@omegagrid/grid-core 0.11.17 → 0.11.19

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.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAehD,eAAO,MAAM,sBAAsB,EAI9B,aAAa,CAAC;AAEnB,eAAO,MAAM,oBAAoB,EAG5B,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFjB,wBAqBC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAehD,eAAO,MAAM,sBAAsB,EAI9B,aAAa,CAAC;AAEnB,eAAO,MAAM,oBAAoB,EAG5B,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FjB,wBAqBC"}
package/dist/constants.js CHANGED
@@ -55,6 +55,9 @@ const DEFAULT_OPTIONS = {
55
55
  cellCache: true,
56
56
  singleCellModel: false,
57
57
  zoom: 1,
58
+ autofit: {
59
+ includeHeaders: true
60
+ },
58
61
  editing: {
59
62
  rowInsertion: true,
60
63
  rowDeletion: true,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,yBA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EAAE,QAAQ;IAC/B,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,IAAI;IAC1B,qBAAqB,EAAE,CAAC;IACxB,cAAc,EAAE,CAAC;IACjB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,mBAAmB,EAAE,GAAG;IACxB,gBAAgB,EAAE,GAAG;IACrB,mBAAmB,EAAE,GAAG;IACxB,yBAAyB,EAAE,yBAAyB;IACpD,eAAe,EAAE,eAAe;IAChC,sBAAsB,EAAE,GAAG;IAC3B,sBAAsB,EAAE,EAAE;IAC1B,GAAG,aAAa;CAChB,CAAA","sourcesContent":["import { constants as coreConstants } from '@omegagrid/core';\nimport { Options, FilterOptions, TreeOptions } from './model';\nimport { SparklineOptions } from './sparklines';\n\nconst DEFAULT_SPARKLINE_OPTIONS = {\n\tminValue: 'auto',\n\tmaxValue: 'auto',\n\ttype: 'line',\n\tstyle: {\n\t\tcolor: '0094FF',\n\t\tweight: 1\n\t},\n\tmarker: {\n\t\tcolor: 'ff0000'\n\t}\n} as SparklineOptions;\n\nexport const DEFAULT_FILTER_OPTIONS = {\n\tenabled: false,\n\tincludeChildren: true,\n\tincludeParents: true\n} as FilterOptions;\n\nexport const DEFAULT_TREE_OPTIONS = {\n\tenabled: true,\n\treversed: false,\n} as TreeOptions;\n\nconst ROW_HEIGHT = 22;\n\nconst DEFAULT_OPTIONS: Options = {\n\trows: 100,\n\tcolumns: 20,\n\treadOnly: false,\n\trowNumbers: true,\n\trowPriority: 2,\n\trowTree: {enabled: true},\n\tcolumnTree: {enabled: true},\n\tcolLetters: true,\n\temptyPlaceholder: true,\n\tfreezeTop: 0,\n\tfontSize: 14,\n\trowHeight: ROW_HEIGHT,\n\trowResize: true,\n\tcolumnWidth: 100,\n\tcolumnResize: true,\n\tcolumnPriority: 1,\n\tfreezeLeft: 0,\n\tfreezeRight: 0,\n\tfreezeBottom: 0,\n\tmaxSortingColumns: 3,\n\tnumberFormat: null,\n\tlevelIndentFactor: 2,\n\tcellIndentFactor: 10,\n\temptyClickable: false,\n\tgrid: true,\n\tautofill: true,\n\tformulas: true,\n\tmaxCalculationDepth: 50,\n\tundoRedo: true,\n\tcommandWindow: true,\n\tcellCache: true,\n\tsingleCellModel: false,\n\tzoom: 1,\n\tediting: {\n\t\trowInsertion: true,\n\t\trowDeletion: true,\n\t\tcolInsertion: true,\n\t\tcolDeletion: true,\n\t\trowOutline: true,\n\t\tcolOutline: true,\n\t\tdateCalendarEditor: false\n\t},\n\tcomments: {\n\t\thideTimeout: 1000,\n\t\toffsetX: 30,\n\t\toffsetY: -30,\n\t\tzIndex: 500,\n\t\theaderPosition: 'top'\n\t},\n\tscrolling: {\n\t\tverticalOverscroll: true,\n\t\thorizontalOverscroll: true,\n\t\tscrollbarVisibilityTreshold: 100\n\t},\n\tselecting: {\n\t\tenabled: true,\n\t\tmultiSelect: true,\n\t},\n\tevents: {\n\t\tclick: {\n\t\t\tmouseMoveTreshold: 10\n\t\t}\n\t},\n\tclipboard: {\n\t\tpasteProps: ['v', 'dv'],\n\t\trowPasteMode: 'rewrite_append',\n\t\tcolumnPasteMode: 'rewrite'\n\t},\n\tprint: {\n\t\tdpi: 600,\n\t\tmargins: {\n\t\t\tleft: 6.35,\n\t\t\tright: 6.35,\n\t\t\ttop: 19.05,\n\t\t\tbottom: 19.05,\n\t\t\theader: 7.62,\n\t\t\tfooter: 7.62\n\t\t},\n\t\torientation: 'portrait',\n\t\tpaper: 'A4'\n\t}\n};\n\nexport default {\n\tROW_HEIGHT: ROW_HEIGHT,\n\tRESIZE_TRESHOLD: 10,\n\tROW_HEADER_WIDTH: 60,\n\tSLIDER_SIZE: 12,\n\tEXPANDER_SIZE: 13,\n\tMAX_CACHE_ITEMS: 5000, //50000,\n\tCACHE_CLEAN_INTERVAL: 30,\n\tCOMMENT_HIDE_TIMEOUT: 1000,\n\tSELECTOR_BORDER_WIDTH: 1,\n\tMIN_ROW_HEIGHT: 5,\n\tMIN_COL_WIDTH: 5,\n\tSPARKLINE_GAP: 4,\n\tAUTOSCROLL_TRESHOLD: 100,\n\tAUTOSCROLL_RATIO: 1.1,\n\tAUTOSCROLL_INTERVAL: 100,\n\tDEFAULT_SPARKLINE_OPTIONS: DEFAULT_SPARKLINE_OPTIONS,\n\tDEFAULT_OPTIONS: DEFAULT_OPTIONS,\n\tMAX_COMMENT_AUTOHEIGHT: 300,\n\tMIN_COMMENT_AUTOHEIGHT: 25,\n\t...coreConstants\n}\n\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,yBAAyB,GAAG;IACjC,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE;QACN,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,CAAC;KACT;IACD,MAAM,EAAE;QACP,KAAK,EAAE,QAAQ;KACf;CACmB,CAAC;AAEtB,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,IAAI;CACH,CAAC;AAEnB,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,KAAK;CACA,CAAC;AAEjB,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,eAAe,GAAY;IAChC,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC;IACxB,UAAU,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC;IAC3B,UAAU,EAAE,IAAI;IAChB,gBAAgB,EAAE,IAAI;IACtB,SAAS,EAAE,CAAC;IACZ,QAA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AAC;QACvB,YAAY,EAAE,gBAAgB;QAC9B,eAAe,EAAE,SAAS;KAC1B;IACD,KAAK,EAAE;QACN,GAAG,EAAE,GAAG;QACR,OAAO,EAAE;YACR,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;SACZ;QACD,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,IAAI;KACX;CACD,CAAC;AAEF,eAAe;IACd,UAAU,EAAE,UAAU;IACtB,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE;IACpB,WAAW,EAAE,EAAE;IACf,aAAa,EAAE,EAAE;IACjB,eAAe,EAAE,IAAI,EAAE,QAAQ;IAC/B,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,IAAI;IAC1B,qBAAqB,EAAE,CAAC;IACxB,cAAc,EAAE,CAAC;IACjB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,mBAAmB,EAAE,GAAG;IACxB,gBAAgB,EAAE,GAAG;IACrB,mBAAmB,EAAE,GAAG;IACxB,yBAAyB,EAAE,yBAAyB;IACpD,eAAe,EAAE,eAAe;IAChC,sBAAsB,EAAE,GAAG;IAC3B,sBAAsB,EAAE,EAAE;IAC1B,GAAG,aAAa;CAChB,CAAA","sourcesContent":["import { constants as coreConstants } from '@omegagrid/core';\nimport { Options, FilterOptions, TreeOptions } from './model';\nimport { SparklineOptions } from './sparklines';\n\nconst DEFAULT_SPARKLINE_OPTIONS = {\n\tminValue: 'auto',\n\tmaxValue: 'auto',\n\ttype: 'line',\n\tstyle: {\n\t\tcolor: '0094FF',\n\t\tweight: 1\n\t},\n\tmarker: {\n\t\tcolor: 'ff0000'\n\t}\n} as SparklineOptions;\n\nexport const DEFAULT_FILTER_OPTIONS = {\n\tenabled: false,\n\tincludeChildren: true,\n\tincludeParents: true\n} as FilterOptions;\n\nexport const DEFAULT_TREE_OPTIONS = {\n\tenabled: true,\n\treversed: false,\n} as TreeOptions;\n\nconst ROW_HEIGHT = 22;\n\nconst DEFAULT_OPTIONS: Options = {\n\trows: 100,\n\tcolumns: 20,\n\treadOnly: false,\n\trowNumbers: true,\n\trowPriority: 2,\n\trowTree: {enabled: true},\n\tcolumnTree: {enabled: true},\n\tcolLetters: true,\n\temptyPlaceholder: true,\n\tfreezeTop: 0,\n\tfontSize: 14,\n\trowHeight: ROW_HEIGHT,\n\trowResize: true,\n\tcolumnWidth: 100,\n\tcolumnResize: true,\n\tcolumnPriority: 1,\n\tfreezeLeft: 0,\n\tfreezeRight: 0,\n\tfreezeBottom: 0,\n\tmaxSortingColumns: 3,\n\tnumberFormat: null,\n\tlevelIndentFactor: 2,\n\tcellIndentFactor: 10,\n\temptyClickable: false,\n\tgrid: true,\n\tautofill: true,\n\tformulas: true,\n\tmaxCalculationDepth: 50,\n\tundoRedo: true,\n\tcommandWindow: true,\n\tcellCache: true,\n\tsingleCellModel: false,\n\tzoom: 1,\n\tautofit: {\n\t\tincludeHeaders: true\n\t},\n\tediting: {\n\t\trowInsertion: true,\n\t\trowDeletion: true,\n\t\tcolInsertion: true,\n\t\tcolDeletion: true,\n\t\trowOutline: true,\n\t\tcolOutline: true,\n\t\tdateCalendarEditor: false\n\t},\n\tcomments: {\n\t\thideTimeout: 1000,\n\t\toffsetX: 30,\n\t\toffsetY: -30,\n\t\tzIndex: 500,\n\t\theaderPosition: 'top'\n\t},\n\tscrolling: {\n\t\tverticalOverscroll: true,\n\t\thorizontalOverscroll: true,\n\t\tscrollbarVisibilityTreshold: 100\n\t},\n\tselecting: {\n\t\tenabled: true,\n\t\tmultiSelect: true,\n\t},\n\tevents: {\n\t\tclick: {\n\t\t\tmouseMoveTreshold: 10\n\t\t}\n\t},\n\tclipboard: {\n\t\tpasteProps: ['v', 'dv'],\n\t\trowPasteMode: 'rewrite_append',\n\t\tcolumnPasteMode: 'rewrite'\n\t},\n\tprint: {\n\t\tdpi: 600,\n\t\tmargins: {\n\t\t\tleft: 6.35,\n\t\t\tright: 6.35,\n\t\t\ttop: 19.05,\n\t\t\tbottom: 19.05,\n\t\t\theader: 7.62,\n\t\t\tfooter: 7.62\n\t\t},\n\t\torientation: 'portrait',\n\t\tpaper: 'A4'\n\t}\n};\n\nexport default {\n\tROW_HEIGHT: ROW_HEIGHT,\n\tRESIZE_TRESHOLD: 10,\n\tROW_HEADER_WIDTH: 60,\n\tSLIDER_SIZE: 12,\n\tEXPANDER_SIZE: 13,\n\tMAX_CACHE_ITEMS: 5000, //50000,\n\tCACHE_CLEAN_INTERVAL: 30,\n\tCOMMENT_HIDE_TIMEOUT: 1000,\n\tSELECTOR_BORDER_WIDTH: 1,\n\tMIN_ROW_HEIGHT: 5,\n\tMIN_COL_WIDTH: 5,\n\tSPARKLINE_GAP: 4,\n\tAUTOSCROLL_TRESHOLD: 100,\n\tAUTOSCROLL_RATIO: 1.1,\n\tAUTOSCROLL_INTERVAL: 100,\n\tDEFAULT_SPARKLINE_OPTIONS: DEFAULT_SPARKLINE_OPTIONS,\n\tDEFAULT_OPTIONS: DEFAULT_OPTIONS,\n\tMAX_COMMENT_AUTOHEIGHT: 300,\n\tMIN_COMMENT_AUTOHEIGHT: 25,\n\t...coreConstants\n}\n\n"]}
@@ -57,10 +57,13 @@ export declare class FilterModel extends EventTarget {
57
57
  get(c: number): FilterSettings;
58
58
  /**
59
59
  * Restore settings captured from a previous model instance (grid refresh recreates the model).
60
+ * With `custom` (the server filters) the rows came filtered by these settings already: they all count as
61
+ * matched, whatever the settings the new model applied to itself in its constructor (the default ones).
60
62
  */
61
63
  restore(settings: FilterSettings[], custom?: boolean): void;
62
64
  filter(filter: FilterSettings, dispatchEvent?: boolean): void;
63
65
  applyFilter(dispatchEvent?: boolean): void;
64
66
  resetFilter(dispatchEvent?: boolean): void;
67
+ private matchAllRows;
65
68
  }
66
69
  //# sourceMappingURL=filterModel.d.ts.map
@@ -1 +1 @@
1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BAAoB,GAAI,KAAK,EAAE,QAAQ,mBAAmB,EAAE,UAAU,MAAM,KAAK,MAWrF,MAAM,KAAK,YASnB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,QAAQ,EAAE,MAAM,WAAW,EAAE,UAAU,MAAM,SAAS,iCAuB7F,CAAA;AAED,qBAAa,WAAY,SAAQ,KAAK;;CAIrC;AAED,qBAAa,WAAY,SAAQ,WAAW;aAkB1B,KAAK,EAAE,SAAS;IAhB1B,MAAM,UAAS;IAEtB,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,SAAS,CAAwB;IACzC,IAAI,QAAQ,IACI,cAAc,EAAE,GAAC,IAAI,CADG;IACxC,IAAI,QAAQ,CAAC,CAAC,EAAE,cAAc,EAAE,GAAC,IAAI,EAQpC;gBAGgB,KAAK,EAAE,SAAS,EAChC,QAAQ,GAAE,cAAc,EAAE,GAAC,IAAW;IAMvC;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM;IAIb;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,MAAM,UAAQ;IAUlD,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,UAAO;IA8BnD,WAAW,CAAC,aAAa,UAAO;IAoDhC,WAAW,CAAC,aAAa,UAAO;IAOhC,OAAO,CAAC,YAAY;CAKpB"}
@@ -209,6 +209,8 @@ export class FilterModel extends EventTarget {
209
209
  }
210
210
  /**
211
211
  * Restore settings captured from a previous model instance (grid refresh recreates the model).
212
+ * With `custom` (the server filters) the rows came filtered by these settings already: they all count as
213
+ * matched, whatever the settings the new model applied to itself in its constructor (the default ones).
212
214
  */
213
215
  restore(settings, custom = false) {
214
216
  this.custom = custom;
@@ -216,7 +218,9 @@ export class FilterModel extends EventTarget {
216
218
  this._settings = (settings || []).filter(s => this.model.columns[s.c]);
217
219
  this.colMap.clear();
218
220
  this._settings.forEach((s, i) => this.colMap.set(s.c, i));
219
- if (!custom && this._settings.length > 0)
221
+ if (custom)
222
+ this.matchAllRows();
223
+ else if (this._settings.length > 0)
220
224
  this.applyFilter(false);
221
225
  }
222
226
  filter(filter, dispatchEvent = true) {
@@ -302,10 +306,13 @@ export class FilterModel extends EventTarget {
302
306
  resetFilter(dispatchEvent = true) {
303
307
  this.settings = [];
304
308
  this.colMap.clear();
305
- this.model.rows.forEach(row => row.filterState = tree.FilterState.Matched);
306
- this.model.indexRows();
309
+ this.matchAllRows();
307
310
  if (dispatchEvent)
308
311
  this.dispatchEvent(new FilterEvent());
309
312
  }
313
+ matchAllRows() {
314
+ this.model.rows.forEach(row => row.filterState = tree.FilterState.Matched);
315
+ this.model.indexRows();
316
+ }
310
317
  }
311
318
  //# sourceMappingURL=filterModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterModel.js","sourceRoot":"","sources":["../../src/model/filterModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAc7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAQ,IAAY,EAAE,QAAqB,EAAE,EAAE;IAC/E,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACnF,OAAO,CAAC,IAAW,EAAE,EAAE;QACtB,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QACpB,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAA;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAQ,IAAa,EAAE,QAAqB,EAAE,EAAE;IAChF,OAAO,CAAC,IAAW,EAAE,EAAE,CAA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,CAAC;QAC3E,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACvB,IAAI,aAAa;YAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,EAAE,CAAC,CAAA;IACzD,CAAC;CAED","sourcesContent":["import { KeyValue, log, tree, utils } from \"@omegagrid/core\";\nimport { CellModel } from \"./cellModel\";\nimport { GridModel } from \"./gridModel\";\nimport { RowModel } from \"./rowModel\";\nimport { FilterOptions } from \"./options\";\nimport { CellType, FilterRange, FilterValue, NumericFilterClause, NumericFilterGroups, NumericFilterOperator } from \"../types\";\n\nexport type FilterMatcher = (cell: CellModel) => boolean;\n\nexport type FilterSettings = {\n\tc: number;\n\tterm: FilterValue;\n};\n\nexport const createTextMatcher = <TItem>(term: string, property: keyof TItem) => {\n\tconst regex = new RegExp(`${utils.escapeRegExp(utils.removeAccents(term))}`, 'ig');\n\treturn (item: TItem) => {\n\t\tregex.lastIndex = 0;\n\t\treturn regex.test(utils.removeAccents((item[property] ?? \"\").toString()));\n\t}\n};\n\nexport const createBoolMatcher = <TItem>(term: boolean, property: keyof TItem) => {\n\treturn (item: TItem) => !!item[property] === term;\n};\n\nexport const createMultiMatcher = <TItem>(term: KeyValue[], property: keyof TItem) => {\n\tconst keys = term.map(t => t.key?.toString());\n\treturn (item: TItem) => {\n\t\treturn item[property] == null ? false : keys.includes(item[property].toString());\n\t};\n};\n\nexport const createMultiMultiMatcher = <TItem>(_term: KeyValue[], _property: keyof TItem) => {\n\treturn (_item: TItem) => false;\n};\n\nexport const isFilterRange = (term: FilterValue): term is FilterRange =>\n\t!!term && typeof term === 'object' && !Array.isArray(term) && (term as FilterRange).kind === 'range';\n\nexport const isFilterRangeEmpty = (term: FilterRange) =>\n\t(term.from == null || term.from === '') && (term.to == null || term.to === '');\n\nexport const createRangeMatcher = <TItem>(term: FilterRange, property: keyof TItem, type: 'd'|'dt'|'tm') => {\n\tconst toNum = (v: unknown): number | null => {\n\t\tif (v == null || v === '') return null;\n\t\tif (v instanceof Date) return v.getTime();\n\t\tconst t = new Date(v as string).getTime();\n\t\treturn Number.isNaN(t) ? null : t;\n\t};\n\n\tconst from = toNum(term.from);\n\tlet to = toNum(term.to);\n\t// move to the end of the day for date types\n\t// TODO: remove dt, when time picker is implemented\n\tif (to !== null && (type === 'd' || type === 'dt')) to += 24 * 60 * 60 * 1000 - 1;\n\n\treturn (item: TItem) => {\n\t\tconst v = toNum(item[property]);\n\t\tif (v === null) return false;\n\t\tif (from !== null && v < from) return false;\n\t\tif (to !== null && v > to) return false;\n\t\treturn true;\n\t};\n};\n\n// number token: optional sign, digits, optional decimal part using '.' or ',' as separator\nconst NUM_TOKEN = '[-+]?\\\\d+(?:[.,]\\\\d+)?';\nconst toClauseNumber = (t: string) => Number(t.replace(',', '.'));\n\n/** True when the whole (trimmed) input is a single bare number, e.g. `42`, `-3.5`, `1,5`. */\nexport const isSingleNumber = (input: string) => new RegExp(`^${NUM_TOKEN}$`).test(input.trim());\n\n/**\n * Parse a numeric filter expression into a disjunction of conjunctions\n * (OR groups, each an AND-combined list of clauses).\n *\n * Supported syntax:\n * - operators `>`, `>=`, `<`, `<=`, `=`/`==`, `!=`/`<>` followed by a number (e.g. `> 100`, `=42`, `!=5`)\n * - a bare number, treated as an exact match `= n` (e.g. `42`)\n * - a range `a..b`, expanded to `>= a` and `<= b` (e.g. `10..20`)\n * - `and` / `or` connectors (case-insensitive), e.g. `<10 or >20`, `>10 and <20`.\n *\n * Combining rules: an explicit `or` starts a new OR group, an explicit `and` keeps\n * clauses in the same AND group. When no connector is given between two clauses the\n * implicit connector is OR if both are exact (`=`) clauses — a value list such as\n * `1 2 3` — and AND otherwise (comparisons narrow, e.g. `>10 <20`).\n *\n * Note: a lone bare number is parsed here as `= n`; callers that want the\n * \"contains\" text-search behaviour for a single number must check {@link isSingleNumber}.\n *\n * Decimal separator may be `.` or `,`. Tokens that cannot be parsed are ignored.\n */\nexport const parseNumericExpression = (input: string): NumericFilterGroups => {\n\tconst groups: NumericFilterClause[][] = [];\n\tif (!input) return groups;\n\n\tlet current: NumericFilterClause[] = [];\n\tlet pending: 'and' | 'or' | null = null; // explicit connector awaiting the next clause\n\tlet lastOp: NumericFilterOperator | null = null;\n\n\tconst flush = () => { if (current.length > 0) { groups.push(current); current = []; } };\n\n\t// add one AND-unit (a single clause, or the two bounds of a range), honouring the\n\t// pending explicit connector or the implicit default (OR between two `=`, else AND)\n\tconst addUnit = (clauses: NumericFilterClause[]) => {\n\t\tconst first = groups.length === 0 && current.length === 0;\n\t\tif (!first) {\n\t\t\tconst connector = pending ?? ((lastOp === '=' && clauses[0].op === '=') ? 'or' : 'and');\n\t\t\tif (connector === 'or') flush();\n\t\t}\n\t\tcurrent.push(...clauses);\n\t\tpending = null;\n\t\tlastOp = clauses[clauses.length - 1].op;\n\t};\n\n\tconst tokenRe = new RegExp(\n\t\t`(${NUM_TOKEN})\\\\s*\\\\.\\\\.\\\\s*(${NUM_TOKEN})` + // 1,2 range a..b\n\t\t`|(>=|<=|<>|!=|==|=|>|<)\\\\s*(${NUM_TOKEN})` + // 3,4 comparison clause\n\t\t`|\\\\b(and|or)\\\\b` + // 5 connector\n\t\t`|(${NUM_TOKEN})`, // 6 bare number (exact match)\n\t\t'gi'\n\t);\n\n\tlet m: RegExpExecArray | null;\n\twhile ((m = tokenRe.exec(input)) !== null) {\n\t\tif (m[1] != null) {\n\t\t\taddUnit([{ op: '>=', value: toClauseNumber(m[1]) }, { op: '<=', value: toClauseNumber(m[2]) }]);\n\t\t} else if (m[3] != null) {\n\t\t\tconst op: NumericFilterOperator = m[3] === '==' ? '=' : m[3] === '<>' ? '!=' : m[3] as NumericFilterOperator;\n\t\t\taddUnit([{ op, value: toClauseNumber(m[4]) }]);\n\t\t} else if (m[5] != null) {\n\t\t\tpending = m[5].toLowerCase() === 'or' ? 'or' : 'and';\n\t\t} else if (m[6] != null) {\n\t\t\taddUnit([{ op: '=', value: toClauseNumber(m[6]) }]);\n\t\t}\n\t}\n\tflush();\n\treturn groups;\n};\n\nexport const createNumericMatcher = <TItem>(groups: NumericFilterGroups, property: keyof TItem) => {\n\tconst test = (v: number, c: NumericFilterClause) => {\n\t\tswitch (c.op) {\n\t\t\tcase '>': return v > c.value;\n\t\t\tcase '>=': return v >= c.value;\n\t\t\tcase '<': return v < c.value;\n\t\t\tcase '<=': return v <= c.value;\n\t\t\tcase '=': return v === c.value;\n\t\t\tcase '!=': return v !== c.value;\n\t\t}\n\t};\n\treturn (item: TItem) => {\n\t\tif (groups.length === 0) return true;\n\t\tconst raw = item[property];\n\t\tif (raw == null || raw === '') return false;\n\t\tconst v = typeof raw === 'number' ? raw : Number(raw);\n\t\tif (Number.isNaN(v)) return false;\n\t\t// value matches if it satisfies every clause of at least one OR group\n\t\treturn groups.some(group => group.every(c => test(v, c)));\n\t};\n};\n\nexport const createCellMatcher = (type: CellType, term: FilterValue, property: keyof CellModel) => {\n\tproperty = property ?? 'value';\n\t// range terms come only from the date/datetime/time range popup\n\tif ((type === 'd' || type === 'dt' || type === 'tm') && isFilterRange(term)) {\n\t\treturn createRangeMatcher<CellModel>(term, property, type);\n\t}\n\tif (type === 'n') {\n\t\tconst str = (term?.toString()) ?? '';\n\t\t// a lone bare number -> plain \"contains\" text search; anything else -> numeric expression\n\t\tif (isSingleNumber(str)) return createTextMatcher<CellModel>(str.trim(), 'formattedValue');\n\t\tconst groups = parseNumericExpression(str);\n\t\tif (groups.length > 0) return createNumericMatcher<CellModel>(groups, property);\n\t\treturn createTextMatcher<CellModel>(str, 'formattedValue');\n\t}\n\tif (type === 'b') return createBoolMatcher<CellModel>(term as boolean, property);\n\telse if (type === 's' && Array.isArray(term)) return createMultiMatcher<CellModel>((term as KeyValue[]), 'value');\n\telse if (type === 's') return createTextMatcher<CellModel>((term?.toString()), 'formattedValue');\n\telse if (type === 'm' && Array.isArray(term)) return createMultiMultiMatcher<CellModel>((term as KeyValue[]), property);\n\telse if (type === 'd') return createTextMatcher<CellModel>((term?.toString()) as string, 'formattedValue');\n\telse if (type === 'dt') return createTextMatcher<CellModel>((term?.toString()) as string, 'formattedValue');\n\telse if (type === 'tm') return createTextMatcher<CellModel>((term?.toString()) as string, 'formattedValue');\n\t// text search in the value must not see the quote prefix, a custom property is kept as is\n\treturn createTextMatcher<CellModel>((term?.toString()) as string, property === 'value' ? 'plainValue' : property);\n}\n\nexport class FilterEvent extends Event {\n\tconstructor() {\n\t\tsuper('filter', {bubbles: false, cancelable: true, composed: true});\n\t}\n}\n\nexport class FilterModel extends EventTarget {\n\t\n\tpublic custom = false;\n\n\tprivate colMap = new Map<number, number>();\n\tprivate _settings: FilterSettings[] = [];\n\tget settings() { return this._settings }\n\tset settings(v: FilterSettings[]|null) {\n\t\tthis._settings = v || [];\n\t\tthis.colMap.clear();\n\t\tif (this.settings.length > 0) {\n\t\t\tthis.settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\t\tthis.applyFilter();\n\t\t\tlog.getLogger().info(`filtering applied: ${JSON.stringify(this.settings)}`);\n\t\t}\n\t}\n\n\tconstructor(\n\t\tpublic readonly model: GridModel,\n\t\tsettings: FilterSettings[]|null = null\n\t) {\n\t\tsuper();\n\t\tthis.settings = settings;\n\t}\n\n\t/**\n\t * Get filtering settings for specified column\n\t * @param c column index\n\t */\n\tget(c: number) {\n\t\treturn this.colMap.has(c) ? this.settings[this.colMap.get(c)] : null;\n\t}\n\n\t/**\n\t * Restore settings captured from a previous model instance (grid refresh recreates the model). \n\t */\n\trestore(settings: FilterSettings[], custom = false) {\n\t\tthis.custom = custom;\n\t\t// drop settings for columns that no longer exist in the refreshed model\n\t\tthis._settings = (settings || []).filter(s => this.model.columns[s.c]);\n\t\tthis.colMap.clear();\n\t\tthis._settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\tif (!custom && this._settings.length > 0) this.applyFilter(false);\n\t}\n\n\tfilter(filter: FilterSettings, dispatchEvent = true) {\n\t\tconst filterSetting = this.get(filter.c);\n\t\tconst empty = filter.term === null || filter.term === ''\n\t\t\t|| (isFilterRange(filter.term) && isFilterRangeEmpty(filter.term));\n\n\t\tif (filterSetting && empty) {\n\t\t\t// remove; splice shifts the following slots, so the map must be rebuilt\n\t\t\tthis.settings.splice(this.colMap.get(filter.c), 1);\n\t\t\tthis.colMap.clear();\n\t\t\tthis.settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\t} else if (filterSetting) {\n\t\t\t// update\n\t\t\tfilterSetting.term = filter.term;\n\t\t} else if (!empty) {\n\t\t\t// add\n\t\t\tthis.colMap.set(filter.c, this.settings.length);\n\t\t\tthis.settings.push(filter);\n\t\t}\n\n\t\tif (!this.custom) {\n\t\t\tif (this.settings.length > 0) {\n\t\t\t\tthis.applyFilter(false);\n\t\t\t} else {\n\t\t\t\tthis.resetFilter(false);\n\t\t\t}\n\t\t}\n\n\t\tif (dispatchEvent) this.dispatchEvent(new FilterEvent())\n\t}\n\n\tapplyFilter(dispatchEvent = true) {\n\t\tconst cellMatchers: {c: number, matcher: FilterMatcher}[] = [];\n\t\tthis.settings.forEach((s) => {\n\t\t\tconst column = this.model.columns[s.c];\n\t\t\tcellMatchers.push({c: s.c, matcher: createCellMatcher(column.type, s.term, column.filter?.property)});\n\t\t});\n\n\t\tconst count = cellMatchers.length;\n\t\tconst rowMatcher = (row: RowModel) => {\n\t\t\tif (!row.filterable) return true;\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tif (!cellMatchers[i].matcher(row.cell(cellMatchers[i].c))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\n\t\tconst includeParents = (this.model.options.filters as FilterOptions)?.includeParents ?? true;\n\t\tconst includeChildren = (this.model.options.filters as FilterOptions)?.includeChildren ?? true;\n\n\t\tconst visitedRows = new Set<number>();\n\t\tthis.model.rows.forEach(row => {\n\t\t\tconst visited = visitedRows.has(row.index);\n\n\t\t\tif (rowMatcher(row)) {\n\t\t\t\trow.filterState = tree.FilterState.Matched;\n\t\t\t\tif (includeParents) {\n\t\t\t\t\trow.walkUp((parent: RowModel) => {\n\t\t\t\t\t\tif (visitedRows.has(parent.index) && parent.filterState > 0) return false;\n\t\t\t\t\t\tparent.filterState = tree.FilterState.ChildMatched;\n\t\t\t\t\t\tvisitedRows.add(parent.index);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (includeChildren) {\n\t\t\t\t\trow.walk((child: RowModel) => {\n\t\t\t\t\t\tif (visitedRows.has(child.index) && child.filterState > 0) return false;\n\t\t\t\t\t\tchild.filterState = tree.FilterState.ParentMatched;\n\t\t\t\t\t\tvisitedRows.add(child.index);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (!visited) {\n\t\t\t\trow.filterState = tree.FilterState.Filtered;\n\t\t\t}\n\n\t\t\tvisitedRows.add(row.index);\n\t\t});\n\n\t\tthis.model.indexRows();\n\t\tif (dispatchEvent) this.dispatchEvent(new FilterEvent())\n\t}\n\n\tresetFilter(dispatchEvent = true) {\n\t\tthis.settings = [];\n\t\tthis.colMap.clear();\n\t\tthis.model.rows.forEach(row => row.filterState = tree.FilterState.Matched);\n\t\tthis.model.indexRows();\n\t\tif (dispatchEvent) this.dispatchEvent(new FilterEvent())\n\t}\n\n}"]}
1
+ {"version":3,"file":"filterModel.js","sourceRoot":"","sources":["../../src/model/filterModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAc7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAQ,IAAY,EAAE,QAAqB,EAAE,EAAE;IAC/E,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACnF,OAAO,CAAC,IAAW,EAAE,EAAE;QACtB,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QACpB,OAAO,KAAK,CAAC,IAAI,C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C,IAAI,WAAW,EAAE,CAAC,CAAA;IACzD,CAAC;IAED,WAAW,CAAC,aAAa,GAAG,IAAI;QAC/B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,aAAa;YAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,EAAE,CAAC,CAAA;IACzD,CAAC;IAEO,YAAY;QACnB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;IACxB,CAAC;CAED","sourcesContent":["import { KeyValue, log, tree, utils } from \"@omegagrid/core\";\nimport { CellModel } from \"./cellModel\";\nimport { GridModel } from \"./gridModel\";\nimport { RowModel } from \"./rowModel\";\nimport { FilterOptions } from \"./options\";\nimport { CellType, FilterRange, FilterValue, NumericFilterClause, NumericFilterGroups, NumericFilterOperator } from \"../types\";\n\nexport type FilterMatcher = (cell: CellModel) => boolean;\n\nexport type FilterSettings = {\n\tc: number;\n\tterm: FilterValue;\n};\n\nexport const createTextMatcher = <TItem>(term: string, property: keyof TItem) => {\n\tconst regex = new RegExp(`${utils.escapeRegExp(utils.removeAccents(term))}`, 'ig');\n\treturn (item: TItem) => {\n\t\tregex.lastIndex = 0;\n\t\treturn regex.test(utils.removeAccents((item[property] ?? \"\").toString()));\n\t}\n};\n\nexport const createBoolMatcher = <TItem>(term: boolean, property: keyof TItem) => {\n\treturn (item: TItem) => !!item[property] === term;\n};\n\nexport const createMultiMatcher = <TItem>(term: KeyValue[], property: keyof TItem) => {\n\tconst keys = term.map(t => t.key?.toString());\n\treturn (item: TItem) => {\n\t\treturn item[property] == null ? false : keys.includes(item[property].toString());\n\t};\n};\n\nexport const createMultiMultiMatcher = <TItem>(_term: KeyValue[], _property: keyof TItem) => {\n\treturn (_item: TItem) => false;\n};\n\nexport const isFilterRange = (term: FilterValue): term is FilterRange =>\n\t!!term && typeof term === 'object' && !Array.isArray(term) && (term as FilterRange).kind === 'range';\n\nexport const isFilterRangeEmpty = (term: FilterRange) =>\n\t(term.from == null || term.from === '') && (term.to == null || term.to === '');\n\nexport const createRangeMatcher = <TItem>(term: FilterRange, property: keyof TItem, type: 'd'|'dt'|'tm') => {\n\tconst toNum = (v: unknown): number | null => {\n\t\tif (v == null || v === '') return null;\n\t\tif (v instanceof Date) return v.getTime();\n\t\tconst t = new Date(v as string).getTime();\n\t\treturn Number.isNaN(t) ? null : t;\n\t};\n\n\tconst from = toNum(term.from);\n\tlet to = toNum(term.to);\n\t// move to the end of the day for date types\n\t// TODO: remove dt, when time picker is implemented\n\tif (to !== null && (type === 'd' || type === 'dt')) to += 24 * 60 * 60 * 1000 - 1;\n\n\treturn (item: TItem) => {\n\t\tconst v = toNum(item[property]);\n\t\tif (v === null) return false;\n\t\tif (from !== null && v < from) return false;\n\t\tif (to !== null && v > to) return false;\n\t\treturn true;\n\t};\n};\n\n// number token: optional sign, digits, optional decimal part using '.' or ',' as separator\nconst NUM_TOKEN = '[-+]?\\\\d+(?:[.,]\\\\d+)?';\nconst toClauseNumber = (t: string) => Number(t.replace(',', '.'));\n\n/** True when the whole (trimmed) input is a single bare number, e.g. `42`, `-3.5`, `1,5`. */\nexport const isSingleNumber = (input: string) => new RegExp(`^${NUM_TOKEN}$`).test(input.trim());\n\n/**\n * Parse a numeric filter expression into a disjunction of conjunctions\n * (OR groups, each an AND-combined list of clauses).\n *\n * Supported syntax:\n * - operators `>`, `>=`, `<`, `<=`, `=`/`==`, `!=`/`<>` followed by a number (e.g. `> 100`, `=42`, `!=5`)\n * - a bare number, treated as an exact match `= n` (e.g. `42`)\n * - a range `a..b`, expanded to `>= a` and `<= b` (e.g. `10..20`)\n * - `and` / `or` connectors (case-insensitive), e.g. `<10 or >20`, `>10 and <20`.\n *\n * Combining rules: an explicit `or` starts a new OR group, an explicit `and` keeps\n * clauses in the same AND group. When no connector is given between two clauses the\n * implicit connector is OR if both are exact (`=`) clauses — a value list such as\n * `1 2 3` — and AND otherwise (comparisons narrow, e.g. `>10 <20`).\n *\n * Note: a lone bare number is parsed here as `= n`; callers that want the\n * \"contains\" text-search behaviour for a single number must check {@link isSingleNumber}.\n *\n * Decimal separator may be `.` or `,`. Tokens that cannot be parsed are ignored.\n */\nexport const parseNumericExpression = (input: string): NumericFilterGroups => {\n\tconst groups: NumericFilterClause[][] = [];\n\tif (!input) return groups;\n\n\tlet current: NumericFilterClause[] = [];\n\tlet pending: 'and' | 'or' | null = null; // explicit connector awaiting the next clause\n\tlet lastOp: NumericFilterOperator | null = null;\n\n\tconst flush = () => { if (current.length > 0) { groups.push(current); current = []; } };\n\n\t// add one AND-unit (a single clause, or the two bounds of a range), honouring the\n\t// pending explicit connector or the implicit default (OR between two `=`, else AND)\n\tconst addUnit = (clauses: NumericFilterClause[]) => {\n\t\tconst first = groups.length === 0 && current.length === 0;\n\t\tif (!first) {\n\t\t\tconst connector = pending ?? ((lastOp === '=' && clauses[0].op === '=') ? 'or' : 'and');\n\t\t\tif (connector === 'or') flush();\n\t\t}\n\t\tcurrent.push(...clauses);\n\t\tpending = null;\n\t\tlastOp = clauses[clauses.length - 1].op;\n\t};\n\n\tconst tokenRe = new RegExp(\n\t\t`(${NUM_TOKEN})\\\\s*\\\\.\\\\.\\\\s*(${NUM_TOKEN})` + // 1,2 range a..b\n\t\t`|(>=|<=|<>|!=|==|=|>|<)\\\\s*(${NUM_TOKEN})` + // 3,4 comparison clause\n\t\t`|\\\\b(and|or)\\\\b` + // 5 connector\n\t\t`|(${NUM_TOKEN})`, // 6 bare number (exact match)\n\t\t'gi'\n\t);\n\n\tlet m: RegExpExecArray | null;\n\twhile ((m = tokenRe.exec(input)) !== null) {\n\t\tif (m[1] != null) {\n\t\t\taddUnit([{ op: '>=', value: toClauseNumber(m[1]) }, { op: '<=', value: toClauseNumber(m[2]) }]);\n\t\t} else if (m[3] != null) {\n\t\t\tconst op: NumericFilterOperator = m[3] === '==' ? '=' : m[3] === '<>' ? '!=' : m[3] as NumericFilterOperator;\n\t\t\taddUnit([{ op, value: toClauseNumber(m[4]) }]);\n\t\t} else if (m[5] != null) {\n\t\t\tpending = m[5].toLowerCase() === 'or' ? 'or' : 'and';\n\t\t} else if (m[6] != null) {\n\t\t\taddUnit([{ op: '=', value: toClauseNumber(m[6]) }]);\n\t\t}\n\t}\n\tflush();\n\treturn groups;\n};\n\nexport const createNumericMatcher = <TItem>(groups: NumericFilterGroups, property: keyof TItem) => {\n\tconst test = (v: number, c: NumericFilterClause) => {\n\t\tswitch (c.op) {\n\t\t\tcase '>': return v > c.value;\n\t\t\tcase '>=': return v >= c.value;\n\t\t\tcase '<': return v < c.value;\n\t\t\tcase '<=': return v <= c.value;\n\t\t\tcase '=': return v === c.value;\n\t\t\tcase '!=': return v !== c.value;\n\t\t}\n\t};\n\treturn (item: TItem) => {\n\t\tif (groups.length === 0) return true;\n\t\tconst raw = item[property];\n\t\tif (raw == null || raw === '') return false;\n\t\tconst v = typeof raw === 'number' ? raw : Number(raw);\n\t\tif (Number.isNaN(v)) return false;\n\t\t// value matches if it satisfies every clause of at least one OR group\n\t\treturn groups.some(group => group.every(c => test(v, c)));\n\t};\n};\n\nexport const createCellMatcher = (type: CellType, term: FilterValue, property: keyof CellModel) => {\n\tproperty = property ?? 'value';\n\t// range terms come only from the date/datetime/time range popup\n\tif ((type === 'd' || type === 'dt' || type === 'tm') && isFilterRange(term)) {\n\t\treturn createRangeMatcher<CellModel>(term, property, type);\n\t}\n\tif (type === 'n') {\n\t\tconst str = (term?.toString()) ?? '';\n\t\t// a lone bare number -> plain \"contains\" text search; anything else -> numeric expression\n\t\tif (isSingleNumber(str)) return createTextMatcher<CellModel>(str.trim(), 'formattedValue');\n\t\tconst groups = parseNumericExpression(str);\n\t\tif (groups.length > 0) return createNumericMatcher<CellModel>(groups, property);\n\t\treturn createTextMatcher<CellModel>(str, 'formattedValue');\n\t}\n\tif (type === 'b') return createBoolMatcher<CellModel>(term as boolean, property);\n\telse if (type === 's' && Array.isArray(term)) return createMultiMatcher<CellModel>((term as KeyValue[]), 'value');\n\telse if (type === 's') return createTextMatcher<CellModel>((term?.toString()), 'formattedValue');\n\telse if (type === 'm' && Array.isArray(term)) return createMultiMultiMatcher<CellModel>((term as KeyValue[]), property);\n\telse if (type === 'd') return createTextMatcher<CellModel>((term?.toString()) as string, 'formattedValue');\n\telse if (type === 'dt') return createTextMatcher<CellModel>((term?.toString()) as string, 'formattedValue');\n\telse if (type === 'tm') return createTextMatcher<CellModel>((term?.toString()) as string, 'formattedValue');\n\t// text search in the value must not see the quote prefix, a custom property is kept as is\n\treturn createTextMatcher<CellModel>((term?.toString()) as string, property === 'value' ? 'plainValue' : property);\n}\n\nexport class FilterEvent extends Event {\n\tconstructor() {\n\t\tsuper('filter', {bubbles: false, cancelable: true, composed: true});\n\t}\n}\n\nexport class FilterModel extends EventTarget {\n\t\n\tpublic custom = false;\n\n\tprivate colMap = new Map<number, number>();\n\tprivate _settings: FilterSettings[] = [];\n\tget settings() { return this._settings }\n\tset settings(v: FilterSettings[]|null) {\n\t\tthis._settings = v || [];\n\t\tthis.colMap.clear();\n\t\tif (this.settings.length > 0) {\n\t\t\tthis.settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\t\tthis.applyFilter();\n\t\t\tlog.getLogger().info(`filtering applied: ${JSON.stringify(this.settings)}`);\n\t\t}\n\t}\n\n\tconstructor(\n\t\tpublic readonly model: GridModel,\n\t\tsettings: FilterSettings[]|null = null\n\t) {\n\t\tsuper();\n\t\tthis.settings = settings;\n\t}\n\n\t/**\n\t * Get filtering settings for specified column\n\t * @param c column index\n\t */\n\tget(c: number) {\n\t\treturn this.colMap.has(c) ? this.settings[this.colMap.get(c)] : null;\n\t}\n\n\t/**\n\t * Restore settings captured from a previous model instance (grid refresh recreates the model).\n\t * With `custom` (the server filters) the rows came filtered by these settings already: they all count as\n\t * matched, whatever the settings the new model applied to itself in its constructor (the default ones).\n\t */\n\trestore(settings: FilterSettings[], custom = false) {\n\t\tthis.custom = custom;\n\t\t// drop settings for columns that no longer exist in the refreshed model\n\t\tthis._settings = (settings || []).filter(s => this.model.columns[s.c]);\n\t\tthis.colMap.clear();\n\t\tthis._settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\tif (custom) this.matchAllRows();\n\t\telse if (this._settings.length > 0) this.applyFilter(false);\n\t}\n\n\tfilter(filter: FilterSettings, dispatchEvent = true) {\n\t\tconst filterSetting = this.get(filter.c);\n\t\tconst empty = filter.term === null || filter.term === ''\n\t\t\t|| (isFilterRange(filter.term) && isFilterRangeEmpty(filter.term));\n\n\t\tif (filterSetting && empty) {\n\t\t\t// remove; splice shifts the following slots, so the map must be rebuilt\n\t\t\tthis.settings.splice(this.colMap.get(filter.c), 1);\n\t\t\tthis.colMap.clear();\n\t\t\tthis.settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\t} else if (filterSetting) {\n\t\t\t// update\n\t\t\tfilterSetting.term = filter.term;\n\t\t} else if (!empty) {\n\t\t\t// add\n\t\t\tthis.colMap.set(filter.c, this.settings.length);\n\t\t\tthis.settings.push(filter);\n\t\t}\n\n\t\tif (!this.custom) {\n\t\t\tif (this.settings.length > 0) {\n\t\t\t\tthis.applyFilter(false);\n\t\t\t} else {\n\t\t\t\tthis.resetFilter(false);\n\t\t\t}\n\t\t}\n\n\t\tif (dispatchEvent) this.dispatchEvent(new FilterEvent())\n\t}\n\n\tapplyFilter(dispatchEvent = true) {\n\t\tconst cellMatchers: {c: number, matcher: FilterMatcher}[] = [];\n\t\tthis.settings.forEach((s) => {\n\t\t\tconst column = this.model.columns[s.c];\n\t\t\tcellMatchers.push({c: s.c, matcher: createCellMatcher(column.type, s.term, column.filter?.property)});\n\t\t});\n\n\t\tconst count = cellMatchers.length;\n\t\tconst rowMatcher = (row: RowModel) => {\n\t\t\tif (!row.filterable) return true;\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tif (!cellMatchers[i].matcher(row.cell(cellMatchers[i].c))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\n\t\tconst includeParents = (this.model.options.filters as FilterOptions)?.includeParents ?? true;\n\t\tconst includeChildren = (this.model.options.filters as FilterOptions)?.includeChildren ?? true;\n\n\t\tconst visitedRows = new Set<number>();\n\t\tthis.model.rows.forEach(row => {\n\t\t\tconst visited = visitedRows.has(row.index);\n\n\t\t\tif (rowMatcher(row)) {\n\t\t\t\trow.filterState = tree.FilterState.Matched;\n\t\t\t\tif (includeParents) {\n\t\t\t\t\trow.walkUp((parent: RowModel) => {\n\t\t\t\t\t\tif (visitedRows.has(parent.index) && parent.filterState > 0) return false;\n\t\t\t\t\t\tparent.filterState = tree.FilterState.ChildMatched;\n\t\t\t\t\t\tvisitedRows.add(parent.index);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (includeChildren) {\n\t\t\t\t\trow.walk((child: RowModel) => {\n\t\t\t\t\t\tif (visitedRows.has(child.index) && child.filterState > 0) return false;\n\t\t\t\t\t\tchild.filterState = tree.FilterState.ParentMatched;\n\t\t\t\t\t\tvisitedRows.add(child.index);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (!visited) {\n\t\t\t\trow.filterState = tree.FilterState.Filtered;\n\t\t\t}\n\n\t\t\tvisitedRows.add(row.index);\n\t\t});\n\n\t\tthis.model.indexRows();\n\t\tif (dispatchEvent) this.dispatchEvent(new FilterEvent())\n\t}\n\n\tresetFilter(dispatchEvent = true) {\n\t\tthis.settings = [];\n\t\tthis.colMap.clear();\n\t\tthis.matchAllRows();\n\t\tif (dispatchEvent) this.dispatchEvent(new FilterEvent())\n\t}\n\n\tprivate matchAllRows() {\n\t\tthis.model.rows.forEach(row => row.filterState = tree.FilterState.Matched);\n\t\tthis.model.indexRows();\n\t}\n\n}"]}
@@ -158,7 +158,15 @@ export declare class GridModel implements Model<GridSource> {
158
158
  r: number;
159
159
  }): Viewport;
160
160
  calculateViewport(): CellModel[];
161
- getValuesInRange(range: CellRange, formattedValues?: boolean): Matrix<unknown>;
161
+ /**
162
+ * Whether the row is one of those the table shows: not hidden, not filtered out and under no collapsed
163
+ * row. A row that dropped out keeps its last visibleIndex, so only the visible row list itself tells.
164
+ */
165
+ isRowVisible(row: RowModel): boolean;
166
+ /**
167
+ * @param visibleOnly leave out the rows the table does not show (filtered out, hidden, collapsed)
168
+ */
169
+ getValuesInRange(range: CellRange, formattedValues?: boolean, visibleOnly?: boolean): Matrix<unknown>;
162
170
  setRowExpandLevel(level: number): void;
163
171
  setColumnExpandLevel(level: number): void;
164
172
  getViewportRange(): CellRange;
@@ -168,8 +176,11 @@ export declare class GridModel implements Model<GridSource> {
168
176
  getRowIterator(range: CellRange, withinViewport?: boolean): IterableAxisRange<RowModel>;
169
177
  getColumnIterator(range: CellRange, withinViewport?: boolean): IterableAxisRange<ColumnModel>;
170
178
  getCellArray(range: CellRange): CellModel[];
171
- transformRangeToMatrix<T>(range: CellRange, transform: (cell: CellModel) => T): Matrix<T>;
172
- getCellMatrix(range: CellRange): Matrix<CellModel>;
179
+ /**
180
+ * @param visibleOnly leave out the rows the table does not show (filtered out, hidden, collapsed)
181
+ */
182
+ transformRangeToMatrix<T>(range: CellRange, transform: (cell: CellModel) => T, visibleOnly?: boolean): Matrix<T>;
183
+ getCellMatrix(range: CellRange, visibleOnly?: boolean): Matrix<CellModel>;
173
184
  getValueMatrix(range: CellRange): Matrix<unknown>;
174
185
  shift(options: ShiftOptions): void;
175
186
  clearCalculations(all?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"gridModel.d.ts","sourceRoot":"","sources":["../../src/model/gridModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,gBAAgB,EAAE,QAAQ,EAAE,KAAK,E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E,SAAS,KAAK,CAAC,EAAE,WAAW,UAAQ,GAAG,MAAM,CAAC,CAAC,CAAC;IAiB9G,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,UAAQ;IAInD,cAAc,CAAC,KAAK,EAAE,SAAS;IAI/B,KAAK,CAAC,OAAO,EAAE,YAAY;IAS3B,iBAAiB,CAAC,GAAG,UAAQ;IAK7B,iBAAiB;IAOjB,qBAAqB;IASrB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,UAAQ;IAczD,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAe1C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAC,QAAQ,EAAE,EAAE,KAAK,UAAQ;IAehE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAUvC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAS1D,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAS7D,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,WAAW;IA8C3C,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,UAAO,GAAG,SAAS;IAOnF,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,SAAS;IAO3D,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAOvE,cAAc;IAQd,iBAAiB;IAQjB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAI,QAAQ;CAa/C"}
@@ -549,22 +549,34 @@ export class GridModel {
549
549
  calculateViewport() {
550
550
  return this._viewport ? this.calculations.calculateViewport(this._viewport) : [];
551
551
  }
552
- getValuesInRange(range, formattedValues = false) {
552
+ /**
553
+ * Whether the row is one of those the table shows: not hidden, not filtered out and under no collapsed
554
+ * row. A row that dropped out keeps its last visibleIndex, so only the visible row list itself tells.
555
+ */
556
+ isRowVisible(row) {
557
+ return this.visibleRows[row.visibleIndex] === row;
558
+ }
559
+ /**
560
+ * @param visibleOnly leave out the rows the table does not show (filtered out, hidden, collapsed)
561
+ */
562
+ getValuesInRange(range, formattedValues = false, visibleOnly = false) {
553
563
  range = range.intersect(this.gridRange);
554
564
  if (!range)
555
565
  return [];
556
- const { columns, rows } = range.size;
557
- const values = new Array(rows);
558
- let i = 0, j = 0;
559
- let row;
566
+ const { columns } = range.size;
567
+ const values = [];
568
+ let j = 0;
569
+ let row, rowValues;
560
570
  for (let r = range.r1; r <= range.r2; r++) {
561
- values[i] = new Array(columns);
562
- j = 0;
563
571
  row = this.rows[r];
572
+ if (visibleOnly && !this.isRowVisible(row))
573
+ continue;
574
+ rowValues = new Array(columns);
575
+ j = 0;
564
576
  for (let c = range.c1; c <= range.c2; c++) {
565
- values[i][j++] = formattedValues ? row.cell(c).formattedValue : row.cell(c).value;
577
+ rowValues[j++] = formattedValues ? row.cell(c).formattedValue : row.cell(c).value;
566
578
  }
567
- ++i;
579
+ values.push(rowValues);
568
580
  }
569
581
  return values;
570
582
  }
@@ -608,13 +620,16 @@ export class GridModel {
608
620
  }
609
621
  return cells;
610
622
  }
611
- transformRangeToMatrix(range, transform) {
623
+ /**
624
+ * @param visibleOnly leave out the rows the table does not show (filtered out, hidden, collapsed)
625
+ */
626
+ transformRangeToMatrix(range, transform, visibleOnly = false) {
612
627
  let row, cell, rowValues;
613
628
  range = range.intersect(this.gridRange);
614
629
  const cells = [];
615
630
  for (let r = range.r1; r <= range.r2; r++) {
616
631
  row = this.rows[r];
617
- if (!row)
632
+ if (!row || (visibleOnly && !this.isRowVisible(row)))
618
633
  continue;
619
634
  rowValues = [];
620
635
  for (let c = range.c1; c <= range.c2; c++) {
@@ -626,8 +641,8 @@ export class GridModel {
626
641
  }
627
642
  return cells;
628
643
  }
629
- getCellMatrix(range) {
630
- return this.getModelByRange(range)?.transformRangeToMatrix(range, c => c);
644
+ getCellMatrix(range, visibleOnly = false) {
645
+ return this.getModelByRange(range)?.transformRangeToMatrix(range, c => c, visibleOnly);
631
646
  }
632
647
  getValueMatrix(range) {
633
648
  return this.getModelByRange(range)?.transformRangeToMatrix(range, c => c.value);
@@ -1 +1 @@
1
- {"version":3,"file":"gridModel.js","sourceRoot":"","sources":["../../src/model/gridModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAqC,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAA2B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAmB,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAoC,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAc,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,WAAW,EAAyB,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAa,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAc,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAS,MAAM,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,W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AC;CAED","sourcesContent":["import { Matrix, tree, CustomProperties, Location, Model } from \"@omegagrid/core\";\nimport { log } from \"@omegagrid/core\";\nimport { CellValueType, ShiftOptions, SpillOptions, SpillResult, TabOptions } from \"../types\";\nimport { CalculationModel } from \"./calculationModel\";\nimport { CellRange } from \"../common/range\";\nimport { ConditionalFormats, ConditionalFormatSource } from \"./conditionalFormats\";\nimport { Sparklines, SparklineSource } from \"../sparklines/sparklines\";\nimport { CellModel, CellSource } from \"./cellModel\";\nimport { ColumnModel, ColumnHeaderModel, ColumnSource } from \"./columnModel\";\nimport { GroupModel } from \"./groupModel\";\nimport { CommentModel, CommentSource } from \"./commentModel\";\nimport { IterableAxisRange, IterableRange } from \"./iterableRange\";\nimport { NameSource, NamingModel } from \"./namingModel\";\nimport { initOptions, Options, OptionSource } from \"./options\";\nimport { RowModel, RowSource } from \"./rowModel\";\nimport { Style } from \"./style\";\nimport { StyleModel } from \"./styleModel\";\nimport { TableTheme, applyCellTheme, applyColumnTheme, applyRowTheme, applyTheme } from \"./tableTheme\";\nimport { SortingModel } from \"./sortingModel\";\nimport { Merge, Merges } from \"./merges\";\nimport { FilterModel } from \"./filterModel\";\n\n\n/** Source object type for grid */\nexport type GridSource = {\n\t/** grid index with group (readonly) */\n\tindex?: number,\n\t/** sheet name */\n\tname?: string,\n\t/** row array */\n\trows?: RowSource[],\n\t/** column array */\n\tcolumns?: ColumnSource[],\n\t/** cell array */\n\tcells?: CellSource[],\n\t/** grid options */\n\toptions?: OptionSource,\n\t/** sprakline definitions */\n\tsparklines?: SparklineSource[],\n\t/** conditional format definitions */\n\trules?: ConditionalFormatSource,\n\t/** comment array */\n\tcomments?: CommentSource[],\n\t/** style array */\n\tstyles?: Style[],\n\t/** renge names */\n\tnames?: NameSource[],\n\t/** custom properties */\n\tprops?: CustomProperties,\n\t/** tab settings used when grid is within group */\n\ttab?: TabOptions,\n\t/** table theme */\n\ttheme?: TableTheme,\n\t/** additional properties */\n\t[key: string]: unknown\n};\n\nconst DEFAULT_SOURCE_KEYS = [\n\t'index', 'name', 'rows', 'columns', 'cells', 'options', 'sparklines',\n\t'rules', 'comments', 'styles', 'names', 'props', 'tab', 'theme'\n];\n\nexport type Viewport = {\n\trows: RowModel[];\n\tcolumns: ColumnModel[];\n};\n\n/** the lowest and the highest index of the elements (a loop - the arrays may be large) */\nfunction indexBounds(elements: (RowModel|ColumnModel)[]): [number, number] {\n\tlet first = Infinity, last = -Infinity;\n\tfor (const element of elements) {\n\t\tif (element.index < first) first = element.index;\n\t\tif (element.index > last) last = element.index;\n\t}\n\treturn [first, last];\n}\n\nexport class GridModel implements Model<GridSource> {\n\t\n\tindex: number;\n\tname: string;\n\ttab: TabOptions;\n\trows: RowModel[];\n\tvisibleRows: RowModel[];\n\trowRoot: RowModel;\n\tcolRoot: ColumnModel;\n\tcolumns: ColumnModel[];\n\tvisibleColumns: ColumnModel[];\n\tvisibleColumnIndex: Record<number, number>;\n\totherSourceData: Record<string, unknown>;\n\totherModels: Record<string, Set<Model>> = {};\n\tautofitColumns: Set<number> = new Set();\n\tautofitRows: Set<number> = new Set();\n\n\treadonly merges = new Merges(this);\n\treadonly styles = new StyleModel(this);\n\treadonly comments = new CommentModel(this);\n\treadonly calculations = new CalculationModel(this);\n\treadonly names = new NamingModel(this);\n\treadonly sorting = new SortingModel(this);\n\treadonly filter = new FilterModel(this);\n\treadonly sparklines = new Sparklines(this);\n\treadonly conditionalFormats = new ConditionalFormats(this);\n\n\tprivate _mergedHeaders: (Merge & {h: ColumnHeaderModel})[];\n\tget mergedHeaders() { return this._mergedHeaders }\n\t\n\tprivate _filter = false\n\tget hasFilter() { return this._filter }\n\t\n\tprivate _maxRowLevel = 0;\n\tget hasRowTree() { return this._maxRowLevel > 0 }\n\tget hasRowTreeEnabled() { return this.hasRowTree && this.options.rowTree.enabled }\n\tget maxRowLevel() { return this._maxRowLevel }\n\t\n\tprivate _maxColumnLevel = 0;\n\tget hasColumnTree() { return this._maxColumnLevel > 0 }\n\tget hasColumnTreeEnabled() { return this.hasColumnTree && this.options.columnTree.enabled }\n\tget maxColumnLevel() { return this._maxColumnLevel }\n\t\n\tprivate _headerCount = 0;\n\tprivate _headerHeights: number[];\n\tget headerCount() { return this._headerCount }\n\tget columnHeaderCount() { return this.headerCount + (this.hasColumnTreeEnabled ? 1 : 0) + (this.hasFilter ? 1 : 0) }\n\n\tprivate _viewport: Viewport;\n\tprivate _levelBasedRowTree = true;\n\tprivate _levelBasedColTree = true;\n\n\tprotected _properties: CustomProperties;\n\tget properties() { return this._properties }\n\tset properties(v: CustomProperties) { this._properties = v }\n\n\tprotected _theme: TableTheme;\n\tget theme() { return this._theme }\n\tset theme(v: TableTheme) { this._theme = v }\n\n\tpublic readonly logger: log.Logger;\n\tpublic options: Options;\n\n\tget formulasEnabled() { return this.options.formulas !== false }\n\tpublic group: GroupModel;\n\n\tconstructor(source: GridSource, options?: Options, logger?: log.Logger) {\n\t\tthis.logger = logger;\n\t\tthis.options = options ?? initOptions(source.options);\n\t\tthis.populate(source);\n\t}\n\n\tgetConnectedModel(name: string) {\n\t\treturn this.group ? this.group.get(name) : null;\n\t}\n\n\tgetModelByRange(range: CellRange) {\n\t\treturn range.sheet ? this.getConnectedModel(range.sheet) : this;\n\t}\n\n\tgetCellByA1(a1: string) {\n\t\treturn this.getCellByRange(CellRange.fromA1(a1));\n\t}\n\n\tgetCellByRange(r: CellRange) {\n\t\treturn this.getCellByCoords(r.r1, r.c1);\n\t}\n\n\tgetCellByCoords(r: number, c: number) {\n\t\treturn this.rows[r]?.cell(c);\n\t}\n\n\tcell(coord1: string|number|CellRange, coord2?: number) {\n\t\tif (!isNaN(coord1 as number)) return this.getCellByCoords(coord1 as number, coord2 || 0);\n\t\tif (coord1 instanceof CellRange) return this.getCellByRange(coord1);\n\t\tif (typeof coord1 === 'string') return this.getCellByA1(coord1);\n\t\treturn null;\n\t}\n\n\tcreateRows(source: RowSource[], root = new RowModel(this, {l: -1}), indexOffset = 0) : [RowModel, RowModel[], number, boolean] {\n\t\tlet hasRowLevelBasedTree = false;\n\t\tlet hasRowParentBasedTree = false;\n\t\tthis.autofitRows.clear();\n\n\t\tconst rows = source.map((rowSource, r) => {\n\t\t\tif (!rowSource) rowSource = {};\n\t\t\tif (!isNaN(rowSource.l)) hasRowLevelBasedTree = true;\n\t\t\tif (rowSource.p != null) hasRowParentBasedTree = true;\n\t\t\tif (rowSource.h == 'auto') this.autofitRows.add(r);\n\t\t\tconst rowModel = new RowModel(this, rowSource);\n\t\t\trowModel.origIndex = r + indexOffset;\n\t\t\tif (rowModel.name) this.names.set(rowModel.name, CellRange.fullRow(r));\n\t\t\treturn rowModel;\n\t\t});\n\t\t\n\t\tlet maxRowLevel = -1;\n\t\tif (hasRowLevelBasedTree) maxRowLevel = tree.buildLevelBasedTree(rows, root, {\n\t\t\treverse: this.options.rowTree.reversed\n\t\t});\n\t\telse if (hasRowParentBasedTree) maxRowLevel = tree.buildParentBasedTree(rows, root);\n\t\telse root.children = rows;\n\n\t\tif (!hasRowParentBasedTree) hasRowLevelBasedTree = true; // default to level based tree\n\t\treturn [root, rows, maxRowLevel, hasRowLevelBasedTree];\n\t}\n\n\tinsertRowData(parent: RowModel, offset: number, source: RowSource[]) {\n\t\tconst res = this.createRows(source, new RowModel(this, {l: parent.level}), offset);\n\t\tthis._maxRowLevel = Math.max(this._maxRowLevel, res[2]);\n\t\tparent.insertChildren(res[0].children, offset);\n\t\tthis.indexRowsByTree();\n\t\tthis.applyThemeToRows(res[1]);\n\t}\n\n\tapplyTheme(theme: TableTheme, invalidateCellStyles?: boolean) {\n\t\tif (invalidateCellStyles) {\n\t\t\tfor (const cell of this.getInitializedCellIterator()) {\n\t\t\t\tcell.invalidateStyle();\n\t\t\t}\n\t\t}\n\t\tapplyTheme(theme, this);\n\t}\n\n\t/**\n\t * Applies the table theme onto the given rows only - inserted rows or rows\n\t * whose level changed: the row items are matched again and the cell items\n\t * are applied over their cells, whose cached styles are dropped. Does\n\t * nothing without a theme.\n\t */\n\tapplyThemeToRows(rows: RowModel[]) {\n\t\tif (!this.theme || !rows.length) return;\n\t\tconst [first, last] = indexBounds(rows);\n\t\tconst range = new CellRange(0, first, Infinity, last);\n\t\tapplyRowTheme(this.theme, this, rows);\n\t\tapplyCellTheme(this.theme, this, range);\n\t\tthis.invalidateCellStyles(range);\n\t}\n\n\t/** the column counterpart of applyThemeToRows */\n\tapplyThemeToColumns(columns: ColumnModel[]) {\n\t\tif (!this.theme || !columns.length) return;\n\t\tconst [first, last] = indexBounds(columns);\n\t\tconst range = new CellRange(first, 0, last, Infinity);\n\t\tapplyColumnTheme(this.theme, this, columns);\n\t\tapplyCellTheme(this.theme, this, range);\n\t\tthis.invalidateCellStyles(range);\n\t}\n\n\tprivate invalidateCellStyles(range: CellRange) {\n\t\tfor (const cell of new IterableRange(this, range.intersect(this.gridRange), true)) cell.invalidateStyle();\n\t}\n\n\tpopulate(source: GridSource) {\n\t\tthis.index = source.index;\n\t\tthis.name = source.name ?? this.name;\n\t\tthis.tab = source.tab;\n\t\t\n\t\tlet hasColLevelBasedTree = false;\n\t\tlet hasColParentBasedTree = false;\n\n\t\tif (!source.columns) source.columns = new Array(this.options.columns).fill({});\n\t\tif (!source.rows) source.rows = new Array(this.options.rows).fill({});\n\n\t\t// styles\n\t\tif (source.styles) this.styles.populate(source.styles);\n\t\t\n\t\t// columns\n\t\tthis.autofitColumns.clear();\n\t\tthis.columns = source.columns.map((columnSource, c) => {\n\t\t\tif (!columnSource) columnSource = {};\n\t\t\tif (columnSource.l !== 0 && columnSource.l != null) hasColLevelBasedTree = true;\n\t\t\tif (columnSource.p != null) hasColParentBasedTree = true;\n\t\t\tif (columnSource.w == 'auto') this.autofitColumns.add(c);\n\t\t\tconst colModel = new ColumnModel(this, columnSource);\n\t\t\tthis._filter = colModel.hasFilter || this._filter;\n\t\t\tif (colModel.name) this.names.set(colModel.name, CellRange.fullColumn(c));\n\t\t\treturn colModel;\n\t\t});\n \n\t\tthis._levelBasedColTree = hasColLevelBasedTree;\n\t\tthis._maxColumnLevel = -1;\n\t\tthis.colRoot = new ColumnModel(this, {l: -1});\n\t\tif (hasColLevelBasedTree) this._maxColumnLevel = tree.buildLevelBasedTree(this.columns, this.colRoot, {\n\t\t\treverse: this.options.columnTree.reversed\n\t\t});\n\t\telse if (hasColParentBasedTree) this._maxColumnLevel = tree.buildParentBasedTree(this.columns, this.colRoot);\n\t\telse this.colRoot.children = this.columns;\n\t\t\n\t\tif (!hasColParentBasedTree) this._levelBasedColTree = true; // default to level based tree\n\n\t\tthis.indexColumns();\n\t\tthis.indexVisibleColumns();\n\n\t\t// rows\n\t\t[this.rowRoot, this.rows, this._maxRowLevel, this._levelBasedRowTree] = this.createRows(source.rows);\n\t\tthis.indexRows();\n\t\tthis.indexVisibleRows();\n\t\tif (this.options.pageSize && this.options.pageSize <= this.rows.length) this.rowRoot.count = Infinity;\n\n\t\t// cells\n\t\tthis.merges.clear();\n\t\tsource.comments = source.comments || [];\n\t\tsource.cells?.forEach((cellSource, i) => {\n\t\t\tconst cell = this.rows[cellSource.r] ? this.rows[cellSource.r].cell(cellSource.c, cellSource) : null;\n\t\t\tif (!cell) {\n\t\t\t\tthis.logger?.error(`invalid cell definition (index ${i}): ${JSON.stringify(cellSource)}`);\n\t\t\t} else if (cellSource.cs > 1 || cellSource.rs > 1) {\n\t\t\t\tthis.merges.add({r: cell.r, c: cell.c, rs: cellSource.rs || 1, cs: cellSource.cs || 1});\n\t\t\t}\n\n\t\t\tif (cell && cellSource.comment) {\n\t\t\t\tsource.comments.push(Object.assign(cellSource.comment, {c: cellSource.c, r: cellSource.r}));\n\t\t\t}\n\t\t});\n\t\t\n\t\t// sparklines\n\t\tif (source.sparklines) {\n\t\t\ttry {\n\t\t\t\tthis.sparklines.populate(source.sparklines);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Sparkline init error: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// names\n\t\tif (source.names) {\n\t\t\ttry {\n\t\t\t\tthis.names.populate(source.names);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Named range init error: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// conditional formats\n\t\tif (source.rules) {\n\t\t\ttry {\n\t\t\t\tthis.conditionalFormats.populate(source.rules);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Conditional formats init error: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// theme\n\t\tif (source.theme) {\n\t\t\ttry {\n\t\t\t\tthis.applyTheme(source.theme);\n\t\t\t\tthis._theme = source.theme;\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Theme init error: ${error}`);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// comments\n\t\tif (source.comments) {\n\t\t\ttry {\n\t\t\t\tthis.comments.populate(source.comments);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Comment init error: ${error}`);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// custom properties\n\t\tthis._properties = source.props;\n\n\t\t// additional properties\n\t\tthis.otherSourceData = {};\n\t\tconst defaultKeys = new Set(DEFAULT_SOURCE_KEYS);\n\t\tconst keys = Object.keys(source).filter(k => !defaultKeys.has(k));\n\t\tkeys.forEach(k => this.otherSourceData[k] = source[k]);\n\n\t\t// default sort\n\t\tif (this.options.sorting?.defaultSettings) {\n\t\t\tthis.sorting.settings = this.options.sorting.defaultSettings;\n\t\t}\n\n\t\t// default filter\n\t\tif (this.options.filters?.defaultSettings) {\n\t\t\tthis.filter.settings = this.options.filters.defaultSettings;\n\t\t}\n\n\t\tthis.calcHeaderHeights();\n\t}\n\n\tgetSourceData() {\n\t\tconst data = {\n\t\t\tindex: this.index,\n\t\t\tname: this.name,\n\t\t\ttab: this.tab,\n\t\t\tcolumns: this.columns.map(col => col.getSourceData()),\n\t\t\trows: this.rows.map(row => row.getSourceData()),\n\t\t\tstyles: this.styles.getSourceData(),\n\t\t\trules: this.conditionalFormats.getSourceData(),\n\t\t\tsparklines: this.sparklines.getSourceData(),\n\t\t\tnames: this.names.getSourceData(),\n\t\t\toptions: this.options,\n\t\t} as GridSource;\n\n\t\tif (this._properties) data.props = this._properties;\n\n\t\tconst cells = [];\n\t\tlet cellData: CellSource;\n\t\tfor (let r = 0; r < this.rows.length; r++) {\n\t\t\tfor (let c = 0; c < this.columns.length; c++) {\n\t\t\t\tcellData = this.rows[r].cell(c).getSourceData();\n\t\t\t\tif (Object.keys(cellData).length > 0) {\n\t\t\t\t\tcellData.r = r;\n\t\t\t\t\tcellData.c = c;\n\t\t\t\t\tcells.push(cellData);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (cells.length > 0) data.cells = cells;\n\t\t\n\t\tconst styles = [] as Style[];\n\t\tthis.styles.clean();\n\t\tthis.styles.map.forEach(style => styles.push(style));\n\t\tif (styles.length > 0) data.styles = styles;\n\n\t\tconst otherModelKeys = new Set([\n\t\t\t...Object.keys(this.otherModels ?? {}),\n\t\t\t...Object.keys(this.otherSourceData ?? {})\n\t\t]);\n\t\totherModelKeys.forEach(k => data[k] = this.otherModels[k] \n\t\t\t? Array.from(this.otherModels[k]).map(m => m.getSourceData())\n\t\t\t: this.otherSourceData[k]\n\t\t);\n\n\t\treturn data;\n\t}\n\n\tcalcHeaderHeights() {\n\t\tthis._headerCount = 0;\n\t\tthis._headerHeights = [];\n\t\tthis.columns.forEach((column) => {\n\t\t\tthis._headerCount = column.header ? column.header.length : this._headerCount;\n\t\t\tif (this._headerHeights.length < this._headerCount) {\n\t\t\t\tthis._headerHeights.push(...Array(this._headerCount - this._headerHeights.length).fill(0));\n\t\t\t}\n\n\t\t\tcolumn.header?.forEach((h: ColumnHeaderModel, r) => {\n\t\t\t\tif (r >= this._headerHeights.length) {\n\t\t\t\t\tthis._headerHeights.push(0);\n\t\t\t\t}\n\t\t\t\tthis._headerHeights[r] = Math.max(this._headerHeights[r], h.height ?? 0);\n\t\t\t});\n\t\t});\n\t}\n\n\tindexRows() {\n\t\tthis.visibleRows = [];\n\t\tthis.rows.forEach((row, r) => {\n\t\t\trow.index = r;\n\t\t\tif (!row.isLoaded) row.collapsed = true;\n\t\t\tif (!row.hidden && row.filterState != tree.FilterState.Filtered) {\n\t\t\t\trow.visibleIndex = this.visibleRows.length;\n\t\t\t\tthis.visibleRows.push(row);\n\t\t\t}\n\t\t});\n\t}\n\n\tindexVisibleRows() {\n\t\tthis.visibleRows = [];\n\t\tlet r = 0;\n\t\tif (this._levelBasedRowTree) {\n\t\t\tthis.rowRoot.walkVisible((node: RowModel) => {\n\t\t\t\tnode.visibleIndex = r++;\n\t\t\t\tthis.visibleRows.push(node)\n\t\t\t});\n\n\t\t\t// reverse order of row index\n\t\t\tif (this.options.rowTree.reversed) {\n\t\t\t\tconst reversedVisibleRows = new Array(this.visibleRows.length);\n\t\t\t\tthis.visibleRows.forEach((row, i) => {\n\t\t\t\t\tr = this.visibleRows.length - i - 1;\n\t\t\t\t\trow.visibleIndex = r;\n\t\t\t\t\treversedVisibleRows[r] = row;\n\t\t\t\t});\n\t\t\t\tthis.visibleRows = reversedVisibleRows;\n\t\t\t}\n\t\t} else {\n\t\t\t// in parent based node rows do not have to respect tree order\n\t\t\tthis.rowRoot.walkVisible((node: RowModel) => this.visibleRows[node.index] = node);\n\t\t\tthis.visibleRows = this.visibleRows.filter(row => {\n\t\t\t\tif (row) {\n\t\t\t\t\trow.visibleIndex = r++;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}\n\t}\n\n\tindexRowsByTree() {\n\t\tthis.rows = [];\n\t\tlet r = 0;\n\t\tthis.rowRoot.walk((row: RowModel) => {\n\t\t\trow.index = r++;\n\t\t\tthis.rows.push(row);\n\t\t});\n\t\tif (this.options.rowTree.reversed) this.rows.reverse();\n\t\tthis.indexVisibleRows();\n\t}\n\n\tindexColumns() {\n\t\tthis.visibleColumns = [];\n\t\tthis.columns.forEach((column, c) => {\n\t\t\tcolumn.index = c;\n\t\t\tif (!column.hidden) this.visibleColumns.push(column);\n\t\t});\n\t}\n\n\tindexVisibleColumns() {\n\t\tthis.visibleColumns = [];\n\t\tthis.visibleColumnIndex = {};\n\t\tlet c = 0;\n\t\tthis.colRoot.walkVisible((node: ColumnModel) => {\n\t\t\tnode.visibleIndex = c;\n\t\t\tthis.visibleColumnIndex[node.index] = c++;\n\t\t\tthis.visibleColumns.push(node);\n\t\t});\n\n\t\t// reverse order of column index\n\t\tif (this.options.columnTree.reversed) {\n\t\t\tthis.visibleColumnIndex = {};\n\t\t\tconst reversedVisibleColumns = new Array(this.visibleColumns.length);\n\t\t\tthis.visibleColumns.forEach((column, i) => {\n\t\t\t\tc = this.visibleColumns.length - i - 1;\n\t\t\t\tcolumn.visibleIndex = c;\n\t\t\t\tthis.visibleColumnIndex[column.index] = c;\n\t\t\t\treversedVisibleColumns[c] = column;\n\t\t\t});\n\t\t\tthis.visibleColumns = reversedVisibleColumns;\n\t\t}\n\n\t\tthis.indexHeaders();\n\t}\n\n\tindexHeaders() {\n\t\tthis._mergedHeaders = [];\n\t\tthis._headerCount = 0;\n\t\tthis.colRoot.walkVisible((column: ColumnModel) => {\n\t\t\tthis._headerCount = Math.max(column.header ? column.header.length : 0, this._headerCount);\n\t\t\tcolumn.mergedHeaders.forEach(h => this._mergedHeaders.push({\n\t\t\t\th: h,\n\t\t\t\tc: column.index,\n\t\t\t\tr: h.r,\n\t\t\t\tcs: column.calculateRealColspan(h.cs ?? 1),\n\t\t\t\trs: h.rs ?? 1\n\t\t\t}));\n\t\t});\n\n\t\t// hidden header cells\n\t\tthis._mergedHeaders.forEach(h => {\n\t\t\tif (h.h.hidden) return;\n\t\t\t\n\t\t\tfor (let c = h.c; c < h.c + h.cs; c++) {\n\t\t\t\tfor (let r = h.r; r < h.r + h.rs; r++) {\n\t\t\t\t\tif ((r > h.r || c > h.c) && this.columns[c] && this.columns[c].header[r]) {\n\t\t\t\t\t\tthis.columns[c].header[r].hidden = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.calcHeaderHeights();\n\t}\n\n\tremoveHeader(r: number) {\n\t\tthis.columns.forEach(column => {\n\t\t\tif (r < column.header.length) column.header.splice(r, 1);\n\t\t});\n\t\tthis.indexHeaders();\n\t}\n\n\tclearRows = () : RowModel[] => {\n\t\tthis.rowRoot.clearChildren();\n\t\tthis.rows = [];\n\t\treturn this.rows;\n\t}\n\t\n\tclearColumns = () : ColumnModel[] => this.columns = [];\n\n\tclear() {\n\t\tthis.clearRows();\n\t\tthis.clearColumns();\n\t\tthis.resetViewport();\n\t}\n\n\tresetViewport() {\n\t\tthis._viewport = null;\n\t\treturn this;\n\t}\n\n\tgetViewport(\n\t\toffset: {c: number, r: number}, \n\t\tviewportSize: {w: number, h: number}, \n\t\tfreeze: {t: number, l: number, b: number, r: number},\n\t) : Viewport {\n\t\tconst viewportRows: RowModel[] = [];\n\t\tconst viewportColumns: ColumnModel[] = [];\n\n\t\tlet row: RowModel;\n\t\tlet remainingHeight = viewportSize.h;\n\t\tlet r = 0;\n\t\t// top rows\n\t\tfor (r = 0; r < freeze.t; r++) {\n\t\t\trow = this.visibleRows[r];\n\t\t\tremainingHeight -= row.height;\n\t\t\tviewportRows.push(row);\n\t\t}\n\n\t\t// bottom rows\n\t\tfor (r = this.visibleRows.length - freeze.b; r < this.visibleRows.length; r++) {\n\t\t\trow = this.visibleRows[r];\n\t\t\tremainingHeight -= row.height;\n\t\t}\n\n\t\t// center rows\n\t\tr = freeze.t + offset.r;\n\t\twhile (remainingHeight > 0 && r < this.visibleRows.length) {\n\t\t\trow = this.visibleRows[r++];\n\t\t\tremainingHeight -= row.height;\n\t\t\tviewportRows.push(row);\n\t\t}\n\n\t\t// bottom rows again\n\t\tfor (r = this.visibleRows.length - freeze.b; r < this.visibleRows.length; r++) {\n\t\t\tviewportRows.push(this.visibleRows[r]);\n\t\t}\n\n\t\tlet column: ColumnModel;\n\t\tlet remainingWidth = viewportSize.w;\n\t\tlet c = 0;\n\n\t\t// left columns\n\t\tfor (c = 0; c < freeze.l; c++) {\n\t\t\tcolumn = this.visibleColumns[c];\n\t\t\tremainingWidth -= column.width;\n\t\t\tviewportColumns.push(column);\n\t\t}\n\n\t\t// right columns\n\t\tfor (c = this.visibleColumns.length - freeze.r; c < this.visibleColumns.length; c++) {\n\t\t\tcolumn = this.visibleColumns[c];\n\t\t\tremainingWidth -= column.width;\n\t\t}\n\n\t\t// center columns\n\t\tc = freeze.l + offset.c;\n\t\twhile (remainingWidth > 0 && c < this.visibleColumns.length) {\n\t\t\tcolumn = this.visibleColumns[c++];\n\t\t\tremainingWidth -= column.width;\n\t\t\tviewportColumns.push(column);\n\t\t}\n\n\t\t// right columns again\n\t\tfor (c = this.visibleColumns.length - freeze.r; c < this.visibleColumns.length; c++) {\n\t\t\tviewportColumns.push(this.visibleColumns[c]);\n\t\t}\n\n\t\treturn (this._viewport = {rows: viewportRows, columns: viewportColumns});\n\t}\n\n\tcalculateViewport() {\n\t\treturn this._viewport ? this.calculations.calculateViewport(this._viewport) : [];\n\t}\n\n\tgetValuesInRange(range: CellRange, formattedValues = false) {\n\t\trange = range.intersect(this.gridRange);\n\t\tif (!range) return [];\n\t\tconst {columns, rows} = range.size;\n\t\tconst values: Matrix<unknown> = new Array(rows);\n\t\tlet i = 0, j = 0;\n\t\tlet row: RowModel;\n\t\tfor (let r = range.r1; r <= range.r2; r++) {\n\t\t\tvalues[i] = new Array(columns);\n\t\t\tj = 0;\n\t\t\trow = this.rows[r];\n\t\t\tfor (let c = range.c1; c <= range.c2; c++) {\n\t\t\t\tvalues[i][j++] = formattedValues ? row.cell(c).formattedValue : row.cell(c).value;\n\t\t\t}\n\t\t\t++i;\n\t\t}\n\n\t\treturn values;\n\t}\n\n\tsetRowExpandLevel(level: number) {\n\t\tthis.rows.forEach(row => {\n\t\t\trow.collapsed = (!row.isLoaded && !row.isPartialyLoaded) || row.level >= level;\n\t\t\tif (row.level <= level) row.hidden = false; // remove hidden flag for visible rows\n\t\t});\n\t\tthis.indexVisibleRows();\n\t}\n\t\n\tsetColumnExpandLevel(level: number) {\n\t\tthis.columns.forEach(column => column.collapsed = column.level >= level);\n\t\tthis.indexVisibleColumns();\n\t}\n\n\tgetViewportRange() {\n\t\treturn this._viewport && this._viewport.columns.length && this._viewport.rows.length ? new CellRange(\n\t\t\tthis._viewport.columns[0].index,\n\t\t\tthis._viewport.rows[0].index,\n\t\t\tthis._viewport.columns[this._viewport.columns.length - 1].index,\n\t\t\tthis._viewport.rows[this._viewport.rows.length - 1].index,\n\t\t) : null;\n\t}\n\n\tget gridRange() {\n\t\treturn new CellRange(0, 0, this.columns.length - 1, this.rows.length - 1);\n\t}\n\n\tgetRangeIterator(range: CellRange, withinViewport = false) {\n\t\tconst clip = withinViewport && this._viewport ? this.getViewportRange() : this.gridRange;\n\t\treturn new IterableRange(this, clip && range.intersect(clip));\n\t}\n\n\tgetInitializedCellIterator() {\n\t\treturn new IterableRange(this, this.gridRange, true);\n\t}\n\n\tgetRowIterator(range: CellRange, withinViewport = false) {\n\t\tconst clip = withinViewport && this._viewport ? this.getViewportRange() : this.gridRange;\n\t\treturn new IterableAxisRange<RowModel>(this, clip && range.intersect(clip), 'rows');\n\t}\n\n\tgetColumnIterator(range: CellRange, withinViewport = false) {\n\t\tconst clip = withinViewport && this._viewport ? this.getViewportRange() : this.gridRange;\n\t\treturn new IterableAxisRange<ColumnModel>(this, clip && range.intersect(clip), 'columns');\n\t}\n\n\tgetCellArray(range: CellRange) {\n\t\tconst cells: CellModel[] = [];\n\t\tfor (const cell of this.getRangeIterator(range)) {\n\t\t\tcells.push(cell);\n\t\t}\n\t\treturn cells;\n\t}\n\n\ttransformRangeToMatrix<T>(range: CellRange, transform: (cell: CellModel) => T): Matrix<T> {\n\t\tlet row: RowModel, cell: CellModel, rowValues: T[];\n\t\trange = range.intersect(this.gridRange);\n\t\tconst cells: Matrix<T> = [];\n\t\tfor (let r = range.r1; r <= range.r2; r++) {\n\t\t\trow = this.rows[r];\n\t\t\tif (!row) continue;\n\t\t\trowValues = [];\n\t\t\tfor (let c = range.c1; c <= range.c2; c++) {\n\t\t\t\tcell = row.cell(c);\n\t\t\t\tif (cell) rowValues.push(transform(cell));\n\t\t\t}\t\n\t\t\tcells.push(rowValues);\n\t\t}\n\t\treturn cells;\n\t}\n\n\tgetCellMatrix(range: CellRange) {\n\t\treturn this.getModelByRange(range)?.transformRangeToMatrix(range, c => c);\n\t}\n\n\tgetValueMatrix(range: CellRange) {\n\t\treturn this.getModelByRange(range)?.transformRangeToMatrix(range, c => c.value);\n\t}\n\n\tshift(options: ShiftOptions) {\n\t\toptions.sheet = this.name;\n\t\tthis.merges.shift(options);\n\t\tthis.calculations.shift(options);\n\t\tthis.names.shift(options);\n\t\tthis.comments.shift(options);\n\t\tthis.sparklines.shift(options);\n\t}\n\n\tclearCalculations(all = false) {\n\t\tif (all && this.group) this.group.models.forEach(m => m.calculations.refresh());\n\t\telse this.calculations.refresh();\n\t}\n\n\trefreshSparklines() {\n\t\tthis.sparklines.updateRangeMaps();\n\t\tfor (const cell of this.getInitializedCellIterator()) {\n\t\t\tcell.invalidateStyle();\n\t\t}\n\t}\n\n\tclearCalculatedStyles() {\n\t\tthis.conditionalFormats.refresh();\n\t\tconst cells = [] as CellModel[];\n\t\tfor (const cell of this.getInitializedCellIterator()) {\n\t\t\tcells.push(cell);\n\t\t\tcell.invalidateStyle();\n\t\t}\n\t}\n\n\tinsertColumns(index: number, count: number, after = false) {\n\t\tconst parent = this.columns[Math.min(this.columns.length - 1, index)].parent;\n\t\tif (after) ++index;\n\t\tthis.shift({index: index, offset: count, direction: 'right'});\n\t\tfor (let r = 0; r < this.rows.length; r++) this.rows[r].insertColumns(index, count, false);\n\t\tconst newColumns = (new Array(count)).fill(null).map(() => new ColumnModel(this));\n\t\tthis.columns.splice(index, 0, ...newColumns);\n\t\tif (this.maxColumnLevel > 0) parent.insertChildren(newColumns, index - (parent.index || -1) - 1);\n\t\tthis.indexColumns();\n\t\tthis.applyThemeToColumns(newColumns);\n\t\tthis.clearCalculations(true);\n\t\treturn newColumns;\n\t}\n\n\tdeleteColumns(index: number, count: number) {\n\t\tconst parent = this.columns[index].parent;\n\t\tthis.shift({index: index, offset: count, direction: 'left'});\n\t\tconst deletedCells: CellModel[][] = [];\n\t\tfor (let r = 0; r < this.rows.length; r++)\n\t\t\tdeletedCells.push(this.rows[r].deleteColumns(index, count, false));\n\t\t// const deletedColumns: [ColumnModel, CellModel[]][] = this.columns.splice(index, count)\n\t\t// \t.map((column, i) => [column, deletedCells[i]]);\n\t\tconst deletedColumns = this.columns.splice(index, count);\n\t\tparent?.deleteChildren(deletedColumns);\n\t\tthis.indexColumns();\n\t\tthis.clearCalculations(true);\n\t\treturn deletedColumns;\n\t}\n\n\tinsertRows(index: number, rows: number|RowModel[], after = false) {\n\t\tconst parentIndex = Math.min(this.rows.length - 1, index);\n\t\tconst parent = parentIndex < 0 ? this.rowRoot : this.rows[parentIndex].parent;\n\t\tif (after) ++index;\n\t\tconst count = isNaN(rows as number) ? (rows as RowModel[]).length : rows as number;\n\t\tthis.shift({index: index, offset: count, direction: 'down'});\n\t\tconst newRows = isNaN(rows as number) ? (rows as RowModel[]) : (new Array(count)).fill(null).map(() => new RowModel(this));\n\t\tthis.rows.splice(index, 0, ...newRows);\n\t\tif (this.maxRowLevel > 0) parent.insertChildren(newRows, index - (parent.index || -1) - 1);\n\t\tthis.indexRows();\n\t\tthis.applyThemeToRows(newRows);\n\t\tthis.clearCalculations(true);\n\t\treturn newRows;\n\t}\n\n\tdeleteRows(index: number, count: number) {\n\t\tconst parent = this.rows[index].parent;\n\t\tthis.shift({index: index, offset: count, direction: 'up'});\n\t\tconst deletedRows = this.rows.splice(index, count);\n\t\tparent?.deleteChildren(deletedRows);\n\t\tthis.indexRows();\n\t\tthis.clearCalculations(true);\n\t\treturn deletedRows;\n\t}\n\n\tmoveRows(index: number, count: number, targetIndex: number) {\n\t\tconst movingRows = this.rows.splice(index, count);\n\t\tthis.rows.splice(targetIndex, 0, ...movingRows);\n\t\tthis.shift({index: index, offset: targetIndex - index, direction: 'down', maxIndex: index + count - 1});\n\t\tthis.indexRows();\n\t\tthis.clearCalculations(true);\n\t\treturn movingRows;\n\t}\n\n\tmoveColumns(index: number, count: number, targetIndex: number) {\n\t\tconst movingColumns = this.columns.splice(index, count);\n\t\tthis.columns.splice(targetIndex, 0, ...movingColumns);\n\t\tthis.shift({index: index, offset: targetIndex - index, direction: 'right', maxIndex: index + count - 1});\n\t\tthis.indexColumns();\n\t\tthis.clearCalculations(true);\n\t\treturn movingColumns;\n\t}\n\n\tspillValues(opt: SpillOptions): SpillResult {\n\t\tconst {cell, values, displayValues, propertyCell} = opt;\n\t\tconst cells: CellModel[] = [];\n\t\tconst oldValues: CellValueType[] = [];\n\t\tconst empty = values.length === 0 || values[0].length === 0;\n\t\tlet row: RowModel, spillCell: CellModel;\n\n\t\tconst range = empty ? null : new CellRange(\n\t\t\tcell.c, cell.r,\n\t\t\tcell.c + values[0].length - 1,\n\t\t\tcell.r + values.length - 1\n\t\t)\n\n\t\tif (cell.spillRange) {\n\t\t\t// clear values from previous evaluations not contained in the new spill range\n\t\t\tthis.getRangeIterator(cell.spillRange, true).forEach(c => {\n\t\t\t\tif (cell != c && !range?.contains(c.range)) c.clearSpilledValue();\n\t\t\t});\n\t\t}\n\n\t\tcell.spillRange = range;\n\t\tif (empty) return {cells, oldValues, range: null};\n\n\t\tfor (let r = range.r1; r <= range.r2; r++) {\n\t\t\trow = this.rows[r];\n\t\t\tif (!row) continue;\n\t\t\tconst r2 = r - range.r1;\n\t\t\tfor (let c = range.c1; c <= range.c2; c++) {\n\t\t\t\tconst c2 = c - range.c1;\n\t\t\t\tspillCell = row.cell(c);\n\t\t\t\tif (spillCell.editable) {\n\t\t\t\t\toldValues.push(spillCell.value2 as CellValueType);\n\t\t\t\t\tspillCell.spillValue(values[r2][c2], cell);\n\t\t\t\t\tif (propertyCell) {\n\t\t\t\t\t\tspillCell.format = propertyCell.format;\n\t\t\t\t\t\tspillCell.type = propertyCell.type;\n\t\t\t\t\t}\n\t\t\t\t\tif (displayValues && displayValues[r2][c2] != null) spillCell.displayValue = displayValues[r2][c2];\n\t\t\t\t\tcells.push(spillCell);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {cells, oldValues, range};\n\t}\n\n\tgetCellByName(name: string, contextRange: CellRange, searchGroup = true): CellModel {\n\t\tconst cell = this.names.getCellByName(name, contextRange);\n\t\tif (cell) return cell;\n\t\telse if (this.group && searchGroup) return this.group.getCellByName(name, contextRange);\n\t\treturn null;\n\t}\n\n\tgetRangeByName(name: string, searchGroup = true): CellRange {\n\t\tconst range = this.names.getRangeByName(name);\n\t\tif (range) return range;\n\t\telse if (this.group && searchGroup) return this.group.getRangeByName(name);\n\t\treturn null;\n\t}\n\n\tgetValueMatrixByName(name: string, searchGroup = true): Matrix<unknown> {\n\t\tconst matrix = this.names.getRangeByName(name);\n\t\tif (matrix) return this.getValueMatrix(matrix);\n\t\telse if (this.group && searchGroup) return this.group.getValueMatrixByName(name);\n\t\treturn null;\n\t}\n\n\trebuildRowTree() {\n\t\tconst buildFunction = this._levelBasedRowTree ? tree.buildLevelBasedTree : tree.buildParentBasedTree;\n\t\tthis._maxRowLevel = buildFunction(this.rows, this.rowRoot, {\n\t\t\treverse: this.options.rowTree.reversed\n\t\t});\n\t\tthis.indexRowsByTree();\n\t}\n\n\trebuildColumnTree() {\n\t\tconst buildFunction = this._levelBasedColTree ? tree.buildLevelBasedTree : tree.buildParentBasedTree;\n\t\tthis._maxColumnLevel = buildFunction(this.columns, this.colRoot, {\n\t\t\treverse: this.options.columnTree.reversed\n\t\t});\n\t\tthis.indexColumns();\n\t}\n\n\tcalculateCellOffset(cell: CellRange) : Location {\n\t\tlet x = 0, y = 0;\n\t\tfor (let c = 0; c < cell.c1; c++) {\n\t\t\tif (!this.columns[c]) break;\n\t\t\tx += this.columns[c].width;\n\t\t}\n\t\tfor (let r = 0; r < cell.r1; r++) {\n\t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ACzB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACjB,CAAC;CAED","sourcesContent":["import { Matrix, tree, CustomProperties, Location, Model } from \"@omegagrid/core\";\nimport { log } from \"@omegagrid/core\";\nimport { CellValueType, ShiftOptions, SpillOptions, SpillResult, TabOptions } from \"../types\";\nimport { CalculationModel } from \"./calculationModel\";\nimport { CellRange } from \"../common/range\";\nimport { ConditionalFormats, ConditionalFormatSource } from \"./conditionalFormats\";\nimport { Sparklines, SparklineSource } from \"../sparklines/sparklines\";\nimport { CellModel, CellSource } from \"./cellModel\";\nimport { ColumnModel, ColumnHeaderModel, ColumnSource } from \"./columnModel\";\nimport { GroupModel } from \"./groupModel\";\nimport { CommentModel, CommentSource } from \"./commentModel\";\nimport { IterableAxisRange, IterableRange } from \"./iterableRange\";\nimport { NameSource, NamingModel } from \"./namingModel\";\nimport { initOptions, Options, OptionSource } from \"./options\";\nimport { RowModel, RowSource } from \"./rowModel\";\nimport { Style } from \"./style\";\nimport { StyleModel } from \"./styleModel\";\nimport { TableTheme, applyCellTheme, applyColumnTheme, applyRowTheme, applyTheme } from \"./tableTheme\";\nimport { SortingModel } from \"./sortingModel\";\nimport { Merge, Merges } from \"./merges\";\nimport { FilterModel } from \"./filterModel\";\n\n\n/** Source object type for grid */\nexport type GridSource = {\n\t/** grid index with group (readonly) */\n\tindex?: number,\n\t/** sheet name */\n\tname?: string,\n\t/** row array */\n\trows?: RowSource[],\n\t/** column array */\n\tcolumns?: ColumnSource[],\n\t/** cell array */\n\tcells?: CellSource[],\n\t/** grid options */\n\toptions?: OptionSource,\n\t/** sprakline definitions */\n\tsparklines?: SparklineSource[],\n\t/** conditional format definitions */\n\trules?: ConditionalFormatSource,\n\t/** comment array */\n\tcomments?: CommentSource[],\n\t/** style array */\n\tstyles?: Style[],\n\t/** renge names */\n\tnames?: NameSource[],\n\t/** custom properties */\n\tprops?: CustomProperties,\n\t/** tab settings used when grid is within group */\n\ttab?: TabOptions,\n\t/** table theme */\n\ttheme?: TableTheme,\n\t/** additional properties */\n\t[key: string]: unknown\n};\n\nconst DEFAULT_SOURCE_KEYS = [\n\t'index', 'name', 'rows', 'columns', 'cells', 'options', 'sparklines',\n\t'rules', 'comments', 'styles', 'names', 'props', 'tab', 'theme'\n];\n\nexport type Viewport = {\n\trows: RowModel[];\n\tcolumns: ColumnModel[];\n};\n\n/** the lowest and the highest index of the elements (a loop - the arrays may be large) */\nfunction indexBounds(elements: (RowModel|ColumnModel)[]): [number, number] {\n\tlet first = Infinity, last = -Infinity;\n\tfor (const element of elements) {\n\t\tif (element.index < first) first = element.index;\n\t\tif (element.index > last) last = element.index;\n\t}\n\treturn [first, last];\n}\n\nexport class GridModel implements Model<GridSource> {\n\t\n\tindex: number;\n\tname: string;\n\ttab: TabOptions;\n\trows: RowModel[];\n\tvisibleRows: RowModel[];\n\trowRoot: RowModel;\n\tcolRoot: ColumnModel;\n\tcolumns: ColumnModel[];\n\tvisibleColumns: ColumnModel[];\n\tvisibleColumnIndex: Record<number, number>;\n\totherSourceData: Record<string, unknown>;\n\totherModels: Record<string, Set<Model>> = {};\n\tautofitColumns: Set<number> = new Set();\n\tautofitRows: Set<number> = new Set();\n\n\treadonly merges = new Merges(this);\n\treadonly styles = new StyleModel(this);\n\treadonly comments = new CommentModel(this);\n\treadonly calculations = new CalculationModel(this);\n\treadonly names = new NamingModel(this);\n\treadonly sorting = new SortingModel(this);\n\treadonly filter = new FilterModel(this);\n\treadonly sparklines = new Sparklines(this);\n\treadonly conditionalFormats = new ConditionalFormats(this);\n\n\tprivate _mergedHeaders: (Merge & {h: ColumnHeaderModel})[];\n\tget mergedHeaders() { return this._mergedHeaders }\n\t\n\tprivate _filter = false\n\tget hasFilter() { return this._filter }\n\t\n\tprivate _maxRowLevel = 0;\n\tget hasRowTree() { return this._maxRowLevel > 0 }\n\tget hasRowTreeEnabled() { return this.hasRowTree && this.options.rowTree.enabled }\n\tget maxRowLevel() { return this._maxRowLevel }\n\t\n\tprivate _maxColumnLevel = 0;\n\tget hasColumnTree() { return this._maxColumnLevel > 0 }\n\tget hasColumnTreeEnabled() { return this.hasColumnTree && this.options.columnTree.enabled }\n\tget maxColumnLevel() { return this._maxColumnLevel }\n\t\n\tprivate _headerCount = 0;\n\tprivate _headerHeights: number[];\n\tget headerCount() { return this._headerCount }\n\tget columnHeaderCount() { return this.headerCount + (this.hasColumnTreeEnabled ? 1 : 0) + (this.hasFilter ? 1 : 0) }\n\n\tprivate _viewport: Viewport;\n\tprivate _levelBasedRowTree = true;\n\tprivate _levelBasedColTree = true;\n\n\tprotected _properties: CustomProperties;\n\tget properties() { return this._properties }\n\tset properties(v: CustomProperties) { this._properties = v }\n\n\tprotected _theme: TableTheme;\n\tget theme() { return this._theme }\n\tset theme(v: TableTheme) { this._theme = v }\n\n\tpublic readonly logger: log.Logger;\n\tpublic options: Options;\n\n\tget formulasEnabled() { return this.options.formulas !== false }\n\tpublic group: GroupModel;\n\n\tconstructor(source: GridSource, options?: Options, logger?: log.Logger) {\n\t\tthis.logger = logger;\n\t\tthis.options = options ?? initOptions(source.options);\n\t\tthis.populate(source);\n\t}\n\n\tgetConnectedModel(name: string) {\n\t\treturn this.group ? this.group.get(name) : null;\n\t}\n\n\tgetModelByRange(range: CellRange) {\n\t\treturn range.sheet ? this.getConnectedModel(range.sheet) : this;\n\t}\n\n\tgetCellByA1(a1: string) {\n\t\treturn this.getCellByRange(CellRange.fromA1(a1));\n\t}\n\n\tgetCellByRange(r: CellRange) {\n\t\treturn this.getCellByCoords(r.r1, r.c1);\n\t}\n\n\tgetCellByCoords(r: number, c: number) {\n\t\treturn this.rows[r]?.cell(c);\n\t}\n\n\tcell(coord1: string|number|CellRange, coord2?: number) {\n\t\tif (!isNaN(coord1 as number)) return this.getCellByCoords(coord1 as number, coord2 || 0);\n\t\tif (coord1 instanceof CellRange) return this.getCellByRange(coord1);\n\t\tif (typeof coord1 === 'string') return this.getCellByA1(coord1);\n\t\treturn null;\n\t}\n\n\tcreateRows(source: RowSource[], root = new RowModel(this, {l: -1}), indexOffset = 0) : [RowModel, RowModel[], number, boolean] {\n\t\tlet hasRowLevelBasedTree = false;\n\t\tlet hasRowParentBasedTree = false;\n\t\tthis.autofitRows.clear();\n\n\t\tconst rows = source.map((rowSource, r) => {\n\t\t\tif (!rowSource) rowSource = {};\n\t\t\tif (!isNaN(rowSource.l)) hasRowLevelBasedTree = true;\n\t\t\tif (rowSource.p != null) hasRowParentBasedTree = true;\n\t\t\tif (rowSource.h == 'auto') this.autofitRows.add(r);\n\t\t\tconst rowModel = new RowModel(this, rowSource);\n\t\t\trowModel.origIndex = r + indexOffset;\n\t\t\tif (rowModel.name) this.names.set(rowModel.name, CellRange.fullRow(r));\n\t\t\treturn rowModel;\n\t\t});\n\t\t\n\t\tlet maxRowLevel = -1;\n\t\tif (hasRowLevelBasedTree) maxRowLevel = tree.buildLevelBasedTree(rows, root, {\n\t\t\treverse: this.options.rowTree.reversed\n\t\t});\n\t\telse if (hasRowParentBasedTree) maxRowLevel = tree.buildParentBasedTree(rows, root);\n\t\telse root.children = rows;\n\n\t\tif (!hasRowParentBasedTree) hasRowLevelBasedTree = true; // default to level based tree\n\t\treturn [root, rows, maxRowLevel, hasRowLevelBasedTree];\n\t}\n\n\tinsertRowData(parent: RowModel, offset: number, source: RowSource[]) {\n\t\tconst res = this.createRows(source, new RowModel(this, {l: parent.level}), offset);\n\t\tthis._maxRowLevel = Math.max(this._maxRowLevel, res[2]);\n\t\tparent.insertChildren(res[0].children, offset);\n\t\tthis.indexRowsByTree();\n\t\tthis.applyThemeToRows(res[1]);\n\t}\n\n\tapplyTheme(theme: TableTheme, invalidateCellStyles?: boolean) {\n\t\tif (invalidateCellStyles) {\n\t\t\tfor (const cell of this.getInitializedCellIterator()) {\n\t\t\t\tcell.invalidateStyle();\n\t\t\t}\n\t\t}\n\t\tapplyTheme(theme, this);\n\t}\n\n\t/**\n\t * Applies the table theme onto the given rows only - inserted rows or rows\n\t * whose level changed: the row items are matched again and the cell items\n\t * are applied over their cells, whose cached styles are dropped. Does\n\t * nothing without a theme.\n\t */\n\tapplyThemeToRows(rows: RowModel[]) {\n\t\tif (!this.theme || !rows.length) return;\n\t\tconst [first, last] = indexBounds(rows);\n\t\tconst range = new CellRange(0, first, Infinity, last);\n\t\tapplyRowTheme(this.theme, this, rows);\n\t\tapplyCellTheme(this.theme, this, range);\n\t\tthis.invalidateCellStyles(range);\n\t}\n\n\t/** the column counterpart of applyThemeToRows */\n\tapplyThemeToColumns(columns: ColumnModel[]) {\n\t\tif (!this.theme || !columns.length) return;\n\t\tconst [first, last] = indexBounds(columns);\n\t\tconst range = new CellRange(first, 0, last, Infinity);\n\t\tapplyColumnTheme(this.theme, this, columns);\n\t\tapplyCellTheme(this.theme, this, range);\n\t\tthis.invalidateCellStyles(range);\n\t}\n\n\tprivate invalidateCellStyles(range: CellRange) {\n\t\tfor (const cell of new IterableRange(this, range.intersect(this.gridRange), true)) cell.invalidateStyle();\n\t}\n\n\tpopulate(source: GridSource) {\n\t\tthis.index = source.index;\n\t\tthis.name = source.name ?? this.name;\n\t\tthis.tab = source.tab;\n\t\t\n\t\tlet hasColLevelBasedTree = false;\n\t\tlet hasColParentBasedTree = false;\n\n\t\tif (!source.columns) source.columns = new Array(this.options.columns).fill({});\n\t\tif (!source.rows) source.rows = new Array(this.options.rows).fill({});\n\n\t\t// styles\n\t\tif (source.styles) this.styles.populate(source.styles);\n\t\t\n\t\t// columns\n\t\tthis.autofitColumns.clear();\n\t\tthis.columns = source.columns.map((columnSource, c) => {\n\t\t\tif (!columnSource) columnSource = {};\n\t\t\tif (columnSource.l !== 0 && columnSource.l != null) hasColLevelBasedTree = true;\n\t\t\tif (columnSource.p != null) hasColParentBasedTree = true;\n\t\t\tif (columnSource.w == 'auto') this.autofitColumns.add(c);\n\t\t\tconst colModel = new ColumnModel(this, columnSource);\n\t\t\tthis._filter = colModel.hasFilter || this._filter;\n\t\t\tif (colModel.name) this.names.set(colModel.name, CellRange.fullColumn(c));\n\t\t\treturn colModel;\n\t\t});\n \n\t\tthis._levelBasedColTree = hasColLevelBasedTree;\n\t\tthis._maxColumnLevel = -1;\n\t\tthis.colRoot = new ColumnModel(this, {l: -1});\n\t\tif (hasColLevelBasedTree) this._maxColumnLevel = tree.buildLevelBasedTree(this.columns, this.colRoot, {\n\t\t\treverse: this.options.columnTree.reversed\n\t\t});\n\t\telse if (hasColParentBasedTree) this._maxColumnLevel = tree.buildParentBasedTree(this.columns, this.colRoot);\n\t\telse this.colRoot.children = this.columns;\n\t\t\n\t\tif (!hasColParentBasedTree) this._levelBasedColTree = true; // default to level based tree\n\n\t\tthis.indexColumns();\n\t\tthis.indexVisibleColumns();\n\n\t\t// rows\n\t\t[this.rowRoot, this.rows, this._maxRowLevel, this._levelBasedRowTree] = this.createRows(source.rows);\n\t\tthis.indexRows();\n\t\tthis.indexVisibleRows();\n\t\tif (this.options.pageSize && this.options.pageSize <= this.rows.length) this.rowRoot.count = Infinity;\n\n\t\t// cells\n\t\tthis.merges.clear();\n\t\tsource.comments = source.comments || [];\n\t\tsource.cells?.forEach((cellSource, i) => {\n\t\t\tconst cell = this.rows[cellSource.r] ? this.rows[cellSource.r].cell(cellSource.c, cellSource) : null;\n\t\t\tif (!cell) {\n\t\t\t\tthis.logger?.error(`invalid cell definition (index ${i}): ${JSON.stringify(cellSource)}`);\n\t\t\t} else if (cellSource.cs > 1 || cellSource.rs > 1) {\n\t\t\t\tthis.merges.add({r: cell.r, c: cell.c, rs: cellSource.rs || 1, cs: cellSource.cs || 1});\n\t\t\t}\n\n\t\t\tif (cell && cellSource.comment) {\n\t\t\t\tsource.comments.push(Object.assign(cellSource.comment, {c: cellSource.c, r: cellSource.r}));\n\t\t\t}\n\t\t});\n\t\t\n\t\t// sparklines\n\t\tif (source.sparklines) {\n\t\t\ttry {\n\t\t\t\tthis.sparklines.populate(source.sparklines);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Sparkline init error: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// names\n\t\tif (source.names) {\n\t\t\ttry {\n\t\t\t\tthis.names.populate(source.names);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Named range init error: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// conditional formats\n\t\tif (source.rules) {\n\t\t\ttry {\n\t\t\t\tthis.conditionalFormats.populate(source.rules);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Conditional formats init error: ${error}`);\n\t\t\t}\n\t\t}\n\n\t\t// theme\n\t\tif (source.theme) {\n\t\t\ttry {\n\t\t\t\tthis.applyTheme(source.theme);\n\t\t\t\tthis._theme = source.theme;\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Theme init error: ${error}`);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// comments\n\t\tif (source.comments) {\n\t\t\ttry {\n\t\t\t\tthis.comments.populate(source.comments);\n\t\t\t} catch (error) {\n\t\t\t\tlog.getLogger().error(`Comment init error: ${error}`);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// custom properties\n\t\tthis._properties = source.props;\n\n\t\t// additional properties\n\t\tthis.otherSourceData = {};\n\t\tconst defaultKeys = new Set(DEFAULT_SOURCE_KEYS);\n\t\tconst keys = Object.keys(source).filter(k => !defaultKeys.has(k));\n\t\tkeys.forEach(k => this.otherSourceData[k] = source[k]);\n\n\t\t// default sort\n\t\tif (this.options.sorting?.defaultSettings) {\n\t\t\tthis.sorting.settings = this.options.sorting.defaultSettings;\n\t\t}\n\n\t\t// default filter\n\t\tif (this.options.filters?.defaultSettings) {\n\t\t\tthis.filter.settings = this.options.filters.defaultSettings;\n\t\t}\n\n\t\tthis.calcHeaderHeights();\n\t}\n\n\tgetSourceData() {\n\t\tconst data = {\n\t\t\tindex: this.index,\n\t\t\tname: this.name,\n\t\t\ttab: this.tab,\n\t\t\tcolumns: this.columns.map(col => col.getSourceData()),\n\t\t\trows: this.rows.map(row => row.getSourceData()),\n\t\t\tstyles: this.styles.getSourceData(),\n\t\t\trules: this.conditionalFormats.getSourceData(),\n\t\t\tsparklines: this.sparklines.getSourceData(),\n\t\t\tnames: this.names.getSourceData(),\n\t\t\toptions: this.options,\n\t\t} as GridSource;\n\n\t\tif (this._properties) data.props = this._properties;\n\n\t\tconst cells = [];\n\t\tlet cellData: CellSource;\n\t\tfor (let r = 0; r < this.rows.length; r++) {\n\t\t\tfor (let c = 0; c < this.columns.length; c++) {\n\t\t\t\tcellData = this.rows[r].cell(c).getSourceData();\n\t\t\t\tif (Object.keys(cellData).length > 0) {\n\t\t\t\t\tcellData.r = r;\n\t\t\t\t\tcellData.c = c;\n\t\t\t\t\tcells.push(cellData);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (cells.length > 0) data.cells = cells;\n\t\t\n\t\tconst styles = [] as Style[];\n\t\tthis.styles.clean();\n\t\tthis.styles.map.forEach(style => styles.push(style));\n\t\tif (styles.length > 0) data.styles = styles;\n\n\t\tconst otherModelKeys = new Set([\n\t\t\t...Object.keys(this.otherModels ?? {}),\n\t\t\t...Object.keys(this.otherSourceData ?? {})\n\t\t]);\n\t\totherModelKeys.forEach(k => data[k] = this.otherModels[k] \n\t\t\t? Array.from(this.otherModels[k]).map(m => m.getSourceData())\n\t\t\t: this.otherSourceData[k]\n\t\t);\n\n\t\treturn data;\n\t}\n\n\tcalcHeaderHeights() {\n\t\tthis._headerCount = 0;\n\t\tthis._headerHeights = [];\n\t\tthis.columns.forEach((column) => {\n\t\t\tthis._headerCount = column.header ? column.header.length : this._headerCount;\n\t\t\tif (this._headerHeights.length < this._headerCount) {\n\t\t\t\tthis._headerHeights.push(...Array(this._headerCount - this._headerHeights.length).fill(0));\n\t\t\t}\n\n\t\t\tcolumn.header?.forEach((h: ColumnHeaderModel, r) => {\n\t\t\t\tif (r >= this._headerHeights.length) {\n\t\t\t\t\tthis._headerHeights.push(0);\n\t\t\t\t}\n\t\t\t\tthis._headerHeights[r] = Math.max(this._headerHeights[r], h.height ?? 0);\n\t\t\t});\n\t\t});\n\t}\n\n\tindexRows() {\n\t\tthis.visibleRows = [];\n\t\tthis.rows.forEach((row, r) => {\n\t\t\trow.index = r;\n\t\t\tif (!row.isLoaded) row.collapsed = true;\n\t\t\tif (!row.hidden && row.filterState != tree.FilterState.Filtered) {\n\t\t\t\trow.visibleIndex = this.visibleRows.length;\n\t\t\t\tthis.visibleRows.push(row);\n\t\t\t}\n\t\t});\n\t}\n\n\tindexVisibleRows() {\n\t\tthis.visibleRows = [];\n\t\tlet r = 0;\n\t\tif (this._levelBasedRowTree) {\n\t\t\tthis.rowRoot.walkVisible((node: RowModel) => {\n\t\t\t\tnode.visibleIndex = r++;\n\t\t\t\tthis.visibleRows.push(node)\n\t\t\t});\n\n\t\t\t// reverse order of row index\n\t\t\tif (this.options.rowTree.reversed) {\n\t\t\t\tconst reversedVisibleRows = new Array(this.visibleRows.length);\n\t\t\t\tthis.visibleRows.forEach((row, i) => {\n\t\t\t\t\tr = this.visibleRows.length - i - 1;\n\t\t\t\t\trow.visibleIndex = r;\n\t\t\t\t\treversedVisibleRows[r] = row;\n\t\t\t\t});\n\t\t\t\tthis.visibleRows = reversedVisibleRows;\n\t\t\t}\n\t\t} else {\n\t\t\t// in parent based node rows do not have to respect tree order\n\t\t\tthis.rowRoot.walkVisible((node: RowModel) => this.visibleRows[node.index] = node);\n\t\t\tthis.visibleRows = this.visibleRows.filter(row => {\n\t\t\t\tif (row) {\n\t\t\t\t\trow.visibleIndex = r++;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}\n\t}\n\n\tindexRowsByTree() {\n\t\tthis.rows = [];\n\t\tlet r = 0;\n\t\tthis.rowRoot.walk((row: RowModel) => {\n\t\t\trow.index = r++;\n\t\t\tthis.rows.push(row);\n\t\t});\n\t\tif (this.options.rowTree.reversed) this.rows.reverse();\n\t\tthis.indexVisibleRows();\n\t}\n\n\tindexColumns() {\n\t\tthis.visibleColumns = [];\n\t\tthis.columns.forEach((column, c) => {\n\t\t\tcolumn.index = c;\n\t\t\tif (!column.hidden) this.visibleColumns.push(column);\n\t\t});\n\t}\n\n\tindexVisibleColumns() {\n\t\tthis.visibleColumns = [];\n\t\tthis.visibleColumnIndex = {};\n\t\tlet c = 0;\n\t\tthis.colRoot.walkVisible((node: ColumnModel) => {\n\t\t\tnode.visibleIndex = c;\n\t\t\tthis.visibleColumnIndex[node.index] = c++;\n\t\t\tthis.visibleColumns.push(node);\n\t\t});\n\n\t\t// reverse order of column index\n\t\tif (this.options.columnTree.reversed) {\n\t\t\tthis.visibleColumnIndex = {};\n\t\t\tconst reversedVisibleColumns = new Array(this.visibleColumns.length);\n\t\t\tthis.visibleColumns.forEach((column, i) => {\n\t\t\t\tc = this.visibleColumns.length - i - 1;\n\t\t\t\tcolumn.visibleIndex = c;\n\t\t\t\tthis.visibleColumnIndex[column.index] = c;\n\t\t\t\treversedVisibleColumns[c] = column;\n\t\t\t});\n\t\t\tthis.visibleColumns = reversedVisibleColumns;\n\t\t}\n\n\t\tthis.indexHeaders();\n\t}\n\n\tindexHeaders() {\n\t\tthis._mergedHeaders = [];\n\t\tthis._headerCount = 0;\n\t\tthis.colRoot.walkVisible((column: ColumnModel) => {\n\t\t\tthis._headerCount = Math.max(column.header ? column.header.length : 0, this._headerCount);\n\t\t\tcolumn.mergedHeaders.forEach(h => this._mergedHeaders.push({\n\t\t\t\th: h,\n\t\t\t\tc: column.index,\n\t\t\t\tr: h.r,\n\t\t\t\tcs: column.calculateRealColspan(h.cs ?? 1),\n\t\t\t\trs: h.rs ?? 1\n\t\t\t}));\n\t\t});\n\n\t\t// hidden header cells\n\t\tthis._mergedHeaders.forEach(h => {\n\t\t\tif (h.h.hidden) return;\n\t\t\t\n\t\t\tfor (let c = h.c; c < h.c + h.cs; c++) {\n\t\t\t\tfor (let r = h.r; r < h.r + h.rs; r++) {\n\t\t\t\t\tif ((r > h.r || c > h.c) && this.columns[c] && this.columns[c].header[r]) {\n\t\t\t\t\t\tthis.columns[c].header[r].hidden = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.calcHeaderHeights();\n\t}\n\n\tremoveHeader(r: number) {\n\t\tthis.columns.forEach(column => {\n\t\t\tif (r < column.header.length) column.header.splice(r, 1);\n\t\t});\n\t\tthis.indexHeaders();\n\t}\n\n\tclearRows = () : RowModel[] => {\n\t\tthis.rowRoot.clearChildren();\n\t\tthis.rows = [];\n\t\treturn this.rows;\n\t}\n\t\n\tclearColumns = () : ColumnModel[] => this.columns = [];\n\n\tclear() {\n\t\tthis.clearRows();\n\t\tthis.clearColumns();\n\t\tthis.resetViewport();\n\t}\n\n\tresetViewport() {\n\t\tthis._viewport = null;\n\t\treturn this;\n\t}\n\n\tgetViewport(\n\t\toffset: {c: number, r: number}, \n\t\tviewportSize: {w: number, h: number}, \n\t\tfreeze: {t: number, l: number, b: number, r: number},\n\t) : Viewport {\n\t\tconst viewportRows: RowModel[] = [];\n\t\tconst viewportColumns: ColumnModel[] = [];\n\n\t\tlet row: RowModel;\n\t\tlet remainingHeight = viewportSize.h;\n\t\tlet r = 0;\n\t\t// top rows\n\t\tfor (r = 0; r < freeze.t; r++) {\n\t\t\trow = this.visibleRows[r];\n\t\t\tremainingHeight -= row.height;\n\t\t\tviewportRows.push(row);\n\t\t}\n\n\t\t// bottom rows\n\t\tfor (r = this.visibleRows.length - freeze.b; r < this.visibleRows.length; r++) {\n\t\t\trow = this.visibleRows[r];\n\t\t\tremainingHeight -= row.height;\n\t\t}\n\n\t\t// center rows\n\t\tr = freeze.t + offset.r;\n\t\twhile (remainingHeight > 0 && r < this.visibleRows.length) {\n\t\t\trow = this.visibleRows[r++];\n\t\t\tremainingHeight -= row.height;\n\t\t\tviewportRows.push(row);\n\t\t}\n\n\t\t// bottom rows again\n\t\tfor (r = this.visibleRows.length - freeze.b; r < this.visibleRows.length; r++) {\n\t\t\tviewportRows.push(this.visibleRows[r]);\n\t\t}\n\n\t\tlet column: ColumnModel;\n\t\tlet remainingWidth = viewportSize.w;\n\t\tlet c = 0;\n\n\t\t// left columns\n\t\tfor (c = 0; c < freeze.l; c++) {\n\t\t\tcolumn = this.visibleColumns[c];\n\t\t\tremainingWidth -= column.width;\n\t\t\tviewportColumns.push(column);\n\t\t}\n\n\t\t// right columns\n\t\tfor (c = this.visibleColumns.length - freeze.r; c < this.visibleColumns.length; c++) {\n\t\t\tcolumn = this.visibleColumns[c];\n\t\t\tremainingWidth -= column.width;\n\t\t}\n\n\t\t// center columns\n\t\tc = freeze.l + offset.c;\n\t\twhile (remainingWidth > 0 && c < this.visibleColumns.length) {\n\t\t\tcolumn = this.visibleColumns[c++];\n\t\t\tremainingWidth -= column.width;\n\t\t\tviewportColumns.push(column);\n\t\t}\n\n\t\t// right columns again\n\t\tfor (c = this.visibleColumns.length - freeze.r; c < this.visibleColumns.length; c++) {\n\t\t\tviewportColumns.push(this.visibleColumns[c]);\n\t\t}\n\n\t\treturn (this._viewport = {rows: viewportRows, columns: viewportColumns});\n\t}\n\n\tcalculateViewport() {\n\t\treturn this._viewport ? this.calculations.calculateViewport(this._viewport) : [];\n\t}\n\n\t/**\n\t * Whether the row is one of those the table shows: not hidden, not filtered out and under no collapsed\n\t * row. A row that dropped out keeps its last visibleIndex, so only the visible row list itself tells.\n\t */\n\tisRowVisible(row: RowModel) {\n\t\treturn this.visibleRows[row.visibleIndex] === row;\n\t}\n\n\t/**\n\t * @param visibleOnly leave out the rows the table does not show (filtered out, hidden, collapsed)\n\t */\n\tgetValuesInRange(range: CellRange, formattedValues = false, visibleOnly = false) {\n\t\trange = range.intersect(this.gridRange);\n\t\tif (!range) return [];\n\t\tconst {columns} = range.size;\n\t\tconst values: Matrix<unknown> = [];\n\t\tlet j = 0;\n\t\tlet row: RowModel, rowValues: unknown[];\n\t\tfor (let r = range.r1; r <= range.r2; r++) {\n\t\t\trow = this.rows[r];\n\t\t\tif (visibleOnly && !this.isRowVisible(row)) continue;\n\t\t\trowValues = new Array(columns);\n\t\t\tj = 0;\n\t\t\tfor (let c = range.c1; c <= range.c2; c++) {\n\t\t\t\trowValues[j++] = formattedValues ? row.cell(c).formattedValue : row.cell(c).value;\n\t\t\t}\n\t\t\tvalues.push(rowValues);\n\t\t}\n\n\t\treturn values;\n\t}\n\n\tsetRowExpandLevel(level: number) {\n\t\tthis.rows.forEach(row => {\n\t\t\trow.collapsed = (!row.isLoaded && !row.isPartialyLoaded) || row.level >= level;\n\t\t\tif (row.level <= level) row.hidden = false; // remove hidden flag for visible rows\n\t\t});\n\t\tthis.indexVisibleRows();\n\t}\n\t\n\tsetColumnExpandLevel(level: number) {\n\t\tthis.columns.forEach(column => column.collapsed = column.level >= level);\n\t\tthis.indexVisibleColumns();\n\t}\n\n\tgetViewportRange() {\n\t\treturn this._viewport && this._viewport.columns.length && this._viewport.rows.length ? new CellRange(\n\t\t\tthis._viewport.columns[0].index,\n\t\t\tthis._viewport.rows[0].index,\n\t\t\tthis._viewport.columns[this._viewport.columns.length - 1].index,\n\t\t\tthis._viewport.rows[this._viewport.rows.length - 1].index,\n\t\t) : null;\n\t}\n\n\tget gridRange() {\n\t\treturn new CellRange(0, 0, this.columns.length - 1, this.rows.length - 1);\n\t}\n\n\tgetRangeIterator(range: CellRange, withinViewport = false) {\n\t\tconst clip = withinViewport && this._viewport ? this.getViewportRange() : this.gridRange;\n\t\treturn new IterableRange(this, clip && range.intersect(clip));\n\t}\n\n\tgetInitializedCellIterator() {\n\t\treturn new IterableRange(this, this.gridRange, true);\n\t}\n\n\tgetRowIterator(range: CellRange, withinViewport = false) {\n\t\tconst clip = withinViewport && this._viewport ? this.getViewportRange() : this.gridRange;\n\t\treturn new IterableAxisRange<RowModel>(this, clip && range.intersect(clip), 'rows');\n\t}\n\n\tgetColumnIterator(range: CellRange, withinViewport = false) {\n\t\tconst clip = withinViewport && this._viewport ? this.getViewportRange() : this.gridRange;\n\t\treturn new IterableAxisRange<ColumnModel>(this, clip && range.intersect(clip), 'columns');\n\t}\n\n\tgetCellArray(range: CellRange) {\n\t\tconst cells: CellModel[] = [];\n\t\tfor (const cell of this.getRangeIterator(range)) {\n\t\t\tcells.push(cell);\n\t\t}\n\t\treturn cells;\n\t}\n\n\t/**\n\t * @param visibleOnly leave out the rows the table does not show (filtered out, hidden, collapsed)\n\t */\n\ttransformRangeToMatrix<T>(range: CellRange, transform: (cell: CellModel) => T, visibleOnly = false): Matrix<T> {\n\t\tlet row: RowModel, cell: CellModel, rowValues: T[];\n\t\trange = range.intersect(this.gridRange);\n\t\tconst cells: Matrix<T> = [];\n\t\tfor (let r = range.r1; r <= range.r2; r++) {\n\t\t\trow = this.rows[r];\n\t\t\tif (!row || (visibleOnly && !this.isRowVisible(row))) continue;\n\t\t\trowValues = [];\n\t\t\tfor (let c = range.c1; c <= range.c2; c++) {\n\t\t\t\tcell = row.cell(c);\n\t\t\t\tif (cell) rowValues.push(transform(cell));\n\t\t\t}\t\n\t\t\tcells.push(rowValues);\n\t\t}\n\t\treturn cells;\n\t}\n\n\tgetCellMatrix(range: CellRange, visibleOnly = false) {\n\t\treturn this.getModelByRange(range)?.transformRangeToMatrix(range, c => c, visibleOnly);\n\t}\n\n\tgetValueMatrix(range: CellRange) {\n\t\treturn this.getModelByRange(range)?.transformRangeToMatrix(range, c => c.value);\n\t}\n\n\tshift(options: ShiftOptions) {\n\t\toptions.sheet = this.name;\n\t\tthis.merges.shift(options);\n\t\tthis.calculations.shift(options);\n\t\tthis.names.shift(options);\n\t\tthis.comments.shift(options);\n\t\tthis.sparklines.shift(options);\n\t}\n\n\tclearCalculations(all = false) {\n\t\tif (all && this.group) this.group.models.forEach(m => m.calculations.refresh());\n\t\telse this.calculations.refresh();\n\t}\n\n\trefreshSparklines() {\n\t\tthis.sparklines.updateRangeMaps();\n\t\tfor (const cell of this.getInitializedCellIterator()) {\n\t\t\tcell.invalidateStyle();\n\t\t}\n\t}\n\n\tclearCalculatedStyles() {\n\t\tthis.conditionalFormats.refresh();\n\t\tconst cells = [] as CellModel[];\n\t\tfor (const cell of this.getInitializedCellIterator()) {\n\t\t\tcells.push(cell);\n\t\t\tcell.invalidateStyle();\n\t\t}\n\t}\n\n\tinsertColumns(index: number, count: number, after = false) {\n\t\tconst parent = this.columns[Math.min(this.columns.length - 1, index)].parent;\n\t\tif (after) ++index;\n\t\tthis.shift({index: index, offset: count, direction: 'right'});\n\t\tfor (let r = 0; r < this.rows.length; r++) this.rows[r].insertColumns(index, count, false);\n\t\tconst newColumns = (new Array(count)).fill(null).map(() => new ColumnModel(this));\n\t\tthis.columns.splice(index, 0, ...newColumns);\n\t\tif (this.maxColumnLevel > 0) parent.insertChildren(newColumns, index - (parent.index || -1) - 1);\n\t\tthis.indexColumns();\n\t\tthis.applyThemeToColumns(newColumns);\n\t\tthis.clearCalculations(true);\n\t\treturn newColumns;\n\t}\n\n\tdeleteColumns(index: number, count: number) {\n\t\tconst parent = this.columns[index].parent;\n\t\tthis.shift({index: index, offset: count, direction: 'left'});\n\t\tconst deletedCells: CellModel[][] = [];\n\t\tfor (let r = 0; r < this.rows.length; r++)\n\t\t\tdeletedCells.push(this.rows[r].deleteColumns(index, count, false));\n\t\t// const deletedColumns: [ColumnModel, CellModel[]][] = this.columns.splice(index, count)\n\t\t// \t.map((column, i) => [column, deletedCells[i]]);\n\t\tconst deletedColumns = this.columns.splice(index, count);\n\t\tparent?.deleteChildren(deletedColumns);\n\t\tthis.indexColumns();\n\t\tthis.clearCalculations(true);\n\t\treturn deletedColumns;\n\t}\n\n\tinsertRows(index: number, rows: number|RowModel[], after = false) {\n\t\tconst parentIndex = Math.min(this.rows.length - 1, index);\n\t\tconst parent = parentIndex < 0 ? this.rowRoot : this.rows[parentIndex].parent;\n\t\tif (after) ++index;\n\t\tconst count = isNaN(rows as number) ? (rows as RowModel[]).length : rows as number;\n\t\tthis.shift({index: index, offset: count, direction: 'down'});\n\t\tconst newRows = isNaN(rows as number) ? (rows as RowModel[]) : (new Array(count)).fill(null).map(() => new RowModel(this));\n\t\tthis.rows.splice(index, 0, ...newRows);\n\t\tif (this.maxRowLevel > 0) parent.insertChildren(newRows, index - (parent.index || -1) - 1);\n\t\tthis.indexRows();\n\t\tthis.applyThemeToRows(newRows);\n\t\tthis.clearCalculations(true);\n\t\treturn newRows;\n\t}\n\n\tdeleteRows(index: number, count: number) {\n\t\tconst parent = this.rows[index].parent;\n\t\tthis.shift({index: index, offset: count, direction: 'up'});\n\t\tconst deletedRows = this.rows.splice(index, count);\n\t\tparent?.deleteChildren(deletedRows);\n\t\tthis.indexRows();\n\t\tthis.clearCalculations(true);\n\t\treturn deletedRows;\n\t}\n\n\tmoveRows(index: number, count: number, targetIndex: number) {\n\t\tconst movingRows = this.rows.splice(index, count);\n\t\tthis.rows.splice(targetIndex, 0, ...movingRows);\n\t\tthis.shift({index: index, offset: targetIndex - index, direction: 'down', maxIndex: index + count - 1});\n\t\tthis.indexRows();\n\t\tthis.clearCalculations(true);\n\t\treturn movingRows;\n\t}\n\n\tmoveColumns(index: number, count: number, targetIndex: number) {\n\t\tconst movingColumns = this.columns.splice(index, count);\n\t\tthis.columns.splice(targetIndex, 0, ...movingColumns);\n\t\tthis.shift({index: index, offset: targetIndex - index, direction: 'right', maxIndex: index + count - 1});\n\t\tthis.indexColumns();\n\t\tthis.clearCalculations(true);\n\t\treturn movingColumns;\n\t}\n\n\tspillValues(opt: SpillOptions): SpillResult {\n\t\tconst {cell, values, displayValues, propertyCell} = opt;\n\t\tconst cells: CellModel[] = [];\n\t\tconst oldValues: CellValueType[] = [];\n\t\tconst empty = values.length === 0 || values[0].length === 0;\n\t\tlet row: RowModel, spillCell: CellModel;\n\n\t\tconst range = empty ? null : new CellRange(\n\t\t\tcell.c, cell.r,\n\t\t\tcell.c + values[0].length - 1,\n\t\t\tcell.r + values.length - 1\n\t\t)\n\n\t\tif (cell.spillRange) {\n\t\t\t// clear values from previous evaluations not contained in the new spill range\n\t\t\tthis.getRangeIterator(cell.spillRange, true).forEach(c => {\n\t\t\t\tif (cell != c && !range?.contains(c.range)) c.clearSpilledValue();\n\t\t\t});\n\t\t}\n\n\t\tcell.spillRange = range;\n\t\tif (empty) return {cells, oldValues, range: null};\n\n\t\tfor (let r = range.r1; r <= range.r2; r++) {\n\t\t\trow = this.rows[r];\n\t\t\tif (!row) continue;\n\t\t\tconst r2 = r - range.r1;\n\t\t\tfor (let c = range.c1; c <= range.c2; c++) {\n\t\t\t\tconst c2 = c - range.c1;\n\t\t\t\tspillCell = row.cell(c);\n\t\t\t\tif (spillCell.editable) {\n\t\t\t\t\toldValues.push(spillCell.value2 as CellValueType);\n\t\t\t\t\tspillCell.spillValue(values[r2][c2], cell);\n\t\t\t\t\tif (propertyCell) {\n\t\t\t\t\t\tspillCell.format = propertyCell.format;\n\t\t\t\t\t\tspillCell.type = propertyCell.type;\n\t\t\t\t\t}\n\t\t\t\t\tif (displayValues && displayValues[r2][c2] != null) spillCell.displayValue = displayValues[r2][c2];\n\t\t\t\t\tcells.push(spillCell);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {cells, oldValues, range};\n\t}\n\n\tgetCellByName(name: string, contextRange: CellRange, searchGroup = true): CellModel {\n\t\tconst cell = this.names.getCellByName(name, contextRange);\n\t\tif (cell) return cell;\n\t\telse if (this.group && searchGroup) return this.group.getCellByName(name, contextRange);\n\t\treturn null;\n\t}\n\n\tgetRangeByName(name: string, searchGroup = true): CellRange {\n\t\tconst range = this.names.getRangeByName(name);\n\t\tif (range) return range;\n\t\telse if (this.group && searchGroup) return this.group.getRangeByName(name);\n\t\treturn null;\n\t}\n\n\tgetValueMatrixByName(name: string, searchGroup = true): Matrix<unknown> {\n\t\tconst matrix = this.names.getRangeByName(name);\n\t\tif (matrix) return this.getValueMatrix(matrix);\n\t\telse if (this.group && searchGroup) return this.group.getValueMatrixByName(name);\n\t\treturn null;\n\t}\n\n\trebuildRowTree() {\n\t\tconst buildFunction = this._levelBasedRowTree ? tree.buildLevelBasedTree : tree.buildParentBasedTree;\n\t\tthis._maxRowLevel = buildFunction(this.rows, this.rowRoot, {\n\t\t\treverse: this.options.rowTree.reversed\n\t\t});\n\t\tthis.indexRowsByTree();\n\t}\n\n\trebuildColumnTree() {\n\t\tconst buildFunction = this._levelBasedColTree ? tree.buildLevelBasedTree : tree.buildParentBasedTree;\n\t\tthis._maxColumnLevel = buildFunction(this.columns, this.colRoot, {\n\t\t\treverse: this.options.columnTree.reversed\n\t\t});\n\t\tthis.indexColumns();\n\t}\n\n\tcalculateCellOffset(cell: CellRange) : Location {\n\t\tlet x = 0, y = 0;\n\t\tfor (let c = 0; c < cell.c1; c++) {\n\t\t\tif (!this.columns[c]) break;\n\t\t\tx += this.columns[c].width;\n\t\t}\n\t\tfor (let r = 0; r < cell.r1; r++) {\n\t\t\tif (!this.rows[r]) break;\n\t\t\ty += this.rows[r].height;\n\t\t}\n\t\treturn { x, y };\n\t}\n\n}"]}
@@ -1,5 +1,5 @@
1
1
  import { numbers, CommonOptions, dates, MenuItem, paper } from "@omegagrid/core";
2
- import { CellValidation, CellValidationSource, Renderer, StyleSource } from "../types";
2
+ import { AutofitOptions, CellValidation, CellValidationSource, Renderer, StyleSource } from "../types";
3
3
  import { CommentOptions, FilterSettings, SortSettings } from "../model";
4
4
  import { ElementModel } from "./elementModel";
5
5
  import { CellModel, CellSource } from "./cellModel";
@@ -248,6 +248,8 @@ export type Options = {
248
248
  print?: PrintOptions;
249
249
  /** grid zoom factor */
250
250
  zoom?: number;
251
+ /** autofit options */
252
+ autofit?: AutofitOptions;
251
253
  /** hides the outer border of the grid (right and top) */
252
254
  hideOuterBorder?: boolean;
253
255
  } & CommonOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/model/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAqB,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE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CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;IAC9C,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,OAAO,GAAG,EAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAC,CAAC;IAC3E,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,sBAAsB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAErE,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,OAAO,GAAG,EAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAC,CAAC;IAC3E,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,oBAAoB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnE,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,EAAC,OAAO,EAAE,GAAG,CAAC,UAAU,EAAC,CAAC;IACpF,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,oBAAoB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IAEzE,IAAI,GAAG,CAAC,cAAc;QAAE,GAAG,CAAC,cAAc,GAAG,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEzF,OAAO,GAAc,CAAC;AACvB,CAAC","sourcesContent":["import { numbers, initCommonOptions, CommonOptions, dates, MenuItem, paper } from \"@omegagrid/core\";\nimport { CellValidation, CellValidationSource, Renderer, StyleSource } from \"../types\";\nimport { CommentOptions, FilterSettings, SortSettings } from \"../model\";\nimport constants, { DEFAULT_FILTER_OPTIONS, DEFAULT_TREE_OPTIONS } from \"../constants\";\nimport { utils } from \"@omegagrid/core\";\nimport { ElementModel } from \"./elementModel\";\nimport { CellModel, CellSource } from \"./cellModel\";\nimport { RowModel } from \"./rowModel\";\nimport { ColumnModel } from \"./columnModel\";\nimport { CellAddress, RangeAddress } from \"../common\";\nimport { normalizeCellValidation } from \"./validations\";\n\nexport type ViewMode = 'grid' | 'singleObject';\n\nexport type EditingOptions = {\n\t/** enable inserting new rows */\n\trowInsertion?: boolean,\n\n\t/** enable deleting rows */\n\trowDeletion?: boolean,\n\n\t/** enable editing row outline levels */\n\trowOutline?: boolean,\n\n\t/** enable inserting new columns */\n\tcolInsertion?: boolean,\n\n\t/** enable deleting columns */\n\tcolDeletion?: boolean,\n\n\t/** enable editing column outline levels */\n\tcolOutline?: boolean,\n\n\t/** use calendar editor for date cells */\n\tdateCalendarEditor?: boolean,\n\n};\n\nexport type ScrollingOptions = {\n\t/** maximum proximity of cursor to scrollbar to be visible */\n\tscrollbarVisibilityTreshold?: number,\n\n\t/** enable vertical overscroll */\n\tverticalOverscroll?: boolean,\n\n\t/** enable horizontal overscroll */\n\thorizontalOverscroll?: boolean,\n};\n\nexport type GridMenuItem<T extends ElementModel> = MenuItem & {\n\thidden?: (model: T) => boolean,\n}\n\nexport type MenuOptionsItem<T extends ElementModel> = {\n\titems: GridMenuItem<T>[],\n\thidden?: (model: T) => boolean,\n\treplace?: boolean\n};\n\nexport type MenuOptions = {\n\tcell: MenuOptionsItem<CellModel>,\n\trow: MenuOptionsItem<RowModel>,\n\tcolumn: MenuOptionsItem<ColumnModel>,\n};\n\nexport type EventOptions = {\n\t/** grid click event options */\n\tclick: {\n\t\t/** maximum mouse move path length, after click event is allowed */\n\t\tmouseMoveTreshold: number\n\t}\n};\n\nexport type SortingOptions = {\n\t/** column sorting enabled */\n\tenabled?: boolean,\n\t\n\t/** maximum number of columns that can be sorted */\n\tmaxColumns?: number,\n\t\n\t/** initial sorting settings */\n\tdefaultSettings?: SortSettings[]\n};\n\nexport type FilterOptions = {\n\tenabled?: boolean;\n\t/** the parents of the matched rows will be included in the results */\n\tincludeParents?: boolean;\n\t/** the children of the matched rows will be included in the results */\n\tincludeChildren?: boolean;\n\t/** initial filter settings */\n\tdefaultSettings?: FilterSettings[]\n}\n\nexport type SelectingOptions = {\n\tenabled?: boolean;\n\tmultiSelect?: boolean;\n}\n\n\nexport type TreeOptions = {\n\tenabled?: boolean;\n\treversed?: boolean;\n}\n\nexport type PasteMode = 'insert'|'rewrite'|'rewrite_append';\n\nexport type ClipboardOptions = {\n\tpasteProps: (keyof CellSource)[]|'all';\n\n\t/**\n\t * paste mode for rows, \n\t * \tinsert = always insert new rows\n\t * \trewrite = rewrite when rows are availible\n\t * \trewrite_append = rewrite when rows are availible, otherwise insert new rows; default\n\t */\n\trowPasteMode?: PasteMode;\n\n\t/**\n\t * paste mode for columns, \n\t * \tinsert = always insert new columns\n\t * \trewrite = rewrite when columns are availible; default\n\t * \trewrite_append = rewrite when columns are availible, otherwise insert new columns\n\t */\n\tcolumnPasteMode?: PasteMode;\n\n\t/**\n\t * Skips hidden rows when pasting data.\n\t * Values are pasted into nearest visible row.\n\t */\n\tskipHiddenRows?: boolean;\n}\n\nexport type PrintOptions = {\n\t/** idexes of rows, after which page break will be inserted */\n\trowBreaks?: number[];\n\n\t/** range of rows to repeat at the top of each page, eg: \"1:20\" */\n\trowTitles?: RangeAddress;\n\n\t/** print scale, 50 = 50% */\n\tscale?: number;\n\n\t/** print page orientation */\n\torientation?: 'landscape'|'portrait';\n\n\t/** print quality */\n\tdpi?: number;\n\n\t/** print paper size */\n\tpaper?: paper.PaperType|paper.PaperSize;\n\n\t/** page margin settings */\n\tmargins?: {\n\t\ttop: number,\n\t\tbottom: number,\n\t\tleft: number,\n\t\tright: number,\n\t\theader: number,\n\t\tfooter: number\n\t}\n}\n\nexport type HeaderOptions = {\n\tstyle?: StyleSource;\n}\n\nexport type Options = {\n\tviewMode?: ViewMode,\n\n\t/** default number of rows */\n\trows?: number;\n\n\t/** default number of columns */\n\tcolumns?: number;\n\n\t/** readOnly cells */\n\treadOnly?: boolean;\n\n\t/** header options */\n\theaders?: HeaderOptions;\n\n\t/** render column with row numbers */\n\trowNumbers?: boolean;\n\n\t/** render column with row numbers */\n\trowResize?: boolean;\n\n\t/** default row priority */\n\trowPriority?: number;\n\n\t/** render column with row tree outline */\n\trowTree?: TreeOptions;\n\n\t/** render header row with column letters */\n\tcolLetters?: boolean;\n\n\t/** render row with column tree outline */\n\tcolumnTree?: TreeOptions;\n\n\t/** default column priority */\n\tcolumnPriority?: number;\n\n\t/** render column with row numbers */\n\tcolumnResize?: boolean;\n\n\t/** render tree buttons in column header labels */\n\tcolumnHeaderTreeButtons?: boolean;\n\n\t/** number of freezed rows on the top */\n\tfreezeTop?: number;\n\t\n\t/** number of freezed columns on the left */\n\tfreezeLeft?: number;\n\n\t/** number of freezed columns on the right, not implemented yet */\n\tfreezeRight?: number;\n\n\t/** number of freezed rows on the bottom, not implemented yet */\n\tfreezeBottom?: number;\n\n\t/** default font size */\n\tfontSize?: number;\n\n\t/** default row height */\n\trowHeight?: number;\n\n\t/** remove row hidden property after its parent is expanded */\n\tunhideRowAfterExpand?: boolean;\n\n\t/** default column width */\n\tcolumnWidth?: number;\n\n\t/** remove column hidden property after its parent is expanded */\n\tunhideColumnAfterExpand?: boolean;\n\n\t/** style source are native css styles */\n\tcssStyles?: boolean;\n\n\t/** cell border visibility */\n\tgrid?: boolean,\n\t\n\t/** column filter options */\n\tfilters?: FilterOptions,\n\n\t/** default number format */\n\tnumberFormat?: string,\n\t\n\t/** tries to repair invalid number/date formats */\n\tfixNumberFormat?: boolean,\n\n\t/** shows click indicator even in cells without value */\n\temptyClickable?: boolean,\n\n\t/** custom number formatter function */\n\tnumberFormatter?: numbers.NumberFormatterFunction,\n\n\t/** custom date formatter function */\n\tdateFormatter?: dates.DateFormatterFunction,\n\t\n\t/** enables default cell editing */\n\teditable?: boolean,\n\n\t/** enables formulas, enabled by default */\n\tformulas?: boolean,\n\n\t/** maximum nesting depth of the formula evaluation, deeper reference chains end with an error */\n\tmaxCalculationDepth?: number,\n\n\t/** enables default cell commenting */\n\tcommentable?: boolean,\n\n\t/** enables autofill function */\n\tautofill?: boolean,\n\n\t/** number of rows on one page for dynamic row fetching */\n\tpageSize?: number,\n\n\t/** enables command window */\n\tcommandWindow?: boolean,\n\n\t/** enables undo/redo */\n\tundoRedo?: boolean,\n\n\t/** location of cell with level buttons */\n\tlevelButtonCell?: {c: number, r: number},\n\n\t/** shows placeholder if grid is empty */\n\temptyPlaceholder?: boolean,\n\n\t/** custom cell renderer applied after default renderers */\n\tafterRenderer?: Renderer,\n\n\t/** factor of cell indentation */\n\tcellIndentFactor?: number,\n\n\t/** factor of level indentation */\n\tlevelIndentFactor?: number,\n\n\t/** menu options */\n\tmenus?: MenuOptions,\n\n\t/** editing options */\n\tediting?: EditingOptions,\n\n\t/** selecting options */\n\tselecting?: SelectingOptions,\n\n\t/** comment options */\n\tcomments?: CommentOptions,\n\t\n\t/** scrolling options */\n\tscrolling?: ScrollingOptions,\n\n\t/** event options */\n\tevents?: EventOptions,\n\t\n\t/** max number of sorted columns, deprecated */\n\tmaxSortingColumns?: number;\n\n\t/** enabled column sorting, deprecated */\n\tcolumnSorting?: boolean,\n\n\t/** column sorting options */\n\tsorting?: SortingOptions,\n\n\t/** clipboard options */\n\tclipboard?: ClipboardOptions,\n\n\t/** default cell validation rules */\n\tcellValidation?: CellValidation,\n\n\t/** first cell in viewport */\n\tfirstCell?: CellAddress,\n\n\t/** cell element caching */\n\tcellCache?: boolean,\n\n\t/** use single cell model instance for all grid cells */\n\tsingleCellModel?: boolean,\n\n\t/** options for raw html export/print */\n\tprint?: PrintOptions,\n\n\t/** grid zoom factor */\n\tzoom?: number,\n\n\t/** hides the outer border of the grid (right and top) */\n\thideOuterBorder?: boolean,\n} & CommonOptions;\n\nexport type OptionSource = Omit<Options, 'rowTree'|'columnTree'|'filters'|'cellValidation'> & {\n\trowTree?: boolean|TreeOptions;\n\tcolumnTree?: boolean|TreeOptions;\n\tfilters?: boolean|FilterOptions;\n\tcellValidation?: CellValidationSource;\n}\n\nexport function initOptions(options?: Partial<OptionSource>, origOptions: OptionSource = null): Options {\n\tconst opt = utils.mergeDeep<OptionSource>({}, constants.DEFAULT_OPTIONS, origOptions, initCommonOptions(options, origOptions));\n\t\n\tif (opt.numberFormat) {\n\t\topt.numberFormatter = numbers.getNumberFormatter(opt.formatLocale, opt.numberFormat);\n\t} else if (!opt.numberFormatter) {\n\t\topt.numberFormatter = numbers.getNumberFormatter(opt.formatLocale);\n\t}\n\n\tif (opt.dateFormat) {\n\t\topt.dateFormatter = dates.getDateFormatter(opt.formatLocale, opt.dateFormat);\n\t} else if (!opt.dateFormatter) {\n\t\topt.dateFormatter = dates.getDateFormatter(opt.formatLocale);\n\t}\n\n\tif (opt.columnSorting) {\n\t\topt.sorting = opt.sorting || {enabled: true};\n\t}\n\t\n\tif (typeof opt.filters === 'boolean') opt.filters = {enabled: opt.filters};\n\topt.filters = Object.assign({}, DEFAULT_FILTER_OPTIONS, opt.filters);\n\n\tif (typeof opt.rowTree === 'boolean') opt.rowTree = {enabled: opt.rowTree};\n\topt.rowTree = Object.assign({}, DEFAULT_TREE_OPTIONS, opt.rowTree);\n\n\tif (typeof opt.columnTree === 'boolean') opt.columnTree = {enabled: opt.columnTree};\n\topt.columnTree = Object.assign({}, DEFAULT_TREE_OPTIONS, opt.columnTree);\n\n\tif (opt.cellValidation) opt.cellValidation = normalizeCellValidation(opt.cellValidation);\n\n\treturn opt as Options;\n}"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/model/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAiB,KAAK,EAAmB,MAAM,iBAAiB,CAAC;AAGpG,OAAO,SAAS,EAAE,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAMxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AA+VxD,MAAM,UAAU,WAA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,SAAS;QAAE,GAAG,CAAC,OAAO,GAAG,EAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAC,CAAC;IAC3E,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,oBAAoB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnE,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,SAAS;QAAE,GAAG,CAAC,UAAU,GAAG,EAAC,OAAO,EAAE,GAAG,CAAC,UAAU,EAAC,CAAC;IACpF,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,oBAAoB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IAEzE,IAAI,GAAG,CAAC,cAAc;QAAE,GAAG,CAAC,cAAc,GAAG,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEzF,OAAO,GAAc,CAAC;AACvB,CAAC","sourcesContent":["import { numbers, initCommonOptions, CommonOptions, dates, MenuItem, paper } from \"@omegagrid/core\";\nimport { AutofitOptions, CellValidation, CellValidationSource, Renderer, StyleSource } from \"../types\";\nimport { CommentOptions, FilterSettings, SortSettings } from \"../model\";\nimport constants, { DEFAULT_FILTER_OPTIONS, DEFAULT_TREE_OPTIONS } from \"../constants\";\nimport { utils } from \"@omegagrid/core\";\nimport { ElementModel } from \"./elementModel\";\nimport { CellModel, CellSource } from \"./cellModel\";\nimport { RowModel } from \"./rowModel\";\nimport { ColumnModel } from \"./columnModel\";\nimport { CellAddress, RangeAddress } from \"../common\";\nimport { normalizeCellValidation } from \"./validations\";\n\nexport type ViewMode = 'grid' | 'singleObject';\n\nexport type EditingOptions = {\n\t/** enable inserting new rows */\n\trowInsertion?: boolean,\n\n\t/** enable deleting rows */\n\trowDeletion?: boolean,\n\n\t/** enable editing row outline levels */\n\trowOutline?: boolean,\n\n\t/** enable inserting new columns */\n\tcolInsertion?: boolean,\n\n\t/** enable deleting columns */\n\tcolDeletion?: boolean,\n\n\t/** enable editing column outline levels */\n\tcolOutline?: boolean,\n\n\t/** use calendar editor for date cells */\n\tdateCalendarEditor?: boolean,\n\n};\n\nexport type ScrollingOptions = {\n\t/** maximum proximity of cursor to scrollbar to be visible */\n\tscrollbarVisibilityTreshold?: number,\n\n\t/** enable vertical overscroll */\n\tverticalOverscroll?: boolean,\n\n\t/** enable horizontal overscroll */\n\thorizontalOverscroll?: boolean,\n};\n\nexport type GridMenuItem<T extends ElementModel> = MenuItem & {\n\thidden?: (model: T) => boolean,\n}\n\nexport type MenuOptionsItem<T extends ElementModel> = {\n\titems: GridMenuItem<T>[],\n\thidden?: (model: T) => boolean,\n\treplace?: boolean\n};\n\nexport type MenuOptions = {\n\tcell: MenuOptionsItem<CellModel>,\n\trow: MenuOptionsItem<RowModel>,\n\tcolumn: MenuOptionsItem<ColumnModel>,\n};\n\nexport type EventOptions = {\n\t/** grid click event options */\n\tclick: {\n\t\t/** maximum mouse move path length, after click event is allowed */\n\t\tmouseMoveTreshold: number\n\t}\n};\n\nexport type SortingOptions = {\n\t/** column sorting enabled */\n\tenabled?: boolean,\n\t\n\t/** maximum number of columns that can be sorted */\n\tmaxColumns?: number,\n\t\n\t/** initial sorting settings */\n\tdefaultSettings?: SortSettings[]\n};\n\nexport type FilterOptions = {\n\tenabled?: boolean;\n\t/** the parents of the matched rows will be included in the results */\n\tincludeParents?: boolean;\n\t/** the children of the matched rows will be included in the results */\n\tincludeChildren?: boolean;\n\t/** initial filter settings */\n\tdefaultSettings?: FilterSettings[]\n}\n\nexport type SelectingOptions = {\n\tenabled?: boolean;\n\tmultiSelect?: boolean;\n}\n\n\nexport type TreeOptions = {\n\tenabled?: boolean;\n\treversed?: boolean;\n}\n\nexport type PasteMode = 'insert'|'rewrite'|'rewrite_append';\n\nexport type ClipboardOptions = {\n\tpasteProps: (keyof CellSource)[]|'all';\n\n\t/**\n\t * paste mode for rows, \n\t * \tinsert = always insert new rows\n\t * \trewrite = rewrite when rows are availible\n\t * \trewrite_append = rewrite when rows are availible, otherwise insert new rows; default\n\t */\n\trowPasteMode?: PasteMode;\n\n\t/**\n\t * paste mode for columns, \n\t * \tinsert = always insert new columns\n\t * \trewrite = rewrite when columns are availible; default\n\t * \trewrite_append = rewrite when columns are availible, otherwise insert new columns\n\t */\n\tcolumnPasteMode?: PasteMode;\n\n\t/**\n\t * Skips hidden rows when pasting data.\n\t * Values are pasted into nearest visible row.\n\t */\n\tskipHiddenRows?: boolean;\n}\n\nexport type PrintOptions = {\n\t/** idexes of rows, after which page break will be inserted */\n\trowBreaks?: number[];\n\n\t/** range of rows to repeat at the top of each page, eg: \"1:20\" */\n\trowTitles?: RangeAddress;\n\n\t/** print scale, 50 = 50% */\n\tscale?: number;\n\n\t/** print page orientation */\n\torientation?: 'landscape'|'portrait';\n\n\t/** print quality */\n\tdpi?: number;\n\n\t/** print paper size */\n\tpaper?: paper.PaperType|paper.PaperSize;\n\n\t/** page margin settings */\n\tmargins?: {\n\t\ttop: number,\n\t\tbottom: number,\n\t\tleft: number,\n\t\tright: number,\n\t\theader: number,\n\t\tfooter: number\n\t}\n}\n\nexport type HeaderOptions = {\n\tstyle?: StyleSource;\n}\n\nexport type Options = {\n\tviewMode?: ViewMode,\n\n\t/** default number of rows */\n\trows?: number;\n\n\t/** default number of columns */\n\tcolumns?: number;\n\n\t/** readOnly cells */\n\treadOnly?: boolean;\n\n\t/** header options */\n\theaders?: HeaderOptions;\n\n\t/** render column with row numbers */\n\trowNumbers?: boolean;\n\n\t/** render column with row numbers */\n\trowResize?: boolean;\n\n\t/** default row priority */\n\trowPriority?: number;\n\n\t/** render column with row tree outline */\n\trowTree?: TreeOptions;\n\n\t/** render header row with column letters */\n\tcolLetters?: boolean;\n\n\t/** render row with column tree outline */\n\tcolumnTree?: TreeOptions;\n\n\t/** default column priority */\n\tcolumnPriority?: number;\n\n\t/** render column with row numbers */\n\tcolumnResize?: boolean;\n\n\t/** render tree buttons in column header labels */\n\tcolumnHeaderTreeButtons?: boolean;\n\n\t/** number of freezed rows on the top */\n\tfreezeTop?: number;\n\t\n\t/** number of freezed columns on the left */\n\tfreezeLeft?: number;\n\n\t/** number of freezed columns on the right, not implemented yet */\n\tfreezeRight?: number;\n\n\t/** number of freezed rows on the bottom, not implemented yet */\n\tfreezeBottom?: number;\n\n\t/** default font size */\n\tfontSize?: number;\n\n\t/** default row height */\n\trowHeight?: number;\n\n\t/** remove row hidden property after its parent is expanded */\n\tunhideRowAfterExpand?: boolean;\n\n\t/** default column width */\n\tcolumnWidth?: number;\n\n\t/** remove column hidden property after its parent is expanded */\n\tunhideColumnAfterExpand?: boolean;\n\n\t/** style source are native css styles */\n\tcssStyles?: boolean;\n\n\t/** cell border visibility */\n\tgrid?: boolean,\n\t\n\t/** column filter options */\n\tfilters?: FilterOptions,\n\n\t/** default number format */\n\tnumberFormat?: string,\n\t\n\t/** tries to repair invalid number/date formats */\n\tfixNumberFormat?: boolean,\n\n\t/** shows click indicator even in cells without value */\n\temptyClickable?: boolean,\n\n\t/** custom number formatter function */\n\tnumberFormatter?: numbers.NumberFormatterFunction,\n\n\t/** custom date formatter function */\n\tdateFormatter?: dates.DateFormatterFunction,\n\t\n\t/** enables default cell editing */\n\teditable?: boolean,\n\n\t/** enables formulas, enabled by default */\n\tformulas?: boolean,\n\n\t/** maximum nesting depth of the formula evaluation, deeper reference chains end with an error */\n\tmaxCalculationDepth?: number,\n\n\t/** enables default cell commenting */\n\tcommentable?: boolean,\n\n\t/** enables autofill function */\n\tautofill?: boolean,\n\n\t/** number of rows on one page for dynamic row fetching */\n\tpageSize?: number,\n\n\t/** enables command window */\n\tcommandWindow?: boolean,\n\n\t/** enables undo/redo */\n\tundoRedo?: boolean,\n\n\t/** location of cell with level buttons */\n\tlevelButtonCell?: {c: number, r: number},\n\n\t/** shows placeholder if grid is empty */\n\temptyPlaceholder?: boolean,\n\n\t/** custom cell renderer applied after default renderers */\n\tafterRenderer?: Renderer,\n\n\t/** factor of cell indentation */\n\tcellIndentFactor?: number,\n\n\t/** factor of level indentation */\n\tlevelIndentFactor?: number,\n\n\t/** menu options */\n\tmenus?: MenuOptions,\n\n\t/** editing options */\n\tediting?: EditingOptions,\n\n\t/** selecting options */\n\tselecting?: SelectingOptions,\n\n\t/** comment options */\n\tcomments?: CommentOptions,\n\t\n\t/** scrolling options */\n\tscrolling?: ScrollingOptions,\n\n\t/** event options */\n\tevents?: EventOptions,\n\t\n\t/** max number of sorted columns, deprecated */\n\tmaxSortingColumns?: number;\n\n\t/** enabled column sorting, deprecated */\n\tcolumnSorting?: boolean,\n\n\t/** column sorting options */\n\tsorting?: SortingOptions,\n\n\t/** clipboard options */\n\tclipboard?: ClipboardOptions,\n\n\t/** default cell validation rules */\n\tcellValidation?: CellValidation,\n\n\t/** first cell in viewport */\n\tfirstCell?: CellAddress,\n\n\t/** cell element caching */\n\tcellCache?: boolean,\n\n\t/** use single cell model instance for all grid cells */\n\tsingleCellModel?: boolean,\n\n\t/** options for raw html export/print */\n\tprint?: PrintOptions,\n\n\t/** grid zoom factor */\n\tzoom?: number,\n\n\t/** autofit options */\n\tautofit?: AutofitOptions,\n\n\t/** hides the outer border of the grid (right and top) */\n\thideOuterBorder?: boolean,\n} & CommonOptions;\n\nexport type OptionSource = Omit<Options, 'rowTree'|'columnTree'|'filters'|'cellValidation'> & {\n\trowTree?: boolean|TreeOptions;\n\tcolumnTree?: boolean|TreeOptions;\n\tfilters?: boolean|FilterOptions;\n\tcellValidation?: CellValidationSource;\n}\n\nexport function initOptions(options?: Partial<OptionSource>, origOptions: OptionSource = null): Options {\n\tconst opt = utils.mergeDeep<OptionSource>({}, constants.DEFAULT_OPTIONS, origOptions, initCommonOptions(options, origOptions));\n\t\n\tif (opt.numberFormat) {\n\t\topt.numberFormatter = numbers.getNumberFormatter(opt.formatLocale, opt.numberFormat);\n\t} else if (!opt.numberFormatter) {\n\t\topt.numberFormatter = numbers.getNumberFormatter(opt.formatLocale);\n\t}\n\n\tif (opt.dateFormat) {\n\t\topt.dateFormatter = dates.getDateFormatter(opt.formatLocale, opt.dateFormat);\n\t} else if (!opt.dateFormatter) {\n\t\topt.dateFormatter = dates.getDateFormatter(opt.formatLocale);\n\t}\n\n\tif (opt.columnSorting) {\n\t\topt.sorting = opt.sorting || {enabled: true};\n\t}\n\t\n\tif (typeof opt.filters === 'boolean') opt.filters = {enabled: opt.filters};\n\topt.filters = Object.assign({}, DEFAULT_FILTER_OPTIONS, opt.filters);\n\n\tif (typeof opt.rowTree === 'boolean') opt.rowTree = {enabled: opt.rowTree};\n\topt.rowTree = Object.assign({}, DEFAULT_TREE_OPTIONS, opt.rowTree);\n\n\tif (typeof opt.columnTree === 'boolean') opt.columnTree = {enabled: opt.columnTree};\n\topt.columnTree = Object.assign({}, DEFAULT_TREE_OPTIONS, opt.columnTree);\n\n\tif (opt.cellValidation) opt.cellValidation = normalizeCellValidation(opt.cellValidation);\n\n\treturn opt as Options;\n}"]}
@@ -26,7 +26,9 @@ export declare class SortingModel {
26
26
  /**
27
27
  * Restore settings captured from a previous model instance (grid refresh recreates
28
28
  * the model). Rows are re-sorted client-side only when `apply` is true — with
29
- * custom (server-side) sorting the loaded rows are already ordered by the request.
29
+ * custom (server-side) sorting the loaded rows are already ordered by the request, so they go
30
+ * back to the order they came in, whatever the settings the new model applied to itself in
31
+ * its constructor (the default ones).
30
32
  */
31
33
  restore(settings: SortSettings[], apply?: boolean): void;
32
34
  /**
@@ -44,6 +46,8 @@ export declare class SortingModel {
44
46
  * Reset row order to default state
45
47
  */
46
48
  resetSort(): void;
49
+ /** Put the rows back into the order they came in (the one of the source) */
50
+ private restoreOrigOrder;
47
51
  /**
48
52
  * Use current sorting settings as default row order
49
53
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sortingModel.d.ts","sourceRoot":"","sources":["../../src/model/sortingModel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,oBAAY,SAAS;IACpB,GAAG,IAAI;IACP,IAAI,KAAK;CACT;AAED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IACI,YAAY,EAAE,GAAC,IAAI,CADK;IACxC,IAAI,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,GAAC,IAAI,EAQlC;gBAGgB,KAAK,EAAE,SAAS,EAChC,SAAS,GAAE,YAAY,EAAE,GAAC,IAAW;IAKtC;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM;IAIb;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,KAAK,UAAQ;IAS/C;;;;;OAKG;IACH,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,SAAgB,EAAE,MAAM,UAAQ,GAAG,YAAY;IAuCpE;;OAEG;IACH,SAAS;IAuCT;;OAEG;IACH,SAAS;IAMT,4EAA4E;IAC5E,OAAO,CAAC,gBAAgB;IAKxB;;OAEG;IACH,WAAW;CAIX"}
@@ -65,7 +65,9 @@ export class SortingModel {
65
65
  /**
66
66
  * Restore settings captured from a previous model instance (grid refresh recreates
67
67
  * the model). Rows are re-sorted client-side only when `apply` is true — with
68
- * custom (server-side) sorting the loaded rows are already ordered by the request.
68
+ * custom (server-side) sorting the loaded rows are already ordered by the request, so they go
69
+ * back to the order they came in, whatever the settings the new model applied to itself in
70
+ * its constructor (the default ones).
69
71
  */
70
72
  restore(settings, apply = false) {
71
73
  // drop settings for columns that no longer exist in the refreshed model
@@ -74,6 +76,8 @@ export class SortingModel {
74
76
  this._settings.forEach((s, i) => this.colMap.set(s.c, i));
75
77
  if (apply && this._settings.length > 0)
76
78
  this.applySort();
79
+ else
80
+ this.restoreOrigOrder();
77
81
  }
78
82
  /**
79
83
  * Add sorting settings for specified column
@@ -161,6 +165,10 @@ export class SortingModel {
161
165
  resetSort() {
162
166
  this.settings = [];
163
167
  this.colMap.clear();
168
+ this.restoreOrigOrder();
169
+ }
170
+ /** Put the rows back into the order they came in (the one of the source) */
171
+ restoreOrigOrder() {
164
172
  this.model.rowRoot.sort(origComparer);
165
173
  this.model.indexRowsByTree();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AAC,CAAC;IACpD,CAAC;CAED","sourcesContent":["import { UIValueType, log } from \"@omegagrid/core\";\nimport { AditionalUIValueType, Comparer } from \"../types\";\nimport { CellModel } from \"./cellModel\";\nimport { GridModel } from \"./gridModel\";\nimport { RowModel } from \"./rowModel\";\n\nexport enum SortOrder {\n\tAsc = 1,\n\tDesc = -1\n}\n\nexport type SortSettings = {\n\tc: number,\n\tord: SortOrder,\n\tindex?: number\n};\n\n// date/datetime/time cell values may be Date instances or numbers (the cell value handler\n// coerces 'd' strings to serial date numbers); anything else sorts as 0\nconst dateSortValue = (v: unknown): number => v instanceof Date ? v.getTime() : (typeof v === 'number' ? v : 0);\n\n// text comparers use plainValue, the quote prefix must not take part in the comparison\nconst ascComparers: Record<UIValueType|AditionalUIValueType, Comparer> = {\n\t'g': (a: CellModel, b: CellModel) => a.plainValue == b.plainValue ? 0 : (a.plainValue > b.plainValue ? 1 : -1),\n\t't': (a: CellModel, b: CellModel) => (a.plainValue as string || '').toString().localeCompare((b.plainValue as string || '').toString()),\n\t's': (a: CellModel, b: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'm': (a: CellModel, b: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'n': (a: CellModel, b: CellModel) => (a.value as number) - (b.value as number),\n\t'd': (a: CellModel, b: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'tm': (a: CellModel, b: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'dt': (a: CellModel, b: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'b': (a: CellModel, b: CellModel) => (a.value as number) - (b.value as number),\n\t'h': (a: CellModel, b: CellModel) => ((a.value as string) || '').localeCompare(b.value as string),\n\t'a': () => 0\n};\n\nconst descComparers: Record<UIValueType|AditionalUIValueType, Comparer> = {\n\t'g': (b: CellModel, a: CellModel) => a.plainValue == b.plainValue ? 0 : (a.plainValue > b.plainValue ? 1 : -1),\n\t't': (b: CellModel, a: CellModel) => (a.plainValue as string || '').toString().localeCompare((b.plainValue as string || '').toString()),\n\t's': (b: CellModel, a: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'm': (b: CellModel, a: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'n': (b: CellModel, a: CellModel) => (a.value as number) - (b.value as number),\n\t'd': (b: CellModel, a: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'tm': (b: CellModel, a: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'dt': (b: CellModel, a: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'b': (b: CellModel, a: CellModel) => (a.value as number) - (b.value as number),\n\t'h': (b: CellModel, a: CellModel) => ((a.value as string) || '').localeCompare(b.value as string),\n\t'a': () => 0\n};\n\nconst origComparer = (a: RowModel, b: RowModel) => a.origIndex - b.origIndex;\n\n/**\n * Class for sorting rows by columns sort settings\n */\nexport class SortingModel {\n\n\tprivate colMap = new Map<number, number>();\n\tprivate _settings: SortSettings[] = [];\n\n\tget settings() { return this._settings }\n\tset settings(v: SortSettings[]|null) {\n\t\tthis._settings = v || [];\n\t\tthis.colMap.clear();\n\t\tif (this.settings.length > 0) {\n\t\t\tthis.settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\t\tthis.applySort();\n\t\t\tlog.getLogger().info(`sorting applied: ${JSON.stringify(this.settings)}`);\n\t\t}\n\t}\n\t\n\tconstructor(\n\t\tpublic readonly model: GridModel,\n\t\t_settings: SortSettings[]|null = null\n\t) {\n\t\tthis.settings = _settings;\n\t}\n\n\t/**\n\t * Get sorting settings for specified column\n\t * @param c column index\n\t */\n\tget(c: number) {\n\t\treturn this.colMap.has(c) ? this.settings[this.colMap.get(c)] : null;\n\t}\n\n\t/**\n\t * Restore settings captured from a previous model instance (grid refresh recreates\n\t * the model). Rows are re-sorted client-side only when `apply` is true — with\n\t * custom (server-side) sorting the loaded rows are already ordered by the request.\n\t */\n\trestore(settings: SortSettings[], apply = false) {\n\t\t// drop settings for columns that no longer exist in the refreshed model\n\t\tthis._settings = (settings || []).filter(s => this.model.columns[s.c]);\n\t\tthis.colMap.clear();\n\t\tthis._settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\tif (apply && this._settings.length > 0) this.applySort();\n\t}\n\n\t/**\n\t * Add sorting settings for specified column\n\t * @param c column index\n\t * @param ord sorting order\n\t * @param custom if true, sorting will not be automaticaly applied\n\t */\n\tsort(c: number, ord: SortOrder = null, custom = false): SortSettings {\n\t\tlet sortSetting: SortSettings = this.get(c);\n\t\tif (sortSetting && sortSetting.ord == SortOrder.Desc && ord === null) {\n\t\t\tthis.settings.splice(this.colMap.get(c), 1);\n\t\t\tsortSetting = null;\n\t\t} else if (sortSetting) {\n\t\t\tsortSetting.ord = SortOrder.Desc;\n\t\t\tthis.settings.splice(this.colMap.get(c), 1);\n\t\t} else {\n\t\t\tsortSetting = {c: c, ord: SortOrder.Asc};\n\t\t}\n\t\t\n\t\tif (sortSetting) {\n\t\t\tif (ord !== null) sortSetting.ord = ord;\n\t\t\tthis.colMap.set(c, 0);\n\t\t\tthis.settings.unshift(sortSetting);\n\t\t}\n\t\t\n\t\tif (this.settings.length > this.model.options.maxSortingColumns) {\n\t\t\tthis.settings.pop();\n\t\t}\n\n\t\tthis.colMap.clear();\n\t\tthis.settings.forEach((s, i) => {\n\t\t\ts.index = i;\n\t\t\tthis.colMap.set(s.c, i);\n\t\t});\n\n\t\tif (!custom) {\n\t\t\tif (this.settings.length > 0) {\n\t\t\t\tthis.applySort();\n\t\t\t} else {\n\t\t\t\tthis.resetSort();\n\t\t\t}\n\t\t}\n\n\t\treturn sortSetting;\n\t}\n\n\t/**\n\t * Apply current sorting settings to rows\n\t */\n\tapplySort() {\n\t\tconst m = this.model;\n\t\tconst cellComparers = this.settings.map(s => {\n\t\t\tconst column = m.columns[s.c];\n\t\t\tif (!column) {\n\t\t\t\tlog.getLogger().warn(`Column sorting: Column with index ${s.c} not found`);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t\n\t\t\tif (column.comparer) return s.ord == SortOrder.Asc \n\t\t\t\t? column.comparer\n\t\t\t\t: (a: CellModel, b: CellModel) => -column.comparer(a, b);\n\n\t\t\treturn s.ord == SortOrder.Asc\n\t\t\t\t? ascComparers[column.type ?? 't']\n\t\t\t\t: descComparers[column.type ?? 't'];\n\t\t}).filter(c => c);\n\n\t\tconst len = cellComparers.length;\n\t\tlet ord: number, i: number, c: number;\n\n\t\tconst rowComparer = (a: RowModel, b: RowModel) => {\n\t\t\tif (a.sortable === false || b.sortable === false) {\n\t\t\t\t// if sorting for one of the rows is disabled, use original index for comparison\n\t\t\t\treturn a.origIndex - b.origIndex;\n\t\t\t}\n\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tc = this.settings[i].c;\n\t\t\t\tord = cellComparers[i](a.cell(c), b.cell(c));\n\t\t\t\tif (ord != 0) return ord;\n\t\t\t}\n\t\t\treturn 0;\n\t\t};\n\n\t\tm.rowRoot.sort(rowComparer);\n\t\tm.indexRowsByTree();\n\t}\n\n\t/**\n\t * Reset row order to default state\n\t */\n\tresetSort() {\n\t\tthis.settings = [];\n\t\tthis.colMap.clear();\n\t\tthis.model.rowRoot.sort(origComparer);\n\t\tthis.model.indexRowsByTree();\n\t}\n\n\t/**\n\t * Use current sorting settings as default row order\n\t */\n\tpersistSort() {\n\t\tthis.model.rows.forEach((r, i) => r.origIndex = i);\n\t}\n\n}"]}
1
+ {"version":3,"file":"sortingModel.js","sourceRoot":"","sources":["../../src/model/sortingModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAMnD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,uCAAO,CAAA;IACP,0CAAS,CAAA;AACV,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAQD,0FAA0F;AAC1F,wEAAwE;AACxE,MAAM,aAAa,GAAG,CAAC,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AAS,CAAC;YAClC,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC1B,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACvB,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,IAAI,GAAG,IAAI,CAAC;oBAAE,OAAO,GAAG,CAAC;YAC1B,CAAC;YACD,OAAO,CAAC,CAAC;QACV,CAAC,CAAC;QAEF,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5B,CAAC,CAAC,eAAe,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,SAAS;QACR,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACzB,CAAC;IAED,4EAA4E;IACpE,gBAAgB;QACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,WAAW;QACV,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;CAED","sourcesContent":["import { UIValueType, log } from \"@omegagrid/core\";\nimport { AditionalUIValueType, Comparer } from \"../types\";\nimport { CellModel } from \"./cellModel\";\nimport { GridModel } from \"./gridModel\";\nimport { RowModel } from \"./rowModel\";\n\nexport enum SortOrder {\n\tAsc = 1,\n\tDesc = -1\n}\n\nexport type SortSettings = {\n\tc: number,\n\tord: SortOrder,\n\tindex?: number\n};\n\n// date/datetime/time cell values may be Date instances or numbers (the cell value handler\n// coerces 'd' strings to serial date numbers); anything else sorts as 0\nconst dateSortValue = (v: unknown): number => v instanceof Date ? v.getTime() : (typeof v === 'number' ? v : 0);\n\n// text comparers use plainValue, the quote prefix must not take part in the comparison\nconst ascComparers: Record<UIValueType|AditionalUIValueType, Comparer> = {\n\t'g': (a: CellModel, b: CellModel) => a.plainValue == b.plainValue ? 0 : (a.plainValue > b.plainValue ? 1 : -1),\n\t't': (a: CellModel, b: CellModel) => (a.plainValue as string || '').toString().localeCompare((b.plainValue as string || '').toString()),\n\t's': (a: CellModel, b: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'm': (a: CellModel, b: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'n': (a: CellModel, b: CellModel) => (a.value as number) - (b.value as number),\n\t'd': (a: CellModel, b: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'tm': (a: CellModel, b: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'dt': (a: CellModel, b: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'b': (a: CellModel, b: CellModel) => (a.value as number) - (b.value as number),\n\t'h': (a: CellModel, b: CellModel) => ((a.value as string) || '').localeCompare(b.value as string),\n\t'a': () => 0\n};\n\nconst descComparers: Record<UIValueType|AditionalUIValueType, Comparer> = {\n\t'g': (b: CellModel, a: CellModel) => a.plainValue == b.plainValue ? 0 : (a.plainValue > b.plainValue ? 1 : -1),\n\t't': (b: CellModel, a: CellModel) => (a.plainValue as string || '').toString().localeCompare((b.plainValue as string || '').toString()),\n\t's': (b: CellModel, a: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'm': (b: CellModel, a: CellModel) => a.value == b.value ? 0 : (a.value > b.value ? 1 : -1),\n\t'n': (b: CellModel, a: CellModel) => (a.value as number) - (b.value as number),\n\t'd': (b: CellModel, a: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'tm': (b: CellModel, a: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'dt': (b: CellModel, a: CellModel) => dateSortValue(a.value) - dateSortValue(b.value),\n\t'b': (b: CellModel, a: CellModel) => (a.value as number) - (b.value as number),\n\t'h': (b: CellModel, a: CellModel) => ((a.value as string) || '').localeCompare(b.value as string),\n\t'a': () => 0\n};\n\nconst origComparer = (a: RowModel, b: RowModel) => a.origIndex - b.origIndex;\n\n/**\n * Class for sorting rows by columns sort settings\n */\nexport class SortingModel {\n\n\tprivate colMap = new Map<number, number>();\n\tprivate _settings: SortSettings[] = [];\n\n\tget settings() { return this._settings }\n\tset settings(v: SortSettings[]|null) {\n\t\tthis._settings = v || [];\n\t\tthis.colMap.clear();\n\t\tif (this.settings.length > 0) {\n\t\t\tthis.settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\t\tthis.applySort();\n\t\t\tlog.getLogger().info(`sorting applied: ${JSON.stringify(this.settings)}`);\n\t\t}\n\t}\n\t\n\tconstructor(\n\t\tpublic readonly model: GridModel,\n\t\t_settings: SortSettings[]|null = null\n\t) {\n\t\tthis.settings = _settings;\n\t}\n\n\t/**\n\t * Get sorting settings for specified column\n\t * @param c column index\n\t */\n\tget(c: number) {\n\t\treturn this.colMap.has(c) ? this.settings[this.colMap.get(c)] : null;\n\t}\n\n\t/**\n\t * Restore settings captured from a previous model instance (grid refresh recreates\n\t * the model). Rows are re-sorted client-side only when `apply` is true — with\n\t * custom (server-side) sorting the loaded rows are already ordered by the request, so they go\n\t * back to the order they came in, whatever the settings the new model applied to itself in\n\t * its constructor (the default ones).\n\t */\n\trestore(settings: SortSettings[], apply = false) {\n\t\t// drop settings for columns that no longer exist in the refreshed model\n\t\tthis._settings = (settings || []).filter(s => this.model.columns[s.c]);\n\t\tthis.colMap.clear();\n\t\tthis._settings.forEach((s, i) => this.colMap.set(s.c, i));\n\t\tif (apply && this._settings.length > 0) this.applySort();\n\t\telse this.restoreOrigOrder();\n\t}\n\n\t/**\n\t * Add sorting settings for specified column\n\t * @param c column index\n\t * @param ord sorting order\n\t * @param custom if true, sorting will not be automaticaly applied\n\t */\n\tsort(c: number, ord: SortOrder = null, custom = false): SortSettings {\n\t\tlet sortSetting: SortSettings = this.get(c);\n\t\tif (sortSetting && sortSetting.ord == SortOrder.Desc && ord === null) {\n\t\t\tthis.settings.splice(this.colMap.get(c), 1);\n\t\t\tsortSetting = null;\n\t\t} else if (sortSetting) {\n\t\t\tsortSetting.ord = SortOrder.Desc;\n\t\t\tthis.settings.splice(this.colMap.get(c), 1);\n\t\t} else {\n\t\t\tsortSetting = {c: c, ord: SortOrder.Asc};\n\t\t}\n\t\t\n\t\tif (sortSetting) {\n\t\t\tif (ord !== null) sortSetting.ord = ord;\n\t\t\tthis.colMap.set(c, 0);\n\t\t\tthis.settings.unshift(sortSetting);\n\t\t}\n\t\t\n\t\tif (this.settings.length > this.model.options.maxSortingColumns) {\n\t\t\tthis.settings.pop();\n\t\t}\n\n\t\tthis.colMap.clear();\n\t\tthis.settings.forEach((s, i) => {\n\t\t\ts.index = i;\n\t\t\tthis.colMap.set(s.c, i);\n\t\t});\n\n\t\tif (!custom) {\n\t\t\tif (this.settings.length > 0) {\n\t\t\t\tthis.applySort();\n\t\t\t} else {\n\t\t\t\tthis.resetSort();\n\t\t\t}\n\t\t}\n\n\t\treturn sortSetting;\n\t}\n\n\t/**\n\t * Apply current sorting settings to rows\n\t */\n\tapplySort() {\n\t\tconst m = this.model;\n\t\tconst cellComparers = this.settings.map(s => {\n\t\t\tconst column = m.columns[s.c];\n\t\t\tif (!column) {\n\t\t\t\tlog.getLogger().warn(`Column sorting: Column with index ${s.c} not found`);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t\n\t\t\tif (column.comparer) return s.ord == SortOrder.Asc \n\t\t\t\t? column.comparer\n\t\t\t\t: (a: CellModel, b: CellModel) => -column.comparer(a, b);\n\n\t\t\treturn s.ord == SortOrder.Asc\n\t\t\t\t? ascComparers[column.type ?? 't']\n\t\t\t\t: descComparers[column.type ?? 't'];\n\t\t}).filter(c => c);\n\n\t\tconst len = cellComparers.length;\n\t\tlet ord: number, i: number, c: number;\n\n\t\tconst rowComparer = (a: RowModel, b: RowModel) => {\n\t\t\tif (a.sortable === false || b.sortable === false) {\n\t\t\t\t// if sorting for one of the rows is disabled, use original index for comparison\n\t\t\t\treturn a.origIndex - b.origIndex;\n\t\t\t}\n\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tc = this.settings[i].c;\n\t\t\t\tord = cellComparers[i](a.cell(c), b.cell(c));\n\t\t\t\tif (ord != 0) return ord;\n\t\t\t}\n\t\t\treturn 0;\n\t\t};\n\n\t\tm.rowRoot.sort(rowComparer);\n\t\tm.indexRowsByTree();\n\t}\n\n\t/**\n\t * Reset row order to default state\n\t */\n\tresetSort() {\n\t\tthis.settings = [];\n\t\tthis.colMap.clear();\n\t\tthis.restoreOrigOrder();\n\t}\n\n\t/** Put the rows back into the order they came in (the one of the source) */\n\tprivate restoreOrigOrder() {\n\t\tthis.model.rowRoot.sort(origComparer);\n\t\tthis.model.indexRowsByTree();\n\t}\n\n\t/**\n\t * Use current sorting settings as default row order\n\t */\n\tpersistSort() {\n\t\tthis.model.rows.forEach((r, i) => r.origIndex = i);\n\t}\n\n}"]}
package/dist/types.d.ts CHANGED
@@ -117,7 +117,8 @@ export type SpillResult = {
117
117
  range: CellRange;
118
118
  };
119
119
  export type AutofitOptions = {
120
- visibleOnly?: boolean;
120
+ /** column autofit measures the header labels too (default true) */
121
+ includeHeaders?: boolean;
121
122
  };
122
123
  export type CellSerializationOptions = {
123
124
  displayValue?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EA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,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,CAAC,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorTypes, Direction, Size, Location, UIValueType, Matrix, KeyValue, MenuItem } from \"@omegagrid/core\";\nimport { CSSStyle, CellModel, GridSource, Style, CommentItem, TableTheme, EditingOptions } from \"./model\";\nimport { CellRange } from \"./common\";\n\nexport type Renderer = (div: HTMLDivElement, cell: CellModel) => HTMLDivElement;\nexport type CommentRenderer = (div: HTMLDivElement, comment: CommentItem, cell: CellModel) => HTMLDivElement;\n\nexport type Comparer = (a: CellModel, b: CellModel) => number;\n\nexport type FormulaFunction = (...args: unknown[]) => unknown;\n\nexport type BaseGroupModelSource = {\n\tmodels: GridSource[],\n\tthemes?: TableTheme[]\n\t//layout: TabSplitContainerModel\n}\n\nexport type EditType = 'value'|'style'|'insert_row'|'insert_column'|'delete_row'|'delete_column'|'move_row'|'move_column'|'autofill';\nexport type CellValueType = unknown; //number|string|boolean|object|null;\n/**\n * Filter term produced by the date/datetime/time range filter popup (`og-filter-range`).\n * Numeric columns do NOT use this — they filter via a text expression (see\n * {@link NumericFilterGroups} and `parseNumericExpression`).\n */\nexport type FilterRange = {\n\tkind: 'range',\n\tfrom?: number|string|Date|null,\n\tto?: number|string|Date|null,\n};\nexport type FilterValue = string|number|boolean|KeyValue[]|FilterRange;\n\n/** Comparison operators usable in a numeric text filter expression (e.g. `> 100`). */\nexport type NumericFilterOperator = '=' | '!=' | '<' | '<=' | '>' | '>=';\nexport type NumericFilterClause = { op: NumericFilterOperator, value: number };\n/**\n * Parsed numeric expression as a disjunction of conjunctions: the outer array holds\n * OR groups, each inner array holds clauses combined with AND. A value matches if it\n * satisfies every clause of at least one group.\n */\nexport type NumericFilterGroups = NumericFilterClause[][];\n\n/**\n * Actions = 'a',\n * Html = 'h'\n */\nexport type AditionalUIValueType = 'a'|'h';\n\nexport type CellType = UIValueType | AditionalUIValueType;\n\nexport type StyleSource = number|string|Style|CSSStyle;\n\nexport type CellAction = {\n\taction: string,\n\ticon?: string,\n\ttext?: string,\n\ttitle?: string,\n\tcolor?: ColorTypes,\n\ttype?: 'button'|'menu',\n\titems?: MenuItem[]\n}\n\nexport type CellValidationSource = {\n\t/** Allow invalid cell values */\n\tallowInvalid?: boolean,\n\n\t/** Validation pattern */\n\tpattern?: string|RegExp,\n\n\t/** Validation function */\n\tvalidate?: (cell: CellModel, value: unknown) => boolean,\n}\n\nexport type CellValidation = Omit<CellValidationSource, 'pattern'> & {\n\t/** Validation pattern */\n\tpattern?: RegExp,\n}\n\nexport type ShiftOptions = {\n\t/** Index of the first shifted row/column */\n\tindex: number;\n\t/** Number of rows/columns to shift */\n\toffset: number;\n\t/** Shift direction up/down for rows, left/right for columns */\n\tdirection: Direction;\n\t/** Name of the sheet where the shift occured */\n\tsheet?: string;\n\t/** Force shift on all references */\n\tallSheets?: boolean;\n\t/** Maximum affected index */\n\tmaxIndex?: number;\n\t/** Shift anchored coords */\n\tignoreAnchors?: boolean;\n}\n\nexport type FormulaFuncParamDescription = {\n\tname: string,\n\ttype: string,\n\tdescription: string,\n\toptional: boolean,\n\tdefault?: string\n}\n\nexport type FormulaFuncDescription = {\n\tname: string,\n\tparams: FormulaFuncParamDescription[],\n\treturns: string,\n\tdescription: string,\n\tlinks: string[]\n}\n\nexport type FormulaFuncGroupDescription = {\n\tname: string,\n\tfunctions: FormulaFuncDescription[]\n}\n\nexport type TabOptions = {\n\tcolor?: string,\n\thidden?: boolean,\n}\n\nexport type ObjectModel = {\n\tlocation: Location;\n\tsize: Size;\n\tzIndex?: number;\n}\n\nexport type SpillOptions = {\n\tcell: CellModel; \n\tvalues: Matrix;\n\tpropertyCell?: CellModel;\n\tdisplayValues?: Matrix<string>;\n}\n\nexport type SpillResult = {\n\tcells: CellModel[];\n\toldValues: CellValueType[];\n\trange: CellRange;\n}\n\nexport type AutofitOptions = {\n\tvisibleOnly?: boolean;\n}\n\nexport type CellSerializationOptions = {\n\tdisplayValue?: boolean;\n}\n\nexport type EditorFactory<T extends HTMLElement = HTMLElement> = (cell: CellModel, options?: EditingOptions) => T;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorTypes, Direction, Size, Location, UIValueType, Matrix, KeyValue, MenuItem } from \"@omegagrid/core\";\nimport { CSSStyle, CellModel, GridSource, Style, CommentItem, TableTheme, EditingOptions } from \"./model\";\nimport { CellRange } from \"./common\";\n\nexport type Renderer = (div: HTMLDivElement, cell: CellModel) => HTMLDivElement;\nexport type CommentRenderer = (div: HTMLDivElement, comment: CommentItem, cell: CellModel) => HTMLDivElement;\n\nexport type Comparer = (a: CellModel, b: CellModel) => number;\n\nexport type FormulaFunction = (...args: unknown[]) => unknown;\n\nexport type BaseGroupModelSource = {\n\tmodels: GridSource[],\n\tthemes?: TableTheme[]\n\t//layout: TabSplitContainerModel\n}\n\nexport type EditType = 'value'|'style'|'insert_row'|'insert_column'|'delete_row'|'delete_column'|'move_row'|'move_column'|'autofill';\nexport type CellValueType = unknown; //number|string|boolean|object|null;\n/**\n * Filter term produced by the date/datetime/time range filter popup (`og-filter-range`).\n * Numeric columns do NOT use this — they filter via a text expression (see\n * {@link NumericFilterGroups} and `parseNumericExpression`).\n */\nexport type FilterRange = {\n\tkind: 'range',\n\tfrom?: number|string|Date|null,\n\tto?: number|string|Date|null,\n};\nexport type FilterValue = string|number|boolean|KeyValue[]|FilterRange;\n\n/** Comparison operators usable in a numeric text filter expression (e.g. `> 100`). */\nexport type NumericFilterOperator = '=' | '!=' | '<' | '<=' | '>' | '>=';\nexport type NumericFilterClause = { op: NumericFilterOperator, value: number };\n/**\n * Parsed numeric expression as a disjunction of conjunctions: the outer array holds\n * OR groups, each inner array holds clauses combined with AND. A value matches if it\n * satisfies every clause of at least one group.\n */\nexport type NumericFilterGroups = NumericFilterClause[][];\n\n/**\n * Actions = 'a',\n * Html = 'h'\n */\nexport type AditionalUIValueType = 'a'|'h';\n\nexport type CellType = UIValueType | AditionalUIValueType;\n\nexport type StyleSource = number|string|Style|CSSStyle;\n\nexport type CellAction = {\n\taction: string,\n\ticon?: string,\n\ttext?: string,\n\ttitle?: string,\n\tcolor?: ColorTypes,\n\ttype?: 'button'|'menu',\n\titems?: MenuItem[]\n}\n\nexport type CellValidationSource = {\n\t/** Allow invalid cell values */\n\tallowInvalid?: boolean,\n\n\t/** Validation pattern */\n\tpattern?: string|RegExp,\n\n\t/** Validation function */\n\tvalidate?: (cell: CellModel, value: unknown) => boolean,\n}\n\nexport type CellValidation = Omit<CellValidationSource, 'pattern'> & {\n\t/** Validation pattern */\n\tpattern?: RegExp,\n}\n\nexport type ShiftOptions = {\n\t/** Index of the first shifted row/column */\n\tindex: number;\n\t/** Number of rows/columns to shift */\n\toffset: number;\n\t/** Shift direction up/down for rows, left/right for columns */\n\tdirection: Direction;\n\t/** Name of the sheet where the shift occured */\n\tsheet?: string;\n\t/** Force shift on all references */\n\tallSheets?: boolean;\n\t/** Maximum affected index */\n\tmaxIndex?: number;\n\t/** Shift anchored coords */\n\tignoreAnchors?: boolean;\n}\n\nexport type FormulaFuncParamDescription = {\n\tname: string,\n\ttype: string,\n\tdescription: string,\n\toptional: boolean,\n\tdefault?: string\n}\n\nexport type FormulaFuncDescription = {\n\tname: string,\n\tparams: FormulaFuncParamDescription[],\n\treturns: string,\n\tdescription: string,\n\tlinks: string[]\n}\n\nexport type FormulaFuncGroupDescription = {\n\tname: string,\n\tfunctions: FormulaFuncDescription[]\n}\n\nexport type TabOptions = {\n\tcolor?: string,\n\thidden?: boolean,\n}\n\nexport type ObjectModel = {\n\tlocation: Location;\n\tsize: Size;\n\tzIndex?: number;\n}\n\nexport type SpillOptions = {\n\tcell: CellModel; \n\tvalues: Matrix;\n\tpropertyCell?: CellModel;\n\tdisplayValues?: Matrix<string>;\n}\n\nexport type SpillResult = {\n\tcells: CellModel[];\n\toldValues: CellValueType[];\n\trange: CellRange;\n}\n\nexport type AutofitOptions = {\n\t// visibleOnly?: boolean;\n\t/** column autofit measures the header labels too (default true) */\n\tincludeHeaders?: boolean;\n}\n\nexport type CellSerializationOptions = {\n\tdisplayValue?: boolean;\n}\n\nexport type EditorFactory<T extends HTMLElement = HTMLElement> = (cell: CellModel, options?: EditingOptions) => T;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/grid-core",
3
- "version": "0.11.17",
3
+ "version": "0.11.19",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Grid model, no ui components",
6
6
  "main": "./dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "generate-functions-docs": "node ./scripts/generate-functions-docs.cjs"
29
29
  },
30
30
  "dependencies": {
31
- "@omegagrid/core": "^0.11.17",
32
- "@omegagrid/localize": "^0.11.17",
31
+ "@omegagrid/core": "^0.11.19",
32
+ "@omegagrid/localize": "^0.11.19",
33
33
  "@stdlib/stats": "^0.0.13",
34
34
  "color": "^4.2.3",
35
35
  "date-fns": "^3.2.0",