@guiexpert/react-table 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +3 -3
- package/index.js +505 -241
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as q } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as U, useEffect as J } from "react";
|
|
3
|
+
import Q from "react-dom";
|
|
4
4
|
function O(p) {
|
|
5
5
|
return p && p.type === "TreeRow";
|
|
6
6
|
}
|
|
@@ -8,8 +8,8 @@ function $(p) {
|
|
|
8
8
|
return p && p.type === "AreaModelTree";
|
|
9
9
|
}
|
|
10
10
|
class W {
|
|
11
|
-
constructor(e = -1, t = -1, s = -1, i = -1, o, r, n, l = 0, a = 0, d = 0,
|
|
12
|
-
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = i, this.areaIdent = o, this.sideIdent = r, this.originalEvent = n, this.clickCount = l, this.draggingX = a, this.draggingY = d, this.action =
|
|
11
|
+
constructor(e = -1, t = -1, s = -1, i = -1, o, r, n, l = 0, a = 0, d = 0, S = "") {
|
|
12
|
+
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = i, this.areaIdent = o, this.sideIdent = r, this.originalEvent = n, this.clickCount = l, this.draggingX = a, this.draggingY = d, this.action = S;
|
|
13
13
|
}
|
|
14
14
|
clone() {
|
|
15
15
|
return new W(
|
|
@@ -32,7 +32,7 @@ class D {
|
|
|
32
32
|
this.content = e, this.style = t, this.classes = s;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class X {
|
|
36
36
|
constructor(e = new D(
|
|
37
37
|
">",
|
|
38
38
|
"transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
|
|
@@ -53,12 +53,12 @@ class j {
|
|
|
53
53
|
this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = s, this.arrowExpandCollapseAll = i;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
class
|
|
56
|
+
class z {
|
|
57
57
|
constructor(e = new D("↑", "", ["ge-header-sorted-asc"]), t = new D("↓", "", ["ge-header-sorted-desc"]), s = new D("↑", "color:transparent;", [])) {
|
|
58
58
|
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class Z {
|
|
62
62
|
constructor(e) {
|
|
63
63
|
this.domService = e;
|
|
64
64
|
}
|
|
@@ -143,15 +143,15 @@ class Q {
|
|
|
143
143
|
}
|
|
144
144
|
return this.domService.appendChild(e.child, l), l;
|
|
145
145
|
}
|
|
146
|
-
addColumnDiv(e, t, s = -1, i = -1, o, r, n = "", l, a, d = void 0,
|
|
147
|
-
const g = a == null ? void 0 : a.treeOptions, m = a == null ? void 0 : a.showCheckboxWihoutExtraColumn,
|
|
148
|
-
this.domService.addClass(
|
|
149
|
-
const
|
|
150
|
-
if (o === "body" && r === "center" && this.domService.addClass(
|
|
151
|
-
const
|
|
152
|
-
this.addLabelDiv(
|
|
146
|
+
addColumnDiv(e, t, s = -1, i = -1, o, r, n = "", l, a, d = void 0, S) {
|
|
147
|
+
const g = a == null ? void 0 : a.treeOptions, m = a == null ? void 0 : a.showCheckboxWihoutExtraColumn, h = this.domService.createElement("div");
|
|
148
|
+
this.domService.addClass(h, "ge-table-col-div"), this.domService.addClass(h, `ge-table-col-div-${t.index}`), this.domService.setAttribute(h, "data-col-index", `${t.index}`), this.domService.setAttribute(h, "data-row-index", `${s}`), this.domService.setAttribute(h, "data-area", `${o}`);
|
|
149
|
+
const f = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
|
|
150
|
+
if (o === "body" && r === "center" && this.domService.addClass(h, `ge-table-column-${f}`), this.domService.setStyle(h, "display", "clip"), this.domService.setStyle(h, "position", "absolute"), this.domService.setStyle(h, "left", `${t.left}px`), this.domService.setStyle(h, "top", `${t.top}px`), this.domService.setStyle(h, "width", `${t.width}px`), this.domService.setStyle(h, "height", `${t.height}px`), l && l !== "none" && (this.domService.addClass(h, "ge-table-col-tree"), this.addArrowDiv(h, l, g, s, i, o)), m && i === 0 && d && this.addCheckboxToDiv(h, d, o, s), n) {
|
|
151
|
+
const c = l !== "none" && i === 0;
|
|
152
|
+
this.addLabelDiv(h, n, c, s, i, o);
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return S && this.addSortedIcon(h, S, a == null ? void 0 : a.sortedOptions, i), this.domService.appendChild(e, h), h;
|
|
155
155
|
}
|
|
156
156
|
addCheckboxToDiv(e, t, s, i) {
|
|
157
157
|
const o = this.domService.createElement("div"), r = t === "full" ? "checked" : "";
|
|
@@ -178,7 +178,7 @@ class Q {
|
|
|
178
178
|
}
|
|
179
179
|
return this.domService.appendChild(e, n), n;
|
|
180
180
|
}
|
|
181
|
-
addSortedIcon(e, t = "", s = new
|
|
181
|
+
addSortedIcon(e, t = "", s = new z(), i = -1) {
|
|
182
182
|
const o = this.domService.createElement("div");
|
|
183
183
|
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");
|
|
184
184
|
let r;
|
|
@@ -189,15 +189,15 @@ class Q {
|
|
|
189
189
|
this.domService.addClass(o, a);
|
|
190
190
|
return this.domService.appendChild(e, o), o;
|
|
191
191
|
}
|
|
192
|
-
addArrowDiv(e, t = "none", s = new
|
|
192
|
+
addArrowDiv(e, t = "none", s = new X(), i = -1, o = -1, r = "body") {
|
|
193
193
|
const n = this.domService.createElement("div");
|
|
194
194
|
this.domService.addClass(n, "ge-table-tree-arrow-div"), this.domService.setStyle(n, "display", "inline-block"), this.domService.setStyle(n, "position", ""), this.domService.setStyle(n, "width", "20px"), this.domService.setStyle(n, "background", "transparent"), this.domService.setStyle(n, "cursor", "pointer"), this.domService.setAttribute(n, "data-row-index", `${i}`), this.domService.setAttribute(n, "data-col-index", `${o}`), this.domService.setAttribute(n, "data-area", `${r}`);
|
|
195
195
|
let l;
|
|
196
196
|
t === "expanded" ? l = s.arrowExpanded : t === "collapsed" ? l = s.arrowCollapsed : l = s.arrowPlaceholder;
|
|
197
197
|
const a = l.content, d = this.domService.createText(a);
|
|
198
198
|
this.domService.appendChild(n, d), l.style && this.applyStyleString(n, l.style);
|
|
199
|
-
for (const
|
|
200
|
-
this.domService.addClass(n,
|
|
199
|
+
for (const S of l.classes)
|
|
200
|
+
this.domService.addClass(n, S);
|
|
201
201
|
return this.domService.appendChild(e, n), n;
|
|
202
202
|
}
|
|
203
203
|
addColumnBorderDivs(e, t, s, i, o) {
|
|
@@ -240,7 +240,7 @@ class Q {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
const H = (p) => p === "header" ? "header" : p === "footer" ? "footer" : "body";
|
|
243
|
-
class
|
|
243
|
+
class ee {
|
|
244
244
|
constructor(e, t) {
|
|
245
245
|
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)) {
|
|
246
246
|
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"));
|
|
@@ -252,19 +252,33 @@ class Z {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
class
|
|
255
|
+
class te {
|
|
256
256
|
constructor(e) {
|
|
257
257
|
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(
|
|
258
258
|
(t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
|
|
259
259
|
);
|
|
260
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Handles the "contextmenu" event.
|
|
263
|
+
*
|
|
264
|
+
* @private
|
|
265
|
+
* @param {MouseEvent} evt - The mouse event object.
|
|
266
|
+
* @return {void}
|
|
267
|
+
*/
|
|
261
268
|
onContextmenu(e) {
|
|
262
269
|
this.mouseEvent = e;
|
|
263
270
|
const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
|
|
264
271
|
this.tableScope.contextmenu(t);
|
|
265
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Handles the click event on the host element.
|
|
275
|
+
*
|
|
276
|
+
* @param {MouseEvent} event - The click event.
|
|
277
|
+
*
|
|
278
|
+
* @return {void}
|
|
279
|
+
*/
|
|
266
280
|
onHostElementClicked(e) {
|
|
267
|
-
const t = new
|
|
281
|
+
const t = new ee(e.target, this.tableScope);
|
|
268
282
|
if (t.action === "toggleExpandCollapseAll")
|
|
269
283
|
this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
|
|
270
284
|
else if (t.inputType === "checkbox" && t.areaIdent)
|
|
@@ -283,6 +297,12 @@ class ee {
|
|
|
283
297
|
}
|
|
284
298
|
this.publishGeMouseEvent(e, 1);
|
|
285
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Handles the double click event on the host element.
|
|
302
|
+
* This method is private.
|
|
303
|
+
*
|
|
304
|
+
* @param {MouseEvent} event - The double click event.
|
|
305
|
+
*/
|
|
286
306
|
onHostElementDblClicked(e) {
|
|
287
307
|
if (e.target instanceof HTMLElement) {
|
|
288
308
|
const t = e.target, s = t.getAttribute("data-area"), i = H(s), o = Number(t.getAttribute("data-row-index")), r = Number(t.getAttribute("data-col-index")), n = this.tableScope.tableModel.getAreaModel(i);
|
|
@@ -299,16 +319,30 @@ class ee {
|
|
|
299
319
|
}
|
|
300
320
|
this.publishGeMouseEvent(e, 2);
|
|
301
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Publishes a GeMouseEvent.
|
|
324
|
+
*
|
|
325
|
+
* @param {MouseEvent} event - The MouseEvent to publish.
|
|
326
|
+
* @param {number} clickCount - The number of clicks for the GeMouseEvent.
|
|
327
|
+
*
|
|
328
|
+
* @return {void}
|
|
329
|
+
*/
|
|
302
330
|
publishGeMouseEvent(e, t) {
|
|
303
331
|
var s;
|
|
304
332
|
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);
|
|
305
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Update the collapsed/expanded state of a tree row.
|
|
336
|
+
*
|
|
337
|
+
* @param {TreeRowIf<any>} tr - The tree row object.
|
|
338
|
+
* @returns {void}
|
|
339
|
+
*/
|
|
306
340
|
updateCollapsedExpandedState(e) {
|
|
307
341
|
var s, i, o, r, n;
|
|
308
342
|
const t = (i = (s = this.tableScope.tableOptions) == null ? void 0 : s.autoRestoreOptions) == null ? void 0 : i.getRowId;
|
|
309
343
|
if (t) {
|
|
310
|
-
const l = (o = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : o.collapsedExpandedStateGet().mode, a = l === "collapsed" && !e.expanded || l === "expanded" && e.expanded, d = l === "collapsed" && e.expanded || l === "expanded" && !e.expanded,
|
|
311
|
-
a ? (r = this.tableScope.storeStateCollapsedExpandService) == null || r.collapsedStateIdsPush(
|
|
344
|
+
const l = (o = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : o.collapsedExpandedStateGet().mode, a = l === "collapsed" && !e.expanded || l === "expanded" && e.expanded, d = l === "collapsed" && e.expanded || l === "expanded" && !e.expanded, S = t(e.data);
|
|
345
|
+
a ? (r = this.tableScope.storeStateCollapsedExpandService) == null || r.collapsedStateIdsPush(S) : d && ((n = this.tableScope.storeStateCollapsedExpandService) == null || n.collapsedStateIdsRemove(S));
|
|
312
346
|
}
|
|
313
347
|
}
|
|
314
348
|
getArrowColumnIndex() {
|
|
@@ -344,35 +378,107 @@ class ee {
|
|
|
344
378
|
}
|
|
345
379
|
}
|
|
346
380
|
}
|
|
347
|
-
class
|
|
381
|
+
class se {
|
|
348
382
|
constructor(e) {
|
|
349
383
|
this.tableScope = e;
|
|
350
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Updates the cells in the table based on the provided events.
|
|
387
|
+
*
|
|
388
|
+
* @param {TableCellUpdateEventIf[]} events - The array of events representing the updates to perform on the cells.
|
|
389
|
+
* @param {boolean} [repaintAll=false] - Optional parameter indicating whether to repaint all cells or not. Default value is false. If true, the full table will be rendered. If false, the table cell will be rendered immediately.
|
|
390
|
+
*
|
|
391
|
+
* @return {void} - This method doesn't return anything.
|
|
392
|
+
*/
|
|
351
393
|
updateCells(e, t = !1) {
|
|
352
394
|
this.tableScope.updateCells(e, t);
|
|
353
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Notifies that the external filter has changed.
|
|
398
|
+
*
|
|
399
|
+
* @return {void}
|
|
400
|
+
*/
|
|
354
401
|
externalFilterChanged() {
|
|
355
402
|
this.tableScope.externalFilterChanged();
|
|
356
403
|
}
|
|
404
|
+
/**
|
|
405
|
+
* Scrolls the table body to the specified pixel coordinates.
|
|
406
|
+
*
|
|
407
|
+
* @param {number} _px - The horizontal pixel coordinate to scroll to. Defaults to 0.
|
|
408
|
+
* @param {number} _py - The vertical pixel coordinate to scroll to. Defaults to 0.
|
|
409
|
+
* @return {void}
|
|
410
|
+
*/
|
|
357
411
|
scrollToPixel(e = 0, t = 0) {
|
|
358
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Scrolls to the specified index in both horizontal and vertical directions.
|
|
415
|
+
*
|
|
416
|
+
* @param {number} _indexX - The index of the column to scroll to in the horizontal direction. Default is 0.
|
|
417
|
+
* @param {number} _indexY - The index of the row to scroll to in the vertical direction. Default is 0.
|
|
418
|
+
*
|
|
419
|
+
* @return undefined
|
|
420
|
+
*/
|
|
359
421
|
scrollToIndex(e = 0, t = 0) {
|
|
360
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* Sets whether the header is visible or not.
|
|
425
|
+
*
|
|
426
|
+
* @param _visible - A boolean value indicating whether the header should be visible. Default value is true.
|
|
427
|
+
*
|
|
428
|
+
* @return undefined
|
|
429
|
+
*/
|
|
361
430
|
setHeaderVisible(e = !0) {
|
|
362
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Sets the visibility of a column in the table.
|
|
434
|
+
*
|
|
435
|
+
* @param {_column} - The column index or column definition to set visibility for.
|
|
436
|
+
* @param {_visible=true} - The flag to set visibility to. true for visible, false for hidden.
|
|
437
|
+
*
|
|
438
|
+
* @return {void} - There is no return value.
|
|
439
|
+
*/
|
|
363
440
|
setColumnVisible(e, t = !0) {
|
|
364
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Returns whether a column is visible or not.
|
|
444
|
+
*
|
|
445
|
+
* @param {number | ColumnDefIf} _column - The column index or the column definition.
|
|
446
|
+
* @return {boolean} - True if the column is visible, false otherwise.
|
|
447
|
+
*/
|
|
365
448
|
isColumnVisible(e) {
|
|
366
449
|
return !0;
|
|
367
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Checks if the header is visible.
|
|
453
|
+
*
|
|
454
|
+
* @return {boolean} - Returns true if the header is visible, otherwise returns false.
|
|
455
|
+
*/
|
|
368
456
|
isHeaderVisible() {
|
|
369
457
|
return !0;
|
|
370
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* Sets the visibility of the footer.
|
|
461
|
+
*
|
|
462
|
+
* @param {boolean} _visible - Indicates whether the footer should be visible or not. Default value is true.
|
|
463
|
+
*
|
|
464
|
+
* @return {void} - This method does not return any value.
|
|
465
|
+
*/
|
|
371
466
|
setFooterVisible(e = !0) {
|
|
372
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Determines if the footer is visible.
|
|
470
|
+
*
|
|
471
|
+
* @returns {boolean} True if the footer is visible, false otherwise.
|
|
472
|
+
*/
|
|
373
473
|
isFooterVisible() {
|
|
374
474
|
return !0;
|
|
375
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Repaints the table.
|
|
478
|
+
*
|
|
479
|
+
* This method calls the repaint method of the tableScope object
|
|
480
|
+
* to update and redraw the table based on the latest data.
|
|
481
|
+
*/
|
|
376
482
|
repaint() {
|
|
377
483
|
this.tableScope.repaint();
|
|
378
484
|
}
|
|
@@ -452,7 +558,7 @@ class P {
|
|
|
452
558
|
// }
|
|
453
559
|
// }
|
|
454
560
|
}
|
|
455
|
-
class
|
|
561
|
+
class ie extends P {
|
|
456
562
|
constructor(e) {
|
|
457
563
|
super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
|
|
458
564
|
}
|
|
@@ -474,14 +580,14 @@ class se extends P {
|
|
|
474
580
|
}
|
|
475
581
|
}
|
|
476
582
|
}
|
|
477
|
-
class
|
|
583
|
+
class oe {
|
|
478
584
|
constructor(e = "collapsed", t = [], s = !1, i = !1) {
|
|
479
585
|
this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = i;
|
|
480
586
|
}
|
|
481
587
|
}
|
|
482
|
-
class
|
|
588
|
+
class le extends P {
|
|
483
589
|
constructor(e) {
|
|
484
|
-
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new
|
|
590
|
+
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new oe(), this.load();
|
|
485
591
|
}
|
|
486
592
|
collapsedExpandedStateGet() {
|
|
487
593
|
return this.collapsedExpandedState;
|
|
@@ -513,7 +619,7 @@ class oe extends P {
|
|
|
513
619
|
this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
|
|
514
620
|
}
|
|
515
621
|
}
|
|
516
|
-
class
|
|
622
|
+
class re extends P {
|
|
517
623
|
constructor(e) {
|
|
518
624
|
super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
|
|
519
625
|
}
|
|
@@ -540,7 +646,7 @@ class T {
|
|
|
540
646
|
this.left = e, this.width = t, this.height = s, this.top = i, this.index = o;
|
|
541
647
|
}
|
|
542
648
|
}
|
|
543
|
-
class
|
|
649
|
+
class ne {
|
|
544
650
|
constructor(e, t, s, i) {
|
|
545
651
|
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();
|
|
546
652
|
const o = this.hostElement;
|
|
@@ -691,12 +797,21 @@ class re {
|
|
|
691
797
|
this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
|
|
692
798
|
}
|
|
693
799
|
}
|
|
694
|
-
class
|
|
800
|
+
class R {
|
|
801
|
+
/**
|
|
802
|
+
* Represents a constructor for a class.
|
|
803
|
+
* @constructor
|
|
804
|
+
* @param {number} r1 - The value for r1.
|
|
805
|
+
* @param {number} c1 - The value for c1.
|
|
806
|
+
* @param {number} r2 - The value for r2.
|
|
807
|
+
* @param {number} c2 - The value for c2.
|
|
808
|
+
* @param {boolean} [gammaRange=false] - The value for gammaRange. Defaults to false. gammaRange will be used for AreaModelCellGroups, but it's not implemented yet!
|
|
809
|
+
*/
|
|
695
810
|
constructor(e, t, s, i, o = !1) {
|
|
696
811
|
this.r1 = e, this.c1 = t, this.r2 = s, this.c2 = i, this.gammaRange = o;
|
|
697
812
|
}
|
|
698
813
|
static create(e) {
|
|
699
|
-
return e.gammaRange === void 0 && (e.gammaRange = !1), new
|
|
814
|
+
return e.gammaRange === void 0 && (e.gammaRange = !1), new R(
|
|
700
815
|
e.rowIndex1,
|
|
701
816
|
e.columnIndex1,
|
|
702
817
|
e.rowIndex2,
|
|
@@ -705,19 +820,19 @@ class A {
|
|
|
705
820
|
);
|
|
706
821
|
}
|
|
707
822
|
static singleCell(e, t) {
|
|
708
|
-
return new
|
|
823
|
+
return new R(e, t, e, t);
|
|
709
824
|
}
|
|
710
825
|
static singleRow(e) {
|
|
711
|
-
return new
|
|
826
|
+
return new R(e, 0, e, Number.MAX_SAFE_INTEGER);
|
|
712
827
|
}
|
|
713
828
|
static singleColumn(e) {
|
|
714
|
-
return new
|
|
829
|
+
return new R(0, e, Number.MAX_SAFE_INTEGER, e);
|
|
715
830
|
}
|
|
716
831
|
isInRange(e, t) {
|
|
717
832
|
return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
|
|
718
833
|
}
|
|
719
834
|
}
|
|
720
|
-
class
|
|
835
|
+
class ae {
|
|
721
836
|
constructor(e, t) {
|
|
722
837
|
this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
|
|
723
838
|
}
|
|
@@ -733,7 +848,7 @@ class ne {
|
|
|
733
848
|
o === 0 && (o = 1), r === 0 && (r = 1);
|
|
734
849
|
const n = this.areaModel.hasOwnProperty("gammaCells");
|
|
735
850
|
this.colAndRowspanRanges.push(
|
|
736
|
-
new
|
|
851
|
+
new R(s, i, s + r - 1, i + o - 1, n)
|
|
737
852
|
);
|
|
738
853
|
}
|
|
739
854
|
}
|
|
@@ -750,22 +865,22 @@ class ne {
|
|
|
750
865
|
return !1;
|
|
751
866
|
}
|
|
752
867
|
}
|
|
753
|
-
class
|
|
868
|
+
class de {
|
|
754
869
|
constructor(e, t, s) {
|
|
755
870
|
this.header = e, this.body = t, this.footer = s;
|
|
756
871
|
}
|
|
757
872
|
}
|
|
758
|
-
class
|
|
873
|
+
class he extends ne {
|
|
759
874
|
constructor(e, t, s, i) {
|
|
760
875
|
var r, n;
|
|
761
876
|
super(e, t, s, i), this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
762
877
|
header: [],
|
|
763
878
|
body: [],
|
|
764
879
|
footer: []
|
|
765
|
-
}, this.tree = !1, this.colAndRowspanModels = new
|
|
880
|
+
}, this.tree = !1, this.colAndRowspanModels = new de(), 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), (n = this.tableOptions) != null && n.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), $(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
766
881
|
(l) => {
|
|
767
882
|
var a;
|
|
768
|
-
this.colAndRowspanModels[l] = new
|
|
883
|
+
this.colAndRowspanModels[l] = new ae(t, t.getAreaModel(l)), (a = this.colAndRowspanModels[l]) == null || a.init();
|
|
769
884
|
}
|
|
770
885
|
);
|
|
771
886
|
}
|
|
@@ -884,87 +999,87 @@ class de extends re {
|
|
|
884
999
|
return "";
|
|
885
1000
|
}
|
|
886
1001
|
adjustArea(e, t = 0) {
|
|
887
|
-
var
|
|
1002
|
+
var c;
|
|
888
1003
|
const s = this.getArea(e, "west"), i = this.getArea(e, "center"), o = this.getArea(e, "east"), r = i.child.clientHeight;
|
|
889
1004
|
s.child.innerText = "", i.child.innerText = "", o.child.innerText = "";
|
|
890
|
-
const n = 0, l = this.areaBodyCenterGeo.width, a = this.tableModel.getPadding(), d = this.tableModel.getAreaModel(e),
|
|
1005
|
+
const n = 0, l = this.areaBodyCenterGeo.width, a = this.tableModel.getPadding(), d = this.tableModel.getAreaModel(e), S = d.getRowCount();
|
|
891
1006
|
for (; this.cleanupFunctions[e].length; ) {
|
|
892
|
-
const
|
|
893
|
-
|
|
1007
|
+
const u = this.cleanupFunctions[e].shift();
|
|
1008
|
+
u && u();
|
|
894
1009
|
}
|
|
895
1010
|
let g = t;
|
|
896
|
-
const m = this.tableModel.getColumnCount(),
|
|
897
|
-
for (let
|
|
898
|
-
const
|
|
899
|
-
if (
|
|
900
|
-
this.firstVisibleRowIndex =
|
|
901
|
-
let
|
|
902
|
-
const
|
|
1011
|
+
const m = this.tableModel.getColumnCount(), h = this.tableModel.getFixedRightColumnCount(), f = this.tableModel.getFixedLeftColumnCount();
|
|
1012
|
+
for (let u = 0; u < S; u++) {
|
|
1013
|
+
const w = g, C = u === S - 1, x = this.tableModel.getRowHeight(e, u);
|
|
1014
|
+
if (w + x > 0) {
|
|
1015
|
+
this.firstVisibleRowIndex = u;
|
|
1016
|
+
let y = { left: n, width: l, height: x, top: w, index: u }, v = this.dom.addRowDiv(i, y, u, e, "center");
|
|
1017
|
+
const E = f;
|
|
903
1018
|
if (this.adjustColumnsToRowParent({
|
|
904
1019
|
areaIdent: e,
|
|
905
1020
|
sideIdent: "center",
|
|
906
1021
|
areaModel: d,
|
|
907
|
-
geo:
|
|
908
|
-
parent:
|
|
909
|
-
rowIndex:
|
|
910
|
-
columnIndexStart:
|
|
911
|
-
columnIndexEnd: m -
|
|
1022
|
+
geo: y,
|
|
1023
|
+
parent: v,
|
|
1024
|
+
rowIndex: u,
|
|
1025
|
+
columnIndexStart: E,
|
|
1026
|
+
columnIndexEnd: m - h - 1,
|
|
912
1027
|
verticalFixed: !1,
|
|
913
|
-
lastRowOfModel:
|
|
914
|
-
}), a.left > 0 && (
|
|
1028
|
+
lastRowOfModel: C
|
|
1029
|
+
}), a.left > 0 && (y = { left: n, width: this.areaBodyWestGeo.width, height: x, top: w, index: u }, v = this.dom.addRowDiv(s, y, u, e, "west"), this.adjustColumnsToRowParent({
|
|
915
1030
|
areaIdent: e,
|
|
916
1031
|
sideIdent: "west",
|
|
917
1032
|
areaModel: d,
|
|
918
|
-
geo:
|
|
919
|
-
parent:
|
|
920
|
-
rowIndex:
|
|
1033
|
+
geo: y,
|
|
1034
|
+
parent: v,
|
|
1035
|
+
rowIndex: u,
|
|
921
1036
|
columnIndexStart: 0,
|
|
922
|
-
columnIndexEnd:
|
|
1037
|
+
columnIndexEnd: E - 1,
|
|
923
1038
|
verticalFixed: !0,
|
|
924
|
-
lastRowOfModel:
|
|
925
|
-
})), a.right > 0 && (
|
|
1039
|
+
lastRowOfModel: C
|
|
1040
|
+
})), a.right > 0 && (y = { left: n, width: this.areaBodyEastGeo.width, height: x, top: w, index: u }, v = this.dom.addRowDiv(o, y, u, e, "east"), this.adjustColumnsToRowParent({
|
|
926
1041
|
areaIdent: e,
|
|
927
1042
|
sideIdent: "east",
|
|
928
1043
|
areaModel: d,
|
|
929
|
-
geo:
|
|
930
|
-
parent:
|
|
931
|
-
rowIndex:
|
|
932
|
-
columnIndexStart: m -
|
|
1044
|
+
geo: y,
|
|
1045
|
+
parent: v,
|
|
1046
|
+
rowIndex: u,
|
|
1047
|
+
columnIndexStart: m - h,
|
|
933
1048
|
columnIndexEnd: m - 1,
|
|
934
1049
|
verticalFixed: !0,
|
|
935
|
-
lastRowOfModel:
|
|
936
|
-
})), e === "header" && this.tree &&
|
|
937
|
-
const
|
|
1050
|
+
lastRowOfModel: C
|
|
1051
|
+
})), e === "header" && this.tree && u === S - 1) {
|
|
1052
|
+
const A = this.dom.applyStyle(
|
|
938
1053
|
this.dom.setAttribute(
|
|
939
|
-
this.dom.addDiv(
|
|
1054
|
+
this.dom.addDiv(v, new T(16, 20, 20, 8)),
|
|
940
1055
|
"data-ge-action",
|
|
941
1056
|
"toggleExpandCollapseAll"
|
|
942
1057
|
),
|
|
943
1058
|
{ cursor: "pointer" }
|
|
944
|
-
),
|
|
945
|
-
if (
|
|
946
|
-
const I = this.dom.domService.createText(
|
|
947
|
-
this.dom.domService.appendChild(
|
|
1059
|
+
), M = this.tableOptions.treeOptions.arrowExpandCollapseAll;
|
|
1060
|
+
if (M) {
|
|
1061
|
+
const I = this.dom.domService.createText(M.content);
|
|
1062
|
+
this.dom.domService.appendChild(A, I), M.style && this.dom.applyStyleString(A, M.style);
|
|
948
1063
|
}
|
|
949
1064
|
}
|
|
950
1065
|
}
|
|
951
|
-
if (g = g +
|
|
1066
|
+
if (g = g + x, g > r)
|
|
952
1067
|
break;
|
|
953
1068
|
}
|
|
954
1069
|
if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
|
|
955
|
-
const
|
|
956
|
-
if (
|
|
957
|
-
for (const
|
|
958
|
-
let
|
|
959
|
-
if (
|
|
960
|
-
|
|
961
|
-
else if (
|
|
962
|
-
|
|
1070
|
+
const u = ((c = this.colAndRowspanModels[e]) == null ? void 0 : c.getRanges()) ?? [];
|
|
1071
|
+
if (u.length)
|
|
1072
|
+
for (const w of u) {
|
|
1073
|
+
let C = 0, x = i.child, y = "center";
|
|
1074
|
+
if (w.c1 < f)
|
|
1075
|
+
x = s.child, y = "west";
|
|
1076
|
+
else if (h > 0 && w.c1 >= m - h)
|
|
1077
|
+
x = o.child, y = "east";
|
|
963
1078
|
else {
|
|
964
|
-
const
|
|
965
|
-
|
|
1079
|
+
const v = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1080
|
+
C = this.scrollFactorX * v - this.areaBodyWestGeo.width, y = "center";
|
|
966
1081
|
}
|
|
967
|
-
this.drawBigCell(
|
|
1082
|
+
this.drawBigCell(w, C, t, d, x, y);
|
|
968
1083
|
}
|
|
969
1084
|
}
|
|
970
1085
|
}
|
|
@@ -979,24 +1094,24 @@ class de extends re {
|
|
|
979
1094
|
* @protected
|
|
980
1095
|
*/
|
|
981
1096
|
drawBigCell(e, t, s, i, o, r) {
|
|
982
|
-
const n = s + this.getRowHeights(0, e.r1 - 1, i).reduce((
|
|
1097
|
+
const n = s + this.getRowHeights(0, e.r1 - 1, i).reduce((c, u) => c + u, 0), l = this.tableModel.getColumnCount(), a = this.tableModel.getFixedRightColumnCount();
|
|
983
1098
|
let d = 0;
|
|
984
1099
|
a > 0 && e.c1 >= l - a && (d = l - a);
|
|
985
|
-
const
|
|
986
|
-
let
|
|
987
|
-
const
|
|
988
|
-
|
|
1100
|
+
const S = t + this.getColumnWidths(d, e.c1 - 1).reduce((c, u) => c + u, 0), g = this.getRowHeights(e.r1, e.r2, i).reduce((c, u) => c + u, 0), m = this.getColumnWidths(e.c1, e.c2).reduce((c, u) => c + u, 0);
|
|
1101
|
+
let h = !1;
|
|
1102
|
+
const f = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
1103
|
+
f && (h = f.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? (console.info("TODO here", e), this.renderCell({
|
|
989
1104
|
areaModel: i,
|
|
990
1105
|
areaIdent: i.areaIdent,
|
|
991
1106
|
sideIdent: r,
|
|
992
1107
|
rowIndex: e.r1,
|
|
993
1108
|
columnIndex: e.c1,
|
|
994
|
-
left:
|
|
1109
|
+
left: S,
|
|
995
1110
|
top: n,
|
|
996
1111
|
width: m,
|
|
997
1112
|
height: g,
|
|
998
1113
|
parent: o,
|
|
999
|
-
cellSelected:
|
|
1114
|
+
cellSelected: h,
|
|
1000
1115
|
lastRowOfModel: !0,
|
|
1001
1116
|
gammaRange: e.gammaRange
|
|
1002
1117
|
})) : this.renderCell({
|
|
@@ -1005,18 +1120,18 @@ class de extends re {
|
|
|
1005
1120
|
sideIdent: r,
|
|
1006
1121
|
rowIndex: e.r1,
|
|
1007
1122
|
columnIndex: e.c1,
|
|
1008
|
-
left:
|
|
1123
|
+
left: S,
|
|
1009
1124
|
top: n,
|
|
1010
1125
|
width: m,
|
|
1011
1126
|
height: g,
|
|
1012
1127
|
parent: o,
|
|
1013
|
-
cellSelected:
|
|
1128
|
+
cellSelected: h,
|
|
1014
1129
|
lastRowOfModel: !0,
|
|
1015
1130
|
gammaRange: e.gammaRange
|
|
1016
1131
|
}), i.areaIdent === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
1017
1132
|
rowIndex: e.r1,
|
|
1018
1133
|
columnIndex: e.c1,
|
|
1019
|
-
cellLeft:
|
|
1134
|
+
cellLeft: S,
|
|
1020
1135
|
cellTop: n,
|
|
1021
1136
|
cellWidth: m,
|
|
1022
1137
|
cellHeight: g,
|
|
@@ -1046,59 +1161,59 @@ class de extends re {
|
|
|
1046
1161
|
verticalFixed: a = !1,
|
|
1047
1162
|
lastRowOfModel: d = !1
|
|
1048
1163
|
}) {
|
|
1049
|
-
var
|
|
1164
|
+
var f;
|
|
1050
1165
|
this.scrollViewportLeft = this.scrollViewport.scrollLeft;
|
|
1051
|
-
let
|
|
1166
|
+
let S = 0;
|
|
1052
1167
|
if (!a) {
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1168
|
+
const c = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1169
|
+
S = this.scrollFactorX * c;
|
|
1055
1170
|
}
|
|
1056
1171
|
const g = 0, m = !!(e === "body" && t);
|
|
1057
|
-
let
|
|
1058
|
-
for (let
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
1061
|
-
let
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
let
|
|
1065
|
-
|
|
1066
|
-
let
|
|
1067
|
-
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (
|
|
1068
|
-
this.renderDragTargetDiv(o,
|
|
1069
|
-
const
|
|
1070
|
-
this.dom.addColumnBorderDivs(this.tableOptions, o,
|
|
1172
|
+
let h = S;
|
|
1173
|
+
for (let c = n; c <= l; c++) {
|
|
1174
|
+
const u = h, w = this.tableModel.getColumnWidth(c);
|
|
1175
|
+
if (w > 0 && u + w > 0) {
|
|
1176
|
+
let C = i.height;
|
|
1177
|
+
const x = s.getRowspanAt(r, c), y = s.getColspanAt(r, c);
|
|
1178
|
+
x > 1 && (C = this.getRowHeights(r, r + x - 1, s).reduce((A, M) => A + M, 0));
|
|
1179
|
+
let v = w;
|
|
1180
|
+
y > 1 && (v = this.getColumnWidths(c, c + y - 1).reduce((A, M) => A + M, 0));
|
|
1181
|
+
let E = !1;
|
|
1182
|
+
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (f = this.colAndRowspanModels[e]) != null && f.isInRange(r, c) && (E = !0), this.draggingTargetColumnIndex === c && e !== "header") {
|
|
1183
|
+
this.renderDragTargetDiv(o, u, g, v, C);
|
|
1184
|
+
const A = { left: u, top: g, width: v, height: C };
|
|
1185
|
+
this.dom.addColumnBorderDivs(this.tableOptions, o, A, e, t);
|
|
1071
1186
|
} else {
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1187
|
+
const A = this.renderSelectedBackgroundDiv(E, m, t, s, r, c, o, u, g, v, C);
|
|
1188
|
+
E || this.renderCell({
|
|
1074
1189
|
areaModel: s,
|
|
1075
1190
|
areaIdent: e,
|
|
1076
1191
|
sideIdent: t,
|
|
1077
1192
|
rowIndex: r,
|
|
1078
|
-
columnIndex:
|
|
1079
|
-
left:
|
|
1193
|
+
columnIndex: c,
|
|
1194
|
+
left: u,
|
|
1080
1195
|
top: g,
|
|
1081
|
-
width:
|
|
1082
|
-
height:
|
|
1196
|
+
width: v,
|
|
1197
|
+
height: C,
|
|
1083
1198
|
parent: o,
|
|
1084
|
-
cellSelected:
|
|
1199
|
+
cellSelected: A,
|
|
1085
1200
|
lastRowOfModel: d,
|
|
1086
1201
|
gammaRange: !0
|
|
1087
1202
|
}), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
1088
1203
|
rowIndex: r,
|
|
1089
|
-
columnIndex:
|
|
1090
|
-
cellLeft:
|
|
1204
|
+
columnIndex: c,
|
|
1205
|
+
cellLeft: u,
|
|
1091
1206
|
cellTop: g,
|
|
1092
|
-
cellWidth:
|
|
1093
|
-
cellHeight:
|
|
1207
|
+
cellWidth: v,
|
|
1208
|
+
cellHeight: C,
|
|
1094
1209
|
parent: o
|
|
1095
1210
|
});
|
|
1096
1211
|
}
|
|
1097
1212
|
}
|
|
1098
|
-
if (
|
|
1213
|
+
if (h = h + w, h > this.areaBodyCenterGeo.width)
|
|
1099
1214
|
break;
|
|
1100
1215
|
}
|
|
1101
|
-
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(
|
|
1216
|
+
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(h - 1, 1, i.height, 0), o);
|
|
1102
1217
|
}
|
|
1103
1218
|
getTreeArrowColumnIndex() {
|
|
1104
1219
|
return this.tableOptions.showCheckboxWihoutExtraColumn ? 0 : this.tableModel.isRowCheckboxVisible() ? 1 : 0;
|
|
@@ -1114,49 +1229,50 @@ class de extends re {
|
|
|
1114
1229
|
height: l,
|
|
1115
1230
|
top: a,
|
|
1116
1231
|
parent: d,
|
|
1117
|
-
lastRowOfModel:
|
|
1232
|
+
lastRowOfModel: S,
|
|
1233
|
+
gammaRange: g
|
|
1118
1234
|
}) {
|
|
1119
|
-
var
|
|
1120
|
-
const
|
|
1121
|
-
let
|
|
1122
|
-
if (o === this.getTreeArrowColumnIndex() && O(
|
|
1123
|
-
const
|
|
1124
|
-
(
|
|
1235
|
+
var k;
|
|
1236
|
+
const h = this.editorRenderer && this.editorRendererRow === i && this.editorRendererColumn === o ? this.editorRenderer : e.getCellRenderer(i, o), f = { left: r, width: n, height: l, top: a, index: o }, c = e.getRowByIndex(i);
|
|
1237
|
+
let u = "none";
|
|
1238
|
+
if (o === this.getTreeArrowColumnIndex() && O(c)) {
|
|
1239
|
+
const b = c;
|
|
1240
|
+
(k = b.children) != null && k.length ? b.expanded ? u = "expanded" : u = "collapsed" : u = "hidden";
|
|
1125
1241
|
}
|
|
1126
1242
|
let C;
|
|
1127
1243
|
if (t === "header") {
|
|
1128
|
-
const
|
|
1129
|
-
(!(
|
|
1244
|
+
const b = this.tableModel.getColumnDef(o);
|
|
1245
|
+
(!(b != null && b.sortIconVisible) || b != null && b.sortIconVisible()) && (C = b == null ? void 0 : b.sortState);
|
|
1130
1246
|
}
|
|
1131
|
-
const x = e.getValueAt(i, o),
|
|
1247
|
+
const x = e.getValueAt(i, o), y = h ? "" : `${x}`, v = e.isRowChecked(i), E = this.dom.addColumnDiv(
|
|
1132
1248
|
d,
|
|
1133
|
-
|
|
1249
|
+
f,
|
|
1134
1250
|
i,
|
|
1135
1251
|
o,
|
|
1136
1252
|
t,
|
|
1137
1253
|
s,
|
|
1138
|
-
|
|
1139
|
-
|
|
1254
|
+
y,
|
|
1255
|
+
u,
|
|
1140
1256
|
this.tableOptions,
|
|
1141
1257
|
v,
|
|
1142
1258
|
C
|
|
1143
|
-
),
|
|
1144
|
-
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
let
|
|
1148
|
-
|
|
1149
|
-
const
|
|
1150
|
-
if (
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1259
|
+
), A = e.getTooltipAt(i, o);
|
|
1260
|
+
A && this.dom.setAttribute(E, "title", A);
|
|
1261
|
+
const M = this.tableModel.getColumnDef(o);
|
|
1262
|
+
M && M.classes[t] && this.dom.addClasses(M.classes[t], E);
|
|
1263
|
+
let I;
|
|
1264
|
+
h && (I = h.render(E, i, o, t, e, x, this.dom.domService));
|
|
1265
|
+
const G = e.getCustomClassesAt(i, o);
|
|
1266
|
+
if (G.length && this.dom.addClasses(G, E), this.dom.addColumnBorderDivs(this.tableOptions, d, f, t, s), S && this.dom.addHorizontalBorder({ left: r, width: n, height: l, top: a + l }, d), this.getFocusModel && t === "body") {
|
|
1267
|
+
const b = this.getFocusModel();
|
|
1268
|
+
b != null && b.hasFocus(i, o) && this.dom.addFocusBorderDivs(d, f, {});
|
|
1153
1269
|
}
|
|
1154
|
-
t === "header" && this.dom.setAttribute(
|
|
1270
|
+
t === "header" && this.dom.setAttribute(E, "data-ge-action", "drag-column");
|
|
1155
1271
|
const L = e.getCustomStyleAt(i, o);
|
|
1156
1272
|
if (L)
|
|
1157
|
-
for (const
|
|
1158
|
-
this.dom.setStyle(
|
|
1159
|
-
return [
|
|
1273
|
+
for (const b in L)
|
|
1274
|
+
this.dom.setStyle(E, b, L[b]);
|
|
1275
|
+
return [E, I];
|
|
1160
1276
|
}
|
|
1161
1277
|
applyCssClasses(e, t = {}) {
|
|
1162
1278
|
e && Object.entries(t).forEach(([s, i]) => {
|
|
@@ -1167,19 +1283,19 @@ class de extends re {
|
|
|
1167
1283
|
const r = this.tableModel.getAreaModel(e), n = 'div[data-col-index="' + s + '"][data-row-index="' + t + '"][data-area="' + e + '"]', l = document.querySelector(n);
|
|
1168
1284
|
if (l) {
|
|
1169
1285
|
let a;
|
|
1170
|
-
const
|
|
1171
|
-
if (l.innerText = "", this.applyCssClasses(l, o),
|
|
1172
|
-
a =
|
|
1286
|
+
const S = this.editorRenderer && this.editorRendererRow === t && this.editorRendererColumn === s ? this.editorRenderer : r.getCellRenderer(t, s);
|
|
1287
|
+
if (l.innerText = "", this.applyCssClasses(l, o), S)
|
|
1288
|
+
a = S.render(l, t, s, e, r, i, this.dom.domService), a && this.cleanupFunctions[e].push(a);
|
|
1173
1289
|
else {
|
|
1174
|
-
const
|
|
1175
|
-
this.dom.addLabelDiv(l,
|
|
1290
|
+
const h = `${i}`;
|
|
1291
|
+
this.dom.addLabelDiv(l, h, !1, t, s, e);
|
|
1176
1292
|
}
|
|
1177
1293
|
const g = r.getCustomClassesAt(t, s);
|
|
1178
1294
|
g.length && this.dom.addClasses(g, l);
|
|
1179
1295
|
const m = r.getCustomStyleAt(t, s);
|
|
1180
1296
|
if (m)
|
|
1181
|
-
for (const
|
|
1182
|
-
this.dom.setStyle(l,
|
|
1297
|
+
for (const h in m)
|
|
1298
|
+
this.dom.setStyle(l, h, m[h]);
|
|
1183
1299
|
}
|
|
1184
1300
|
}
|
|
1185
1301
|
getColumnWidths(e, t) {
|
|
@@ -1239,19 +1355,19 @@ class de extends re {
|
|
|
1239
1355
|
);
|
|
1240
1356
|
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;
|
|
1241
1357
|
}
|
|
1242
|
-
renderSelectedBackgroundDiv(e, t, s, i, o, r, n, l, a, d,
|
|
1358
|
+
renderSelectedBackgroundDiv(e, t, s, i, o, r, n, l, a, d, S) {
|
|
1243
1359
|
let g = !1;
|
|
1244
1360
|
if (!e && t && i.isSelectable(o, r) && this.getSelectionModel) {
|
|
1245
1361
|
const m = this.getSelectionModel();
|
|
1246
1362
|
if (m) {
|
|
1247
|
-
const
|
|
1248
|
-
g =
|
|
1249
|
-
for (let
|
|
1250
|
-
const
|
|
1363
|
+
const h = m.getSelectionCount(o, r);
|
|
1364
|
+
g = h > 0;
|
|
1365
|
+
for (let f = 0; f < h; f++) {
|
|
1366
|
+
const c = this.dom.applyStylePosistionAbsolute(
|
|
1251
1367
|
// ge-table-body-west-selected-range
|
|
1252
1368
|
this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`, n)
|
|
1253
1369
|
);
|
|
1254
|
-
this.dom.setStyle(
|
|
1370
|
+
this.dom.setStyle(c, "left", `${l}px`), this.dom.setStyle(c, "top", `${a}px`), this.dom.setStyle(c, "width", `${d}px`), this.dom.setStyle(c, "height", `${S}px`);
|
|
1255
1371
|
}
|
|
1256
1372
|
}
|
|
1257
1373
|
}
|
|
@@ -1268,11 +1384,11 @@ class de extends re {
|
|
|
1268
1384
|
width: l,
|
|
1269
1385
|
height: a,
|
|
1270
1386
|
parent: d,
|
|
1271
|
-
cellSelected:
|
|
1387
|
+
cellSelected: S,
|
|
1272
1388
|
lastRowOfModel: g,
|
|
1273
1389
|
gammaRange: m
|
|
1274
1390
|
}) {
|
|
1275
|
-
const [
|
|
1391
|
+
const [h, f] = this.addAndRenderCellDiv({
|
|
1276
1392
|
areaModel: e,
|
|
1277
1393
|
areaIdent: t,
|
|
1278
1394
|
sideIdent: s,
|
|
@@ -1286,22 +1402,30 @@ class de extends re {
|
|
|
1286
1402
|
lastRowOfModel: g,
|
|
1287
1403
|
gammaRange: m
|
|
1288
1404
|
});
|
|
1289
|
-
|
|
1405
|
+
S && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, h), f && this.cleanupFunctions[t].push(f);
|
|
1290
1406
|
}
|
|
1291
1407
|
renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: s, cellTop: i, cellWidth: o, cellHeight: r, parent: n }) {
|
|
1292
1408
|
const l = this.dom.domService, a = this.tableOptions.columnResizeHandleWidthInPx ?? 2, d = l.createElement("div");
|
|
1293
1409
|
l.setAttribute(d, "data-col-index", `${t}`), l.setAttribute(d, "data-row-index", `${e}`), l.setAttribute(d, "data-area", "header"), l.setAttribute(d, "data-ge-action", "resize-column"), l.addClass(d, "ge-table-column-resize-handle"), l.setStyle(d, "display", "clip"), l.setStyle(d, "position", "absolute"), l.setStyle(d, "cursor", "col-resize"), l.setStyle(d, "left", `${s + o - a}px`), l.setStyle(d, "top", `${i}px`), l.setStyle(d, "width", `${a}px`), l.setStyle(d, "height", `${r}px`), l.appendChild(n, d);
|
|
1294
1410
|
}
|
|
1295
1411
|
}
|
|
1296
|
-
class
|
|
1412
|
+
class ce {
|
|
1297
1413
|
constructor(e, t) {
|
|
1298
1414
|
this.columnIndex = e, this.sortState = t;
|
|
1299
1415
|
}
|
|
1300
1416
|
}
|
|
1301
|
-
class
|
|
1417
|
+
class pe {
|
|
1302
1418
|
constructor(e) {
|
|
1303
1419
|
this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
|
|
1304
1420
|
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Handles the onHostElementChanged event.
|
|
1423
|
+
* In case that the element is an input field, the tableScope.updateModelValueAfterEdit() method is triggered.
|
|
1424
|
+
*
|
|
1425
|
+
* @param {Event} event - The event object.
|
|
1426
|
+
*
|
|
1427
|
+
* @return {void}
|
|
1428
|
+
*/
|
|
1305
1429
|
onHostElementChanged(e) {
|
|
1306
1430
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
|
|
1307
1431
|
const t = e.target, s = t.getAttribute("data-area"), i = t.getAttribute("data-row-index"), o = t.getAttribute("data-col-index");
|
|
@@ -1312,7 +1436,7 @@ class ce {
|
|
|
1312
1436
|
}
|
|
1313
1437
|
}
|
|
1314
1438
|
}
|
|
1315
|
-
class
|
|
1439
|
+
class ue {
|
|
1316
1440
|
constructor(e = -1, t = -1) {
|
|
1317
1441
|
this.rowIndex = e, this.columnIndex = t;
|
|
1318
1442
|
}
|
|
@@ -1322,20 +1446,20 @@ class V {
|
|
|
1322
1446
|
this.cells = e;
|
|
1323
1447
|
}
|
|
1324
1448
|
static createSingle(e, t) {
|
|
1325
|
-
return new V([new
|
|
1449
|
+
return new V([new ue(e, t)]);
|
|
1326
1450
|
}
|
|
1327
1451
|
}
|
|
1328
|
-
class
|
|
1452
|
+
class Se {
|
|
1329
1453
|
constructor(e) {
|
|
1330
1454
|
var t, s;
|
|
1331
1455
|
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);
|
|
1332
1456
|
}
|
|
1333
1457
|
onMouseClicked(e, t) {
|
|
1334
|
-
var o, r, n, l, a, d,
|
|
1458
|
+
var o, r, n, l, a, d, S;
|
|
1335
1459
|
let s = !1, i = !1;
|
|
1336
1460
|
if (this.getSelectionModel && this.getFocusModel) {
|
|
1337
1461
|
const g = this.getSelectionModel(), m = this.getFocusModel();
|
|
1338
|
-
g && m && (m.hasFocus(e.rowIndex, e.columnIndex) || (m.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) : (n = e.originalEvent) != null && n.ctrlKey || (l = e.originalEvent) != null && l.metaKey ? (g.addSelection(
|
|
1462
|
+
g && m && (m.hasFocus(e.rowIndex, e.columnIndex) || (m.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) : (n = e.originalEvent) != null && n.ctrlKey || (l = e.originalEvent) != null && l.metaKey ? (g.addSelection(R.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(R.singleCell(e.rowIndex, e.columnIndex)), i = !0, s = !0));
|
|
1339
1463
|
}
|
|
1340
1464
|
return i ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
|
|
1341
1465
|
}
|
|
@@ -1358,7 +1482,7 @@ class ue {
|
|
|
1358
1482
|
createRangeByEvents(e, t) {
|
|
1359
1483
|
t || (t = e);
|
|
1360
1484
|
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);
|
|
1361
|
-
return
|
|
1485
|
+
return R.create({
|
|
1362
1486
|
rowIndex1: s,
|
|
1363
1487
|
columnIndex1: o,
|
|
1364
1488
|
rowIndex2: i,
|
|
@@ -1366,7 +1490,7 @@ class ue {
|
|
|
1366
1490
|
});
|
|
1367
1491
|
}
|
|
1368
1492
|
}
|
|
1369
|
-
class
|
|
1493
|
+
class ge {
|
|
1370
1494
|
get() {
|
|
1371
1495
|
return {
|
|
1372
1496
|
f2: "START_EDITING",
|
|
@@ -1384,7 +1508,7 @@ class Se {
|
|
|
1384
1508
|
};
|
|
1385
1509
|
}
|
|
1386
1510
|
}
|
|
1387
|
-
class
|
|
1511
|
+
class me {
|
|
1388
1512
|
get() {
|
|
1389
1513
|
return {
|
|
1390
1514
|
f2: "START_EDITING",
|
|
@@ -1404,7 +1528,7 @@ class ge {
|
|
|
1404
1528
|
};
|
|
1405
1529
|
}
|
|
1406
1530
|
}
|
|
1407
|
-
class
|
|
1531
|
+
class fe {
|
|
1408
1532
|
constructor(e) {
|
|
1409
1533
|
this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
|
|
1410
1534
|
}
|
|
@@ -1412,7 +1536,7 @@ class me {
|
|
|
1412
1536
|
this.listener.includes(e) || this.listener.push(e);
|
|
1413
1537
|
}
|
|
1414
1538
|
init() {
|
|
1415
|
-
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new
|
|
1539
|
+
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new me().get()) : Object.assign(this.shortcutActionIdMapping, new ge().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));
|
|
1416
1540
|
}
|
|
1417
1541
|
isMacintosh() {
|
|
1418
1542
|
return navigator.platform.indexOf("Mac") > -1;
|
|
@@ -1456,7 +1580,7 @@ class me {
|
|
|
1456
1580
|
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();
|
|
1457
1581
|
}
|
|
1458
1582
|
}
|
|
1459
|
-
class
|
|
1583
|
+
class N {
|
|
1460
1584
|
onCheckboxChanged(e) {
|
|
1461
1585
|
}
|
|
1462
1586
|
onContextmenu(e) {
|
|
@@ -1472,7 +1596,7 @@ class k {
|
|
|
1472
1596
|
onMouseMoved(e) {
|
|
1473
1597
|
}
|
|
1474
1598
|
}
|
|
1475
|
-
class
|
|
1599
|
+
class K {
|
|
1476
1600
|
setStyle(e, t, s) {
|
|
1477
1601
|
return e.style[t] = s, e;
|
|
1478
1602
|
}
|
|
@@ -1499,7 +1623,7 @@ class z {
|
|
|
1499
1623
|
e.setAttribute(t, s);
|
|
1500
1624
|
}
|
|
1501
1625
|
}
|
|
1502
|
-
class
|
|
1626
|
+
class be {
|
|
1503
1627
|
render(e, t, s, i, o, r, n) {
|
|
1504
1628
|
if (o.isEditable(t, s)) {
|
|
1505
1629
|
n.addClass(e, "ge-table-row-input-div");
|
|
@@ -1520,7 +1644,7 @@ class fe {
|
|
|
1520
1644
|
}
|
|
1521
1645
|
}
|
|
1522
1646
|
}
|
|
1523
|
-
class
|
|
1647
|
+
class ye {
|
|
1524
1648
|
constructor(e = "none", t = "single") {
|
|
1525
1649
|
this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
|
|
1526
1650
|
}
|
|
@@ -1555,16 +1679,16 @@ class be {
|
|
|
1555
1679
|
if (this.selectionType === "none")
|
|
1556
1680
|
return;
|
|
1557
1681
|
let t = e;
|
|
1558
|
-
this.selectionType === "row" ? t =
|
|
1682
|
+
this.selectionType === "row" ? t = R.singleRow(e.r1) : this.selectionType === "column" && (t = R.singleColumn(e.c1)), this.negativeRanges.push(t);
|
|
1559
1683
|
}
|
|
1560
1684
|
togglePoint(e, t) {
|
|
1561
|
-
this.getSelectionCount(e, t) > 0 ? this.removeSelection(
|
|
1685
|
+
this.getSelectionCount(e, t) > 0 ? this.removeSelection(R.singleCell(e, t)) : this.addSelection(R.singleCell(e, t));
|
|
1562
1686
|
}
|
|
1563
1687
|
addRange(e) {
|
|
1564
1688
|
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));
|
|
1565
1689
|
}
|
|
1566
1690
|
}
|
|
1567
|
-
class
|
|
1691
|
+
class ve {
|
|
1568
1692
|
constructor(e = "none") {
|
|
1569
1693
|
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1;
|
|
1570
1694
|
}
|
|
@@ -1587,31 +1711,42 @@ class ye {
|
|
|
1587
1711
|
return [this.rowIndex, this.columnIndex];
|
|
1588
1712
|
}
|
|
1589
1713
|
}
|
|
1590
|
-
const
|
|
1591
|
-
class
|
|
1714
|
+
const Ce = new ye(), xe = new ve("cell");
|
|
1715
|
+
class Y {
|
|
1592
1716
|
constructor() {
|
|
1593
1717
|
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 = {
|
|
1594
1718
|
header: 34,
|
|
1595
1719
|
body: 34,
|
|
1596
1720
|
footer: 34
|
|
1597
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new
|
|
1721
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new X(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new z(), this.sortOrder = ["asc", "desc"], this.getEditRenderer = (e, t) => new be(), this.getSelectionModel = () => Ce, this.getFocusModel = () => xe;
|
|
1598
1722
|
}
|
|
1599
1723
|
}
|
|
1600
|
-
class _ extends
|
|
1724
|
+
class _ extends he {
|
|
1601
1725
|
constructor(e, t, s, i, o) {
|
|
1602
1726
|
var r;
|
|
1603
1727
|
if (super(
|
|
1604
1728
|
e,
|
|
1605
1729
|
t,
|
|
1606
|
-
new
|
|
1730
|
+
new Z(s),
|
|
1607
1731
|
i
|
|
1608
|
-
), this.eventListener = o, this.selectionService = new
|
|
1732
|
+
), this.eventListener = o, this.selectionService = new Se(this), this.api = new se(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, o || (this.eventListener = new N()), (r = this.tableOptions) != null && r.autoRestoreOptions) {
|
|
1609
1733
|
const n = this.tableOptions.autoRestoreOptions, l = n.getStorageKeyFn;
|
|
1610
|
-
l && (n.autoRestoreScrollPosition && (this.storeScrollPosStateService = new
|
|
1734
|
+
l && (n.autoRestoreScrollPosition && (this.storeScrollPosStateService = new ie(l)), n.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new le(l)), n.autoRestoreSortingState && (this.storeSortingService = new re(l)));
|
|
1611
1735
|
}
|
|
1612
|
-
this.mouseHandler = new
|
|
1736
|
+
this.mouseHandler = new te(this), this.inputHandler = new pe(this), this.shortcutService = new fe(this), this.shortcutService.addListener(this.selectionService);
|
|
1613
1737
|
}
|
|
1614
|
-
|
|
1738
|
+
/**
|
|
1739
|
+
* Creates a TableScope instance.
|
|
1740
|
+
*
|
|
1741
|
+
* @param {HTMLDivElement} hostElement - The HTML div element that will contain the table.
|
|
1742
|
+
* @param {TableModelIf} tableModel - The table model object.
|
|
1743
|
+
* @param {TableOptionsIf} [tableOptions=new TableOptions()] - The optional table options object.
|
|
1744
|
+
* @param {EventListenerIf} [eventListener=new EventAdapter()] - The optional event listener object.
|
|
1745
|
+
* @param {DomServiceIf} [domService=new SimpleDomService()] - The optional DOM service object.
|
|
1746
|
+
*
|
|
1747
|
+
* @return {TableScope} - The newly created TableScope instance.
|
|
1748
|
+
*/
|
|
1749
|
+
static create(e, t, s = new Y(), i = new N(), o = new K()) {
|
|
1615
1750
|
return new _(
|
|
1616
1751
|
e,
|
|
1617
1752
|
t,
|
|
@@ -1636,16 +1771,32 @@ class _ extends de {
|
|
|
1636
1771
|
updateModelValueAfterEdit(e, t, s, i) {
|
|
1637
1772
|
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, i) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(V.createSingle(t, s)), this.hostElement.focus());
|
|
1638
1773
|
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Retrieves the TableApi object.
|
|
1776
|
+
*
|
|
1777
|
+
* @return {TableApi} The TableApi object.
|
|
1778
|
+
*/
|
|
1639
1779
|
getApi() {
|
|
1640
1780
|
return this.api;
|
|
1641
1781
|
}
|
|
1642
|
-
|
|
1643
|
-
* Called by the table component
|
|
1782
|
+
/**
|
|
1783
|
+
* Initializes the table. Called by the table component.
|
|
1784
|
+
*
|
|
1785
|
+
* @function firstInit
|
|
1786
|
+
* @memberof TableScope
|
|
1787
|
+
*
|
|
1788
|
+
* @returns {TableScope} This instance of the table scope.
|
|
1644
1789
|
*/
|
|
1645
1790
|
firstInit() {
|
|
1646
1791
|
var e;
|
|
1647
1792
|
return this.tableModel.init(), (e = this.tableOptions) != null && e.externalFilterFunction && this.externalFilterChanged(!1), this.autoRestoreCollapsedExpandedState(), this.autoRestoreSortingState(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.autoRestoreScrollPosition(), this;
|
|
1648
1793
|
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Creates a GeMouseEvent object based on a MouseEvent.
|
|
1796
|
+
*
|
|
1797
|
+
* @param {MouseEvent} mouseEvent - The MouseEvent object to create the GeMouseEvent from.
|
|
1798
|
+
* @return {GeMouseEvent} - The created GeMouseEvent object.
|
|
1799
|
+
*/
|
|
1649
1800
|
createGeMouseEvent(e) {
|
|
1650
1801
|
const t = new W();
|
|
1651
1802
|
if (t.originalEvent = e, e) {
|
|
@@ -1661,26 +1812,72 @@ class _ extends de {
|
|
|
1661
1812
|
}
|
|
1662
1813
|
return t;
|
|
1663
1814
|
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Handles the mouse down event.
|
|
1817
|
+
*
|
|
1818
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
1819
|
+
* @return {void}
|
|
1820
|
+
*/
|
|
1664
1821
|
onMouseDown(e) {
|
|
1665
1822
|
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));
|
|
1666
1823
|
}
|
|
1824
|
+
/**
|
|
1825
|
+
* Handles mouse dragging on the frame.
|
|
1826
|
+
*
|
|
1827
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
1828
|
+
*/
|
|
1667
1829
|
mouseDraggingOnFrame(e) {
|
|
1668
1830
|
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());
|
|
1669
1831
|
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Handles the end of mouse dragging event on a frame.
|
|
1834
|
+
*
|
|
1835
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
1836
|
+
*
|
|
1837
|
+
* @returns {void}
|
|
1838
|
+
*/
|
|
1670
1839
|
mouseDraggingEndOnFrame(e) {
|
|
1671
1840
|
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 = "";
|
|
1672
1841
|
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Handles the mouse move event.
|
|
1844
|
+
*
|
|
1845
|
+
* @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
|
|
1846
|
+
* @return {void}
|
|
1847
|
+
*/
|
|
1673
1848
|
mouseMove(e) {
|
|
1674
1849
|
this.eventListener.onMouseMoved(e), this.adjustHoverRows(e), this.adjustHoverColumns(e);
|
|
1675
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Triggers the context menu event based on the mouse move event.
|
|
1853
|
+
*
|
|
1854
|
+
* @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
|
|
1855
|
+
* @return {void}
|
|
1856
|
+
*/
|
|
1676
1857
|
contextmenu(e) {
|
|
1677
1858
|
this.eventListener.onContextmenu(e);
|
|
1678
1859
|
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Toggles the expand or collapse state of all items in the body area model.
|
|
1862
|
+
*
|
|
1863
|
+
* @param {boolean} [expand=true] - Whether to expand or collapse all items. Default is true.
|
|
1864
|
+
*
|
|
1865
|
+
* @return {void}
|
|
1866
|
+
*/
|
|
1679
1867
|
toggleExpandCollapseAll(e = !0) {
|
|
1680
1868
|
var s;
|
|
1681
1869
|
const t = this.tableModel.getBodyModel();
|
|
1682
1870
|
$(t) && (t.toggleExpandCollapseAll(e), this.repaint(), (s = this.storeStateCollapsedExpandService) == null || s.collapsedStateAll(e));
|
|
1683
1871
|
}
|
|
1872
|
+
/**
|
|
1873
|
+
* Toggles the checkbox state of a specific row in a table.
|
|
1874
|
+
*
|
|
1875
|
+
* @param {number} rowIdx - The index of the row to toggle the checkbox state.
|
|
1876
|
+
* @param {number} _colIdx - The index of the column. This parameter is unused.
|
|
1877
|
+
* @param {AreaIdent} areaIdent - The identifier of the table area.
|
|
1878
|
+
*
|
|
1879
|
+
* @return {void} - This method does not return anything.
|
|
1880
|
+
*/
|
|
1684
1881
|
toggleRowCheckbox(e, t, s) {
|
|
1685
1882
|
var l;
|
|
1686
1883
|
const i = this.tableModel.getAreaModel(s), o = i.isRowChecked(e), r = o === void 0 || o === "semi" || o === "none";
|
|
@@ -1688,6 +1885,13 @@ class _ extends de {
|
|
|
1688
1885
|
const n = (l = i.rowSelectionModel) == null ? void 0 : l.getCheckedRows();
|
|
1689
1886
|
this.eventListener.onCheckboxChanged(n || []);
|
|
1690
1887
|
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Handle mouse click events.
|
|
1890
|
+
*
|
|
1891
|
+
* @param {GeMouseEvent} evt - The mouse click event.
|
|
1892
|
+
* @param {GeMouseEvent | undefined} previousEvt - The previous mouse click event, if any.
|
|
1893
|
+
* @returns {void}
|
|
1894
|
+
*/
|
|
1691
1895
|
onMouseClicked(e, t) {
|
|
1692
1896
|
let s = this.selectionService.onMouseClicked(e, t);
|
|
1693
1897
|
if (!s && this.getFocusModel) {
|
|
@@ -1696,19 +1900,41 @@ class _ extends de {
|
|
|
1696
1900
|
}
|
|
1697
1901
|
this.eventListener.onMouseClicked(e), s && this.debounce(this.repaint.bind(this), 10);
|
|
1698
1902
|
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Updates the table (repaint) when an external filter is changed.
|
|
1905
|
+
*
|
|
1906
|
+
* @param {boolean} clearSelection - Indicates whether to clear the selection model or not. Default value is true.
|
|
1907
|
+
* @return {void}
|
|
1908
|
+
*/
|
|
1699
1909
|
externalFilterChanged(e = !0) {
|
|
1700
1910
|
const t = this.tableOptions.externalFilterFunction;
|
|
1701
1911
|
t && (e && this.clearSelectionModel(), this.tableModel.externalFilterChanged(t), this.scrollViewport.scrollTo(0, 0), this.tableModel.recalcHeightAndPadding(), this.resetSizeOfWrapperDiv(), this.repaint());
|
|
1702
1912
|
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Handle the double click event on the table header.
|
|
1915
|
+
*
|
|
1916
|
+
* @param {MouseEvent} event - The mouse event that triggered the double click.
|
|
1917
|
+
* @param {number} _rowIdx - The row index of the header.
|
|
1918
|
+
* @param {number} colIdx - The column index of the header.
|
|
1919
|
+
*
|
|
1920
|
+
* @return {void}
|
|
1921
|
+
*/
|
|
1703
1922
|
onHeaderDblClicked(e, t, s) {
|
|
1704
1923
|
var o, r;
|
|
1705
1924
|
const i = this.tableModel.getColumnDef(s);
|
|
1706
1925
|
if (i != null && i.sortable && i.sortable()) {
|
|
1707
1926
|
e.preventDefault(), e.stopPropagation();
|
|
1708
|
-
const n = i.sortStatesOrder ? i.sortStatesOrder : this.tableOptions.sortOrder, l = i.sortState ?? "", a = n[(n.indexOf(l) + 1) % n.length], d = new
|
|
1927
|
+
const n = i.sortStatesOrder ? i.sortStatesOrder : this.tableOptions.sortOrder, l = i.sortState ?? "", a = n[(n.indexOf(l) + 1) % n.length], d = new ce(s, a);
|
|
1709
1928
|
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]);
|
|
1710
1929
|
}
|
|
1711
1930
|
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Changes the focus cell using the specified deltas.
|
|
1933
|
+
*
|
|
1934
|
+
* @param {number} dx - The delta for the column index.
|
|
1935
|
+
* @param {number} dy - The delta for the row index.
|
|
1936
|
+
* @return {boolean} - True if the focus cell was changed, false otherwise.
|
|
1937
|
+
*/
|
|
1712
1938
|
changeFocusCell(e, t) {
|
|
1713
1939
|
if (!this.isEditing() && this.getFocusModel) {
|
|
1714
1940
|
const s = this.getFocusModel();
|
|
@@ -1719,9 +1945,19 @@ class _ extends de {
|
|
|
1719
1945
|
}
|
|
1720
1946
|
return !1;
|
|
1721
1947
|
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Resizes the column based on the mouse event.
|
|
1950
|
+
*
|
|
1951
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event that triggered the resize.
|
|
1952
|
+
*/
|
|
1722
1953
|
resizeColumn(e) {
|
|
1723
1954
|
this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
|
|
1724
1955
|
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Clears the selection model, if available.
|
|
1958
|
+
*
|
|
1959
|
+
* @return {void}
|
|
1960
|
+
*/
|
|
1725
1961
|
clearSelectionModel() {
|
|
1726
1962
|
var e;
|
|
1727
1963
|
this.getSelectionModel && ((e = this.getSelectionModel()) == null || e.clear());
|
|
@@ -1730,6 +1966,14 @@ class _ extends de {
|
|
|
1730
1966
|
var s;
|
|
1731
1967
|
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);
|
|
1732
1968
|
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Restores the scroll position of the table if auto restore options are enabled.
|
|
1971
|
+
*
|
|
1972
|
+
* @private
|
|
1973
|
+
* @memberof ClassName
|
|
1974
|
+
*
|
|
1975
|
+
* @returns {void}
|
|
1976
|
+
*/
|
|
1733
1977
|
autoRestoreScrollPosition() {
|
|
1734
1978
|
var e;
|
|
1735
1979
|
if ((e = this.tableOptions) != null && e.autoRestoreOptions && this.storeScrollPosStateService && this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition) {
|
|
@@ -1737,6 +1981,20 @@ class _ extends de {
|
|
|
1737
1981
|
s && this.scrollViewport.scrollTo(...s);
|
|
1738
1982
|
}
|
|
1739
1983
|
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Automatically restores the sorting state of the table.
|
|
1986
|
+
*
|
|
1987
|
+
* @private
|
|
1988
|
+
* @function autoRestoreSortingState
|
|
1989
|
+
* @memberof ClassName
|
|
1990
|
+
*
|
|
1991
|
+
* @description
|
|
1992
|
+
* This method checks if the autoRestoreSortingState option is enabled in the tableOptions.
|
|
1993
|
+
* If enabled, it uses the storeSortingService to retrieve the sort items array.
|
|
1994
|
+
* If there are sort items present, it applies them to the table's body model using the doSort method.
|
|
1995
|
+
*
|
|
1996
|
+
* @returns {void}
|
|
1997
|
+
*/
|
|
1740
1998
|
autoRestoreSortingState() {
|
|
1741
1999
|
var e, t;
|
|
1742
2000
|
if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreSortingState && this.storeSortingService) {
|
|
@@ -1744,6 +2002,12 @@ class _ extends de {
|
|
|
1744
2002
|
s != null && s.length && this.tableModel.getBodyModel().doSort(s);
|
|
1745
2003
|
}
|
|
1746
2004
|
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Restores the collapsed/expanded state of the rows in the table based on the autoRestoreOptions
|
|
2007
|
+
* specified in the tableOptions. This method is private and should not be called directly.
|
|
2008
|
+
*
|
|
2009
|
+
* @private
|
|
2010
|
+
*/
|
|
1747
2011
|
autoRestoreCollapsedExpandedState() {
|
|
1748
2012
|
var e, t;
|
|
1749
2013
|
if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.getRowId && this.storeStateCollapsedExpandService) {
|
|
@@ -1760,8 +2024,8 @@ class _ extends de {
|
|
|
1760
2024
|
else if (o.allCollapsed)
|
|
1761
2025
|
d.expanded = !1;
|
|
1762
2026
|
else {
|
|
1763
|
-
const
|
|
1764
|
-
o.mode === "expanded" ? d.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(
|
|
2027
|
+
const S = i(d.data);
|
|
2028
|
+
o.mode === "expanded" ? d.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S) : o.mode === "collapsed" && (d.expanded = !this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S));
|
|
1765
2029
|
}
|
|
1766
2030
|
}
|
|
1767
2031
|
n.recalcVisibleTreeRows();
|
|
@@ -1770,9 +2034,9 @@ class _ extends de {
|
|
|
1770
2034
|
}
|
|
1771
2035
|
}
|
|
1772
2036
|
}
|
|
1773
|
-
function
|
|
2037
|
+
function Re({
|
|
1774
2038
|
tableModel: p,
|
|
1775
|
-
tableOptions: e = new
|
|
2039
|
+
tableOptions: e = new Y(),
|
|
1776
2040
|
mouseMoved: t,
|
|
1777
2041
|
checkboxChanged: s,
|
|
1778
2042
|
contextmenu: i,
|
|
@@ -1782,44 +2046,44 @@ function Ae({
|
|
|
1782
2046
|
mouseDraggingEnd: l,
|
|
1783
2047
|
tableReady: a
|
|
1784
2048
|
}) {
|
|
1785
|
-
const d =
|
|
1786
|
-
let
|
|
1787
|
-
|
|
1788
|
-
d.current && !
|
|
2049
|
+
const d = U(null);
|
|
2050
|
+
let S = !1;
|
|
2051
|
+
J(() => {
|
|
2052
|
+
d.current && !S && (g(d.current), S = !0);
|
|
1789
2053
|
});
|
|
1790
2054
|
const g = (m) => {
|
|
1791
|
-
const
|
|
1792
|
-
onCheckboxChanged: (
|
|
1793
|
-
s && s(
|
|
2055
|
+
const h = {
|
|
2056
|
+
onCheckboxChanged: (c) => {
|
|
2057
|
+
s && s(c);
|
|
1794
2058
|
},
|
|
1795
|
-
onContextmenu: (
|
|
1796
|
-
i && i(
|
|
2059
|
+
onContextmenu: (c) => {
|
|
2060
|
+
i && i(c);
|
|
1797
2061
|
},
|
|
1798
|
-
onModelChanged: (
|
|
1799
|
-
o && o(
|
|
2062
|
+
onModelChanged: (c) => {
|
|
2063
|
+
o && o(c);
|
|
1800
2064
|
},
|
|
1801
|
-
onMouseClicked: (
|
|
1802
|
-
r && r(
|
|
2065
|
+
onMouseClicked: (c) => {
|
|
2066
|
+
r && r(c);
|
|
1803
2067
|
},
|
|
1804
|
-
onMouseDragging: (
|
|
1805
|
-
n && n(
|
|
2068
|
+
onMouseDragging: (c) => {
|
|
2069
|
+
n && n(c);
|
|
1806
2070
|
},
|
|
1807
|
-
onMouseDraggingEnd: (
|
|
1808
|
-
l && l(
|
|
2071
|
+
onMouseDraggingEnd: (c) => {
|
|
2072
|
+
l && l(c);
|
|
1809
2073
|
},
|
|
1810
|
-
onMouseMoved: (
|
|
1811
|
-
t && t(
|
|
2074
|
+
onMouseMoved: (c) => {
|
|
2075
|
+
t && t(c);
|
|
1812
2076
|
}
|
|
1813
|
-
},
|
|
2077
|
+
}, f = new _(
|
|
1814
2078
|
m,
|
|
1815
2079
|
p,
|
|
1816
|
-
new
|
|
2080
|
+
new K(),
|
|
1817
2081
|
e,
|
|
1818
|
-
|
|
2082
|
+
h
|
|
1819
2083
|
);
|
|
1820
|
-
|
|
2084
|
+
f.firstInit(), a && a(f.getApi());
|
|
1821
2085
|
};
|
|
1822
|
-
return /* @__PURE__ */
|
|
2086
|
+
return /* @__PURE__ */ q(
|
|
1823
2087
|
"div",
|
|
1824
2088
|
{
|
|
1825
2089
|
ref: d,
|
|
@@ -1834,21 +2098,21 @@ function Ae({
|
|
|
1834
2098
|
}
|
|
1835
2099
|
);
|
|
1836
2100
|
}
|
|
1837
|
-
var B, F =
|
|
2101
|
+
var B, F = Q;
|
|
1838
2102
|
if (process.env.NODE_ENV === "production")
|
|
1839
2103
|
B = F.createRoot, F.hydrateRoot;
|
|
1840
2104
|
else {
|
|
1841
|
-
var
|
|
2105
|
+
var j = F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1842
2106
|
B = function(p, e) {
|
|
1843
|
-
|
|
2107
|
+
j.usingClientEntryPoint = !0;
|
|
1844
2108
|
try {
|
|
1845
2109
|
return F.createRoot(p, e);
|
|
1846
2110
|
} finally {
|
|
1847
|
-
|
|
2111
|
+
j.usingClientEntryPoint = !1;
|
|
1848
2112
|
}
|
|
1849
2113
|
};
|
|
1850
2114
|
}
|
|
1851
|
-
class
|
|
2115
|
+
class Me {
|
|
1852
2116
|
constructor(e) {
|
|
1853
2117
|
this.Component = e, console.info(e);
|
|
1854
2118
|
}
|
|
@@ -1867,6 +2131,6 @@ class Re {
|
|
|
1867
2131
|
}
|
|
1868
2132
|
}
|
|
1869
2133
|
export {
|
|
1870
|
-
|
|
1871
|
-
|
|
2134
|
+
Me as ComponentRendererWrapper,
|
|
2135
|
+
Re as GuiexpertTable
|
|
1872
2136
|
};
|