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