dcp-design-react 1.8.17 → 1.8.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/tour/style/index.less +183 -183
- package/package.json +1 -1
package/lib/index.full.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={787:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{Affix:()=>P.Affix,Alert:()=>P.Alert,Anchor:()=>P.Anchor,AutoComplete:()=>P.AutoComplete,Avatar:()=>P.Avatar,BackTop:()=>P.BackTop,Badge:()=>P.Badge,Breadcrumb:()=>P.Breadcrumb,Button:()=>P.Button,Calendar:()=>L,Card:()=>P.Card,Carousel:()=>P.Carousel,Cascader:()=>P.Cascader,Checkbox:()=>P.Checkbox,Col:()=>P.Col,Collapse:()=>P.Collapse,Comment:()=>P.Comment,ConfigProvider:()=>P.ConfigProvider,DatePicker:()=>D,DcpAnchor:()=>Gt,DcpButton:()=>he,DcpCollapse:()=>_e,DcpConfigProvider:()=>X,DcpCopyToClipboard:()=>rc,DcpCountup:()=>ut,DcpCropper:()=>zl,DcpDivider:()=>Ie,DcpDownload:()=>_t,DcpDrawer:()=>ar,DcpEmpty:()=>ht,DcpForm:()=>vl,DcpGuideTracker:()=>Yu,DcpLazyLoad:()=>td,DcpModal:()=>ur,DcpPrint:()=>Tu,DcpRangeTableHelper:()=>kc,DcpScrollbar:()=>Pt,DcpSearchHelper:()=>vc,DcpSearchTree:()=>po,DcpSpace:()=>xe,DcpSpin:()=>gt,DcpSplit:()=>at,DcpTable:()=>gc,DcpTabs:()=>er,DcpTinymce:()=>ql,DcpTour:()=>au,DcpTransition:()=>cu,DcpTreeHelper:()=>Ic,DcpTreeTableHelper:()=>Nc,DcpUploadFile:()=>Gl,DcpUploadImg:()=>to,DcpWatermark:()=>Xu,Descriptions:()=>P.Descriptions,Divider:()=>P.Divider,Drawer:()=>P.Drawer,Dropdown:()=>P.Dropdown,Empty:()=>P.Empty,Form:()=>P.Form,Grid:()=>P.Grid,Image:()=>P.Image,Input:()=>P.Input,InputNumber:()=>P.InputNumber,Layout:()=>P.Layout,List:()=>P.List,Mentions:()=>P.Mentions,Menu:()=>P.Menu,Modal:()=>P.Modal,PageHeader:()=>P.PageHeader,Pagination:()=>P.Pagination,Popconfirm:()=>P.Popconfirm,Popover:()=>P.Popover,Progress:()=>P.Progress,QmAnchor:()=>Gt,QmButton:()=>he,QmCollapse:()=>_e,QmConfigProvider:()=>X,QmCopyToClipboard:()=>rc,QmCountup:()=>ut,QmCropper:()=>zl,QmDivider:()=>Ie,QmDownload:()=>_t,QmDrawer:()=>ar,QmEmpty:()=>ht,QmForm:()=>vl,QmGuideTracker:()=>Yu,QmLazyLoad:()=>td,QmModal:()=>ur,QmPrint:()=>Tu,QmRangeTableHelper:()=>kc,QmScrollbar:()=>Pt,QmSearchHelper:()=>vc,QmSearchTree:()=>po,QmSpace:()=>xe,QmSpin:()=>gt,QmSplit:()=>at,QmTable:()=>gc,QmTabs:()=>er,QmTinymce:()=>ql,QmTour:()=>au,QmTransition:()=>cu,QmTreeHelper:()=>Ic,QmTreeTableHelper:()=>Nc,QmUploadFile:()=>Gl,QmUploadImg:()=>to,QmWatermark:()=>Xu,Radio:()=>P.Radio,Rate:()=>P.Rate,Result:()=>P.Result,Row:()=>P.Row,Segmented:()=>P.Segmented,Select:()=>P.Select,Skeleton:()=>P.Skeleton,Slider:()=>P.Slider,Space:()=>P.Space,Spin:()=>P.Spin,Statistic:()=>P.Statistic,Steps:()=>P.Steps,Switch:()=>P.Switch,Table:()=>P.Table,Tabs:()=>P.Tabs,Tag:()=>P.Tag,TimePicker:()=>M,Timeline:()=>P.Timeline,Tooltip:()=>P.Tooltip,Transfer:()=>P.Transfer,Tree:()=>P.Tree,TreeSelect:()=>P.TreeSelect,Typography:()=>P.Typography,Upload:()=>P.Upload,message:()=>P.message,notification:()=>P.notification,pinyin:()=>Gr,version:()=>rd});var e=n(787),t=n.n(e);const r=require("prop-types");var i=n.n(r);const l=(0,e.createContext)({locale:"zh-cn",size:"middle"}),o=require("dayjs");var s=n.n(o);const c={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传"},uploadCropper:{dragableText:"拖放或点击",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let u=c;function d(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,a]=t;let i;const l=n.split(".");let o=u;for(let e=0,t=l.length;e<t;e++){if(i=o[l[e]],e===t-1)return d(i,a);if(!i)return"";o=i}return""},m=e=>{u=e||u,u.name&&s().locale(u.name)};class h extends Error{constructor(e){super(e),this.name="QmDesignError"}}function f(e,t){throw new h(`[${e}] ${t}`)}function g(e,t){console.warn(new h(`[${e}] ${t}`))}const b=e=>["","small","middle","large"].includes(e),y=require("dayjs/plugin/localeData");var v=n.n(y);const x=require("dayjs/plugin/advancedFormat");var E=n.n(x);const S=require("dayjs/plugin/customParseFormat");var C=n.n(S);const w=require("dayjs/plugin/quarterOfYear");var N=n.n(w);const T=require("dayjs/plugin/weekOfYear");var I=n.n(T);const R=require("dayjs/plugin/weekday");var O=n.n(R);s().extend(v()),s().extend(E()),s().extend(C()),s().extend(N()),s().extend(I()),s().extend(O());const P=require("antd"),A=require("rc-picker/es/generate/dayjs");var k=n.n(A);const F=require("antd/es/calendar/generateCalendar");var H=n.n(F);require("antd/es/calendar/style");const L=H()(k()),$=require("antd/es/date-picker/generatePicker");var _=n.n($);require("antd/es/date-picker/style/index");const D=_()(k());function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},q.apply(this,arguments)}const j=e.forwardRef(((t,r)=>e.createElement(D,q({},t,{picker:"time",mode:void 0,ref:r}))));j.displayName="TimePicker";const K=e.forwardRef(((t,r)=>e.createElement(D.RangePicker,q({},t,{picker:"time",mode:void 0,ref:r}))));K.displayName="RangePicker",j.RangePicker=K;const M=j,V={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload"},uploadCropper:{dragableText:"Drop or click",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},z=require("antd/es/locale/zh_CN");var U=n.n(z);const B=require("antd/es/locale/en_GB");function W(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const G={[V.name]:{qm:V,antd:n.n(B)()},[c.name]:{qm:c,antd:U()}};class Y extends e.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},m(Object.assign({},G,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:a,size:i,global:l}=e;return a!==r&&m(Object.assign({},G,l.langPackage)[a].qm),a!==r||i!==n?{value:Object.assign({},t.value,{locale:a,size:i})}:null}render(){const{global:e}=this.props,{value:r}=this.state,n=Object.assign({},G,e.langPackage);return t().createElement(l.Provider,{value:r},t().createElement(P.ConfigProvider,{locale:n[r.locale].antd,componentSize:r.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}W(Y,"propTypes",{locale:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:i().string,global:i().object}),W(Y,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const X=Y,Q=require("omit.js");var Z=n.n(Q);const J=require("lodash-es"),ee="undefined"==typeof window,te=e=>t().isValidElement(e),re=e=>te(e)&&e.type===t().Fragment,ne=()=>{},ae=()=>!0,ie=async e=>new Promise((t=>setTimeout(t,e))),le=e=>{Promise.resolve().then(e)},oe=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),se=e=>!!(!e&&0!==e||(0,J.isArray)(e)&&!e.length||(0,J.isPlainObject)(e)&&!Object.keys(e).length),ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,J.isPlainObject)(e)||(0,J.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(a||e,((r,i)=>{a&&(i=r),n[i]=ce(e[i],t)})),n}return e},ue=e=>(0,J.isNumber)(e)?`${e}px`:e.toString();function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},de.apply(this,arguments)}function pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class me extends e.Component{constructor(){super(...arguments),pe(this,"state",{isLoading:!1}),pe(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){g("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:r,authConfig:n,click:a,confirm:i}=this.props,{isLoading:l}=this.state,o=e||this.context.size||"",s=(0,J.isFunction)(a)?{onClick:this.clickHandle}:null,c={...Z()(this.props,["authConfig","click","confirm"]),size:o,loading:l||r||!1,...s};if(n){const{visible:e=1,disabled:t}=n||{};if(!e)return null;t&&(c.disabled=!0)}return i?t().createElement(P.Popconfirm,{title:i.title||p("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{i.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},t().createElement(P.Button,de({},c,{onClick:ne}),this.props.children)):t().createElement(P.Button,c,this.props.children)}}pe(me,"propTypes",{click:i().func,confirm:i().shape({title:i().node,onConfirm:i().func,onCancel:i().func})}),pe(me,"contextType",l);const he=me;var fe,ge,be,ye=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ye||{});class ve extends e.Component{render(){const{size:e}=this.props,r=e||this.context.size||"",n=(0,J.isNumber)(e)?e:ye[e||r||"default"],a={...this.props,size:n};return t().createElement(P.Space,a,this.props.children)}}fe=ve,be=l,(ge=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(ge="contextType"))in fe?Object.defineProperty(fe,ge,{value:be,enumerable:!0,configurable:!0,writable:!0}):fe[ge]=be;const xe=ve,Ee=require("classnames");var Se=n.n(Ee);const Ce=e=>`qm-${e}`,we=require("@ant-design/icons");function Ne(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Te extends e.Component{constructor(){super(...arguments),Ne(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=ne}=this.props;t(!e)}))}render(){const{size:e,label:r,extra:n,collapse:a,bordered:i,disabled:l,id:o,className:s,style:c}=this.props,u=e||this.context.size||"",d=Ce("divider"),m={[d]:!0,[`${d}-borderless`]:!i,[`${d}--lg`]:"large"===u,[`${d}--sm`]:"small"===u};return t().createElement("div",{id:o,className:Se()(m,s),style:c},t().createElement("span",{className:Se()(`${d}__title`)},r),t().createElement("div",{className:Se()(`${d}__extra`)},n),void 0!==a&&t().createElement(P.Button,{type:"link",className:Se()(`${d}__collapse`),disabled:l,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}Ne(Te,"contextType",l),Ne(Te,"propTypes",{label:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:i().oneOfType([i().element,i().string]),collapse:i().bool,bordered:i().bool}),Ne(Te,"defaultProps",{bordered:!0});const Ie=Te,Re=()=>({height:0,opacity:0}),Oe=(e,t)=>"height"===t.propertyName,Pe={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"},Ae=require("rc-motion");var ke=n.n(Ae);const Fe=t().forwardRef(((e,r)=>{const{forceRender:n,className:a,style:i,boxStyle:l,isActive:o}=e,[s,c]=t().useState(o||n);if(t().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const u=Ce("collapse");return t().createElement("div",{ref:r,className:Se()(`${u}-content`,{[`${u}-content-active`]:o,[`${u}-content-inactive`]:!o},a),style:i},t().createElement("div",{className:`${u}-content-box`,style:l},e.children))}));Fe.displayName="PanelContent";const He=Fe;function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Le.apply(this,arguments)}const $e=e=>{const{defaultActive:r,label:n,extra:a,className:i,style:l,containerStyle:o,bordered:s,disabled:c,forceRender:u,destroyOnClose:d=!1,onChange:p}=e,[m,h]=t().useState(!!r),f=Ce("collapse"),g=Se()({[`${f}`]:!0,[`${f}-active`]:m,[`${f}-disabled`]:c},i);return t().createElement("div",{className:g,style:l},t().createElement(Ie,{label:n,extra:a,collapse:m,bordered:s,disabled:c,onCollapseChange:e=>{h(e),p?.(e)}}),t().createElement(ke(),Le({visible:m},Pe,{leavedClassName:`${f}-content-hidden`,forceRender:u,removeOnLeave:d}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(He,{ref:n,prefixCls:f,className:a,style:i,boxStyle:o,isActive:m,forceRender:u},e.children)})))};$e.displayName="QmCollapse";const _e=$e,De=t().createContext(void 0);function qe(t,r){((r,n)=>{const a=e.useRef(!0);e.useEffect((()=>(e=>{if(!e)return t()})(a.current)),n),e.useEffect((()=>(a.current=!1,()=>{a.current=!0})),[])})(0,r)}const je=require("react-draggable");var Ke=n.n(je);const Me=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Ve=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},ze=e=>e.stopPropagation(),Ue=e=>e.preventDefault(),Be=(e,t,r)=>{!ee&&e&&t&&((0,J.isPlainObject)(t)?Object.keys(t).forEach((r=>{Be(e,r,t[r])})):(t=oe(t),e.style[t]=r))},We=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},Ge=(e,t)=>Math.abs(We(e)-We(t)),Ye=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Xe=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},Qe=(e,t)=>{if(ee||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Ze=e=>{const{minValues:r,onDragChange:n,onDragging:a}=e,{splitRef:i,direction:l}=t().useContext(De),[o,s]=t().useState(),[c,u]=t().useState(0),d="vertical"===l?"y":"x",m={[`${Ce("split")}__resize-bar`]:!0,vertical:"vertical"===l,horizontal:"horizontal"===l};return t().createElement(Ke(),{bounds:o,axis:d,position:{x:0,y:0},positionOffset:{[d]:-1*c},onStart:()=>{n(!0),(()=>{const e=i.current.children[0];if(!e)return;const t=(()=>{const{w:e,h:t}={w:i.current.offsetWidth,h:i.current.offsetHeight};return[r[0],("vertical"===l?t:e)-r[1]]})(),n=e.offsetWidth,a=e.offsetHeight;s({left:t[0]-n,right:t[1]-n,top:t[0]-a,bottom:t[1]-a})})()},onDrag:(e,t)=>{u(t[d]),a(t[d])},onStop:()=>n(!1)},t().createElement("div",{className:Se()(m),title:p("qm.split.resize")}))};Ze.displayName="ResizeBar";const Je=Ze,et=t().forwardRef(((e,r)=>{const{offset:n,className:a,style:i}=e,{direction:l,dragging:o}=t().useContext(De),s="vertical"===l?"height":"width",c={[Ce("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===l,vertical:"vertical"===l,[a]:!!a},u=void 0!==n?{[s]:ue(n)}:{flex:1,[s]:0};return t().createElement("div",{ref:r,className:Se()(c),style:{...u,...i}},e.children)}));et.displayName="QmSplitPane";const tt=et;function rt(){return rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rt.apply(this,arguments)}const nt=e=>{const{direction:r="horizontal",defaultValue:n="50%",uniqueKey:a,className:i,style:o,onDragStart:s,onDrag:c=ne,onDragEnd:u}=e,{global:d}=t().useContext(l),p=t().useRef(null),m=t().useRef(null),h=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=t().useMemo((()=>a?`split_${a}`:""),[a]),[y,v]=t().useState(!1),[x,E]=t().useState(h(n)),S=t().useRef(0);qe((()=>{y?(S.current="vertical"===r?m.current.offsetHeight:m.current.offsetWidth,s?.(f(x))):(u?.(f(x)),localStorage.setItem(b,x),N(b,x))}),[y]),t().useEffect((()=>{C()}),[]);const C=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(h(e)):w(b).then((e=>{localStorage.setItem(b,h(e||n)),C()})).catch((()=>{}))},w=async e=>{const t=d?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},N=async(e,t)=>{const r=d?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},T=t().useMemo((()=>({splitRef:p,direction:r,dragging:y})),[r,y]),I=[];t().Children.map(e.children,(e=>{te(e)&&!re(e)&&"QmSplitPane"===e.type?.displayName&&I.push(e)}));const[R,O]=I,P=t().useMemo((()=>[g(R),g(O)]),[R,O]),A={[Ce("split")]:!0,vertical:"vertical"===r};return t().createElement(De.Provider,{value:T},t().createElement("div",{ref:p,className:Se()(A,i),style:o},t().createElement(tt,rt({},R.props,{ref:m,offset:x})),t().createElement(Je,{minValues:P,onDragChange:e=>v(e),onDragging:e=>{const t=S.current+e;E(`${t}px`),c(t)}}),t().createElement(tt,O.props)))};nt.Pane=tt,nt.displayName="QmSplit";const at=nt,it=require("react-countup");var lt=n.n(it);function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ot.apply(this,arguments)}function st(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ct extends e.Component{render(){const{size:e,className:r,style:n}=this.props,a=e||this.context.size||"",i=Ce("countup"),l={[i]:!0,[`${i}--lg`]:"large"===a,[`${i}--sm`]:"small"===a};return t().createElement(lt(),ot({},this.props,{className:Se()(l,r),style:n}),this.props.children)}}st(ct,"defaultProps",{duration:2}),st(ct,"contextType",l);const ut=ct;function dt(){return dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dt.apply(this,arguments)}function pt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mt extends e.Component{render(){const{size:e,className:r}=this.props,n=e||this.context.size||"",a=Ce("empty"),i={...this.props,image:P.Empty.PRESENTED_IMAGE_SIMPLE},l={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return t().createElement(P.Empty,dt({},i,{className:Se()(l,r)}))}}pt(mt,"contextType",l),pt(mt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const ht=mt;class ft extends e.Component{render(){const{fullHeight:e,className:r,style:n={}}=this.props,a={[`${Ce("spin")}-full-height`]:e},i={wrapperClassName:Se()(a,r),...Z()(this.props,["fullHeight"]),style:{...n,maxHeight:"none"}};return t().createElement(P.Spin,i,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ft,"defaultProps",{tip:"Loading...",fullHeight:!1});const gt=ft,bt=t().createContext(void 0),yt=require("resize-observer-polyfill");var vt=n.n(yt);const xt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},Et=function(e,t){!ee&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(vt())(xt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},St=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Ct(t){const[r,n]=e.useState({width:0,height:0});return e.useEffect((()=>{const e=t.current,r=e=>{const{width:t,height:r}=e.contentRect;n({width:t,height:r})};return e&&Et(e,r),()=>{e&&St(e,r)}}),[t]),r}function wt(t,r){var n=this;const a=e.useRef(null);return e.useEffect((()=>()=>{clearTimeout(a.current),a.current=null}),[]),function(){for(var e=arguments.length,i=new Array(e),l=0;l<e;l++)i[l]=arguments[l];a.current&&clearTimeout(a.current),a.current=setTimeout((()=>t.apply(n,i)),r)}}const Nt=6,Tt={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},It=e=>{const{thumb:r,always:n,barSize:a=Nt,direction:i="vertical",onDrag:l=ne}=e,{dragging:o,scrollbarElement:s,wrapElement:c}=t().useContext(bt),u=Tt[i],d=t().useRef(r),p=t().useRef(null),m=t().useRef(null),h=t().useRef({}),f=t().useRef(!1),g=t().useRef(!1),b=t().useRef(ee?null:document.onselectstart),[y,v]=t().useState(!1);t().useEffect((()=>{d.current=r}),[r]),t().useEffect((()=>{const e=s.current;return Me(e,"mousemove",C),Me(e,"mouseleave",w),()=>{S(),Ve(document,"mouseup",E),Ve(e,"mousemove",C),Ve(e,"mouseleave",w)}}),[]);const x=e=>{if(!p.current||!m.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/p.current[u.offset];c.current[u.scroll]=r*c.current[u.scrollSize]/100,l(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},Ve(document,"mousemove",x),Ve(document,"mouseup",E),S(),g.current&&v(!1),l(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},C=()=>{g.current=!1,v(!!d.current.size)},w=()=>{g.current=!0,v(f.current)},N=Ce("scrollbar"),T={[`${N}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},I={[u.reverse]:a},R={[u.size]:r.size,transform:`translate${u.axis}(${r.offset}%)`};return t().createElement(cu,{name:"fade",in:n||o||y,timeout:300},t().createElement("div",{ref:p,className:Se()(T),style:I},t().createElement("div",{ref:m,className:`${N}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Me(document,"mousemove",x),Me(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},Rt=20,Ot=t().forwardRef(((e,r)=>{const{wrapClassName:n,wrapStyle:a,barWidth:i,always:l,native:o,minSize:s=Rt,onScroll:c}=e,u=t().useRef(null),d=t().useRef(null),p=t().useRef(null),[m,h]=t().useState({size:0,offset:0,ratio:1}),[f,b]=t().useState({size:0,offset:0,ratio:1}),[y,v]=t().useState(!1),x=Ct(u),E=Ct(p);qe((()=>{!o&&S()}),[E.width,E.height,x.width,x.height]);const S=wt((()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=e**2/d.current.scrollHeight,n=t**2/d.current.scrollWidth,a=Math.max(r,s),i=Math.max(n,s),l=r/(e-r)/(a/(e-a)),o=n/(t-n)/(i/(t-i)),c=a+4<e?a:0,u=i+4<t?i:0,p=100*d.current.scrollTop/e*l,g=100*d.current.scrollLeft/t*o;h(Object.assign({},m,{size:u,ratio:o,offset:g})),b(Object.assign({},f,{size:c,ratio:l,offset:p}))}),5),C=e=>{v(e)},w=e=>{(0,J.isNumber)(e)?d.current.scrollTop=e:g("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},N=e=>{(0,J.isNumber)(e)?d.current.scrollLeft=e:g("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t().useImperativeHandle(r,(()=>({container:u.current,scrollTop:d.current?.scrollTop||0,scrollLeft:d.current?.scrollLeft||0,SET_SCROLL_TOP:w,SET_SCROLL_LEFT:N})));const T=t().useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:d})),[y]),I=Ce("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!o};return t().createElement("div",{ref:u,className:Se()(I,e.className),style:e.style},t().createElement("div",{ref:d,className:Se()(R,n),style:a,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=100*d.current.scrollTop/e*f.ratio,n=100*d.current.scrollLeft/t*m.ratio;h(Object.assign({},m,{offset:n})),b(Object.assign({},f,{offset:r}))})(),c?.({scrollTop:t,scrollLeft:r})}},t().createElement("div",{ref:p,className:`${I}__view`},e.children)),!o&&t().createElement(bt.Provider,{value:T},t().createElement(It,{direction:"horizontal",thumb:m,barSize:i,always:l,onDrag:C}),t().createElement(It,{direction:"vertical",thumb:f,barSize:i,always:l,onDrag:C})))}));Ot.displayName="QmScrollbar";const Pt=Ot,At=require("axios");var kt=n.n(At);const Ft=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Ht(){return Ht=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ht.apply(this,arguments)}function Lt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class $t extends e.Component{constructor(){super(...arguments),Lt(this,"state",{loading:!1}),Lt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,beforeDownload:t=ae}=this.props,r=(0,J.isString)(e)?e:await this.getActionUrl();if(!r)return g("Download","参数 `action` 有误!");if(!t(r))return;await this.downloadFile(r),await ie(100),this.props.onSuccess?.(),P.message.success(p("qm.download.success"))}catch(e){this.props.onError?.(e),P.message.error(p("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}async downloadFile(e){const{fileName:t,headers:r,params:n,withCredentials:a}=this.props,i=await kt()({url:e,params:n,headers:r,withCredentials:a,responseType:"blob",timeout:0}),l=i.data,o=i.headers["content-disposition"],s=t||(o?o.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Ft(l,s)}render(){const{size:e}=this.props,{loading:r}=this.state,n=e||this.context.size||"",a=Z()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t().createElement(P.Button,Ht({},a,{size:n,loading:r,onClick:this.downloadHandle}),this.props.children)}}Lt($t,"propTypes",{action:i().oneOfType([i().string,i().shape({api:i().func.isRequired,params:i().object})]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:i().string,headers:i().object,withCredentials:i().bool,params:i().object,beforeDownload:i().func,onSuccess:i().func,onError:i().func}),Lt($t,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),Lt($t,"contextType",l);const _t=$t,Dt=require("add-dom-event-listener");var qt=n.n(Dt);const jt=require("scroll-into-view-if-needed");var Kt=n.n(jt);class Mt extends e.Component{renderLabel(){const{activeKey:e,labels:r,onTabClick:n}=this.props;return r.map(((r,a)=>{const i={item:!0,actived:a===e};return t().createElement("div",{key:a,className:Se()(i),onClick:e=>n(a,e)},t().createElement("span",null,r))}))}render(){return t().createElement(t().Fragment,null,this.renderLabel())}}const Vt=Mt;class zt extends e.Component{render(){const{label:e,showDivider:r,className:n,style:a}=this.props,i={[Ce("anchor-item")]:!0};return t().createElement("div",{className:Se()(i,n),style:a},r&&t().createElement(Ie,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(zt,"displayName","QmAnchorItem");const Ut=zt;function Bt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wt extends e.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(t){super(t),Bt(this,"currentState","ready"),Bt(this,"itemsTotal",void 0),Bt(this,"timer",void 0),Bt(this,"scrollEvent",void 0),Bt(this,"scrollRef",(0,e.createRef)()),Bt(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),Bt(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Kt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),Bt(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)})),this.state={activeKey:t.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=qt()(this.scrollRef.current,"scroll",(0,J.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=Ge(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>Ge(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const a=r[e],i=r[e+1]||1e4;t>=a-1&&t<i&&(n=e)}return n}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:r,labelWidth:n,tabPosition:a,labelList:i=[],onTabClick:l,className:o,style:s}=this.props,c=r||this.context.size||"",u=Ce("anchor"),d={[u]:!0,[`${u}-left`]:"left"===a,[`${u}-top`]:"top"===a,[`${u}--lg`]:"large"===c,[`${u}--sm`]:"small"===c},p=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const m=this.__is_conf?i.map((e=>e.label)):p.map((e=>e.props.label)),h=this.__is_conf?i.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=m.length,t().createElement("div",{className:Se()(d,o),style:s},t().createElement("div",{className:Se()("anchor-nav"),style:{width:n?ue(n):""}},t().createElement(Vt,{activeKey:e,labels:m,onTabClick:(e,t)=>{this.onTabClickHandle(e),l?.({label:m[e],id:h[e]},t)}})),t().createElement("div",{ref:this.scrollRef,className:Se()("anchor-container")},this.__is_conf?this.props.children:p))}}Bt(Wt,"Item",Ut),Bt(Wt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:i().arrayOf(i().shape({id:i().string,label:i().string}))}),Bt(Wt,"defaultProps",{tabPosition:"left"}),Bt(Wt,"contextType",l);const Gt=Wt;class Yt extends e.Component{render(){return t().createElement(P.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Yt,"displayName","QmTabPane");const Xt=Yt;function Qt(){return Qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qt.apply(this,arguments)}function Zt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Jt extends e.Component{render(){const{items:e,size:r,tabPosition:n,tabBarGutter:a,className:i,authConfig:l}=this.props,o=r||this.context.size||"",s=Ce("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===o,[`${s}--sm`]:"small"===o},u={...Z()(this.props,["items","authConfig"]),size:o,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},d=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmTabPane"===e.type?.displayName&&d.push(e)}));const p=e?[...e]:d.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(l){const{fieldList:e=[]}=l||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(p.splice(t,1),t--)}}return t().createElement(P.Tabs,Qt({},u,{items:p,className:Se()(c,i)}))}}Zt(Jt,"TabPane",Xt),Zt(Jt,"contextType",l),Zt(Jt,"defaultProps",{tabPosition:"top"});const er=Jt;function tr(){return tr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tr.apply(this,arguments)}function rr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class nr extends e.Component{constructor(){super(...arguments),rr(this,"titleRef",t().createRef()),rr(this,"$drawer",null),rr(this,"opened",!1),rr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),rr(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,J.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),rr(this,"toggleHandle",(()=>{this.$drawer=Xe(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),rr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),rr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,l=n??r,o=e.open??e.visible,{fullscreen:s}=this.state;l&&l!==o&&(!i&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Be(this.$drawer,s?{width:"100%"}:{width:ue(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:r,showHeader:n,showFullScreen:a}=this.props;return t().createElement(t().Fragment,null,t().createElement("span",{ref:this.titleRef,className:Se()("text")},n&&r),a&&t().createElement("button",{type:"button",className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r}=this.state,{visible:n,open:a,size:i,className:l,loading:o,showHeader:s,maskClosable:c,onClose:u}=this.props,d=this.context.global,p=i||this.context.size||"",m=Ce("drawer"),h={[m]:!0,"no-header":!s,[`${m}--lg`]:"large"===p,[`${m}--sm`]:"small"===p};return t().createElement(P.Drawer,tr({},Z()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:c??d?.maskClosable??!1,className:Se()(h,l),title:this.renderTitle(),footer:null,onClose:u,afterOpenChange:this.afterVisibleChange}),this.props.children,(o||r||e)&&t().createElement(gt,{spinning:!0,className:Se()("spinning")}))}}rr(nr,"contextType",l),rr(nr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),rr(nr,"defaultProps",{width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null});const ar=nr;function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ir.apply(this,arguments)}function lr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const or="10vh";var sr=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(sr||{});class cr extends e.Component{constructor(){super(...arguments),lr(this,"$event",null),lr(this,"draggleRef",t().createRef()),lr(this,"opened",!1),lr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),lr(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=qt()(document.body,"mousedown",ze))})),lr(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),lr(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1}})})),lr(this,"toggleHandle",(e=>{const t=Xe(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{width:n,height:a,showHeader:i}=this.props,{fullscreen:l}=this.state;l?(Be(t,{width:ue(n||"60%"),height:"auto",top:or}),Be(r,{height:a?ue(a):this.defaultHeight,maxHeight:"auto"===a?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${sr[i?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),lr(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),lr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),lr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${or} - ${or} - ${sr[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,stopMouseDownEvent:i,destroyOnClose:l}=this.props,o=n??r,s=e.open??e.visible,{fullscreen:c}=this.state;if(o&&o!==s){if(!l&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0}),i&&this.addMouseDownEvent(),!l&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,J.isUndefined)(a)&&this.setState({spinning:!1})}),400)}o||this.removeMouseDownEvent(),c!==t.fullscreen&&(c?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:r}=this.state,{title:n,showHeader:a,showFullScreen:i}=this.props;return t().createElement("div",{onMouseOver:()=>{r&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t().createElement("span",{className:Se()("text")},a&&n),i&&t().createElement("button",{type:"button",className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r,fullscreen:n,disabled:a,bounds:i,position:l}=this.state,{visible:o,open:s,height:c,className:u,loading:d,draggable:p,showHeader:m,maskClosable:h,bodyStyle:f,onClose:g}=this.props,b=this.context.global,y=Ce("modal"),v={height:c?ue(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},x={[y]:!0,"no-header":!m,[`${y}--lg`]:"large"===this.$size,[`${y}--sm`]:"small"===this.$size};return t().createElement(P.Modal,ir({},Z()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??o,maskClosable:h??b?.maskClosable??!1,className:Se()(x,u),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},v,f),onCancel:g,afterClose:this.afterVisibleChange,modalRender:e=>t().createElement(Ke(),{disabled:!p||a||n,bounds:i,position:l,onStart:(e,t)=>this.onStart(e,t)},t().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(d||r||e)&&t().createElement(gt,{spinning:!0,className:Se()("spinning")}))}}lr(cr,"contextType",l),lr(cr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),lr(cr,"defaultProps",{width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:or}});const ur=cr,dr=require("memoize-one");var pr=n.n(dr);const mr=(0,e.createContext)(void 0),hr=80,fr="1",gr="0",br=400,yr=["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"],vr={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 xr=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),Er=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),Sr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Cr={items:i().arrayOf(i().shape({type:i().string.isRequired,fieldName:i().string.isRequired})),initialValues:i().object,initialExtras:i().object,layout:i().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:i().number,customClass:i().string,compactMode:i().bool,labelWidth:i().oneOfType([i().number,i().string]),labelAlign:i().oneOf(["left","right"]),labelWrap:i().bool,formType:i().oneOf(["default","search","onlyShow"]),disabled:i().bool,uniqueKey:i().string,defaultRows:i().number,defaultExpand:i().bool,searchButtonCols:i().number,scrollToFirstError:i().bool,authConfig:i().object,isAutoFocus:i().bool,isCollapse:i().bool,isFieldsDefine:i().bool,isSearchBtn:i().bool,isSubmitBtn:i().bool,fieldsChange:i().func,onValuesChange:i().func,onFieldsChange:i().func,onFinish:i().func,onFinishFailed:i().func,onReset:i().func,onCollapse:i().func},wr={layout:"horizontal",labelWidth:hr,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:ne,onFieldsChange:ne,onFinish:ne,onFinishFailed:ne,onReset:ne,onCollapse:ne,onFormItemsChange:ne},Nr=(e,t)=>{if(!e)return null;if(t===Er.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===Er.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?s()().year(Number(t[1])).quarter(Number(t[2])):null}return s()(e,t)},Tr=(e,t)=>e?s()(e).format(t):"",Ir=e=>""===e||null==e,Rr=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},Or=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Pr=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Ar=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),e.isLeaf&&(n.isLeaf=!0),!(0,J.isUndefined)(e.selectable)&&(n.selectable=e.selectable),Array.isArray(e.children)&&(n.children=Ar(e.children,t,r)),n})),kr=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=kr(r.children,t);if(e)return e}}return null},Fr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...Fr(e.children,t,r+1))})),n},Hr=(e,t,r,n)=>{const a={};return a.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Lr={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{曾:"ZENG",沈:"SHEN",嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬤:"MO",嬷:"MO",蹒:"PAN",蹊:"XI",丬:"PAN",霰:"XIAN",莘:"XIN",豉:"CHI",饧:"XING",筠:"JUN",长:"CHANG",帧:"ZHEN",峙:"SHI",郍:"NA",芎:"XIONG",谁:"SHUI"}},$r="阿",_r="鿿",Dr=1,qr=2,jr=3;let Kr,Mr=null;function Vr(e){return e||null===Mr?("object"==typeof Intl&&Intl.Collator?(Kr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Mr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Mr=!1,Mr):Mr}function zr(e){const t=Lr.UNIHANS,r=Lr.PINYINS,n=Lr.EXCEPTIONS,a={source:e};if(e in n)return a.type=qr,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=Dr,a.target=e,a;if(i=Kr.compare(e,$r),i<0)return a.type=jr,a.target=e,a;if(0===i)a.type=qr,l=0;else{if(i=Kr.compare(e,_r),i>0)return a.type=jr,a.target=e,a;0===i&&(a.type=qr,l=t.length-1)}if(a.type=qr,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=Kr.compare(e,a),0===i)break;i>0?r=l+1:n=l-1}}return i<0&&l--,a.target=r[l],a.target||(a.type=jr,a.target=a.source),a}function Ur(e){return"string"==typeof e&&Vr()?e.split("").map((e=>zr(e))):e}const Br={isSupported:Vr,parse:Ur,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Lr)})))},genToken:zr,convertToPinyin:(e,t,r)=>Ur(e).map((e=>t&&e.type===qr?e.target.toLowerCase():e.target)).join(r||"")},Wr={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}};Br.isSupported()&&Wr.shouldPatch(Br.genToken)&&Br.patchDict(Wr);const Gr=Br,Yr=e=>{const{value:r,bordered:n}=e;return t().createElement(P.Input,{value:r,title:r,bordered:n,readOnly:!0})};Yr.displayName="FormItemView";const Xr=Yr;function Qr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zr(){return Zr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zr.apply(this,arguments)}const{Option:Jr}=P.Select,en=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{fieldName:c,options:u={},style:d={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:b}=e.option,{itemList:y=[],filterable:v=!0,listHeight:x=br,collapseTags:E,maxTagTextLength:S,openPyt:C=!0}=u,w=se(y)?a:y,N=e=>i?w.filter((t=>e?.includes(t.value))).map((e=>e.text)).join(","):w.find((t=>t.value===e))?.text||"";return r.isOnlyShow?t().createElement(Xr,{value:N(n),bordered:h}):t().createElement(P.Select,Zr({value:n,mode:i?"multiple":void 0,popupClassName:`form-popper__${c}`,placeholder:m,style:d,loading:l,bordered:h,allowClear:f,disabled:b,showSearch:v,listHeight:x,maxTagCount:E?"responsive":void 0,maxTagTextLength:S},i?{title:N(n)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,N(e),w)})(e)}}),w.map((e=>t().createElement(Jr,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class tn extends e.Component{constructor(){super(...arguments),Qr(this,"state",{itemList:[],loading:!1}),Qr(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:u=e.props.labelWidth,className:d,extra:p,buttonAfter:m,validateTrigger:h,rules:f=[],onChange:g=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(i),className:Se()(d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},required:e.getFormItemRequired(f)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(en,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(o,r)}}))),m&&t().createElement(P.Col,null,e.renderFormItemButton(o,m)),p&&t().createElement(P.Col,{flex:ue(p.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Qr(tn,"contextType",mr);const rn=tn,nn=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:u=r.isFormDisabled}=e.option,{labelToCheckbox:d,falseValue:m=gr,trueValue:h=fr}=o;return t().createElement(P.Checkbox,{checked:n===h,style:s,disabled:u||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:m)}},d?l:null)};class an extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option,{labelToCheckbox:h}=o;return t().createElement(P.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(nn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(an,"contextType",mr);const ln=an,on=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],sn={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)on.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},cn=["==","<",">","<=",">=","!=","like","likes","in","nin"],un=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)cn.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),cn.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},dn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,pn=["string","number","boolean","symbol"],mn=e=>pn.includes(typeof e),hn=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),fn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(dn,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(fn(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(fn(t))));break;case"in":mn(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":mn(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(hn(e)?e.slice(0,10):e)!=r;break;case"<":n=(hn(e)?e.slice(0,10):e)<r;break;case"<=":n=(hn(e)?e.slice(0,10):e)<=r;break;case">":n=(hn(e)?e.slice(0,10):e)>r;break;case">=":n=(hn(e)?e.slice(0,10):e)>=r;break;default:n=(hn(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const gn=sn.stringify,bn=sn.array_format,yn=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},vn=(e,t,r)=>{let n=[];t=sn.replace_symbols(t);try{if(r){const r=new Function("record",`return ${un(t,"record")};`);n=Xn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${un(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){g("Table","组件 `initialFilter` 参数有误!"),n=e}return n},xn=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...xn(e.children)):t.push(e)})),t},En=e=>e.filter((e=>(e.children&&(e.children=En(e.children)),!e.hidden&&!e.noAuth))),Sn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Sn(e.children))})),t},Cn=(e,t)=>e.map((e=>(e.children&&(e.children=Cn(e.children,t)),t?.(e),e))),wn=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=wn(r.children,t);if(e)return e}}return null},Nn=e=>{const t=e.children;return t?t[0].children?Nn(t[0]):t[0]:e},Tn=e=>{const t=e.children;return t?t[t.length-1].children?Tn(t[t.length-1]):t[t.length-1]:e},In=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Rn=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Rn(r.children,t);if(e)return e}}return null},On=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...On(e.children))})),t},Pn=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Sn(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},An=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return An(e.offsetParent,t,r)}return r},kn=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Fn=(e,t)=>(0,J.transform)(e,((e,r,n)=>{(0,J.isEqual)(r,t[n])||(e[n]=(0,J.isPlainObject)(r)&&(0,J.isPlainObject)(t[n])?Fn(r,t[n]):r)})),Hn=(e,t)=>(0,J.intersection)(e,t).length===t.length,Ln=(e,t)=>(0,J.get)(e,t)??"",$n=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},_n=(e,t)=>{if(!t.includes("|"))return Ln(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(Ln(e,t))})),r.every((e=>!e))?"":r.join(" | ")},Dn=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},qn=(e,t)=>{const r=e.toString();if(Number.isNaN(Number.parseFloat(r))||0===t)return e;const n=r.indexOf(".");if(-1===n)return r+"."+"0".repeat(t);const a=Math.max(0,t-(r.length-n-1));return r+"0".repeat(a)},jn=(e,t)=>e?s()(e,t):null,Kn=(e,t)=>e?s()(e).format(t):"",Mn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Vn=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...Vn(e)))):r&&t.push(...Vn(r))}else t.push(e);return t},zn=e=>e.filter((e=>!e._group)),Un=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const l=Array.isArray(i.condition)?bn(i.condition):gn(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],l=e[n];for(const e in l)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?bn(l[e]):gn(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},Bn=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(Ln(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},Wn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=Wn(e[r].children,t);if(n)return[e[r],n].flat()}}},Gn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=Gn(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},Yn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=Yn(r.children,t);if(e)return e}if(t(r))return r}return null},Xn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Xn(e.children,t),t(e)||e.children&&e.children.length))),Qn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Zn=require("react-sortablejs");function Jn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ea extends e.Component{constructor(){super(...arguments),Jn(this,"linkRef",t().createRef()),Jn(this,"state",{visible:!1}),Jn(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Jn(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Jn(this,"resetFieldsHandle",(e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||ce(e);return Object.assign(t,{hidden:e.hidden})}));this.changeHandle(t),this.setLocalFields(t)}))}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,J.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,J.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,J.isEqual)(t,r)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;t?.([...e])}popupRender(){const{items:e}=this.props;return t().createElement(mr.Consumer,null,(r=>{const n=r.$$form;return t().createElement("div",{className:Se()("ant-dropdown-menu","fields-list")},t().createElement("div",{className:"reset"},t().createElement(he,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(n.originItems)},p("qm.table.columnFilter.reset"))),t().createElement(Zn.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const r=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));if((0,J.isEqual)(r,a))return;n.setExpandHandle(!0);const i=Qn(t);this.changeHandle(i),this.setLocalFields(i)}},e.map((r=>t().createElement("li",{key:r.fieldName,className:"item",style:r.noAuth?{display:"none"}:void 0},t().createElement(P.Checkbox,{disabled:r.rules?.findIndex((e=>e.required))>-1,checked:!r.hidden,onChange:t=>{const{checked:n}=t.target;r.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),t().createElement(we.HolderOutlined,{className:"handle",title:p("qm.form.draggable")}),t().createElement("span",{className:"title"},n.getFormItemLabel(r.label||"")))))))}))}render(){const{visible:e}=this.state,r=Ce("form-fields-filter");return t().createElement(mr.Consumer,null,(n=>{const{$size:a}=n.$$form,i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a};return t().createElement(P.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:Se()(i),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},t().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t().createElement(we.UnorderedListOutlined,null)))}))}}Jn(ea,"contextType",l);const ta=ea;function ra(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const na=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(mr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h,onBlur:f=ne,onEnter:g=ne}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:C,autoFocus:w,autoComplete:N,secretType:T}=o,I=T&&(m||h),R=t().useRef(),O=e=>{i?.(e),l(e)},A=v?P.Input.Password:P.Input,k=I?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e}(a,T):a;return n.isOnlyShow?t().createElement(Xr,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:u}):t().createElement(A,{ref:e=>{R.current=e,"function"==typeof r&&r(e)},value:k,autoComplete:v?"new-password":N,autoFocus:w,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:u,allowClear:d,readOnly:m,disabled:h,onBlur:t=>{let r=t.target.value??"";if(C){const e=r.trim();r!==e&&(r=e,O(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),f(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),n.isFilterType&&(n.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,J.isRegExp)(E)&&(t=E.test(t)?t:a??""),S&&(t=t.toUpperCase()),O(t)}})}));na.displayName="VInput";class aa extends e.Component{constructor(){super(...arguments),ra(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,buttonAfter:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(na,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&t().createElement(P.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ra(aa,"contextType",mr);const ia=aa,la=e=>{const{$$form:r}=t().useContext(mr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=e.option,{prefix:m,suffix:h,maxLength:f}=l,g=e=>{const t=e.every((e=>!e))?[]:e;a?.(t),i(t,b(t))},b=e=>e.join(" - ");return r.isOnlyShow?t().createElement(Xr,{value:b(n),bordered:s}):t().createElement(P.Input.Group,null,t().createElement(P.Input,{value:n[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:o[0],prefix:m,suffix:h,maxLength:f,allowClear:c,bordered:s,readOnly:u,disabled:d,onChange:e=>{const{value:t}=e.target;g([t,n[1]])}}),t().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:d,readOnly:!0}),t().createElement(P.Input,{value:n[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:o[1],prefix:m,suffix:h,maxLength:f,bordered:s,allowClear:c,readOnly:u,disabled:d,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class oa extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:u,rules:d=[],onChange:p=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(o)},required:e.getFormItemRequired(d)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(la,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(P.Col,{flex:ue(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(oa,"contextType",mr);const sa=oa,ca=require("big.js");var ua=n.n(ca);function da(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pa=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(mr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:d,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:C=!0,formatter:w,parser:N}=o,T=t().useRef(),I=t().useRef(a),R=e=>{const t=Ir(e)?"":(0,J.isNumber)(e)?e.toFixed(v):new(ua())(e).toFixed(v);return"function"==typeof w?w(t):t},O={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Xr,{value:R(a),bordered:u}):t().createElement(P.InputNumber,{ref:e=>{T.current=e,"function"==typeof r&&r(e)},value:a,className:Se()(O),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:C,precision:v,autoFocus:x,stringMode:E,formatter:w,parser:N,bordered:u,readOnly:d,disabled:m,onBlur:()=>{le((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&(f(a),n.isFilterType&&(n.SUBMIT_FORM(),T.current?.blur()))},onChange:e=>{const t=e??"";!E&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{I.current=e,i?.(e),l(e,R(e))})(t)}})}));pa.displayName="VInputNumber";class ma extends e.Component{constructor(){super(...arguments),da(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,buttonAfter:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(pa,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&t().createElement(P.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}da(ma,"contextType",mr);const ha=ma,fa=e=>{const{$$form:r}=t().useContext(mr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=e.option,{step:m=1,min:h=0,max:f,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=l,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];a?.(t),i(t,C(t))},C=e=>Ir(e)?"":e.map((e=>Ir(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return r.isOnlyShow?t().createElement(Xr,{value:C(n),bordered:s}):t().createElement(P.Input.Group,null,t().createElement(P.InputNumber,{value:n[0],className:Se()("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:o[0],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:u,disabled:d,onChange:e=>{S([e,n[1]])},onBlur:()=>{E(n)}}),t().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:d,readOnly:!0}),t().createElement(P.InputNumber,{value:n[1],className:Se()("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:o[1],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:u,disabled:d,onChange:e=>{S([n[0],e])},onBlur:()=>{E(n)}}))};class ga extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:u,rules:d=[],onChange:p=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(o)},required:e.getFormItemRequired(d)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(fa,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(P.Col,{flex:ue(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ga,"contextType",mr);const ba=ga;let ya=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function va(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:xa}=P.Input;class Ea extends e.Component{constructor(e){var t;super(e),t=this,va(this,"deriveParams",void 0),va(this,"valueKey",void 0),va(this,"_is_change",!1),va(this,"_record",void 0),va(this,"_prevValue",null),va(this,"state",{visible:!1,loading:!1}),va(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),va(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),va(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||g("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||g("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&g("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),va(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),va(this,"getDerivedSearchHelper",(()=>this.searchHelper)),va(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},u=this.getItemValue();if(!e||se(u))return this._prevValue=void 0;this.setState({loading:!0});try{const l=await e(r({...t,key:u}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&Pr(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=u,i){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),va(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),va(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),va(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{le((()=>this.setState({loading:!1})))}}))})),va(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Rr(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=Rr(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),va(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,a=e.filter((e=>Rr(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(r)})),va(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??ae)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),va(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Rr(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])});const n=Rr(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),va(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)})),va(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),va(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),va(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),va(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),va(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:u=p("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Xr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(xa,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(t),this._is_change&&!r&&(t?n?a?.fetch?.api&&this.getSearchHelperTableData(t).then((e=>this.resetSearchHelperValue(e,t))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(t):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!r&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):le((()=>this.clearSearchHelperValue())))}}),t().createElement(ur,v,t().createElement(vc,x)))}}va(Ea,"contextType",mr);class Sa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),va(this,"promiseRef",void 0),va(this,"searchRef",void 0),va(this,"state",{searchHelper:{}}),va(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),va(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[]}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ea,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(l,t)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}va(Sa,"contextType",mr);const Ca=Sa;function wa(){return wa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wa.apply(this,arguments)}function Na(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ta=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,Na(this,"startClick",void 0),Na(this,"event1",null),Na(this,"event2",null),Na(this,"$el",null),Na(this,"omitClassNames",[]),Na(this,"state",{clickOutside:!1}),Na(this,"mousedownHandler",(e=>{this.startClick=e})),Na(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Na(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),l=this.$el===r,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(r)))||o.includes(n);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),Na(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Na(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=qt()(document,"mousedown",this.mousedownHandler),this.event2=qt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:e}=this.props,{clickOutside:n}=this.state;return t().createElement(r,wa({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Na(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,wa({},e,{forwardedRef:r}))))},Ia=require("rc-trigger");var Ra,Oa,Pa=n.n(Ia);function Aa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ka=Ta((Oa=class extends e.Component{constructor(e){var r;super(e),r=this,Aa(this,"searchRef",t().createRef()),Aa(this,"_records",[]),Aa(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Aa(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),Aa(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||g("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Aa(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Aa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Aa(this,"setItemList",(e=>{this.setState({itemList:e})})),Aa(this,"setRecords",(e=>{this._records=e})),Aa(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Aa(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Aa(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Aa(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),Aa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:l,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r&&!se(c)){this.setState({loading:!0});try{const o=await r(a({...n,keys:c}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,J.get)(o.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),l?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:u={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-search-helper"),{size:N}=e.context,T={[w]:!0,[`${w}--lg`]:"large"===N,[`${w}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Xr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Pa(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(T),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(ur,v,t().createElement(vc,x)))}},Aa(Oa,"contextType",mr),Ra=Oa))||Ra;class Fa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Aa(this,"promiseRef",void 0),Aa(this,"state",{searchHelper:{}}),Aa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Aa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ka,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Aa(Fa,"contextType",mr);const Ha=Fa;function La(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:$a}=P.Input;class _a extends e.Component{constructor(e){super(e),La(this,"valueKey",void 0),La(this,"_record",void 0),La(this,"_prevValue",null),La(this,"state",{visible:!1,loading:!1}),La(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),La(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),La(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||g("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||g("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&g("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),La(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),La(this,"getDerivedSearchHelper",(()=>this.searchHelper)),La(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,triggeredChange:a,fieldAliasMap:i,extraAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},s="function"==typeof l?l():l||{},c=this.getItemValue();if(!e||se(c))return this._prevValue=void 0;this.setState({loading:!0});try{const i=await e(r({...t,key:c}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,n)??[];if(e[0]){const t=e[0];if(o&&Or(t,this.alias,o),s&&Pr(t,this.extras,s),this._record=t,this.setFieldsValue(t),this._prevValue=c,a){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}}}}catch(e){}this.setState({loading:!1})})),La(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Rr(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])})})),La(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),La(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Rr(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])});const n=Rr(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),La(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),La(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),La(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a=""}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?t().createElement(Xr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement($a,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t().createElement(ur,v,t().createElement(Nc,x)))}}La(_a,"contextType",mr);class Da extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),La(this,"promiseRef",void 0),La(this,"state",{searchHelper:{}}),La(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),La(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(_a,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(l,t)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}La(Da,"contextType",mr);const qa=Da;var ja,Ka;function Ma(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Va=Ta((Ka=class extends e.Component{constructor(e){var r;super(e),r=this,Ma(this,"searchRef",t().createRef()),Ma(this,"_records",[]),Ma(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Ma(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),Ma(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||g("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Ma(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Ma(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ma(this,"setItemList",(e=>{this.setState({itemList:e})})),Ma(this,"setRecords",(e=>{this._records=e})),Ma(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Ma(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Ma(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ma(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),Ma(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:u={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-tree-table-helper"),{size:N}=e.context,T={[w]:!0,[`${w}--lg`]:"large"===N,[`${w}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Xr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Pa(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(T),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(ur,v,t().createElement(Nc,x)))}},Ma(Ka,"contextType",mr),ja=Ka))||ja;class za extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ma(this,"promiseRef",void 0),Ma(this,"state",{searchHelper:{}}),Ma(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ma(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Va,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Ma(za,"contextType",mr);const Ua=za;function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Wa=new Array(2).fill("");class Ga extends e.Component{constructor(e){var t;super(e),t=this,Ba(this,"_is_change",!1),Ba(this,"_ceho_data",void 0),Ba(this,"_records",[]),Ba(this,"_is_clear",!1),Ba(this,"state",{visible:!1,loading:!1,itemList:[],textValue:Wa}),Ba(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),Ba(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||g("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Ba(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Ba(this,"setItemList",(e=>{this.setState({itemList:e})})),Ba(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ba(this,"setTextValue",(e=>{this.setState({textValue:e})})),Ba(this,"setRecords",(e=>{this._records=e})),Ba(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),Ba(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),Ba(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(Wa),this.triggerChange([])})),Ba(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Ba(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ba(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:se(e)?void 0:e}})),Ba(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(le((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),Ba(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,a=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),Ba(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:r=[]}=this.props;(0,J.isEqual)((0,J.intersection)(t,r),r)||(0,J.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,J.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=Wa.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:r=[]}=this.props,{visible:n,loading:a,textValue:i}=this.state,{fieldName:l,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:u=!0,readOnly:d,disabled:m}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,f={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Xr,{value:i.join(" - "),bordered:u}):t().createElement(t().Fragment,null,t().createElement(P.Input.Group,null,t().createElement(P.Input,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:u,readOnly:d,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),t().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:u,disabled:m,readOnly:!0}),t().createElement(P.Input.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:a,bordered:u,allowClear:!0,readOnly:d,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([i[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t().createElement(ur,f,t().createElement(kc,g)))}}Ba(Ga,"contextType",mr);class Ya extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ba(this,"promiseRef",void 0),Ba(this,"state",{searchHelper:{}}),Ba(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ba(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:u,buttonAfter:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ga,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(l,r)}}))),d&&t().createElement(P.Col,null,e.renderFormItemButton(l,d)),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Ba(Ya,"contextType",mr);const Xa=Ya;function Qa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Za=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return r.isOnlyShow?t().createElement(Xr,{value:h(n),bordered:c}):t().createElement(P.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:d,onChange:e=>{(e=>{i?.(e),l(e,h(e))})(e)}},m.map((e=>t().createElement(P.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ja extends e.Component{constructor(){super(...arguments),Qa(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Za,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Qa(Ja,"contextType",mr);const ei=Ja,ti=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:u=r.isFormDisabled}=e.option,{allowHalf:d,count:p=5,tooltips:m}=l;return t().createElement(P.Rate,{value:n,count:p,style:o,allowHalf:d,allowClear:s,tooltips:m,disabled:u||r.isOnlyShow,onChange:e=>{(e=>{var t;a?.(e),i(e,(t=e,m?m[Math.ceil(t)-1]:t.toString()))})(e)}})};class ri extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ti,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ri,"contextType",mr);const ni=ri;function ai(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ii=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d=r.isFormDisabled}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Xr,{value:h(n),bordered:c}):t().createElement(P.Radio.Group,{value:n,style:{width:"100%",...s},disabled:d||r.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{i?.(e),l(e,h(e))})(t)}},m.map((e=>t().createElement(P.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class li extends e.Component{constructor(){super(...arguments),ai(this,"state",{itemList:[]}),ai(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ii,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}ai(li,"contextType",mr);const oi=li,si=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:u=r.isFormDisabled}=e.option,{labelToSwitch:d,falseValue:m=gr,trueValue:h=fr}=o;return t().createElement(t().Fragment,null,t().createElement(P.Switch,{checked:n===h,style:s,disabled:u||r.isOnlyShow,checkedChildren:t().createElement(we.CheckOutlined,null),unCheckedChildren:t().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:m)}}),d?t().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class ci extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option,{labelToSwitch:h}=o;return t().createElement(P.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(si,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ci,"contextType",mr);const ui=ci,di=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:u,readOnly:d,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{showCount:g,maxLength:b,autoSize:y}=l,v=Object.assign({},{minRows:1,maxRows:3},y);return t().createElement(P.Input.TextArea,{value:n,placeholder:s,style:o,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:u,readOnly:d||r.isOnlyShow,disabled:m,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f(t)}},onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e)})(t)}})};class pi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(di,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(pi,"contextType",mr);const mi=pi,hi=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:c={},placeholder:u=p("qm.form.datePlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:b,disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=o,S=t().createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),a?.(e),i(e,w(e))},w=e=>Ir(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Tr(s()().subtract(e,"day"),Er[g]);"date"===g&&(t=t.slice(0,10)),C(t),S.current.blur(),S.current.focus()};return r.isOnlyShow?t().createElement(Xr,{value:w(n),bordered:d}):t().createElement(D,{ref:S,style:{width:"100%",...c},popupClassName:`form-popper__${l}`,picker:xr[g],format:b,bordered:d,showToday:!1,showTime:"datetime"===g&&{defaultValue:s()("00:00:00","HH:mm:ss")},allowClear:m,disabled:f,inputReadOnly:h,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),renderExtraFooter:E?()=>t().createElement(t().Fragment,null,t().createElement(P.Tag,{color:"processing",onClick:()=>N(0)},p("qm.form.datePickers")[0]),t().createElement(P.Tag,{color:"processing",onClick:()=>N(1)},p("qm.form.datePickers")[1]),t().createElement(P.Tag,{color:"processing",onClick:()=>N(7)},p("qm.form.datePickers")[2]),t().createElement(P.Tag,{color:"processing",onClick:()=>N(30)},p("qm.form.datePickers")[3])):void 0,value:Nr(n,Er[g]),onChange:(e,t)=>{C(Tr(e,Er[g]))}})};class fi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(hi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(fi,"contextType",mr);const gi=fi,bi=e=>[s()().subtract(e,"day"),s()()],yi=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:c={},placeholder:u=p("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f=r.isFormDisabled}=e.option,{dateType:g="date",format:b,disableds:y=[!1,!1],disabledDate:v,minDateTime:x,maxDateTime:E,shortCuts:S=!0}=o,C={[p("qm.form.dateRangePickers")[0]]:bi(7),[p("qm.form.dateRangePickers")[1]]:bi(30),[p("qm.form.dateRangePickers")[2]]:bi(90),[p("qm.form.dateRangePickers")[3]]:bi(180)},w=e=>Ir(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Xr,{value:w(n),bordered:d}):t().createElement(D.RangePicker,{style:{width:"100%",...c},popupClassName:`form-popper__${l}`,picker:xr[g],format:b,bordered:d,showTime:"datetime"===g&&{defaultValue:[s()("00:00:00","HH:mm:ss"),s()("23:59:59","HH:mm:ss")]},allowClear:m,disabled:f?[!0,!0]:y,inputReadOnly:h,disabledDate:v??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[x,E])),ranges:S?C:void 0,value:se(n)?null:[Nr(n?.[0],Er[g]),Nr(n?.[1],Er[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),a?.(e),i(e,w(e))})([Tr(e?.[0],Er[g]),Tr(e?.[1],Er[g])])}})};class vi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(yi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(vi,"contextType",mr);const xi=vi,Ei=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:s={},placeholder:c=p("qm.form.timePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:b=1,secondStep:y=1}=o;return r.isOnlyShow?t().createElement(Xr,{value:n,bordered:u}):t().createElement(M,{style:{width:"100%",...s},popupClassName:`form-popper__${l}`,bordered:u,showNow:!0,hourStep:g,minuteStep:b,secondStep:y,allowClear:d,disabled:h,inputReadOnly:m,format:Sr[f],value:Nr(n,Sr[f]),onChange:(e,t)=>{(e=>{const t=Tr(e,Sr[f]);a?.(t),i(t)})(e)}})};class Si extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Ei,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Si,"contextType",mr);const Ci=Si,wi=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:s={},placeholder:c=p("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h=r.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],hourStep:b=1,minuteStep:y=1,secondStep:v=1}=o,x=e=>Ir(e)?"":e.join(" - ");return r.isOnlyShow?t().createElement(Xr,{value:x(n),bordered:u}):t().createElement(M.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${l}`,bordered:u,showNow:!1,hourStep:b,minuteStep:y,secondStep:v,allowClear:d,disabled:h?[!0,!0]:g,inputReadOnly:m,format:Sr[f],value:se(n)?null:[Nr(n?.[0],Sr[f]),Nr(n?.[1],Sr[f])],onChange:(e,t)=>{(e=>{const t=[Tr(e?.[0],Sr[f]),Tr(e?.[1],Sr[f])];a?.(t),i(t,x(t))})(e)}})};class Ni extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(wi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ni,"contextType",mr);const Ti=Ni;function Ii(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ri extends e.Component{constructor(e){super(e),Ii(this,"searchRef",t().createRef()),Ii(this,"valueKey",void 0),Ii(this,"_clicking",!1),Ii(this,"_record",void 0),Ii(this,"_prevValue",null),Ii(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Ii(this,"getSearchHelper",pr()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),Ii(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(n||g("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||g("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&g("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&g("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),Ii(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Ii(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,triggeredChange:a,fieldAliasMap:i,extraAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},s="function"==typeof l?l():l||{},c=this.getItemValue();if(!e||se(c))return this._prevValue=void 0;try{const i=await e(r({...t,key:c}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,n)??[];if(e[0]){const t=e[0];if(o&&Or(t,this.alias,o),s&&Pr(t,this.extras,s),this._record=t,this.setFieldsValue(t),this._prevValue=c,a){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}}}}catch(e){}})),Ii(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=Rr(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])})})),Ii(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),Ii(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ii(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Ii(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Ii(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Rr(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Rr(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Rr(e,this.alias[n]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,J.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const l=await r(a({...n,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:r,loading:n,itemList:a,inputText:i}=this.state,{value:o}=this.props,{fieldName:s,options:c={},style:u={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{listHeight:b=br}=c,{hideHeader:y,onlySelect:v=!0}=this.searchHelper||c,x=this.searchHelper.columns||[],E=Ce("form-immediate"),S=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=t().createElement(P.Spin,{spinning:n},a.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Se()("table")},!y&&t().createElement("thead",null,t().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>t().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t().createElement("tbody",null,a.map(((e,r)=>t().createElement("tr",{key:r,className:this.state.activeIndex===r?"active":"",onMouseEnter:()=>{this.setState({activeIndex:r})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((r=>t().createElement("td",{key:r.dataIndex},(0,J.get)(e,r.dataIndex))))))))):t().createElement(ht,null));return t().createElement(l.Consumer,null,(n=>{const l={[E]:!0,[`${E}--lg`]:"large"===n?.size,[`${E}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Xr,{value:o,bordered:m}):t().createElement(Pa(),{action:g?[]:["click"],popupVisible:!g&&r,popup:C,popupClassName:Se()(l,`form-popper__${s}`),popupStyle:{minWidth:S,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Input,{ref:this.searchRef,placeholder:d,allowClear:h,bordered:m,readOnly:f,disabled:g,style:{width:"100%",...u},value:i??o,title:o,onFocus:()=>{!a.length&&this.fetchHandle(o)},onBlur:e=>{v&&!this._clicking&&i!==o&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(a[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const r=40===e.keyCode?++t%a.length:(--t+a.length)%a.length;this.setState({activeIndex:r})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),v?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}}))}))}}Ii(Ri,"contextType",mr);class Oi extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ii(this,"promiseRef",void 0),Ii(this,"state",{searchHelper:{}}),Ii(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ii(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ri,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(l,t)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Ii(Oi,"contextType",mr);const Pi=Oi;class Ai extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,fieldName:a,className:i,style:l={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:u=[],onCollapse:d=ne}=o,p=[];if(u.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=u.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return t().createElement(P.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},t().createElement(Ie,{id:a,label:n,className:i,extra:p.map((e=>e.text)).join(" | "),style:{...l},collapse:s[a],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[a]:t})}))),d(t)}}))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ai,"contextType",mr);const ki=Ai;function Fi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hi(){return Hi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hi.apply(this,arguments)}const Li=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Li(e.children,t,r,n)}:e)),$i=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{fieldName:c,options:u={},style:d={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,asyncLoad:g,readOnly:b,disabled:y}=e.option,{itemList:v,filterable:x=!0,listHeight:E=br,checkStrictly:S,checkStrategy:C="SHOW_CHILD",collapseTags:w,openPyt:N=!0}=u,[T,I]=t().useState(se(v)?a:v);qe((()=>{I(se(v)?a:v)}),[v,a]);const R=e=>kr(T,e)?.text||"",O=e=>i?e.map((e=>R(e))).filter((e=>!!e)).join(","):R(e);return r.isOnlyShow?t().createElement(Xr,{value:O(n),bordered:h}):t().createElement(P.TreeSelect,Hi({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:i,treeCheckable:i,treeCheckStrictly:S,showCheckedStrategy:P.TreeSelect[C],popupClassName:`form-popper__${c}`,placeholder:m,listHeight:E,style:d,loading:l,bordered:h,allowClear:f,disabled:y,treeDefaultExpandAll:!g,showSearch:x,maxTagCount:w?"responsive":void 0,loadData:g?async e=>{let{key:t,children:r}=e;if(!g||r)return;const{fetchApi:n,params:a,dataKey:i,textKey:l="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=g;if(n)try{const e=await n(c({...a,[o]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=Li(T,t,o,Ar(r,o,l));I(n),s?.(r)}}catch(e){}}:void 0,treeData:T},i?{title:O(n)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,O(e),T)})(e)}}))};class _i extends e.Component{constructor(){super(...arguments),Fi(this,"state",{itemList:[],loading:!1}),Fi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Ar(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:u=e.props.labelWidth,className:d,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(i),className:Se()(d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement($i,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(P.Col,{flex:ue(p.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Fi(_i,"contextType",mr);const Di=_i;function qi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ji(){return ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ji.apply(this,arguments)}const Ki=e=>{const{$$form:r}=t().useContext(mr),{value:n,multiple:a,items:i}=e,{fieldName:l,options:o={},style:s={},placeholder:c=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{changeOnSelect:f,checkStrictly:g,checkStrategy:b="SHOW_PARENT",filterable:y=!0,openPyt:v=!0}=o,{itemList:x=[]}=o,E=se(x)?i:x,S=e=>se(e)?"":a?e.map((e=>Fr(E,e).map((e=>e.text)).join("/"))).join(","):Fr(E,e).map((e=>e.text)).join("/");return r.isOnlyShow?t().createElement(Xr,{value:S(n),bordered:u}):t().createElement(P.Cascader,ji({value:(e=>se(e)?[]:a?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:E,multiple:a,maxTagCount:"responsive",changeOnSelect:f||g,showCheckedStrategy:P.Cascader[b],popupClassName:`form-popper__${l}`,placeholder:c,style:s,bordered:u,allowClear:d,disabled:h,showSearch:y&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(v?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))}},a?{title:S(n)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,S(t),E)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class Mi extends e.Component{constructor(){super(...arguments),qi(this,"state",{itemList:[],loading:!1}),qi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Ar(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:r}=this.props,{itemList:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:u=e.props.labelWidth,className:d,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(i),className:Se()(d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(Ki,{option:this.props.option,multiple:r,items:n,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(P.Col,{flex:ue(p.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...p}))))}}qi(Mi,"contextType",mr);const Vi=Mi,zi=require("china-area-data");var Ui=n.n(zi);function Bi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Wi=["110000","120000","310000","500000"],Gi=["810000","820000"],Yi=[{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"}],Xi=[{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"}],Qi=e=>Gr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Zi=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...Wi,...Gi].includes(e))):Object.keys(e[t])).map((n=>({l:Qi(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:Zi(e,n,r+1)})))},Ji=(e,t)=>t.map((t=>({l:Qi(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class el extends e.Component{constructor(e){super(e),Bi(this,"searchRef",t().createRef()),Bi(this,"scrollRef",t().createRef()),Bi(this,"zxsAndGa",void 0),Bi(this,"provinces",void 0),Bi(this,"allCities",void 0),Bi(this,"letterCities",void 0),Bi(this,"state",{visible:!1,select_type:"0",active_key:""}),Bi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Bi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Kt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Ji(Ui(),Wi)},{l:"Z2",n:"港澳",c:"",p:"",children:Ji(Ui(),Gi)}]}createProvince(){return(Zi(Ui(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Xi.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Wi,...Gi].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t().createElement(P.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(P.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),t().createElement(P.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:r}=this.state;return("0"===r?Yi:Xi).map((r=>t().createElement("li",{key:r.value,className:Se()({tag:!0,actived:r.value===e}),onClick:()=>this.scrollHandle(r.value.toString())},r.text)))}renderSelect(){const{value:e}=this.props;return t().createElement(P.Select,{size:"small",placeholder:p("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t().createElement(P.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:r}=this.state;return("0"===r?this.provinces:this.letterCities).map(((r,n)=>t().createElement("div",{key:n},t().createElement("dt",{ref:e=>this[`${r.l}Ref`]=e},r.n,":"),t().createElement("dd",null,r.children?.map((r=>t().createElement("li",{key:r.c,className:Se()({actived:r.c===e}),onClick:()=>this.clickHadnle(r.c)},r.n)))))))}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{fieldName:a,options:i={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,disabled:m}=this.props.option,h=Ce("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(n),b=t().createElement("div",{className:"container",style:{...o}},t().createElement("div",{className:"city-drop"},t().createElement("div",{className:"city-drop-toper"},t().createElement("div",{className:"city-drop-toper__type"},this.renderType()),t().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t().createElement("div",{className:"city-drop-letter"},this.renderLetter()),t().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t().createElement("dl",null,this.renderCity(n)))));return t().createElement(l.Consumer,null,(n=>{const i={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Xr,{value:g,bordered:c}):t().createElement(Pa(),{action:m?[]:["click"],popupVisible:!m&&r,popup:b,popupClassName:Se()(i,`form-popper__${a}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Input,{ref:this.searchRef,placeholder:s,allowClear:u,bordered:c,readOnly:d,disabled:m,style:{width:"100%",...o},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}Bi(el,"contextType",mr);class tl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(el,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Bi(tl,"contextType",mr);const rl=tl;function nl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const al=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:al(e,r)})))};class il extends e.Component{constructor(e){super(e),nl(this,"searchRef",t().createRef()),nl(this,"prevText",void 0),nl(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),nl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const r=al(Ui(),"86")||[];this.state={results:r,visible:!1,values:[],tabs:[r.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=kr(e,t[n]);if(a&&se(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,J.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[l],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,r=this.state.tabs.map(((r,n)=>{const a=r.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return t().createElement(er.TabPane,{key:n.toString(),tab:a},t().createElement("div",{className:"region-box"},r.map((r=>t().createElement("span",{key:r.value,className:Se()({"region-box__item":!0,actived:e.includes(r.value.toString())}),title:r.text,onClick:()=>{let{values:e}=this.state;e[n]=r.value.toString(),e=e.slice(0,n+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},r.text)))))}));return r.length?t().createElement(er,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},r):t().createElement(ht,null)}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{fieldName:a,options:i={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,disabled:m}=this.props.option,h=Ce("form-region-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=t().createElement("div",{className:"container"},this.renderTabs());let b=this.prevText;if(!r){const e=this.createTextValue(n);(""===e||e.split("/").every((e=>""!==e)))&&(b=e,this.prevText=b)}return t().createElement(l.Consumer,null,(n=>{const i={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Xr,{value:b,bordered:c}):t().createElement(Pa(),{action:m?[]:["click"],popupVisible:!m&&r,popup:g,popupClassName:Se()(i,`form-popper__${a}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Input,{ref:this.searchRef,placeholder:s,allowClear:u,bordered:c,style:{width:"100%",...o},readOnly:d,disabled:m,value:b,title:b,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&le((()=>this.initial()))}}))}))}}nl(il,"contextType",mr);class ll extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(il,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}nl(ll,"contextType",mr);const ol=ll,sl=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:u}=e.option,{multiple:d=!0,maxCount:m=1,fileTypes:h,fileSize:f,fileDirection:g,onPreview:b,onRemove:y}=l,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:C="",downloadWithHeaders:w,fieldAliasMap:N,beforeUpload:T,button:I}=o,R="function"==typeof N?N():N||{};return t().createElement(Gl,{name:"file",action:v,multiple:d,headers:x,data:E,withCredentials:S,downloadWithHeaders:w,beforeUpload:T,maxCount:m,fileTypes:h,fileSize:f,fileDirection:g,disabled:c,readOnly:r.isOnlyShow||u,button:I,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)},fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&P.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(C?(0,J.get)(t.data,C):t.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onPreview:b,onRemove:y})};class cl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(sl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(cl,"contextType",mr);const ul=cl,dl=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:u}=e.option,{multiple:d=!0,maxCount:m=1,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,onRemove:v}=l,{action:x,headers:E,params:S,withCredentials:C=!1,dataKey:w="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,R="function"==typeof T?T():T||{};return t().createElement(to,{name:"file",action:x,multiple:d,headers:E,data:S,withCredentials:C,popupClassName:N,beforeUpload:I,maxCount:m,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,disabled:c,readOnly:r.isOnlyShow||u,fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&P.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(w?(0,J.get)(t.data,w):t.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:v})};class pl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(dl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(pl,"contextType",mr);const ml=pl,hl=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o,style:s={},readOnly:c,disabled:u=r.isFormDisabled}=e.option,{tinymce:d,thresholdSize:p,onResizeEditor:m}=l;return t().createElement(ql,{value:n,tinymce:d,upload:o,thresholdSize:p,style:{width:"100%",...s},disabled:u||c||r.isOnlyShow,onResizeEditor:m,onChange:e=>{(e=>{a?.(e),i(e)})(e)}})};class fl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(hl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(fl,"contextType",mr);const gl=fl;function bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class yl extends e.Component{constructor(e){super(e),bl(this,"provide",{$$form:this,echo_data:{}}),bl(this,"_initialValues",void 0),bl(this,"_initialOthers",void 0),bl(this,"_initialExtras",void 0),bl(this,"_fieldAuth",{}),bl(this,"wrapperRef",t().createRef()),bl(this,"formRef",t().createRef()),bl(this,"originItems",[]),bl(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),bl(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),bl(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),bl(this,"getFormItems",pr()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),bl(this,"getFlattenItems",pr()((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}))),bl(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),bl(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),bl(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),bl(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),bl(this,"openValidateInfo",(e=>{const r=t().createElement("ul",null,e.map((e=>{const{label:r}=this.formItems.find((t=>t.fieldName===e.name[0]));return t().createElement("li",{key:e.name[0],style:{color:"#f5222d"}},"[",("string"==typeof r?`${r}: `:"")+e.errors.join(","),"]")})));P.notification.error({message:p("qm.form.validatePrompt"),description:r,duration:10})})),bl(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Kt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){Et(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){St(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&g("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,J.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,J.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,yr.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??gr),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}createOriginItems(){this.originItems=ce(this.props.items)}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){this.setState({collapse:e},(()=>{this.props.onCollapse?.(this.state.collapse)}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if("string"==typeof e)return e;const{fieldName:t,label:r,options:n={}}=e;if("string"==typeof r)return r;const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],a=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=a?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(Ir(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Ir(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)se(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=Z()(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,J.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:a=1,disabled:i,secretName:l}=n;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},t.options=Object.assign({},t.options,{secretType:l})),this.setFieldAuth(r,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return t().createElement(ia,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(sa,{option:e})}INPUT_NUMBER(e){return t().createElement(ha,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(ba,{option:e})}SEARCH_HELPER(e){return t().createElement(Ca,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(Ha,{option:e})}TREE_TABLE_HELPER(e){return t().createElement(qa,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(Ua,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(Xa,{option:e})}CHECKBOX(e){return t().createElement(ln,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(ei,{option:e})}RATE(e){return t().createElement(ni,{option:e})}RADIO(e){return t().createElement(oi,{option:e})}SWITCH(e){return t().createElement(ui,{option:e})}TEXT_AREA(e){return t().createElement(mi,{option:e})}DATE(e){return t().createElement(gi,{option:e})}RANGE_DATE(e){return t().createElement(xi,{option:e})}TIME(e){return t().createElement(Ci,{option:e})}RANGE_TIME(e){return t().createElement(Ti,{option:e})}SELECT(e){return t().createElement(rn,{option:e})}MULTIPLE_SELECT(e){return t().createElement(rn,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(Pi,{option:e})}DIVIDER(e){return t().createElement(ki,{option:e})}TREE_SELECT(e){return t().createElement(Di,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Di,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Vi,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Vi,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(rl,{option:e})}REGION_SELECT(e){return t().createElement(ol,{option:e})}UPLOAD_FILE(e){return t().createElement(ul,{option:e})}UPLOAD_IMG(e){return t().createElement(ml,{option:e})}TINYMCE(e){return t().createElement(gl,{option:e})}renderFormLabel(e){if(!(0,J.isPlainObject)(e))return e;const{type:r,fieldName:n,label:a,options:i={},onChange:l=ne}=e,{itemList:o=[]}=i;return"SELECT"===r?t().createElement(P.Form.Item,{name:n,noStyle:!0},t().createElement(en,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>l(e,t)})):"CHECKBOX"===r?t().createElement(t().Fragment,null,t().createElement("span",{style:{paddingRight:5}},a),t().createElement(P.Form.Item,{name:n,noStyle:!0},t().createElement(nn,{option:e,onValuesChange:e=>l(e)}))):null}renderFormItemExtra(e){const{fieldName:r,isTooltip:n,style:a={},render:i}=e,{extra:l}=this.state;if(n)return t().createElement(P.Tooltip,{className:"extra-tooltip",title:l[r]},t().createElement(we.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===r));return t().createElement("div",{className:"extra-text",title:i?"":l[r],style:a},t().createElement("span",{className:"extra-overflow-cut"},i?i(o,this):l[r]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:r,fieldName:n,invisible:a,tooltip:i,className:l,labelWidth:o=this.props.labelWidth,rules:s=[],style:c={},render:u}=e;return se(this.state.formData)?null:t().createElement(P.Form.Item,{label:this.renderFormLabel(r),name:n,rules:s,tooltip:i,hidden:a,className:Se()(l),style:{width:"100%",...c},labelCol:{flex:ue(o)}},u?.(e,this))}createFormItem(e){return(0,J.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(g("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:r,defaultRows:n,isFieldsDefine:a}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<r;e++)i.push({})}));const l=24/e,o=[],s=i.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return o.push(n),n}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,u=[],d=i.map(((r,n)=>{let{selfCol:a=1}=r;const{type:i,fieldName:s}=r;a=a>=24||"DIVIDER"===i||"TINYMCE"===i?e:a;const d=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(r);return d&&u.push(o[n]),t().createElement(P.Col,{key:s??n,className:s,span:a*l,style:this.isFilterType?{display:!this.showFilterCollapse||d?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(ce(r)):null)}));return a&&"default"===r&&d.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...d,this.createSearchButtonLayout(u[u.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:r,collapse:n}=this.state,{searchButtonCols:a,isSearchBtn:i,isFieldsDefine:l=!0}=this.props;if(!this.isFilterType)return null;const o=24/r,s=a||1,c=r-e%r-s;return i?t().createElement(P.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t().createElement(P.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,icon:t().createElement(we.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),t().createElement(he,{size:this.$size,icon:t().createElement(we.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),l?this.createFieldsDefine():null,this.showFilterCollapse&&t().createElement("a",{onClick:()=>this.setExpandHandle(!n)},n?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:r,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const a=24/e;return n&&"default"===r?t().createElement(P.Row,{gutter:0},t().createElement(P.Col,{key:"-",span:a},t().createElement(P.Form.Item,null,t().createElement(P.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),t().createElement(he,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:r,fieldsChange:n}=this.props;return t().createElement(ta,{uniqueKey:e,items:r,fieldsChange:n})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[p("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){g("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return g("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return g("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,J.set)(i,r,t[r]));r&&(a?a([...n]):g("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:r,layout:n,disabled:a,labelWidth:i,labelAlign:l,labelWrap:o,customClass:s}=this.props,c=Ce("form"),u={required:"${label}"+p("qm.form.requiredTips")},d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t().createElement("div",{ref:this.wrapperRef,className:Se()(d,e),style:r},t().createElement(P.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:l,labelWrap:o,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":ue(i)},validateMessages:u,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(mr.Provider,{value:this.provide},t().createElement(P.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}bl(yl,"contextType",l),bl(yl,"propTypes",Cr),bl(yl,"defaultProps",wr);const vl=yl,xl={onActivate:r.func,onAddUndo:r.func,onBeforeAddUndo:r.func,onBeforeExecCommand:r.func,onBeforeGetContent:r.func,onBeforeRenderUI:r.func,onBeforeSetContent:r.func,onBeforePaste:r.func,onBlur:r.func,onChange:r.func,onClearUndos:r.func,onClick:r.func,onContextMenu:r.func,onCommentChange:r.func,onCopy:r.func,onCut:r.func,onDblclick:r.func,onDeactivate:r.func,onDirty:r.func,onDrag:r.func,onDragDrop:r.func,onDragEnd:r.func,onDragGesture:r.func,onDragOver:r.func,onDrop:r.func,onExecCommand:r.func,onFocus:r.func,onFocusIn:r.func,onFocusOut:r.func,onGetContent:r.func,onHide:r.func,onInit:r.func,onKeyDown:r.func,onKeyPress:r.func,onKeyUp:r.func,onLoadContent:r.func,onMouseDown:r.func,onMouseEnter:r.func,onMouseLeave:r.func,onMouseMove:r.func,onMouseOut:r.func,onMouseOver:r.func,onMouseUp:r.func,onNodeChange:r.func,onObjectResizeStart:r.func,onObjectResized:r.func,onObjectSelected:r.func,onPaste:r.func,onPostProcess:r.func,onPostRender:r.func,onPreProcess:r.func,onProgressState:r.func,onRedo:r.func,onRemove:r.func,onReset:r.func,onSaveContent:r.func,onSelectionChange:r.func,onSetAttrib:r.func,onSetContent:r.func,onShow:r.func,onSubmit:r.func,onUndo:r.func,onVisualAid:r.func,onSkinLoadError:r.func,onThemeLoadError:r.func,onModelLoadError:r.func,onPluginLoadError:r.func,onIconsLoadError:r.func,onLanguageLoadError:r.func},El={apiKey:r.string,id:r.string,inline:r.bool,init:r.object,initialValue:r.string,onEditorChange:r.func,value:r.string,tagName:r.string,cloudChannel:r.string,plugins:r.oneOfType([r.string,r.array]),toolbar:r.oneOfType([r.string,r.array]),disabled:r.bool,textareaName:r.string,tinymceScriptSrc:r.string,rollback:r.oneOfType([r.number,r.oneOf([!1])]),scriptLoading:r.shape({async:r.bool,defer:r.bool,delay:r.number}),...xl},Sl=e=>"function"==typeof e,Cl=e=>e in xl,wl=e=>e.substr(2),Nl=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(Cl),c=Object.keys(l).filter(Cl),u=s.filter((e=>void 0===l[e])),d=c.filter((e=>void 0===i[e]));u.forEach((e=>{const t=wl(e),r=o[t];n(t,r),delete o[t]})),d.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=wl(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Tl=0;const Il=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Tl++,e+"_"+r+Tl+String(t)},Rl=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Ol=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Pl=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Al=()=>({listeners:[],scriptId:Il("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),kl=(()=>{let e=Al();return{load:(t,r,n,a,i,l)=>{const o=()=>((t,r,n,a,i,l)=>{const o=r.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),r.head&&r.head.appendChild(o)})(e.scriptId,t,r,n,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Al()}}})(),Fl=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Hl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ll extends e.Component{constructor(t){var r;super(t),r=this,Hl(this,"editor",void 0),Hl(this,"id",void 0),Hl(this,"elementRef",void 0),Hl(this,"inline",void 0),Hl(this,"currentContent",void 0),Hl(this,"boundHandlers",void 0),Hl(this,"rollbackTimer",void 0),Hl(this,"valueCursor",void 0),Hl(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})),Hl(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){}})),Hl(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Hl(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))}})),Hl(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Hl(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=r.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>r.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>r.initialise(e+1)),100)}return}const n=Fl(r.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const a={...r.props.init,selector:void 0,target:t,readonly:r.props.disabled,inline:r.inline,plugins:(i=r.props.init?.plugins,l=r.props.plugins,Ol(i).concat(Ol(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!Rl(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&Sl(r.props.init.setup)&&r.props.init.setup(e)},init_instance_callback:e=>{const t=r.getInitialValue();r.currentContent=r.currentContent??e.getContent(),r.currentContent!==t&&(r.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=r.props.disabled??!1;Pl(r.editor,n?"readonly":"design"),r.props.init&&Sl(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),Rl(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||Il("tiny-react"),this.elementRef=e.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Pl(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==Fl(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&kl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=Fl(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Nl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):r&&!n&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}function $l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Hl(Ll,"propTypes",El),Hl(Ll,"defaultProps",{cloudChannel:"6"});var _l=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(_l||{});class Dl extends e.Component{constructor(){super(...arguments),$l(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 quickbars emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl"})}render(){const{size:e,className:r,style:n,tinymce:a={},upload:i={},thresholdSize:l=.5,tinymceScriptSrc:o,disabled:s,value:c,onResizeEditor:u,onChange:d}=this.props,m=this.context.global,h=this.context.locale,f=e||this.context.size||"",g=Ce("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===f,[`${g}--sm`]:"small"===f},y={init:{height:a.height||this.defaultOption.height,plugins:a.plugins||this.defaultOption.plugins,toolbar:a.toolbar||this.defaultOption.toolbar,menubar:a.menubar||this.defaultOption.menubar,font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:_l[h],skin:"tinymce-5",...Z()(a,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:a,withCredentials:o,dataKey:s}=i,c=`data:image/jpeg;base64,${e.base64()}`,u=new FormData;u.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>l)try{const{data:e}=await kt().post(n,u,{headers:a,withCredentials:o});200===e.code&&t(s?(0,J.get)(e.data,s):e.data)}catch(e){P.message.error(p("qm.uploadCropper.uploadError"))}else t(c)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;u?.({width:r,height:n},t)}))}},value:c,disabled:s,tinymceScriptSrc:o||m?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{d?.(t.getContent(),t)}};return t().createElement("div",{className:Se()(b,r),style:n},t().createElement(Ll,y))}}$l(Dl,"contextType",l),$l(Dl,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const ql=Dl,jl=require("cropperjs");var Kl=n.n(jl);function Ml(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Vl extends e.Component{constructor(){super(...arguments),Ml(this,"imgRef",t().createRef()),Ml(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:a,...i}=this.props,l={};for(const e in i)void 0!==this.props[e]&&(l[e]=this.props[e]);this.cropper=new(Kl())(this.imgRef.current,l)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:r,src:n,alt:a,imgStyle:i}=this.props,l={[Ce("cropper")]:!0};return t().createElement("div",{className:Se()(l,e),style:r},t().createElement("img",{ref:this.imgRef,src:n,alt:a,style:{maxWidth:"100%",...i}}))}}Ml(Vl,"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 zl=Vl;function Ul(){return Ul=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ul.apply(this,arguments)}function Bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wl extends e.Component{constructor(){super(...arguments),Bl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,maxCount:l,fileList:o=[],beforeUpload:s}=this.props,c=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!i||e.size/1024/1024<i,d=!(l>1)||o.length<l,m=c&&u&&d;if(c||P.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),u||P.message.warning(p("qm.upload.sizeLimit",{size:i})),d||P.message.warning(p("qm.upload.countLimit",{count:l})),!m)return m||P.Upload.LIST_IGNORE;if(s){const a=s(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Bl(this,"doDownload",(async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){P.message.error(p("qm.download.error"))}}))}get $size(){return this.context.size??""}async downloadFile(e,t){const r=this.props.downloadWithHeaders?{headers:this.props.headers}:null,n=await kt()({url:e,...r,responseType:"blob",timeout:0}),a=n.data,i=n.headers["content-disposition"],l=t||(i?i.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Ft(a,l)}render(){const{fileList:e=[],button:r={},fileDirection:n,disabled:a,readOnly:i,className:l,onPreview:o,onChange:s}=this.props,c=Ce("upload-file"),u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===n};return t().createElement(P.Upload,Ul({className:Se()(u,l)},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:a||i,onChange:s,onPreview:async e=>{if("function"==typeof o)return o(e,(t=>this.doDownload(t||e)));a||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)}}),this.props.children||i&&e.length?this.props.children:t().createElement(P.Button,{type:r.type??"default",icon:r.icon??t().createElement(we.UploadOutlined,null),disabled:a||i},r.text||p("qm.upload.text")))}}Bl(Wl,"contextType",l),Bl(Wl,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const Gl=Wl;function Yl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Xl extends e.Component{constructor(){super(...arguments),Yl(this,"cropperRef",t().createRef()),Yl(this,"beforeUploadRef",void 0),Yl(this,"fileRef",void 0),Yl(this,"resolveRef",void 0),Yl(this,"rejectRef",void 0),Yl(this,"state",{src:""}),Yl(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],r,{type:t});Object.assign(a,{uid:n});const{fileTypes:i=[],fileSize:l}=this.props;if(i.length&&!i.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return P.message.warning(p("qm.upload.tooltip",{type:i.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const o=this.beforeUploadRef(a,[a]);if("boolean"==typeof o||o){if(!0===o)return this.resolveRef(a);if(!1===o)return this.rejectRef("not upload");if(o&&"function"==typeof o.then)try{const e=await o,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else g("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await ie(100),this.onClose()})),Yl(this,"onOk",(()=>{this.confirmHandle()})),Yl(this,"onClose",(()=>{this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:r}=this.props,n=Array.isArray(e)?e[0]:e;if(!n)return null;const{beforeUpload:a,...i}=n.props;return this.beforeUploadRef=a,t().createElement(n.type,{...i,beforeUpload:(e,t)=>new Promise((async(n,a)=>{const i=()=>n(P.Upload.LIST_IGNORE);if(r&&!await r(e,t))return void i();this.fileRef=e,this.resolveRef=n,this.rejectRef=i;const l=new FileReader;l.onload=()=>{this.setSrc(l.result),l.onload=null},l.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t().createElement("div",{className:"cropper-preview"},t().createElement("div",{className:"cropper-area"},t().createElement("div",{className:"img-cropper"},t().createElement(zl,{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(P.Space,{size:"small"},t().createElement(P.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},p("qm.uploadCropper.zoomIn")),t().createElement(P.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},p("qm.uploadCropper.zoomOut")),t().createElement(P.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},p("qm.uploadCropper.rotatePlus")),t().createElement(P.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{className:e}=this.props,{src:r}=this.state,n=Ce("cropper-preview");return t().createElement(t().Fragment,null,this.renderUpload(),r&&t().createElement(P.Modal,{open:!0,wrapClassName:Se()(n,e),title:p("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}Yl(Xl,"contextType",l);const Ql=Xl;function Zl(){return Zl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zl.apply(this,arguments)}function Jl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eo extends e.Component{constructor(){super(...arguments),Jl(this,"state",{previewVisible:!1,currentIndex:0}),Jl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,beforeUpload:l}=this.props,o=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!i||e.size/1024/1024<i,c=o&&s;if(o||P.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),s||P.message.warning(p("qm.upload.sizeLimit",{size:i})),!c)return c||P.Upload.LIST_IGNORE;if(l){const a=l(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Jl(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})}))}get $size(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}render(){const{previewVisible:e,currentIndex:r}=this.state,{fileList:n=[],fixedSize:a,quality:i,fileTypes:l,fileSize:o,disabled:s,readOnly:c,className:u,popupClassName:d,openCropper:m,beforeCrop:h}=this.props,f=Ce("upload-img"),g={[f]:!0,[`${f}--lg`]:"large"===this.$size,[`${f}--sm`]:"small"===this.$size},b=t().createElement(P.Upload,Zl({className:Se()(g,u)},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:s||c,onPreview:this.handlePreview}),!this.showUploadButton||c&&n.length?null:t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("p",null,p("qm.uploadCropper.dragableText"))));return t().createElement(t().Fragment,null,m?t().createElement(Ql,{className:d,fixedSize:a,quality:i,fileTypes:l,fileSize:o,beforeCrop:h},b):b,t().createElement("div",{style:{display:"none"}},t().createElement(P.Image.PreviewGroup,{preview:{visible:e,current:r,rootClassName:d,onVisibleChange:e=>{this.setState({previewVisible:e})}}},n.map((e=>t().createElement(P.Image,{key:e.uid,src:e.url,alt:""}))))))}}Jl(eo,"contextType",l),Jl(eo,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const to=eo,ro=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=ro(i.children,t,r);e&&(n=e)}}return n},no=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&no(e.children,t),t(e)||e.children&&e.children.length))),ao=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...ao(e.children,t)),t(e)&&r.push(e)})),r},io=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=io(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},lo=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:lo(e.children,t,r,n)}:e)),oo=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...oo(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},so=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=so(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},co=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...co(e,t)))),r},uo=t().forwardRef(((e,r)=>{const{className:n,style:a,filterable:i=!0,multiple:o,draggable:s,dataSource:c,fetch:u,asyncLoad:d,checkStrictly:m,checkStrategy:h="SHOW_CHILD",placeholder:f=p("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:C,onCheckChange:w,onDragStart:N,onDragChange:T,onExpand:I}=e,{size:R}=t().useContext(l),O=t().useMemo((()=>e.size??R??""),[e.size,R]),A=g?.valueKey||"value",k=g?.textKey||"text",F=(g?.children,t().useRef(null)),H=Ct(F),[L,$]=t().useState(y),[_,D]=t().useState(!1),q=wt((()=>{$(F.current.offsetHeight-Z.current.offsetHeight-10)}),5);qe((()=>{y||q()}),[H.height]);const[j,K]=t().useState([]),[M,V]=t().useState({}),[z,U]=t().useState([]),[B,W]=t().useState([]),[G,Y]=t().useState(""),[X,Q]=t().useState(x),Z=t().useRef(null),ee=t().useRef([]),te=t().useRef([]);t().useEffect((()=>{Array.isArray(c)&&(re(c),U(ne(c)),V({}))}),[c]),t().useEffect((()=>{le()}),[]),qe((()=>{le()}),[u?.params]),qe((()=>{W(ie())}),[M]),t().useImperativeHandle(r,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=io(j,(t=>e===t[A]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],re([...j]))},REMOVE_RECORD:e=>{const t=ro(j,e,A);if(void 0===t&&j.find((t=>t[A]===e)))re(j.filter((t=>t[A]!==e)));else{const r=io(j,(e=>t===e[A]));if(!r)return;const n=r.children?.findIndex((t=>e===t[A]));n>=0&&(r.children.splice(n,1),re([...j]))}},UPDATE_RECORD:(e,t)=>{const r=io(j,(t=>e===t[A]));r&&((0,J.merge)(r,t),re([...j]))}})));const re=e=>{K(e),ee.current=e,te.current=oo(e,A)},ne=e=>{if(o)return v;const t=ao(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][A]]:[]},ae=e=>so(j,e,A)?.slice(0,-1)||[],ie=()=>{if(x)return te.current;const e=[];return z.forEach((t=>{if(o){if("SHOW_ALL"===h&&!te.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const r=kr(j,t);if(r){const n=ae(t),a=co(r,A);e.push(...n,...[t,...a].filter((e=>te.current.includes(e))))}}}else e.push(...ae(t))})),[...new Set(e)]},le=async()=>{if(!u)return;const{api:e,params:t,dataKey:r,callback:n}=u;try{D(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,r)??[];re(e),U(ne(e)),V({}),n?.(e)}}catch(e){}D(!1)},oe=e=>`${e}|${Gr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ce("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===O,[`${se}--sm`]:"small"===O};return t().createElement("div",{ref:F,className:Se()(ce,n),style:a},t().createElement("div",{ref:Z,className:"topper"},E&&t().createElement(P.Input.Search,{value:G,size:O,placeholder:f,allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=no(ee.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==oe(r).indexOf(e)}));Y(e),K(t),x||e?W(oo(t,A)):V({})})(e.target.value)}),S&&t().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:te.current)}},X?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(X?"qm.form.collect":"qm.form.spread"))),t().createElement(gt,{spinning:_},t().createElement(P.Tree,{fieldNames:{title:k,key:A,children:"children"},multiple:o,draggable:s,blockNode:s,checkable:o,selectable:!o,height:L,disabled:e.disabled,checkStrictly:m,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:B,treeData:j,loadData:d?async e=>{let{key:t,children:r}=e;if(!u||r)return;const{api:n,params:a,dataKey:i,formatter:l=(e=>e)}=u;try{const e=await n(l({...a,[A]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=lo(ee.current,t,A,r);re(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==oe(t).indexOf(G)},onDragStart:N,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][A]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...j];let o;if(i(l,r,((e,t,r)=>{r.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,r=[];i(l,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,o):r.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(l)},onDragEnd:e=>{T?.(e,j)},onExpand:(e,t)=>{W(e),I?.(e,t)},onSelect:e=>{U(e);const t=ao(ee.current,(t=>e.includes((0,J.get)(t,A))));C?.(o?t:t[0])},onCheck:e=>{m&&(e=e.checked),U(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!te.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(ro(j,e,A)))));const t=ao(ee.current,(t=>e.includes((0,J.get)(t,A))));w?.(o?t:t[0])}})))}));uo.displayName="QmSearchTree";const po=uo,mo=(0,e.createContext)(void 0),ho={dataIndex:i().string.isRequired,title:i().string.isRequired,description:i().string,colSpan:i().number,width:i().number,minWidth:i().number,fixed:i().oneOf(["left","right"]),align:i().oneOf(["left","center","right"]),theadAlign:i().oneOf(["left","center","right"]),printFixed:i().bool,hidden:i().bool,noAuth:i().bool,noFixed:i().bool,ellipsis:i().bool,className:i().string,theadClassName:i().string,children:i().array,sorter:i().oneOfType([i().bool,i().func]),filter:i().shape({type:i().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),style:i().object}),precision:i().number,displayPrecision:i().number,formatType:i().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:i().bool,canCopy:i().bool,editRender:i().func,dictItems:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),summation:i().shape({sumBySelection:i().bool,displayWhenNotSelect:i().bool,dataKey:i().string,unit:i().string,render:i().func}),groupSummary:i().shape({dataKey:i().string,unit:i().string,render:i().func}),shouldCellUpdate:i().func,headRender:i().func,render:i().func},fo=(i().arrayOf(i().shape(ho)).isRequired,i().func,i().array,i().oneOfType([i().string,i().func]).isRequired,i().number,i().bool,i().bool,i().shape({api:i().func.isRequired,params:i().object.isRequired,formatter:i().func,beforeFetch:i().func,afterFetch:i().func,stopToFirst:i().bool,dataKey:i().string,callback:i().func}),i().bool,i().bool,i().string,i().string,i().bool,i().bool,i().bool,i().bool,i().oneOfType([i().object,i().func]),i().oneOfType([i().object,i().func]),i().array,i().func,i().bool,i().bool,i().object,i().object,i().shape({type:i().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:i().array,selectedRowKeys:i().array,hideSelectAll:i().bool,checkStrictly:i().bool,filterable:i().bool,selectByClickRow:i().bool,selectFirstRowOnChange:i().bool,clearableAfterFetched:i().bool,selectAllOnCurrentPage:i().bool,fetchSelectedRows:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fetchAllRowKeys:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),disabled:i().func,onChange:i().func,onSelect:i().func,onSelectAll:i().func}),i().shape({currentRowKey:i().oneOfType([i().number,i().string]),disabled:i().func,onChange:i().func}),i().shape({virtual:i().bool,expandIconColumn:i().string}),i().shape({defaultExpandAllRows:i().bool,defaultExpandedRowKeys:i().array,expandedRowKeys:i().array,hideExpandAll:i().bool,rowExpandable:i().func,expandedRowClassName:i().string,expandedRowRender:i().func,onExpand:i().func,onChange:i().func}),i().shape({groupItems:i().arrayOf(i().shape({dataIndex:i().string.isRequired,titleIndex:i().string,color:i().string,backgroundColor:i().string})),fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),onChange:i().func}),i().func,i().bool,i().bool,i().bool,i().bool,i().shape({current:i().number,pageSize:i().number,pageSizeOptions:i().array,showSizeChanger:i().bool,showQuickJumper:i().bool}),i().shape({fileName:i().string,fetch:i().shape({api:i().func.isRequired,params:i().object}),beforeExport:i().func,cellStyle:i().bool,hideIcon:i().bool}),i().shape({showLogo:i().bool}),i().shape({fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fieldList:i().arrayOf(i().object)}),i().shape({position:i().oneOf(["top","bottom"]),hideAlert:i().bool,hideClearButton:i().bool}),i().oneOf(["left","right"]),i().func,i().func,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,10),go="1",bo="0",yo="YYYY-MM-DD",vo="YYYY-MM-DD HH:mm:ss",xo="YYYYMMDDHHmmss",Eo={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 So=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Co=[];const wo={getFocusInstance:function(){return Co[0]??null},getInstance:function(e){return Co.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Co.findIndex((e=>e===t))&&(this.deregister(e),Co=[t,...Co])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Co=[{id:e,vm:t},...Co])},deregister:function(e){e&&(Co=Co.filter((t=>t.id!==e)))}};function No(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const To=class{constructor(){No(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),No(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),No(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)})),No(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),No(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)})),No(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),No(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)})),No(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),No(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),No(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),No(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),No(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),No(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),No(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),No(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},Io={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 Ro;const Oo=()=>{if(ee)return 0;if(void 0!==Ro)return Ro;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),Ro=t-n,Ro},Po=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=Po(t.children)),t})),Ao=(e,r)=>{const{fetch:n,columns:a,height:i,minHeight:l,maxHeight:o,border:s=!0,rowSelection:c,summation:u,expandable:d,treeConfig:m,webPagination:h,scrollPagination:f,dragMergeCell:g,showSuperSearch:b,showFastSearch:y,showGroupSummary:v,showTableImport:x,showClipboard:E,showSelectCollection:S,footRender:C}=e,{tableRef:w,tableFullData:N,tableData:T,selectionKeys:I,sorter:R,filters:O,superFilters:P,pagination:A}=r,{selectionRows:k,summaries:F}=w.current,{expandIconColumn:H=""}=m||{},L=t().useMemo((()=>!!n?.api),[n?.api]),$=t().useMemo((()=>!L&&!!h),[L,h]),_=t().useMemo((()=>L&&!!f),[L,f]),D=t().useMemo((()=>(L||$)&&!_),[L,$,_]),q=t().useMemo((()=>!!(i||l||o)),[i,l,o]),j=t().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(Po(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Io.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:Io.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=d,a?.expandedRowRender?{dataIndex:Io.expandableColumn,title:"",width:Io.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),En(t)})(a)),[a]),K=t().useMemo((()=>xn(j)),[j]),M=t().useMemo((()=>K.filter((e=>"function"==typeof e.editRender))),[K]),V=t().useMemo((()=>K.filter((e=>!!e.summation))),[K]),z=t().useMemo((()=>K.filter((e=>"left"===e.fixed))),[K]),U=t().useMemo((()=>K.filter((e=>"right"===e.fixed))),[K]),B=t().useMemo((()=>{const e=K.filter((e=>![Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(e.dataIndex)));return H&&e.some((e=>e.dataIndex===H))?H:e[0]?.dataIndex??""}),[K,H]),W=t().useMemo((()=>V.length>0),[V]),G=t().useMemo((()=>!!C||W),[C,W]),Y=t().useMemo((()=>Pn(j).length>1),[j]),X=t().useMemo((()=>s||Y),[s,Y]),Q=t().useMemo((()=>K.some((e=>e.sorter))),[K]),Z=t().useMemo((()=>K.some((e=>e.filter))),[K]),J=t().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),ee=t().useMemo((()=>!L&&!!x),[L,x]),te=t().useMemo((()=>!!E&&M.length>0),[E,M]),re=t().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),ne=t().useMemo((()=>!!b&&Z),[b,Z]),ae=t().useMemo((()=>!L&&!!y&&Z),[L,y,Z]),ie=t().useMemo((()=>!!v&&K.some((e=>!!e.groupSummary))),[K]),le=t().useMemo((()=>!!u?.groupItems?.length),[u]),oe=t().useMemo((()=>!!g&&!L&&!h),[g,L,h]),se=t().useMemo((()=>N.some((e=>Array.isArray(e.children)))),[N]),ce=t().useMemo((()=>!T.length),[T]),ue=t().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=le?zn(w.current.tableFullData):w.current.tableFullData,u=!k.length&&!!o;let d=(!l||u?c:k).reduce(((e,t)=>{if(t?.[Io.summaryIgnore])return e;const n=Ln(t,r);return Number.isNaN(n)||""===n?e:e.plus(n)}),new(ua())(0));!Object.keys(F).includes(r)||l&&!u||(d=new(ua())(Ln(F,r))),$n(e,r,d.toNumber());let p=n>=0?d.toFixed(n):d.toString();a>=0&&""!==p&&(p=qn(p,a)),p=Dn(p),$n(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[T,I,F]),de=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),pe=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=Io.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:Io.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(O,P);return{...e?{[Io.sorterFieldName]:e}:null,...t.length?{[Io.filterFieldName]:t}:null,...de?{[Io.groupSummary.summaryFieldName]:de,usedJH:1}:null,...n?.params??null,[Io.currentPageName]:A.current,[Io.pageSizeName]:A.pageSize}}),[n?.params,A.current,A.pageSize,R,O,P,de]);return{isFetch:L,isWebPagination:$,isScrollPagination:_,showPagination:D,shouldUpdateHeight:q,tableColumns:j,flattenColumns:K,editableColumns:M,summationColumns:V,leftFixedColumns:z,rightFixedColumns:U,treeExpandIndex:B,showSummary:W,showFooter:G,isHeadGroup:Y,bordered:X,isHeadSorter:Q,isHeadFilter:Z,isServiceSummation:J,isSelectCollection:re,isTableImport:ee,isTableClipboard:te,isSuperSearch:ne,isFastSearch:ae,isGroupSummary:ie,isGroupSubtotal:le,isDragMergeCell:oe,isTreeTable:se,isTableEmpty:ce,summationRows:ue,fetchParams:pe}};function ko(t){const r=e.useRef();r.current=t;const n=e.useCallback((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current?.(...t)}),[]);return n}const Fo=(e,r)=>{const{rowKey:n,dataSource:a,summation:i,fetch:l,initialSorter:o,initialFilter:s,rowSelection:c,expandable:u,treeConfig:d,authConfig:p,ignorePageIndex:m,columnsChange:h,onChange:f,onDataChange:b,onDataLoad:y,onScrollEnd:v,onFetchError:x}=e,{getRowKey:E,tableRef:S,tableElementRef:C,tableBodyRef:w,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:P,filters:A,sorter:k,superFilters:F,fetchParams:H,selectionKeys:L,rowExpandedKeys:$,highlightKey:_,summationColumns:D,shouldUpdateHeight:q,isFetch:j,isTreeTable:K,isWebPagination:M,isScrollPagination:V,isServiceSummation:z,isGroupSubtotal:U,doLayout:B,setTableData:W,setTableFullData:G,setTableOriginData:Y,setAllTableData:X,setDeriveRowKeys:Q,setPagination:ee,setSpinning:te,setSorter:re,setFilters:ne,setSuperFilters:ie,setSelectionKeys:le,setRowExpandedKeys:oe,setHighlightKey:ce,setSelectionRows:ue,setScrollYLoad:de,setScrollYStore:pe,setFieldAuth:me,setResizeState:he,setSummaries:fe,setPermission:ge,setRecordsMap:be,resetTableScroll:ye,clearElementStore:ve,clearRecordsMap:xe}=r,{store:Ee}=S.current,Se=Ct(C),Ce=t().useRef({...H}),we=t().useRef(new Map),Ne=t().useRef(!1);qe((()=>{B()}),[T,N,P.tableAutoHeight]),qe((()=>{Te()}),[Se]),qe((()=>{lt(),ot(),st(),j||(M&&Qe(),Ue(a)),o&&re(o),s&&ne(s)}),[a,l?.params]),qe((()=>{const e=Me(H,Ce.current);e||j&&c?.clearableAfterFetched&&ct(),!e&&H[Io.currentPageName]>1&&!l?.stopToFirst?Qe():j&&ze(),Ce.current=H}),[H]),qe((()=>{M&&rt(),V||ye(),De()}),[O.current,O.pageSize]),qe((()=>{j||Ie(R.length),B()}),[R]),qe((()=>{K&&d?.virtual&&(Ze(),rt())}),[$]);const Te=()=>{const{scrollYLoad:e,resizeState:t}=S.current,{height:r}=t,{width:n,height:a}=Se,i=a!==r;B(),i&&q&&e&&rt(),he(Object.assign({},t,{width:n,height:a}))},Ie=e=>{e!==O.total&&ee((t=>Object.assign({},t,{total:e})))},Re=e=>{Ne.current=e},Oe=wt((e=>{Ge(),v?.(e)})),Pe=e=>U?Ae(ke(e,0)):e,Ae=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ae(e.children)),delete e.children,t.push(e)})),t},ke=(e,t)=>{const r=i.groupItems?.[t];return r?Bn(e,[r.dataIndex]).map((e=>{const a={children:ke(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&$n(a,n.toString(),Mn()),r.titleIndex&&$n(a,r.titleIndex,Ln(e[0],r.titleIndex)),$n(a,r.dataIndex,Ln(e[0],r.dataIndex)),D.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[Io.summaryIgnore])return e;const n=Number(Ln(r,t));return Number.isNaN(n)?e:e+n}),0);$n(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Fe=e=>{le(e),ue((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=S.current;if(j)return[...t.filter((t=>e.includes(E(t,t.index)))),...r.filter((r=>{const n=E(r,r.index);return e.includes(n)&&-1===t.findIndex((e=>E(e,e.index)===n))}))];const a=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];n.has(r)&&a.push(n.get(r))}return a})(e))},He=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:L;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{deriveRowKeys:r}=S.current,n=Rn(r,e);let a=[];if(!n)return a;const i=$e(n?.children||[]),l=Gn(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=Rn(r,e),n=Hn(a,t?.children?.map((e=>e.rowKey))||[]);a=n?[...a,e]:a.filter((t=>t!==e))})),a})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},Le=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=u||{},i=Array.isArray(e)?e:$;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...L];_&&e.unshift(_);let l=[];return e.forEach((e=>{const t=Gn(S.current.deriveRowKeys,e)||[];l.push(...t.length>1?t.slice(0,-1).reverse():t)})),l=n?t:[...new Set([...i,...l])],l.filter((e=>!r.includes(e)))}return u?n?t.slice(0):[...i]:[]},$e=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...$e(e[r].children)),t.push(e[r].rowKey);return t},_e=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(..._e(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(..._e(e,r[r.length-1])),r},De=wt((()=>{We(),f?.(O,Ke(A),je(k),F,{currentDataSource:et()})})),je=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},Ke=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[Io.showFilterType?`${n}|${a}`:n]=e[r]}return t},Me=(e,t)=>{const r=Object.keys(Fn(e,t));return 1===r.length&&(r.includes(Io.currentPageName)||r.includes(Io.pageSizeName))},Ve=ko((async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(H))return;const a=!!i?.fetch?.api;te(!0);try{const[t,o]=a?await Promise.all([l.api(e(H)),i.fetch.api(e(H))]):[await l.api(e(H))];if(S.current.unMounted)return;if(a?200===t.code&&200===o.code:200===t.code){const e=l.dataKey??Io.dataKey;let a=(0,J.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,J.get)(t.data,e.replace(/[^.]+$/,Io.totalKey))||a.length||0,s=Math.max(Math.ceil(i/O.pageSize),1);if(H[Io.currentPageName]>s)return Ye({...O,current:s});Ue(Ne.current?S.current.tableFullData.concat(a):a),Ie(i),Be(o?.data||t.data),n?.(t.data,t)}}catch(e){x?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),te(!1),Re(!1)})),ze=wt(Ve),Ue=e=>{const t=e=>e.map(((e,r)=>(Array.isArray(e.children)&&(e.children=t(e.children)),e.index=r,m||(e.pageIndex=(e=>{const{current:t,pageSize:r}=O;return!j||V?e:(t-1)*r+e})(r)),e))),r=Pe(t(e));nt(r),at(r),it(),Fe(He()),oe(Le()),We(),y?.(r)},Be=e=>{if(!z)return;const t=i?.fetch?.dataKey??Io.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};D.filter((e=>!!e.summation.dataKey)).forEach((e=>{$n(n,e.dataIndex,Number(Ln(r,e.summation.dataKey)))})),fe(n)},We=()=>{const{type:e,selectFirstRowOnChange:t}=c||{};if("radio"===e&&t){const e=et();if(e.length){const t=E(e[0],e[0].index);Fe([t])}else Fe([])}},Ge=()=>{if(!V)return;const e=Xe();Ne.current||O.current>=e||(Re(!0),Ye({...O,current:O.current+1}))},Ye=e=>{let{current:t,pageSize:r}=e;ee((e=>Object.assign({},e,{current:t,pageSize:r})))},Xe=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Qe=()=>{Ye(Object.assign({},O,{current:1}))},Ze=()=>{if(!S.current.treeTable||!d?.virtual)return;const e=Je(S.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=u||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?$.filter((e=>!n.includes(e))):$})());we.current.clear(),e.forEach(((e,t)=>we.current.set(e,t)))},Je=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Je(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},et=()=>M?(()=>{const{current:e,pageSize:t}=O;return S.current.tableFullData.slice((e-1)*t,e*t)})():S.current.tableFullData,tt=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;W(t?e.slice(r.startIndex,r.endIndex):e)},rt=()=>{let e=et();S.current.treeTable&&d?.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:r}=S.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];we.current.has(a)&&n.push(t[e])}return n})()),de(e.length>Io.virtualScrollY),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=S.current,{startIndex:a,rowHeight:i}=r;let l="",o="";n&&(l=`translateY(${Math.max(0,a*i)+"px"})`,o=e.length*i+"px"),t.$tableBody.style.transform=l,t.$tableYspace.style.height=o})(e),tt(e)},nt=e=>{G(e),X(e),Q(e),Ze(),rt()},at=e=>{Y(e)},it=()=>{const{allTableData:e}=S.current;xe(),e.forEach((e=>be(E(e,e.index),e)))},lt=()=>{re({})},ot=()=>{ne({})},st=()=>{ie([])},ct=()=>{Fe([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=Z()(p,["fetch"]);if(p.fetch){const{api:e,params:r,dataKey:n}=p.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,J.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;ge((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=Cn(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:l}=a,o=wn(r,n);me(n,{visible:t,disabled:i,secretName:l}),t||(e.noAuth=!0,o.noAuth=!0),l&&(e.formatType=`secret-${l}`,o.formatType=`secret-${l}`)}}));h?.(n)}})(),_&&w.current.setClickedValues([_,""]),"radio"===c?.type&&L.length&&w.current.setClickedValues([L[0],""]),j?Ve():Ue(a)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&g("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:nt,getTableData:Ve,handleTableData:tt,createTableData:Ue,createGroupData:Pe,createSelectionKeys:He,createRowExpandedKeys:Le,setSelectionKeysEffect:Fe,findParentRowKeys:_e,getAllChildRowKeys:$e,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ee.removeFromRequired({x:r,y:n}),Ee.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&se(t)&&Ee.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Ee.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Ee.state,i=(0,J.intersection)(r,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,J.intersection)(n,r),...(0,J.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(S.current.tableFullData)},tableChange:De,toLastPage:()=>{const e=Xe();O.current!==e&&Ye(Object.assign({},O,{current:e}))},toFirstPage:Qe,getPageCount:Xe,pagerChangeHandle:Ye,triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:l}=t,o=Math.floor(e/l),s=Math.max(0,o-1-a),c=o+i+a;(o<=r||o>=n-i-1)&&(r===s&&n===c||(pe(Object.assign({},t,{startIndex:s,endIndex:c})),rt()))}(e)},scrollBottomDebouncer:Oe,clearTableSorter:lt,clearTableFilter:ot,clearSuperFilters:st,clearRowSelection:ct,clearRowHighlight:()=>{ce("")},clearTableLog:()=>{Ee.clearAllLog()},destroy:()=>{ve(),Ee.destroy(),wo.deregister(S.current.uid)}}},Ho=(e,r)=>{const{height:n,minHeight:a,maxHeight:i,rowHeight:l,resizable:o,showHeader:s,spanMethod:c}=e,{getRowKey:u,tableRef:d,$size:p,tableColumns:m,flattenColumns:h,leftFixedColumns:f,layout:g,scrollY:b,tableData:y,showFooter:v,showPagination:x,isWebPagination:E,isFullScreen:S,setLayout:C,setScrollX:w,setScrollY:N,setElementStore:T,setScrollYStore:I,setShouldToTop:R}=r,O=t().useRef(b),P=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=g,r={};return a&&Object.assign(r,{minHeight:`${kn(a)}px`}),i&&Object.assign(r,{maxHeight:`${kn(i)}px`}),S?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${kn(n)}px`:`${t}px`}:r}),[n,i,a,S,g]),A=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:a}=d.current,i=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)i.scrollTop=t*n.rowHeight;else{const t=(E?On(y):a).findIndex((t=>e===u(t,t.index)));i.scrollTop=(t<0?0:t)*n.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{T(t,e[t])}))},tableStyles:P,getSpan:(e,t,r,n,a)=>{let i=1,l=1;if("function"==typeof c){const o=c({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}const{mergeCells:o}=d.current;if(o.length>0){const e=o.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Nn(wn(m,e)).dataIndex);let t=0;for(let r=0;r<h.length;r++){const n=h[r];if(n.dataIndex===e)break;t+=kn(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Tn(wn(m,e)).dataIndex);let t=0;for(let r=h.length-1;r>=0;r--){const n=h[r];if(n.dataIndex===e)break;t+=kn(n.width||n.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:r}=d.current,n=void 0===t?h.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=f.map((e=>e.width||e.renderWidth||Io.defaultColumnWidth)).reduce(((e,t)=>e+t),0);r.$tableBody.parentNode.parentNode.scrollLeft=r.$tableBody.querySelectorAll("tbody > tr > td")[n].offsetLeft-a},scrollYToRecord:A,rowInViewport:e=>{const{elementStore:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=g,i=e*r.rowHeight,l=t.$tableBody.parentNode.parentNode;return!(i<l.scrollTop||i+r.rowHeight>l.scrollTop+(scrollX?n-a:n))},calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=d.current,r=t.winHeight-e.$table.getBoundingClientRect().top-(x?ya["small"!==p?"middle":p]+fo:0)-fo;C((e=>Object.assign({},e,{tableAutoHeight:r})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&A("",0),R(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=s?e.$header.offsetHeight:g.headerHeight,i=v?e.$footer.offsetHeight:g.footerHeight,o=n-a-i,c=e.$tableBody.offsetHeight,u=t||c>o;let m=0;if(S){const t=e.$toper?e.$toper.offsetHeight+fo:0,n=e.$pager?e.$pager.offsetHeight+fo:0;m=r.winHeight-t-n-20}o!==g.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=d.current,{startIndex:n,endIndex:a}=t,i=l||Io.rowHeightMaps[p],o=Math.max(8,Math.ceil(e/i)+2),s=r?5:0;I(Object.assign({},t,{visibleSize:o,offsetSize:s,endIndex:Math.max(n+o+s,a),rowHeight:i}))})(o),O.current=u,N(u),C((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:o,tableBodyHeight:c,tableFullHeight:m})))})(),(()=>{const{elementStore:e}=d.current,t=e.$table.clientWidth,r=O.current?g.gutterWidth:0,{defaultColumnWidth:n}=Io,a=h.filter((e=>"number"!=typeof e.width));let i=0;if(h.forEach((e=>{"number"==typeof e.width&&(e.renderWidth=void 0)})),a.length>0){if(h.forEach((e=>{i+=e.width||e.minWidth||n})),i<=t-r){w(!1);const e=t-r-i;if(1===a.length&&o)a[0].renderWidth=(a[0].minWidth||n)+e;else{const t=e/a.reduce(((e,t)=>e+(t.minWidth||n)),0);let r=0;a.forEach(((e,a)=>{if(0===a)return;const i=Math.floor((e.minWidth||n)*t);r+=i,e.renderWidth=(e.minWidth||n)+i})),o&&(a[0].renderWidth=(a[0].minWidth||n)+e-r)}}else w(!0),a.forEach((e=>{e.renderWidth=e.minWidth||n}));C((e=>Object.assign({},e,{tableBodyWidth:Math.max(i,t)})))}else h.forEach((e=>{e.renderWidth=e.width||e.minWidth||n,i+=e.renderWidth})),w(i>t),C((e=>Object.assign({},e,{tableBodyWidth:i})));C((e=>Object.assign({},e,{tableWidth:t})))})()}}},Lo=e=>{const{total:r}=e,{tableRef:n,selectionKeys:a,isHeadSorter:i,isHeadFilter:l,isTreeTable:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:u,clearRowSelection:d,clearRowHighlight:m}=t().useContext(mo),{infoBarConfig:h,rowSelection:f,rowHighlight:g}=n.current.props,{allTableData:b,invalidRowKeys:y}=n.current,{hideAlert:v,hideClearButton:x}=h||{},E=t().useMemo((()=>!v),[v]),S=t().useMemo((()=>!x&&!!(i||l||f||g)),[x,i,l,f,g]),C={[`${Ce("table")}__alert`]:!0};return E?t().createElement("div",{className:Se()(C)},t().createElement("i",{className:"svgicon icon"},t().createElement(we.InfoCircleFilled,null)),t().createElement("span",null,p("qm.table.alert.total",{total:o?b.length:r}),f?`,${p("qm.table.alert.selected",{total:a.length-y.length})}`:""),S&&t().createElement("em",{onClick:()=>{s(),c(),u(),d(),m()}},p("qm.table.alert.clear"))):null},$o=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(mo),l=()=>{i(!n)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table");return a?t().createElement("span",{className:`${o}-full-screen`,title:p(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},n?t().createElement(we.FullscreenExitOutlined,null):t().createElement(we.FullscreenOutlined,null))):null}));$o.displayName="FullScreen";const _o=$o,Do=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(mo),i=()=>{a()};t().useImperativeHandle(r,(()=>({clickHandle:i})));const l=Ce("table");return n?t().createElement("span",{className:`${l}-reload`,title:p("qm.table.refresh.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ReloadOutlined,null))):null}));Do.displayName="Reload";const qo=Do,jo=()=>{const e={dateFormat:e=>{const t=e?s()(e).format(yo):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(vo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(vo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(e)?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>Dn(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},t=(t,r,n)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=r,c=a||s?.(n,r)?.items||[];let u=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(u=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==u&&(u=Number.isNaN(u)?u:new(ua())(u).toFixed(i)),l>=0&&""!==u&&(u=qn(u,l)),o){const t=e[`${oe(o)}Format`];t?u=t(u):g("Table","字段的格式化类型 `formatType` 配置不正确")}return u},r=e=>te(e)?Vn(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,a,i)=>{const l=Ln(e,n.dataIndex),o=n.render?n.render(l,e,n,a,i):t(l,n,e);return r(o)}}},Ko=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,flattenColumns:s,summationRows:c,showSummary:u,getSpan:d}=t().useContext(mo),{tablePrint:m,showHeader:h}=o.current.props,{getTitleFromCellValue:f}=jo(),g=i?.print?.leftLogo??"",b=i?.print?.rightLogo??"",y=!(!g&&!b),v=t().useMemo((()=>ce(In(n,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn]))),[n]),x=t().useMemo((()=>ce(In(s,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn]))),[s]),E=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),S=e=>{const t=Object.assign({},Wn(v,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},C=(e,t)=>(0,J.map)((0,J.groupBy)((0,J.flatten)(e),t),(0,J.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,J.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return C(e.concat(r),t)}))}))),w=()=>{const{allTableData:e}=o.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||Io.defaultColumnWidth,n<=Io.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),E.length&&e.unshift(...E),t.push(r),r=[],n=0,a=0):(i.width=Io.printWidth,r.push(i),t.push(r),a++)}return t})([...x]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(S(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:C(r,"dataIndex")[0]})))(r),t.push(Pn(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=N(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},N=(e,t,r)=>{const{showLogo:n=!0}=m;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||Io.defaultColumnWidth}px">`})).join("")}</colgroup>`,h&&(a+=["<thead>",n&&y?`<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">',g?`<img src="${g}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${r.map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=d(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${f(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),u&&c.length&&(a+=["<tfoot>",c.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):Ln(e,`${a}_text`);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},T=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});Ft(e,i)}})(0,w())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),o.current.isIE?(n.contentDocument.write(t),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(r))}))};t().useImperativeHandle(r,(()=>({clickHandle:T})));const I=Ce("table");return a?t().createElement("span",{className:`${I}-print`,title:p("qm.table.print.text"),onClick:()=>T()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PrinterOutlined,null))):null}));Ko.displayName="TablePrint";const Mo=Ko,Vo=require("exceljs");var zo=n.n(Vo);const Uo="606060",Bo="thin",Wo="d4d4d4",Go=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Yo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Xo=()=>({top:{style:Bo,color:{argb:Wo}},left:{style:Bo,color:{argb:Wo}},bottom:{style:Bo,color:{argb:Wo}},right:{style:Bo,color:{argb:Wo}}}),Qo=e=>{const{children:t}=e;return t&&t.length?Qo(t[0]):e},Zo=e=>{const{precision:t,formatType:r}=e,n=t>=0?t?`0.${new Array(t).fill("0").join("")}`:"0":"";return n?{numFmt:n}:"percent"===r?{numFmt:t>=0?`${n}%`:"0%"}:"finance"===r?{numFmt:t>=0?`#,##${n}`:"#,##0"}:null},Jo=()=>{const{tableRef:e,getSpan:r,showSummary:n,isHeadGroup:a}=t().useContext(mo),{spanMethod:i,showHeader:l}=e.current.props,o=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(t,o,s,c)=>{const{columns:u,footSummation:d}=t,{scrollYStore:{rowHeight:m}}=e.current,h=xn(u),f=Pn(u),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,title:r,width:n,minWidth:a,renderWidth:i}=e;E[t]=r,y.push({key:t,width:(n||i||a||Io.defaultColumnWidth)/8})})),l&&(a?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Qo(e),l=h.findIndex((e=>{let{dataIndex:t}=e;return t===i.dataIndex}));r[i.dataIndex]=e.title,0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=o.map(((e,t)=>{const n={};return h.forEach(((a,l)=>{if("function"==typeof i){const{rowSpan:n,colSpan:i}=r(e,a,t,l,o);(i>1||n>1)&&v.push({s:{r:t+x,c:l},e:{r:t+x+n-1,c:l+i-1}})}const s=["percent","finance"].includes(a.formatType);n[a.dataIndex]=s?Ln(e,a.dataIndex):c(e,t,a,l)})),n}));x+=S.length,n&&d&&s(h,o).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(o):Ln(e,a);r[a]=0===n&&""===l?p("qm.table.config.summaryText"):te(l)?Vn(l).join(""):l})),b.push(r)}));const{sheetName:C,useStyle:w}=t,N=new(zo().Workbook),T=N.addWorksheet(C);T.columns=y,l&&T.addRows(g).forEach((e=>{w&&Go(e,m),e.eachCell((e=>{const t=T.getColumn(e.col),r=wn(u,t.key),{align:n,theadAlign:a}=r;Yo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:Uo}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Xo()})}))})),T.addRows(S).forEach((e=>{w&&Go(e,m),e.eachCell((e=>{const t=T.getColumn(e.col),r=wn(u,t.key),{align:n}=r;Yo(e,n),Object.assign(e,Zo(r)),w&&Object.assign(e,{font:{color:{argb:Uo}},border:Xo()})}))})),n&&d&&T.addRows(b).forEach((e=>{w&&Go(e,m),e.eachCell((e=>{const t=T.getColumn(e.col),r=wn(u,t.key),{align:n}=r;Yo(e,n),Object.assign(e,Zo(r)),w&&Object.assign(e,{font:{color:{argb:Uo}},border:Xo()})}))})),v.forEach((e=>{let{s:t,e:r}=e;T.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const I=await N.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],l=l+(n?",":"")+r(i.textContent.trim());l+="\r\n"}return l})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=xn(r),i=new FileReader;i.onerror=()=>{P.message.error(p("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>e.title)),n=new(zo().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,l);if(s){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;(0,J.isPlainObject)(n)&&(n=e.text),(0,J.isDate)(n)&&(n=Kn(e,vo)),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>o(l,e))).filter((e=>""!==e)):t[e]=o(l,t[e])),$n(n,i,t[e])})),n}));t?.(n)}else P.message.error(p("qm.table.import.error"))}else P.message.error(p("qm.table.import.error"))})):P.message.error(p("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},es=e=>{const{fileType:r,onChange:n}=e;let a,i;const l=Ce("table"),o=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return t().createElement(he,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),i=document.createElement("input"),a.className=`${l}--file-form`,i.name="file",i.type="file",a.appendChild(i),document.body.appendChild(a)),new Promise(((e,r)=>{const n=!t.type;i.multiple=!!t.multiple,i.accept=n?"":`.${t.type}`,i.onchange=l=>{const{files:s}=l.target,c=s[0];let u="";if(!n)for(let e=0;e<s.length;e++){const{type:r}=o(s[e]);if(t.type!==r){u=r;break}}u?(P.message.warning(p("qm.upload.notType",{type:u})),r()):e(c),document.body.removeChild(a),a=null,i=null},a.reset(),i.click()}))})({type:r});n?.(e.name,e)}catch(e){}})()},p("qm.upload.text"))},ts=e=>{const{columns:r,onClose:n}=e,{tableRef:a,createTableData:i,dataChange:l}=t().useContext(mo),{beforeTableImport:o}=a.current.props,{importXLSX:s}=Jo(),c=t().useRef(null),[u,d]=t().useState(!1),[m,h]=t().useState(!0),f=e=>e.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))),[g,b]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName",render:(e,r)=>{const{fileName:n}=r.GET_FIELDS_VALUE(["fileName"]);return t().createElement(t().Fragment,null,n?t().createElement("span",null,n):t().createElement(es,{fileType:r.state.formData.fileType,onChange:(e,t)=>{r.SET_FIELDS_VALUE({fileName:e,file:t}),t&&h(!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=>{g.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,b([...g])}},{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}}]),y=Ce("table");return t().createElement("div",{className:`${y}-import__setting`},t().createElement(vl,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:g,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:u,disabled:m,onClick:()=>(async()=>{const[e,t]=await c.current.GET_FORM_DATA();e||(d(!0),s({columns:f(r),file:t.file},(async e=>{const{tableFullData:r,store:s}=a.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof o)try{e=await o(e)}catch(e){}if("fill"===t.importType&&i(e),"add"===t.importType&&i([...r,...e]),"insert"===t.importType){const{tableFullData:r}=a.current,n=t.posIndex,l=r.slice(0,n).concat(e).concat(r.slice(n));i(l)}e.forEach((e=>{s.addToInserted(e)})),l(),P.message.success(p("qm.table.import.success",{total:e.length})),d(!1),n()})))})()},p("qm.table.import.text"))))},rs=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s={[`${Ce("table")}-import`]:!0},c={visible:i,title:p("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(s),title:p("qm.table.import.textNoSpace"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ImportOutlined,null))),t().createElement(ur,c,t().createElement(ts,{columns:n,onClose:()=>l(!1)})))}));rs.displayName="TableImport";const ns=rs,as=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(mo),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);qe((()=>{d()}),[s]),t().useEffect((()=>{u()}),[r]);const u=()=>{const e=[];r.forEach(((t,n)=>{const a=t.colSpan;a>1&&r.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(r.slice(n,n+a))})),i.current=e},d=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=i.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...i.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),n?.(e)},m=Ce("table"),h={[`${m}__popper`]:!0,"column-filter__popper":!0,[`${m}--lg`]:"large"===a,[`${m}--sm`]:"small"===a},f=[`${m}-column-filter`,{selected:l}];return t().createElement(Pa(),{action:["click"],popupVisible:l,popup:t().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"main"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||c(Qn(e))}},s.map((e=>((e,r)=>{const{colSpan:n}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=["svgicon","handle","main-handle"];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(P.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),t().createElement("i",{className:Se()(a),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title))})(e)))))),popupClassName:Se()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{o(e)},builtinPlacements:Eo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(f),title:p("qm.table.columnFilter.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),t().createElement("span",null,p("qm.table.columnFilter.text"))))},is=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableRef:i,selectionKeys:l,pagination:o,showSummary:c}=t().useContext(mo),{rowSelection:u}=i.current.props,d=t().useRef(null),[m,h]=t().useState(!1),f=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(xo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:l.length?"selected":"all","startIndex|endIndex":[1,o.total],footSummation:c?1:0,useStyle:0},r,{columns:ce(r.columns||[])})),[]),[g,b]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:p("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:p("qm.table.export.all"),value:"all"},{text:p("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==u?.type},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,r)=>t().createElement(as,{columns:r.state.formData.columns,onChange:e=>{r.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ce("table");return t().createElement("div",{className:`${y}-export__setting`},t().createElement(vl,{ref:d,initialValues:f,items:g,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:m,onClick:()=>(async()=>{const[e,t]=await 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 ie(1e3),h(!1),n()}})()},p("qm.table.export.text"))))},ls=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:c,flattenColumns:u,pagination:d,fetchParams:m,isFetch:h,isGroupSubtotal:f,showSummary:g,getSpan:b}=t().useContext(mo),{exportExcel:y,fetch:v,showHeader:x}=o.current.props,{getTitleFromCellValue:E}=jo(),[S,C]=t().useState(!1),[w,N]=t().useState(!1),T=t().useMemo((()=>!!y?.fetch?.api),[y]),I=t().useMemo((()=>!d.total||w),[d.total,w]),R=t().useMemo((()=>In(n,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn])),[n]),O=t().useMemo((()=>In(u,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn])),[u]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(f?zn(t):t).reduce(((e,t)=>{if(t?.[Io.summaryIgnore])return e;const r=Number(Ln(t,n));return Number.isNaN(r)?e:e+r}),0);$n(r,n,a)})),[r]},k=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let l=E(e,r,t,n);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:F,exportCSV:H}=Jo(),L=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=v;let i=[];try{N(!0);const l=await t({...r(m),[Io.currentPageName]:1,[Io.pageSizeName]:e??d.total});if(200===l.code){let e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,a)??[];e="function"==typeof n?await n(e):e,i=On(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return O.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&$n(r,n,Ln(r,n))})),r})))}}catch(e){}return N(!1),i},$=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},_=y?.fileName??`${s()().format(xo)}.xlsx`,D=_.slice(_.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(I)return P.message.warning(p("qm.table.export.warnText"));T?(async e=>{N(!0);try{const{api:t,params:r}=y.fetch,n=await t({columns:O.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...m,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[Io.currentPageName]:void 0,[Io.pageSizeName]:void 0});n.data&&(Ft(n.data,e),$(e))}catch(e){}N(!1)})(_):C(!0)};t().useImperativeHandle(r,(()=>({clickHandle:q})));const j={[`${Ce("table")}-export`]:!0},K={visible:S,title:p("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},M={fileName:_.slice(0,_.lastIndexOf(".")),fileType:D,columns:R,useStyle:y?.cellStyle?1:0};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(j),title:p("qm.table.export.textNoSpace"),onClick:()=>q()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.DownloadOutlined,null))),t().createElement(ur,K,t().createElement(is,{defaultValue:M,onClose:()=>C(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:i}=e,{allTableData:l,selectionRows:s}=o.current;let c=[];if(h?("all"===n&&(c=await L()),"custom"===n&&(c=await L(i),c=c.slice(a-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(a-1,i||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof y?.beforeExport)try{c=y?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await F(e,c,A,k);Ft(r,`${t}.xlsx`),$(`${t}.xlsx`)}if("csv"===r){const r=H(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=Pn(r),i=xn(r);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||Io.defaultColumnWidth}px">`})).join("")}</colgroup>`,x&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${t.map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=b(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),g&&n&&(l+=["<tfoot>",A(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,l=i?.render?i.render(t):Ln(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?Vn(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));Ft(r,`${t}.csv`),$(`${t}.csv`)}})(Object.assign({},e,{columns:En(e.columns)}))}})))}));ls.displayName="TableExport";const os=ls,ss=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,dataChange:l}=t().useContext(mo),{beforeClipboard:o}=a.current.props,s=t().useRef(null),[c,u]=t().useState([{type:"INPUT_NUMBER",label:p("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:p("qm.table.clipboard.colIndex"),fieldName:"dataIndex",options:{itemList:r.map(((e,t)=>({value:t,text:e.title})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:p("qm.table.clipboard.content"),fieldName:"content",placeholder:p("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[d,m]=t().useState(!1),h=Ce("table");return t().createElement("div",{className:`${h}-clipboard__setting`},t().createElement("h3",{className:"info"},p("qm.table.clipboard.supportText")),t().createElement(vl,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",dataIndex:"列"},items:c,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:d,onClick:()=>(async()=>{const[e,t]=await s.current.GET_FORM_DATA();if(e)return;const{tableFullData:c,store:u}=a.current;m(!0);const d=t.content.trim().replace(/(\r|\n)$/,"");let h=d.replace(/"[^"]+"/g,"^");(d.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{h=h.replace(/\^/,e)}));let f=h.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof o)try{f=await o(f,f[0].map(((e,n)=>r[t.dataIndex+n].dataIndex)))}catch(e){}f.forEach(((e,n)=>{e.forEach(((e,i)=>{const l=c[t.rowIndex-1+n],o=r[t.dataIndex+i];if(l&&o){let t=!1;if(o.editRender){const e=o.editRender(l,o);t=!(e.disabled||e.extra?.disabled||a.current.fieldAuth[o.dataIndex]?.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&($n(l,o.dataIndex,e),u.addToUpdated(l))}}))})),i.current.forceUpdate(),l(),P.message.success(p("qm.table.clipboard.success",{total:f.length})),m(!1),n()})()},p("qm.table.clipboard.text"))))},cs=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:s})));const c={[`${Ce("table")}-clipboard`]:!0},u={visible:i,title:p("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(c),title:p("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CopyOutlined,null))),t().createElement(ur,u,t().createElement(ss,{columns:o,onClose:()=>l(!1)})))}));cs.displayName="TableClipboard";const us=cs,ds=e=>{const{columns:r,onClose:n}=e,{tableRef:a,$size:i,selectionKeys:l,setSelectionKeysEffect:o}=t().useContext(mo),{rowKey:s}=a.current.props,c=t().useRef(null),u=Ct(c),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})),[m,h]=t().useState([{title:p("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...d(r.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))))]),[f]=t().useState(a.current.selectionRows.map((e=>({...e,children:void 0})))),[g,b]=t().useState(300),y=wt((()=>{const e=c.current;b(e.offsetHeight-2*ya[i]-30)}),5);return qe((()=>{y()}),[u.width]),t().createElement("div",{ref:c,style:{height:"100%"}},t().createElement(fc,{size:i,columns:m,dataSource:f,rowKey:s,height:g,rowSelection:{type:"checkbox",selectedRowKeys:l,onChange:e=>o(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"))))},ps=t().forwardRef(((e,r)=>{const{columns:n,open:a=!0}=e,{tableRef:i,getRowKey:l,selectionKeys:o,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:u,setSelectionRows:d}=t().useContext(mo),{rowSelection:m}=i.current.props,[h,f]=t().useState(!1),g=t().useRef(!1);qe((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=m;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:o},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),u(n.map(((e,t)=>l(e,t)))),d(n),g.current=!0}}catch(e){}},y=()=>{f(!0)};t().useImperativeHandle(r,(()=>({clickHandle:y})));const v=Ce("table"),x={visible:h,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>f(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${v}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>y()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CheckSquareOutlined,null))),t().createElement(ur,x,t().createElement(ds,{columns:n,onClose:()=>f(!1)})))}));ps.displayName="SelectCollection";const ms=ps,hs=require("localforage");var fs=n.n(hs);const gs=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),bs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableRef:a,getRowKey:i,$size:o,flattenColumns:s,pagination:c,setPagination:u,scrollYToRecord:d,setHighlightKey:m,setShouldToTop:h,isTreeTable:f,isWebPagination:b}=t().useContext(mo),{uniqueKey:y}=a.current.props,v=t().useRef(null),x=t().useRef(null),E=t().useRef([]),S=t().useRef(""),C=t().useRef(-1),w=t().useRef("stop");qe((()=>{const{current:e,pageSize:t}=c,r=a.current.tableFullData.slice((e-1)*t,e*t),n=On(r).findIndex((e=>i(e,e.index)===S.current));d("",n)}),[c.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=>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 v.current.GET_FORM_DATA(),[r,n]=await x.current.GET_FORM_DATA(),a=(0,J.omitBy)(Object.assign({},t,n),se);A(a)}}))),I={case:0,fullchar:0},R=t().useMemo((()=>s.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[s]),[O,A]=t().useState({}),[k,F]=t().useState(I),[H]=t().useState(T([R[0]])),[L]=t().useState(T(R.slice(1))),[$,_]=t().useState(0),D=t().useMemo((()=>!Object.keys(O).length),[O]);qe((()=>{w.current="ready"}),[O,k]);const q=e=>{F(Object.assign({},k,e))},j=(e,t,r)=>new Promise(((n,a)=>{P.Modal.confirm({title:p("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),K=async e=>{if(!Object.keys(O).length)return P.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.queryCondition")});if("ready"===w.current&&(w.current="stop",E.current=(e=>{const{allTableData:t}=a.current,r=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];let i=!0;for(const t in e){const{type:r}=R.find((e=>e.dataIndex===t)).filter;let n=Ln(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(k.fullchar?`^${e[t]}$`:e[t],k.case?"":"i").test(n):(n=gs(n)?n.slice(0,10):n,l=n==e[t]),!l){i=!1;break}}i&&r.push(a)}return r})(O),_(E.current.length)),!E.current.length)return m(""),P.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>E.current.length-1&&await j(p("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=E.current.length-1))),"prev"===e&&(C.current=C.current<0?E.current.length-1:C.current-1,C.current<0&&await j(p("qm.table.fastSearch.toStart"),(()=>C.current=E.current.length-1),(()=>C.current=0)));const t=E.current[C.current],r=i(t,t.index);let n=t.index;if(f&&b){const e=Gn(a.current.deriveRowKeys,r)[0];n=a.current.tableFullData.findIndex((t=>i(t,t.index)===e))}((e,t)=>{if(S.current=e,b){const{pageSize:e}=c,r=Math.ceil((t+1)/e);h(!1),u(Object.assign({},c,{current:r}))}else d(e)})(r,n),m(r)},M=()=>{v.current.RESET_FORM(),x.current.RESET_FORM()},V=t().useMemo((()=>y?`fastSearch_${y}`:""),[y]),[z,U]=t().useState([]),[B,W]=t().useState(""),[G,Y]=t().useState("");qe((()=>{if(G){const{filters:e,config:t}=z.find((e=>e.value===G)).list;v.current.SET_FIELDS_VALUE(Z()(e,L.map((e=>e.fieldName)))),x.current.SET_FIELDS_VALUE(Z()(e,H.map((e=>e.fieldName)))),A(e),F(t)}else M(),A({}),F(I)}),[G]),t().useEffect((()=>{X()}),[]);const X=async()=>{if(!V)return;let e=await fs().getItem(V);e||(e=await Q(V),Array.isArray(e)&&await fs().setItem(V,e)),Array.isArray(e)&&e.length&&(U(e),Y(e[0].value))},Q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},ee=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},te=Ce("table");return t().createElement("div",{className:`${te}-fast-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"top"},t().createElement("div",{className:"container"},t().createElement(er,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:$}))},t().createElement(er.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(vl,{ref:v,items:H,cols:1,labelWidth:110})),t().createElement(er.TabPane,{tab:p("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t().createElement(vl,{ref:x,items:L,cols:1,labelWidth:110})))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(P.Input,{size:o,value:B,placeholder:p("qm.table.highSearch.configText"),disabled:D,onChange:e=>{const{value:t}=e.target;W(t)}}),t().createElement(he,{type:"primary",disabled:!B||D,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!V)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Mn(),t=[...z,{text:B,value:e,list:{filters:O,config:k}}];U(t),Y(e),W(""),await fs().setItem(V,t),await ee(V,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Io.rowHeightMaps[o]}px`}},t().createElement("span",null,p("qm.table.fastSearch.savedSetting"))),t().createElement("ul",null,z.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===G}),title:e.text,onClick:()=>(e=>{Y(e!==G?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=z.filter((t=>t.value!==e));U(t),e===G&&Y(""),await fs().setItem(V,t),await ee(V,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!z.length&&t().createElement("div",{style:{padding:fo}},t().createElement(ht,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(P.Checkbox,{checked:!!k.case,onChange:e=>q({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(P.Checkbox,{checked:!!k.fullchar,onChange:e=>q({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(he,{onClick:()=>M()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${ya[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.fastSearch.closeButton")),t().createElement(he,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(he,{type:"primary",onClick:()=>K("next")},p("qm.table.fastSearch.queryNext"))))},ys=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(mo),[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s=Ce("table"),c={visible:i,title:p("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${ya[a]+20}px`},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${s}-super-search`,title:p("qm.table.fastSearch.text"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.MonitorOutlined,null))),t().createElement(ur,c,t().createElement(bs,{onClose:()=>l(!1)})))}));ys.displayName="FastSearch";const vs=ys,xs=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,$size:l,pagination:o,fetchParams:c,isFetch:u}=t().useContext(mo),{fetch:d}=i.current.props,m=e=>{const t=r.find((t=>t.dataIndex===e));return{title:t.title,precision:t.precision,dictItems:t.dictItems??[]}},h=n.map((e=>({dataIndex:e.group,...m(e.group)}))),f=a.map((e=>e.summary===Io.groupSummary.total.value?{dataIndex:e.summary,title:Io.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...m(e.summary),formula:e.formula})),g=t().useMemo((()=>Object.assign({},c,{[Io.sorterFieldName]:void 0,[Io.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[Io.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[Io.currentPageName]:1})),[c,n,a]),[b,y]=t().useState(((e,t)=>[{title:p("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{const t=r.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=t?{summation:t}:null;return e.dataIndex===Io.groupSummary.total.value&&(n={dataIndex:Io.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,f)),[v]=t().useState(u?[]:(e=>{const t=Bn(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};b.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&$n(t,n,Ln(e[0],n))})),a.forEach((r=>{const n=r.summary!==Io.groupSummary.total.value?r.summary:Io.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&$n(t,n,e.length),"sum"===a&&$n(t,n,(0,J.sumBy)(e,n)),"max"===a&&$n(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&$n(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&$n(t,n,((0,J.sumBy)(e,n)/e.length).toFixed(2))})),r.push(t)})),r})(i.current.tableFullData)),x={size:l,height:400,...u?{fetch:{api:d.api,params:g,dataKey:d?.dataKey}}:{dataSource:v},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${s()().format("YYYYMMDDHHmmss")}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)};return t().createElement(fc,x)},Es=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableRef:a,$size:i,flattenColumns:o}=t().useContext(mo),{uniqueKey:s}=a.current.props,c=t().useRef(null),u=t().useRef(null),[d,m]=t().useState(!1),[h,f]=t().useState([]),[b,y]=t().useState(""),[v,x]=t().useState("");qe((()=>{if(v){const{group:e,summary:t}=h.find((e=>e.value===v)).list;I(e),k(t)}else{const e=$();I(e?.group||[]),k(e?.summary||[])}}),[v]),t().useEffect((()=>{_()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[Io.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex})))],N=[{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"}],[T,I]=t().useState([]),[R,O]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:p("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:C.map((e=>({...e,disabled:T.findIndex((t=>t.group===e.value))>-1})))})}]),[A,k]=t().useState([]),[F,H]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:p("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:w.map((e=>({...e,disabled:A.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:p("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===Io.groupSummary.total.value?N.slice(N.length-1):N})}]),L=t().useMemo((()=>{const e=T.length&&T.every((e=>Object.values(e).every((e=>""!==e)))),t=A.length&&A.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[T,A]),$=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},_=async()=>{if(!E)return;const e=$();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await fs().getItem(E);t||(t=await D(E),Array.isArray(t)&&await fs().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},D=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table"),K={visible:d,title:p("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>m(!1)};return t().createElement("div",{className:`${j}-group-summary__setting`},t().createElement("div",{className:"main"},t().createElement("div",{style:{width:"30%"}},t().createElement(fc,{ref:c,size:i,columns:R,dataSource:T,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>O(e),onDataChange:e=>{I(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"container line"},t().createElement(fc,{ref:u,size:i,columns:F,dataSource:A,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>H(e),onDataChange:e=>{k(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(P.Input,{size:i,value:b,placeholder:p("qm.table.groupSummary.configText"),disabled:L,onChange:e=>{const{value:t}=e.target;y(t)}}),t().createElement(he,{type:"primary",disabled:!b||L,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Mn(),t=[...h,{text:b,value:e,list:{group:T.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await fs().setItem(E,t),await q(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Io.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.groupSummary.savedSetting"))),t().createElement("ul",null,h.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===v}),title:e.text,onClick:()=>(e=>{x(e!==v?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));f(t),e===v&&x(""),await fs().setItem(E,t),await q(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:fo}},t().createElement(ht,null)))))),t().createElement(ur,K,t().createElement(xs,{columns:S,group:T,summary:A})),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.groupSummary.closeButton")),t().createElement(he,{type:"primary",disabled:L,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:T.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))})),void m(!0))},p("qm.table.groupSummary.confirmButton"))))},Ss=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-group-summary`,title:p("qm.table.groupSummary.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PieChartOutlined,null))),t().createElement(ur,s,t().createElement(Es,{onClose:()=>i(!1)})))}));Ss.displayName="GroupSummary";const Cs=Ss,ws=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableRef:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(mo),{uniqueKey:u}=a.current.props,d=t().useRef(null),[m,h]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");qe((()=>{h(x?f.find((e=>e.value===x)).list:$()||[])}),[x]),t().useEffect((()=>{_()}),[]);const S=t().useMemo((()=>u?`superSearch_${u}`:""),[u]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=Un(m),N=t().useMemo((()=>!(w&&yn(w))),[w]),T=t().useMemo((()=>!!m.length&&N),[m,N]),I=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:e.title}))),O=e=>["in","nin"].includes(e),A=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:p("qm.table.highSearch.gtText")},{value:"<",text:p("qm.table.highSearch.ltText")},{value:">=",text:p("qm.table.highSearch.gteText")},{value:"<=",text:p("qm.table.highSearch.lteText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:p("qm.table.highSearch.inText")},{value:"nin",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.likeText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}]}return t},[F,H]=t().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(r)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=C.find((e=>e.dataIndex===r))?.filter.type,a=k(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=O(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:p("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:p("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=O(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:A(r,O(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:I,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),L=()=>{S&&sessionStorage.setItem(S,JSON.stringify(m.filter((e=>!!e.fieldName))))},$=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},_=async()=>{if(!S)return;const e=$();e&&h(e);let t=await fs().getItem(S);t||(t=await D(S),Array.isArray(t)&&await fs().setItem(S,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},D=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table");return t().createElement("div",{className:`${j}-super-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"container"},t().createElement(fc,{ref:d,size:i,columns:F,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>H(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...m]))},onDataChange:e=>{h(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),Io.highSearch.showSQL&&w&&t().createElement("code",{className:"lang-js"},w)),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(P.Input,{size:i,value:y,placeholder:p("qm.table.highSearch.configText"),disabled:N,onChange:e=>{const{value:t}=e.target;v(t)}}),t().createElement(he,{type:"primary",disabled:!y||N,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Mn(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await fs().setItem(S,t),await q(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Io.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.highSearch.savedSetting"))),t().createElement("ul",null,f.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));b(t),e===x&&E(""),await fs().setItem(S,t),await q(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:fo}},t().createElement(ht,null)))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),t().createElement(he,{type:"primary",disabled:T,onClick:()=>(c(),s(m.map((e=>Z()(e,["index","pageIndex"])))),L(),void r())},p("qm.table.highSearch.searchButton"))))},Ns=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-super-search`,title:p("qm.table.highSearch.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.FunnelPlotOutlined,null))),t().createElement(ur,s,t().createElement(ws,{onClose:()=>i(!1)})))}));Ns.displayName="SuperSearch";const Ts=Ns,Is=t().forwardRef(((e,r)=>{const{tableColumns:n,showFullScreen:a,showReload:i,showPrint:o,showImport:s,showExport:c,showClipboard:u,showCollection:d,showFastSearch:m,showSuperSearch:h,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(l),{tableRef:v,flattenColumns:x,isFullScreen:E,$size:S}=t().useContext(mo),{uniqueKey:C,exportExcel:w}=v.current.props,N=t().useRef(null),T=t().useRef(null),I=t().useRef(null),R=t().useRef(null),O=t().useRef(null),A=t().useRef(null),k=t().useRef(null),F=t().useRef(null),H=t().useRef(null),L=t().useRef(null),$=t().useRef(!1),_=t().useMemo((()=>C?`toolBox_${C}`:""),[C]),[D,q]=t().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),j={fullScreen:a,reload:i,print:o,import:s,export:c&&!w?.hideIcon,clipboard:u,collection:d,fastSearch:m,superSearch:h,groupSummary:f},[K,M]=t().useState(!1);qe((()=>{$.current&&(z(),$.current=!1)}),[D]),t().useEffect((()=>{V()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!O.current)return g("Table","执行导出需要配置 `exportExcel` 参数");O.current.clickHandle()}})));const V=()=>{if(!_||!b)return;const e=JSON.parse(localStorage.getItem(_));e||U(_).then((e=>{e&&(q(Object.assign({},D,e)),localStorage.setItem(_,JSON.stringify(e)))})).catch((()=>{})),e&&q(Object.assign({},D,e))},z=()=>{if(!_||!b)return;const e={};for(const t in D)D[t]&&(e[t]=D[t]);localStorage.setItem(_,JSON.stringify(e)),B(_,e)},U=async e=>{const t=y?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=y?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},W=async e=>{M(!1),await ie(100),e.current.clickHandle()},G=(e,t)=>{$.current=!0,q(Object.assign({},D,{[t]:e}))},Y=Ce("table"),X={"top-toolbox__popper":!0,[`${Y}--lg`]:"large"===S,[`${Y}--sm`]:"small"===S};return t().createElement(t().Fragment,null,a&&t().createElement(_o,{ref:N,isFullScreen:E,open:!b||D.fullScreen}),i&&t().createElement(qo,{ref:T,open:!b||D.reload}),o&&t().createElement(Mo,{ref:I,tableColumns:n,open:!b||D.print}),s&&t().createElement(ns,{ref:R,tableColumns:n,open:!b||D.import}),c&&t().createElement(os,{ref:O,tableColumns:n,open:(!b||D.export)&&!w?.hideIcon}),u&&t().createElement(us,{ref:A,flattenColumns:x,open:!b||D.clipboard}),d&&t().createElement(ms,{ref:k,columns:n,open:!b||D.collection}),m&&t().createElement(vs,{ref:F,open:!b||D.fastSearch}),f&&t().createElement(Cs,{ref:H,open:!b||D.groupSummary}),h&&t().createElement(Ts,{ref:L,open:!b||D.superSearch}),b&&t().createElement(P.Dropdown,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.fullScreen,style:{marginRight:6},onChange:e=>G(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.screen.full"))),onClick:()=>W(N)},{key:"reload",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.reload,style:{marginRight:6},onChange:e=>G(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.refresh.text"))),onClick:()=>W(T)},{key:"print",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.print,style:{marginRight:6},onChange:e=>G(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.print.text"))),onClick:()=>W(I)},{key:"import",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.import,style:{marginRight:6},onChange:e=>G(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.import.textNoSpace"))),onClick:()=>W(R)},{key:"export",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.export,style:{marginRight:6},onChange:e=>G(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.export.textNoSpace"))),onClick:()=>W(O)},{key:"clipboard",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.clipboard,style:{marginRight:6},onChange:e=>G(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.clipboard.textNoSpace"))),onClick:()=>W(A)},{key:"collection",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.collection,style:{marginRight:6},onChange:e=>G(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.selectCollection.text"))),onClick:()=>W(k)},{key:"fastSearch",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.fastSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.fastSearch.text"))),onClick:()=>W(F)},{key:"groupSummary",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.groupSummary,style:{marginRight:6},onChange:e=>G(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.groupSummary.text"))),onClick:()=>W(H)},{key:"superSearch",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.superSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.highSearch.text"))),onClick:()=>W(L)}];return t().createElement(P.Menu,{items:e.filter((e=>j[e.key]))})})(),overlayClassName:Se()(X),overlayStyle:{minWidth:120},onOpenChange:e=>{M(e)}},t().createElement("span",{className:`${Y}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.AppstoreAddOutlined,null)))))}));Is.displayName="ToolBox";const Rs=Is,Os=(e,t)=>e.map((e=>(e.children&&(e.children=Os(e.children,t)),t(e)))),Ps=t().forwardRef(((e,r)=>{const{columns:n}=e,{global:a}=t().useContext(l),{tableRef:i,$size:o}=t().useContext(mo),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:u,columnsChange:d}=i.current.props,m=t().useRef([]),h=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),f=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),g=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[b,y]=t().useState(!1),[v,x]=t().useState(h(n)),[E,S]=t().useState(f(n)),[C,w]=t().useState(g(n)),N=t().useMemo((()=>c?`table_${c}`:""),[c]),T=t().useMemo((()=>[...v,...C,...E]),[v,C,E]);qe((()=>{k(n),A(n),R(n)}),[n]),t().useLayoutEffect((()=>{O()}),[]),t().useImperativeHandle(r,(()=>({initialHandler:O})));const I=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=I(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),R=e=>{if(!N)return;const t=I(e),r=JSON.parse(localStorage.getItem(N));i.current.columnsDefined&&!(0,J.isEqual)(t,r)&&(localStorage.setItem(N,JSON.stringify(t)),(async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(N,t))},O=()=>{const e=(()=>{if(!N)return;const e=JSON.parse(localStorage.getItem(N));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(N).then((e=>{e?(localStorage.setItem(N,JSON.stringify(e)),O()):a?.getComponentConfigApi&&R(n)})).catch((()=>{})),e?(0,J.xor)(Sn(e).map((e=>e.dataIndex)),Sn(n).map((e=>e.dataIndex))).length>0?Os(n,(t=>{const r=wn(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):Os(e,(e=>{const t=wn(n,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();e&&d?.(e)},A=e=>{const t=h(e),r=f(e),n=g(e);return x(t),S(r),w(n),[...t,...n,...r]},k=e=>{const t=[];e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+a))})),m.current=t},F=()=>{const e=[];T.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=m.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...m.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=T.find((e=>e.dataIndex===n));return r>0&&(void 0!==t.hidden&&(a.hidden=t.hidden),void 0!==t.fixed?a.fixed=t.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((t,r)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(r,0,t)})),d?.(e)},H=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const r=A(n);d?.(r)},L=(e,r)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${r}-handle`],l=t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(P.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,F()}}),t().createElement("i",{className:Se()(i),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>H(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>H(e,"right")},t().createElement(we.StepForwardOutlined,null))):"sub"!==r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>H(e)},t().createElement(we.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?t().createElement(P.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:$(e.children,e.dataIndex)},l):l},$=(e,r)=>t().createElement("div",{className:"column-filter--wrap"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const a=t.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,J.isEqual)(a,i)||((e,t)=>{wn(n,t).children=e,d?.([...n])})(Qn(t),r)}},e.map((e=>L(e,"sub"))))),_=Ce("table"),D={[`${_}__popper`]:!0,"column-filter__popper":!0,[`${_}--lg`]:"large"===o,[`${_}--sm`]:"small"===o},q=[`${_}-column-filter`,{selected:b}];return s?t().createElement(Pa(),{action:["click"],popupVisible:b,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=t=>t.map((t=>{const r=wn(n,t.dataIndex)||ce(t);return t.children&&(r.children=e(t.children)),Object.assign(r,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));d?.(e(i.current.originColumns))}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),r=v.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||x(Qn(e))},onEnd:()=>F()},v.map((e=>L(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:C,setList:e=>{const t=e.map((e=>e.dataIndex)),r=C.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||w(Qn(e))},onEnd:()=>F()},C.map((e=>L(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:E,setList:e=>{const t=e.map((e=>e.dataIndex)),r=E.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||S(Qn(e))},onEnd:()=>F()},E.map((e=>L(e,"right")))))),popupClassName:Se()(D),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{y(e)},builtinPlacements:Eo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(q),title:u?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),!u&&t().createElement("span",null,p("qm.table.columnFilter.text")))):null}));Ps.displayName="ColumnFilter";const As=Ps,ks=()=>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 r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fs.apply(this,arguments)}const Hs=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(mo),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[u,d]=t().useState(!1),[m,h]=t().useState(!1),[f,b]=t().useState({}),y=t().useMemo((()=>{const{dataIndex:e,filter:t}=r;return`${e}|${t.type}`}),[r]),v=t().useMemo((()=>{let e=!1;for(const t in n[y])if(!se(n[y][t])||m){e=!0;break}return e}),[y,n,m]);t().useEffect((()=>{u&&setTimeout((()=>x()),50)}),[u]),t().useEffect((()=>{(0,J.isEqual)(f[y],n[y])||b({[y]:n[y]||{}}),h(""===n[y]?.["=="])}),[n]);const x=()=>{switch(r.filter.type){case"text":o.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&b(e),l(),i((e=>{for(const t in e){for(const r in e[t])if(se(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...n,...f,...e})),d(!1)},S={text:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(P.Input,{ref:o,size:a,placeholder:p("qm.table.filter.searchText",{text:r}),style:{width:"180px"},value:f[y]?.like??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(P.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},textarea:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(P.Input.TextArea,{ref:c,size:a,placeholder:p("qm.table.filter.searchAreaText",{text:r}),style:{width:"220px"},value:f[y]?.likes??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(P.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},number:e=>{const r=e=>({value:f[y]?.[e]??"",size:a,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(P.InputNumber,Fs({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(P.InputNumber,Fs({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(P.InputNumber,Fs({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(P.InputNumber,Fs({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:jn(f[y]?.[e],yo),format:yo,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:Kn(t,yo)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(D,Fs({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(D,Fs({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(D,Fs({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(D,Fs({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(P.Radio.Group,{style:{width:"100%"},value:f[y]?.["=="],onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{"==":t}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(P.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(P.Checkbox.Group,{style:{width:"100%"},value:f[y]?.in,onChange:e=>{b((t=>Object.assign({},t,{[y]:{in:e}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(P.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("div",{style:{height:200,...r.style}},t().createElement(po,{multiple:!0,value:f[y]?.in||[],dataSource:a,onCheckChange:e=>{const t=e.map((e=>e.value));b((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},C=Ce("table"),w={"head-filter__popper":!0,[`${C}--lg`]:"large"===a,[`${C}--sm`]:"small"===a},N=["cell--filter",{selected:u,actived:v}];return t().createElement(Pa(),{action:["click"],popupVisible:u,popup:(()=>{const e=r.filter.type,n=S[e];return n?t().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t().createElement("div",null,n(r)),t().createElement(P.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t().createElement(he,{size:a,onClick:()=>{E({[y]:{}})}},p("qm.table.filter.reset")),t().createElement(he,{type:"primary",size:a,onClick:()=>E()},p("qm.table.filter.search")))):(g("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Se()(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{d(e)},builtinPlacements:Eo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("div",{className:Se()(N),title:p("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t().createElement("span",{className:"svgicon icon"},t().createElement(ks,null))))},Ls=e=>{const{column:r}=e,{tableRef:n,bordered:a}=t().useContext(mo),{columns:i,resizable:l,columnsChange:o=ne}=n.current.props,s=t().useMemo((()=>Tn(r)),[r]),c={resizable:!0,"is--line":l&&!a};return t().createElement("div",{className:Se()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r}=n.current,a=r.$resizableBar,l=t.offsetWidth/2,c=e.clientX,u=An(t,r.$table).left-r.$tableBody.parentNode.parentNode.scrollLeft+l;r.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const d=s.width||s.renderWidth;let p=d;return document.onmousemove=function(e){if("number"!=typeof d)return;const t=e.clientX-c,r=d+t;r<(s.minWidth||Io.defaultColumnWidth)||(p=Math.floor(r),a.style.left=`${t+u}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(wn(i,s.dataIndex).width=p,o([...i]))},!1}})},$s=e=>{const{selectionKeys:r}=e,{tableRef:n,getRowKey:a,pagination:i,fetchParams:l,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:u,isWebPagination:d}=t().useContext(mo),{rowSelection:m}=n.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:f,filterable:g,onSelectAll:b}=m,y=t().useRef([]),v=t().useMemo((()=>u&&!!h),[u,h]),x=t().useMemo((()=>!v&&!!f),[v,f]),E=t().useMemo((()=>(g??!0)&&!x),[g,x]),S=()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=i;return d?e.slice((t-1)*r,t*r):e},C=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:r}=n.current,{disabled:i}=m;if(v)return y.current.length?y.current:(0,J.union)(t,r.map((e=>a(e,e.index))));if(!x)return i?t.filter(((t,r)=>!i(e[r]))):t;const l=i?S().filter((e=>!i(e))).map((e=>a(e,e.index))):S().map((e=>a(e,e.index)));return(0,J.union)(l,r.map((e=>a(e,e.index))))})(),w=r.filter((e=>!C.includes(e))),N=r.length-w.length,T=N>0&&N<C.length,I=!!N&&N===C.length;s(w);const R=async()=>{const e=h;let t=[];c(!0);try{const r=await e.api(l);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];const{disabled:n}=m;n&&(t=(0,J.xor)(t,S().filter((e=>n(e))).map((e=>a(e,e.index))))),y.current=t}}catch(e){}return c(!1),t},O=async e=>{let t=[];t=v?e?await R():[]:e?C.slice(0):[],t=[...new Set([...t,...w])],o(t),b?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(P.Checkbox,{checked:I,indeterminate:T,disabled:!C.length,onChange:e=>O(e.target.checked)}),E&&t().createElement(P.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{O(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=v?(0,J.xor)(r,await R()):(0,J.xor)(r,C),e=[...new Set([...e,...w])],o(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{O(!1)}}];return t().createElement(P.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),x&&t().createElement(P.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},_s=e=>{const{style:r}=e,{tableRef:n,isTreeTable:a,setRowExpandedKeys:i}=t().useContext(mo),{expandable:l}=n.current.props,[o,s]=t().useState(l?.defaultExpandAllRows||!1);qe((()=>{const{allRowKeys:e,flattenRowKeys:t}=n.current;i(o?e.filter((e=>!(a&&t.includes(e)))):[])}),[o]);const c={[`${Ce("expand")}--icon`]:!0,expanded:o,collapsed:!o};return t().createElement("span",{className:Se()(c),title:"",onClick:e=>{e.stopPropagation(),s(!o)},style:r})},Ds=()=>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"})),qs=()=>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"})),js=e=>{const{tableColumns:r,flattenColumns:n,sorter:a,filters:i}=e,{tableRef:l,layout:o,scrollY:s,superFilters:c,selectionKeys:u,rightFixedColumns:d,treeExpandIndex:m,isFetch:h,isTreeTable:f,isGroupSubtotal:g,tableChange:b,setSorter:y,setElementStore:v,resetTableScroll:x,getStickyLeft:E,getStickyRight:S,createGroupData:C,createTableFullData:w}=t().useContext(mo),{ellipsis:N,resizable:T,multipleSort:I,rowSelection:R,expandable:O}=l.current.props,[A,k]=Io.sortDirections,F=t().useRef(null),H=t().useMemo((()=>!h),[h]),L=t().useMemo((()=>!h),[h]),$=t().useMemo((()=>!O?.hideExpandAll),[O]),_=t().useMemo((()=>!(!R||(h?!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys:R.hideSelectAll))),[h,R]);qe((()=>{V(),b(),x()}),[a]),qe((()=>{B(),b(),x()}),[i]),qe((()=>{B(),b(),x()}),[c]),t().useEffect((()=>{D(),!se(a)&&le((()=>V())),!se(i)&&le((()=>B()))}),[]);const D=()=>{v("$header",F.current)},q=e=>{const{dataIndex:r,type:n,sorter:i,title:l,description:o}=e;if(r===Io.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},_?t().createElement($s,{selectionKeys:u}):p("qm.table.config.selectionText"));if("radio"===n)return t().createElement("div",{className:"cell"},l)}const s=[];return s.push(t().createElement("div",{key:0,className:"cell",title:l},f&&r===m&&$?t().createElement(_s,null):null,r===Io.expandableColumn&&$?t().createElement(_s,null):l)),o&&s.push(t().createElement(P.Tooltip,{key:1,placement:"top",title:o},t().createElement(we.InfoCircleOutlined,{className:"tip"}))),i&&s.push(j(a[r])),s},j=e=>{const r=["svgicon cell--sorter__asc",{actived:e===A}],n=["svgicon cell--sorter__desc",{actived:e===k}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Se()(r)},t().createElement(Ds,null)),t().createElement("span",{className:Se()(n)},t().createElement(qs,null)))},K=e=>t().createElement(Hs,{column:e,filters:i}),M=(e,t)=>{const{sorter:r,dataIndex:n}=t;if(r){const e=a[n],t=e?e===k?null:k:A;I?(delete a[n],y(Object.assign({},a,{[n]:t}))):y(Object.assign({},{[n]:t}))}},V=()=>{H&&z()},z=e=>{const t=(0,J.pickBy)(a,(e=>null!==e));for(const e in t){const r=n.find((t=>t.dataIndex===e));r?U(r,t[e]):delete t[e]}e||Object.keys(t).length||U({dataIndex:"index"},A)},U=(e,t)=>{const{tableFullData:r}=l.current,{dataIndex:n,sorter:a}=e,i=(e,r)=>{const a=Ln(e,n),i=Ln(r,n);return Number.isNaN(a-i)?t===A?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===A?a-i:i-a},o=g?C(zn(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);w(o)},B=()=>{L&&W()},W=()=>{const{tableOriginData:e}=l.current,t=c.length?Un(c):Un(i),r=""!==t?g?C(vn(zn(e),t,f)):vn(e,t,f):e;w(r),z(!0)},G=Pn(r),Y=Ce("table"),{tableBodyWidth:X}=o;return t().createElement("div",{ref:F,className:`${Y}--header-wrapper`},t().createElement("table",{className:`${Y}--header`,cellSpacing:"0",cellPadding:"0",style:{width:X?`${X}px`:""}},(()=>{const{gutterWidth:e}=o;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),s&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("thead",null,(e=>{const{isIE:r}=l.current,n=["gutter",{"cell-fix-right":!!d.length}],i=r?null:{right:d.length?0:""};return e.map(((e,r)=>t().createElement("tr",{key:r,className:"header--row"},e.map(((r,n)=>((e,r,n)=>{const{isIE:i}=l.current,{gutterWidth:c}=o,{dataIndex:u,colSpan:d,rowSpan:p,fixed:m,align:h,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===d)return null;const C=f||h,w=["header--column",{"col--ellipsis":e.ellipsis??N,"col--center":"center"===C,"col--right":"right"===C,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!a[u],"cell-fix-left":!i&&"left"===m,"cell-fix-right":!i&&"right"===m,"cell-fix-left-last":!i&&"left"===m&&!n[r+1]?.fixed,"cell-fix-right-first":!i&&"right"===m&&!n[r-1]?.fixed,[g]:!!g}],I=i?null:{left:"left"===m?`${E(u)}px`:"",right:"right"===m?`${S(u)+(s?c:0)}px`:""},R=T&&![Io.expandableColumn,Io.selectionColumn].includes(u);return t().createElement("th",{key:u,className:Se()(w),colSpan:d,rowSpan:p,style:{...I},onClick:t=>M(t,e)},t().createElement("div",{className:"cell--wrapper"},x?t().createElement("div",{className:"cell--text cell"},x(e,l.current.tableFullData)):t().createElement(t().Fragment,null,t().createElement("div",{className:"cell--text"},q(e)),y?K(e):null)),R&&t().createElement(Ls,{column:e}))})(r,n,e))),s&&t().createElement("th",{className:Se()(n),style:{...i}}))))})(G))))},Ks=t().createContext([]);function Ms(){const[,t]=e.useReducer((e=>e+1),0);return t}function Vs(){const{locale:t}=e.useContext(l);return{t:p,$locale:t}}const zs=e=>{const{selectionKeys:r,column:n,record:a,rowKey:i}=e,{tableRef:l,isTreeTable:o,getAllChildRowKeys:s}=t().useContext(mo),{rowSelection:c}=l.current.props,u=t().useMemo((()=>n.type||""),[n.type]),d=e=>{const t=c.checkStrictly??!0;if(!o||t)return!1;const n=Rn(l.current.deriveRowKeys,e),a=s(n?.children??[]);return!(!Array.isArray(n?.children)||Hn(r,n?.children.map((e=>e.rowKey))||[]))&&a.some((e=>r.includes(e)))};return"radio"===u?(()=>{const e=c.disabled,n=e?.(a),l=!n&&r[0]===i;return t().createElement(P.Radio,{checked:l,disabled:n})})():(()=>{const e=c.disabled,n=e?.(a),l=!!r.includes(i);return t().createElement(P.Checkbox,{checked:l,indeterminate:d(i),disabled:n})})()},Us=e=>{const{record:r,rowKey:n,style:a}=e,{tableRef:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(mo),{expandable:s={}}=i.current.props,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),u=t().useMemo((()=>l.includes(n)),[l,n]);qe((()=>{s.onExpand?.(u,r)}),[u]);const d={[`${Ce("expand")}--icon`]:!0,expanded:u,collapsed:!u,disabled:c};return t().createElement("span",{className:Se()(d),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=u?l.filter((e=>e!==n)):[...l,n];o(t)},style:a})},Bs=t().forwardRef(((e,r)=>{const{size:n,defaultValue:a,value:i,min:l,max:o,prefix:s,suffix:c,placeholder:u,maxLength:d,precision:p,stringMode:m,allowClear:h,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<l&&(t=l.toString()),p>=0&&""!==t&&(t=new(ua())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),N=y(w);return qe((()=>{e.onChange?.(N)}),[S]),t().createElement(P.Input,{ref:r,size:n,value:w,maxLength:d,prefix:s,suffix:c,placeholder:u,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),l>=0&&r.startsWith("-")&&(n=!1),n){if(!m&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):C(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(N),N)}})}));Bs.displayName="InputNumber";const Ws=Bs;function Gs(){return Gs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gs.apply(this,arguments)}const{Search:Ys}=P.Input,Xs=t().forwardRef(((e,r)=>{const{column:n,record:a,rowKey:i,columnKey:l}=e,{tableRef:o,tableBodyRef:s,$size:c,flattenColumns:u,updateTableData:d,doFieldValidate:m,dataChange:h}=t().useContext(mo),f=t().useContext(Ks),b=Ms(),{store:y,fieldAuth:v}=o.current,x=n.editRender?.(a,n)||{},E=t().useRef(null),S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),N=t().useRef(null),T=t().useRef(!1),I=t().useRef({}),R=t().useRef({}),O=t().useRef([]),[A,k]=t().useState(!1),[F,H]=t().useState(!1),[L,$]=t().useState(!1),[_,q]=t().useState(x.items||[]),[j,K]=t().useState(),V=(x.editable||(0,J.isEqual)(f,[i,l]))&&!x.disabled&&!v[l]?.disabled,z=`${i}|${l}`,U=2===f.length?`${f[0]}|${f[1]}`:"",B=![...y.state.required,...y.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),W=y.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",G=y.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Y=y.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),X=V||!B||A||L||F,Q=!!x.helper?.combinedDataIndex&&("search-helper"===x.type||"tree-helper"===x.type),Z=x.type?.endsWith("multiple");t().useEffect((()=>{X&&U===z&&ne()}),[f]),t().useLayoutEffect((()=>{const{items:e}=x;Z&&e&&re(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const ee=()=>{d(),h()},te=(e,t)=>{k(e),t?.()},re=e=>{O.current=e},ne=()=>{const{type:e}=x;switch(e){case"text":S.current?.focus();break;case"number":C.current?.select();break;case"search-helper":w.current?.focus();break;case"tree-helper":N.current?.focus()}};t().useImperativeHandle(r,(()=>({focus:ne})));const ie=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},oe=(e,t,r)=>{const{cornerSign:n=!0}=x.extra||{};y.addToUpdated(e),n&&y.addToEdited({x:t,y:r})},se=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",ce={text:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:u=[],onInput:d,onChange:h,onEnter:f,onBlur:g}=x,y=Ln(e,a),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=n?{rows:v.minRows,autoSize:v}:null,C=s.password?P.Input.Password:n?P.Input.TextArea:P.Input;return t().createElement(C,Gs({ref:S,size:c,value:y,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||p("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";$n(e,a,r),m(u,r,i,l),b(),d?.({[z]:r}),T.current=!0},onFocus:()=>H(!0),onBlur:t=>{H(!1);const r=t.target.value??"";T.current&&(T.current=!1,oe(e,i,l),h?.({[z]:r},e),g?.({[z]:r},e),ee())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";f?.({[z]:r},e)}},onKeyDown:e=>{n&&13===e.keyCode&&!e.shiftKey&&f&&e.preventDefault()}}))},textarea:(e,t)=>ce.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:a,formatType:o}=r,{type:s,extra:u={},rules:d=[],onInput:h,onChange:f,onEnter:g,onBlur:y}=x,v=Ln(e,n);let E,S;return"finance"===o&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(ua())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(ua())(e).times(.01).toString()),t().createElement(Ws,{ref:C,size:c,value:v,min:u.min,max:u.max,precision:a,stringMode:u.stringMode,prefix:u.prefix,suffix:u.suffix??("percent"===o?"%":void 0),placeholder:u.placeholder||p("qm.table.editable.inputPlaceholder"),maxLength:u.maxLength,allowClear:u.allowClear,readOnly:u.readOnly,disabled:u.disabled,formatter:E,parser:S,onChange:t=>{$n(e,n,t),m(d,t,i,l),b(),h?.({[z]:t}),T.current=!0},onFocus:()=>H(!0),onBlur:(t,r)=>{if(H(!1),!T.current)return;T.current=!1;let a=u.stringMode?t:se(t);"percent"===o&&"."===r.charAt(r.length-1)&&(a=Number(t)/100),$n(e,n,a),oe(e,i,l),f?.({[z]:a},e),y?.({[z]:a},e),ee()},onEnter:(t,r)=>{let n=u.stringMode?t:se(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),g?.({[z]:n},e)}})},select:(e,r,n)=>{const{dataIndex:a,dictItems:s=[]}=r,{type:u,extra:d={},rules:h=[],items:f,onChange:g,onEnter:b}=x,{elementStore:y}=o.current,v=f||s,E=Ln(e,a);let S=E;return t().createElement(P.Select,{mode:n?"multiple":void 0,size:c,popupClassName:"table-editable__popper",value:E||void 0,placeholder:d.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{$n(e,a,t),m(h,t,i,l),oe(e,i,l),g?.({[z]:t},e),ee()},onSelect:e=>{S=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>b?.({[z]:S},e)))}},v.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ce.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:u=[],onChange:d}=x,p=n||"exactdate",h=Ln(e,a);return t().createElement(D,{size:c,popupClassName:"table-editable__popper",value:jn(h,Er[p])??void 0,picker:xr[p],format:s.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=Kn(t,Er[p]);$n(e,a,r),m(u,r,i,l),oe(e,i,l),d?.({[z]:r},e),ee()}})},datetime:(e,t)=>ce.date(e,t,"datetime"),month:(e,t)=>ce.date(e,t,"month"),year:(e,t)=>ce.date(e,t,"year"),time:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},rules:s=[],onChange:u}=x,d="HH:mm:ss",p=Ln(e,n);return t().createElement(M,{size:c,popupClassName:"table-editable__popper",value:jn(p,d)??void 0,format:o.format||d,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=Kn(t,d);$n(e,n,r),m(s,r,i,l),oe(e,i,l),u?.({[z]:r},e),ee()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=x,{trueValue:c=go,falseValue:u=bo,disabled:d}=o,p=Ln(e,n);return t().createElement(P.Checkbox,{checked:p===c,disabled:d,onChange:t=>{const r=t.target.checked?c:u;$n(e,n,r),oe(e,i,l),s?.({[z]:r},e),ee()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=x,{trueValue:c=go,falseValue:u=bo,disabled:d}=o,p=Ln(e,n);return t().createElement(P.Switch,{checked:p===c,disabled:d,onChange:t=>{const r=t?c:u;$n(e,n,r),oe(e,i,l),s?.({[z]:r},e),ee()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:d=[],helper:h={},onInput:f,onChange:b,onEnter:y}=x,v=_n(e,Q?h.combinedDataIndex:n),S=h.fieldAliasMap;S||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof S?S():S||{};Object.keys(C).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(C).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),C[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const N=e=>{const{filterAliasMap:t}=h,r=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[n]:r};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i},R=e=>{const{autoQueryAssign:t=!0}=h;t&&(I.current=N(e)),k(!0)},O=(t,n)=>{const{beforeOpen:a}=h,i=(a??ae)({[z]:v},e,r);i?.then?i.then((()=>{R(t),n?.()})).catch((()=>{})):!1!==i&&(R(t),n?.())},P=e=>{const t={};for(const r in C){const a=C[r];r!==n&&(t[r]=_n(e,a))}const r=C[n]?_n(e,C[n]):"";H(r,t);const{closed:a}=h;te(!1,(()=>ie(E.current))),ne(),a?.(e)},F=()=>{const{onlySelect:e=!0}=h;T.current&&H(e?"":v),te(!1,(()=>ie(E.current)))},H=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=u.find((e=>e.dataIndex===t));if(a){$n(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&m(r.rules,n,i,t)}else $n(e,t,n)}Q&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return $n(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&$n(e,t,a[r]?.trim())}))})(e,h.combinedDataIndex),$n(e,n,t,a),m(d,t,i,l),oe(e,i,l),b?.({[z]:t},e),ee(),I.current={},T.current=!1,K(void 0)},L={visible:A,title:p("qm.searchHelper.text"),width:h.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{F()}},_={...h,size:c,initialValue:Object.assign({},I.current,h.initialValue),onClose:e=>{e?P(e):F()}};return t().createElement(t().Fragment,null,t().createElement(Ys,{ref:w,value:j??v,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:r=!0,table:a}=h;if(T.current&&!A)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=h,{beforeFetch:n=ae}=t.fetch;return new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...N(e)},{currentPage:1,pageSize:500});if(!n(l))return i();$(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{le((()=>$(!1)))}}))})(t).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>_n(t,C[n]).toString().includes(e)));if(1===t.length)return P(t[0]);O(e)}(e,t))).catch((()=>H(""))):void H(t)},onChange:e=>{const{value:t}=e.target;f?.({[z]:t}),T.current=!0,K(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";y?.({[z]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;O(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&O(e)}}),t().createElement(ur,L,t().createElement(vc,_)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,items:o=[],extra:s={},rules:u=[],helper:d={},onInput:h,onChange:f,onEnter:b}=x,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof v?v():v||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[z]:y},e,r);a?.then?a.then((()=>{k(!0),t?.()})).catch((()=>{})):!1!==a&&(k(!0),t?.())},w=()=>{te(!1,(()=>ie(E.current)))},N=t=>{$n(e,n,t),m(u,t,i,l),oe(e,i,l),f?.({[z]:t},e,O.current),ee()},T={visible:A,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{w()}},I={...d,size:c,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=S;re((0,J.uniqBy)([...O.current.filter((e=>t.includes(e[n]))),...e],n));const a=O.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));q(i),N(i.map((e=>e.value)));const{closed:l}=d;te(!1,(()=>ie(E.current))),l?.(O.current)})(e,t):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(P.Select,{mode:"multiple",open:!1,value:y,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&b?.({[z]:y},e)},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=S;re(O.current.filter((r=>e.includes(r[t])))),N(e)}},_.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(ur,T,t().createElement(vc,I)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:d=[],helper:h={},onChange:f,onEnter:b}=x,y=_n(e,Q?h.combinedDataIndex:n),v=h.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof v?v():v||{};Object.keys(S).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(S).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),S[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const C=t=>{const{beforeOpen:n}=h,a=(n??ae)({[z]:y},e,r);a?.then?a.then((()=>{k(!0),t?.()})).catch((()=>{})):!1!==a&&(k(!0),t?.())},w=()=>{te(!1,(()=>ie(E.current)))},T=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=u.find((e=>e.dataIndex===t));if(a){$n(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&m(r.rules,n,i,t)}else $n(e,t,n)}$n(e,n,t,a),m(d,t,i,l),oe(e,i,l),f?.({[z]:t},e),ee()},I={visible:A,title:p("qm.searchHelper.text"),width:h.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{w()}},R={...h,defaultSelectedKeys:[y],size:c,onClose:e=>{e?(e=>{const t={};for(const r in S){const a=S[r];r!==n&&(t[r]=_n(e,a))}const r=S[n]?_n(e,S[n]):"";T(r,t);const{closed:a}=h;te(!1,(()=>ie(E.current))),ne(),a?.(e)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement(Ys,{ref:N,value:y,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";b?.({[z]:r},e)}},onDoubleClick:()=>{C()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?C():T(""))}}),t().createElement(ur,I,t().createElement(Ic,R)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},items:s=[],rules:u=[],helper:d={},onInput:h,onChange:f,onEnter:b}=x,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof v?v():v||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[z]:y},e,r);a?.then?a.then((()=>{k(!0),t?.()})).catch((()=>{})):!1!==a&&(k(!0),t?.())},w=()=>{te(!1,(()=>ie(E.current)))},N=t=>{$n(e,n,t),m(u,t,i,l),oe(e,i,l),f?.({[z]:t},e,O.current),ee()},T={visible:A,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{w()}},I={...d,size:c,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=S;re(e);const n=O.current.map((e=>({text:e[t],value:e[r]})));q(n),N(n.map((e=>e.value)));const{closed:a}=d;te(!1,(()=>ie(E.current))),a?.(O.current)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(P.Select,{mode:"multiple",open:!1,value:y,placeholder:o.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&b?.({[z]:y},e)},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=S;re(O.current.filter((r=>e.includes(r[t])))),N(e)}},_.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:o.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(ur,T,t().createElement(Ic,I)))}};return t().createElement(t().Fragment,null,X?(()=>{const{type:e}=x,r=ce[e];if(!r)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!B}];return t().createElement("div",{ref:E,className:Se()(i)},r(a,n),!B&&t().createElement("div",{className:"cell-error"},W||G))})():(()=>{const{extra:r={}}=x;return t().createElement("span",{style:{color:r.disabledColor}},e.children)})(),Y&&t().createElement("i",{className:"cell--sign"}))}));Xs.displayName="CellEdit";const Qs=Xs,Zs=require("copy-to-clipboard");var Js=n.n(Zs);const ec=function(e){if(!t().isValidElement(e))return null;for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return t().cloneElement(e,...n)},tc=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return ec(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Js()(r,n);i?.(r,s),s&&a&&P.message.success(p("qm.clipboard.success")),o&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(l)}})};tc.displayName="QmCopyToClipboard";const rc=tc,nc=t().forwardRef(((r,n)=>{const{column:a,row:i,rowIndex:l,columnIndex:o,rowKey:s,depth:c,showTitle:u}=r,{tableRef:d,selectionKeys:p,treeExpandIndex:m,updateMark:h,isTreeTable:f}=t().useContext(mo),{treeConfig:g}=d.current.props,{dataIndex:b,canCopy:y,render:v,editRender:x,shouldCellUpdate:E}=a,{t:S}=Vs(),{renderText:C,getTitleFromCellNode:w}=jo(),N=t().useRef(null),[T,I]=function(r,c,u){const d=e.useRef({});return"value"in d.current&&!((e,t)=>{if(E){const[,r]=e,[,n]=t;return E(n,r)}return!(0,J.isEqual)(e,t)})(d.current.condition,c)||(d.current.value=(()=>{const e=Ln(i,b),r=v?v(e,i,a,l,o):C(e,a,i);return[r,x?t().createElement(Qs,{ref:n,column:a,record:i,rowKey:s,columnKey:b},r):null]})(),d.current.condition=c),d.current.value}(0,[h,ce(i),v,x]);t().useEffect((()=>{if([Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(b))return;const e=N.current.parentNode;u?e.title=w(T):e.removeAttribute("title")}),[u,T]);const R=e=>Array.isArray(e.children);return t().createElement("div",{ref:N,className:"cell"},(()=>{if(b===Io.expandableColumn)return t().createElement(Us,{record:i,rowKey:s});if(b===Io.selectionColumn)return t().createElement(zs,{selectionKeys:p,column:a,record:i,rowKey:s});if(I)return I;if(f&&b===m)return[(e=g?.virtual?i._level:c,e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*Io.treeTable.textIndent+"px"}}):null),t().createElement(Us,{key:"expand",record:i,rowKey:s,style:R(i)?{}:{visibility:"hidden"}}),T];var e;if(y){const e=w(T);return t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},T),e&&t().createElement(rc,{text:e},t().createElement(we.CopyOutlined,{className:"icon",title:S("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return T})())}));nc.displayName="Cell";const ac=nc;function ic(){return ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ic.apply(this,arguments)}const lc=t().forwardRef(((r,n)=>{const{tableData:a,flattenColumns:i}=r,{getRowKey:l,tableRef:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:u,sorter:d,layout:m,showFooter:h,scrollX:f,scrollY:g,selectionKeys:b,rowExpandedKeys:y,highlightKey:v,isPingLeft:x,isPingRight:E,isTableEmpty:S,isTreeTable:C,isGroupSubtotal:w,isWebPagination:N,isDragMergeCell:T,setElementStore:I,createTableFullData:R,setSelectionKeysEffect:O,setHighlightKey:P,getStickyLeft:A,getStickyRight:k,scrollXToColumn:F,scrollYToRecord:H,rowInViewport:L,dataChange:$,setPingLeft:_,setPingRight:D,setFullScreen:q,findParentRowKeys:j,getAllChildRowKeys:K,triggerScrollYEvent:M,scrollBottomDebouncer:V}=t().useContext(mo),{height:z,minHeight:U,maxHeight:B,rowHeight:W,rowSelection:G,rowHighlight:Y,treeConfig:X,expandable:Q,stripe:Z,summation:ee,rowStyle:te,cellStyle:re,spanMethod:ie,nativeScrollBar:le,ellipsis:oe,showHeader:se,rowDraggable:ce,onRowClick:ue,onRowDblclick:de,onRowContextmenu:pe,onRowEnter:me}=o.current.props,fe=t().useRef(null),ge=t().useRef({}),be=t().useRef(null),ye=t().useRef({prevST:0,prevSL:0}),{dragStart:ve,renderDragPanel:xe,closeDragPanel:Ee}=(()=>{const{tableRef:e,layout:r,flattenColumns:n,isDragMergeCell:a}=t().useContext(mo),{mergeCells:i=[],onMergeChange:l}=e.current.props,[o,s]=t().useState(!1),c=t().useRef(null),u=t().useRef(null),d=t().useRef({x:0,y:0,disX:0,disY:0}),m=Ce("table");qe((()=>{a||x()}),[a]);const h=()=>{x(),Be(c.current,{display:"none"})},f=e=>{const t=[];for(let r=0;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push([e.row+r,e.col+n]);return t},g=()=>{d.current={x:0,y:0,disX:0,disY:0},u.current&&!E(u.current)||(u.current=null,h()),s(!0),document.removeEventListener("mousemove",b)},b=e=>{const{pageX:t,pageY:n}=e,{x:a,y:i,disX:l,disY:o}=d.current;let s=l,u=o,p=t-a,m=n-i;return p<0&&(p=Math.abs(p),s=l-p,Be(c.current,{left:`${s}px`})),m<0&&(m=Math.abs(m),u=o-m,Be(c.current,{top:`${u+r.headerHeight}px`})),Be(c.current,{width:`${p}px`,height:`${m}px`}),y(s,u,p,m),!1},y=wt(((t,r,a,i)=>{const{allTableData:l,scrollYStore:o}=e.current;let s=-1,c=-1,d=-1,p=-1;for(let e=0;e<l.length;e++)r>o.rowHeight*e&&r<o.rowHeight*(e+1)&&(s=e),r+i>o.rowHeight*e&&r+i<o.rowHeight*(e+1)&&(c=e);let m=0;for(let e=0;e<n.length;e++)t>m&&t<m+S(n[e])&&(d=e),t+a>m&&t+a<m+S(n[e])&&(p=e),m+=S(n[e]);const h={row:s,col:d,rowSpan:c-s+1,colSpan:p-d+1};(0,J.isEqual)(u,h)||(u.current=h,v(s,c,d,p))}),5),v=(t,r,n,a)=>{const{elementStore:i,scrollYStore:l}=e.current,o=i.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<o.length;e++){const i=o[e].children;for(let o=0;o<i.length;o++)if(i[o].classList.remove("selected"),(t!==r||n!==a)&&e+l.startIndex>=t&&e+l.startIndex<=r){const e=Number(i[o].getAttribute("colspan")),t=Number(i[o].getAttribute("data-index")),r=e>1?t+e-1:t;r>=n&&r<=a&&i[o].classList.add("selected")}}},x=()=>{const{elementStore:t}=e.current,r=t.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<r.length;e++){const t=r[e].children;for(let e=0;e<t.length;e++)t[e].classList.remove("selected")}},E=e=>1===e.rowSpan&&1===e.colSpan,S=e=>e.width||e.renderWidth||e.minWidth||Io.defaultColumnWidth;return{dragStart:t=>{const{pageX:n,pageY:a}=t,{elementStore:i}=e.current,{x:l,y:o}=Ye(i.$table),{scrollLeft:p,scrollTop:m}=i.$tableBody.parentNode.parentNode;u.current=null,d.current={x:n,y:a,disX:n+p-l,disY:a+m-(o+r.headerHeight)},Be(c.current,{width:0,height:0,left:n-l+"px",top:a-o+"px",display:"block"}),x(),s(!1),document.addEventListener("mousemove",b,{passive:!0}),document.addEventListener("mouseup",g,{passive:!0,once:!0})},renderDragPanel:()=>t().createElement("div",{ref:c,className:`${m}--merge-cell`,onMouseDown:e=>e.stopPropagation()},o&&t().createElement(t().Fragment,null,t().createElement(he,{size:"small",className:"btn cancel",onClick:()=>{if(u.current&&!E(u.current)){const e=f(u.current),t=i.findIndex((t=>{const r=f(t);return(0,J.intersectionWith)(r,e,J.isEqual).length===r.length}));-1!==t&&l?.(i.filter(((e,r)=>r!==t)))}h()}},p("qm.table.mergeCell.cancel")),t().createElement(he,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(u.current&&!E(u.current)){const e=f(u.current);let t=!1;for(let r=0;r<i.length;r++)(0,J.intersectionWith)(f(i[r]),e,J.isEqual).length&&(t=!0);t||l?.([...i,u.current])}h()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:h}})(),we=t().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=m,i={};return S&&Object.assign(i,{minHeight:"100px"}),U&&Object.assign(i,{minHeight:kn(U)-e-r+"px"}),B&&Object.assign(i,{maxHeight:kn(B)-e-r+"px"}),z||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[z,B,U,S,m]),Ne=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=m;return e&&g?e-t:e}),[m,g]),Te=t().useMemo((()=>{const{scrollYStore:e}=o.current,{viewportHeight:t,gutterWidth:r}=m;return Math.floor((f?t-r:t)/e.rowHeight)}),[m,f]),[Ie,Re]=t().useState([]),Oe=Ms(),Pe=function(t,r){const[n,a]=e.useState(!1);return e.useEffect((()=>{let e;const n=t.current,i=t=>{e=t},l=t=>{((e,t)=>{const i=e.target,l=t?.target,o=!i||!l,s=n?.contains(i)||n?.contains(l),c=n===i,u=r?.map((e=>Array.from(document.querySelectorAll(e)))).flat()||[],d=u.some((e=>e?.contains(i)))||u.includes(l);a(!(o||s||c||d))})(t,e)};return n&&(Me(document,"mousedown",i),Me(document,"mouseup",l)),()=>{n&&(Ve(document,"mousedown",i),Ve(document,"mouseup",l))}}),[t]),n}(fe,[".table-editable__popper"]);t().useImperativeHandle(n,(()=>({setClickedValues:He,createFocus:Fe,forceUpdate:Oe}))),qe((()=>{Pe&&(He([]),T&&Ee())}),[Pe]),qe((()=>{Ie.length&&wo.focus(o.current.uid)}),[Ie]),t().useEffect((()=>{ke();const e=qt()(document,"keydown",Ae);return()=>e.remove()}),[]);const Ae=ko((e=>{const{keyCode:t}=e;if(o.current.uid===wo.getFocusInstance()?.id&&(27===t&&(He([]),P(""),q(!1)),Ie.length&&(Qe(document.activeElement,fe.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===G?.type||Y)){const t=b[0]??v??null,r=a.find((e=>l(e,e.index)===t))??null;r&&me?.(r,e)}if(38===t||40===t){Ue(e);const{allTableData:r}=o.current,n=N?On(a):r,i=n.length;let s=n.findIndex((e=>l(e,e.index)===Ie[0]));const c=38===t?(--s+i)%i:++s%i,u=n[c],d=l(u,u.index);"radio"!==G?.type||G.disabled?.(u)||O([d]),Y&&!Y.disabled?.(u)&&P(d),L(c)||(38===t&&H(d,c),40===t&&H(d,Te>c+1?0:c+1-Te)),He([d,Ie[1]])}if(9===t){if(Ue(e),!s.length)return He([]);const t=s.length;let r=s.findIndex((e=>e.dataIndex===Ie[1]));const n=++r%t,a=s[n].dataIndex;He([Ie[0],a]),F(a)}}})),ke=()=>{I("$tableBody",fe.current),I("$tableYspace",be.current)},Fe=(e,t)=>{ge.current[`${e}-${t}`]?.focus()},He=e=>{(0,J.isEqual)(e,Ie)||Re(e)},Le=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),$e=(e,t,r)=>{const{deriveRowKeys:n}=o.current,a=Rn(n,e);let i=[];const l=K(a?.children||[]),s=Gn(n,e)?.slice(0,-1).reverse()||[];return i=r?[...new Set([...t,e,...l])]:t.filter((t=>![e,...l].includes(t))),s.forEach((e=>{const t=Rn(n,e),r=Hn(i,t?.children?.map((e=>e.rowKey))||[]);i=r?[...i,e]:i.filter((t=>t!==e))})),i},_e=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];return e.forEach((e=>{const a=e.index,o=l(e,e.index);if(n.push(De(e,a,o,r)),Q?.expandedRowRender){const{expandedRowClassName:r,rowExpandable:l=ae}=Q;y.includes(o)&&l(e)&&n.push(t().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},t().createElement("td",{colSpan:i.length,className:"body--column",style:{paddingLeft:G?2*Io.selectionColumnWidth:Io.selectionColumnWidth}},t().createElement("div",{className:Se()("cell",r)},Q.expandedRowRender(e,a)))))}if(!X?.virtual&&(e=>Array.isArray(e.children))(e)){const t="function"!=typeof Q?.rowExpandable||Q.rowExpandable(e);y.includes(o)&&t&&n.push(..._e(e.children,r+1))}})),n},De=function(e,r,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const l=["body--row",{"body--row-striped":Z&&r%2!=0,"body--row-selected":b.includes(n),"body--row-current":v===n,...w?We(e._group):null}];return t().createElement("tr",{key:n,className:Se()(l)},i.map(((t,i)=>je(t,i,e,r,n,a))))},je=(e,r,n,a,i,s)=>{const{isIE:p}=o.current,{dataIndex:m,fixed:h,align:f,className:g="",editRender:y}=e,{rowSpan:v,colSpan:x}=Ke(n,e,a,r);if(!v||!x)return null;const E=e.ellipsis??oe,S=!p&&"left"===h,N=!p&&"right"===h,T=["body--column",{"col--ellipsis":E,"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!d[m],"cell-fix-left":S,"cell-fix-right":N,"cell-fix-left-last":S&&c[c.length-1].dataIndex===m,"cell-fix-right-first":N&&u[0].dataIndex===m,[g]:!!g}],I=p?null:{left:S?`${A(m)}px`:"",right:N?`${k(m)}px`:""},R=te?"function"==typeof te?te(n,a):te:null,F=re?"function"==typeof re?re(n,e,a,r):re:null,H=w?ze(n._group):null,L=Object.assign({},I,W?{height:W}:null,H,R,F);if(y){const{extra:t}=y(n,e)||{};t?.disabledBackgroundColor&&Object.assign(L,{backgroundColor:t?.disabledBackgroundColor})}return t().createElement("td",{key:m,rowSpan:v>1?v:void 0,colSpan:x>1?x:void 0,"data-index":r,className:Se()(T),style:L,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([Io.expandableColumn,Io.operationColumn].includes(n))return;const a=l(t,t.index);He([a,n]);const i=r.editRender?.(t,r),o=i&&!i.disabled,{type:s,selectByClickRow:c=!0,disabled:u=ne}=G||{};!s||u(t)||o||(c||n===Io.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=G||{};if("radio"===r&&O([e]),"checkbox"===r){const r=!b.includes(e),i=C&&!n?$e(e,b,r):Le(e,b,r);O(i),a?.(r,t,i)}})(a,t),[Io.selectionColumn].includes(n)||(!Y||Y.disabled?.(t)||o||P(a),ue?.(t,r,e))})(t,n,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(n)||de?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(n)||pe?.(t,r,e)})(t,n,e)},t().createElement(ac,{ref:e=>ge.current[`${i}-${m}`]=e,row:n,column:e,rowIndex:a,columnIndex:r,rowKey:i,depth:s,showTitle:E}))},Ke=(e,t,r,n)=>{let i=1,l=1;if("function"==typeof ie){const o=ie({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});if(Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan),e===a[0]&&0===i){i=1;for(let e=1;e<a.length;e++){const{rowSpan:r}=Ke(a[e],t,a[e].index,n);if(r>0)break;i++}}}const{mergeCells:s}=o.current;if(s.length>0){const e=s.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},ze=e=>{const{backgroundColor:t,color:r}=ee.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},We=e=>{const t=ee.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ge=Ce("table"),Xe=T?{onMouseDown:ve}:null;return t().createElement(t().Fragment,null,t().createElement(Pt,{wrapClassName:`${Ge}--body-wrapper`,wrapStyle:we,native:le,onScroll:e=>{const{elementStore:t,scrollYLoad:r}=o.current,{prevST:n,prevSL:a}=ye.current,i=g?m.gutterWidth:0,{scrollTop:l,scrollLeft:s}=e;if(s!==a){se&&(t.$header.scrollLeft=s),h&&(t.$footer.scrollLeft=s);const e=s>0,r=Math.ceil(s)+m.tableWidth<m.tableBodyWidth+i;x!==e&&_(e),E!==r&&D(r)}if(r&&l!==n&&M(l),g&&l!==n){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(l)+m.viewportHeight-i>=r&&V({type:"scroll",target:e,preventDefault:ne,stopPropagation:ne})}ye.current.prevST=l,ye.current.prevSL=s}},t().createElement("div",{ref:be,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:Ne?`${Ne}px`:""}}),t().createElement(Ks.Provider,{value:Ie},t().createElement("table",ic({ref:fe,className:`${Ge}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},Xe,{style:{width:Ne?`${Ne}px`:""}}),t().createElement("colgroup",null,i.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})}))),ce?t().createElement(Zn.ReactSortable,{itemKey:e=>l(e,e.index),tag:"tbody",animation:200,list:a,setList:e=>{const t=e.map((e=>l(e,e.index))),r=a.map((e=>l(e,e.index)));if((0,J.isEqual)(t,r))return;const n=Qn(e),i=[];o.current.tableFullData.forEach((e=>{a.includes(e)?i.push(n.shift()):i.push(e)})),R(i),$()}},a.map((e=>De(e,e.index,l(e,e.index))))):t().createElement("tbody",null,_e(a))))),T&&xe())}));lc.displayName="TableBody";const oc=lc,sc=e=>{const{summationRows:r,flattenColumns:n}=e,{tableRef:a,sorter:i,layout:l,scrollY:o,leftFixedColumns:s,rightFixedColumns:c,setElementStore:u,getStickyLeft:d,getStickyRight:m}=t().useContext(mo),{footRender:h}=a.current.props,f=t().useRef(null);t().useEffect((()=>{g()}),[]);const g=()=>{u("$footer",f.current)},b=Ce("table"),{tableBodyWidth:y}=l;return t().createElement("div",{ref:f,className:`${b}--footer-wrapper`},h?h(n,a.current.tableFullData):t().createElement("table",{className:`${b}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=l;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),o&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("tfoot",null,(()=>{const{isIE:e}=a.current,u=["gutter",{"cell-fix-right":!!c.length}],h=e?null:{right:c.length?0:""};return r.map(((e,r)=>t().createElement("tr",{key:r,className:"footer--row"},n.map(((r,n)=>((e,r,n)=>{const{isIE:u}=a.current,{gutterWidth:h}=l,{dataIndex:f,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!i[f],"cell-fix-left":!u&&"left"===g,"cell-fix-right":!u&&"right"===g,"cell-fix-left-last":!u&&"left"===g&&s[s.length-1].dataIndex===f,"cell-fix-right-first":!u&&"right"===g&&c[0].dataIndex===f}],x=u?null:{left:"left"===g?`${d(f)}px`:"",right:"right"===g?`${m(f)+(o?h:0)}px`:""},E=y?.render?y.render(a.current.tableFullData):Ln(r,`${f}_text`),S=0===n&&""===E?p("qm.table.config.summaryText"):E;return t().createElement("td",{key:f,title:S,className:Se()(v),style:{...x}},t().createElement("div",{className:"cell"},S))})(r,e,n))),o&&t().createElement("td",{className:Se()(u),style:{...h}}))))})())))};var cc=function(e){return e.small="small",e.middle="default",e.large="default",e}(cc||{});const uc=e=>{const{current:r,pageSize:n,total:a,onChange:i}=e,{global:o}=t().useContext(l),{tableRef:s,$size:c,setElementStore:u}=t().useContext(mo),{uniqueKey:d,paginationConfig:p,infoBarConfig:m}=s.current.props,h=t().useRef(null),f=t().useMemo((()=>d?`tablePager_${d}`:""),[d]);t().useEffect((()=>{g(),x()}),[]);const g=()=>{u("$pager",h.current)},b=p?.showSizeChanger??Io.pagination.showSizeChanger,y=p?.showQuickJumper??Io.pagination.showQuickJumper,v=p?.pageSizeOptions||o?.table?.pagination?.pageSizeOptions||Io.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==n&&(i(r,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=o?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S={[`${Ce("table")}-pager`]:!0};return t().createElement("div",{ref:h,className:Se()(S)},t().createElement("div",{className:"pager-alert"},"bottom"===m?.position&&t().createElement(Lo,{total:a})),t().createElement(P.Pagination,{size:cc[c],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:r,pageSize:n,total:a,onChange:(e,t)=>{i(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=o?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},dc=()=>{const{layout:e}=t().useContext(mo),r=t().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),n=Ce("table");return t().createElement("div",{className:`${n}--empty`,style:r},t().createElement(ht,null))},pc=()=>{const{setElementStore:e}=t().useContext(mo),r=t().useRef(null);t().useEffect((()=>{n()}),[]);const n=()=>{e("$resizableBar",r.current)},a=Ce("table");return t().createElement("div",{ref:r,className:`${a}--resizable-bar`})};function mc(){return mc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mc.apply(this,arguments)}const hc=t().forwardRef(((e,r)=>{const{rowKey:n,columns:a,loading:i,stripe:o,resizable:s,customClass:c,tablePrint:u,exportExcel:d,infoBarConfig:p,topSpaceAlign:m,showTableInfo:h,showFullScreen:f,showRefresh:b,showToolBox:y,showHeader:v}=e,{size:x}=t().useContext(l),E=t().useMemo((()=>e.size??x??""),[e.size,x]),S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),N=t().useRef(null),T=t().useRef(null),I=t().useCallback(((e,t)=>{const r="function"==typeof n?n(e,t):e[n];return void 0===r?(g("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r}),[n]),{tableRef:R,tableFullData:O,setElementStore:P,setOriginColumns:A,setTableFullData:k,setTableOriginData:F,setAllTableData:H,setDeriveRowKeys:L,setInvalidRowKeys:$,setFieldAuth:_,setMergeCells:D,setColumnsDefined:q,setScrollYStore:j,setScrollYLoad:K,setResizeState:M,setHandleState:V,setSummaries:z,setSelectionRows:U,setShouldToTop:B,setRecordsMap:W,setUnMounted:G,setHandleChange:Y,clearElementStore:X,clearRecordsMap:Q}=((e,r)=>{let{getRowKey:n,$size:a}=r;const{rowHeight:i,dynamicThead:l}=e,o=t().useRef({props:e,uid:Mn(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],columnsDefined:!l,scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:i||Io.rowHeightMaps[a]},store:new To,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isHandleChange:!0,isIE:!ee&&/MSIE|Trident/.test(navigator.userAgent)});(e=>{o.current.props=e})(e);const s=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const l=n(e,e.index),o=r?`${r}#${l}`:`${l}`,c=a?`${a}-${e.index+1}`:`${e.index+1}`,u={level:i,rowKey:l,rowKeyPath:o,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(u.children=s(e.children,l,o,c,i+1)),t?Object.assign({},u,{parentRowKey:t}):u}))},c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:o,...o.current,setElementStore:(e,t)=>{o.current.elementStore[e]=t},setOriginColumns:e=>{o.current.originColumns=e},setTableFullData:e=>{o.current.tableFullData=e},setTableOriginData:e=>{o.current.tableOriginData=e},setAllTableData:e=>{const t=On(e);o.current.allTableData=t,o.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{o.current.treeTable=o.current.tableFullData.some((e=>Array.isArray(e.children))),o.current.treeTable&&(o.current.deriveRowKeys=s(e,""),o.current.flattenRowKeys=c(o.current.deriveRowKeys))},setInvalidRowKeys:e=>{o.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{o.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:e.row+n,col:e.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:e.row+r,col:e.col+n,rowSpan:0,colSpan:0})})),o.current.mergeCells=t},setColumnsDefined:e=>{o.current.columnsDefined=e},setScrollYStore:e=>{o.current.scrollYStore=e},setResizeState:e=>{o.current.resizeState=e},setHandleState:e=>{o.current.handleState=e},setSummaries:e=>{o.current.summaries=e},setScrollYLoad:e=>{o.current.scrollYLoad=e},setShouldToTop:e=>{o.current.shouldToTop=e},setSelectionRows:e=>{o.current.selectionRows=e},setRecordsMap:(e,t)=>{o.current.recordsMap.set(e,t)},setUnMounted:e=>{o.current.unMounted=e},setHandleChange:e=>{o.current.isHandleChange=e},clearElementStore:()=>{for(const e in o.current.elementStore)o.current.elementStore[e]=null},clearRecordsMap:()=>{o.current.recordsMap.clear()}}})(e,{getRowKey:I,$size:E}),{tableData:Z,setTableData:te,filters:re,setFilters:ne,sorter:ae,setSorter:ie,superFilters:le,setSuperFilters:oe,pagination:se,setPagination:ue,selectionKeys:de,setSelectionKeys:pe,rowExpandedKeys:me,setRowExpandedKeys:he,highlightKey:fe,setHighlightKey:ge,updateMark:be,forceUpdate:ye,layout:ve,setLayout:xe,permission:Ee,setPermission:we,spinning:Ne,setSpinning:Te,scrollX:Ie,setScrollX:Re,scrollY:Oe,setScrollY:Pe,isPingLeft:Ae,setPingLeft:ke,isPingRight:Fe,setPingRight:He,isFullScreen:Le,setFullScreen:$e,updateTableData:_e}=(e=>{const{uniqueKey:r,nativeScrollBar:n,initialSorter:a={},initialFilter:i={},paginationConfig:o,rowSelection:s,expandable:c,rowHighlight:u}=e,{global:d}=t().useContext(l),p={current:Io.pagination.current,pageSize:(()=>{if(r)return Number(localStorage.getItem(`tablePager_${r}`))||void 0})()??o?.pageSize??d?.table?.pagination?.pageSize??Io.pagination.pageSize,total:0},m=s?.selectedRowKeys??s?.defaultSelectedRowKeys??[],h=c?.expandedRowKeys??c?.defaultExpandedRowKeys??[],[f,g]=t().useState([]),[b,y]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),i),[v,x]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),a),[E,S]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),[]),[C,w]=t().useState(p),[N,T]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),m),[I,R]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),h),[O,P]=t().useState(u?.currentRowKey??""),[A,k]=t().useReducer((e=>e+1),0),[F,H]=t().useState({gutterWidth:n?Oo():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[L,$]=t().useState({export:!0,import:!0,print:!0}),[_,D]=t().useState(!1),[q,j]=t().useState(!1),[K,M]=t().useState(!1),[V,z]=t().useState(!1),[U,B]=t().useState(!1),[W,G]=t().useState(!1);return{tableData:f,setTableData:g,filters:b,setFilters:y,sorter:v,setSorter:x,superFilters:E,setSuperFilters:S,pagination:C,setPagination:w,selectionKeys:N,setSelectionKeys:T,rowExpandedKeys:I,setRowExpandedKeys:R,highlightKey:O,setHighlightKey:P,updateMark:A,forceUpdate:k,layout:F,permission:L,setPermission:$,setLayout:H,spinning:_,setSpinning:D,scrollX:q,setScrollX:j,scrollY:K,setScrollY:M,isPingLeft:V,setPingLeft:z,isPingRight:U,setPingRight:B,isFullScreen:W,setFullScreen:G,updateTableData:()=>{g([...f])}}})(e),{isFetch:De,isWebPagination:je,isScrollPagination:Ke,showPagination:Me,shouldUpdateHeight:Ve,tableColumns:ze,flattenColumns:Ue,editableColumns:Be,summationColumns:We,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,showSummary:Qe,showFooter:Ze,isHeadGroup:Je,bordered:et,isHeadSorter:tt,isHeadFilter:rt,isServiceSummation:nt,isSelectCollection:at,isTableImport:it,isTableClipboard:lt,isSuperSearch:ot,isFastSearch:st,isGroupSummary:ct,isGroupSubtotal:ut,isDragMergeCell:dt,isTreeTable:pt,isTableEmpty:mt,summationRows:ht,fetchParams:ft}=Ao(e,{getRowKey:I,tableRef:R,tableFullData:O,tableData:Z,sorter:ae,filters:re,superFilters:le,selectionKeys:de,pagination:se}),{createElementStore:bt,tableStyles:yt,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,calcTableHeight:Nt,resetTableScroll:Tt,doLayout:It}=Ho(e,{getRowKey:I,tableRef:R,$size:E,tableColumns:ze,flattenColumns:Ue,leftFixedColumns:Ge,layout:ve,scrollY:Oe,tableData:Z,showFooter:Ze,showPagination:Me,isWebPagination:je,isFullScreen:Le,setLayout:xe,setScrollX:Re,setScrollY:Pe,setElementStore:P,setScrollYStore:j,setShouldToTop:B}),{initialTable:Rt,checkDataIndex:Ot,createTableFullData:Pt,getTableData:At,handleTableData:kt,createTableData:Ft,createGroupData:Ht,createSelectionKeys:Lt,createRowExpandedKeys:$t,setSelectionKeysEffect:_t,findParentRowKeys:Dt,getAllChildRowKeys:qt,doFieldValidate:jt,getTableLog:Kt,dataChange:Mt,tableChange:Vt,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,pagerChangeHandle:Wt,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er,clearTableLog:tr,destroy:rr}=Fo(e,{getRowKey:I,tableRef:R,tableElementRef:C,tableBodyRef:w,$size:E,tableColumns:ze,flattenColumns:Ue,tableFullData:O,pagination:se,layout:ve,filters:re,sorter:ae,superFilters:le,fetchParams:ft,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,summationColumns:We,shouldUpdateHeight:Ve,isFetch:De,isTreeTable:pt,isWebPagination:je,isScrollPagination:Ke,isServiceSummation:nt,isGroupSubtotal:ut,doLayout:It,setTableData:te,setTableFullData:k,setTableOriginData:F,setAllTableData:H,setDeriveRowKeys:L,setPagination:ue,setSpinning:Te,setSorter:ie,setFilters:ne,setSuperFilters:oe,setSelectionKeys:pe,setRowExpandedKeys:he,setHighlightKey:ge,setSelectionRows:U,setScrollYLoad:K,setScrollYStore:j,setFieldAuth:_,setResizeState:M,setSummaries:z,setPermission:we,setRecordsMap:W,resetTableScroll:Tt,clearElementStore:X,clearRecordsMap:Q});((e,r)=>{const{columns:n,summation:a,rowSelection:i,expandable:l,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:u,tableElementRef:d,tableBodyRef:p,$size:m,scrollX:h,pagination:f,selectionKeys:b,rowExpandedKeys:y,highlightKey:v,summationRows:x,showSummary:E,isWebPagination:S,isScrollPagination:C,isTreeTable:w,checkDataIndex:N,toLastPage:T,toFirstPage:I,getPageCount:R,setHandleState:O,scrollYToRecord:P,setSelectionKeysEffect:A,setOriginColumns:k,setRowExpandedKeys:F,setHighlightKey:H,setResizeState:L,setMergeCells:$,setPingRight:_,setUnMounted:D,setHandleChange:q,calcTableHeight:j,createSelectionKeys:K,createRowExpandedKeys:M,createElementStore:V,triggerScrollYEvent:z,initialTable:U,destroy:B}=r,{elementStore:W,handleState:G,scrollYLoad:Y}=c.current,X=t().useRef(x);qe((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(b.length?[b[0],""]:[]),c.current.isHandleChange&&e?.(b,c.current.selectionRows),q(!0)}),[b]),qe((()=>{if(!l)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:r}=l;r?.(y,y.map((r=>e[t.findIndex((e=>e===r))])))}),[y]),qe((()=>{const{allTableData:e,allRowKeys:t}=c.current;w&&F(M()),o&&(p.current.setClickedValues(v?[v,""]:[]),o.onChange?.(v,e[t.findIndex((e=>e===v))]??null))}),[v]),qe((()=>{(0,J.isEqual)(x,X.current)||(X.current=x,E&&a&&a.onChange?.(x))}),[x]),qe((()=>{const e=K(i.selectedRowKeys);(0,J.isEqual)(e,b)||(A(e),w&&F(M()))}),[i?.selectedRowKeys]),qe((()=>{const e=M(l.expandedRowKeys);(0,J.isEqual)(e,y)||F(e)}),[l?.expandedRowKeys]),qe((()=>{const{currentRowKey:e}=o;e!==v&&H(e??"")}),[o?.currentRowKey]),qe((()=>{const{insert:e,remove:t}=G;e&&(S&&("after"===e?T():I()),P("","after"===e?1e5:0)),t&&f.current>R()&&T(),(e||t)&&O({insert:null,remove:!1})}),[f.total]),qe((()=>{Y&&z(W.$tableBody.parentNode.parentNode.scrollTop)}),[Y]),qe((()=>{_(h)}),[h]),qe((()=>{j()}),[m]),qe((()=>{$(s),p.current.forceUpdate()}),[s]),qe((()=>{Y&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),C&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Y,C]);const Q=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(L(Object.assign({},e,{winHeight:r})),j())};t().useEffect((()=>(V({$toper:u.current,$table:d.current}),k(ce(n)),U(),$(s),window.addEventListener("resize",Q,!1),j(),N(),()=>{B(),window.removeEventListener("resize",Q),D(!0)})),[])})(e,{tableRef:R,topElementRef:S,tableElementRef:C,tableBodyRef:w,$size:E,scrollX:Ie,pagination:se,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,showSummary:Qe,summationRows:ht,isWebPagination:je,isScrollPagination:Ke,isTreeTable:pt,checkDataIndex:Ot,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,setHandleState:V,scrollYToRecord:Ct,setOriginColumns:A,setSelectionKeysEffect:_t,setRowExpandedKeys:he,setHighlightKey:ge,setResizeState:M,setMergeCells:D,setPingRight:He,setUnMounted:G,setHandleChange:Y,calcTableHeight:Nt,createSelectionKeys:Lt,createRowExpandedKeys:$t,createElementStore:bt,triggerScrollYEvent:Gt,initialTable:Rt,destroy:rr});const nr=t().useMemo((()=>({getRowKey:I,tableRef:R,tableBodyRef:w,$size:E,flattenColumns:Ue,editableColumns:Be,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,sorter:ae,filters:re,superFilters:le,layout:ve,bordered:et,showFooter:Ze,showSummary:Qe,summationRows:ht,scrollX:Ie,scrollY:Oe,pagination:se,fetchParams:ft,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,updateMark:be,isFetch:De,isPingLeft:Ae,isPingRight:Fe,isHeadSorter:tt,isHeadFilter:rt,isFullScreen:Le,isTableEmpty:mt,isHeadGroup:Je,isTreeTable:pt,isGroupSubtotal:ut,isWebPagination:je,isDragMergeCell:dt,dataChange:Mt,tableChange:Vt,getTableData:At,setElementStore:P,createTableFullData:Pt,updateTableData:_e,setSorter:ie,setFilters:ne,setSuperFilters:oe,setHighlightKey:ge,setRowExpandedKeys:he,setSelectionRows:U,setSelectionKeysEffect:_t,setInvalidRowKeys:$,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,setPagination:ue,setPingLeft:ke,setPingRight:He,setSpinning:Te,setFullScreen:$e,setShouldToTop:B,doFieldValidate:jt,createTableData:Ft,createGroupData:Ht,findParentRowKeys:Dt,getAllChildRowKeys:qt,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,resetTableScroll:Tt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er})),[E,Ue,Be,Ge,Ye,Xe,ae,re,le,ve,et,Ze,Qe,ht,Ie,Oe,se,ft,de,me,fe,be,De,Ae,Fe,tt,rt,Le,mt,Je,pt,ut,je,dt]);((e,r)=>{const{getRowKey:n,tableRef:a,toolBoxRef:i,tableBodyRef:l,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:u,fetchParams:d,selectionKeys:p,rowExpandedKeys:m,highlightKey:h,isFetch:f,dataChange:b,getTableData:y,handleTableData:v,createTableData:x,calcTableHeight:E,scrollXToColumn:S,scrollYToRecord:C,doFieldValidate:w,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:P,setOriginColumns:A,setHandleChange:k,forceUpdate:F,getTableLog:H,clearRowSelection:L,clearRowHighlight:$,clearTableSorter:_,clearTableFilter:D,clearSuperFilters:q,clearTableLog:j}=r,{columns:K,columnsChange:M}=a.current.props,V=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&V(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:async e=>{f&&(await y(),e?.())},GET_LOG:()=>H(),GET_FETCH_PARAMS:()=>{const e={};for(const t in d)Object.keys(u).includes(t)||(e[t]=d[t]);return e},CLEAR_TABLE_DATA:()=>{f||(L(),$(),_(),D(),q(),j(),x([]))},CLEAR_LOG:()=>{j()},CREATE_FOCUS:(e,t)=>{l.current.createFocus(e,t)},FORCE_UPDATE:()=>{F()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{S(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,p)&&k(!1),I(e)},SET_HIGHLIGHT:e=>{O(e)},SET_EXPANDABLE:e=>{R(e)},SET_SELECTION_ROWS:e=>{P(e)},SET_TABLE_DATA:e=>{v(e)},DEFINE_INITIAL_COLUMNS:e=>{A(e),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=wn(K,e);if(!n)return g("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return g("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,J.set)(n,e,t[e]);r&&(M?M([...K]):g("Table","需要设置 `columnsChange` 参数"))},INSERT_RECORDS:(e,t)=>{const{store:r,tableFullData:i}=a.current,l=(Array.isArray(e)?e:[e]).filter((e=>(0,J.isPlainObject)(e)));if(!l.length)return;l.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(r)||$n(e,r,Ln(e,r))})),r.addToInserted(e)}));const o="before"===t?.mode,c=void 0===t?.parentRowKey,u=i;if(c)o?u.unshift(...l):u.push(...l);else{const e=Yn(i,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}x(u),c&&N(Object.assign({},a.current.handleState,{insert:o?"before":"after"})),F(),b()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:r}=a.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,J.isPlainObject)(e)?n(e,e.index):e));if(!i.length)return;let l=!1;V(r,i,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),l=!0})),l&&(x(r),I(p.filter((e=>!i.includes(e)))),i.includes(h)&&$(),R(m.filter((e=>!i.includes(e)))),N(Object.assign({},a.current.handleState,{remove:!0})),b())},VALIDATE_FIELDS:(e,t)=>{a.current.allTableData.forEach((r=>{c.forEach((a=>{const{dataIndex:i,editRender:l}=a,o=l?.(r,a);if(!o)return;const s=n(r,r.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:u}=o;!u&&c.length&&w(c,Ln(r,i),s,i)}))}));const{required:r,validate:i}=H(),l=[...r,...i];return l.length&&C(l[0].rowKey),F(),{required:r,validate:i}}})))})(r,{getRowKey:I,tableRef:R,toolBoxRef:N,tableBodyRef:w,columnFilterRef:T,flattenColumns:Ue,editableColumns:Be,pagination:se,fetchParams:ft,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,isFetch:De,dataChange:Mt,getTableData:At,handleTableData:kt,createTableData:Ft,calcTableHeight:Nt,scrollXToColumn:St,scrollYToRecord:Ct,doFieldValidate:jt,setHandleState:V,setColumnsDefined:q,setSelectionKeysEffect:_t,setRowExpandedKeys:he,setHighlightKey:ge,setSelectionRows:U,setOriginColumns:A,setHandleChange:Y,forceUpdate:ye,getTableLog:Kt,clearRowSelection:Jt,clearRowHighlight:er,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearTableLog:tr}),t().useEffect((()=>{wo.register(R.current.uid,r??{current:null})}),[]);const ar=Ce("table"),ir={[`${ar}--wrapper`]:!0,[`${ar}--lg`]:"large"===E,[`${ar}--sm`]:"small"===E,[`${ar}--maximize`]:Le,[c]:!!c},lr={[ar]:!0,"is--border":et,"is--striped":o,"is--fixed":Ge.length||Ye.length,"is--sortable":tt,"is--filterable":rt,"is--head-group":Je,"is--merge-cell":dt,"is--empty":mt,"show--head":v,"show--foot":Ze,"ping--left":Ae,"ping--right":Fe,"scroll--x":Ie,"scroll--y":Oe};return t().createElement(mo.Provider,{value:nr},t().createElement("div",{className:Se()(ir)},h&&t().createElement("div",{ref:S,className:`${ar}-top`},t().createElement("div",{className:`${ar}-top__space`},"bottom"!==p?.position&&t().createElement(Lo,{total:se.total}),t().createElement("div",{className:`${ar}-top__space-slot`,style:{justifyContent:So[m]}},e.children)),t().createElement("div",{className:`${ar}-top__actions`},t().createElement(Rs,{ref:N,showFullScreen:f,showReload:b&&De,showPrint:Ee.print&&!!u,showImport:Ee.import&&it,showExport:Ee.export&&!!d,showClipboard:lt,showCollection:at,showFastSearch:st,showSuperSearch:ot,showGroupSummary:ct,showToolBox:y,tableColumns:ze}),t().createElement(As,{ref:T,columns:a}))),t().createElement(gt,{spinning:i??Ne},t().createElement("div",{ref:C,className:Se()(lr),style:yt},t().createElement("div",{className:`${ar}--main-wrapper`},v&&t().createElement(js,{tableColumns:ze,flattenColumns:Ue,sorter:ae,filters:re}),t().createElement(oc,{ref:w,tableData:Z,flattenColumns:Ue}),Ze&&t().createElement(sc,{summationRows:ht,flattenColumns:Ue})),et&&t().createElement("div",{className:`${ar}--border-line`}),mt&&t().createElement(dc,null),s&&t().createElement(pc,null))),Me&&t().createElement(uc,mc({},se,{onChange:(e,t)=>Wt({current:e,pageSize:t})}))))}));hc.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},hc.displayName="QmTable";const fc=hc,gc=fc;function bc(){return bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bc.apply(this,arguments)}const yc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:u,style:d,onClose:m}=e,{size:h}=t().useContext(l),f=t().useMemo((()=>e.size??h??""),[e.size,h]),g=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=Ct(g),[x,E]=t().useState(c),[S,C]=t().useState(),[w,N]=t().useState(o),[T,I]=t().useState(!1),[R,O]=t().useState(300),[P,A]=t().useState(s),[k,F]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[H,L]=t().useState((0,J.merge)({},c.fetch?.params,a)),[$,_]=t().useState([]),D=()=>{const e=g.current,t=e.querySelector(".form-wrap");O(e.offsetHeight-t.offsetHeight-2*ya[f]-30)},q=wt(D,5);qe((()=>{q()}),[v.width]),qe((()=>{(0,J.isEqual)(s,P)||A(s)}),[s]),t().useEffect((()=>{j()}),[H]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a)}),[]);const j=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(H)){I(!0);try{const e=await r(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(N([]),await ie(0)),_(t)}}catch(e){}I(!1)}},K=e=>{n||(C(e),m(e))},M=e=>{L(Object.assign({},H,e))},V={[`${Ce("search-helper")}--wrapper`]:!0},z=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:{...x.fetch,params:H}};return t().createElement("div",{ref:g,className:Se()(V,u),style:d},t().createElement("div",{className:"form-wrap"},P.length?t().createElement(vl,{ref:b,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>D(),onFinish:e=>M(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||M(t)}}):null),t().createElement("div",null,t().createElement(gc,bc({ref:y,uniqueKey:r,height:R,columns:k,rowKey:x.rowKey||"pageIndex"},z,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{N(e),C(n?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>F(e),onRowDblclick:K,onRowEnter:K}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ya[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>m(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!S,onClick:()=>m(S,n?w:void 0)},p("qm.dialog.confirm"))))};yc.displayName="SearchHelper";const vc=yc;function xc(){return xc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xc.apply(this,arguments)}const Ec=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ec(e.children)),e.children&&t.push(e.value)})),t},Sc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=Sc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Cc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Cc(e.children,t),t(e)||e.children&&e.children.length))),wc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:u={},className:d,style:m,onClose:h}=e,{size:f}=t().useContext(l),b=t().useMemo((()=>e.size??f??""),[e.size,f]),y=t().useRef(null),v=t().useRef(null),x=t().useRef(null),E=Ct(y),[S,C]=t().useState(c),[w,N]=t().useState(),[T,I]=t().useState(o),[R,O]=t().useState(!1),[A,k]=t().useState(300),[F,H]=t().useState(300),[L,$]=t().useState(s),[_,D]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[q,j]=t().useState((0,J.merge)({},c.fetch?.params,a)),[K,M]=t().useState([]),V=()=>{const e=y.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),H(e.offsetHeight-t.offsetHeight-2*ya[b]-30)},z=wt(V,5);qe((()=>{z()}),[E.width]),qe((()=>{(0,J.isEqual)(s,L)||$(s)}),[s]),t().useEffect((()=>{U()}),[q]),t().useEffect((()=>{i&&x.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&v.current?.SET_FIELDS_VALUE(a),ne()}),[]);const U=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(q)){O(!0);try{const e=await r(q);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(I([]),await ie(0)),M(t)}}catch(e){}O(!1)}},B=e=>{n||(N(e),h(e))},W=e=>{j(Object.assign({},q,e))},[G,Y]=t().useState([]),[X,Q]=t().useState([]),[Z,ee]=t().useState(""),te=t().useRef(G),re=t().useRef([]);qe((()=>{Q(Ec(G))}),[G]);const ne=async()=>{if(!u.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=u.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,r)??[],t=Ar(e,n,a);Y(t),te.current=t,re.current=e}}catch(e){}},le=e=>`${e}|${Gr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe={[`${Ce("tree-table-helper")}--wrapper`]:!0},se=S.webPagination?{dataSource:K,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:q}};return t().createElement("div",{ref:y,className:Se()(oe,d),style:m},t().createElement(at,{defaultValue:200,style:{height:"100%"}},t().createElement(at.Pane,{min:100,style:{overflowY:"auto"}},t().createElement(P.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=Cc(te.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==le(r).indexOf(e)}));ee(e),Y(t)})(e.target.value)}),t().createElement(P.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:A,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==le(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=u.fetch;(e=>{if(!u.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof u.tableParamsMap?u.tableParamsMap():u.tableParamsMap,r={};for(const n in t)r[n]=(0,J.get)(e,t[n]);W(r)})(Sc(re.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(at.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},L.length?t().createElement(vl,{ref:v,items:L,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>$(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await v.current.GET_FORM_DATA();e||W(t)}}):null),t().createElement("div",null,t().createElement(gc,xc({ref:x,uniqueKey:r,height:F,columns:_,rowKey:S.rowKey||"pageIndex"},se,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:T,onChange:(e,t)=>{I(e),N(n?t:t[0])}},paginationConfig:S.paginationConfig,columnsChange:e=>D(e),onRowDblclick:B,onRowEnter:B}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ya[b]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>h(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!w,onClick:()=>h(w,n?T:void 0)},p("qm.dialog.confirm"))))};wc.displayName="TreeTableHelper";const Nc=wc,Tc=e=>{const{multiple:r,tree:n={},defaultSelectedKeys:a,className:i,style:o,onClose:s}=e,{size:c}=t().useContext(l),u=t().useMemo((()=>e.size??c??""),[e.size,c]),[d,m]=t().useState(),[h]=t().useState(n.fetch?.params),f={[`${Ce("tree-helper")}--wrapper`]:!0},g=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:h}:void 0;return t().createElement("div",{className:Se()(f,i),style:o},t().createElement(po,{multiple:r,fetch:g,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:a,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ya[u]+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:!d,onClick:()=>s(d)},p("qm.dialog.confirm"))))};Tc.displayName="TreeHelper";const Ic=Tc;function Rc(){return Rc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rc.apply(this,arguments)}const Oc="_startSign",Pc="_endSign",Ac=e=>{const{uniqueKey:r,initialValue:n,filters:a=[],table:i={},onClose:o}=e,{size:s}=t().useContext(l),c=t().useMemo((()=>e.size??s??""),[e.size,s]),u=t().useRef(null),d=t().useRef(null),m=t().useRef(null),h=Ct(u),[f,g]=t().useState(i),[b,y]=t().useState(!1),[v,x]=t().useState([]),[E,S]=t().useState(300),[C,w]=t().useState(a),[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:Oc,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:Pc,fixed:"right",width:80,render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)}]),[I,R]=t().useState((0,J.merge)({},i.fetch?.params,n)),[O,A]=t().useState([]),k=t().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),F=t().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),H=()=>{const e=u.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*ya[c]-30)},L=wt(H,5);qe((()=>{L()}),[h.width]),qe((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{$()}),[I]);const $=async()=>{const{webPagination:e,fetch:t}=f;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=ae}=t;if(a(I)){y(!0);try{const e=await r(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];A(t)}}catch(e){}y(!1)}},_=(e,t)=>{delete e[t]},D=()=>{v.forEach((e=>{e&&(_(e,Oc),_(e,Pc))})),x([])},q=e=>{D(),R(Object.assign({},I,e))},j=Ce("range-helper"),K=f.webPagination?{dataSource:O,loading:b,webPagination:!0}:{fetch:{...f.fetch,params:I}};return t().createElement("div",{ref:u,className:`${j}--wrapper`},t().createElement("div",{className:"form-wrap"},C.length?t().createElement(vl,{ref:d,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>H(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||q(t)}}):null),t().createElement("div",null,t().createElement(gc,Rc({ref:m,height:E,columns:N,rowKey:f.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},K,{columnsChange:e=>T(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[Oc,Pc].includes(r)&&(r===Oc&&(e[r]?(_(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?P.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&_(v[0],r),e[r]="[",x([e,v[1]]))),r===Pc&&(e[r]?(_(e,r),x([v[0],void 0])):e.pageIndex<k[0]?P.message.warning(p("qm.searchHelper.rangeEndTip")):(v[1]&&_(v[1],r),e[r]="]",x([v[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[Oc]="["),e.pageIndex===k[1]&&(e[Pc]="]")}))}}),t().createElement(he,{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:`${ya[c]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>o(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!F,onClick:()=>o(v.map((e=>(e=>{const t={};for(const r in e)[Oc,Pc].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};Ac.displayName="RangeTableHelper";const kc=Ac,Fc=e=>null!=e;function Hc(e,r,n,a){const[i,l]=t().useState(void 0);t().useLayoutEffect((()=>{const t="function"==typeof e?e():e;l(t||null)}));const[o,s]=t().useState(null),c=ko((()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:l}=e.getBoundingClientRect();return n>=0&&l>=0&&a<=t&&i<=r})(i)&&r&&i.scrollIntoView(a);const{left:e,top:t,width:n,height:l}=i.getBoundingClientRect(),o={left:e,top:t,width:n,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)}));return t().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[i,r,c]),[t().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),i]}const Lc=(t,r)=>{const n=e.useRef(!0);e.useLayoutEffect((()=>t(n.current)),r),e.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function $c(e,t){Lc((t=>{if(!t)return e()}),t)}function _c(e){return void 0!==e}function Dc(t,r){const{defaultValue:n,value:a,onChange:i,postState:l}=r||{},[o,s]=e.useState((()=>_c(a)?a:_c(n)?"function"==typeof n?n():n:"function"==typeof t?t():t)),c=_c(a)?a:o,u=l?l(c):c,d=ko(i),[p,m]=e.useState([c]);return $c((()=>{const e=p[0];o!==e&&d(o,e)}),[p]),$c((()=>{_c(a)||s(a)}),[a]),[u,ko((e=>{s(e),m([c])}))]}const qc={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},jc={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Kc=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Mc(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(qc).forEach((e=>{const c={...n&&jc[e]||qc[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Kc.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const u=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":c.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":c.offset[1]=-u.arrowOffsetHorizontal-o;break;case"leftBottom":case"rightBottom":c.offset[1]=u.arrowOffsetHorizontal+o}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+r,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+r,i.shiftX=!0,i.adjustX=!0}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,u,t,r),l&&(c.htmlRegion="visibleFirst")})),s}const Vc=require("@rc-component/portal");var zc=n.n(Vc);const Uc=require("@rc-component/trigger");var Bc=n.n(Uc);const Wc=require("rc-util/lib/hooks/useId");var Gc=n.n(Wc);function Yc(){return Yc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yc.apply(this,arguments)}const Xc={fill:"transparent",pointerEvents:"auto"},Qc=e=>{const{prefixCls:r,rootClassName:n,pos:a,showMask:i,style:l={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:u}=e,d=`${r}-mask-${Gc()()}`,p="object"==typeof c?c?.placeholder:c;return t().createElement(zc(),{open:s,autoLock:!0},t().createElement("div",{className:Se()(`${r}-mask`,n),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:u,pointerEvents:"none",...l}},i?t().createElement("svg",{style:{width:"100%",height:"100%"}},t().createElement("defs",null,t().createElement("mask",{id:d},t().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),a&&t().createElement("rect",{x:a.left,y:a.top,rx:a.radius,width:a.width,height:a.height,fill:"black",className:p?`${r}-placeholder-animated`:""}))),t().createElement("rect",Yc({},a?null:Xc,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${d})`})),a&&t().createElement(t().Fragment,null,t().createElement("rect",Yc({},Xc,{x:"0",y:"0",width:"100%",height:`${a.top}px`})),t().createElement("rect",Yc({},Xc,{x:"0",y:"0",width:a.left,height:"100%"})),t().createElement("rect",Yc({},Xc,{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`})),t().createElement("rect",Yc({},Xc,{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"})))):null))},Zc=e=>{const{prefixCls:r,zIndex:n,open:a,onPause:i,onPlay:l}=e,[o,s]=Dc(void 0,{value:a,postState:e=>e??!0}),c=t().useRef(null),u=t().useRef(!1),d=ko((e=>{p(e),32===e.keyCode&&m()}));t().useEffect((()=>{const e=qt()(document,"keyup",d);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},m=()=>{u.current?u.current=!1:(s(!o),o?i?.():l?.())};return t().createElement("div",{ref:c,className:`${r}-control`,style:{zIndex:n+1},onMouseDown:e=>{p(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-Ye(t).x,o=e.clientY-Ye(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-r-1&&(s=a-r-1),c<0&&(c=0),c>i-n-1&&(c=i-n-1),Be(t,{left:`${s}px`,top:`${c}px`}),u.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>m()},o?t().createElement(we.PauseOutlined,null):t().createElement(we.CaretRightOutlined,null))},Jc=e=>{const{prefixCls:r,current:n,total:a=0,cover:i,title:l,description:o,helper:s={},type:c,zIndex:u,onClose:d,onPrev:p,onNext:m,onFinish:h,className:f,indicatorsRender:g}=e,{t:b}=Vs(),y="primary"!==c?"primary":"default",v=ko((e=>{C(e),40===e.keyCode&&(n<a-1?m?.():h?.()),38===e.keyCode&&n>0&&p?.()}));t().useEffect((()=>{const e=qt()(document,"keyup",v);return()=>e.remove()}),[]);const x=Fc(i)?t().createElement("div",{className:`${r}-cover`},i):null,E=Fc(o)?t().createElement("div",{className:`${r}-description`},o):null;let S;S=g?g(n,a):[...Array.from({length:a}).keys()].map(((e,a)=>t().createElement("span",{key:e,className:Se()(a===n&&`${r}-indicator-active`,`${r}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t().createElement("div",{className:Se()(`${r}-content`,f)},t().createElement("div",{className:`${r}-inner`},t().createElement(we.CloseOutlined,{className:`${r}-close`,onClick:d}),s.content&&t().createElement(P.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:u},content:s.content,title:s.title},t().createElement(we.QuestionCircleOutlined,{className:Se()(`${r}-close`,"help-icon")})),x,t().createElement("div",{className:`${r}-header`},t().createElement("div",{className:`${r}-title`},l)),E,t().createElement("div",{className:`${r}-footer`},a>1&&t().createElement("div",{className:`${r}-indicators`},S),t().createElement(xe,{className:`${r}-buttons`},0!==n?t().createElement(he,{className:`${r}-prev-btn`,size:"small",onMouseDown:C,onClick:p},b("qm.tour.prevStep")):null,n===a-1?t().createElement(he,{className:`${r}-finish-btn`,type:y,size:"small",onClick:h},b("qm.tour.finish")):t().createElement(he,{className:`${r}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:m},b("qm.tour.nextStep"))))))},eu=e=>{const{current:r,renderPanel:n}=e;return t().createElement(t().Fragment,null,"function"==typeof n?n(e,r):t().createElement(Jc,e))};function tu(){return tu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tu.apply(this,arguments)}const ru={left:"50%",top:"50%",width:1,height:1},nu=t().forwardRef(((e,r)=>{const{steps:n=[],defaultCurrent:a,current:i,onChange:l,onClose:o,onFinish:s,open:c,type:u="default",mask:d=!0,arrow:p=!0,control:m=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:b,zIndex:y,renderPanel:v,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:C=!0,...w}=e,N=t().useRef(),[T,I]=Dc(0,{value:i,defaultValue:a}),[R,O]=Dc(void 0,{value:c,postState:e=>!(T<0||T>=n.length)&&(e??!1)}),[P,A]=Dc(1051,{value:y,defaultValue:y}),[k,F]=t().useState(),H=t().useRef(R);t().useLayoutEffect((()=>{R&&!H.current&&I(0),H.current=R,F(R)}),[R]),t().useImperativeHandle(r,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>A(e)})));const{target:L,type:$,placement:_,trigger:D,delay:q,style:j,arrow:K,className:M,mask:V,scrollIntoViewOptions:z,zIndex:U,action:B}=n[T]||{},W=U||P,G=$||u,Y=R&&(V??d),X=z??C,[Q,Z]=Hc(L,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,_),ee=!!Z&&(void 0===K?p:K),te="object"==typeof ee&&ee.pointAtCenter;t().useLayoutEffect((()=>{N.current?.forceAlign()}),[te,T]),qe((()=>{R&&B?.(Z,T)}),[R,Z]);const re=e=>{I(e),l?.(e)},ne=()=>{O(!1),o?.(T)};if(void 0===Z)return null;const ae=async()=>{if(!D||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[a,i]=[e+r/2,t+n/2],l=new MouseEvent(D,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await ie(q??320))},le="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,j),ce=Ce("tour"),ue=[{[`${ce}-primary`]:"primary"===G},h,M],de=Mc({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Qc,{zIndex:W,prefixCls:ce,pos:Q,showMask:le,style:oe?.style,fill:oe?.color,open:k,animated:S,rootClassName:h}),t().createElement(Bc(),tu({ref:N},w,{zIndex:W,builtinPlacements:de,popupStyle:se,popupPlacement:J,popupVisible:k,popupClassName:Se()(ue),prefixCls:ce,popup:()=>t().createElement(eu,tu({key:"content",arrow:ee,prefixCls:ce,total:n.length,helper:b,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await ae(),re(T-1)},onNext:async()=>{await ae(),re(T+1)},onClose:ne,current:T,onFinish:()=>{ne(),s?.()}},Object.assign({},n[T],{zIndex:W,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),t().createElement(zc(),{open:k,autoLock:!0},t().createElement("div",{className:Se()(h,`${ce}-target-placeholder`),style:{...Q||ru,position:"fixed",pointerEvents:"none"}}))),m&&t().createElement(zc(),{open:R},t().createElement(Zc,{zIndex:W,prefixCls:ce,onPause:()=>F(!1),onPlay:()=>F(!0)})))}));nu.displayName="QmTour";const au=nu,iu=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],lu=e=>({_s:e,status:iu[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),ou=e=>e?6:5,su=(e,t,r,n,a)=>{clearTimeout(n.current);const i=lu(e);t(i),r.current=i,a?.({current:i})},cu=r=>{const{name:n,in:a,timeout:i,preEnter:l=!0,preExit:o}=r,[s,c]=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:r=!0,exit:n=!0,preEnter:a,preExit:i,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:u}=t||{},[d,p]=(0,e.useState)((()=>lu(o?2:ou(s)))),m=(0,e.useRef)(d),h=(0,e.useRef)(),[f,g]=(e=>(0,J.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),b=(0,e.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return ou(t)}})(m.current._s,c);e&&su(e,p,m,h,u)}),[u,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch(su(e,p,m,h,u),e){case 1:f>=0&&(h.current=setTimeout(b,f));break;case 4:g>=0&&(h.current=setTimeout(b,g));break;case 0:case 3:h.current=setTimeout((()=>t(e+1)),0)}},l=m.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&t(r?a?0:1:2):l&&t(n?i?3:4:ou(c))}),[b,u,r,n,a,i,f,g,c]);return(0,e.useEffect)((()=>()=>clearTimeout(h.current)),[]),[d,y,b]}({timeout:i,preEnter:l,preExit:o,initialEntered:a});return $c((()=>{c()}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?ec(e,{className:Se()(e.props.className,n,s.status)}):e)))},uu={previewWidth:1100,defaultDistance:.45,logoHeight:60},du=(0,e.createContext)(void 0);var pu=null;function mu(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function hu(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(mu()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void P.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:pu?r=pu:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),pu=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&mu(),r}catch(e){P.message.error("getLodop 出错:"+e)}}mu();const fu=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},gu=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(du),{state:s,isWindowsPrinter:c,pageSize:u}=o,d=t().useRef(null),p=t().useRef({}),m=t().useRef([]),h=t().useRef([]),f=t().useRef([]),[b,y]=t().useState(!0);t().useImperativeHandle(r,(()=>({createPreviewDom:A,createExportHtml:F,createPrintHtml:k,SHOW_PREVIEW:H,DIRECT_PRINT:L}))),qe((()=>{P()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),t().useEffect((()=>{p.current.templateEl=d.current.querySelector(".origin-template").children[0],p.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*uu.defaultDistance+10*uu.defaultDistance:0;return("vertical"===e?u[0]:u[1])-t}),[s,c,u]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*uu.defaultDistance+10*uu.defaultDistance:0;return("vertical"===e?u[1]:u[0])-t}),[s,c,u]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return fu(v-10*(e.left-uu.defaultDistance)-10*(e.right-uu.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return fu(x-10*(e.top-uu.defaultDistance)-10*(e.bottom-uu.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:fu(10*e.left),right:fu(10*e.right),top:fu(10*e.top),bottom:fu(10*e.bottom)}}),[s]),N=t().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:r,top:n,bottom:a}=w,i=E+t+r,l=uu.previewWidth-i<=0?0:(uu.previewWidth-i)/2,o=Math.abs((1-C)*i/2);let c=0;return C>1&&(c=o>l?-1*l:-1*o),C<1&&(c=i-2*o>uu.previewWidth?0:l>0?o:(uu.previewWidth-(i-2*o))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${C})`,opacity:b?0:1}}),[s,b,w,C,S,E]),T=(m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${uu.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},O=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}h.current=r,m.current=t},P=()=>{if(!m.current.length)return;const{form:{setting:e,printerType:t}}=s;if(a)return f.current.push([I(),T(),...m.current]);const r=e.fixedLogo?S-uu.logoHeight:S;let n=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[T()]:[],...m.current]);else{let t=0;for(let a=0,i=h.current.length;a<i;a++){const l=m.current[a],o=h.current[a];e.fixedLogo||0!==a||(t+=uu.logoHeight),t+=o,t<=r?n.push(l):(f.current.push([I(),...e.fixedLogo?[T()]:[],...n]),n=[],t=0,a-=1),a===i-1&&n.length&&f.current.push([I(),...e.fixedLogo?[T()]:[],...n])}}e.fixedLogo||f.current[0]?.splice(1,0,T());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');o.setState({currentPage:1,totalPage:f.current.length}),A()},A=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},F=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+T()+I()+e.join("")+"</table>"},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();p.current.previewEl.innerHTML||(R(),await ie(0),O(),P(),y(!1))},L=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();R(),await ie(0),O(),P(),y(!1),o.doPrint(k()),await ie(0),o.doClose()},$=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:d,className:Se()(_)},t().createElement(gt,{wrapperClassName:"spin",spinning:b,tip:"Loading..."},t().createElement("div",{className:"preview"},t().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},n?.()),t().createElement("div",{className:"workspace",style:N}))))}));gu.displayName="Container";const bu=gu;function yu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class vu extends e.Component{constructor(){super(...arguments),yu(this,"formRef",t().createRef()),yu(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:uu.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:uu.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:uu.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:uu.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),yu(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})})),yu(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")}))),yu(this,"state",{formList:this.createFormList()}),yu(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())})),yu(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(vl,{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"))))}}yu(vu,"contextType",l);const xu=vu;function Eu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Su extends e.Component{constructor(){super(...arguments),Eu(this,"provide",{$$preview:this}),Eu(this,"containRef",t().createRef()),Eu(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:uu.defaultDistance,right:uu.defaultDistance,top:uu.defaultDistance,bottom:uu.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Eu(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Eu(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Eu(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 fs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Eu(this,"doClose",(()=>{this.props.onClose?.()})),Eu(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Eu(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Eu(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 ')),Eu(this,"doPrint",(e=>{const t=hu();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=uu,{left:u,right:d,top:m,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(u-c)+"mm",`RightMargin: ${10*(d-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():P.message.error(p("qm.print.printError"))},t.PRINT()})),Eu(this,"doExport",(e=>{const t=hu();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():P.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=hu(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){g("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await fs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await fs().setItem(this.printerKey,e)),(0,J.isPlainObject)(e)&&Object.keys(e).length&&(0,J.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:r}=this.props,{visible:n,form:a,currentPage:i,totalPage:l,printPage:o}=this.state,s=Ce("print-preview"),c={visible:n,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},u={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Se()(u)},t().createElement("div",{className:"outer"},t().createElement("div",{className:"header"},t().createElement("span",null,p("qm.print.printer"),":",t().createElement(P.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(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.type"),":",t().createElement(P.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(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.copies"),":",t().createElement(P.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(P.InputNumber,{value:o,min:1,max:l,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),p("qm.print.printPage.1")),t().createElement("span",null,t().createElement(P.Pagination,{size:"small",current:i,pageSize:1,total:l,onChange:this.pageChangeHandle})),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),t().createElement("span",null,t().createElement(he,{icon:t().createElement(we.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),t().createElement("div",{className:"main"},t().createElement(du.Provider,{value:this.provide},t().createElement(bu,{ref:this.containRef,templateRender:r,directPrint:!1}))),t().createElement("div",{className:"footer"},t().createElement("span",null,p("qm.print.scale"),":",t().createElement(P.Slider,{value:a.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{scale:e}})))}}),t().createElement("em",{className:"scale-text"},`${Math.floor(100*a.scale)}%`)),t().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:i,totalPage:l}))))),t().createElement(ur,c,t().createElement(xu,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(du.Provider,{value:this.provide},t().createElement(bu,{ref:this.containRef,templateRender:r,directPrint:!0}))}}Eu(Su,"contextType",l);const Cu=Su;function wu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nu extends e.Component{constructor(){super(...arguments),wu(this,"previewRef",t().createRef()),wu(this,"state",{visible:!1,loading:!1}),wu(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),wu(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${uu.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l,onClose:()=>{this.setState({visible:!1})}};return i?t().createElement(ur,o,t().createElement(Cu,s)):e?t().createElement(Cu,s):null})),wu(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ie(0),this.setState({visible:!0}),await ie(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:r,icon:n,type:a,disabled:i,shape:l}=this.props,o={size:r||this.context.size||"",type:a,shape:l,icon:n,loading:e,disabled:i,click:this.clickHandle};return t().createElement(t().Fragment,null,this.props.children&&t().createElement(he,o,this.props.children),this.createRender())}}wu(Nu,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),wu(Nu,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),wu(Nu,"contextType",l);const Tu=Nu;function Iu(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Ru(e){const t=Iu(e);return t?t.frameElement:null}function Ou(e){const t=ku(e);return Pu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Pu(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function Au(e,t){const r=Ru(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=Ou(a);if(n.push(e),a=Ru(a),i)break;a&&Iu(a)===t&&(i=!0)}return Pu(n)}return e.getBoundingClientRect()}function ku(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function Fu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Hu=Object.assign;class Lu{constructor(e,t){Fu(this,"node",void 0),Fu(this,"border",void 0),Fu(this,"padding",void 0),Fu(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=qu.border,this.padding.style.borderColor=qu.padding,this.content.style.backgroundColor=qu.background,Hu(this.node.style,{borderColor:qu.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){Du(t,"margin",this.node),Du(t,"border",this.border),Du(t,"padding",this.padding),Hu(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),Hu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class $u{constructor(e,t){Fu(this,"tip",void 0),Fu(this,"nameSpan",void 0),Fu(this,"dimSpan",void 0),this.tip=e.createElement("div"),Hu(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),Hu(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),Hu(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:r.width,height:r.height});Hu(this.tip.style,n.style)}}class _u{constructor(){Fu(this,"window",void 0),Fu(this,"tipBoundsWindow",void 0),Fu(this,"container",void 0),Fu(this,"tip",void 0),Fu(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new $u(r,this.container),this.rects=[],r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new Lu(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=Au(e,this.window),a=ku(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=Au(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Du(e,t,r){Hu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const qu={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let ju=null,Ku=null;function Mu(){null!=window.document&&(ju=null,null!==Ku&&(Ku.remove(),Ku=null))}function Vu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class zu{constructor(e){Vu(this,"_isRunning",void 0),Vu(this,"_selectIgnore",void 0),Vu(this,"_lastHoveredNode",null),Vu(this,"excludeSelectors",void 0),Vu(this,"onSelect",void 0),Vu(this,"iframesListeningTo",new Set),Vu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Vu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Vu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),Vu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Qe(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Mu();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var r;r=[t],null,!1,null!=window.document?(null!==ju&&clearTimeout(ju),null!=r&&(null===Ku&&(Ku=new _u),Ku.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),Vu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Vu(this,"selectFiberForNode",(0,J.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.join(" > ")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){Mu(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function Uu(e){return document.querySelector(e)}const Bu=e=>{const{action:r,onConfirm:n,onCancel:a,onFinish:i}=e,{t:l}=Vs();return t().createElement(t().Fragment,null,t().createElement("div",{style:{height:100}},l("qm.table.config.emptyText")),t().createElement(xe,{style:{width:"100%",justifyContent:"flex-end"}},t().createElement(he,{size:"small",onClick:()=>a?.()},l("qm.guideTracker.closeButton")),t().createElement(he,{size:"small",onClick:()=>n?.()},l("add"===r?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t().createElement(he,{size:"small",onClick:()=>i?.()},l("qm.guideTracker.finishButton"))))},Wu={left:"50%",top:"50%",width:1,height:1},Gu=t().forwardRef(((e,r)=>{const{open:n,current:a,defaultCurrent:i,steps:l=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:u,destroyOnHide:d,contentRender:p,zIndex:m,helper:h={},selectFilter:f=(e=>e),onSelect:g,onChange:b,onClose:y,onFinish:v}=e,{t:x}=Vs(),E=t().useRef(),S=t().useRef(l.length),[C,w]=Dc(0,{value:a,defaultValue:i}),[N,T]=Dc(void 0,{value:n,postState:e=>e??!1}),[I,R]=Dc(1051,{value:m,defaultValue:m}),[O,A]=t().useState({}),[k,F]=t().useState(!1),[H,L]=t().useState(!1),[$,_]=Hc(O.node,!!n),[D,q]=t().useState(22),j=t().useRef(!1),K=t().useMemo((()=>C>=l.length?"add":"edit"),[C,l]),M=t().useMemo((()=>`${C+1} / ${l.length}`),[C,l]);t().useLayoutEffect((()=>{E.current=new zu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),A({id:Mn(),node:e,path:t}),w(S.current),F(!0),z(),g?.(t,e)}})}),[]),t().useEffect((()=>(N?V():z(),()=>{z()})),[N]),t().useEffect((()=>{S.current=l.length}),[l]);const V=()=>{E.current.startHandle()},z=()=>{E.current.stopHandle()},U=e=>{e.stopPropagation(),e.preventDefault()};t().useImperativeHandle(r,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),GET_CURRENT_STEP:()=>({current:C,selector:O.path})})));const B=Ce("guide-tracker"),W=[{[`${B}-primary`]:!0}],G=Mc({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Bc(),{zIndex:I,builtinPlacements:G,popupPlacement:o,popupVisible:N&&k,popupClassName:Se()(W,c),popupStyle:u,prefixCls:B,popup:()=>{const e=()=>{F(!1),V()};return t().createElement("div",{className:`${B}-content`},t().createElement("div",{className:`${B}-inner`},t().createElement(we.CloseOutlined,{className:`${B}-close`,onClick:()=>{y?.(C),e()}}),t().createElement(P.Dropdown,{open:H,trigger:["click"],dropdownRender:()=>l.length?t().createElement("div",{className:"ant-dropdown-menu step-list"},t().createElement(Zn.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.id)),r=l.map((e=>e.id));if((0,J.isEqual)(t,r))return;const n=t.findIndex((e=>e===O.id)),a=-1!==n?n:C;w(a),b?.(Qn(e),a)}},l.map(((e,r)=>t().createElement("li",{key:r,className:Se()("item",{actived:e.id===O.id})},t().createElement(we.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),t().createElement("span",{className:"box"},t().createElement("span",{className:"title",title:e.title,onClick:()=>{r!==C&&(A({id:e.id,node:Uu(e.selector),path:e.selector}),w(r),q(22===D?D+1:D-1),b?.(l,r))}},e.title),t().createElement(P.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:I+1,onConfirm:()=>{const t=l.filter((t=>t.id!==e.id)),n=r===C;let a=r<=C?C-1:C;if(a=a<0?0:a,a=a>t.length?t.length:a,n&&t[a]){const{id:e,selector:r}=t[a];A({id:e,node:Uu(r),path:r})}w(a),b?.(t,a)}},t().createElement(we.CloseOutlined,{className:"close-icon"})))))))):t().createElement(t().Fragment,null),overlayClassName:`${B}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:I},onOpenChange:e=>L(e)},t().createElement(we.MenuOutlined,{className:Se()(`${B}-close`,"menu-icon"),style:{width:D}})),h.content&&t().createElement(P.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:I},content:h.content,title:h.title},t().createElement(we.QuestionCircleOutlined,{className:Se()(`${B}-close`,"help-icon")})),t().createElement("div",{className:"panel-label"},t().createElement("span",{className:"title"},x("qm.guideTracker.label")),t().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),M)),p?p({id:O.id,selector:O.path,actionStatus:K,DO_CLOSE:e},C):t().createElement(Bu,{action:K,onConfirm:()=>{b?.("add"===K?[...l,{id:O.id,selector:O.path,title:"Guide Title"}]:[...l],C),e()},onCancel:()=>{y?.(C),e()},onFinish:()=>{e(),y?.(C),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:d},t().createElement(zc(),{open:N&&k,autoLock:!0},t().createElement("div",{className:Se()(`${B}-target-placeholder`),style:{...$||Wu,position:"fixed",zIndex:I-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:U,onClick:U}))),s&&t().createElement(zc(),{open:N},t().createElement(Zc,{zIndex:I,prefixCls:B,onPause:()=>{j.current=k,F(!1),z()},onPlay:()=>{j.current?F(!0):V()}})))}));Gu.displayName="QmGuideTracker";const Yu=Gu,Xu=r=>{const{content:n,image:a,width:i,height:l,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:u=-22,zIndex:d=9,alpha:p=1,antiTamper:m=!0,grayscale:h,className:f,style:g}=r,b=t().useRef(null),y=t().useRef(new Map),v=o.fontSize??16,x=o.fontWeight??"normal",E=o.fontStyle??"normal",S=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",w=o.textAlign??"center",N=Array.isArray(n)?n:[n],T=s[0],I=s[1],R=T/2,O=I/2,P=c[0]??R,A=c[1]??O,k=t().useMemo((()=>{const e=P-R,t=A-O;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:d}}),[R,O,P,A,d]),F=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const r=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[n,o]=(e=>{let t=120,r=64;if(!a&&e.measureText){e.font=`${v}px ${S}`;const n=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),r=v*N.length+3*(N.length-1)}return[i??t,l??r]})(t),s=n*r,c=o*r,d=(T+n)*r,m=(I+o)*r,f=T/2*r,g=I/2*r,R=d/2,O=m/2,P=2*(T+n);e.width=2*d,e.height=2*m,t.globalAlpha=p,t.save(),t.translate(R,O),t.rotate(Math.PI/180*u),t.translate(-R,-O);const A=()=>{t.restore(),t.drawImage(e,0,0,d,m,d,m,d,m),h&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...k,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),P)},F=()=>{const e=Number(v)*r;t.font=`${E} normal ${x} ${e}px/${o}px ${S}`,t.fillStyle=C,t.textAlign=w,t.textBaseline="top",t.translate(s/2,0),N.forEach(((n,a)=>{t.fillText(n??"",f,g+a*(e+3*r))})),A()};if(a){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),A()},e.onerror=()=>{F()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=a}else F()},H=e=>Array.from(y.current.values()).includes(e);t().useEffect((()=>{F()}),[n,a,i,l,o,s,c,u,d,p,m,h]),function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=window&&"MutationObserver"in window,i=e.useRef(),l=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};e.useEffect((()=>(l(),a&&t.current&&(i.current=new MutationObserver(r),i.current.observe(t.current,n)),()=>l())),[t])}(b,(e=>{if(m)for(const t of e){const e=Array.from(t.removedNodes).some((e=>H(e))),r="attributes"===t.type&&H(t.target);if(e||r){F();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const L=Ce("watermark");return t().createElement("div",{ref:b,className:Se()(L,f),style:{position:"relative",...g}},r.children)},Qu=new Map,Zu=new WeakMap;let Ju=0;function ed(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:undefined;if(void 0===window.IntersectionObserver&&void 0!==n){const a=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:l}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(Zu.has(r)||(Ju+=1,Zu.set(r,Ju.toString())),Zu.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=Qu.get(t);if(!r){const n=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},Qu.set(t,r)}return r}(r),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),i.unobserve(e)),0===l.size&&(i.disconnect(),Qu.delete(a))}}const td=e=>{const{forceRender:r,height:n,placeholder:a=null,unmountIfInvisible:i,className:l,style:o}=e,{ref:s,inView:c,entry:u}=function(){let{root:e,rootMargin:r,threshold:n,triggerOnce:a,fallbackInView:i,trackVisibility:l,skip:o,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,d]=t().useState(null),[p,m]=t().useState({inView:!1,entry:void 0}),h=t().useRef(c);t().useEffect((()=>{if(o||!u)return;let t;return t=ed(u,((e,r)=>{m({inView:e,entry:r}),h.current?.(e,r),r.isIntersecting&&a&&t&&(t(),t=void 0)}),{root:e,rootMargin:r,threshold:n,trackVisibility:l,delay:s},i),()=>{t&&t()}}),[Array.isArray(n)?n.toString():n,u,e,r,a,o,l,i,s]);const f=p.entry?.target,g=t().useRef();u||!f||a||o||g.current===f||(g.current=f,m({inView:!1,entry:void 0}));const b=[d,p.inView,p.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}(Object.assign({},e,{triggerOnce:!i}));t().useEffect((()=>{n||g("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const d={[Ce("lazy-load")]:!0};return t().createElement("div",{ref:s,className:Se()(d,l),style:o},r||c?e.children:t().createElement("div",{className:"placeholder",style:{height:n}},a))},rd="1.8.17"})(),a})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("QmDesign",["react"],t):"object"==typeof exports?exports.QmDesign=t(require("react")):e.QmDesign=t(e.React)}("undefined"!=typeof self?self:this,(e=>(()=>{"use strict";var t={787:t=>{t.exports=e}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{Affix:()=>P.Affix,Alert:()=>P.Alert,Anchor:()=>P.Anchor,AutoComplete:()=>P.AutoComplete,Avatar:()=>P.Avatar,BackTop:()=>P.BackTop,Badge:()=>P.Badge,Breadcrumb:()=>P.Breadcrumb,Button:()=>P.Button,Calendar:()=>L,Card:()=>P.Card,Carousel:()=>P.Carousel,Cascader:()=>P.Cascader,Checkbox:()=>P.Checkbox,Col:()=>P.Col,Collapse:()=>P.Collapse,Comment:()=>P.Comment,ConfigProvider:()=>P.ConfigProvider,DatePicker:()=>D,DcpAnchor:()=>Gt,DcpButton:()=>he,DcpCollapse:()=>_e,DcpConfigProvider:()=>X,DcpCopyToClipboard:()=>rc,DcpCountup:()=>ut,DcpCropper:()=>zl,DcpDivider:()=>Ie,DcpDownload:()=>_t,DcpDrawer:()=>ar,DcpEmpty:()=>ht,DcpForm:()=>vl,DcpGuideTracker:()=>Yu,DcpLazyLoad:()=>td,DcpModal:()=>ur,DcpPrint:()=>Tu,DcpRangeTableHelper:()=>kc,DcpScrollbar:()=>Pt,DcpSearchHelper:()=>vc,DcpSearchTree:()=>po,DcpSpace:()=>xe,DcpSpin:()=>gt,DcpSplit:()=>at,DcpTable:()=>gc,DcpTabs:()=>er,DcpTinymce:()=>ql,DcpTour:()=>au,DcpTransition:()=>cu,DcpTreeHelper:()=>Ic,DcpTreeTableHelper:()=>Nc,DcpUploadFile:()=>Gl,DcpUploadImg:()=>to,DcpWatermark:()=>Xu,Descriptions:()=>P.Descriptions,Divider:()=>P.Divider,Drawer:()=>P.Drawer,Dropdown:()=>P.Dropdown,Empty:()=>P.Empty,Form:()=>P.Form,Grid:()=>P.Grid,Image:()=>P.Image,Input:()=>P.Input,InputNumber:()=>P.InputNumber,Layout:()=>P.Layout,List:()=>P.List,Mentions:()=>P.Mentions,Menu:()=>P.Menu,Modal:()=>P.Modal,PageHeader:()=>P.PageHeader,Pagination:()=>P.Pagination,Popconfirm:()=>P.Popconfirm,Popover:()=>P.Popover,Progress:()=>P.Progress,QmAnchor:()=>Gt,QmButton:()=>he,QmCollapse:()=>_e,QmConfigProvider:()=>X,QmCopyToClipboard:()=>rc,QmCountup:()=>ut,QmCropper:()=>zl,QmDivider:()=>Ie,QmDownload:()=>_t,QmDrawer:()=>ar,QmEmpty:()=>ht,QmForm:()=>vl,QmGuideTracker:()=>Yu,QmLazyLoad:()=>td,QmModal:()=>ur,QmPrint:()=>Tu,QmRangeTableHelper:()=>kc,QmScrollbar:()=>Pt,QmSearchHelper:()=>vc,QmSearchTree:()=>po,QmSpace:()=>xe,QmSpin:()=>gt,QmSplit:()=>at,QmTable:()=>gc,QmTabs:()=>er,QmTinymce:()=>ql,QmTour:()=>au,QmTransition:()=>cu,QmTreeHelper:()=>Ic,QmTreeTableHelper:()=>Nc,QmUploadFile:()=>Gl,QmUploadImg:()=>to,QmWatermark:()=>Xu,Radio:()=>P.Radio,Rate:()=>P.Rate,Result:()=>P.Result,Row:()=>P.Row,Segmented:()=>P.Segmented,Select:()=>P.Select,Skeleton:()=>P.Skeleton,Slider:()=>P.Slider,Space:()=>P.Space,Spin:()=>P.Spin,Statistic:()=>P.Statistic,Steps:()=>P.Steps,Switch:()=>P.Switch,Table:()=>P.Table,Tabs:()=>P.Tabs,Tag:()=>P.Tag,TimePicker:()=>M,Timeline:()=>P.Timeline,Tooltip:()=>P.Tooltip,Transfer:()=>P.Transfer,Tree:()=>P.Tree,TreeSelect:()=>P.TreeSelect,Typography:()=>P.Typography,Upload:()=>P.Upload,message:()=>P.message,notification:()=>P.notification,pinyin:()=>Gr,version:()=>rd});var e=n(787),t=n.n(e);const r=require("prop-types");var i=n.n(r);const l=(0,e.createContext)({locale:"zh-cn",size:"middle"}),o=require("dayjs");var s=n.n(o);const c={name:"zh-cn",qm:{button:{confirmPrompt:"提示",confirmTitle:"确认执行删除吗?"},divider:{collect:"收起",spread:"展开"},dialog:{fullScreen:"全屏",cancelFullScreen:"取消全屏",close:"关 闭",confirm:"确 定",cancel:"取 消"},form:{search:"搜 索",reset:"重 置",save:"保 存",spread:"展开",collect:"收起",trueText:"是",falseText:"否",draggable:"拖动排序",requiredTips:"不能为空",searchHelperTips:"搜索帮助正在加载值",inputPlaceholder:"请输入...",selectPlaceholder:"请选择...",treePlaceholder:"树节点过滤",rangeInputNumberPlaceholder:["开始值","结束值"],rangeSearchHelper:["起始位置","结束位置"],datePlaceholder:"选择日期",timePlaceholder:"选择时间",weekPlaceholder:"选择周",monthPlaceholder:"选择月",quarterPlaceholder:"选择季度",yearPlaceholder:"选择年",daterangePlaceholder:["开始日期","结束日期"],timerangePlaceholder:["开始时间","结束时间"],monthrangePlaceholder:["开始月份","结束月份"],yearrangePlaceholder:["开始年份","结束年份"],datePickers:["今天","昨天","一周前","一个月前"],dateRangePickers:["最近一周","最近一个月","最近三个月","最近六个月"],citySelectType:["按省份","按城市"],regionSelectLabel:["省","市","区","街道"],validatePrompt:"表单校验提示"},clipboard:{success:"复制成功",error:"复制失败"},download:{text:"下载",success:"文件下载成功",error:"文件下载失败!"},upload:{tooltip:"只能上传 {type} 格式",notType:"不支持的文件类型 {type}",sizeLimit:"大小不能超过 {size}M",countLimit:"数量不能超过 {count} 个",uploadError:"文件上传失败!",downError:"文件下载失败!",text:"点击上传"},uploadCropper:{dragableText:"拖放或点击",tooltip:"只能上传 {type} 格式的图片",preview:"图片预览",cropper:"图片裁剪",uploadError:"图片上传失败!",downError:"图片下载失败!",text:"上传图片",zoomIn:"放大",zoomOut:"缩小",rotatePlus:"顺时针",rotateSubtract:"逆时针"},print:{preview:"打印预览",pageSetting:"页面设置",printError:"打印失败!",exportError:"导出失败!",defaultPrinter:"默认打印机",laserPrinter:"激光打印机",stylusPrinter:"针式打印机",printer:"打印机",type:"类型",copies:"份数",printPage:["打印第","几页"],setting:"设置",export:"导出",print:"打印",scale:"缩放",paper:"纸张",pageNumber:"页码",pagination:"第{currentPage}页 / 共{totalPage}页",setPanel:{printParameter:"打印参数",pagerType:"纸张类型",carbonPaper:"三联复写纸(针式)",printDirection:"打印方向",vertical:"纵向",horizontal:"横向",doublePrint:"双面打印",autoDoublePrint:"自动双面打印",manualDoublePrint:"手动双面打印",fixedLogo:"固定Logo",printMargin:"打印边距",leftMargin:"左边距",rightMargin:"右边距",topMargin:"上边距",bottomMargin:"下边距",sizeUnit:"厘米",noEmpty:"不能为空"}},split:{resize:"拖动改变大小"},searchHelper:{text:"搜索帮助",orderIndex:"序号",rangeStartTip:"起始位置不能大于结束位置",rangeEndTip:"结束位置不能小于起始位置"},tour:{prevStep:"上一步",nextStep:"下一步",finish:"结束引导"},guideTracker:{addButton:"添 加",editButton:"保 存",closeButton:"关 闭",finishButton:"结束并保存",label:"新手引导录入",currentStep:"当前步骤:"},table:{config:{selectionText:"选择",summaryText:"合计",copyText:"复制",emptyText:"暂无数据..."},alert:{total:"共 {total} 条",selected:"已选择 {total} 项",clear:"清空"},selection:{all:"全选所有",invert:"反选所有",clear:"清空所有",currentPage:"当前页全选"},columnFilter:{text:"列定义",reset:"重置",draggable:"拖动排序",fixedLeft:"固定左侧",fixedRight:"固定右侧",cancelFixed:"取消固定"},editable:{inputPlaceholder:"请输入",selectPlaceholder:"请选择",datePlaceholder:"选择日期",datetimePlaceholder:"选择时间"},sorter:{text:"排序",asc:"升序",desc:"降序"},filter:{search:"搜 索",reset:"重 置",searchText:"搜索{text}",searchAreaText:"搜索{text},用逗号隔开",gtPlaceholder:"大于",ltPlaceholder:"小于",eqPlaceholder:"等于",neqPlaceholder:"不等于",text:"筛选",nullValue:"空值"},screen:{full:"全屏",cancelFull:"取消全屏"},import:{text:"导 入",textNoSpace:"导入",success:"成功导入 {total} 条记录",error:"导入失败,请检查字段名和数据格式是否正确",settingTitle:"导入设置",importType:"导入模式",insertPos:"插入位置",fillText:"新增",addText:"追加",insertText:"插入"},export:{text:"导 出",textNoSpace:"导出",closeButton:"关 闭",settingTitle:"导出设置",fileName:"文件名",fileType:"文件类型",sheetName:"标题",all:"全部",selected:"选中",custom:"自定义",footSummation:"底部合计",useStyle:"使用样式",warnText:"暂无表格数据或正在导出"},clipboard:{text:"粘 贴",textNoSpace:"粘贴",success:"成功粘贴 {total} 条记录",settingTitle:"粘贴设置",rowIndex:"粘贴起始行",colIndex:"粘贴起始列",content:"粘贴内容",placeholder:"请在此处 ctrl+v 粘贴数据",supportText:"说明:只支持粘贴 Excel 数据"},mergeCell:{cancel:"恢复",confirm:"合并"},print:{text:"打印"},refresh:{text:"刷新"},toolbox:{text:"工具箱"},selectCollection:{text:"行选集合",settingTitle:"行选列表",closeButton:"关 闭"},groupSummary:{text:"汇总",settingTitle:"汇总设置",savedSetting:"保存的汇总设置",saveButton:"保 存",closeButton:"关 闭",confirmButton:"显示汇总",removeText:"移除",configText:"配置名称",resultText:"汇总结果",sumText:"列值汇总",maxText:"列最大值",minText:"列最小值",avgText:"列平均值",countText:"条数汇总",operation:"操作",index:"序号",groupItem:"分组项",summaryColumn:"汇总列",calcFormula:"计算公式"},highSearch:{text:"高级检索",settingTitle:"高级检索设置",searchButton:"开始检索",closeButton:"关 闭",removeText:"移除",andText:"并且",orText:"或者",gtText:"大于",ltText:"小于",gteText:"大于等于",lteText:"小于等于",eqText:"等于",neqText:"不等于",inText:"包含",ninText:"不包含",likeText:"模糊匹配",configText:"配置名称",saveButton:"保 存",savedSetting:"保存的高级检索设置",operation:"操作",bracket:"括号",fieldName:"字段名",fieldType:"字段类型",expression:"运算",condition:"条件值",logic:"逻辑",noEmpty:"字段名不能为空"},fastSearch:{text:"数据定位查找",settingTitle:"数据定位查找设置",closeButton:"关 闭",savedSetting:"保存的数据查找设置",queryCondition:"请输入查询条件",notMatch:"没有符合条件的记录!",toTheEnd:"已查找到表格末尾,是否从头开始查找?",toStart:"已查找到表格开始,是否从末尾开始查找",tabPanes:["查找条件","更多条件"],matchCase:"大小写匹配",matchFullchar:"全字符匹配",clear:"清空条件",queryPrev:"查找上一个",queryNext:"查找下一个"}}}};require("dayjs/locale/zh-cn");let u=c;function d(e,t){return e&&t?e.replace(/\{(\w+)\}/g,((e,r)=>t[r])):e}const p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const[n,a]=t;let i;const l=n.split(".");let o=u;for(let e=0,t=l.length;e<t;e++){if(i=o[l[e]],e===t-1)return d(i,a);if(!i)return"";o=i}return""},m=e=>{u=e||u,u.name&&s().locale(u.name)};class h extends Error{constructor(e){super(e),this.name="QmDesignError"}}function f(e,t){throw new h(`[${e}] ${t}`)}function g(e,t){console.warn(new h(`[${e}] ${t}`))}const b=e=>["","small","middle","large"].includes(e),y=require("dayjs/plugin/localeData");var v=n.n(y);const x=require("dayjs/plugin/advancedFormat");var E=n.n(x);const S=require("dayjs/plugin/customParseFormat");var C=n.n(S);const w=require("dayjs/plugin/quarterOfYear");var N=n.n(w);const T=require("dayjs/plugin/weekOfYear");var I=n.n(T);const R=require("dayjs/plugin/weekday");var O=n.n(R);s().extend(v()),s().extend(E()),s().extend(C()),s().extend(N()),s().extend(I()),s().extend(O());const P=require("antd"),A=require("rc-picker/es/generate/dayjs");var k=n.n(A);const F=require("antd/es/calendar/generateCalendar");var H=n.n(F);require("antd/es/calendar/style");const L=H()(k()),$=require("antd/es/date-picker/generatePicker");var _=n.n($);require("antd/es/date-picker/style/index");const D=_()(k());function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},q.apply(this,arguments)}const j=e.forwardRef(((t,r)=>e.createElement(D,q({},t,{picker:"time",mode:void 0,ref:r}))));j.displayName="TimePicker";const K=e.forwardRef(((t,r)=>e.createElement(D.RangePicker,q({},t,{picker:"time",mode:void 0,ref:r}))));K.displayName="RangePicker",j.RangePicker=K;const M=j,V={name:"en",qm:{button:{confirmPrompt:"Prompt",confirmTitle:"Are you sure you want to delete it?"},divider:{collect:"Collapse",spread:"Expand"},dialog:{fullScreen:"Full Screen",cancelFullScreen:"Cancel Full Screen",close:"Close",confirm:"Confirm",cancel:"Cancel"},form:{search:"Search",reset:"Reset",save:"Save",spread:"Expand",collect:"Collapse",trueText:"Yes",falseText:"No",draggable:"Drag and sort",requiredTips:" is required",searchHelperTips:"Search Helper is loading value",inputPlaceholder:"Please enter...",selectPlaceholder:"Please select...",treePlaceholder:"Tree node filter",rangeInputNumberPlaceholder:["Start value","End value"],rangeSearchHelper:["Start","End"],datePlaceholder:"Select date",timePlaceholder:"Select time",weekPlaceholder:"Select week",monthPlaceholder:"Select month",quarterPlaceholder:"Select quarter",yearPlaceholder:"Select year",daterangePlaceholder:["Start date","End date"],timerangePlaceholder:["Start time","End time"],monthrangePlaceholder:["Start month","End month"],yearrangePlaceholder:["Start year","End year"],datePickers:["Today","Yesterday","A Week Ago","A Month Ago"],dateRangePickers:["Nearly A Week","Nearly A Month","Nearly Three Months","Nearly Six Months"],citySelectType:["Province","City"],regionSelectLabel:["Province","City","Region","Street"],validatePrompt:"Form validation tips"},clipboard:{success:"Copy successful",error:"Copy failed"},download:{text:"Download",success:"File downloaded successfully",error:"File download failed!"},upload:{tooltip:"Can only upload {type} format",notType:"Unsupported file types {type}",sizeLimit:"Size cannot exceed {size}M",countLimit:"Quantity cannot exceed {count}",uploadError:"Failed to upload files!",downError:"File download failed!",text:"click and upload"},uploadCropper:{dragableText:"Drop or click",tooltip:"Can only upload {type} format",preview:"Preview image",cropper:"Cropper image",uploadError:"Failed to upload images!",downError:"Image download failed!",text:"Upload image",zoomIn:"Zoom in",zoomOut:"Zoom out",rotatePlus:"Rotate plus",rotateSubtract:"Rotate subtract"},print:{preview:"Print preview",pageSetting:"Page setting",printError:"Print failed!",exportError:"Export failed!",defaultPrinter:"Default printer",laserPrinter:"Laser printer",stylusPrinter:"Stylus printer",printer:"Printer",type:"Type",copies:"Copies",printPage:["Print","page"],setting:"Setting",export:"Export",print:"Print",scale:"Scale",paper:"Paper",pageNumber:"Number",pagination:"{currentPage} / {totalPage} page",setPanel:{printParameter:"Print parameter",pagerType:"Pager type",carbonPaper:"Triple carbon paper(stylus)",printDirection:"Print direction",vertical:"Vertical",horizontal:"Horizontal",doublePrint:"Double print",autoDoublePrint:"Auto double print",manualDoublePrint:"Manual double print",fixedLogo:"Fixed Logo",printMargin:"Print margin",leftMargin:"Left margin",rightMargin:"Light margin",topMargin:"Top margin",bottomMargin:"Bottom margin",sizeUnit:"cm",noEmpty:"Can not be empty"}},split:{resize:"Drag to change size"},searchHelper:{text:"Search helper",orderIndex:"Index",rangeStartTip:"Start position cannot be greater than end position",rangeEndTip:"End position cannot be less than start position"},tour:{prevStep:"Prev",nextStep:"Next",finish:"Finish"},guideTracker:{addButton:"Add To",editButton:"Save",closeButton:"Close",finishButton:"Finish And Save",label:"Operation guide collection",currentStep:"Current Step: "},table:{config:{selectionText:"#",summaryText:"Summation",copyText:"Copy",emptyText:"No Data..."},alert:{total:"Total {total} items",selected:"Selected {total}",clear:"Clear"},selection:{all:"Select all",invert:"Invert select",clear:"Clear all",currentPage:"Select all on current page"},columnFilter:{text:"Define",reset:"Reset",draggable:"Drag and sort",fixedLeft:"Fixed left",fixedRight:"Fixed right",cancelFixed:"Cancel fixed"},editable:{inputPlaceholder:"Please input",selectPlaceholder:"Please select",datePlaceholder:"Select date",datetimePlaceholder:"Select time"},sorter:{text:"Sort",asc:"Ascending",desc:"Descending"},filter:{search:"Search",reset:"Reset",searchText:"Search {text}",searchAreaText:"Search {text}, separated by commas",gtPlaceholder:"is greater than",ltPlaceholder:"is lesser than",eqPlaceholder:"is equal to",neqPlaceholder:"is not equal to",text:"Filter",nullValue:"Null Value"},screen:{full:"Full Screen",cancelFull:"Cancel Full Screen"},import:{text:"Import",textNoSpace:"Import",success:"Successfully imported {total} records",error:"Import failed, please check that the field name and data format are correct.",settingTitle:"Import setting",importType:"Import type",insertPos:"Insertion position",fillText:"fill",addText:"add",insertText:"insert"},export:{text:"Export",textNoSpace:"Export",closeButton:"Close",settingTitle:"Export setting",fileName:"File name",fileType:"File type",sheetName:"Title",all:"All",selected:"Selected",custom:"Custom",footSummation:"Summation",useStyle:"Use style",warnText:"No table data or exporting"},clipboard:{text:"Paste",textNoSpace:"Paste",success:"Successfully paste {total} records",settingTitle:"Paste setting",rowIndex:"Start row index",colIndex:"Start col index",content:"content",placeholder:"Please paste data here with ctrl+v",supportText:"Note: only excel data can be pasted"},mergeCell:{cancel:"reset",confirm:"merge"},print:{text:"Print"},refresh:{text:"Reload"},toolbox:{text:"Tool box"},selectCollection:{text:"Selected row collection",settingTitle:"Selected row list",closeButton:"Close"},groupSummary:{text:"Summary",settingTitle:"Summary setting",savedSetting:"Saved configuration",saveButton:"Save",closeButton:"Close",confirmButton:"Show summary",removeText:"Remove",configText:"Configuration name",resultText:"Summary result",sumText:"column value summary",maxText:"column max value",minText:"column min value",avgText:"column avg value",countText:"records summary",operation:"Operation",index:"Index",groupItem:"Group item",summaryColumn:"Summary column",calcFormula:"Calculate formula"},highSearch:{text:"Super search",settingTitle:"Super search setting",searchButton:"Start search",closeButton:"Close",removeText:"Remove",andText:"and",orText:"or",gtText:"is greater than",ltText:"is lesser than",gteText:"is equal or greater than",lteText:"is equal or lesser than",eqText:"is equal to",neqText:"is not equal to",inText:"include",ninText:"not include",likeText:"fuzzy matching",configText:"Configuration name",saveButton:"Save",savedSetting:"Saved configuration",operation:"Operation",bracket:"Bracket",fieldName:"Field name",fieldType:"Field type",expression:"Expression",condition:"Condition value",logic:"Logic",noEmpty:"Can not be empty"},fastSearch:{text:"Records location search",settingTitle:"Records location search setting",closeButton:"Close",savedSetting:"Saved configuration",queryCondition:"Please enter query condition",notMatch:"There are no qualified records!",toTheEnd:"It has been found to the end. Do you want to find it from the beginning?",toStart:"The start has been found. Do you want to start from the end?",tabPanes:["Search condition","More conditions"],matchCase:"Case matching",matchFullchar:"Full character matching",clear:"Clear condition",queryPrev:"Find previous",queryNext:"Find next"}}}},z=require("antd/es/locale/zh_CN");var U=n.n(z);const B=require("antd/es/locale/en_GB");function W(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const G={[V.name]:{qm:V,antd:n.n(B)()},[c.name]:{qm:c,antd:U()}};class Y extends e.Component{constructor(e){super(e),this.state={value:{locale:e.locale,size:e.size,global:e.global}},m(Object.assign({},G,e.global.langPackage)[e.locale].qm)}static getDerivedStateFromProps(e,t){const{locale:r,size:n}=t.value,{locale:a,size:i,global:l}=e;return a!==r&&m(Object.assign({},G,l.langPackage)[a].qm),a!==r||i!==n?{value:Object.assign({},t.value,{locale:a,size:i})}:null}render(){const{global:e}=this.props,{value:r}=this.state,n=Object.assign({},G,e.langPackage);return t().createElement(l.Provider,{value:r},t().createElement(P.ConfigProvider,{locale:n[r.locale].antd,componentSize:r.size,autoInsertSpaceInButton:e.autoInsertSpaceInButton},this.props.children))}}W(Y,"propTypes",{locale:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},theme:i().string,global:i().object}),W(Y,"defaultProps",{locale:"zh-cn",size:"middle",global:{}});const X=Y,Q=require("omit.js");var Z=n.n(Q);const J=require("lodash-es"),ee="undefined"==typeof window,te=e=>t().isValidElement(e),re=e=>te(e)&&e.type===t().Fragment,ne=()=>{},ae=()=>!0,ie=async e=>new Promise((t=>setTimeout(t,e))),le=e=>{Promise.resolve().then(e)},oe=e=>e.replace(/-(\w)/g,((e,t)=>t?t.toUpperCase():"")),se=e=>!!(!e&&0!==e||(0,J.isArray)(e)&&!e.length||(0,J.isPlainObject)(e)&&!Object.keys(e).length),ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if((0,J.isPlainObject)(e)||(0,J.isArray)(e)){const r=Array.isArray(e),n=r?[]:{};if(t.get(e))return e;t.set(e,n);const a=r?void 0:Object.keys(e);return function(e,t){let r=-1;const n=e.length;for(;++r<n;)t(e[r],r)}(a||e,((r,i)=>{a&&(i=r),n[i]=ce(e[i],t)})),n}return e},ue=e=>(0,J.isNumber)(e)?`${e}px`:e.toString();function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},de.apply(this,arguments)}function pe(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class me extends e.Component{constructor(){super(...arguments),pe(this,"state",{isLoading:!1}),pe(this,"clickHandle",(async e=>{this.setState({isLoading:!0});try{await(this.props.click?.(e))}catch(e){g("Button","`click`方法执行出错")}this.setState({isLoading:!1})}))}render(){const{size:e,loading:r,authConfig:n,click:a,confirm:i}=this.props,{isLoading:l}=this.state,o=e||this.context.size||"",s=(0,J.isFunction)(a)?{onClick:this.clickHandle}:null,c={...Z()(this.props,["authConfig","click","confirm"]),size:o,loading:l||r||!1,...s};if(n){const{visible:e=1,disabled:t}=n||{};if(!e)return null;t&&(c.disabled=!0)}return i?t().createElement(P.Popconfirm,{title:i.title||p("qm.button.confirmTitle"),disabled:c.disabled,onConfirm:e=>{i.onConfirm?.(),c.onClick?.(e)},onCancel:e=>{i.onCancel?.(e)}},t().createElement(P.Button,de({},c,{onClick:ne}),this.props.children)):t().createElement(P.Button,c,this.props.children)}}pe(me,"propTypes",{click:i().func,confirm:i().shape({title:i().node,onConfirm:i().func,onCancel:i().func})}),pe(me,"contextType",l);const he=me;var fe,ge,be,ye=function(e){return e[e.default=14]="default",e[e.large=12]="large",e[e.middle=10]="middle",e[e.small=8]="small",e}(ye||{});class ve extends e.Component{render(){const{size:e}=this.props,r=e||this.context.size||"",n=(0,J.isNumber)(e)?e:ye[e||r||"default"],a={...this.props,size:n};return t().createElement(P.Space,a,this.props.children)}}fe=ve,be=l,(ge=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(ge="contextType"))in fe?Object.defineProperty(fe,ge,{value:be,enumerable:!0,configurable:!0,writable:!0}):fe[ge]=be;const xe=ve,Ee=require("classnames");var Se=n.n(Ee);const Ce=e=>`qm-${e}`,we=require("@ant-design/icons");function Ne(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Te extends e.Component{constructor(){super(...arguments),Ne(this,"clickHandle",(()=>{const{collapse:e,onCollapseChange:t=ne}=this.props;t(!e)}))}render(){const{size:e,label:r,extra:n,collapse:a,bordered:i,disabled:l,id:o,className:s,style:c}=this.props,u=e||this.context.size||"",d=Ce("divider"),m={[d]:!0,[`${d}-borderless`]:!i,[`${d}--lg`]:"large"===u,[`${d}--sm`]:"small"===u};return t().createElement("div",{id:o,className:Se()(m,s),style:c},t().createElement("span",{className:Se()(`${d}__title`)},r),t().createElement("div",{className:Se()(`${d}__extra`)},n),void 0!==a&&t().createElement(P.Button,{type:"link",className:Se()(`${d}__collapse`),disabled:l,onClick:this.clickHandle},p(a?"qm.divider.collect":"qm.divider.spread"),a?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)))}}Ne(Te,"contextType",l),Ne(Te,"propTypes",{label:i().string,size:(e,t,r)=>{if(!b(e[t]||""))return f("Divider","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},extra:i().oneOfType([i().element,i().string]),collapse:i().bool,bordered:i().bool}),Ne(Te,"defaultProps",{bordered:!0});const Ie=Te,Re=()=>({height:0,opacity:0}),Oe=(e,t)=>"height"===t.propertyName,Pe={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"},Ae=require("rc-motion");var ke=n.n(Ae);const Fe=t().forwardRef(((e,r)=>{const{forceRender:n,className:a,style:i,boxStyle:l,isActive:o}=e,[s,c]=t().useState(o||n);if(t().useEffect((()=>{(n||o)&&c(!0)}),[n,o]),!s)return null;const u=Ce("collapse");return t().createElement("div",{ref:r,className:Se()(`${u}-content`,{[`${u}-content-active`]:o,[`${u}-content-inactive`]:!o},a),style:i},t().createElement("div",{className:`${u}-content-box`,style:l},e.children))}));Fe.displayName="PanelContent";const He=Fe;function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Le.apply(this,arguments)}const $e=e=>{const{defaultActive:r,label:n,extra:a,className:i,style:l,containerStyle:o,bordered:s,disabled:c,forceRender:u,destroyOnClose:d=!1,onChange:p}=e,[m,h]=t().useState(!!r),f=Ce("collapse"),g=Se()({[`${f}`]:!0,[`${f}-active`]:m,[`${f}-disabled`]:c},i);return t().createElement("div",{className:g,style:l},t().createElement(Ie,{label:n,extra:a,collapse:m,bordered:s,disabled:c,onCollapseChange:e=>{h(e),p?.(e)}}),t().createElement(ke(),Le({visible:m},Pe,{leavedClassName:`${f}-content-hidden`,forceRender:u,removeOnLeave:d}),((r,n)=>{let{className:a,style:i}=r;return t().createElement(He,{ref:n,prefixCls:f,className:a,style:i,boxStyle:o,isActive:m,forceRender:u},e.children)})))};$e.displayName="QmCollapse";const _e=$e,De=t().createContext(void 0);function qe(t,r){((r,n)=>{const a=e.useRef(!0);e.useEffect((()=>(e=>{if(!e)return t()})(a.current)),n),e.useEffect((()=>(a.current=!1,()=>{a.current=!0})),[])})(0,r)}const je=require("react-draggable");var Ke=n.n(je);const Me=(e,t,r)=>{e&&t&&r&&e.addEventListener(t,r,!1)},Ve=(e,t,r)=>{e&&t&&r&&e.removeEventListener(t,r,!1)},ze=e=>e.stopPropagation(),Ue=e=>e.preventDefault(),Be=(e,t,r)=>{!ee&&e&&t&&((0,J.isPlainObject)(t)?Object.keys(t).forEach((r=>{Be(e,r,t[r])})):(t=oe(t),e.style[t]=r))},We=e=>{let t=0,r=e;for(;r;)t+=r.offsetTop,r=r.offsetParent;return t},Ge=(e,t)=>Math.abs(We(e)-We(t)),Ye=e=>{let t=0,r=0;for(;e;)t+=e.offsetLeft-e.scrollLeft,r+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{x:t,y:r}},Xe=(e,t)=>{let r=e;for(;r;){if(r.classList?.contains(t))return r;r=r.parentNode}return null},Qe=(e,t)=>{if(ee||!e||!t)return!1;let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1},Ze=e=>{const{minValues:r,onDragChange:n,onDragging:a}=e,{splitRef:i,direction:l}=t().useContext(De),[o,s]=t().useState(),[c,u]=t().useState(0),d="vertical"===l?"y":"x",m={[`${Ce("split")}__resize-bar`]:!0,vertical:"vertical"===l,horizontal:"horizontal"===l};return t().createElement(Ke(),{bounds:o,axis:d,position:{x:0,y:0},positionOffset:{[d]:-1*c},onStart:()=>{n(!0),(()=>{const e=i.current.children[0];if(!e)return;const t=(()=>{const{w:e,h:t}={w:i.current.offsetWidth,h:i.current.offsetHeight};return[r[0],("vertical"===l?t:e)-r[1]]})(),n=e.offsetWidth,a=e.offsetHeight;s({left:t[0]-n,right:t[1]-n,top:t[0]-a,bottom:t[1]-a})})()},onDrag:(e,t)=>{u(t[d]),a(t[d])},onStop:()=>n(!1)},t().createElement("div",{className:Se()(m),title:p("qm.split.resize")}))};Ze.displayName="ResizeBar";const Je=Ze,et=t().forwardRef(((e,r)=>{const{offset:n,className:a,style:i}=e,{direction:l,dragging:o}=t().useContext(De),s="vertical"===l?"height":"width",c={[Ce("split-pane")]:!0,isLocked:o,horizontal:"horizontal"===l,vertical:"vertical"===l,[a]:!!a},u=void 0!==n?{[s]:ue(n)}:{flex:1,[s]:0};return t().createElement("div",{ref:r,className:Se()(c),style:{...u,...i}},e.children)}));et.displayName="QmSplitPane";const tt=et;function rt(){return rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rt.apply(this,arguments)}const nt=e=>{const{direction:r="horizontal",defaultValue:n="50%",uniqueKey:a,className:i,style:o,onDragStart:s,onDrag:c=ne,onDragEnd:u}=e,{global:d}=t().useContext(l),p=t().useRef(null),m=t().useRef(null),h=e=>Number(e)>0?`${e}px`:(e=>["px","em","vw","vh","%"].some((t=>e.endsWith(t))))(e.toString())?e.toString():`${Number.parseFloat(e)}px`,f=e=>Number.parseInt(e,10),g=e=>{const t=Number.parseInt(e.props?.min||0);return t>=0?t:0},b=t().useMemo((()=>a?`split_${a}`:""),[a]),[y,v]=t().useState(!1),[x,E]=t().useState(h(n)),S=t().useRef(0);qe((()=>{y?(S.current="vertical"===r?m.current.offsetHeight:m.current.offsetWidth,s?.(f(x))):(u?.(f(x)),localStorage.setItem(b,x),N(b,x))}),[y]),t().useEffect((()=>{C()}),[]);const C=()=>{if(!b)return;const e=localStorage.getItem(b);e?E(h(e)):w(b).then((e=>{localStorage.setItem(b,h(e||n)),C()})).catch((()=>{}))},w=async e=>{const t=d?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},N=async(e,t)=>{const r=d?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},T=t().useMemo((()=>({splitRef:p,direction:r,dragging:y})),[r,y]),I=[];t().Children.map(e.children,(e=>{te(e)&&!re(e)&&"QmSplitPane"===e.type?.displayName&&I.push(e)}));const[R,O]=I,P=t().useMemo((()=>[g(R),g(O)]),[R,O]),A={[Ce("split")]:!0,vertical:"vertical"===r};return t().createElement(De.Provider,{value:T},t().createElement("div",{ref:p,className:Se()(A,i),style:o},t().createElement(tt,rt({},R.props,{ref:m,offset:x})),t().createElement(Je,{minValues:P,onDragChange:e=>v(e),onDragging:e=>{const t=S.current+e;E(`${t}px`),c(t)}}),t().createElement(tt,O.props)))};nt.Pane=tt,nt.displayName="QmSplit";const at=nt,it=require("react-countup");var lt=n.n(it);function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ot.apply(this,arguments)}function st(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ct extends e.Component{render(){const{size:e,className:r,style:n}=this.props,a=e||this.context.size||"",i=Ce("countup"),l={[i]:!0,[`${i}--lg`]:"large"===a,[`${i}--sm`]:"small"===a};return t().createElement(lt(),ot({},this.props,{className:Se()(l,r),style:n}),this.props.children)}}st(ct,"defaultProps",{duration:2}),st(ct,"contextType",l);const ut=ct;function dt(){return dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dt.apply(this,arguments)}function pt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mt extends e.Component{render(){const{size:e,className:r}=this.props,n=e||this.context.size||"",a=Ce("empty"),i={...this.props,image:P.Empty.PRESENTED_IMAGE_SIMPLE},l={[a]:!0,[`${a}--lg`]:"large"===n,[`${a}--sm`]:"small"===n};return t().createElement(P.Empty,dt({},i,{className:Se()(l,r)}))}}pt(mt,"contextType",l),pt(mt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const ht=mt;class ft extends e.Component{render(){const{fullHeight:e,className:r,style:n={}}=this.props,a={[`${Ce("spin")}-full-height`]:e},i={wrapperClassName:Se()(a,r),...Z()(this.props,["fullHeight"]),style:{...n,maxHeight:"none"}};return t().createElement(P.Spin,i,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ft,"defaultProps",{tip:"Loading...",fullHeight:!1});const gt=ft,bt=t().createContext(void 0),yt=require("resize-observer-polyfill");var vt=n.n(yt);const xt=function(e){for(const t of e){const e=t.target.__resizeListeners__||[];Array.isArray(e)&&e.length&&e.forEach((e=>e(t)))}},Et=function(e,t){!ee&&e&&(e.__resizeListeners__||(e.__resizeListeners__=[],e.__ro__=new(vt())(xt),e.__ro__.observe(e)),e.__resizeListeners__.push(t))},St=function(e,t){e&&e.__resizeListeners__&&(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),e.__resizeListeners__.length||e.__ro__?.disconnect())};function Ct(t){const[r,n]=e.useState({width:0,height:0});return e.useEffect((()=>{const e=t.current,r=e=>{const{width:t,height:r}=e.contentRect;n({width:t,height:r})};return e&&Et(e,r),()=>{e&&St(e,r)}}),[t]),r}function wt(t,r){var n=this;const a=e.useRef(null);return e.useEffect((()=>()=>{clearTimeout(a.current),a.current=null}),[]),function(){for(var e=arguments.length,i=new Array(e),l=0;l<e;l++)i[l]=arguments[l];a.current&&clearTimeout(a.current),a.current=setTimeout((()=>t.apply(n,i)),r)}}const Nt=6,Tt={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",reverse:"width",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",reverse:"height",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},It=e=>{const{thumb:r,always:n,barSize:a=Nt,direction:i="vertical",onDrag:l=ne}=e,{dragging:o,scrollbarElement:s,wrapElement:c}=t().useContext(bt),u=Tt[i],d=t().useRef(r),p=t().useRef(null),m=t().useRef(null),h=t().useRef({}),f=t().useRef(!1),g=t().useRef(!1),b=t().useRef(ee?null:document.onselectstart),[y,v]=t().useState(!1);t().useEffect((()=>{d.current=r}),[r]),t().useEffect((()=>{const e=s.current;return Me(e,"mousemove",C),Me(e,"mouseleave",w),()=>{S(),Ve(document,"mouseup",E),Ve(e,"mousemove",C),Ve(e,"mouseleave",w)}}),[]);const x=e=>{if(!p.current||!m.current)return;if(!f.current)return;const t=h.current[u.axis];if(!t)return;const r=100*(-1*(p.current.getBoundingClientRect()[u.direction]-e[u.client])-(m.current[u.offset]-t))/p.current[u.offset];c.current[u.scroll]=r*c.current[u.scrollSize]/100,l(!0)},E=()=>{f.current=!1,h.current={[u.axis]:0},Ve(document,"mousemove",x),Ve(document,"mouseup",E),S(),g.current&&v(!1),l(!1)},S=()=>{document.onselectstart!==b.current&&(document.onselectstart=b.current)},C=()=>{g.current=!1,v(!!d.current.size)},w=()=>{g.current=!0,v(f.current)},N=Ce("scrollbar"),T={[`${N}__bar`]:!0,"is-vertical":"vertical"===i,"is-horizontal":"horizontal"===i},I={[u.reverse]:a},R={[u.size]:r.size,transform:`translate${u.axis}(${r.offset}%)`};return t().createElement(cu,{name:"fade",in:n||o||y,timeout:300},t().createElement("div",{ref:p,className:Se()(T),style:I},t().createElement("div",{ref:m,className:`${N}__thumb`,style:R,onMouseDown:e=>{e.stopPropagation(),Me(document,"mousemove",x),Me(document,"mouseup",E),f.current=!0,b.current=document.onselectstart,document.onselectstart=()=>!1;const t=e.target;t&&(h.current={[u.axis]:t[u.offset]-(e[u.client]-t.getBoundingClientRect()[u.direction])})}})))},Rt=20,Ot=t().forwardRef(((e,r)=>{const{wrapClassName:n,wrapStyle:a,barWidth:i,always:l,native:o,minSize:s=Rt,onScroll:c}=e,u=t().useRef(null),d=t().useRef(null),p=t().useRef(null),[m,h]=t().useState({size:0,offset:0,ratio:1}),[f,b]=t().useState({size:0,offset:0,ratio:1}),[y,v]=t().useState(!1),x=Ct(u),E=Ct(p);qe((()=>{!o&&S()}),[E.width,E.height,x.width,x.height]);const S=wt((()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=e**2/d.current.scrollHeight,n=t**2/d.current.scrollWidth,a=Math.max(r,s),i=Math.max(n,s),l=r/(e-r)/(a/(e-a)),o=n/(t-n)/(i/(t-i)),c=a+4<e?a:0,u=i+4<t?i:0,p=100*d.current.scrollTop/e*l,g=100*d.current.scrollLeft/t*o;h(Object.assign({},m,{size:u,ratio:o,offset:g})),b(Object.assign({},f,{size:c,ratio:l,offset:p}))}),5),C=e=>{v(e)},w=e=>{(0,J.isNumber)(e)?d.current.scrollTop=e:g("Scrollbar","SET_SCROLL_TOP 参数必须是数值类型")},N=e=>{(0,J.isNumber)(e)?d.current.scrollLeft=e:g("Scrollbar","SET_SCROLL_LEFT 参数必须是数值类型")};t().useImperativeHandle(r,(()=>({container:u.current,scrollTop:d.current?.scrollTop||0,scrollLeft:d.current?.scrollLeft||0,SET_SCROLL_TOP:w,SET_SCROLL_LEFT:N})));const T=t().useMemo((()=>({dragging:y,scrollbarElement:u,wrapElement:d})),[y]),I=Ce("scrollbar"),R={[`${I}__wrap`]:!0,[`${I}__wrap--hidden`]:!o};return t().createElement("div",{ref:u,className:Se()(I,e.className),style:e.style},t().createElement("div",{ref:d,className:Se()(R,n),style:a,onScroll:e=>{const{scrollTop:t,scrollLeft:r}=e.target;!o&&(()=>{if(!d.current)return;const e=d.current.offsetHeight-4,t=d.current.offsetWidth-4,r=100*d.current.scrollTop/e*f.ratio,n=100*d.current.scrollLeft/t*m.ratio;h(Object.assign({},m,{offset:n})),b(Object.assign({},f,{offset:r}))})(),c?.({scrollTop:t,scrollLeft:r})}},t().createElement("div",{ref:p,className:`${I}__view`},e.children)),!o&&t().createElement(bt.Provider,{value:T},t().createElement(It,{direction:"horizontal",thumb:m,barSize:i,always:l,onDrag:C}),t().createElement(It,{direction:"vertical",thumb:f,barSize:i,always:l,onDrag:C})))}));Ot.displayName="QmScrollbar";const Pt=Ot,At=require("axios");var kt=n.n(At);const Ft=(e,t)=>{if(navigator.msSaveBlob)navigator.msSaveBlob(e,decodeURI(t));else{const r=window.URL.createObjectURL(e);let n=document.createElement("a");n.href=r,n.download=decodeURI(t),n.click(),n=null}};function Ht(){return Ht=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ht.apply(this,arguments)}function Lt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class $t extends e.Component{constructor(){super(...arguments),Lt(this,"state",{loading:!1}),Lt(this,"downloadHandle",(async()=>{this.setState({loading:!0});try{const{action:e,beforeDownload:t=ae}=this.props,r=(0,J.isString)(e)?e:await this.getActionUrl();if(!r)return g("Download","参数 `action` 有误!");if(!t(r))return;await this.downloadFile(r),await ie(100),this.props.onSuccess?.(),P.message.success(p("qm.download.success"))}catch(e){this.props.onError?.(e),P.message.error(p("qm.download.error"))}this.setState({loading:!1})}))}async getActionUrl(){const e=this.props.action;if(e.api)try{const t=await e.api(e.params);if(200===t.code)return t.data}catch(e){}return""}async downloadFile(e){const{fileName:t,headers:r,params:n,withCredentials:a}=this.props,i=await kt()({url:e,params:n,headers:r,withCredentials:a,responseType:"blob",timeout:0}),l=i.data,o=i.headers["content-disposition"],s=t||(o?o.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Ft(l,s)}render(){const{size:e}=this.props,{loading:r}=this.state,n=e||this.context.size||"",a=Z()(this.props,["action","fileName","headers","withCredentials","params","beforeDownload","onSuccess","onError"]);return t().createElement(P.Button,Ht({},a,{size:n,loading:r,onClick:this.downloadHandle}),this.props.children)}}Lt($t,"propTypes",{action:i().oneOfType([i().string,i().shape({api:i().func.isRequired,params:i().object})]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},fileName:i().string,headers:i().object,withCredentials:i().bool,params:i().object,beforeDownload:i().func,onSuccess:i().func,onError:i().func}),Lt($t,"defaultProps",{icon:t().createElement(we.DownloadOutlined,null),children:p("qm.download.text"),withCredentials:!1}),Lt($t,"contextType",l);const _t=$t,Dt=require("add-dom-event-listener");var qt=n.n(Dt);const jt=require("scroll-into-view-if-needed");var Kt=n.n(jt);class Mt extends e.Component{renderLabel(){const{activeKey:e,labels:r,onTabClick:n}=this.props;return r.map(((r,a)=>{const i={item:!0,actived:a===e};return t().createElement("div",{key:a,className:Se()(i),onClick:e=>n(a,e)},t().createElement("span",null,r))}))}render(){return t().createElement(t().Fragment,null,this.renderLabel())}}const Vt=Mt;class zt extends e.Component{render(){const{label:e,showDivider:r,className:n,style:a}=this.props,i={[Ce("anchor-item")]:!0};return t().createElement("div",{className:Se()(i,n),style:a},r&&t().createElement(Ie,{label:e,style:{marginBottom:10}}),this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(zt,"displayName","QmAnchorItem");const Ut=zt;function Bt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wt extends e.Component{get __is_conf(){return!!this.props.labelList?.length}constructor(t){super(t),Bt(this,"currentState","ready"),Bt(this,"itemsTotal",void 0),Bt(this,"timer",void 0),Bt(this,"scrollEvent",void 0),Bt(this,"scrollRef",(0,e.createRef)()),Bt(this,"onScrollHandle",(e=>{if("ready"!==this.currentState)return;const t=this.findCurrentIndex(e.target.scrollTop);-1!==t&&this.setState({activeKey:t})})),Bt(this,"onTabClickHandle",(e=>{const t=this.getTargetElement(e);t&&(this.setState({activeKey:e}),this.currentState="stop",this.timer&&clearTimeout(this.timer),Kt()(t,{block:"start",behavior:"smooth",boundary:this.scrollRef.current}),this.timer=setTimeout((()=>this.currentState="ready"),500))})),Bt(this,"SCROLL_TO_ITEM",(e=>{e=(e=e<0?0:e)>this.itemsTotal?this.itemsTotal:e,this.onTabClickHandle(e)})),this.state={activeKey:t.defaultActiveIndex||0}}componentDidMount(){this.initialHandle(),this.scrollEvent=qt()(this.scrollRef.current,"scroll",(0,J.throttle)(this.onScrollHandle,60))}componentWillUnmount(){this.scrollEvent.remove()}initialHandle(){const{activeKey:e}=this.state;e>0&&(this.scrollRef.current.scrollTop=Ge(this.getTargetElement(e),this.scrollRef.current))}createDistances(){const{labelList:e=[]}=this.props;return(this.__is_conf?e.map((e=>document.getElementById(e.id))):Array.from(this.scrollRef.current?.children||[])).map((e=>Ge(e,this.scrollRef.current)))}findCurrentIndex(e){const t=Math.abs(e),r=this.createDistances();let n=-1;for(let e=0;e<r.length;e++){const a=r[e],i=r[e+1]||1e4;t>=a-1&&t<i&&(n=e)}return n}getTargetElement(e){const{labelList:t=[]}=this.props;return this.__is_conf?document.getElementById(t[e].id):this.scrollRef.current.children[e]}render(){const{activeKey:e}=this.state,{size:r,labelWidth:n,tabPosition:a,labelList:i=[],onTabClick:l,className:o,style:s}=this.props,c=r||this.context.size||"",u=Ce("anchor"),d={[u]:!0,[`${u}-left`]:"left"===a,[`${u}-top`]:"top"===a,[`${u}--lg`]:"large"===c,[`${u}--sm`]:"small"===c},p=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmAnchorItem"===e.type?.displayName&&p.push(e)}));const m=this.__is_conf?i.map((e=>e.label)):p.map((e=>e.props.label)),h=this.__is_conf?i.map((e=>e.id)):p.map(((e,t)=>e.props["data-id"]||t.toString()));return this.itemsTotal=m.length,t().createElement("div",{className:Se()(d,o),style:s},t().createElement("div",{className:Se()("anchor-nav"),style:{width:n?ue(n):""}},t().createElement(Vt,{activeKey:e,labels:m,onTabClick:(e,t)=>{this.onTabClickHandle(e),l?.({label:m[e],id:h[e]},t)}})),t().createElement("div",{ref:this.scrollRef,className:Se()("anchor-container")},this.__is_conf?this.props.children:p))}}Bt(Wt,"Item",Ut),Bt(Wt,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},labelWidth:(e,t,r)=>{if("number"!=typeof(n=e[t])&&void 0!==n&&!["px","rem","em","vw","vh","%"].some((e=>n.endsWith(e)))&&!n.startsWith("calc"))return f("Anchor","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.");var n},labelList:i().arrayOf(i().shape({id:i().string,label:i().string}))}),Bt(Wt,"defaultProps",{tabPosition:"left"}),Bt(Wt,"contextType",l);const Gt=Wt;class Yt extends e.Component{render(){return t().createElement(P.Tabs.TabPane,this.props,this.props.children)}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Yt,"displayName","QmTabPane");const Xt=Yt;function Qt(){return Qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qt.apply(this,arguments)}function Zt(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Jt extends e.Component{render(){const{items:e,size:r,tabPosition:n,tabBarGutter:a,className:i,authConfig:l}=this.props,o=r||this.context.size||"",s=Ce("tabs"),c={[s]:!0,[`${s}--lg`]:"large"===o,[`${s}--sm`]:"small"===o},u={...Z()(this.props,["items","authConfig"]),size:o,tabBarGutter:a??(["top","bottom"].includes(n)?30:0)},d=[];t().Children.map(this.props.children,(e=>{te(e)&&!re(e)&&"QmTabPane"===e.type?.displayName&&d.push(e)}));const p=e?[...e]:d.map((e=>{let{key:t,props:r}=e;return{key:t,label:r.tab,disabled:r.disabled,closable:r.closable,forceRender:r.forceRender,children:r.children}}));if(l){const{fieldList:e=[]}=l||{};for(let t=0;t<p.length;t++){const r=p[t],n=e.find((e=>e.dataIndex===r.key)),{visible:a=1,disabled:i}=n||{};a?i&&(r.disabled=!0):(p.splice(t,1),t--)}}return t().createElement(P.Tabs,Qt({},u,{items:p,className:Se()(c,i)}))}}Zt(Jt,"TabPane",Xt),Zt(Jt,"contextType",l),Zt(Jt,"defaultProps",{tabPosition:"top"});const er=Jt;function tr(){return tr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tr.apply(this,arguments)}function rr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class nr extends e.Component{constructor(){super(...arguments),rr(this,"titleRef",t().createRef()),rr(this,"$drawer",null),rr(this,"opened",!1),rr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1}),rr(this,"afterVisibleChange",(e=>{const{loading:t}=this.props;e?(this.opened=!0,(0,J.isUndefined)(t)&&setTimeout((()=>this.setState({spinning:!1})),100)):(this.props.onClosed?.(),this.setState({fullscreen:!1}))})),rr(this,"toggleHandle",(()=>{this.$drawer=Xe(this.titleRef.current,"ant-drawer-content-wrapper"),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),rr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),rr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}componentWillUnmount(){this.$drawer=null}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,destroyOnClose:i}=this.props,l=n??r,o=e.open??e.visible,{fullscreen:s}=this.state;l&&l!==o&&(!i&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0})),this.$drawer&&s!==t.fullscreen&&Be(this.$drawer,s?{width:"100%"}:{width:ue(this.props.width||"72%")})}renderTitle(){const{fullscreen:e}=this.state,{title:r,showHeader:n,showFullScreen:a}=this.props;return t().createElement(t().Fragment,null,t().createElement("span",{ref:this.titleRef,className:Se()("text")},n&&r),a&&t().createElement("button",{type:"button",className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r}=this.state,{visible:n,open:a,size:i,className:l,loading:o,showHeader:s,maskClosable:c,onClose:u}=this.props,d=this.context.global,p=i||this.context.size||"",m=Ce("drawer"),h={[m]:!0,"no-header":!s,[`${m}--lg`]:"large"===p,[`${m}--sm`]:"small"===p};return t().createElement(P.Drawer,tr({},Z()(this.props,["visible","size","showFullScreen","loading","maskClosable","onClosed"]),{open:a??n,maskClosable:c??d?.maskClosable??!1,className:Se()(h,l),title:this.renderTitle(),footer:null,onClose:u,afterOpenChange:this.afterVisibleChange}),this.props.children,(o||r||e)&&t().createElement(gt,{spinning:!0,className:Se()("spinning")}))}}rr(nr,"contextType",l),rr(nr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Drawer","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),rr(nr,"defaultProps",{width:"72%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,footer:null});const ar=nr;function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ir.apply(this,arguments)}function lr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const or="10vh";var sr=function(e){return e[e.large=48]="large",e[e.middle=44]="middle",e[e.small=40]="small",e[e.none=0]="none",e}(sr||{});class cr extends e.Component{constructor(){super(...arguments),lr(this,"$event",null),lr(this,"draggleRef",t().createRef()),lr(this,"opened",!1),lr(this,"state",{fullscreen:!1,spinning:!1,sloading:!1,disabled:!0,bounds:{left:0,top:0,bottom:0,right:0},position:void 0}),lr(this,"addMouseDownEvent",(()=>{this.$event||(this.$event=qt()(document.body,"mousedown",ze))})),lr(this,"removeMouseDownEvent",(()=>{this.$event&&(this.$event?.remove(),this.$event=null)})),lr(this,"onStart",((e,t)=>{const{clientWidth:r,clientHeight:n}=window.document.documentElement,a=this.draggleRef.current.getBoundingClientRect();a&&this.setState({bounds:{left:-a.left+t.x,right:r-(a.right-t.x)-1,top:-a.top+t.y,bottom:n-(a.bottom-t.y)-1}})})),lr(this,"toggleHandle",(e=>{const t=Xe(e.target,"ant-modal");if(!t)return;const r=t.querySelector(".ant-modal-body"),{width:n,height:a,showHeader:i}=this.props,{fullscreen:l}=this.state;l?(Be(t,{width:ue(n||"60%"),height:"auto",top:or}),Be(r,{height:a?ue(a):this.defaultHeight,maxHeight:"auto"===a?this.defaultHeight:""})):(Be(t,{width:"100%",height:"100%",top:0,maxWidth:"100%"}),Be(r,{height:`calc(100vh - ${sr[i?this.$size:"none"]}px)`,maxHeight:""})),this.setState((e=>({fullscreen:!e.fullscreen})),(()=>{this.props.onFullChange?.(this.state.fullscreen)}))})),lr(this,"afterVisibleChange",(()=>{const{onClosed:e}=this.props;e?.(),this.setState({fullscreen:!1})})),lr(this,"START_LOADING",(()=>{this.setState({sloading:!0})})),lr(this,"STOP_LOADING",(()=>{this.setState({sloading:!1})}))}get $size(){const{size:e}=this.props;return e||this.context.size||""}get defaultHeight(){return`calc(100vh - ${or} - ${or} - ${sr[this.props.showHeader?this.$size:"none"]}px)`}componentDidUpdate(e,t){const{visible:r,open:n,loading:a,stopMouseDownEvent:i,destroyOnClose:l}=this.props,o=n??r,s=e.open??e.visible,{fullscreen:c}=this.state;if(o&&o!==s){if(!l&&this.opened||(0,J.isUndefined)(a)&&this.setState({spinning:!0}),i&&this.addMouseDownEvent(),!l&&this.opened)return;setTimeout((()=>{this.opened=!0,(0,J.isUndefined)(a)&&this.setState({spinning:!1})}),400)}o||this.removeMouseDownEvent(),c!==t.fullscreen&&(c?this.setState({position:{x:0,y:0}}):this.setState({position:void 0}))}renderTitle(){const{fullscreen:e,disabled:r}=this.state,{title:n,showHeader:a,showFullScreen:i}=this.props;return t().createElement("div",{onMouseOver:()=>{r&&this.setState({disabled:!1})},onMouseOut:()=>{this.setState({disabled:!0})}},t().createElement("span",{className:Se()("text")},a&&n),i&&t().createElement("button",{type:"button",className:Se()("full-screen"),onClick:this.toggleHandle},t().createElement(e?we.FullscreenExitOutlined:we.FullscreenOutlined)))}render(){const{spinning:e,sloading:r,fullscreen:n,disabled:a,bounds:i,position:l}=this.state,{visible:o,open:s,height:c,className:u,loading:d,draggable:p,showHeader:m,maskClosable:h,bodyStyle:f,onClose:g}=this.props,b=this.context.global,y=Ce("modal"),v={height:c?ue(c):this.defaultHeight,maxHeight:"auto"===c?this.defaultHeight:"",overflow:"auto"},x={[y]:!0,"no-header":!m,[`${y}--lg`]:"large"===this.$size,[`${y}--sm`]:"small"===this.$size};return t().createElement(P.Modal,ir({},Z()(this.props,["visible","loading","showFullScreen","maskClosable","stopMouseDownEvent","onClose","onClosed"]),{open:s??o,maskClosable:h??b?.maskClosable??!1,className:Se()(x,u),title:this.renderTitle(),footer:null,bodyStyle:Object.assign({},v,f),onCancel:g,afterClose:this.afterVisibleChange,modalRender:e=>t().createElement(Ke(),{disabled:!p||a||n,bounds:i,position:l,onStart:(e,t)=>this.onStart(e,t)},t().createElement("div",{ref:this.draggleRef},e))}),this.props.children,(d||r||e)&&t().createElement(gt,{spinning:!0,className:Se()("spinning")}))}}lr(cr,"contextType",l),lr(cr,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Modal","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},spinning:i().bool}),lr(cr,"defaultProps",{width:"60%",showHeader:!0,showFullScreen:!0,destroyOnClose:!0,draggable:!0,footer:null,style:{top:or}});const ur=cr,dr=require("memoize-one");var pr=n.n(dr);const mr=(0,e.createContext)(void 0),hr=80,fr="1",gr="0",br=400,yr=["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"],vr={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 xr=function(e){return e.date="date",e.datetime="date",e.exactdate="date",e.week="week",e.month="month",e.quarter="quarter",e.year="year",e}({}),Er=function(e){return e.date="YYYY-MM-DD HH:mm:ss",e.datetime="YYYY-MM-DD HH:mm:ss",e.exactdate="YYYY-MM-DD",e.week="YYYY-wo",e.month="YYYY-MM",e.quarter="YYYY-[Q]Q",e.year="YYYY",e}({}),Sr=function(e){return e.hour="HH",e["hour-minute"]="HH:mm",e["hour-minute-second"]="HH:mm:ss",e}({});const Cr={items:i().arrayOf(i().shape({type:i().string.isRequired,fieldName:i().string.isRequired})),initialValues:i().object,initialExtras:i().object,layout:i().oneOf(["horizontal","vertical"]),size:(e,t,r)=>{if(!b(e[t]||""))return f("Form","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},cols:i().number,customClass:i().string,compactMode:i().bool,labelWidth:i().oneOfType([i().number,i().string]),labelAlign:i().oneOf(["left","right"]),labelWrap:i().bool,formType:i().oneOf(["default","search","onlyShow"]),disabled:i().bool,uniqueKey:i().string,defaultRows:i().number,defaultExpand:i().bool,searchButtonCols:i().number,scrollToFirstError:i().bool,authConfig:i().object,isAutoFocus:i().bool,isCollapse:i().bool,isFieldsDefine:i().bool,isSearchBtn:i().bool,isSubmitBtn:i().bool,fieldsChange:i().func,onValuesChange:i().func,onFieldsChange:i().func,onFinish:i().func,onFinishFailed:i().func,onReset:i().func,onCollapse:i().func},wr={layout:"horizontal",labelWidth:hr,labelAlign:"right",formType:"default",initialValues:{},initialExtras:{},defaultRows:1,isAutoFocus:!0,isCollapse:!0,isSearchBtn:!0,onValuesChange:ne,onFieldsChange:ne,onFinish:ne,onFinishFailed:ne,onReset:ne,onCollapse:ne,onFormItemsChange:ne},Nr=(e,t)=>{if(!e)return null;if(t===Er.week){const t=e.match(/^(\d{4})-(\d+)/);return t?s()().year(Number(t[1])).week(Number(t[2])):null}if(t===Er.quarter){const t=e.match(/^(\d{4})-Q(\d)/);return t?s()().year(Number(t[1])).quarter(Number(t[2])):null}return s()(e,t)},Tr=(e,t)=>e?s()(e).format(t):"",Ir=e=>""===e||null==e,Rr=(e,t)=>{if(!e)return"";if(!t.includes("|"))return e[t];const r=t.split("|");let n="";for(let t=0,a=r.length;t<a;t++)n+=(e[r[t].trim()]??"")+(t===a-1?"":" | ");return n},Or=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Pr=(e,t,r)=>{for(const n in r)if(Object.keys(t).includes(n)&&t[n]!==r[n])if(t[n].includes("|")){const a=t[n].split("|"),i=r[n].split("|");a.forEach(((t,r)=>e[t]=e[i[r]]))}else e[t[n]]=e[r[n]]},Ar=(e,t,r)=>e.map((e=>{const n={value:e[t],text:e[r]};return e.disabled&&(n.disabled=!0),e.isLeaf&&(n.isLeaf=!0),!(0,J.isUndefined)(e.selectable)&&(n.selectable=e.selectable),Array.isArray(e.children)&&(n.children=Ar(e.children,t,r)),n})),kr=(e,t)=>{for(const r of e){if(r.value===t)return r;if(Array.isArray(r.children)){const e=kr(r.children,t);if(e)return e}}return null},Fr=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[];return e.forEach((e=>{e.value==t.split(",")[r]&&n.push(e),Array.isArray(e.children)&&n.push(...Fr(e.children,t,r+1))})),n},Hr=(e,t,r,n)=>{const a={};return a.filters=e.filters?.filter((e=>"1"===e.isQuery)).map((e=>{const t={type:e.type,label:e.label,fieldName:e.fieldName,options:{}};return Array.isArray(e.dicData)&&(t.options.itemList=e.dicData),t}))||[],a.table={columns:e.columns||[],rowKey:e.valueName},a.fieldsDefine={valueKey:e.valueKey||e.valueName},a.fieldAliasMap={[n?"textKey":t]:e.displayName[0],[n?"valueKey":e.valueKey||e.valueName]:e.valueName},e.tableSetting&&(a.table.fetch={api:r(e.tableSetting.api),dataKey:e.tableSetting.dataKey}),e.echoSetting&&(a.echoRequest={fetchApi:r(e.echoSetting.api),formatter:t=>Object.assign({},t,{[e.echoSetting.paramKey]:t.key??t.keys}),dataKey:e.echoSetting.dataKey},e.echoSetting.displayKey&&(a.echoRequest.fieldAliasMap={[n?"textKey":t]:e.echoSetting.displayKey[0]})),e.treeSetting&&(a.tree={fetch:{api:r(e.treeSetting.api),dataKey:e.treeSetting.dataKey,valueKey:e.treeSetting.valueKey,textKey:e.treeSetting.textKey},tableParamsMap:()=>{const t={};return e.treeSetting.relativeTable?.forEach((e=>t[e.tableField]=e.treeField)),t}}),e.emmediateSetting&&(a.columns=e.emmediateSetting.columns,a.request={fetchApi:r(e.emmediateSetting.api),dataKey:e.emmediateSetting.dataKey}),a},Lr={PINYINS:["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],UNIHANS:["阿","哎","安","肮","凹","八","挀","扳","邦","勹","陂","奔","伻","屄","边","灬","憋","汃","冫","癶","峬","嚓","偲","参","仓","撡","冊","嵾","曽","叉","芆","辿","伥","抄","车","抻","阷","吃","充","抽","出","欻","揣","巛","刅","吹","旾","逴","呲","匆","凑","粗","汆","崔","邨","搓","咑","呆","丹","当","刀","嘚","扥","灯","氐","甸","刁","爹","丁","丟","东","吺","厾","耑","垖","吨","多","妸","诶","奀","鞥","儿","发","帆","匚","飞","分","丰","覅","仏","紑","夫","旮","侅","甘","冈","皋","戈","给","根","刯","工","勾","估","瓜","乖","关","光","归","丨","呙","哈","咍","佄","夯","茠","诃","黒","拫","亨","噷","叿","齁","乎","花","怀","欢","巟","灰","昏","吙","丌","加","戋","江","艽","阶","巾","坕","冂","丩","凥","姢","噘","军","咔","开","刊","忼","尻","匼","肎","劥","空","抠","扝","夸","蒯","宽","匡","亏","坤","扩","垃","来","兰","啷","捞","肋","勒","崚","哩","俩","奁","良","撩","毟","拎","伶","溜","囖","龙","瞜","噜","驴","娈","掠","抡","罗","呣","妈","埋","嫚","牤","猫","么","呅","门","甿","咪","宀","喵","乜","民","名","谬","摸","哞","毪","嗯","拏","腉","囡","囔","孬","疒","娞","恁","能","妮","拈","娘","鸟","捏","囜","宁","妞","农","羺","奴","女","奻","疟","黁","挪","喔","讴","妑","拍","眅","乓","抛","呸","喷","匉","丕","囨","剽","氕","姘","乒","钋","剖","仆","七","掐","千","呛","悄","癿","亲","靑","卭","丘","区","峑","缺","夋","呥","穣","娆","惹","人","扔","日","茸","厹","邚","挼","堧","婑","瞤","捼","仨","毢","三","桒","掻","閪","森","僧","杀","筛","山","伤","弰","奢","申","升","尸","収","书","刷","衰","闩","双","脽","吮","说","厶","忪","捜","苏","狻","夊","孙","唆","他","囼","坍","汤","夲","忑","熥","剔","天","旫","帖","厅","囲","偷","凸","湍","推","吞","乇","穵","歪","弯","尣","危","昷","翁","挝","乌","夕","虲","仙","乡","灱","些","心","星","凶","休","吁","吅","削","坃","丫","恹","央","幺","倻","一","囙","应","哟","佣","优","扜","囦","曰","晕","帀","災","兂","匨","傮","则","贼","怎","増","扎","捚","沾","张","佋","蜇","贞","争","之","中","州","朱","抓","拽","专","妆","隹","宒","卓","乲","宗","邹","租","钻","厜","尊","昨","兙"],EXCEPTIONS:{曾:"ZENG",沈:"SHEN",嗲:"DIA",碡:"ZHOU",聒:"GUO",炔:"QUE",蚵:"KE",砉:"HUA",嬤:"MO",嬷:"MO",蹒:"PAN",蹊:"XI",丬:"PAN",霰:"XIAN",莘:"XIN",豉:"CHI",饧:"XING",筠:"JUN",长:"CHANG",帧:"ZHEN",峙:"SHI",郍:"NA",芎:"XIONG",谁:"SHUI"}},$r="阿",_r="鿿",Dr=1,qr=2,jr=3;let Kr,Mr=null;function Vr(e){return e||null===Mr?("object"==typeof Intl&&Intl.Collator?(Kr=new Intl.Collator(["zh-Hans-CN","zh-CN"]),Mr=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):Mr=!1,Mr):Mr}function zr(e){const t=Lr.UNIHANS,r=Lr.PINYINS,n=Lr.EXCEPTIONS,a={source:e};if(e in n)return a.type=qr,a.target=n[e],a;let i,l=-1;if(e.charCodeAt(0)<256)return a.type=Dr,a.target=e,a;if(i=Kr.compare(e,$r),i<0)return a.type=jr,a.target=e,a;if(0===i)a.type=qr,l=0;else{if(i=Kr.compare(e,_r),i>0)return a.type=jr,a.target=e,a;0===i&&(a.type=qr,l=t.length-1)}if(a.type=qr,l<0){let r=0,n=t.length-1;for(;r<=n;){l=~~((r+n)/2);const a=t[l];if(i=Kr.compare(e,a),0===i)break;i>0?r=l+1:n=l-1}}return i<0&&l--,a.target=r[l],a.target||(a.type=jr,a.target=a.source),a}function Ur(e){return"string"==typeof e&&Vr()?e.split("").map((e=>zr(e))):e}const Br={isSupported:Vr,parse:Ur,patchDict:function(e){e&&("function"==typeof e&&(e=[e]),e.forEach&&e.forEach((e=>{"function"==typeof e&&e(Lr)})))},genToken:zr,convertToPinyin:(e,t,r)=>Ur(e).map((e=>t&&e.type===qr?e.target.toLowerCase():e.target)).join(r||"")},Wr={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}};Br.isSupported()&&Wr.shouldPatch(Br.genToken)&&Br.patchDict(Wr);const Gr=Br,Yr=e=>{const{value:r,bordered:n}=e;return t().createElement(P.Input,{value:r,title:r,bordered:n,readOnly:!0})};Yr.displayName="FormItemView";const Xr=Yr;function Qr(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zr(){return Zr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zr.apply(this,arguments)}const{Option:Jr}=P.Select,en=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{fieldName:c,options:u={},style:d={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,readOnly:g,disabled:b}=e.option,{itemList:y=[],filterable:v=!0,listHeight:x=br,collapseTags:E,maxTagTextLength:S,openPyt:C=!0}=u,w=se(y)?a:y,N=e=>i?w.filter((t=>e?.includes(t.value))).map((e=>e.text)).join(","):w.find((t=>t.value===e))?.text||"";return r.isOnlyShow?t().createElement(Xr,{value:N(n),bordered:h}):t().createElement(P.Select,Zr({value:n,mode:i?"multiple":void 0,popupClassName:`form-popper__${c}`,placeholder:m,style:d,loading:l,bordered:h,allowClear:f,disabled:b,showSearch:v,listHeight:x,maxTagCount:E?"responsive":void 0,maxTagTextLength:S},i?{title:N(n)}:null,{filterOption:(e,t)=>{const r=t?.children?.toString()||"",n=Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(C?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,N(e),w)})(e)}}),w.map((e=>t().createElement(Jr,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class tn extends e.Component{constructor(){super(...arguments),Qr(this,"state",{itemList:[],loading:!1}),Qr(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:u=e.props.labelWidth,className:d,extra:p,buttonAfter:m,validateTrigger:h,rules:f=[],onChange:g=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(i),className:Se()(d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},required:e.getFormItemRequired(f)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:o,noStyle:!0,rules:f,validateTrigger:h,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(en,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{g(t,r,n),e.setViewValue(o,r)}}))),m&&t().createElement(P.Col,null,e.renderFormItemButton(o,m)),p&&t().createElement(P.Col,{flex:ue(p.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Qr(tn,"contextType",mr);const rn=tn,nn=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:u=r.isFormDisabled}=e.option,{labelToCheckbox:d,falseValue:m=gr,trueValue:h=fr}=o;return t().createElement(P.Checkbox,{checked:n===h,style:s,disabled:u||r.isOnlyShow,onChange:e=>{const{checked:t}=e.target;(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(t?h:m)}},d?l:null)};class an extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option,{labelToCheckbox:h}=o;return t().createElement(P.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(nn,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(an,"contextType",mr);const ln=an,on=["&&","||","AND","OR","and","or","like","likes","in","nin","LIKE","LIKES","IN","NIN"],sn={operations:function(e){const t=e.split(" "),r=[];let n=0;r[n]=[];for(let e=0;e<t.length;e++)on.includes(t[e])?(r[n]=r[n].join(" "),n++,r[n]=[]):r[n].push(t[e]);return r[n]=r[n].join(" "),r},number_operations:function(e){return this.operations(e).length},string_format:function(e){return"string"!=typeof e?e:e.split(/[\s'\s"]/).join("")},stringify:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return"string"==typeof e?"'"+e.trim().replace(/(')/g,"\\$1").replace(/\(/g,"├").replace(/\)/g,"┤").replace(/\s/g,t)+"'":e},array_format:function(e){let t="[";for(let r=0,n=(e=Array.isArray(e)?e:[e]).length;r<n;r++)t+="number"==typeof e[r]?e[r]:"'"+e[r]+"'",r<n-1&&(t+=",");return t+="]",t},operation_format:function(e){const t=e.split(" ");for(let e=0;e<t.length;e++)""==t[e]&&(t.splice(e,1),e--);if("("==t[0]?t.splice(0,1):"("==t[0][0]&&(t[0]=t[0].split(""),t[0].splice(0,1),t[0]=t[0].join("")),")"==t[t.length-1])t.splice(t.length-1,1);else if(")"==t[t.length-1][t[t.length-1].length-1]){const e=t.length-1;t[e]=t[e].split(""),t[e].splice(t[e].length-1,1).join(""),t[e]=t[e].join("")}return t},find_replace:function(e,t,r){return e.split(t).join(r)},replace_symbols:function(e){return e=this.find_replace(e," AND "," && "),e=this.find_replace(e," and "," && "),e=this.find_replace(e," OR "," || "),e=this.find_replace(e," or "," || "),e=this.find_replace(e," <> "," != "),e=this.find_replace(e," LIKE "," like "),e=this.find_replace(e," LIKES "," likes "),e=this.find_replace(e," IN "," in "),this.find_replace(e," NIN "," nin ")}},cn=["==","<",">","<=",">=","!=","like","likes","in","nin"],un=function(e,t){let r="";for(let t=0;t<e.length;t++)"("==e[t]||")"==e[t]?r+=" "+e[t]+" ":r+=e[t];const n=r.split(" ").filter((e=>""!==e));for(let e=0;e<n.length;e++)cn.includes(n[e])&&("this"!=n[e-1]?n[e-1]=t+"."+n[e-1]:n[e-1]=t),cn.includes(n[e])&&(n.splice(e-1,3,`__query__(${n[e-1]}, '${n[e]}', ${n[e+1]})`),e-=2);return n.join(" ")},dn=/(\^|\.|\[|\]|\$|\(|\)|\||\*|\+|\?|\{|\}|\\)/g,pn=["string","number","boolean","symbol"],mn=e=>pn.includes(typeof e),hn=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s+\d{2}:\d{2}:\d{2})?$/.test(e),fn=e=>new RegExp(e.replace(/├/g,"(").replace(/┤/g,")").replace(/\^/g," ").toString().replace(dn,"\\$1"),"i");window.__query__=function(){return((e,t,r)=>{e=e??"";let n=!0;switch(t){case"like":n=null!==e.toString().match(fn(r));break;case"likes":n=r.split(/,|,/).some((t=>null!==e.toString().match(fn(t))));break;case"in":mn(r)&&(r=[r]),Array.isArray(r)&&(n=Array.isArray(e)?r.every((t=>e.includes(t))):r.includes(e));break;case"nin":mn(r)&&(r=[r]),Array.isArray(r)&&(n=!(Array.isArray(e)?r.some((t=>e.includes(t))):r.includes(e)));break;case"!=":case"<>":n=(hn(e)?e.slice(0,10):e)!=r;break;case"<":n=(hn(e)?e.slice(0,10):e)<r;break;case"<=":n=(hn(e)?e.slice(0,10):e)<=r;break;case">":n=(hn(e)?e.slice(0,10):e)>r;break;case">=":n=(hn(e)?e.slice(0,10):e)>=r;break;default:n=(hn(e)?e.slice(0,10):e)==r}return n})(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])};const gn=sn.stringify,bn=sn.array_format,yn=function(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const r=e.charAt(n);"("===r&&t++,")"===r&&t--}return 0===t},vn=(e,t,r)=>{let n=[];t=sn.replace_symbols(t);try{if(r){const r=new Function("record",`return ${un(t,"record")};`);n=Xn(e,(e=>r(e)))}else{const r=new Function("array","i",`return ${un(t,"array[i]")};`);for(let t=0,a=e.length;t<a;t++)r(e,t)&&n.push(e[t])}}catch(t){g("Table","组件 `initialFilter` 参数有误!"),n=e}return n},xn=e=>{const t=[];return e.forEach((e=>{e.children?t.push(...xn(e.children)):t.push(e)})),t},En=e=>e.filter((e=>(e.children&&(e.children=En(e.children)),!e.hidden&&!e.noAuth))),Sn=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...Sn(e.children))})),t},Cn=(e,t)=>e.map((e=>(e.children&&(e.children=Cn(e.children,t)),t?.(e),e))),wn=(e,t)=>{for(const r of e){if(r.dataIndex===t)return r;if(r.children){const e=wn(r.children,t);if(e)return e}}return null},Nn=e=>{const t=e.children;return t?t[0].children?Nn(t[0]):t[0]:e},Tn=e=>{const t=e.children;return t?t[t.length-1].children?Tn(t[t.length-1]):t[t.length-1]:e},In=(e,t)=>e.filter((e=>!t.includes(e.dataIndex))),Rn=(e,t)=>{for(const r of e){if(r.rowKey===t)return r;if(r.children){const e=Rn(r.children,t);if(e)return e}}return null},On=e=>{const t=[];return e.forEach((e=>{t.push(e),e.children&&t.push(...On(e.children))})),t},Pn=e=>{let t=1;const r=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{e.fixed?n.fixed=e.fixed:delete n.fixed,r(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=e.colSpan??1};e.forEach((e=>{e.level=1,r(e,null)}));const n=[];for(let e=0;e<t;e++)n.push([]);return Sn(e).forEach((e=>{e.children?e.rowSpan=1:e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n},An=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){const n=e.parentNode;if(r.top+=e.offsetTop,r.left+=e.offsetLeft,n&&n!==document.documentElement&&n!==document.body&&(r.top-=n.scrollTop,r.left-=n.scrollLeft),(!t||e!==t&&e.offsetParent!==t)&&e.offsetParent)return An(e.offsetParent,t,r)}return r},kn=e=>"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null,Fn=(e,t)=>(0,J.transform)(e,((e,r,n)=>{(0,J.isEqual)(r,t[n])||(e[n]=(0,J.isPlainObject)(r)&&(0,J.isPlainObject)(t[n])?Fn(r,t[n]):r)})),Hn=(e,t)=>(0,J.intersection)(e,t).length===t.length,Ln=(e,t)=>(0,J.get)(e,t)??"",$n=(e,t,r,n)=>{n>=0&&null!=r&&(r=Number(r).toFixed(n)),(0,J.set)(e,t,r??"")},_n=(e,t)=>{if(!t.includes("|"))return Ln(e,t);const r=[];return t.split("|").forEach((t=>{t&&r.push(Ln(e,t))})),r.every((e=>!e))?"":r.join(" | ")},Dn=e=>{const t=(e=e.toString()).split("."),r="-"===t[0].charAt(0)?"-":"";let n=r?t[0].slice(1):t[0],a="";for(;n.length>3;)a=`,${n.slice(-3)}${a}`,n=n.slice(0,n.length-3);return n&&(a=n+a),`${r}${a}${t[1]?`.${t[1]}`:""}`},qn=(e,t)=>{const r=e.toString();if(Number.isNaN(Number.parseFloat(r))||0===t)return e;const n=Number.parseFloat(r).toString(),a=n.indexOf(".");if(-1===a)return n+"."+"0".repeat(t);const i=Math.max(0,t-(n.length-a-1));return n+"0".repeat(i)},jn=(e,t)=>e?s()(e,t):null,Kn=(e,t)=>e?s()(e).format(t):"",Mn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=(new Date).getTime();return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},Vn=e=>{const t=[];if(te(e)){const{children:r}=e.props;Array.isArray(r)?r.forEach((e=>t.push(...Vn(e)))):r&&t.push(...Vn(r))}else t.push(e);return t},zn=e=>e.filter((e=>!e._group)),Un=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="";if(Array.isArray(e)){let n=0;for(let a=0,i=e.length;a<i;a++){const i=e[a];if(!i.fieldName)continue;const l=Array.isArray(i.condition)?bn(i.condition):gn(i.condition,"^");r+=`${i.bracketLeft} ${t?`${i.fieldName}|${i.fieldType}`:i.fieldName} ${i.expression} ${l} ${i.bracketRight} ${i.logic} `,n=i.logic.length}r=r.slice(0,-1*n-2)}else{const n=5;for(const n in e){const[a,i]=n.includes("|")?n.split("|"):[n,""],l=e[n];for(const e in l)r+=`${t?`${a}|${i}`:a} ${e} ${Array.isArray(l[e])?bn(l[e]):gn(l[e],"^")} and `}r=r.slice(0,-1*n)}return r.replace(/\s+/g," ").trim()},Bn=function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((r=>{const n=JSON.stringify((t=>{const r=[];return e.forEach((e=>r.push(Ln(t,e)))),r})(r));t[n]=t[n]||[],t[n].push(r)})),Object.keys(t).map((e=>t[e]))},Wn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].dataIndex===t)return[e[r]];if(Array.isArray(e[r].children)){const n=Wn(e[r].children,t);if(n)return[e[r],n].flat()}}},Gn=(e,t)=>{for(let r=0;r<e.length;r++){if(e[r].rowKey===t)return[t];if(Array.isArray(e[r].children)){const n=Gn(e[r].children,t);if(n)return[e[r].rowKey,n].flat()}}},Yn=(e,t)=>{for(const r of e){if(Array.isArray(r.children)){const e=Yn(r.children,t);if(e)return e}if(t(r))return r}return null},Xn=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Xn(e.children,t),t(e)||e.children&&e.children.length))),Qn=e=>e.map((e=>(delete e.chosen,delete e.selected,e))),Zn=require("react-sortablejs");function Jn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ea extends e.Component{constructor(){super(...arguments),Jn(this,"linkRef",t().createRef()),Jn(this,"state",{visible:!1}),Jn(this,"getFormFieldsConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Jn(this,"saveFormFieldsConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Jn(this,"resetFieldsHandle",(e=>{const t=e.map((e=>{const t=this.props.items.find((t=>t.fieldName===e.fieldName))||ce(e);return Object.assign(t,{hidden:e.hidden})}));this.changeHandle(t),this.setLocalFields(t)}))}get formUniqueKey(){return this.props.uniqueKey?`form_${this.props.uniqueKey}`:""}componentDidMount(){this.initLocalfields()}getLocalFields(){if(!this.formUniqueKey)return;const e=JSON.parse(localStorage.getItem(this.formUniqueKey));return e||this.getFormFieldsConfig(this.formUniqueKey).then((e=>{e?(localStorage.setItem(this.formUniqueKey,JSON.stringify(e)),this.initLocalfields()):this.context.global?.getComponentConfigApi&&this.setLocalFields(this.props.items)})).catch((()=>{})),e?(0,J.xor)(e.map((e=>e.fieldName)),this.props.items.map((e=>e.fieldName))).length>0?this.props.items.map((t=>{const{fieldName:r}=t,n=e.find((e=>e.fieldName===r));return n?((0,J.isUndefined)(n.hidden)||(t.hidden=n.hidden),t):t})):e.map((e=>({...this.props.items.find((t=>t.fieldName===e.fieldName)),...e}))):void 0}setLocalFields(e){if(!this.formUniqueKey)return;const t=e.map((e=>{const t={};return(0,J.isUndefined)(e.hidden)||(t.hidden=e.hidden),{fieldName:e.fieldName,...t}})),r=JSON.parse(localStorage.getItem(this.formUniqueKey));(0,J.isEqual)(t,r)||(localStorage.setItem(this.formUniqueKey,JSON.stringify(t)),this.saveFormFieldsConfig(this.formUniqueKey,t))}initLocalfields(){const e=this.getLocalFields();e&&this.changeHandle(e)}changeHandle(e){const{fieldsChange:t}=this.props;t?.([...e])}popupRender(){const{items:e}=this.props;return t().createElement(mr.Consumer,null,(r=>{const n=r.$$form;return t().createElement("div",{className:Se()("ant-dropdown-menu","fields-list")},t().createElement("div",{className:"reset"},t().createElement(he,{type:"text",size:"small",onClick:()=>this.resetFieldsHandle(n.originItems)},p("qm.table.columnFilter.reset"))),t().createElement(Zn.ReactSortable,{itemKey:"fieldName",handle:".handle",tag:"ul",animation:200,list:e,setList:t=>{const r=t.map((e=>e.fieldName)),a=e.map((e=>e.fieldName));if((0,J.isEqual)(r,a))return;n.setExpandHandle(!0);const i=Qn(t);this.changeHandle(i),this.setLocalFields(i)}},e.map((r=>t().createElement("li",{key:r.fieldName,className:"item",style:r.noAuth?{display:"none"}:void 0},t().createElement(P.Checkbox,{disabled:r.rules?.findIndex((e=>e.required))>-1,checked:!r.hidden,onChange:t=>{const{checked:n}=t.target;r.hidden=!n,this.changeHandle(e),this.setLocalFields(e)}}),t().createElement(we.HolderOutlined,{className:"handle",title:p("qm.form.draggable")}),t().createElement("span",{className:"title"},n.getFormItemLabel(r.label||"")))))))}))}render(){const{visible:e}=this.state,r=Ce("form-fields-filter");return t().createElement(mr.Consumer,null,(n=>{const{$size:a}=n.$$form,i={[r]:!0,[`${r}--lg`]:"large"===a,[`${r}--sm`]:"small"===a};return t().createElement(P.Dropdown,{open:e,trigger:["click"],dropdownRender:()=>this.popupRender(),overlayClassName:Se()(i),placement:"bottomRight",overlayStyle:{minWidth:150},getPopupContainer:()=>this.linkRef.current,onOpenChange:e=>{this.setState({visible:e})}},t().createElement("a",{ref:this.linkRef,style:{padding:"5px 0"}},t().createElement(we.UnorderedListOutlined,null)))}))}}Jn(ea,"contextType",l);const ta=ea;function ra(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const na=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(mr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h,onBlur:f=ne,onEnter:g=ne}=e.option,{prefix:b,suffix:y,password:v,maxLength:x,pattern:E,toUpper:S,toTrim:C,autoFocus:w,autoComplete:N,secretType:T}=o,I=T&&(m||h),R=t().useRef(),O=e=>{i?.(e),l(e)},A=v?P.Input.Password:P.Input,k=I?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e=e.toString(),"finance"===t&&(e=(e=>e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","))(e)),"name"===t&&(e=e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**")),"phone"===t&&(e=e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2")),"IDnumber"===t&&(e=e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2")),"bankNumber"===t&&(e=e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")),e}(a,T):a;return n.isOnlyShow?t().createElement(Xr,{value:(e=>e&&v?new Array(e.length).fill("*").join(""):e)(k),bordered:u}):t().createElement(A,{ref:e=>{R.current=e,"function"==typeof r&&r(e)},value:k,autoComplete:v?"new-password":N,autoFocus:w,placeholder:c,style:s,title:v?"":k,prefix:b,suffix:y,maxLength:x,bordered:u,allowClear:d,readOnly:m,disabled:h,onBlur:t=>{let r=t.target.value??"";if(C){const e=r.trim();r!==e&&(r=e,O(r))}(t=>{const{onBlur:r}=e;r?.(t)})(r),f(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;g(t),n.isFilterType&&(n.SUBMIT_FORM(),R.current?.blur())}},onChange:e=>{let t=e.target.value;(0,J.isRegExp)(E)&&(t=E.test(t)?t:a??""),S&&(t=t.toUpperCase()),O(t)}})}));na.displayName="VInput";class aa extends e.Component{constructor(){super(...arguments),ra(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,buttonAfter:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(na,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:t=>{h(t),e.setViewValue(i,t)}}))),d&&t().createElement(P.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}ra(aa,"contextType",mr);const ia=aa,la=e=>{const{$$form:r}=t().useContext(mr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=e.option,{prefix:m,suffix:h,maxLength:f}=l,g=e=>{const t=e.every((e=>!e))?[]:e;a?.(t),i(t,b(t))},b=e=>e.join(" - ");return r.isOnlyShow?t().createElement(Xr,{value:b(n),bordered:s}):t().createElement(P.Input.Group,null,t().createElement(P.Input,{value:n[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:o[0],prefix:m,suffix:h,maxLength:f,allowClear:c,bordered:s,readOnly:u,disabled:d,onChange:e=>{const{value:t}=e.target;g([t,n[1]])}}),t().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:d,readOnly:!0}),t().createElement(P.Input,{value:n[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:o[1],prefix:m,suffix:h,maxLength:f,bordered:s,allowClear:c,readOnly:u,disabled:d,onChange:e=>{const{value:t}=e.target;g([n[0],t])}}))};class oa extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:u,rules:d=[],onChange:p=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(o)},required:e.getFormItemRequired(d)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(la,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(P.Col,{flex:ue(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(oa,"contextType",mr);const sa=oa,ca=require("big.js");var ua=n.n(ca);function da(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const pa=t().forwardRef(((e,r)=>{const{$$form:n}=t().useContext(mr),{value:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},placeholder:c=p("qm.form.inputPlaceholder"),bordered:u=!0,readOnly:d,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{step:g=1,min:b,max:y,precision:v,autoFocus:x,stringMode:E,textAlign:S="left",controls:C=!0,formatter:w,parser:N}=o,T=t().useRef(),I=t().useRef(a),R=e=>{const t=Ir(e)?"":(0,J.isNumber)(e)?e.toFixed(v):new(ua())(e).toFixed(v);return"function"==typeof w?w(t):t},O={[S]:!0,controls:C};return n.isOnlyShow?t().createElement(Xr,{value:R(a),bordered:u}):t().createElement(P.InputNumber,{ref:e=>{T.current=e,"function"==typeof r&&r(e)},value:a,className:Se()(O),placeholder:c,style:{width:"100%",...s},step:g,min:b,max:y,controls:C,precision:v,autoFocus:x,stringMode:E,formatter:w,parser:N,bordered:u,readOnly:d,disabled:m,onBlur:()=>{le((()=>{(t=>{const{onBlur:r}=e;r?.(t)})(I.current),h(I.current)}))},onKeyUp:e=>{13===e.keyCode&&(f(a),n.isFilterType&&(n.SUBMIT_FORM(),T.current?.blur()))},onChange:e=>{const t=e??"";!E&&(Number(t)>Number.MAX_SAFE_INTEGER||Number(t)<Number.MIN_SAFE_INTEGER)||(e=>{I.current=e,i?.(e),l(e,R(e))})(t)}})}));pa.displayName="VInputNumber";class ma extends e.Component{constructor(){super(...arguments),da(this,"focus",(()=>{const{type:e}=this.props.option;this[e].focus()}))}render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,buttonAfter:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(pa,{ref:e=>this[r]=e,option:this.props.option,onValuesChange:(t,r)=>{h(t),e.setViewValue(i,r)}}))),d&&t().createElement(P.Col,null,e.renderFormItemButton(i,d)),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}da(ma,"contextType",mr);const ha=ma,fa=e=>{const{$$form:r}=t().useContext(mr),{value:n=[],onChange:a,onValuesChange:i}=e,{options:l={},placeholder:o=p("qm.form.rangeInputNumberPlaceholder"),bordered:s=!0,allowClear:c,readOnly:u,disabled:d}=e.option,{step:m=1,min:h=0,max:f,textAlign:g="left",controls:b=!0,precision:y,formatter:v,parser:x}=l,E=e=>{e.every((e=>null!==e))&&e[0]>e[1]&&(e[1]=e[0]),S(e)},S=e=>{const t=e.every((e=>null===e))?[]:[...e];a?.(t),i(t,C(t))},C=e=>Ir(e)?"":e.map((e=>Ir(e)?"":Number(e).toFixed(y))),w={[g]:!0,controls:b};return r.isOnlyShow?t().createElement(Xr,{value:C(n),bordered:s}):t().createElement(P.Input.Group,null,t().createElement(P.InputNumber,{value:n[0],className:Se()("site-input-left",w),style:{width:"calc(50% - 5px)",display:"table-cell",float:"left"},placeholder:o[0],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:u,disabled:d,onChange:e=>{S([e,n[1]])},onBlur:()=>{E(n)}}),t().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:s,disabled:d,readOnly:!0}),t().createElement(P.InputNumber,{value:n[1],className:Se()("site-input-right",w),style:{width:"calc(50% - 5px)"},placeholder:o[1],step:m,min:h,max:f,controls:b,precision:y,formatter:v,parser:x,bordered:s,readOnly:u,disabled:d,onChange:e=>{S([n[0],e])},onBlur:()=>{E(n)}}))};class ga extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,labelWidth:o=e.props.labelWidth,className:s,extra:c,validateTrigger:u,rules:d=[],onChange:p=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(s),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(o)},required:e.getFormItemRequired(d)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:d,validateTrigger:u,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(fa,{option:this.props.option,onValuesChange:function(){let t=arguments.length>1?arguments[1]:void 0;p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),e.setViewValue(i,t)}}))),c&&t().createElement(P.Col,{flex:ue(c.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...c}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ga,"contextType",mr);const ba=ga;let ya=function(e){return e[e.large=40]="large",e[e.middle=32]="middle",e[e.small=24]="small",e}({});function va(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:xa}=P.Input;class Ea extends e.Component{constructor(e){var t;super(e),t=this,va(this,"deriveParams",void 0),va(this,"valueKey",void 0),va(this,"_is_change",!1),va(this,"_record",void 0),va(this,"_prevValue",null),va(this,"state",{visible:!1,loading:!1}),va(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),va(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),va(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||g("Form","SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||g("Form","SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&g("Form","SEARCH_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),va(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),va(this,"getDerivedSearchHelper",(()=>this.searchHelper)),va(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,callback:a,triggeredChange:i,fieldAliasMap:l,extraAliasMap:o}=this.searchHelper.echoRequest||{},s="function"==typeof l?l():l||{},c="function"==typeof o?o():o||{},u=this.getItemValue();if(!e||se(u))return this._prevValue=void 0;this.setState({loading:!0});try{const l=await e(r({...t,key:u}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,n)??[];if(e[0]){const t=e[0];if(s&&Or(t,this.alias,s),c&&Pr(t,this.extras,c),this._record=t,this.setFieldsValue(t),this._prevValue=u,i){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e),this.searchHelperChangeHandle(e)}a?.([t])}}}catch(e){}this.setState({loading:!1})})),va(this,"todoOpen",(e=>{const{autoQueryAssign:t=!0}=this.searchHelper;t&&(this.deriveParams=this.createFilters(e)),this.setVisible(!0)})),va(this,"createFilters",(e=>{const{fieldName:t}=this.props.option,{filterAliasMap:r}=this.searchHelper,n=""!==e?e:void 0,a=("function"==typeof r?r():r)||[],i={[t]:n};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](n):n;else i[e]=n})),i})),va(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});if(!n(o))return l();this.setState({loading:!0});try{const e=await t.fetch.api(o);200===e.code?i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):l()}catch(e){l(e)}finally{le((()=>this.setState({loading:!1})))}}))})),va(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Rr(e,this.alias[n]);void 0!==a&&(t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a))}for(const r in this.extras){const n=Rr(e,this.extras[r]);void 0!==n&&t.SET_FIELDS_EXTRA({[r]:n})}})),va(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;const{fieldName:n}=t.props.option,a=e.filter((e=>Rr(e,t.alias[n])?.toString().toLowerCase().includes(r.toLowerCase())));if(1===a.length)return t.closeSearchHelper(a[0]);t.openSearchHelper(r)})),va(this,"openSearchHelper",(async(e,t)=>{await this.props.waiting();const{$$form:r}=this.context,{beforeOpen:n}=this.searchHelper,a=(n??ae)(r.state.formData);a?.then?a.then((()=>{this.todoOpen(e),t?.()})).catch((()=>{})):!1!==a&&(this.todoOpen(e),t?.())})),va(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Rr(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])});const n=Rr(e,this.alias[r]);this.triggerChange(n),this.searchHelperChangeHandle(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),va(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)})),va(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;if(this.triggerChange(""),null!==this._record){for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.searchHelperChangeHandle("")}})),va(this,"searchHelperChangeHandle",(e=>{const{onChange:t}=this.props.option;this.deriveParams={},this._is_change=!1,t?.(e,this._record)})),va(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e)})),va(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),va(this,"focus",(()=>{const{type:e}=this.props.option;this[`${e}_Ref`].focus({cursor:"end"})})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:u=p("qm.form.inputPlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"60%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:Object.assign({},this.deriveParams,s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Xr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement(xa,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target,{onlySelect:n=!0,table:a}=this.searchHelper;this.triggerBlur(t),this._is_change&&!r&&(t?n?a?.fetch?.api&&this.getSearchHelperTableData(t).then((e=>this.resetSearchHelperValue(e,t))).catch((()=>this.clearSearchHelperValue())):this.searchHelperChangeHandle(t):this.clearSearchHelperValue())},onKeyDown:e=>{if(13===e.keyCode){e.preventDefault();const{value:t}=e.target;!r&&this.openSearchHelper(t)}},onDoubleClick:e=>{const{value:t}=e.target;this.openSearchHelper(t)},onChange:e=>{const{value:t}=e.target;this.triggerChange(t),this._is_change=!0},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper(e):le((()=>this.clearSearchHelperValue())))}}),t().createElement(ur,v,t().createElement(vc,x)))}}va(Ea,"contextType",mr);class Sa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),va(this,"promiseRef",void 0),va(this,"searchRef",void 0),va(this,"state",{searchHelper:{}}),va(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),va(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[]}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ea,{ref:e=>this.searchRef=e,option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e.setViewValue(l,t)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}va(Sa,"contextType",mr);const Ca=Sa;function wa(){return wa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wa.apply(this,arguments)}function Na(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ta=r=>{class n extends e.Component{constructor(){var e;super(...arguments),e=this,Na(this,"startClick",void 0),Na(this,"event1",null),Na(this,"event2",null),Na(this,"$el",null),Na(this,"omitClassNames",[]),Na(this,"state",{clickOutside:!1}),Na(this,"mousedownHandler",(e=>{this.startClick=e})),Na(this,"mouseupHandler",(e=>{this.documentHandler(e,this.startClick)})),Na(this,"documentHandler",((e,t)=>{const r=e.target,n=t?.target,a=!r||!n,i=this.$el?.contains(r)||this.$el?.contains(n),l=this.$el===r,o=this.omitClassNames.map((e=>Array.from(document.querySelectorAll(e)))).flat(),s=o.some((e=>e?.contains(r)))||o.includes(n);let c;c=!(a||i||l||s),this.setState({clickOutside:c})})),Na(this,"setCurrentElement",(e=>{e&&(this.$el=e)})),Na(this,"setOmitClassNames",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.omitClassNames=t}))}componentDidMount(){this.event1=qt()(document,"mousedown",this.mousedownHandler),this.event2=qt()(document,"mouseup",this.mouseupHandler)}componentWillUnmount(){this.event1?.remove(),this.event2?.remove()}render(){const{forwardedRef:e}=this.props,{clickOutside:n}=this.state;return t().createElement(r,wa({ref:e},this.props,{clickOutside:n,setCurrentElement:this.setCurrentElement,setOmitClassNames:this.setOmitClassNames}))}}return Na(n,"displayName",`OutsideClick(${r.displayName||r.name})`),t().forwardRef(((e,r)=>t().createElement(n,wa({},e,{forwardedRef:r}))))},Ia=require("rc-trigger");var Ra,Oa,Pa=n.n(Ia);function Aa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ka=Ta((Oa=class extends e.Component{constructor(e){var r;super(e),r=this,Aa(this,"searchRef",t().createRef()),Aa(this,"_records",[]),Aa(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Aa(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),Aa(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||g("Form","MULTIPLE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Aa(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Aa(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Aa(this,"setItemList",(e=>{this.setState({itemList:e})})),Aa(this,"setRecords",(e=>{this._records=e})),Aa(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Aa(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Aa(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Aa(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),Aa(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,callback:l,fieldAliasMap:o}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},s="function"==typeof o?o():o||{},{value:c}=this.props;if(r&&!se(c)){this.setState({loading:!0});try{const o=await r(a({...n,keys:c}));if(200===o.code){let r=Array.isArray(o.data)?o.data:(0,J.get)(o.data,i)??[];r.forEach((r=>{s?.valueKey&&s.valueKey!==t&&(r[t]=r[s.valueKey]),s?.textKey&&s.textKey!==e&&(r[e]=r[s.textKey])})),r=r.filter((e=>c.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(c),l?.(r)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:u={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"60%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-search-helper"),{size:N}=e.context,T={[w]:!0,[`${w}--lg`]:"large"===N,[`${w}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Xr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Pa(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(T),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(ur,v,t().createElement(vc,x)))}},Aa(Oa,"contextType",mr),Ra=Oa))||Ra;class Fa extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Aa(this,"promiseRef",void 0),Aa(this,"state",{searchHelper:{}}),Aa(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Aa(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ka,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Aa(Fa,"contextType",mr);const Ha=Fa;function La(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{Search:$a}=P.Input;class _a extends e.Component{constructor(e){super(e),La(this,"valueKey",void 0),La(this,"_record",void 0),La(this,"_prevValue",null),La(this,"state",{visible:!1,loading:!1}),La(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),La(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),La(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e}=this.props.option,{fieldAliasMap:t,fieldsDefine:r,echoRequest:n}=this.searchHelper;if(t||g("Form","TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),r){const e=["valueKey","displayKey","extraKey"];for(const t in r)e.includes(t)&&(this[t]=r[t])}Object.keys(this.alias).includes(e)||g("Form","TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),n&&!this.valueKey&&g("Form","TREE_TABLE_HELPER 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用")})),La(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),La(this,"getDerivedSearchHelper",(()=>this.searchHelper)),La(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,triggeredChange:a,fieldAliasMap:i,extraAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},s="function"==typeof l?l():l||{},c=this.getItemValue();if(!e||se(c))return this._prevValue=void 0;this.setState({loading:!0});try{const i=await e(r({...t,key:c}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,n)??[];if(e[0]){const t=e[0];if(o&&Or(t,this.alias,o),s&&Pr(t,this.extras,s),this._record=t,this.setFieldsValue(t),this._prevValue=c,a){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}}}}catch(e){}this.setState({loading:!1})})),La(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;for(const n in this.alias){const a=Rr(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])})})),La(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),La(this,"closeSearchHelper",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias)n!==r&&t.SET_FIELDS_VALUE({[n]:Rr(e,this.alias[n])});for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])});const n=Rr(e,this.alias[r]);this.triggerChange(n);const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(e)),200)}))})),La(this,"clearSearchHelperValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;for(const r in this.alias)r!==t&&e.SET_FIELDS_VALUE({[r]:void 0});for(const t in this.extras)e.SET_FIELDS_EXTRA({[t]:""});this._record=null,this.triggerChange("")})),La(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),La(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(){if(null===this._prevValue)return;const e=this.getItemValue();this._prevValue!==e&&e!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=e}render(){const{$$form:e}=this.context,{visible:r,loading:n}=this.state,{value:a=""}=this.props,{type:i,fieldName:l,options:o={},searchHelper:s={},style:c={},placeholder:u=p("qm.form.selectPlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f}=this.props.option,{prefix:g,suffix:b,maxLength:y}=o,v={visible:r,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.setVisible(!1)}};return e.isOnlyShow?t().createElement(Xr,{value:a,bordered:d}):t().createElement(t().Fragment,null,t().createElement($a,{ref:e=>this[`${i}_Ref`]=e,value:a,title:a,loading:n,placeholder:u,style:c,prefix:g,suffix:b,maxLength:y,bordered:d,allowClear:m,readOnly:h,disabled:f,onBlur:e=>{const{value:t}=e.target;this.triggerBlur(t)},onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onDoubleClick:e=>{this.openSearchHelper()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():this.clearSearchHelperValue())}}),t().createElement(ur,v,t().createElement(Nc,x)))}}La(_a,"contextType",mr);class Da extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),La(this,"promiseRef",void 0),La(this,"state",{searchHelper:{}}),La(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),La(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(_a,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r)=>{f(t,r),e.setViewValue(l,t)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}La(Da,"contextType",mr);const qa=Da;var ja,Ka;function Ma(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let Va=Ta((Ka=class extends e.Component{constructor(e){var r;super(e),r=this,Ma(this,"searchRef",t().createRef()),Ma(this,"_records",[]),Ma(this,"state",{visible:!1,visible2:!1,loading:!1,itemList:[]}),Ma(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),Ma(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||g("Form","MULTIPLE_TREE_TABLE_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","MULTIPLE_TREE_TABLE_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Ma(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Ma(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ma(this,"setItemList",(e=>{this.setState({itemList:e})})),Ma(this,"setRecords",(e=>{this._records=e})),Ma(this,"recordsToDict",(()=>this._records.map((e=>({text:e[this.alias.textKey],value:e[this.alias.valueKey]}))))),Ma(this,"setViewValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;t.setViewValue(r,this.createViewText(e))})),Ma(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ma(this,"closeSearchHelper",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{valueKey:n}=r.alias;r.setRecords((0,J.uniqBy)([...r._records.filter((e=>t.includes(e[n]))),...e],n));const a=r.recordsToDict();r.setItemList(a),r.triggerChange(a.map((e=>e.value)));const{closed:i}=r.searchHelper;r.setVisible(!1,(()=>{setTimeout((()=>i?.(r._records)),200)}))})),Ma(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props,{valueKey:n}=this.alias||{};this.setRecords(this._records.filter((t=>e.includes(t[n])))),t?.(e),r(e,this.createViewText(e),this._records)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e,t){const{value:r=[]}=e,{value:n=[],clickOutside:a}=this.props;(0,J.isEqual)((0,J.intersection)(r,n),n)||(0,J.isEqual)(n,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList(),a&&t.visible2&&this.setState({visible2:!1})}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||this.props.option.searchHelper?.request||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t])));const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setViewValue(s)}}catch(e){}this.setState({loading:!1})}}createViewText(e){return this.recordsToDict().filter((t=>e.includes(t.value))).map((e=>e.text)).join(",")}render(){const{$$form:e}=this.context,{visible:r,visible2:n,loading:a,itemList:i}=this.state,{value:l}=this.props,{fieldName:o,options:s={},searchHelper:c={},style:u={},placeholder:d=p("qm.form.selectPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{collapseTags:b,maxTagTextLength:y}=s,v={visible:r,title:p("qm.searchHelper.text"),width:c.width??"65%",wrapClassName:`form-popper__${o}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.setVisible(!1)}},x={...this.getDerivedSearchHelper(),size:e.$size,multiple:!0,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${o}`:"",initialValue:(0,J.merge)({},c.initialValue),defaultSelectedKeys:l,selectionRows:this._records,onClose:(e,t)=>{e?this.closeSearchHelper(e,t):this.setVisible(!1)}},E=i.filter((e=>l?.includes(e.value))),S=t().createElement("ul",{className:"ant-dropdown-menu"},E.length?E.map((e=>t().createElement("li",{key:e.value,className:"ant-dropdown-menu-item"},e.text))):t().createElement("li",{className:"ant-dropdown-menu-item"},p("qm.table.config.emptyText"))),C=this.searchRef.current?this.searchRef.current.offsetWidth:300,w=Ce("form-multiple-tree-table-helper"),{size:N}=e.context,T={[w]:!0,[`${w}--lg`]:"large"===N,[`${w}--sm`]:"small"===N};this.props.setOmitClassNames?.([`.${w}`]);const I=i.filter((e=>l?.includes(e.value))).map((e=>e.text)).join(",");return e.isOnlyShow?t().createElement(Xr,{value:I,bordered:m}):t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{ref:this.searchRef,className:"ant-input-wrapper ant-input-group"},t().createElement(Pa(),{popupVisible:!g&&n,popup:S,popupClassName:Se()(T),popupStyle:{minWidth:C},onPopupVisibleChange:e=>this.setState({visible2:e}),builtinPlacements:vr,prefixCls:"ant-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Select,{mode:"multiple",maxTagCount:b?"responsive":void 0,maxTagTextLength:y,open:!1,value:l,placeholder:d,loading:a,bordered:m,allowClear:h,disabled:g,style:{width:"100%",...u},title:I,onKeyUp:e=>{13===e.keyCode&&(e.preventDefault(),this.openSearchHelper())},onClick:e=>{const t=e.target;t.classList.contains("ant-select-selection-overflow-item-rest")&&(this.props.setCurrentElement?.(t),this.setState({visible2:!0}))},onDoubleClick:()=>{g||this.openSearchHelper()},onChange:e=>{this.triggerChange(e)}},i.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:g,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{this.openSearchHelper()}})))),t().createElement(ur,v,t().createElement(Nc,x)))}},Ma(Ka,"contextType",mr),ja=Ka))||ja;class za extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ma(this,"promiseRef",void 0),Ma(this,"state",{searchHelper:{}}),Ma(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ma(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Va,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{f(t,n),e.setViewValue(l,r)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Ma(za,"contextType",mr);const Ua=za;function Ba(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Wa=new Array(2).fill("");class Ga extends e.Component{constructor(e){var t;super(e),t=this,Ba(this,"_is_change",!1),Ba(this,"_ceho_data",void 0),Ba(this,"_records",[]),Ba(this,"_is_clear",!1),Ba(this,"state",{visible:!1,loading:!1,itemList:[],textValue:Wa}),Ba(this,"getSearchHelper",pr()((e=>Object.assign({},this.props.helperConfig,e)))),Ba(this,"initialHandle",(async()=>{await this.props.waiting(),this.searchHelper.fieldAliasMap||g("Form","RANGE_SEARCH_HELPER 需要配置 `fieldAliasMap` 选项"),Object.keys(this.alias).includes("valueKey")&&Object.keys(this.alias).includes("textKey")||g("Form","RANGE_SEARCH_HELPER 的 fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`")})),Ba(this,"getDerivedSearchHelper",(()=>(this.searchHelper.table&&!this.searchHelper.table.rowKey&&(this.searchHelper.table.rowKey=this.alias.valueKey),this.searchHelper))),Ba(this,"setItemList",(e=>{this.setState({itemList:e})})),Ba(this,"setVisible",((e,t)=>{this.setState({visible:e},t)})),Ba(this,"setTextValue",(e=>{this.setState({textValue:e})})),Ba(this,"setRecords",(e=>{this._records=e})),Ba(this,"setViewValue",(()=>{const{$$form:e}=this.context,{fieldName:t}=this.props.option;e.setViewValue(t,this.createViewText())})),Ba(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;this._is_change=!1,t?.(e),r(e,this.createViewText(),this._records)})),Ba(this,"clearSearchHelperValue",(()=>{this.setRecords([]),this.setTextValue(Wa),this.triggerChange([])})),Ba(this,"closeSearchHelper",(e=>{const{valueKey:t,textKey:r}=this.alias,n=e.map((e=>({value:e[t],text:e[r]})));this.setRecords(e),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.triggerChange(e.map((e=>e[t])));const{closed:a}=this.searchHelper;this.setVisible(!1,(()=>{setTimeout((()=>a?.(this._records)),200)}))})),Ba(this,"openSearchHelper",(async e=>{await this.props.waiting();const{$$form:t}=this.context,{beforeOpen:r}=this.searchHelper,n=(r??ae)(t.state.formData);n?.then?n.then((()=>{this.setVisible(!0),e?.()})).catch((()=>{})):!1!==n&&(this.setVisible(!0),e?.())})),Ba(this,"createFilters",(e=>{const{fieldName:t}=this.props.option;return{[t]:se(e)?void 0:e}})),Ba(this,"getSearchHelperTableData",(e=>{const{table:t,initialValue:r={}}=this.searchHelper,{beforeFetch:n=ae,formatter:a=(e=>e)}=t.fetch;return new Promise((async(i,l)=>{const o=(0,J.merge)({},this.searchHelper.table.fetch.params,{...r,...a(this.createFilters(e))},{currentPage:1,pageSize:500});try{if(!n(o))return l();this.setState({loading:!0});const e=await t.fetch.api(o);if(le((()=>this.setState({loading:!1}))),200===e.code)return i(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[])}catch(e){this.setState({loading:!1})}l()}))})),Ba(this,"resetSearchHelperValue",(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{textValue:r}=t.state,{textKey:n}=t.alias,a=e.filter((e=>{const t=e[n]?.toString().toLowerCase();return r.some((e=>t?.includes(e.toLowerCase())))}));if(2===a.length)return t.closeSearchHelper(a);t.openSearchHelper()})),Ba(this,"closeButNotSelect",(()=>{this._is_change&&this.clearSearchHelperValue(),this.setVisible(!1)})),this.initialHandle()}get uniqueKey(){const{$$form:e}=this.context;return e.props.uniqueKey||""}get searchHelper(){return this.getSearchHelper(this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemList()}componentDidUpdate(e){const{value:t=[]}=e,{value:r=[]}=this.props;(0,J.isEqual)((0,J.intersection)(t,r),r)||(0,J.isEqual)(r,this._records.map((e=>e[this.alias.valueKey])))||this.getItemList();const{echo_data:n}=this.context,{fieldName:a}=this.props.option;if(!(0,J.isEqual)(n[a],this._ceho_data)&&(this._ceho_data=n[a],this.setItemList(n[a]),r.length)){const e=Wa.map(((e,t)=>n[a].find((e=>e.value===r[t]))?.text??""));this.setTextValue(e)}}async getItemList(){await this.props.waiting();const{textKey:e,valueKey:t}=this.alias,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i,fieldAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof l?l():l||{},{value:s}=this.props;if(r&&!se(s)){this.setState({loading:!0});try{const l=await r(a({...n,keys:s}));if(200===l.code){let r=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];r.forEach((r=>{o?.valueKey&&o.valueKey!==t&&(r[t]=r[o.valueKey]),o?.textKey&&o.textKey!==e&&(r[e]=r[o.textKey])})),r=r.filter((e=>s.includes(e[t]))).slice(0,2);const n=r.map((r=>({value:r[t],text:r[e]})));this.setRecords(r),this.setItemList(n),this.setTextValue(n.map((e=>e.text??""))),this.setViewValue()}}catch(e){}this.setState({loading:!1})}}createViewText(){const{textKey:e}=this.alias;return this._records.map((t=>t[e])).join(" - ")}render(){const{$$form:e}=this.context,{value:r=[]}=this.props,{visible:n,loading:a,textValue:i}=this.state,{fieldName:l,options:o={},searchHelper:s={},placeholder:c=p("qm.form.rangeInputNumberPlaceholder"),bordered:u=!0,readOnly:d,disabled:m}=this.props.option,{onlySelect:h=!0}=this.searchHelper||s,f={visible:n,title:p("qm.searchHelper.text"),width:s.width??"65%",wrapClassName:`form-popper__${l}`,loading:!1,bodyStyle:{paddingBottom:`${ya[e.$size]+20}px`},onClose:()=>{this.closeButNotSelect()}},g={...this.getDerivedSearchHelper(),size:e.$size,uniqueKey:this.uniqueKey?`${this.uniqueKey}_${l}`:"",initialValue:(0,J.merge)({},s.initialValue),onClose:e=>{e?this.closeSearchHelper(e):this.closeButNotSelect()}};return e.isOnlyShow?t().createElement(Xr,{value:i.join(" - "),bordered:u}):t().createElement(t().Fragment,null,t().createElement(P.Input.Group,null,t().createElement(P.Input,{value:i[0],className:"site-input-left",style:{width:"calc(50% - 5px)"},placeholder:c[0],allowClear:!1,bordered:u,readOnly:d,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;h||(this._is_change=!0,this.setTextValue([t,i[1]]))}}),t().createElement(P.Input,{className:"site-input-split",style:{width:10,paddingLeft:0,paddingRight:0,borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"~",bordered:u,disabled:m,readOnly:!0}),t().createElement(P.Input.Search,{value:i[1],className:"site-input-right",style:{width:"calc(50% - 5px)"},placeholder:c[1],loading:a,bordered:u,allowClear:!0,readOnly:d,disabled:m,onBlur:e=>{const{value:t}=e.target;this._is_change&&!n&&(t?i.every((e=>!!e))&&this.searchHelper.table?.fetch?.api&&this.getSearchHelperTableData(i).then((e=>this.resetSearchHelperValue(e))).catch((()=>this.clearSearchHelperValue())):i.every((e=>!e))&&this.clearSearchHelperValue())},onDoubleClick:()=>{this.openSearchHelper()},onChange:e=>{const{value:t}=e.target;this._is_clear?this._is_clear=!1:h||(this._is_change=!0,this.setTextValue([i[0],t]))},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?this.openSearchHelper():(this._is_clear=!0,this.clearSearchHelperValue()))}})),t().createElement(ur,f,t().createElement(kc,g)))}}Ba(Ga,"contextType",mr);class Ya extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ba(this,"promiseRef",void 0),Ba(this,"state",{searchHelper:{}}),Ba(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ba(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("searchHelper","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi,!0);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,labelWidth:s=e.props.labelWidth,className:c,extra:u,buttonAfter:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(c),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ga,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:(t,r,n)=>{h(t,n),e.setViewValue(l,r)}}))),d&&t().createElement(P.Col,null,e.renderFormItemButton(l,d)),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...u}))))}}Ba(Ya,"contextType",mr);const Xa=Ya;function Qa(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Za=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.filter((t=>e.includes(t.value))).map((e=>e.text)).join(",");return r.isOnlyShow?t().createElement(Xr,{value:h(n),bordered:c}):t().createElement(P.Checkbox.Group,{value:n,style:{width:"100%",...s},disabled:d,onChange:e=>{(e=>{i?.(e),l(e,h(e))})(e)}},m.map((e=>t().createElement(P.Checkbox,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class Ja extends e.Component{constructor(){super(...arguments),Qa(this,"state",{itemList:[]})}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}async getItemList(){const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Za,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Qa(Ja,"contextType",mr);const ei=Ja,ti=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},allowClear:s=!0,readOnly:c,disabled:u=r.isFormDisabled}=e.option,{allowHalf:d,count:p=5,tooltips:m}=l;return t().createElement(P.Rate,{value:n,count:p,style:o,allowHalf:d,allowClear:s,tooltips:m,disabled:u||r.isOnlyShow,onChange:e=>{(e=>{var t;a?.(e),i(e,(t=e,m?m[Math.ceil(t)-1]:t.toString()))})(e)}})};class ri extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(ti,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ri,"contextType",mr);const ni=ri;function ai(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ii=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,onChange:i,onValuesChange:l}=e,{options:o={},style:s={},bordered:c=!1,readOnly:u,disabled:d=r.isFormDisabled}=e.option,{itemList:p=[]}=o,m=se(p)?a:p,h=e=>m.find((t=>t.value===e))?.text??"";return r.isOnlyShow?t().createElement(Xr,{value:h(n),bordered:c}):t().createElement(P.Radio.Group,{value:n,style:{width:"100%",...s},disabled:d||r.isOnlyShow,onChange:e=>{const{value:t}=e.target;(e=>{i?.(e),l(e,h(e))})(t)}},m.map((e=>t().createElement(P.Radio,{key:e.value,value:e.value,disabled:e.disabled},e.text))))};class li extends e.Component{constructor(){super(...arguments),ai(this,"state",{itemList:[]}),ai(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t)try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=t.map((e=>({value:e[a],text:e[i]})));this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,validateTrigger:p,rules:m=[],onChange:h=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(m)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:m,validateTrigger:p,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(ii,{option:this.props.option,items:r,onValuesChange:(t,r)=>{h(t),e.setViewValue(l,r)}}))),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}ai(li,"contextType",mr);const oi=li,si=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{label:l,options:o={},style:s={},readOnly:c,disabled:u=r.isFormDisabled}=e.option,{labelToSwitch:d,falseValue:m=gr,trueValue:h=fr}=o;return t().createElement(t().Fragment,null,t().createElement(P.Switch,{checked:n===h,style:s,disabled:u||r.isOnlyShow,checkedChildren:t().createElement(we.CheckOutlined,null),unCheckedChildren:t().createElement(we.CloseOutlined,null),onChange:e=>{(e=>{a?.(e),i(e,p(e===h?"am.form.trueText":"am.form.falseText"))})(e?h:m)}}),d?t().createElement("span",{style:{verticalAlign:"middle",marginLeft:8}},l):null)};class ci extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option,{labelToSwitch:h}=o;return t().createElement(P.Form.Item,{label:h?" ":e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(si,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ci,"contextType",mr);const ui=ci,di=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},style:o={},placeholder:s=p("qm.form.inputPlaceholder"),bordered:c=!0,allowClear:u,readOnly:d,disabled:m,onBlur:h=ne,onEnter:f=ne}=e.option,{showCount:g,maxLength:b,autoSize:y}=l,v=Object.assign({},{minRows:1,maxRows:3},y);return t().createElement(P.Input.TextArea,{value:n,placeholder:s,style:o,maxLength:b,showCount:g,autoSize:v,bordered:c,allowClear:u,readOnly:d||r.isOnlyShow,disabled:m,onBlur:t=>{const{value:r}=t.target;(t=>{const{onBlur:r}=e;r?.(t)})(r),h(r)},onKeyUp:e=>{if(13===e.keyCode){const{value:t}=e.target;f(t)}},onChange:e=>{const{value:t}=e.target;(e=>{a?.(e),i(e)})(t)}})};class pi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(di,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(pi,"contextType",mr);const mi=pi,hi=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:c={},placeholder:u=p("qm.form.datePlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f}=e.option,{dateType:g="date",format:b,disabledDate:y,minDateTime:v,maxDateTime:x,shortCuts:E=!0}=o,S=t().createRef(),C=e=>{e&&"date"===g&&(e=e.slice(0,10)+" 00:00:00"),a?.(e),i(e,w(e))},w=e=>Ir(e)?"":["date","exactdate"].includes(g)?e.slice(0,10):e,N=e=>{let t=Tr(s()().subtract(e,"day"),Er[g]);"date"===g&&(t=t.slice(0,10)),C(t),S.current.blur(),S.current.focus()};return r.isOnlyShow?t().createElement(Xr,{value:w(n),bordered:d}):t().createElement(D,{ref:S,style:{width:"100%",...c},popupClassName:`form-popper__${l}`,picker:xr[g],format:b,bordered:d,showToday:!1,showTime:"datetime"===g&&{defaultValue:s()("00:00:00","HH:mm:ss")},allowClear:m,disabled:f,inputReadOnly:h,disabledDate:y??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[v,x])),renderExtraFooter:E?()=>t().createElement(t().Fragment,null,t().createElement(P.Tag,{color:"processing",onClick:()=>N(0)},p("qm.form.datePickers")[0]),t().createElement(P.Tag,{color:"processing",onClick:()=>N(1)},p("qm.form.datePickers")[1]),t().createElement(P.Tag,{color:"processing",onClick:()=>N(7)},p("qm.form.datePickers")[2]),t().createElement(P.Tag,{color:"processing",onClick:()=>N(30)},p("qm.form.datePickers")[3])):void 0,value:Nr(n,Er[g]),onChange:(e,t)=>{C(Tr(e,Er[g]))}})};class fi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(hi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(fi,"contextType",mr);const gi=fi,bi=e=>[s()().subtract(e,"day"),s()()],yi=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:c={},placeholder:u=p("qm.form.daterangePlaceholder"),bordered:d=!0,allowClear:m=!0,readOnly:h,disabled:f=r.isFormDisabled}=e.option,{dateType:g="date",format:b,disableds:y=[!1,!1],disabledDate:v,minDateTime:x,maxDateTime:E,shortCuts:S=!0}=o,C={[p("qm.form.dateRangePickers")[0]]:bi(7),[p("qm.form.dateRangePickers")[1]]:bi(30),[p("qm.form.dateRangePickers")[2]]:bi(90),[p("qm.form.dateRangePickers")[3]]:bi(180)},w=e=>Ir(e)?"":e.map((e=>["date","exactdate"].includes(g)?e?.slice(0,10):e)).join(" - ");return r.isOnlyShow?t().createElement(Xr,{value:w(n),bordered:d}):t().createElement(D.RangePicker,{style:{width:"100%",...c},popupClassName:`form-popper__${l}`,picker:xr[g],format:b,bordered:d,showTime:"datetime"===g&&{defaultValue:[s()("00:00:00","HH:mm:ss"),s()("23:59:59","HH:mm:ss")]},allowClear:m,disabled:f?[!0,!0]:y,inputReadOnly:h,disabledDate:v??(e=>((e,t)=>{let[r,n]=t;return r&&n?e.isBefore(r,"day")||e.isAfter(n,"day"):r?e.isBefore(r,"day"):!!n&&e.isAfter(n,"day")})(e,[x,E])),ranges:S?C:void 0,value:se(n)?null:[Nr(n?.[0],Er[g]),Nr(n?.[1],Er[g])],onChange:(e,t)=>{(e=>{"date"===g&&(e=e.map(((e,t)=>e?0===t?e.slice(0,10)+" 00:00:00":e.slice(0,10)+" 23:59:59":e))),e.every((e=>!e))&&(e=[]),a?.(e),i(e,w(e))})([Tr(e?.[0],Er[g]),Tr(e?.[1],Er[g])])}})};class vi extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(yi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(vi,"contextType",mr);const xi=vi,Ei=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:s={},placeholder:c=p("qm.form.timePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{timeType:f="hour-minute-second",hourStep:g=1,minuteStep:b=1,secondStep:y=1}=o;return r.isOnlyShow?t().createElement(Xr,{value:n,bordered:u}):t().createElement(M,{style:{width:"100%",...s},popupClassName:`form-popper__${l}`,bordered:u,showNow:!0,hourStep:g,minuteStep:b,secondStep:y,allowClear:d,disabled:h,inputReadOnly:m,format:Sr[f],value:Nr(n,Sr[f]),onChange:(e,t)=>{(e=>{const t=Tr(e,Sr[f]);a?.(t),i(t)})(e)}})};class Si extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(Ei,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Si,"contextType",mr);const Ci=Si,wi=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{fieldName:l,options:o={},style:s={},placeholder:c=p("qm.form.timerangePlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h=r.isFormDisabled}=e.option,{timeType:f="hour-minute-second",disableds:g=[!1,!1],hourStep:b=1,minuteStep:y=1,secondStep:v=1}=o,x=e=>Ir(e)?"":e.join(" - ");return r.isOnlyShow?t().createElement(Xr,{value:x(n),bordered:u}):t().createElement(M.RangePicker,{style:{width:"100%",...s},popupClassName:`form-popper__${l}`,bordered:u,showNow:!1,hourStep:b,minuteStep:y,secondStep:v,allowClear:d,disabled:h?[!0,!0]:g,inputReadOnly:m,format:Sr[f],value:se(n)?null:[Nr(n?.[0],Sr[f]),Nr(n?.[1],Sr[f])],onChange:(e,t)=>{(e=>{const t=[Tr(e?.[0],Sr[f]),Tr(e?.[1],Sr[f])];a?.(t),i(t,x(t))})(e)}})};class Ni extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(wi,{option:this.props.option,onValuesChange:(t,r)=>{m(t),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ni,"contextType",mr);const Ti=Ni;function Ii(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ri extends e.Component{constructor(e){super(e),Ii(this,"searchRef",t().createRef()),Ii(this,"valueKey",void 0),Ii(this,"_clicking",!1),Ii(this,"_record",void 0),Ii(this,"_prevValue",null),Ii(this,"state",{itemList:[],visible:!1,loading:!1,activeIndex:0,inputText:void 0}),Ii(this,"getSearchHelper",pr()(((e,t)=>Object.assign({},this.props.helperConfig,e,t)))),Ii(this,"initialHandle",(async()=>{await this.props.waiting();const{fieldName:e,options:t,searchHelper:r}=this.props.option,{fieldAliasMap:n,fieldsDefine:a,echoRequest:i}=this.searchHelper;if(n||g("Form","IMMEDIATE 需要配置 `fieldAliasMap` 选项"),a){const e=["valueKey","displayKey","extraKey"];for(const t in a)e.includes(t)&&(this[t]=a[t])}Object.keys(this.alias).includes(e)||g("Form","IMMEDIATE 的 fieldAliasMap 选项必须包含自身 `fieldName` 值"),i&&!this.valueKey&&g("Form","IMMEDIATE 的 echoRequest 选项必须组合 `fieldsDefine` 中的 `valueKey` 一起使用"),t&&!r&&g("Form","IMMEDIATE 的 `options` 选项即将在下一个大版本中废弃,请使用 `searchHelper` 参数")})),Ii(this,"getItemValue",(()=>{const{$$form:e}=this.context;return e.state.other[this.valueKey]??e.state.formData[this.valueKey]})),Ii(this,"getItemText",(async()=>{await this.props.waiting();const{fetchApi:e,params:t={},formatter:r=(e=>e),dataKey:n,triggeredChange:a,fieldAliasMap:i,extraAliasMap:l}=this.searchHelper.echoRequest||{},o="function"==typeof i?i():i||{},s="function"==typeof l?l():l||{},c=this.getItemValue();if(!e||se(c))return this._prevValue=void 0;try{const i=await e(r({...t,key:c}));if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,n)??[];if(e[0]){const t=e[0];if(o&&Or(t,this.alias,o),s&&Pr(t,this.extras,s),this._record=t,this.setFieldsValue(t),this._prevValue=c,a){const e=Rr(t,this.alias[this.props.option.fieldName]);this.triggerChange(e)}}}}catch(e){}})),Ii(this,"setFieldsValue",(e=>{const{$$form:t}=this.context,{fieldName:r}=this.props.option;this._record=e;for(const n in this.alias){const a=Rr(e,this.alias[n]);t.SET_FIELDS_VALUE({[n]:a}),n===r&&t.setViewValue(r,a)}for(const r in this.extras)t.SET_FIELDS_EXTRA({[r]:Rr(e,this.extras[r])})})),Ii(this,"fetchHandle",(0,J.debounce)(this.getItemList,200)),Ii(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Ii(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this._record)})),Ii(this,"triggerBlur",(e=>{const{onBlur:t}=this.props;t?.(e)})),Ii(this,"clickHandle",((e,t)=>{const{$$form:r}=this.context,{fieldName:n}=this.props.option;for(const t in this.alias)t!==n&&r.SET_FIELDS_VALUE({[t]:Rr(e,this.alias[t])});for(const t in this.extras)r.SET_FIELDS_EXTRA({[t]:Rr(e,this.extras[t])});this.searchRef.current.focus({cursor:"end"}),this._record=e;const a=Rr(e,this.alias[n]);this.triggerChange(a),this.setState({inputText:void 0}),t&&t()})),this.initialHandle()}get searchHelper(){return this.getSearchHelper(this.props.option.options,this.props.option.searchHelper)}get alias(){const{fieldAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}get extras(){const{extraAliasMap:e}=this.searchHelper;return"function"==typeof e?e():e||{}}componentDidMount(){this.getItemText()}componentDidUpdate(e){const t=e.option.searchHelper?.request?.params||e.option.request?.params,r=this.props.option.searchHelper?.request?.params||this.props.option.request?.params;if((0,J.isEqual)(t,r)||this.getItemList(),null===this._prevValue)return;const n=this.getItemValue();this._prevValue!==n&&n!==this._record?.[this.alias[this.valueKey]]&&this.getItemText(),this._prevValue=n}async getItemList(e){const{fieldName:t}=this.props.option,{fetchApi:r,params:n={},formatter:a=(e=>e),dataKey:i}=this.searchHelper.request||this.props.option.request||{};if(r){this.setState({loading:!0});try{const l=await r(a({...n,[t]:e}));if(200===l.code){const e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,i)??[];this.setState({itemList:e,activeIndex:0})}}catch(e){}this.setState({loading:!1})}}render(){const{$$form:e}=this.context,{visible:r,loading:n,itemList:a,inputText:i}=this.state,{value:o}=this.props,{fieldName:s,options:c={},style:u={},placeholder:d=p("qm.form.inputPlaceholder"),bordered:m=!0,allowClear:h=!0,readOnly:f,disabled:g}=this.props.option,{listHeight:b=br}=c,{hideHeader:y,onlySelect:v=!0}=this.searchHelper||c,x=this.searchHelper.columns||[],E=Ce("form-immediate"),S=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,C=t().createElement(P.Spin,{spinning:n},a.length?t().createElement("table",{cellSpacing:0,cellPadding:0,className:Se()("table")},!y&&t().createElement("thead",null,t().createElement("tr",null,x.filter((e=>!e.hidden)).map((e=>t().createElement("th",{key:e.dataIndex,style:{width:`${e.width}px`,backgroundColor:"#f0f0f0"}},e.title))))),t().createElement("tbody",null,a.map(((e,r)=>t().createElement("tr",{key:r,className:this.state.activeIndex===r?"active":"",onMouseEnter:()=>{this.setState({activeIndex:r})},onMouseDown:()=>{this._clicking=!0},onMouseUp:()=>{this._clicking=!1},onClick:()=>{this.clickHandle(e,(()=>this.handleVisibleChange(!1)))}},x.filter((e=>!e.hidden)).map((r=>t().createElement("td",{key:r.dataIndex},(0,J.get)(e,r.dataIndex))))))))):t().createElement(ht,null));return t().createElement(l.Consumer,null,(n=>{const l={[E]:!0,[`${E}--lg`]:"large"===n?.size,[`${E}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Xr,{value:o,bordered:m}):t().createElement(Pa(),{action:g?[]:["click"],popupVisible:!g&&r,popup:C,popupClassName:Se()(l,`form-popper__${s}`),popupStyle:{minWidth:S,maxHeight:b},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Input,{ref:this.searchRef,placeholder:d,allowClear:h,bordered:m,readOnly:f,disabled:g,style:{width:"100%",...u},value:i??o,title:o,onFocus:()=>{!a.length&&this.fetchHandle(o)},onBlur:e=>{v&&!this._clicking&&i!==o&&this.setState({inputText:void 0}),this.triggerBlur(e.target.value)},onKeyDown:e=>{if(27===e.keyCode&&this.handleVisibleChange(!1),13===e.keyCode&&this.clickHandle(a[this.state.activeIndex],(()=>this.handleVisibleChange(!1))),38===e.keyCode||40===e.keyCode){if(!this.state.visible)return this.handleVisibleChange(!0);let t=this.state.activeIndex;const r=40===e.keyCode?++t%a.length:(--t+a.length)%a.length;this.setState({activeIndex:r})}},onChange:e=>{const{value:t}=e.target;this.fetchHandle(t),v?this.setState({inputText:t}):t&&this.triggerChange(t),t?this.handleVisibleChange(!0):this.clickHandle(null)}}))}))}}Ii(Ri,"contextType",mr);class Oi extends e.Component{constructor(e,t){let{$$form:r}=t;super(e),Ii(this,"promiseRef",void 0),Ii(this,"state",{searchHelper:{}}),Ii(this,"waiting",(async()=>{try{await this.promiseRef}catch(e){f("Form","搜索帮助获取定义信息的接口出错")}})),Ii(this,"getHelperConfig",(e=>{const{global:t}=e,{name:r,fieldsDefine:n}=this.props.option.searchHelper||{};if(!r)return;if(!t?.searchHelper?.getServerConfig||!t?.searchHelper?.createFetchApi)return g("immediate","从服务端获取定义信息的时候,ConfigProvider 组件 `getServerConfig` 和 `createFetchApi` 为必选参数");const{fieldName:a}=this.props.option;this.promiseRef=new Promise((async(e,i)=>{try{const l=await t.searchHelper.getServerConfig({searchHelperId:r});if(200===l.code){const r=Hr(Object.assign({},l.data,n),a,t.searchHelper.createFetchApi);this.setState({searchHelper:r},(()=>e()))}else i()}catch(e){i()}}))})),this.getHelperConfig(r.context)}render(){const{$$form:e}=this.context,{searchHelper:r}=this.state,{type:n,label:a,tooltip:i,fieldName:l,invisible:o,options:s={},labelWidth:c=e.props.labelWidth,className:u,extra:d,buttonAfter:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(a),className:Se()(u),tooltip:i,hidden:o,labelCol:{flex:e.verticalLayout?"initial":ue(c)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:l,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(a)}},t().createElement(Ri,{option:this.props.option,helperConfig:r,waiting:this.waiting,onValuesChange:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(t,arguments.length>1?arguments[1]:void 0),e.setViewValue(l,t)}}))),p&&t().createElement(P.Col,null,e.renderFormItemButton(l,p)),d&&t().createElement(P.Col,{flex:ue(d.labelWidth||hr)},e.renderFormItemExtra({fieldName:l,...d}))))}}Ii(Oi,"contextType",mr);const Pi=Oi;class Ai extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,fieldName:a,className:i,style:l={},collapse:o={}}=this.props.option,{expand:s}=e.state,{showLimit:c,remarkItems:u=[],onCollapse:d=ne}=o,p=[];if(u.length){const t=e.getBlockDerivedItems().find((e=>e[0].fieldName===a))??[],r=c??t.length-1;t.slice(r+1).forEach((t=>{const r=u.find((e=>e.fieldName===t.fieldName));if(!r)return;const n=r.showLabel?`${t.label}:`:"",a=e.getViewValue(t.fieldName)??"";""!==a&&p.push({...t,text:`${n}${a}`})}))}return t().createElement(P.Form.Item,{labelCol:{span:0},wrapperCol:{span:24}},t().createElement(Ie,{id:a,label:n,className:i,extra:p.map((e=>e.text)).join(" | "),style:{...l},collapse:s[a],onCollapseChange:t=>{e.setState((e=>({expand:Object.assign({},e.expand,{[a]:t})}))),d(t)}}))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ai,"contextType",mr);const ki=Ai;function Fi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hi(){return Hi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hi.apply(this,arguments)}const Li=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:Li(e.children,t,r,n)}:e)),$i=e=>{const{$$form:r}=t().useContext(mr),{value:n,items:a,multiple:i,loading:l,onChange:o,onValuesChange:s}=e,{fieldName:c,options:u={},style:d={},placeholder:m=p("qm.form.selectPlaceholder"),bordered:h=!0,allowClear:f=!0,asyncLoad:g,readOnly:b,disabled:y}=e.option,{itemList:v,filterable:x=!0,listHeight:E=br,checkStrictly:S,checkStrategy:C="SHOW_CHILD",collapseTags:w,openPyt:N=!0}=u,[T,I]=t().useState(se(v)?a:v);qe((()=>{I(se(v)?a:v)}),[v,a]);const R=e=>kr(T,e)?.text||"",O=e=>i?e.map((e=>R(e))).filter((e=>!!e)).join(","):R(e);return r.isOnlyShow?t().createElement(Xr,{value:O(n),bordered:h}):t().createElement(P.TreeSelect,Hi({fieldNames:{label:"text",value:"value",children:"children"},value:n,multiple:i,treeCheckable:i,treeCheckStrictly:S,showCheckedStrategy:P.TreeSelect[C],popupClassName:`form-popper__${c}`,placeholder:m,listHeight:E,style:d,loading:l,bordered:h,allowClear:f,disabled:y,treeDefaultExpandAll:!g,showSearch:x,maxTagCount:w?"responsive":void 0,loadData:g?async e=>{let{key:t,children:r}=e;if(!g||r)return;const{fetchApi:n,params:a,dataKey:i,textKey:l="text",valueKey:o="value",callback:s,formatter:c=(e=>e)}=g;if(n)try{const e=await n(c({...a,[o]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=Li(T,t,o,Ar(r,o,l));I(n),s?.(r)}}catch(e){}}:void 0,treeData:T},i?{title:O(n)}:null,{filterTreeNode:(e,t)=>{const r=t?.text?.toString()||"",n=Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(N?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0},onChange:e=>{(e=>{o?.(e),s(e,O(e),T)})(e)}}))};class _i extends e.Component{constructor(){super(...arguments),Fi(this,"state",{itemList:[],loading:!1}),Fi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Ar(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{itemList:r,loading:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:u=e.props.labelWidth,className:d,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(i),className:Se()(d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement($i,{option:this.props.option,items:r,loading:n,multiple:this.props.multiple,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(P.Col,{flex:ue(p.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...p}))))}}Fi(_i,"contextType",mr);const Di=_i;function qi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ji(){return ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ji.apply(this,arguments)}const Ki=e=>{const{$$form:r}=t().useContext(mr),{value:n,multiple:a,items:i}=e,{fieldName:l,options:o={},style:s={},placeholder:c=p("qm.form.selectPlaceholder"),bordered:u=!0,allowClear:d=!0,readOnly:m,disabled:h}=e.option,{changeOnSelect:f,checkStrictly:g,checkStrategy:b="SHOW_PARENT",filterable:y=!0,openPyt:v=!0}=o,{itemList:x=[]}=o,E=se(x)?i:x,S=e=>se(e)?"":a?e.map((e=>Fr(E,e).map((e=>e.text)).join("/"))).join(","):Fr(E,e).map((e=>e.text)).join("/");return r.isOnlyShow?t().createElement(Xr,{value:S(n),bordered:u}):t().createElement(P.Cascader,ji({value:(e=>se(e)?[]:a?e.map((e=>e.split(","))):e.split(","))(n),fieldNames:{label:"text",value:"value",children:"children"},options:E,multiple:a,maxTagCount:"responsive",changeOnSelect:f||g,showCheckedStrategy:P.Cascader[b],popupClassName:`form-popper__${l}`,placeholder:c,style:s,bordered:u,allowClear:d,disabled:h,showSearch:y&&{filter:(e,t)=>t.some((t=>{const r=t?.text?.toString()||"",n=Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("");return(v?`${r}|${n}`:r).toLowerCase().indexOf(e.toLowerCase())>=0}))}},a?{title:S(n)}:null,{onChange:t=>{(t=>{const{onChange:r,onValuesChange:n}=e;r?.(t),n(t,S(t),E)})(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a?e.map((e=>e.join(","))):e.join(",")}(t))}}))};class Mi extends e.Component{constructor(){super(...arguments),qi(this,"state",{itemList:[],loading:!1}),qi(this,"getItemList",(async()=>{const{request:e={}}=this.props.option,{fetchApi:t,params:r={},dataKey:n,valueKey:a="value",textKey:i="text",callback:l}=e;if(t){this.setState({loading:!0});try{const e=await t(r);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[],r=Ar(t,a,i);this.setState({itemList:r},(()=>l?.(t)))}}catch(e){}this.setState({loading:!1})}}))}componentDidMount(){this.getItemList()}componentWillUnmount(){this.setState=()=>!1}componentDidUpdate(e){const t=e.option.request?.params,r=this.props.option.request?.params;(0,J.isEqual)(t,r)||this.getItemList()}render(){const{$$form:e}=this.context,{multiple:r}=this.props,{itemList:n}=this.state,{type:a,label:i,tooltip:l,fieldName:o,invisible:s,options:c={},labelWidth:u=e.props.labelWidth,className:d,extra:p,validateTrigger:m,rules:h=[],onChange:f=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(i),className:Se()(d),tooltip:l,hidden:s,labelCol:{flex:e.verticalLayout?"initial":ue(u)},required:e.getFormItemRequired(h)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:o,noStyle:!0,rules:h,validateTrigger:m,messageVariables:{label:e.getFormItemLabel(i)}},t().createElement(Ki,{option:this.props.option,multiple:r,items:n,onValuesChange:(t,r,n)=>{f(t,r,n),e.setViewValue(o,r)}}))),p&&t().createElement(P.Col,{flex:ue(p.labelWidth||hr)},e.renderFormItemExtra({fieldName:o,...p}))))}}qi(Mi,"contextType",mr);const Vi=Mi,zi=require("china-area-data");var Ui=n.n(zi);function Bi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Wi=["110000","120000","310000","500000"],Gi=["810000","820000"],Yi=[{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"}],Xi=[{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"}],Qi=e=>Gr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join(""),Zi=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!(r>2)&&e[t])return("86"===t?Object.keys(e[t]).filter((e=>![...Wi,...Gi].includes(e))):Object.keys(e[t])).map((n=>({l:Qi(e[t][n].slice(0,1)).toUpperCase(),n:e[t][n],c:n,p:t,children:Zi(e,n,r+1)})))},Ji=(e,t)=>t.map((t=>({l:Qi(e[86][t].slice(0,1)).toUpperCase(),n:e[86][t],c:t,p:"86",children:void 0})));class el extends e.Component{constructor(e){super(e),Bi(this,"searchRef",t().createRef()),Bi(this,"scrollRef",t().createRef()),Bi(this,"zxsAndGa",void 0),Bi(this,"provinces",void 0),Bi(this,"allCities",void 0),Bi(this,"letterCities",void 0),Bi(this,"state",{visible:!1,select_type:"0",active_key:""}),Bi(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),Bi(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)})),this.zxsAndGa=this.createZxsAndGa(),this.provinces=this.createProvince(),this.allCities=this.createAllCity(),this.letterCities=this.createCity()}componentDidMount(){this.setInputReadonly()}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}scrollHandle(e){this.setState({active_key:e}),Kt()(this[`${e}Ref`],{block:"start",behavior:"smooth",boundary:this.scrollRef.current})}clickHadnle(e){this.triggerChange(e)}createTextValue(e){return this.allCities.find((t=>t.c===e))?.n||""}createZxsAndGa(){return[{l:"Z1",n:"直辖市",c:"",p:"",children:Ji(Ui(),Wi)},{l:"Z2",n:"港澳",c:"",p:"",children:Ji(Ui(),Gi)}]}createProvince(){return(Zi(Ui(),"86")??[]).concat(this.zxsAndGa)}createAllCity(){const e=[];return this.provinces.forEach((t=>e.push(...t.children))),e}createCity(){return Xi.filter((e=>"Z1"!==e.value&&"Z2"!==e.value)).map((e=>({l:e.value,n:e.text,c:"",p:"",children:this.allCities.filter((e=>![...Wi,...Gi].includes(e.c))).filter((t=>t.l===e.value))}))).concat(this.zxsAndGa)}renderType(){const{select_type:e}=this.state;return t().createElement(P.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(P.Radio.Button,{value:"0"},p("qm.form.citySelectType.0")),t().createElement(P.Radio.Button,{value:"1"},p("qm.form.citySelectType.1")))}renderLetter(){const{active_key:e,select_type:r}=this.state;return("0"===r?Yi:Xi).map((r=>t().createElement("li",{key:r.value,className:Se()({tag:!0,actived:r.value===e}),onClick:()=>this.scrollHandle(r.value.toString())},r.text)))}renderSelect(){const{value:e}=this.props;return t().createElement(P.Select,{size:"small",placeholder:p("qm.form.selectPlaceholder"),style:{width:"200px"},showSearch:!0,filterOption:(e,t)=>(t?.children?.toString()||"").toLowerCase().indexOf(e.toLowerCase())>=0,value:e||void 0,onChange:e=>{this.triggerChange(e)}},this.allCities.map((e=>t().createElement(P.Select.Option,{key:e.c,value:e.c},e.n))))}renderCity(e){const{select_type:r}=this.state;return("0"===r?this.provinces:this.letterCities).map(((r,n)=>t().createElement("div",{key:n},t().createElement("dt",{ref:e=>this[`${r.l}Ref`]=e},r.n,":"),t().createElement("dd",null,r.children?.map((r=>t().createElement("li",{key:r.c,className:Se()({actived:r.c===e}),onClick:()=>this.clickHadnle(r.c)},r.n)))))))}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{fieldName:a,options:i={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,disabled:m}=this.props.option,h=Ce("form-city-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=this.createTextValue(n),b=t().createElement("div",{className:"container",style:{...o}},t().createElement("div",{className:"city-drop"},t().createElement("div",{className:"city-drop-toper"},t().createElement("div",{className:"city-drop-toper__type"},this.renderType()),t().createElement("div",{className:"city-drop-toper__search"},this.renderSelect())),t().createElement("div",{className:"city-drop-letter"},this.renderLetter()),t().createElement("div",{ref:this.scrollRef,className:"city-drop-list"},t().createElement("dl",null,this.renderCity(n)))));return t().createElement(l.Consumer,null,(n=>{const i={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Xr,{value:g,bordered:c}):t().createElement(Pa(),{action:m?[]:["click"],popupVisible:!m&&r,popup:b,popupClassName:Se()(i,`form-popper__${a}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Input,{ref:this.searchRef,placeholder:s,allowClear:u,bordered:c,readOnly:d,disabled:m,style:{width:"100%",...o},value:g,title:g,onChange:e=>{const{value:t}=e.target;this.triggerChange(t)}}))}))}}Bi(el,"contextType",mr);class tl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(el,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}Bi(tl,"contextType",mr);const rl=tl;function nl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const al=(e,t)=>{if(e[t])return Object.keys(e[t]).map((r=>({text:e[t][r],value:r,children:al(e,r)})))};class il extends e.Component{constructor(e){super(e),nl(this,"searchRef",t().createRef()),nl(this,"prevText",void 0),nl(this,"handleVisibleChange",(e=>{this.setState({visible:e})})),nl(this,"triggerChange",(e=>{const{onChange:t,onValuesChange:r}=this.props;t?.(e),r(e,this.createTextValue(e)),this.handleVisibleChange(!1)}));const r=al(Ui(),"86")||[];this.state={results:r,visible:!1,values:[],tabs:[r.map((e=>({text:e.text,value:e.value})))],activeName:"0"}}componentDidMount(){this.initial(),this.setInputReadonly()}componentDidUpdate(e){const{value:t}=e,{value:r}=this.props;t!==r&&this.state.values.join(",")!==(r??"")&&this.initial()}get isFetch(){return!!this.props.option.request?.fetchApi}get level(){let{selectLevel:e=0}=this.props.option.options||{};return(e<1||e>3)&&(e=3),this.isFetch?4:e}setInputReadonly(){this.searchRef.current?.input.setAttribute("readonly","readonly")}createTextValue(e){return(e?e.split(","):[]).map(((e,t)=>this.state.tabs[t]?.find((t=>t.value===e))?.text)).join("/")}initial(){const{value:e}=this.props,t=e?e.split(","):[];this.setState({values:t},(()=>{this.createTabs(),this.createActiveName(t.length?t.length-1:0)}))}createActiveName(e){this.setState({activeName:e.toString()})}createTabs(){const{results:e,values:t}=this.state;if(!e.length)return;const r=this.state.tabs.slice(0,1);for(let n=0;n<t.length;n++){const a=kr(e,t[n]);if(a&&se(a.children)){this.isFetch&&this.getStreetList(t[n]);break}Array.isArray(a?.children)&&(r[n+1]=a?.children.map((e=>({text:e.text,value:e.value}))))}this.setState({tabs:r})}async getStreetList(e){const{request:t={}}=this.props.option,{fetchApi:r,formatter:n=(e=>e),dataKey:a,valueKey:i="value",textKey:l="text"}=t;if(r)try{const t=await r(n({code:e}));if(200===t.code){const e=Array.isArray(t.data)?t.data:(0,J.get)(t.data,a)??[];this.setState((t=>({tabs:[...t.tabs,e.map((e=>({text:e[l],value:e[i]})))]})))}}catch(e){}}renderTabs(){const{values:e}=this.state,r=this.state.tabs.map(((r,n)=>{const a=r.find((t=>t.value===e[n]))?.text||`${p("qm.form.selectPlaceholder").replace("...","")}(${p("qm.form.regionSelectLabel")[n]})`;return t().createElement(er.TabPane,{key:n.toString(),tab:a},t().createElement("div",{className:"region-box"},r.map((r=>t().createElement("span",{key:r.value,className:Se()({"region-box__item":!0,actived:e.includes(r.value.toString())}),title:r.text,onClick:()=>{let{values:e}=this.state;e[n]=r.value.toString(),e=e.slice(0,n+1),this.setState({values:e},(()=>{const t=(e=>["810000","820000"].includes(e[0]))(e)?this.level<3?this.level:this.level-1:this.level;if(n+1>=t)return this.triggerChange(e.join(","));this.createTabs(),this.createActiveName(n+1)}))}},r.text)))))}));return r.length?t().createElement(er,{size:"small",activeKey:this.state.activeName,onChange:e=>{this.createActiveName(e)}},r):t().createElement(ht,null)}render(){const{$$form:e}=this.context,{visible:r}=this.state,{value:n}=this.props,{fieldName:a,options:i={},style:o={},placeholder:s=p("qm.form.selectPlaceholder"),bordered:c=!0,allowClear:u=!0,readOnly:d,disabled:m}=this.props.option,h=Ce("form-region-select"),f=this.searchRef.current?this.searchRef.current.input.parentNode.offsetWidth:300,g=t().createElement("div",{className:"container"},this.renderTabs());let b=this.prevText;if(!r){const e=this.createTextValue(n);(""===e||e.split("/").every((e=>""!==e)))&&(b=e,this.prevText=b)}return t().createElement(l.Consumer,null,(n=>{const i={[h]:!0,[`${h}--lg`]:"large"===n?.size,[`${h}--sm`]:"small"===n?.size};return e.isOnlyShow?t().createElement(Xr,{value:b,bordered:c}):t().createElement(Pa(),{action:m?[]:["click"],popupVisible:!m&&r,popup:g,popupClassName:Se()(i,`form-popper__${a}`),popupStyle:{minWidth:f},onPopupVisibleChange:this.handleVisibleChange,builtinPlacements:vr,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement(P.Input,{ref:this.searchRef,placeholder:s,allowClear:u,bordered:c,style:{width:"100%",...o},readOnly:d,disabled:m,value:b,title:b,onChange:e=>{const{value:t}=e.target;this.triggerChange(t),!t&&le((()=>this.initial()))}}))}))}}nl(il,"contextType",mr);class ll extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(il,{option:this.props.option,onValuesChange:(t,r)=>{m(t,r),e.setViewValue(i,r)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}nl(ll,"contextType",mr);const ol=ll,sl=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:u}=e.option,{multiple:d=!0,maxCount:m=1,fileTypes:h,fileSize:f,fileDirection:g,onPreview:b,onRemove:y}=l,{action:v,headers:x,params:E,withCredentials:S=!1,dataKey:C="",downloadWithHeaders:w,fieldAliasMap:N,beforeUpload:T,button:I}=o,R="function"==typeof N?N():N||{};return t().createElement(Gl,{name:"file",action:v,multiple:d,headers:x,data:E,withCredentials:S,downloadWithHeaders:w,beforeUpload:T,maxCount:m,fileTypes:h,fileSize:f,fileDirection:g,disabled:c,readOnly:r.isOnlyShow||u,button:I,showUploadList:{showDownloadIcon:!0,downloadIcon:t().createElement(we.DownloadOutlined,null)},fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&P.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(C?(0,J.get)(t.data,C):t.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onPreview:b,onRemove:y})};class cl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(sl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(cl,"contextType",mr);const ul=cl,dl=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o={},style:s={},disabled:c,readOnly:u}=e.option,{multiple:d=!0,maxCount:m=1,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,onRemove:v}=l,{action:x,headers:E,params:S,withCredentials:C=!1,dataKey:w="",popupClassName:N,fieldAliasMap:T,beforeUpload:I}=o,R="function"==typeof T?T():T||{};return t().createElement(to,{name:"file",action:x,multiple:d,headers:E,data:S,withCredentials:C,popupClassName:N,beforeUpload:I,maxCount:m,fixedSize:h,quality:f,openCropper:g,fileTypes:b,fileSize:y,disabled:c,readOnly:r.isOnlyShow||u,fileList:n,onChange:e=>{let{file:t,fileList:r}=e;(e=>{const t=e.map((e=>{const t=e.response||{},r={};for(const n in R)r[n]=e[n]||t.data?.[R[n]]||"";return e.response&&200!==t.code&&P.message.error(t.message||p("qm.uploadCropper.uploadError")),{uid:e.uid,name:e.name,...r,url:e.url||(w?(0,J.get)(t.data,w):t.data)||"",status:e.status}}));a?.(t),t.every((e=>"done"===e.status&&e.url))&&i(t)})(r)},onRemove:v})};class pl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(dl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,"")}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(pl,"contextType",mr);const ml=pl,hl=e=>{const{$$form:r}=t().useContext(mr),{value:n,onChange:a,onValuesChange:i}=e,{options:l={},upload:o,style:s={},readOnly:c,disabled:u=r.isFormDisabled}=e.option,{tinymce:d,thresholdSize:p,onResizeEditor:m}=l;return t().createElement(ql,{value:n,tinymce:d,upload:o,thresholdSize:p,style:{width:"100%",...s},disabled:u||c||r.isOnlyShow,onResizeEditor:m,onChange:e=>{(e=>{a?.(e),i(e)})(e)}})};class fl extends e.Component{render(){const{$$form:e}=this.context,{type:r,label:n,tooltip:a,fieldName:i,invisible:l,options:o={},labelWidth:s=e.props.labelWidth,className:c,extra:u,validateTrigger:d,rules:p=[],onChange:m=ne}=this.props.option;return t().createElement(P.Form.Item,{label:e.renderFormLabel(n),className:Se()(c),tooltip:a,hidden:l,labelCol:{flex:e.verticalLayout?"initial":ue(s)},required:e.getFormItemRequired(p)},t().createElement(P.Row,{wrap:!1,gutter:4},t().createElement(P.Col,{flex:"auto"},t().createElement(P.Form.Item,{name:i,noStyle:!0,rules:p,validateTrigger:d,messageVariables:{label:e.getFormItemLabel(n)}},t().createElement(hl,{option:this.props.option,onValuesChange:t=>{m(t),e.setViewValue(i,t)}}))),u&&t().createElement(P.Col,{flex:ue(u.labelWidth||hr)},e.renderFormItemExtra({fieldName:i,...u}))))}}!function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(fl,"contextType",mr);const gl=fl;function bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class yl extends e.Component{constructor(e){super(e),bl(this,"provide",{$$form:this,echo_data:{}}),bl(this,"_initialValues",void 0),bl(this,"_initialOthers",void 0),bl(this,"_initialExtras",void 0),bl(this,"_fieldAuth",{}),bl(this,"wrapperRef",t().createRef()),bl(this,"formRef",t().createRef()),bl(this,"originItems",[]),bl(this,"state",{formData:{},viewData:{},other:{},extra:{},expand:{},flexCols:this.props.cols??4,collapse:!!this.props.defaultExpand}),bl(this,"resizeObserveHandler",(()=>{const e=this.wrapperRef.current?.offsetWidth;if(void 0===e||0===e||this.props.cols>0)return;let t=Math.floor(e/300);t=24%t==0?t:t-1,t=t<1?1:t,t=t>8?8:t,t!==this.state.flexCols&&this.setState({flexCols:t})})),bl(this,"resizeListenerHandle",(0,J.debounce)(this.resizeObserveHandler,10)),bl(this,"getFormItems",pr()((e=>e.filter((e=>!e.noAuth&&!e.hidden))))),bl(this,"getFlattenItems",pr()((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}))),bl(this,"valuesChangeHandle",((e,t)=>{this.props.onValuesChange?.(e,this._initialValues)})),bl(this,"fieldsChangeHandle",((e,t)=>{this.props.onFieldsChange?.(e,t)})),bl(this,"finishHandle",(e=>{this.props.onFinish?.(Object.assign({},this.get_fields_other(),this.formatFormValue(e)))})),bl(this,"finishFailedHandle",(e=>{let{values:t,errorFields:r}=e;this.props.onFinishFailed?.(r)})),bl(this,"openValidateInfo",(e=>{const r=t().createElement("ul",null,e.map((e=>{const{label:r}=this.formItems.find((t=>t.fieldName===e.name[0]));return t().createElement("li",{key:e.name[0],style:{color:"#f5222d"}},"[",("string"==typeof r?`${r}: `:"")+e.errors.join(","),"]")})));P.notification.error({message:p("qm.form.validatePrompt"),description:r,duration:10})})),bl(this,"scrollToField",(e=>{if(!e)return;const t=this.wrapperRef.current.querySelector(`.${e}`);t&&Kt()(t,{scrollMode:"if-needed",block:"nearest",behavior:"smooth"})})),this.createOriginItems(),this.createInitialValues(),this.createInitialOthers(),this.createInitialExtras(),this.createFormAuth()}get $size(){return this.props.size??this.context.size??""}get verticalLayout(){return"vertical"===this.props.layout}get formItems(){return this.getFormItems(this.props.items)}get flattenItems(){return this.getFlattenItems(this.formItems)}get dividers(){return this.formItems.filter((e=>"DIVIDER"===e.type))}get isFilterType(){return"search"===this.props.formType}get isOnlyShow(){return"onlyShow"===this.props.formType}get isFormDisabled(){return this.props.disabled}get isCompactMode(){const e=this.context.global;return this.props.compactMode??("small"===this.$size&&!!e?.compactModeInSmallSize)}get showDividerCollapse(){return this.dividers.some((e=>!!e.collapse))}get showFilterCollapse(){return this.props.isCollapse&&this.formItems.length>=this.state.flexCols}componentDidMount(){this.checkFieldNames(),this.initialHandle(),this.createInputFocus(),this.bindResizeEvent(),this.resizeObserveHandler()}componentDidUpdate(e,t){this.props.items!==e.items&&this.checkFieldNames()}componentWillUnmount(){this.removeResizeEvent()}bindResizeEvent(){Et(this.wrapperRef.current,this.resizeListenerHandle)}removeResizeEvent(){St(this.wrapperRef.current,this.resizeListenerHandle)}initialHandle(){this.setState({formData:this.createFormValue(this.props.initialValues),other:this.createOtherValue(this.props.initialValues),extra:this.createExtraValue(this.props.initialExtras),expand:this.createDividerExpand()})}checkFieldNames(){const e=this.flattenItems.map((e=>e.fieldName));[...new Set(e)].length!==e.length&&g("Form","配置项 fieldName 属性是唯一的,不能重复")}getFormItemRequired(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).some((e=>e.required))}createOtherValue(e){const t=this.flattenItems.map((e=>e.fieldName)),r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return Object.assign({},r)}createExtraValue(e){const t={};return this.flattenItems.filter((e=>(0,J.isPlainObject)(e.extra))).forEach((r=>{t[r.fieldName]=e[r.fieldName]??""})),Object.assign({},t)}createDividerExpand(){const e={};return this.dividers.filter((e=>(0,J.isPlainObject)(e.collapse))).forEach((t=>{e[t.fieldName]=t.collapse.defaultExpand??!1})),Object.assign({},e)}getInitialValue(e,t){const{type:r,options:n}=e;return t=t??void 0,yr.includes(r)&&(t=t??[]),"CHECKBOX"!==r&&"SWITCH"!==r||(t=t??n?.falseValue??gr),t}createFormValue(e){const t={};return this.flattenItems.forEach((r=>{t[r.fieldName]=this.getInitialValue(r,e[r.fieldName])})),Object.assign({},e,t)}createInitialValues(){this._initialValues=this.createFormValue(this.props.initialValues)}createInitialOthers(){this._initialOthers=this.createOtherValue(this.props.initialValues)}createInitialExtras(){this._initialExtras=this.createExtraValue(this.props.initialExtras)}createOriginItems(){this.originItems=ce(this.props.items)}setViewValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t!==this.getViewValue(e)&&this.setState((r=>({viewData:Object.assign({},r.viewData,{[e]:t})})))}getViewValue(e){return this.state.viewData[e]??""}setExpandHandle(e){this.setState({collapse:e},(()=>{this.props.onCollapse?.(this.state.collapse)}))}createInputFocus(){const{isAutoFocus:e}=this.props;if(!e||this.isOnlyShow)return;const{type:t,fieldName:r}=this.formItems.filter((e=>e.fieldName))[0]||{};"INPUT"!==t&&"INPUT_NUMBER"!==t||!r||setTimeout((()=>this.CREATE_FOCUS(r)))}getFormItemLabel(e){if("string"==typeof e)return e;const{fieldName:t,label:r,options:n={}}=e;if("string"==typeof r)return r;const{itemList:a=[]}=n,i=this.formRef.current?.getFieldsValue([t])[t]??this._initialValues[t]??a[0]?.value;return a.find((e=>e.value===i))?.text||""}getBlockDerivedItems(){const e=[];for(let t=0,r=this.dividers.length;t<r;t++){const r=this.formItems.findIndex((e=>e===this.dividers[t]));let n=this.formItems.findIndex((e=>e===this.dividers[t+1]));n=n>-1?n:void 0,e.push(this.formItems.slice(r,n).map((e=>({label:e.label,fieldName:e.fieldName}))))}return e}getFormItemDisplay(e){let{type:t,fieldName:r}=e;if("DIVIDER"===t)return!0;const n=this.getBlockDerivedItems();for(let e=0,t=n.length;e<t;e++){const t=n[e],a=this.dividers.find((e=>e.fieldName===t[0].fieldName)),i=a?.collapse?.showLimit??t.length-1;for(let e=1;e<t.length;e++)if(t[e].fieldName===r&&e>i)return this.state.expand[t[0].fieldName]}return!0}formatFormValue(e){for(const t in e){const r=e[t];if(Ir(r)&&(e[t]=""),Array.isArray(r)&&r.forEach(((r,n)=>{Ir(r)&&(e[t][n]="")})),t.includes("|")&&Array.isArray(r)){const[n,a]=t.split("|");e[n]=r[0]??"",e[a]=r[1]??""}}if(this.isFilterType)for(const t in e)se(e[t])&&(e[t]=void 0);return e}setFieldAuth(e,t){this._fieldAuth[e]=t}async createFormAuth(){const{authConfig:e}=this.props;if(!e)return;let t=Z()(e,["fetch"]);if(e.fetch){const{api:r,params:n,dataKey:a}=e.fetch;try{const e=await r(n);200===e.code&&(t=(a?(0,J.get)(e.data,a):e.data)??{})}catch(e){}}if(Array.isArray(t.fieldList)){const e=this.props.items.map((e=>{const{fieldName:r}=e,n=t.fieldList.find((e=>e.dataIndex===r));if(n){const t=this.originItems.find((e=>e.fieldName===r)),{visible:a=1,disabled:i,secretName:l}=n;a||(e.noAuth=!0,t.noAuth=!0),i&&(e.disabled=!0,t.disabled=!0),l&&(e.options?e.options.secretType=l:e.options={secretType:l},t.options=Object.assign({},t.options,{secretType:l})),this.setFieldAuth(r,{visible:a,disabled:i,secretName:l})}return e}));this.props.fieldsChange?.(e)}}INPUT(e){return t().createElement(ia,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT(e){return t().createElement(sa,{option:e})}INPUT_NUMBER(e){return t().createElement(ha,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}RANGE_INPUT_NUMBER(e){return t().createElement(ba,{option:e})}SEARCH_HELPER(e){return t().createElement(Ca,{ref:t=>this[`${e.fieldName}_Ref`]=t,option:e})}MULTIPLE_SEARCH_HELPER(e){return t().createElement(Ha,{option:e})}TREE_TABLE_HELPER(e){return t().createElement(qa,{option:e})}MULTIPLE_TREE_TABLE_HELPER(e){return t().createElement(Ua,{option:e})}RANGE_SEARCH_HELPER(e){return t().createElement(Xa,{option:e})}CHECKBOX(e){return t().createElement(ln,{option:e})}MULTIPLE_CHECKBOX(e){return t().createElement(ei,{option:e})}RATE(e){return t().createElement(ni,{option:e})}RADIO(e){return t().createElement(oi,{option:e})}SWITCH(e){return t().createElement(ui,{option:e})}TEXT_AREA(e){return t().createElement(mi,{option:e})}DATE(e){return t().createElement(gi,{option:e})}RANGE_DATE(e){return t().createElement(xi,{option:e})}TIME(e){return t().createElement(Ci,{option:e})}RANGE_TIME(e){return t().createElement(Ti,{option:e})}SELECT(e){return t().createElement(rn,{option:e})}MULTIPLE_SELECT(e){return t().createElement(rn,{option:e,multiple:!0})}IMMEDIATE(e){return t().createElement(Pi,{option:e})}DIVIDER(e){return t().createElement(ki,{option:e})}TREE_SELECT(e){return t().createElement(Di,{option:e})}MULTIPLE_TREE_SELECT(e){return t().createElement(Di,{option:e,multiple:!0})}CASCADER(e){return t().createElement(Vi,{option:e})}MULTIPLE_CASCADER(e){return t().createElement(Vi,{option:e,multiple:!0})}CITY_SELECT(e){return t().createElement(rl,{option:e})}REGION_SELECT(e){return t().createElement(ol,{option:e})}UPLOAD_FILE(e){return t().createElement(ul,{option:e})}UPLOAD_IMG(e){return t().createElement(ml,{option:e})}TINYMCE(e){return t().createElement(gl,{option:e})}renderFormLabel(e){if(!(0,J.isPlainObject)(e))return e;const{type:r,fieldName:n,label:a,options:i={},onChange:l=ne}=e,{itemList:o=[]}=i;return"SELECT"===r?t().createElement(P.Form.Item,{name:n,noStyle:!0},t().createElement(en,{option:e,items:o,loading:!1,onValuesChange:(e,t)=>l(e,t)})):"CHECKBOX"===r?t().createElement(t().Fragment,null,t().createElement("span",{style:{paddingRight:5}},a),t().createElement(P.Form.Item,{name:n,noStyle:!0},t().createElement(nn,{option:e,onValuesChange:e=>l(e)}))):null}renderFormItemExtra(e){const{fieldName:r,isTooltip:n,style:a={},render:i}=e,{extra:l}=this.state;if(n)return t().createElement(P.Tooltip,{className:"extra-tooltip",title:l[r]},t().createElement(we.ExclamationCircleOutlined,{style:{marginLeft:4}}));const o=this.formItems.find((e=>e.fieldName===r));return t().createElement("div",{className:"extra-text",title:i?"":l[r],style:a},t().createElement("span",{className:"extra-overflow-cut"},i?i(o,this):l[r]))}renderFormItemButton(e,t){const r=this.formItems.find((t=>t.fieldName===e)),n="function"==typeof t?t(r):t;return this.isOnlyShow?null:n}renderFormItem(e){const{label:r,fieldName:n,invisible:a,tooltip:i,className:l,labelWidth:o=this.props.labelWidth,rules:s=[],style:c={},render:u}=e;return se(this.state.formData)?null:t().createElement(P.Form.Item,{label:this.renderFormLabel(r),name:n,rules:s,tooltip:i,hidden:a,className:Se()(l),style:{width:"100%",...c},labelCol:{flex:this.verticalLayout?"initial":ue(o)}},u?.(e,this))}createFormItem(e){return(0,J.isFunction)(this[e.type])?e.render?this.renderFormItem(e):this[e.type](e):(g("Form",`配置项 ${e.fieldName} 的 type 类型错误`),null)}createFormLayout(){const{flexCols:e}=this.state,{formType:r,defaultRows:n,isFieldsDefine:a}=this.props,i=[];this.formItems.forEach((e=>{const{offsetLeft:t=0,offsetRight:r=0}=e;for(let e=0;e<t;e++)i.push({});i.push(e);for(let e=0;e<r;e++)i.push({})}));const l=24/e,o=[],s=i.reduce(((e,t)=>{const{selfCol:r=1}=t,n=e+r;return o.push(n),n}),0),c=n>Math.ceil(s/e)?Math.ceil(s/e):n,u=[],d=i.map(((r,n)=>{let{selfCol:a=1}=r;const{type:i,fieldName:s}=r;a=a>=24||"DIVIDER"===i||"TINYMCE"===i?e:a;const d=!(!this.state.collapse&&this.showFilterCollapse)||o[n]<c*e,p=!this.showDividerCollapse||this.getFormItemDisplay(r);return d&&u.push(o[n]),t().createElement(P.Col,{key:s??n,className:s,span:a*l,style:this.isFilterType?{display:!this.showFilterCollapse||d?"block":"none"}:{display:p?"block":"none"}},i?this.createFormItem(ce(r)):null)}));return a&&"default"===r&&d.push(t().createElement("div",{className:"form-fields__define"},this.createFieldsDefine())),[...d,this.createSearchButtonLayout(u[u.length-1])]}createSearchButtonLayout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{flexCols:r,collapse:n}=this.state,{searchButtonCols:a,isSearchBtn:i,isFieldsDefine:l=!0}=this.props;if(!this.isFilterType)return null;const o=24/r,s=a||1,c=r-e%r-s;return i?t().createElement(P.Col,{key:"-",span:s*o,offset:c*o,style:{textAlign:"right"}},t().createElement(P.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,icon:t().createElement(we.SearchOutlined,null),onClick:()=>this.SUBMIT_FORM()},p("qm.form.search")),t().createElement(he,{size:this.$size,icon:t().createElement(we.ReloadOutlined,null),onClick:()=>this.RESET_FORM()},p("qm.form.reset")),l?this.createFieldsDefine():null,this.showFilterCollapse&&t().createElement("a",{onClick:()=>this.setExpandHandle(!n)},n?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(n?"qm.form.collect":"qm.form.spread")))):null}createFormButtonLayout(){const{flexCols:e}=this.state,{formType:r,isSubmitBtn:n}=this.props;if(this.isFilterType)return null;const a=24/e;return n&&"default"===r?t().createElement(P.Row,{gutter:0},t().createElement(P.Col,{key:"-",span:a},t().createElement(P.Form.Item,null,t().createElement(P.Space,{style:{marginBottom:12}},t().createElement(he,{type:"primary",size:this.$size,onClick:()=>this.SUBMIT_FORM()},p("qm.form.save")),t().createElement(he,{size:this.$size,onClick:()=>this.RESET_FORM()},p("qm.form.reset")))))):null}createFieldsDefine(){const{uniqueKey:e,items:r,fieldsChange:n}=this.props;return t().createElement(ta,{uniqueKey:e,items:r,fieldsChange:n})}set_fields_other(e){this.setState((t=>({other:Object.assign({},t.other,this.createOtherValue(e))})))}get_fields_other(e){if(!e)return this.state.other;const t={};return e.forEach((e=>{t[e]=this.state.other[e]})),t}formValidate(){return new Promise((async(e,t)=>{const[r,n]=await this.VALIDATE_FIELDS(),a=this.formItems.filter((e=>"SEARCH_HELPER"===e.type)).filter((e=>this[`${e.fieldName}_Ref`]?.searchRef._is_change)).map((e=>({name:[e.fieldName],errors:[p("qm.form.searchHelperTips")],warnings:[]})));r||a.length?t((r||[]).concat(a)):e(n)}))}SET_FIELDS_VALUE(e){this.formRef.current.setFieldsValue(e),this.set_fields_other(e)}GET_FIELDS_VALUE(e){return e?Object.assign({},this.get_fields_other(e),this.formRef.current.getFieldsValue(e)):Object.assign({},this.state.other,this.formRef.current.getFieldsValue(!0))}async GET_FORM_DATA(){try{const e=await this.formValidate();return[null,Object.assign({},this.get_fields_other(),this.formatFormValue(e))]}catch(e){return this.props.scrollToFirstError&&this.scrollToField(e[0].name[0]),[e,null]}}async VALIDATE_FIELDS(e){try{return[null,await this.formRef.current.validateFields(e)]}catch({errorFields:e}){return this.isCompactMode&&this.openValidateInfo(e),[e,null]}}SET_FIELDS_EXTRA(e){this.setState((t=>({extra:Object.assign({},t.extra,e)})))}SET_FIELDS_ECHO(e){Object.keys(e).length&&(Object.assign(this.provide,{echo_data:Object.assign({},this.provide.echo_data,e)}),this.forceUpdate())}GET_FIELDS_EXTRA(e){if(!e)return this.state.extra;const t={};return e.forEach((e=>{t[e]=this.state.extra[e]})),t}GET_FIELDS_TOUCHED(e){return this.formRef.current.isFieldsTouched(e)}async SUBMIT_FORM(){try{await this.formValidate(),this.formRef.current.submit()}catch(e){this.isFilterType&&this.setExpandHandle(!0)}}RESET_FORM(){const e=this.flattenItems.filter((e=>e.noReset)).map((e=>e.fieldName)),t=this.flattenItems.map((e=>e.fieldName)).filter((t=>!e.includes(t)));t.length&&this.formRef.current.resetFields(t),this.setState((e=>{const t=Object.keys(e.other),r=Object.keys(this._initialOthers),n=t.filter((e=>!r.includes(e))),a={};return n.forEach((e=>a[e]=void 0)),{other:Object.assign({},this._initialOthers,a)}})),this.setState({extra:Object.assign({},this._initialExtras)}),this.props.onReset?.()}CREATE_FOCUS(e){try{this[`${e}_Ref`].focus()}catch(e){g("Form","参数 `fieldName` 的值不正确或者该表单项不支持获得焦点")}}SET_FORM_ITEM(e,t,r){const{items:n,fieldsChange:a}=this.props,i=n.find((t=>t.fieldName===e));if(!i)return g("Form","SET_FORM_ITEM 方法参数 `fieldName` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Form","SET_FORM_ITEM 方法参数 `option` 的值不正确");if(i.noAuth)return g("Form","SET_FORM_ITEM 方法不能操作受权限控制的表单项");for(const r in t)r&&(Object.keys(this._fieldAuth).includes(e)&&"disabled"===r||(0,J.set)(i,r,t[r]));r&&(a?a([...n]):g("Form","需要设置 `fieldsChange` 参数"))}render(){const{className:e,style:r,layout:n,disabled:a,labelWidth:i,labelAlign:l,labelWrap:o,customClass:s}=this.props,c=Ce("form"),u={required:"${label}"+p("qm.form.requiredTips")},d={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}__only-show`]:this.isOnlyShow,[`${c}__compact`]:this.isCompactMode,[s]:!!s};return t().createElement("div",{ref:this.wrapperRef,className:Se()(d,e),style:r},t().createElement(P.Form,{ref:this.formRef,size:this.$size,initialValues:this._initialValues,layout:n,labelAlign:l,labelWrap:o,colon:!1,disabled:a,labelCol:{flex:this.verticalLayout?"initial":ue(i)},validateMessages:u,onValuesChange:this.valuesChangeHandle,onFieldsChange:this.fieldsChangeHandle,onFinish:this.finishHandle,onFinishFailed:this.finishFailedHandle},t().createElement(mr.Provider,{value:this.provide},t().createElement(P.Row,{gutter:this.verticalLayout?20:0},this.createFormLayout()),this.createFormButtonLayout())))}}bl(yl,"contextType",l),bl(yl,"propTypes",Cr),bl(yl,"defaultProps",wr);const vl=yl,xl={onActivate:r.func,onAddUndo:r.func,onBeforeAddUndo:r.func,onBeforeExecCommand:r.func,onBeforeGetContent:r.func,onBeforeRenderUI:r.func,onBeforeSetContent:r.func,onBeforePaste:r.func,onBlur:r.func,onChange:r.func,onClearUndos:r.func,onClick:r.func,onContextMenu:r.func,onCommentChange:r.func,onCopy:r.func,onCut:r.func,onDblclick:r.func,onDeactivate:r.func,onDirty:r.func,onDrag:r.func,onDragDrop:r.func,onDragEnd:r.func,onDragGesture:r.func,onDragOver:r.func,onDrop:r.func,onExecCommand:r.func,onFocus:r.func,onFocusIn:r.func,onFocusOut:r.func,onGetContent:r.func,onHide:r.func,onInit:r.func,onKeyDown:r.func,onKeyPress:r.func,onKeyUp:r.func,onLoadContent:r.func,onMouseDown:r.func,onMouseEnter:r.func,onMouseLeave:r.func,onMouseMove:r.func,onMouseOut:r.func,onMouseOver:r.func,onMouseUp:r.func,onNodeChange:r.func,onObjectResizeStart:r.func,onObjectResized:r.func,onObjectSelected:r.func,onPaste:r.func,onPostProcess:r.func,onPostRender:r.func,onPreProcess:r.func,onProgressState:r.func,onRedo:r.func,onRemove:r.func,onReset:r.func,onSaveContent:r.func,onSelectionChange:r.func,onSetAttrib:r.func,onSetContent:r.func,onShow:r.func,onSubmit:r.func,onUndo:r.func,onVisualAid:r.func,onSkinLoadError:r.func,onThemeLoadError:r.func,onModelLoadError:r.func,onPluginLoadError:r.func,onIconsLoadError:r.func,onLanguageLoadError:r.func},El={apiKey:r.string,id:r.string,inline:r.bool,init:r.object,initialValue:r.string,onEditorChange:r.func,value:r.string,tagName:r.string,cloudChannel:r.string,plugins:r.oneOfType([r.string,r.array]),toolbar:r.oneOfType([r.string,r.array]),disabled:r.bool,textareaName:r.string,tinymceScriptSrc:r.string,rollback:r.oneOfType([r.number,r.oneOf([!1])]),scriptLoading:r.shape({async:r.bool,defer:r.bool,delay:r.number}),...xl},Sl=e=>"function"==typeof e,Cl=e=>e in xl,wl=e=>e.substr(2),Nl=(e,t,r,n,a)=>((t,r,n,a,i,l,o)=>{const s=Object.keys(i).filter(Cl),c=Object.keys(l).filter(Cl),u=s.filter((e=>void 0===l[e])),d=c.filter((e=>void 0===i[e]));u.forEach((e=>{const t=wl(e),r=o[t];n(t,r),delete o[t]})),d.forEach((n=>{const a=((t,r)=>n=>t(r)?.(n,e))(t,n),i=wl(n);o[i]=a,r(i,a)}))})(a,e.on.bind(e),e.off.bind(e),0,t,r,n);let Tl=0;const Il=e=>{const t=Date.now(),r=Math.floor(1e9*Math.random());return Tl++,e+"_"+r+Tl+String(t)},Rl=e=>null!==e&&("textarea"===e.tagName.toLowerCase()||"input"===e.tagName.toLowerCase()),Ol=e=>void 0===e||""===e?[]:Array.isArray(e)?e:e.split(" "),Pl=(e,t)=>{void 0!==e&&(null!=e.mode&&"object"==typeof e.mode&&"function"==typeof e.mode.set?e.mode.set(t):e.setMode(t))},Al=()=>({listeners:[],scriptId:Il("tiny-script"),scriptLoading:!1,scriptLoaded:!1}),kl=(()=>{let e=Al();return{load:(t,r,n,a,i,l)=>{const o=()=>((t,r,n,a,i,l)=>{const o=r.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.id=t,o.src=n,o.async=a,o.defer=i;const s=()=>{o.removeEventListener("load",s),e.listeners.forEach((e=>e())),e.scriptLoaded=!0};o.addEventListener("load",s),r.head&&r.head.appendChild(o)})(e.scriptId,t,r,n,a);e.scriptLoaded?l():(e.listeners.push(l),e.scriptLoading||(e.scriptLoading=!0,i>0?setTimeout(o,i):o()))},reinitialize:()=>{e=Al()}}})(),Fl=e=>{const t=e;return t&&t.tinymce?t.tinymce:null};function Hl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ll extends e.Component{constructor(t){var r;super(t),r=this,Hl(this,"editor",void 0),Hl(this,"id",void 0),Hl(this,"elementRef",void 0),Hl(this,"inline",void 0),Hl(this,"currentContent",void 0),Hl(this,"boundHandlers",void 0),Hl(this,"rollbackTimer",void 0),Hl(this,"valueCursor",void 0),Hl(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})),Hl(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){}})),Hl(this,"handleBeforeInputSpecial",(e=>{"Enter"!==e.key&&"Backspace"!==e.key&&"Delete"!==e.key||this.handleBeforeInput(e)})),Hl(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))}})),Hl(this,"handleEditorChangeSpecial",(e=>{"Backspace"!==e.key&&"Delete"!==e.key||this.handleEditorChange(e)})),Hl(this,"initialise",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=r.elementRef.current;if(!t)return;if(!(e=>{if(!("isConnected"in Node.prototype)){let t=e,r=e.parentNode;for(;null!=r;)t=r,r=t.parentNode;return t===e.ownerDocument}return e.isConnected})(t)){if(0===e)setTimeout((()=>r.initialise(1)),1);else{if(!(e<100))throw new Error("tinymce can only be initialised when in a document");setTimeout((()=>r.initialise(e+1)),100)}return}const n=Fl(r.view);if(!n)throw new Error("tinymce should have been loaded into global scope");const a={...r.props.init,selector:void 0,target:t,readonly:r.props.disabled,inline:r.inline,plugins:(i=r.props.init?.plugins,l=r.props.plugins,Ol(i).concat(Ol(l))),toolbar:r.props.toolbar??r.props.init?.toolbar,setup:e=>{r.editor=e,r.bindHandlers({}),r.inline&&!Rl(t)&&e.once("PostRender",(t=>{e.setContent(r.getInitialValue(),{no_events:!0})})),r.props.init&&Sl(r.props.init.setup)&&r.props.init.setup(e)},init_instance_callback:e=>{const t=r.getInitialValue();r.currentContent=r.currentContent??e.getContent(),r.currentContent!==t&&(r.currentContent=t,e.setContent(t),e.undoManager.clear(),e.undoManager.add(),e.setDirty(!1));const n=r.props.disabled??!1;Pl(r.editor,n?"readonly":"design"),r.props.init&&Sl(r.props.init.init_instance_callback)&&r.props.init.init_instance_callback(e)}};var i,l;r.inline||(t.style.visibility=""),Rl(t)&&(t.value=r.getInitialValue()),n.init(a)})),this.id=this.props.id||Il("tiny-react"),this.elementRef=e.createRef(),this.inline=this.props.inline??this.props.init?.inline??!1,this.boundHandlers={}}get view(){return this.elementRef.current?.ownerDocument.defaultView??window}componentDidUpdate(e){if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(e),this.editor.initialized)){if(this.currentContent=this.currentContent??this.editor.getContent(),"string"==typeof this.props.initialValue&&this.props.initialValue!==e.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if("string"==typeof this.props.value&&this.props.value!==this.currentContent){const e=this.editor;e.undoManager.transact((()=>{let t;if(!this.inline||e.hasFocus())try{t=e.selection.getBookmark(3)}catch(e){}const r=this.valueCursor;if(e.setContent(this.props.value),!this.inline||e.hasFocus())for(const n of[t,r])if(n)try{e.selection.moveToBookmark(n),this.valueCursor=n;break}catch(e){}}))}if(this.props.disabled!==e.disabled){const e=this.props.disabled??!1;Pl(this.editor,e?"readonly":"design")}}}componentDidMount(){null!==Fl(this.view)?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&kl.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),this.props.scriptLoading?.async??!1,this.props.scriptLoading?.defer??!1,this.props.scriptLoading?.delay??0,this.initialise)}componentWillUnmount(){const e=this.editor;e&&(e.off(this.changeEvents(),this.handleEditorChange),e.off(this.beforeInputEvent(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach((t=>{e.off(t,this.boundHandlers[t])})),this.boundHandlers={},e.remove(),this.editor=void 0)}render(){return this.inline?this.renderInline():this.renderIframe()}changeEvents(){const e=Fl(this.view)?.Env?.browser?.isIE();return e?"change keyup compositionend setcontent CommentChange":"change input compositionend setcontent CommentChange"}beforeInputEvent(){return window.InputEvent&&"function"==typeof InputEvent.prototype.getTargetRanges?"beforeinput SelectionChange":"SelectionChange"}renderInline(){const{tagName:t="div"}=this.props;return e.createElement(t,{ref:this.elementRef,id:this.id})}renderIframe(){return e.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})}getScriptSrc(){if("string"==typeof this.props.tinymceScriptSrc)return this.props.tinymceScriptSrc;{const e=this.props.cloudChannel;return`https://cdn.tiny.cloud/1/${this.props.apiKey?this.props.apiKey:"no-api-key"}/tinymce/${e}/tinymce.min.js`}}getInitialValue(){return"string"==typeof this.props.initialValue?this.props.initialValue:"string"==typeof this.props.value?this.props.value:""}bindHandlers(e){if(void 0!==this.editor){Nl(this.editor,e,this.props,this.boundHandlers,(e=>this.props[e]));const t=e=>void 0!==e.onEditorChange||void 0!==e.value,r=t(e),n=t(this.props);!r&&n?(this.editor.on(this.changeEvents(),this.handleEditorChange),this.editor.on(this.beforeInputEvent(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):r&&!n&&(this.editor.off(this.changeEvents(),this.handleEditorChange),this.editor.off(this.beforeInputEvent(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}}}function $l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Hl(Ll,"propTypes",El),Hl(Ll,"defaultProps",{cloudChannel:"6"});var _l=function(e){return e["zh-cn"]="zh_CN",e["zh-tw"]="zh_TW",e.en="en",e}(_l||{});class Dl extends e.Component{constructor(){super(...arguments),$l(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 quickbars emoticons",menubar:"file edit view insert format tools table help",toolbar:"undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl"})}render(){const{size:e,className:r,style:n,tinymce:a={},upload:i={},thresholdSize:l=.5,tinymceScriptSrc:o,disabled:s,value:c,onResizeEditor:u,onChange:d}=this.props,m=this.context.global,h=this.context.locale,f=e||this.context.size||"",g=Ce("tinymce"),b={[g]:!0,[`${g}--lg`]:"large"===f,[`${g}--sm`]:"small"===f},y={init:{height:a.height||this.defaultOption.height,plugins:a.plugins||this.defaultOption.plugins,toolbar:a.toolbar||this.defaultOption.toolbar,menubar:a.menubar||this.defaultOption.menubar,font_family_formats:"微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",font_size_formats:"10px 12px 14px 16px 18px 20px 24px 36px 48px 56px 72px",language:_l[h],skin:"tinymce-5",...Z()(a,["height","plugins","toolbar","menubar"]),images_upload_handler:e=>new Promise((async(t,r)=>{const{action:n,headers:a,withCredentials:o,dataKey:s}=i,c=`data:image/jpeg;base64,${e.base64()}`,u=new FormData;u.append("file",e.blob(),e.filename());const d=e.blob().size;if(n&&d/1024/1024>l)try{const{data:e}=await kt().post(n,u,{headers:a,withCredentials:o});200===e.code&&t(s?(0,J.get)(e.data,s):e.data)}catch(e){P.message.error(p("qm.uploadCropper.uploadError"))}else t(c)})),setup:e=>{e.on("ResizeEditor",(t=>{const{offsetWidth:r,offsetHeight:n}=e.editorContainer;u?.({width:r,height:n},t)}))}},value:c,disabled:s,tinymceScriptSrc:o||m?.tinymce?.scriptSrc||void 0,onEditorChange:(e,t)=>{d?.(t.getContent(),t)}};return t().createElement("div",{className:Se()(b,r),style:n},t().createElement(Ll,y))}}$l(Dl,"contextType",l),$l(Dl,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Tinymce","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")}});const ql=Dl,jl=require("cropperjs");var Kl=n.n(jl);function Ml(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Vl extends e.Component{constructor(){super(...arguments),Ml(this,"imgRef",t().createRef()),Ml(this,"cropper",void 0)}componentDidMount(){const{className:e,style:t,src:r,alt:n,imgStyle:a,...i}=this.props,l={};for(const e in i)void 0!==this.props[e]&&(l[e]=this.props[e]);this.cropper=new(Kl())(this.imgRef.current,l)}componentWillUnmount(){this.destroy(),this.cropper=null}reset(){return this.cropper.reset()}clear(){return this.cropper.clear()}initCrop(){return this.cropper.crop()}replace(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.cropper.replace(e,t)}enable(){return this.cropper.enable()}disable(){return this.cropper.disable()}destroy(){return this.cropper.destroy()}move(e,t){return this.cropper.move(e,t)}moveTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.moveTo(e,t)}relativeZoom(e,t){return this.cropper.zoom(e,t)}zoomTo(e,t){return this.cropper.zoomTo(e,t)}rotate(e){return this.cropper.rotate(e)}rotateTo(e){return this.cropper.rotateTo(e)}scaleX(e){return this.cropper.scaleX(e)}scaleY(e){return this.cropper.scaleY(e)}scale(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.cropper.scale(e,t)}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.cropper.getData(e)}setData(e){return this.cropper.setData(e)}getContainerData(){return this.cropper.getContainerData()}getImageData(){return this.cropper.getImageData()}getCanvasData(){return this.cropper.getCanvasData()}setCanvasData(e){return this.cropper.setCanvasData(e)}getCropBoxData(){return this.cropper.getCropBoxData()}setCropBoxData(e){return this.cropper.setCropBoxData(e)}getCroppedCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.cropper.getCroppedCanvas(e)}setAspectRatio(e){return this.cropper.setAspectRatio(e)}setDragMode(e){return this.cropper.setDragMode(e)}render(){const{className:e,style:r,src:n,alt:a,imgStyle:i}=this.props,l={[Ce("cropper")]:!0};return t().createElement("div",{className:Se()(l,e),style:r},t().createElement("img",{ref:this.imgRef,src:n,alt:a,style:{maxWidth:"100%",...i}}))}}Ml(Vl,"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 zl=Vl;function Ul(){return Ul=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ul.apply(this,arguments)}function Bl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wl extends e.Component{constructor(){super(...arguments),Bl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,maxCount:l,fileList:o=[],beforeUpload:s}=this.props,c=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),u=!i||e.size/1024/1024<i,d=!(l>1)||o.length<l,m=c&&u&&d;if(c||P.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),u||P.message.warning(p("qm.upload.sizeLimit",{size:i})),d||P.message.warning(p("qm.upload.countLimit",{count:l})),!m)return m||P.Upload.LIST_IGNORE;if(s){const a=s(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Bl(this,"doDownload",(async e=>{try{e.url&&await this.downloadFile(e.url,e.name)}catch(e){P.message.error(p("qm.download.error"))}}))}get $size(){return this.context.size??""}async downloadFile(e,t){const r=this.props.downloadWithHeaders?{headers:this.props.headers}:null,n=await kt()({url:e,...r,responseType:"blob",timeout:0}),a=n.data,i=n.headers["content-disposition"],l=t||(i?i.split(";")[1].split("filename=")[1]:e.slice(e.lastIndexOf("/")+1));Ft(a,l)}render(){const{fileList:e=[],button:r={},fileDirection:n,disabled:a,readOnly:i,className:l,onPreview:o,onChange:s}=this.props,c=Ce("upload-file"),u={[c]:!0,[`${c}--lg`]:"large"===this.$size,[`${c}--sm`]:"small"===this.$size,[`${c}--horizontal`]:"horizontal"===n};return t().createElement(P.Upload,Ul({className:Se()(u,l)},Z()(this.props,["fileTypes","fileSize","button"]),{beforeUpload:this.beforeUpload,disabled:a||i,onChange:s,onPreview:async e=>{if("function"==typeof o)return o(e,(t=>this.doDownload(t||e)));a||await this.doDownload(e)},onDownload:async e=>{await this.doDownload(e)}}),this.props.children||i&&e.length?this.props.children:t().createElement(P.Button,{type:r.type??"default",icon:r.icon??t().createElement(we.UploadOutlined,null),disabled:a||i},r.text||p("qm.upload.text")))}}Bl(Wl,"contextType",l),Bl(Wl,"defaultProps",{name:"file",multiple:!0,fileDirection:"vertical",showUploadList:{showPreviewIcon:!0,showDownloadIcon:!0,showRemoveIcon:!0}});const Gl=Wl;function Yl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Xl extends e.Component{constructor(){super(...arguments),Yl(this,"cropperRef",t().createRef()),Yl(this,"beforeUploadRef",void 0),Yl(this,"fileRef",void 0),Yl(this,"resolveRef",void 0),Yl(this,"rejectRef",void 0),Yl(this,"state",{src:""}),Yl(this,"confirmHandle",(async()=>{const{quality:e}=this.props,{type:t,name:r,uid:n}=this.fileRef;this.cropperRef.current.getCroppedCanvas({maxWidth:1920,fillColor:"image/png"===t?"transparent":"#fff",imageSmoothingEnabled:!1,imageSmoothingQuality:"high"}).toBlob((async e=>{let a=new File([e],r,{type:t});Object.assign(a,{uid:n});const{fileTypes:i=[],fileSize:l}=this.props;if(i.length&&!i.includes(a.name.slice(a.name.lastIndexOf(".")+1).toLowerCase()))return P.message.warning(p("qm.upload.tooltip",{type:i.join(",")})),this.rejectRef("file type is error");if("function"!=typeof this.beforeUploadRef)return this.resolveRef(a);const o=this.beforeUploadRef(a,[a]);if("boolean"==typeof o||o){if(!0===o)return this.resolveRef(a);if(!1===o)return this.rejectRef("not upload");if(o&&"function"==typeof o.then)try{const e=await o,t=Object.prototype.toString.call(e);"[object File]"!==t&&"[object Blob]"!==t||(a=e),this.resolveRef(a)}catch(e){this.rejectRef(e)}}else g("CropperPreview","`beforeUpload` 必须返回 `boolean` 或 `Promise` 类型")}),t,e),await ie(100),this.onClose()})),Yl(this,"onOk",(()=>{this.confirmHandle()})),Yl(this,"onClose",(()=>{this.setSrc("")}))}get previewSize(){const{fixedSize:e}=this.props;return{width:"380px",height:e?`calc(380px * ${e[1]/e[0]})`:"auto"}}setSrc(e){this.setState({src:e})}renderUpload(){const{children:e,beforeCrop:r}=this.props,n=Array.isArray(e)?e[0]:e;if(!n)return null;const{beforeUpload:a,...i}=n.props;return this.beforeUploadRef=a,t().createElement(n.type,{...i,beforeUpload:(e,t)=>new Promise((async(n,a)=>{const i=()=>n(P.Upload.LIST_IGNORE);if(r&&!await r(e,t))return void i();this.fileRef=e,this.resolveRef=n,this.rejectRef=i;const l=new FileReader;l.onload=()=>{this.setSrc(l.result),l.onload=null},l.readAsDataURL(e)}))})}scaleHandle(e){this.cropperRef.current.relativeZoom(e,void 0)}rotateHandle(e){this.cropperRef.current.rotate(e)}renderCropper(){const{fixedSize:e}=this.props;return t().createElement("div",{className:"cropper-preview"},t().createElement("div",{className:"cropper-area"},t().createElement("div",{className:"img-cropper"},t().createElement(zl,{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(P.Space,{size:"small"},t().createElement(P.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomInOutlined,null),onClick:()=>this.scaleHandle(.2)},p("qm.uploadCropper.zoomIn")),t().createElement(P.Button,{type:"primary",size:"middle",icon:t().createElement(we.ZoomOutOutlined,null),onClick:()=>this.scaleHandle(-.2)},p("qm.uploadCropper.zoomOut")),t().createElement(P.Button,{type:"primary",size:"middle",icon:t().createElement(we.RotateRightOutlined,null),onClick:()=>this.rotateHandle(90)},p("qm.uploadCropper.rotatePlus")),t().createElement(P.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{className:e}=this.props,{src:r}=this.state,n=Ce("cropper-preview");return t().createElement(t().Fragment,null,this.renderUpload(),r&&t().createElement(P.Modal,{open:!0,wrapClassName:Se()(n,e),title:p("qm.uploadCropper.cropper"),width:790,bodyStyle:{padding:10},onOk:this.onOk,onCancel:this.onClose,maskClosable:!1,destroyOnClose:!0},this.renderCropper()))}}Yl(Xl,"contextType",l);const Ql=Xl;function Zl(){return Zl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zl.apply(this,arguments)}function Jl(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eo extends e.Component{constructor(){super(...arguments),Jl(this,"state",{previewVisible:!1,currentIndex:0}),Jl(this,"beforeUpload",((e,t)=>new Promise((async(r,n)=>{const{fileTypes:a=[],fileSize:i,beforeUpload:l}=this.props,o=!a.length||a.includes(e.name.slice(e.name.lastIndexOf(".")+1).toLowerCase()),s=!i||e.size/1024/1024<i,c=o&&s;if(o||P.message.warning(p("qm.upload.tooltip",{type:a.join(",")})),s||P.message.warning(p("qm.upload.sizeLimit",{size:i})),!c)return c||P.Upload.LIST_IGNORE;if(l){const a=l(e,t);if(!0===a)return r(e);if(!1===a)return n("not upload");if(a&&"function"==typeof a.then)try{r(await a)}catch(e){n(e)}}else r(e)})))),Jl(this,"handlePreview",(e=>{this.setState({currentIndex:this.props.fileList?.findIndex((t=>t.url===e.url))||0,previewVisible:!0})}))}get $size(){return this.context.size??""}get showUploadButton(){const e=this.props.fileList?.length??0;return!this.props.maxCount||e<this.props.maxCount}render(){const{previewVisible:e,currentIndex:r}=this.state,{fileList:n=[],fixedSize:a,quality:i,fileTypes:l,fileSize:o,disabled:s,readOnly:c,className:u,popupClassName:d,openCropper:m,beforeCrop:h}=this.props,f=Ce("upload-img"),g={[f]:!0,[`${f}--lg`]:"large"===this.$size,[`${f}--sm`]:"small"===this.$size},b=t().createElement(P.Upload,Zl({className:Se()(g,u)},Z()(this.props,["fileTypes","fileSize","fixedSize","quality"]),{beforeUpload:this.beforeUpload,disabled:s||c,onPreview:this.handlePreview}),!this.showUploadButton||c&&n.length?null:t().createElement("div",null,t().createElement(we.PlusOutlined,null),t().createElement("p",null,p("qm.uploadCropper.dragableText"))));return t().createElement(t().Fragment,null,m?t().createElement(Ql,{className:d,fixedSize:a,quality:i,fileTypes:l,fileSize:o,beforeCrop:h},b):b,t().createElement("div",{style:{display:"none"}},t().createElement(P.Image.PreviewGroup,{preview:{visible:e,current:r,rootClassName:d,onVisibleChange:e=>{this.setState({previewVisible:e})}}},n.map((e=>t().createElement(P.Image,{key:e.uid,src:e.url,alt:""}))))))}}Jl(eo,"contextType",l),Jl(eo,"defaultProps",{name:"file",multiple:!0,accept:"image/*",listType:"picture-card",quality:1,openCropper:!0});const to=eo,ro=(e,t,r)=>{let n;for(let a=0;a<e.length;a++){const i=e[a];if(i.children)if(i.children.some((e=>e[r]===t)))n=i[r];else{const e=ro(i.children,t,r);e&&(n=e)}}return n},no=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&no(e.children,t),t(e)||e.children&&e.children.length))),ao=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...ao(e.children,t)),t(e)&&r.push(e)})),r},io=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=io(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},lo=(e,t,r,n)=>e.map((e=>e[r]===t?{...e,children:n}:e.children?{...e,children:lo(e.children,t,r,n)}:e)),oo=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...oo(e.children,t)),Array.isArray(e.children)&&e.children.length&&r.push(e[t])})),r},so=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][r]===t)return[t];if(Array.isArray(e[n].children)){const a=so(e[n].children,t,r);if(a)return[e[n][r],a].flat()}}},co=(e,t)=>{const r=e.children?.map((e=>e[t]))||[];return Array.isArray(e.children)&&e.children.forEach((e=>r.push(...co(e,t)))),r},uo=t().forwardRef(((e,r)=>{const{className:n,style:a,filterable:i=!0,multiple:o,draggable:s,dataSource:c,fetch:u,asyncLoad:d,checkStrictly:m,checkStrategy:h="SHOW_CHILD",placeholder:f=p("qm.form.inputPlaceholder"),fieldsDefine:g,value:b,height:y,defaultSelectedKeys:v=[],defaultExpandAll:x=!0,showSearchBar:E=!0,showCollapse:S=!0,onSelectChange:C,onCheckChange:w,onDragStart:N,onDragChange:T,onExpand:I}=e,{size:R}=t().useContext(l),O=t().useMemo((()=>e.size??R??""),[e.size,R]),A=g?.valueKey||"value",k=g?.textKey||"text",F=(g?.children,t().useRef(null)),H=Ct(F),[L,$]=t().useState(y),[_,D]=t().useState(!1),q=wt((()=>{$(F.current.offsetHeight-Z.current.offsetHeight-10)}),5);qe((()=>{y||q()}),[H.height]);const[j,K]=t().useState([]),[M,V]=t().useState({}),[z,U]=t().useState([]),[B,W]=t().useState([]),[G,Y]=t().useState(""),[X,Q]=t().useState(x),Z=t().useRef(null),ee=t().useRef([]),te=t().useRef([]);t().useEffect((()=>{Array.isArray(c)&&(re(c),U(ne(c)),V({}))}),[c]),t().useEffect((()=>{le()}),[]),qe((()=>{le()}),[u?.params]),qe((()=>{W(ie())}),[M]),t().useImperativeHandle(r,(()=>({INSERT_RECORD:(e,t)=>{const r=Array.isArray(t)?t:[t],n=io(j,(t=>e===t[A]));n&&(Array.isArray(n.children)?n.children.push(...r):n.children=[...r],re([...j]))},REMOVE_RECORD:e=>{const t=ro(j,e,A);if(void 0===t&&j.find((t=>t[A]===e)))re(j.filter((t=>t[A]!==e)));else{const r=io(j,(e=>t===e[A]));if(!r)return;const n=r.children?.findIndex((t=>e===t[A]));n>=0&&(r.children.splice(n,1),re([...j]))}},UPDATE_RECORD:(e,t)=>{const r=io(j,(t=>e===t[A]));r&&((0,J.merge)(r,t),re([...j]))}})));const re=e=>{K(e),ee.current=e,te.current=oo(e,A)},ne=e=>{if(o)return v;const t=ao(e,(e=>v.includes(e[k])));return 1===t.length?[t[0][A]]:[]},ae=e=>so(j,e,A)?.slice(0,-1)||[],ie=()=>{if(x)return te.current;const e=[];return z.forEach((t=>{if(o){if("SHOW_ALL"===h&&!te.current.includes(t)&&e.push(...ae(t)),"SHOW_CHILD"===h&&e.push(...ae(t)),"SHOW_PARENT"===h){const r=kr(j,t);if(r){const n=ae(t),a=co(r,A);e.push(...n,...[t,...a].filter((e=>te.current.includes(e))))}}}else e.push(...ae(t))})),[...new Set(e)]},le=async()=>{if(!u)return;const{api:e,params:t,dataKey:r,callback:n}=u;try{D(!0);const a=await e(t);if(200===a.code){const e=Array.isArray(a.data)?a.data:(0,J.get)(a.data,r)??[];re(e),U(ne(e)),V({}),n?.(e)}}catch(e){}D(!1)},oe=e=>`${e}|${Gr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,se=Ce("search-tree"),ce={[se]:!0,[`${se}--lg`]:"large"===O,[`${se}--sm`]:"small"===O};return t().createElement("div",{ref:F,className:Se()(ce,n),style:a},t().createElement("div",{ref:Z,className:"topper"},E&&t().createElement(P.Input.Search,{value:G,size:O,placeholder:f,allowClear:!0,onChange:e=>(e=>{if(!i)return;const t=no(ee.current,(t=>{if(!e)return!0;const r=t[k]||"";return-1!==oe(r).indexOf(e)}));Y(e),K(t),x||e?W(oo(t,A)):V({})})(e.target.value)}),S&&t().createElement("a",{className:"trigger",onClick:()=>{Q(!X),W(X?[]:te.current)}},X?t().createElement(we.UpOutlined,null):t().createElement(we.DownOutlined,null)," ",p(X?"qm.form.collect":"qm.form.spread"))),t().createElement(gt,{spinning:_},t().createElement(P.Tree,{fieldNames:{title:k,key:A,children:"children"},multiple:o,draggable:s,blockNode:s,checkable:o,selectable:!o,height:L,disabled:e.disabled,checkStrictly:m,selectedKeys:b??z,checkedKeys:b??z,expandedKeys:B,treeData:j,loadData:d?async e=>{let{key:t,children:r}=e;if(!u||r)return;const{api:n,params:a,dataKey:i,formatter:l=(e=>e)}=u;try{const e=await n(l({...a,[A]:t}));if(200===e.code){const r=Array.isArray(e.data)?e.data:(0,J.get)(e.data,i)??[],n=lo(ee.current,t,A,r);re(n)}}catch(e){}}:void 0,titleRender:e.titleRender,filterTreeNode:e=>{if(!G)return!1;const t=e[k]||"";return-1!==oe(t).indexOf(G)},onDragStart:N,onDragEnter:e=>{W(e.expandedKeys)},onDrop:e=>{const t=e.node.key,r=e.dragNode.key,n=e.node.pos.split("-"),a=e.dropPosition-Number(n[n.length-1]),i=(e,t,r)=>{for(let n=0;n<e.length;n++){if(e[n][A]===t)return r(e[n],n,e);e[n].children&&i(e[n].children,t,r)}},l=[...j];let o;if(i(l,r,((e,t,r)=>{r.splice(t,1),o=e})),e.dropToGap)if((e.node.children||[]).length>0&&e.node.expanded&&1===a)i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));else{let e,r=[];i(l,t,((t,n,a)=>{r=a,e=n})),-1===a?r.splice(e,0,o):r.splice(e+1,0,o)}else i(l,t,(e=>{e.children=e.children||[],e.children.unshift(o)}));re(l)},onDragEnd:e=>{T?.(e,j)},onExpand:(e,t)=>{W(e),I?.(e,t)},onSelect:e=>{U(e);const t=ao(ee.current,(t=>e.includes((0,J.get)(t,A))));C?.(o?t:t[0])},onCheck:e=>{m&&(e=e.checked),U(e),"SHOW_CHILD"===h&&(e=e.filter((e=>!te.current.includes(e)))),"SHOW_PARENT"===h&&(e=e.filter(((e,t,r)=>!r.includes(ro(j,e,A)))));const t=ao(ee.current,(t=>e.includes((0,J.get)(t,A))));w?.(o?t:t[0])}})))}));uo.displayName="QmSearchTree";const po=uo,mo=(0,e.createContext)(void 0),ho={dataIndex:i().string.isRequired,title:i().string.isRequired,description:i().string,colSpan:i().number,width:i().number,minWidth:i().number,fixed:i().oneOf(["left","right"]),align:i().oneOf(["left","center","right"]),theadAlign:i().oneOf(["left","center","right"]),printFixed:i().bool,hidden:i().bool,noAuth:i().bool,noFixed:i().bool,ellipsis:i().bool,className:i().string,theadClassName:i().string,children:i().array,sorter:i().oneOfType([i().bool,i().func]),filter:i().shape({type:i().oneOf(["text","textarea","checkbox","radio","number","date","tree"]).isRequired,items:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),style:i().object}),precision:i().number,displayPrecision:i().number,formatType:i().oneOf(["date","datetime","dateShortTime","finance","percent","secret-name","secret-phone","secret-IDnumber","secret-bankNumber"]),required:i().bool,canCopy:i().bool,editRender:i().func,dictItems:i().arrayOf(i().shape({text:i().string,value:i().oneOfType([i().string,i().number])})),summation:i().shape({sumBySelection:i().bool,displayWhenNotSelect:i().bool,dataKey:i().string,unit:i().string,render:i().func}),groupSummary:i().shape({dataKey:i().string,unit:i().string,render:i().func}),shouldCellUpdate:i().func,headRender:i().func,render:i().func},fo=(i().arrayOf(i().shape(ho)).isRequired,i().func,i().array,i().oneOfType([i().string,i().func]).isRequired,i().number,i().bool,i().bool,i().shape({api:i().func.isRequired,params:i().object.isRequired,formatter:i().func,beforeFetch:i().func,afterFetch:i().func,stopToFirst:i().bool,dataKey:i().string,callback:i().func}),i().bool,i().bool,i().string,i().string,i().bool,i().bool,i().bool,i().bool,i().oneOfType([i().object,i().func]),i().oneOfType([i().object,i().func]),i().array,i().func,i().bool,i().bool,i().object,i().object,i().shape({type:i().oneOf(["checkbox","radio"]).isRequired,defaultSelectedRowKeys:i().array,selectedRowKeys:i().array,hideSelectAll:i().bool,checkStrictly:i().bool,filterable:i().bool,selectByClickRow:i().bool,selectFirstRowOnChange:i().bool,clearableAfterFetched:i().bool,selectAllOnCurrentPage:i().bool,fetchSelectedRows:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fetchAllRowKeys:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),disabled:i().func,onChange:i().func,onSelect:i().func,onSelectAll:i().func}),i().shape({currentRowKey:i().oneOfType([i().number,i().string]),disabled:i().func,onChange:i().func}),i().shape({virtual:i().bool,expandIconColumn:i().string}),i().shape({defaultExpandAllRows:i().bool,defaultExpandedRowKeys:i().array,expandedRowKeys:i().array,hideExpandAll:i().bool,rowExpandable:i().func,expandedRowClassName:i().string,expandedRowRender:i().func,onExpand:i().func,onChange:i().func}),i().shape({groupItems:i().arrayOf(i().shape({dataIndex:i().string.isRequired,titleIndex:i().string,color:i().string,backgroundColor:i().string})),fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),onChange:i().func}),i().func,i().bool,i().bool,i().bool,i().bool,i().shape({current:i().number,pageSize:i().number,pageSizeOptions:i().array,showSizeChanger:i().bool,showQuickJumper:i().bool}),i().shape({fileName:i().string,fetch:i().shape({api:i().func.isRequired,params:i().object}),beforeExport:i().func,cellStyle:i().bool,hideIcon:i().bool}),i().shape({showLogo:i().bool}),i().shape({fetch:i().shape({api:i().func.isRequired,params:i().object,dataKey:i().string}),fieldList:i().arrayOf(i().object)}),i().shape({position:i().oneOf(["top","bottom"]),hideAlert:i().bool,hideClearButton:i().bool}),i().oneOf(["left","right"]),i().func,i().func,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().bool,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,i().func,10),go="1",bo="0",yo="YYYY-MM-DD",vo="YYYY-MM-DD HH:mm:ss",xo="YYYYMMDDHHmmss",Eo={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 So=function(e){return e.left="flex-start",e.right="flex-end",e}({}),Co=[];const wo={getFocusInstance:function(){return Co[0]??null},getInstance:function(e){return Co.find((t=>t.id===e))??null},focus:function(e){const t=this.getInstance(e);t&&0!==Co.findIndex((e=>e===t))&&(this.deregister(e),Co=[t,...Co])},register:function(e,t){e&&t&&(null!==this.getInstance(e)&&this.deregister(e),Co=[{id:e,vm:t},...Co])},deregister:function(e){e&&(Co=Co.filter((t=>t.id!==e)))}};function No(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const To=class{constructor(){No(this,"state",{required:[],validate:[],edited:[],inserted:[],updated:[],removed:[]}),No(this,"addToRequired",(e=>{-1===this.state.required.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.required.push(e)})),No(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)})),No(this,"addToValidate",(e=>{-1===this.state.validate.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.validate.push(e)})),No(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)})),No(this,"addToEdited",(e=>{-1===this.state.edited.findIndex((t=>t.x===e.x&&t.y===e.y))&&this.state.edited.push(e)})),No(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)})),No(this,"addToInserted",(e=>{-1===this.state.inserted.findIndex((t=>t===e))&&this.state.inserted.push(e)})),No(this,"removeFromInserted",(e=>{const t=this.state.inserted.findIndex((t=>t===e));t<0||this.state.inserted.splice(t,1)})),No(this,"addToUpdated",(e=>{-1===this.state.updated.findIndex((t=>t===e))&&this.state.updated.push(e)})),No(this,"removeFromUpdated",(e=>{const t=this.state.updated.findIndex((t=>t===e));t<0||this.state.updated.splice(t,1)})),No(this,"addToRemoved",(e=>{-1===this.state.removed.findIndex((t=>t===e))&&this.state.removed.push(e)})),No(this,"removeFromRemoved",(e=>{const t=this.state.removed.findIndex((t=>t===e));t<0||this.state.removed.splice(t,1)})),No(this,"clearAllLog",(()=>{this.state.required=[],this.state.validate=[],this.state.edited=[],this.state.inserted=[],this.state.updated=[],this.state.removed=[]})),No(this,"destroy",(()=>{for(const e in this)this[e]=null}))}},Io={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 Ro;const Oo=()=>{if(ee)return 0;if(void 0!==Ro)return Ro;const e=document.createElement("div");e.className="qm-scrollbar__wrap",e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth;e.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",e.appendChild(r);const n=r.offsetWidth;return e.parentNode?.removeChild(e),Ro=t-n,Ro},Po=e=>e.map((e=>{const t={...e};return t.children&&(t.children.forEach((e=>{t.fixed?e.fixed=t.fixed:delete e.fixed})),t.children=Po(t.children)),t})),Ao=(e,r)=>{const{fetch:n,columns:a,height:i,minHeight:l,maxHeight:o,border:s=!0,rowSelection:c,summation:u,expandable:d,treeConfig:m,webPagination:h,scrollPagination:f,dragMergeCell:g,showSuperSearch:b,showFastSearch:y,showGroupSummary:v,showTableImport:x,showClipboard:E,showSelectCollection:S,footRender:C}=e,{tableRef:w,tableFullData:N,tableData:T,selectionKeys:I,sorter:R,filters:O,superFilters:P,pagination:A}=r,{selectionRows:k,summaries:F}=w.current,{expandIconColumn:H=""}=m||{},L=t().useMemo((()=>!!n?.api),[n?.api]),$=t().useMemo((()=>!L&&!!h),[L,h]),_=t().useMemo((()=>L&&!!f),[L,f]),D=t().useMemo((()=>(L||$)&&!_),[L,$,_]),q=t().useMemo((()=>!!(i||l||o)),[i,l,o]),j=t().useMemo((()=>(e=>{const t=(e=>{const t=[],r=[],n=[];for(let a=0;a<e.length;a++){const i=e[a];"left"===i.fixed?t.push(i):"right"===i.fixed?r.push(i):n.push(i)}return[...t,...n,...r]})(Po(e)),r=(e=>{if(!e)return null;const{type:t}=e;return{dataIndex:Io.selectionColumn,title:"radio"===t?p("qm.table.config.selectionText"):"",width:Io.selectionColumnWidth,fixed:"left",type:t}})(c),n=(a=d,a?.expandedRowRender?{dataIndex:Io.expandableColumn,title:"",width:Io.selectionColumnWidth,fixed:"left",type:"expand"}:null);var a;return r&&t.unshift(r),n&&t.unshift(n),En(t)})(a)),[a]),K=t().useMemo((()=>xn(j)),[j]),M=t().useMemo((()=>K.filter((e=>"function"==typeof e.editRender))),[K]),V=t().useMemo((()=>K.filter((e=>!!e.summation))),[K]),z=t().useMemo((()=>K.filter((e=>"left"===e.fixed))),[K]),U=t().useMemo((()=>K.filter((e=>"right"===e.fixed))),[K]),B=t().useMemo((()=>{const e=K.filter((e=>![Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(e.dataIndex)));return H&&e.some((e=>e.dataIndex===H))?H:e[0]?.dataIndex??""}),[K,H]),W=t().useMemo((()=>V.length>0),[V]),G=t().useMemo((()=>!!C||W),[C,W]),Y=t().useMemo((()=>Pn(j).length>1),[j]),X=t().useMemo((()=>s||Y),[s,Y]),Q=t().useMemo((()=>K.some((e=>e.sorter))),[K]),Z=t().useMemo((()=>K.some((e=>e.filter))),[K]),J=t().useMemo((()=>V.some((e=>!!e.summation.dataKey))),[V]),ee=t().useMemo((()=>!L&&!!x),[L,x]),te=t().useMemo((()=>!!E&&M.length>0),[E,M]),re=t().useMemo((()=>!!S&&"checkbox"===c?.type),[S,c]),ne=t().useMemo((()=>!!b&&Z),[b,Z]),ae=t().useMemo((()=>!L&&!!y&&Z),[L,y,Z]),ie=t().useMemo((()=>!!v&&K.some((e=>!!e.groupSummary))),[K]),le=t().useMemo((()=>!!u?.groupItems?.length),[u]),oe=t().useMemo((()=>!!g&&!L&&!h),[g,L,h]),se=t().useMemo((()=>N.some((e=>Array.isArray(e.children)))),[N]),ce=t().useMemo((()=>!T.length),[T]),ue=t().useMemo((()=>(()=>{const e={};return V.forEach((t=>{const{dataIndex:r,precision:n,displayPrecision:a,summation:i}=t,{sumBySelection:l,displayWhenNotSelect:o,unit:s}=i,c=le?zn(w.current.tableFullData):w.current.tableFullData,u=!k.length&&!!o;let d=(!l||u?c:k).reduce(((e,t)=>{if(t?.[Io.summaryIgnore])return e;const n=Ln(t,r);return Number.isNaN(n)||""===n?e:e.plus(n)}),new(ua())(0));!Object.keys(F).includes(r)||l&&!u||(d=new(ua())(Ln(F,r))),$n(e,r,d.toNumber());let p=n>=0?d.toFixed(n):d.toString();a>=0&&""!==p&&(p=qn(p,a)),p=Dn(p),$n(e,`${r}_text`,s?`${p} ${s}`:p)})),[e]})()),[T,I,F]),de=t().useMemo((()=>(e=>e.filter((e=>e.summation.dataKey)).map((e=>`sum|${e.dataIndex}`)).join(","))(V)),[V]),pe=t().useMemo((()=>{const e=(e=>{const t=[];return Object.keys(e).forEach((r=>{null!==e[r]&&t.push(`${r}|${e[r]}`)})),t.join(",")})(R),t=((e,t)=>{const r=[];if(Object.keys(e).length)for(const t in e){const[n,a]=Io.showFilterType?t.split("|"):[t,""],i=e[t];Object.keys(i).forEach((e=>{r.push({type:a,bracketLeft:"",fieldName:n,expression:e,value:i[e],bracketRight:"",logic:"and"})}))}return t.length&&t.forEach((e=>{r.push({type:Io.showFilterType?e.fieldType:"",bracketLeft:e.bracketLeft,fieldName:e.fieldName,expression:e.expression,value:e.condition,bracketRight:e.bracketRight,logic:e.logic})})),r.length&&(r[r.length-1].logic=""),r})(O,P);return{...e?{[Io.sorterFieldName]:e}:null,...t.length?{[Io.filterFieldName]:t}:null,...de?{[Io.groupSummary.summaryFieldName]:de,usedJH:1}:null,...n?.params??null,[Io.currentPageName]:A.current,[Io.pageSizeName]:A.pageSize}}),[n?.params,A.current,A.pageSize,R,O,P,de]);return{isFetch:L,isWebPagination:$,isScrollPagination:_,showPagination:D,shouldUpdateHeight:q,tableColumns:j,flattenColumns:K,editableColumns:M,summationColumns:V,leftFixedColumns:z,rightFixedColumns:U,treeExpandIndex:B,showSummary:W,showFooter:G,isHeadGroup:Y,bordered:X,isHeadSorter:Q,isHeadFilter:Z,isServiceSummation:J,isSelectCollection:re,isTableImport:ee,isTableClipboard:te,isSuperSearch:ne,isFastSearch:ae,isGroupSummary:ie,isGroupSubtotal:le,isDragMergeCell:oe,isTreeTable:se,isTableEmpty:ce,summationRows:ue,fetchParams:pe}};function ko(t){const r=e.useRef();r.current=t;const n=e.useCallback((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current?.(...t)}),[]);return n}const Fo=(e,r)=>{const{rowKey:n,dataSource:a,summation:i,fetch:l,initialSorter:o,initialFilter:s,rowSelection:c,expandable:u,treeConfig:d,authConfig:p,ignorePageIndex:m,columnsChange:h,onChange:f,onDataChange:b,onDataLoad:y,onScrollEnd:v,onFetchError:x}=e,{getRowKey:E,tableRef:S,tableElementRef:C,tableBodyRef:w,$size:N,tableColumns:T,flattenColumns:I,tableFullData:R,pagination:O,layout:P,filters:A,sorter:k,superFilters:F,fetchParams:H,selectionKeys:L,rowExpandedKeys:$,highlightKey:_,summationColumns:D,shouldUpdateHeight:q,isFetch:j,isTreeTable:K,isWebPagination:M,isScrollPagination:V,isServiceSummation:z,isGroupSubtotal:U,doLayout:B,setTableData:W,setTableFullData:G,setTableOriginData:Y,setAllTableData:X,setDeriveRowKeys:Q,setPagination:ee,setSpinning:te,setSorter:re,setFilters:ne,setSuperFilters:ie,setSelectionKeys:le,setRowExpandedKeys:oe,setHighlightKey:ce,setSelectionRows:ue,setScrollYLoad:de,setScrollYStore:pe,setFieldAuth:me,setResizeState:he,setSummaries:fe,setPermission:ge,setRecordsMap:be,resetTableScroll:ye,clearElementStore:ve,clearRecordsMap:xe}=r,{store:Ee}=S.current,Se=Ct(C),Ce=t().useRef({...H}),we=t().useRef(new Map),Ne=t().useRef(!1);qe((()=>{B()}),[T,N,P.tableAutoHeight]),qe((()=>{Te()}),[Se]),qe((()=>{lt(),ot(),st(),j||(M&&Qe(),Ue(a)),o&&re(o),s&&ne(s)}),[a,l?.params]),qe((()=>{const e=Me(H,Ce.current);e||j&&c?.clearableAfterFetched&&ct(),!e&&H[Io.currentPageName]>1&&!l?.stopToFirst?Qe():j&&ze(),Ce.current=H}),[H]),qe((()=>{M&&rt(),V||ye(),De()}),[O.current,O.pageSize]),qe((()=>{j||Ie(R.length),B()}),[R]),qe((()=>{K&&d?.virtual&&(Ze(),rt())}),[$]);const Te=()=>{const{scrollYLoad:e,resizeState:t}=S.current,{height:r}=t,{width:n,height:a}=Se,i=a!==r;B(),i&&q&&e&&rt(),he(Object.assign({},t,{width:n,height:a}))},Ie=e=>{e!==O.total&&ee((t=>Object.assign({},t,{total:e})))},Re=e=>{Ne.current=e},Oe=wt((e=>{Ge(),v?.(e)})),Pe=e=>U?Ae(ke(e,0)):e,Ae=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ae(e.children)),delete e.children,t.push(e)})),t},ke=(e,t)=>{const r=i.groupItems?.[t];return r?Bn(e,[r.dataIndex]).map((e=>{const a={children:ke(e,t+1),_group:r.dataIndex};return"function"!=typeof n&&$n(a,n.toString(),Mn()),r.titleIndex&&$n(a,r.titleIndex,Ln(e[0],r.titleIndex)),$n(a,r.dataIndex,Ln(e[0],r.dataIndex)),D.forEach((e=>{const{dataIndex:t}=e,r=a.children?.reduce(((e,r)=>{if(r[Io.summaryIgnore])return e;const n=Number(Ln(r,t));return Number.isNaN(n)?e:e+n}),0);$n(a,t,r)})),a})):(e.forEach(((t,r)=>{t._rowSpan=0===r?e.length:0,t._colSpan=1})),e)},Fe=e=>{le(e),ue((e=>{const{selectionRows:t,allTableData:r,recordsMap:n}=S.current;if(j)return[...t.filter((t=>e.includes(E(t,t.index)))),...r.filter((r=>{const n=E(r,r.index);return e.includes(n)&&-1===t.findIndex((e=>E(e,e.index)===n))}))];const a=[];for(let t=0,r=e.length;t<r;t++){const r=e[t];n.has(r)&&a.push(n.get(r))}return a})(e))},He=e=>{const{type:t,checkStrictly:r=!0}=c||{},n=Array.isArray(e)?e:L;let a=[];return S.current.treeTable&&!r&&n.forEach((e=>{a.push(...((e,t)=>{const{deriveRowKeys:r}=S.current,n=Rn(r,e);let a=[];if(!n)return a;const i=$e(n?.children||[]),l=Gn(r,e)?.slice(0,-1).reverse()||[];return a=[...new Set([...t,...i])],l.forEach((e=>{const t=Rn(r,e),n=Hn(a,t?.children?.map((e=>e.rowKey))||[]);a=n?[...a,e]:a.filter((t=>t!==e))})),a})(e,n))})),a="radio"===t?n.slice(0,1):[...new Set([...n,...a])],a},Le=e=>{const{allRowKeys:t,flattenRowKeys:r}=S.current,{defaultExpandAllRows:n,expandedRowRender:a}=u||{},i=Array.isArray(e)?e:$;if(S.current.treeTable){a&&g("Table","树结构表格不能再设置展开行的 `expandedRowRender` 参数");const e=[...L];_&&e.unshift(_);let l=[];return e.forEach((e=>{const t=Gn(S.current.deriveRowKeys,e)||[];l.push(...t.length>1?t.slice(0,-1).reverse():t)})),l=n?t:[...new Set([...i,...l])],l.filter((e=>!r.includes(e)))}return u?n?t.slice(0):[...i]:[]},$e=e=>{const t=[];for(let r=0;r<e.length;r++)Array.isArray(e[r].children)&&t.push(...$e(e[r].children)),t.push(e[r].rowKey);return t},_e=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(..._e(e.children,t)),e.rowKey===t&&e.parentRowKey&&r.push(e.parentRowKey)})),r.length&&r.push(..._e(e,r[r.length-1])),r},De=wt((()=>{We(),f?.(O,Ke(A),je(k),F,{currentDataSource:et()})})),je=e=>{const t={};for(const r in e)null!==e[r]&&(t[r]=e[r]);return t},Ke=e=>{const t={};for(const r in e){if(!r.includes("|"))continue;const[n,a]=r.split("|");t[Io.showFilterType?`${n}|${a}`:n]=e[r]}return t},Me=(e,t)=>{const r=Object.keys(Fn(e,t));return 1===r.length&&(r.includes(Io.currentPageName)||r.includes(Io.pageSizeName))},Ve=ko((async()=>{if(!l)return;const{formatter:e=(e=>e),beforeFetch:t=ae,afterFetch:r,callback:n}=l;if(!t(H))return;const a=!!i?.fetch?.api;te(!0);try{const[t,o]=a?await Promise.all([l.api(e(H)),i.fetch.api(e(H))]):[await l.api(e(H))];if(S.current.unMounted)return;if(a?200===t.code&&200===o.code:200===t.code){const e=l.dataKey??Io.dataKey;let a=(0,J.get)(t.data,e)??[];a="function"==typeof r?await r(a):a;const i=(0,J.get)(t.data,e.replace(/[^.]+$/,Io.totalKey))||a.length||0,s=Math.max(Math.ceil(i/O.pageSize),1);if(H[Io.currentPageName]>s)return Ye({...O,current:s});Ue(Ne.current?S.current.tableFullData.concat(a):a),Ie(i),Be(o?.data||t.data),n?.(t.data,t)}}catch(e){x?.(e)}((e,t)=>Object.prototype.hasOwnProperty.call(e,"stopToFirst"))(l)&&(l.stopToFirst=!1),te(!1),Re(!1)})),ze=wt(Ve),Ue=e=>{const t=e=>e.map(((e,r)=>(Array.isArray(e.children)&&(e.children=t(e.children)),e.index=r,m||(e.pageIndex=(e=>{const{current:t,pageSize:r}=O;return!j||V?e:(t-1)*r+e})(r)),e))),r=Pe(t(e));nt(r),at(r),it(),Fe(He()),oe(Le()),We(),y?.(r)},Be=e=>{if(!z)return;const t=i?.fetch?.dataKey??Io.summationKey,r=(t?(0,J.get)(e,t):e)??{},n={};D.filter((e=>!!e.summation.dataKey)).forEach((e=>{$n(n,e.dataIndex,Number(Ln(r,e.summation.dataKey)))})),fe(n)},We=()=>{const{type:e,selectFirstRowOnChange:t}=c||{};if("radio"===e&&t){const e=et();if(e.length){const t=E(e[0],e[0].index);Fe([t])}else Fe([])}},Ge=()=>{if(!V)return;const e=Xe();Ne.current||O.current>=e||(Re(!0),Ye({...O,current:O.current+1}))},Ye=e=>{let{current:t,pageSize:r}=e;ee((e=>Object.assign({},e,{current:t,pageSize:r})))},Xe=()=>{const{pageSize:e,total:t}=O;return Math.ceil(t/e)||1},Qe=()=>{Ye(Object.assign({},O,{current:1}))},Ze=()=>{if(!S.current.treeTable||!d?.virtual)return;const e=Je(S.current.deriveRowKeys,(()=>{const{allTableData:e,allRowKeys:t}=S.current,{rowExpandable:r}=u||{},n=[];return"function"==typeof r&&e.forEach(((e,a)=>!r(e)&&n.push(t[a]))),n.length?$.filter((e=>!n.includes(e))):$})());we.current.clear(),e.forEach(((e,t)=>we.current.set(e,t)))},Je=(e,t)=>{const r=[];return e.forEach((e=>{e.children&&r.push(...Je(e.children,t)),(void 0===e.parentRowKey||t.includes(e.parentRowKey)&&e.rowKeyPath.split("#").slice(0,-1).every((e=>t.findIndex((t=>t==e))>-1)))&&r.push(e.rowKey)})),r},et=()=>M?(()=>{const{current:e,pageSize:t}=O;return S.current.tableFullData.slice((e-1)*t,e*t)})():S.current.tableFullData,tt=e=>{const{scrollYLoad:t,scrollYStore:r}=S.current;W(t?e.slice(r.startIndex,r.endIndex):e)},rt=()=>{let e=et();S.current.treeTable&&d?.virtual&&(e=(e=>{const{allTableData:t,allRowKeys:r}=S.current,n=[];for(let e=0,a=r.length;e<a;e++){const a=r[e];we.current.has(a)&&n.push(t[e])}return n})()),de(e.length>Io.virtualScrollY),(e=>{const{elementStore:t,scrollYStore:r,scrollYLoad:n}=S.current,{startIndex:a,rowHeight:i}=r;let l="",o="";n&&(l=`translateY(${Math.max(0,a*i)+"px"})`,o=e.length*i+"px"),t.$tableBody.style.transform=l,t.$tableYspace.style.height=o})(e),tt(e)},nt=e=>{G(e),X(e),Q(e),Ze(),rt()},at=e=>{Y(e)},it=()=>{const{allTableData:e}=S.current;xe(),e.forEach((e=>be(E(e,e.index),e)))},lt=()=>{re({})},ot=()=>{ne({})},st=()=>{ie([])},ct=()=>{Fe([])};return{initialTable:()=>{(async()=>{if(!p)return;let t=Z()(p,["fetch"]);if(p.fetch){const{api:e,params:r,dataKey:n}=p.fetch;try{const a=await e(r);200===a.code&&(t=(n?(0,J.get)(a.data,n):a.data)??{})}catch(e){}}if(Object.keys(t).length){const{isExport:e=1,isImport:r=1,isPrint:n=1}=t;ge((t=>Object.assign({},t,{export:!!e,import:!!r,print:!!n})))}if(Array.isArray(t.fieldList)){const{originColumns:r}=S.current,n=Cn(e.columns,(e=>{const{dataIndex:n}=e,a=t.fieldList.find((e=>e.dataIndex===n));if(a){const{visible:t=1,disabled:i,secretName:l}=a,o=wn(r,n);me(n,{visible:t,disabled:i,secretName:l}),t||(e.noAuth=!0,o.noAuth=!0),l&&(e.formatType=`secret-${l}`,o.formatType=`secret-${l}`)}}));h?.(n)}})(),_&&w.current.setClickedValues([_,""]),"radio"===c?.type&&L.length&&w.current.setClickedValues([L[0],""]),j?Ve():Ue(a)},checkDataIndex:()=>{const e=I.map((e=>e.dataIndex));[...new Set(e)].length!==e.length&&g("Table","配置项 dataIndex 属性是唯一的,不能重复")},createTableFullData:nt,getTableData:Ve,handleTableData:tt,createTableData:Ue,createGroupData:Pe,createSelectionKeys:He,createRowExpandedKeys:Le,setSelectionKeysEffect:Fe,findParentRowKeys:_e,getAllChildRowKeys:$e,doFieldValidate:(e,t,r,n)=>{if(!Array.isArray(e))return g("Table","可编辑单元格的校验规则 `rules` 配置不正确");e.length&&(Ee.removeFromRequired({x:r,y:n}),Ee.removeFromValidate({x:r,y:n}),e.forEach((e=>{e.required&&se(t)&&Ee.addToRequired({x:r,y:n,text:e.message}),"function"!=typeof e.validator||e.validator?.(t)||Ee.addToValidate({x:r,y:n,text:e.message})})))},getTableLog:()=>{const{required:e,validate:t,inserted:r,updated:n,removed:a}=Ee.state,i=(0,J.intersection)(r,a),l=e=>e.map((e=>({rowKey:e.x,dataIndex:e.y,text:e.text})));return{required:l(e),validate:l(t),inserted:r.filter((e=>!i.includes(e))),updated:n.filter((e=>![...(0,J.intersection)(n,r),...(0,J.intersection)(n,a)].includes(e))),removed:a.filter((e=>!i.includes(e)))}},dataChange:()=>{b?.(S.current.tableFullData)},tableChange:De,toLastPage:()=>{const e=Xe();O.current!==e&&Ye(Object.assign({},O,{current:e}))},toFirstPage:Qe,getPageCount:Xe,pagerChangeHandle:Ye,triggerScrollYEvent:e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const{scrollYStore:t}=S.current,{startIndex:r,endIndex:n,offsetSize:a,visibleSize:i,rowHeight:l}=t,o=Math.floor(e/l),s=Math.max(0,o-1-a),c=o+i+a;(o<=r||o>=n-i-1)&&(r===s&&n===c||(pe(Object.assign({},t,{startIndex:s,endIndex:c})),rt()))}(e)},scrollBottomDebouncer:Oe,clearTableSorter:lt,clearTableFilter:ot,clearSuperFilters:st,clearRowSelection:ct,clearRowHighlight:()=>{ce("")},clearTableLog:()=>{Ee.clearAllLog()},destroy:()=>{ve(),Ee.destroy(),wo.deregister(S.current.uid)}}},Ho=(e,r)=>{const{height:n,minHeight:a,maxHeight:i,rowHeight:l,resizable:o,showHeader:s,spanMethod:c}=e,{getRowKey:u,tableRef:d,$size:p,tableColumns:m,flattenColumns:h,leftFixedColumns:f,layout:g,scrollY:b,tableData:y,showFooter:v,showPagination:x,isWebPagination:E,isFullScreen:S,setLayout:C,setScrollX:w,setScrollY:N,setElementStore:T,setScrollYStore:I,setShouldToTop:R}=r,O=t().useRef(b),P=t().useMemo((()=>{const{tableFullHeight:e,tableAutoHeight:t}=g,r={};return a&&Object.assign(r,{minHeight:`${kn(a)}px`}),i&&Object.assign(r,{maxHeight:`${kn(i)}px`}),S?{...r,maxHeight:"",minHeight:"",height:`${e}px`}:n?{...r,height:"auto"!==n?`${kn(n)}px`:`${t}px`}:r}),[n,i,a,S,g]),A=(e,t)=>{const{elementStore:r,scrollYStore:n,allTableData:a}=d.current,i=r.$tableBody.parentNode.parentNode;if(void 0!==t&&t>=0)i.scrollTop=t*n.rowHeight;else{const t=(E?On(y):a).findIndex((t=>e===u(t,t.index)));i.scrollTop=(t<0?0:t)*n.rowHeight}};return{createElementStore:e=>{Object.keys(e).forEach((t=>{T(t,e[t])}))},tableStyles:P,getSpan:(e,t,r,n,a)=>{let i=1,l=1;if("function"==typeof c){const o=c({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan)}const{mergeCells:o}=d.current;if(o.length>0){const e=o.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},getStickyLeft:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Nn(wn(m,e)).dataIndex);let t=0;for(let r=0;r<h.length;r++){const n=h[r];if(n.dataIndex===e)break;t+=kn(n.width||n.renderWidth||0)}return t},getStickyRight:e=>{h.findIndex((t=>t.dataIndex===e))<0&&(e=Tn(wn(m,e)).dataIndex);let t=0;for(let r=h.length-1;r>=0;r--){const n=h[r];if(n.dataIndex===e)break;t+=kn(n.width||n.renderWidth||0)}return t},scrollXToColumn:(e,t)=>{const{elementStore:r}=d.current,n=void 0===t?h.findIndex((t=>t.dataIndex===e)):t;if(n<0)return;const a=f.map((e=>e.width||e.renderWidth||Io.defaultColumnWidth)).reduce(((e,t)=>e+t),0);r.$tableBody.parentNode.parentNode.scrollLeft=r.$tableBody.querySelectorAll("tbody > tr > td")[n].offsetLeft-a},scrollYToRecord:A,rowInViewport:e=>{const{elementStore:t,scrollYStore:r}=d.current,{viewportHeight:n,gutterWidth:a}=g,i=e*r.rowHeight,l=t.$tableBody.parentNode.parentNode;return!(i<l.scrollTop||i+r.rowHeight>l.scrollTop+(scrollX?n-a:n))},calcTableHeight:()=>{if("auto"!==n)return;const{elementStore:e,resizeState:t}=d.current,r=t.winHeight-e.$table.getBoundingClientRect().top-(x?ya["small"!==p?"middle":p]+fo:0)-fo;C((e=>Object.assign({},e,{tableAutoHeight:r})))},resetTableScroll:()=>{const{shouldToTop:e}=d.current;e&&A("",0),R(!0)},doLayout:()=>{(()=>{const{elementStore:e,scrollYLoad:t,resizeState:r}=d.current;if(!e.$table.offsetParent)return;const n=e.$table.offsetHeight,a=s?e.$header.offsetHeight:g.headerHeight,i=v?e.$footer.offsetHeight:g.footerHeight,o=n-a-i,c=e.$tableBody.offsetHeight,u=t||c>o;let m=0;if(S){const t=e.$toper?e.$toper.offsetHeight+fo:0,n=e.$pager?e.$pager.offsetHeight+fo:0;m=r.winHeight-t-n-20}o!==g.viewportHeight&&(e=>{const{scrollYStore:t,isIE:r}=d.current,{startIndex:n,endIndex:a}=t,i=l||Io.rowHeightMaps[p],o=Math.max(8,Math.ceil(e/i)+2),s=r?5:0;I(Object.assign({},t,{visibleSize:o,offsetSize:s,endIndex:Math.max(n+o+s,a),rowHeight:i}))})(o),O.current=u,N(u),C((e=>Object.assign({},e,{headerHeight:a,footerHeight:i,viewportHeight:o,tableBodyHeight:c,tableFullHeight:m})))})(),(()=>{const{elementStore:e}=d.current,t=e.$table.clientWidth,r=O.current?g.gutterWidth:0,{defaultColumnWidth:n}=Io,a=h.filter((e=>"number"!=typeof e.width));let i=0;if(h.forEach((e=>{"number"==typeof e.width&&(e.renderWidth=void 0)})),a.length>0){if(h.forEach((e=>{i+=e.width||e.minWidth||n})),i<=t-r){w(!1);const e=t-r-i;if(1===a.length&&o)a[0].renderWidth=(a[0].minWidth||n)+e;else{const t=e/a.reduce(((e,t)=>e+(t.minWidth||n)),0);let r=0;a.forEach(((e,a)=>{if(0===a)return;const i=Math.floor((e.minWidth||n)*t);r+=i,e.renderWidth=(e.minWidth||n)+i})),o&&(a[0].renderWidth=(a[0].minWidth||n)+e-r)}}else w(!0),a.forEach((e=>{e.renderWidth=e.minWidth||n}));C((e=>Object.assign({},e,{tableBodyWidth:Math.max(i,t)})))}else h.forEach((e=>{e.renderWidth=e.width||e.minWidth||n,i+=e.renderWidth})),w(i>t),C((e=>Object.assign({},e,{tableBodyWidth:i})));C((e=>Object.assign({},e,{tableWidth:t})))})()}}},Lo=e=>{const{total:r}=e,{tableRef:n,selectionKeys:a,isHeadSorter:i,isHeadFilter:l,isTreeTable:o,clearTableSorter:s,clearTableFilter:c,clearSuperFilters:u,clearRowSelection:d,clearRowHighlight:m}=t().useContext(mo),{infoBarConfig:h,rowSelection:f,rowHighlight:g}=n.current.props,{allTableData:b,invalidRowKeys:y}=n.current,{hideAlert:v,hideClearButton:x}=h||{},E=t().useMemo((()=>!v),[v]),S=t().useMemo((()=>!x&&!!(i||l||f||g)),[x,i,l,f,g]),C={[`${Ce("table")}__alert`]:!0};return E?t().createElement("div",{className:Se()(C)},t().createElement("i",{className:"svgicon icon"},t().createElement(we.InfoCircleFilled,null)),t().createElement("span",null,p("qm.table.alert.total",{total:o?b.length:r}),f?`,${p("qm.table.alert.selected",{total:a.length-y.length})}`:""),S&&t().createElement("em",{onClick:()=>{s(),c(),u(),d(),m()}},p("qm.table.alert.clear"))):null},$o=t().forwardRef(((e,r)=>{const{isFullScreen:n,open:a=!0}=e,{setFullScreen:i}=t().useContext(mo),l=()=>{i(!n)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table");return a?t().createElement("span",{className:`${o}-full-screen`,title:p(n?"qm.table.screen.cancelFull":"qm.table.screen.full"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},n?t().createElement(we.FullscreenExitOutlined,null):t().createElement(we.FullscreenOutlined,null))):null}));$o.displayName="FullScreen";const _o=$o,Do=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{getTableData:a}=t().useContext(mo),i=()=>{a()};t().useImperativeHandle(r,(()=>({clickHandle:i})));const l=Ce("table");return n?t().createElement("span",{className:`${l}-reload`,title:p("qm.table.refresh.text"),onClick:()=>i()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ReloadOutlined,null))):null}));Do.displayName="Reload";const qo=Do,jo=()=>{const e={dateFormat:e=>{const t=e?s()(e).format(yo):"";return t.startsWith("1900-01-01")?"":t},datetimeFormat:e=>{const t=e?s()(e).format(vo):"";return t.startsWith("1900-01-01")?"":t},dateShortTimeFormat:e=>{const t=e?s()(e).format(vo.slice(0,-3)):"";return t.startsWith("1900-01-01")?"":t},percentFormat:e=>Number.isNaN(e)?e:(100*Number(e)).toFixed(2)+"%",financeFormat:e=>Dn(e.toString()),secretNameFormat:e=>e.replace(/^([\u4e00-\u9fa5]{1}).+$/,"$1**"),secretPhoneFormat:e=>e.replace(/^(\d{3}).+(\d{4})$/,"$1****$2"),secretIDnumberFormat:e=>e.replace(/^(\d{3}).+(\w{4})$/,"$1***********$2"),secretBankNumberFormat:e=>e.replace(/^(\d{4}).+(\w{3})$/,"$1************$2")},t=(t,r,n)=>{const{dictItems:a,precision:i,displayPrecision:l,formatType:o,editRender:s}=r,c=a||s?.(n,r)?.items||[];let u=c.find((e=>e.value==t))?.text??t??"";if(Array.isArray(t)&&(u=t.map((e=>c.find((t=>t.value==e))?.text??e)).join(",")),i>=0&&""!==u&&(u=Number.isNaN(u)?u:new(ua())(u).toFixed(i)),l>=0&&""!==u&&(u=qn(u,l)),o){const t=e[`${oe(o)}Format`];t?u=t(u):g("Table","字段的格式化类型 `formatType` 配置不正确")}return u},r=e=>te(e)?Vn(e).join(""):e??"";return{renderText:t,getTitleFromCellNode:r,getTitleFromCellValue:(e,n,a,i)=>{const l=Ln(e,n.dataIndex),o=n.render?n.render(l,e,n,a,i):t(l,n,e);return r(o)}}},Ko=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,flattenColumns:s,summationRows:c,showSummary:u,getSpan:d}=t().useContext(mo),{tablePrint:m,showHeader:h}=o.current.props,{getTitleFromCellValue:f}=jo(),g=i?.print?.leftLogo??"",b=i?.print?.rightLogo??"",y=!(!g&&!b),v=t().useMemo((()=>ce(In(n,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn]))),[n]),x=t().useMemo((()=>ce(In(s,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn]))),[s]),E=t().useMemo((()=>ce(n.filter((e=>e.printFixed)))),[n]),S=e=>{const t=Object.assign({},Wn(v,e.dataIndex).slice(0,-1).reverse()[0]);return t.children=[e],t.level&&t.level>1?S(t):t},C=(e,t)=>(0,J.map)((0,J.groupBy)((0,J.flatten)(e),t),(0,J.spread)((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return(0,J.mergeWith)(...r,((e,r)=>{if(Array.isArray(e))return C(e.concat(r),t)}))}))),w=()=>{const{allTableData:e}=o.current,t=(e=>{const t=[];let r=[],n=0,a=0;for(;a<e.length;){const i=e[a];n+=i.width||i.renderWidth||i.minWidth||Io.defaultColumnWidth,n<=Io.printWidth?(r.push(i),a===e.length-1&&t.push(r),a++):a>0?(e.splice(0,a),E.length&&e.unshift(...E),t.push(r),r=[],n=0,a=0):(i.width=Io.printWidth,r.push(i),t.push(r),a++)}return t})([...x]),r=(e=>{const t=[];return e.forEach((e=>{let r=[];e.forEach((e=>{1===e.level?r.push(e):r.push(S(e))})),r=(e=>[...new Set(e.map((e=>e.dataIndex)))].map((t=>{const r=e.filter((e=>e.dataIndex===t));return r.length<=1?r[0]:C(r,"dataIndex")[0]})))(r),t.push(Pn(r))})),t})(t);let n=["<!DOCTYPE html>","<html>","<head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',"<style>\n * {\n margin: 0;\n padding: 0;\n }\n body * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n }\n table--print {\n font-size: 14px;\n text-align: left;\n }\n .table--print th,\n .table--print td {\n padding: 5px;\n border: 1px solid #000;\n }\n .no-border th,\n .no-border td {\n border: 0!important;\n }\n .table--print th[colspan]:not([colspan='1']) {\n text-align: center;\n }\n .page-break {\n page-break-after: always;\n }\n</style>","</head>","<body>"].join("");for(let a=0;a<t.length;a++)n+=N(r[a],t[a],e),n+='<div class="page-break"></div>';return n+"</body></html>"},N=(e,t,r)=>{const{showLogo:n=!0}=m;let a='<table class="table--print" width="100%" border="0" cellspacing="0" cellpadding="0">';return a+=`<colgroup>${t.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||Io.defaultColumnWidth}px">`})).join("")}</colgroup>`,h&&(a+=["<thead>",n&&y?`<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">',g?`<img src="${g}" border="0" height="26" />`:"","</td>",'<td width="50%" align="right">',b?`<img src="${b}" border="0" height="38" />`:"","</td>","</tr>","</table>"].join("")}</th></tr>`:"",e.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),r.length&&(a+=`<tbody>${r.map((e=>`<tr>${t.map(((t,n)=>{const{rowSpan:a,colSpan:i}=d(e,t,e.index,n,r);return a&&i?`<td rowspan="${a}" colspan="${i}">${f(e,t,e.index,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),u&&c.length&&(a+=["<tfoot>",c.map((e=>`<tr>${t.map(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(r):Ln(e,`${a}_text`);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),a+="</table>",a},T=()=>{((e,t)=>{const{filename:r,type:n,isDownload:a}={filename:"print",type:"html",isDownload:!1},i=`${r}.${n}`;if(window.Blob){const e=new Blob([t],{type:`text/${n}`});if(!a)return Promise.resolve({type:n,content:t,blob:e});Ft(e,i)}})(0,w())?.then((e=>{let{content:t,blob:r}=e,n=document.createElement("iframe");n.setAttribute("frameborder","0"),n.setAttribute("width","100%"),n.setAttribute("height","0"),n.style.display="none",document.body.appendChild(n),o.current.isIE?(n.contentDocument.write(t),n.contentDocument.execCommand("print"),n.parentNode.removeChild(n),n=null):(n.onload=e=>{e.target.src&&e.target.contentWindow.print(),setTimeout((()=>{n.parentNode.removeChild(n),n=null}))},n.src=URL.createObjectURL(r))}))};t().useImperativeHandle(r,(()=>({clickHandle:T})));const I=Ce("table");return a?t().createElement("span",{className:`${I}-print`,title:p("qm.table.print.text"),onClick:()=>T()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PrinterOutlined,null))):null}));Ko.displayName="TablePrint";const Mo=Ko,Vo=require("exceljs");var zo=n.n(Vo);const Uo="606060",Bo="thin",Wo="d4d4d4",Go=(e,t)=>{t&&(e.height=Math.floor(.75*t))},Yo=(e,t)=>{e.protection={locked:!1},e.alignment={vertical:"middle",horizontal:t||"left"}},Xo=()=>({top:{style:Bo,color:{argb:Wo}},left:{style:Bo,color:{argb:Wo}},bottom:{style:Bo,color:{argb:Wo}},right:{style:Bo,color:{argb:Wo}}}),Qo=e=>{const{children:t}=e;return t&&t.length?Qo(t[0]):e},Zo=e=>{const{precision:t,formatType:r}=e,n=t>=0?t?`0.${new Array(t).fill("0").join("")}`:"0":"";return n?{numFmt:n}:"percent"===r?{numFmt:t>=0?`${n}%`:"0%"}:"finance"===r?{numFmt:t>=0?`#,##${n}`:"#,##0"}:null},Jo=()=>{const{tableRef:e,getSpan:r,showSummary:n,isHeadGroup:a}=t().useContext(mo),{spanMethod:i,showHeader:l}=e.current.props,o=(e,t)=>e.find((e=>e.text==t))?.value??t??"";return{exportXLSX:async(t,o,s,c)=>{const{columns:u,footSummation:d}=t,{scrollYStore:{rowHeight:m}}=e.current,h=xn(u),f=Pn(u),g=[],b=[],y=[],v=[];let x=0;const E={};h.forEach((e=>{const{dataIndex:t,title:r,width:n,minWidth:a,renderWidth:i}=e;E[t]=r,y.push({key:t,width:(n||i||a||Io.defaultColumnWidth)/8})})),l&&(a?f.forEach(((e,t)=>{const r={};e.forEach((e=>{const{colSpan:n,rowSpan:a}=e,i=Qo(e),l=h.findIndex((e=>{let{dataIndex:t}=e;return t===i.dataIndex}));r[i.dataIndex]=e.title,0!==n&&(n>1||a>1)&&v.push({s:{r:t,c:l},e:{r:t+a-1,c:l+n-1}})})),g.push(r)})):(h.forEach(((e,t)=>{const{colSpan:r,rowSpan:n}=e;(r>1||n>1)&&v.push({s:{r:x,c:t},e:{r:x+n-1,c:t+r-1}})})),g.push(E)),x+=g.length);const S=o.map(((e,t)=>{const n={};return h.forEach(((a,l)=>{if("function"==typeof i){const{rowSpan:n,colSpan:i}=r(e,a,t,l,o);(i>1||n>1)&&v.push({s:{r:t+x,c:l},e:{r:t+x+n-1,c:l+i-1}})}const s=["percent","finance"].includes(a.formatType);n[a.dataIndex]=s?Ln(e,a.dataIndex):c(e,t,a,l)})),n}));x+=S.length,n&&d&&s(h,o).forEach(((e,t)=>{const r={};h.forEach(((t,n)=>{const{dataIndex:a,summation:i}=t,l=i?.render?i.render(o):Ln(e,a);r[a]=0===n&&""===l?p("qm.table.config.summaryText"):te(l)?Vn(l).join(""):l})),b.push(r)}));const{sheetName:C,useStyle:w}=t,N=new(zo().Workbook),T=N.addWorksheet(C);T.columns=y,l&&T.addRows(g).forEach((e=>{w&&Go(e,m),e.eachCell((e=>{const t=T.getColumn(e.col),r=wn(u,t.key),{align:n,theadAlign:a}=r;Yo(e,a||n),w&&Object.assign(e,{font:{bold:!0,color:{argb:Uo}},fill:{type:"pattern",pattern:"solid",fgColor:{argb:"f5f5f5"}},border:Xo()})}))})),T.addRows(S).forEach((e=>{w&&Go(e,m),e.eachCell((e=>{const t=T.getColumn(e.col),r=wn(u,t.key),{align:n}=r;Yo(e,n),Object.assign(e,Zo(r)),w&&Object.assign(e,{font:{color:{argb:Uo}},border:Xo()})}))})),n&&d&&T.addRows(b).forEach((e=>{w&&Go(e,m),e.eachCell((e=>{const t=T.getColumn(e.col),r=wn(u,t.key),{align:n}=r;Yo(e,n),Object.assign(e,Zo(r)),w&&Object.assign(e,{font:{color:{argb:Uo}},border:Xo()})}))})),v.forEach((e=>{let{s:t,e:r}=e;T.mergeCells(t.r+1,t.c+1,r.r+1,r.c+1)}));const I=await N.xlsx.writeBuffer();return new Blob([I],{type:"application/octet-stream"})},exportCSV:(e,t)=>{const r=e=>{let t=e;const r=-1!==e.indexOf(",")||-1!==e.indexOf("\r")||-1!==e.indexOf("\n"),n=-1!==e.indexOf('"');return n&&(t=t.replace(/"/g,'""')),(r||n)&&(t='"'+t+'"'),t},n="\ufeff"+(e=>{let t,n,a,i,l="";for(t=0;t<e.rows.length;t+=1){for(a=e.rows[t],n=0;n<a.cells.length;n+=1)i=a.cells[n],l=l+(n?",":"")+r(i.textContent.trim());l+="\r\n"}return l})((e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstChild})(t));var a;return((e,t,r)=>{t=t||"",r=r||512;const n=window.atob(e),a=[];let i;for(i=0;i<n.length;i+=r){const e=n.slice(i,i+r),t=new Array(e.length);let l;for(l=0;l<e.length;l+=1)t[l]=e.charCodeAt(l);const o=new window.Uint8Array(t);a.push(o)}return new window.Blob(a,{type:t})})((a=n,window.btoa(unescape(encodeURIComponent(a)))),"application/csv")},importXLSX:(e,t)=>{const{columns:r,file:n}=e,a=xn(r),i=new FileReader;i.onerror=()=>{P.message.error(p("qm.table.import.error"))},i.onload=e=>{const r=a.map((e=>e.title)),n=new(zo().Workbook),i=e.target;i?n.xlsx.load(i.result).then((e=>{const n=e.worksheets[0];if(n){const e=n.getSheetValues(),i=e.findIndex((e=>e&&e.length>0)),l=e[i],s=((e,t)=>t.some((t=>e.indexOf(t)>-1)))(r,l);if(s){const n=e.slice(i+1).map((e=>{const t={};e.forEach(((e,r)=>{let n=e;(0,J.isPlainObject)(n)&&(n=e.text),(0,J.isDate)(n)&&(n=Kn(e,vo)),t[l[r]]=n}));const n={};return r.forEach(((e,r)=>{const{dataIndex:i,dictItems:l}=a[r];Array.isArray(l)&&(t[e]?.toString().includes(",")?t[e]=t[e].split(",").map((e=>o(l,e))).filter((e=>""!==e)):t[e]=o(l,t[e])),$n(n,i,t[e])})),n}));t?.(n)}else P.message.error(p("qm.table.import.error"))}else P.message.error(p("qm.table.import.error"))})):P.message.error(p("qm.table.import.error"))},i.readAsArrayBuffer(n)}}},es=e=>{const{fileType:r,onChange:n}=e;let a,i;const l=Ce("table"),o=e=>{const t=e.name,r=t.lastIndexOf("."),n=t.substring(r+1,t.length);return{filename:t.substring(0,r),type:n}};return t().createElement(he,{onClick:()=>(async()=>{try{const e=await(e=>{const t=Object.assign({},e);return a||(a=document.createElement("form"),i=document.createElement("input"),a.className=`${l}--file-form`,i.name="file",i.type="file",a.appendChild(i),document.body.appendChild(a)),new Promise(((e,r)=>{const n=!t.type;i.multiple=!!t.multiple,i.accept=n?"":`.${t.type}`,i.onchange=l=>{const{files:s}=l.target,c=s[0];let u="";if(!n)for(let e=0;e<s.length;e++){const{type:r}=o(s[e]);if(t.type!==r){u=r;break}}u?(P.message.warning(p("qm.upload.notType",{type:u})),r()):e(c),document.body.removeChild(a),a=null,i=null},a.reset(),i.click()}))})({type:r});n?.(e.name,e)}catch(e){}})()},p("qm.upload.text"))},ts=e=>{const{columns:r,onClose:n}=e,{tableRef:a,createTableData:i,dataChange:l}=t().useContext(mo),{beforeTableImport:o}=a.current.props,{importXLSX:s}=Jo(),c=t().useRef(null),[u,d]=t().useState(!1),[m,h]=t().useState(!0),f=e=>e.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))),[g,b]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName",render:(e,r)=>{const{fileName:n}=r.GET_FIELDS_VALUE(["fileName"]);return t().createElement(t().Fragment,null,n?t().createElement("span",null,n):t().createElement(es,{fileType:r.state.formData.fileType,onChange:(e,t)=>{r.SET_FIELDS_VALUE({fileName:e,file:t}),t&&h(!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=>{g.find((e=>"posIndex"===e.fieldName)).hidden="insert"!==e,b([...g])}},{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}}]),y=Ce("table");return t().createElement("div",{className:`${y}-import__setting`},t().createElement(vl,{ref:c,initialValues:{fileType:"xlsx",importType:"fill"},initialExtras:{posIndex:"条"},items:g,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:u,disabled:m,onClick:()=>(async()=>{const[e,t]=await c.current.GET_FORM_DATA();e||(d(!0),s({columns:f(r),file:t.file},(async e=>{const{tableFullData:r,store:s}=a.current;if(e=Array.from(e).map((e=>e||{})),"function"==typeof o)try{e=await o(e)}catch(e){}if("fill"===t.importType&&i(e),"add"===t.importType&&i([...r,...e]),"insert"===t.importType){const{tableFullData:r}=a.current,n=t.posIndex,l=r.slice(0,n).concat(e).concat(r.slice(n));i(l)}e.forEach((e=>{s.addToInserted(e)})),l(),P.message.success(p("qm.table.import.success",{total:e.length})),d(!1),n()})))})()},p("qm.table.import.text"))))},rs=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s={[`${Ce("table")}-import`]:!0},c={visible:i,title:p("qm.table.import.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(s),title:p("qm.table.import.textNoSpace"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.ImportOutlined,null))),t().createElement(ur,c,t().createElement(ts,{columns:n,onClose:()=>l(!1)})))}));rs.displayName="TableImport";const ns=rs,as=e=>{const{columns:r,onChange:n}=e,{$size:a}=t().useContext(mo),i=t().useRef([]),[l,o]=t().useState(!1),[s,c]=t().useState(r);qe((()=>{d()}),[s]),t().useEffect((()=>{u()}),[r]);const u=()=>{const e=[];r.forEach(((t,n)=>{const a=t.colSpan;a>1&&r.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&e.push(r.slice(n,n+a))})),i.current=e},d=()=>{const e=[];s.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=i.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...i.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=s.find((e=>e.dataIndex===n));return r>0&&void 0!==t.hidden&&(a.hidden=t.hidden),a})))})),n?.(e)},m=Ce("table"),h={[`${m}__popper`]:!0,"column-filter__popper":!0,[`${m}--lg`]:"large"===a,[`${m}--sm`]:"small"===a},f=[`${m}-column-filter`,{selected:l}];return t().createElement(Pa(),{action:["click"],popupVisible:l,popup:t().createElement("div",{className:"column-filter--wrap",style:{overflowY:"auto",maxHeight:"calc(100vh - 10px)"}},t().createElement("div",{className:"main"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:s,setList:e=>{const t=e.map((e=>e.dataIndex)),r=s.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||c(Qn(e))}},s.map((e=>((e,r)=>{const{colSpan:n}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const a=["svgicon","handle","main-handle"];return t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(P.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,c([...s])}}),t().createElement("i",{className:Se()(a),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title))})(e)))))),popupClassName:Se()(h),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{o(e)},builtinPlacements:Eo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomLeft",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(f),title:p("qm.table.columnFilter.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),t().createElement("span",null,p("qm.table.columnFilter.text"))))},is=e=>{const{defaultValue:r,onClose:n,onOk:a}=e,{tableRef:i,selectionKeys:l,pagination:o,showSummary:c}=t().useContext(mo),{rowSelection:u}=i.current.props,d=t().useRef(null),[m,h]=t().useState(!1),f=t().useMemo((()=>Object.assign({},{fileName:`${s()().format(xo)}.xlsx`,fileType:"xlsx",sheetName:"sheet1",exportType:l.length?"selected":"all","startIndex|endIndex":[1,o.total],footSummation:c?1:0,useStyle:0},r,{columns:ce(r.columns||[])})),[]),[g,b]=t().useState([{type:"INPUT",label:p("qm.table.export.fileName"),fieldName:"fileName"},{type:"SELECT",label:p("qm.table.export.fileType"),fieldName:"fileType",options:{itemList:[{text:"xlsx",value:"xlsx"},{text:"csv",value:"csv"}]}},{type:"INPUT",label:p("qm.table.export.sheetName"),fieldName:"sheetName"},{type:"RANGE_INPUT_NUMBER",fieldName:"startIndex|endIndex",label:{type:"SELECT",fieldName:"exportType",options:{itemList:[{text:p("qm.table.export.all"),value:"all"},{text:p("qm.table.export.selected"),value:"selected",disabled:"checkbox"!==u?.type},{text:p("qm.table.export.custom"),value:"custom"}]},onChange:e=>{g.find((e=>"startIndex|endIndex"===e.fieldName)).disabled="custom"!==e,b([...g])}},options:{min:1},disabled:!0},{type:"INPUT",label:p("qm.table.columnFilter.text"),fieldName:"columns",render:(e,r)=>t().createElement(as,{columns:r.state.formData.columns,onChange:e=>{r.SET_FIELDS_VALUE({columns:e})}})},{type:"CHECKBOX",label:p("qm.table.export.footSummation"),fieldName:"footSummation",disabled:!c,options:{trueValue:1,falseValue:0}},{type:"CHECKBOX",label:p("qm.table.export.useStyle"),fieldName:"useStyle",options:{trueValue:1,falseValue:0}}]),y=Ce("table");return t().createElement("div",{className:`${y}-export__setting`},t().createElement(vl,{ref:d,initialValues:f,items:g,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:m,onClick:()=>(async()=>{const[e,t]=await 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 ie(1e3),h(!1),n()}})()},p("qm.table.export.text"))))},ls=t().forwardRef(((e,r)=>{const{tableColumns:n,open:a=!0}=e,{global:i}=t().useContext(l),{tableRef:o,tableBodyRef:c,flattenColumns:u,pagination:d,fetchParams:m,isFetch:h,isGroupSubtotal:f,showSummary:g,getSpan:b}=t().useContext(mo),{exportExcel:y,fetch:v,showHeader:x}=o.current.props,{getTitleFromCellValue:E}=jo(),[S,C]=t().useState(!1),[w,N]=t().useState(!1),T=t().useMemo((()=>!!y?.fetch?.api),[y]),I=t().useMemo((()=>!d.total||w),[d.total,w]),R=t().useMemo((()=>In(n,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn])),[n]),O=t().useMemo((()=>In(u,[Io.expandableColumn,Io.selectionColumn,Io.operationColumn])),[u]),A=(e,t)=>{const r={};return e.filter((e=>!!e.summation)).forEach((e=>{const{dataIndex:n}=e,a=(f?zn(t):t).reduce(((e,t)=>{if(t?.[Io.summaryIgnore])return e;const r=Number(Ln(t,n));return Number.isNaN(r)?e:e+r}),0);$n(r,n,a)})),[r]},k=(e,t,r,n)=>{const{precision:a,formatType:i}=r;let l=E(e,r,t,n);return a>=0&&!i&&""!==l&&(l=Number(l)),l},{exportXLSX:F,exportCSV:H}=Jo(),L=async e=>{const{api:t,formatter:r=(e=>e),afterFetch:n,dataKey:a}=v;let i=[];try{N(!0);const l=await t({...r(m),[Io.currentPageName]:1,[Io.pageSizeName]:e??d.total});if(200===l.code){let e=Array.isArray(l.data)?l.data:(0,J.get)(l.data,a)??[];e="function"==typeof n?await n(e):e,i=On(e.map(((e,t)=>{const r={...e,index:t,pageIndex:t};return O.forEach(((e,t)=>{const{dataIndex:n}=e;"index"!==n&&"pageIndex"!==n&&$n(r,n,Ln(r,n))})),r})))}}catch(e){}return N(!1),i},$=e=>{const t=i?.table?.recordExportLog;try{t?.({fileName:e})}catch(e){}},_=y?.fileName??`${s()().format(xo)}.xlsx`,D=_.slice(_.lastIndexOf(".")+1).toLowerCase(),q=()=>{if(I)return P.message.warning(p("qm.table.export.warnText"));T?(async e=>{N(!0);try{const{api:t,params:r}=y.fetch,n=await t({columns:O.map((e=>{const{title:t,dataIndex:r,hidden:n}=e,{type:a}=e.filter||{};return{title:t,dataIndex:r,type:a,hidden:n}})),...m,...r,tsortby:void 0,tsummary:void 0,tgroupby:void 0,[Io.currentPageName]:void 0,[Io.pageSizeName]:void 0});n.data&&(Ft(n.data,e),$(e))}catch(e){}N(!1)})(_):C(!0)};t().useImperativeHandle(r,(()=>({clickHandle:q})));const j={[`${Ce("table")}-export`]:!0},K={visible:S,title:p("qm.table.export.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>C(!1)},M={fileName:_.slice(0,_.lastIndexOf(".")),fileType:D,columns:R,useStyle:y?.cellStyle?1:0};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(j),title:p("qm.table.export.textNoSpace"),onClick:()=>q()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.DownloadOutlined,null))),t().createElement(ur,K,t().createElement(is,{defaultValue:M,onClose:()=>C(!1),onOk:e=>{(async e=>{const{fileName:t,fileType:r,exportType:n,startIndex:a=1,endIndex:i}=e,{allTableData:l,selectionRows:s}=o.current;let c=[];if(h?("all"===n&&(c=await L()),"custom"===n&&(c=await L(i),c=c.slice(a-1))):("all"===n&&(c=l.slice(0)),"custom"===n&&(c=l.slice(a-1,i||void 0))),"selected"===n&&(c=s.slice(0).sort(((e,t)=>e.pageIndex-t.pageIndex))),"function"==typeof y?.beforeExport)try{c=y?.beforeExport(c)}catch(e){}if("xlsx"===r){const r=await F(e,c,A,k);Ft(r,`${t}.xlsx`),$(`${t}.xlsx`)}if("csv"===r){const r=H(e,((e,t)=>{const{columns:r,footSummation:n}=e,a=Pn(r),i=xn(r);let l='<table width="100%" border="0" cellspacing="0" cellpadding="0">';return l+=`<colgroup>${i.map((e=>{let{width:t,minWidth:r,renderWidth:n}=e;return`<col style="width:${t||n||r||Io.defaultColumnWidth}px">`})).join("")}</colgroup>`,x&&(l+=["<thead>",a.map((e=>`<tr>${e.map((e=>{const{rowSpan:t,colSpan:r}=e;return 0===r?null:`<th colspan="${r}" rowspan="${t}">${e.title}</th>`})).join("")}</tr>`)).join(""),"</thead>"].join("")),t.length&&(l+=`<tbody>${t.map((e=>`<tr>${i.map(((r,n)=>{const{rowSpan:a,colSpan:i}=b(e,r,e.index,n,t);return a&&i?`<td rowspan="${a}" colspan="${i}">${k(e,e.index,r,n)}</td>`:null})).join("")}</tr>`)).join("")}</tbody>`),g&&n&&(l+=["<tfoot>",A(i,t).map((e=>`<tr>${i.map(((r,n)=>{const{dataIndex:a,summation:i}=r,l=i?.render?i.render(t):Ln(e,a);return`<td>${0===n&&""===l?p("qm.table.config.summaryText"):te(l)?Vn(l).join(""):l}</td>`})).join("")}</tr>`)).join(""),"</tfoot>"].join("")),l+="</table>",l})(e,c));Ft(r,`${t}.csv`),$(`${t}.csv`)}})(Object.assign({},e,{columns:En(e.columns)}))}})))}));ls.displayName="TableExport";const os=ls,ss=e=>{const{columns:r,onClose:n}=e,{tableRef:a,tableBodyRef:i,dataChange:l}=t().useContext(mo),{beforeClipboard:o}=a.current.props,s=t().useRef(null),[c,u]=t().useState([{type:"INPUT_NUMBER",label:p("qm.table.clipboard.rowIndex"),fieldName:"rowIndex",options:{min:1},extra:{labelWidth:50},rules:[{required:!0}]},{type:"SELECT",label:p("qm.table.clipboard.colIndex"),fieldName:"dataIndex",options:{itemList:r.map(((e,t)=>({value:t,text:e.title})))},rules:[{required:!0}],extra:{labelWidth:50}},{type:"TEXT_AREA",label:p("qm.table.clipboard.content"),fieldName:"content",placeholder:p("qm.table.clipboard.placeholder"),options:{autoSize:{minRows:4}},rules:[{required:!0}]}]),[d,m]=t().useState(!1),h=Ce("table");return t().createElement("div",{className:`${h}-clipboard__setting`},t().createElement("h3",{className:"info"},p("qm.table.clipboard.supportText")),t().createElement(vl,{ref:s,initialValues:{},initialExtras:{rowIndex:"行",dataIndex:"列"},items:c,cols:1,labelWidth:100}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>n(),style:{marginRight:8}},p("qm.table.export.closeButton")),t().createElement(he,{type:"primary",loading:d,onClick:()=>(async()=>{const[e,t]=await s.current.GET_FORM_DATA();if(e)return;const{tableFullData:c,store:u}=a.current;m(!0);const d=t.content.trim().replace(/(\r|\n)$/,"");let h=d.replace(/"[^"]+"/g,"^");(d.match(/"[^"]+"/g)?.map((e=>e.replace(/"/g,"").replace(/\r|\n/g," ")))||[]).forEach((e=>{h=h.replace(/\^/,e)}));let f=h.split(/\r|\n/).map((e=>e.split(/\t/)));if("function"==typeof o)try{f=await o(f,f[0].map(((e,n)=>r[t.dataIndex+n].dataIndex)))}catch(e){}f.forEach(((e,n)=>{e.forEach(((e,i)=>{const l=c[t.rowIndex-1+n],o=r[t.dataIndex+i];if(l&&o){let t=!1;if(o.editRender){const e=o.editRender(l,o);t=!(e.disabled||e.extra?.disabled||a.current.fieldAuth[o.dataIndex]?.disabled)}t&&o.dictItems&&(t=o.dictItems.some((t=>t.value==e))),t&&($n(l,o.dataIndex,e),u.addToUpdated(l))}}))})),i.current.forceUpdate(),l(),P.message.success(p("qm.table.clipboard.success",{total:f.length})),m(!1),n()})()},p("qm.table.clipboard.text"))))},cs=t().forwardRef(((e,r)=>{const{flattenColumns:n,open:a=!0}=e,[i,l]=t().useState(!1),o=t().useMemo((()=>(e=>e.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))))(n)),[n]),s=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:s})));const c={[`${Ce("table")}-clipboard`]:!0},u={visible:i,title:p("qm.table.clipboard.settingTitle"),width:600,height:"auto",loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:Se()(c),title:p("qm.table.clipboard.textNoSpace"),onClick:()=>s()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CopyOutlined,null))),t().createElement(ur,u,t().createElement(ss,{columns:o,onClose:()=>l(!1)})))}));cs.displayName="TableClipboard";const us=cs,ds=e=>{const{columns:r,onClose:n}=e,{tableRef:a,$size:i,selectionKeys:l,setSelectionKeysEffect:o}=t().useContext(mo),{rowKey:s}=a.current.props,c=t().useRef(null),u=Ct(c),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})),[m,h]=t().useState([{title:p("qm.table.groupSummary.index"),dataIndex:"index",width:80,render:e=>e+1},...d(r.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))))]),[f]=t().useState(a.current.selectionRows.map((e=>({...e,children:void 0})))),[g,b]=t().useState(300),y=wt((()=>{const e=c.current;b(e.offsetHeight-2*ya[i]-30)}),5);return qe((()=>{y()}),[u.width]),t().createElement("div",{ref:c,style:{height:"100%"}},t().createElement(fc,{size:i,columns:m,dataSource:f,rowKey:s,height:g,rowSelection:{type:"checkbox",selectedRowKeys:l,onChange:e=>o(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"))))},ps=t().forwardRef(((e,r)=>{const{columns:n,open:a=!0}=e,{tableRef:i,getRowKey:l,selectionKeys:o,isFetch:s,isTableEmpty:c,setSelectionKeysEffect:u,setSelectionRows:d}=t().useContext(mo),{rowSelection:m}=i.current.props,[h,f]=t().useState(!1),g=t().useRef(!1);qe((()=>{!g.current&&b()}),[c]);const b=async()=>{const{fetchSelectedRows:e,disabled:t=(e=>!1)}=m;if(s&&e)try{const r=await e.api(Object.assign({},{selectedKeys:o},e.params));if(200===r.code){let n=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];n=n.filter((e=>!t(e))),u(n.map(((e,t)=>l(e,t)))),d(n),g.current=!0}}catch(e){}},y=()=>{f(!0)};t().useImperativeHandle(r,(()=>({clickHandle:y})));const v=Ce("table"),x={visible:h,title:p("qm.table.selectCollection.settingTitle"),loading:!1,bodyStyle:{paddingBottom:"52px"},onClose:()=>f(!1)};return t().createElement(t().Fragment,null,a&&t().createElement("span",{className:`${v}-select-collection`,title:p("qm.table.selectCollection.text"),onClick:()=>y()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.CheckSquareOutlined,null))),t().createElement(ur,x,t().createElement(ds,{columns:n,onClose:()=>f(!1)})))}));ps.displayName="SelectCollection";const ms=ps,hs=require("localforage");var fs=n.n(hs);const gs=e=>"string"==typeof e&&/^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?$/.test(e),bs=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableRef:a,getRowKey:i,$size:o,flattenColumns:s,pagination:c,setPagination:u,scrollYToRecord:d,setHighlightKey:m,setShouldToTop:h,isTreeTable:f,isWebPagination:b}=t().useContext(mo),{uniqueKey:y}=a.current.props,v=t().useRef(null),x=t().useRef(null),E=t().useRef([]),S=t().useRef(""),C=t().useRef(-1),w=t().useRef("stop");qe((()=>{const{current:e,pageSize:t}=c,r=a.current.tableFullData.slice((e-1)*t,e*t),n=On(r).findIndex((e=>i(e,e.index)===S.current));d("",n)}),[c.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=>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 v.current.GET_FORM_DATA(),[r,n]=await x.current.GET_FORM_DATA(),a=(0,J.omitBy)(Object.assign({},t,n),se);A(a)}}))),I={case:0,fullchar:0},R=t().useMemo((()=>s.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex))).filter((e=>e.filter))),[s]),[O,A]=t().useState({}),[k,F]=t().useState(I),[H]=t().useState(T([R[0]])),[L]=t().useState(T(R.slice(1))),[$,_]=t().useState(0),D=t().useMemo((()=>!Object.keys(O).length),[O]);qe((()=>{w.current="ready"}),[O,k]);const q=e=>{F(Object.assign({},k,e))},j=(e,t,r)=>new Promise(((n,a)=>{P.Modal.confirm({title:p("qm.button.confirmPrompt"),content:e,onOk:()=>{t(),n()},onCancel:()=>{r(),n()}})})),K=async e=>{if(!Object.keys(O).length)return P.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.queryCondition")});if("ready"===w.current&&(w.current="stop",E.current=(e=>{const{allTableData:t}=a.current,r=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];let i=!0;for(const t in e){const{type:r}=R.find((e=>e.dataIndex===t)).filter;let n=Ln(a,t),l=!0;if("text"===r||"textarea"===r?l=new RegExp(k.fullchar?`^${e[t]}$`:e[t],k.case?"":"i").test(n):(n=gs(n)?n.slice(0,10):n,l=n==e[t]),!l){i=!1;break}}i&&r.push(a)}return r})(O),_(E.current.length)),!E.current.length)return m(""),P.Modal.warning({title:p("qm.button.confirmPrompt"),content:p("qm.table.fastSearch.notMatch")});"next"===e&&(C.current=C.current<0?0:C.current+1,C.current>E.current.length-1&&await j(p("qm.table.fastSearch.toTheEnd"),(()=>C.current=0),(()=>C.current=E.current.length-1))),"prev"===e&&(C.current=C.current<0?E.current.length-1:C.current-1,C.current<0&&await j(p("qm.table.fastSearch.toStart"),(()=>C.current=E.current.length-1),(()=>C.current=0)));const t=E.current[C.current],r=i(t,t.index);let n=t.index;if(f&&b){const e=Gn(a.current.deriveRowKeys,r)[0];n=a.current.tableFullData.findIndex((t=>i(t,t.index)===e))}((e,t)=>{if(S.current=e,b){const{pageSize:e}=c,r=Math.ceil((t+1)/e);h(!1),u(Object.assign({},c,{current:r}))}else d(e)})(r,n),m(r)},M=()=>{v.current.RESET_FORM(),x.current.RESET_FORM()},V=t().useMemo((()=>y?`fastSearch_${y}`:""),[y]),[z,U]=t().useState([]),[B,W]=t().useState(""),[G,Y]=t().useState("");qe((()=>{if(G){const{filters:e,config:t}=z.find((e=>e.value===G)).list;v.current.SET_FIELDS_VALUE(Z()(e,L.map((e=>e.fieldName)))),x.current.SET_FIELDS_VALUE(Z()(e,H.map((e=>e.fieldName)))),A(e),F(t)}else M(),A({}),F(I)}),[G]),t().useEffect((()=>{X()}),[]);const X=async()=>{if(!V)return;let e=await fs().getItem(V);e||(e=await Q(V),Array.isArray(e)&&await fs().setItem(V,e)),Array.isArray(e)&&e.length&&(U(e),Y(e[0].value))},Q=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},ee=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},te=Ce("table");return t().createElement("div",{className:`${te}-fast-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"top"},t().createElement("div",{className:"container"},t().createElement(er,{defaultActiveKey:"1",size:"small",tabBarExtraContent:t().createElement("span",null,p("qm.table.alert.total",{total:$}))},t().createElement(er.TabPane,{tab:p("qm.table.fastSearch.tabPanes.0"),key:"1",forceRender:!0},t().createElement(vl,{ref:v,items:H,cols:1,labelWidth:110})),t().createElement(er.TabPane,{tab:p("qm.table.fastSearch.tabPanes.1"),key:"2",forceRender:!0},t().createElement(vl,{ref:x,items:L,cols:1,labelWidth:110})))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(P.Input,{size:o,value:B,placeholder:p("qm.table.highSearch.configText"),disabled:D,onChange:e=>{const{value:t}=e.target;W(t)}}),t().createElement(he,{type:"primary",disabled:!B||D,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!V)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Mn(),t=[...z,{text:B,value:e,list:{filters:O,config:k}}];U(t),Y(e),W(""),await fs().setItem(V,t),await ee(V,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Io.rowHeightMaps[o]}px`}},t().createElement("span",null,p("qm.table.fastSearch.savedSetting"))),t().createElement("ul",null,z.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===G}),title:e.text,onClick:()=>(e=>{Y(e!==G?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=z.filter((t=>t.value!==e));U(t),e===G&&Y(""),await fs().setItem(V,t),await ee(V,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!z.length&&t().createElement("div",{style:{padding:fo}},t().createElement(ht,null)))))),t().createElement("div",{className:"bottom"},t().createElement("div",null,t().createElement(P.Checkbox,{checked:!!k.case,onChange:e=>q({case:e.target.checked})},p("qm.table.fastSearch.matchCase")),t().createElement(P.Checkbox,{checked:!!k.fullchar,onChange:e=>q({fullchar:e.target.checked})},p("qm.table.fastSearch.matchFullchar"))),t().createElement("div",null,t().createElement(he,{onClick:()=>M()},p("qm.table.fastSearch.clear"))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,height:`${ya[o]+20}px`,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.fastSearch.closeButton")),t().createElement(he,{type:"primary",style:{marginRight:8},onClick:()=>K("prev")},p("qm.table.fastSearch.queryPrev")),t().createElement(he,{type:"primary",onClick:()=>K("next")},p("qm.table.fastSearch.queryNext"))))},ys=t().forwardRef(((e,r)=>{const{open:n=!0}=e,{$size:a}=t().useContext(mo),[i,l]=t().useState(!1),o=()=>{l(!0)};t().useImperativeHandle(r,(()=>({clickHandle:o})));const s=Ce("table"),c={visible:i,title:p("qm.table.fastSearch.settingTitle"),width:600,loading:!1,bodyStyle:{paddingBottom:`${ya[a]+20}px`},onClose:()=>l(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${s}-super-search`,title:p("qm.table.fastSearch.text"),onClick:()=>o()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.MonitorOutlined,null))),t().createElement(ur,c,t().createElement(bs,{onClose:()=>l(!1)})))}));ys.displayName="FastSearch";const vs=ys,xs=e=>{const{columns:r,group:n,summary:a}=e,{tableRef:i,$size:l,pagination:o,fetchParams:c,isFetch:u}=t().useContext(mo),{fetch:d}=i.current.props,m=e=>{const t=r.find((t=>t.dataIndex===e));return{title:t.title,precision:t.precision,dictItems:t.dictItems??[]}},h=n.map((e=>({dataIndex:e.group,...m(e.group)}))),f=a.map((e=>e.summary===Io.groupSummary.total.value?{dataIndex:e.summary,title:Io.groupSummary.total.text,formula:e.formula}:{dataIndex:e.summary,...m(e.summary),formula:e.formula})),g=t().useMemo((()=>Object.assign({},c,{[Io.sorterFieldName]:void 0,[Io.groupSummary.summaryFieldName]:a.map((e=>`${e.formula}|${e.summary}`)).join(","),[Io.groupSummary.groupbyFieldName]:n.map((e=>e.group)).join(","),usedJH:2,[Io.currentPageName]:1})),[c,n,a]),[b,y]=t().useState(((e,t)=>[{title:p("qm.table.groupSummary.index"),dataIndex:"pageIndex",width:80,render:e=>e+1},...e.map((e=>({title:e.title,dataIndex:e.dataIndex,dictItems:e.dictItems}))),...t.map((e=>{const t=r.find((t=>t.dataIndex===e.dataIndex))?.groupSummary;let n=t?{summation:t}:null;return e.dataIndex===Io.groupSummary.total.value&&(n={dataIndex:Io.groupSummary.recordTotalIndex,summation:{render:()=>o.total}}),{...e,..."count"===e.formula||"sum"===e.formula?n:null}}))])(h,f)),[v]=t().useState(u?[]:(e=>{const t=Bn(e,n.map((e=>e.group))),r=[];return t.forEach((e=>{const t={};b.forEach((r=>{const{dataIndex:n}=r;"index"!==n&&$n(t,n,Ln(e[0],n))})),a.forEach((r=>{const n=r.summary!==Io.groupSummary.total.value?r.summary:Io.groupSummary.recordTotalIndex,a=r.formula;"count"===a&&$n(t,n,e.length),"sum"===a&&$n(t,n,(0,J.sumBy)(e,n)),"max"===a&&$n(t,n,(0,J.maxBy)(e,n)[n]),"min"===a&&$n(t,n,(0,J.minBy)(e,n)[n]),"avg"===a&&$n(t,n,((0,J.sumBy)(e,n)/e.length).toFixed(2))})),r.push(t)})),r})(i.current.tableFullData)),x={size:l,height:400,...u?{fetch:{api:d.api,params:g,dataKey:d?.dataKey}}:{dataSource:v},columns:b,rowKey:e=>e.index,showFastSearch:!1,showTableImport:!1,exportExcel:{fileName:`${s()().format("YYYYMMDDHHmmss")}.xlsx`},tablePrint:{showLogo:!0},columnsChange:e=>y(e)};return t().createElement(fc,x)},Es=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableRef:a,$size:i,flattenColumns:o}=t().useContext(mo),{uniqueKey:s}=a.current.props,c=t().useRef(null),u=t().useRef(null),[d,m]=t().useState(!1),[h,f]=t().useState([]),[b,y]=t().useState(""),[v,x]=t().useState("");qe((()=>{if(v){const{group:e,summary:t}=h.find((e=>e.value===v)).list;I(e),k(t)}else{const e=$();I(e?.group||[]),k(e?.summary||[])}}),[v]),t().useEffect((()=>{_()}),[]);const E=t().useMemo((()=>s?`summary_${s}`:""),[s]),S=t().useMemo((()=>o.filter((e=>![Io.expandableColumn,Io.selectionColumn,"index","pageIndex",Io.operationColumn].includes(e.dataIndex)))),[o]),C=S.filter((e=>!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex}))),w=[Io.groupSummary.total,...S.filter((e=>!!e.groupSummary)).map((e=>({text:e.title,value:e.dataIndex})))],N=[{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"}],[T,I]=t().useState([]),[R,O]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{c.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"group",title:p("qm.table.groupSummary.groupItem"),minWidth:200,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:C.map((e=>({...e,disabled:T.findIndex((t=>t.group===e.value))>-1})))})}]),[A,k]=t().useState([]),[F,H]=t().useState([{title:p("qm.table.groupSummary.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{u.current.REMOVE_RECORDS(r)}},p("qm.table.groupSummary.removeText")))},{dataIndex:"summary",title:p("qm.table.groupSummary.summaryColumn"),minWidth:200,editRender:e=>({type:"select",editable:!0,items:w.map((e=>({...e,disabled:A.findIndex((t=>t.summary===e.value))>-1}))),extra:{cornerSign:!1},onChange:t=>{e.formula=""}})},{dataIndex:"formula",title:p("qm.table.groupSummary.calcFormula"),width:140,editRender:e=>({type:"select",editable:!0,extra:{cornerSign:!1},items:e.summary===Io.groupSummary.total.value?N.slice(N.length-1):N})}]),L=t().useMemo((()=>{const e=T.length&&T.every((e=>Object.values(e).every((e=>""!==e)))),t=A.length&&A.every((e=>Object.values(e).every((e=>""!==e))));return!(e&&t)}),[T,A]),$=()=>{if(!E)return;const e=sessionStorage.getItem(E);return e?JSON.parse(e):null},_=async()=>{if(!E)return;const e=$();if(e){const{group:t,summary:r}=e;I(t),k(r)}let t=await fs().getItem(E);t||(t=await D(E),Array.isArray(t)&&await fs().setItem(E,t)),Array.isArray(t)&&t.length&&(f(t),!e&&x(t[0].value))},D=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table"),K={visible:d,title:p("qm.table.groupSummary.resultText"),loading:!1,onClose:()=>m(!1)};return t().createElement("div",{className:`${j}-group-summary__setting`},t().createElement("div",{className:"main"},t().createElement("div",{style:{width:"30%"}},t().createElement(fc,{ref:c,size:i,columns:R,dataSource:T,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>O(e),onDataChange:e=>{I(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{c.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"container line"},t().createElement(fc,{ref:u,size:i,columns:F,dataSource:A,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>H(e),onDataChange:e=>{k(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{u.current.INSERT_RECORDS({})},style:{marginRight:0}}))),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(P.Input,{size:i,value:b,placeholder:p("qm.table.groupSummary.configText"),disabled:L,onChange:e=>{const{value:t}=e.target;y(t)}}),t().createElement(he,{type:"primary",disabled:!b||L,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!E)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Mn(),t=[...h,{text:b,value:e,list:{group:T.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))}}];f(t),x(e),y(""),await fs().setItem(E,t),await q(E,t)})()},p("qm.table.groupSummary.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Io.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.groupSummary.savedSetting"))),t().createElement("ul",null,h.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===v}),title:e.text,onClick:()=>(e=>{x(e!==v?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.groupSummary.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=h.filter((t=>t.value!==e));f(t),e===v&&x(""),await fs().setItem(E,t),await q(E,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!h.length&&t().createElement("div",{style:{padding:fo}},t().createElement(ht,null)))))),t().createElement(ur,K,t().createElement(xs,{columns:S,group:T,summary:A})),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.groupSummary.closeButton")),t().createElement(he,{type:"primary",disabled:L,onClick:()=>(E&&sessionStorage.setItem(E,JSON.stringify({group:T.filter((e=>!!e.group)),summary:A.filter((e=>!!e.summary))})),void m(!0))},p("qm.table.groupSummary.confirmButton"))))},Ss=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.groupSummary.settingTitle"),loading:!1,width:"65%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-group-summary`,title:p("qm.table.groupSummary.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.PieChartOutlined,null))),t().createElement(ur,s,t().createElement(Es,{onClose:()=>i(!1)})))}));Ss.displayName="GroupSummary";const Cs=Ss,ws=e=>{const{onClose:r}=e,{global:n}=t().useContext(l),{tableRef:a,$size:i,flattenColumns:o,setSuperFilters:s,clearTableFilter:c}=t().useContext(mo),{uniqueKey:u}=a.current.props,d=t().useRef(null),[m,h]=t().useState([]),[f,b]=t().useState([]),[y,v]=t().useState(""),[x,E]=t().useState("");qe((()=>{h(x?f.find((e=>e.value===x)).list:$()||[])}),[x]),t().useEffect((()=>{_()}),[]);const S=t().useMemo((()=>u?`superSearch_${u}`:""),[u]),C=t().useMemo((()=>o.filter((e=>!!e.filter))),[o]),w=Un(m),N=t().useMemo((()=>!(w&&yn(w))),[w]),T=t().useMemo((()=>!!m.length&&N),[m,N]),I=[{value:"and",text:p("qm.table.highSearch.andText")},{value:"or",text:p("qm.table.highSearch.orText")}],R=o.filter((e=>!!e.filter)).map((e=>({value:e.dataIndex,text:e.title}))),O=e=>["in","nin"].includes(e),A=(e,t)=>{let r;switch(e){case"number":r="number";break;case"date":r="date";break;case"checkbox":case"radio":r=t?"select-multiple":"select";break;default:r="text"}return r},k=e=>{let t=[];switch(e){case"date":case"number":t=[{value:">",text:p("qm.table.highSearch.gtText")},{value:"<",text:p("qm.table.highSearch.ltText")},{value:">=",text:p("qm.table.highSearch.gteText")},{value:"<=",text:p("qm.table.highSearch.lteText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;case"checkbox":case"radio":t=[{value:"in",text:p("qm.table.highSearch.inText")},{value:"nin",text:p("qm.table.highSearch.ninText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}];break;default:t=[{value:"like",text:p("qm.table.highSearch.likeText")},{value:"==",text:p("qm.table.highSearch.eqText")},{value:"!=",text:p("qm.table.highSearch.neqText")}]}return t},[F,H]=t().useState([{title:p("qm.table.highSearch.operation"),dataIndex:"__action__",fixed:"left",width:80,render:(e,r)=>t().createElement("div",null,t().createElement(he,{type:"text",onClick:()=>{d.current.REMOVE_RECORDS(r)}},p("qm.table.highSearch.removeText")))},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketLeft",align:"right",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.fieldName"),dataIndex:"fieldName",width:160,required:!0,editRender:e=>({type:"select",editable:!0,items:R,rules:[{required:!0,message:p("qm.table.highSearch.noEmpty")}],extra:{cornerSign:!1},onChange:t=>{const r=Object.values(t)[0],n=C.find((e=>e.dataIndex===r))?.filter.type,a=k(n);e.fieldType=n,e.expression=r?a[0]?.value:"",e.condition=O(e.expression)?[]:"",r||(e.bracketLeft=e.bracketRight="")}})},{title:p("qm.table.highSearch.fieldType"),dataIndex:"fieldType",width:100,hidden:!0},{title:p("qm.table.highSearch.expression"),dataIndex:"expression",width:120,required:!0,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName))?.filter.type;return{type:"select",editable:!0,items:k(t),extra:{disabled:!e.fieldName,cornerSign:!1},onChange:()=>{e.condition=O(e.expression)?[]:""}}}},{title:p("qm.table.highSearch.condition"),dataIndex:"condition",minWidth:200,editRender:e=>{const t=C.find((t=>t.dataIndex===e.fieldName)),r=t?.filter.type,n=t?.filter?.items??t?.dictItems??[];return{type:A(r,O(e.expression)),editable:!0,items:n,extra:{disabled:!e.fieldName,cornerSign:!1}}}},{title:p("qm.table.highSearch.bracket"),dataIndex:"bracketRight",width:80,render:(e,r)=>t().createElement("span",{style:{fontSize:"20px"}},e)},{title:p("qm.table.highSearch.logic"),dataIndex:"logic",width:100,required:!0,editRender:e=>({type:"select",editable:!0,items:I,extra:{disabled:!e.fieldName,cornerSign:!1}})}]),L=()=>{S&&sessionStorage.setItem(S,JSON.stringify(m.filter((e=>!!e.fieldName))))},$=()=>{if(!S)return;const e=sessionStorage.getItem(S);return e?JSON.parse(e):null},_=async()=>{if(!S)return;const e=$();e&&h(e);let t=await fs().getItem(S);t||(t=await D(S),Array.isArray(t)&&await fs().setItem(S,t)),Array.isArray(t)&&t.length&&(b(t),!e&&E(t[0].value))},D=async e=>{const t=n?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},q=async(e,t)=>{const r=n?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},j=Ce("table");return t().createElement("div",{className:`${j}-super-search__setting`},t().createElement("div",{className:"main"},t().createElement("div",{className:"container"},t().createElement(fc,{ref:d,size:i,columns:F,dataSource:m,rowKey:"index",height:350,showFastSearch:!1,showTableImport:!1,showFullScreen:!1,showClipboard:!1,showColumnDefine:!1,columnsChange:e=>H(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;e.fieldName&&["bracketLeft","bracketRight"].includes(r)&&("bracketLeft"===r&&(e[r]=e[r]?"":"("),"bracketRight"===r&&(e[r]=e[r]?"":")"),h([...m]))},onDataChange:e=>{h(e)}},t().createElement(he,{type:"primary",icon:t().createElement(we.PlusOutlined,null),onClick:()=>{d.current.INSERT_RECORDS({bracketLeft:"",bracketRight:"",logic:"and"})},style:{marginRight:0}})),Io.highSearch.showSQL&&w&&t().createElement("code",{className:"lang-js"},w)),t().createElement("div",{className:"saved line"},t().createElement("div",{className:"form-wrap"},t().createElement(P.Input,{size:i,value:y,placeholder:p("qm.table.highSearch.configText"),disabled:N,onChange:e=>{const{value:t}=e.target;v(t)}}),t().createElement(he,{type:"primary",disabled:!y||N,style:{marginLeft:"10px"},onClick:()=>(async()=>{if(!S)return g("Table","必须设置组件参数 `uniqueKey` 才能保存");const e=Mn(),t=[...f,{text:y,value:e,list:m.filter((e=>!!e.fieldName))}];b(t),E(e),v(""),await fs().setItem(S,t),await q(S,t)})()},p("qm.table.highSearch.saveButton"))),t().createElement("div",{className:"card-wrap"},t().createElement("h5",{style:{height:`${Io.rowHeightMaps[i]}px`}},t().createElement("span",null,p("qm.table.highSearch.savedSetting"))),t().createElement("ul",null,f.map((e=>t().createElement("li",{key:e.value,className:Se()({selected:e.value===x}),title:e.text,onClick:()=>(e=>{E(e!==x?e:"")})(e.value)},t().createElement("span",{className:"title"},e.text),t().createElement("i",{className:"svgicon close",title:p("qm.table.highSearch.removeText"),onClick:t=>{t.stopPropagation(),(async e=>{if(!e)return;const t=f.filter((t=>t.value!==e));b(t),e===x&&E(""),await fs().setItem(S,t),await q(S,t)})(e.value)}},t().createElement(we.CloseCircleOutlined,null))))),!f.length&&t().createElement("div",{style:{padding:fo}},t().createElement(ht,null)))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right"}},t().createElement(he,{onClick:()=>r(),style:{marginRight:8}},p("qm.table.highSearch.closeButton")),t().createElement(he,{type:"primary",disabled:T,onClick:()=>(c(),s(m.map((e=>Z()(e,["index","pageIndex"])))),L(),void r())},p("qm.table.highSearch.searchButton"))))},Ns=t().forwardRef(((e,r)=>{const{open:n=!0}=e,[a,i]=t().useState(!1),l=()=>{i(!0)};t().useImperativeHandle(r,(()=>({clickHandle:l})));const o=Ce("table"),s={visible:a,title:p("qm.table.highSearch.settingTitle"),loading:!1,width:"70%",bodyStyle:{paddingBottom:"52px"},onClose:()=>i(!1)};return t().createElement(t().Fragment,null,n&&t().createElement("span",{className:`${o}-super-search`,title:p("qm.table.highSearch.text"),onClick:()=>l()},t().createElement("i",{className:"svgicon icon"},t().createElement(we.FunnelPlotOutlined,null))),t().createElement(ur,s,t().createElement(ws,{onClose:()=>i(!1)})))}));Ns.displayName="SuperSearch";const Ts=Ns,Is=t().forwardRef(((e,r)=>{const{tableColumns:n,showFullScreen:a,showReload:i,showPrint:o,showImport:s,showExport:c,showClipboard:u,showCollection:d,showFastSearch:m,showSuperSearch:h,showGroupSummary:f,showToolBox:b}=e,{global:y}=t().useContext(l),{tableRef:v,flattenColumns:x,isFullScreen:E,$size:S}=t().useContext(mo),{uniqueKey:C,exportExcel:w}=v.current.props,N=t().useRef(null),T=t().useRef(null),I=t().useRef(null),R=t().useRef(null),O=t().useRef(null),A=t().useRef(null),k=t().useRef(null),F=t().useRef(null),H=t().useRef(null),L=t().useRef(null),$=t().useRef(!1),_=t().useMemo((()=>C?`toolBox_${C}`:""),[C]),[D,q]=t().useState({fullScreen:!1,reload:!1,print:!1,import:!1,export:!1,clipboard:!1,collection:!1,fastSearch:!1,superSearch:!1,groupSummary:!1}),j={fullScreen:a,reload:i,print:o,import:s,export:c&&!w?.hideIcon,clipboard:u,collection:d,fastSearch:m,superSearch:h,groupSummary:f},[K,M]=t().useState(!1);qe((()=>{$.current&&(z(),$.current=!1)}),[D]),t().useEffect((()=>{V()}),[]),t().useImperativeHandle(r,(()=>({exportHandle:()=>{if(!O.current)return g("Table","执行导出需要配置 `exportExcel` 参数");O.current.clickHandle()}})));const V=()=>{if(!_||!b)return;const e=JSON.parse(localStorage.getItem(_));e||U(_).then((e=>{e&&(q(Object.assign({},D,e)),localStorage.setItem(_,JSON.stringify(e)))})).catch((()=>{})),e&&q(Object.assign({},D,e))},z=()=>{if(!_||!b)return;const e={};for(const t in D)D[t]&&(e[t]=D[t]);localStorage.setItem(_,JSON.stringify(e)),B(_,e)},U=async e=>{const t=y?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},B=async(e,t)=>{const r=y?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}},W=async e=>{M(!1),await ie(100),e.current.clickHandle()},G=(e,t)=>{$.current=!0,q(Object.assign({},D,{[t]:e}))},Y=Ce("table"),X={"top-toolbox__popper":!0,[`${Y}--lg`]:"large"===S,[`${Y}--sm`]:"small"===S};return t().createElement(t().Fragment,null,a&&t().createElement(_o,{ref:N,isFullScreen:E,open:!b||D.fullScreen}),i&&t().createElement(qo,{ref:T,open:!b||D.reload}),o&&t().createElement(Mo,{ref:I,tableColumns:n,open:!b||D.print}),s&&t().createElement(ns,{ref:R,tableColumns:n,open:!b||D.import}),c&&t().createElement(os,{ref:O,tableColumns:n,open:(!b||D.export)&&!w?.hideIcon}),u&&t().createElement(us,{ref:A,flattenColumns:x,open:!b||D.clipboard}),d&&t().createElement(ms,{ref:k,columns:n,open:!b||D.collection}),m&&t().createElement(vs,{ref:F,open:!b||D.fastSearch}),f&&t().createElement(Cs,{ref:H,open:!b||D.groupSummary}),h&&t().createElement(Ts,{ref:L,open:!b||D.superSearch}),b&&t().createElement(P.Dropdown,{open:K,trigger:["click"],placement:"bottomRight",dropdownRender:()=>(()=>{const e=[{key:"fullScreen",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.fullScreen,style:{marginRight:6},onChange:e=>G(e.target.checked,"fullScreen"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.screen.full"))),onClick:()=>W(N)},{key:"reload",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.reload,style:{marginRight:6},onChange:e=>G(e.target.checked,"reload"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.refresh.text"))),onClick:()=>W(T)},{key:"print",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.print,style:{marginRight:6},onChange:e=>G(e.target.checked,"print"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.print.text"))),onClick:()=>W(I)},{key:"import",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.import,style:{marginRight:6},onChange:e=>G(e.target.checked,"import"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.import.textNoSpace"))),onClick:()=>W(R)},{key:"export",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.export,style:{marginRight:6},onChange:e=>G(e.target.checked,"export"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.export.textNoSpace"))),onClick:()=>W(O)},{key:"clipboard",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.clipboard,style:{marginRight:6},onChange:e=>G(e.target.checked,"clipboard"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.clipboard.textNoSpace"))),onClick:()=>W(A)},{key:"collection",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.collection,style:{marginRight:6},onChange:e=>G(e.target.checked,"collection"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.selectCollection.text"))),onClick:()=>W(k)},{key:"fastSearch",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.fastSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"fastSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.fastSearch.text"))),onClick:()=>W(F)},{key:"groupSummary",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.groupSummary,style:{marginRight:6},onChange:e=>G(e.target.checked,"groupSummary"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.groupSummary.text"))),onClick:()=>W(H)},{key:"superSearch",label:t().createElement(t().Fragment,null,t().createElement(P.Checkbox,{checked:D.superSearch,style:{marginRight:6},onChange:e=>G(e.target.checked,"superSearch"),onClick:e=>e.stopPropagation()}),t().createElement("span",null,p("qm.table.highSearch.text"))),onClick:()=>W(L)}];return t().createElement(P.Menu,{items:e.filter((e=>j[e.key]))})})(),overlayClassName:Se()(X),overlayStyle:{minWidth:120},onOpenChange:e=>{M(e)}},t().createElement("span",{className:`${Y}-toolbox`,title:p("qm.table.toolbox.text")},t().createElement("i",{className:"svgicon icon"},t().createElement(we.AppstoreAddOutlined,null)))))}));Is.displayName="ToolBox";const Rs=Is,Os=(e,t)=>e.map((e=>(e.children&&(e.children=Os(e.children,t)),t(e)))),Ps=t().forwardRef(((e,r)=>{const{columns:n}=e,{global:a}=t().useContext(l),{tableRef:i,$size:o}=t().useContext(mo),{showColumnDefine:s,uniqueKey:c,onlyShowIcon:u,columnsChange:d}=i.current.props,m=t().useRef([]),h=e=>e.filter((e=>!e.noAuth&&"left"===e.fixed)),f=e=>e.filter((e=>!e.noAuth&&"right"===e.fixed)),g=e=>e.filter((e=>!e.noAuth&&!e.fixed)),[b,y]=t().useState(!1),[v,x]=t().useState(h(n)),[E,S]=t().useState(f(n)),[C,w]=t().useState(g(n)),N=t().useMemo((()=>c?`table_${c}`:""),[c]),T=t().useMemo((()=>[...v,...C,...E]),[v,C,E]);qe((()=>{k(n),A(n),R(n)}),[n]),t().useLayoutEffect((()=>{O()}),[]),t().useImperativeHandle(r,(()=>({initialHandler:O})));const I=e=>e.map((e=>{const t={};return Array.isArray(e.children)&&(t.children=I(e.children)),void 0!==e.hidden&&(t.hidden=e.hidden),void 0!==e.fixed&&(t.fixed=e.fixed),void 0!==e.width&&(t.width=e.width),void 0!==e.renderWidth&&(t.renderWidth=e.renderWidth),{dataIndex:e.dataIndex,...t}})),R=e=>{if(!N)return;const t=I(e),r=JSON.parse(localStorage.getItem(N));i.current.columnsDefined&&!(0,J.isEqual)(t,r)&&(localStorage.setItem(N,JSON.stringify(t)),(async(e,t)=>{const r=a?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(N,t))},O=()=>{const e=(()=>{if(!N)return;const e=JSON.parse(localStorage.getItem(N));return e||(async e=>{const t=a?.getComponentConfigApi;if(t)try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}})(N).then((e=>{e?(localStorage.setItem(N,JSON.stringify(e)),O()):a?.getComponentConfigApi&&R(n)})).catch((()=>{})),e?(0,J.xor)(Sn(e).map((e=>e.dataIndex)),Sn(n).map((e=>e.dataIndex))).length>0?Os(n,(t=>{const r=wn(e,t.dataIndex);return r&&(void 0!==r.hidden&&(t.hidden=r.hidden),void 0!==r.fixed&&(t.fixed=r.fixed),void 0!==r.width&&(t.width=r.width),void 0!==r.renderWidth&&(t.renderWidth=r.renderWidth)),t})):Os(e,(e=>{const t=wn(n,e.dataIndex);return void 0===e.fixed&&delete t.fixed,Object.assign({},t,e)})):void 0})();e&&d?.(e)},A=e=>{const t=h(e),r=f(e),n=g(e);return x(t),S(r),w(n),[...t,...n,...r]},k=e=>{const t=[];e.filter((e=>!e.noAuth)).forEach(((r,n)=>{const a=r.colSpan;a>1&&e.slice(n+1,n+a).every((e=>{let{colSpan:t}=e;return 0===t}))&&t.push(e.slice(n,n+a))})),m.current=t},F=()=>{const e=[];T.forEach((t=>{const{colSpan:r,dataIndex:n}=t;if(0===r)return;if(1===r)return e.push(t);const a=m.current.findIndex((e=>e.map((e=>e.dataIndex)).includes(n)));if(-1===a)return e.push(t);e.push(...m.current[a].map(((e,r)=>{let{dataIndex:n}=e;const a=T.find((e=>e.dataIndex===n));return r>0&&(void 0!==t.hidden&&(a.hidden=t.hidden),void 0!==t.fixed?a.fixed=t.fixed:a.fixed&&delete a.fixed),a})))})),n.forEach(((t,r)=>{t.noAuth&&e.findIndex((e=>e.dataIndex===t.dataIndex))<0&&e.splice(r,0,t)})),d?.(e)},H=(e,t)=>{if(e.noFixed)return;t?e.fixed=t:delete e.fixed;const r=A(n);d?.(r)},L=(e,r)=>{const{colSpan:n,noFixed:a}=e;if(0===n)return t().createElement("li",{key:e.dataIndex,style:{display:"none"}});const i=["svgicon","handle",`${r}-handle`],l=t().createElement("li",{key:e.dataIndex,className:"item"},t().createElement(P.Checkbox,{disabled:e.required,checked:!e.hidden,onChange:t=>{const{checked:r}=t.target;e.hidden=!r,F()}}),t().createElement("i",{className:Se()(i),title:p("qm.table.columnFilter.draggable")},t().createElement(we.HolderOutlined,null)),t().createElement("span",{className:"text",title:e.title},e.title),"main"===r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedLeft"),onClick:()=>H(e,"left")},t().createElement(we.StepBackwardOutlined,null)),t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.fixedRight"),onClick:()=>H(e,"right")},t().createElement(we.StepForwardOutlined,null))):"sub"!==r?t().createElement("span",{className:Se()("fixed",a?"disabled":"")},t().createElement("i",{className:"svgicon",title:p("qm.table.columnFilter.cancelFixed"),onClick:()=>H(e)},t().createElement(we.CloseCircleOutlined,null))):null);return!e.hidden&&e.children?.length?t().createElement(P.Popover,{key:e.dataIndex,trigger:["hover"],placement:"leftTop",overlayClassName:"column-item__popper",content:$(e.children,e.dataIndex)},l):l},$=(e,r)=>t().createElement("div",{className:"column-filter--wrap"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".sub-handle",tag:"ul",animation:200,list:e,setList:t=>{const a=t.map((e=>e.dataIndex)),i=e.map((e=>e.dataIndex));(0,J.isEqual)(a,i)||((e,t)=>{wn(n,t).children=e,d?.([...n])})(Qn(t),r)}},e.map((e=>L(e,"sub"))))),_=Ce("table"),D={[`${_}__popper`]:!0,"column-filter__popper":!0,[`${_}--lg`]:"large"===o,[`${_}--sm`]:"small"===o},q=[`${_}-column-filter`,{selected:b}];return s?t().createElement(Pa(),{action:["click"],popupVisible:b,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=t=>t.map((t=>{const r=wn(n,t.dataIndex)||ce(t);return t.children&&(r.children=e(t.children)),Object.assign(r,{hidden:t.hidden,fixed:t.fixed,width:t.width})}));d?.(e(i.current.originColumns))}},p("qm.table.columnFilter.reset"))),t().createElement("div",{className:"left"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".left-handle",tag:"ul",animation:200,list:v,setList:e=>{const t=e.map((e=>e.dataIndex)),r=v.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||x(Qn(e))},onEnd:()=>F()},v.map((e=>L(e,"left"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"main"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".main-handle",tag:"ul",animation:200,list:C,setList:e=>{const t=e.map((e=>e.dataIndex)),r=C.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||w(Qn(e))},onEnd:()=>F()},C.map((e=>L(e,"main"))))),t().createElement("div",{className:"divider"}),t().createElement("div",{className:"right"},t().createElement(Zn.ReactSortable,{itemKey:"dataIndex",handle:".right-handle",tag:"ul",animation:200,list:E,setList:e=>{const t=e.map((e=>e.dataIndex)),r=E.map((e=>e.dataIndex));(0,J.isEqual)(t,r)||S(Qn(e))},onEnd:()=>F()},E.map((e=>L(e,"right")))))),popupClassName:Se()(D),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{y(e)},builtinPlacements:Eo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("span",{className:Se()(q),title:u?p("qm.table.columnFilter.text"):void 0},t().createElement("i",{className:"svgicon icon"},t().createElement(we.SettingOutlined,null)),!u&&t().createElement("span",null,p("qm.table.columnFilter.text")))):null}));Ps.displayName="ColumnFilter";const As=Ps,ks=()=>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 r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fs.apply(this,arguments)}const Hs=e=>{const{column:r,filters:n}=e,{$size:a,setFilters:i,clearSuperFilters:l}=t().useContext(mo),o=t().useRef(null),s=t().useRef(null),c=t().useRef(null),[u,d]=t().useState(!1),[m,h]=t().useState(!1),[f,b]=t().useState({}),y=t().useMemo((()=>{const{dataIndex:e,filter:t}=r;return`${e}|${t.type}`}),[r]),v=t().useMemo((()=>{let e=!1;for(const t in n[y])if(!se(n[y][t])||m){e=!0;break}return e}),[y,n,m]);t().useEffect((()=>{u&&setTimeout((()=>x()),50)}),[u]),t().useEffect((()=>{(0,J.isEqual)(f[y],n[y])||b({[y]:n[y]||{}}),h(""===n[y]?.["=="])}),[n]);const x=()=>{switch(r.filter.type){case"text":o.current.focus();break;case"number":s.current.focus();break;case"textarea":c.current.focus()}},E=e=>{e&&b(e),l(),i((e=>{for(const t in e){for(const r in e[t])if(se(e[t][r])){if(["text","textarea"].includes(t.split("|")[1])&&null!==e[t][r])continue;delete e[t][r]}Object.keys(e[t]).length||delete e[t]}return e})({...n,...f,...e})),d(!1)},S={text:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(P.Input,{ref:o,size:a,placeholder:p("qm.table.filter.searchText",{text:r}),style:{width:"180px"},value:f[y]?.like??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{like:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(P.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},textarea:e=>{const{title:r}=e;return t().createElement(t().Fragment,null,t().createElement(P.Input.TextArea,{ref:c,size:a,placeholder:p("qm.table.filter.searchAreaText",{text:r}),style:{width:"220px"},value:f[y]?.likes??"",disabled:m,onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{likes:t||null}})))},onKeyDown:e=>{13===e.keyCode&&E()}}),t().createElement("div",{style:{marginTop:8}},t().createElement(P.Checkbox,{checked:m,onChange:e=>{const{checked:t}=e.target,r=t?"":null;b((e=>Object.assign({},e,{[y]:{"==":r,like:null}}))),h(t)}},p("qm.table.filter.nullValue"))))},number:e=>{const r=e=>({value:f[y]?.[e]??"",size:a,onChange:t=>{t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:t})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(P.InputNumber,Fs({ref:s},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(P.InputNumber,Fs({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(P.InputNumber,Fs({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(P.InputNumber,Fs({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},date:e=>{const r=e=>({value:jn(f[y]?.[e],yo),format:yo,size:a,onChange:t=>{b((r=>Object.assign({},r,{[y]:Object.assign({},r[y],{[e]:Kn(t,yo)})})))},onKeyDown:e=>{13===e.keyCode&&E()}});return t().createElement("ul",null,t().createElement("li",null,t().createElement("span",null,"> "),t().createElement(D,Fs({},r(">"),{placeholder:p("qm.table.filter.gtPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"< "),t().createElement(D,Fs({},r("<"),{placeholder:p("qm.table.filter.ltPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"= "),t().createElement(D,Fs({},r("=="),{placeholder:p("qm.table.filter.eqPlaceholder"),style:{width:"150px"}}))),t().createElement("li",null,t().createElement("span",null,"!="),t().createElement(D,Fs({},r("!="),{placeholder:p("qm.table.filter.neqPlaceholder"),style:{width:"150px"}}))))},radio:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(P.Radio.Group,{style:{width:"100%"},value:f[y]?.["=="],onChange:e=>{const{value:t}=e.target;b((e=>Object.assign({},e,{[y]:{"==":t}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(P.Radio,{value:e.value,disabled:e.disabled},e.text))))))},checkbox:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("ul",null,t().createElement(P.Checkbox.Group,{style:{width:"100%"},value:f[y]?.in,onChange:e=>{b((t=>Object.assign({},t,{[y]:{in:e}})))}},a.map((e=>t().createElement("li",{key:e.value},t().createElement(P.Checkbox,{value:e.value,disabled:e.disabled},e.text))))))},tree:e=>{const{filter:r,dictItems:n=[]}=e,a=r.items||n;return t().createElement("div",{style:{height:200,...r.style}},t().createElement(po,{multiple:!0,value:f[y]?.in||[],dataSource:a,onCheckChange:e=>{const t=e.map((e=>e.value));b((e=>Object.assign({},e,{[y]:{in:t}})))}}))}},C=Ce("table"),w={"head-filter__popper":!0,[`${C}--lg`]:"large"===a,[`${C}--sm`]:"small"===a},N=["cell--filter",{selected:u,actived:v}];return t().createElement(Pa(),{action:["click"],popupVisible:u,popup:(()=>{const e=r.filter.type,n=S[e];return n?t().createElement("div",{className:"head-filter--wrap",onClick:e=>e.stopPropagation()},t().createElement("div",null,n(r)),t().createElement(P.Space,{style:{width:"100%",marginTop:8,justifyContent:"flex-end"}},t().createElement(he,{size:a,onClick:()=>{E({[y]:{}})}},p("qm.table.filter.reset")),t().createElement(he,{type:"primary",size:a,onClick:()=>E()},p("qm.table.filter.search")))):(g("Table","表头筛选的类型 `type` 配置不正确"),null)})(),popupClassName:Se()(w),popupStyle:{minWidth:150},onPopupVisibleChange:e=>{d(e)},builtinPlacements:Eo,prefixCls:"ant-select-dropdown",popupPlacement:"bottomRight",popupTransitionName:"ant-slide-up"},t().createElement("div",{className:Se()(N),title:p("qm.table.filter.text"),onClick:e=>e.stopPropagation()},t().createElement("span",{className:"svgicon icon"},t().createElement(ks,null))))},Ls=e=>{const{column:r}=e,{tableRef:n,bordered:a}=t().useContext(mo),{columns:i,resizable:l,columnsChange:o=ne}=n.current.props,s=t().useMemo((()=>Tn(r)),[r]),c={resizable:!0,"is--line":l&&!a};return t().createElement("div",{className:Se()(c),onMouseDown:e=>{e.preventDefault();const t=e.target,{elementStore:r}=n.current,a=r.$resizableBar,l=t.offsetWidth/2,c=e.clientX,u=An(t,r.$table).left-r.$tableBody.parentNode.parentNode.scrollLeft+l;r.$table.classList.add("c--resize"),a.style.left=`${u}px`,a.style.display="block";const d=s.width||s.renderWidth;let p=d;return document.onmousemove=function(e){if("number"!=typeof d)return;const t=e.clientX-c,r=d+t;r<(s.minWidth||Io.defaultColumnWidth)||(p=Math.floor(r),a.style.left=`${t+u}px`)},document.onmouseup=function(){r.$table.classList.remove("c--resize"),a.style.display="none",this.onmousemove=null,this.onmouseup=null,"number"==typeof p&&(wn(i,s.dataIndex).width=p,o([...i]))},!1}})},$s=e=>{const{selectionKeys:r}=e,{tableRef:n,getRowKey:a,pagination:i,fetchParams:l,setSelectionKeysEffect:o,setInvalidRowKeys:s,setSpinning:c,isFetch:u,isWebPagination:d}=t().useContext(mo),{rowSelection:m}=n.current.props,{fetchAllRowKeys:h,selectAllOnCurrentPage:f,filterable:g,onSelectAll:b}=m,y=t().useRef([]),v=t().useMemo((()=>u&&!!h),[u,h]),x=t().useMemo((()=>!v&&!!f),[v,f]),E=t().useMemo((()=>(g??!0)&&!x),[g,x]),S=()=>{const{tableFullData:e}=n.current,{current:t,pageSize:r}=i;return d?e.slice((t-1)*r,t*r):e},C=(()=>{const{allTableData:e,allRowKeys:t,selectionRows:r}=n.current,{disabled:i}=m;if(v)return y.current.length?y.current:(0,J.union)(t,r.map((e=>a(e,e.index))));if(!x)return i?t.filter(((t,r)=>!i(e[r]))):t;const l=i?S().filter((e=>!i(e))).map((e=>a(e,e.index))):S().map((e=>a(e,e.index)));return(0,J.union)(l,r.map((e=>a(e,e.index))))})(),w=r.filter((e=>!C.includes(e))),N=r.length-w.length,T=N>0&&N<C.length,I=!!N&&N===C.length;s(w);const R=async()=>{const e=h;let t=[];c(!0);try{const r=await e.api(l);if(200===r.code){t=Array.isArray(r.data)?r.data:(0,J.get)(r.data,e.dataKey)??[];const{disabled:n}=m;n&&(t=(0,J.xor)(t,S().filter((e=>n(e))).map((e=>a(e,e.index))))),y.current=t}}catch(e){}return c(!1),t},O=async e=>{let t=[];t=v?e?await R():[]:e?C.slice(0):[],t=[...new Set([...t,...w])],o(t),b?.(e,t)};return t().createElement("div",{className:"cell--selection"},t().createElement(P.Checkbox,{checked:I,indeterminate:T,disabled:!C.length,onChange:e=>O(e.target.checked)}),E&&t().createElement(P.Dropdown,{overlayClassName:"all-selection__popper",dropdownRender:()=>(()=>{const e=[{key:1,label:p("qm.table.selection.all"),onClick:()=>{O(!0)}},{key:2,label:p("qm.table.selection.invert"),onClick:()=>(async()=>{let e=[];e=v?(0,J.xor)(r,await R()):(0,J.xor)(r,C),e=[...new Set([...e,...w])],o(e)})()},{key:3,label:p("qm.table.selection.clear"),onClick:()=>{O(!1)}}];return t().createElement(P.Menu,{items:e})})()},t().createElement(we.DownOutlined,{className:"svgicon icon"})),x&&t().createElement(P.Tooltip,{placement:"top",title:p("qm.table.selection.currentPage")},t().createElement(we.InfoCircleOutlined,{className:"info"})))},_s=e=>{const{style:r}=e,{tableRef:n,isTreeTable:a,setRowExpandedKeys:i}=t().useContext(mo),{expandable:l}=n.current.props,[o,s]=t().useState(l?.defaultExpandAllRows||!1);qe((()=>{const{allRowKeys:e,flattenRowKeys:t}=n.current;i(o?e.filter((e=>!(a&&t.includes(e)))):[])}),[o]);const c={[`${Ce("expand")}--icon`]:!0,expanded:o,collapsed:!o};return t().createElement("span",{className:Se()(c),title:"",onClick:e=>{e.stopPropagation(),s(!o)},style:r})},Ds=()=>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"})),qs=()=>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"})),js=e=>{const{tableColumns:r,flattenColumns:n,sorter:a,filters:i}=e,{tableRef:l,layout:o,scrollY:s,superFilters:c,selectionKeys:u,rightFixedColumns:d,treeExpandIndex:m,isFetch:h,isTreeTable:f,isGroupSubtotal:g,tableChange:b,setSorter:y,setElementStore:v,resetTableScroll:x,getStickyLeft:E,getStickyRight:S,createGroupData:C,createTableFullData:w}=t().useContext(mo),{ellipsis:N,resizable:T,multipleSort:I,rowSelection:R,expandable:O}=l.current.props,[A,k]=Io.sortDirections,F=t().useRef(null),H=t().useMemo((()=>!h),[h]),L=t().useMemo((()=>!h),[h]),$=t().useMemo((()=>!O?.hideExpandAll),[O]),_=t().useMemo((()=>!(!R||(h?!R.selectAllOnCurrentPage&&!R.fetchAllRowKeys:R.hideSelectAll))),[h,R]);qe((()=>{V(),b(),x()}),[a]),qe((()=>{B(),b(),x()}),[i]),qe((()=>{B(),b(),x()}),[c]),t().useEffect((()=>{D(),!se(a)&&le((()=>V())),!se(i)&&le((()=>B()))}),[]);const D=()=>{v("$header",F.current)},q=e=>{const{dataIndex:r,type:n,sorter:i,title:l,description:o}=e;if(r===Io.selectionColumn&&"checkbox"===n){if("checkbox"===n)return t().createElement("div",{className:"cell"},_?t().createElement($s,{selectionKeys:u}):p("qm.table.config.selectionText"));if("radio"===n)return t().createElement("div",{className:"cell"},l)}const s=[];return s.push(t().createElement("div",{key:0,className:"cell",title:l},f&&r===m&&$?t().createElement(_s,null):null,r===Io.expandableColumn&&$?t().createElement(_s,null):l)),o&&s.push(t().createElement(P.Tooltip,{key:1,placement:"top",title:o},t().createElement(we.InfoCircleOutlined,{className:"tip"}))),i&&s.push(j(a[r])),s},j=e=>{const r=["svgicon cell--sorter__asc",{actived:e===A}],n=["svgicon cell--sorter__desc",{actived:e===k}];return t().createElement("div",{key:2,className:"cell--sorter",title:p("qm.table.sorter.text")},t().createElement("span",{className:Se()(r)},t().createElement(Ds,null)),t().createElement("span",{className:Se()(n)},t().createElement(qs,null)))},K=e=>t().createElement(Hs,{column:e,filters:i}),M=(e,t)=>{const{sorter:r,dataIndex:n}=t;if(r){const e=a[n],t=e?e===k?null:k:A;I?(delete a[n],y(Object.assign({},a,{[n]:t}))):y(Object.assign({},{[n]:t}))}},V=()=>{H&&z()},z=e=>{const t=(0,J.pickBy)(a,(e=>null!==e));for(const e in t){const r=n.find((t=>t.dataIndex===e));r?U(r,t[e]):delete t[e]}e||Object.keys(t).length||U({dataIndex:"index"},A)},U=(e,t)=>{const{tableFullData:r}=l.current,{dataIndex:n,sorter:a}=e,i=(e,r)=>{const a=Ln(e,n),i=Ln(r,n);return Number.isNaN(a-i)?t===A?a.toString().localeCompare(i.toString()):i.toString().localeCompare(a.toString()):t===A?a-i:i-a},o=g?C(zn(r).sort("function"==typeof a?a:i)):r.sort("function"==typeof a?a:i).slice(0);w(o)},B=()=>{L&&W()},W=()=>{const{tableOriginData:e}=l.current,t=c.length?Un(c):Un(i),r=""!==t?g?C(vn(zn(e),t,f)):vn(e,t,f):e;w(r),z(!0)},G=Pn(r),Y=Ce("table"),{tableBodyWidth:X}=o;return t().createElement("div",{ref:F,className:`${Y}--header-wrapper`},t().createElement("table",{className:`${Y}--header`,cellSpacing:"0",cellPadding:"0",style:{width:X?`${X}px`:""}},(()=>{const{gutterWidth:e}=o;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),s&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("thead",null,(e=>{const{isIE:r}=l.current,n=["gutter",{"cell-fix-right":!!d.length}],i=r?null:{right:d.length?0:""};return e.map(((e,r)=>t().createElement("tr",{key:r,className:"header--row"},e.map(((r,n)=>((e,r,n)=>{const{isIE:i}=l.current,{gutterWidth:c}=o,{dataIndex:u,colSpan:d,rowSpan:p,fixed:m,align:h,theadAlign:f,theadClassName:g="",sorter:b,filter:y,required:v,headRender:x}=e;if(0===d)return null;const C=f||h,w=["header--column",{"col--ellipsis":e.ellipsis??N,"col--center":"center"===C,"col--right":"right"===C,"column--required":!!v,"column-has-sorter":b,"column-has-filter":y,"column--sort":!!a[u],"cell-fix-left":!i&&"left"===m,"cell-fix-right":!i&&"right"===m,"cell-fix-left-last":!i&&"left"===m&&!n[r+1]?.fixed,"cell-fix-right-first":!i&&"right"===m&&!n[r-1]?.fixed,[g]:!!g}],I=i?null:{left:"left"===m?`${E(u)}px`:"",right:"right"===m?`${S(u)+(s?c:0)}px`:""},R=T&&![Io.expandableColumn,Io.selectionColumn].includes(u);return t().createElement("th",{key:u,className:Se()(w),colSpan:d,rowSpan:p,style:{...I},onClick:t=>M(t,e)},t().createElement("div",{className:"cell--wrapper"},x?t().createElement("div",{className:"cell--text cell"},x(e,l.current.tableFullData)):t().createElement(t().Fragment,null,t().createElement("div",{className:"cell--text"},q(e)),y?K(e):null)),R&&t().createElement(Ls,{column:e}))})(r,n,e))),s&&t().createElement("th",{className:Se()(n),style:{...i}}))))})(G))))},Ks=t().createContext([]);function Ms(){const[,t]=e.useReducer((e=>e+1),0);return t}function Vs(){const{locale:t}=e.useContext(l);return{t:p,$locale:t}}const zs=e=>{const{selectionKeys:r,column:n,record:a,rowKey:i}=e,{tableRef:l,isTreeTable:o,getAllChildRowKeys:s}=t().useContext(mo),{rowSelection:c}=l.current.props,u=t().useMemo((()=>n.type||""),[n.type]),d=e=>{const t=c.checkStrictly??!0;if(!o||t)return!1;const n=Rn(l.current.deriveRowKeys,e),a=s(n?.children??[]);return!(!Array.isArray(n?.children)||Hn(r,n?.children.map((e=>e.rowKey))||[]))&&a.some((e=>r.includes(e)))};return"radio"===u?(()=>{const e=c.disabled,n=e?.(a),l=!n&&r[0]===i;return t().createElement(P.Radio,{checked:l,disabled:n})})():(()=>{const e=c.disabled,n=e?.(a),l=!!r.includes(i);return t().createElement(P.Checkbox,{checked:l,indeterminate:d(i),disabled:n})})()},Us=e=>{const{record:r,rowKey:n,style:a}=e,{tableRef:i,rowExpandedKeys:l,setRowExpandedKeys:o}=t().useContext(mo),{expandable:s={}}=i.current.props,[c]=t().useState("function"==typeof s.rowExpandable&&!s.rowExpandable(r)),u=t().useMemo((()=>l.includes(n)),[l,n]);qe((()=>{s.onExpand?.(u,r)}),[u]);const d={[`${Ce("expand")}--icon`]:!0,expanded:u,collapsed:!u,disabled:c};return t().createElement("span",{className:Se()(d),title:"",onClick:e=>{if(e.stopPropagation(),c)return;const t=u?l.filter((e=>e!==n)):[...l,n];o(t)},style:a})},Bs=t().forwardRef(((e,r)=>{const{size:n,defaultValue:a,value:i,min:l,max:o,prefix:s,suffix:c,placeholder:u,maxLength:d,precision:p,stringMode:m,allowClear:h,readOnly:f,disabled:g,formatter:b=(e=>e.toString()),parser:y=(e=>e),onFocus:v}=e,x=e=>{let t=e.toString();return"."!==t.charAt(t.length-1)&&"-"!==t||(t=t.slice(0,-1)),t&&Number(t)>o&&(t=o.toString()),t&&Number(t)<l&&(t=l.toString()),p>=0&&""!==t&&(t=new(ua())(t).toFixed(p)),t},E=void 0!==i,[S,C]=t().useState(a??""),w=b(E?i:S),N=y(w);return qe((()=>{e.onChange?.(N)}),[S]),t().createElement(P.Input,{ref:r,size:n,value:w,maxLength:d,prefix:s,suffix:c,placeholder:u,allowClear:h,readOnly:f,disabled:g,onChange:t=>{const r=y(t.target.value);let n=/^-?\d*(\.\d*)?$/.test(r)||""===r||"-"===r;if(0===p&&r.includes(".")&&(n=!1),l>=0&&r.startsWith("-")&&(n=!1),n){if(!m&&(Number(r)>Number.MAX_SAFE_INTEGER||Number(r)<Number.MIN_SAFE_INTEGER))return;(t=>{E?e.onChange?.(t):C(t)})(r)}},onFocus:v,onBlur:()=>{const t=x(N);e.onBlur?.(t,N)},onKeyUp:t=>{13===t.keyCode&&e.onEnter?.(x(N),N)}})}));Bs.displayName="InputNumber";const Ws=Bs;function Gs(){return Gs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gs.apply(this,arguments)}const{Search:Ys}=P.Input,Xs=t().forwardRef(((e,r)=>{const{column:n,record:a,rowKey:i,columnKey:l}=e,{tableRef:o,tableBodyRef:s,$size:c,flattenColumns:u,updateTableData:d,doFieldValidate:m,dataChange:h}=t().useContext(mo),f=t().useContext(Ks),b=Ms(),{store:y,fieldAuth:v}=o.current,x=n.editRender?.(a,n)||{},E=t().useRef(null),S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),N=t().useRef(null),T=t().useRef(!1),I=t().useRef({}),R=t().useRef({}),O=t().useRef([]),[A,k]=t().useState(!1),[F,H]=t().useState(!1),[L,$]=t().useState(!1),[_,q]=t().useState(x.items||[]),[j,K]=t().useState(),V=(x.editable||(0,J.isEqual)(f,[i,l]))&&!x.disabled&&!v[l]?.disabled,z=`${i}|${l}`,U=2===f.length?`${f[0]}|${f[1]}`:"",B=![...y.state.required,...y.state.validate].some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),W=y.state.required.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",G=y.state.validate.find((e=>{let{x:t,y:r}=e;return t===i&&r===l}))?.text||"",Y=y.state.edited.some((e=>{let{x:t,y:r}=e;return t===i&&r===l})),X=V||!B||A||L||F,Q=!!x.helper?.combinedDataIndex&&("search-helper"===x.type||"tree-helper"===x.type),Z=x.type?.endsWith("multiple");t().useEffect((()=>{X&&U===z&&ne()}),[f]),t().useLayoutEffect((()=>{const{items:e}=x;Z&&e&&re(e.map((e=>({[R.current.valueKey]:e.value,[R.current.textKey]:e.text}))))}),[]);const ee=()=>{d(),h()},te=(e,t)=>{k(e),t?.()},re=e=>{O.current=e},ne=()=>{const{type:e}=x;switch(e){case"text":S.current?.focus();break;case"number":C.current?.select();break;case"search-helper":w.current?.focus();break;case"tree-helper":N.current?.focus()}};t().useImperativeHandle(r,(()=>({focus:ne})));const ie=e=>{e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),e.dispatchEvent(new MouseEvent("mouseup",{bubbles:!0,cancelable:!0}))},oe=(e,t,r)=>{const{cornerSign:n=!0}=x.extra||{};y.addToUpdated(e),n&&y.addToEdited({x:t,y:r})},se=e=>e?(e=>/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(e.toString()))(Number(e))?e:Number(e):"",ce={text:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:u=[],onInput:d,onChange:h,onEnter:f,onBlur:g}=x,y=Ln(e,a),v=Object.assign({},{minRows:1,maxRows:4},s.autoSize),E=n?{rows:v.minRows,autoSize:v}:null,C=s.password?P.Input.Password:n?P.Input.TextArea:P.Input;return t().createElement(C,Gs({ref:S,size:c,value:y,maxLength:s.maxLength,showCount:s.showCount},E,{autoComplete:s.password?"new-password":"off",placeholder:s.placeholder||p("qm.table.editable.inputPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,suffix:s.suffix,onChange:t=>{const r=t.target.value??"";$n(e,a,r),m(u,r,i,l),b(),d?.({[z]:r}),T.current=!0},onFocus:()=>H(!0),onBlur:t=>{H(!1);const r=t.target.value??"";T.current&&(T.current=!1,oe(e,i,l),h?.({[z]:r},e),g?.({[z]:r},e),ee())},onKeyUp:t=>{if(13===t.keyCode&&!t.shiftKey){const r=t.target.value??"";f?.({[z]:r},e)}},onKeyDown:e=>{n&&13===e.keyCode&&!e.shiftKey&&f&&e.preventDefault()}}))},textarea:(e,t)=>ce.text(e,t,!0),number:(e,r)=>{const{dataIndex:n,precision:a,formatType:o}=r,{type:s,extra:u={},rules:d=[],onInput:h,onChange:f,onEnter:g,onBlur:y}=x,v=Ln(e,n);let E,S;return"finance"===o&&(E=e=>{const t=e.toString().split(".");return`${t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")}${void 0!==t[1]?`.${t[1]}`:""}`},S=e=>e.replace(/\$\s?|(,*)/g,"")),"percent"===o&&(E=e=>"."===(e+="").charAt(e.length-1)||"-"===e||""===e?e:`${new(ua())(e).times(100).toNumber()}`,S=e=>"."===e.charAt(e.length-1)||"-"===e||""===e?e:new(ua())(e).times(.01).toString()),t().createElement(Ws,{ref:C,size:c,value:v,min:u.min,max:u.max,precision:a,stringMode:u.stringMode,prefix:u.prefix,suffix:u.suffix??("percent"===o?"%":void 0),placeholder:u.placeholder||p("qm.table.editable.inputPlaceholder"),maxLength:u.maxLength,allowClear:u.allowClear,readOnly:u.readOnly,disabled:u.disabled,formatter:E,parser:S,onChange:t=>{$n(e,n,t),m(d,t,i,l),b(),h?.({[z]:t}),T.current=!0},onFocus:()=>H(!0),onBlur:(t,r)=>{if(H(!1),!T.current)return;T.current=!1;let a=u.stringMode?t:se(t);"percent"===o&&"."===r.charAt(r.length-1)&&(a=Number(t)/100),$n(e,n,a),oe(e,i,l),f?.({[z]:a},e),y?.({[z]:a},e),ee()},onEnter:(t,r)=>{let n=u.stringMode?t:se(t);"percent"===o&&"."===r.charAt(r.length-1)&&(n=Number(t)/100),g?.({[z]:n},e)}})},select:(e,r,n)=>{const{dataIndex:a,dictItems:s=[]}=r,{type:u,extra:d={},rules:h=[],items:f,onChange:g,onEnter:b}=x,{elementStore:y}=o.current,v=f||s,E=Ln(e,a);let S=E;return t().createElement(P.Select,{mode:n?"multiple":void 0,size:c,popupClassName:"table-editable__popper",value:E||void 0,placeholder:d.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:d.allowClear,listHeight:d.listHeight,maxTagCount:d.collapseTags?"responsive":void 0,maxTagTextLength:d.maxTagTextLength,disabled:d.disabled,style:{width:"100%"},showSearch:d.filterable??!0,filterOption:(e,t)=>{const r=t?.children?.toString()||"";return`${r}|${Gr.parse(r).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`.toLowerCase().indexOf(e.toLowerCase())>=0},onChange:t=>{$n(e,a,t),m(h,t,i,l),oe(e,i,l),g?.({[z]:t},e),ee()},onSelect:e=>{S=e},onInputKeyDown:t=>{13===t.keyCode&&le((()=>b?.({[z]:S},e)))}},v.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value,disabled:e.disabled},e.text))))},"select-multiple":(e,t)=>ce.select(e,t,!0),date:(e,r,n)=>{const{dataIndex:a}=r,{type:o,extra:s={},rules:u=[],onChange:d}=x,p=n||"exactdate",h=Ln(e,a);return t().createElement(D,{size:c,popupClassName:"table-editable__popper",value:jn(h,Er[p])??void 0,picker:xr[p],format:s.format,showTime:"datetime"===p,disabledDate:e=>(e=>{const{minDateTime:t,maxDateTime:r}=s;return t&&r?e.isBefore(t,"day")||e.isAfter(r,"day"):t?e.isBefore(t,"day"):!!r&&e.isAfter(r,"day")})(e),placeholder:s.placeholder,allowClear:s.allowClear,disabled:s.disabled,style:{width:"100%"},onChange:t=>{const r=Kn(t,Er[p]);$n(e,a,r),m(u,r,i,l),oe(e,i,l),d?.({[z]:r},e),ee()}})},datetime:(e,t)=>ce.date(e,t,"datetime"),month:(e,t)=>ce.date(e,t,"month"),year:(e,t)=>ce.date(e,t,"year"),time:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},rules:s=[],onChange:u}=x,d="HH:mm:ss",p=Ln(e,n);return t().createElement(M,{size:c,popupClassName:"table-editable__popper",value:jn(p,d)??void 0,format:o.format||d,placeholder:o.placeholder,allowClear:o.allowClear,disabled:o.disabled,style:{width:"100%"},onChange:t=>{const r=Kn(t,d);$n(e,n,r),m(s,r,i,l),oe(e,i,l),u?.({[z]:r},e),ee()}})},checkbox:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=x,{trueValue:c=go,falseValue:u=bo,disabled:d}=o,p=Ln(e,n);return t().createElement(P.Checkbox,{checked:p===c,disabled:d,onChange:t=>{const r=t.target.checked?c:u;$n(e,n,r),oe(e,i,l),s?.({[z]:r},e),ee()}})},switch:(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},onChange:s}=x,{trueValue:c=go,falseValue:u=bo,disabled:d}=o,p=Ln(e,n);return t().createElement(P.Switch,{checked:p===c,disabled:d,onChange:t=>{const r=t?c:u;$n(e,n,r),oe(e,i,l),s?.({[z]:r},e),ee()}})},"search-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:d=[],helper:h={},onInput:f,onChange:b,onEnter:y}=x,v=_n(e,Q?h.combinedDataIndex:n),S=h.fieldAliasMap;S||g("Table","helper 需要配置 `fieldAliasMap` 选项");const C="function"==typeof S?S():S||{};Object.keys(C).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(C).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),C[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const N=e=>{const{filterAliasMap:t}=h,r=""!==e?e:void 0,a=("function"==typeof t?t():t)||[],i={[n]:r};return(Array.isArray(a)?a:[a]).forEach((e=>{if((0,J.isPlainObject)(e))for(const t in e)i[t]="function"==typeof e[t]?e[t](r):r;else i[e]=r})),i},R=e=>{const{autoQueryAssign:t=!0}=h;t&&(I.current=N(e)),k(!0)},O=(t,n)=>{const{beforeOpen:a}=h,i=(a??ae)({[z]:v},e,r);i?.then?i.then((()=>{R(t),n?.()})).catch((()=>{})):!1!==i&&(R(t),n?.())},P=e=>{const t={};for(const r in C){const a=C[r];r!==n&&(t[r]=_n(e,a))}const r=C[n]?_n(e,C[n]):"";H(r,t);const{closed:a}=h;te(!1,(()=>ie(E.current))),ne(),a?.(e)},F=()=>{const{onlySelect:e=!0}=h;T.current&&H(e?"":v),te(!1,(()=>ie(E.current)))},H=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=u.find((e=>e.dataIndex===t));if(a){$n(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&m(r.rules,n,i,t)}else $n(e,t,n)}Q&&!t&&((e,t,r,n)=>{if(!t.includes("|"))return $n(e,t,"",void 0);const a="".split("|")||[];t.split("|").forEach(((t,r)=>{t&&$n(e,t,a[r]?.trim())}))})(e,h.combinedDataIndex),$n(e,n,t,a),m(d,t,i,l),oe(e,i,l),b?.({[z]:t},e),ee(),I.current={},T.current=!1,K(void 0)},L={visible:A,title:p("qm.searchHelper.text"),width:h.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{F()}},_={...h,size:c,initialValue:Object.assign({},I.current,h.initialValue),onClose:e=>{e?P(e):F()}};return t().createElement(t().Fragment,null,t().createElement(Ys,{ref:w,value:j??v,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,readOnly:s.readOnly,disabled:s.disabled,onBlur:e=>{const{value:t}=e.target,{onlySelect:r=!0,table:a}=h;if(T.current&&!A)return t&&r&&a?.fetch?.api?(e=>{const{table:t,initialValue:r={}}=h,{beforeFetch:n=ae}=t.fetch;return new Promise((async(a,i)=>{const l=(0,J.merge)({},t.fetch.params,{...r,...N(e)},{currentPage:1,pageSize:500});if(!n(l))return i();$(!0);try{const e=await t.fetch.api(l);200===e.code?a(Array.isArray(e.data)?e.data:(0,J.get)(e.data,t.fetch.dataKey)??[]):i()}catch(e){i(e)}finally{le((()=>$(!1)))}}))})(t).then((e=>function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter((t=>_n(t,C[n]).toString().includes(e)));if(1===t.length)return P(t[0]);O(e)}(e,t))).catch((()=>H(""))):void H(t)},onChange:e=>{const{value:t}=e.target;f?.({[z]:t}),T.current=!0,K(t)},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";y?.({[z]:r},e)}},onDoubleClick:e=>{const{value:t}=e.target;O(t)},onSearch:(e,t)=>{"click"===t?.type&&"INPUT"!==t.target.tagName&&O(e)}}),t().createElement(ur,L,t().createElement(vc,_)))},"search-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,items:o=[],extra:s={},rules:u=[],helper:d={},onInput:h,onChange:f,onEnter:b}=x,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof v?v():v||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[z]:y},e,r);a?.then?a.then((()=>{k(!0),t?.()})).catch((()=>{})):!1!==a&&(k(!0),t?.())},w=()=>{te(!1,(()=>ie(E.current)))},N=t=>{$n(e,n,t),m(u,t,i,l),oe(e,i,l),f?.({[z]:t},e,O.current),ee()},T={visible:A,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{w()}},I={...d,size:c,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:(e,t)=>{e?((e,t)=>{const{textKey:r,valueKey:n}=S;re((0,J.uniqBy)([...O.current.filter((e=>t.includes(e[n]))),...e],n));const a=O.current.map((e=>({text:e[r],value:e[n]}))),i=(0,J.uniqBy)([...a,...o],"value").filter((e=>t.includes(e.value)));q(i),N(i.map((e=>e.value)));const{closed:l}=d;te(!1,(()=>ie(E.current))),l?.(O.current)})(e,t):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(P.Select,{mode:"multiple",open:!1,value:y,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:s.allowClear,maxTagCount:s.collapseTags?"responsive":void 0,maxTagTextLength:s.maxTagTextLength,disabled:s.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&b?.({[z]:y},e)},onDoubleClick:()=>{s.disabled||C()},onChange:e=>{const{valueKey:t}=S;re(O.current.filter((r=>e.includes(r[t])))),N(e)}},_.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:s.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(ur,T,t().createElement(vc,I)))},"tree-helper":(e,r)=>{const{dataIndex:n,precision:a}=r,{type:o,extra:s={},rules:d=[],helper:h={},onChange:f,onEnter:b}=x,y=_n(e,Q?h.combinedDataIndex:n),v=h.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof v?v():v||{};Object.keys(S).includes(n)||g("Table","fieldAliasMap 选项必须包含自身 `dataIndex` 值"),Q&&(h.combinedDataIndex.split("|").every((e=>Object.keys(S).includes(e)))||g("Table","所有出现在 `combinedDataIndex` 里的数据字段,在 `fieldAliasMap` 中必须做对应的映射配置"),S[n].includes("|")&&g("Table","配置了 `combinedDataIndex` 参数后,在 `fieldAliasMap` 中自身 `dataIndex` 值不能再使用分隔符"));const C=t=>{const{beforeOpen:n}=h,a=(n??ae)({[z]:y},e,r);a?.then?a.then((()=>{k(!0),t?.()})).catch((()=>{})):!1!==a&&(k(!0),t?.())},w=()=>{te(!1,(()=>ie(E.current)))},T=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if((0,J.isPlainObject)(r)&&Object.keys(r).length)for(const t in r){const n=r[t],a=u.find((e=>e.dataIndex===t));if(a){$n(e,t,n,a.precision);const r=a.editRender?.(e,a);r&&Array.isArray(r.rules)&&m(r.rules,n,i,t)}else $n(e,t,n)}$n(e,n,t,a),m(d,t,i,l),oe(e,i,l),f?.({[z]:t},e),ee()},I={visible:A,title:p("qm.searchHelper.text"),width:h.width??"30%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{w()}},R={...h,defaultSelectedKeys:[y],size:c,onClose:e=>{e?(e=>{const t={};for(const r in S){const a=S[r];r!==n&&(t[r]=_n(e,a))}const r=S[n]?_n(e,S[n]):"";T(r,t);const{closed:a}=h;te(!1,(()=>ie(E.current))),ne(),a?.(e)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement(Ys,{ref:N,value:y,allowClear:s.allowClear??!0,readOnly:s.readOnly,disabled:s.disabled,placeholder:s.placeholder||p("qm.table.editable.selectPlaceholder"),onChange:e=>{const{value:t}=e.target},onKeyUp:t=>{if(13===t.keyCode){const r=t.target.value??"";b?.({[z]:r},e)}},onDoubleClick:()=>{C()},onSearch:(e,t)=>{"click"===t?.type&&("INPUT"!==t.target.tagName?C():T(""))}}),t().createElement(ur,I,t().createElement(Ic,R)))},"tree-helper-multiple":(e,r)=>{const{dataIndex:n}=r,{type:a,extra:o={},items:s=[],rules:u=[],helper:d={},onInput:h,onChange:f,onEnter:b}=x,y=Ln(e,n),v=d.fieldAliasMap;v||g("Table","helper 需要配置 `fieldAliasMap` 选项");const S="function"==typeof v?v():v||{};Object.keys(S).includes("valueKey")&&Object.keys(S).includes("textKey")||g("Table","fieldAliasMap 选项必须包含自身 `valueKey` 和 `textKey`"),R.current=S;const C=t=>{const{beforeOpen:n}=d,a=(n??ae)({[z]:y},e,r);a?.then?a.then((()=>{k(!0),t?.()})).catch((()=>{})):!1!==a&&(k(!0),t?.())},w=()=>{te(!1,(()=>ie(E.current)))},N=t=>{$n(e,n,t),m(u,t,i,l),oe(e,i,l),f?.({[z]:t},e,O.current),ee()},T={visible:A,title:p("qm.searchHelper.text"),width:d.width??"60%",loading:!1,stopMouseDownEvent:!0,bodyStyle:{paddingBottom:`${ya[c]+20}px`},onClose:()=>{w()}},I={...d,size:c,multiple:!0,initialValue:(0,J.merge)({},d.initialValue),defaultSelectedKeys:y,onClose:e=>{e?(e=>{const{textKey:t,valueKey:r}=S;re(e);const n=O.current.map((e=>({text:e[t],value:e[r]})));q(n),N(n.map((e=>e.value)));const{closed:a}=d;te(!1,(()=>ie(E.current))),a?.(O.current)})(e):w()}};return t().createElement(t().Fragment,null,t().createElement("span",{className:"ant-input-group-wrapper ant-input-search search-helper-multiple"},t().createElement("span",{className:"ant-input-wrapper ant-input-group"},t().createElement(P.Select,{mode:"multiple",open:!1,value:y,placeholder:o.placeholder||p("qm.table.editable.selectPlaceholder"),allowClear:o.allowClear,maxTagCount:o.collapseTags?"responsive":void 0,maxTagTextLength:o.maxTagTextLength,disabled:o.disabled,style:{width:"100%"},onKeyUp:t=>{13===t.keyCode&&b?.({[z]:y},e)},onDoubleClick:()=>{o.disabled||C()},onChange:e=>{const{valueKey:t}=S;re(O.current.filter((r=>e.includes(r[t])))),N(e)}},_.map((e=>t().createElement(P.Select.Option,{key:e.value,value:e.value},e.text)))),t().createElement("span",{className:"ant-input-group-addon"},t().createElement(P.Button,{className:"ant-input-search-button",disabled:o.disabled,icon:t().createElement(we.SearchOutlined,null),onClick:()=>{C()}})))),t().createElement(ur,T,t().createElement(Ic,I)))}};return t().createElement(t().Fragment,null,X?(()=>{const{type:e}=x,r=ce[e];if(!r)return g("Table","单元格编辑的类型 `type` 配置不正确"),null;const i=["cell--edit",{"is-error":!B}];return t().createElement("div",{ref:E,className:Se()(i)},r(a,n),!B&&t().createElement("div",{className:"cell-error"},W||G))})():(()=>{const{extra:r={}}=x;return t().createElement("span",{style:{color:r.disabledColor}},e.children)})(),Y&&t().createElement("i",{className:"cell--sign"}))}));Xs.displayName="CellEdit";const Qs=Xs,Zs=require("copy-to-clipboard");var Js=n.n(Zs);const ec=function(e){if(!t().isValidElement(e))return null;for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return t().cloneElement(e,...n)},tc=e=>{const{text:r,options:n,showMessage:a=!0,onCopy:i}=e;return ec(e.children,{onClick:l=>{const o=t().Children.only(e.children),s=Js()(r,n);i?.(r,s),s&&a&&P.message.success(p("qm.clipboard.success")),o&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(l)}})};tc.displayName="QmCopyToClipboard";const rc=tc,nc=t().forwardRef(((r,n)=>{const{column:a,row:i,rowIndex:l,columnIndex:o,rowKey:s,depth:c,showTitle:u}=r,{tableRef:d,selectionKeys:p,treeExpandIndex:m,updateMark:h,isTreeTable:f}=t().useContext(mo),{treeConfig:g}=d.current.props,{dataIndex:b,canCopy:y,render:v,editRender:x,shouldCellUpdate:E}=a,{t:S}=Vs(),{renderText:C,getTitleFromCellNode:w}=jo(),N=t().useRef(null),[T,I]=function(r,c,u){const d=e.useRef({});return"value"in d.current&&!((e,t)=>{if(E){const[,r]=e,[,n]=t;return E(n,r)}return!(0,J.isEqual)(e,t)})(d.current.condition,c)||(d.current.value=(()=>{const e=Ln(i,b),r=v?v(e,i,a,l,o):C(e,a,i);return[r,x?t().createElement(Qs,{ref:n,column:a,record:i,rowKey:s,columnKey:b},r):null]})(),d.current.condition=c),d.current.value}(0,[h,ce(i),v,x]);t().useEffect((()=>{if([Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(b))return;const e=N.current.parentNode;u?e.title=w(T):e.removeAttribute("title")}),[u,T]);const R=e=>Array.isArray(e.children);return t().createElement("div",{ref:N,className:"cell"},(()=>{if(b===Io.expandableColumn)return t().createElement(Us,{record:i,rowKey:s});if(b===Io.selectionColumn)return t().createElement(zs,{selectionKeys:p,column:a,record:i,rowKey:s});if(I)return I;if(f&&b===m)return[(e=g?.virtual?i._level:c,e?t().createElement("span",{key:e,className:`cell--indent indent-level-${e}`,style:{paddingLeft:e*Io.treeTable.textIndent+"px"}}):null),t().createElement(Us,{key:"expand",record:i,rowKey:s,style:R(i)?{}:{visibility:"hidden"}}),T];var e;if(y){const e=w(T);return t().createElement("div",{className:"cell--copy"},t().createElement("span",{className:"text"},T),e&&t().createElement(rc,{text:e},t().createElement(we.CopyOutlined,{className:"icon",title:S("qm.table.config.copyText"),onClick:e=>e.stopPropagation()})))}return T})())}));nc.displayName="Cell";const ac=nc;function ic(){return ic=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ic.apply(this,arguments)}const lc=t().forwardRef(((r,n)=>{const{tableData:a,flattenColumns:i}=r,{getRowKey:l,tableRef:o,editableColumns:s,leftFixedColumns:c,rightFixedColumns:u,sorter:d,layout:m,showFooter:h,scrollX:f,scrollY:g,selectionKeys:b,rowExpandedKeys:y,highlightKey:v,isPingLeft:x,isPingRight:E,isTableEmpty:S,isTreeTable:C,isGroupSubtotal:w,isWebPagination:N,isDragMergeCell:T,setElementStore:I,createTableFullData:R,setSelectionKeysEffect:O,setHighlightKey:P,getStickyLeft:A,getStickyRight:k,scrollXToColumn:F,scrollYToRecord:H,rowInViewport:L,dataChange:$,setPingLeft:_,setPingRight:D,setFullScreen:q,findParentRowKeys:j,getAllChildRowKeys:K,triggerScrollYEvent:M,scrollBottomDebouncer:V}=t().useContext(mo),{height:z,minHeight:U,maxHeight:B,rowHeight:W,rowSelection:G,rowHighlight:Y,treeConfig:X,expandable:Q,stripe:Z,summation:ee,rowStyle:te,cellStyle:re,spanMethod:ie,nativeScrollBar:le,ellipsis:oe,showHeader:se,rowDraggable:ce,onRowClick:ue,onRowDblclick:de,onRowContextmenu:pe,onRowEnter:me}=o.current.props,fe=t().useRef(null),ge=t().useRef({}),be=t().useRef(null),ye=t().useRef({prevST:0,prevSL:0}),{dragStart:ve,renderDragPanel:xe,closeDragPanel:Ee}=(()=>{const{tableRef:e,layout:r,flattenColumns:n,isDragMergeCell:a}=t().useContext(mo),{mergeCells:i=[],onMergeChange:l}=e.current.props,[o,s]=t().useState(!1),c=t().useRef(null),u=t().useRef(null),d=t().useRef({x:0,y:0,disX:0,disY:0}),m=Ce("table");qe((()=>{a||x()}),[a]);const h=()=>{x(),Be(c.current,{display:"none"})},f=e=>{const t=[];for(let r=0;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push([e.row+r,e.col+n]);return t},g=()=>{d.current={x:0,y:0,disX:0,disY:0},u.current&&!E(u.current)||(u.current=null,h()),s(!0),document.removeEventListener("mousemove",b)},b=e=>{const{pageX:t,pageY:n}=e,{x:a,y:i,disX:l,disY:o}=d.current;let s=l,u=o,p=t-a,m=n-i;return p<0&&(p=Math.abs(p),s=l-p,Be(c.current,{left:`${s}px`})),m<0&&(m=Math.abs(m),u=o-m,Be(c.current,{top:`${u+r.headerHeight}px`})),Be(c.current,{width:`${p}px`,height:`${m}px`}),y(s,u,p,m),!1},y=wt(((t,r,a,i)=>{const{allTableData:l,scrollYStore:o}=e.current;let s=-1,c=-1,d=-1,p=-1;for(let e=0;e<l.length;e++)r>o.rowHeight*e&&r<o.rowHeight*(e+1)&&(s=e),r+i>o.rowHeight*e&&r+i<o.rowHeight*(e+1)&&(c=e);let m=0;for(let e=0;e<n.length;e++)t>m&&t<m+S(n[e])&&(d=e),t+a>m&&t+a<m+S(n[e])&&(p=e),m+=S(n[e]);const h={row:s,col:d,rowSpan:c-s+1,colSpan:p-d+1};(0,J.isEqual)(u,h)||(u.current=h,v(s,c,d,p))}),5),v=(t,r,n,a)=>{const{elementStore:i,scrollYStore:l}=e.current,o=i.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<o.length;e++){const i=o[e].children;for(let o=0;o<i.length;o++)if(i[o].classList.remove("selected"),(t!==r||n!==a)&&e+l.startIndex>=t&&e+l.startIndex<=r){const e=Number(i[o].getAttribute("colspan")),t=Number(i[o].getAttribute("data-index")),r=e>1?t+e-1:t;r>=n&&r<=a&&i[o].classList.add("selected")}}},x=()=>{const{elementStore:t}=e.current,r=t.$tableBody.querySelectorAll("tbody > tr");for(let e=0;e<r.length;e++){const t=r[e].children;for(let e=0;e<t.length;e++)t[e].classList.remove("selected")}},E=e=>1===e.rowSpan&&1===e.colSpan,S=e=>e.width||e.renderWidth||e.minWidth||Io.defaultColumnWidth;return{dragStart:t=>{const{pageX:n,pageY:a}=t,{elementStore:i}=e.current,{x:l,y:o}=Ye(i.$table),{scrollLeft:p,scrollTop:m}=i.$tableBody.parentNode.parentNode;u.current=null,d.current={x:n,y:a,disX:n+p-l,disY:a+m-(o+r.headerHeight)},Be(c.current,{width:0,height:0,left:n-l+"px",top:a-o+"px",display:"block"}),x(),s(!1),document.addEventListener("mousemove",b,{passive:!0}),document.addEventListener("mouseup",g,{passive:!0,once:!0})},renderDragPanel:()=>t().createElement("div",{ref:c,className:`${m}--merge-cell`,onMouseDown:e=>e.stopPropagation()},o&&t().createElement(t().Fragment,null,t().createElement(he,{size:"small",className:"btn cancel",onClick:()=>{if(u.current&&!E(u.current)){const e=f(u.current),t=i.findIndex((t=>{const r=f(t);return(0,J.intersectionWith)(r,e,J.isEqual).length===r.length}));-1!==t&&l?.(i.filter(((e,r)=>r!==t)))}h()}},p("qm.table.mergeCell.cancel")),t().createElement(he,{size:"small",type:"primary",className:"btn confirm",onClick:()=>{if(u.current&&!E(u.current)){const e=f(u.current);let t=!1;for(let r=0;r<i.length;r++)(0,J.intersectionWith)(f(i[r]),e,J.isEqual).length&&(t=!0);t||l?.([...i,u.current])}h()}},p("qm.table.mergeCell.confirm")))),closeDragPanel:h}})(),we=t().useMemo((()=>{const{headerHeight:e,viewportHeight:t,footerHeight:r,tableFullHeight:n,tableAutoHeight:a}=m,i={};return S&&Object.assign(i,{minHeight:"100px"}),U&&Object.assign(i,{minHeight:kn(U)-e-r+"px"}),B&&Object.assign(i,{maxHeight:kn(B)-e-r+"px"}),z||n||a?{...i,maxHeight:"",minHeight:"",height:`${t}px`}:i}),[z,B,U,S,m]),Ne=t().useMemo((()=>{const{tableBodyWidth:e,gutterWidth:t}=m;return e&&g?e-t:e}),[m,g]),Te=t().useMemo((()=>{const{scrollYStore:e}=o.current,{viewportHeight:t,gutterWidth:r}=m;return Math.floor((f?t-r:t)/e.rowHeight)}),[m,f]),[Ie,Re]=t().useState([]),Oe=Ms(),Pe=function(t,r){const[n,a]=e.useState(!1);return e.useEffect((()=>{let e;const n=t.current,i=t=>{e=t},l=t=>{((e,t)=>{const i=e.target,l=t?.target,o=!i||!l,s=n?.contains(i)||n?.contains(l),c=n===i,u=r?.map((e=>Array.from(document.querySelectorAll(e)))).flat()||[],d=u.some((e=>e?.contains(i)))||u.includes(l);a(!(o||s||c||d))})(t,e)};return n&&(Me(document,"mousedown",i),Me(document,"mouseup",l)),()=>{n&&(Ve(document,"mousedown",i),Ve(document,"mouseup",l))}}),[t]),n}(fe,[".table-editable__popper"]);t().useImperativeHandle(n,(()=>({setClickedValues:He,createFocus:Fe,forceUpdate:Oe}))),qe((()=>{Pe&&(He([]),T&&Ee())}),[Pe]),qe((()=>{Ie.length&&wo.focus(o.current.uid)}),[Ie]),t().useEffect((()=>{ke();const e=qt()(document,"keydown",Ae);return()=>e.remove()}),[]);const Ae=ko((e=>{const{keyCode:t}=e;if(o.current.uid===wo.getFocusInstance()?.id&&(27===t&&(He([]),P(""),q(!1)),Ie.length&&(Qe(document.activeElement,fe.current)||"INPUT"!==document.activeElement?.tagName))){if(13===t&&("radio"===G?.type||Y)){const t=b[0]??v??null,r=a.find((e=>l(e,e.index)===t))??null;r&&me?.(r,e)}if(38===t||40===t){Ue(e);const{allTableData:r}=o.current,n=N?On(a):r,i=n.length;let s=n.findIndex((e=>l(e,e.index)===Ie[0]));const c=38===t?(--s+i)%i:++s%i,u=n[c],d=l(u,u.index);"radio"!==G?.type||G.disabled?.(u)||O([d]),Y&&!Y.disabled?.(u)&&P(d),L(c)||(38===t&&H(d,c),40===t&&H(d,Te>c+1?0:c+1-Te)),He([d,Ie[1]])}if(9===t){if(Ue(e),!s.length)return He([]);const t=s.length;let r=s.findIndex((e=>e.dataIndex===Ie[1]));const n=++r%t,a=s[n].dataIndex;He([Ie[0],a]),F(a)}}})),ke=()=>{I("$tableBody",fe.current),I("$tableYspace",be.current)},Fe=(e,t)=>{ge.current[`${e}-${t}`]?.focus()},He=e=>{(0,J.isEqual)(e,Ie)||Re(e)},Le=(e,t,r)=>r?[...t,e]:t.filter((t=>t!==e)),$e=(e,t,r)=>{const{deriveRowKeys:n}=o.current,a=Rn(n,e);let i=[];const l=K(a?.children||[]),s=Gn(n,e)?.slice(0,-1).reverse()||[];return i=r?[...new Set([...t,e,...l])]:t.filter((t=>![e,...l].includes(t))),s.forEach((e=>{const t=Rn(n,e),r=Hn(i,t?.children?.map((e=>e.rowKey))||[]);i=r?[...i,e]:i.filter((t=>t!==e))})),i},_e=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];return e.forEach((e=>{const a=e.index,o=l(e,e.index);if(n.push(De(e,a,o,r)),Q?.expandedRowRender){const{expandedRowClassName:r,rowExpandable:l=ae}=Q;y.includes(o)&&l(e)&&n.push(t().createElement("tr",{key:`expand_${o}`,className:"body--row-expanded"},t().createElement("td",{colSpan:i.length,className:"body--column",style:{paddingLeft:G?2*Io.selectionColumnWidth:Io.selectionColumnWidth}},t().createElement("div",{className:Se()("cell",r)},Q.expandedRowRender(e,a)))))}if(!X?.virtual&&(e=>Array.isArray(e.children))(e)){const t="function"!=typeof Q?.rowExpandable||Q.rowExpandable(e);y.includes(o)&&t&&n.push(..._e(e.children,r+1))}})),n},De=function(e,r,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const l=["body--row",{"body--row-striped":Z&&r%2!=0,"body--row-selected":b.includes(n),"body--row-current":v===n,...w?We(e._group):null}];return t().createElement("tr",{key:n,className:Se()(l)},i.map(((t,i)=>je(t,i,e,r,n,a))))},je=(e,r,n,a,i,s)=>{const{isIE:p}=o.current,{dataIndex:m,fixed:h,align:f,className:g="",editRender:y}=e,{rowSpan:v,colSpan:x}=Ke(n,e,a,r);if(!v||!x)return null;const E=e.ellipsis??oe,S=!p&&"left"===h,N=!p&&"right"===h,T=["body--column",{"col--ellipsis":E,"col--center":"center"===f,"col--right":"right"===f,"column--sort":!!d[m],"cell-fix-left":S,"cell-fix-right":N,"cell-fix-left-last":S&&c[c.length-1].dataIndex===m,"cell-fix-right-first":N&&u[0].dataIndex===m,[g]:!!g}],I=p?null:{left:S?`${A(m)}px`:"",right:N?`${k(m)}px`:""},R=te?"function"==typeof te?te(n,a):te:null,F=re?"function"==typeof re?re(n,e,a,r):re:null,H=w?ze(n._group):null,L=Object.assign({},I,W?{height:W}:null,H,R,F);if(y){const{extra:t}=y(n,e)||{};t?.disabledBackgroundColor&&Object.assign(L,{backgroundColor:t?.disabledBackgroundColor})}return t().createElement("td",{key:m,rowSpan:v>1?v:void 0,colSpan:x>1?x:void 0,"data-index":r,className:Se()(T),style:L,onClick:t=>((e,t,r)=>{const{dataIndex:n}=r;if([Io.expandableColumn,Io.operationColumn].includes(n))return;const a=l(t,t.index);He([a,n]);const i=r.editRender?.(t,r),o=i&&!i.disabled,{type:s,selectByClickRow:c=!0,disabled:u=ne}=G||{};!s||u(t)||o||(c||n===Io.selectionColumn)&&((e,t)=>{const{type:r,checkStrictly:n=!0,onSelect:a}=G||{};if("radio"===r&&O([e]),"checkbox"===r){const r=!b.includes(e),i=C&&!n?$e(e,b,r):Le(e,b,r);O(i),a?.(r,t,i)}})(a,t),[Io.selectionColumn].includes(n)||(!Y||Y.disabled?.(t)||o||P(a),ue?.(t,r,e))})(t,n,e),onDoubleClick:t=>((e,t,r)=>{const{dataIndex:n}=r;[Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(n)||de?.(t,r,e)})(t,n,e),onContextMenu:t=>((e,t,r)=>{const{dataIndex:n}=r;[Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(n)||pe?.(t,r,e)})(t,n,e)},t().createElement(ac,{ref:e=>ge.current[`${i}-${m}`]=e,row:n,column:e,rowIndex:a,columnIndex:r,rowKey:i,depth:s,showTitle:E}))},Ke=(e,t,r,n)=>{let i=1,l=1;if("function"==typeof ie){const o=ie({row:e,column:t,rowIndex:r,columnIndex:n,tableData:a});if(Array.isArray(o)?(i=o[0],l=o[1]):(0,J.isPlainObject)(o)&&(i=o.rowSpan,l=o.colSpan),e===a[0]&&0===i){i=1;for(let e=1;e<a.length;e++){const{rowSpan:r}=Ke(a[e],t,a[e].index,n);if(r>0)break;i++}}}const{mergeCells:s}=o.current;if(s.length>0){const e=s.find((e=>e.row===r&&e.col===n));e&&(i=e.rowSpan,l=e.colSpan)}return{rowSpan:i,colSpan:l}},ze=e=>{const{backgroundColor:t,color:r}=ee.groupItems.find((t=>t.dataIndex===e))??{};return{backgroundColor:t,color:r}},We=e=>{const t=ee.groupItems.findIndex((t=>t.dataIndex===e));return{[`body--row-group_${t+1}`]:t>=0}},Ge=Ce("table"),Xe=T?{onMouseDown:ve}:null;return t().createElement(t().Fragment,null,t().createElement(Pt,{wrapClassName:`${Ge}--body-wrapper`,wrapStyle:we,native:le,onScroll:e=>{const{elementStore:t,scrollYLoad:r}=o.current,{prevST:n,prevSL:a}=ye.current,i=g?m.gutterWidth:0,{scrollTop:l,scrollLeft:s}=e;if(s!==a){se&&(t.$header.scrollLeft=s),h&&(t.$footer.scrollLeft=s);const e=s>0,r=Math.ceil(s)+m.tableWidth<m.tableBodyWidth+i;x!==e&&_(e),E!==r&&D(r)}if(r&&l!==n&&M(l),g&&l!==n){const r=t.$tableYspace.offsetHeight||t.$tableBody.offsetHeight;Math.ceil(l)+m.viewportHeight-i>=r&&V({type:"scroll",target:e,preventDefault:ne,stopPropagation:ne})}ye.current.prevST=l,ye.current.prevSL=s}},t().createElement("div",{ref:be,className:"body--y-space"}),t().createElement("div",{className:"body--x-space",style:{width:Ne?`${Ne}px`:""}}),t().createElement(Ks.Provider,{value:Ie},t().createElement("table",ic({ref:fe,className:`${Ge}--body`,tabIndex:-1,cellSpacing:"0",cellPadding:"0"},Xe,{style:{width:Ne?`${Ne}px`:""}}),t().createElement("colgroup",null,i.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})}))),ce?t().createElement(Zn.ReactSortable,{itemKey:e=>l(e,e.index),tag:"tbody",animation:200,list:a,setList:e=>{const t=e.map((e=>l(e,e.index))),r=a.map((e=>l(e,e.index)));if((0,J.isEqual)(t,r))return;const n=Qn(e),i=[];o.current.tableFullData.forEach((e=>{a.includes(e)?i.push(n.shift()):i.push(e)})),R(i),$()}},a.map((e=>De(e,e.index,l(e,e.index))))):t().createElement("tbody",null,_e(a))))),T&&xe())}));lc.displayName="TableBody";const oc=lc,sc=e=>{const{summationRows:r,flattenColumns:n}=e,{tableRef:a,sorter:i,layout:l,scrollY:o,leftFixedColumns:s,rightFixedColumns:c,setElementStore:u,getStickyLeft:d,getStickyRight:m}=t().useContext(mo),{footRender:h}=a.current.props,f=t().useRef(null);t().useEffect((()=>{g()}),[]);const g=()=>{u("$footer",f.current)},b=Ce("table"),{tableBodyWidth:y}=l;return t().createElement("div",{ref:f,className:`${b}--footer-wrapper`},h?h(n,a.current.tableFullData):t().createElement("table",{className:`${b}--footer`,cellSpacing:"0",cellPadding:"0",style:{width:y?`${y}px`:""}},(()=>{const{gutterWidth:e}=l;return t().createElement("colgroup",null,n.map((e=>{const{dataIndex:r,width:n,renderWidth:a}=e;return t().createElement("col",{key:r,style:{width:`${n||a}px`,minWidth:`${n||a}px`}})})),o&&t().createElement("col",{style:{width:`${e}px`,minWidth:`${e}px`}}))})(),t().createElement("tfoot",null,(()=>{const{isIE:e}=a.current,u=["gutter",{"cell-fix-right":!!c.length}],h=e?null:{right:c.length?0:""};return r.map(((e,r)=>t().createElement("tr",{key:r,className:"footer--row"},n.map(((r,n)=>((e,r,n)=>{const{isIE:u}=a.current,{gutterWidth:h}=l,{dataIndex:f,fixed:g,align:b,summation:y}=e,v=["footer--column","col--ellipsis",{"col--center":"center"===b,"col--right":"right"===b,"column--sort":!!i[f],"cell-fix-left":!u&&"left"===g,"cell-fix-right":!u&&"right"===g,"cell-fix-left-last":!u&&"left"===g&&s[s.length-1].dataIndex===f,"cell-fix-right-first":!u&&"right"===g&&c[0].dataIndex===f}],x=u?null:{left:"left"===g?`${d(f)}px`:"",right:"right"===g?`${m(f)+(o?h:0)}px`:""},E=y?.render?y.render(a.current.tableFullData):Ln(r,`${f}_text`),S=0===n&&""===E?p("qm.table.config.summaryText"):E;return t().createElement("td",{key:f,title:S,className:Se()(v),style:{...x}},t().createElement("div",{className:"cell"},S))})(r,e,n))),o&&t().createElement("td",{className:Se()(u),style:{...h}}))))})())))};var cc=function(e){return e.small="small",e.middle="default",e.large="default",e}(cc||{});const uc=e=>{const{current:r,pageSize:n,total:a,onChange:i}=e,{global:o}=t().useContext(l),{tableRef:s,$size:c,setElementStore:u}=t().useContext(mo),{uniqueKey:d,paginationConfig:p,infoBarConfig:m}=s.current.props,h=t().useRef(null),f=t().useMemo((()=>d?`tablePager_${d}`:""),[d]);t().useEffect((()=>{g(),x()}),[]);const g=()=>{u("$pager",h.current)},b=p?.showSizeChanger??Io.pagination.showSizeChanger,y=p?.showQuickJumper??Io.pagination.showQuickJumper,v=p?.pageSizeOptions||o?.table?.pagination?.pageSizeOptions||Io.pagination.pageSizeOptions,x=async()=>{if(!f)return;const e=await E(f);e&&e!==n&&(i(r,e),localStorage.setItem(f,e.toString()))},E=async e=>{const t=o?.getComponentConfigApi;if(t&&!localStorage.getItem(f))try{const r=await t({key:e});if(200===r.code)return r.data}catch(e){}},S={[`${Ce("table")}-pager`]:!0};return t().createElement("div",{ref:h,className:Se()(S)},t().createElement("div",{className:"pager-alert"},"bottom"===m?.position&&t().createElement(Lo,{total:a})),t().createElement(P.Pagination,{size:cc[c],showSizeChanger:b,showQuickJumper:y,pageSizeOptions:v,current:r,pageSize:n,total:a,onChange:(e,t)=>{i(e,t)},onShowSizeChange:(e,t)=>{f&&((async(e,t)=>{const r=o?.saveComponentConfigApi;if(r)try{await r({[e]:t})}catch(e){}})(f,t),localStorage.setItem(f,`${t}`))}}))},dc=()=>{const{layout:e}=t().useContext(mo),r=t().useMemo((()=>{const{headerHeight:t,viewportHeight:r}=e;return{top:`${t}px`,height:`${r}px`}}),[e]),n=Ce("table");return t().createElement("div",{className:`${n}--empty`,style:r},t().createElement(ht,null))},pc=()=>{const{setElementStore:e}=t().useContext(mo),r=t().useRef(null);t().useEffect((()=>{n()}),[]);const n=()=>{e("$resizableBar",r.current)},a=Ce("table");return t().createElement("div",{ref:r,className:`${a}--resizable-bar`})};function mc(){return mc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mc.apply(this,arguments)}const hc=t().forwardRef(((e,r)=>{const{rowKey:n,columns:a,loading:i,stripe:o,resizable:s,customClass:c,tablePrint:u,exportExcel:d,infoBarConfig:p,topSpaceAlign:m,showTableInfo:h,showFullScreen:f,showRefresh:b,showToolBox:y,showHeader:v}=e,{size:x}=t().useContext(l),E=t().useMemo((()=>e.size??x??""),[e.size,x]),S=t().useRef(null),C=t().useRef(null),w=t().useRef(null),N=t().useRef(null),T=t().useRef(null),I=t().useCallback(((e,t)=>{const r="function"==typeof n?n(e,t):e[n];return void 0===r?(g("Table","Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key."),t):r}),[n]),{tableRef:R,tableFullData:O,setElementStore:P,setOriginColumns:A,setTableFullData:k,setTableOriginData:F,setAllTableData:H,setDeriveRowKeys:L,setInvalidRowKeys:$,setFieldAuth:_,setMergeCells:D,setColumnsDefined:q,setScrollYStore:j,setScrollYLoad:K,setResizeState:M,setHandleState:V,setSummaries:z,setSelectionRows:U,setShouldToTop:B,setRecordsMap:W,setUnMounted:G,setHandleChange:Y,clearElementStore:X,clearRecordsMap:Q}=((e,r)=>{let{getRowKey:n,$size:a}=r;const{rowHeight:i,dynamicThead:l}=e,o=t().useRef({props:e,uid:Mn(),elementStore:{},originColumns:[],tableFullData:[],tableOriginData:[],allTableData:[],allRowKeys:[],deriveRowKeys:[],flattenRowKeys:[],invalidRowKeys:[],fieldAuth:{},mergeCells:[],columnsDefined:!l,scrollYStore:{startIndex:0,endIndex:0,offsetSize:0,visibleSize:0,rowHeight:i||Io.rowHeightMaps[a]},store:new To,resizeState:{width:0,height:0,winHeight:window.innerHeight},handleState:{insert:null,remove:!1},summaries:{},treeTable:!1,scrollYLoad:!1,shouldToTop:!0,selectionRows:[],recordsMap:new Map,unMounted:!1,isHandleChange:!0,isIE:!ee&&/MSIE|Trident/.test(navigator.userAgent)});(e=>{o.current.props=e})(e);const s=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return e.map((e=>{const l=n(e,e.index),o=r?`${r}#${l}`:`${l}`,c=a?`${a}-${e.index+1}`:`${e.index+1}`,u={level:i,rowKey:l,rowKeyPath:o,indexPath:c};return e.indexPath=c,e._level=i,e.children&&(u.children=s(e.children,l,o,c,i+1)),t?Object.assign({},u,{parentRowKey:t}):u}))},c=e=>{const t=[];return e.forEach((e=>{Array.isArray(e.children)?t.push(...c(e.children)):t.push(e.rowKey)})),t};return{tableRef:o,...o.current,setElementStore:(e,t)=>{o.current.elementStore[e]=t},setOriginColumns:e=>{o.current.originColumns=e},setTableFullData:e=>{o.current.tableFullData=e},setTableOriginData:e=>{o.current.tableOriginData=e},setAllTableData:e=>{const t=On(e);o.current.allTableData=t,o.current.allRowKeys=t.map((e=>n(e,e.index)))},setDeriveRowKeys:e=>{o.current.treeTable=o.current.tableFullData.some((e=>Array.isArray(e.children))),o.current.treeTable&&(o.current.deriveRowKeys=s(e,""),o.current.flattenRowKeys=c(o.current.deriveRowKeys))},setInvalidRowKeys:e=>{o.current.invalidRowKeys=e},setFieldAuth:(e,t)=>{o.current.fieldAuth[e]=t},setMergeCells:e=>{const t=[];e.forEach((e=>{t.push(e);for(let r=1;r<e.colSpan;r++)for(let n=0;n<e.rowSpan;n++)t.push({row:e.row+n,col:e.col+r,rowSpan:0,colSpan:0});for(let r=1;r<e.rowSpan;r++)for(let n=0;n<e.colSpan;n++)t.push({row:e.row+r,col:e.col+n,rowSpan:0,colSpan:0})})),o.current.mergeCells=t},setColumnsDefined:e=>{o.current.columnsDefined=e},setScrollYStore:e=>{o.current.scrollYStore=e},setResizeState:e=>{o.current.resizeState=e},setHandleState:e=>{o.current.handleState=e},setSummaries:e=>{o.current.summaries=e},setScrollYLoad:e=>{o.current.scrollYLoad=e},setShouldToTop:e=>{o.current.shouldToTop=e},setSelectionRows:e=>{o.current.selectionRows=e},setRecordsMap:(e,t)=>{o.current.recordsMap.set(e,t)},setUnMounted:e=>{o.current.unMounted=e},setHandleChange:e=>{o.current.isHandleChange=e},clearElementStore:()=>{for(const e in o.current.elementStore)o.current.elementStore[e]=null},clearRecordsMap:()=>{o.current.recordsMap.clear()}}})(e,{getRowKey:I,$size:E}),{tableData:Z,setTableData:te,filters:re,setFilters:ne,sorter:ae,setSorter:ie,superFilters:le,setSuperFilters:oe,pagination:se,setPagination:ue,selectionKeys:de,setSelectionKeys:pe,rowExpandedKeys:me,setRowExpandedKeys:he,highlightKey:fe,setHighlightKey:ge,updateMark:be,forceUpdate:ye,layout:ve,setLayout:xe,permission:Ee,setPermission:we,spinning:Ne,setSpinning:Te,scrollX:Ie,setScrollX:Re,scrollY:Oe,setScrollY:Pe,isPingLeft:Ae,setPingLeft:ke,isPingRight:Fe,setPingRight:He,isFullScreen:Le,setFullScreen:$e,updateTableData:_e}=(e=>{const{uniqueKey:r,nativeScrollBar:n,initialSorter:a={},initialFilter:i={},paginationConfig:o,rowSelection:s,expandable:c,rowHighlight:u}=e,{global:d}=t().useContext(l),p={current:Io.pagination.current,pageSize:(()=>{if(r)return Number(localStorage.getItem(`tablePager_${r}`))||void 0})()??o?.pageSize??d?.table?.pagination?.pageSize??Io.pagination.pageSize,total:0},m=s?.selectedRowKeys??s?.defaultSelectedRowKeys??[],h=c?.expandedRowKeys??c?.defaultExpandedRowKeys??[],[f,g]=t().useState([]),[b,y]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),i),[v,x]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),a),[E,S]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),[]),[C,w]=t().useState(p),[N,T]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),m),[I,R]=t().useReducer(((e,t)=>(0,J.isEqual)(e,t)?e:t),h),[O,P]=t().useState(u?.currentRowKey??""),[A,k]=t().useReducer((e=>e+1),0),[F,H]=t().useState({gutterWidth:n?Oo():0,tableWidth:0,tableBodyWidth:0,tableBodyHeight:0,viewportHeight:0,headerHeight:0,footerHeight:0,tableAutoHeight:0,tableFullHeight:0}),[L,$]=t().useState({export:!0,import:!0,print:!0}),[_,D]=t().useState(!1),[q,j]=t().useState(!1),[K,M]=t().useState(!1),[V,z]=t().useState(!1),[U,B]=t().useState(!1),[W,G]=t().useState(!1);return{tableData:f,setTableData:g,filters:b,setFilters:y,sorter:v,setSorter:x,superFilters:E,setSuperFilters:S,pagination:C,setPagination:w,selectionKeys:N,setSelectionKeys:T,rowExpandedKeys:I,setRowExpandedKeys:R,highlightKey:O,setHighlightKey:P,updateMark:A,forceUpdate:k,layout:F,permission:L,setPermission:$,setLayout:H,spinning:_,setSpinning:D,scrollX:q,setScrollX:j,scrollY:K,setScrollY:M,isPingLeft:V,setPingLeft:z,isPingRight:U,setPingRight:B,isFullScreen:W,setFullScreen:G,updateTableData:()=>{g([...f])}}})(e),{isFetch:De,isWebPagination:je,isScrollPagination:Ke,showPagination:Me,shouldUpdateHeight:Ve,tableColumns:ze,flattenColumns:Ue,editableColumns:Be,summationColumns:We,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,showSummary:Qe,showFooter:Ze,isHeadGroup:Je,bordered:et,isHeadSorter:tt,isHeadFilter:rt,isServiceSummation:nt,isSelectCollection:at,isTableImport:it,isTableClipboard:lt,isSuperSearch:ot,isFastSearch:st,isGroupSummary:ct,isGroupSubtotal:ut,isDragMergeCell:dt,isTreeTable:pt,isTableEmpty:mt,summationRows:ht,fetchParams:ft}=Ao(e,{getRowKey:I,tableRef:R,tableFullData:O,tableData:Z,sorter:ae,filters:re,superFilters:le,selectionKeys:de,pagination:se}),{createElementStore:bt,tableStyles:yt,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,calcTableHeight:Nt,resetTableScroll:Tt,doLayout:It}=Ho(e,{getRowKey:I,tableRef:R,$size:E,tableColumns:ze,flattenColumns:Ue,leftFixedColumns:Ge,layout:ve,scrollY:Oe,tableData:Z,showFooter:Ze,showPagination:Me,isWebPagination:je,isFullScreen:Le,setLayout:xe,setScrollX:Re,setScrollY:Pe,setElementStore:P,setScrollYStore:j,setShouldToTop:B}),{initialTable:Rt,checkDataIndex:Ot,createTableFullData:Pt,getTableData:At,handleTableData:kt,createTableData:Ft,createGroupData:Ht,createSelectionKeys:Lt,createRowExpandedKeys:$t,setSelectionKeysEffect:_t,findParentRowKeys:Dt,getAllChildRowKeys:qt,doFieldValidate:jt,getTableLog:Kt,dataChange:Mt,tableChange:Vt,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,pagerChangeHandle:Wt,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er,clearTableLog:tr,destroy:rr}=Fo(e,{getRowKey:I,tableRef:R,tableElementRef:C,tableBodyRef:w,$size:E,tableColumns:ze,flattenColumns:Ue,tableFullData:O,pagination:se,layout:ve,filters:re,sorter:ae,superFilters:le,fetchParams:ft,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,summationColumns:We,shouldUpdateHeight:Ve,isFetch:De,isTreeTable:pt,isWebPagination:je,isScrollPagination:Ke,isServiceSummation:nt,isGroupSubtotal:ut,doLayout:It,setTableData:te,setTableFullData:k,setTableOriginData:F,setAllTableData:H,setDeriveRowKeys:L,setPagination:ue,setSpinning:Te,setSorter:ie,setFilters:ne,setSuperFilters:oe,setSelectionKeys:pe,setRowExpandedKeys:he,setHighlightKey:ge,setSelectionRows:U,setScrollYLoad:K,setScrollYStore:j,setFieldAuth:_,setResizeState:M,setSummaries:z,setPermission:we,setRecordsMap:W,resetTableScroll:Tt,clearElementStore:X,clearRecordsMap:Q});((e,r)=>{const{columns:n,summation:a,rowSelection:i,expandable:l,rowHighlight:o,mergeCells:s=[]}=e,{tableRef:c,topElementRef:u,tableElementRef:d,tableBodyRef:p,$size:m,scrollX:h,pagination:f,selectionKeys:b,rowExpandedKeys:y,highlightKey:v,summationRows:x,showSummary:E,isWebPagination:S,isScrollPagination:C,isTreeTable:w,checkDataIndex:N,toLastPage:T,toFirstPage:I,getPageCount:R,setHandleState:O,scrollYToRecord:P,setSelectionKeysEffect:A,setOriginColumns:k,setRowExpandedKeys:F,setHighlightKey:H,setResizeState:L,setMergeCells:$,setPingRight:_,setUnMounted:D,setHandleChange:q,calcTableHeight:j,createSelectionKeys:K,createRowExpandedKeys:M,createElementStore:V,triggerScrollYEvent:z,initialTable:U,destroy:B}=r,{elementStore:W,handleState:G,scrollYLoad:Y}=c.current,X=t().useRef(x);qe((()=>{if(!i)return;const{onChange:e}=i;"radio"===i.type&&p.current.setClickedValues(b.length?[b[0],""]:[]),c.current.isHandleChange&&e?.(b,c.current.selectionRows),q(!0)}),[b]),qe((()=>{if(!l)return;const{allTableData:e,allRowKeys:t}=c.current,{onChange:r}=l;r?.(y,y.map((r=>e[t.findIndex((e=>e===r))])))}),[y]),qe((()=>{const{allTableData:e,allRowKeys:t}=c.current;w&&F(M()),o&&(p.current.setClickedValues(v?[v,""]:[]),o.onChange?.(v,e[t.findIndex((e=>e===v))]??null))}),[v]),qe((()=>{(0,J.isEqual)(x,X.current)||(X.current=x,E&&a&&a.onChange?.(x))}),[x]),qe((()=>{const e=K(i.selectedRowKeys);(0,J.isEqual)(e,b)||(A(e),w&&F(M()))}),[i?.selectedRowKeys]),qe((()=>{const e=M(l.expandedRowKeys);(0,J.isEqual)(e,y)||F(e)}),[l?.expandedRowKeys]),qe((()=>{const{currentRowKey:e}=o;e!==v&&H(e??"")}),[o?.currentRowKey]),qe((()=>{const{insert:e,remove:t}=G;e&&(S&&("after"===e?T():I()),P("","after"===e?1e5:0)),t&&f.current>R()&&T(),(e||t)&&O({insert:null,remove:!1})}),[f.total]),qe((()=>{Y&&z(W.$tableBody.parentNode.parentNode.scrollTop)}),[Y]),qe((()=>{_(h)}),[h]),qe((()=>{j()}),[m]),qe((()=>{$(s),p.current.forceUpdate()}),[s]),qe((()=>{Y&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"),e.ellipsis||g("Table","必须设置组件参数 `ellipsis`")),C&&(e.height||e.maxHeight||g("Table","必须设置组件参数 `height` 或 `maxHeight`"))}),[Y,C]);const Q=()=>{const{resizeState:e}=c.current,{winHeight:t}=e,r=window.innerHeight;r!==t&&(L(Object.assign({},e,{winHeight:r})),j())};t().useEffect((()=>(V({$toper:u.current,$table:d.current}),k(ce(n)),U(),$(s),window.addEventListener("resize",Q,!1),j(),N(),()=>{B(),window.removeEventListener("resize",Q),D(!0)})),[])})(e,{tableRef:R,topElementRef:S,tableElementRef:C,tableBodyRef:w,$size:E,scrollX:Ie,pagination:se,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,showSummary:Qe,summationRows:ht,isWebPagination:je,isScrollPagination:Ke,isTreeTable:pt,checkDataIndex:Ot,toLastPage:zt,toFirstPage:Ut,getPageCount:Bt,setHandleState:V,scrollYToRecord:Ct,setOriginColumns:A,setSelectionKeysEffect:_t,setRowExpandedKeys:he,setHighlightKey:ge,setResizeState:M,setMergeCells:D,setPingRight:He,setUnMounted:G,setHandleChange:Y,calcTableHeight:Nt,createSelectionKeys:Lt,createRowExpandedKeys:$t,createElementStore:bt,triggerScrollYEvent:Gt,initialTable:Rt,destroy:rr});const nr=t().useMemo((()=>({getRowKey:I,tableRef:R,tableBodyRef:w,$size:E,flattenColumns:Ue,editableColumns:Be,leftFixedColumns:Ge,rightFixedColumns:Ye,treeExpandIndex:Xe,sorter:ae,filters:re,superFilters:le,layout:ve,bordered:et,showFooter:Ze,showSummary:Qe,summationRows:ht,scrollX:Ie,scrollY:Oe,pagination:se,fetchParams:ft,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,updateMark:be,isFetch:De,isPingLeft:Ae,isPingRight:Fe,isHeadSorter:tt,isHeadFilter:rt,isFullScreen:Le,isTableEmpty:mt,isHeadGroup:Je,isTreeTable:pt,isGroupSubtotal:ut,isWebPagination:je,isDragMergeCell:dt,dataChange:Mt,tableChange:Vt,getTableData:At,setElementStore:P,createTableFullData:Pt,updateTableData:_e,setSorter:ie,setFilters:ne,setSuperFilters:oe,setHighlightKey:ge,setRowExpandedKeys:he,setSelectionRows:U,setSelectionKeysEffect:_t,setInvalidRowKeys:$,getSpan:vt,getStickyLeft:xt,getStickyRight:Et,scrollXToColumn:St,scrollYToRecord:Ct,rowInViewport:wt,setPagination:ue,setPingLeft:ke,setPingRight:He,setSpinning:Te,setFullScreen:$e,setShouldToTop:B,doFieldValidate:jt,createTableData:Ft,createGroupData:Ht,findParentRowKeys:Dt,getAllChildRowKeys:qt,triggerScrollYEvent:Gt,scrollBottomDebouncer:Yt,resetTableScroll:Tt,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearRowSelection:Jt,clearRowHighlight:er})),[E,Ue,Be,Ge,Ye,Xe,ae,re,le,ve,et,Ze,Qe,ht,Ie,Oe,se,ft,de,me,fe,be,De,Ae,Fe,tt,rt,Le,mt,Je,pt,ut,je,dt]);((e,r)=>{const{getRowKey:n,tableRef:a,toolBoxRef:i,tableBodyRef:l,columnFilterRef:o,flattenColumns:s,editableColumns:c,pagination:u,fetchParams:d,selectionKeys:p,rowExpandedKeys:m,highlightKey:h,isFetch:f,dataChange:b,getTableData:y,handleTableData:v,createTableData:x,calcTableHeight:E,scrollXToColumn:S,scrollYToRecord:C,doFieldValidate:w,setHandleState:N,setColumnsDefined:T,setSelectionKeysEffect:I,setRowExpandedKeys:R,setHighlightKey:O,setSelectionRows:P,setOriginColumns:A,setHandleChange:k,forceUpdate:F,getTableLog:H,clearRowSelection:L,clearRowHighlight:$,clearTableSorter:_,clearTableFilter:D,clearSuperFilters:q,clearTableLog:j}=r,{columns:K,columnsChange:M}=a.current.props,V=(e,t,r)=>{for(let a=0;a<e.length;a++){const i=e[a],l=n(i,i.index);Array.isArray(i.children)&&V(i.children,t,r),t.includes(l)&&(r?.(i,l),e.splice(a,1),a-=1)}};t().useImperativeHandle(e,(()=>({CALCULATE_HEIGHT:()=>{E()},DO_REFRESH:async e=>{f&&(await y(),e?.())},GET_LOG:()=>H(),GET_FETCH_PARAMS:()=>{const e={};for(const t in d)Object.keys(u).includes(t)||(e[t]=d[t]);return e},CLEAR_TABLE_DATA:()=>{f||(L(),$(),_(),D(),q(),j(),x([]))},CLEAR_LOG:()=>{j()},CREATE_FOCUS:(e,t)=>{l.current.createFocus(e,t)},FORCE_UPDATE:()=>{F()},DO_EXPORT:()=>{i.current.exportHandle()},SCROLL_TO_RECORD:e=>{C(e)},SCROLL_TO_COLUMN:e=>{S(e)},SET_SELECTION:function(e){!(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&!(0,J.isEqual)(e,p)&&k(!1),I(e)},SET_HIGHLIGHT:e=>{O(e)},SET_EXPANDABLE:e=>{R(e)},SET_SELECTION_ROWS:e=>{P(e)},SET_TABLE_DATA:e=>{v(e)},DEFINE_INITIAL_COLUMNS:e=>{A(e),T(!0),o.current.initialHandler()},SET_TABLE_COLUMN:(e,t,r)=>{const n=wn(K,e);if(!n)return g("Table","SET_TABLE_COLUMN 方法参数 `dataIndex` 的值不正确");if(!(0,J.isPlainObject)(t))return g("Table","SET_TABLE_COLUMN 方法参数 `option` 的值不正确");if(n.noAuth)return g("Table","SET_TABLE_COLUMN 方法不能操作受权限控制的列");for(const e in t)e&&(0,J.set)(n,e,t[e]);r&&(M?M([...K]):g("Table","需要设置 `columnsChange` 参数"),F())},INSERT_RECORDS:(e,t)=>{const{store:r,tableFullData:i}=a.current,l=(Array.isArray(e)?e:[e]).filter((e=>(0,J.isPlainObject)(e)));if(!l.length)return;l.forEach((e=>{s.forEach((t=>{const{dataIndex:r}=t;[Io.expandableColumn,Io.selectionColumn,Io.operationColumn].includes(r)||$n(e,r,Ln(e,r))})),r.addToInserted(e)}));const o="before"===t?.mode,c=void 0===t?.parentRowKey,u=i;if(c)o?u.unshift(...l):u.push(...l);else{const e=Yn(i,(e=>t.parentRowKey===n(e,e.index)));e&&(Array.isArray(e.children)?o?e.children.unshift(...l):e.children.push(...l):e.children=l)}x(u),c&&N(Object.assign({},a.current.handleState,{insert:o?"before":"after"})),F(),b()},REMOVE_RECORDS:e=>{const{store:t,tableFullData:r}=a.current,i=(Array.isArray(e)?e:[e]).map((e=>(0,J.isPlainObject)(e)?n(e,e.index):e));if(!i.length)return;let l=!1;V(r,i,((e,r)=>{t.addToRemoved(e),c.forEach((n=>{const{dataIndex:a,editRender:i}=n,l=i?.(e,n);if(!l)return;const{rules:o=[],disabled:s}=l;!s&&o.length&&(t.removeFromRequired({x:r,y:a}),t.removeFromValidate({x:r,y:a}),t.removeFromEdited({x:r,y:a}))})),l=!0})),l&&(x(r),I(p.filter((e=>!i.includes(e)))),i.includes(h)&&$(),R(m.filter((e=>!i.includes(e)))),N(Object.assign({},a.current.handleState,{remove:!0})),b())},VALIDATE_FIELDS:(e,t)=>{a.current.allTableData.forEach((r=>{c.forEach((a=>{const{dataIndex:i,editRender:l}=a,o=l?.(r,a);if(!o)return;const s=n(r,r.index);if(e&&!e.includes(s))return;if(t&&!t.includes(i))return;const{rules:c=[],disabled:u}=o;!u&&c.length&&w(c,Ln(r,i),s,i)}))}));const{required:r,validate:i}=H(),l=[...r,...i];return l.length&&C(l[0].rowKey),F(),{required:r,validate:i}}})))})(r,{getRowKey:I,tableRef:R,toolBoxRef:N,tableBodyRef:w,columnFilterRef:T,flattenColumns:Ue,editableColumns:Be,pagination:se,fetchParams:ft,selectionKeys:de,rowExpandedKeys:me,highlightKey:fe,isFetch:De,dataChange:Mt,getTableData:At,handleTableData:kt,createTableData:Ft,calcTableHeight:Nt,scrollXToColumn:St,scrollYToRecord:Ct,doFieldValidate:jt,setHandleState:V,setColumnsDefined:q,setSelectionKeysEffect:_t,setRowExpandedKeys:he,setHighlightKey:ge,setSelectionRows:U,setOriginColumns:A,setHandleChange:Y,forceUpdate:ye,getTableLog:Kt,clearRowSelection:Jt,clearRowHighlight:er,clearTableSorter:Xt,clearTableFilter:Qt,clearSuperFilters:Zt,clearTableLog:tr}),t().useEffect((()=>{wo.register(R.current.uid,r??{current:null})}),[]);const ar=Ce("table"),ir={[`${ar}--wrapper`]:!0,[`${ar}--lg`]:"large"===E,[`${ar}--sm`]:"small"===E,[`${ar}--maximize`]:Le,[c]:!!c},lr={[ar]:!0,"is--border":et,"is--striped":o,"is--fixed":Ge.length||Ye.length,"is--sortable":tt,"is--filterable":rt,"is--head-group":Je,"is--merge-cell":dt,"is--empty":mt,"show--head":v,"show--foot":Ze,"ping--left":Ae,"ping--right":Fe,"scroll--x":Ie,"scroll--y":Oe};return t().createElement(mo.Provider,{value:nr},t().createElement("div",{className:Se()(ir)},h&&t().createElement("div",{ref:S,className:`${ar}-top`},t().createElement("div",{className:`${ar}-top__space`},"bottom"!==p?.position&&t().createElement(Lo,{total:se.total}),t().createElement("div",{className:`${ar}-top__space-slot`,style:{justifyContent:So[m]}},e.children)),t().createElement("div",{className:`${ar}-top__actions`},t().createElement(Rs,{ref:N,showFullScreen:f,showReload:b&&De,showPrint:Ee.print&&!!u,showImport:Ee.import&&it,showExport:Ee.export&&!!d,showClipboard:lt,showCollection:at,showFastSearch:st,showSuperSearch:ot,showGroupSummary:ct,showToolBox:y,tableColumns:ze}),t().createElement(As,{ref:T,columns:a}))),t().createElement(gt,{spinning:i??Ne},t().createElement("div",{ref:C,className:Se()(lr),style:yt},t().createElement("div",{className:`${ar}--main-wrapper`},v&&t().createElement(js,{tableColumns:ze,flattenColumns:Ue,sorter:ae,filters:re}),t().createElement(oc,{ref:w,tableData:Z,flattenColumns:Ue}),Ze&&t().createElement(sc,{summationRows:ht,flattenColumns:Ue})),et&&t().createElement("div",{className:`${ar}--border-line`}),mt&&t().createElement(dc,null),s&&t().createElement(pc,null))),Me&&t().createElement(uc,mc({},se,{onChange:(e,t)=>Wt({current:e,pageSize:t})}))))}));hc.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},hc.displayName="QmTable";const fc=hc,gc=fc;function bc(){return bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bc.apply(this,arguments)}const yc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},className:u,style:d,onClose:m}=e,{size:h}=t().useContext(l),f=t().useMemo((()=>e.size??h??""),[e.size,h]),g=t().useRef(null),b=t().useRef(null),y=t().useRef(null),v=Ct(g),[x,E]=t().useState(c),[S,C]=t().useState(),[w,N]=t().useState(o),[T,I]=t().useState(!1),[R,O]=t().useState(300),[P,A]=t().useState(s),[k,F]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[H,L]=t().useState((0,J.merge)({},c.fetch?.params,a)),[$,_]=t().useState([]),D=()=>{const e=g.current,t=e.querySelector(".form-wrap");O(e.offsetHeight-t.offsetHeight-2*ya[f]-30)},q=wt(D,5);qe((()=>{q()}),[v.width]),qe((()=>{(0,J.isEqual)(s,P)||A(s)}),[s]),t().useEffect((()=>{j()}),[H]),t().useEffect((()=>{i&&y.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&b.current?.SET_FIELDS_VALUE(a)}),[]);const j=async()=>{const{webPagination:e,fetch:t}=x;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(H)){I(!0);try{const e=await r(H);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(N([]),await ie(0)),_(t)}}catch(e){}I(!1)}},K=e=>{n||(C(e),m(e))},M=e=>{L(Object.assign({},H,e))},V={[`${Ce("search-helper")}--wrapper`]:!0},z=x.webPagination?{dataSource:$,loading:T,webPagination:!0}:{fetch:{...x.fetch,params:H}};return t().createElement("div",{ref:g,className:Se()(V,u),style:d},t().createElement("div",{className:"form-wrap"},P.length?t().createElement(vl,{ref:b,items:P,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>A(e),onCollapse:()=>D(),onFinish:e=>M(e),onReset:async()=>{const[e,t]=await b.current.GET_FORM_DATA();e||M(t)}}):null),t().createElement("div",null,t().createElement(gc,bc({ref:y,uniqueKey:r,height:R,columns:k,rowKey:x.rowKey||"pageIndex"},z,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:w,onChange:(e,t)=>{N(e),C(n?t:t[0])}},paginationConfig:x.paginationConfig,columnsChange:e=>F(e),onRowDblclick:K,onRowEnter:K}))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ya[f]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>m(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!S,onClick:()=>m(S,n?w:void 0)},p("qm.dialog.confirm"))))};yc.displayName="SearchHelper";const vc=yc;function xc(){return xc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xc.apply(this,arguments)}const Ec=e=>{const t=[];return e.forEach((e=>{e.children&&t.push(...Ec(e.children)),e.children&&t.push(e.value)})),t},Sc=(e,t)=>{let r=null;for(let n=0;n<e.length;n++){if(Array.isArray(e[n].children)&&(r=Sc(e[n].children,t)),r)return r;if(t(e[n]))return e[n]}return r},Cc=(e,t)=>e.map((e=>({...e}))).filter((e=>(e.children=e.children&&Cc(e.children,t),t(e)||e.children&&e.children.length))),wc=e=>{const{uniqueKey:r,multiple:n,initialValue:a,selectionRows:i,defaultSelectedKeys:o=[],filters:s=[],table:c={},tree:u={},className:d,style:m,onClose:h}=e,{size:f}=t().useContext(l),b=t().useMemo((()=>e.size??f??""),[e.size,f]),y=t().useRef(null),v=t().useRef(null),x=t().useRef(null),E=Ct(y),[S,C]=t().useState(c),[w,N]=t().useState(),[T,I]=t().useState(o),[R,O]=t().useState(!1),[A,k]=t().useState(300),[F,H]=t().useState(300),[L,$]=t().useState(s),[_,D]=t().useState([{title:p("qm.searchHelper.orderIndex"),dataIndex:"pageIndex",width:80,render:e=>t().createElement("span",null,e+1)},...c.columns||[]]),[q,j]=t().useState((0,J.merge)({},c.fetch?.params,a)),[K,M]=t().useState([]),V=()=>{const e=y.current,t=e.querySelector(".form-wrap"),r=e.querySelector(".input-wrap");k(e.offsetHeight-r.offsetHeight-10),H(e.offsetHeight-t.offsetHeight-2*ya[b]-30)},z=wt(V,5);qe((()=>{z()}),[E.width]),qe((()=>{(0,J.isEqual)(s,L)||$(s)}),[s]),t().useEffect((()=>{U()}),[q]),t().useEffect((()=>{i&&x.current.SET_SELECTION_ROWS(i)}),[i]),t().useEffect((()=>{a&&v.current?.SET_FIELDS_VALUE(a),ne()}),[]);const U=async()=>{const{webPagination:e,fetch:t}=S;if(!e||!t?.api)return;const{api:r,dataKey:a,beforeFetch:i=ae}=t;if(i(q)){O(!0);try{const e=await r(q);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,a)??[];n||(I([]),await ie(0)),M(t)}}catch(e){}O(!1)}},B=e=>{n||(N(e),h(e))},W=e=>{j(Object.assign({},q,e))},[G,Y]=t().useState([]),[X,Q]=t().useState([]),[Z,ee]=t().useState(""),te=t().useRef(G),re=t().useRef([]);qe((()=>{Q(Ec(G))}),[G]);const ne=async()=>{if(!u.fetch)return;const{api:e,params:t,dataKey:r,valueKey:n="value",textKey:a="text"}=u.fetch;try{const i=await e(t);if(200===i.code){const e=Array.isArray(i.data)?i.data:(0,J.get)(i.data,r)??[],t=Ar(e,n,a);Y(t),te.current=t,re.current=e}}catch(e){}},le=e=>`${e}|${Gr.parse(e).map((e=>2===e.type?e.target.toLowerCase().slice(0,1):e.target)).join("")}`,oe={[`${Ce("tree-table-helper")}--wrapper`]:!0},se=S.webPagination?{dataSource:K,loading:R,webPagination:!0}:{fetch:{...S.fetch,params:q}};return t().createElement("div",{ref:y,className:Se()(oe,d),style:m},t().createElement(at,{defaultValue:200,style:{height:"100%"}},t().createElement(at.Pane,{min:100,style:{overflowY:"auto"}},t().createElement(P.Input.Search,{className:"input-wrap",value:Z,style:{marginBottom:8},placeholder:p("qm.form.inputPlaceholder"),allowClear:!0,onChange:e=>(e=>{const t=Cc(te.current,(t=>{if(!e)return!0;const r=t.text||"";return-1!==le(r).indexOf(e)}));ee(e),Y(t)})(e.target.value)}),t().createElement(P.Tree,{fieldNames:{title:"text",key:"value",children:"children"},height:A,defaultExpandAll:!0,expandedKeys:X,treeData:G,filterTreeNode:e=>{if(!Z)return!1;const t=e.text||"";return-1!==le(t).indexOf(Z)},onExpand:e=>{Q(e)},onSelect:e=>{const{valueKey:t="value"}=u.fetch;(e=>{if(!u.tableParamsMap)return g("TreeTableHelper","需要配置 `tree.tableParamsMap` 选项");const t="function"==typeof u.tableParamsMap?u.tableParamsMap():u.tableParamsMap,r={};for(const n in t)r[n]=(0,J.get)(e,t[n]);W(r)})(Sc(re.current,(r=>(0,J.get)(r,t)===e[0]))||{})}})),t().createElement(at.Pane,{className:"split-pane"},t().createElement("div",{className:"form-wrap"},L.length?t().createElement(vl,{ref:v,items:L,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>$(e),onCollapse:()=>V(),onFinish:e=>W(e),onReset:async()=>{const[e,t]=await v.current.GET_FORM_DATA();e||W(t)}}):null),t().createElement("div",null,t().createElement(gc,xc({ref:x,uniqueKey:r,height:F,columns:_,rowKey:S.rowKey||"pageIndex"},se,{rowSelection:{type:n?"checkbox":"radio",clearableAfterFetched:!n,selectFirstRowOnChange:!0,selectAllOnCurrentPage:!0,selectedRowKeys:T,onChange:(e,t)=>{I(e),N(n?t:t[0])}},paginationConfig:S.paginationConfig,columnsChange:e=>D(e),onRowDblclick:B,onRowEnter:B}))))),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ya[b]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>h(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!w,onClick:()=>h(w,n?T:void 0)},p("qm.dialog.confirm"))))};wc.displayName="TreeTableHelper";const Nc=wc,Tc=e=>{const{multiple:r,tree:n={},defaultSelectedKeys:a,className:i,style:o,onClose:s}=e,{size:c}=t().useContext(l),u=t().useMemo((()=>e.size??c??""),[e.size,c]),[d,m]=t().useState(),[h]=t().useState(n.fetch?.params),f={[`${Ce("tree-helper")}--wrapper`]:!0},g=n.fetch?{...Z()(n.fetch,["params","valueKey","textKey"]),params:h}:void 0;return t().createElement("div",{className:Se()(f,i),style:o},t().createElement(po,{multiple:r,fetch:g,fieldsDefine:{valueKey:n.fetch?.valueKey,textKey:n.fetch?.textKey},asyncLoad:n.asyncLoad,checkStrictly:n.checkStrictly,checkStrategy:n.checkStrategy,defaultSelectedKeys:a,defaultExpandAll:n.defaultExpandAll,onSelectChange:e=>m(e),onCheckChange:e=>m(e)}),t().createElement("div",{style:{position:"absolute",left:0,bottom:0,right:0,zIndex:9,height:`${ya[u]+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:!d,onClick:()=>s(d)},p("qm.dialog.confirm"))))};Tc.displayName="TreeHelper";const Ic=Tc;function Rc(){return Rc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rc.apply(this,arguments)}const Oc="_startSign",Pc="_endSign",Ac=e=>{const{uniqueKey:r,initialValue:n,filters:a=[],table:i={},onClose:o}=e,{size:s}=t().useContext(l),c=t().useMemo((()=>e.size??s??""),[e.size,s]),u=t().useRef(null),d=t().useRef(null),m=t().useRef(null),h=Ct(u),[f,g]=t().useState(i),[b,y]=t().useState(!1),[v,x]=t().useState([]),[E,S]=t().useState(300),[C,w]=t().useState(a),[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:Oc,width:80,align:"right",render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)},...i.columns||[],{title:p("qm.form.rangeSearchHelper")[1],dataIndex:Pc,fixed:"right",width:80,render:(e,r)=>t().createElement("span",{className:"icon-sign"},e)}]),[I,R]=t().useState((0,J.merge)({},i.fetch?.params,n)),[O,A]=t().useState([]),k=t().useMemo((()=>v.map((e=>e?.pageIndex))),[v]),F=t().useMemo((()=>2===k.length&&k.every((e=>void 0!==e))),[k]),H=()=>{const e=u.current.parentNode.children[0],t=e.querySelector(".form-wrap");S(e.offsetHeight-t.offsetHeight-2*ya[c]-30)},L=wt(H,5);qe((()=>{L()}),[h.width]),qe((()=>{(0,J.isEqual)(a,C)||w(a)}),[a]),t().useEffect((()=>{$()}),[I]);const $=async()=>{const{webPagination:e,fetch:t}=f;if(!e||!t?.api)return;const{api:r,dataKey:n,beforeFetch:a=ae}=t;if(a(I)){y(!0);try{const e=await r(I);if(200===e.code){const t=Array.isArray(e.data)?e.data:(0,J.get)(e.data,n)??[];A(t)}}catch(e){}y(!1)}},_=(e,t)=>{delete e[t]},D=()=>{v.forEach((e=>{e&&(_(e,Oc),_(e,Pc))})),x([])},q=e=>{D(),R(Object.assign({},I,e))},j=Ce("range-helper"),K=f.webPagination?{dataSource:O,loading:b,webPagination:!0}:{fetch:{...f.fetch,params:I}};return t().createElement("div",{ref:u,className:`${j}--wrapper`},t().createElement("div",{className:"form-wrap"},C.length?t().createElement(vl,{ref:d,items:C,initialValues:n,uniqueKey:r,formType:"search",isAutoFocus:!1,fieldsChange:e=>w(e),onCollapse:()=>H(),onFinish:e=>q(e),onReset:async()=>{const[e,t]=await d.current.GET_FORM_DATA();e||q(t)}}):null),t().createElement("div",null,t().createElement(gc,Rc({ref:m,height:E,columns:N,rowKey:f.rowKey||"pageIndex",rowStyle:e=>e.pageIndex>=k[0]&&e.pageIndex<=k[1]?{backgroundColor:"#f5f5f5"}:{}},K,{columnsChange:e=>T(e),onRowClick:(e,t)=>{const{dataIndex:r}=t;[Oc,Pc].includes(r)&&(r===Oc&&(e[r]?(_(e,r),x([void 0,v[1]])):e.pageIndex>k[1]?P.message.warning(p("qm.searchHelper.rangeStartTip")):(v[0]&&_(v[0],r),e[r]="[",x([e,v[1]]))),r===Pc&&(e[r]?(_(e,r),x([v[0],void 0])):e.pageIndex<k[0]?P.message.warning(p("qm.searchHelper.rangeEndTip")):(v[1]&&_(v[1],r),e[r]="]",x([v[0],e]))),m.current.FORCE_UPDATE())},onDataLoad:e=>{e.forEach((e=>{e.pageIndex===k[0]&&(e[Oc]="["),e.pageIndex===k[1]&&(e[Pc]="]")}))}}),t().createElement(he,{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:`${ya[c]+20}px`,borderTop:"1px solid #d9d9d9",padding:"10px 15px",background:"#fff",textAlign:"right",boxSizing:"border-box"}},t().createElement(he,{onClick:()=>o(null),style:{marginRight:8}},p("qm.dialog.cancel")),t().createElement(he,{type:"primary",disabled:!F,onClick:()=>o(v.map((e=>(e=>{const t={};for(const r in e)[Oc,Pc].includes(r)||(t[r]=e[r]);return t})(e))))},p("qm.dialog.confirm"))))};Ac.displayName="RangeTableHelper";const kc=Ac,Fc=e=>null!=e;function Hc(e,r,n,a){const[i,l]=t().useState(void 0);t().useLayoutEffect((()=>{const t="function"==typeof e?e():e;l(t||null)}));const[o,s]=t().useState(null),c=ko((()=>{if(i){!(e=>{const t=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,{top:n,right:a,bottom:i,left:l}=e.getBoundingClientRect();return n>=0&&l>=0&&a<=t&&i<=r})(i)&&r&&i.scrollIntoView(a);const{left:e,top:t,width:n,height:l}=i.getBoundingClientRect(),o={left:e,top:t,width:n,height:l,radius:0};s((e=>JSON.stringify(e)!==JSON.stringify(o)?o:e))}else s(null)}));return t().useLayoutEffect((()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)})),[i,r,c]),[t().useMemo((()=>{if(!o)return o;const e=n?.offset||6,t=n?.radius||2;return{left:o.left-e,top:o.top-e,width:o.width+2*e,height:o.height+2*e,radius:t}}),[o,n]),i]}const Lc=(t,r)=>{const n=e.useRef(!0);e.useLayoutEffect((()=>t(n.current)),r),e.useLayoutEffect((()=>(n.current=!1,()=>{n.current=!0})),[])};function $c(e,t){Lc((t=>{if(!t)return e()}),t)}function _c(e){return void 0!==e}function Dc(t,r){const{defaultValue:n,value:a,onChange:i,postState:l}=r||{},[o,s]=e.useState((()=>_c(a)?a:_c(n)?"function"==typeof n?n():n:"function"==typeof t?t():t)),c=_c(a)?a:o,u=l?l(c):c,d=ko(i),[p,m]=e.useState([c]);return $c((()=>{const e=p[0];o!==e&&d(o,e)}),[p]),$c((()=>{_c(a)||s(a)}),[a]),[u,ko((e=>{s(e),m([c])}))]}const qc={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},jc={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},Kc=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function Mc(e){const{arrowWidth:t,autoAdjustOverflow:r,arrowPointAtCenter:n,offset:a,borderRadius:i,visibleFirst:l}=e,o=t/2,s={};return Object.keys(qc).forEach((e=>{const c={...n&&jc[e]||qc[e],offset:[0,0],dynamicInset:!0};switch(s[e]=c,Kc.has(e)&&(c.autoArrow=!1),e){case"top":case"topLeft":case"topRight":c.offset[1]=-o-a;break;case"bottom":case"bottomLeft":case"bottomRight":c.offset[1]=o+a;break;case"left":case"leftTop":case"leftBottom":c.offset[0]=-o-a;break;case"right":case"rightTop":case"rightBottom":c.offset[0]=o+a}const u=function(e){const{contentRadius:t,limitVerticalRadius:r}=e,n=t>12?t+2:12;return{arrowOffsetHorizontal:n,arrowOffsetVertical:r?8:n}}({contentRadius:i,limitVerticalRadius:!0});if(n)switch(e){case"topLeft":case"bottomLeft":c.offset[0]=-u.arrowOffsetHorizontal-o;break;case"topRight":case"bottomRight":c.offset[0]=u.arrowOffsetHorizontal+o;break;case"leftTop":case"rightTop":c.offset[1]=-u.arrowOffsetHorizontal-o;break;case"leftBottom":case"rightBottom":c.offset[1]=u.arrowOffsetHorizontal+o}c.overflow=function(e,t,r,n){if(!1===n)return{adjustX:!1,adjustY:!1};const a=n&&"object"==typeof n?n:{},i={};switch(e){case"top":case"bottom":i.shiftX=2*t.arrowOffsetHorizontal+r,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=2*t.arrowOffsetVertical+r,i.shiftX=!0,i.adjustX=!0}const l={...i,...a};return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}(e,u,t,r),l&&(c.htmlRegion="visibleFirst")})),s}const Vc=require("@rc-component/portal");var zc=n.n(Vc);const Uc=require("@rc-component/trigger");var Bc=n.n(Uc);const Wc=require("rc-util/lib/hooks/useId");var Gc=n.n(Wc);function Yc(){return Yc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yc.apply(this,arguments)}const Xc={fill:"transparent",pointerEvents:"auto"},Qc=e=>{const{prefixCls:r,rootClassName:n,pos:a,showMask:i,style:l={},fill:o="rgba(0,0,0,0.5)",open:s,animated:c,zIndex:u}=e,d=`${r}-mask-${Gc()()}`,p="object"==typeof c?c?.placeholder:c;return t().createElement(zc(),{open:s,autoLock:!0},t().createElement("div",{className:Se()(`${r}-mask`,n),style:{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:u,pointerEvents:"none",...l}},i?t().createElement("svg",{style:{width:"100%",height:"100%"}},t().createElement("defs",null,t().createElement("mask",{id:d},t().createElement("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"}),a&&t().createElement("rect",{x:a.left,y:a.top,rx:a.radius,width:a.width,height:a.height,fill:"black",className:p?`${r}-placeholder-animated`:""}))),t().createElement("rect",Yc({},a?null:Xc,{x:"0",y:"0",width:"100%",height:"100%",fill:o,mask:`url(#${d})`})),a&&t().createElement(t().Fragment,null,t().createElement("rect",Yc({},Xc,{x:"0",y:"0",width:"100%",height:`${a.top}px`})),t().createElement("rect",Yc({},Xc,{x:"0",y:"0",width:a.left,height:"100%"})),t().createElement("rect",Yc({},Xc,{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`})),t().createElement("rect",Yc({},Xc,{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"})))):null))},Zc=e=>{const{prefixCls:r,zIndex:n,open:a,onPause:i,onPlay:l}=e,[o,s]=Dc(void 0,{value:a,postState:e=>e??!0}),c=t().useRef(null),u=t().useRef(!1),d=ko((e=>{p(e),32===e.keyCode&&m()}));t().useEffect((()=>{const e=qt()(document,"keyup",d);return()=>e.remove()}),[]);const p=e=>{e.stopPropagation(),e.preventDefault()},m=()=>{u.current?u.current=!1:(s(!o),o?i?.():l?.())};return t().createElement("div",{ref:c,className:`${r}-control`,style:{zIndex:n+1},onMouseDown:e=>{p(e);const t=c.current,r=t.offsetWidth,n=t.offsetHeight,a=window.innerWidth,i=window.innerHeight,l=e.clientX-Ye(t).x,o=e.clientY-Ye(t).y;return document.onmousemove=e=>{let s=e.clientX-l,c=e.clientY-o;s<0&&(s=0),s>a-r-1&&(s=a-r-1),c<0&&(c=0),c>i-n-1&&(c=i-n-1),Be(t,{left:`${s}px`,top:`${c}px`}),u.current=!0},document.onmouseup=function(){this.onmousemove=null,this.onmouseup=null},!1},onClick:()=>m()},o?t().createElement(we.PauseOutlined,null):t().createElement(we.CaretRightOutlined,null))},Jc=e=>{const{prefixCls:r,current:n,total:a=0,cover:i,title:l,description:o,helper:s={},type:c,zIndex:u,onClose:d,onPrev:p,onNext:m,onFinish:h,className:f,indicatorsRender:g}=e,{t:b}=Vs(),y="primary"!==c?"primary":"default",v=ko((e=>{C(e),40===e.keyCode&&(n<a-1?m?.():h?.()),38===e.keyCode&&n>0&&p?.()}));t().useEffect((()=>{const e=qt()(document,"keyup",v);return()=>e.remove()}),[]);const x=Fc(i)?t().createElement("div",{className:`${r}-cover`},i):null,E=Fc(o)?t().createElement("div",{className:`${r}-description`},o):null;let S;S=g?g(n,a):[...Array.from({length:a}).keys()].map(((e,a)=>t().createElement("span",{key:e,className:Se()(a===n&&`${r}-indicator-active`,`${r}-indicator`)})));const C=e=>{e.stopPropagation(),e.preventDefault()};return t().createElement("div",{className:Se()(`${r}-content`,f)},t().createElement("div",{className:`${r}-inner`},t().createElement(we.CloseOutlined,{className:`${r}-close`,onClick:d}),s.content&&t().createElement(P.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:u},content:s.content,title:s.title},t().createElement(we.QuestionCircleOutlined,{className:Se()(`${r}-close`,"help-icon")})),x,t().createElement("div",{className:`${r}-header`},t().createElement("div",{className:`${r}-title`},l)),E,t().createElement("div",{className:`${r}-footer`},a>1&&t().createElement("div",{className:`${r}-indicators`},S),t().createElement(xe,{className:`${r}-buttons`},0!==n?t().createElement(he,{className:`${r}-prev-btn`,size:"small",onMouseDown:C,onClick:p},b("qm.tour.prevStep")):null,n===a-1?t().createElement(he,{className:`${r}-finish-btn`,type:y,size:"small",onClick:h},b("qm.tour.finish")):t().createElement(he,{className:`${r}-next-btn`,type:y,size:"small",onMouseDown:C,onClick:m},b("qm.tour.nextStep"))))))},eu=e=>{const{current:r,renderPanel:n}=e;return t().createElement(t().Fragment,null,"function"==typeof n?n(e,r):t().createElement(Jc,e))};function tu(){return tu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tu.apply(this,arguments)}const ru={left:"50%",top:"50%",width:1,height:1},nu=t().forwardRef(((e,r)=>{const{steps:n=[],defaultCurrent:a,current:i,onChange:l,onClose:o,onFinish:s,open:c,type:u="default",mask:d=!0,arrow:p=!0,control:m=!0,overlayClassName:h,overlayStyle:f,placement:g,helper:b,zIndex:y,renderPanel:v,indicatorsRender:x,gap:E,animated:S=!0,scrollIntoViewOptions:C=!0,...w}=e,N=t().useRef(),[T,I]=Dc(0,{value:i,defaultValue:a}),[R,O]=Dc(void 0,{value:c,postState:e=>!(T<0||T>=n.length)&&(e??!1)}),[P,A]=Dc(1051,{value:y,defaultValue:y}),[k,F]=t().useState(),H=t().useRef(R);t().useLayoutEffect((()=>{R&&!H.current&&I(0),H.current=R,F(R)}),[R]),t().useImperativeHandle(r,(()=>({OPEN:()=>O(!0),CLOSE:()=>O(!1),SET_ZINDEX:e=>A(e)})));const{target:L,type:$,placement:_,trigger:D,delay:q,style:j,arrow:K,className:M,mask:V,scrollIntoViewOptions:z,zIndex:U,action:B}=n[T]||{},W=U||P,G=$||u,Y=R&&(V??d),X=z??C,[Q,Z]=Hc(L,!!c,E,X),J=((e,t,r)=>r??t??(null===e?"center":"bottom"))(Z,g,_),ee=!!Z&&(void 0===K?p:K),te="object"==typeof ee&&ee.pointAtCenter;t().useLayoutEffect((()=>{N.current?.forceAlign()}),[te,T]),qe((()=>{R&&B?.(Z,T)}),[R,Z]);const re=e=>{I(e),l?.(e)},ne=()=>{O(!1),o?.(T)};if(void 0===Z)return null;const ae=async()=>{if(!D||!Z)return;const{left:e,top:t}=Z.getBoundingClientRect(),r=Z.offsetWidth,n=Z.offsetHeight,[a,i]=[e+r/2,t+n/2],l=new MouseEvent(D,{bubbles:!0,cancelable:!0,button:0,clientX:a,clientY:i}),o=document.elementFromPoint(a,i);o&&(o.dispatchEvent(l),await ie(q??320))},le="boolean"==typeof Y?Y:!!Y,oe="boolean"==typeof Y?void 0:Y,se=Object.assign({},f,j),ce=Ce("tour"),ue=[{[`${ce}-primary`]:"primary"===G},h,M],de=Mc({arrowPointAtCenter:te,autoAdjustOverflow:!0,offset:6,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Qc,{zIndex:W,prefixCls:ce,pos:Q,showMask:le,style:oe?.style,fill:oe?.color,open:k,animated:S,rootClassName:h}),t().createElement(Bc(),tu({ref:N},w,{zIndex:W,builtinPlacements:de,popupStyle:se,popupPlacement:J,popupVisible:k,popupClassName:Se()(ue),prefixCls:ce,popup:()=>t().createElement(eu,tu({key:"content",arrow:ee,prefixCls:ce,total:n.length,helper:b,renderPanel:v,indicatorsRender:x,onPrev:async()=>{await ae(),re(T-1)},onNext:async()=>{await ae(),re(T+1)},onClose:ne,current:T,onFinish:()=>{ne(),s?.()}},Object.assign({},n[T],{zIndex:W,type:G}))),arrow:!!ee,getTriggerDOMNode:e=>e||Z||document.body,forceRender:!1,destroyPopupOnHide:!0}),t().createElement(zc(),{open:k,autoLock:!0},t().createElement("div",{className:Se()(h,`${ce}-target-placeholder`),style:{...Q||ru,position:"fixed",pointerEvents:"none"}}))),m&&t().createElement(zc(),{open:R},t().createElement(Zc,{zIndex:W,prefixCls:ce,onPause:()=>F(!1),onPlay:()=>F(!0)})))}));nu.displayName="QmTour";const au=nu,iu=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],lu=e=>({_s:e,status:iu[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),ou=e=>e?6:5,su=(e,t,r,n,a)=>{clearTimeout(n.current);const i=lu(e);t(i),r.current=i,a?.({current:i})},cu=r=>{const{name:n,in:a,timeout:i,preEnter:l=!0,preExit:o}=r,[s,c]=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enter:r=!0,exit:n=!0,preEnter:a,preExit:i,timeout:l,initialEntered:o,mountOnEnter:s,unmountOnExit:c,onStateChange:u}=t||{},[d,p]=(0,e.useState)((()=>lu(o?2:ou(s)))),m=(0,e.useRef)(d),h=(0,e.useRef)(),[f,g]=(e=>(0,J.isPlainObject)(e)?[e.enter,e.exit]:[e,e])(l),b=(0,e.useCallback)((()=>{const e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return ou(t)}})(m.current._s,c);e&&su(e,p,m,h,u)}),[u,c]),y=(0,e.useCallback)((e=>{const t=e=>{switch(su(e,p,m,h,u),e){case 1:f>=0&&(h.current=setTimeout(b,f));break;case 4:g>=0&&(h.current=setTimeout(b,g));break;case 0:case 3:h.current=setTimeout((()=>t(e+1)),0)}},l=m.current.isEnter;"boolean"!=typeof e&&(e=!l),e?!l&&t(r?a?0:1:2):l&&t(n?i?3:4:ou(c))}),[b,u,r,n,a,i,f,g,c]);return(0,e.useEffect)((()=>()=>clearTimeout(h.current)),[]),[d,y,b]}({timeout:i,preEnter:l,preExit:o,initialEntered:a});return $c((()=>{c()}),[a]),t().createElement(t().Fragment,null,t().Children.map(r.children,(e=>t().isValidElement(e)?ec(e,{className:Se()(e.props.className,n,s.status)}):e)))},uu={previewWidth:1100,defaultDistance:.45,logoHeight:60},du=(0,e.createContext)(void 0);var pu=null;function mu(){try{var e=navigator.userAgent;if(e.match(/Windows\sPhone/i))return!0;if(e.match(/iPhone|iPod|iPad/i))return!0;if(e.match(/Android/i))return!0;if(e.match(/Edge\D?\d+/i))return!0;var t=e.match(/Trident\D?\d+/i),r=e.match(/MSIE\D?\d+/i),n=e.match(/OPR\D?\d+/i),a=e.match(/Firefox\D?\d+/i),i=e.match(/x64/i);if(!t&&!r&&i)return!0;if(a){if((a=a[0].match(/\d+/))[0]>=41||i)return!0}else if(n){if((n=n[0].match(/\d+/))[0]>=32)return!0}else if(!t&&!r){var l=e.match(/Chrome\D?\d+/i);if(l&&(l=l[0].match(/\d+/))[0]>=41)return!0}return!1}catch(e){return!0}}function hu(e,t){var r;try{var n=navigator.userAgent,a=!!n.match(/MSIE/i)||!!n.match(/Trident/i);if(mu()){try{r=getCLodop()}catch(e){}if(!r&&"complete"!==document.readyState)return void P.message.warning("打印组件还没有加载完毕,请稍等一下再操作");if(!r)return;CLODOP.CVERSION,t&&t.parentNode&&t.parentNode.removeChild(t),e&&e.parentNode&&e.parentNode.removeChild(e)}else if(a&&n.match(/x64/i),e||t?r=a?e:t:pu?r=pu:((r=document.createElement("object")).setAttribute("width",0),r.setAttribute("height",0),r.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),a?r.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA"):r.setAttribute("type","application/x-print-lodop"),document.documentElement.appendChild(r),pu=r),!r||!r.VERSION)return n.indexOf("Chrome"),n.indexOf("Firefox"),r;return r.VERSION<"6.2.2.6"&&mu(),r}catch(e){P.message.error("getLodop 出错:"+e)}}mu();const fu=e=>{const t=e/25.4*(()=>{const e=[],{deviceXDPI:t,deviceYDPI:r}=window.screen;if(t&&r)e[0]=t,e[1]=r;else{let t=document.createElement("DIV");t.style.cssText="width: 1in; height: 1in; position: absolute; left: 0px; top: 0px; z-index: -1; visibility: hidden;",document.body.appendChild(t),e[0]=parseInt(t.offsetWidth.toString()),e[1]=parseInt(t.offsetHeight.toString()),t.parentNode?.removeChild(t),t=null}return e})()[0];return Math.ceil(t)},gu=t().forwardRef(((e,r)=>{const{templateRender:n,directPrint:a}=e,{global:i}=t().useContext(l),{$$preview:o}=t().useContext(du),{state:s,isWindowsPrinter:c,pageSize:u}=o,d=t().useRef(null),p=t().useRef({}),m=t().useRef([]),h=t().useRef([]),f=t().useRef([]),[b,y]=t().useState(!0);t().useImperativeHandle(r,(()=>({createPreviewDom:A,createExportHtml:F,createPrintHtml:k,SHOW_PREVIEW:H,DIRECT_PRINT:L}))),qe((()=>{P()}),[s.form.printerType,s.form.setting.direction,s.form.setting.distance,s.form.setting.fixedLogo]),t().useEffect((()=>{p.current.templateEl=d.current.querySelector(".origin-template").children[0],p.current.previewEl=d.current.querySelector(".workspace")}),[]);const v=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*uu.defaultDistance+10*uu.defaultDistance:0;return("vertical"===e?u[0]:u[1])-t}),[s,c,u]),x=t().useMemo((()=>{const{form:{setting:{direction:e}}}=s,t=c?10*uu.defaultDistance+10*uu.defaultDistance:0;return("vertical"===e?u[1]:u[0])-t}),[s,c,u]),E=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return fu(v-10*(e.left-uu.defaultDistance)-10*(e.right-uu.defaultDistance))}),[s,v]),S=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return fu(x-10*(e.top-uu.defaultDistance)-10*(e.bottom-uu.defaultDistance))}),[s,x]),C=s.form.scale,w=t().useMemo((()=>{const{form:{setting:{distance:e}}}=s;return{left:fu(10*e.left),right:fu(10*e.right),top:fu(10*e.top),bottom:fu(10*e.bottom)}}),[s]),N=t().useMemo((()=>{const{form:{printerType:e}}=s,{left:t,right:r,top:n,bottom:a}=w,i=E+t+r,l=uu.previewWidth-i<=0?0:(uu.previewWidth-i)/2,o=Math.abs((1-C)*i/2);let c=0;return C>1&&(c=o>l?-1*l:-1*o),C<1&&(c=i-2*o>uu.previewWidth?0:l>0?o:(uu.previewWidth-(i-2*o))/2),{width:`${E}px`,height:"stylus"===e?"auto":S+"px",paddingLeft:`${t}px`,paddingRight:`${r}px`,paddingTop:`${n}px`,paddingBottom:`${a}px`,transform:`translateX(${c}px) scale(${C})`,opacity:b?0:1}}),[s,b,w,C,S,E]),T=(m.current.some((e=>/^<tr[^>]+type="page-break"[^>]+><\/tr>$/.test(e))),()=>{const e=i?.print?.leftLogo??"",t=i?.print?.rightLogo??"";return[`<tr style="height: ${uu.logoHeight}px;">`,'<td colspan="8" align="left" style="vertical-align: top;">',e?`<img src="${e}" border="0" height="46" />`:"","</td>",'<td colspan="16" align="right" style="vertical-align: top;">',t?`<img src="${t}" border="0" height="46" />`:"","</td>","</tr>"].join("")}),I=()=>{let e='<tr style="height: 0;">';for(let t=0;t<24;t++)e+=`<td width="${100/24}%" style="width: ${100/24}%; padding: 0;"></td>`;return e+="</tr>",e},R=()=>{let e=document.createElement("tr");var t,r;e.setAttribute("type","template-cols"),e.style.height="0",e.innerHTML=I().replace(/<tr[^>]+>/,"").replace(/<\/tr>/,""),t=e,(r=p.current.templateEl.children[0]).children[0]?r.insertBefore(t,r.children[0]):r.appendChild(t),e=null},O=()=>{const e=p.current.templateEl.children[0].children,t=[],r=[];for(let n=0;n<e.length;n++){if("template-cols"===e[n].getAttribute("type"))continue;const a=e[n].clientHeight;e[n].style.height=a+"px",r.push(a),t.push(e[n].outerHTML)}h.current=r,m.current=t},P=()=>{if(!m.current.length)return;const{form:{setting:e,printerType:t}}=s;if(a)return f.current.push([I(),T(),...m.current]);const r=e.fixedLogo?S-uu.logoHeight:S;let n=[];if(f.current=[],"stylus"===t)f.current.push([I(),...e.fixedLogo?[T()]:[],...m.current]);else{let t=0;for(let a=0,i=h.current.length;a<i;a++){const l=m.current[a],o=h.current[a];e.fixedLogo||0!==a||(t+=uu.logoHeight),t+=o,t<=r?n.push(l):(f.current.push([I(),...e.fixedLogo?[T()]:[],...n]),n=[],t=0,a-=1),a===i-1&&n.length&&f.current.push([I(),...e.fixedLogo?[T()]:[],...n])}}e.fixedLogo||f.current[0]?.splice(1,0,T());for(let e=0,t=f.current.length;e<t&&e!==t-1;e++)f.current[e].push('<tr type="page-break" style="page-break-after: always;"></tr>');o.setState({currentPage:1,totalPage:f.current.length}),A()},A=()=>{const{currentPage:e}=s;let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;t+=f.current[e-1]?.join("")??"",t+="</table>",p.current.previewEl.innerHTML=t,p.current.previewEl.parentNode.scrollTop=0},k=e=>{let t=`<table cellspacing="0" cellpadding="0" border="0" class="${p.current.templateEl.className}">`;if(void 0!==e)t+=[...f.current[e-1]].join("");else for(let e=0;e<f.current.length;e++)t+=f.current[e].join("");return t+="</table>",t},F=()=>{const e=[];for(let t=0;t<m.current.length;t++)e[t]=m.current[t].replace(/\s+/g," ").replace(/(<td[^>]+>)\s+/,"$1").replace(/\s+(<\/td>)/,"$1");return"<table>"+T()+I()+e.join("")+"</table>"},H=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();p.current.previewEl.innerHTML||(R(),await ie(0),O(),P(),y(!1))},L=async()=>{if("TABLE"!==p.current.templateEl?.tagName)return $();R(),await ie(0),O(),P(),y(!1),o.doPrint(k()),await ie(0),o.doClose()},$=()=>{g("Print","[PrintTemplate] 打印模板组件的根元素必须是 `table` 节点")},_={[Ce("print-container")]:!0,"no-visible":a};return t().createElement("div",{ref:d,className:Se()(_)},t().createElement(gt,{wrapperClassName:"spin",spinning:b,tip:"Loading..."},t().createElement("div",{className:"preview"},t().createElement("div",{className:"origin-template",style:{width:`${E}px`,marginLeft:`-${Math.floor(E/2)}px`}},n?.()),t().createElement("div",{className:"workspace",style:N}))))}));gu.displayName="Container";const bu=gu;function yu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class vu extends e.Component{constructor(){super(...arguments),yu(this,"formRef",t().createRef()),yu(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:uu.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:uu.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:uu.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:uu.defaultDistance,step:.05,precision:2},extra:{labelWidth:80},rules:[{required:!0,message:p("qm.print.setPanel.noEmpty")}]}])),yu(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})})),yu(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")}))),yu(this,"state",{formList:this.createFormList()}),yu(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())})),yu(this,"cancelHandle",(()=>{this.props.onClose()}))}render(){const{formList:e}=this.state;return t().createElement(t().Fragment,null,t().createElement(vl,{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"))))}}yu(vu,"contextType",l);const xu=vu;function Eu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Su extends e.Component{constructor(){super(...arguments),Eu(this,"provide",{$$preview:this}),Eu(this,"containRef",t().createRef()),Eu(this,"state",{visible:!1,form:{printerName:-1,printerType:this.props.defaultConfig?.printerType||"laser",copies:this.props.defaultConfig?.copies||1,scale:1,setting:{distance:{left:uu.defaultDistance,right:uu.defaultDistance,top:uu.defaultDistance,bottom:uu.defaultDistance},pageSize:"210*297",direction:this.props.defaultConfig?.direction||"vertical",doubleSide:0,doubleSideType:"auto",fixedLogo:0}},printPage:void 0,currentPage:1,totalPage:0}),Eu(this,"pageChangeHandle",(e=>{this.setState({currentPage:e},(()=>{this.containRef.current.createPreviewDom()}))})),Eu(this,"exportClickHandle",(()=>{this.doExport(this.containRef.current.createExportHtml())})),Eu(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 fs().setItem(this.printerKey,e),await this.savePrintConfig(this.printerKey,e)}catch(e){}})),Eu(this,"doClose",(()=>{this.props.onClose?.()})),Eu(this,"getPrintConfig",(async e=>{const t=this.context.global,r=t?.getComponentConfigApi;if(r)try{const t=await r({key:e});if(200===t.code)return t.data}catch(e){}})),Eu(this,"savePrintConfig",(async(e,t)=>{const r=this.context.global,n=r?.saveComponentConfigApi;if(n)try{await n({[e]:t})}catch(e){}})),Eu(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 ')),Eu(this,"doPrint",(e=>{const t=hu();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a,printerName:i,printerType:l,copies:o}}=this.state,{pageSize:s}=this,{defaultDistance:c}=uu,{left:u,right:d,top:m,bottom:h}=a.distance;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.SET_PRINTER_INDEX(i),t.SET_PRINT_COPIES(o),a.doubleSide&&("auto"===a.doubleSideType?(t.SET_PRINT_MODE("PRINT_DUPLEX",2),t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE",1)):t.SET_PRINT_MODE("DOUBLE_SIDED_PRINT",1)),t.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW",1),"laser"===l&&("vertical"===a.direction&&t.SET_PRINT_PAGESIZE(1),"horizontal"===a.direction&&(t.SET_PRINT_PAGESIZE(2),t.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1))),"stylus"===l&&t.SET_PRINT_PAGESIZE(3,10*s[0],100*h*2,""),t.ADD_PRINT_TABLE(10*(m-c)+"mm",10*(u-c)+"mm",`RightMargin: ${10*(d-c)}mm`,`BottomMargin: ${"stylus"!==l?10*(h-c):0}mm`,this.createStyle()+e),t.On_Return=(e,t)=>{t?n&&this.doClose():P.message.error(p("qm.print.printError"))},t.PRINT()})),Eu(this,"doExport",(e=>{const t=hu();if(!t)return;const{uniqueKey:r,closeAfterPrint:n}=this.props,{form:{setting:a}}=this.state;t.PRINT_INIT(r??Math.random().toString().slice(2)),t.On_Return=(e,t)=>{t?n&&this.doClose():P.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=hu(),t=[{text:p("qm.print.defaultPrinter"),value:-1}];try{const r=e.GET_PRINTER_COUNT();for(let n=0;n<r;n++)t.push({text:e.GET_PRINTER_NAME(n),value:n})}catch(e){g("Print","[ClientPrint]: 请安装 LODOP 打印插件")}return t}get isWindowsPrinter(){const{form:{printerName:e}}=this.state;return!/OneNote|Microsoft|Fax/.test(this.printerItems.find((t=>t.value===e)).text)}get pageSize(){return this.state.form.setting.pageSize.split("*").map((e=>Number(e)))}get printerKey(){return this.props.uniqueKey?`print_${this.props.uniqueKey}`:""}async componentDidMount(){if(this.props.uniqueKey)try{let e=await fs().getItem(this.printerKey);e||(e=await this.getPrintConfig(this.printerKey),(0,J.isPlainObject)(e)&&await fs().setItem(this.printerKey,e)),(0,J.isPlainObject)(e)&&Object.keys(e).length&&(0,J.merge)(this.state.form,{...e,printerName:this.printerItems.find((t=>t.text===e.printerName))?.value??-1})}catch(e){}}render(){const{preview:e,templateRender:r}=this.props,{visible:n,form:a,currentPage:i,totalPage:l,printPage:o}=this.state,s=Ce("print-preview"),c={visible:n,title:p("qm.print.pageSetting"),width:"50%",loading:!1,containerStyle:{paddingBottom:"52px"},onClose:()=>{this.setState({visible:!1})}},u={[s]:!0};return e?t().createElement(t().Fragment,null,t().createElement("div",{className:Se()(u)},t().createElement("div",{className:"outer"},t().createElement("div",{className:"header"},t().createElement("span",null,p("qm.print.printer"),":",t().createElement(P.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(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.type"),":",t().createElement(P.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(P.Select.Option,{key:e.value,value:e.value},e.text))))),t().createElement("span",null,p("qm.print.copies"),":",t().createElement(P.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(P.InputNumber,{value:o,min:1,max:l,precision:0,onChange:e=>{this.setState({printPage:e??void 0})},style:{width:"50px",marginLeft:"4px",marginRight:"4px"}}),p("qm.print.printPage.1")),t().createElement("span",null,t().createElement(P.Pagination,{size:"small",current:i,pageSize:1,total:l,onChange:this.pageChangeHandle})),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.SettingOutlined,null),className:"text-btn",onClick:()=>this.setState({visible:!0})},p("qm.print.setting"))),t().createElement("span",null,t().createElement(he,{type:"text",icon:t().createElement(we.DownloadOutlined,null),className:"text-btn",onClick:()=>this.exportClickHandle()},p("qm.print.export"))),t().createElement("span",null,t().createElement(he,{icon:t().createElement(we.PrinterOutlined,null),type:"primary",onClick:this.printClickHandle},p("qm.print.print")))),t().createElement("div",{className:"main"},t().createElement(du.Provider,{value:this.provide},t().createElement(bu,{ref:this.containRef,templateRender:r,directPrint:!1}))),t().createElement("div",{className:"footer"},t().createElement("span",null,p("qm.print.scale"),":",t().createElement(P.Slider,{value:a.scale,step:.1,min:.5,max:1.5,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{scale:e}})))}}),t().createElement("em",{className:"scale-text"},`${Math.floor(100*a.scale)}%`)),t().createElement("span",null,p("qm.print.paper"),":",this.pageSize[0],"mm * ",this.pageSize[1],"mm"),t().createElement("span",null,p("qm.print.pageNumber"),":",p("qm.print.pagination",{currentPage:i,totalPage:l}))))),t().createElement(ur,c,t().createElement(xu,{setting:a.setting,onChange:e=>{this.setState((t=>(0,J.merge)({},t,{form:{setting:e}})))},onClose:()=>{this.setState({visible:!1})}}))):t().createElement(du.Provider,{value:this.provide},t().createElement(bu,{ref:this.containRef,templateRender:r,directPrint:!0}))}}Eu(Su,"contextType",l);const Cu=Su;function wu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Nu extends e.Component{constructor(){super(...arguments),wu(this,"previewRef",t().createRef()),wu(this,"state",{visible:!1,loading:!1}),wu(this,"clickHandle",(async()=>{this.setState({loading:!0});try{const e=await(this.props.click?.());if(this.setState({loading:!1}),"boolean"==typeof e&&!e)return;await this.DO_PRINT()}catch(e){}this.setState({loading:!1})})),wu(this,"createRender",(()=>{const{visible:e}=this.state,{templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l}=this.props,o={visible:e,title:p("qm.print.preview"),width:`${uu.previewWidth}px`,loading:!1,onClose:()=>{this.setState({visible:!1})}},s={ref:this.previewRef,templateRender:r,uniqueKey:n,defaultConfig:a,preview:i,closeAfterPrint:l,onClose:()=>{this.setState({visible:!1})}};return i?t().createElement(ur,o,t().createElement(Cu,s)):e?t().createElement(Cu,s):null})),wu(this,"DO_PRINT",(async()=>{const{preview:e}=this.props;await ie(0),this.setState({visible:!0}),await ie(e?500:0);const t=this.previewRef.current.containRef.current;e?t.SHOW_PREVIEW():t.DIRECT_PRINT()}))}render(){const{loading:e}=this.state,{size:r,icon:n,type:a,disabled:i,shape:l}=this.props,o={size:r||this.context.size||"",type:a,shape:l,icon:n,loading:e,disabled:i,click:this.clickHandle};return t().createElement(t().Fragment,null,this.props.children&&t().createElement(he,o,this.props.children),this.createRender())}}wu(Nu,"propTypes",{size:(e,t,r)=>{if(!b(e[t]||""))return f("Print","Invalid prop `"+t+"` supplied to `"+r+"`. Validation failed.")},templateRender:i().elementType}),wu(Nu,"defaultProps",{preview:!0,type:"primary",icon:t().createElement(we.PrinterOutlined,null)}),wu(Nu,"contextType",l);const Tu=Nu;function Iu(e){return e.ownerDocument?e.ownerDocument.defaultView:null}function Ru(e){const t=Iu(e);return t?t.frameElement:null}function Ou(e){const t=ku(e);return Pu([e.getBoundingClientRect(),{top:t.borderTop,left:t.borderLeft,bottom:t.borderBottom,right:t.borderRight,width:0,height:0}])}function Pu(e){return e.reduce(((e,t)=>null==e?t:{top:e.top+t.top,left:e.left+t.left,width:e.width,height:e.height,bottom:e.bottom+t.bottom,right:e.right+t.right}))}function Au(e,t){const r=Ru(e);if(r&&r!==t){const n=[e.getBoundingClientRect()];let a=r,i=!1;for(;a;){const e=Ou(a);if(n.push(e),a=Ru(a),i)break;a&&Iu(a)===t&&(i=!0)}return Pu(n)}return e.getBoundingClientRect()}function ku(e){const t=window.getComputedStyle(e);return{borderLeft:parseInt(t.borderLeftWidth,10),borderRight:parseInt(t.borderRightWidth,10),borderTop:parseInt(t.borderTopWidth,10),borderBottom:parseInt(t.borderBottomWidth,10),marginLeft:parseInt(t.marginLeft,10),marginRight:parseInt(t.marginRight,10),marginTop:parseInt(t.marginTop,10),marginBottom:parseInt(t.marginBottom,10),paddingLeft:parseInt(t.paddingLeft,10),paddingRight:parseInt(t.paddingRight,10),paddingTop:parseInt(t.paddingTop,10),paddingBottom:parseInt(t.paddingBottom,10)}}function Fu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Hu=Object.assign;class Lu{constructor(e,t){Fu(this,"node",void 0),Fu(this,"border",void 0),Fu(this,"padding",void 0),Fu(this,"content",void 0),this.node=e.createElement("div"),this.border=e.createElement("div"),this.padding=e.createElement("div"),this.content=e.createElement("div"),this.border.style.borderColor=qu.border,this.padding.style.borderColor=qu.padding,this.content.style.backgroundColor=qu.background,Hu(this.node.style,{borderColor:qu.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),t.appendChild(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(e,t){Du(t,"margin",this.node),Du(t,"border",this.border),Du(t,"padding",this.padding),Hu(this.content.style,{height:e.height-t.borderTop-t.borderBottom-t.paddingTop-t.paddingBottom+"px",width:e.width-t.borderLeft-t.borderRight-t.paddingLeft-t.paddingRight+"px"}),Hu(this.node.style,{top:e.top-t.marginTop+"px",left:e.left-t.marginLeft+"px"})}}class $u{constructor(e,t){Fu(this,"tip",void 0),Fu(this,"nameSpan",void 0),Fu(this,"dimSpan",void 0),this.tip=e.createElement("div"),Hu(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=e.createElement("span"),this.tip.appendChild(this.nameSpan),Hu(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=e.createElement("span"),this.tip.appendChild(this.dimSpan),Hu(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",t.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(e,t,r){this.nameSpan.textContent=e,this.dimSpan.textContent=Math.round(t)+"px × "+Math.round(r)+"px"}updatePosition(e,t){const r=this.tip.getBoundingClientRect(),n=function(e,t,r){const n=Math.max(r.height,20),a=Math.max(r.width,60);let i;i=e.top+e.height+n<=t.top+t.height?e.top+e.height<t.top+0?t.top+5:e.top+e.height+5:e.top-n<=t.top+t.height?e.top-n-5<t.top+5?t.top+5:e.top-n-5:t.top+t.height-n-5;let l=e.left+5;return e.left<t.left&&(l=t.left+5),e.left+a>t.left+t.width&&(l=t.left+t.width-a-5),i+="px",l+="px",{style:{top:i,left:l}}}(e,t,{width:r.width,height:r.height});Hu(this.tip.style,n.style)}}class _u{constructor(){Fu(this,"window",void 0),Fu(this,"tipBoundsWindow",void 0),Fu(this,"container",void 0),Fu(this,"tip",void 0),Fu(this,"rects",void 0);const e=window;this.window=e;const t=window;this.tipBoundsWindow=t;const r=e.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new $u(r,this.container),this.rects=[],r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach((e=>{e.remove()})),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}inspect(e,t){const r=e.filter((e=>e.nodeType===Node.ELEMENT_NODE));for(;this.rects.length>r.length;){const e=this.rects.pop();e?.remove()}if(0===r.length)return;for(;this.rects.length<r.length;)this.rects.push(new Lu(this.window.document,this.container));const n={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};r.forEach(((e,t)=>{const r=Au(e,this.window),a=ku(e);n.top=Math.min(n.top,r.top-a.marginTop),n.right=Math.max(n.right,r.left+r.width+a.marginRight),n.bottom=Math.max(n.bottom,r.top+r.height+a.marginBottom),n.left=Math.min(n.left,r.left-a.marginLeft),this.rects[t].update(r,a)})),t||(t=r[0].nodeName.toLowerCase(),r[0]),this.tip.updateText(t,n.right-n.left,n.bottom-n.top);const a=Au(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:n.top,left:n.left,height:n.bottom-n.top,width:n.right-n.left},{top:a.top+this.tipBoundsWindow.scrollY,left:a.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function Du(e,t,r){Hu(r.style,{borderTopWidth:e[t+"Top"]+"px",borderLeftWidth:e[t+"Left"]+"px",borderRightWidth:e[t+"Right"]+"px",borderBottomWidth:e[t+"Bottom"]+"px",borderStyle:"solid"})}const qu={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"};let ju=null,Ku=null;function Mu(){null!=window.document&&(ju=null,null!==Ku&&(Ku.remove(),Ku=null))}function Vu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class zu{constructor(e){Vu(this,"_isRunning",void 0),Vu(this,"_selectIgnore",void 0),Vu(this,"_lastHoveredNode",null),Vu(this,"excludeSelectors",void 0),Vu(this,"onSelect",void 0),Vu(this,"iframesListeningTo",new Set),Vu(this,"onClick",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Vu(this,"onMouseEvent",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Vu(this,"onPointerDown",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation(),this.selectFiberForNode(this.getEventTarget(e)))})),Vu(this,"onPointerMove",(e=>{e.preventDefault(),e.stopPropagation();const t=this.getEventTarget(e);if(this._lastHoveredNode!==t){if(this._lastHoveredNode=t,this.excludeSelectors.some((e=>Qe(t,window.document.querySelector(e)))))return this._selectIgnore=!0,Mu();if(this._selectIgnore=!1,"IFRAME"===t.tagName){const e=t;try{if(!this.iframesListeningTo.has(e)){const t=e.contentWindow;this.registerListenersOnWindow(t),this.iframesListeningTo.add(e)}}catch(e){}}var r;r=[t],null,!1,null!=window.document?(null!==ju&&clearTimeout(ju),null!=r&&(null===Ku&&(Ku=new _u),Ku.inspect(r,null))):null!=r&&null!=r[0]&&console.error("showNativeHighlight",r[0])}})),Vu(this,"onPointerUp",(e=>{this._selectIgnore||(e.preventDefault(),e.stopPropagation())})),Vu(this,"selectFiberForNode",(0,J.throttle)((e=>{this._selectIgnore||this.onSelect?.(e,function(e){if(!(e instanceof Element))return"";const t=document.documentElement;let r=e;const n=[];for(;r!==t&&null!==r;){let e=r.tagName.toLowerCase();const t=/(?:\b|\w+-)(actived?|select(ed)?|focus(ed)?|open(ed)?)$/;for(let e=0,n=Array.from(r.classList).reverse();e<n.length;e++)t.test(n[e])&&r.classList.remove(n[e]);if(r.id&&/^rc-\w+/.test(r.id)&&r.removeAttribute("id"),r.id)e+=`#${r.id}`;else{const t=Array.from(r.parentElement.children).filter((e=>e.tagName===r.tagName)),n=r.className.trim();if(t.filter((e=>e.className.includes(n))).length<=1){if(n){const t=n.split(/\s+/);let r="";for(let e=0;e<t.length;e++)/^ant-col-\d+$/.test(t[e])||(r+=`.${t[e]}`);e+=r}}else e+=`:nth-of-type(${t.indexOf(r)+1})`}r.nodeType!==Node.TEXT_NODE&&n.unshift(e),r=r.parentElement}return n.join(" > ")}(e))}),200,{leading:!1})),this.excludeSelectors=e.excludeSelectors||[],this.onSelect=e.onSelect}startHandle(){this.startInspectingNative()}stopHandle(){this.stopInspectingNative()}startInspectingNative(){this._isRunning||(this.registerListenersOnWindow(window),this._isRunning=!0)}stopInspectingNative(){Mu(),this.removeListenersOnWindow(window),this.iframesListeningTo.forEach((function(e){try{this.removeListenersOnWindow(e.contentWindow)}catch(e){}})),this.iframesListeningTo=new Set,this._isRunning=!1}registerListenersOnWindow(e){e&&"function"==typeof e.addEventListener&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("mousedown",this.onMouseEvent,!0),e.addEventListener("mouseover",this.onMouseEvent,!0),e.addEventListener("mouseup",this.onMouseEvent,!0),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0))}removeListenersOnWindow(e){e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("click",this.onClick,!0),e.removeEventListener("mousedown",this.onMouseEvent,!0),e.removeEventListener("mouseover",this.onMouseEvent,!0),e.removeEventListener("mouseup",this.onMouseEvent,!0),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0))}getEventTarget(e){return e.composed?e.composedPath()[0]:e.target}}function Uu(e){return document.querySelector(e)}const Bu=e=>{const{action:r,onConfirm:n,onCancel:a,onFinish:i}=e,{t:l}=Vs();return t().createElement(t().Fragment,null,t().createElement("div",{style:{height:100}},l("qm.table.config.emptyText")),t().createElement(xe,{style:{width:"100%",justifyContent:"flex-end"}},t().createElement(he,{size:"small",onClick:()=>a?.()},l("qm.guideTracker.closeButton")),t().createElement(he,{size:"small",onClick:()=>n?.()},l("add"===r?"qm.guideTracker.addButton":"qm.guideTracker.editButton")),t().createElement(he,{size:"small",onClick:()=>i?.()},l("qm.guideTracker.finishButton"))))},Wu={left:"50%",top:"50%",width:1,height:1},Gu=t().forwardRef(((e,r)=>{const{open:n,current:a,defaultCurrent:i,steps:l=[],placement:o="bottom",control:s=!0,overlayClassName:c,overlayStyle:u,destroyOnHide:d,contentRender:p,zIndex:m,helper:h={},selectFilter:f=(e=>e),onSelect:g,onChange:b,onClose:y,onFinish:v}=e,{t:x}=Vs(),E=t().useRef(),S=t().useRef(l.length),[C,w]=Dc(0,{value:a,defaultValue:i}),[N,T]=Dc(void 0,{value:n,postState:e=>e??!1}),[I,R]=Dc(1051,{value:m,defaultValue:m}),[O,A]=t().useState({}),[k,F]=t().useState(!1),[H,L]=t().useState(!1),[$,_]=Hc(O.node,!!n),[D,q]=t().useState(22),j=t().useRef(!1),K=t().useMemo((()=>C>=l.length?"add":"edit"),[C,l]),M=t().useMemo((()=>`${C+1} / ${l.length}`),[C,l]);t().useLayoutEffect((()=>{E.current=new zu({excludeSelectors:[".qm-guide-tracker-control"],onSelect:(e,t)=>{t=f(t),A({id:Mn(),node:e,path:t}),w(S.current),F(!0),z(),g?.(t,e)}})}),[]),t().useEffect((()=>(N?V():z(),()=>{z()})),[N]),t().useEffect((()=>{S.current=l.length}),[l]);const V=()=>{E.current.startHandle()},z=()=>{E.current.stopHandle()},U=e=>{e.stopPropagation(),e.preventDefault()};t().useImperativeHandle(r,(()=>({OPEN:()=>T(!0),CLOSE:()=>T(!1),GET_CURRENT_STEP:()=>({current:C,selector:O.path})})));const B=Ce("guide-tracker"),W=[{[`${B}-primary`]:!0}],G=Mc({arrowPointAtCenter:!1,autoAdjustOverflow:!0,offset:5,arrowWidth:16,borderRadius:8});return t().createElement(t().Fragment,null,t().createElement(Bc(),{zIndex:I,builtinPlacements:G,popupPlacement:o,popupVisible:N&&k,popupClassName:Se()(W,c),popupStyle:u,prefixCls:B,popup:()=>{const e=()=>{F(!1),V()};return t().createElement("div",{className:`${B}-content`},t().createElement("div",{className:`${B}-inner`},t().createElement(we.CloseOutlined,{className:`${B}-close`,onClick:()=>{y?.(C),e()}}),t().createElement(P.Dropdown,{open:H,trigger:["click"],dropdownRender:()=>l.length?t().createElement("div",{className:"ant-dropdown-menu step-list"},t().createElement(Zn.ReactSortable,{itemKey:"id",handle:".handle",tag:"ul",animation:200,list:l,setList:e=>{const t=e.map((e=>e.id)),r=l.map((e=>e.id));if((0,J.isEqual)(t,r))return;const n=t.findIndex((e=>e===O.id)),a=-1!==n?n:C;w(a),b?.(Qn(e),a)}},l.map(((e,r)=>t().createElement("li",{key:r,className:Se()("item",{actived:e.id===O.id})},t().createElement(we.HolderOutlined,{className:"handle",title:x("qm.form.draggable")}),t().createElement("span",{className:"box"},t().createElement("span",{className:"title",title:e.title,onClick:()=>{r!==C&&(A({id:e.id,node:Uu(e.selector),path:e.selector}),w(r),q(22===D?D+1:D-1),b?.(l,r))}},e.title),t().createElement(P.Popconfirm,{title:x("qm.button.confirmTitle"),zIndex:I+1,onConfirm:()=>{const t=l.filter((t=>t.id!==e.id)),n=r===C;let a=r<=C?C-1:C;if(a=a<0?0:a,a=a>t.length?t.length:a,n&&t[a]){const{id:e,selector:r}=t[a];A({id:e,node:Uu(r),path:r})}w(a),b?.(t,a)}},t().createElement(we.CloseOutlined,{className:"close-icon"})))))))):t().createElement(t().Fragment,null),overlayClassName:`${B}__popper`,placement:"bottomLeft",overlayStyle:{minWidth:180,zIndex:I},onOpenChange:e=>L(e)},t().createElement(we.MenuOutlined,{className:Se()(`${B}-close`,"menu-icon"),style:{width:D}})),h.content&&t().createElement(P.Popover,{placement:"bottom",overlayStyle:{width:360,zIndex:I},content:h.content,title:h.title},t().createElement(we.QuestionCircleOutlined,{className:Se()(`${B}-close`,"help-icon")})),t().createElement("div",{className:"panel-label"},t().createElement("span",{className:"title"},x("qm.guideTracker.label")),t().createElement("span",{className:"step"},x("qm.guideTracker.currentStep"),M)),p?p({id:O.id,selector:O.path,actionStatus:K,DO_CLOSE:e},C):t().createElement(Bu,{action:K,onConfirm:()=>{b?.("add"===K?[...l,{id:O.id,selector:O.path,title:"Guide Title"}]:[...l],C),e()},onCancel:()=>{y?.(C),e()},onFinish:()=>{e(),y?.(C),v?.()}})))},arrow:!0,forceRender:!1,destroyPopupOnHide:d},t().createElement(zc(),{open:N&&k,autoLock:!0},t().createElement("div",{className:Se()(`${B}-target-placeholder`),style:{...$||Wu,position:"fixed",zIndex:I-1,backgroundColor:"rgba(120, 170, 210, 0.7)"},onMouseDown:U,onClick:U}))),s&&t().createElement(zc(),{open:N},t().createElement(Zc,{zIndex:I,prefixCls:B,onPause:()=>{j.current=k,F(!1),z()},onPlay:()=>{j.current?F(!0):V()}})))}));Gu.displayName="QmGuideTracker";const Yu=Gu,Xu=r=>{const{content:n,image:a,width:i,height:l,font:o={},gap:s=[100,100],offset:c=[50,50],rotate:u=-22,zIndex:d=9,alpha:p=1,antiTamper:m=!0,grayscale:h,className:f,style:g}=r,b=t().useRef(null),y=t().useRef(new Map),v=o.fontSize??16,x=o.fontWeight??"normal",E=o.fontStyle??"normal",S=o.fontFamily??"sans-serif",C=o.color??"rgba(0, 0, 0, 0.15)",w=o.textAlign??"center",N=Array.isArray(n)?n:[n],T=s[0],I=s[1],R=T/2,O=I/2,P=c[0]??R,A=c[1]??O,k=t().useMemo((()=>{const e=P-R,t=A-O;return{position:"absolute",left:e>0?`${e}px`:0,top:t>0?`${t}px`:0,width:e>0?`calc(100% - ${e}px)`:"100%",height:t>0?`calc(100% - ${t}px)`:"100%",pointerEvents:"none",backgroundRepeat:"repeat",backgroundPosition:`${e>0?0:e}px ${t>0?0:t}px`,zIndex:d}}),[R,O,P,A,d]),F=()=>{const e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;const r=(e=>{if(!e)return 1;const t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t})(t),[n,o]=(e=>{let t=120,r=64;if(!a&&e.measureText){e.font=`${v}px ${S}`;const n=N.map((t=>e.measureText(t).width));t=Math.ceil(Math.max(...n)),r=v*N.length+3*(N.length-1)}return[i??t,l??r]})(t),s=n*r,c=o*r,d=(T+n)*r,m=(I+o)*r,f=T/2*r,g=I/2*r,R=d/2,O=m/2,P=2*(T+n);e.width=2*d,e.height=2*m,t.globalAlpha=p,t.save(),t.translate(R,O),t.rotate(Math.PI/180*u),t.translate(-R,-O);const A=()=>{t.restore(),t.drawImage(e,0,0,d,m,d,m,d,m),h&&(e=>{const t=e.getContext("2d");if(!t)return;const r=t.getImageData(0,0,e.width,e.height),{data:n}=r;for(let e=0;e<n.length;e+=4){const t=(n[e]+n[e+1]+n[e+2])/3;n[e]=t,n[e+1]=t,n[e+2]=t}t.putImageData(r,0,0)})(e),((e,t)=>{if(b.current){const r=y.current.get(b.current);r&&(b.current.contains(r)&&b.current.removeChild(r),y.current.delete(b.current));const n=document.createElement("div");n.setAttribute("style",(e=>Object.entries(e).map((e=>{let[t,r]=e;return`${n=t,n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${r}`;var n})).join(";"))({...k,backgroundImage:`url('${e}')`,backgroundSize:`${t}px`})),b.current?.append(n),y.current.set(b.current,n)}})(e.toDataURL(),P)},F=()=>{const e=Number(v)*r;t.font=`${E} normal ${x} ${e}px/${o}px ${S}`,t.fillStyle=C,t.textAlign=w,t.textBaseline="top",t.translate(s/2,0),N.forEach(((n,a)=>{t.fillText(n??"",f,g+a*(e+3*r))})),A()};if(a){const e=new Image;e.onload=()=>{t.drawImage(e,f,g,s,c),A()},e.onerror=()=>{F()},e.crossOrigin="anonymous",e.referrerPolicy="no-referrer",e.src=a}else F()},H=e=>Array.from(y.current.values()).includes(e);t().useEffect((()=>{F()}),[n,a,i,l,o,s,c,u,d,p,m,h]),function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=window&&"MutationObserver"in window,i=e.useRef(),l=()=>{i.current&&(i.current.disconnect(),i.current=void 0)};e.useEffect((()=>(l(),a&&t.current&&(i.current=new MutationObserver(r),i.current.observe(t.current,n)),()=>l())),[t])}(b,(e=>{if(m)for(const t of e){const e=Array.from(t.removedNodes).some((e=>H(e))),r="attributes"===t.type&&H(t.target);if(e||r){F();break}}}),{attributes:!0,childList:!0,characterData:!0,subtree:!0});const L=Ce("watermark");return t().createElement("div",{ref:b,className:Se()(L,f),style:{position:"relative",...g}},r.children)},Qu=new Map,Zu=new WeakMap;let Ju=0;function ed(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:undefined;if(void 0===window.IntersectionObserver&&void 0!==n){const a=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:a,intersectionRect:a,rootBounds:a}),()=>{}}const{id:a,observer:i,elements:l}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(r=e.root,r?(Zu.has(r)||(Ju+=1,Zu.set(r,Ju.toString())),Zu.get(r)):"0"):e[t]}`;var r})).toString()}(e);let r=Qu.get(t);if(!r){const n=new Map;let a=[];const i=new IntersectionObserver((t=>{t.forEach((t=>{const r=t.isIntersecting&&a.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),n.get(t.target)?.forEach((e=>{e(r,t)}))}))}),e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},Qu.set(t,r)}return r}(r),o=l.get(e)||[];return l.has(e)||l.set(e,o),o.push(t),i.observe(e),function(){o.splice(o.indexOf(t),1),0===o.length&&(l.delete(e),i.unobserve(e)),0===l.size&&(i.disconnect(),Qu.delete(a))}}const td=e=>{const{forceRender:r,height:n,placeholder:a=null,unmountIfInvisible:i,className:l,style:o}=e,{ref:s,inView:c,entry:u}=function(){let{root:e,rootMargin:r,threshold:n,triggerOnce:a,fallbackInView:i,trackVisibility:l,skip:o,delay:s,onChange:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[u,d]=t().useState(null),[p,m]=t().useState({inView:!1,entry:void 0}),h=t().useRef(c);t().useEffect((()=>{if(o||!u)return;let t;return t=ed(u,((e,r)=>{m({inView:e,entry:r}),h.current?.(e,r),r.isIntersecting&&a&&t&&(t(),t=void 0)}),{root:e,rootMargin:r,threshold:n,trackVisibility:l,delay:s},i),()=>{t&&t()}}),[Array.isArray(n)?n.toString():n,u,e,r,a,o,l,i,s]);const f=p.entry?.target,g=t().useRef();u||!f||a||o||g.current===f||(g.current=f,m({inView:!1,entry:void 0}));const b=[d,p.inView,p.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}(Object.assign({},e,{triggerOnce:!i}));t().useEffect((()=>{n||g("LazyLoad","height 是必要参数,需要设定组件的高度值!")}),[]);const d={[Ce("lazy-load")]:!0};return t().createElement("div",{ref:s,className:Se()(d,l),style:o},r||c?e.children:t().createElement("div",{className:"placeholder",style:{height:n}},a))},rd="1.8.18"})(),a})()));
|