@guiexpert/preact-table 10.1.82 → 10.1.83
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/index.cjs +5 -5
- package/index.js +66 -43
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${s}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",o=!1,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const c=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,c),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",o=new Ae,s=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${s}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const c of r.classes)this.domService.addClass(i,c);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",o=new Ce,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const c=l.content,d=this.domService.createText(c);this.domService.appendChild(n,d),l.style&&this.applyStyleString(n,l.style);for(const p of l.classes)this.domService.addClass(n,p);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,o,s,i){if(e.verticalBorderVisible){const r=`ge-table-${s}-${i}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${i}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width",`${e.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.appendChild(t,s),s}addFocusBorderDivs(e,t,o){t={...t,width:t.width+1,height:t.height+1};let s=this.domService.createElement("div");return this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left+t.width-1}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top+t.height-1}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${e.height}px`),this.domService.appendChild(t,s),s}addDiv(e,t,o=""){const s=this.domService.createElement("div");return o&&this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.appendChild(e,s),s}applyStyleString(e,t){const o=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of o){const[i,r]=s.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const q=a=>a==="header"?"header":a==="footer"?"footer":"body";class Pe{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const o=e.getAttribute("data-area");if(o&&(this.areaIdent=q(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const s=e;this.value=s.value}}}}class Ve{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay){this.lastClicked=t,this.publishGeMouseEvent(e,2);return}this.lastClicked=t;const o=new Pe(e.target,this.tableScope);if(o.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(o.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(o),e.preventDefault(),e.stopPropagation();else if(o.inputType==="checkbox"&&o.areaIdent)this.tableScope.toggleRowCheckbox(o.rowIdx,o.colIdx,o.areaIdent),e.preventDefault(),e.stopPropagation();else if(H(o.row)&&o.areaModel){const s=o.colIdx===this.getArrowColumnIndex()&&e.altKey,i=o.className.includes("ge-table-tree-arrow-div");if(s||i){e.preventDefault(),e.stopPropagation();const r=o.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in o.areaModel&&o.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(o.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(o.rowIdx,o.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,o=t.getAttribute("data-area"),s=q(o),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(s);if(o&&s==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const l=n.getRowByIndex(i);if(o&&s==="body"&&n.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),H(l)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const c=l;c.expanded=!c.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(c)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent)}updateCollapsedExpandedState(e){var o,s,i,r,n;const t=(s=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:s.getRowId;if(t){const l=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,c=l==="collapsed"&&!e.expanded||l==="expanded"&&e.expanded,d=l==="collapsed"&&e.expanded||l==="expanded"&&!e.expanded,p=t(e.data);c?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(p):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(p))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class He{constructor(e,t=[],o=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=o,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(s=>s.rendererMap[e])}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var o;const t=this.getRowByIndex(e);return(o=this.rowSelectionModel)==null?void 0:o.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const o=this.getRowByIndex(e);this.rowSelectionModel.checkRow(o,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}sort(e){}isEditable(e,t){var s,i;const o=(s=this.columnDefs)==null?void 0:s[t];return((i=o==null?void 0:o.editable)==null?void 0:i.call(o))??!1}setValue(e,t,o){var n;const s=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;s&&(o=s(o,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),o):(i[r]=o,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,o){const s=t.shift();if(s){const i=e[s];return i&&t.length?this.setPropertyValue(i,t,o):(e[s]=o,!0)}return!1}arrayMove(e,t,o){const s=e.splice(t,1)[0];return e.splice(o,0,s),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class We{genericSortComparator(e,t,o){if(typeof e=="number"&&typeof t=="number")return o*(e-t);if(typeof e=="string"&&typeof t=="string")return o*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return o*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return o*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const s=e,i=t;if(s.length&&i.length)return this.genericSortComparator(s[0],i[0],o)}return o*(""+e).localeCompare(""+t)}}class I extends He{constructor(e,t,o,s=[],i="ge-selected-row",r="ge-focused-row"){super(e,s,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=s,this.selectedRowClass=i,this.focusedRowClass=r,this.sorterService=new We,this._focusedRowIndex=0,this.filteredRows=[...t],this.properties=s.map(n=>n.property)}getFocusedRowIndex(){return this._focusedRowIndex}setFocusedRowIndex(e){this._focusedRowIndex=e}setRows(e){this.rows=e,this.filteredRows=[...e]}filterRowsByPredict(e){this.rows=this.rows.filter(e),this.filteredRows=this.filteredRows.filter(e)}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getValueAt(e,t){const o=this.properties[t];let s=this.filteredRows[e];return H(s)&&(s=s.data),s?this.getValueByT(s,o):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}findRowFromFilteredRowsByAllCriteria(e,t){return this.getFilteredRows().find(o=>t(e,o))}findRowFromAllRowsByAllCriteria(e,t){return this.getAllRows().find(o=>t(e,o))}getRowHeight(e){return this.defaultRowHeight}getRowByIndex(e){return this.filteredRows[e]}externalFilterChanged(e){this.filteredRows=this.rows?this.rows.filter(e):[]}doSort(e){for(const t of e){const{columnIndex:o,sortState:s}=t,i=s==="asc"?1:s==="desc"?-1:0,r=this.properties[o];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,i))}return!0}sort(e){this.filteredRows=this.filteredRows.sort(e)}getValueByT(e,t){if(e&&t)return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}getCustomClassesAt(e,t){const o=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&o.push(this.selectedRowClass),this._focusedRowIndex===e&&o.push(this.focusedRowClass),o}genericFlatTableSortComparator(e,t){const o=this.columnDefs.find(s=>s.property===e);return(s,i)=>{const r=this.getValueByT(s,e),n=this.getValueByT(i,e);return o!=null&&o.sortComparator?t*o.sortComparator(r,n,s,i,t):this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const o=t.shift(),s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}}class $e{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}downloadExcel(e="table.xlsx",t=""){const o=[],s=this.tableScope.tableModel.getColumnCount(),i=["header","body","footer"];for(const r of i){const n=this.tableScope.tableModel.getAreaModel(r),l=(n==null?void 0:n.getRowCount())??0;for(let c=0;c<l;c++){const d=[];o.push(d);for(let p=0;p<s;p++)d.push(n.getValueAt(c,p))}}return this.tableScope.excelService.downloadExcel(o,e,t)}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}autoResizeColumns(e=!0){this.tableScope.autoResizeColumns(e)}recalcWrappers(){this.tableScope.recalcWrappers()}setColumnWidth(e,t){this.tableScope.setColumnWidth(e,t)}getTableModel(){return this.tableScope.tableModel}getBodyModel(){return this.tableScope.tableModel.getBodyModel()}setRows(e){const t=this.getBodyModel();t instanceof I?t.setRows(e):console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRows(e){const t=this.getBodyModel();if(t instanceof I){const o=t;let s=o.getAllRows();o.setRows([...s,...e])}else console.warn("addRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRowsAt(e,t){const o=this.getBodyModel();if(o instanceof I){const s=o;let i=s.getAllRows();s.setRows([...i.slice(0,t),...e,...i.slice(t)])}else console.warn("addRowsAt<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}removeRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof I){const s=o,i=s.getAllRows().filter(r=>!e.some(n=>t(r,n)));s.setRows(i)}else console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}findRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();return o instanceof I?o.getAllRows().filter(i=>e.some(r=>t(i,r))):(console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o),[])}findRowFromFilteredRowsByAllCriteria(e,t){const o=this.getBodyModel();if(o instanceof I)return o.getFilteredRows().find(i=>t(e,i));console.warn("findRowFromFilteredRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}findRowFromAllRowsByAllCriteria(e,t){const o=this.getBodyModel();if(o instanceof I)return o.getAllRows().find(i=>t(e,i));console.warn("findRowFromAllRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}updateRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof I){let i=o.getAllRows();for(const r of i)for(const n of e)if(t(r,n))for(const l of Object.keys(n))r[l]=n[l]}else console.warn("updateRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}reSort(){this.tableScope.reSort()}sort(e){this.tableScope.sort(e)}ensureRowIsVisible(e){return this.tableScope.ensureRowIsVisible(e)}getDisplayedRowCount(){return this.tableScope.getDisplayedRowCount()}getFirstVisibleRowIndex(){return this.tableScope.getFirstVisibleRowIndex()}getFirstFullVisibleRowIndex(){return this.tableScope.getFirstFullVisibleRowIndex()}getLastVisibleRowIndex(){return this.tableScope.getLastVisibleRowIndex()}getLastFullVisibleRowIndex(){return this.tableScope.getLastFullVisibleRowIndex()}setLoggingActive(e){this.tableScope.loggingActive=e}isLoggingActive(){return this.tableScope.loggingActive}}class J{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};return e instanceof Map&&e.forEach((s,i)=>{t[s]=i}),t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const s=o();if(s){const i=s+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class Ne extends J{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(o);this.scrollOffset=s||[0,0]}}}}class ze{constructor(e="collapsed",t=[],o=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=s}}class Ge extends J{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new ze,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(o);s&&(this.collapsedExpandedState=s)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Ue extends J{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const o=t+this.SORTING_STATE,s=this.loadFromLocalStorage(o);this.sortItems=s||[]}}}}class D{constructor(e=0,t=0,o=0,s=0,i){this.left=e,this.width=t,this.height=o,this.top=s,this.index=i}}class je{constructor(e,t,o,s){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new D,this.areaBodyCenterGeo=new D,this.areaBodyEastGeo=new D;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=o.appendRelativeChildDiv(o.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=o-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=o-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=o-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class E{constructor(e,t,o,s,i=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=s,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new E(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new E(e,t,e,t)}static singleRow(e){return new E(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new E(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Xe{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let o=0;o<e;o++)for(let s=0;s<t;s++){let i=this.areaModel.getColspanAt(o,s),r=this.areaModel.getRowspanAt(o,s);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new E(o,s,o+r-1,s+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class Ke{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class Ye extends je{constructor(e,t,o,s){var r,n;super(e,t,o,s),this.firstVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1,this.displayedRowCount=0,this.pixelLimitForFullVisible=5,this.loggingActive=!1,this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new Ke,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),X(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(l=>{var c;this.colAndRowspanModels[l]=new Xe(t,t.getAreaModel(l)),(c=this.colAndRowspanModels[l])==null||c.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var s;let o=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(o||(o=this.tableOptions.getEditRenderer),o)if(this.editorRenderer=o(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=(!e||e>this.scrollViewport.offsetWidth)&&this.scrollViewport.offsetWidth>100?this.scrollViewport.offsetWidth:this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new D(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new D(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new D(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new D(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(o=>{this.tableModel.getAreaModel(o.area).setValue(o.rowIndex,o.columnIndex,o.value),t||this.rerenderCellContent(o)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:o,value:s,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=document.querySelector(n);if(l){let c;const d=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o;let p;if(d?p=this.editorRenderer:p=r.getCellRenderer(t,o),l.innerText="",this.applyCssClasses(l,i),p)c=p.render(l,t,o,e,r,s,this.dom.domService),c&&this.cleanupFunctions[e].push(c);else{const u=`${s}`;this.dom.addLabelDiv(l,u,!1,t,o,e)}const h=r.getCustomClassesAt(t,o);h.length&&this.dom.addClasses(h,l);const m=r.getCustomStyleAt(t,o);if(m)for(const u in m)this.dom.setStyle(l,u,m[u])}}getFirstVisibleRowIndex(){return this.firstVisibleRowIndex}getLastVisibleRowIndex(){return this.lastVisibleRowIndex}getFirstFullVisibleRowIndex(){return this.firstFullVisibleRowIndex}getLastFullVisibleRowIndex(){return this.lastFullVisibleRowIndex}getDisplayedRowCount(){return this.displayedRowCount}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,o)=>this.tableModel.getColumnWidth(o)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),o=this.getStringByAttr(e,"data-side");if(o&&t)return[t,o]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var g;const o=this.getArea(e,"west"),s=this.getArea(e,"center"),i=this.getArea(e,"east"),r=s.child.clientHeight;o.child.innerText="",s.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,c=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),p=d.getRowCount();for(;this.cleanupFunctions[e].length;){const f=this.cleanupFunctions[e].shift();f&&f()}let h=t;const m=this.tableModel.getColumnCount(),u=this.tableModel.getFixedRightColumnCount(),b=this.tableModel.getFixedLeftColumnCount();e==="body"&&(this.firstVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1);for(let f=0;f<p;f++){const x=h,v=f===p-1,A=this.tableModel.getRowHeight(e,f);if(x+A>0){e==="body"&&this.firstVisibleRowIndex===-1&&(this.firstVisibleRowIndex=f,this.firstFullVisibleRowIndex=x<-this.pixelLimitForFullVisible?this.firstVisibleRowIndex+1:this.firstVisibleRowIndex);let w={left:n,width:l,height:A,top:x,index:f},y=this.dom.addRowDiv(s,w,f,e,"center");const T=b;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:w,parent:y,rowIndex:f,columnIndexStart:T,columnIndexEnd:m-u-1,verticalFixed:!1,lastRowOfModel:v}),c.left>0&&(w={left:n,width:this.areaBodyWestGeo.width,height:A,top:x,index:f},y=this.dom.addRowDiv(o,w,f,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:w,parent:y,rowIndex:f,columnIndexStart:0,columnIndexEnd:T-1,verticalFixed:!0,lastRowOfModel:v})),c.right>0&&(w={left:n,width:this.areaBodyEastGeo.width,height:A,top:x,index:f},y=this.dom.addRowDiv(i,w,f,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:w,parent:y,rowIndex:f,columnIndexStart:m-u,columnIndexEnd:m-1,verticalFixed:!0,lastRowOfModel:v})),e==="header"&&this.tree&&f===p-1){const _=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(y,new D(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),M=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(M){const B=this.dom.domService.createText(M.content);this.dom.domService.appendChild(_,B),M.style&&this.dom.applyStyleString(_,M.style)}}}if(h=h+A,h>r){e==="body"&&(this.lastVisibleRowIndex=f,this.lastFullVisibleRowIndex=r-h<-this.pixelLimitForFullVisible?f-1:f,this.displayedRowCount=this.lastFullVisibleRowIndex-this.firstFullVisibleRowIndex+1);break}}if(this.loggingActive&&e==="body"&&console.log("render scope: this.firstVisibleRowIndex <- "+this.firstVisibleRowIndex+`
|
|
9
9
|
render scope: this.firstFullVisibleRowIndex <- `+this.firstFullVisibleRowIndex+`
|
|
10
10
|
render scope: this.lastVisibleRowIndex <- `+this.lastVisibleRowIndex+`
|
|
11
|
-
render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),this.colAndRowspanModels&&this.colAndRowspanModels[e]){const f=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(f.length)for(const x of f){let v=0,A=s.child,w="center";if(x.c1<b)A=o.child,w="west";else if(u>0&&x.c1>=m-u)A=i.child,w="east";else{const y=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();v=this.scrollFactorX*y-this.areaBodyWestGeo.width,w="center"}this.drawBigCell(x,v,t,d,A,w)}}}drawBigCell(e,t,o,s,i,r){const n=o+this.getRowHeights(0,e.r1-1,s).reduce((g,f)=>g+f,0),l=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let d=0;c>0&&e.c1>=l-c&&(d=l-c);const p=t+this.getColumnWidths(d,e.c1-1).reduce((g,f)=>g+f,0),h=this.getRowHeights(e.r1,e.r2,s).reduce((g,f)=>g+f,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,f)=>g+f,0);let u=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(u=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:p,top:n,width:m,height:h,parent:i,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:p,top:n,width:m,height:h,parent:i,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:p,cellTop:n,cellWidth:m,cellHeight:h,parent:i})}findRowOfImportantRowspanCell(e,t,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:c=!1,lastRowOfModel:d=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let p=0;if(!c){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();p=this.scrollFactorX*g}const h=0,m=!!(e==="body"&&t);let u=p;for(let g=n;g<=l;g++){const f=u,x=this.tableModel.getColumnWidth(g);if(x>0&&f+x>0){let v=s.height;const A=o.getRowspanAt(r,g),w=o.getColspanAt(r,g);A>1&&(v=this.getRowHeights(r,r+A-1,o).reduce((_,M)=>_+M,0));let y=x;w>1&&(y=this.getColumnWidths(g,g+w-1).reduce((_,M)=>_+M,0));let T=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(r,g)&&(T=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,f,h,y,v);const _={left:f,top:h,width:y,height:v};this.dom.addColumnBorderDivs(this.tableOptions,i,_,e,t)}else{const _=this.renderSelectedBackgroundDiv(T,m,t,o,r,g,i,f,h,y,v);"gammaCells"in o&&o.getValueAt(r,g)&&(T=!1),T||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:f,top:h,width:y,height:v,parent:i,cellSelected:_,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:f,cellTop:h,cellWidth:y,cellHeight:v,parent:i})}}if(u=u+x,u>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new D(u-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:n,height:l,top:c,parent:d,lastRowOfModel:p}){var ee;const m=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(s,i),u={left:r,width:n,height:l,top:c,index:i},b=e.getRowByIndex(s);let g="none";if(i===this.getTreeArrowColumnIndex()&&H(b)){const C=b;(ee=C.children)!=null&&ee.length?C.expanded?g="expanded":g="collapsed":g="hidden"}let x;if(t==="header"){const C=this.tableModel.getColumnDef(i);(!(C!=null&&C.sortIconVisible)||C!=null&&C.sortIconVisible())&&(x=C==null?void 0:C.sortState)}const v=e.getValueAt(s,i),A=m?"":`${v}`,w=e.isRowChecked(s),y=this.dom.addColumnDiv({parent:d,geo:u,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:A,treeArrow:g,tableOptions:this.tableOptions,checkedType:w,sortState:x}),T=e.getTooltipAt(s,i);T&&this.dom.setAttribute(y,"title",T);const _=this.tableModel.getColumnDef(i);_&&_.classes[t]&&this.dom.addClasses(_.classes[t],y);let M;m&&(M=m.render(y,s,i,t,e,v,this.dom.domService));const B=e.getCustomClassesAt(s,i);if(B.length&&this.dom.addClasses(B,y),this.dom.addColumnBorderDivs(this.tableOptions,d,u,t,o),p&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:c+l},d),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(s,i)&&this.dom.addFocusBorderDivs(d,u,{})}t==="header"&&this.dom.setAttribute(y,"data-ge-action","drag-column");const z=e.getCustomStyleAt(s,i);if(z)for(const C in z)this.dom.setStyle(y,C,z[C]);return[y,M]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:s+"px",width:t+"px",height:o+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const d={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,d),o&&this.renderContentOfDraggingColumn(d)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let c=0;c<r;c++){const d=o,p=i.getRowHeight(c),h={left:0,width:e.width,height:p,top:d,index:c},m=i.getValueAt(c,n),u=i.getCellRenderer(c,n),b=u?"":`${m}`,g={parent:l,geo:h,rowIndex:c,columnIndex:n,areaIdent:t,sideIdent:s,text:b},f=this.dom.addColumnDiv(g);let x;u&&(x=u.render(f,c,n,t,i,m,this.dom.domService),x&&this.cleanupFunctions[t].push(x));const v=i.getCustomClassesAt(c,n);v.length&&this.dom.addClasses(v,f);const A=this.tableModel.getColumnDef(n);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],f),this.dom.addColumnBorderDivs(this.tableOptions,l,h,t,s);const w=i.getCustomStyleAt(c,n);if(w)for(const y in w)this.dom.setStyle(f,y,w[y]);o=o+p}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,n,l,c,d,p){let h=!1;if(!e&&t&&s.isSelectable(i,r)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const u=m.getSelectionCount(i,r);h=u>0;for(let b=0;b<u;b++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${c}px`),this.dom.setStyle(g,"width",`${d}px`),this.dom.setStyle(g,"height",`${p}px`)}}}return h}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:n,width:l,height:c,parent:d,cellSelected:p,lastRowOfModel:h}){const[m,u]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:c,top:n,parent:d,lastRowOfModel:h});p&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,m),u&&this.cleanupFunctions[t].push(u)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,d=l.createElement("div");l.setAttribute(d,"data-col-index",`${t}`),l.setAttribute(d,"data-row-index",`${e}`),l.setAttribute(d,"data-area","header"),l.setAttribute(d,"data-ge-action","resize-column"),l.addClass(d,"ge-table-column-resize-handle"),l.setStyle(d,"display","clip"),l.setStyle(d,"position","absolute"),l.setStyle(d,"cursor","col-resize"),l.setStyle(d,"left",`${o+i-c}px`),l.setStyle(d,"top",`${s}px`),l.setStyle(d,"width",`${c}px`),l.setStyle(d,"height",`${r}px`),l.appendChild(n,d)}}class qe{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Je{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=q(o),n=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class Ze{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Z{constructor(e){this.cells=e}static createSingle(e,t){return new Z([new Ze(e,t)])}}class Qe{constructor(e){var t,o;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(o=this.tableScope.tableOptions)!=null&&o.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,n,l,c,d,p;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const h=this.getSelectionModel(),m=this.getFocusModel();h&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(m),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||h.hasSelection()&&(h.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(h.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)?(h.removeSelection(E.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(p=e.originalEvent)!=null&&p.metaKey?(h.addSelection(E.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(h.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(h))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return E.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class et{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class tt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}function ot(a){return a.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).filter((e,t,o)=>o.indexOf(e)===t).sort((e,t)=>{const o={cmd:1,ctrl:2,alt:3,shift:4},s=o[e]||5,i=o[t]||5;return s!==i?s-i:e.localeCompare(t)}).join(" ")}function oe(a){let e=a.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&a.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),a.code.startsWith("Numpad")){const o=a.code.replace("Numpad","").toLowerCase();o==="add"?e="num_add":o==="subtract"?e="num_subtract":o==="multiply"?e="num_multiply":o==="divide"?e="num_divide":o==="decimal"?e="num_decimal":o==="enter"?e="num_enter":e="num_"+o}a.code.match(/^F\d+$/)&&(e=a.code.toLowerCase()),a.code.match(/^Digit\d+$/)&&(e=a.code.replace(/Digit/g,""));let t="";return a.ctrlKey&&(t+=" ctrl"),a.altKey&&(t+=t+" alt"),a.shiftKey&&(t+=t+" shift"),a.metaKey&&(t+=t+" cmd"),ot(t+" "+e)}class st{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this)))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new tt().get()):Object.assign(this.shortcutActionIdMapping,new et().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=oe(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const o in this.shortcutActionIdMapping)if(oe(e)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[o]),this.shortcutActionIdMapping[o]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class se{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Re{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,o){e.setAttribute(t,o)}}class it{render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
|
|
11
|
+
render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),this.colAndRowspanModels&&this.colAndRowspanModels[e]){const f=((g=this.colAndRowspanModels[e])==null?void 0:g.getRanges())??[];if(f.length)for(const x of f){let v=0,A=s.child,w="center";if(x.c1<b)A=o.child,w="west";else if(u>0&&x.c1>=m-u)A=i.child,w="east";else{const y=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();v=this.scrollFactorX*y-this.areaBodyWestGeo.width,w="center"}this.drawBigCell(x,v,t,d,A,w)}}}drawBigCell(e,t,o,s,i,r){const n=o+this.getRowHeights(0,e.r1-1,s).reduce((g,f)=>g+f,0),l=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let d=0;c>0&&e.c1>=l-c&&(d=l-c);const p=t+this.getColumnWidths(d,e.c1-1).reduce((g,f)=>g+f,0),h=this.getRowHeights(e.r1,e.r2,s).reduce((g,f)=>g+f,0),m=this.getColumnWidths(e.c1,e.c2).reduce((g,f)=>g+f,0);let u=!1;const b=this.getSelectionModel?this.getSelectionModel():void 0;b&&(u=b.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:p,top:n,width:m,height:h,parent:i,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:s,areaIdent:s.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:p,top:n,width:m,height:h,parent:i,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}),s.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:p,cellTop:n,cellWidth:m,cellHeight:h,parent:i})}findRowOfImportantRowspanCell(e,t,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:c=!1,lastRowOfModel:d=!1}){var b;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let p=0;if(!c){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();p=this.scrollFactorX*g}const h=0,m=!!(e==="body"&&t);let u=p;for(let g=n;g<=l;g++){const f=u,x=this.tableModel.getColumnWidth(g);if(x>0&&f+x>0){let v=s.height;const A=o.getRowspanAt(r,g),w=o.getColspanAt(r,g);A>1&&(v=this.getRowHeights(r,r+A-1,o).reduce((_,M)=>_+M,0));let y=x;w>1&&(y=this.getColumnWidths(g,g+w-1).reduce((_,M)=>_+M,0));let T=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(b=this.colAndRowspanModels[e])!=null&&b.isInRange(r,g)&&(T=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,f,h,y,v);const _={left:f,top:h,width:y,height:v};this.dom.addColumnBorderDivs(this.tableOptions,i,_,e,t)}else{const _=this.renderSelectedBackgroundDiv(T,m,t,o,r,g,i,f,h,y,v);"gammaCells"in o&&o.getValueAt(r,g)&&(T=!1),T||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:f,top:h,width:y,height:v,parent:i,cellSelected:_,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:f,cellTop:h,cellWidth:y,cellHeight:v,parent:i})}}if(u=u+x,u>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new D(u-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:n,height:l,top:c,parent:d,lastRowOfModel:p}){var ee;const m=this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(s,i),u={left:r,width:n,height:l,top:c,index:i},b=e.getRowByIndex(s);let g="none";if(i===this.getTreeArrowColumnIndex()&&H(b)){const C=b;(ee=C.children)!=null&&ee.length?C.expanded?g="expanded":g="collapsed":g="hidden"}let x;if(t==="header"){const C=this.tableModel.getColumnDef(i);(!(C!=null&&C.sortIconVisible)||C!=null&&C.sortIconVisible())&&(x=C==null?void 0:C.sortState)}const v=e.getValueAt(s,i),A=m?"":`${v}`,w=e.isRowChecked(s),y=this.dom.addColumnDiv({parent:d,geo:u,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:A,treeArrow:g,tableOptions:this.tableOptions,checkedType:w,sortState:x}),T=e.getTooltipAt(s,i);T&&this.dom.setAttribute(y,"title",T);const _=this.tableModel.getColumnDef(i);_&&_.classes[t]&&this.dom.addClasses(_.classes[t],y);let M;m&&(M=m.render(y,s,i,t,e,v,this.dom.domService));const B=e.getCustomClassesAt(s,i);if(B.length&&this.dom.addClasses(B,y),this.dom.addColumnBorderDivs(this.tableOptions,d,u,t,o),p&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:c+l},d),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(s,i)&&this.dom.addFocusBorderDivs(d,u,{})}t==="header"&&this.dom.setAttribute(y,"data-ge-action","drag-column");const z=e.getCustomStyleAt(s,i);if(z)for(const C in z)this.dom.setStyle(y,C,z[C]);return[y,M]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:s+"px",width:t+"px",height:o+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const d={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,d),o&&this.renderContentOfDraggingColumn(d)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let c=0;c<r;c++){const d=o,p=i.getRowHeight(c),h={left:0,width:e.width,height:p,top:d,index:c},m=i.getValueAt(c,n),u=i.getCellRenderer(c,n),b=u?"":`${m}`,g={parent:l,geo:h,rowIndex:c,columnIndex:n,areaIdent:t,sideIdent:s,text:b},f=this.dom.addColumnDiv(g);let x;u&&(x=u.render(f,c,n,t,i,m,this.dom.domService),x&&this.cleanupFunctions[t].push(x));const v=i.getCustomClassesAt(c,n);v.length&&this.dom.addClasses(v,f);const A=this.tableModel.getColumnDef(n);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],f),this.dom.addColumnBorderDivs(this.tableOptions,l,h,t,s);const w=i.getCustomStyleAt(c,n);if(w)for(const y in w)this.dom.setStyle(f,y,w[y]);o=o+p}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,n,l,c,d,p){let h=!1;if(!e&&t&&s.isSelectable(i,r)&&this.getSelectionModel){const m=this.getSelectionModel();if(m){const u=m.getSelectionCount(i,r);h=u>0;for(let b=0;b<u;b++){const g=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${c}px`),this.dom.setStyle(g,"width",`${d}px`),this.dom.setStyle(g,"height",`${p}px`)}}}return h}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:n,width:l,height:c,parent:d,cellSelected:p,lastRowOfModel:h}){const[m,u]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:c,top:n,parent:d,lastRowOfModel:h});p&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,m),u&&this.cleanupFunctions[t].push(u)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,d=l.createElement("div");l.setAttribute(d,"data-col-index",`${t}`),l.setAttribute(d,"data-row-index",`${e}`),l.setAttribute(d,"data-area","header"),l.setAttribute(d,"data-ge-action","resize-column"),l.addClass(d,"ge-table-column-resize-handle"),l.setStyle(d,"display","clip"),l.setStyle(d,"position","absolute"),l.setStyle(d,"cursor","col-resize"),l.setStyle(d,"left",`${o+i-c}px`),l.setStyle(d,"top",`${s}px`),l.setStyle(d,"width",`${c}px`),l.setStyle(d,"height",`${r}px`),l.appendChild(n,d)}}class qe{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Je{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=q(o),n=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class Ze{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Z{constructor(e){this.cells=e}static createSingle(e,t){return new Z([new Ze(e,t)])}}class Qe{constructor(e,t,o,s,i,r,n,l){this.scrollTop=e,this.scrollLeft=t,this.scrollHeight=o,this.scrollWidth=s,this.clientHeight=i,this.clientWidth=r,this.scrollFactorY=n,this.scrollFactorX=l}}class et{constructor(e){var t,o;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(o=this.tableScope.tableOptions)!=null&&o.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,n,l,c,d,p;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const h=this.getSelectionModel(),m=this.getFocusModel();h&&m&&(m.hasFocus(e.rowIndex,e.columnIndex)||(m.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(m),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||h.hasSelection()&&(h.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(h.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)?(h.removeSelection(E.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(p=e.originalEvent)!=null&&p.metaKey?(h.addSelection(E.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(h.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(h))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return E.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class tt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class ot{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}function st(a){return a.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).filter((e,t,o)=>o.indexOf(e)===t).sort((e,t)=>{const o={cmd:1,ctrl:2,alt:3,shift:4},s=o[e]||5,i=o[t]||5;return s!==i?s-i:e.localeCompare(t)}).join(" ")}function oe(a){let e=a.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&a.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),a.code.startsWith("Numpad")){const o=a.code.replace("Numpad","").toLowerCase();o==="add"?e="num_add":o==="subtract"?e="num_subtract":o==="multiply"?e="num_multiply":o==="divide"?e="num_divide":o==="decimal"?e="num_decimal":o==="enter"?e="num_enter":e="num_"+o}a.code.match(/^F\d+$/)&&(e=a.code.toLowerCase()),a.code.match(/^Digit\d+$/)&&(e=a.code.replace(/Digit/g,""));let t="";return a.ctrlKey&&(t+=" ctrl"),a.altKey&&(t+=t+" alt"),a.shiftKey&&(t+=t+" shift"),a.metaKey&&(t+=t+" cmd"),st(t+" "+e)}class it{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this)))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new ot().get()):Object.assign(this.shortcutActionIdMapping,new tt().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=oe(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const o in this.shortcutActionIdMapping)if(oe(e)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[o]),this.shortcutActionIdMapping[o]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class se{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onScroll(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Re{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,o){e.setAttribute(t,o)}}class rt{render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
|
|
12
12
|
<input
|
|
13
13
|
type="text"
|
|
14
14
|
value="${l}"
|
|
@@ -20,8 +20,8 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
20
20
|
data-col-index="${o}"
|
|
21
21
|
data-input-type="text"
|
|
22
22
|
style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
|
|
23
|
-
class="ge-table-cell-editor-input">`}}}class
|
|
24
|
-
`;let W=O;class
|
|
23
|
+
class="ge-table-cell-editor-input">`}}}class at{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(E.singleRow(e)):this.selectionType==="column"&&this.addRange(E.singleColumn(t))}getSelectionCount(e,t){let o=0;for(const s of this.ranges)s.isInRange(e,t)&&o++;return this.allSelected&&o++,this.isInNegativeRange(e,t)&&(o=0),o}isInNegativeRange(e,t){for(const o of this.negativeRanges)if(o.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.fireChangeEvent()}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(){const e=new Set;for(const t of this.ranges)for(let o=t.r1;o<=t.r2;o++)!e.has(o)&&!this.isInNegativeRange(o,0)&&e.add(o);return Array.from(e)}selectAll(){this.allSelected=!0,this.fireChangeEvent()}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e),this.fireChangeEvent()}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=E.singleRow(e.r1):this.selectionType==="column"&&(t=E.singleColumn(e.c1)),this.negativeRanges.push(t),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(E.singleCell(e,t)):this.addSelection(E.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e),this.fireChangeEvent())}}class lt{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1,this.listenerArr=[]}getEventFocusChangedListeners(){return this.listenerArr}addEventFocusChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventFocusChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.listenerArr.forEach(e=>e.onFocusChanged(this))}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1,this.fireChangeEvent()}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0,this.fireChangeEvent())}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class Ee{constructor(e=new k("❯","",["gt-table-icon-expanded"]),t=new k("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const nt=new at,ct=new lt("cell");class _e{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new Ce,this.headerGroupOptions=new Ee,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Ae,this.sortOrder=["asc","desc"],this.shortcutActionsDisabled=!1,this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,t)=>new rt,this.getSelectionModel=()=>nt,this.getFocusModel=()=>ct}}const O=class O{createContent(e,t,o){return new Promise((s,i)=>{if(t!=null&&t.hasSelection()){const r=this.mergeRanges(t.getRanges());if(r){r.c2=Math.min(r.c2,e.getColumnCount()-1),r.r2=Math.min(r.r2,e.getBodyModel().getRowCount()-1);const n=[];for(let l=r.r1;l<=r.r2;l++){const c=[];for(let d=r.c1;d<=r.c2;d++){const p=t.isSelected(l,d)?e.getBodyModel().getTextValueAt(l,d):"";c.push(p)}n.push(c.join(O.columnSeparatorChar))}return s(n.join(O.rowSeparatorChar))}}if(o){const[r,n]=o.getFocus(),l=e.getBodyModel().getTextValueAt(r,n);return s(l)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,o){return new Promise((s,i)=>{this.createContent(e,t,o).then(r=>{r&&this.copyContent(r).then(n=>{s(r)}).catch(n=>{i()})}).catch(r=>{i()})})}mergeRanges(e){let t;for(const o of e)t?(t.r1=Math.min(t.r1,o.r1),t.c1=Math.min(t.c1,o.c1),t.r2=Math.max(t.r2,o.r2),t.c2=Math.max(t.c2,o.c2)):t=new E(o.r1,o.c1,o.r2,o.c2);return t}};O.columnSeparatorChar=" ",O.rowSeparatorChar=`
|
|
24
|
+
`;let W=O;class dt{constructor(e,t=500){this.tableScope=e,this.debounceDelay=t,new ResizeObserver(Oe(this.handleResize.bind(this),t)).observe(this.tableScope.hostElement)}handleResize(e){const t=e[0],{width:o}=t.contentRect;this.tableScope.recalcColumnWidths(o)}}class ht{downloadExcel(e,t="file.xlsx",o=""){if(!Array.isArray(e)||e.some(s=>!Array.isArray(s)))throw new Error("Invalid matrix format. Expected a 2D array.");if((t==null?void 0:t.trim())==="")throw new Error("Invalid filename. Filename must be a non-empty string.");try{const s=this.generateBuffer(e,o),i=new Blob([s],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(s){throw console.error("Error generating Excel file:",s),new Error("Failed to download Excel file.")}}generateMap(e,t=""){const o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
25
25
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`,s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
26
26
|
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>Microsoft Macintosh Excel</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="2" baseType="variant"><vt:variant><vt:lpstr>Worksheets</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="1" baseType="lpstr"><vt:lpstr>Sheet1</vt:lpstr></vt:vector></TitlesOfParts><Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>16.0300</AppVersion></Properties>`,i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
27
27
|
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>${t}</dc:creator><cp:lastModifiedBy>${t}</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">2024-12-13T19:45:08Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2024-12-13T19:45:35Z</dcterms:modified></cp:coreProperties>`,r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -37,7 +37,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
37
37
|
<sheetView tabSelected="1" workbookViewId="0"/></sheetViews>
|
|
38
38
|
<sheetFormatPr baseColWidth="10" defaultRowHeight="16" x14ac:dyDescent="0.2"/>
|
|
39
39
|
<sheetData>`);for(let o=0;o<e.length;o++){const s=e[o];t.push('<row r="${r + 1}" spans="1:2" x14ac:dyDescent="0.2">');for(let i=0;i<s.length;i++){const r=s[i],n=this.getCellAddress(o,i);if(typeof r=="number")t.push(`<c r="${n}"><v>${r}</v></c>`);else if(r instanceof Date){const l=r;t.push(`<c r="${n}" t="inlineStr"><is><t>${l.toISOString()}</t></is></c>`)}else{const l=r!=null?this.escapeXml(String(r)):"";t.push(`<c r="${n}" t="inlineStr"><is><t>${l}</t></is></c>`)}}t.push("</row>")}return t.push(""),t.push(""),t.push('</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>'),t.push("</worksheet>"),t.join(`
|
|
40
|
-
`)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getCellAddress(e,t){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let s="";for(;t>=0;)s=o[t%26]+s,t=Math.floor(t/26)-1;return`${s}${e+1}`}createZip(e){const t=[];let o=0;const s=[];e.forEach((p,h)=>{const m=new TextEncoder().encode(h),u=new TextEncoder().encode(p),b=new Uint8Array(30+m.length),g=new DataView(b.buffer);b.set([80,75,3,4],0),g.setUint16(4,20,!0),g.setUint16(6,0,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint32(14,0,!0),g.setUint32(18,u.length,!0),g.setUint32(22,u.length,!0),g.setUint16(26,m.length,!0),g.setUint16(28,0,!0),b.set(m,30),t.push(b,u),s.push({path:h,offset:o,contentSize:u.length}),o+=b.length+u.length});const i=o;s.forEach(p=>{const h=new TextEncoder().encode(p.path),m=new Uint8Array(46+h.length),u=new DataView(m.buffer);m.set([80,75,1,2],0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,0,!0),u.setUint16(10,0,!0),u.setUint16(12,0,!0),u.setUint16(14,0,!0),u.setUint32(16,0,!0),u.setUint32(20,p.contentSize,!0),u.setUint32(24,p.contentSize,!0),u.setUint16(28,h.length,!0),u.setUint16(30,0,!0),u.setUint16(32,0,!0),u.setUint16(34,0,!0),u.setUint16(36,0,!0),u.setUint32(38,0,!0),u.setUint32(42,p.offset,!0),m.set(h,46),t.push(m),o+=m.length});const r=new Uint8Array(22),n=new DataView(r.buffer);r.set([80,75,5,6],0),n.setUint16(4,0,!0),n.setUint16(6,0,!0),n.setUint16(8,s.length,!0),n.setUint16(10,s.length,!0),n.setUint32(12,o-i,!0),n.setUint32(16,i,!0),n.setUint16(20,0,!0),t.push(r);const l=t.reduce((p,h)=>p+h.length,0),c=new Uint8Array(l);let d=0;for(const p of t)c.set(p,d),d+=p.length;return c}generateBuffer(e,t=""){const o=this.generateMap(e,t);return this.createZip(o)}}class Q extends Ye{constructor(e,t,o,s,i,r=new W,n=new dt){var d;if(super(e,t,new Be(o),s),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=L.getInstance(),this.selectionService=new Qe(this),this.api=new $e(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastContextmenu=Date.now(),t.setTableScope(this),i||(this.eventListener=new se),(d=this.tableOptions)!=null&&d.autoRestoreOptions){const p=this.tableOptions.autoRestoreOptions,h=p.getStorageKeyFn;h&&(p.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new Ne(h)),p.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new Ge(h)),p.autoRestoreSortingState&&(this.storeSortingService=new Ue(h)))}this.mouseHandler=new Ve(this),this.inputHandler=new Je(this),this.resizeHandler=new ct(this,s.resizeEventDebounceDelay),this.shortcutService=new st(this),this.shortcutService.addListener(this.selectionService);const l=this.getSelectionModel?this.getSelectionModel():void 0;l&&l.addEventSelectionChangedListener(this);const c=this.getFocusModel?this.getFocusModel():void 0;c&&c.addEventFocusChangedListener(this)}static create(e,t,o=new _e,s=new se,i=new Re,r=new W){return new Q(e,t,i,o,s,r)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[o,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,s)&&(this.clearSelection(),this.initRenderEditor(o,s))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,o).then(s=>this.copyService.copyContent(s))}return!1}updateModelValueAfterEdit(e,t,o,s){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,s)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(Z.createSingle(t,o)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new Y;if(t.originalEvent=e,e){const o=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(o),t.rowIndex=this.getNumberByAttr(o,"data-row-index"),t.columnIndex=this.getNumberByAttr(o,"data-col-index"),t.action=this.getStringByAttr(o,"data-ge-action"),t.areaIdent){const s=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=s.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const s=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,s)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var o,s;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(o=e.originalEvent)==null||o.preventDefault(),(s=e.originalEvent)==null||s.stopImmediatePropagation();return}this.lastContextmenu=t,this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var o;const t=this.tableModel.getBodyModel();X(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l;const s=this.tableModel.getAreaModel(o),i=s.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";s.setRowChecked(e,r),this.repaint();const n=(l=s.rowSelectionModel)==null?void 0:l.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const s=this.getFocusModel();s&&(o=s.hasChanged(),s.clearChanged())}return o}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,o){var i,r;const s=this.tableModel.getColumnDef(o);if(s!=null&&s.sortable&&s.sortable()){e.preventDefault(),e.stopPropagation();const n=s.sortStatesOrder?s.sortStatesOrder:this.tableOptions.sortOrder,l=s.sortState??"",c=n[(n.indexOf(l)+1)%n.length],d=new qe(o,c);this.tableModel.doSort([d])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(h=>h.sortState=""),s.sortState=c),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const s=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,s)}setSelectionModel(e,t=!1){const o=()=>e;this.tableOptions.getSelectionModel=o,this.getSelectionModel=o,this.selectionService.getSelectionModel=o,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const o=this.getFocusModel();if(o){const[s,i]=o.getFocus();return o.setFocus(s+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var o;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(o=this.mouseHandler.mouseEvent)==null?void 0:o.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const o=this.storeScrollPosStateService.getScrollOffset();o&&this.scrollViewport.scrollTo(...o)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const o=this.storeSortingService.getSortItems();o!=null&&o.length&&this.tableModel.getBodyModel().doSort(o)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const o=this.tableOptions.autoRestoreOptions,s=o.getRowId;if(o.autoRestoreCollapsedExpandedState&&s){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(X(r)){const n=r,l=r.getRowCount();for(let c=0;c<l;c++){const d=r.getRowByIndex(c);if(d)if(i.allExpanded)d.expanded=!0;else if(i.allCollapsed)d.expanded=!1;else{const p=s(d.data);i.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(p):i.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(p))}}n.recalcVisibleTreeRows()}}}}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount(),o=(e==null?void 0:e.getRowCount())??0;if(!e)return console.warn("Body model is not available."),[];const s=new Array(t).fill(0);for(let i=0;i<o;i++)for(let r=0;r<t;r++){const n=e.getValueAt(i,r),l=(n==null?void 0:n.toString().length)||0;l>s[r]&&(s[r]=l)}return s.map(i=>Math.max(i*10,50))}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let o=0;o<t.length;o++){const s=t[o];this.tableModel.setColumnWidth(o,s)}e&&this.recalcWrappers()}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){var t;let e=((t=this.storeSortingService)==null?void 0:t.getSortItems())??[];this.tableModel.doSort(e)}sort(e){this.tableModel.sort(e)}ensureRowIsVisible(e){const t=this.getFirstFullVisibleRowIndex(),o=this.getLastFullVisibleRowIndex(),s=this.getDisplayedRowCount();return e<t?(this.scrollToIndex(0,e),!0):e>o?(this.scrollToIndex(0,e-s+1),!0):!1}}const $=class ${};$.themes=["light","combat","paper","blackboard"],$.vars={light:`html[data-theme="light"] {
|
|
40
|
+
`)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getCellAddress(e,t){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let s="";for(;t>=0;)s=o[t%26]+s,t=Math.floor(t/26)-1;return`${s}${e+1}`}createZip(e){const t=[];let o=0;const s=[];e.forEach((p,h)=>{const m=new TextEncoder().encode(h),u=new TextEncoder().encode(p),b=new Uint8Array(30+m.length),g=new DataView(b.buffer);b.set([80,75,3,4],0),g.setUint16(4,20,!0),g.setUint16(6,0,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint32(14,0,!0),g.setUint32(18,u.length,!0),g.setUint32(22,u.length,!0),g.setUint16(26,m.length,!0),g.setUint16(28,0,!0),b.set(m,30),t.push(b,u),s.push({path:h,offset:o,contentSize:u.length}),o+=b.length+u.length});const i=o;s.forEach(p=>{const h=new TextEncoder().encode(p.path),m=new Uint8Array(46+h.length),u=new DataView(m.buffer);m.set([80,75,1,2],0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,0,!0),u.setUint16(10,0,!0),u.setUint16(12,0,!0),u.setUint16(14,0,!0),u.setUint32(16,0,!0),u.setUint32(20,p.contentSize,!0),u.setUint32(24,p.contentSize,!0),u.setUint16(28,h.length,!0),u.setUint16(30,0,!0),u.setUint16(32,0,!0),u.setUint16(34,0,!0),u.setUint16(36,0,!0),u.setUint32(38,0,!0),u.setUint32(42,p.offset,!0),m.set(h,46),t.push(m),o+=m.length});const r=new Uint8Array(22),n=new DataView(r.buffer);r.set([80,75,5,6],0),n.setUint16(4,0,!0),n.setUint16(6,0,!0),n.setUint16(8,s.length,!0),n.setUint16(10,s.length,!0),n.setUint32(12,o-i,!0),n.setUint32(16,i,!0),n.setUint16(20,0,!0),t.push(r);const l=t.reduce((p,h)=>p+h.length,0),c=new Uint8Array(l);let d=0;for(const p of t)c.set(p,d),d+=p.length;return c}generateBuffer(e,t=""){const o=this.generateMap(e,t);return this.createZip(o)}}class Q extends Ye{constructor(e,t,o,s,i,r=new W,n=new ht){var d;if(super(e,t,new Be(o),s),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=L.getInstance(),this.selectionService=new et(this),this.api=new $e(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastContextmenu=Date.now(),t.setTableScope(this),i||(this.eventListener=new se),(d=this.tableOptions)!=null&&d.autoRestoreOptions){const p=this.tableOptions.autoRestoreOptions,h=p.getStorageKeyFn;h&&(p.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new Ne(h)),p.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new Ge(h)),p.autoRestoreSortingState&&(this.storeSortingService=new Ue(h)))}this.mouseHandler=new Ve(this),this.inputHandler=new Je(this),this.resizeHandler=new dt(this,s.resizeEventDebounceDelay),this.shortcutService=new it(this),this.shortcutService.addListener(this.selectionService);const l=this.getSelectionModel?this.getSelectionModel():void 0;l&&l.addEventSelectionChangedListener(this);const c=this.getFocusModel?this.getFocusModel():void 0;c&&c.addEventFocusChangedListener(this)}static create(e,t,o=new _e,s=new se,i=new Re,r=new W){return new Q(e,t,i,o,s,r)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[o,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,s)&&(this.clearSelection(),this.initRenderEditor(o,s))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,o).then(s=>this.copyService.copyContent(s))}return!1}updateModelValueAfterEdit(e,t,o,s){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,s)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(Z.createSingle(t,o)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new Y;if(t.originalEvent=e,e){const o=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(o),t.rowIndex=this.getNumberByAttr(o,"data-row-index"),t.columnIndex=this.getNumberByAttr(o,"data-col-index"),t.action=this.getStringByAttr(o,"data-ge-action"),t.areaIdent){const s=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=s.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const s=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,s)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var o,s;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(o=e.originalEvent)==null||o.preventDefault(),(s=e.originalEvent)==null||s.stopImmediatePropagation();return}this.lastContextmenu=t,this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var o;const t=this.tableModel.getBodyModel();X(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l;const s=this.tableModel.getAreaModel(o),i=s.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";s.setRowChecked(e,r),this.repaint();const n=(l=s.rowSelectionModel)==null?void 0:l.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const s=this.getFocusModel();s&&(o=s.hasChanged(),s.clearChanged())}return o}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,o){var i,r;const s=this.tableModel.getColumnDef(o);if(s!=null&&s.sortable&&s.sortable()){e.preventDefault(),e.stopPropagation();const n=s.sortStatesOrder?s.sortStatesOrder:this.tableOptions.sortOrder,l=s.sortState??"",c=n[(n.indexOf(l)+1)%n.length],d=new qe(o,c);this.tableModel.doSort([d])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(h=>h.sortState=""),s.sortState=c),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const s=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,s)}adjustAfterScrolling(){super.adjustAfterScrolling();const e=this.scrollViewport;this.eventListener.onScroll(new Qe(this.scrollTop,this.scrollLeft,e.scrollHeight,e.scrollWidth,e.clientHeight,e.clientWidth,this.scrollFactorY,this.scrollFactorX))}setSelectionModel(e,t=!1){const o=()=>e;this.tableOptions.getSelectionModel=o,this.getSelectionModel=o,this.selectionService.getSelectionModel=o,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const o=this.getFocusModel();if(o){const[s,i]=o.getFocus();return o.setFocus(s+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var o;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(o=this.mouseHandler.mouseEvent)==null?void 0:o.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const o=this.storeScrollPosStateService.getScrollOffset();o&&this.scrollViewport.scrollTo(...o)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const o=this.storeSortingService.getSortItems();o!=null&&o.length&&this.tableModel.getBodyModel().doSort(o)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const o=this.tableOptions.autoRestoreOptions,s=o.getRowId;if(o.autoRestoreCollapsedExpandedState&&s){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(X(r)){const n=r,l=r.getRowCount();for(let c=0;c<l;c++){const d=r.getRowByIndex(c);if(d)if(i.allExpanded)d.expanded=!0;else if(i.allCollapsed)d.expanded=!1;else{const p=s(d.data);i.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(p):i.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(p))}}n.recalcVisibleTreeRows()}}}}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount(),o=(e==null?void 0:e.getRowCount())??0;if(!e)return console.warn("Body model is not available."),[];const s=new Array(t).fill(0);for(let i=0;i<o;i++)for(let r=0;r<t;r++){const n=e.getValueAt(i,r),l=(n==null?void 0:n.toString().length)||0;l>s[r]&&(s[r]=l)}return s.map(i=>Math.max(i*10,50))}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let o=0;o<t.length;o++){const s=t[o];this.tableModel.setColumnWidth(o,s)}e&&this.recalcWrappers()}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){var t;let e=((t=this.storeSortingService)==null?void 0:t.getSortItems())??[];this.tableModel.doSort(e)}sort(e){this.tableModel.sort(e)}ensureRowIsVisible(e){const t=this.getFirstFullVisibleRowIndex(),o=this.getLastFullVisibleRowIndex(),s=this.getDisplayedRowCount();return e<t?(this.scrollToIndex(0,e),!0):e>o?(this.scrollToIndex(0,e-s+1),!0):!1}}const $=class ${};$.themes=["light","combat","paper","blackboard"],$.vars={light:`html[data-theme="light"] {
|
|
41
41
|
--ge-table-bg: rgba(255,255,255, 0.5);
|
|
42
42
|
--ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
|
|
43
43
|
--ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
|
|
@@ -270,4 +270,4 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
270
270
|
data-area="${t}"
|
|
271
271
|
data-row-index="${o}"
|
|
272
272
|
data-col-index="${s}"
|
|
273
|
-
>${i}</span>`}addArrowDiv(e,t,o=!0,s=-1,i=-1,r="header",n){const l=e.createElement("div");e.addClass(l,"ge-table-toggle-icon-div"),e.setStyle(l,"display","inline-block"),e.setStyle(l,"position",""),e.setStyle(l,"width","20px"),e.setStyle(l,"background","transparent"),e.setStyle(l,"cursor","pointer"),e.setAttribute(l,"data-row-index",`${s}`),e.setAttribute(l,"data-col-index",`${i}`),e.setAttribute(l,"data-area",`${r}`),e.setAttribute(l,"data-ge-action",`${n}`);let c;o?c=this.headerGroupOptions.iconExpanded:c=this.headerGroupOptions.iconCollapsed;const d=c.content,p=e.createText(d);e.appendChild(l,p),c.style&&this.applyStyleString(e,l,c.style);for(const h of c.classes)e.addClass(l,h);return e.appendChild(t,l),l}applyStyleString(e,t,o){const s=o.split(";").map(i=>i.trim()).filter(i=>i);for(const i of s){const[r,n]=i.split(":");e.setStyle(t,r.trim(),n.trim())}}};N.toggleHeaderGroup="toggleHeaderGroup";let re=N;class
|
|
273
|
+
>${i}</span>`}addArrowDiv(e,t,o=!0,s=-1,i=-1,r="header",n){const l=e.createElement("div");e.addClass(l,"ge-table-toggle-icon-div"),e.setStyle(l,"display","inline-block"),e.setStyle(l,"position",""),e.setStyle(l,"width","20px"),e.setStyle(l,"background","transparent"),e.setStyle(l,"cursor","pointer"),e.setAttribute(l,"data-row-index",`${s}`),e.setAttribute(l,"data-col-index",`${i}`),e.setAttribute(l,"data-area",`${r}`),e.setAttribute(l,"data-ge-action",`${n}`);let c;o?c=this.headerGroupOptions.iconExpanded:c=this.headerGroupOptions.iconCollapsed;const d=c.content,p=e.createText(d);e.appendChild(l,p),c.style&&this.applyStyleString(e,l,c.style);for(const h of c.classes)e.addClass(l,h);return e.appendChild(t,l),l}applyStyleString(e,t,o){const s=o.split(";").map(i=>i.trim()).filter(i=>i);for(const i of s){const[r,n]=i.split(":");e.setStyle(t,r.trim(),n.trim())}}};N.toggleHeaderGroup="toggleHeaderGroup";let re=N;class pt extends S.Component{constructor(t){super(t);te(this,"ref",S.createRef())}componentDidMount(){const t=this.ref.current;this.initTable(t,this.props)}componentWillUnmount(){}initTable(t,o){const s={onSelectionChanged(r){o.selectionChanged&&o.selectionChanged(r)},onFocusChanged(r){o.focusChanged&&o.focusChanged(r)},onCheckboxChanged:r=>{o.checkboxChanged&&o.checkboxChanged(r)},onContextmenu:r=>{o.contextmenu&&o.contextmenu(r)},onModelChanged:r=>{o.modelChanged&&o.modelChanged(r)},onMouseClicked:r=>{o.mouseClicked&&o.mouseClicked(r)},onMouseDragging:r=>{o.mouseDragging&&o.mouseDragging(r)},onMouseDraggingEnd:r=>{o.mouseDraggingEnd&&o.mouseDraggingEnd(r)},onMouseMoved:r=>{},onScroll(r){}},i=new Q(t,o.tableModel,new Re,o.tableOptions??new _e,s);i.firstInit(),o.tableReady&&o.tableReady(i.getApi()),o.licenseKey&&L.getInstance().setLicenseKey(o.licenseKey)}render(){return Le.jsx("div",{ref:this.ref,className:"container-div",style:{width:"100%",height:"100%",backgroundColor:"transparent",padding:"0",margin:"0"}})}}var F,G,ae,Me=[],U=[],R=S.options,le=R.__b,ne=R.__r,ce=R.diffed,de=R.__c,he=R.unmount,pe=R.__;function ut(){for(var a;a=Me.shift();)if(a.__P&&a.__H)try{a.__H.__h.forEach(V),a.__H.__h.forEach(K),a.__H.__h=[]}catch(e){a.__H.__h=[],R.__e(e,a.__v)}}R.__b=function(a){F=null,le&&le(a)},R.__=function(a,e){e.__k&&e.__k.__m&&(a.__m=e.__k.__m),pe&&pe(a,e)},R.__r=function(a){ne&&ne(a);var e=(F=a.__c).__H;e&&(G===F?(e.__h=[],F.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=U,t.__N=t.i=void 0})):(e.__h.forEach(V),e.__h.forEach(K),e.__h=[])),G=F},R.diffed=function(a){ce&&ce(a);var e=a.__c;e&&e.__H&&(e.__H.__h.length&&(Me.push(e)!==1&&ae===R.requestAnimationFrame||((ae=R.requestAnimationFrame)||gt)(ut)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==U&&(t.__=t.__V),t.i=void 0,t.__V=U})),G=F=null},R.__c=function(a,e){e.some(function(t){try{t.__h.forEach(V),t.__h=t.__h.filter(function(o){return!o.__||K(o)})}catch(o){e.some(function(s){s.__h&&(s.__h=[])}),e=[],R.__e(o,t.__v)}}),de&&de(a,e)},R.unmount=function(a){he&&he(a);var e,t=a.__c;t&&t.__H&&(t.__H.__.forEach(function(o){try{V(o)}catch(s){e=s}}),t.__H=void 0,e&&R.__e(e,t.__v))};var ue=typeof requestAnimationFrame=="function";function gt(a){var e,t=function(){clearTimeout(o),ue&&cancelAnimationFrame(e),setTimeout(a)},o=setTimeout(t,100);ue&&(e=requestAnimationFrame(t))}function V(a){var e=F,t=a.__c;typeof t=="function"&&(a.__c=void 0,t()),F=e}function K(a){var e=F;a.__c=a.__(),F=e}function ft(a,e){for(var t in e)a[t]=e[t];return a}function ge(a,e){for(var t in a)if(t!=="__source"&&!(t in e))return!0;for(var o in e)if(o!=="__source"&&a[o]!==e[o])return!0;return!1}function fe(a,e){this.props=a,this.context=e}(fe.prototype=new S.Component).isPureReactComponent=!0,fe.prototype.shouldComponentUpdate=function(a,e){return ge(this.props,a)||ge(this.state,e)};var me=S.options.__b;S.options.__b=function(a){a.type&&a.type.__f&&a.ref&&(a.props.ref=a.ref,a.ref=null),me&&me(a)};var mt=S.options.__e;S.options.__e=function(a,e,t,o){if(a.then){for(var s,i=e;i=i.__;)if((s=i.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(a,e)}mt(a,e,t,o)};var be=S.options.unmount;function Te(a,e,t){return a&&(a.__c&&a.__c.__H&&(a.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),a.__c.__H=null),(a=ft({},a)).__c!=null&&(a.__c.__P===t&&(a.__c.__P=e),a.__c=null),a.__k=a.__k&&a.__k.map(function(o){return Te(o,e,t)})),a}function Fe(a,e,t){return a&&t&&(a.__v=null,a.__k=a.__k&&a.__k.map(function(o){return Fe(o,e,t)}),a.__c&&a.__c.__P===e&&(a.__e&&t.appendChild(a.__e),a.__c.__e=!0,a.__c.__P=t)),a}function j(){this.__u=0,this.t=null,this.__b=null}function De(a){var e=a.__.__c;return e&&e.__a&&e.__a(a)}function P(){this.u=null,this.o=null}S.options.unmount=function(a){var e=a.__c;e&&e.__R&&e.__R(),e&&32&a.__u&&(a.type=null),be&&be(a)},(j.prototype=new S.Component).__c=function(a,e){var t=e.__c,o=this;o.t==null&&(o.t=[]),o.t.push(t);var s=De(o.__v),i=!1,r=function(){i||(i=!0,t.__R=null,s?s(n):n())};t.__R=r;var n=function(){if(!--o.__u){if(o.state.__a){var l=o.state.__a;o.__v.__k[0]=Fe(l,l.__c.__P,l.__c.__O)}var c;for(o.setState({__a:o.__b=null});c=o.t.pop();)c.forceUpdate()}};o.__u++||32&e.__u||o.setState({__a:o.__b=o.__v.__k[0]}),a.then(r,r)},j.prototype.componentWillUnmount=function(){this.t=[]},j.prototype.render=function(a,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Te(this.__b,t,o.__O=o.__P)}this.__b=null}var s=e.__a&&S.createElement(S.Fragment,null,a.fallback);return s&&(s.__u&=-33),[S.createElement(S.Fragment,null,e.__a?null:a.children),s]};var Se=function(a,e,t){if(++t[1]===t[0]&&a.o.delete(e),a.props.revealOrder&&(a.props.revealOrder[0]!=="t"||!a.o.size))for(t=a.u;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;a.u=t=t[2]}};(P.prototype=new S.Component).__a=function(a){var e=this,t=De(e.__v),o=e.o.get(a);return o[0]++,function(s){var i=function(){e.props.revealOrder?(o.push(s),Se(e,a,o)):s()};t?t(i):i()}},P.prototype.render=function(a){this.u=null,this.o=new Map;var e=S.toChildArray(a.children);a.revealOrder&&a.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.o.set(e[t],this.u=[1,0,this.u]);return a.children},P.prototype.componentDidUpdate=P.prototype.componentDidMount=function(){var a=this;this.o.forEach(function(e,t){Se(a,t,e)})};var bt=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,St=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,yt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wt=/[A-Z0-9]/g,xt=typeof document<"u",vt=function(a){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(a)};function Ct(a,e,t){return e.__k==null&&(e.textContent=""),S.render(a,e),typeof t=="function"&&t(),a?a.__c:null}S.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(a){Object.defineProperty(S.Component.prototype,a,{configurable:!0,get:function(){return this["UNSAFE_"+a]},set:function(e){Object.defineProperty(this,a,{configurable:!0,writable:!0,value:e})}})});var ye=S.options.event;function At(){}function Rt(){return this.cancelBubble}function Et(){return this.defaultPrevented}S.options.event=function(a){return ye&&(a=ye(a)),a.persist=At,a.isPropagationStopped=Rt,a.isDefaultPrevented=Et,a.nativeEvent=a};var _t={enumerable:!1,configurable:!0,get:function(){return this.class}},we=S.options.vnode;S.options.vnode=function(a){typeof a.type=="string"&&function(e){var t=e.props,o=e.type,s={};for(var i in t){var r=t[i];if(!(i==="value"&&"defaultValue"in t&&r==null||xt&&i==="children"&&o==="noscript"||i==="class"||i==="className")){var n=i.toLowerCase();i==="defaultValue"&&"value"in t&&t.value==null?i="value":i==="download"&&r===!0?r="":n==="ondoubleclick"?i="ondblclick":n!=="onchange"||o!=="input"&&o!=="textarea"||vt(t.type)?n==="onfocus"?i="onfocusin":n==="onblur"?i="onfocusout":yt.test(i)?i=n:o.indexOf("-")===-1&&St.test(i)?i=i.replace(wt,"-$&").toLowerCase():r===null&&(r=void 0):n=i="oninput",n==="oninput"&&s[i=n]&&(i="oninputCapture"),s[i]=r}}o=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=S.toChildArray(t.children).forEach(function(l){l.props.selected=s.value.indexOf(l.props.value)!=-1})),o=="select"&&s.defaultValue!=null&&(s.value=S.toChildArray(t.children).forEach(function(l){l.props.selected=s.multiple?s.defaultValue.indexOf(l.props.value)!=-1:s.defaultValue==l.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",_t)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(a),a.$$typeof=bt,we&&we(a)};var xe=S.options.__r;S.options.__r=function(a){xe&&xe(a),a.__c};var ve=S.options.diffed;S.options.diffed=function(a){ve&&ve(a);var e=a.props,t=a.__e;t!=null&&a.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value)};function Mt(a){return!!a.__k&&(S.render(null,a),!0)}function Tt(a){return{render(e){Ct(e,a)},unmount(){Mt(a)}}}class Ft{constructor(e){this.Component=e,console.info(e)}render(e,t,o,s,i,r,n){const l={cellDiv:e,rowIndex:t,columnIndex:o,areaIdent:s,areaModel:i,cellValue:r},c=Tt(e);return c.render(this.Component(l)),()=>{c.unmount()}}}exports.ComponentRendererWrapper=Ft;exports.GuiexpertTable=pt;
|
package/index.js
CHANGED
|
@@ -3659,6 +3659,11 @@ class ee {
|
|
|
3659
3659
|
}
|
|
3660
3660
|
}
|
|
3661
3661
|
class rt {
|
|
3662
|
+
constructor(e, t, s, o, i, r, n, l) {
|
|
3663
|
+
this.scrollTop = e, this.scrollLeft = t, this.scrollHeight = s, this.scrollWidth = o, this.clientHeight = i, this.clientWidth = r, this.scrollFactorY = n, this.scrollFactorX = l;
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
class at {
|
|
3662
3667
|
constructor(e) {
|
|
3663
3668
|
var t, s;
|
|
3664
3669
|
this.tableScope = e, (t = this.tableScope.tableOptions) != null && t.getSelectionModel && (this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel), (s = this.tableScope.tableOptions) != null && s.getFocusModel && (this.getFocusModel = this.tableScope.tableOptions.getFocusModel);
|
|
@@ -3699,7 +3704,7 @@ class rt {
|
|
|
3699
3704
|
});
|
|
3700
3705
|
}
|
|
3701
3706
|
}
|
|
3702
|
-
class
|
|
3707
|
+
class lt {
|
|
3703
3708
|
get() {
|
|
3704
3709
|
return {
|
|
3705
3710
|
f2: "START_EDITING",
|
|
@@ -3719,7 +3724,7 @@ class at {
|
|
|
3719
3724
|
};
|
|
3720
3725
|
}
|
|
3721
3726
|
}
|
|
3722
|
-
class
|
|
3727
|
+
class nt {
|
|
3723
3728
|
get() {
|
|
3724
3729
|
return {
|
|
3725
3730
|
f2: "START_EDITING",
|
|
@@ -3741,7 +3746,7 @@ class lt {
|
|
|
3741
3746
|
};
|
|
3742
3747
|
}
|
|
3743
3748
|
}
|
|
3744
|
-
function
|
|
3749
|
+
function ct(a) {
|
|
3745
3750
|
return a.trim().replace(/\+/g, " ").replace(/ +/g, " ").replace(/⌫/g, "backspace").replace(/↩/g, "enter").replace(/⇧/g, "shift").replace(/⌥/g, "alt").replace(/option/g, "alt").replace(/opt/g, "alt").replace(/⌃/g, "ctrl").replace(/control/g, "ctrl").replace(/command/g, "cmd").replace(/meta/g, "cmd").replace(/escape/g, "esc").replace(/⌘/g, "cmd").replace(/\*/g, "multiply").split(" ").filter((e) => e).filter((e, t, s) => s.indexOf(e) === t).sort((e, t) => {
|
|
3746
3751
|
const s = { cmd: 1, ctrl: 2, alt: 3, shift: 4 }, o = s[e] || 5, i = s[t] || 5;
|
|
3747
3752
|
return o !== i ? o - i : e.localeCompare(t);
|
|
@@ -3755,9 +3760,9 @@ function ae(a) {
|
|
|
3755
3760
|
}
|
|
3756
3761
|
a.code.match(/^F\d+$/) && (e = a.code.toLowerCase()), a.code.match(/^Digit\d+$/) && (e = a.code.replace(/Digit/g, ""));
|
|
3757
3762
|
let t = "";
|
|
3758
|
-
return a.ctrlKey && (t += " ctrl"), a.altKey && (t += t + " alt"), a.shiftKey && (t += t + " shift"), a.metaKey && (t += t + " cmd"),
|
|
3763
|
+
return a.ctrlKey && (t += " ctrl"), a.altKey && (t += t + " alt"), a.shiftKey && (t += t + " shift"), a.metaKey && (t += t + " cmd"), ct(t + " " + e);
|
|
3759
3764
|
}
|
|
3760
|
-
class
|
|
3765
|
+
class dt {
|
|
3761
3766
|
constructor(e) {
|
|
3762
3767
|
this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
|
|
3763
3768
|
}
|
|
@@ -3779,7 +3784,7 @@ class ct {
|
|
|
3779
3784
|
(t = (e = this.tableScope) == null ? void 0 : e.tableOptions) != null && t.shortcutActionsDisabled ? this.isDebug() && console.debug("ShortcutService skipped.") : (this.assignPredefinedSystemShortcutMappings(), Object.assign(this.shortcutActionIdMapping, this.tableScope.tableOptions.shortcutActionIdMapping), this.isDebug() && console.debug("ShortcutService", this.shortcutActionIdMapping), this.tableScope.hostElement.addEventListener("keydown", this.onKeyDown.bind(this)));
|
|
3780
3785
|
}
|
|
3781
3786
|
assignPredefinedSystemShortcutMappings() {
|
|
3782
|
-
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new
|
|
3787
|
+
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new nt().get()) : Object.assign(this.shortcutActionIdMapping, new lt().get());
|
|
3783
3788
|
}
|
|
3784
3789
|
isMacintosh() {
|
|
3785
3790
|
return navigator.platform.indexOf("Mac") > -1;
|
|
@@ -3867,6 +3872,8 @@ class le {
|
|
|
3867
3872
|
}
|
|
3868
3873
|
onMouseMoved(e) {
|
|
3869
3874
|
}
|
|
3875
|
+
onScroll(e) {
|
|
3876
|
+
}
|
|
3870
3877
|
onSelectionChanged(e) {
|
|
3871
3878
|
}
|
|
3872
3879
|
onFocusChanged(e) {
|
|
@@ -3899,7 +3906,7 @@ class Fe {
|
|
|
3899
3906
|
e.setAttribute(t, s);
|
|
3900
3907
|
}
|
|
3901
3908
|
}
|
|
3902
|
-
class
|
|
3909
|
+
class ht {
|
|
3903
3910
|
render(e, t, s, o, i, r, n) {
|
|
3904
3911
|
if (i.isEditable(t, s)) {
|
|
3905
3912
|
n.addClass(e, "ge-table-row-input-div");
|
|
@@ -3920,7 +3927,7 @@ class dt {
|
|
|
3920
3927
|
}
|
|
3921
3928
|
}
|
|
3922
3929
|
}
|
|
3923
|
-
class
|
|
3930
|
+
class pt {
|
|
3924
3931
|
constructor(e = "none", t = "single") {
|
|
3925
3932
|
this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1, this.silent = !1, this.listenerArr = [];
|
|
3926
3933
|
}
|
|
@@ -4002,7 +4009,7 @@ class ht {
|
|
|
4002
4009
|
this.selectionType !== "none" && (this.allSelected = !1, this.selectionMode === "single" && (this.ranges = []), this.selectionType === "row" ? (e.c1 = 0, e.c2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "column" ? (e.r1 = 0, e.r2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "cell" ? (e.r2 = e.r1, e.c2 = e.c1) : this.selectionType, this.ranges.push(e), this.fireChangeEvent());
|
|
4003
4010
|
}
|
|
4004
4011
|
}
|
|
4005
|
-
class
|
|
4012
|
+
class gt {
|
|
4006
4013
|
constructor(e = "none") {
|
|
4007
4014
|
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1, this.listenerArr = [];
|
|
4008
4015
|
}
|
|
@@ -4053,14 +4060,14 @@ class De {
|
|
|
4053
4060
|
}
|
|
4054
4061
|
// `⊖ `, `⊕ `;
|
|
4055
4062
|
}
|
|
4056
|
-
const
|
|
4063
|
+
const ut = new pt(), ft = new gt("cell");
|
|
4057
4064
|
class ke {
|
|
4058
4065
|
constructor() {
|
|
4059
4066
|
this.overflowX = "auto", this.overflowY = "auto", this.horizontalBorderVisible = !0, this.verticalBorderVisible = !0, this.footerSeparatorBorderVisible = !0, this.headerSeparatorBorderVisible = !0, this.fixedEastSeparatorBorderVisible = !0, this.fixedWestSeparatorBorderVisible = !0, this.tableTopBorderVisible = !0, this.tableBottomBorderVisible = !0, this.hoverRowVisible = !0, this.hoverColumnVisible = !0, this.columnsResizable = !0, this.columnsDraggable = !0, this.columnResizeHandleWidthInPx = 4, this.defaultRowHeights = {
|
|
4060
4067
|
header: 34,
|
|
4061
4068
|
body: 34,
|
|
4062
4069
|
footer: 34
|
|
4063
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new Me(), this.headerGroupOptions = new De(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Te(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new
|
|
4070
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new Me(), this.headerGroupOptions = new De(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Te(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, t) => new ht(), this.getSelectionModel = () => ut, this.getFocusModel = () => ft;
|
|
4064
4071
|
}
|
|
4065
4072
|
}
|
|
4066
4073
|
const O = class O {
|
|
@@ -4148,7 +4155,7 @@ const O = class O {
|
|
|
4148
4155
|
O.columnSeparatorChar = " ", O.rowSeparatorChar = `
|
|
4149
4156
|
`;
|
|
4150
4157
|
let $ = O;
|
|
4151
|
-
class
|
|
4158
|
+
class mt {
|
|
4152
4159
|
constructor(e, t = 500) {
|
|
4153
4160
|
this.tableScope = e, this.debounceDelay = t, new ResizeObserver($e(this.handleResize.bind(this), t)).observe(this.tableScope.hostElement);
|
|
4154
4161
|
}
|
|
@@ -4157,7 +4164,7 @@ class ft {
|
|
|
4157
4164
|
this.tableScope.recalcColumnWidths(s);
|
|
4158
4165
|
}
|
|
4159
4166
|
}
|
|
4160
|
-
class
|
|
4167
|
+
class bt {
|
|
4161
4168
|
/**
|
|
4162
4169
|
* Downloads a matrix data as an Excel file.
|
|
4163
4170
|
*
|
|
@@ -4264,13 +4271,13 @@ class mt {
|
|
|
4264
4271
|
}
|
|
4265
4272
|
}
|
|
4266
4273
|
class te extends tt {
|
|
4267
|
-
constructor(e, t, s, o, i, r = new $(), n = new
|
|
4274
|
+
constructor(e, t, s, o, i, r = new $(), n = new bt()) {
|
|
4268
4275
|
var d;
|
|
4269
|
-
if (super(e, t, new Ne(s), o), this.eventListener = i, this.copyService = r, this.excelService = n, this.licenseManager = L.getInstance(), this.selectionService = new
|
|
4276
|
+
if (super(e, t, new Ne(s), o), this.eventListener = i, this.copyService = r, this.excelService = n, this.licenseManager = L.getInstance(), this.selectionService = new at(this), this.api = new Xe(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.lastDragFrom = -1, this.lastDragTo = -1, this.firstDraggingRendering = !0, this.lastContextmenu = Date.now(), t.setTableScope(this), i || (this.eventListener = new le()), (d = this.tableOptions) != null && d.autoRestoreOptions) {
|
|
4270
4277
|
const p = this.tableOptions.autoRestoreOptions, h = p.getStorageKeyFn;
|
|
4271
4278
|
h && (p.autoRestoreScrollPosition && (this.storeScrollPosStateService = new Ke(h)), p.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new qe(h)), p.autoRestoreSortingState && (this.storeSortingService = new Je(h)));
|
|
4272
4279
|
}
|
|
4273
|
-
this.mouseHandler = new Ge(this), this.inputHandler = new ot(this), this.resizeHandler = new
|
|
4280
|
+
this.mouseHandler = new Ge(this), this.inputHandler = new ot(this), this.resizeHandler = new mt(this, o.resizeEventDebounceDelay), this.shortcutService = new dt(this), this.shortcutService.addListener(this.selectionService);
|
|
4274
4281
|
const l = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
4275
4282
|
l && l.addEventSelectionChangedListener(this);
|
|
4276
4283
|
const c = this.getFocusModel ? this.getFocusModel() : void 0;
|
|
@@ -4518,6 +4525,20 @@ class te extends tt {
|
|
|
4518
4525
|
const o = this.tableModel.getAreaModel("body").getYPosByRowIndex(t);
|
|
4519
4526
|
this.scrollToPixel(0, o);
|
|
4520
4527
|
}
|
|
4528
|
+
adjustAfterScrolling() {
|
|
4529
|
+
super.adjustAfterScrolling();
|
|
4530
|
+
const e = this.scrollViewport;
|
|
4531
|
+
this.eventListener.onScroll(new rt(
|
|
4532
|
+
this.scrollTop,
|
|
4533
|
+
this.scrollLeft,
|
|
4534
|
+
e.scrollHeight,
|
|
4535
|
+
e.scrollWidth,
|
|
4536
|
+
e.clientHeight,
|
|
4537
|
+
e.clientWidth,
|
|
4538
|
+
this.scrollFactorY,
|
|
4539
|
+
this.scrollFactorX
|
|
4540
|
+
));
|
|
4541
|
+
}
|
|
4521
4542
|
/**
|
|
4522
4543
|
* Sets the selection model for the table.
|
|
4523
4544
|
*
|
|
@@ -5025,7 +5046,7 @@ const z = class z {
|
|
|
5025
5046
|
};
|
|
5026
5047
|
z.toggleHeaderGroup = "toggleHeaderGroup";
|
|
5027
5048
|
let ce = z;
|
|
5028
|
-
class
|
|
5049
|
+
class Vt extends B {
|
|
5029
5050
|
constructor(t) {
|
|
5030
5051
|
super(t);
|
|
5031
5052
|
oe(this, "ref", He());
|
|
@@ -5063,6 +5084,8 @@ class Pt extends B {
|
|
|
5063
5084
|
s.mouseDraggingEnd && s.mouseDraggingEnd(r);
|
|
5064
5085
|
},
|
|
5065
5086
|
onMouseMoved: (r) => {
|
|
5087
|
+
},
|
|
5088
|
+
onScroll(r) {
|
|
5066
5089
|
}
|
|
5067
5090
|
}, i = new te(t, s.tableModel, new Fe(), s.tableOptions ?? new ke(), o);
|
|
5068
5091
|
i.firstInit(), s.tableReady && s.tableReady(i.getApi()), s.licenseKey && L.getInstance().setLicenseKey(s.licenseKey);
|
|
@@ -5082,7 +5105,7 @@ class Pt extends B {
|
|
|
5082
5105
|
}
|
|
5083
5106
|
}
|
|
5084
5107
|
var F, U, de, Ie = [], j = [], A = E, he = A.__b, pe = A.__r, ge = A.diffed, ue = A.__c, fe = A.unmount, me = A.__;
|
|
5085
|
-
function
|
|
5108
|
+
function St() {
|
|
5086
5109
|
for (var a; a = Ie.shift(); ) if (a.__P && a.__H) try {
|
|
5087
5110
|
a.__H.__h.forEach(H), a.__H.__h.forEach(q), a.__H.__h = [];
|
|
5088
5111
|
} catch (e) {
|
|
@@ -5102,7 +5125,7 @@ A.__b = function(a) {
|
|
|
5102
5125
|
}, A.diffed = function(a) {
|
|
5103
5126
|
ge && ge(a);
|
|
5104
5127
|
var e = a.__c;
|
|
5105
|
-
e && e.__H && (e.__H.__h.length && (Ie.push(e) !== 1 && de === A.requestAnimationFrame || ((de = A.requestAnimationFrame) ||
|
|
5128
|
+
e && e.__H && (e.__H.__h.length && (Ie.push(e) !== 1 && de === A.requestAnimationFrame || ((de = A.requestAnimationFrame) || yt)(St)), e.__H.__.forEach(function(t) {
|
|
5106
5129
|
t.i && (t.__H = t.i), t.__V !== j && (t.__ = t.__V), t.i = void 0, t.__V = j;
|
|
5107
5130
|
})), U = F = null;
|
|
5108
5131
|
}, A.__c = function(a, e) {
|
|
@@ -5129,7 +5152,7 @@ A.__b = function(a) {
|
|
|
5129
5152
|
}), t.__H = void 0, e && A.__e(e, t.__v));
|
|
5130
5153
|
};
|
|
5131
5154
|
var be = typeof requestAnimationFrame == "function";
|
|
5132
|
-
function
|
|
5155
|
+
function yt(a) {
|
|
5133
5156
|
var e, t = function() {
|
|
5134
5157
|
clearTimeout(s), be && cancelAnimationFrame(e), setTimeout(a);
|
|
5135
5158
|
}, s = setTimeout(t, 100);
|
|
@@ -5143,7 +5166,7 @@ function q(a) {
|
|
|
5143
5166
|
var e = F;
|
|
5144
5167
|
a.__c = a.__(), F = e;
|
|
5145
5168
|
}
|
|
5146
|
-
function
|
|
5169
|
+
function wt(a, e) {
|
|
5147
5170
|
for (var t in e) a[t] = e[t];
|
|
5148
5171
|
return a;
|
|
5149
5172
|
}
|
|
@@ -5162,18 +5185,18 @@ var we = E.__b;
|
|
|
5162
5185
|
E.__b = function(a) {
|
|
5163
5186
|
a.type && a.type.__f && a.ref && (a.props.ref = a.ref, a.ref = null), we && we(a);
|
|
5164
5187
|
};
|
|
5165
|
-
var
|
|
5188
|
+
var xt = E.__e;
|
|
5166
5189
|
E.__e = function(a, e, t, s) {
|
|
5167
5190
|
if (a.then) {
|
|
5168
5191
|
for (var o, i = e; i = i.__; ) if ((o = i.__c) && o.__c) return e.__e == null && (e.__e = t.__e, e.__k = t.__k), o.__c(a, e);
|
|
5169
5192
|
}
|
|
5170
|
-
|
|
5193
|
+
xt(a, e, t, s);
|
|
5171
5194
|
};
|
|
5172
5195
|
var xe = E.unmount;
|
|
5173
5196
|
function Le(a, e, t) {
|
|
5174
5197
|
return a && (a.__c && a.__c.__H && (a.__c.__H.__.forEach(function(s) {
|
|
5175
5198
|
typeof s.__c == "function" && s.__c();
|
|
5176
|
-
}), a.__c.__H = null), (a =
|
|
5199
|
+
}), a.__c.__H = null), (a = wt({}, a)).__c != null && (a.__c.__P === t && (a.__c.__P = e), a.__c = null), a.__k = a.__k && a.__k.map(function(s) {
|
|
5177
5200
|
return Le(s, e, t);
|
|
5178
5201
|
})), a;
|
|
5179
5202
|
}
|
|
@@ -5253,10 +5276,10 @@ var ve = function(a, e, t) {
|
|
|
5253
5276
|
ve(a, t, e);
|
|
5254
5277
|
});
|
|
5255
5278
|
};
|
|
5256
|
-
var
|
|
5279
|
+
var vt = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, Ct = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, At = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, Rt = /[A-Z0-9]/g, Et = typeof document < "u", _t = function(a) {
|
|
5257
5280
|
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(a);
|
|
5258
5281
|
};
|
|
5259
|
-
function
|
|
5282
|
+
function Mt(a, e, t) {
|
|
5260
5283
|
return e.__k == null && (e.textContent = ""), _e(a, e), typeof t == "function" && t(), a ? a.__c : null;
|
|
5261
5284
|
}
|
|
5262
5285
|
B.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(a) {
|
|
@@ -5267,18 +5290,18 @@ B.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveP
|
|
|
5267
5290
|
} });
|
|
5268
5291
|
});
|
|
5269
5292
|
var Ce = E.event;
|
|
5270
|
-
function Mt() {
|
|
5271
|
-
}
|
|
5272
5293
|
function Tt() {
|
|
5273
|
-
return this.cancelBubble;
|
|
5274
5294
|
}
|
|
5275
5295
|
function Ft() {
|
|
5296
|
+
return this.cancelBubble;
|
|
5297
|
+
}
|
|
5298
|
+
function Dt() {
|
|
5276
5299
|
return this.defaultPrevented;
|
|
5277
5300
|
}
|
|
5278
5301
|
E.event = function(a) {
|
|
5279
|
-
return Ce && (a = Ce(a)), a.persist =
|
|
5302
|
+
return Ce && (a = Ce(a)), a.persist = Tt, a.isPropagationStopped = Ft, a.isDefaultPrevented = Dt, a.nativeEvent = a;
|
|
5280
5303
|
};
|
|
5281
|
-
var
|
|
5304
|
+
var kt = { enumerable: !1, configurable: !0, get: function() {
|
|
5282
5305
|
return this.class;
|
|
5283
5306
|
} }, Ae = E.vnode;
|
|
5284
5307
|
E.vnode = function(a) {
|
|
@@ -5286,17 +5309,17 @@ E.vnode = function(a) {
|
|
|
5286
5309
|
var t = e.props, s = e.type, o = {};
|
|
5287
5310
|
for (var i in t) {
|
|
5288
5311
|
var r = t[i];
|
|
5289
|
-
if (!(i === "value" && "defaultValue" in t && r == null ||
|
|
5312
|
+
if (!(i === "value" && "defaultValue" in t && r == null || Et && i === "children" && s === "noscript" || i === "class" || i === "className")) {
|
|
5290
5313
|
var n = i.toLowerCase();
|
|
5291
|
-
i === "defaultValue" && "value" in t && t.value == null ? i = "value" : i === "download" && r === !0 ? r = "" : n === "ondoubleclick" ? i = "ondblclick" : n !== "onchange" || s !== "input" && s !== "textarea" ||
|
|
5314
|
+
i === "defaultValue" && "value" in t && t.value == null ? i = "value" : i === "download" && r === !0 ? r = "" : n === "ondoubleclick" ? i = "ondblclick" : n !== "onchange" || s !== "input" && s !== "textarea" || _t(t.type) ? n === "onfocus" ? i = "onfocusin" : n === "onblur" ? i = "onfocusout" : At.test(i) ? i = n : s.indexOf("-") === -1 && Ct.test(i) ? i = i.replace(Rt, "-$&").toLowerCase() : r === null && (r = void 0) : n = i = "oninput", n === "oninput" && o[i = n] && (i = "oninputCapture"), o[i] = r;
|
|
5292
5315
|
}
|
|
5293
5316
|
}
|
|
5294
5317
|
s == "select" && o.multiple && Array.isArray(o.value) && (o.value = K(t.children).forEach(function(l) {
|
|
5295
5318
|
l.props.selected = o.value.indexOf(l.props.value) != -1;
|
|
5296
5319
|
})), s == "select" && o.defaultValue != null && (o.value = K(t.children).forEach(function(l) {
|
|
5297
5320
|
l.props.selected = o.multiple ? o.defaultValue.indexOf(l.props.value) != -1 : o.defaultValue == l.props.value;
|
|
5298
|
-
})), t.class && !t.className ? (o.class = t.class, Object.defineProperty(o, "className",
|
|
5299
|
-
}(a), a.$$typeof =
|
|
5321
|
+
})), t.class && !t.className ? (o.class = t.class, Object.defineProperty(o, "className", kt)) : (t.className && !t.class || t.class && t.className) && (o.class = o.className = t.className), e.props = o;
|
|
5322
|
+
}(a), a.$$typeof = vt, Ae && Ae(a);
|
|
5300
5323
|
};
|
|
5301
5324
|
var Re = E.__r;
|
|
5302
5325
|
E.__r = function(a) {
|
|
@@ -5308,20 +5331,20 @@ E.diffed = function(a) {
|
|
|
5308
5331
|
var e = a.props, t = a.__e;
|
|
5309
5332
|
t != null && a.type === "textarea" && "value" in e && e.value !== t.value && (t.value = e.value == null ? "" : e.value);
|
|
5310
5333
|
};
|
|
5311
|
-
function
|
|
5334
|
+
function It(a) {
|
|
5312
5335
|
return !!a.__k && (_e(null, a), !0);
|
|
5313
5336
|
}
|
|
5314
|
-
function
|
|
5337
|
+
function Lt(a) {
|
|
5315
5338
|
return {
|
|
5316
5339
|
render(e) {
|
|
5317
|
-
|
|
5340
|
+
Mt(e, a);
|
|
5318
5341
|
},
|
|
5319
5342
|
unmount() {
|
|
5320
|
-
|
|
5343
|
+
It(a);
|
|
5321
5344
|
}
|
|
5322
5345
|
};
|
|
5323
5346
|
}
|
|
5324
|
-
class
|
|
5347
|
+
class Ht {
|
|
5325
5348
|
constructor(e) {
|
|
5326
5349
|
this.Component = e, console.info(e);
|
|
5327
5350
|
}
|
|
@@ -5333,7 +5356,7 @@ class Vt {
|
|
|
5333
5356
|
areaIdent: o,
|
|
5334
5357
|
areaModel: i,
|
|
5335
5358
|
cellValue: r
|
|
5336
|
-
}, c =
|
|
5359
|
+
}, c = Lt(e);
|
|
5337
5360
|
return c.render(this.Component(l)), () => {
|
|
5338
5361
|
c.unmount();
|
|
5339
5362
|
};
|
|
@@ -5359,6 +5382,6 @@ class Vt {
|
|
|
5359
5382
|
// }
|
|
5360
5383
|
}
|
|
5361
5384
|
export {
|
|
5362
|
-
|
|
5363
|
-
|
|
5385
|
+
Ht as ComponentRendererWrapper,
|
|
5386
|
+
Vt as GuiexpertTable
|
|
5364
5387
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/preact-table",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.83",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"tslib": "^2.3.0",
|
|
23
23
|
"preact": "^10.19.4",
|
|
24
|
-
"@guiexpert/table": "^1.1.
|
|
24
|
+
"@guiexpert/table": "^1.1.83"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"react-scripts-ts": "^3.1.0",
|