@guiexpert/vue3-table 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,747 +1,423 @@
1
- import { defineComponent, ref, onMounted, openBlock, createElementBlock } from "vue";
2
- class GeMouseEvent {
3
- constructor(rowIndex = -1, rowTop = -1, columnIndex = -1, columnLeft = -1, areaIdent, sideIdent, originalEvent, clickCount = 0, draggingX = 0, draggingY = 0, action = "") {
4
- this.rowIndex = rowIndex;
5
- this.rowTop = rowTop;
6
- this.columnIndex = columnIndex;
7
- this.columnLeft = columnLeft;
8
- this.areaIdent = areaIdent;
9
- this.sideIdent = sideIdent;
10
- this.originalEvent = originalEvent;
11
- this.clickCount = clickCount;
12
- this.draggingX = draggingX;
13
- this.draggingY = draggingY;
14
- this.action = action;
1
+ import { defineComponent as G, ref as N, onMounted as z, openBlock as j, createElementBlock as X, createVNode as K, render as k } from "vue";
2
+ class B {
3
+ constructor(e = -1, t = -1, s = -1, i = -1, o, r, l, n = 0, a = 0, d = 0, S = "") {
4
+ this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = i, this.areaIdent = o, this.sideIdent = r, this.originalEvent = l, this.clickCount = n, this.draggingX = a, this.draggingY = d, this.action = S;
15
5
  }
16
6
  clone() {
17
- return new GeMouseEvent(this.rowIndex, this.rowTop, this.columnIndex, this.columnLeft, this.areaIdent, this.sideIdent, this.originalEvent, this.clickCount, this.draggingX, this.draggingY, this.action);
7
+ return new B(
8
+ this.rowIndex,
9
+ this.rowTop,
10
+ this.columnIndex,
11
+ this.columnLeft,
12
+ this.areaIdent,
13
+ this.sideIdent,
14
+ this.originalEvent,
15
+ this.clickCount,
16
+ this.draggingX,
17
+ this.draggingY,
18
+ this.action
19
+ );
18
20
  }
19
21
  }
20
- class Icon {
21
- constructor(content = ">", style = "", classes = []) {
22
- this.content = content;
23
- this.style = style;
24
- this.classes = classes;
22
+ class I {
23
+ constructor(e = ">", t = "", s = []) {
24
+ this.content = e, this.style = t, this.classes = s;
25
25
  }
26
26
  }
27
- class TreeOptions {
28
- constructor(arrowExpanded = new Icon(">", "transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;", ["gt-table-tree-arrow-expanded"]), arrowCollapsed = new Icon(">", "", ["ge-table-tree-arrow-collapsed"]), arrowPlaceholder = new Icon(">", "color:transparent;", ["gt-table-tree-arrow-hidden"]), arrowExpandCollapseAll = new Icon("\u2195", "", ["gt-table-tree-arrow-expanded-all"])) {
29
- this.arrowExpanded = arrowExpanded;
30
- this.arrowCollapsed = arrowCollapsed;
31
- this.arrowPlaceholder = arrowPlaceholder;
32
- this.arrowExpandCollapseAll = arrowExpandCollapseAll;
27
+ class H {
28
+ constructor(e = new I(
29
+ ">",
30
+ "transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
31
+ ["gt-table-tree-arrow-expanded"]
32
+ ), t = new I(
33
+ ">",
34
+ "",
35
+ ["ge-table-tree-arrow-collapsed"]
36
+ ), s = new I(
37
+ ">",
38
+ "color:transparent;",
39
+ ["gt-table-tree-arrow-hidden"]
40
+ ), i = new I(
41
+ "↕",
42
+ "",
43
+ ["gt-table-tree-arrow-expanded-all"]
44
+ )) {
45
+ this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = s, this.arrowExpandCollapseAll = i;
33
46
  }
34
47
  }
35
- class SortedOptions {
36
- constructor(iconAsc = new Icon("\u2191", "", ["ge-header-sorted-asc"]), iconDesc = new Icon("\u2193", "", ["ge-header-sorted-desc"]), iconPlaceholder = new Icon("\u2191", "color:transparent;", [])) {
37
- this.iconAsc = iconAsc;
38
- this.iconDesc = iconDesc;
39
- this.iconPlaceholder = iconPlaceholder;
48
+ class W {
49
+ constructor(e = new I("↑", "", ["ge-header-sorted-asc"]), t = new I("↓", "", ["ge-header-sorted-desc"]), s = new I("↑", "color:transparent;", [])) {
50
+ this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
40
51
  }
41
52
  }
42
- class ConvenienceDomService {
43
- constructor(domService) {
44
- this.domService = domService;
53
+ class Y {
54
+ constructor(e) {
55
+ this.domService = e;
45
56
  }
46
- setStyle(el, style, value) {
47
- this.domService.setStyle(el, style, value);
48
- return el;
57
+ setStyle(e, t, s) {
58
+ return this.domService.setStyle(e, t, s), e;
49
59
  }
50
- applyStyle(ele, style) {
51
- for (const key in style) {
52
- this.domService.setStyle(ele, key, style[key]);
53
- }
54
- return ele;
55
- }
56
- applyDisplayNoneStyle(ele) {
57
- this.domService.setStyle(ele, "display", "none");
58
- return ele;
59
- }
60
- applyDisplayBlockStyle(ele) {
61
- this.domService.setStyle(ele, "display", "block");
62
- return ele;
63
- }
64
- applyStyleInPx(ele, geoData) {
65
- Object.entries(geoData).forEach(([key, value]) => this.domService.setStyle(ele, key, value + "px"));
66
- return ele;
67
- }
68
- applyStylePosistionRelative(ele) {
69
- this.domService.setStyle(ele, "position", "relative");
70
- this.domService.setStyle(ele, "overflow", "clip");
71
- return ele;
72
- }
73
- applyStylePosistionAbsolute(ele) {
74
- this.domService.setStyle(ele, "position", "absolute");
75
- return ele;
76
- }
77
- applyStyleFullSize(ele) {
78
- this.domService.setStyle(ele, "width", "100%");
79
- this.domService.setStyle(ele, "height", "100%");
80
- return ele;
81
- }
82
- applyStyleOverflowAuto(overflowX = "auto", overflowY = "auto", ele) {
83
- this.domService.setStyle(ele, "overflow-x", overflowX);
84
- this.domService.setStyle(ele, "overflow-y", overflowY);
85
- return ele;
86
- }
87
- applyStyleNoPadding(ele) {
88
- this.domService.setStyle(ele, "padding", "0");
89
- this.domService.setStyle(ele, "margin", "0");
90
- this.domService.setStyle(ele, "border", "0");
91
- return ele;
92
- }
93
- appendRelativeChildDiv(parent) {
94
- const child = this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));
95
- this.domService.appendChild(parent, child);
96
- this.applyStylePosistionAbsolute(parent);
97
- const cache = {};
98
- return { parent, child, cache };
99
- }
100
- appendText(parent, text) {
101
- const div = this.domService.createText(text);
102
- this.domService.appendChild(parent, div);
103
- return div;
104
- }
105
- addClass(clazz, div) {
106
- if (clazz.includes(" ")) {
107
- clazz.split(" ").forEach((c) => this.domService.addClass(div, c));
108
- } else {
109
- this.domService.addClass(div, clazz);
110
- }
111
- return div;
60
+ applyStyle(e, t) {
61
+ for (const s in t)
62
+ this.domService.setStyle(e, s, t[s]);
63
+ return e;
112
64
  }
113
- addClasses(classes, div) {
114
- if (classes) {
115
- for (const c of classes) {
116
- this.domService.addClass(div, c);
117
- }
118
- }
119
- return div;
65
+ applyDisplayNoneStyle(e) {
66
+ return this.domService.setStyle(e, "display", "none"), e;
120
67
  }
121
- setAttribute(div, key, value) {
122
- if (key && value) {
123
- this.domService.setAttribute(div, key, value);
124
- }
125
- return div;
126
- }
127
- createAreaDivWithClass(clazz, parent, areaIdent, sideIdent) {
128
- const div = this.domService.createElement("div");
129
- this.addClass(clazz, div);
130
- this.domService.setAttribute(div, "data-area", areaIdent);
131
- this.domService.setAttribute(div, "data-side", sideIdent);
132
- this.domService.appendChild(parent, div);
133
- return div;
134
- }
135
- createDivWithClass(clazz, parent) {
136
- const div = this.domService.createElement("div");
137
- this.addClass(clazz, div);
138
- this.domService.appendChild(parent, div);
139
- return div;
140
- }
141
- addRowDiv(divScope, geo, rowIndex = -1, areaIdent, sideIdent, text = "") {
142
- var _a, _b;
143
- const cacheKey = (_a = geo.index) !== null && _a !== void 0 ? _a : -1;
144
- const div = this.getDivOrCreateDiv(cacheKey, divScope);
145
- this.domService.addClass(div, "ge-table-row-div");
146
- this.domService.addClass(div, `ge-table-row-div-${geo.index}`);
147
- if (areaIdent === "body" && sideIdent === "center") {
148
- const oddEven = ((_b = geo === null || geo === void 0 ? void 0 : geo.index) !== null && _b !== void 0 ? _b : 0) % 2 === 0 ? "even" : "odd";
149
- this.domService.addClass(div, `ge-table-row-${oddEven}`);
150
- }
151
- this.domService.setStyle(div, "display", "clip");
152
- this.domService.setStyle(div, "position", "absolute");
153
- this.domService.setStyle(div, "left", `${geo.left}px`);
154
- this.domService.setStyle(div, "top", `${geo.top}px`);
155
- this.domService.setStyle(div, "width", `${geo.width}px`);
156
- this.domService.setStyle(div, "height", `${geo.height}px`);
157
- this.domService.setAttribute(div, "data-row-index", `${rowIndex}`);
158
- this.domService.setAttribute(div, "data-area", `${areaIdent}`);
159
- if (text) {
160
- const textElement = this.domService.createText(text);
161
- this.domService.appendChild(div, textElement);
162
- }
163
- this.domService.appendChild(divScope.child, div);
164
- return div;
165
- }
166
- addColumnDiv(parent, geo, rowIndex = -1, columnIndex = -1, areaIdent, sideIdent, text = "", treeArrow, tableOptions, checkedType = void 0, sortState) {
167
- var _a;
168
- const treeOptions = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.treeOptions;
169
- const checkboxWithoutExtraColumn = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.showCheckboxWihoutExtraColumn;
170
- const div = this.domService.createElement("div");
171
- this.domService.addClass(div, "ge-table-col-div");
172
- this.domService.addClass(div, `ge-table-col-div-${geo.index}`);
173
- this.domService.setAttribute(div, "data-col-index", `${geo.index}`);
174
- this.domService.setAttribute(div, "data-row-index", `${rowIndex}`);
175
- this.domService.setAttribute(div, "data-area", `${areaIdent}`);
176
- const oddEven = ((_a = geo === null || geo === void 0 ? void 0 : geo.index) !== null && _a !== void 0 ? _a : 0) % 2 === 0 ? "even" : "odd";
177
- if (areaIdent === "body" && sideIdent === "center") {
178
- this.domService.addClass(div, `ge-table-column-${oddEven}`);
179
- }
180
- this.domService.setStyle(div, "display", "clip");
181
- this.domService.setStyle(div, "position", "absolute");
182
- this.domService.setStyle(div, "left", `${geo.left}px`);
183
- this.domService.setStyle(div, "top", `${geo.top}px`);
184
- this.domService.setStyle(div, "width", `${geo.width}px`);
185
- this.domService.setStyle(div, "height", `${geo.height}px`);
186
- if (treeArrow && treeArrow !== "none") {
187
- this.domService.addClass(div, "ge-table-col-tree");
188
- this.addArrowDiv(div, treeArrow, treeOptions, rowIndex, columnIndex, areaIdent);
189
- }
190
- if (checkboxWithoutExtraColumn && columnIndex === 0 && checkedType) {
191
- this.addCheckboxToDiv(div, checkedType, areaIdent, rowIndex);
68
+ applyDisplayBlockStyle(e) {
69
+ return this.domService.setStyle(e, "display", "block"), e;
70
+ }
71
+ applyStyleInPx(e, t) {
72
+ return Object.entries(t).forEach(([s, i]) => this.domService.setStyle(e, s, i + "px")), e;
73
+ }
74
+ applyStylePosistionRelative(e) {
75
+ return this.domService.setStyle(e, "position", "relative"), this.domService.setStyle(e, "overflow", "clip"), e;
76
+ }
77
+ applyStylePosistionAbsolute(e) {
78
+ return this.domService.setStyle(e, "position", "absolute"), e;
79
+ }
80
+ applyStyleFullSize(e) {
81
+ return this.domService.setStyle(e, "width", "100%"), this.domService.setStyle(e, "height", "100%"), e;
82
+ }
83
+ applyStyleOverflowAuto(e = "auto", t = "auto", s) {
84
+ return this.domService.setStyle(s, "overflow-x", e), this.domService.setStyle(s, "overflow-y", t), s;
85
+ }
86
+ applyStyleNoPadding(e) {
87
+ return this.domService.setStyle(e, "padding", "0"), this.domService.setStyle(e, "margin", "0"), this.domService.setStyle(e, "border", "0"), e;
88
+ }
89
+ appendRelativeChildDiv(e) {
90
+ const t = this.applyStylePosistionRelative(
91
+ this.applyStyleFullSize(
92
+ this.applyStyleNoPadding(
93
+ this.domService.createElement("div")
94
+ )
95
+ )
96
+ );
97
+ return this.domService.appendChild(e, t), this.applyStylePosistionAbsolute(e), { parent: e, child: t, cache: {} };
98
+ }
99
+ appendText(e, t) {
100
+ const s = this.domService.createText(t);
101
+ return this.domService.appendChild(e, s), s;
102
+ }
103
+ addClass(e, t) {
104
+ return e.includes(" ") ? e.split(" ").forEach((s) => this.domService.addClass(t, s)) : this.domService.addClass(t, e), t;
105
+ }
106
+ addClasses(e, t) {
107
+ if (e)
108
+ for (const s of e)
109
+ this.domService.addClass(t, s);
110
+ return t;
111
+ }
112
+ setAttribute(e, t, s) {
113
+ return t && s && this.domService.setAttribute(e, t, s), e;
114
+ }
115
+ createAreaDivWithClass(e, t, s, i) {
116
+ const o = this.domService.createElement("div");
117
+ return this.addClass(e, o), this.domService.setAttribute(o, "data-area", s), this.domService.setAttribute(o, "data-side", i), this.domService.appendChild(t, o), o;
118
+ }
119
+ createDivWithClass(e, t) {
120
+ const s = this.domService.createElement("div");
121
+ return this.addClass(e, s), this.domService.appendChild(t, s), s;
122
+ }
123
+ addRowDiv(e, t, s = -1, i, o, r = "") {
124
+ const l = t.index ?? -1, n = this.getDivOrCreateDiv(l, e);
125
+ if (this.domService.addClass(n, "ge-table-row-div"), this.domService.addClass(n, `ge-table-row-div-${t.index}`), i === "body" && o === "center") {
126
+ const a = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
127
+ this.domService.addClass(n, `ge-table-row-${a}`);
192
128
  }
193
- if (text) {
194
- const firstTreeColumn = treeArrow !== "none" && columnIndex === 0;
195
- this.addLabelDiv(div, text, firstTreeColumn, rowIndex, columnIndex, areaIdent);
129
+ if (this.domService.setStyle(n, "display", "clip"), this.domService.setStyle(n, "position", "absolute"), this.domService.setStyle(n, "left", `${t.left}px`), this.domService.setStyle(n, "top", `${t.top}px`), this.domService.setStyle(n, "width", `${t.width}px`), this.domService.setStyle(n, "height", `${t.height}px`), this.domService.setAttribute(n, "data-row-index", `${s}`), this.domService.setAttribute(n, "data-area", `${i}`), r) {
130
+ const a = this.domService.createText(r);
131
+ this.domService.appendChild(n, a);
196
132
  }
197
- if (sortState) {
198
- this.addSortedIcon(div, sortState, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.sortedOptions, columnIndex);
133
+ return this.domService.appendChild(e.child, n), n;
134
+ }
135
+ addColumnDiv(e, t, s = -1, i = -1, o, r, l = "", n, a, d = void 0, S) {
136
+ const g = a == null ? void 0 : a.treeOptions, f = a == null ? void 0 : a.showCheckboxWihoutExtraColumn, c = this.domService.createElement("div");
137
+ this.domService.addClass(c, "ge-table-col-div"), this.domService.addClass(c, `ge-table-col-div-${t.index}`), this.domService.setAttribute(c, "data-col-index", `${t.index}`), this.domService.setAttribute(c, "data-row-index", `${s}`), this.domService.setAttribute(c, "data-area", `${o}`);
138
+ const b = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
139
+ if (o === "body" && r === "center" && this.domService.addClass(c, `ge-table-column-${b}`), this.domService.setStyle(c, "display", "clip"), this.domService.setStyle(c, "position", "absolute"), this.domService.setStyle(c, "left", `${t.left}px`), this.domService.setStyle(c, "top", `${t.top}px`), this.domService.setStyle(c, "width", `${t.width}px`), this.domService.setStyle(c, "height", `${t.height}px`), n && n !== "none" && (this.domService.addClass(c, "ge-table-col-tree"), this.addArrowDiv(c, n, g, s, i, o)), f && i === 0 && d && this.addCheckboxToDiv(c, d, o, s), l) {
140
+ const p = n !== "none" && i === 0;
141
+ this.addLabelDiv(c, l, p, s, i, o);
199
142
  }
200
- this.domService.appendChild(parent, div);
201
- return div;
143
+ return S && this.addSortedIcon(c, S, a == null ? void 0 : a.sortedOptions, i), this.domService.appendChild(e, c), c;
202
144
  }
203
- addCheckboxToDiv(parent, checkedType, areaIdent, rowIndex) {
204
- const div = this.domService.createElement("div");
205
- const checked = checkedType === "full" ? "checked" : "";
206
- div.innerHTML = `
145
+ addCheckboxToDiv(e, t, s, i) {
146
+ const o = this.domService.createElement("div"), r = t === "full" ? "checked" : "";
147
+ return o.innerHTML = `
207
148
  <input
208
149
  type="checkbox"
209
- data-area="${areaIdent}"
210
- data-row-index="${rowIndex}"
150
+ data-area="${s}"
151
+ data-row-index="${i}"
211
152
  data-input-type="checkbox"
212
- ${checked}
213
- class="ge-table-row-checkbox"> `;
214
- this.domService.setStyle(div, "display", "inline");
215
- this.domService.setStyle(div, "width", "inherit");
216
- this.domService.setAttribute(div, "data-row-index", `${rowIndex}`);
217
- this.domService.appendChild(parent, div);
218
- return div;
219
- }
220
- addLabelDiv(parent, text = "", firstTreeColumn = false, rowIndex = -1, columnIndex = -1, areaIdent = "body") {
221
- const div = this.domService.createElement("div");
222
- this.domService.addClass(div, "ge-table-label-div");
223
- this.domService.setStyle(div, "position", "relative");
224
- this.domService.setStyle(div, "background", "transparent");
225
- this.domService.setStyle(div, "width", "100%");
226
- this.domService.setStyle(div, "height", "100%");
227
- this.domService.setAttribute(div, "data-row-index", `${rowIndex}`);
228
- this.domService.setAttribute(div, "data-col-index", `${columnIndex}`);
229
- this.domService.setAttribute(div, "data-area", `${areaIdent}`);
230
- if (text) {
231
- if (firstTreeColumn) {
232
- const textElement = this.domService.createText(text);
233
- this.domService.appendChild(div, textElement);
153
+ ${r}
154
+ class="ge-table-row-checkbox"> `, this.domService.setStyle(o, "display", "inline"), this.domService.setStyle(o, "width", "inherit"), this.domService.setAttribute(o, "data-row-index", `${i}`), this.domService.appendChild(e, o), o;
155
+ }
156
+ addLabelDiv(e, t = "", s = !1, i = -1, o = -1, r = "body") {
157
+ const l = this.domService.createElement("div");
158
+ if (this.domService.addClass(l, "ge-table-label-div"), this.domService.setStyle(l, "position", "relative"), this.domService.setStyle(l, "background", "transparent"), this.domService.setStyle(l, "width", "100%"), this.domService.setStyle(l, "height", "100%"), this.domService.setAttribute(l, "data-row-index", `${i}`), this.domService.setAttribute(l, "data-col-index", `${o}`), this.domService.setAttribute(l, "data-area", `${r}`), t)
159
+ if (s) {
160
+ const n = this.domService.createText(t);
161
+ this.domService.appendChild(l, n);
234
162
  } else {
235
- const div2 = this.domService.createElement("div");
236
- this.domService.appendChild(div, div2);
237
- const textElement = this.domService.createText(text);
238
- this.domService.addClass(div2, "ge-table-label");
239
- this.domService.appendChild(div2, textElement);
240
- this.domService.setAttribute(div2, "data-row-index", `${rowIndex}`);
241
- this.domService.setAttribute(div2, "data-col-index", `${columnIndex}`);
242
- this.domService.setAttribute(div2, "data-area", `${areaIdent}`);
243
- }
244
- }
245
- this.domService.appendChild(parent, div);
246
- return div;
247
- }
248
- addSortedIcon(parent, sorted = "", sortedOptions = new SortedOptions(), columnIndex = -1) {
249
- const div = this.domService.createElement("div");
250
- this.domService.addClass(div, "ge-table-sorted-icon-div");
251
- this.domService.setStyle(div, "position", "absolute");
252
- this.domService.setStyle(div, "top", "0");
253
- this.domService.setStyle(div, "right", "0");
254
- this.domService.setStyle(div, "width", "20px");
255
- this.domService.setStyle(div, "background", "transparent");
256
- this.domService.setStyle(div, "cursor", "pointer");
257
- this.domService.setAttribute(div, "data-col-index", `${columnIndex}`);
258
- this.domService.setAttribute(div, "data-area", "header");
259
- let treeOptionsArrow;
260
- if (sorted === "asc") {
261
- treeOptionsArrow = sortedOptions.iconAsc;
262
- } else if (sorted === "desc") {
263
- treeOptionsArrow = sortedOptions.iconDesc;
264
- } else {
265
- treeOptionsArrow = sortedOptions.iconPlaceholder;
266
- }
267
- const content = treeOptionsArrow.content;
268
- const textElement = this.domService.createText(content);
269
- this.domService.appendChild(div, textElement);
270
- if (treeOptionsArrow.style) {
271
- this.applyStyleString(div, treeOptionsArrow.style);
272
- }
273
- for (const clazz of treeOptionsArrow.classes) {
274
- this.domService.addClass(div, clazz);
275
- }
276
- this.domService.appendChild(parent, div);
277
- return div;
278
- }
279
- addArrowDiv(parent, arrow = "none", treeOptions = new TreeOptions(), rowIndex = -1, columnIndex = -1, areaIdent = "body") {
280
- const div = this.domService.createElement("div");
281
- this.domService.addClass(div, "ge-table-tree-arrow-div");
282
- this.domService.setStyle(div, "display", "inline-block");
283
- this.domService.setStyle(div, "position", "");
284
- this.domService.setStyle(div, "width", "20px");
285
- this.domService.setStyle(div, "background", "transparent");
286
- this.domService.setStyle(div, "cursor", "pointer");
287
- this.domService.setAttribute(div, "data-row-index", `${rowIndex}`);
288
- this.domService.setAttribute(div, "data-col-index", `${columnIndex}`);
289
- this.domService.setAttribute(div, "data-area", `${areaIdent}`);
290
- let treeOptionsArrow;
291
- if (arrow === "expanded") {
292
- treeOptionsArrow = treeOptions.arrowExpanded;
293
- } else if (arrow === "collapsed") {
294
- treeOptionsArrow = treeOptions.arrowCollapsed;
295
- } else {
296
- treeOptionsArrow = treeOptions.arrowPlaceholder;
297
- }
298
- const content = treeOptionsArrow.content;
299
- const textElement = this.domService.createText(content);
300
- this.domService.appendChild(div, textElement);
301
- if (treeOptionsArrow.style) {
302
- this.applyStyleString(div, treeOptionsArrow.style);
303
- }
304
- for (const clazz of treeOptionsArrow.classes) {
305
- this.domService.addClass(div, clazz);
306
- }
307
- this.domService.appendChild(parent, div);
308
- return div;
309
- }
310
- addColumnBorderDivs(tableOptions, parent, geo, areaIdent, sideIdent) {
311
- if (tableOptions.verticalBorderVisible) {
312
- const clazz = `ge-table-${areaIdent}-${sideIdent}-vertical-border`;
313
- this.addVerticalBorder(geo, parent, clazz);
314
- }
315
- if (tableOptions.horizontalBorderVisible) {
316
- const clazz = `ge-table-${areaIdent}-${sideIdent}-horizontal-border`;
317
- this.addHorizontalBorder(geo, parent, clazz);
318
- }
319
- return parent;
320
- }
321
- addHorizontalBorder(geo, parent, clazz = "ge-table-body-center-horizontal-border") {
322
- const div = this.domService.createElement("div");
323
- this.domService.addClass(div, clazz);
324
- this.domService.setStyle(div, "display", "clip");
325
- this.domService.setStyle(div, "position", "absolute");
326
- this.domService.setStyle(div, "left", `${geo.left}px`);
327
- this.domService.setStyle(div, "top", `${geo.top}px`);
328
- this.domService.setStyle(div, "width", `${geo.width}px`);
329
- this.domService.setStyle(div, "height", `1px`);
330
- this.domService.appendChild(parent, div);
331
- return div;
332
- }
333
- addFocusBorderDivs(parent, geo, style) {
334
- let div = this.domService.createElement("div");
335
- this.domService.addClass(div, "ge-table-focus-border");
336
- this.domService.setStyle(div, "display", "clip");
337
- this.domService.setStyle(div, "position", "absolute");
338
- this.domService.setStyle(div, "left", `${geo.left}px`);
339
- this.domService.setStyle(div, "top", `${geo.top}px`);
340
- this.domService.setStyle(div, "width", `1px`);
341
- this.domService.setStyle(div, "height", `${geo.height}px`);
342
- this.applyStyle(div, style);
343
- this.domService.appendChild(parent, div);
344
- div = this.domService.createElement("div");
345
- this.domService.addClass(div, "ge-table-focus-border");
346
- this.domService.setStyle(div, "display", "clip");
347
- this.domService.setStyle(div, "position", "absolute");
348
- this.domService.setStyle(div, "left", `${geo.left + geo.width - 1}px`);
349
- this.domService.setStyle(div, "top", `${geo.top}px`);
350
- this.domService.setStyle(div, "width", `1px`);
351
- this.domService.setStyle(div, "height", `${geo.height}px`);
352
- this.applyStyle(div, style);
353
- this.domService.appendChild(parent, div);
354
- div = this.domService.createElement("div");
355
- this.domService.addClass(div, "ge-table-focus-border");
356
- this.domService.setStyle(div, "display", "clip");
357
- this.domService.setStyle(div, "position", "absolute");
358
- this.domService.setStyle(div, "left", `${geo.left}px`);
359
- this.domService.setStyle(div, "top", `${geo.top}px`);
360
- this.domService.setStyle(div, "width", `${geo.width}px`);
361
- this.domService.setStyle(div, "height", `1px`);
362
- this.applyStyle(div, style);
363
- this.domService.appendChild(parent, div);
364
- div = this.domService.createElement("div");
365
- this.domService.addClass(div, "ge-table-focus-border");
366
- this.domService.setStyle(div, "display", "clip");
367
- this.domService.setStyle(div, "position", "absolute");
368
- this.domService.setStyle(div, "left", `${geo.left}px`);
369
- this.domService.setStyle(div, "top", `${geo.top + geo.height - 1}px`);
370
- this.domService.setStyle(div, "width", `${geo.width}px`);
371
- this.domService.setStyle(div, "height", `1px`);
372
- this.applyStyle(div, style);
373
- this.domService.appendChild(parent, div);
374
- return parent;
375
- }
376
- addVerticalBorder(geo, parent, clazz = "ge-table-body-center-vertical-border") {
377
- const div = this.domService.createElement("div");
378
- this.domService.addClass(div, clazz);
379
- this.domService.setStyle(div, "display", "clip");
380
- this.domService.setStyle(div, "position", "absolute");
381
- this.domService.setStyle(div, "left", `${geo.left}px`);
382
- this.domService.setStyle(div, "top", `${geo.top}px`);
383
- this.domService.setStyle(div, "width", `1px`);
384
- this.domService.setStyle(div, "height", `${geo.height}px`);
385
- this.domService.appendChild(parent, div);
386
- return div;
387
- }
388
- addDiv(parent, geo, clazz = "") {
389
- const div = this.domService.createElement("div");
390
- if (clazz) {
391
- this.domService.addClass(div, clazz);
392
- }
393
- this.domService.setStyle(div, "display", "clip");
394
- this.domService.setStyle(div, "position", "absolute");
395
- this.domService.setStyle(div, "left", `${geo.left}px`);
396
- this.domService.setStyle(div, "top", `${geo.top}px`);
397
- this.domService.setStyle(div, "width", `${geo.width}px`);
398
- this.domService.setStyle(div, "height", `${geo.height}px`);
399
- this.domService.appendChild(parent, div);
400
- return div;
401
- }
402
- applyStyleString(div, style) {
403
- const cmds = style.split(";").map((s) => s.trim()).filter((s) => s);
404
- for (const cmd of cmds) {
405
- const [key, value] = cmd.split(":");
406
- this.domService.setStyle(div, key.trim(), value.trim());
407
- }
408
- }
409
- getDivOrCreateDiv(cacheKey, divScope) {
410
- let div = divScope.cache[cacheKey];
411
- if (div) {
412
- div.innerText = "";
413
- return div;
414
- }
415
- div = this.domService.createElement("div");
416
- divScope.cache[cacheKey] = div;
417
- return div;
163
+ const n = this.domService.createElement("div");
164
+ this.domService.appendChild(l, n);
165
+ const a = this.domService.createText(t);
166
+ this.domService.addClass(n, "ge-table-label"), this.domService.appendChild(n, a), this.domService.setAttribute(n, "data-row-index", `${i}`), this.domService.setAttribute(n, "data-col-index", `${o}`), this.domService.setAttribute(n, "data-area", `${r}`);
167
+ }
168
+ return this.domService.appendChild(e, l), l;
169
+ }
170
+ addSortedIcon(e, t = "", s = new W(), i = -1) {
171
+ const o = this.domService.createElement("div");
172
+ this.domService.addClass(o, "ge-table-sorted-icon-div"), this.domService.setStyle(o, "position", "absolute"), this.domService.setStyle(o, "top", "0"), this.domService.setStyle(o, "right", "0"), this.domService.setStyle(o, "width", "20px"), this.domService.setStyle(o, "background", "transparent"), this.domService.setStyle(o, "cursor", "pointer"), this.domService.setAttribute(o, "data-col-index", `${i}`), this.domService.setAttribute(o, "data-area", "header");
173
+ let r;
174
+ t === "asc" ? r = s.iconAsc : t === "desc" ? r = s.iconDesc : r = s.iconPlaceholder;
175
+ const l = r.content, n = this.domService.createText(l);
176
+ this.domService.appendChild(o, n), r.style && this.applyStyleString(o, r.style);
177
+ for (const a of r.classes)
178
+ this.domService.addClass(o, a);
179
+ return this.domService.appendChild(e, o), o;
180
+ }
181
+ addArrowDiv(e, t = "none", s = new H(), i = -1, o = -1, r = "body") {
182
+ const l = this.domService.createElement("div");
183
+ this.domService.addClass(l, "ge-table-tree-arrow-div"), this.domService.setStyle(l, "display", "inline-block"), this.domService.setStyle(l, "position", ""), this.domService.setStyle(l, "width", "20px"), this.domService.setStyle(l, "background", "transparent"), this.domService.setStyle(l, "cursor", "pointer"), this.domService.setAttribute(l, "data-row-index", `${i}`), this.domService.setAttribute(l, "data-col-index", `${o}`), this.domService.setAttribute(l, "data-area", `${r}`);
184
+ let n;
185
+ t === "expanded" ? n = s.arrowExpanded : t === "collapsed" ? n = s.arrowCollapsed : n = s.arrowPlaceholder;
186
+ const a = n.content, d = this.domService.createText(a);
187
+ this.domService.appendChild(l, d), n.style && this.applyStyleString(l, n.style);
188
+ for (const S of n.classes)
189
+ this.domService.addClass(l, S);
190
+ return this.domService.appendChild(e, l), l;
191
+ }
192
+ addColumnBorderDivs(e, t, s, i, o) {
193
+ if (e.verticalBorderVisible) {
194
+ const r = `ge-table-${i}-${o}-vertical-border`;
195
+ this.addVerticalBorder(s, t, r);
196
+ }
197
+ if (e.horizontalBorderVisible) {
198
+ const r = `ge-table-${i}-${o}-horizontal-border`;
199
+ this.addHorizontalBorder(s, t, r);
200
+ }
201
+ return t;
202
+ }
203
+ addHorizontalBorder(e, t, s = "ge-table-body-center-horizontal-border") {
204
+ const i = this.domService.createElement("div");
205
+ return this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${e.left}px`), this.domService.setStyle(i, "top", `${e.top}px`), this.domService.setStyle(i, "width", `${e.width}px`), this.domService.setStyle(i, "height", "1px"), this.domService.appendChild(t, i), i;
206
+ }
207
+ addFocusBorderDivs(e, t, s) {
208
+ let i = this.domService.createElement("div");
209
+ return this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${t.height}px`), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left + t.width - 1}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${t.height}px`), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", "1px"), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top + t.height - 1}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", "1px"), this.applyStyle(i, s), this.domService.appendChild(e, i), e;
210
+ }
211
+ addVerticalBorder(e, t, s = "ge-table-body-center-vertical-border") {
212
+ const i = this.domService.createElement("div");
213
+ return this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${e.left}px`), this.domService.setStyle(i, "top", `${e.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${e.height}px`), this.domService.appendChild(t, i), i;
214
+ }
215
+ addDiv(e, t, s = "") {
216
+ const i = this.domService.createElement("div");
217
+ return s && this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", `${t.height}px`), this.domService.appendChild(e, i), i;
218
+ }
219
+ applyStyleString(e, t) {
220
+ const s = t.split(";").map((i) => i.trim()).filter((i) => i);
221
+ for (const i of s) {
222
+ const [o, r] = i.split(":");
223
+ this.domService.setStyle(e, o.trim(), r.trim());
224
+ }
225
+ }
226
+ getDivOrCreateDiv(e, t) {
227
+ let s = t.cache[e];
228
+ return s ? (s.innerText = "", s) : (s = this.domService.createElement("div"), t.cache[e] = s, s);
418
229
  }
419
230
  }
420
- class TreeRow {
421
- constructor(data, expanded = true, children, parent, deep = 0, checked = false, keep = false) {
422
- this.data = data;
423
- this.expanded = expanded;
424
- this.children = children;
425
- this.parent = parent;
426
- this.deep = deep;
427
- this.checked = checked;
428
- this.keep = keep;
231
+ class O {
232
+ constructor(e, t = !0, s, i, o = 0, r = !1, l = !1) {
233
+ this.data = e, this.expanded = t, this.children = s, this.parent = i, this.deep = o, this.checked = r, this.keep = l;
429
234
  }
430
235
  }
431
- const getAreaIdentByString = (s) => {
432
- if (s === "header") {
433
- return "header";
434
- }
435
- if (s === "footer") {
436
- return "footer";
437
- }
438
- return "body";
439
- };
440
- class MouseTargetData {
441
- constructor(eventTarget, tableScope) {
442
- this.rowIdx = -1;
443
- this.colIdx = -1;
444
- this.action = null;
445
- this.inputType = null;
446
- this.className = "";
447
- if (eventTarget === null)
448
- return;
449
- if (eventTarget instanceof HTMLDivElement || eventTarget instanceof HTMLSpanElement || eventTarget instanceof HTMLInputElement) {
450
- this.className = eventTarget.className;
451
- this.action = eventTarget.getAttribute("data-ge-action");
452
- this.inputType = eventTarget.getAttribute("data-input-type");
453
- this.rowIdx = Number(eventTarget.getAttribute("data-row-index"));
454
- this.colIdx = Number(eventTarget.getAttribute("data-col-index"));
455
- const area = eventTarget.getAttribute("data-area");
456
- if (area) {
457
- this.areaIdent = getAreaIdentByString(area);
458
- this.areaModel = tableScope.tableModel.getAreaModel(this.areaIdent);
459
- this.row = this.areaModel.getRowByIndex(this.rowIdx);
460
- }
461
- if (eventTarget instanceof HTMLInputElement) {
462
- const target = eventTarget;
463
- this.value = target.value;
236
+ const $ = (h) => h === "header" ? "header" : h === "footer" ? "footer" : "body";
237
+ class q {
238
+ constructor(e, t) {
239
+ if (this.rowIdx = -1, this.colIdx = -1, this.action = null, this.inputType = null, this.className = "", e !== null && (e instanceof HTMLDivElement || e instanceof HTMLSpanElement || e instanceof HTMLInputElement)) {
240
+ this.className = e.className, this.action = e.getAttribute("data-ge-action"), this.inputType = e.getAttribute("data-input-type"), this.rowIdx = Number(e.getAttribute("data-row-index")), this.colIdx = Number(e.getAttribute("data-col-index"));
241
+ const s = e.getAttribute("data-area");
242
+ if (s && (this.areaIdent = $(s), this.areaModel = t.tableModel.getAreaModel(this.areaIdent), this.row = this.areaModel.getRowByIndex(this.rowIdx)), e instanceof HTMLInputElement) {
243
+ const i = e;
244
+ this.value = i.value;
464
245
  }
465
246
  }
466
247
  }
467
248
  }
468
- class MouseHandler {
469
- constructor(tableScope) {
470
- this.tableScope = tableScope;
471
- this.expandedAll = true;
472
- this.mouseDown = false;
473
- this.dragging = false;
474
- this.tableScope.hostElement.addEventListener("click", this.onHostElementClicked.bind(this));
475
- this.tableScope.hostElement.addEventListener("dblclick", this.onHostElementDblClicked.bind(this));
476
- this.tableScope.hostElement.addEventListener("mousedown", this.onMouseDown.bind(this));
477
- this.tableScope.hostElement.addEventListener("mousemove", this.onMouseMove.bind(this));
478
- this.tableScope.hostElement.addEventListener("mouseup", this.onMouseUp.bind(this));
479
- this.tableScope.hostElement.addEventListener("contextmenu", this.onContextmenu.bind(this));
480
- this.tableScope.hostElement["_MouseHandler"] = "true";
481
- this.tableScope.scrollViewport.addEventListener("scroll", this.tableScope.adjustAfterScrolling.bind(this.tableScope));
482
- [window, this.tableScope.hostElement].forEach((ele) => ele.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope)));
483
- }
484
- onContextmenu(evt) {
485
- this.mouseEvent = evt;
486
- const mouseMoveEvent = this.tableScope.createGeMouseEvent(this.mouseEvent);
487
- this.tableScope.contextmenu(mouseMoveEvent);
488
- }
489
- onHostElementClicked(event) {
490
- const mouseTargetData = new MouseTargetData(event.target, this.tableScope);
491
- if (mouseTargetData.action === "toggleExpandCollapseAll") {
492
- this.expandedAll = !this.expandedAll;
493
- this.tableScope.toggleExpandCollapseAll(this.expandedAll);
494
- event.preventDefault();
495
- event.stopPropagation();
496
- } else if (mouseTargetData.inputType === "checkbox" && mouseTargetData.areaIdent) {
497
- this.tableScope.toggleRowCheckbox(mouseTargetData.rowIdx, mouseTargetData.colIdx, mouseTargetData.areaIdent);
498
- event.preventDefault();
499
- event.stopPropagation();
500
- } else if (mouseTargetData.row instanceof TreeRow && mouseTargetData.areaModel) {
501
- const altClickOnFirstCol = mouseTargetData.colIdx === this.getArrowColumnIndex() && event.altKey;
502
- const clickOnArrow = mouseTargetData.className.includes("ge-table-tree-arrow-div");
503
- console.info(clickOnArrow, altClickOnFirstCol);
504
- if (altClickOnFirstCol || clickOnArrow) {
505
- event.preventDefault();
506
- event.stopPropagation();
507
- const tr = mouseTargetData.row;
508
- tr.expanded = !tr.expanded;
509
- if ("recalcVisibleTreeRows" in mouseTargetData.areaModel) {
510
- mouseTargetData.areaModel.recalcVisibleTreeRows();
249
+ class U {
250
+ constructor(e) {
251
+ this.tableScope = e, this.expandedAll = !0, this.mouseDown = !1, this.dragging = !1, this.tableScope.hostElement.addEventListener("click", this.onHostElementClicked.bind(this)), this.tableScope.hostElement.addEventListener("dblclick", this.onHostElementDblClicked.bind(this)), this.tableScope.hostElement.addEventListener("mousedown", this.onMouseDown.bind(this)), this.tableScope.hostElement.addEventListener("mousemove", this.onMouseMove.bind(this)), this.tableScope.hostElement.addEventListener("mouseup", this.onMouseUp.bind(this)), this.tableScope.hostElement.addEventListener("contextmenu", this.onContextmenu.bind(this)), this.tableScope.hostElement._MouseHandler = "true", this.tableScope.scrollViewport.addEventListener("scroll", this.tableScope.adjustAfterScrolling.bind(this.tableScope)), [window, this.tableScope.hostElement].forEach(
252
+ (t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
253
+ );
254
+ }
255
+ onContextmenu(e) {
256
+ this.mouseEvent = e;
257
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
258
+ this.tableScope.contextmenu(t);
259
+ }
260
+ onHostElementClicked(e) {
261
+ const t = new q(e.target, this.tableScope);
262
+ if (t.action === "toggleExpandCollapseAll")
263
+ this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
264
+ else if (t.inputType === "checkbox" && t.areaIdent)
265
+ this.tableScope.toggleRowCheckbox(t.rowIdx, t.colIdx, t.areaIdent), e.preventDefault(), e.stopPropagation();
266
+ else if (t.row instanceof O && t.areaModel) {
267
+ const s = t.colIdx === this.getArrowColumnIndex() && e.altKey, i = t.className.includes("ge-table-tree-arrow-div");
268
+ if (console.info(i, s), s || i) {
269
+ e.preventDefault(), e.stopPropagation();
270
+ const o = t.row;
271
+ o.expanded = !o.expanded, "recalcVisibleTreeRows" in t.areaModel && t.areaModel.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(o);
272
+ }
273
+ }
274
+ if (t.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
275
+ const s = this.tableScope.tableOptions.getFocusModel();
276
+ s == null || s.clear(), s == null || s.setFocus(t.rowIdx, t.colIdx);
277
+ }
278
+ this.publishGeMouseEvent(e, 1);
279
+ }
280
+ onHostElementDblClicked(e) {
281
+ if (e.target instanceof HTMLElement) {
282
+ const t = e.target, s = t.getAttribute("data-area"), i = $(s), o = Number(t.getAttribute("data-row-index")), r = Number(t.getAttribute("data-col-index")), l = this.tableScope.tableModel.getAreaModel(i);
283
+ if (s && i === "header")
284
+ this.tableScope.tableModel.isSortable(r) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, o, r));
285
+ else if (t.getAttribute("data-row-index")) {
286
+ const n = l.getRowByIndex(o);
287
+ if (s && i === "body" && l.isEditable(o, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(o, r)), n instanceof O && r === this.getArrowColumnIndex()) {
288
+ e.preventDefault(), e.stopPropagation();
289
+ const a = n;
290
+ a.expanded = !a.expanded, "recalcVisibleTreeRows" in l && l.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(a);
511
291
  }
512
- this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth);
513
- this.tableScope.adjustContainersAndRows();
514
- this.updateCollapsedExpandedState(tr);
515
292
  }
516
293
  }
517
- if (mouseTargetData.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
518
- const fm = this.tableScope.tableOptions.getFocusModel();
519
- fm === null || fm === void 0 ? void 0 : fm.clear();
520
- fm === null || fm === void 0 ? void 0 : fm.setFocus(mouseTargetData.rowIdx, mouseTargetData.colIdx);
521
- }
522
- this.publishGeMouseEvent(event, 1);
523
- }
524
- onHostElementDblClicked(event) {
525
- if (event.target instanceof HTMLElement) {
526
- const target = event.target;
527
- const area = target.getAttribute("data-area");
528
- const areaIdent = getAreaIdentByString(area);
529
- const rowIdx = Number(target.getAttribute("data-row-index"));
530
- const colIdx = Number(target.getAttribute("data-col-index"));
531
- const areaModel = this.tableScope.tableModel.getAreaModel(areaIdent);
532
- if (area && areaIdent === "header") {
533
- if (this.tableScope.tableModel.isSortable(colIdx)) {
534
- this.tableScope.clearSelection();
535
- this.tableScope.onHeaderDblClicked(event, rowIdx, colIdx);
536
- }
537
- } else if (target.getAttribute("data-row-index")) {
538
- const row = areaModel.getRowByIndex(rowIdx);
539
- if (area && areaIdent === "body") {
540
- if (areaModel.isEditable(rowIdx, colIdx)) {
541
- this.tableScope.clearSelection();
542
- this.tableScope.initRenderEditor(rowIdx, colIdx);
543
- }
544
- }
545
- if (row instanceof TreeRow) {
546
- if (colIdx === this.getArrowColumnIndex()) {
547
- event.preventDefault();
548
- event.stopPropagation();
549
- const tr = row;
550
- tr.expanded = !tr.expanded;
551
- if ("recalcVisibleTreeRows" in areaModel) {
552
- areaModel.recalcVisibleTreeRows();
553
- }
554
- this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth);
555
- this.tableScope.adjustContainersAndRows();
556
- this.updateCollapsedExpandedState(tr);
557
- }
558
- }
559
- }
560
- }
561
- this.publishGeMouseEvent(event, 2);
562
- }
563
- publishGeMouseEvent(event, clickCount) {
564
- var _a;
565
- this.mouseEvent = event;
566
- this.geMouseEventOld = (_a = this.geMouseEvent) === null || _a === void 0 ? void 0 : _a.clone();
567
- this.geMouseEvent = this.tableScope.createGeMouseEvent(event);
568
- if (this.geMouseEvent) {
569
- this.geMouseEvent.clickCount = clickCount;
570
- }
571
- this.tableScope.onMouseClicked(this.geMouseEvent, this.geMouseEventOld);
572
- }
573
- updateCollapsedExpandedState(tr) {
574
- var _a, _b, _c, _d, _e;
575
- const getRowId = (_b = (_a = this.tableScope.tableOptions) === null || _a === void 0 ? void 0 : _a.autoRestoreOptions) === null || _b === void 0 ? void 0 : _b.getRowId;
576
- if (getRowId) {
577
- const mode = (_c = this.tableScope.storeStateCollapsedExpandService) === null || _c === void 0 ? void 0 : _c.collapsedExpandedStateGet().mode;
578
- const push = mode === "collapsed" && !tr.expanded || mode === "expanded" && tr.expanded;
579
- const remove = mode === "collapsed" && tr.expanded || mode === "expanded" && !tr.expanded;
580
- const rowId = getRowId(tr.data);
581
- if (push) {
582
- (_d = this.tableScope.storeStateCollapsedExpandService) === null || _d === void 0 ? void 0 : _d.collapsedStateIdsPush(rowId);
583
- } else if (remove) {
584
- (_e = this.tableScope.storeStateCollapsedExpandService) === null || _e === void 0 ? void 0 : _e.collapsedStateIdsRemove(rowId);
585
- }
294
+ this.publishGeMouseEvent(e, 2);
295
+ }
296
+ publishGeMouseEvent(e, t) {
297
+ var s;
298
+ this.mouseEvent = e, this.geMouseEventOld = (s = this.geMouseEvent) == null ? void 0 : s.clone(), this.geMouseEvent = this.tableScope.createGeMouseEvent(e), this.geMouseEvent && (this.geMouseEvent.clickCount = t), this.tableScope.onMouseClicked(this.geMouseEvent, this.geMouseEventOld);
299
+ }
300
+ updateCollapsedExpandedState(e) {
301
+ var s, i, o, r, l;
302
+ const t = (i = (s = this.tableScope.tableOptions) == null ? void 0 : s.autoRestoreOptions) == null ? void 0 : i.getRowId;
303
+ if (t) {
304
+ const n = (o = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : o.collapsedExpandedStateGet().mode, a = n === "collapsed" && !e.expanded || n === "expanded" && e.expanded, d = n === "collapsed" && e.expanded || n === "expanded" && !e.expanded, S = t(e.data);
305
+ a ? (r = this.tableScope.storeStateCollapsedExpandService) == null || r.collapsedStateIdsPush(S) : d && ((l = this.tableScope.storeStateCollapsedExpandService) == null || l.collapsedStateIdsRemove(S));
586
306
  }
587
307
  }
588
308
  getArrowColumnIndex() {
589
- const rowCheckboxVisible = this.tableScope.tableModel.isRowCheckboxVisible();
590
- return rowCheckboxVisible ? 1 : 0;
591
- }
592
- onMouseDown(evt) {
593
- this.mouseEvent = evt;
594
- this.startMouseEvent = this.tableScope.createGeMouseEvent(this.mouseEvent);
595
- this.tableScope.onMouseDown(this.startMouseEvent);
596
- this.mouseDown = true;
597
- }
598
- onMouseMove(evt) {
599
- this.mouseEvent = evt;
600
- if (this.mouseDown) {
601
- this.dragging = true;
602
- requestAnimationFrame(this.mouseDraggingOnFrame.bind(this));
603
- } else {
604
- requestAnimationFrame(this.mouseMoveOnFrame.bind(this));
605
- }
309
+ return this.tableScope.tableModel.isRowCheckboxVisible() ? 1 : 0;
606
310
  }
607
- onMouseUp(evt) {
608
- this.mouseEvent = evt;
609
- if (this.dragging) {
610
- requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this));
611
- }
612
- this.mouseDown = false;
613
- this.dragging = false;
311
+ onMouseDown(e) {
312
+ this.mouseEvent = e, this.startMouseEvent = this.tableScope.createGeMouseEvent(this.mouseEvent), this.tableScope.onMouseDown(this.startMouseEvent), this.mouseDown = !0;
313
+ }
314
+ onMouseMove(e) {
315
+ this.mouseEvent = e, this.mouseDown ? (this.dragging = !0, requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))) : requestAnimationFrame(this.mouseMoveOnFrame.bind(this));
316
+ }
317
+ onMouseUp(e) {
318
+ this.mouseEvent = e, this.dragging && requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)), this.mouseDown = !1, this.dragging = !1;
614
319
  }
615
320
  mouseDraggingOnFrame() {
616
- var _a;
321
+ var e;
617
322
  if (this.mouseEvent) {
618
- const mouseEvent = this.tableScope.createGeMouseEvent(this.mouseEvent);
619
- if ((_a = this.startMouseEvent) === null || _a === void 0 ? void 0 : _a.originalEvent) {
620
- mouseEvent.draggingX = this.mouseEvent.clientX - this.startMouseEvent.originalEvent.clientX;
621
- mouseEvent.draggingY = this.mouseEvent.clientY - this.startMouseEvent.originalEvent.clientY;
622
- }
623
- this.tableScope.mouseDraggingOnFrame(mouseEvent);
323
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
324
+ (e = this.startMouseEvent) != null && e.originalEvent && (t.draggingX = this.mouseEvent.clientX - this.startMouseEvent.originalEvent.clientX, t.draggingY = this.mouseEvent.clientY - this.startMouseEvent.originalEvent.clientY), this.tableScope.mouseDraggingOnFrame(t);
624
325
  }
625
326
  }
626
327
  mouseDraggingEndOnFrame() {
627
- var _a;
328
+ var e;
628
329
  if (this.mouseEvent) {
629
- const mouseEvent = this.tableScope.createGeMouseEvent(this.mouseEvent);
630
- if ((_a = this.startMouseEvent) === null || _a === void 0 ? void 0 : _a.originalEvent) {
631
- mouseEvent.draggingX = this.mouseEvent.clientX - this.startMouseEvent.originalEvent.clientX;
632
- mouseEvent.draggingY = this.mouseEvent.clientY - this.startMouseEvent.originalEvent.clientY;
633
- }
634
- this.tableScope.mouseDraggingEndOnFrame(mouseEvent);
330
+ const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
331
+ (e = this.startMouseEvent) != null && e.originalEvent && (t.draggingX = this.mouseEvent.clientX - this.startMouseEvent.originalEvent.clientX, t.draggingY = this.mouseEvent.clientY - this.startMouseEvent.originalEvent.clientY), this.tableScope.mouseDraggingEndOnFrame(t);
635
332
  }
636
333
  }
637
334
  mouseMoveOnFrame() {
638
335
  if (this.mouseEvent) {
639
- const mouseMoveEvent = this.tableScope.createGeMouseEvent(this.mouseEvent);
640
- this.tableScope.mouseMove(mouseMoveEvent);
336
+ const e = this.tableScope.createGeMouseEvent(this.mouseEvent);
337
+ this.tableScope.mouseMove(e);
641
338
  }
642
339
  }
643
340
  }
644
- class TableApi {
645
- constructor(tableScope) {
646
- this.tableScope = tableScope;
341
+ class J {
342
+ constructor(e) {
343
+ this.tableScope = e;
647
344
  }
648
- updateCells(events) {
649
- this.tableScope.updateCells(events);
345
+ updateCells(e) {
346
+ this.tableScope.updateCells(e);
650
347
  }
651
348
  externalFilterChanged() {
652
349
  this.tableScope.externalFilterChanged();
653
350
  }
654
- scrollToPixel(_px = 0, _py = 0) {
351
+ scrollToPixel(e = 0, t = 0) {
655
352
  }
656
- scrollToIndex(_indexX = 0, _indexY = 0) {
353
+ scrollToIndex(e = 0, t = 0) {
657
354
  }
658
- setHeaderVisible(_visible = true) {
355
+ setHeaderVisible(e = !0) {
659
356
  }
660
- setColumnVisible(_column, _visible = true) {
357
+ setColumnVisible(e, t = !0) {
661
358
  }
662
- isColumnVisible(_column) {
663
- return true;
359
+ isColumnVisible(e) {
360
+ return !0;
664
361
  }
665
362
  isHeaderVisible() {
666
- return true;
363
+ return !0;
667
364
  }
668
- setFooterVisible(_visible = true) {
365
+ setFooterVisible(e = !0) {
669
366
  }
670
367
  isFooterVisible() {
671
- return true;
368
+ return !0;
672
369
  }
673
370
  repaint() {
674
371
  this.tableScope.repaint();
675
372
  }
676
373
  }
677
- class TreeRowService {
678
- flattenTree(rows, ret = []) {
679
- var _a;
680
- for (const row of rows) {
681
- if (this.isVisible(row)) {
682
- ret.push(row);
683
- }
684
- if ((_a = row.children) === null || _a === void 0 ? void 0 : _a.length) {
685
- this.flattenTree(row.children, ret);
686
- }
687
- }
688
- return ret;
374
+ class Q {
375
+ flattenTree(e, t = []) {
376
+ var s;
377
+ for (const i of e)
378
+ this.isVisible(i) && t.push(i), (s = i.children) != null && s.length && this.flattenTree(i.children, t);
379
+ return t;
689
380
  }
690
- isVisible(row) {
691
- if (!row.parent) {
692
- return true;
693
- }
694
- if (!row.parent.expanded) {
695
- return false;
696
- }
697
- return this.isVisible(row.parent);
381
+ isVisible(e) {
382
+ return e.parent ? e.parent.expanded ? this.isVisible(e.parent) : !1 : !0;
698
383
  }
699
384
  }
700
- class AbstractAreaModel {
701
- constructor(areaIdent, columnDefs = [], defaultRowHeight = -1) {
702
- this.areaIdent = areaIdent;
703
- this.columnDefs = columnDefs;
704
- this.defaultRowHeight = defaultRowHeight;
705
- this.rowSelectionModel = void 0;
706
- this.yPositions = [];
707
- this.cellRenderers = columnDefs.map((def) => def.rendererMap[areaIdent]);
708
- }
709
- getTooltipAt(_rowIndex, _columnIndex) {
385
+ class Z {
386
+ constructor(e, t = [], s = -1) {
387
+ this.areaIdent = e, this.columnDefs = t, this.defaultRowHeight = s, this.rowSelectionModel = void 0, this.yPositions = [], this.cellRenderers = t.map((i) => i.rendererMap[e]);
388
+ }
389
+ getTooltipAt(e, t) {
710
390
  return "";
711
391
  }
712
- getCellRenderer(_rowIndex, columnIndex) {
713
- if (columnIndex < this.cellRenderers.length) {
714
- return this.cellRenderers[columnIndex];
715
- }
716
- return void 0;
392
+ getCellRenderer(e, t) {
393
+ if (t < this.cellRenderers.length)
394
+ return this.cellRenderers[t];
717
395
  }
718
- getColspanAt(_rowIndex, _columnIndex) {
396
+ getColspanAt(e, t) {
719
397
  return 0;
720
398
  }
721
- getCustomClassesAt(_rowIndex, _columnIndex) {
399
+ getCustomClassesAt(e, t) {
722
400
  return [];
723
401
  }
724
- getCustomStyleAt(_rowIndex, _columnIndex) {
725
- return void 0;
402
+ getCustomStyleAt(e, t) {
726
403
  }
727
- getRowspanAt(_rowIndex, _columnIndex) {
404
+ getRowspanAt(e, t) {
728
405
  return 0;
729
406
  }
730
- getRowByIndex(_rowIndex) {
731
- return void 0;
407
+ getRowByIndex(e) {
732
408
  }
733
- isRowCheckable(_rowIndex) {
734
- return true;
409
+ isRowCheckable(e) {
410
+ return !0;
735
411
  }
736
- isRowChecked(rowIndex) {
737
- var _a;
738
- const row = this.getRowByIndex(rowIndex);
739
- return (_a = this.rowSelectionModel) === null || _a === void 0 ? void 0 : _a.isRowChecked(row);
412
+ isRowChecked(e) {
413
+ var s;
414
+ const t = this.getRowByIndex(e);
415
+ return (s = this.rowSelectionModel) == null ? void 0 : s.isRowChecked(t);
740
416
  }
741
- setRowChecked(rowIndex, checked) {
417
+ setRowChecked(e, t) {
742
418
  if (this.rowSelectionModel) {
743
- const row = this.getRowByIndex(rowIndex);
744
- this.rowSelectionModel.checkRow(row, checked);
419
+ const s = this.getRowByIndex(e);
420
+ this.rowSelectionModel.checkRow(s, t);
745
421
  }
746
422
  }
747
423
  getMaxColspan() {
@@ -750,120 +426,77 @@ class AbstractAreaModel {
750
426
  getMaxRowspan() {
751
427
  return 31;
752
428
  }
753
- getYPosByRowIndex(rowIndex) {
754
- if (this.defaultRowHeight > 0) {
755
- return this.defaultRowHeight * rowIndex;
756
- }
757
- return this.yPositions[rowIndex];
429
+ getYPosByRowIndex(e) {
430
+ return this.defaultRowHeight > 0 ? this.defaultRowHeight * e : this.yPositions[e];
758
431
  }
759
432
  init() {
760
- if (!this.yPositions.length && this.getRowCount() !== void 0) {
761
- if (this.defaultRowHeight === -1) {
762
- this.calcYPositions();
763
- }
764
- }
433
+ !this.yPositions.length && this.getRowCount() !== void 0 && this.defaultRowHeight === -1 && this.calcYPositions();
765
434
  }
766
435
  isFilterable() {
767
436
  return this.areaIdent === "body";
768
437
  }
769
- doSort(_sortItems) {
770
- return false;
438
+ doSort(e) {
439
+ return !1;
771
440
  }
772
- isEditable(_rowIndex, columnIndex) {
773
- if (this.columnDefs && columnIndex < this.columnDefs.length && this.columnDefs[columnIndex].editable) {
774
- return this.columnDefs[columnIndex].editable();
775
- }
776
- return false;
441
+ isEditable(e, t) {
442
+ return this.columnDefs && t < this.columnDefs.length && this.columnDefs[t].editable ? this.columnDefs[t].editable() : !1;
777
443
  }
778
- setValue(rowIndex, columnIndex, value) {
779
- var _a;
780
- const editInputPipe = (_a = this.columnDefs[columnIndex]) === null || _a === void 0 ? void 0 : _a.editInputPipe;
781
- if (editInputPipe) {
782
- value = editInputPipe(value, rowIndex, columnIndex);
783
- }
784
- const row = this.getRowByIndex(rowIndex);
785
- const property = this.columnDefs[columnIndex].property;
786
- if (property.includes(".")) {
787
- return this.setPropertyValue(row, property.split("."), value);
788
- }
789
- row[property] = value;
790
- return true;
444
+ setValue(e, t, s) {
445
+ var l;
446
+ const i = (l = this.columnDefs[t]) == null ? void 0 : l.editInputPipe;
447
+ i && (s = i(s, e, t));
448
+ const o = this.getRowByIndex(e), r = this.columnDefs[t].property;
449
+ return r.includes(".") ? this.setPropertyValue(o, r.split("."), s) : (o[r] = s, !0);
791
450
  }
792
- isSelectable(_rowIndex, _columnIndex) {
793
- return true;
451
+ isSelectable(e, t) {
452
+ return !0;
794
453
  }
795
- changeColumnOrder(sourceColumnIndex, targetColumnIndex) {
796
- this.arrayMove(this.cellRenderers, sourceColumnIndex, targetColumnIndex);
454
+ changeColumnOrder(e, t) {
455
+ this.arrayMove(this.cellRenderers, e, t);
797
456
  }
798
- setPropertyValue(o, props, value) {
799
- const prop = props.shift();
800
- if (prop) {
801
- let o2 = o[prop];
802
- if (o2 && props.length) {
803
- return this.setPropertyValue(o2, props, value);
804
- } else {
805
- o[prop] = value;
806
- return true;
807
- }
457
+ setPropertyValue(e, t, s) {
458
+ const i = t.shift();
459
+ if (i) {
460
+ let o = e[i];
461
+ return o && t.length ? this.setPropertyValue(o, t, s) : (e[i] = s, !0);
808
462
  }
809
- return false;
463
+ return !1;
810
464
  }
811
- arrayMove(arr, fromIndex, toIndex) {
812
- const element = arr.splice(fromIndex, 1)[0];
813
- arr.splice(toIndex, 0, element);
814
- return arr;
465
+ arrayMove(e, t, s) {
466
+ const i = e.splice(t, 1)[0];
467
+ return e.splice(s, 0, i), e;
815
468
  }
816
469
  calcYPositions() {
817
- const rowCount = this.getRowCount();
818
- this.yPositions = new Array(rowCount + 1);
819
- this.yPositions[0] = 0;
820
- for (let i = 0; i < rowCount; i++) {
821
- this.yPositions[i + 1] = this.getRowHeight(i) + this.yPositions[i];
822
- }
470
+ const e = this.getRowCount();
471
+ this.yPositions = new Array(e + 1), this.yPositions[0] = 0;
472
+ for (let t = 0; t < e; t++)
473
+ this.yPositions[t + 1] = this.getRowHeight(t) + this.yPositions[t];
823
474
  }
824
475
  }
825
- class SorterService {
826
- genericSortComparator(va, vb, f) {
827
- if (typeof va === "number" && typeof vb === "number") {
828
- return f * (va - vb);
829
- }
830
- if (typeof va === "string" && typeof vb === "string") {
831
- return f * va.localeCompare(vb);
832
- }
833
- if (typeof va === "boolean" && typeof vb === "boolean") {
834
- const a = va ? -1 : 1;
835
- const b = vb ? -1 : 1;
836
- return f * (a - b);
837
- }
838
- if (va instanceof Date && vb instanceof Date) {
839
- return f * (va.getTime() - vb.getTime());
840
- }
841
- if (va instanceof Array && vb instanceof Array) {
842
- const arr1 = va;
843
- const arr2 = vb;
844
- if (arr1.length && arr2.length) {
845
- return this.genericSortComparator(arr1[0], arr2[0], f);
846
- }
847
- }
848
- return f * ("" + va).localeCompare("" + vb);
476
+ class ee {
477
+ genericSortComparator(e, t, s) {
478
+ if (typeof e == "number" && typeof t == "number")
479
+ return s * (e - t);
480
+ if (typeof e == "string" && typeof t == "string")
481
+ return s * e.localeCompare(t);
482
+ if (typeof e == "boolean" && typeof t == "boolean")
483
+ return s * ((e ? -1 : 1) - (t ? -1 : 1));
484
+ if (e instanceof Date && t instanceof Date)
485
+ return s * (e.getTime() - t.getTime());
486
+ if (e instanceof Array && t instanceof Array) {
487
+ const i = e, o = t;
488
+ if (i.length && o.length)
489
+ return this.genericSortComparator(i[0], o[0], s);
490
+ }
491
+ return s * ("" + e).localeCompare("" + t);
849
492
  }
850
493
  }
851
- class AreaModelTree extends AbstractAreaModel {
852
- constructor(areaIdent, rows, defaultRowHeight, columnDefs = []) {
853
- super(areaIdent, columnDefs, defaultRowHeight);
854
- this.areaIdent = areaIdent;
855
- this.rows = rows;
856
- this.defaultRowHeight = defaultRowHeight;
857
- this.columnDefs = columnDefs;
858
- this.sorterService = new SorterService();
859
- this.service = new TreeRowService();
860
- this.properties = columnDefs.map((def) => def.property);
861
- this.flattenRows = this.service.flattenTree(rows);
862
- this.filteredFlattenRows = [...this.flattenRows];
863
- }
864
- changeColumnOrder(sourceColumnIndex, targetColumnIndex) {
865
- this.arrayMove(this.properties, sourceColumnIndex, targetColumnIndex);
866
- super.changeColumnOrder(sourceColumnIndex, targetColumnIndex);
494
+ class L extends Z {
495
+ constructor(e, t, s, i = []) {
496
+ super(e, i, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = i, this.sorterService = new ee(), this.service = new Q(), this.properties = i.map((o) => o.property), this.flattenRows = this.service.flattenTree(t), this.filteredFlattenRows = [...this.flattenRows];
497
+ }
498
+ changeColumnOrder(e, t) {
499
+ this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
867
500
  }
868
501
  recalcVisibleTreeRows() {
869
502
  this.filteredFlattenRows = this.service.flattenTree(this.rows);
@@ -872,270 +505,225 @@ class AreaModelTree extends AbstractAreaModel {
872
505
  return this.filteredFlattenRows;
873
506
  }
874
507
  getRowCount() {
875
- let n = 0;
876
- for (const r of this.filteredFlattenRows) {
877
- if (this.service.isVisible(r)) {
878
- n++;
879
- }
880
- }
881
- return n;
882
- }
883
- getValueAt(rowIndex, columnIndex) {
884
- const row = this.getRowByIndex(rowIndex);
885
- if (row) {
886
- const prop = this.properties[columnIndex];
887
- if (prop) {
888
- if (prop.includes(".")) {
889
- return this.getPropertyValue(row.data, prop.split("."));
890
- }
891
- return row.data[prop];
892
- }
508
+ let e = 0;
509
+ for (const t of this.filteredFlattenRows)
510
+ this.service.isVisible(t) && e++;
511
+ return e;
512
+ }
513
+ getValueAt(e, t) {
514
+ const s = this.getRowByIndex(e);
515
+ if (s) {
516
+ const i = this.properties[t];
517
+ if (i)
518
+ return i.includes(".") ? this.getPropertyValue(s.data, i.split(".")) : s.data[i];
893
519
  }
894
520
  return "";
895
521
  }
896
- getRowHeight(_rowIndex) {
522
+ getRowHeight(e) {
897
523
  return this.defaultRowHeight;
898
524
  }
899
- getCustomClassesAt(rowIndex, _columnIndex) {
900
- const row = this.filteredFlattenRows[rowIndex];
901
- return ["ge-table-tree-cell", "ge-table-tree-deep-" + row.deep];
525
+ getCustomClassesAt(e, t) {
526
+ return ["ge-table-tree-cell", "ge-table-tree-deep-" + this.filteredFlattenRows[e].deep];
902
527
  }
903
- getRowByIndex(idx) {
904
- return this.filteredFlattenRows[idx];
528
+ getRowByIndex(e) {
529
+ return this.filteredFlattenRows[e];
905
530
  }
906
- getValueByT(t, property) {
907
- if (property.includes(".")) {
908
- return this.getPropertyValue(t, property.split("."));
909
- }
910
- return t[property];
911
- }
912
- externalFilterChanged(predictFn) {
913
- this.lastPredictFn = predictFn;
914
- this.doFiltering();
915
- }
916
- doSort(sortItems) {
917
- const { columnIndex, sortState } = sortItems[sortItems.length - 1];
918
- const f = sortState === "asc" ? 1 : sortState === "desc" ? -1 : 0;
919
- const property = this.properties[columnIndex];
920
- this.treeSort(this.rows, property, f);
921
- this.flattenRows = this.service.flattenTree(this.rows);
922
- this.filteredFlattenRows = [...this.flattenRows];
923
- return true;
924
- }
925
- toggleExpandCollapseAll(expanded) {
926
- this.expandAllRecursive(this.rows, expanded);
927
- this.flattenRows = this.service.flattenTree(this.rows);
928
- this.doFiltering();
929
- }
930
- setAllParentsOk(item) {
931
- if (item.parent) {
932
- item.parent.keep = true;
933
- this.setAllParentsOk(item.parent);
934
- }
935
- return false;
531
+ getValueByT(e, t) {
532
+ return t.includes(".") ? this.getPropertyValue(e, t.split(".")) : e[t];
936
533
  }
937
- setValue(rowIndex, columnIndex, value) {
938
- var _a;
939
- const editInputPipe = (_a = this.columnDefs[columnIndex]) === null || _a === void 0 ? void 0 : _a.editInputPipe;
940
- if (editInputPipe) {
941
- value = editInputPipe(value, rowIndex, columnIndex);
942
- }
943
- const treeRow = this.getRowByIndex(rowIndex);
944
- if (treeRow) {
945
- const row = treeRow.data;
946
- const property = this.columnDefs[columnIndex].property;
947
- if (property.includes(".")) {
948
- return this.setPropertyValue(row, property.split("."), value);
949
- }
950
- row[property] = value;
951
- return true;
534
+ externalFilterChanged(e) {
535
+ this.lastPredictFn = e, this.doFiltering();
536
+ }
537
+ doSort(e) {
538
+ const { columnIndex: t, sortState: s } = e[e.length - 1], i = s === "asc" ? 1 : s === "desc" ? -1 : 0, o = this.properties[t];
539
+ return this.treeSort(this.rows, o, i), this.flattenRows = this.service.flattenTree(this.rows), this.filteredFlattenRows = [...this.flattenRows], !0;
540
+ }
541
+ toggleExpandCollapseAll(e) {
542
+ this.expandAllRecursive(this.rows, e), this.flattenRows = this.service.flattenTree(this.rows), this.doFiltering();
543
+ }
544
+ setAllParentsOk(e) {
545
+ return e.parent && (e.parent.keep = !0, this.setAllParentsOk(e.parent)), !1;
546
+ }
547
+ setValue(e, t, s) {
548
+ var r;
549
+ const i = (r = this.columnDefs[t]) == null ? void 0 : r.editInputPipe;
550
+ i && (s = i(s, e, t));
551
+ const o = this.getRowByIndex(e);
552
+ if (o) {
553
+ const l = o.data, n = this.columnDefs[t].property;
554
+ return n.includes(".") ? this.setPropertyValue(l, n.split("."), s) : (l[n] = s, !0);
952
555
  }
953
- return false;
556
+ return !1;
954
557
  }
955
- genericTreeTableSortComparator(property, f) {
956
- return (a, b) => {
957
- const va = this.getValueByT(a.data, property);
958
- const vb = this.getValueByT(b.data, property);
959
- return this.sorterService.genericSortComparator(va, vb, f);
558
+ genericTreeTableSortComparator(e, t) {
559
+ return (s, i) => {
560
+ const o = this.getValueByT(s.data, e), r = this.getValueByT(i.data, e);
561
+ return this.sorterService.genericSortComparator(o, r, t);
960
562
  };
961
563
  }
962
- expandAllRecursive(arr, expanded) {
963
- for (const row of arr) {
964
- row.expanded = expanded;
965
- if (row.children) {
966
- this.expandAllRecursive(row.children, expanded);
967
- }
968
- }
564
+ expandAllRecursive(e, t) {
565
+ for (const s of e)
566
+ s.expanded = t, s.children && this.expandAllRecursive(s.children, t);
969
567
  }
970
568
  doFiltering() {
971
- if (!this.lastPredictFn) {
569
+ if (!this.lastPredictFn)
972
570
  this.filteredFlattenRows = [...this.flattenRows ? this.flattenRows : []];
973
- } else {
974
- if (!this.flattenRows) {
975
- this.flattenRows = [];
976
- }
977
- let maxDeep = 0;
978
- this.flattenRows.forEach((v) => {
979
- maxDeep = Math.max(maxDeep, v.deep);
980
- });
981
- const okRows = this.flattenRows.filter((value, index, array) => {
982
- return this.lastPredictFn(value, index, array);
983
- });
984
- this.flattenRows.forEach((v) => v.keep = false);
985
- this.flattenRows.forEach((v) => {
986
- if (okRows.includes(v)) {
987
- v.keep = true;
988
- this.setAllParentsOk(v);
989
- }
571
+ else {
572
+ this.flattenRows || (this.flattenRows = []);
573
+ let e = 0;
574
+ this.flattenRows.forEach((s) => {
575
+ e = Math.max(e, s.deep);
990
576
  });
991
- this.filteredFlattenRows = this.flattenRows.filter((value, _index, _array) => {
992
- return value.keep;
993
- });
994
- }
995
- }
996
- getPropertyValue(o, props) {
997
- const prop = props.shift();
998
- let o2 = o[prop];
999
- if (o2 && props.length) {
1000
- return this.getPropertyValue(o2, props);
1001
- }
1002
- return o2;
1003
- }
1004
- treeSort(rows, property, f) {
1005
- rows.sort(this.genericTreeTableSortComparator(property, f));
1006
- for (const row of rows) {
1007
- if (row.children) {
1008
- this.treeSort(row.children, property, f);
1009
- }
1010
- }
577
+ const t = this.flattenRows.filter(
578
+ (s, i, o) => this.lastPredictFn(s, i, o)
579
+ );
580
+ this.flattenRows.forEach((s) => s.keep = !1), this.flattenRows.forEach((s) => {
581
+ t.includes(s) && (s.keep = !0, this.setAllParentsOk(s));
582
+ }), this.filteredFlattenRows = this.flattenRows.filter(
583
+ (s, i, o) => s.keep
584
+ );
585
+ }
586
+ }
587
+ getPropertyValue(e, t) {
588
+ const s = t.shift();
589
+ let i = e[s];
590
+ return i && t.length ? this.getPropertyValue(i, t) : i;
591
+ }
592
+ treeSort(e, t, s) {
593
+ e.sort(this.genericTreeTableSortComparator(t, s));
594
+ for (const i of e)
595
+ i.children && this.treeSort(i.children, t, s);
1011
596
  }
1012
597
  }
1013
- class AbstractStoreStateService {
1014
- constructor(fn) {
1015
- this.getStorageKeyFn = fn;
1016
- }
1017
- autoConvertMapToObject(item) {
1018
- const obj = {};
1019
- if (item instanceof Map) {
1020
- const map = item;
1021
- for (const item2 of [...map]) {
1022
- const [key, value] = item2;
1023
- obj[key] = value;
1024
- }
1025
- }
1026
- return obj;
1027
- }
1028
- checkAndPersistItem(keySuffix, item) {
1029
- const fn = this.getStorageKeyFn;
1030
- if (fn) {
1031
- const key = fn();
1032
- if (key) {
1033
- const subKey = key + keySuffix;
1034
- if ((item + "").includes("Map")) {
1035
- const obj = this.autoConvertMapToObject(item);
1036
- this.persistItem(subKey, obj);
1037
- } else {
1038
- this.persistItem(subKey, item);
1039
- }
1040
- }
1041
- }
1042
- }
1043
- persistItem(subKey, item) {
1044
- if (item) {
1045
- localStorage.setItem(subKey, JSON.stringify(item));
1046
- } else {
1047
- localStorage.removeItem(subKey);
1048
- }
1049
- }
1050
- loadFromLocalStorage(subKey) {
1051
- const item = localStorage.getItem(subKey);
1052
- if (item) {
1053
- return JSON.parse(item);
1054
- }
1055
- return null;
1056
- }
598
+ class P {
599
+ constructor(e) {
600
+ this.getStorageKeyFn = e;
601
+ }
602
+ autoConvertMapToObject(e) {
603
+ const t = {};
604
+ if (e instanceof Map) {
605
+ const s = e;
606
+ for (const i of [...s]) {
607
+ const [
608
+ o,
609
+ r
610
+ ] = i;
611
+ t[o] = r;
612
+ }
613
+ }
614
+ return t;
615
+ }
616
+ checkAndPersistItem(e, t) {
617
+ const s = this.getStorageKeyFn;
618
+ if (s) {
619
+ const i = s();
620
+ if (i) {
621
+ const o = i + e;
622
+ if ((t + "").includes("Map")) {
623
+ const r = this.autoConvertMapToObject(t);
624
+ this.persistItem(o, r);
625
+ } else
626
+ this.persistItem(o, t);
627
+ }
628
+ }
629
+ }
630
+ persistItem(e, t) {
631
+ t ? localStorage.setItem(e, JSON.stringify(t)) : localStorage.removeItem(e);
632
+ }
633
+ loadFromLocalStorage(e) {
634
+ const t = localStorage.getItem(e);
635
+ return t ? JSON.parse(t) : null;
636
+ }
637
+ // private loadItems() {
638
+ // const fn = this.getStorageKeyFn;
639
+ // if (fn) {
640
+ // const key = fn();
641
+ // if (key) {
642
+ // // A main key is given by function from options
643
+ // const subKey = key + this.CHECKED_STATE;
644
+ // const arr = this.loadFromLocalStorage<Array<string | number>>(subKey);
645
+ // if (arr) {
646
+ // this.checkedStateIds.length = 0;
647
+ // arr.forEach(a => this.checkedStateIds.push(a));
648
+ // }
649
+ //
650
+ // const subKey2 = key + this.COLLAPSED_EXPANDED_STATE;
651
+ // const data = this.loadFromLocalStorage<CollapsedExpandedData>(subKey2);
652
+ // if (data) {
653
+ // this.collapsedExpandedState = data;
654
+ // }
655
+ //
656
+ // const subKey3 = key + this.SELECTED_STATE;
657
+ // const arr3 = this.loadFromLocalStorage<object>(subKey3);
658
+ // if (arr3) {
659
+ // const map: Map<string | number, string[]> = new Map(Object.entries(arr3));
660
+ // if (map) {
661
+ // this.selectedStateIds.clear();
662
+ // map.forEach((col, k) => this.selectedStateIds.set(k, col));
663
+ // }
664
+ // }
665
+ //
666
+ // const subKey4 = key + this.SCROLL_STATE;
667
+ // let scrollOffset = this.loadFromLocalStorage<[number, number]>(subKey4);
668
+ // this.scrollOffset = scrollOffset ? scrollOffset : [0, 0];
669
+ // }
670
+ // }
671
+ // }
1057
672
  }
1058
- class StoreStateScrollPosService extends AbstractStoreStateService {
1059
- constructor(fn) {
1060
- super(fn);
1061
- this.SCROLL_STATE = "scrollState";
1062
- this.scrollOffset = [0, 0];
1063
- this.load();
673
+ class te extends P {
674
+ constructor(e) {
675
+ super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
1064
676
  }
1065
677
  getScrollOffset() {
1066
678
  return this.scrollOffset;
1067
679
  }
1068
- updateScrollOffset(xy) {
1069
- this.scrollOffset = xy;
1070
- this.checkAndPersistItem(this.SCROLL_STATE, this.scrollOffset);
680
+ updateScrollOffset(e) {
681
+ this.scrollOffset = e, this.checkAndPersistItem(this.SCROLL_STATE, this.scrollOffset);
1071
682
  }
1072
683
  load() {
1073
- const fn = this.getStorageKeyFn;
1074
- if (fn) {
1075
- const key = fn();
1076
- if (key) {
1077
- const subKey4 = key + this.SCROLL_STATE;
1078
- let scrollOffset = this.loadFromLocalStorage(subKey4);
1079
- this.scrollOffset = scrollOffset ? scrollOffset : [0, 0];
684
+ const e = this.getStorageKeyFn;
685
+ if (e) {
686
+ const t = e();
687
+ if (t) {
688
+ const s = t + this.SCROLL_STATE;
689
+ let i = this.loadFromLocalStorage(s);
690
+ this.scrollOffset = i || [0, 0];
1080
691
  }
1081
692
  }
1082
693
  }
1083
694
  }
1084
- class CollapsedExpandedData {
1085
- constructor(mode = "collapsed", rowIds = [], allCollapsed = false, allExpanded = false) {
1086
- this.mode = mode;
1087
- this.rowIds = rowIds;
1088
- this.allCollapsed = allCollapsed;
1089
- this.allExpanded = allExpanded;
695
+ class se {
696
+ constructor(e = "collapsed", t = [], s = !1, i = !1) {
697
+ this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = i;
1090
698
  }
1091
699
  }
1092
- class StoreStateCollapsedExpandService extends AbstractStoreStateService {
1093
- constructor(fn) {
1094
- super(fn);
1095
- this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState";
1096
- this.collapsedExpandedState = new CollapsedExpandedData();
1097
- this.load();
700
+ class ie extends P {
701
+ constructor(e) {
702
+ super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new se(), this.load();
1098
703
  }
1099
704
  collapsedExpandedStateGet() {
1100
705
  return this.collapsedExpandedState;
1101
706
  }
1102
- collapsedExpandedStateIncludes(rowId) {
1103
- return this.collapsedExpandedState.rowIds.includes(rowId);
707
+ collapsedExpandedStateIncludes(e) {
708
+ return this.collapsedExpandedState.rowIds.includes(e);
1104
709
  }
1105
- collapsedStateIdsPush(id) {
1106
- if (!this.collapsedExpandedState.rowIds.includes(id)) {
1107
- this.collapsedExpandedState.rowIds.push(id);
1108
- this.collapsedExpandedState.allCollapsed = false;
1109
- this.collapsedExpandedState.allExpanded = false;
1110
- this.persist();
1111
- }
710
+ collapsedStateIdsPush(e) {
711
+ this.collapsedExpandedState.rowIds.includes(e) || (this.collapsedExpandedState.rowIds.push(e), this.collapsedExpandedState.allCollapsed = !1, this.collapsedExpandedState.allExpanded = !1, this.persist());
1112
712
  }
1113
- collapsedStateIdsRemove(id) {
1114
- const idx = this.collapsedExpandedState.rowIds.indexOf(id);
1115
- if (idx !== -1) {
1116
- this.collapsedExpandedState.rowIds.splice(idx, 1);
1117
- this.collapsedExpandedState.allCollapsed = false;
1118
- this.collapsedExpandedState.allExpanded = false;
1119
- this.persist();
1120
- }
713
+ collapsedStateIdsRemove(e) {
714
+ const t = this.collapsedExpandedState.rowIds.indexOf(e);
715
+ t !== -1 && (this.collapsedExpandedState.rowIds.splice(t, 1), this.collapsedExpandedState.allCollapsed = !1, this.collapsedExpandedState.allExpanded = !1, this.persist());
1121
716
  }
1122
- collapsedStateAll(expand) {
1123
- this.collapsedExpandedState.rowIds = [];
1124
- this.collapsedExpandedState.mode = expand ? "collapsed" : "expanded";
1125
- this.collapsedExpandedState.allCollapsed = !expand;
1126
- this.collapsedExpandedState.allExpanded = expand;
1127
- this.persist();
717
+ collapsedStateAll(e) {
718
+ this.collapsedExpandedState.rowIds = [], this.collapsedExpandedState.mode = e ? "collapsed" : "expanded", this.collapsedExpandedState.allCollapsed = !e, this.collapsedExpandedState.allExpanded = e, this.persist();
1128
719
  }
1129
720
  load() {
1130
- const fn = this.getStorageKeyFn;
1131
- if (fn) {
1132
- const key = fn();
1133
- if (key) {
1134
- const subKey2 = key + this.COLLAPSED_EXPANDED_STATE;
1135
- const data = this.loadFromLocalStorage(subKey2);
1136
- if (data) {
1137
- this.collapsedExpandedState = data;
1138
- }
721
+ const e = this.getStorageKeyFn;
722
+ if (e) {
723
+ const t = e();
724
+ if (t) {
725
+ const s = t + this.COLLAPSED_EXPANDED_STATE, i = this.loadFromLocalStorage(s);
726
+ i && (this.collapsedExpandedState = i);
1139
727
  }
1140
728
  }
1141
729
  }
@@ -1143,1092 +731,856 @@ class StoreStateCollapsedExpandService extends AbstractStoreStateService {
1143
731
  this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
1144
732
  }
1145
733
  }
1146
- class StoreStateSortingService extends AbstractStoreStateService {
1147
- constructor(fn) {
1148
- super(fn);
1149
- this.SORTING_STATE = "sortingState";
1150
- this.sortItems = [];
1151
- this.load();
734
+ class oe extends P {
735
+ constructor(e) {
736
+ super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
1152
737
  }
1153
738
  getSortItems() {
1154
739
  return this.sortItems;
1155
740
  }
1156
- setSortItems(sortItems) {
1157
- this.sortItems = sortItems;
1158
- this.checkAndPersistItem(this.SORTING_STATE, this.sortItems);
741
+ setSortItems(e) {
742
+ this.sortItems = e, this.checkAndPersistItem(this.SORTING_STATE, this.sortItems);
1159
743
  }
1160
744
  load() {
1161
- const fn = this.getStorageKeyFn;
1162
- if (fn) {
1163
- const key = fn();
1164
- if (key) {
1165
- const subKey = key + this.SORTING_STATE;
1166
- let sortItems = this.loadFromLocalStorage(subKey);
1167
- this.sortItems = sortItems ? sortItems : [];
745
+ const e = this.getStorageKeyFn;
746
+ if (e) {
747
+ const t = e();
748
+ if (t) {
749
+ const s = t + this.SORTING_STATE;
750
+ let i = this.loadFromLocalStorage(s);
751
+ this.sortItems = i || [];
1168
752
  }
1169
753
  }
1170
754
  }
1171
755
  }
1172
- class GeoData {
1173
- constructor(left = 0, width = 0, height = 0, top = 0, index) {
1174
- this.left = left;
1175
- this.width = width;
1176
- this.height = height;
1177
- this.top = top;
1178
- this.index = index;
756
+ class T {
757
+ constructor(e = 0, t = 0, s = 0, i = 0, o) {
758
+ this.left = e, this.width = t, this.height = s, this.top = i, this.index = o;
1179
759
  }
1180
760
  }
1181
- class EleScope {
1182
- constructor(hostElement, tableModel, dom, tableOptions) {
1183
- var _a, _b;
1184
- this.hostElement = hostElement;
1185
- this.tableModel = tableModel;
1186
- this.dom = dom;
1187
- this.tableOptions = tableOptions;
1188
- this.scrollTop = 0;
1189
- this.areaBodyWestGeo = new GeoData();
1190
- this.areaBodyCenterGeo = new GeoData();
1191
- this.areaBodyEastGeo = new GeoData();
1192
- const hostEle = this.hostElement;
1193
- hostEle.innerText = "";
1194
- this.dom.setAttribute(hostEle, "tabindex", "0");
1195
- this.dom.setStyle(this.dom.addClass("ge-table", hostEle), "position", "relative");
1196
- this.hoverRow = dom.applyStylePosistionAbsolute(dom.createDivWithClass("ge-table-hover-row", hostEle));
1197
- this.hoverColumn = dom.applyStylePosistionAbsolute(dom.createDivWithClass("ge-table-hover-column", hostEle));
1198
- this.areaHeaderWest = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-header ge-table-header-west", hostEle, "header", "west")));
1199
- this.areaHeaderCenter = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-header ge-table-header-center", hostEle, "header", "center")));
1200
- this.areaHeaderEast = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-header ge-table-header-east", hostEle, "body", "east")));
1201
- this.areaBodyWest = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-body ge-table-body-west", hostEle, "body", "west")));
1202
- this.areaBodyEast = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-body ge-table-body-east", hostEle, "body", "east")));
1203
- this.areaFooterWest = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-footer ge-table-footer-west", hostEle, "footer", "west")));
1204
- this.areaFooterCenter = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-footer ge-table-footer-center", hostEle, "footer", "center")));
1205
- this.areaFooterEast = dom.appendRelativeChildDiv(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-footer ge-table-footer-east", hostEle, "footer", "east")));
1206
- this.scrollViewport = dom.applyStyleOverflowAuto((_a = this.tableOptions.overflowX) !== null && _a !== void 0 ? _a : "auto", (_b = this.tableOptions.overflowY) !== null && _b !== void 0 ? _b : "auto", dom.applyStyleNoPadding(dom.applyStylePosistionAbsolute(dom.createAreaDivWithClass("ge-table-scroll-viewport", hostEle, "body", "center"))));
1207
- this.contentWrapperDiv = dom.applyStyleNoPadding(dom.applyStylePosistionRelative(dom.createDivWithClass("ge-table-scroll-content-wrapper", this.scrollViewport)));
1208
- this.contentDiv = dom.applyStyleNoPadding(dom.applyStylePosistionRelative(dom.createDivWithClass("ge-table-scroll-content", this.contentWrapperDiv)));
1209
- this.areaBodyCenter = dom.appendRelativeChildDiv(dom.createDivWithClass("ge-table-body-center", this.contentDiv));
1210
- this.borderHeaderBottom = dom.applyStylePosistionAbsolute(dom.createDivWithClass("ge-table-header-border", hostEle));
1211
- this.borderFixedWest = dom.applyStylePosistionAbsolute(dom.createDivWithClass("ge-table-west-fixed-column-border", hostEle));
1212
- this.borderFixedEast = dom.applyStylePosistionAbsolute(dom.createDivWithClass("ge-table-east-fixed-column-border", hostEle));
1213
- this.borderFooterTop = dom.applyStylePosistionAbsolute(dom.createDivWithClass("ge-table-footer-border", hostEle));
761
+ class re {
762
+ constructor(e, t, s, i) {
763
+ this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = i, this.scrollTop = 0, this.areaBodyWestGeo = new T(), this.areaBodyCenterGeo = new T(), this.areaBodyEastGeo = new T();
764
+ const o = this.hostElement;
765
+ o.innerText = "", this.dom.setAttribute(o, "tabindex", "0"), this.dom.setStyle(
766
+ this.dom.addClass("ge-table", o),
767
+ "position",
768
+ "relative"
769
+ ), this.hoverRow = s.applyStylePosistionAbsolute(
770
+ s.createDivWithClass("ge-table-hover-row", o)
771
+ ), this.hoverColumn = s.applyStylePosistionAbsolute(
772
+ s.createDivWithClass("ge-table-hover-column", o)
773
+ ), this.areaHeaderWest = s.appendRelativeChildDiv(
774
+ s.applyStylePosistionAbsolute(
775
+ s.createAreaDivWithClass("ge-table-header ge-table-header-west", o, "header", "west")
776
+ )
777
+ ), this.areaHeaderCenter = s.appendRelativeChildDiv(
778
+ s.applyStylePosistionAbsolute(
779
+ s.createAreaDivWithClass("ge-table-header ge-table-header-center", o, "header", "center")
780
+ )
781
+ ), this.areaHeaderEast = s.appendRelativeChildDiv(
782
+ s.applyStylePosistionAbsolute(
783
+ s.createAreaDivWithClass("ge-table-header ge-table-header-east", o, "body", "east")
784
+ )
785
+ ), this.areaBodyWest = s.appendRelativeChildDiv(
786
+ s.applyStylePosistionAbsolute(
787
+ s.createAreaDivWithClass("ge-table-body ge-table-body-west", o, "body", "west")
788
+ )
789
+ ), this.areaBodyEast = s.appendRelativeChildDiv(
790
+ s.applyStylePosistionAbsolute(
791
+ s.createAreaDivWithClass("ge-table-body ge-table-body-east", o, "body", "east")
792
+ )
793
+ ), this.areaFooterWest = s.appendRelativeChildDiv(
794
+ s.applyStylePosistionAbsolute(
795
+ s.createAreaDivWithClass("ge-table-footer ge-table-footer-west", o, "footer", "west")
796
+ )
797
+ ), this.areaFooterCenter = s.appendRelativeChildDiv(
798
+ s.applyStylePosistionAbsolute(
799
+ s.createAreaDivWithClass("ge-table-footer ge-table-footer-center", o, "footer", "center")
800
+ )
801
+ ), this.areaFooterEast = s.appendRelativeChildDiv(
802
+ s.applyStylePosistionAbsolute(
803
+ s.createAreaDivWithClass("ge-table-footer ge-table-footer-east", o, "footer", "east")
804
+ )
805
+ ), this.scrollViewport = s.applyStyleOverflowAuto(
806
+ this.tableOptions.overflowX ?? "auto",
807
+ this.tableOptions.overflowY ?? "auto",
808
+ s.applyStyleNoPadding(
809
+ s.applyStylePosistionAbsolute(
810
+ s.createAreaDivWithClass("ge-table-scroll-viewport", o, "body", "center")
811
+ )
812
+ )
813
+ ), this.contentWrapperDiv = s.applyStyleNoPadding(
814
+ s.applyStylePosistionRelative(
815
+ s.createDivWithClass("ge-table-scroll-content-wrapper", this.scrollViewport)
816
+ )
817
+ ), this.contentDiv = s.applyStyleNoPadding(
818
+ s.applyStylePosistionRelative(
819
+ s.createDivWithClass("ge-table-scroll-content", this.contentWrapperDiv)
820
+ )
821
+ ), this.areaBodyCenter = s.appendRelativeChildDiv(
822
+ s.createDivWithClass("ge-table-body-center", this.contentDiv)
823
+ ), this.borderHeaderBottom = s.applyStylePosistionAbsolute(
824
+ s.createDivWithClass("ge-table-header-border", o)
825
+ ), this.borderFixedWest = s.applyStylePosistionAbsolute(
826
+ s.createDivWithClass("ge-table-west-fixed-column-border", o)
827
+ ), this.borderFixedEast = s.applyStylePosistionAbsolute(
828
+ s.createDivWithClass("ge-table-east-fixed-column-border", o)
829
+ ), this.borderFooterTop = s.applyStylePosistionAbsolute(
830
+ s.createDivWithClass("ge-table-footer-border", o)
831
+ );
1214
832
  }
1215
833
  adjustContainersAndRows() {
1216
- const padding = this.tableModel.getPadding();
1217
- const w = this.hostElement.clientWidth;
1218
- const h = this.hostElement.clientHeight;
834
+ const e = this.tableModel.getPadding(), t = this.hostElement.clientWidth, s = this.hostElement.clientHeight;
1219
835
  this.dom.applyStyle(this.scrollViewport, {
1220
- width: `${w - padding.left}px`,
1221
- height: `${h - padding.top}px`,
1222
- top: `${padding.top}px`,
1223
- left: `${padding.left}px`
1224
- });
1225
- this.scrollTop = this.scrollViewport.scrollTop;
1226
- this.dom.applyStyle(this.contentDiv, {
836
+ width: `${t - e.left}px`,
837
+ height: `${s - e.top}px`,
838
+ top: `${e.top}px`,
839
+ left: `${e.left}px`
840
+ }), this.scrollTop = this.scrollViewport.scrollTop, this.dom.applyStyle(this.contentDiv, {
1227
841
  width: `${this.scrollViewport.clientWidth}px`,
1228
842
  height: `${this.scrollViewport.clientHeight}px`,
1229
843
  top: `${this.scrollTop}px`,
1230
844
  left: `${this.scrollViewport.scrollLeft}px`
1231
- });
1232
- this.areaBodyWestGeo.width = padding.left;
1233
- this.areaBodyWestGeo.height = h - padding.top - padding.bottom;
1234
- this.areaBodyWestGeo.top = padding.top;
1235
- this.areaBodyWestGeo.left = 0;
1236
- this.dom.applyStyleInPx(this.areaBodyWest.parent, this.areaBodyWestGeo);
1237
- if (this.tableOptions.fixedWestSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount()) {
1238
- this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest, {
1239
- width: `1px`,
845
+ }), this.areaBodyWestGeo.width = e.left, this.areaBodyWestGeo.height = s - e.top - e.bottom, this.areaBodyWestGeo.top = e.top, this.areaBodyWestGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyWest.parent, this.areaBodyWestGeo), this.tableOptions.fixedWestSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
846
+ this.dom.applyStyle(this.borderFixedWest, {
847
+ width: "1px",
1240
848
  height: `${this.areaBodyWestGeo.height}px`,
1241
849
  top: `${this.areaBodyWestGeo.top}px`,
1242
850
  left: `${this.areaBodyWestGeo.width}px`
1243
- }));
1244
- } else {
1245
- this.dom.applyDisplayNoneStyle(this.borderFixedWest);
1246
- }
1247
- this.areaBodyEastGeo.width = padding.right;
1248
- this.areaBodyEastGeo.height = h - padding.top - padding.bottom;
1249
- this.areaBodyEastGeo.top = padding.top;
1250
- this.areaBodyEastGeo.left = w - padding.right;
1251
- this.dom.applyStyleInPx(this.areaBodyEast.parent, this.areaBodyEastGeo);
1252
- if (this.tableOptions.fixedEastSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount()) {
1253
- this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast, {
1254
- width: `1px`,
851
+ })
852
+ ) : this.dom.applyDisplayNoneStyle(this.borderFixedWest), this.areaBodyEastGeo.width = e.right, this.areaBodyEastGeo.height = s - e.top - e.bottom, this.areaBodyEastGeo.top = e.top, this.areaBodyEastGeo.left = t - e.right, this.dom.applyStyleInPx(this.areaBodyEast.parent, this.areaBodyEastGeo), this.tableOptions.fixedEastSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
853
+ this.dom.applyStyle(this.borderFixedEast, {
854
+ width: "1px",
1255
855
  height: `${this.areaBodyEastGeo.height}px`,
1256
856
  top: `${this.areaBodyEastGeo.top}px`,
1257
857
  left: `${this.areaBodyEastGeo.left}px`
1258
- }));
1259
- } else {
1260
- this.dom.applyDisplayNoneStyle(this.borderFixedEast);
1261
- }
1262
- this.areaBodyCenterGeo.width = w - padding.left - padding.right;
1263
- this.areaBodyCenterGeo.height = h - padding.top - padding.bottom;
1264
- this.areaBodyCenterGeo.top = 0;
1265
- this.areaBodyCenterGeo.left = 0;
1266
- this.dom.applyStyleInPx(this.areaBodyCenter.parent, this.areaBodyCenterGeo);
1267
- this.dom.applyStyle(this.areaHeaderCenter.parent, {
1268
- width: `${w - padding.left - padding.right}px`,
1269
- height: `${padding.top}px`,
858
+ })
859
+ ) : this.dom.applyDisplayNoneStyle(this.borderFixedEast), this.areaBodyCenterGeo.width = t - e.left - e.right, this.areaBodyCenterGeo.height = s - e.top - e.bottom, this.areaBodyCenterGeo.top = 0, this.areaBodyCenterGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyCenter.parent, this.areaBodyCenterGeo), this.dom.applyStyle(this.areaHeaderCenter.parent, {
860
+ width: `${t - e.left - e.right}px`,
861
+ height: `${e.top}px`,
1270
862
  top: "0",
1271
- left: `${padding.left}px`
1272
- });
1273
- this.dom.applyStyle(this.areaHeaderWest.parent, {
1274
- width: `${padding.left}px`,
1275
- height: `${padding.top}px`,
863
+ left: `${e.left}px`
864
+ }), this.dom.applyStyle(this.areaHeaderWest.parent, {
865
+ width: `${e.left}px`,
866
+ height: `${e.top}px`,
1276
867
  top: "0",
1277
868
  left: "0"
1278
- });
1279
- this.dom.applyStyle(this.areaHeaderEast.parent, {
1280
- width: `${padding.right}px`,
1281
- height: `${padding.top}px`,
869
+ }), this.dom.applyStyle(this.areaHeaderEast.parent, {
870
+ width: `${e.right}px`,
871
+ height: `${e.top}px`,
1282
872
  top: "0",
1283
- left: `${w - padding.right}px`
1284
- });
1285
- if (this.tableOptions.headerSeparatorBorderVisible && this.tableModel.isHeaderVisibe()) {
1286
- this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom, {
1287
- width: `${w}px`,
873
+ left: `${t - e.right}px`
874
+ }), this.tableOptions.headerSeparatorBorderVisible && this.tableModel.isHeaderVisibe() ? this.dom.applyDisplayBlockStyle(
875
+ this.dom.applyStyle(this.borderHeaderBottom, {
876
+ width: `${t}px`,
1288
877
  height: "1px",
1289
- top: `${padding.top}px`,
878
+ top: `${e.top}px`,
1290
879
  left: "0px"
1291
- }));
1292
- } else {
1293
- this.dom.applyDisplayNoneStyle(this.borderHeaderBottom);
1294
- }
1295
- this.dom.applyStyle(this.areaFooterWest.parent, {
1296
- width: `${padding.left}px`,
1297
- height: `${padding.bottom}px`,
1298
- top: `${h - padding.bottom}px`,
880
+ })
881
+ ) : this.dom.applyDisplayNoneStyle(this.borderHeaderBottom), this.dom.applyStyle(this.areaFooterWest.parent, {
882
+ width: `${e.left}px`,
883
+ height: `${e.bottom}px`,
884
+ top: `${s - e.bottom}px`,
1299
885
  left: "0"
1300
- });
1301
- this.dom.applyStyle(this.areaFooterCenter.parent, {
1302
- width: `${w - padding.left - padding.right}px`,
1303
- height: `${padding.bottom}px`,
1304
- top: `${h - padding.bottom}px`,
1305
- left: `${padding.left}px`
1306
- });
1307
- this.dom.applyStyle(this.areaFooterEast.parent, {
1308
- width: `${padding.right}px`,
1309
- height: `${padding.bottom}px`,
1310
- top: `${h - padding.bottom}px`,
1311
- left: `${w - padding.right}px`
1312
- });
1313
- if (this.tableOptions.footerSeparatorBorderVisible && this.tableModel.isFooterVisibe()) {
1314
- this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop, {
1315
- width: `${w}px`,
886
+ }), this.dom.applyStyle(this.areaFooterCenter.parent, {
887
+ width: `${t - e.left - e.right}px`,
888
+ height: `${e.bottom}px`,
889
+ top: `${s - e.bottom}px`,
890
+ left: `${e.left}px`
891
+ }), this.dom.applyStyle(this.areaFooterEast.parent, {
892
+ width: `${e.right}px`,
893
+ height: `${e.bottom}px`,
894
+ top: `${s - e.bottom}px`,
895
+ left: `${t - e.right}px`
896
+ }), this.tableOptions.footerSeparatorBorderVisible && this.tableModel.isFooterVisibe() ? this.dom.applyDisplayBlockStyle(
897
+ this.dom.applyStyle(this.borderFooterTop, {
898
+ width: `${t}px`,
1316
899
  height: "1px",
1317
- top: `${h - padding.bottom}px`,
900
+ top: `${s - e.bottom}px`,
1318
901
  left: "0px"
1319
- }));
1320
- } else {
1321
- this.dom.applyDisplayNoneStyle(this.borderFooterTop);
1322
- }
1323
- this.adjustAfterScrolling();
902
+ })
903
+ ) : this.dom.applyDisplayNoneStyle(this.borderFooterTop), this.adjustAfterScrolling();
1324
904
  }
1325
905
  adjustAfterScrolling() {
1326
906
  }
1327
907
  resetSizeOfWrapperDiv() {
1328
- const w = `${this.tableModel.getContentWidthInPixel()}px`;
1329
- const h = `${this.tableModel.getContentHeightInPixel() + 1}px`;
1330
- this.dom.setStyle(this.contentWrapperDiv, "width", w);
1331
- this.dom.setStyle(this.contentWrapperDiv, "height", h);
908
+ const e = `${this.tableModel.getContentWidthInPixel()}px`, t = `${this.tableModel.getContentHeightInPixel() + 1}px`;
909
+ this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
1332
910
  }
1333
911
  }
1334
- class CellRange {
1335
- constructor(r1, c1, r2, c2, gammaRange = false) {
1336
- this.r1 = r1;
1337
- this.c1 = c1;
1338
- this.r2 = r2;
1339
- this.c2 = c2;
1340
- this.gammaRange = gammaRange;
1341
- }
1342
- static create(params) {
1343
- if (params.gammaRange === void 0) {
1344
- params.gammaRange = false;
1345
- }
1346
- return new CellRange(params.rowIndex1, params.columnIndex1, params.rowIndex2, params.columnIndex2, params.gammaRange);
912
+ class A {
913
+ constructor(e, t, s, i, o = !1) {
914
+ this.r1 = e, this.c1 = t, this.r2 = s, this.c2 = i, this.gammaRange = o;
1347
915
  }
1348
- static singleCell(rowIndex, columnIndex) {
1349
- return new CellRange(rowIndex, columnIndex, rowIndex, columnIndex);
916
+ static create(e) {
917
+ return e.gammaRange === void 0 && (e.gammaRange = !1), new A(
918
+ e.rowIndex1,
919
+ e.columnIndex1,
920
+ e.rowIndex2,
921
+ e.columnIndex2,
922
+ e.gammaRange
923
+ );
1350
924
  }
1351
- static singleRow(rowIndex) {
1352
- return new CellRange(rowIndex, 0, rowIndex, Number.MAX_SAFE_INTEGER);
925
+ static singleCell(e, t) {
926
+ return new A(e, t, e, t);
1353
927
  }
1354
- static singleColumn(columnIndex) {
1355
- return new CellRange(0, columnIndex, Number.MAX_SAFE_INTEGER, columnIndex);
928
+ static singleRow(e) {
929
+ return new A(e, 0, e, Number.MAX_SAFE_INTEGER);
1356
930
  }
1357
- isInRange(rowIndex, columnIndex) {
1358
- return rowIndex >= this.r1 && rowIndex <= this.r2 && columnIndex >= this.c1 && columnIndex <= this.c2;
931
+ static singleColumn(e) {
932
+ return new A(0, e, Number.MAX_SAFE_INTEGER, e);
933
+ }
934
+ isInRange(e, t) {
935
+ return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
1359
936
  }
1360
937
  }
1361
- class ColAndRowspanModel {
1362
- constructor(tableModel, areaModel) {
1363
- this.tableModel = tableModel;
1364
- this.areaModel = areaModel;
1365
- this.colAndRowspanRanges = void 0;
938
+ class le {
939
+ constructor(e, t) {
940
+ this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
1366
941
  }
1367
942
  init() {
1368
- if (this.areaModel.getMaxColspan() < 2 && this.areaModel.getMaxRowspan() < 2) {
943
+ if (this.areaModel.getMaxColspan() < 2 && this.areaModel.getMaxRowspan() < 2)
1369
944
  return;
1370
- }
1371
945
  this.colAndRowspanRanges = [];
1372
- const rowCount = this.areaModel.getRowCount();
1373
- const colCount = this.tableModel.getColumnCount();
1374
- for (let r = 0; r < rowCount; r++) {
1375
- for (let c = 0; c < colCount; c++) {
1376
- let cs = this.areaModel.getColspanAt(r, c);
1377
- let rs = this.areaModel.getRowspanAt(r, c);
1378
- if (cs > 1 || rs > 1) {
1379
- if (cs === 0) {
1380
- cs = 1;
1381
- }
1382
- if (rs === 0) {
1383
- rs = 1;
1384
- }
1385
- const gammaRange = this.areaModel.hasOwnProperty("gammaCells");
1386
- this.colAndRowspanRanges.push(new CellRange(r, c, r + rs - 1, c + cs - 1, gammaRange));
946
+ const e = this.areaModel.getRowCount(), t = this.tableModel.getColumnCount();
947
+ for (let s = 0; s < e; s++)
948
+ for (let i = 0; i < t; i++) {
949
+ let o = this.areaModel.getColspanAt(s, i), r = this.areaModel.getRowspanAt(s, i);
950
+ if (o > 1 || r > 1) {
951
+ o === 0 && (o = 1), r === 0 && (r = 1);
952
+ const l = this.areaModel.hasOwnProperty("gammaCells");
953
+ this.colAndRowspanRanges.push(
954
+ new A(s, i, s + r - 1, i + o - 1, l)
955
+ );
1387
956
  }
1388
957
  }
1389
- }
1390
958
  }
1391
959
  getRanges() {
1392
- if (this.colAndRowspanRanges) {
1393
- return this.colAndRowspanRanges;
1394
- }
1395
- return [];
960
+ return this.colAndRowspanRanges ? this.colAndRowspanRanges : [];
1396
961
  }
1397
- isInRange(rowIndex, columnIndex) {
962
+ isInRange(e, t) {
1398
963
  if (this.colAndRowspanRanges) {
1399
- for (const range of this.colAndRowspanRanges) {
1400
- if (range.isInRange(rowIndex, columnIndex)) {
1401
- return true;
1402
- }
1403
- }
964
+ for (const s of this.colAndRowspanRanges)
965
+ if (s.isInRange(e, t))
966
+ return !0;
1404
967
  }
1405
- return false;
968
+ return !1;
1406
969
  }
1407
970
  }
1408
- class AreaObjectMap {
1409
- constructor(header, body, footer) {
1410
- this.header = header;
1411
- this.body = body;
1412
- this.footer = footer;
971
+ class ne {
972
+ constructor(e, t, s) {
973
+ this.header = e, this.body = t, this.footer = s;
1413
974
  }
1414
975
  }
1415
- class RenderScope extends EleScope {
1416
- constructor(hostElement, tableModel, dom, tableOptions) {
1417
- var _a, _b;
1418
- super(hostElement, tableModel, dom, tableOptions);
1419
- this.scrollLeft = 0;
1420
- this.scrollViewportLeft = 0;
1421
- this.scrollFactorY = 0;
1422
- this.scrollFactorX = 0;
1423
- this.cleanupFunctions = {
976
+ class ae extends re {
977
+ constructor(e, t, s, i) {
978
+ var r, l;
979
+ super(e, t, s, i), this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
1424
980
  header: [],
1425
981
  body: [],
1426
982
  footer: []
1427
- };
1428
- this.tree = false;
1429
- this.colAndRowspanModels = new AreaObjectMap();
1430
- this.firstVisibleRowIndex = -1;
1431
- this.draggingTargetColumnIndex = -1;
1432
- this.removables = [];
1433
- this.editing = false;
1434
- if (this.tableModel.getSelectionModel) {
1435
- this.getSelectionModel = this.tableModel.getSelectionModel;
1436
- } else if ((_a = this.tableOptions) === null || _a === void 0 ? void 0 : _a.getSelectionModel) {
1437
- this.getSelectionModel = this.tableOptions.getSelectionModel;
1438
- }
1439
- if ((_b = this.tableOptions) === null || _b === void 0 ? void 0 : _b.getFocusModel) {
1440
- this.getFocusModel = this.tableOptions.getFocusModel;
1441
- }
1442
- if (tableModel.getAreaModel("body") instanceof AreaModelTree) {
1443
- this.tree = true;
1444
- }
1445
- const aereaIds = ["header", "body", "footer"];
1446
- aereaIds.forEach((areaIdent) => {
1447
- var _a2;
1448
- this.colAndRowspanModels[areaIdent] = new ColAndRowspanModel(tableModel, tableModel.getAreaModel(areaIdent));
1449
- (_a2 = this.colAndRowspanModels[areaIdent]) === null || _a2 === void 0 ? void 0 : _a2.init();
1450
- });
983
+ }, this.tree = !1, this.colAndRowspanModels = new ne(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.editing = !1, this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (l = this.tableOptions) != null && l.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), t.getAreaModel("body") instanceof L && (this.tree = !0), ["header", "body", "footer"].forEach(
984
+ (n) => {
985
+ var a;
986
+ this.colAndRowspanModels[n] = new le(t, t.getAreaModel(n)), (a = this.colAndRowspanModels[n]) == null || a.init();
987
+ }
988
+ );
1451
989
  }
1452
990
  isEditing() {
1453
991
  return this.editing;
1454
992
  }
1455
993
  resetEditorRenderer() {
1456
- this.editorRenderer = void 0;
1457
- this.editorRendererRow = -1;
1458
- this.editorRendererColumn = -1;
1459
- this.editing = false;
994
+ this.editorRenderer = void 0, this.editorRendererRow = -1, this.editorRendererColumn = -1, this.editing = !1;
1460
995
  }
1461
996
  clearSelection() {
1462
997
  if (this.getSelectionModel) {
1463
- const sm = this.getSelectionModel();
1464
- sm === null || sm === void 0 ? void 0 : sm.clear();
1465
- }
1466
- }
1467
- initRenderEditor(rowIdx, colIdx) {
1468
- var _a;
1469
- let rnFn = (_a = this.tableModel.getColumnDef(colIdx)) === null || _a === void 0 ? void 0 : _a.getEditRenderer;
1470
- if (!rnFn) {
1471
- rnFn = this.tableOptions.getEditRenderer;
1472
- }
1473
- if (rnFn) {
1474
- this.editorRenderer = rnFn(rowIdx, colIdx);
1475
- if (this.editorRenderer) {
1476
- this.editorRendererRow = rowIdx;
1477
- this.editorRendererColumn = colIdx;
1478
- this.editing = true;
1479
- this.repaint();
1480
- const input = document.querySelector("input.ge-table-cell-editor-input");
1481
- if (input) {
1482
- input.focus();
1483
- }
1484
- } else {
998
+ const e = this.getSelectionModel();
999
+ e == null || e.clear();
1000
+ }
1001
+ }
1002
+ initRenderEditor(e, t) {
1003
+ var i;
1004
+ let s = (i = this.tableModel.getColumnDef(t)) == null ? void 0 : i.getEditRenderer;
1005
+ if (s || (s = this.tableOptions.getEditRenderer), s)
1006
+ if (this.editorRenderer = s(e, t), this.editorRenderer) {
1007
+ this.editorRendererRow = e, this.editorRendererColumn = t, this.editing = !0, this.repaint();
1008
+ const o = document.querySelector("input.ge-table-cell-editor-input");
1009
+ o && o.focus();
1010
+ } else
1485
1011
  this.resetEditorRenderer();
1486
- }
1487
- }
1488
1012
  }
1489
1013
  repaint() {
1490
1014
  this.adjustAfterScrolling();
1491
1015
  }
1492
1016
  adjustAfterScrolling() {
1493
- var _a;
1494
- for (const cleaning of this.removables) {
1495
- cleaning.remove();
1496
- }
1497
- this.hideHoverRow();
1498
- this.hideHoverColumn();
1499
- this.scrollTop = this.scrollViewport.scrollTop;
1500
- this.scrollLeft = this.scrollViewport.scrollLeft;
1501
- this.debounce(this.checkForScrollPosSaving.bind(this));
1502
- this.scrollFactorY = this.scrollTop / (this.scrollViewport.scrollHeight - this.scrollViewport.clientHeight);
1503
- this.scrollFactorX = this.scrollLeft / (this.scrollViewport.scrollWidth - this.scrollViewport.clientWidth);
1504
- if (isNaN(this.scrollFactorY)) {
1505
- this.scrollFactorY = 0;
1506
- }
1507
- if (isNaN(this.scrollFactorX)) {
1508
- this.scrollFactorX = 0;
1509
- }
1510
- this.adjustBody();
1511
- this.adjustArea("footer");
1512
- this.adjustArea("header");
1513
- if (this.tableOptions.tableTopBorderVisible) {
1514
- this.removables.push(this.dom.addHorizontalBorder(new GeoData(0, this.hostElement.clientWidth, 1, 0), this.hostElement, "ge-table-border"));
1515
- }
1516
- if (this.tableOptions.tableBottomBorderVisible) {
1517
- this.removables.push(this.dom.addHorizontalBorder(new GeoData(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1), this.hostElement, "ge-table-border"));
1518
- }
1519
- if (this.tableModel.getFixedLeftColumnCount() > 0) {
1520
- this.removables.push(this.dom.addVerticalBorder(new GeoData(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0), this.hostElement, "ge-table-body-west-vertical-border"));
1521
- }
1522
- if (((_a = this.tableModel.getAreaModel("header")) === null || _a === void 0 ? void 0 : _a.getRowCount()) > 0) {
1523
- this.removables.push(this.dom.addHorizontalBorder(new GeoData(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight), this.hostElement, "ge-table-body-west-vertical-border"));
1524
- }
1017
+ var e;
1018
+ for (const t of this.removables)
1019
+ t.remove();
1020
+ this.hideHoverRow(), this.hideHoverColumn(), this.scrollTop = this.scrollViewport.scrollTop, this.scrollLeft = this.scrollViewport.scrollLeft, this.debounce(this.checkForScrollPosSaving.bind(this)), this.scrollFactorY = this.scrollTop / (this.scrollViewport.scrollHeight - this.scrollViewport.clientHeight), this.scrollFactorX = this.scrollLeft / (this.scrollViewport.scrollWidth - this.scrollViewport.clientWidth), isNaN(this.scrollFactorY) && (this.scrollFactorY = 0), isNaN(this.scrollFactorX) && (this.scrollFactorX = 0), this.adjustBody(), this.adjustArea("footer"), this.adjustArea("header"), this.tableOptions.tableTopBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
1021
+ new T(0, this.hostElement.clientWidth, 1, 0),
1022
+ this.hostElement,
1023
+ "ge-table-border"
1024
+ )), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
1025
+ new T(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
1026
+ this.hostElement,
1027
+ "ge-table-border"
1028
+ )), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
1029
+ new T(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
1030
+ this.hostElement,
1031
+ "ge-table-body-west-vertical-border"
1032
+ )), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
1033
+ new T(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
1034
+ this.hostElement,
1035
+ "ge-table-body-west-vertical-border"
1036
+ ));
1525
1037
  }
1526
1038
  checkForScrollPosSaving() {
1527
- var _a, _b;
1528
- if (this.storeScrollPosStateService && ((_b = (_a = this.tableOptions) === null || _a === void 0 ? void 0 : _a.autoRestoreOptions) === null || _b === void 0 ? void 0 : _b.autoRestoreScrollPosition)) {
1529
- this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft, this.scrollTop]);
1530
- }
1039
+ var e, t;
1040
+ this.storeScrollPosStateService && ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreScrollPosition) && this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft, this.scrollTop]);
1531
1041
  }
1532
- updateCells(events) {
1533
- events.forEach((evt) => this.tableModel.getAreaModel(evt.area).setValue(evt.rowIndex, evt.columnIndex, evt.value));
1534
- this.repaint();
1042
+ updateCells(e) {
1043
+ e.forEach(
1044
+ (t) => this.tableModel.getAreaModel(t.area).setValue(t.rowIndex, t.columnIndex, t.value)
1045
+ ), this.repaint();
1535
1046
  }
1536
- getAreaAndSideIdentByAttr(srcElement) {
1537
- if (srcElement) {
1538
- const dataArea = this.getStringByAttr(srcElement, "data-area");
1539
- const dataSide = this.getStringByAttr(srcElement, "data-side");
1540
- if (dataSide && dataArea) {
1541
- return [dataArea, dataSide];
1542
- }
1047
+ getAreaAndSideIdentByAttr(e) {
1048
+ if (e) {
1049
+ const t = this.getStringByAttr(e, "data-area"), s = this.getStringByAttr(e, "data-side");
1050
+ if (s && t)
1051
+ return [t, s];
1543
1052
  }
1544
1053
  return [void 0, void 0];
1545
1054
  }
1546
- getArea(rowIdent, sideIdent) {
1547
- if (rowIdent === "header") {
1548
- if (sideIdent === "west")
1055
+ getArea(e, t) {
1056
+ if (e === "header") {
1057
+ if (t === "west")
1549
1058
  return this.areaHeaderWest;
1550
- if (sideIdent === "center")
1059
+ if (t === "center")
1551
1060
  return this.areaHeaderCenter;
1552
- if (sideIdent === "east")
1061
+ if (t === "east")
1553
1062
  return this.areaHeaderEast;
1554
- } else if (rowIdent === "body") {
1555
- if (sideIdent === "west")
1063
+ } else if (e === "body") {
1064
+ if (t === "west")
1556
1065
  return this.areaBodyWest;
1557
- if (sideIdent === "center")
1066
+ if (t === "center")
1558
1067
  return this.areaBodyCenter;
1559
- if (sideIdent === "east")
1068
+ if (t === "east")
1560
1069
  return this.areaBodyEast;
1561
- } else if (rowIdent === "footer") {
1562
- if (sideIdent === "west")
1070
+ } else if (e === "footer") {
1071
+ if (t === "west")
1563
1072
  return this.areaFooterWest;
1564
- if (sideIdent === "center")
1073
+ if (t === "center")
1565
1074
  return this.areaFooterCenter;
1566
- if (sideIdent === "east")
1075
+ if (t === "east")
1567
1076
  return this.areaFooterEast;
1568
1077
  }
1569
- throw Error(`Wrong area identifier: row:${rowIdent}, col:${sideIdent}`);
1078
+ throw Error(`Wrong area identifier: row:${e}, col:${t}`);
1570
1079
  }
1571
1080
  adjustBody() {
1572
- const virtualRowDivTopF1 = this.areaBodyCenterGeo.height - this.tableModel.getContentHeightInPixel();
1573
- const virtualRowDivTop = this.scrollFactorY * virtualRowDivTopF1;
1574
- this.dom.setStyle(this.contentDiv, "top", `${this.scrollTop}px`);
1575
- this.dom.setStyle(this.contentDiv, "left", `${this.scrollViewport.scrollLeft}px`);
1576
- this.adjustArea("body", virtualRowDivTop);
1577
- }
1578
- getNumberByAttr(srcElement, key) {
1579
- var _a;
1580
- if (srcElement) {
1581
- const attr = (_a = srcElement.closest("[" + key + "]")) === null || _a === void 0 ? void 0 : _a.getAttribute(key);
1582
- if (attr)
1583
- return Number(attr);
1081
+ const e = this.areaBodyCenterGeo.height - this.tableModel.getContentHeightInPixel(), t = this.scrollFactorY * e;
1082
+ this.dom.setStyle(this.contentDiv, "top", `${this.scrollTop}px`), this.dom.setStyle(this.contentDiv, "left", `${this.scrollViewport.scrollLeft}px`), this.adjustArea("body", t);
1083
+ }
1084
+ getNumberByAttr(e, t) {
1085
+ var s;
1086
+ if (e) {
1087
+ const i = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
1088
+ if (i)
1089
+ return Number(i);
1584
1090
  }
1585
1091
  return -1;
1586
1092
  }
1587
- getStringByAttr(srcElement, key) {
1588
- var _a;
1589
- if (srcElement) {
1590
- const attr = (_a = srcElement.closest("[" + key + "]")) === null || _a === void 0 ? void 0 : _a.getAttribute(key);
1591
- if (attr)
1592
- return attr;
1093
+ getStringByAttr(e, t) {
1094
+ var s;
1095
+ if (e) {
1096
+ const i = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
1097
+ if (i)
1098
+ return i;
1593
1099
  }
1594
1100
  return "";
1595
1101
  }
1596
- adjustArea(areaIdent, yStart = 0) {
1597
- var _a, _b;
1598
- const westArea = this.getArea(areaIdent, "west");
1599
- const centerArea = this.getArea(areaIdent, "center");
1600
- const eastArea = this.getArea(areaIdent, "east");
1601
- const divHeight = centerArea.child.clientHeight;
1602
- westArea.child.innerText = "";
1603
- centerArea.child.innerText = "";
1604
- eastArea.child.innerText = "";
1605
- const left = 0;
1606
- const width = this.areaBodyCenterGeo.width;
1607
- const padding = this.tableModel.getPadding();
1608
- const areaModel = this.tableModel.getAreaModel(areaIdent);
1609
- const rowCount = areaModel.getRowCount();
1610
- while (this.cleanupFunctions[areaIdent].length) {
1611
- const fn = this.cleanupFunctions[areaIdent].shift();
1612
- if (fn) {
1613
- fn();
1614
- }
1615
- }
1616
- let y = yStart;
1617
- const columnCount = this.tableModel.getColumnCount();
1618
- const fixedRightColumnCount = this.tableModel.getFixedRightColumnCount();
1619
- const fixedLeftColumnCount = this.tableModel.getFixedLeftColumnCount();
1620
- for (let index = 0; index < rowCount; index++) {
1621
- const top = y;
1622
- const lastRowOfModel = index === rowCount - 1;
1623
- const height = this.tableModel.getRowHeight(areaIdent, index);
1624
- if (top + height > 0) {
1625
- this.firstVisibleRowIndex = index;
1626
- let geo = { left, width, height, top, index };
1627
- let rowDiv = this.dom.addRowDiv(centerArea, geo, index, areaIdent, "center");
1628
- const centerStartCol = fixedLeftColumnCount;
1629
- this.adjustColumnsToRowParent({
1630
- areaIdent,
1102
+ adjustArea(e, t = 0) {
1103
+ var p;
1104
+ const s = this.getArea(e, "west"), i = this.getArea(e, "center"), o = this.getArea(e, "east"), r = i.child.clientHeight;
1105
+ s.child.innerText = "", i.child.innerText = "", o.child.innerText = "";
1106
+ const l = 0, n = this.areaBodyCenterGeo.width, a = this.tableModel.getPadding(), d = this.tableModel.getAreaModel(e), S = d.getRowCount();
1107
+ for (; this.cleanupFunctions[e].length; ) {
1108
+ const u = this.cleanupFunctions[e].shift();
1109
+ u && u();
1110
+ }
1111
+ let g = t;
1112
+ const f = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount(), b = this.tableModel.getFixedLeftColumnCount();
1113
+ for (let u = 0; u < S; u++) {
1114
+ const x = g, v = u === S - 1, C = this.tableModel.getRowHeight(e, u);
1115
+ if (x + C > 0) {
1116
+ this.firstVisibleRowIndex = u;
1117
+ let w = { left: l, width: n, height: C, top: x, index: u }, m = this.dom.addRowDiv(i, w, u, e, "center");
1118
+ const M = b;
1119
+ if (this.adjustColumnsToRowParent({
1120
+ areaIdent: e,
1631
1121
  sideIdent: "center",
1632
- areaModel,
1633
- geo,
1634
- parent: rowDiv,
1635
- rowIndex: index,
1636
- columnIndexStart: centerStartCol,
1637
- columnIndexEnd: columnCount - fixedRightColumnCount - 1,
1638
- verticalFixed: false,
1639
- lastRowOfModel
1640
- });
1641
- if (padding.left > 0) {
1642
- geo = { left, width: this.areaBodyWestGeo.width, height, top, index };
1643
- rowDiv = this.dom.addRowDiv(westArea, geo, index, areaIdent, "west");
1644
- this.adjustColumnsToRowParent({
1645
- areaIdent,
1646
- sideIdent: "west",
1647
- areaModel,
1648
- geo,
1649
- parent: rowDiv,
1650
- rowIndex: index,
1651
- columnIndexStart: 0,
1652
- columnIndexEnd: centerStartCol - 1,
1653
- verticalFixed: true,
1654
- lastRowOfModel
1655
- });
1656
- }
1657
- if (padding.right > 0) {
1658
- geo = { left, width: this.areaBodyEastGeo.width, height, top, index };
1659
- rowDiv = this.dom.addRowDiv(eastArea, geo, index, areaIdent, "east");
1660
- this.adjustColumnsToRowParent({
1661
- areaIdent,
1662
- sideIdent: "east",
1663
- areaModel,
1664
- geo,
1665
- parent: rowDiv,
1666
- rowIndex: index,
1667
- columnIndexStart: columnCount - fixedRightColumnCount,
1668
- columnIndexEnd: columnCount - 1,
1669
- verticalFixed: true,
1670
- lastRowOfModel
1671
- });
1672
- }
1673
- if (areaIdent === "header" && this.tree && index === rowCount - 1) {
1674
- const div = this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(rowDiv, new GeoData(16, 20, 20, 8)), "data-ge-action", "toggleExpandCollapseAll"), { "cursor": "pointer" });
1675
- const treeOptionsArrow = this.tableOptions.treeOptions.arrowExpandCollapseAll;
1676
- if (treeOptionsArrow) {
1677
- const textElement = this.dom.domService.createText(treeOptionsArrow.content);
1678
- this.dom.domService.appendChild(div, textElement);
1679
- if (treeOptionsArrow.style) {
1680
- this.dom.applyStyleString(div, treeOptionsArrow.style);
1681
- }
1122
+ areaModel: d,
1123
+ geo: w,
1124
+ parent: m,
1125
+ rowIndex: u,
1126
+ columnIndexStart: M,
1127
+ columnIndexEnd: f - c - 1,
1128
+ verticalFixed: !1,
1129
+ lastRowOfModel: v
1130
+ }), a.left > 0 && (w = { left: l, width: this.areaBodyWestGeo.width, height: C, top: x, index: u }, m = this.dom.addRowDiv(s, w, u, e, "west"), this.adjustColumnsToRowParent({
1131
+ areaIdent: e,
1132
+ sideIdent: "west",
1133
+ areaModel: d,
1134
+ geo: w,
1135
+ parent: m,
1136
+ rowIndex: u,
1137
+ columnIndexStart: 0,
1138
+ columnIndexEnd: M - 1,
1139
+ verticalFixed: !0,
1140
+ lastRowOfModel: v
1141
+ })), a.right > 0 && (w = { left: l, width: this.areaBodyEastGeo.width, height: C, top: x, index: u }, m = this.dom.addRowDiv(o, w, u, e, "east"), this.adjustColumnsToRowParent({
1142
+ areaIdent: e,
1143
+ sideIdent: "east",
1144
+ areaModel: d,
1145
+ geo: w,
1146
+ parent: m,
1147
+ rowIndex: u,
1148
+ columnIndexStart: f - c,
1149
+ columnIndexEnd: f - 1,
1150
+ verticalFixed: !0,
1151
+ lastRowOfModel: v
1152
+ })), e === "header" && this.tree && u === S - 1) {
1153
+ const E = this.dom.applyStyle(
1154
+ this.dom.setAttribute(
1155
+ this.dom.addDiv(m, new T(16, 20, 20, 8)),
1156
+ "data-ge-action",
1157
+ "toggleExpandCollapseAll"
1158
+ ),
1159
+ { cursor: "pointer" }
1160
+ ), R = this.tableOptions.treeOptions.arrowExpandCollapseAll;
1161
+ if (R) {
1162
+ const D = this.dom.domService.createText(R.content);
1163
+ this.dom.domService.appendChild(E, D), R.style && this.dom.applyStyleString(E, R.style);
1682
1164
  }
1683
1165
  }
1684
1166
  }
1685
- y = y + height;
1686
- if (y > divHeight) {
1167
+ if (g = g + C, g > r)
1687
1168
  break;
1688
- }
1689
1169
  }
1690
- if (this.colAndRowspanModels && this.colAndRowspanModels[areaIdent]) {
1691
- const ranges = (_b = (_a = this.colAndRowspanModels[areaIdent]) === null || _a === void 0 ? void 0 : _a.getRanges()) !== null && _b !== void 0 ? _b : [];
1692
- if (ranges.length) {
1693
- for (const range of ranges) {
1694
- let xStart = 0;
1695
- let child = centerArea.child;
1696
- let sideIdent = "center";
1697
- if (range.c1 < fixedLeftColumnCount) {
1698
- child = westArea.child;
1699
- sideIdent = "west";
1700
- } else if (fixedRightColumnCount > 0 && range.c1 >= columnCount - fixedRightColumnCount) {
1701
- child = eastArea.child;
1702
- sideIdent = "east";
1703
- } else {
1704
- const virtualRowDivLeftF1 = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1705
- xStart = this.scrollFactorX * virtualRowDivLeftF1 - this.areaBodyWestGeo.width;
1706
- sideIdent = "center";
1170
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
1171
+ const u = ((p = this.colAndRowspanModels[e]) == null ? void 0 : p.getRanges()) ?? [];
1172
+ if (u.length)
1173
+ for (const x of u) {
1174
+ let v = 0, C = i.child, w = "center";
1175
+ if (x.c1 < b)
1176
+ C = s.child, w = "west";
1177
+ else if (c > 0 && x.c1 >= f - c)
1178
+ C = o.child, w = "east";
1179
+ else {
1180
+ const m = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1181
+ v = this.scrollFactorX * m - this.areaBodyWestGeo.width, w = "center";
1707
1182
  }
1708
- this.drawBigCell(range, xStart, yStart, areaModel, child, sideIdent);
1183
+ this.drawBigCell(x, v, t, d, C, w);
1709
1184
  }
1710
- }
1711
1185
  }
1712
1186
  }
1713
- drawBigCell(range, xStart, yStart, areaModel, parentDiv, sideIdent) {
1714
- const y1 = yStart + this.getRowHeights(0, range.r1 - 1, areaModel).reduce((a, b) => a + b, 0);
1715
- const columnCount = this.tableModel.getColumnCount();
1716
- const fixedRightColumnCount = this.tableModel.getFixedRightColumnCount();
1717
- let firstColIdx = 0;
1718
- if (fixedRightColumnCount > 0 && range.c1 >= columnCount - fixedRightColumnCount) {
1719
- firstColIdx = columnCount - fixedRightColumnCount;
1720
- }
1721
- const x1 = xStart + this.getColumnWidths(firstColIdx, range.c1 - 1).reduce((a, b) => a + b, 0);
1722
- const h = this.getRowHeights(range.r1, range.r2, areaModel).reduce((a, b) => a + b, 0);
1723
- const w = this.getColumnWidths(range.c1, range.c2).reduce((a, b) => a + b, 0);
1724
- let cellSelected = false;
1725
- const selectionModel2 = this.getSelectionModel ? this.getSelectionModel() : void 0;
1726
- if (selectionModel2) {
1727
- const count = selectionModel2.getSelectionCount(range.r1, range.c1);
1728
- cellSelected = count > 0;
1729
- }
1730
- if (range.gammaRange) {
1731
- console.info("TODO here", range);
1732
- this.renderCell({
1733
- areaModel,
1734
- areaIdent: areaModel.areaIdent,
1735
- sideIdent,
1736
- rowIndex: range.r1,
1737
- columnIndex: range.c1,
1738
- left: x1,
1739
- top: y1,
1740
- width: w,
1741
- height: h,
1742
- parent: parentDiv,
1743
- cellSelected,
1744
- lastRowOfModel: true,
1745
- gammaRange: range.gammaRange
1746
- });
1747
- } else {
1748
- this.renderCell({
1749
- areaModel,
1750
- areaIdent: areaModel.areaIdent,
1751
- sideIdent,
1752
- rowIndex: range.r1,
1753
- columnIndex: range.c1,
1754
- left: x1,
1755
- top: y1,
1756
- width: w,
1757
- height: h,
1758
- parent: parentDiv,
1759
- cellSelected,
1760
- lastRowOfModel: true,
1761
- gammaRange: range.gammaRange
1762
- });
1763
- }
1764
- if (areaModel.areaIdent === "header" && this.tableOptions.columnsResizable) {
1765
- this.renderHeaderCellResizeHandle({
1766
- rowIndex: range.r1,
1767
- columnIndex: range.c1,
1768
- cellLeft: x1,
1769
- cellTop: y1,
1770
- cellWidth: w,
1771
- cellHeight: h,
1772
- parent: parentDiv
1773
- });
1774
- }
1187
+ /**
1188
+ * Draws big cells (rowspan and or colspan) in body/center
1189
+ * @param range CellRange
1190
+ * @param xStart X position in pixel for top left corner
1191
+ * @param yStart Y position in pixel for top left corner
1192
+ * @param areaModel AreaModelIf
1193
+ * @param parentDiv Parent div as HTMLDivElement
1194
+ * @param sideIdent SideIdent (west,center,east)
1195
+ * @protected
1196
+ */
1197
+ drawBigCell(e, t, s, i, o, r) {
1198
+ const l = s + this.getRowHeights(0, e.r1 - 1, i).reduce((p, u) => p + u, 0), n = this.tableModel.getColumnCount(), a = this.tableModel.getFixedRightColumnCount();
1199
+ let d = 0;
1200
+ a > 0 && e.c1 >= n - a && (d = n - a);
1201
+ const S = t + this.getColumnWidths(d, e.c1 - 1).reduce((p, u) => p + u, 0), g = this.getRowHeights(e.r1, e.r2, i).reduce((p, u) => p + u, 0), f = this.getColumnWidths(e.c1, e.c2).reduce((p, u) => p + u, 0);
1202
+ let c = !1;
1203
+ const b = this.getSelectionModel ? this.getSelectionModel() : void 0;
1204
+ b && (c = b.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? (console.info("TODO here", e), this.renderCell({
1205
+ areaModel: i,
1206
+ areaIdent: i.areaIdent,
1207
+ sideIdent: r,
1208
+ rowIndex: e.r1,
1209
+ columnIndex: e.c1,
1210
+ left: S,
1211
+ top: l,
1212
+ width: f,
1213
+ height: g,
1214
+ parent: o,
1215
+ cellSelected: c,
1216
+ lastRowOfModel: !0,
1217
+ gammaRange: e.gammaRange
1218
+ })) : this.renderCell({
1219
+ areaModel: i,
1220
+ areaIdent: i.areaIdent,
1221
+ sideIdent: r,
1222
+ rowIndex: e.r1,
1223
+ columnIndex: e.c1,
1224
+ left: S,
1225
+ top: l,
1226
+ width: f,
1227
+ height: g,
1228
+ parent: o,
1229
+ cellSelected: c,
1230
+ lastRowOfModel: !0,
1231
+ gammaRange: e.gammaRange
1232
+ }), i.areaIdent === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
1233
+ rowIndex: e.r1,
1234
+ columnIndex: e.c1,
1235
+ cellLeft: S,
1236
+ cellTop: l,
1237
+ cellWidth: f,
1238
+ cellHeight: g,
1239
+ parent: o
1240
+ });
1775
1241
  }
1776
- findRowOfImportantRowspanCell(areaModel, rowIndex, colIndex) {
1777
- const maxRowspan = areaModel.getMaxRowspan();
1778
- for (let r = rowIndex - 1; r > -1; r--) {
1779
- const rowspan = areaModel.getRowspanAt(r, colIndex);
1780
- if (rowspan > 1 && r + rowspan + 1 >= rowIndex) {
1781
- return r;
1782
- }
1783
- if (rowIndex - r > maxRowspan) {
1242
+ findRowOfImportantRowspanCell(e, t, s) {
1243
+ const i = e.getMaxRowspan();
1244
+ for (let o = t - 1; o > -1; o--) {
1245
+ const r = e.getRowspanAt(o, s);
1246
+ if (r > 1 && o + r + 1 >= t)
1247
+ return o;
1248
+ if (t - o > i)
1784
1249
  return -1;
1785
- }
1786
1250
  }
1787
1251
  return -1;
1788
1252
  }
1789
- adjustColumnsToRowParent({ areaIdent, sideIdent, areaModel, geo, parent, rowIndex, columnIndexStart, columnIndexEnd, verticalFixed = false, lastRowOfModel = false }) {
1790
- var _a;
1253
+ adjustColumnsToRowParent({
1254
+ areaIdent: e,
1255
+ sideIdent: t,
1256
+ areaModel: s,
1257
+ geo: i,
1258
+ parent: o,
1259
+ rowIndex: r,
1260
+ columnIndexStart: l,
1261
+ columnIndexEnd: n,
1262
+ verticalFixed: a = !1,
1263
+ lastRowOfModel: d = !1
1264
+ }) {
1265
+ var b;
1791
1266
  this.scrollViewportLeft = this.scrollViewport.scrollLeft;
1792
- let virtualRowDivLeft = 0;
1793
- if (!verticalFixed) {
1794
- const virtualRowDivLeftF1 = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1795
- virtualRowDivLeft = this.scrollFactorX * virtualRowDivLeftF1;
1796
- }
1797
- const top = 0;
1798
- const renderSelection = !!(areaIdent === "body" && sideIdent);
1799
- let x = virtualRowDivLeft;
1800
- for (let index = columnIndexStart; index <= columnIndexEnd; index++) {
1801
- const left = x;
1802
- const w = this.tableModel.getColumnWidth(index);
1803
- if (w > 0 && left + w > 0) {
1804
- let height = geo.height;
1805
- const rowspan = areaModel.getRowspanAt(rowIndex, index);
1806
- const colspan = areaModel.getColspanAt(rowIndex, index);
1807
- if (rowspan > 1) {
1808
- height = this.getRowHeights(rowIndex, rowIndex + rowspan - 1, areaModel).reduce((a, b) => a + b, 0);
1809
- }
1810
- let width = w;
1811
- if (colspan > 1) {
1812
- width = this.getColumnWidths(index, index + colspan - 1).reduce((a, b) => a + b, 0);
1813
- }
1814
- let skip = false;
1815
- if (this.colAndRowspanModels && this.colAndRowspanModels[areaIdent]) {
1816
- if ((_a = this.colAndRowspanModels[areaIdent]) === null || _a === void 0 ? void 0 : _a.isInRange(rowIndex, index)) {
1817
- skip = true;
1818
- }
1819
- }
1820
- if (this.draggingTargetColumnIndex === index && areaIdent !== "header") {
1821
- this.renderDragTargetDiv(parent, left, top, width, height);
1822
- const geo1 = { left, top, width, height };
1823
- this.dom.addColumnBorderDivs(this.tableOptions, parent, geo1, areaIdent, sideIdent);
1267
+ let S = 0;
1268
+ if (!a) {
1269
+ const p = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
1270
+ S = this.scrollFactorX * p;
1271
+ }
1272
+ const g = 0, f = !!(e === "body" && t);
1273
+ let c = S;
1274
+ for (let p = l; p <= n; p++) {
1275
+ const u = c, x = this.tableModel.getColumnWidth(p);
1276
+ if (x > 0 && u + x > 0) {
1277
+ let v = i.height;
1278
+ const C = s.getRowspanAt(r, p), w = s.getColspanAt(r, p);
1279
+ C > 1 && (v = this.getRowHeights(r, r + C - 1, s).reduce((E, R) => E + R, 0));
1280
+ let m = x;
1281
+ w > 1 && (m = this.getColumnWidths(p, p + w - 1).reduce((E, R) => E + R, 0));
1282
+ let M = !1;
1283
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(r, p) && (M = !0), this.draggingTargetColumnIndex === p && e !== "header") {
1284
+ this.renderDragTargetDiv(o, u, g, m, v);
1285
+ const E = { left: u, top: g, width: m, height: v };
1286
+ this.dom.addColumnBorderDivs(this.tableOptions, o, E, e, t);
1824
1287
  } else {
1825
- const cellSelected = this.renderSelectedBackgroundDiv(skip, renderSelection, sideIdent, areaModel, rowIndex, index, parent, left, top, width, height);
1826
- if (!skip) {
1827
- this.renderCell({
1828
- areaModel,
1829
- areaIdent,
1830
- sideIdent,
1831
- rowIndex,
1832
- columnIndex: index,
1833
- left,
1834
- top,
1835
- width,
1836
- height,
1837
- parent,
1838
- cellSelected,
1839
- lastRowOfModel,
1840
- gammaRange: true
1841
- });
1842
- }
1843
- if (areaIdent === "header" && this.tableOptions.columnsResizable) {
1844
- this.renderHeaderCellResizeHandle({
1845
- rowIndex,
1846
- columnIndex: index,
1847
- cellLeft: left,
1848
- cellTop: top,
1849
- cellWidth: width,
1850
- cellHeight: height,
1851
- parent
1852
- });
1853
- }
1288
+ const E = this.renderSelectedBackgroundDiv(M, f, t, s, r, p, o, u, g, m, v);
1289
+ M || this.renderCell({
1290
+ areaModel: s,
1291
+ areaIdent: e,
1292
+ sideIdent: t,
1293
+ rowIndex: r,
1294
+ columnIndex: p,
1295
+ left: u,
1296
+ top: g,
1297
+ width: m,
1298
+ height: v,
1299
+ parent: o,
1300
+ cellSelected: E,
1301
+ lastRowOfModel: d,
1302
+ gammaRange: !0
1303
+ }), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
1304
+ rowIndex: r,
1305
+ columnIndex: p,
1306
+ cellLeft: u,
1307
+ cellTop: g,
1308
+ cellWidth: m,
1309
+ cellHeight: v,
1310
+ parent: o
1311
+ });
1854
1312
  }
1855
1313
  }
1856
- x = x + w;
1857
- if (x > this.areaBodyCenterGeo.width) {
1314
+ if (c = c + x, c > this.areaBodyCenterGeo.width)
1858
1315
  break;
1859
- }
1860
- }
1861
- if (this.tableOptions.verticalBorderVisible) {
1862
- this.dom.addVerticalBorder(new GeoData(x - 1, 1, geo.height, 0), parent);
1863
1316
  }
1317
+ this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(c - 1, 1, i.height, 0), o);
1864
1318
  }
1865
1319
  getTreeArrowColumnIndex() {
1866
- if (this.tableOptions.showCheckboxWihoutExtraColumn) {
1867
- return 0;
1868
- }
1869
- if (this.tableModel.isRowCheckboxVisible()) {
1870
- return 1;
1871
- }
1872
- return 0;
1873
- }
1874
- addAndRenderCellDiv({ areaModel, areaIdent, sideIdent, rowIndex, index, left, width, height, top, parent, lastRowOfModel }) {
1875
- var _a;
1876
- const editor = this.editorRenderer && this.editorRendererRow === rowIndex && this.editorRendererColumn === index;
1877
- const cellRenderer = editor ? this.editorRenderer : areaModel.getCellRenderer(rowIndex, index);
1878
- const geo = { left, width, height, top, index };
1879
- const rowObject = areaModel.getRowByIndex(rowIndex);
1880
- let treeArrow = "none";
1881
- const arrowIndexOk = index === this.getTreeArrowColumnIndex();
1882
- if (arrowIndexOk && rowObject instanceof TreeRow) {
1883
- const tr = rowObject;
1884
- if ((_a = tr.children) === null || _a === void 0 ? void 0 : _a.length) {
1885
- if (tr.expanded) {
1886
- treeArrow = "expanded";
1887
- } else {
1888
- treeArrow = "collapsed";
1889
- }
1890
- } else {
1891
- treeArrow = "hidden";
1892
- }
1893
- }
1894
- let sortState = void 0;
1895
- if (areaIdent === "header") {
1896
- const columnDef2 = this.tableModel.getColumnDef(index);
1897
- if (!(columnDef2 === null || columnDef2 === void 0 ? void 0 : columnDef2.sortIconVisible) || (columnDef2 === null || columnDef2 === void 0 ? void 0 : columnDef2.sortIconVisible())) {
1898
- sortState = columnDef2 === null || columnDef2 === void 0 ? void 0 : columnDef2.sortState;
1899
- }
1900
- }
1901
- const val = areaModel.getValueAt(rowIndex, index);
1902
- const text = cellRenderer ? "" : `${val}`;
1903
- const checkedType = areaModel.isRowChecked(rowIndex);
1904
- const cell = this.dom.addColumnDiv(parent, geo, rowIndex, index, areaIdent, sideIdent, text, treeArrow, this.tableOptions, checkedType, sortState);
1905
- const tooltip = areaModel.getTooltipAt(rowIndex, index);
1906
- if (tooltip) {
1907
- this.dom.setAttribute(cell, "title", tooltip);
1908
- }
1909
- const columnDef = this.tableModel.getColumnDef(index);
1910
- if (columnDef && columnDef.classes[areaIdent]) {
1911
- this.dom.addClasses(columnDef.classes[areaIdent], cell);
1912
- }
1913
- let fn = void 0;
1914
- if (cellRenderer) {
1915
- fn = cellRenderer.render(cell, rowIndex, index, areaIdent, areaModel, val, this.dom.domService);
1916
- }
1917
- const classes = areaModel.getCustomClassesAt(rowIndex, index);
1918
- if (classes.length) {
1919
- this.dom.addClasses(classes, cell);
1920
- }
1921
- this.dom.addColumnBorderDivs(this.tableOptions, parent, geo, areaIdent, sideIdent);
1922
- if (lastRowOfModel) {
1923
- this.dom.addHorizontalBorder({ left, width, height, top: top + height }, parent);
1924
- }
1925
- if (this.getFocusModel && areaIdent === "body") {
1926
- const fm = this.getFocusModel();
1927
- if (fm === null || fm === void 0 ? void 0 : fm.hasFocus(rowIndex, index)) {
1928
- this.dom.addFocusBorderDivs(parent, geo, {});
1929
- }
1930
- }
1931
- if (areaIdent === "header") {
1932
- this.dom.setAttribute(cell, "data-ge-action", "drag-column");
1933
- }
1934
- const styles = areaModel.getCustomStyleAt(rowIndex, index);
1935
- if (styles) {
1936
- for (const css in styles) {
1937
- this.dom.setStyle(cell, css, styles[css]);
1938
- }
1939
- }
1940
- return [cell, fn];
1941
- }
1942
- getColumnWidths(startIndex, endIndex) {
1943
- const ret = [];
1944
- for (let i = startIndex; i <= endIndex; i++) {
1945
- ret.push(this.tableModel.getColumnWidth(i));
1946
- }
1947
- return ret;
1948
- }
1949
- getRowHeights(startIndex, endIndex, areaModel) {
1950
- const ret = [];
1951
- for (let i = startIndex; i <= endIndex; i++) {
1952
- ret.push(areaModel.getRowHeight(i));
1953
- }
1954
- return ret;
1955
- }
1956
- adjustHoverRows(mouseMoveEvent) {
1957
- if (this.tableOptions.hoverRowVisible && mouseMoveEvent.rowIndex > -1) {
1958
- const width = this.hostElement.clientWidth;
1959
- const rowHeight = this.tableModel.getAreaModel("body").getRowHeight(mouseMoveEvent.rowIndex);
1960
- const top = mouseMoveEvent.rowTop + this.areaHeaderCenter.parent.clientHeight - this.scrollTop;
1320
+ return this.tableOptions.showCheckboxWihoutExtraColumn ? 0 : this.tableModel.isRowCheckboxVisible() ? 1 : 0;
1321
+ }
1322
+ addAndRenderCellDiv({
1323
+ areaModel: e,
1324
+ areaIdent: t,
1325
+ sideIdent: s,
1326
+ rowIndex: i,
1327
+ index: o,
1328
+ left: r,
1329
+ width: l,
1330
+ height: n,
1331
+ top: a,
1332
+ parent: d,
1333
+ lastRowOfModel: S
1334
+ }) {
1335
+ var V;
1336
+ const f = this.editorRenderer && this.editorRendererRow === i && this.editorRendererColumn === o ? this.editorRenderer : e.getCellRenderer(i, o), c = { left: r, width: l, height: n, top: a, index: o }, b = e.getRowByIndex(i);
1337
+ let p = "none";
1338
+ if (o === this.getTreeArrowColumnIndex() && b instanceof O) {
1339
+ const y = b;
1340
+ (V = y.children) != null && V.length ? y.expanded ? p = "expanded" : p = "collapsed" : p = "hidden";
1341
+ }
1342
+ let x;
1343
+ if (t === "header") {
1344
+ const y = this.tableModel.getColumnDef(o);
1345
+ (!(y != null && y.sortIconVisible) || y != null && y.sortIconVisible()) && (x = y == null ? void 0 : y.sortState);
1346
+ }
1347
+ const v = e.getValueAt(i, o), C = f ? "" : `${v}`, w = e.isRowChecked(i), m = this.dom.addColumnDiv(
1348
+ d,
1349
+ c,
1350
+ i,
1351
+ o,
1352
+ t,
1353
+ s,
1354
+ C,
1355
+ p,
1356
+ this.tableOptions,
1357
+ w,
1358
+ x
1359
+ ), M = e.getTooltipAt(i, o);
1360
+ M && this.dom.setAttribute(m, "title", M);
1361
+ const E = this.tableModel.getColumnDef(o);
1362
+ E && E.classes[t] && this.dom.addClasses(E.classes[t], m);
1363
+ let R;
1364
+ f && (R = f.render(m, i, o, t, e, v, this.dom.domService));
1365
+ const D = e.getCustomClassesAt(i, o);
1366
+ if (D.length && this.dom.addClasses(D, m), this.dom.addColumnBorderDivs(this.tableOptions, d, c, t, s), S && this.dom.addHorizontalBorder({ left: r, width: l, height: n, top: a + n }, d), this.getFocusModel && t === "body") {
1367
+ const y = this.getFocusModel();
1368
+ y != null && y.hasFocus(i, o) && this.dom.addFocusBorderDivs(d, c, {});
1369
+ }
1370
+ t === "header" && this.dom.setAttribute(m, "data-ge-action", "drag-column");
1371
+ const F = e.getCustomStyleAt(i, o);
1372
+ if (F)
1373
+ for (const y in F)
1374
+ this.dom.setStyle(m, y, F[y]);
1375
+ return [m, R];
1376
+ }
1377
+ getColumnWidths(e, t) {
1378
+ const s = [];
1379
+ for (let i = e; i <= t; i++)
1380
+ s.push(this.tableModel.getColumnWidth(i));
1381
+ return s;
1382
+ }
1383
+ getRowHeights(e, t, s) {
1384
+ const i = [];
1385
+ for (let o = e; o <= t; o++)
1386
+ i.push(s.getRowHeight(o));
1387
+ return i;
1388
+ }
1389
+ adjustHoverRows(e) {
1390
+ if (this.tableOptions.hoverRowVisible && e.rowIndex > -1) {
1391
+ const t = this.hostElement.clientWidth, s = this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex), i = e.rowTop + this.areaHeaderCenter.parent.clientHeight - this.scrollTop;
1961
1392
  this.dom.applyStyle(this.hoverRow, {
1962
- "left": "0",
1963
- "top": top + "px",
1964
- "width": width + "px",
1965
- "height": rowHeight + "px",
1966
- "display": "block"
1393
+ left: "0",
1394
+ top: i + "px",
1395
+ width: t + "px",
1396
+ height: s + "px",
1397
+ display: "block"
1967
1398
  });
1968
- } else {
1399
+ } else
1969
1400
  this.hideHoverRow();
1970
- }
1971
1401
  }
1972
1402
  hideHoverRow() {
1973
1403
  this.dom.applyStyle(this.hoverRow, {
1974
- "display": "none"
1404
+ display: "none"
1975
1405
  });
1976
1406
  }
1977
- adjustHoverColumns(mouseMoveEvent) {
1978
- if (this.tableOptions.hoverColumnVisible && mouseMoveEvent.rowIndex > -1) {
1979
- const height = this.hostElement.clientHeight;
1980
- const width = this.tableModel.getColumnWidth(mouseMoveEvent.columnIndex);
1981
- const fixedWest = this.areaBodyWestGeo.width;
1982
- const left = mouseMoveEvent.columnLeft + this.tableModel.getPadding().left - this.scrollLeft - fixedWest;
1407
+ adjustHoverColumns(e) {
1408
+ if (this.tableOptions.hoverColumnVisible && e.rowIndex > -1) {
1409
+ const t = this.hostElement.clientHeight, s = this.tableModel.getColumnWidth(e.columnIndex), i = this.areaBodyWestGeo.width, o = e.columnLeft + this.tableModel.getPadding().left - this.scrollLeft - i;
1983
1410
  this.dom.applyStyle(this.hoverColumn, {
1984
- "left": left + "px",
1985
- "top": "0px",
1986
- "width": width + "px",
1987
- "height": height + "px",
1988
- "display": "block"
1411
+ left: o + "px",
1412
+ top: "0px",
1413
+ width: s + "px",
1414
+ height: t + "px",
1415
+ display: "block"
1989
1416
  });
1990
- } else {
1417
+ } else
1991
1418
  this.hideHoverColumn();
1992
- }
1993
1419
  }
1994
1420
  hideHoverColumn() {
1995
1421
  this.dom.applyStyle(this.hoverColumn, {
1996
- "display": "none"
1422
+ display: "none"
1997
1423
  });
1998
1424
  }
1999
- debounce(fn, delay = 1e3) {
2000
- if (this.debounceTimeout) {
2001
- clearTimeout(this.debounceTimeout);
2002
- }
2003
- this.debounceTimeout = setTimeout(fn.bind(this), delay);
2004
- }
2005
- renderDragTargetDiv(parent, left, top, width, height) {
2006
- const div = this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone", parent));
2007
- this.dom.setStyle(div, "left", `${left}px`);
2008
- this.dom.setStyle(div, "top", `${top}px`);
2009
- this.dom.setStyle(div, "width", `${width}px`);
2010
- this.dom.setStyle(div, "height", `${height}px`);
2011
- return div;
2012
- }
2013
- renderSelectedBackgroundDiv(skip, renderSelection, sideIdent, areaModel, rowIndex, index, parent, left, top, width, height) {
2014
- let cellSelected = false;
2015
- if (!skip && renderSelection && areaModel.isSelectable(rowIndex, index)) {
2016
- if (this.getSelectionModel) {
2017
- const selectionModel2 = this.getSelectionModel();
2018
- if (selectionModel2) {
2019
- const count = selectionModel2.getSelectionCount(rowIndex, index);
2020
- cellSelected = count > 0;
2021
- for (let i = 0; i < count; i++) {
2022
- const div = this.dom.applyStylePosistionAbsolute(
2023
- this.dom.createDivWithClass(`ge-table-${areaModel.areaIdent}-${sideIdent}-selected-range`, parent)
2024
- );
2025
- this.dom.setStyle(div, "left", `${left}px`);
2026
- this.dom.setStyle(div, "top", `${top}px`);
2027
- this.dom.setStyle(div, "width", `${width}px`);
2028
- this.dom.setStyle(div, "height", `${height}px`);
2029
- }
1425
+ debounce(e, t = 1e3) {
1426
+ this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(e.bind(this), t);
1427
+ }
1428
+ renderDragTargetDiv(e, t, s, i, o) {
1429
+ const r = this.dom.applyStylePosistionAbsolute(
1430
+ this.dom.createDivWithClass("ge-table-drop-zone", e)
1431
+ );
1432
+ return this.dom.setStyle(r, "left", `${t}px`), this.dom.setStyle(r, "top", `${s}px`), this.dom.setStyle(r, "width", `${i}px`), this.dom.setStyle(r, "height", `${o}px`), r;
1433
+ }
1434
+ renderSelectedBackgroundDiv(e, t, s, i, o, r, l, n, a, d, S) {
1435
+ let g = !1;
1436
+ if (!e && t && i.isSelectable(o, r) && this.getSelectionModel) {
1437
+ const f = this.getSelectionModel();
1438
+ if (f) {
1439
+ const c = f.getSelectionCount(o, r);
1440
+ g = c > 0;
1441
+ for (let b = 0; b < c; b++) {
1442
+ const p = this.dom.applyStylePosistionAbsolute(
1443
+ // ge-table-body-west-selected-range
1444
+ this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`, l)
1445
+ );
1446
+ this.dom.setStyle(p, "left", `${n}px`), this.dom.setStyle(p, "top", `${a}px`), this.dom.setStyle(p, "width", `${d}px`), this.dom.setStyle(p, "height", `${S}px`);
2030
1447
  }
2031
1448
  }
2032
1449
  }
2033
- return cellSelected;
2034
- }
2035
- renderCell({ areaModel, areaIdent, sideIdent, rowIndex, columnIndex, left, top, width, height, parent, cellSelected, lastRowOfModel, gammaRange }) {
2036
- const [div, fn] = this.addAndRenderCellDiv({
2037
- areaModel,
2038
- areaIdent,
2039
- sideIdent,
2040
- rowIndex,
2041
- index: columnIndex,
2042
- left,
2043
- width,
2044
- height,
2045
- top,
2046
- parent,
2047
- lastRowOfModel,
2048
- gammaRange
1450
+ return g;
1451
+ }
1452
+ renderCell({
1453
+ areaModel: e,
1454
+ areaIdent: t,
1455
+ sideIdent: s,
1456
+ rowIndex: i,
1457
+ columnIndex: o,
1458
+ left: r,
1459
+ top: l,
1460
+ width: n,
1461
+ height: a,
1462
+ parent: d,
1463
+ cellSelected: S,
1464
+ lastRowOfModel: g,
1465
+ gammaRange: f
1466
+ }) {
1467
+ const [c, b] = this.addAndRenderCellDiv({
1468
+ areaModel: e,
1469
+ areaIdent: t,
1470
+ sideIdent: s,
1471
+ rowIndex: i,
1472
+ index: o,
1473
+ left: r,
1474
+ width: n,
1475
+ height: a,
1476
+ top: l,
1477
+ parent: d,
1478
+ lastRowOfModel: g,
1479
+ gammaRange: f
2049
1480
  });
2050
- if (cellSelected) {
2051
- this.dom.addClass(`ge-table-${areaIdent}-${sideIdent}-selected-range`, div);
2052
- }
2053
- if (fn) {
2054
- this.cleanupFunctions[areaIdent].push(fn);
2055
- }
1481
+ S && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, c), b && this.cleanupFunctions[t].push(b);
2056
1482
  }
2057
- renderHeaderCellResizeHandle({ rowIndex, columnIndex, cellLeft, cellTop, cellWidth, cellHeight, parent }) {
2058
- var _a;
2059
- const domService = this.dom.domService;
2060
- const handleWidth = (_a = this.tableOptions.columnResizeHandleWidthInPx) !== null && _a !== void 0 ? _a : 2;
2061
- const div = domService.createElement("div");
2062
- domService.setAttribute(div, "data-col-index", `${columnIndex}`);
2063
- domService.setAttribute(div, "data-row-index", `${rowIndex}`);
2064
- domService.setAttribute(div, "data-area", "header");
2065
- domService.setAttribute(div, "data-ge-action", "resize-column");
2066
- domService.addClass(div, `ge-table-column-resize-handle`);
2067
- domService.setStyle(div, "display", "clip");
2068
- domService.setStyle(div, "position", "absolute");
2069
- domService.setStyle(div, "cursor", "col-resize");
2070
- domService.setStyle(div, "left", `${cellLeft + cellWidth - handleWidth}px`);
2071
- domService.setStyle(div, "top", `${cellTop}px`);
2072
- domService.setStyle(div, "width", `${handleWidth}px`);
2073
- domService.setStyle(div, "height", `${cellHeight}px`);
2074
- domService.appendChild(parent, div);
1483
+ renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: s, cellTop: i, cellWidth: o, cellHeight: r, parent: l }) {
1484
+ const n = this.dom.domService, a = this.tableOptions.columnResizeHandleWidthInPx ?? 2, d = n.createElement("div");
1485
+ n.setAttribute(d, "data-col-index", `${t}`), n.setAttribute(d, "data-row-index", `${e}`), n.setAttribute(d, "data-area", "header"), n.setAttribute(d, "data-ge-action", "resize-column"), n.addClass(d, "ge-table-column-resize-handle"), n.setStyle(d, "display", "clip"), n.setStyle(d, "position", "absolute"), n.setStyle(d, "cursor", "col-resize"), n.setStyle(d, "left", `${s + o - a}px`), n.setStyle(d, "top", `${i}px`), n.setStyle(d, "width", `${a}px`), n.setStyle(d, "height", `${r}px`), n.appendChild(l, d);
2075
1486
  }
2076
1487
  }
2077
- class SortItem {
2078
- constructor(columnIndex, sortState) {
2079
- this.columnIndex = columnIndex;
2080
- this.sortState = sortState;
1488
+ class de {
1489
+ constructor(e, t) {
1490
+ this.columnIndex = e, this.sortState = t;
2081
1491
  }
2082
1492
  }
2083
- class InputHandler {
2084
- constructor(tableScope) {
2085
- this.tableScope = tableScope;
2086
- this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
2087
- }
2088
- onHostElementChanged(event) {
2089
- if (event.target instanceof HTMLInputElement || event.target instanceof HTMLSelectElement || event.target instanceof HTMLTextAreaElement) {
2090
- const htmpInputEle = event.target;
2091
- const areaIdentStr = htmpInputEle.getAttribute("data-area");
2092
- const rowIndexStr = htmpInputEle.getAttribute("data-row-index");
2093
- const columnIndexStr = htmpInputEle.getAttribute("data-col-index");
2094
- if (areaIdentStr && rowIndexStr && columnIndexStr) {
2095
- const area = getAreaIdentByString(areaIdentStr);
2096
- const rowIndex = Number(rowIndexStr);
2097
- const columnIndex = Number(columnIndexStr);
2098
- this.tableScope.updateModelValueAfterEdit(area, rowIndex, columnIndex, htmpInputEle.value);
1493
+ class he {
1494
+ constructor(e) {
1495
+ this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
1496
+ }
1497
+ onHostElementChanged(e) {
1498
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
1499
+ const t = e.target, s = t.getAttribute("data-area"), i = t.getAttribute("data-row-index"), o = t.getAttribute("data-col-index");
1500
+ if (s && i && o) {
1501
+ const r = $(s), l = Number(i), n = Number(o);
1502
+ this.tableScope.updateModelValueAfterEdit(r, l, n, t.value);
2099
1503
  }
2100
1504
  }
2101
1505
  }
2102
1506
  }
2103
- class GeCellIndices {
2104
- constructor(rowIndex = -1, columnIndex = -1) {
2105
- this.rowIndex = rowIndex;
2106
- this.columnIndex = columnIndex;
1507
+ class ce {
1508
+ constructor(e = -1, t = -1) {
1509
+ this.rowIndex = e, this.columnIndex = t;
2107
1510
  }
2108
1511
  }
2109
- class GeModelChangeEvent {
2110
- constructor(cells) {
2111
- this.cells = cells;
1512
+ class _ {
1513
+ constructor(e) {
1514
+ this.cells = e;
2112
1515
  }
2113
- static createSingle(rowIndex, columnIndex) {
2114
- return new GeModelChangeEvent([new GeCellIndices(rowIndex, columnIndex)]);
1516
+ static createSingle(e, t) {
1517
+ return new _([new ce(e, t)]);
2115
1518
  }
2116
1519
  }
2117
- class SelectionService {
2118
- constructor(tableScope) {
2119
- var _a, _b;
2120
- this.tableScope = tableScope;
2121
- if ((_a = this.tableScope.tableOptions) === null || _a === void 0 ? void 0 : _a.getSelectionModel) {
2122
- this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel;
2123
- }
2124
- if ((_b = this.tableScope.tableOptions) === null || _b === void 0 ? void 0 : _b.getFocusModel) {
2125
- this.getFocusModel = this.tableScope.tableOptions.getFocusModel;
2126
- }
2127
- }
2128
- onMouseClicked(evt, _previousEvt) {
2129
- var _a, _b, _c, _d, _e, _f, _g;
2130
- let dirty = false;
2131
- let deletePreviousEvent = false;
1520
+ class pe {
1521
+ constructor(e) {
1522
+ var t, s;
1523
+ this.tableScope = e, (t = this.tableScope.tableOptions) != null && t.getSelectionModel && (this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel), (s = this.tableScope.tableOptions) != null && s.getFocusModel && (this.getFocusModel = this.tableScope.tableOptions.getFocusModel);
1524
+ }
1525
+ onMouseClicked(e, t) {
1526
+ var o, r, l, n, a, d, S;
1527
+ let s = !1, i = !1;
2132
1528
  if (this.getSelectionModel && this.getFocusModel) {
2133
- const sm = this.getSelectionModel();
2134
- const fm = this.getFocusModel();
2135
- if (sm && fm) {
2136
- if (!fm.hasFocus(evt.rowIndex, evt.columnIndex)) {
2137
- fm.setFocus(evt.rowIndex, evt.columnIndex);
2138
- dirty = true;
2139
- }
2140
- if (!((_a = evt.originalEvent) === null || _a === void 0 ? void 0 : _a.shiftKey)) {
2141
- if (sm.hasSelection()) {
2142
- sm.clear();
2143
- dirty = true;
2144
- }
2145
- }
2146
- if (((_b = evt.originalEvent) === null || _b === void 0 ? void 0 : _b.shiftKey) && this.previousEvt) {
2147
- sm.addSelection(this.createRangeByEvents(evt, this.previousEvt));
2148
- deletePreviousEvent = true;
2149
- dirty = true;
2150
- } else if (((_c = evt.originalEvent) === null || _c === void 0 ? void 0 : _c.ctrlKey) || ((_d = evt.originalEvent) === null || _d === void 0 ? void 0 : _d.metaKey)) {
2151
- sm.addSelection(CellRange.singleCell(evt.rowIndex, evt.columnIndex));
2152
- deletePreviousEvent = true;
2153
- dirty = true;
2154
- } else if (((_e = evt.originalEvent) === null || _e === void 0 ? void 0 : _e.altKey) && (((_f = evt.originalEvent) === null || _f === void 0 ? void 0 : _f.ctrlKey) || ((_g = evt.originalEvent) === null || _g === void 0 ? void 0 : _g.metaKey))) {
2155
- sm.removeSelection(CellRange.singleCell(evt.rowIndex, evt.columnIndex));
2156
- deletePreviousEvent = true;
2157
- dirty = true;
2158
- }
2159
- }
1529
+ const g = this.getSelectionModel(), f = this.getFocusModel();
1530
+ g && f && (f.hasFocus(e.rowIndex, e.columnIndex) || (f.setFocus(e.rowIndex, e.columnIndex), s = !0), (o = e.originalEvent) != null && o.shiftKey || g.hasSelection() && (g.clear(), s = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (g.addSelection(this.createRangeByEvents(e, this.previousEvt)), i = !0, s = !0) : (l = e.originalEvent) != null && l.ctrlKey || (n = e.originalEvent) != null && n.metaKey ? (g.addSelection(A.singleCell(e.rowIndex, e.columnIndex)), i = !0, s = !0) : (a = e.originalEvent) != null && a.altKey && ((d = e.originalEvent) != null && d.ctrlKey || (S = e.originalEvent) != null && S.metaKey) && (g.removeSelection(A.singleCell(e.rowIndex, e.columnIndex)), i = !0, s = !0));
2160
1531
  }
2161
- if (deletePreviousEvent) {
2162
- this.previousEvt = void 0;
2163
- } else {
2164
- this.previousEvt = evt === null || evt === void 0 ? void 0 : evt.clone();
2165
- }
2166
- return dirty;
1532
+ return i ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
2167
1533
  }
2168
- onActionTriggered(actionId) {
1534
+ onActionTriggered(e) {
2169
1535
  if (this.getSelectionModel && this.getFocusModel) {
2170
- const sm = this.getSelectionModel();
2171
- const fm = this.getFocusModel();
2172
- if (sm && fm) {
2173
- if (actionId === "SELECT_ALL") {
2174
- sm.selectAll();
2175
- this.tableScope.repaint();
2176
- return true;
2177
- }
2178
- if (actionId === "DESELECT_ALL") {
2179
- sm.clear();
2180
- this.tableScope.repaint();
2181
- return true;
2182
- }
2183
- if (actionId === "TOGGLE_SELECTION") {
2184
- const [row, col] = fm.getFocus();
2185
- sm.togglePoint(row, col);
2186
- this.tableScope.repaint();
2187
- return true;
1536
+ const t = this.getSelectionModel(), s = this.getFocusModel();
1537
+ if (t && s) {
1538
+ if (e === "SELECT_ALL")
1539
+ return t.selectAll(), this.tableScope.repaint(), !0;
1540
+ if (e === "DESELECT_ALL")
1541
+ return t.clear(), this.tableScope.repaint(), !0;
1542
+ if (e === "TOGGLE_SELECTION") {
1543
+ const [i, o] = s.getFocus();
1544
+ return t.togglePoint(i, o), this.tableScope.repaint(), !0;
2188
1545
  }
2189
1546
  }
2190
1547
  }
2191
- return false;
1548
+ return !1;
2192
1549
  }
2193
- createRangeByEvents(evt, previousEvt) {
2194
- if (!previousEvt) {
2195
- previousEvt = evt;
2196
- }
2197
- const r1 = Math.min(evt.rowIndex, previousEvt === null || previousEvt === void 0 ? void 0 : previousEvt.rowIndex);
2198
- const r2 = Math.max(evt.rowIndex, previousEvt === null || previousEvt === void 0 ? void 0 : previousEvt.rowIndex);
2199
- const c1 = Math.min(evt.columnIndex, previousEvt === null || previousEvt === void 0 ? void 0 : previousEvt.columnIndex);
2200
- const c2 = Math.max(evt.columnIndex, previousEvt === null || previousEvt === void 0 ? void 0 : previousEvt.columnIndex);
2201
- return CellRange.create({
2202
- rowIndex1: r1,
2203
- columnIndex1: c1,
2204
- rowIndex2: r2,
2205
- columnIndex2: c2
1550
+ createRangeByEvents(e, t) {
1551
+ t || (t = e);
1552
+ const s = Math.min(e.rowIndex, t == null ? void 0 : t.rowIndex), i = Math.max(e.rowIndex, t == null ? void 0 : t.rowIndex), o = Math.min(e.columnIndex, t == null ? void 0 : t.columnIndex), r = Math.max(e.columnIndex, t == null ? void 0 : t.columnIndex);
1553
+ return A.create({
1554
+ rowIndex1: s,
1555
+ columnIndex1: o,
1556
+ rowIndex2: i,
1557
+ columnIndex2: r
2206
1558
  });
2207
1559
  }
2208
1560
  }
2209
- class WindowsShortcutActionIdMapping {
1561
+ class ue {
2210
1562
  get() {
2211
1563
  return {
2212
- "f2": "START_EDITING",
2213
- "space": "TOGGLE_SELECTION",
1564
+ f2: "START_EDITING",
1565
+ space: "TOGGLE_SELECTION",
2214
1566
  "ctrl+num_add": "SELECT_ALL",
2215
1567
  "ctrl+a": "SELECT_ALL",
2216
1568
  "ctrl+shift+a": "DESELECT_ALL",
2217
1569
  "ctrl+x": "DESELECT_ALL",
2218
1570
  "ctrl+num_subtract": "DESELECT_ALL",
2219
1571
  "cmd -": "DESELECT_ALL",
2220
- "arrowup": "NAVIGATE_UP",
2221
- "arrowdown": "NAVIGATE_DOWN",
2222
- "arrowleft": "NAVIGATE_LEFT",
2223
- "arrowright": "NAVIGATE_RIGHT"
1572
+ arrowup: "NAVIGATE_UP",
1573
+ arrowdown: "NAVIGATE_DOWN",
1574
+ arrowleft: "NAVIGATE_LEFT",
1575
+ arrowright: "NAVIGATE_RIGHT"
2224
1576
  };
2225
1577
  }
2226
1578
  }
2227
- class OsxShortcutActionIdMapping {
1579
+ class Se {
2228
1580
  get() {
2229
1581
  return {
2230
- "f2": "START_EDITING",
2231
- "space": "TOGGLE_SELECTION",
1582
+ f2: "START_EDITING",
1583
+ space: "TOGGLE_SELECTION",
2232
1584
  "ctrl+num_add": "SELECT_ALL",
2233
1585
  "cmd+a": "SELECT_ALL",
2234
1586
  "ctrl+a": "SELECT_ALL",
@@ -2237,37 +1589,22 @@ class OsxShortcutActionIdMapping {
2237
1589
  "ctrl+shift+a": "DESELECT_ALL",
2238
1590
  "ctrl+num_subtract": "DESELECT_ALL",
2239
1591
  "ctrl -": "DESELECT_ALL",
2240
- "arrowup": "NAVIGATE_UP",
2241
- "arrowdown": "NAVIGATE_DOWN",
2242
- "arrowleft": "NAVIGATE_LEFT",
2243
- "arrowright": "NAVIGATE_RIGHT"
1592
+ arrowup: "NAVIGATE_UP",
1593
+ arrowdown: "NAVIGATE_DOWN",
1594
+ arrowleft: "NAVIGATE_LEFT",
1595
+ arrowright: "NAVIGATE_RIGHT"
2244
1596
  };
2245
1597
  }
2246
1598
  }
2247
- class ShortcutService {
2248
- constructor(tableScope) {
2249
- this.tableScope = tableScope;
2250
- this.shortcutActionIdMapping = {};
2251
- this.listener = [];
2252
- this.listener.push(tableScope);
2253
- this.init();
2254
- }
2255
- addListener(listener) {
2256
- if (!this.listener.includes(listener)) {
2257
- this.listener.push(listener);
2258
- }
1599
+ class ge {
1600
+ constructor(e) {
1601
+ this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
1602
+ }
1603
+ addListener(e) {
1604
+ this.listener.includes(e) || this.listener.push(e);
2259
1605
  }
2260
1606
  init() {
2261
- if (this.isMacintosh()) {
2262
- Object.assign(this.shortcutActionIdMapping, new OsxShortcutActionIdMapping().get());
2263
- } else {
2264
- Object.assign(this.shortcutActionIdMapping, new WindowsShortcutActionIdMapping().get());
2265
- }
2266
- Object.assign(this.shortcutActionIdMapping, this.tableScope.tableOptions.shortcutActionIdMapping);
2267
- if (this.isDebug()) {
2268
- console.debug("ShortcutService", this.shortcutActionIdMapping);
2269
- }
2270
- this.tableScope.hostElement.addEventListener("keydown", this.onKeyDown.bind(this));
1607
+ this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new Se().get()) : Object.assign(this.shortcutActionIdMapping, new ue().get()), Object.assign(this.shortcutActionIdMapping, this.tableScope.tableOptions.shortcutActionIdMapping), this.isDebug() && console.debug("ShortcutService", this.shortcutActionIdMapping), this.tableScope.hostElement.addEventListener("keydown", this.onKeyDown.bind(this));
2271
1608
  }
2272
1609
  isMacintosh() {
2273
1610
  return navigator.platform.indexOf("Mac") > -1;
@@ -2278,657 +1615,353 @@ class ShortcutService {
2278
1615
  isLocalhost() {
2279
1616
  return location.hostname === "localhost" || location.hostname === "127.0.0.1";
2280
1617
  }
2281
- onKeyDown(evt) {
2282
- const actionId = this.findEnty(evt);
2283
- if (actionId) {
2284
- const consumed = this.emit(actionId);
2285
- if (consumed) {
2286
- evt.preventDefault();
2287
- evt.stopPropagation();
2288
- }
2289
- }
2290
- }
2291
- emit(actionId) {
2292
- if (this.isDebug()) {
2293
- console.debug("ShortcutService emit:", actionId);
2294
- }
2295
- let ret = false;
2296
- for (const l of this.listener) {
2297
- const consumed = l.onActionTriggered(actionId);
2298
- if (consumed) {
2299
- ret = true;
2300
- }
2301
- }
2302
- return ret;
2303
- }
2304
- findEnty(evt) {
2305
- const tokens = this.getTokenByEvent(evt);
2306
- if (this.isDebug()) {
2307
- console.debug("ShortcutService tokens:", tokens);
2308
- }
2309
- for (const key in this.shortcutActionIdMapping) {
2310
- const shortcutTokens = key.replace(/opt/g, "alt").replace(/cmd/g, "meta").split(/[\+ ]/g).sort();
2311
- if (this.areTokensEquals(tokens, shortcutTokens)) {
2312
- return this.shortcutActionIdMapping[key];
2313
- }
2314
- }
2315
- return void 0;
2316
- }
2317
- areTokensEquals(tokens1, tokens2) {
2318
- if (tokens1.length !== tokens2.length) {
2319
- return false;
2320
- }
2321
- if (tokens1.length === 0) {
2322
- return false;
2323
- }
2324
- for (let i = 0; i < tokens1.length; i++) {
2325
- if (tokens1[i] !== tokens2[i]) {
2326
- return false;
2327
- }
2328
- }
2329
- return true;
2330
- }
2331
- getTokenByEvent(evt) {
2332
- const tokens = [];
2333
- if (evt.altKey) {
2334
- tokens.push("alt");
2335
- }
2336
- if (evt.shiftKey) {
2337
- tokens.push("shift");
2338
- }
2339
- if (evt.ctrlKey) {
2340
- tokens.push("ctrl");
2341
- }
2342
- if (evt.metaKey) {
2343
- tokens.push("meta");
2344
- }
2345
- if (evt.code) {
2346
- tokens.push(evt.code.toLowerCase().replace(/key/g, ""));
2347
- }
2348
- return tokens.sort();
1618
+ onKeyDown(e) {
1619
+ const t = this.findEnty(e);
1620
+ t && this.emit(t) && (e.preventDefault(), e.stopPropagation());
1621
+ }
1622
+ emit(e) {
1623
+ this.isDebug() && console.debug("ShortcutService emit:", e);
1624
+ let t = !1;
1625
+ for (const s of this.listener)
1626
+ s.onActionTriggered(e) && (t = !0);
1627
+ return t;
1628
+ }
1629
+ findEnty(e) {
1630
+ const t = this.getTokenByEvent(e);
1631
+ this.isDebug() && console.debug("ShortcutService tokens:", t);
1632
+ for (const s in this.shortcutActionIdMapping) {
1633
+ const i = s.replace(/opt/g, "alt").replace(/cmd/g, "meta").split(/[\+ ]/g).sort();
1634
+ if (this.areTokensEquals(t, i))
1635
+ return this.shortcutActionIdMapping[s];
1636
+ }
1637
+ }
1638
+ areTokensEquals(e, t) {
1639
+ if (e.length !== t.length || e.length === 0)
1640
+ return !1;
1641
+ for (let s = 0; s < e.length; s++)
1642
+ if (e[s] !== t[s])
1643
+ return !1;
1644
+ return !0;
1645
+ }
1646
+ getTokenByEvent(e) {
1647
+ const t = [];
1648
+ return e.altKey && t.push("alt"), e.shiftKey && t.push("shift"), e.ctrlKey && t.push("ctrl"), e.metaKey && t.push("meta"), e.code && t.push(e.code.toLowerCase().replace(/key/g, "")), t.sort();
2349
1649
  }
2350
1650
  }
2351
- class EventAdapter {
2352
- onCheckboxChanged(_evt) {
1651
+ class fe {
1652
+ onCheckboxChanged(e) {
2353
1653
  }
2354
- onContextmenu(_evt) {
1654
+ onContextmenu(e) {
2355
1655
  }
2356
- onModelChanged(_evt) {
1656
+ onModelChanged(e) {
2357
1657
  }
2358
- onMouseClicked(_evt) {
1658
+ onMouseClicked(e) {
2359
1659
  }
2360
- onMouseDragging(_evt) {
1660
+ onMouseDragging(e) {
2361
1661
  }
2362
- onMouseDraggingEnd(_evt) {
1662
+ onMouseDraggingEnd(e) {
2363
1663
  }
2364
- onMouseMoved(_evt) {
1664
+ onMouseMoved(e) {
2365
1665
  }
2366
1666
  }
2367
- class TableScope extends RenderScope {
2368
- constructor(hostElement, tableModel, domService, tableOptions, eventListener) {
2369
- var _a;
2370
- super(hostElement, tableModel, new ConvenienceDomService(domService), tableOptions);
2371
- this.eventListener = eventListener;
2372
- this.selectionService = new SelectionService(this);
2373
- this.api = new TableApi(this);
2374
- this.mouseStartAction = "";
2375
- this.mouseStartWidth = -1;
2376
- this.mouseStartColumnIndex = -1;
2377
- this.dragFrom = -1;
2378
- this.dragTo = -1;
2379
- if (!eventListener) {
2380
- this.eventListener = new EventAdapter();
2381
- }
2382
- if ((_a = this.tableOptions) === null || _a === void 0 ? void 0 : _a.autoRestoreOptions) {
2383
- const autoRestoreOptions = this.tableOptions.autoRestoreOptions;
2384
- const keyFn = autoRestoreOptions.getStorageKeyFn;
2385
- if (keyFn) {
2386
- if (autoRestoreOptions.autoRestoreScrollPosition) {
2387
- this.storeScrollPosStateService = new StoreStateScrollPosService(keyFn);
2388
- }
2389
- if (autoRestoreOptions.autoRestoreCollapsedExpandedState) {
2390
- this.storeStateCollapsedExpandService = new StoreStateCollapsedExpandService(keyFn);
2391
- }
2392
- if (autoRestoreOptions.autoRestoreSortingState) {
2393
- this.storeSortingService = new StoreStateSortingService(keyFn);
2394
- }
2395
- }
2396
- }
2397
- this.mouseHandler = new MouseHandler(this);
2398
- this.inputHandler = new InputHandler(this);
2399
- this.shortcutService = new ShortcutService(this);
2400
- this.shortcutService.addListener(this.selectionService);
2401
- }
2402
- onActionTriggered(actionId) {
2403
- if (actionId === "NAVIGATE_DOWN") {
2404
- if (this.changeFocusCell(0, 1)) {
2405
- return true;
2406
- }
2407
- }
2408
- if (actionId === "NAVIGATE_UP") {
2409
- if (this.changeFocusCell(0, -1)) {
2410
- return true;
2411
- }
2412
- }
2413
- if (actionId === "NAVIGATE_LEFT") {
2414
- if (this.changeFocusCell(-1, 0)) {
2415
- return true;
2416
- }
2417
- }
2418
- if (actionId === "NAVIGATE_RIGHT") {
2419
- if (this.changeFocusCell(1, 0)) {
2420
- return true;
2421
- }
2422
- }
2423
- if (actionId === "START_EDITING") {
2424
- if (this.getFocusModel) {
2425
- const fm = this.getFocusModel();
2426
- if (fm) {
2427
- const [rowIdx, colIdx] = fm.getFocus();
2428
- if (this.tableModel.getBodyModel().isEditable(rowIdx, colIdx)) {
2429
- this.clearSelection();
2430
- this.initRenderEditor(rowIdx, colIdx);
2431
- }
2432
- }
2433
- return true;
2434
- }
2435
- }
2436
- return false;
2437
- }
2438
- updateModelValueAfterEdit(areaIdent, rowIndex, columnIndex, value) {
2439
- if (areaIdent === "body") {
2440
- const bodyAreaModel = this.tableModel.getAreaModel(areaIdent);
2441
- const ok = bodyAreaModel.setValue(rowIndex, columnIndex, value);
2442
- if (ok) {
2443
- this.resetEditorRenderer();
2444
- this.repaint();
2445
- this.eventListener.onModelChanged(GeModelChangeEvent.createSingle(rowIndex, columnIndex));
2446
- this.hostElement.focus();
2447
- }
2448
- }
1667
+ class me extends ae {
1668
+ constructor(e, t, s, i, o) {
1669
+ var r;
1670
+ if (super(
1671
+ e,
1672
+ t,
1673
+ new Y(s),
1674
+ i
1675
+ ), this.eventListener = o, this.selectionService = new pe(this), this.api = new J(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, o || (this.eventListener = new fe()), (r = this.tableOptions) != null && r.autoRestoreOptions) {
1676
+ const l = this.tableOptions.autoRestoreOptions, n = l.getStorageKeyFn;
1677
+ n && (l.autoRestoreScrollPosition && (this.storeScrollPosStateService = new te(n)), l.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new ie(n)), l.autoRestoreSortingState && (this.storeSortingService = new oe(n)));
1678
+ }
1679
+ this.mouseHandler = new U(this), this.inputHandler = new he(this), this.shortcutService = new ge(this), this.shortcutService.addListener(this.selectionService);
1680
+ }
1681
+ onActionTriggered(e) {
1682
+ if (e === "NAVIGATE_DOWN" && this.changeFocusCell(0, 1) || e === "NAVIGATE_UP" && this.changeFocusCell(0, -1) || e === "NAVIGATE_LEFT" && this.changeFocusCell(-1, 0) || e === "NAVIGATE_RIGHT" && this.changeFocusCell(1, 0))
1683
+ return !0;
1684
+ if (e === "START_EDITING" && this.getFocusModel) {
1685
+ const t = this.getFocusModel();
1686
+ if (t) {
1687
+ const [s, i] = t.getFocus();
1688
+ this.tableModel.getBodyModel().isEditable(s, i) && (this.clearSelection(), this.initRenderEditor(s, i));
1689
+ }
1690
+ return !0;
1691
+ }
1692
+ return !1;
1693
+ }
1694
+ updateModelValueAfterEdit(e, t, s, i) {
1695
+ e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, i) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(_.createSingle(t, s)), this.hostElement.focus());
2449
1696
  }
2450
1697
  getApi() {
2451
1698
  return this.api;
2452
1699
  }
1700
+ /*
1701
+ * Called by the table component
1702
+ */
2453
1703
  firstInit() {
2454
- var _a;
2455
- this.tableModel.init();
2456
- if ((_a = this.tableOptions) === null || _a === void 0 ? void 0 : _a.externalFilterFunction) {
2457
- this.externalFilterChanged(false);
2458
- }
2459
- this.autoRestoreCollapsedExpandedState();
2460
- this.autoRestoreSortingState();
2461
- this.resetSizeOfWrapperDiv();
2462
- this.adjustContainersAndRows();
2463
- this.autoRestoreScrollPosition();
2464
- }
2465
- createGeMouseEvent(mouseEvent) {
2466
- const ret = new GeMouseEvent();
2467
- ret.originalEvent = mouseEvent;
2468
- if (mouseEvent) {
2469
- const target = mouseEvent.target;
2470
- [ret.areaIdent, ret.sideIdent] = this.getAreaAndSideIdentByAttr(target);
2471
- ret.rowIndex = this.getNumberByAttr(target, "data-row-index");
2472
- ret.columnIndex = this.getNumberByAttr(target, "data-col-index");
2473
- ret.action = this.getStringByAttr(target, "data-ge-action");
2474
- if (ret.areaIdent) {
2475
- const am = this.tableModel.getAreaModel(ret.areaIdent);
2476
- ret.rowTop = am.getYPosByRowIndex(ret.rowIndex);
1704
+ var e;
1705
+ this.tableModel.init(), (e = this.tableOptions) != null && e.externalFilterFunction && this.externalFilterChanged(!1), this.autoRestoreCollapsedExpandedState(), this.autoRestoreSortingState(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.autoRestoreScrollPosition();
1706
+ }
1707
+ createGeMouseEvent(e) {
1708
+ const t = new B();
1709
+ if (t.originalEvent = e, e) {
1710
+ const s = e.target;
1711
+ if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(s), t.rowIndex = this.getNumberByAttr(s, "data-row-index"), t.columnIndex = this.getNumberByAttr(s, "data-col-index"), t.action = this.getStringByAttr(s, "data-ge-action"), t.areaIdent) {
1712
+ const i = this.tableModel.getAreaModel(t.areaIdent);
1713
+ t.rowTop = i.getYPosByRowIndex(t.rowIndex);
2477
1714
  }
2478
- ret.columnLeft = this.tableModel.getXPosByColumnIndex(ret.columnIndex);
2479
- if (mouseEvent.ctrlKey && mouseEvent.altKey) {
2480
- const bodyY = mouseEvent.clientY - this.hostElement.offsetTop - this.areaHeaderCenter.parent.clientHeight;
2481
- const bodyX = mouseEvent.clientX - this.hostElement.offsetLeft - this.areaBodyWestGeo.width;
2482
- this.debugOnce(bodyX, bodyY);
2483
- }
2484
- }
2485
- return ret;
2486
- }
2487
- onMouseDown(mouseEvent) {
2488
- if (mouseEvent.columnIndex > -1 && mouseEvent.action && ["resize-column", "drag-column"].includes(mouseEvent.action)) {
2489
- this.mouseStartWidth = this.tableModel.getColumnWidth(mouseEvent.columnIndex);
2490
- this.mouseStartAction = mouseEvent.action;
2491
- this.mouseStartColumnIndex = mouseEvent.columnIndex;
2492
- if (this.mouseStartAction === "drag-column") {
2493
- this.dragFrom = this.mouseStartColumnIndex;
1715
+ if (t.columnLeft = this.tableModel.getXPosByColumnIndex(t.columnIndex), e.ctrlKey && e.altKey) {
1716
+ const i = e.clientY - this.hostElement.offsetTop - this.areaHeaderCenter.parent.clientHeight, o = e.clientX - this.hostElement.offsetLeft - this.areaBodyWestGeo.width;
1717
+ this.debugOnce(o, i);
2494
1718
  }
2495
1719
  }
1720
+ return t;
2496
1721
  }
2497
- mouseDraggingOnFrame(mouseEvent) {
2498
- this.eventListener.onMouseDragging(mouseEvent);
2499
- this.mouseEvent = mouseEvent;
2500
- if (this.mouseStartColumnIndex > -1 && this.mouseStartAction === "resize-column" && this.tableOptions.columnsResizable) {
2501
- this.resizeColumn(mouseEvent);
2502
- } else if (this.mouseStartAction === "drag-column" && mouseEvent.columnIndex > -1 && this.tableOptions.columnsDraggable) {
2503
- this.draggingTargetColumnIndex = mouseEvent.columnIndex;
2504
- this.dragTo = this.draggingTargetColumnIndex;
2505
- if (this.dragFrom > -1 && this.dragTo > -1 && this.dragFrom !== this.dragTo) {
2506
- this.tableModel.changeColumnOrder(this.dragFrom, this.dragTo);
2507
- this.dragFrom = this.dragTo;
2508
- this.resetSizeOfWrapperDiv();
2509
- this.adjustContainersAndRows();
2510
- }
2511
- this.repaint();
2512
- }
1722
+ onMouseDown(e) {
1723
+ e.columnIndex > -1 && e.action && ["resize-column", "drag-column"].includes(e.action) && (this.mouseStartWidth = this.tableModel.getColumnWidth(e.columnIndex), this.mouseStartAction = e.action, this.mouseStartColumnIndex = e.columnIndex, this.mouseStartAction === "drag-column" && (this.dragFrom = this.mouseStartColumnIndex));
2513
1724
  }
2514
- mouseDraggingEndOnFrame(mouseEvent) {
2515
- this.eventListener.onMouseDraggingEnd(mouseEvent);
2516
- this.draggingTargetColumnIndex = -1;
2517
- if (this.mouseStartAction === "resize-column") {
2518
- this.resizeColumn(mouseEvent);
2519
- } else if (this.mouseStartAction === "drag-column") {
2520
- this.repaint();
2521
- }
2522
- this.mouseStartWidth = -1;
2523
- this.mouseStartColumnIndex = -1;
2524
- this.dragFrom = -1;
2525
- this.dragTo = -1;
2526
- this.mouseStartAction = "";
2527
- }
2528
- mouseMove(mouseMoveEvent) {
2529
- this.eventListener.onMouseMoved(mouseMoveEvent);
2530
- this.adjustHoverRows(mouseMoveEvent);
2531
- this.adjustHoverColumns(mouseMoveEvent);
2532
- }
2533
- contextmenu(mouseMoveEvent) {
2534
- this.eventListener.onContextmenu(mouseMoveEvent);
2535
- }
2536
- toggleExpandCollapseAll(expand = true) {
2537
- var _a;
2538
- const bodyAreaModel = this.tableModel.getBodyModel();
2539
- if (bodyAreaModel instanceof AreaModelTree) {
2540
- const amt = bodyAreaModel;
2541
- amt.toggleExpandCollapseAll(expand);
2542
- this.repaint();
2543
- (_a = this.storeStateCollapsedExpandService) === null || _a === void 0 ? void 0 : _a.collapsedStateAll(expand);
2544
- }
1725
+ mouseDraggingOnFrame(e) {
1726
+ this.eventListener.onMouseDragging(e), this.mouseEvent = e, this.mouseStartColumnIndex > -1 && this.mouseStartAction === "resize-column" && this.tableOptions.columnsResizable ? this.resizeColumn(e) : this.mouseStartAction === "drag-column" && e.columnIndex > -1 && this.tableOptions.columnsDraggable && (this.draggingTargetColumnIndex = e.columnIndex, this.dragTo = this.draggingTargetColumnIndex, this.dragFrom > -1 && this.dragTo > -1 && this.dragFrom !== this.dragTo && (this.tableModel.changeColumnOrder(this.dragFrom, this.dragTo), this.dragFrom = this.dragTo, this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows()), this.repaint());
2545
1727
  }
2546
- toggleRowCheckbox(rowIdx, _colIdx, areaIdent) {
2547
- var _a;
2548
- const areaModel = this.tableModel.getAreaModel(areaIdent);
2549
- const state = areaModel.isRowChecked(rowIdx);
2550
- const unsel = state === void 0 || state === "semi" || state === "none";
2551
- areaModel.setRowChecked(rowIdx, unsel);
2552
- this.repaint();
2553
- const selectedRows = (_a = areaModel.rowSelectionModel) === null || _a === void 0 ? void 0 : _a.getCheckedRows();
2554
- this.eventListener.onCheckboxChanged(selectedRows ? selectedRows : []);
2555
- }
2556
- onMouseClicked(evt, previousEvt) {
2557
- let dirty = this.selectionService.onMouseClicked(evt, previousEvt);
2558
- if (!dirty && this.getFocusModel) {
2559
- const fm = this.getFocusModel();
2560
- if (fm) {
2561
- dirty = fm.hasChanged();
2562
- fm.clearChanged();
2563
- if (dirty) {
2564
- this.resetEditorRenderer();
2565
- }
2566
- }
2567
- }
2568
- this.eventListener.onMouseClicked(evt);
2569
- if (dirty) {
2570
- this.debounce(this.repaint.bind(this), 10);
2571
- }
1728
+ mouseDraggingEndOnFrame(e) {
1729
+ this.eventListener.onMouseDraggingEnd(e), this.draggingTargetColumnIndex = -1, this.mouseStartAction === "resize-column" ? this.resizeColumn(e) : this.mouseStartAction === "drag-column" && this.repaint(), this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.mouseStartAction = "";
2572
1730
  }
2573
- externalFilterChanged(clearSelection = true) {
2574
- const predictFn = this.tableOptions.externalFilterFunction;
2575
- if (predictFn) {
2576
- if (clearSelection) {
2577
- this.clearSelectionModel();
2578
- }
2579
- this.tableModel.externalFilterChanged(predictFn);
2580
- this.scrollViewport.scrollTo(0, 0);
2581
- this.tableModel.recalcHeightAndPadding();
2582
- this.resetSizeOfWrapperDiv();
2583
- this.repaint();
1731
+ mouseMove(e) {
1732
+ this.eventListener.onMouseMoved(e), this.adjustHoverRows(e), this.adjustHoverColumns(e);
1733
+ }
1734
+ contextmenu(e) {
1735
+ this.eventListener.onContextmenu(e);
1736
+ }
1737
+ toggleExpandCollapseAll(e = !0) {
1738
+ var s;
1739
+ const t = this.tableModel.getBodyModel();
1740
+ t instanceof L && (t.toggleExpandCollapseAll(e), this.repaint(), (s = this.storeStateCollapsedExpandService) == null || s.collapsedStateAll(e));
1741
+ }
1742
+ toggleRowCheckbox(e, t, s) {
1743
+ var n;
1744
+ const i = this.tableModel.getAreaModel(s), o = i.isRowChecked(e), r = o === void 0 || o === "semi" || o === "none";
1745
+ i.setRowChecked(e, r), this.repaint();
1746
+ const l = (n = i.rowSelectionModel) == null ? void 0 : n.getCheckedRows();
1747
+ this.eventListener.onCheckboxChanged(l || []);
1748
+ }
1749
+ onMouseClicked(e, t) {
1750
+ let s = this.selectionService.onMouseClicked(e, t);
1751
+ if (!s && this.getFocusModel) {
1752
+ const i = this.getFocusModel();
1753
+ i && (s = i.hasChanged(), i.clearChanged(), s && this.resetEditorRenderer());
2584
1754
  }
1755
+ this.eventListener.onMouseClicked(e), s && this.debounce(this.repaint.bind(this), 10);
2585
1756
  }
2586
- onHeaderDblClicked(event, _rowIdx, colIdx) {
2587
- var _a, _b, _c;
2588
- const colDef = this.tableModel.getColumnDef(colIdx);
2589
- if ((colDef === null || colDef === void 0 ? void 0 : colDef.sortable) && colDef.sortable()) {
2590
- event.preventDefault();
2591
- event.stopPropagation();
2592
- const states = colDef.sortStatesOrder ? colDef.sortStatesOrder : this.tableOptions.sortOrder;
2593
- const currentState = (_a = colDef.sortState) !== null && _a !== void 0 ? _a : "";
2594
- const newState = states[(states.indexOf(currentState) + 1) % states.length];
2595
- const sortItem = new SortItem(colIdx, newState);
2596
- const done = this.tableModel.doSort([sortItem]);
2597
- if (done) {
2598
- (_b = this.tableModel.getColumnDefs()) === null || _b === void 0 ? void 0 : _b.forEach((cd) => cd.sortState = "");
2599
- colDef.sortState = newState;
2600
- }
2601
- this.repaint();
2602
- (_c = this.storeSortingService) === null || _c === void 0 ? void 0 : _c.setSortItems([sortItem]);
1757
+ externalFilterChanged(e = !0) {
1758
+ const t = this.tableOptions.externalFilterFunction;
1759
+ t && (e && this.clearSelectionModel(), this.tableModel.externalFilterChanged(t), this.scrollViewport.scrollTo(0, 0), this.tableModel.recalcHeightAndPadding(), this.resetSizeOfWrapperDiv(), this.repaint());
1760
+ }
1761
+ onHeaderDblClicked(e, t, s) {
1762
+ var o, r;
1763
+ const i = this.tableModel.getColumnDef(s);
1764
+ if (i != null && i.sortable && i.sortable()) {
1765
+ e.preventDefault(), e.stopPropagation();
1766
+ const l = i.sortStatesOrder ? i.sortStatesOrder : this.tableOptions.sortOrder, n = i.sortState ?? "", a = l[(l.indexOf(n) + 1) % l.length], d = new de(s, a);
1767
+ this.tableModel.doSort([d]) && ((o = this.tableModel.getColumnDefs()) == null || o.forEach((g) => g.sortState = ""), i.sortState = a), this.repaint(), (r = this.storeSortingService) == null || r.setSortItems([d]);
2603
1768
  }
2604
1769
  }
2605
- changeFocusCell(dx, dy) {
1770
+ changeFocusCell(e, t) {
2606
1771
  if (!this.isEditing() && this.getFocusModel) {
2607
- const fm = this.getFocusModel();
2608
- if (fm) {
2609
- const [rowIdx, colIdx] = fm.getFocus();
2610
- fm.setFocus(rowIdx + dy, colIdx + dx);
2611
- this.repaint();
2612
- return true;
1772
+ const s = this.getFocusModel();
1773
+ if (s) {
1774
+ const [i, o] = s.getFocus();
1775
+ return s.setFocus(i + t, o + e), this.repaint(), !0;
2613
1776
  }
2614
1777
  }
2615
- return false;
1778
+ return !1;
2616
1779
  }
2617
- resizeColumn(mouseEvent) {
2618
- this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + mouseEvent.draggingX);
2619
- this.tableModel.recalcPadding();
2620
- this.resetSizeOfWrapperDiv();
2621
- this.adjustContainersAndRows();
1780
+ resizeColumn(e) {
1781
+ this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
2622
1782
  }
2623
1783
  clearSelectionModel() {
2624
- var _a;
2625
- if (this.getSelectionModel) {
2626
- (_a = this.getSelectionModel()) === null || _a === void 0 ? void 0 : _a.clear();
2627
- }
1784
+ var e;
1785
+ this.getSelectionModel && ((e = this.getSelectionModel()) == null || e.clear());
2628
1786
  }
2629
- debugOnce(bodyX, bodyY) {
2630
- var _a;
2631
- console.clear();
2632
- console.info("this.hostElement.offsetTop", this.hostElement.offsetTop);
2633
- console.info("this.hostElement.scrollHeight", this.hostElement.scrollHeight);
2634
- console.info("this.scrollViewportTop", this.scrollTop);
2635
- console.info("this.areaHeaderCenter.parent.clientHeight", this.areaHeaderCenter.parent.clientHeight);
2636
- console.info("bodyY", bodyY);
2637
- console.info("bodyX", bodyX);
2638
- console.info("rows", this.firstVisibleRowIndex);
2639
- console.info("");
2640
- console.info("this.tableModel", this.tableModel);
2641
- console.info("");
2642
- console.info("this.mouseMoveEvent.clientX", (_a = this.mouseHandler.mouseEvent) === null || _a === void 0 ? void 0 : _a.clientX);
2643
- console.info("this.hostElement.offsetLeft", this.hostElement.offsetLeft);
2644
- console.info("this.areaBodyWestGeo.width", this.areaBodyWestGeo.width);
1787
+ debugOnce(e, t) {
1788
+ var s;
1789
+ console.clear(), console.info("this.hostElement.offsetTop", this.hostElement.offsetTop), console.info("this.hostElement.scrollHeight", this.hostElement.scrollHeight), console.info("this.scrollViewportTop", this.scrollTop), console.info("this.areaHeaderCenter.parent.clientHeight", this.areaHeaderCenter.parent.clientHeight), console.info("bodyY", t), console.info("bodyX", e), console.info("rows", this.firstVisibleRowIndex), console.info(""), console.info("this.tableModel", this.tableModel), console.info(""), console.info("this.mouseMoveEvent.clientX", (s = this.mouseHandler.mouseEvent) == null ? void 0 : s.clientX), console.info("this.hostElement.offsetLeft", this.hostElement.offsetLeft), console.info("this.areaBodyWestGeo.width", this.areaBodyWestGeo.width);
2645
1790
  }
2646
1791
  autoRestoreScrollPosition() {
2647
- var _a;
2648
- if (((_a = this.tableOptions) === null || _a === void 0 ? void 0 : _a.autoRestoreOptions) && this.storeScrollPosStateService) {
2649
- const autoRestoreOptions = this.tableOptions.autoRestoreOptions;
2650
- if (autoRestoreOptions.autoRestoreScrollPosition) {
2651
- const scrollOffset = this.storeScrollPosStateService.getScrollOffset();
2652
- if (scrollOffset) {
2653
- this.scrollViewport.scrollTo(...scrollOffset);
2654
- }
2655
- }
1792
+ var e;
1793
+ if ((e = this.tableOptions) != null && e.autoRestoreOptions && this.storeScrollPosStateService && this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition) {
1794
+ const s = this.storeScrollPosStateService.getScrollOffset();
1795
+ s && this.scrollViewport.scrollTo(...s);
2656
1796
  }
2657
1797
  }
2658
1798
  autoRestoreSortingState() {
2659
- var _a, _b;
2660
- if (((_b = (_a = this.tableOptions) === null || _a === void 0 ? void 0 : _a.autoRestoreOptions) === null || _b === void 0 ? void 0 : _b.autoRestoreSortingState) && this.storeSortingService) {
2661
- const sortItems = this.storeSortingService.getSortItems();
2662
- if (sortItems === null || sortItems === void 0 ? void 0 : sortItems.length) {
2663
- const areaModel = this.tableModel.getBodyModel();
2664
- areaModel.doSort(sortItems);
2665
- }
1799
+ var e, t;
1800
+ if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreSortingState && this.storeSortingService) {
1801
+ const s = this.storeSortingService.getSortItems();
1802
+ s != null && s.length && this.tableModel.getBodyModel().doSort(s);
2666
1803
  }
2667
1804
  }
2668
1805
  autoRestoreCollapsedExpandedState() {
2669
- var _a, _b;
2670
- if (((_b = (_a = this.tableOptions) === null || _a === void 0 ? void 0 : _a.autoRestoreOptions) === null || _b === void 0 ? void 0 : _b.getRowId) && this.storeStateCollapsedExpandService) {
2671
- const autoRestoreOptions = this.tableOptions.autoRestoreOptions;
2672
- const getRowId = autoRestoreOptions.getRowId;
2673
- if (autoRestoreOptions.autoRestoreCollapsedExpandedState && getRowId) {
2674
- const state = this.storeStateCollapsedExpandService.collapsedExpandedStateGet();
2675
- const areaModel = this.tableModel.getAreaModel("body");
2676
- if (areaModel instanceof AreaModelTree) {
2677
- const amtr = areaModel;
2678
- const rowCount = areaModel.getRowCount();
2679
- for (let i = 0; i < rowCount; i++) {
2680
- const row = areaModel.getRowByIndex(i);
2681
- if (row) {
2682
- if (state.allExpanded) {
2683
- row.expanded = true;
2684
- } else if (state.allCollapsed) {
2685
- row.expanded = false;
2686
- } else {
2687
- const rowId = getRowId(row.data);
2688
- if (state.mode === "expanded") {
2689
- row.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(rowId);
2690
- } else if (state.mode === "collapsed") {
2691
- row.expanded = !this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(rowId);
2692
- }
1806
+ var e, t;
1807
+ if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.getRowId && this.storeStateCollapsedExpandService) {
1808
+ const s = this.tableOptions.autoRestoreOptions, i = s.getRowId;
1809
+ if (s.autoRestoreCollapsedExpandedState && i) {
1810
+ const o = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(), r = this.tableModel.getAreaModel("body");
1811
+ if (r instanceof L) {
1812
+ const l = r, n = r.getRowCount();
1813
+ for (let a = 0; a < n; a++) {
1814
+ const d = r.getRowByIndex(a);
1815
+ if (d)
1816
+ if (o.allExpanded)
1817
+ d.expanded = !0;
1818
+ else if (o.allCollapsed)
1819
+ d.expanded = !1;
1820
+ else {
1821
+ const S = i(d.data);
1822
+ o.mode === "expanded" ? d.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S) : o.mode === "collapsed" && (d.expanded = !this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S));
2693
1823
  }
2694
- }
2695
1824
  }
2696
- amtr.recalcVisibleTreeRows();
1825
+ l.recalcVisibleTreeRows();
2697
1826
  }
2698
1827
  }
2699
1828
  }
2700
1829
  }
2701
1830
  }
2702
- class InputCellRenderer {
2703
- render(cellDiv, rowIndex, columnIndex, areaIdent, areaModel, _cellValue, domService) {
2704
- if (areaModel.isEditable(rowIndex, columnIndex)) {
2705
- domService.addClass(cellDiv, "ge-table-row-input-div");
2706
- const val = areaModel.getValueAt(rowIndex, columnIndex);
2707
- cellDiv.innerHTML = `
1831
+ class be {
1832
+ render(e, t, s, i, o, r, l) {
1833
+ if (o.isEditable(t, s)) {
1834
+ l.addClass(e, "ge-table-row-input-div");
1835
+ const n = o.getValueAt(t, s);
1836
+ e.innerHTML = `
2708
1837
  <input
2709
1838
  type="text"
2710
- value="${val}"
1839
+ value="${n}"
2711
1840
  autofocus
2712
1841
  onfocus="this.setSelectionRange(0, this.value.length)"
2713
1842
  data-listen="change"
2714
- data-area="${areaIdent}"
2715
- data-row-index="${rowIndex}"
2716
- data-col-index="${columnIndex}"
1843
+ data-area="${i}"
1844
+ data-row-index="${t}"
1845
+ data-col-index="${s}"
2717
1846
  data-input-type="text"
2718
1847
  style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
2719
1848
  class="ge-table-cell-editor-input">`;
2720
1849
  }
2721
- return void 0;
2722
1850
  }
2723
1851
  }
2724
- class SelectionModel {
2725
- constructor(selectionType = "none", selectionMode = "single") {
2726
- this.selectionType = selectionType;
2727
- this.selectionMode = selectionMode;
2728
- this.ranges = [];
2729
- this.negativeRanges = [];
2730
- this.allSelected = false;
2731
- }
2732
- getSelectionCount(rowIndex, columnIndex) {
2733
- let count = 0;
2734
- for (const range of this.ranges) {
2735
- if (range.isInRange(rowIndex, columnIndex)) {
2736
- count++;
2737
- }
2738
- }
2739
- if (this.allSelected) {
2740
- count++;
2741
- }
2742
- if (this.isInNegativeRange(rowIndex, columnIndex)) {
2743
- count = 0;
2744
- }
2745
- return count;
2746
- }
2747
- isInNegativeRange(rowIndex, columnIndex) {
2748
- for (const range of this.negativeRanges) {
2749
- if (range.isInRange(rowIndex, columnIndex)) {
2750
- return true;
2751
- }
2752
- }
2753
- return false;
1852
+ class ye {
1853
+ constructor(e = "none", t = "single") {
1854
+ this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
1855
+ }
1856
+ getSelectionCount(e, t) {
1857
+ let s = 0;
1858
+ for (const i of this.ranges)
1859
+ i.isInRange(e, t) && s++;
1860
+ return this.allSelected && s++, this.isInNegativeRange(e, t) && (s = 0), s;
1861
+ }
1862
+ isInNegativeRange(e, t) {
1863
+ for (const s of this.negativeRanges)
1864
+ if (s.isInRange(e, t))
1865
+ return !0;
1866
+ return !1;
2754
1867
  }
2755
1868
  getRanges() {
2756
1869
  return this.ranges;
2757
1870
  }
2758
1871
  clear() {
2759
- this.ranges = [];
2760
- this.negativeRanges = [];
2761
- this.allSelected = false;
1872
+ this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
2762
1873
  }
2763
1874
  hasSelection() {
2764
1875
  return !!this.ranges.length;
2765
1876
  }
2766
1877
  selectAll() {
2767
- this.allSelected = true;
1878
+ this.allSelected = !0;
2768
1879
  }
2769
- addSelection(range) {
2770
- this.addRange(range);
1880
+ addSelection(e) {
1881
+ this.addRange(e);
2771
1882
  }
2772
- removeSelection(range) {
2773
- if (this.selectionType === "none") {
1883
+ removeSelection(e) {
1884
+ if (this.selectionType === "none")
2774
1885
  return;
2775
- }
2776
- let r = range;
2777
- if (this.selectionType === "row") {
2778
- r = CellRange.singleRow(range.r1);
2779
- } else if (this.selectionType === "column") {
2780
- r = CellRange.singleColumn(range.c1);
2781
- }
2782
- this.negativeRanges.push(r);
1886
+ let t = e;
1887
+ this.selectionType === "row" ? t = A.singleRow(e.r1) : this.selectionType === "column" && (t = A.singleColumn(e.c1)), this.negativeRanges.push(t);
2783
1888
  }
2784
- togglePoint(row, col) {
2785
- if (this.getSelectionCount(row, col) > 0) {
2786
- this.removeSelection(CellRange.singleCell(row, col));
2787
- } else {
2788
- this.addSelection(CellRange.singleCell(row, col));
2789
- }
1889
+ togglePoint(e, t) {
1890
+ this.getSelectionCount(e, t) > 0 ? this.removeSelection(A.singleCell(e, t)) : this.addSelection(A.singleCell(e, t));
2790
1891
  }
2791
- addRange(range) {
2792
- if (this.selectionType === "none") {
2793
- return;
2794
- }
2795
- this.allSelected = false;
2796
- if (this.selectionMode === "single") {
2797
- this.ranges = [];
2798
- }
2799
- if (this.selectionType === "row") {
2800
- range.c1 = 0;
2801
- range.c2 = Number.MAX_SAFE_INTEGER;
2802
- } else if (this.selectionType === "column") {
2803
- range.r1 = 0;
2804
- range.r2 = Number.MAX_SAFE_INTEGER;
2805
- } else if (this.selectionType === "cell") {
2806
- range.r2 = range.r1;
2807
- range.c2 = range.c1;
2808
- } else if (this.selectionType === "range")
2809
- ;
2810
- this.ranges.push(range);
1892
+ addRange(e) {
1893
+ this.selectionType !== "none" && (this.allSelected = !1, this.selectionMode === "single" && (this.ranges = []), this.selectionType === "row" ? (e.c1 = 0, e.c2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "column" ? (e.r1 = 0, e.r2 = Number.MAX_SAFE_INTEGER) : this.selectionType === "cell" ? (e.r2 = e.r1, e.c2 = e.c1) : this.selectionType, this.ranges.push(e));
2811
1894
  }
2812
1895
  }
2813
- class FocusModel {
2814
- constructor(selectionType = "none") {
2815
- this.selectionType = selectionType;
2816
- this.rowIndex = -1;
2817
- this.columnIndex = -1;
2818
- this.changed = false;
1896
+ class we {
1897
+ constructor(e = "none") {
1898
+ this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1;
2819
1899
  }
2820
1900
  clearChanged() {
2821
- this.changed = false;
1901
+ this.changed = !1;
2822
1902
  }
2823
1903
  hasChanged() {
2824
1904
  return this.changed;
2825
1905
  }
2826
1906
  clear() {
2827
- this.rowIndex = -1;
2828
- this.columnIndex = -1;
2829
- }
2830
- setFocus(rowIndex, columnIndex) {
2831
- if (this.rowIndex !== rowIndex || this.columnIndex !== columnIndex) {
2832
- this.rowIndex = rowIndex;
2833
- this.columnIndex = columnIndex;
2834
- this.changed = true;
2835
- }
1907
+ this.rowIndex = -1, this.columnIndex = -1;
1908
+ }
1909
+ setFocus(e, t) {
1910
+ (this.rowIndex !== e || this.columnIndex !== t) && (this.rowIndex = e, this.columnIndex = t, this.changed = !0);
2836
1911
  }
2837
- hasFocus(rowIndex, columnIndex) {
2838
- return this.rowIndex === rowIndex && this.columnIndex === columnIndex;
1912
+ hasFocus(e, t) {
1913
+ return this.rowIndex === e && this.columnIndex === t;
2839
1914
  }
2840
1915
  getFocus() {
2841
1916
  return [this.rowIndex, this.columnIndex];
2842
1917
  }
2843
1918
  }
2844
- const selectionModel = new SelectionModel();
2845
- const focusModel = new FocusModel("cell");
2846
- class TableOptions {
1919
+ const xe = new ye(), ve = new we("cell");
1920
+ class Ce {
2847
1921
  constructor() {
2848
- this.overflowX = "auto";
2849
- this.overflowY = "auto";
2850
- this.horizontalBorderVisible = true;
2851
- this.verticalBorderVisible = true;
2852
- this.footerSeparatorBorderVisible = true;
2853
- this.headerSeparatorBorderVisible = true;
2854
- this.fixedEastSeparatorBorderVisible = true;
2855
- this.fixedWestSeparatorBorderVisible = true;
2856
- this.tableTopBorderVisible = true;
2857
- this.tableBottomBorderVisible = true;
2858
- this.hoverRowVisible = true;
2859
- this.hoverColumnVisible = true;
2860
- this.columnsResizable = true;
2861
- this.columnsDraggable = true;
2862
- this.columnResizeHandleWidthInPx = 4;
2863
- this.defaultRowHeights = {
1922
+ this.overflowX = "auto", this.overflowY = "auto", this.horizontalBorderVisible = !0, this.verticalBorderVisible = !0, this.footerSeparatorBorderVisible = !0, this.headerSeparatorBorderVisible = !0, this.fixedEastSeparatorBorderVisible = !0, this.fixedWestSeparatorBorderVisible = !0, this.tableTopBorderVisible = !0, this.tableBottomBorderVisible = !0, this.hoverRowVisible = !0, this.hoverColumnVisible = !0, this.columnsResizable = !0, this.columnsDraggable = !0, this.columnResizeHandleWidthInPx = 4, this.defaultRowHeights = {
2864
1923
  header: 34,
2865
1924
  body: 34,
2866
1925
  footer: 34
2867
- };
2868
- this.footerVerticalSeparator = false;
2869
- this.headerToggleExpandCollapseIcons = false;
2870
- this.headerVerticalSeparator = false;
2871
- this.treeOptions = new TreeOptions();
2872
- this.showCheckboxWihoutExtraColumn = false;
2873
- this.externalFilterFunction = void 0;
2874
- this.sortedOptions = new SortedOptions();
2875
- this.sortOrder = ["asc", "desc"];
2876
- this.getEditRenderer = (_rowIndex, _columnIndex) => new InputCellRenderer();
2877
- this.getSelectionModel = () => selectionModel;
2878
- this.getFocusModel = () => focusModel;
1926
+ }, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new H(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new W(), this.sortOrder = ["asc", "desc"], this.getEditRenderer = (e, t) => new be(), this.getSelectionModel = () => xe, this.getFocusModel = () => ve;
2879
1927
  }
2880
1928
  }
2881
- class SimpleDomService {
2882
- setStyle(el, style, value) {
2883
- el.style[style] = value;
2884
- return el;
2885
- }
2886
- appendText(parent, text) {
2887
- const div = this.createText(text);
2888
- this.appendChild(parent, div);
2889
- return div;
2890
- }
2891
- addClass(div, clazz) {
2892
- if (clazz.includes(" ")) {
2893
- clazz.split(" ").forEach((c) => div.classList.add(c));
2894
- } else {
2895
- div.classList.add(clazz);
2896
- }
2897
- return div;
1929
+ class Ee {
1930
+ setStyle(e, t, s) {
1931
+ return e.style[t] = s, e;
2898
1932
  }
2899
- appendChild(parent, child) {
2900
- parent.appendChild(child);
1933
+ appendText(e, t) {
1934
+ const s = this.createText(t);
1935
+ return this.appendChild(e, s), s;
2901
1936
  }
2902
- createElement(name) {
2903
- return document.createElement(name);
1937
+ addClass(e, t) {
1938
+ return t.includes(" ") ? t.split(" ").forEach((s) => e.classList.add(s)) : e.classList.add(t), e;
2904
1939
  }
2905
- createText(value) {
2906
- return document.createTextNode(value);
1940
+ appendChild(e, t) {
1941
+ e.appendChild(t);
2907
1942
  }
2908
- setAttribute(ele, key, value) {
2909
- ele.setAttribute(key, value);
1943
+ createElement(e) {
1944
+ return document.createElement(e);
2910
1945
  }
2911
- }
2912
- var GuiexpertTable_vue_vue_type_style_index_0_lang = "";
2913
- var _export_sfc = (sfc, props) => {
2914
- const target = sfc.__vccOpts || sfc;
2915
- for (const [key, val] of props) {
2916
- target[key] = val;
1946
+ createText(e) {
1947
+ return document.createTextNode(e);
2917
1948
  }
2918
- return target;
2919
- };
2920
- const _sfc_main = defineComponent({
2921
- inheritAttrs: false,
1949
+ setAttribute(e, t, s) {
1950
+ e.setAttribute(t, s);
1951
+ }
1952
+ }
1953
+ const Ae = G({
1954
+ inheritAttrs: !1,
2922
1955
  props: {
2923
1956
  tableModel: {
2924
- required: true
1957
+ required: !0
2925
1958
  },
2926
1959
  tableOptions: {
2927
- required: false,
2928
- default: new TableOptions()
1960
+ required: !1,
1961
+ default: new Ce()
2929
1962
  },
2930
1963
  debounceMouseClickDelay: {
2931
- required: false,
1964
+ required: !1,
2932
1965
  default: 150
2933
1966
  }
2934
1967
  },
@@ -2942,58 +1975,93 @@ const _sfc_main = defineComponent({
2942
1975
  "mouseDraggingEnd",
2943
1976
  "mouseMoved"
2944
1977
  ],
2945
- setup(props, { emit }) {
2946
- const root = ref(null);
2947
- const initTable = (ele) => {
2948
- const listener = {
2949
- onCheckboxChanged: (evt) => {
2950
- emit("checkboxChanged", evt);
1978
+ setup(h, { emit: e }) {
1979
+ const t = N(null), s = (i) => {
1980
+ const o = {
1981
+ onCheckboxChanged: (l) => {
1982
+ e("checkboxChanged", l);
2951
1983
  },
2952
- onContextmenu: (evt) => {
2953
- emit("contextmenu", evt);
1984
+ onContextmenu: (l) => {
1985
+ e("contextmenu", l);
2954
1986
  },
2955
- onModelChanged: (evt) => {
2956
- emit("modelChanged", evt);
1987
+ onModelChanged: (l) => {
1988
+ e("modelChanged", l);
2957
1989
  },
2958
- onMouseClicked: (evt) => {
2959
- emit("mouseClicked", evt);
1990
+ onMouseClicked: (l) => {
1991
+ e("mouseClicked", l);
2960
1992
  },
2961
- onMouseDragging: (evt) => {
2962
- emit("mouseDragging", evt);
1993
+ onMouseDragging: (l) => {
1994
+ e("mouseDragging", l);
2963
1995
  },
2964
- onMouseDraggingEnd: (evt) => {
2965
- emit("mouseDraggingEnd", evt);
1996
+ onMouseDraggingEnd: (l) => {
1997
+ e("mouseDraggingEnd", l);
2966
1998
  },
2967
- onMouseMoved: (evt) => {
2968
- emit("mouseMoved", evt);
1999
+ onMouseMoved: (l) => {
2000
+ e("mouseMoved", l);
2969
2001
  }
2970
- };
2971
- const tableScope = new TableScope(ele, props.tableModel, new SimpleDomService(), props.tableOptions, listener);
2972
- tableScope.firstInit();
2973
- emit("tableReady", tableScope.getApi());
2002
+ }, r = new me(
2003
+ i,
2004
+ h.tableModel,
2005
+ new Ee(),
2006
+ h.tableOptions,
2007
+ o
2008
+ );
2009
+ r.firstInit(), e("tableReady", r.getApi());
2974
2010
  };
2975
- onMounted(() => {
2976
- if (root.value) {
2977
- initTable(root.value);
2978
- }
2979
- });
2980
- return {
2981
- root
2011
+ return z(() => {
2012
+ t.value && s(t.value);
2013
+ }), {
2014
+ root: t
2982
2015
  };
2983
2016
  }
2984
2017
  });
2985
- const _hoisted_1 = {
2018
+ const Re = (h, e) => {
2019
+ const t = h.__vccOpts || h;
2020
+ for (const [s, i] of e)
2021
+ t[s] = i;
2022
+ return t;
2023
+ }, Me = {
2986
2024
  ref: "root",
2987
2025
  class: "container-div",
2988
- style: { "width": "100%", "height": "100%", "background-color": "transparent", "padding": "0", "margin": "0" }
2026
+ style: { width: "100%", height: "100%", "background-color": "transparent", padding: "0", margin: "0" }
2989
2027
  };
2990
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2991
- return openBlock(), createElementBlock("div", _hoisted_1, null, 512);
2028
+ function Te(h, e, t, s, i, o) {
2029
+ return j(), X("div", Me, null, 512);
2992
2030
  }
2993
- var GuiexpertTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
2994
- var GuiexpertTablePlugin = {
2995
- install: (app, options = { img: "" }) => {
2996
- app.component("GuiexpertTable", GuiexpertTable);
2031
+ const Ie = /* @__PURE__ */ Re(Ae, [["render", Te]]);
2032
+ class Fe {
2033
+ constructor(e, t) {
2034
+ this.component = e, this.appContext = t;
2035
+ }
2036
+ render(e, t, s, i, o, r, l) {
2037
+ return this.mount(
2038
+ this.component,
2039
+ {
2040
+ cellDiv: e,
2041
+ rowIndex: t,
2042
+ columnIndex: s,
2043
+ areaIdent: i,
2044
+ areaModel: o,
2045
+ cellValue: r
2046
+ },
2047
+ this.appContext,
2048
+ e
2049
+ );
2050
+ }
2051
+ mount(e, t, s, i) {
2052
+ let o = K(e, t);
2053
+ return o.appContext = s, k(o, i), () => {
2054
+ i && k(null, i);
2055
+ };
2997
2056
  }
2057
+ }
2058
+ const Oe = {
2059
+ install: (h, e = { img: "" }) => {
2060
+ h.component("GuiexpertTable", Ie);
2061
+ }
2062
+ };
2063
+ export {
2064
+ Fe as ComponentRendererWrapper,
2065
+ Ie as GuiexpertTable,
2066
+ Oe as default
2998
2067
  };
2999
- export { GuiexpertTable, GuiexpertTablePlugin as default };