@guiexpert/demo-table-models 1.1.75 → 1.1.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs +1 -1
  2. package/index.js +2 -2
  3. package/package.json +2 -2
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}sort(e){}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=[],n="ge-selected-row",m="ge-focused-row"){super(e,t,a),this.areaIdent=e,this.rows=r,this.defaultRowHeight=a,this.columnDefs=t,this.selectedRowClass=n,this.focusedRowClass=m,this.sorterService=new fe,this._focusedRowIndex=0,this.filteredRows=[...r],this.properties=t.map(d=>d.property)}get focusedRowIndex(){return this._focusedRowIndex}set focusedRowIndex(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,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}findRowFromFilteredRowsByAllCriteria(e,r){return this.getFilteredRows().find(a=>r(e,a))}findRowFromAllRowsByAllCriteria(e,r){return this.getAllRows().find(a=>r(e,a))}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}sort(e){this.filteredRows=this.filteredRows.sort(e)}getValueByT(e,r){if(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(this.selectedRowClass),this._focusedRowIndex===e&&a.push(this.focusedRowClass),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=`
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}sort(e){}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=[],n="ge-selected-row",m="ge-focused-row"){super(e,t,a),this.areaIdent=e,this.rows=r,this.defaultRowHeight=a,this.columnDefs=t,this.selectedRowClass=n,this.focusedRowClass=m,this.sorterService=new fe,this._focusedRowIndex=0,this.filteredRows=[...r],this.properties=t.map(d=>d.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,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}findRowFromFilteredRowsByAllCriteria(e,r){return this.getFilteredRows().find(a=>r(e,a))}findRowFromAllRowsByAllCriteria(e,r){return this.getAllRows().find(a=>r(e,a))}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}sort(e){this.filteredRows=this.filteredRows.sort(e)}getValueByT(e,r){if(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(this.selectedRowClass),this._focusedRowIndex===e&&a.push(this.focusedRowClass),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}"
package/index.js CHANGED
@@ -155,10 +155,10 @@ class De extends ee {
155
155
  constructor(e, r, a, t = [], n = "ge-selected-row", m = "ge-focused-row") {
156
156
  super(e, t, a), this.areaIdent = e, this.rows = r, this.defaultRowHeight = a, this.columnDefs = t, this.selectedRowClass = n, this.focusedRowClass = m, this.sorterService = new fe(), this._focusedRowIndex = 0, this.filteredRows = [...r], this.properties = t.map((d) => d.property);
157
157
  }
158
- get focusedRowIndex() {
158
+ getFocusedRowIndex() {
159
159
  return this._focusedRowIndex;
160
160
  }
161
- set focusedRowIndex(e) {
161
+ setFocusedRowIndex(e) {
162
162
  this._focusedRowIndex = e;
163
163
  }
164
164
  setRows(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/demo-table-models",
3
- "version": "1.1.75",
3
+ "version": "1.1.78",
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.75"
21
+ "@guiexpert/table": "^1.1.78"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^20.11.17",