@omegagrid/grid-core 0.10.75 → 0.10.77
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":"merges.d.ts","sourceRoot":"","sources":["../../src/model/merges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,uBAAuB;AACvB,MAAM,MAAM,KAAK,GAAG;IACnB,gBAAgB;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,mBAAmB;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe;IACf,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAA;CACV,CAAC;AAEF,oBAAY,cAAc;IACzB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,MAAM,IAAI;CACV;AAED,qBAAa,MAAM;IAQN,QAAQ,CAAC,KAAK,EAAE,SAAS;IANrC,OAAO,CAAC,YAAY,CAAiC;IACrD,IAAI,WAAW,uBAA+B;IAE9C,OAAO,CAAC,YAAY,CAAiC;IACrD,IAAI,WAAW,uBAA+B;gBAEzB,KAAK,EAAE,SAAS;IAErC,KAAK;IAKL,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc;IAMnD,gBAAgB,CAAC,SAAS,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"merges.d.ts","sourceRoot":"","sources":["../../src/model/merges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,uBAAuB;AACvB,MAAM,MAAM,KAAK,GAAG;IACnB,gBAAgB;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,mBAAmB;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe;IACf,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAA;CACV,CAAC;AAEF,oBAAY,cAAc;IACzB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,MAAM,IAAI;CACV;AAED,qBAAa,MAAM;IAQN,QAAQ,CAAC,KAAK,EAAE,SAAS;IANrC,OAAO,CAAC,YAAY,CAAiC;IACrD,IAAI,WAAW,uBAA+B;IAE9C,OAAO,CAAC,YAAY,CAAiC;IACrD,IAAI,WAAW,uBAA+B;gBAEzB,KAAK,EAAE,SAAS;IAErC,KAAK;IAKL,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc;IAMnD,gBAAgB,CAAC,SAAS,EAAE,SAAS;IA0BrC,GAAG,CAAC,KAAK,EAAE,KAAK;IAehB,MAAM,CAAC,OAAO,EAAE,WAAW;IAsB3B,KAAK,CAAC,OAAO,EAAE,YAAY;CAwC3B"}
|
package/dist/model/merges.js
CHANGED
|
@@ -32,8 +32,7 @@ export class Merges {
|
|
|
32
32
|
const r0 = merge.r;
|
|
33
33
|
const c0 = merge.c;
|
|
34
34
|
const range = cellRange.clone();
|
|
35
|
-
|
|
36
|
-
if (!cell) {
|
|
35
|
+
if (this.model.rows.length <= r0 || this.model.columns.length <= c0) {
|
|
37
36
|
this.remove(a1);
|
|
38
37
|
return;
|
|
39
38
|
}
|
package/dist/model/merges.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merges.js","sourceRoot":"","sources":["../../src/model/merges.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,SAAS,EAAE,MAAM,WAAW,CAAC;AAcnD,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACzB,mDAAQ,CAAA;IACR,uDAAU,CAAA;IACV,uDAA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,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7D,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAClB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;IAEJ,CAAC;CAED","sourcesContent":["import { Direction } from \"@omegagrid/core\";\nimport { ShiftOptions } from \"../types\";\nimport { GridModel } from \"./gridModel\";\nimport { CellAddress, CellRange } from \"../common\";\n\n/** Merge definition */\nexport type Merge = {\n\t/** row index */\n\tr: number,\n\t/** column index */\n\tc: number,\n\t/** row span */\n\trs: number,\n\t/** column span */\n\tcs: number\n};\n\nexport enum MergeCellState {\n\tNONE = 0,\n\tMERGED = 1,\n\tHIDDEN = 2\n}\n\nexport class Merges {\n\n\tprivate _mergedCells = new Map<CellAddress, Merge>();\n\tget mergedCells() { return this._mergedCells }\n\n\tprivate _hiddenCells = new Map<CellAddress, Merge>();\n\tget hiddenCells() { return this._hiddenCells }\n\n\tconstructor(readonly model: GridModel) {}\n\n\tclear() {\n\t\tthis._mergedCells.clear();\n\t\tthis._hiddenCells.clear();\n\t}\n\n\tgetMergeState(address: CellAddress): MergeCellState {\n\t\tif (this._mergedCells.has(address)) return MergeCellState.MERGED;\n\t\tif (this._hiddenCells.has(address)) return MergeCellState.HIDDEN;\n\t\treturn MergeCellState.NONE;\n\t}\n\n\tindexMergedRange(cellRange: CellRange) {\n\t\tconst a1 = cellRange.A1;\n\t\tconst merge = this._mergedCells.get(a1);\n\t\tif (!merge) return;\n\n\t\tconst r0 = merge.r;\n\t\tconst c0 = merge.c;\n\t\tconst range = cellRange.clone();\n\n\t\tif (this.model.rows.length <= r0 || this.model.columns.length <= c0) {\n\t\t\tthis.remove(a1);\n\t\t\treturn;\n\t\t}\n\n\t\tfor (let r = 0; r < merge.rs; r++) {\n\t\t\tfor (let c = 0; c < merge.cs; c++) {\n\t\t\t\tif (r == 0 && c == 0) continue; // skip the top-left cell\n\t\t\t\trange.r1 = r0 + r;\n\t\t\t\trange.c1 = c0 + c;\n\t\t\t\trange.r2 = range.r1;\n\t\t\t\trange.c2 = range.c1;\n\t\t\t\tthis._hiddenCells.set(range.A1, merge);\n\t\t\t}\n\t\t}\n\t}\n\n\tadd(merge: Merge) {\n\t\tconst range = new CellRange(merge.c, merge.r);\n\t\tconst a1 = range.A1;\n\t\tif (this._mergedCells.has(a1)) {\n\t\t\t// replace existing merge\n\t\t\tthis.remove(a1);\n\t\t} else if (this._hiddenCells.has(a1)) {\n\t\t\t// do nothing if cell is already part of a merge range\n\t\t\treturn;\n\t\t}\n\n\t\tthis._mergedCells.set(a1, merge);\n\t\tthis.indexMergedRange(range);\n\t}\n\n\tremove(address: CellAddress) {\n\t\tconst merge = this._mergedCells.get(address);\n\t\tif (!merge) return;\n\t\tthis._mergedCells.delete(address);\n\n\t\tconst r0 = merge.r;\n\t\tconst c0 = merge.c;\n\t\tconst range = new CellRange(c0, r0);\n\n\t\tthis._hiddenCells.delete(address);\n\t\tfor (let r = 0; r < merge.rs; r++) {\n\t\t\tfor (let c = 0; c < merge.cs; c++) {\n\t\t\t\tif (r == 0 && c == 0) continue; // skip the top-left cell\n\t\t\t\trange.r1 = r0 + r;\n\t\t\t\trange.c1 = c0 + c;\n\t\t\t\trange.r2 = range.r1;\n\t\t\t\trange.c2 = range.c1;\n\t\t\t\tthis._hiddenCells.delete(range.A1);\n\t\t\t}\n\t\t}\n\t}\n\n\tshift(options: ShiftOptions) {\n\t\tconst {index, offset, direction} = options;\n\t\t\n\t\tconst update: Record<Direction, (merge: Merge) => void> = {\n\t\t\t'down': m => {\n\t\t\t\tif (index <= m.r) \n\t\t\t\t\tm.r += offset;\n\t\t\t\telse if (index > m.r && index < m.r + m.rs) // && m.r + m.rs < maxIndex)\n\t\t\t\t\tm.rs += offset;\n\t\t\t},\n\t\t\t'up': m => {\n\t\t\t\tif (index <= m.r) \n\t\t\t\t\tm.r -= offset;\n\t\t\t\telse if (index > m.r && index < m.r + m.rs) // && m.r + m.rs < maxIndex)\n\t\t\t\t\tm.rs -= offset;\n\t\t\t},\n\t\t\t'right': m => {\n\t\t\t\tif (index <= m.c) \n\t\t\t\t\tm.c += offset;\n\t\t\t\telse if (index > m.c && index < m.c + m.cs)\n\t\t\t\t\tm.cs += offset;\n\t\t\t},\n\t\t\t'left': m => {\n\t\t\t\tif (index <= m.c)\n\t\t\t\t\tm.c -= offset;\n\t\t\t\telse if (index > m.c && index < m.c + m.cs) // && m.r + m.rs < maxIndex)\n\t\t\t\t\tm.cs -= offset;\n\t\t\t}\n\t\t};\n\n\t\t\n\t\tconst merges = [...this._mergedCells.values()];\n\t\tmerges.forEach(m => this.remove(new CellRange(m.c, m.r).A1));\n\t\tmerges.forEach(m => {\n\t\t\tupdate[direction](m);\n\t\t\tthis.add(m);\n\t\t});\n\n\t}\n\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowModel.d.ts","sourceRoot":"","sources":["../../src/model/rowModel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAa,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAS,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAU7D,sCAAsC;AACtC,MAAM,MAAM,SAAS,GAAG;IACvB,CAAC,CAAC,EAAE,MA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IAAI,QAAQ,IACQ,MAAM,CADc;IACxC,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAA4B;IAEtD,IAAI,OAAO,WAAmC;IAC9C,IAAI,KAAK,cAA+D;IAExE,IAAI,UAAU,YAA6B;IAC3C,IAAI,OAAO,IACI,MAAM,CADiB;IACtC,IAAI,OAAO,CAAC,CAAC,EAAE,MAAM,EAGpB;IAED,IAAI,MAAM,cAAuE;IAEjF,iBAAiB,GAAI,GAAG,MAAM,aAAqB;IAEnD,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAI,SAAS;gBAuCpC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS;IAMhD,QAAQ,CAAC,MAAM,EAAE,SAAS;IAY1B,aAAa;IAOb,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO;IAKvB,QAAQ;IAKR,IAAI,IAAI,aAA6C;IACrD,IAAI,IAAI,aAA6C;IAErD,IAAI,WAAW,IAAK,QAAQ,CAI3B;IAED,IAAI,WAAW,IAAK,QAAQ,CAI3B;IAED;;;;OAIG;IACH,cAAc,CAAC,CAAC,EAAE,MAAM;IAKxB,WAAW,CAAC,CAAC,EAAE,MAAM;IAKrB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,UAAQ;IAqBjE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,UAAQ;IAqBjE,qBAAqB;CAIrB"}
|
package/dist/model/rowModel.js
CHANGED
|
@@ -36,8 +36,12 @@ export class RowModel extends tree.TreeNodeMixin(ElementModel) {
|
|
|
36
36
|
if (dataField != null) {
|
|
37
37
|
const d = this._data[dataField];
|
|
38
38
|
if (utils.isObject(d)) {
|
|
39
|
-
if (d.comment)
|
|
39
|
+
if (d.comment) {
|
|
40
40
|
this.model.comments.set(cell.address, [d.comment]);
|
|
41
|
+
}
|
|
42
|
+
if (d.cs > 1 || d.rs > 1) {
|
|
43
|
+
this.model.merges.add({ r: this.index, c: c, cs: d.cs || 1, rs: d.rs || 1 });
|
|
44
|
+
}
|
|
41
45
|
cell.populate(d);
|
|
42
46
|
}
|
|
43
47
|
else if (!cell.hasValue) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowModel.js","sourceRoot":"","sources":["../../src/model/rowModel.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AAkB7D,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;IAO7D,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IAGlC,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,CAA8B,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA,CAAC,CAAC;IAG3D,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAA,CAAC,CAAC;IACpE,IAAI,MAAM,CAAC,KAAa,IAAI,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA,CAAC,CAAC;IAGlD,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,CAAA,CAAC,CAAC;IACxC,IAAI,QAAQ,CAAC,KAAa,IAAI,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA,CAAC,CAAC;IAEtD,IAAI,OAAO,KAAK,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA,C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IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAClF,CAAC;CAED","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { CellRange, encodeRow } from \"../common/range\";\nimport { CellModel, CellSource } from \"./cellModel\";\nimport { GridModel } from \"./gridModel\";\nimport { tree, utils } from \"@omegagrid/core\";\nimport { ElementModel, ElementSource } from \"./elementModel\";\n\n// /** Source object type for row header item */\n// export type RowHeaderModel = {\n// \tlabel?: string;\n// \tcolspan?: number;\n// \trowspan?: number;\n// \twidth?: number;\n// };\n\n/** Source object type for grid row */\nexport type RowSource = {\n\th?: number|'auto', // height\n\tdata?: Record<string|number, any>,\n\t/** if row priority is higher then column priority, row properties has precedence over column properties */\n\tpriority?: number,\n} & tree.TreeNodeSource & ElementSource\n\nexport class RowModel extends tree.TreeNodeMixin(ElementModel) {\n\n\torigIndex: number;\n\t\n\tprivate _singleCell: CellModel;\n\n\tprivate _cells: CellModel[];\n\tget cells() { return this._cells }\n\t\n\tprivate _data: Record<string|number, any>;\n\tget data() { return this._data }\n\tset data(v : Record<string|number, any>) { this._data = v }\n\t\n\tprivate _height: number;\n\tget height() { return this._height ?? this.model.options.rowHeight }\n\tset height(value: number) { this._height = value }\n\t\n\tprivate _priority: number;\n\tget priority() { return this._priority }\n\tset priority(value: number) { this._priority = value }\n\n\tget address() { return encodeRow(this.index) }\n\tget range() { return new CellRange(null, this.index, null, this.index) }\n\n\tget hasFormula() { return !!this._formula }\n\tget formula() { return this._formula }\n\tset formula(v: string) {\n\t\tsuper.formula = v;\n\t\tthis.model.columns.forEach(col => this.cell(col.index).refreshFormula());\n\t}\n\n\tget values() { return this.model.columns.map(col => this.cell(col.index).value) }\n\n\tisCellInitialized = (c: number) => !!this.cells[c];\n\t\n\tcell(c: number, source?: CellSource) : CellModel {\n\t\tif (this.model.options.singleCellModel) {\n\t\t\tif (!this._singleCell) this._singleCell = new CellModel(this.model, {c: c, r: this.index});\n\t\t\tthis._singleCell.row = this;\n\t\t\tthis._singleCell.column = this.model.columns[c];\n\t\t\treturn this._singleCell;\n\t\t}\n\n\t\tlet cell = this._cells[c];\n\t\tif ((source || !cell) && this.model.columns[c]) {\n\t\t\tcell = new CellModel(this.model, source ?? {c: c, r: this.index});\n\t\t\tif (this._data) {\n\t\t\t\tconst dataField = this.model.columns[c].data;\n\t\t\t\tif (dataField != null) {\n\t\t\t\t\tconst d = this._data[dataField];\n\t\t\t\t\tif (utils.isObject(d)) {\n\t\t\t\t\t\tif ((d as CellSource).comment) this.model.comments.set(cell.address, [(d as CellSource).comment]);\n\t\t\t\t\t\tcell.populate(d);\n\t\t\t\t\t} else if (!cell.hasValue) {\n\t\t\t\t\t\t// keep display value from cell source - value assignment resets it\n\t\t\t\t\t\tconst dv = cell.displayValue;\n\t\t\t\t\t\tcell.value = d;\n\t\t\t\t\t\tif (dv != null) cell.displayValue = dv;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (cell.name) this.model.names.set(cell.name, cell.range);\n\t\t\tthis._cells[c] = cell;\n\t\t}\n\t\treturn cell;\n\t}\n\n\tconstructor(model: GridModel, source?: RowSource) {\n\t\tsuper(model, source);\n\t\tthis._cells = [];\n\t\tif (this._priority == null) this._priority = model.options.rowPriority;\n\t}\n\n\tpopulate(source: RowSource) {\n\t\tsuper.populate(source);\n\t\tthis._height = source.h == null || source.h == 'auto' ? this.model.options.rowHeight : source.h;\n\n\t\tif (source.data) {\n\t\t\tif (Array.isArray(source.data)) this._data = [...source.data];\n\t\t\telse this._data = {...source.data};\n\t\t}\n\n\t\tif (source.priority != null) this._priority = source.priority;\n\t}\n\n\tgetSourceData() {\n\t\tconst data = super.getSourceData() as RowSource;\n\t\t//if (this._data != null) data.data = this._data;\n\t\tif (this._height != null && this._height != this.model.options.rowHeight) data.h = this._height;\n\t\treturn data;\n\t}\n\n\texpand(unhide?: boolean) {\n\t\tsuper.expand(unhide);\n\t\tthis.model.indexVisibleRows();\n\t}\n\n\tcollapse() {\n\t\tsuper.collapse();\n\t\tthis.model.indexVisibleRows();\n\t}\n\n\tget prev() { return this.model.rows[this.index - 1] }\n\tget next() { return this.model.rows[this.index + 1] }\n\n\tget prevVisible() : RowModel {\n\t\tlet prev = this.prev;\n\t\twhile (prev && !prev.visible) prev = prev.prev;\n\t\treturn prev;\n\t}\n\n\tget nextVisible() : RowModel {\n\t\tlet next = this.next;\n\t\twhile (next && !next.visible) next = next.next;\n\t\treturn next;\n\t}\n\n\t/**\n\t * Checks if cell has formula, even for uninitialized cells\n\t * @param c number\n\t * @returns boolean\n\t */\n\thasCellFormula(c: number) {\n\t\treturn (this.cells[c] && this.cells[c].hasFormula)\n\t\t\t|| (this._data && this._data[this.model.columns[c].data] && this._data[this.model.columns[c].data].f);\n\t}\n\n\thasCellName(c: number) {\n\t\treturn (this.cells[c] && this.cells[c].name != null)\n\t\t\t|| (this._data && this._data[this.model.columns[c].data] && this._data[this.model.columns[c].data].name != null);\n\t}\n\n\tinsertColumns(index: number, count: number, shiftFormulas = false) {\n\t\tlet cell: CellModel;\n\t\tconst columns = this.model.columns.length;\n\t\tconst calculations = this.model.calculations;\n\n\t\tif (shiftFormulas) {\n\t\t\tfor (let c = 0; c < columns; c++) {\n\t\t\t\tif (this.hasCellFormula(c)) {\n\t\t\t\t\tcell = this.cell(c);\n\t\t\t\t\tcell.formula = calculations.getFormula(cell).shift({\n\t\t\t\t\t\tindex: index, \n\t\t\t\t\t\toffset: count, \n\t\t\t\t\t\tdirection: 'right'\n\t\t\t\t\t}).createFormulaString(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (index < this.cells.length) this.cells.splice(index, 0, ...Array(count).fill(null));\n\t}\n\n\tdeleteColumns(index: number, count: number, shiftFormulas = false) {\n\t\tlet cell: CellModel;\n\t\tconst columns = this.model.columns.length;\n\t\tconst calculations = this.model.calculations;\n\n\t\tif (shiftFormulas) {\n\t\t\tfor (let c = 0; c < columns; c++) {\n\t\t\t\tif (this.hasCellFormula(c)) {\n\t\t\t\t\tcell = this.cell(c);\n\t\t\t\t\tcell.formula = calculations.getFormula(cell).shift({\n\t\t\t\t\t\tindex: index, \n\t\t\t\t\t\toffset: count,\n\t\t\t\t\t\tdirection: 'left'\n\t\t\t\t\t}).createFormulaString(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index < this.cells.length ? this.cells.splice(index, count) : null;\n\t}\n\n\tclearCalculatedValues() {\n\t\tthis.cells.forEach(cell => cell && this.model.calculations.refreshFormula(cell));\n\t}\n\n}"]}
|
|
1
|
+
{"version":3,"file":"rowModel.js","sourceRoot":"","sources":["../../src/model/rowModel.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AAkB7D,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;IAO7D,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IAGlC,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAA,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,CAA8B,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA,CAAC,CAAC;IAG3D,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAA,CAAC,CAAC;IACpE,IAAI,MAAM,CAAC,KAAa,IAAI,IAAI,CAAC,OAAO,GAAG,KAAK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C,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC5B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBACpB,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;wBAClD,KAAK,EAAE,KAAK;wBACZ,MAAM,EAAE,KAAK;wBACb,SAAS,EAAE,MAAM;qBACjB,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,CAAC;IAED,qBAAqB;QACpB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAClF,CAAC;CAED","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { CellRange, encodeRow } from \"../common/range\";\nimport { CellModel, CellSource } from \"./cellModel\";\nimport { GridModel } from \"./gridModel\";\nimport { tree, utils } from \"@omegagrid/core\";\nimport { ElementModel, ElementSource } from \"./elementModel\";\n\n// /** Source object type for row header item */\n// export type RowHeaderModel = {\n// \tlabel?: string;\n// \tcolspan?: number;\n// \trowspan?: number;\n// \twidth?: number;\n// };\n\n/** Source object type for grid row */\nexport type RowSource = {\n\th?: number|'auto', // height\n\tdata?: Record<string|number, any>,\n\t/** if row priority is higher then column priority, row properties has precedence over column properties */\n\tpriority?: number,\n} & tree.TreeNodeSource & ElementSource\n\nexport class RowModel extends tree.TreeNodeMixin(ElementModel) {\n\n\torigIndex: number;\n\t\n\tprivate _singleCell: CellModel;\n\n\tprivate _cells: CellModel[];\n\tget cells() { return this._cells }\n\t\n\tprivate _data: Record<string|number, any>;\n\tget data() { return this._data }\n\tset data(v : Record<string|number, any>) { this._data = v }\n\t\n\tprivate _height: number;\n\tget height() { return this._height ?? this.model.options.rowHeight }\n\tset height(value: number) { this._height = value }\n\t\n\tprivate _priority: number;\n\tget priority() { return this._priority }\n\tset priority(value: number) { this._priority = value }\n\n\tget address() { return encodeRow(this.index) }\n\tget range() { return new CellRange(null, this.index, null, this.index) }\n\n\tget hasFormula() { return !!this._formula }\n\tget formula() { return this._formula }\n\tset formula(v: string) {\n\t\tsuper.formula = v;\n\t\tthis.model.columns.forEach(col => this.cell(col.index).refreshFormula());\n\t}\n\n\tget values() { return this.model.columns.map(col => this.cell(col.index).value) }\n\n\tisCellInitialized = (c: number) => !!this.cells[c];\n\t\n\tcell(c: number, source?: CellSource) : CellModel {\n\t\tif (this.model.options.singleCellModel) {\n\t\t\tif (!this._singleCell) this._singleCell = new CellModel(this.model, {c: c, r: this.index});\n\t\t\tthis._singleCell.row = this;\n\t\t\tthis._singleCell.column = this.model.columns[c];\n\t\t\treturn this._singleCell;\n\t\t}\n\n\t\tlet cell = this._cells[c];\n\t\tif ((source || !cell) && this.model.columns[c]) {\n\t\t\tcell = new CellModel(this.model, source ?? {c: c, r: this.index});\n\t\t\tif (this._data) {\n\t\t\t\tconst dataField = this.model.columns[c].data;\n\t\t\t\tif (dataField != null) {\n\t\t\t\t\tconst d = this._data[dataField];\n\t\t\t\t\tif (utils.isObject(d)) {\n\t\t\t\t\t\tif ((d as CellSource).comment) {\n\t\t\t\t\t\t\tthis.model.comments.set(cell.address, [(d as CellSource).comment]);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (d.cs > 1 || d.rs > 1) {\n\t\t\t\t\t\t\tthis.model.merges.add({r: this.index, c: c, cs: d.cs || 1, rs: d.rs || 1});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tcell.populate(d);\n\t\t\t\t\t} else if (!cell.hasValue) {\n\t\t\t\t\t\t// keep display value from cell source - value assignment resets it\n\t\t\t\t\t\tconst dv = cell.displayValue;\n\t\t\t\t\t\tcell.value = d;\n\t\t\t\t\t\tif (dv != null) cell.displayValue = dv;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (cell.name) this.model.names.set(cell.name, cell.range);\n\t\t\tthis._cells[c] = cell;\n\t\t}\n\t\treturn cell;\n\t}\n\n\tconstructor(model: GridModel, source?: RowSource) {\n\t\tsuper(model, source);\n\t\tthis._cells = [];\n\t\tif (this._priority == null) this._priority = model.options.rowPriority;\n\t}\n\n\tpopulate(source: RowSource) {\n\t\tsuper.populate(source);\n\t\tthis._height = source.h == null || source.h == 'auto' ? this.model.options.rowHeight : source.h;\n\n\t\tif (source.data) {\n\t\t\tif (Array.isArray(source.data)) this._data = [...source.data];\n\t\t\telse this._data = {...source.data};\n\t\t}\n\n\t\tif (source.priority != null) this._priority = source.priority;\n\t}\n\n\tgetSourceData() {\n\t\tconst data = super.getSourceData() as RowSource;\n\t\t//if (this._data != null) data.data = this._data;\n\t\tif (this._height != null && this._height != this.model.options.rowHeight) data.h = this._height;\n\t\treturn data;\n\t}\n\n\texpand(unhide?: boolean) {\n\t\tsuper.expand(unhide);\n\t\tthis.model.indexVisibleRows();\n\t}\n\n\tcollapse() {\n\t\tsuper.collapse();\n\t\tthis.model.indexVisibleRows();\n\t}\n\n\tget prev() { return this.model.rows[this.index - 1] }\n\tget next() { return this.model.rows[this.index + 1] }\n\n\tget prevVisible() : RowModel {\n\t\tlet prev = this.prev;\n\t\twhile (prev && !prev.visible) prev = prev.prev;\n\t\treturn prev;\n\t}\n\n\tget nextVisible() : RowModel {\n\t\tlet next = this.next;\n\t\twhile (next && !next.visible) next = next.next;\n\t\treturn next;\n\t}\n\n\t/**\n\t * Checks if cell has formula, even for uninitialized cells\n\t * @param c number\n\t * @returns boolean\n\t */\n\thasCellFormula(c: number) {\n\t\treturn (this.cells[c] && this.cells[c].hasFormula)\n\t\t\t|| (this._data && this._data[this.model.columns[c].data] && this._data[this.model.columns[c].data].f);\n\t}\n\n\thasCellName(c: number) {\n\t\treturn (this.cells[c] && this.cells[c].name != null)\n\t\t\t|| (this._data && this._data[this.model.columns[c].data] && this._data[this.model.columns[c].data].name != null);\n\t}\n\n\tinsertColumns(index: number, count: number, shiftFormulas = false) {\n\t\tlet cell: CellModel;\n\t\tconst columns = this.model.columns.length;\n\t\tconst calculations = this.model.calculations;\n\n\t\tif (shiftFormulas) {\n\t\t\tfor (let c = 0; c < columns; c++) {\n\t\t\t\tif (this.hasCellFormula(c)) {\n\t\t\t\t\tcell = this.cell(c);\n\t\t\t\t\tcell.formula = calculations.getFormula(cell).shift({\n\t\t\t\t\t\tindex: index, \n\t\t\t\t\t\toffset: count, \n\t\t\t\t\t\tdirection: 'right'\n\t\t\t\t\t}).createFormulaString(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (index < this.cells.length) this.cells.splice(index, 0, ...Array(count).fill(null));\n\t}\n\n\tdeleteColumns(index: number, count: number, shiftFormulas = false) {\n\t\tlet cell: CellModel;\n\t\tconst columns = this.model.columns.length;\n\t\tconst calculations = this.model.calculations;\n\n\t\tif (shiftFormulas) {\n\t\t\tfor (let c = 0; c < columns; c++) {\n\t\t\t\tif (this.hasCellFormula(c)) {\n\t\t\t\t\tcell = this.cell(c);\n\t\t\t\t\tcell.formula = calculations.getFormula(cell).shift({\n\t\t\t\t\t\tindex: index, \n\t\t\t\t\t\toffset: count,\n\t\t\t\t\t\tdirection: 'left'\n\t\t\t\t\t}).createFormulaString(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index < this.cells.length ? this.cells.splice(index, count) : null;\n\t}\n\n\tclearCalculatedValues() {\n\t\tthis.cells.forEach(cell => cell && this.model.calculations.refreshFormula(cell));\n\t}\n\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/grid-core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.77",
|
|
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.10.
|
|
32
|
-
"@omegagrid/localize": "^0.10.
|
|
31
|
+
"@omegagrid/core": "^0.10.77",
|
|
32
|
+
"@omegagrid/localize": "^0.10.77",
|
|
33
33
|
"@stdlib/stats": "^0.0.13",
|
|
34
34
|
"color": "^4.2.3",
|
|
35
35
|
"date-fns": "^3.2.0",
|