5 lines
682 KiB
JavaScript
5 lines
682 KiB
JavaScript
|
|
import{D as e,M as t,d as n,h as r}from"./package-Bop5TfAT.js";import{C as i,D as a,J as o,X as s,Y as c,_ as l,b as u,f as d,g as f,h as p,i as m,o as h,r as g,s as _,t as v,y}from"./runtime-core.esm-bundler-DO-WTVbd.js";import{t as b}from"./worker-ref-BbTnHTC-.js";``+new URL(`xlsx-ff7ER-JZ.png`,import.meta.url).href;var x=t(e(((e,t)=>{(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`:root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color
|
||
|
|
`)>-1?a+=`"${o.replace(/"/g,`""`)}"`:a+=o:o==null?a+=``:a+=o;t!==n-1&&(a+=`
|
||
|
|
`)}return a}function g(e,t,n=[]){let r=0,i=[];return e.forEach((a,o)=>{o===0?i.push(1):(n.reduce((e,t)=>`${e}${a[t]??``}`,``)||a[t])===(n.reduce((t,n)=>`${t}${e[o-1][n]??``}`,``)||e[o-1][t])?(i[r]+=1,i.push(0)):(i.push(1),r=o)}),i}function _(e,t){let n=``,r=``,i={};return t.forEach((t,a)=>{a===0?(n=t.key,r=t.key,i[t.key]=1):e[t.key]===e[n]?(i[t.key]=0,i[r]+=1):(i[t.key]=1,n=t.key,r=t.key)}),i}function v(e,t,n=[]){let{visibleRows:r,rowIndex:i,headIndex:a}=e,o=g(r,t,n);return o[i-a]===0?{rowspan:0,colspan:0,relationRowKeys:n,mergeRow:!0}:{rowspan:o[i-a],colspan:1,relationRowKeys:n,mergeRow:!0}}function y(e,t=[]){let{column:n,row:r,visibleLeafColumns:i}=e,a=i.filter(e=>t.includes(e.key));if(t.includes(n.key)){let e=_(r,a);return e[n.key]===0?{rowspan:0,colspan:0,relationColKeys:t,mergeCol:!0}:{rowspan:1,colspan:e[n.key],relationColKeys:t,mergeCol:!0}}}function b(e,t=document.documentElement){let n=e.startsWith(`--`)?e:`--${e}`;return getComputedStyle(t).getPropertyValue(n).trim()}function x(e){if(!e)return new Date(0);if(typeof e==`number`)return new Date(e);let t=String(e).trim(),n=new Date(t);if(!isNaN(n.getTime()))return n;for(let e of[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/]){let n=t.match(e);if(n){let t=n.slice(1).map(Number);if(e.source.includes(`YYYY-MM-DD`)||e.source.includes(`YYYY/MM/DD`)||e.source.includes(`YYYY.MM.DD`)){let[e,n,r,i=0,a=0,o=0]=t;return new Date(e,n-1,r,i,a,o)}else if(e.source.includes(`DD-MM-YYYY`)||e.source.includes(`DD/MM/YYYY`)||e.source.includes(`DD.MM.YYYY`)){let[e,n,r,i=0,a=0,o=0]=t;return new Date(r,n-1,e,i,a,o)}else if(e.source.includes(`MM-DD-YYYY`)||e.source.includes(`MM/DD/YYYY`)||e.source.includes(`MM.DD.YYYY`)){let[e,n,r,i=0,a=0,o=0]=t;return new Date(r,e-1,n,i,a,o)}else if(e.source.includes(`YYYYMMDD`)){let[e,n,r]=t;return new Date(e,n-1,r)}}}return new Date(NaN)}function S(e,t){let n=x(e),r=x(t);return isNaN(n.getTime())&&isNaN(r.getTime())?0:isNaN(n.getTime())?-1:isNaN(r.getTime())?1:n.getTime()-r.getTime()}class C{constructor(e,t,r,i,a,o,s){n(this,`ctx`),n(this,`x`,0),n(this,`y`,0),n(this,`width`,0),n(this,`height`,0),n(this,`fixed`),n(this,`cellType`),this.ctx=e,this.x=t,this.y=r,this.width=i,this.height=a,this.fixed=s,this.cellType=o}isHorizontalVisible(){if(this.fixed)return!0;let{stageWidth:e,fixedLeftWidth:t,scrollX:n,fixedRightWidth:r}=this.ctx,i=e;return!(this.x+this.width-t-n<=0||this.x-n>=i-r)}isVerticalVisible(){let{stageHeight:e,scrollY:t}=this.ctx,n=e;return!(this.y+this.height-t<=0||this.y-t>=n)}getDrawX(){if(this.fixed===`left`)return this.x;if(this.fixed===`right`){let{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType===`header`||this.cellType===`footer`&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class w extends C{constructor(e,t,r,i,a,o,s,c,l,u=`body`,d=!0){super(e,i,a,o,s,u,c.fixed),n(this,`formatter`),n(this,`formatterFooter`),n(this,`hoverIconName`,``),n(this,`operation`,!1),n(this,`align`),n(this,`verticalAlign`),n(this,`fixed`),n(this,`type`),n(this,`editorType`),n(this,`editorProps`),n(this,`cellType`),n(this,`level`),n(this,`colspan`,1),n(this,`rowspan`,1),n(this,`mergeRow`,!1),n(this,`mergeCol`,!1),n(this,`relationRowKeys`,[]),n(this,`relationColKeys`,[]),n(this,`key`),n(this,`column`),n(this,`rowIndex`),n(this,`colIndex`),n(this,`rowKey`),n(this,`row`),n(this,`value`),n(this,`render`),n(this,`renderFooter`),n(this,`style`,{}),n(this,`domDataset`,{}),n(this,`rules`,[]),n(this,`message`,``),n(this,`text`,``),n(this,`displayText`,``),n(this,`visibleWi
|
||
|
|
`);for(let e of i){if(e===``){r.push(``);continue}let n=e.split(``),i=``;for(let e of n){let n=i+e;this.ctx.measureText(n).width<=t?i=n:i?(r.push(i),i=e):(r.push(e),i=``)}i&&r.push(i)}let a=r.length>0?r:[``];return n&&this.textCacheMap.set(n,a),a}calculateTextHeight(e=``,t,n={}){let{font:r=`12px Arial`,padding:i=0,align:a=`center`,color:o=`#495060`,maxLineClamp:s=1,cacheTextKey:c=``}=n;this.ctx.save(),this.ctx.font=r,this.ctx.fillStyle=o,this.ctx.textAlign=a;let l=parseInt(r.match(/\d+/)?.[0]||`12`),u=l*(n.lineHeight||1.2),d=t-i*2,f=this.wrapText(e,d,c),p=1;return p=s===`auto`?f.length:f.length>s?s:f.length,this.ctx.restore(),Math.max(Math.floor(p*u+i*2),Math.floor(l+i*2))}handleEllipsis(e,t,n=0,r=`12px Arial`){this.ctx.save();let i=!1,a=e;if(this.ctx.font=r,e==null||e===``)return this.ctx.restore(),{_text:``,ellipsis:i};let o=this.ctx.measureText(`...`).width;if(t<=o+n*2)return this.ctx.restore(),{_text:``,ellipsis:!0};let s=this.ctx.measureText(e).width,c=t-n*2;if(s&&s>=c){i=!0;let t=0;for(let n=0;n<e.length;n++)if(t+=this.ctx.measureText(e[n]).width,t>=c-o){a=e.slice(0,n)+`...`,i=!0;break}}return this.ctx.restore(),{_text:a,ellipsis:i}}}class O{constructor(e){n(this,`_config`,{}),n(this,`CSS_PREFIX`,`e-virt-table`),n(this,`ICONS`,[]),n(this,`ROW_KEY`,``),n(this,`DISABLED`,!1),n(this,`HEADER_FONT`,`12px normal Arial`),n(this,`BODY_FONT`,`12px normal Arial`),n(this,`BORDER`,!0),n(this,`STRIPE`,!1),n(this,`STRIPE_COLOR`,`#fafafa`),n(this,`BORDER_COLOR`,`#e1e6eb`),n(this,`HEIGHT`,0),n(this,`PLACEHOLDER_COLOR`,`#CDD0DC`),n(this,`EMPTY_BODY_HEIGHT`,120),n(this,`EMPTY_CUSTOM_STYLE`,{}),n(this,`NUMBER_ERROR_TIP`,`只允许输入数字`),n(this,`EMPTY_TEXT`,`暂无数据`),n(this,`LOADING_TEXT`,`加载中...`),n(this,`MAX_HEIGHT`,1e3),n(this,`BORDER_RADIUS`,8),n(this,`ENABLE_OFFSET_HEIGHT`,!1),n(this,`OFFSET_HEIGHT`,0),n(this,`HEADER_HEIGHT`,36),n(this,`ENABLE_HEADER_STICKY`,!1),n(this,`HEADER_BG_COLOR`,`#F8FAFF`),n(this,`BODY_BG_COLOR`,`#FFF`),n(this,`HEADER_TEXT_COLOR`,`#1D2129`),n(this,`REQUIRED_COLOR`,`#F56C6C`),n(this,`BODY_TEXT_COLOR`,`#4E5969`),n(this,`FOOTER_TEXT_COLOR`,`#4E5969`),n(this,`LOADING_ICON_SVG`,``),n(this,`LOADING_ICON_COLOR`,`#4E5969`),n(this,`EXPAND_ICON_SVG`,``),n(this,`SHRINK_ICON_SVG`,``),n(this,`EXPAND_ICON_COLOR`,`#4E5969`),n(this,`SHRINK_ICON_COLOR`,`#4E5969`),n(this,`ERROR_TIP_ICON_COLOR`,`red`),n(this,`ERROR_TIP_ICON_SIZE`,6),n(this,`COLUMNS_ALIGN`,`left`),n(this,`COLUMNS_VERTICAL_ALIGN`,`middle`),n(this,`EXPAND_LAZY`,!0),n(this,`DEFAULT_EXPAND_ALL`,!1),n(this,`CELL_WIDTH`,100),n(this,`CELL_HEIGHT`,36),n(this,`CELL_PADDING`,8),n(this,`CELL_HOVER_ICON_SIZE`,14),n(this,`CELL_HOVER_ICON_BG_COLOR`,`#fff`),n(this,`CELL_HOVER_ICON_BORDER_COLOR`,`#DDE0EA`),n(this,`SCROLLER_TRACK_SIZE`,14),n(this,`SCROLLER_SIZE`,8),n(this,`SCROLLER_COLOR`,`#dee0e3`),n(this,`SCROLLER_TRACK_COLOR`,`#fff`),n(this,`SCROLLER_FOCUS_COLOR`,`#bbbec4`),n(this,`SELECT_BORDER_COLOR`,`rgb(82,146,247)`),n(this,`SELECT_AREA_COLOR`,`rgba(82,146,247,0.1)`),n(this,`SELECT_ROW_COL_BG_COLOR`,`transparent`),n(this,`AUTOFILL_POINT_BORDER_COLOR`,`#fff`),n(this,`EDIT_BG_COLOR`,`#fcf6ed`),n(this,`CHECKBOX_KEY`,``),n(this,`CHECKBOX_COLOR`,`rgb(82,146,247)`),n(this,`FINDER_CELL_BG_COLOR`,`rgb(255,229,144)`),n(this,`ENABLE_FINDER`,!0),n(this,`CHECKBOX_SIZE`,20),n(this,`CHECKBOX_DISABLED_SVG`,``),n(this,`CHECKBOX_DISABLED_COLOR`,`#F1F2F4`),n(this,`CHECKBOX_CHECK_SVG`,``),n(this,`CHECKBOX_UNCHECK_SVG`,``),n(this,`CHECKBOX_UNCHECK_COLOR`,`#DDE0EA`),n(this,`CHECKBOX_INDETERMINATE_SVG`,``),n(this,`CHECKBOX_CHECK_DISABLED_SVG`,``),n(this,`CHECKBOX_CHECK_DISABLED_COLOR`,`#DDE0EA`),n(this,`ICON_EDIT_SVG`,``),n(this,`ICON_EDIT_COLOR`,`#4E5969`),n(this,`ICON_SELECT_SVG`,``),n(this,`ICON_SELECT_COLOR`,`#4E5969`),n(this,`SORT_STRICTLY`,!0),n(this,`SORT_ASC_ICON_SVG`,``),n(this,`SORT_DESC_ICON_SVG`,``),n(this,`SORTABLE_ICON_SVG`,``),n(this,`SORT_ICON_COLOR`,`rgb(82,146,247)`),n(this,`READONLY_COLOR`,`#fff`),n(this,`READONLY_TEXT_COLOR`,`#4E5969`),n(this,`ERROR_TIP_COLOR`,`#ED3F14`),n(this,`FOOTER_BG_COLOR`,`#fafafa`),n(this,`FOOTER_FIXED`,!0),n(this,`FOOTER_PO
|
||
|
|
`+r,this.inputEl.selectionStart=this.inputEl.selectionEnd=t+1,this.autoSize();return}if(e.code===`Tab`&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit(`setMoveFocus`,`LEFT`);return}this.ctx.emit(`setMoveFocus`,`RIGHT`);return}if(e.key===`Enter`&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit(`setMoveFocus`,`TOP`);return}this.ctx.emit(`setMoveFocus`,`BOTTOM`);return}if(e.key===`Enter`&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}let n=e.key,r=e.ctrlKey,i=e.altKey,a=e.shiftKey,o=e.metaKey;if(!(r||i||a||o||`Enter.CapsLock.Escape.Tab.Backspace.Delete.ArrowUp.ArrowDown.ArrowLeft.ArrowRight.Home.End.PageUp.PageDown.Insert.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12`.split(`.`).includes(n))){if(document.activeElement!==this.inputEl&&t.editorType===`text`){e.preventDefault();return}this.startEdit(!0)}}),this.ctx.on(`cellClick`,e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;let{xArr:t,yArr:n}=this.ctx.selector,r=JSON.stringify(t)+JSON.stringify(n);if(this.focusInput(),this.selectorArrStr===r&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=r,this.doneEdit(),this.cellTarget=e,this.resetEditorStyle(),this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}})}isInSelectorRange(e,t){let{xArr:n,yArr:r}=this.ctx.selector,[i,a]=n,[o,s]=r;return!(t<i||t>a||e<o||e>s)}initTextEditor(){this.inputEl=document.createElement(`textarea`),this.inputEl.id=`e-virt-table-editor-textarea`,this.inputEl.setAttribute(`rows`,`1`),this.inputEl.setAttribute(`tabindex`,`-1`),this.inputEl.addEventListener(`input`,this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className=`e-virt-table-editor-textarea`,this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){if(!this.ctx.editing)return;let e=this.inputEl.value;this.cellTarget&&this.cellTarget.type===`number`&&e!==``&&(this.ctx.emit(`cellHideTooltip`),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit(`cellShowTooltip`,this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height=`auto`;let t=this.inputEl.scrollHeight,n=this.ctx.body.visibleHeight;t>n&&(t=n);let{stageHeight:r,footer:i,header:a,config:{SCROLLER_TRACK_SIZE:o}}=this.ctx,s=r-i.height-o;this.editorEl.style.bottom=`auto`,this.drawY<a.height&&(this.editorEl.style.top=`${a.height-1}px`),this.drawY+t>s&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`auto`,this.editorEl.style.bottom=`${r-s}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){let n=t?null:e.getValue(),{editorType:r}=e;if(r===`none`)return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:i,width:a,drawY:o,drawX:s}=e;this.drawX=s,this.drawY=o;let{config:{CELL_PADDING:c},header:l}=this.ctx,u=this.ctx.body.visibleHeight;i>u&&(i=u),this.editorEl.style.zIndex=`100`,this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY}px`,this.editorEl.style.bottom=`auto`,this.editorEl.style.maxWidth=`none`,this.editorEl.style.maxHeight=`${u}px`,[`text`].includes(r)?(this.inputEl.style.opacity=`1`,this.inputEl.style.position=`relative`,this.inputEl.style.minWidth=`${a-1}px`,this.inputEl.style.minHeight=`${i-1}px`,this.inputEl.style.maxHeight=`${u}px`,this.inputEl.style.width=`${a}px`,this.inputEl.style.height=`auto`,this.inputEl.style.padding=`${c}px`,this.inputEl.value=``,n!==null&&(this.inputEl.value=n),(this.inputEl.scrollHeight>i||this.drawY<l.height)&&this.autoSize()):(this.inputEl.style.opacity=`0`,this.inputEl.style.width=`1px`,this.inputEl.style.height=`1px`,this.inputEl.style.position=`absolute`,this.inputEl.style.left=`0px`,this.inputEl.style.top=`0px`)}doneEditByInput(){if(this.cellTarget&&this.cellT
|