@guiexpert/demo-table-models 1.1.61 → 1.1.62

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 CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function X(s){return s&&s.type==="TreeRow"}function Fe(s){return s&&s.type==="CheckboxColumnDef"}class w{constructor(e=">",r="",a=[]){this.content=e,this.style=r,this.classes=a}}class We{constructor(e=new w(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),r=new w(">","",["ge-table-tree-arrow-collapsed"]),a=new w(">","color:transparent;",["gt-table-tree-arrow-hidden"]),t=new w("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=r,this.arrowPlaceholder=a,this.arrowExpandCollapseAll=t}}class Ke{constructor(e=new w("↑","",["ge-header-sorted-asc"]),r=new w("↓","",["ge-header-sorted-desc"]),a=new w("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=r,this.iconPlaceholder=a}}class ee{constructor(e,r=[],a=-1){this.areaIdent=e,this.columnDefs=r,this.defaultRowHeight=a,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=r.map(t=>t.rendererMap[e])}getTextValueAt(e,r){return""+this.getValueAt(e,r)}getTooltipAt(e,r){return""}getCellRenderer(e,r){if(r<this.cellRenderers.length)return this.cellRenderers[r]}getColspanAt(e,r){return 0}getCustomClassesAt(e,r){return[]}getCustomStyleAt(e,r){}getRowspanAt(e,r){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var a;const r=this.getRowByIndex(e);return(a=this.rowSelectionModel)==null?void 0:a.isRowChecked(r)}setRowChecked(e,r){if(this.rowSelectionModel){const a=this.getRowByIndex(e);this.rowSelectionModel.checkRow(a,r)}}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}isEditable(e,r){var t,n;const a=(t=this.columnDefs)==null?void 0:t[r];return((n=a==null?void 0:a.editable)==null?void 0:n.call(a))??!1}setValue(e,r,a){var d;const t=(d=this.columnDefs[r])==null?void 0:d.editInputPipe;t&&(a=t(a,e,r));const n=this.getRowByIndex(e),m=this.columnDefs[r].property;return m.includes(".")?this.setPropertyValue(n,m.split("."),a):(n[m]=a,!0)}isSelectable(e,r){return!0}changeColumnOrder(e,r){this.arrayMove(this.cellRenderers,e,r)}setPropertyValue(e,r,a){const t=r.shift();if(t){const n=e[t];return n&&r.length?this.setPropertyValue(n,r,a):(e[t]=a,!0)}return!1}arrayMove(e,r,a){const t=e.splice(r,1)[0];return e.splice(a,0,t),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let r=0;r<e;r++)this.yPositions[r+1]=this.getRowHeight(r)+this.yPositions[r]}}class fe{genericSortComparator(e,r,a){if(typeof e=="number"&&typeof r=="number")return a*(e-r);if(typeof e=="string"&&typeof r=="string")return a*e.localeCompare(r);if(typeof e=="boolean"&&typeof r=="boolean")return a*((e?-1:1)-(r?-1:1));if(e instanceof Date&&r instanceof Date)return a*(e.getTime()-r.getTime());if(e instanceof Array&&r instanceof Array){const t=e,n=r;if(t.length&&n.length)return this.genericSortComparator(t[0],n[0],a)}return a*(""+e).localeCompare(""+r)}}class je extends ee{constructor(e,r,a,t=[]){super(e,t,a),this.areaIdent=e,this.rows=r,this.defaultRowHeight=a,this.columnDefs=t,this.sorterService=new fe,this.filteredRows=[...r],this.properties=t.map(n=>n.property)}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,r){const a=this.properties[r];let t=this.filteredRows[e];return X(t)&&(t=t.data),t?this.getValueByT(t,a):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}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 r of e){const{columnIndex:a,sortState:t}=r,n=t==="asc"?1:t==="desc"?-1:0,m=this.properties[a];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(m,n))}return!0}getValueByT(e,r){return r.includes(".")?this.getPropertyValue(e,r.split(".")):e[r]}changeColumnOrder(e,r){this.arrayMove(this.properties,e,r),super.changeColumnOrder(e,r)}genericFlatTableSortComparator(e,r){const a=this.columnDefs.find(t=>t.property===e);return(t,n)=>{const m=this.getValueByT(t,e),d=this.getValueByT(n,e);return a!=null&&a.sortComparator?r*a.sortComparator(m,d,t,n,r):this.sorterService.genericSortComparator(m,d,r)}}getPropertyValue(e,r){const a=r.shift(),t=e[a];return t&&r.length?this.getPropertyValue(t,r):t}}class o{constructor(e,r,a,t,n=!1){this.r1=e,this.c1=r,this.r2=a,this.c2=t,this.gammaRange=n}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new o(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,r){return new o(e,r,e,r)}static singleRow(e){return new o(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new o(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,r){return e>=this.r1&&e<=this.r2&&r>=this.c1&&r<=this.c2}}class C{constructor(e,r,a){this.header=e,this.body=r,this.footer=a}}class Xe{render(e,r,a,t,n,m,d){if(n.isEditable(r,a)){d.addClass(e,"ge-table-row-input-div");const i=n.getValueAt(r,a);e.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function X(s){return s&&s.type==="TreeRow"}function Fe(s){return s&&s.type==="CheckboxColumnDef"}class w{constructor(e=">",r="",a=[]){this.content=e,this.style=r,this.classes=a}}class We{constructor(e=new w(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),r=new w(">","",["ge-table-tree-arrow-collapsed"]),a=new w(">","color:transparent;",["gt-table-tree-arrow-hidden"]),t=new w("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=r,this.arrowPlaceholder=a,this.arrowExpandCollapseAll=t}}class Ke{constructor(e=new w("↑","",["ge-header-sorted-asc"]),r=new w("↓","",["ge-header-sorted-desc"]),a=new w("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=r,this.iconPlaceholder=a}}class ee{constructor(e,r=[],a=-1){this.areaIdent=e,this.columnDefs=r,this.defaultRowHeight=a,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=r.map(t=>t.rendererMap[e])}getTextValueAt(e,r){return""+this.getValueAt(e,r)}getTooltipAt(e,r){return""}getCellRenderer(e,r){if(r<this.cellRenderers.length)return this.cellRenderers[r]}getColspanAt(e,r){return 0}getCustomClassesAt(e,r){return[]}getCustomStyleAt(e,r){}getRowspanAt(e,r){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var a;const r=this.getRowByIndex(e);return(a=this.rowSelectionModel)==null?void 0:a.isRowChecked(r)}setRowChecked(e,r){if(this.rowSelectionModel){const a=this.getRowByIndex(e);this.rowSelectionModel.checkRow(a,r)}}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}isEditable(e,r){var t,n;const a=(t=this.columnDefs)==null?void 0:t[r];return((n=a==null?void 0:a.editable)==null?void 0:n.call(a))??!1}setValue(e,r,a){var d;const t=(d=this.columnDefs[r])==null?void 0:d.editInputPipe;t&&(a=t(a,e,r));const n=this.getRowByIndex(e),m=this.columnDefs[r].property;return m.includes(".")?this.setPropertyValue(n,m.split("."),a):(n[m]=a,!0)}isSelectable(e,r){return!0}changeColumnOrder(e,r){this.arrayMove(this.cellRenderers,e,r)}setPropertyValue(e,r,a){const t=r.shift();if(t){const n=e[t];return n&&r.length?this.setPropertyValue(n,r,a):(e[t]=a,!0)}return!1}arrayMove(e,r,a){const t=e.splice(r,1)[0];return e.splice(a,0,t),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let r=0;r<e;r++)this.yPositions[r+1]=this.getRowHeight(r)+this.yPositions[r]}}class fe{genericSortComparator(e,r,a){if(typeof e=="number"&&typeof r=="number")return a*(e-r);if(typeof e=="string"&&typeof r=="string")return a*e.localeCompare(r);if(typeof e=="boolean"&&typeof r=="boolean")return a*((e?-1:1)-(r?-1:1));if(e instanceof Date&&r instanceof Date)return a*(e.getTime()-r.getTime());if(e instanceof Array&&r instanceof Array){const t=e,n=r;if(t.length&&n.length)return this.genericSortComparator(t[0],n[0],a)}return a*(""+e).localeCompare(""+r)}}class je extends ee{constructor(e,r,a,t=[]){super(e,t,a),this.areaIdent=e,this.rows=r,this.defaultRowHeight=a,this.columnDefs=t,this.focusedRowIndex=0,this.sorterService=new fe,this.filteredRows=[...r],this.properties=t.map(n=>n.property)}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,r){const a=this.properties[r];let t=this.filteredRows[e];return X(t)&&(t=t.data),t?this.getValueByT(t,a):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}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 r of e){const{columnIndex:a,sortState:t}=r,n=t==="asc"?1:t==="desc"?-1:0,m=this.properties[a];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(m,n))}return!0}getValueByT(e,r){return r.includes(".")?this.getPropertyValue(e,r.split(".")):e[r]}changeColumnOrder(e,r){this.arrayMove(this.properties,e,r),super.changeColumnOrder(e,r)}getCustomClassesAt(e,r){const a=super.getCustomClassesAt(e,r);return this.getRowByIndex(e).selected&&a.push("ge-selected-row"),this.focusedRowIndex===e&&a.push("ge-focused-row"),a}genericFlatTableSortComparator(e,r){const a=this.columnDefs.find(t=>t.property===e);return(t,n)=>{const m=this.getValueByT(t,e),d=this.getValueByT(n,e);return a!=null&&a.sortComparator?r*a.sortComparator(m,d,t,n,r):this.sorterService.genericSortComparator(m,d,r)}}getPropertyValue(e,r){const a=r.shift(),t=e[a];return t&&r.length?this.getPropertyValue(t,r):t}}class o{constructor(e,r,a,t,n=!1){this.r1=e,this.c1=r,this.r2=a,this.c2=t,this.gammaRange=n}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new o(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,r){return new o(e,r,e,r)}static singleRow(e){return new o(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new o(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,r){return e>=this.r1&&e<=this.r2&&r>=this.c1&&r<=this.c2}}class C{constructor(e,r,a){this.header=e,this.body=r,this.footer=a}}class Xe{render(e,r,a,t,n,m,d){if(n.isEditable(r,a)){d.addClass(e,"ge-table-row-input-div");const i=n.getValueAt(r,a);e.innerHTML=`
2
2
  <input
3
3
  type="text"
4
4
  value="${i}"
@@ -10,7 +10,7 @@
10
10
  data-col-index="${a}"
11
11
  data-input-type="text"
12
12
  style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
13
- class="ge-table-cell-editor-input">`}}}class q{constructor(e="none",r="single"){this.selectionType=e,this.selectionMode=r,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 r=this.listenerArr.indexOf(e,0);r>-1&&this.listenerArr.splice(r,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,r){this.selectionType==="row"?this.addRange(o.singleRow(e)):this.selectionType==="column"&&this.addRange(o.singleColumn(r))}getSelectionCount(e,r){let a=0;for(const t of this.ranges)t.isInRange(e,r)&&a++;return this.allSelected&&a++,this.isInNegativeRange(e,r)&&(a=0),a}isInNegativeRange(e,r){for(const a of this.negativeRanges)if(a.isInRange(e,r))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 r of this.ranges)for(let a=r.r1;a<=r.r2;a++)!e.has(a)&&!this.isInNegativeRange(a,0)&&e.add(a);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 r=e;this.selectionType==="row"?r=o.singleRow(e.r1):this.selectionType==="column"&&(r=o.singleColumn(e.c1)),this.negativeRanges.push(r),this.fireChangeEvent()}togglePoint(e,r){this.getSelectionCount(e,r)>0?this.removeSelection(o.singleCell(e,r)):this.addSelection(o.singleCell(e,r))}isSelected(e,r){return this.getSelectionCount(e,r)>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 Ye{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 r=this.listenerArr.indexOf(e,0);r>-1&&this.listenerArr.splice(r,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,r){(this.rowIndex!==e||this.columnIndex!==r)&&(this.rowIndex=e,this.columnIndex=r,this.changed=!0,this.fireChangeEvent())}hasFocus(e,r){return this.rowIndex===e&&this.columnIndex===r}getFocus(){return[this.rowIndex,this.columnIndex]}}class re{constructor(e=new w("❯","",["gt-table-icon-expanded"]),r=new w("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=r}}const Je=new q,Qe=new Ye("cell");class z{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 We,this.headerGroupOptions=new re,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Ke,this.sortOrder=["asc","desc"],this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,r)=>new Xe,this.getSelectionModel=()=>Je,this.getFocusModel=()=>Qe}}const D=class D{createContent(e,r,a){return new Promise((t,n)=>{if(r!=null&&r.hasSelection()){const m=this.mergeRanges(r.getRanges());if(m){m.c2=Math.min(m.c2,e.getColumnCount()-1),m.r2=Math.min(m.r2,e.getBodyModel().getRowCount()-1);const d=[];for(let i=m.r1;i<=m.r2;i++){const u=[];for(let p=m.c1;p<=m.c2;p++){const c=r.isSelected(i,p)?e.getBodyModel().getTextValueAt(i,p):"";u.push(c)}d.push(u.join(D.columnSeparatorChar))}return t(d.join(D.rowSeparatorChar))}}if(a){const[m,d]=a.getFocus(),i=e.getBodyModel().getTextValueAt(m,d);return t(i)}n("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,r,a){return new Promise((t,n)=>{this.createContent(e,r,a).then(m=>{m&&this.copyContent(m).then(d=>{t(m)}).catch(d=>{n()})}).catch(m=>{n()})})}mergeRanges(e){let r;for(const a of e)r?(r.r1=Math.min(r.r1,a.r1),r.c1=Math.min(r.c1,a.c1),r.r2=Math.max(r.r2,a.r2),r.c2=Math.max(r.c2,a.c2)):r=new o(a.r1,a.c1,a.r2,a.c2);return r}};D.columnSeparatorChar=" ",D.rowSeparatorChar=`
13
+ class="ge-table-cell-editor-input">`}}}class q{constructor(e="none",r="single"){this.selectionType=e,this.selectionMode=r,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 r=this.listenerArr.indexOf(e,0);r>-1&&this.listenerArr.splice(r,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,r){this.selectionType==="row"?this.addRange(o.singleRow(e)):this.selectionType==="column"&&this.addRange(o.singleColumn(r))}getSelectionCount(e,r){let a=0;for(const t of this.ranges)t.isInRange(e,r)&&a++;return this.allSelected&&a++,this.isInNegativeRange(e,r)&&(a=0),a}isInNegativeRange(e,r){for(const a of this.negativeRanges)if(a.isInRange(e,r))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 r of this.ranges)for(let a=r.r1;a<=r.r2;a++)!e.has(a)&&!this.isInNegativeRange(a,0)&&e.add(a);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 r=e;this.selectionType==="row"?r=o.singleRow(e.r1):this.selectionType==="column"&&(r=o.singleColumn(e.c1)),this.negativeRanges.push(r),this.fireChangeEvent()}togglePoint(e,r){this.getSelectionCount(e,r)>0?this.removeSelection(o.singleCell(e,r)):this.addSelection(o.singleCell(e,r))}isSelected(e,r){return this.getSelectionCount(e,r)>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 Ye{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 r=this.listenerArr.indexOf(e,0);r>-1&&this.listenerArr.splice(r,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,r){(this.rowIndex!==e||this.columnIndex!==r)&&(this.rowIndex=e,this.columnIndex=r,this.changed=!0,this.fireChangeEvent())}hasFocus(e,r){return this.rowIndex===e&&this.columnIndex===r}getFocus(){return[this.rowIndex,this.columnIndex]}}class re{constructor(e=new w("❯","",["gt-table-icon-expanded"]),r=new w("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=r}}const Je=new q,Qe=new Ye("cell");class z{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 We,this.headerGroupOptions=new re,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Ke,this.sortOrder=["asc","desc"],this.shortcutActionsDisabled=!1,this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,r)=>new Xe,this.getSelectionModel=()=>Je,this.getFocusModel=()=>Qe}}const D=class D{createContent(e,r,a){return new Promise((t,n)=>{if(r!=null&&r.hasSelection()){const m=this.mergeRanges(r.getRanges());if(m){m.c2=Math.min(m.c2,e.getColumnCount()-1),m.r2=Math.min(m.r2,e.getBodyModel().getRowCount()-1);const d=[];for(let i=m.r1;i<=m.r2;i++){const u=[];for(let p=m.c1;p<=m.c2;p++){const c=r.isSelected(i,p)?e.getBodyModel().getTextValueAt(i,p):"";u.push(c)}d.push(u.join(D.columnSeparatorChar))}return t(d.join(D.rowSeparatorChar))}}if(a){const[m,d]=a.getFocus(),i=e.getBodyModel().getTextValueAt(m,d);return t(i)}n("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,r,a){return new Promise((t,n)=>{this.createContent(e,r,a).then(m=>{m&&this.copyContent(m).then(d=>{t(m)}).catch(d=>{n()})}).catch(m=>{n()})})}mergeRanges(e){let r;for(const a of e)r?(r.r1=Math.min(r.r1,a.r1),r.c1=Math.min(r.c1,a.c1),r.r2=Math.max(r.r2,a.r2),r.c2=Math.max(r.c2,a.c2)):r=new o(a.r1,a.c1,a.r2,a.c2);return r}};D.columnSeparatorChar=" ",D.rowSeparatorChar=`
14
14
  `;let me=D;const $=class ${};$.themes=["light","combat","paper","blackboard"],$.vars={light:`html[data-theme="light"] {
15
15
  --ge-table-bg: rgba(255,255,255, 0.5);
16
16
  --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
package/index.js CHANGED
@@ -151,7 +151,7 @@ class fe {
151
151
  }
152
152
  class De extends ee {
153
153
  constructor(e, r, a, t = []) {
154
- super(e, t, a), this.areaIdent = e, this.rows = r, this.defaultRowHeight = a, this.columnDefs = t, this.sorterService = new fe(), this.filteredRows = [...r], this.properties = t.map((n) => n.property);
154
+ super(e, t, a), this.areaIdent = e, this.rows = r, this.defaultRowHeight = a, this.columnDefs = t, this.focusedRowIndex = 0, this.sorterService = new fe(), this.filteredRows = [...r], this.properties = t.map((n) => n.property);
155
155
  }
156
156
  setRows(e) {
157
157
  this.rows = e, this.filteredRows = [...e];
@@ -168,6 +168,12 @@ class De extends ee {
168
168
  let t = this.filteredRows[e];
169
169
  return X(t) && (t = t.data), t ? this.getValueByT(t, a) : "";
170
170
  }
171
+ /**
172
+ * Retrieves the filtered and sorted rows from the dataset.
173
+ * These rows are used for rendering the table.
174
+ *
175
+ * @return {T[]} An array containing the filtered (and sorted) rows.
176
+ */
171
177
  getFilteredRows() {
172
178
  return this.filteredRows;
173
179
  }
@@ -196,6 +202,10 @@ class De extends ee {
196
202
  changeColumnOrder(e, r) {
197
203
  this.arrayMove(this.properties, e, r), super.changeColumnOrder(e, r);
198
204
  }
205
+ getCustomClassesAt(e, r) {
206
+ const a = super.getCustomClassesAt(e, r);
207
+ return this.getRowByIndex(e).selected && a.push("ge-selected-row"), this.focusedRowIndex === e && a.push("ge-focused-row"), a;
208
+ }
199
209
  genericFlatTableSortComparator(e, r) {
200
210
  const a = this.columnDefs.find((t) => t.property === e);
201
211
  return (t, n) => {
@@ -409,7 +419,7 @@ class z {
409
419
  header: 34,
410
420
  body: 34,
411
421
  footer: 34
412
- }, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new ke(), this.headerGroupOptions = new re(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Re(), this.sortOrder = ["asc", "desc"], this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, r) => new Ae(), this.getSelectionModel = () => Me, this.getFocusModel = () => Be;
422
+ }, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new ke(), this.headerGroupOptions = new re(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new Re(), this.sortOrder = ["asc", "desc"], this.shortcutActionsDisabled = !1, this.resizeEventDebounceDelay = 500, this.getEditRenderer = (e, r) => new Ae(), this.getSelectionModel = () => Me, this.getFocusModel = () => Be;
413
423
  }
414
424
  }
415
425
  const D = class D {
@@ -44,6 +44,7 @@ export declare const tableOptions: {
44
44
  sortedOptions: import('../../../table/src').SortedOptions;
45
45
  sortOrder: import('../../../table/src').SortState[];
46
46
  shortcutActionIdMapping?: import('../../../table/src').ShortcutActionIdMapping | undefined;
47
+ shortcutActionsDisabled: boolean;
47
48
  resizeEventDebounceDelay: number;
48
49
  getEditRenderer?: import('../../../table/src').GetEditRenderer | undefined;
49
50
  getSelectionModel?: import('../../../table/src').GetT<import('../../../table/src').SelectionModelIf> | undefined;
@@ -42,6 +42,7 @@ export declare function createTreePeopleTableOptions(addDemoSelection?: boolean)
42
42
  sortedOptions: import('../../../../table/src').SortedOptions;
43
43
  sortOrder: import('../../../../table/src').SortState[];
44
44
  shortcutActionIdMapping?: import('../../../../table/src').ShortcutActionIdMapping | undefined;
45
+ shortcutActionsDisabled: boolean;
45
46
  resizeEventDebounceDelay: number;
46
47
  getEditRenderer?: import('../../../../table/src').GetEditRenderer | undefined;
47
48
  getFocusModel?: import('../../../../table/src').GetT<import('../../../../table/src').FocusModelIf> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/demo-table-models",
3
- "version": "1.1.61",
3
+ "version": "1.1.62",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "tslib": "^2.3.0",
21
- "@guiexpert/table": "^1.1.61"
21
+ "@guiexpert/table": "^1.1.62"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^20.11.17",