@guiexpert/svelte-table 1.0.8 → 1.0.9
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 +491 -227
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var k = (l, e, t) => (
|
|
4
|
-
import { createEventDispatcher as
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var pe = (l, e, t) => e in l ? ce(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var k = (l, e, t) => (pe(l, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { createEventDispatcher as ue, onMount as Se } from "svelte";
|
|
5
5
|
function F() {
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function ie(l) {
|
|
8
8
|
return l();
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function ee() {
|
|
11
11
|
return /* @__PURE__ */ Object.create(null);
|
|
12
12
|
}
|
|
13
13
|
function W(l) {
|
|
14
|
-
l.forEach(
|
|
14
|
+
l.forEach(ie);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function oe(l) {
|
|
17
17
|
return typeof l == "function";
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function ge(l, e) {
|
|
20
20
|
return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function fe(l) {
|
|
23
23
|
return Object.keys(l).length === 0;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function me(l, e, t) {
|
|
26
26
|
l.insertBefore(e, t || null);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function le(l) {
|
|
29
29
|
l.parentNode && l.parentNode.removeChild(l);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function be(l) {
|
|
32
32
|
return document.createElement(l);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ye(l, e, t) {
|
|
35
35
|
t == null ? l.removeAttribute(e) : l.getAttribute(e) !== t && l.setAttribute(e, t);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function ve(l) {
|
|
38
38
|
return Array.from(l.childNodes);
|
|
39
39
|
}
|
|
40
40
|
function L(l, e, t, s) {
|
|
@@ -46,17 +46,17 @@ function _(l) {
|
|
|
46
46
|
}
|
|
47
47
|
const $ = [], V = [];
|
|
48
48
|
let O = [];
|
|
49
|
-
const
|
|
49
|
+
const te = [], xe = /* @__PURE__ */ Promise.resolve();
|
|
50
50
|
let G = !1;
|
|
51
|
-
function
|
|
52
|
-
G || (G = !0,
|
|
51
|
+
function Ce() {
|
|
52
|
+
G || (G = !0, xe.then(re));
|
|
53
53
|
}
|
|
54
54
|
function N(l) {
|
|
55
55
|
O.push(l);
|
|
56
56
|
}
|
|
57
57
|
const P = /* @__PURE__ */ new Set();
|
|
58
58
|
let I = 0;
|
|
59
|
-
function
|
|
59
|
+
function re() {
|
|
60
60
|
if (I !== 0)
|
|
61
61
|
return;
|
|
62
62
|
const l = z;
|
|
@@ -64,7 +64,7 @@ function le() {
|
|
|
64
64
|
try {
|
|
65
65
|
for (; I < $.length; ) {
|
|
66
66
|
const e = $[I];
|
|
67
|
-
I++, _(e),
|
|
67
|
+
I++, _(e), we(e.$$);
|
|
68
68
|
}
|
|
69
69
|
} catch (e) {
|
|
70
70
|
throw $.length = 0, I = 0, e;
|
|
@@ -77,40 +77,40 @@ function le() {
|
|
|
77
77
|
}
|
|
78
78
|
O.length = 0;
|
|
79
79
|
} while ($.length);
|
|
80
|
-
for (;
|
|
81
|
-
|
|
80
|
+
for (; te.length; )
|
|
81
|
+
te.pop()();
|
|
82
82
|
G = !1, P.clear(), _(l);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function we(l) {
|
|
85
85
|
if (l.fragment !== null) {
|
|
86
86
|
l.update(), W(l.before_update);
|
|
87
87
|
const e = l.dirty;
|
|
88
88
|
l.dirty = [-1], l.fragment && l.fragment.p(l.ctx, e), l.after_update.forEach(N);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Ee(l) {
|
|
92
92
|
const e = [], t = [];
|
|
93
93
|
O.forEach((s) => l.indexOf(s) === -1 ? e.push(s) : t.push(s)), t.forEach((s) => s()), O = e;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
96
|
-
function
|
|
97
|
-
l && l.i && (
|
|
95
|
+
const Ae = /* @__PURE__ */ new Set();
|
|
96
|
+
function Me(l, e) {
|
|
97
|
+
l && l.i && (Ae.delete(l), l.i(e));
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Re(l, e, t) {
|
|
100
100
|
const { fragment: s, after_update: i } = l.$$;
|
|
101
101
|
s && s.m(e, t), N(() => {
|
|
102
|
-
const o = l.$$.on_mount.map(
|
|
102
|
+
const o = l.$$.on_mount.map(ie).filter(oe);
|
|
103
103
|
l.$$.on_destroy ? l.$$.on_destroy.push(...o) : W(o), l.$$.on_mount = [];
|
|
104
104
|
}), i.forEach(N);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Te(l, e) {
|
|
107
107
|
const t = l.$$;
|
|
108
|
-
t.fragment !== null && (
|
|
108
|
+
t.fragment !== null && (Ee(t.after_update), W(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
l.$$.dirty[0] === -1 && ($.push(l),
|
|
110
|
+
function De(l, e) {
|
|
111
|
+
l.$$.dirty[0] === -1 && ($.push(l), Ce(), l.$$.dirty.fill(0)), l.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Ie(l, e, t, s, i, o, n = null, a = [-1]) {
|
|
114
114
|
const r = z;
|
|
115
115
|
_(l);
|
|
116
116
|
const d = l.$$ = {
|
|
@@ -120,7 +120,7 @@ function De(l, e, t, s, i, o, n = null, a = [-1]) {
|
|
|
120
120
|
props: o,
|
|
121
121
|
update: F,
|
|
122
122
|
not_equal: i,
|
|
123
|
-
bound:
|
|
123
|
+
bound: ee(),
|
|
124
124
|
// lifecycle
|
|
125
125
|
on_mount: [],
|
|
126
126
|
on_destroy: [],
|
|
@@ -129,7 +129,7 @@ function De(l, e, t, s, i, o, n = null, a = [-1]) {
|
|
|
129
129
|
after_update: [],
|
|
130
130
|
context: new Map(e.context || (r ? r.$$.context : [])),
|
|
131
131
|
// everything else
|
|
132
|
-
callbacks:
|
|
132
|
+
callbacks: ee(),
|
|
133
133
|
dirty: a,
|
|
134
134
|
skip_bound: !1,
|
|
135
135
|
root: e.target || r.$$.root
|
|
@@ -138,18 +138,18 @@ function De(l, e, t, s, i, o, n = null, a = [-1]) {
|
|
|
138
138
|
let h = !1;
|
|
139
139
|
if (d.ctx = t ? t(l, e.props || {}, (p, S, ...f) => {
|
|
140
140
|
const c = f.length ? f[0] : S;
|
|
141
|
-
return d.ctx && i(d.ctx[p], d.ctx[p] = c) && (!d.skip_bound && d.bound[p] && d.bound[p](c), h &&
|
|
141
|
+
return d.ctx && i(d.ctx[p], d.ctx[p] = c) && (!d.skip_bound && d.bound[p] && d.bound[p](c), h && De(l, p)), S;
|
|
142
142
|
}) : [], d.update(), h = !0, W(d.before_update), d.fragment = s ? s(d.ctx) : !1, e.target) {
|
|
143
143
|
if (e.hydrate) {
|
|
144
|
-
const p =
|
|
145
|
-
d.fragment && d.fragment.l(p), p.forEach(
|
|
144
|
+
const p = ve(e.target);
|
|
145
|
+
d.fragment && d.fragment.l(p), p.forEach(le);
|
|
146
146
|
} else
|
|
147
147
|
d.fragment && d.fragment.c();
|
|
148
|
-
e.intro &&
|
|
148
|
+
e.intro && Me(l.$$.fragment), Re(l, e.target, e.anchor), re();
|
|
149
149
|
}
|
|
150
150
|
_(r);
|
|
151
151
|
}
|
|
152
|
-
class
|
|
152
|
+
class $e {
|
|
153
153
|
constructor() {
|
|
154
154
|
/**
|
|
155
155
|
* ### PRIVATE API
|
|
@@ -170,7 +170,7 @@ class Ie {
|
|
|
170
170
|
}
|
|
171
171
|
/** @returns {void} */
|
|
172
172
|
$destroy() {
|
|
173
|
-
|
|
173
|
+
Te(this, 1), this.$destroy = F;
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
176
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -179,7 +179,7 @@ class Ie {
|
|
|
179
179
|
* @returns {() => void}
|
|
180
180
|
*/
|
|
181
181
|
$on(e, t) {
|
|
182
|
-
if (!
|
|
182
|
+
if (!oe(t))
|
|
183
183
|
return F;
|
|
184
184
|
const s = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
185
185
|
return s.push(t), () => {
|
|
@@ -192,11 +192,11 @@ class Ie {
|
|
|
192
192
|
* @returns {void}
|
|
193
193
|
*/
|
|
194
194
|
$set(e) {
|
|
195
|
-
this.$$set && !
|
|
195
|
+
this.$$set && !fe(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
const
|
|
199
|
-
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(
|
|
198
|
+
const Fe = "4";
|
|
199
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Fe);
|
|
200
200
|
function j(l) {
|
|
201
201
|
return l && l.type === "TreeRow";
|
|
202
202
|
}
|
|
@@ -228,7 +228,7 @@ class D {
|
|
|
228
228
|
this.content = e, this.style = t, this.classes = s;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
class
|
|
231
|
+
class ne {
|
|
232
232
|
constructor(e = new D(
|
|
233
233
|
">",
|
|
234
234
|
"transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
|
|
@@ -249,12 +249,12 @@ class re {
|
|
|
249
249
|
this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = s, this.arrowExpandCollapseAll = i;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
class
|
|
252
|
+
class ae {
|
|
253
253
|
constructor(e = new D("↑", "", ["ge-header-sorted-asc"]), t = new D("↓", "", ["ge-header-sorted-desc"]), s = new D("↑", "color:transparent;", [])) {
|
|
254
254
|
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class Oe {
|
|
258
258
|
constructor(e) {
|
|
259
259
|
this.domService = e;
|
|
260
260
|
}
|
|
@@ -342,10 +342,10 @@ class Fe {
|
|
|
342
342
|
addColumnDiv(e, t, s = -1, i = -1, o, n, a = "", r, d, h = void 0, p) {
|
|
343
343
|
const S = d == null ? void 0 : d.treeOptions, f = d == null ? void 0 : d.showCheckboxWihoutExtraColumn, c = this.domService.createElement("div");
|
|
344
344
|
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}`);
|
|
345
|
-
const
|
|
346
|
-
if (o === "body" && n === "center" && this.domService.addClass(c, `ge-table-column-${
|
|
347
|
-
const
|
|
348
|
-
this.addLabelDiv(c, a,
|
|
345
|
+
const m = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
|
|
346
|
+
if (o === "body" && n === "center" && this.domService.addClass(c, `ge-table-column-${m}`), 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, S, s, i, o)), f && i === 0 && h && this.addCheckboxToDiv(c, h, o, s), a) {
|
|
347
|
+
const g = r !== "none" && i === 0;
|
|
348
|
+
this.addLabelDiv(c, a, g, s, i, o);
|
|
349
349
|
}
|
|
350
350
|
return p && this.addSortedIcon(c, p, d == null ? void 0 : d.sortedOptions, i), this.domService.appendChild(e, c), c;
|
|
351
351
|
}
|
|
@@ -374,7 +374,7 @@ class Fe {
|
|
|
374
374
|
}
|
|
375
375
|
return this.domService.appendChild(e, a), a;
|
|
376
376
|
}
|
|
377
|
-
addSortedIcon(e, t = "", s = new
|
|
377
|
+
addSortedIcon(e, t = "", s = new ae(), i = -1) {
|
|
378
378
|
const o = this.domService.createElement("div");
|
|
379
379
|
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");
|
|
380
380
|
let n;
|
|
@@ -385,7 +385,7 @@ class Fe {
|
|
|
385
385
|
this.domService.addClass(o, d);
|
|
386
386
|
return this.domService.appendChild(e, o), o;
|
|
387
387
|
}
|
|
388
|
-
addArrowDiv(e, t = "none", s = new
|
|
388
|
+
addArrowDiv(e, t = "none", s = new ne(), i = -1, o = -1, n = "body") {
|
|
389
389
|
const a = this.domService.createElement("div");
|
|
390
390
|
this.domService.addClass(a, "ge-table-tree-arrow-div"), this.domService.setStyle(a, "display", "inline-block"), this.domService.setStyle(a, "position", ""), this.domService.setStyle(a, "width", "20px"), this.domService.setStyle(a, "background", "transparent"), this.domService.setStyle(a, "cursor", "pointer"), this.domService.setAttribute(a, "data-row-index", `${i}`), this.domService.setAttribute(a, "data-col-index", `${o}`), this.domService.setAttribute(a, "data-area", `${n}`);
|
|
391
391
|
let r;
|
|
@@ -436,7 +436,7 @@ class Fe {
|
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
const Y = (l) => l === "header" ? "header" : l === "footer" ? "footer" : "body";
|
|
439
|
-
class
|
|
439
|
+
class Le {
|
|
440
440
|
constructor(e, t) {
|
|
441
441
|
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)) {
|
|
442
442
|
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"));
|
|
@@ -448,19 +448,33 @@ class Oe {
|
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
class
|
|
451
|
+
class _e {
|
|
452
452
|
constructor(e) {
|
|
453
453
|
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(
|
|
454
454
|
(t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Handles the "contextmenu" event.
|
|
459
|
+
*
|
|
460
|
+
* @private
|
|
461
|
+
* @param {MouseEvent} evt - The mouse event object.
|
|
462
|
+
* @return {void}
|
|
463
|
+
*/
|
|
457
464
|
onContextmenu(e) {
|
|
458
465
|
this.mouseEvent = e;
|
|
459
466
|
const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
|
|
460
467
|
this.tableScope.contextmenu(t);
|
|
461
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Handles the click event on the host element.
|
|
471
|
+
*
|
|
472
|
+
* @param {MouseEvent} event - The click event.
|
|
473
|
+
*
|
|
474
|
+
* @return {void}
|
|
475
|
+
*/
|
|
462
476
|
onHostElementClicked(e) {
|
|
463
|
-
const t = new
|
|
477
|
+
const t = new Le(e.target, this.tableScope);
|
|
464
478
|
if (t.action === "toggleExpandCollapseAll")
|
|
465
479
|
this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
|
|
466
480
|
else if (t.inputType === "checkbox" && t.areaIdent)
|
|
@@ -479,6 +493,12 @@ class Le {
|
|
|
479
493
|
}
|
|
480
494
|
this.publishGeMouseEvent(e, 1);
|
|
481
495
|
}
|
|
496
|
+
/**
|
|
497
|
+
* Handles the double click event on the host element.
|
|
498
|
+
* This method is private.
|
|
499
|
+
*
|
|
500
|
+
* @param {MouseEvent} event - The double click event.
|
|
501
|
+
*/
|
|
482
502
|
onHostElementDblClicked(e) {
|
|
483
503
|
if (e.target instanceof HTMLElement) {
|
|
484
504
|
const t = e.target, s = t.getAttribute("data-area"), i = Y(s), o = Number(t.getAttribute("data-row-index")), n = Number(t.getAttribute("data-col-index")), a = this.tableScope.tableModel.getAreaModel(i);
|
|
@@ -495,10 +515,24 @@ class Le {
|
|
|
495
515
|
}
|
|
496
516
|
this.publishGeMouseEvent(e, 2);
|
|
497
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Publishes a GeMouseEvent.
|
|
520
|
+
*
|
|
521
|
+
* @param {MouseEvent} event - The MouseEvent to publish.
|
|
522
|
+
* @param {number} clickCount - The number of clicks for the GeMouseEvent.
|
|
523
|
+
*
|
|
524
|
+
* @return {void}
|
|
525
|
+
*/
|
|
498
526
|
publishGeMouseEvent(e, t) {
|
|
499
527
|
var s;
|
|
500
528
|
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);
|
|
501
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* Update the collapsed/expanded state of a tree row.
|
|
532
|
+
*
|
|
533
|
+
* @param {TreeRowIf<any>} tr - The tree row object.
|
|
534
|
+
* @returns {void}
|
|
535
|
+
*/
|
|
502
536
|
updateCollapsedExpandedState(e) {
|
|
503
537
|
var s, i, o, n, a;
|
|
504
538
|
const t = (i = (s = this.tableScope.tableOptions) == null ? void 0 : s.autoRestoreOptions) == null ? void 0 : i.getRowId;
|
|
@@ -540,35 +574,107 @@ class Le {
|
|
|
540
574
|
}
|
|
541
575
|
}
|
|
542
576
|
}
|
|
543
|
-
class
|
|
577
|
+
class Be {
|
|
544
578
|
constructor(e) {
|
|
545
579
|
this.tableScope = e;
|
|
546
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* Updates the cells in the table based on the provided events.
|
|
583
|
+
*
|
|
584
|
+
* @param {TableCellUpdateEventIf[]} events - The array of events representing the updates to perform on the cells.
|
|
585
|
+
* @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.
|
|
586
|
+
*
|
|
587
|
+
* @return {void} - This method doesn't return anything.
|
|
588
|
+
*/
|
|
547
589
|
updateCells(e, t = !1) {
|
|
548
590
|
this.tableScope.updateCells(e, t);
|
|
549
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* Notifies that the external filter has changed.
|
|
594
|
+
*
|
|
595
|
+
* @return {void}
|
|
596
|
+
*/
|
|
550
597
|
externalFilterChanged() {
|
|
551
598
|
this.tableScope.externalFilterChanged();
|
|
552
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* Scrolls the table body to the specified pixel coordinates.
|
|
602
|
+
*
|
|
603
|
+
* @param {number} _px - The horizontal pixel coordinate to scroll to. Defaults to 0.
|
|
604
|
+
* @param {number} _py - The vertical pixel coordinate to scroll to. Defaults to 0.
|
|
605
|
+
* @return {void}
|
|
606
|
+
*/
|
|
553
607
|
scrollToPixel(e = 0, t = 0) {
|
|
554
608
|
}
|
|
609
|
+
/**
|
|
610
|
+
* Scrolls to the specified index in both horizontal and vertical directions.
|
|
611
|
+
*
|
|
612
|
+
* @param {number} _indexX - The index of the column to scroll to in the horizontal direction. Default is 0.
|
|
613
|
+
* @param {number} _indexY - The index of the row to scroll to in the vertical direction. Default is 0.
|
|
614
|
+
*
|
|
615
|
+
* @return undefined
|
|
616
|
+
*/
|
|
555
617
|
scrollToIndex(e = 0, t = 0) {
|
|
556
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* Sets whether the header is visible or not.
|
|
621
|
+
*
|
|
622
|
+
* @param _visible - A boolean value indicating whether the header should be visible. Default value is true.
|
|
623
|
+
*
|
|
624
|
+
* @return undefined
|
|
625
|
+
*/
|
|
557
626
|
setHeaderVisible(e = !0) {
|
|
558
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* Sets the visibility of a column in the table.
|
|
630
|
+
*
|
|
631
|
+
* @param {_column} - The column index or column definition to set visibility for.
|
|
632
|
+
* @param {_visible=true} - The flag to set visibility to. true for visible, false for hidden.
|
|
633
|
+
*
|
|
634
|
+
* @return {void} - There is no return value.
|
|
635
|
+
*/
|
|
559
636
|
setColumnVisible(e, t = !0) {
|
|
560
637
|
}
|
|
638
|
+
/**
|
|
639
|
+
* Returns whether a column is visible or not.
|
|
640
|
+
*
|
|
641
|
+
* @param {number | ColumnDefIf} _column - The column index or the column definition.
|
|
642
|
+
* @return {boolean} - True if the column is visible, false otherwise.
|
|
643
|
+
*/
|
|
561
644
|
isColumnVisible(e) {
|
|
562
645
|
return !0;
|
|
563
646
|
}
|
|
647
|
+
/**
|
|
648
|
+
* Checks if the header is visible.
|
|
649
|
+
*
|
|
650
|
+
* @return {boolean} - Returns true if the header is visible, otherwise returns false.
|
|
651
|
+
*/
|
|
564
652
|
isHeaderVisible() {
|
|
565
653
|
return !0;
|
|
566
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* Sets the visibility of the footer.
|
|
657
|
+
*
|
|
658
|
+
* @param {boolean} _visible - Indicates whether the footer should be visible or not. Default value is true.
|
|
659
|
+
*
|
|
660
|
+
* @return {void} - This method does not return any value.
|
|
661
|
+
*/
|
|
567
662
|
setFooterVisible(e = !0) {
|
|
568
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Determines if the footer is visible.
|
|
666
|
+
*
|
|
667
|
+
* @returns {boolean} True if the footer is visible, false otherwise.
|
|
668
|
+
*/
|
|
569
669
|
isFooterVisible() {
|
|
570
670
|
return !0;
|
|
571
671
|
}
|
|
672
|
+
/**
|
|
673
|
+
* Repaints the table.
|
|
674
|
+
*
|
|
675
|
+
* This method calls the repaint method of the tableScope object
|
|
676
|
+
* to update and redraw the table based on the latest data.
|
|
677
|
+
*/
|
|
572
678
|
repaint() {
|
|
573
679
|
this.tableScope.repaint();
|
|
574
680
|
}
|
|
@@ -648,7 +754,7 @@ class q {
|
|
|
648
754
|
// }
|
|
649
755
|
// }
|
|
650
756
|
}
|
|
651
|
-
class
|
|
757
|
+
class We extends q {
|
|
652
758
|
constructor(e) {
|
|
653
759
|
super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
|
|
654
760
|
}
|
|
@@ -670,14 +776,14 @@ class Be extends q {
|
|
|
670
776
|
}
|
|
671
777
|
}
|
|
672
778
|
}
|
|
673
|
-
class
|
|
779
|
+
class He {
|
|
674
780
|
constructor(e = "collapsed", t = [], s = !1, i = !1) {
|
|
675
781
|
this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = i;
|
|
676
782
|
}
|
|
677
783
|
}
|
|
678
|
-
class
|
|
784
|
+
class ke extends q {
|
|
679
785
|
constructor(e) {
|
|
680
|
-
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new
|
|
786
|
+
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new He(), this.load();
|
|
681
787
|
}
|
|
682
788
|
collapsedExpandedStateGet() {
|
|
683
789
|
return this.collapsedExpandedState;
|
|
@@ -709,7 +815,7 @@ class He extends q {
|
|
|
709
815
|
this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
|
|
710
816
|
}
|
|
711
817
|
}
|
|
712
|
-
class
|
|
818
|
+
class Pe extends q {
|
|
713
819
|
constructor(e) {
|
|
714
820
|
super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
|
|
715
821
|
}
|
|
@@ -736,7 +842,7 @@ class T {
|
|
|
736
842
|
this.left = e, this.width = t, this.height = s, this.top = i, this.index = o;
|
|
737
843
|
}
|
|
738
844
|
}
|
|
739
|
-
class
|
|
845
|
+
class Ve {
|
|
740
846
|
constructor(e, t, s, i) {
|
|
741
847
|
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();
|
|
742
848
|
const o = this.hostElement;
|
|
@@ -887,12 +993,21 @@ class Pe {
|
|
|
887
993
|
this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
|
|
888
994
|
}
|
|
889
995
|
}
|
|
890
|
-
class
|
|
996
|
+
class M {
|
|
997
|
+
/**
|
|
998
|
+
* Represents a constructor for a class.
|
|
999
|
+
* @constructor
|
|
1000
|
+
* @param {number} r1 - The value for r1.
|
|
1001
|
+
* @param {number} c1 - The value for c1.
|
|
1002
|
+
* @param {number} r2 - The value for r2.
|
|
1003
|
+
* @param {number} c2 - The value for c2.
|
|
1004
|
+
* @param {boolean} [gammaRange=false] - The value for gammaRange. Defaults to false. gammaRange will be used for AreaModelCellGroups, but it's not implemented yet!
|
|
1005
|
+
*/
|
|
891
1006
|
constructor(e, t, s, i, o = !1) {
|
|
892
1007
|
this.r1 = e, this.c1 = t, this.r2 = s, this.c2 = i, this.gammaRange = o;
|
|
893
1008
|
}
|
|
894
1009
|
static create(e) {
|
|
895
|
-
return e.gammaRange === void 0 && (e.gammaRange = !1), new
|
|
1010
|
+
return e.gammaRange === void 0 && (e.gammaRange = !1), new M(
|
|
896
1011
|
e.rowIndex1,
|
|
897
1012
|
e.columnIndex1,
|
|
898
1013
|
e.rowIndex2,
|
|
@@ -901,19 +1016,19 @@ class A {
|
|
|
901
1016
|
);
|
|
902
1017
|
}
|
|
903
1018
|
static singleCell(e, t) {
|
|
904
|
-
return new
|
|
1019
|
+
return new M(e, t, e, t);
|
|
905
1020
|
}
|
|
906
1021
|
static singleRow(e) {
|
|
907
|
-
return new
|
|
1022
|
+
return new M(e, 0, e, Number.MAX_SAFE_INTEGER);
|
|
908
1023
|
}
|
|
909
1024
|
static singleColumn(e) {
|
|
910
|
-
return new
|
|
1025
|
+
return new M(0, e, Number.MAX_SAFE_INTEGER, e);
|
|
911
1026
|
}
|
|
912
1027
|
isInRange(e, t) {
|
|
913
1028
|
return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
|
|
914
1029
|
}
|
|
915
1030
|
}
|
|
916
|
-
class
|
|
1031
|
+
class Ge {
|
|
917
1032
|
constructor(e, t) {
|
|
918
1033
|
this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
|
|
919
1034
|
}
|
|
@@ -929,7 +1044,7 @@ class Ve {
|
|
|
929
1044
|
o === 0 && (o = 1), n === 0 && (n = 1);
|
|
930
1045
|
const a = this.areaModel.hasOwnProperty("gammaCells");
|
|
931
1046
|
this.colAndRowspanRanges.push(
|
|
932
|
-
new
|
|
1047
|
+
new M(s, i, s + n - 1, i + o - 1, a)
|
|
933
1048
|
);
|
|
934
1049
|
}
|
|
935
1050
|
}
|
|
@@ -946,22 +1061,22 @@ class Ve {
|
|
|
946
1061
|
return !1;
|
|
947
1062
|
}
|
|
948
1063
|
}
|
|
949
|
-
class
|
|
1064
|
+
class Ne {
|
|
950
1065
|
constructor(e, t, s) {
|
|
951
1066
|
this.header = e, this.body = t, this.footer = s;
|
|
952
1067
|
}
|
|
953
1068
|
}
|
|
954
|
-
class
|
|
1069
|
+
class je extends Ve {
|
|
955
1070
|
constructor(e, t, s, i) {
|
|
956
1071
|
var n, a;
|
|
957
1072
|
super(e, t, s, i), this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
958
1073
|
header: [],
|
|
959
1074
|
body: [],
|
|
960
1075
|
footer: []
|
|
961
|
-
}, this.tree = !1, this.colAndRowspanModels = new
|
|
1076
|
+
}, this.tree = !1, this.colAndRowspanModels = new Ne(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.editing = !1, this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (n = this.tableOptions) != null && n.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (a = this.tableOptions) != null && a.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), X(t.getAreaModel("body")) && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
962
1077
|
(r) => {
|
|
963
1078
|
var d;
|
|
964
|
-
this.colAndRowspanModels[r] = new
|
|
1079
|
+
this.colAndRowspanModels[r] = new Ge(t, t.getAreaModel(r)), (d = this.colAndRowspanModels[r]) == null || d.init();
|
|
965
1080
|
}
|
|
966
1081
|
);
|
|
967
1082
|
}
|
|
@@ -1080,87 +1195,87 @@ class Ne extends Pe {
|
|
|
1080
1195
|
return "";
|
|
1081
1196
|
}
|
|
1082
1197
|
adjustArea(e, t = 0) {
|
|
1083
|
-
var
|
|
1198
|
+
var g;
|
|
1084
1199
|
const s = this.getArea(e, "west"), i = this.getArea(e, "center"), o = this.getArea(e, "east"), n = i.child.clientHeight;
|
|
1085
1200
|
s.child.innerText = "", i.child.innerText = "", o.child.innerText = "";
|
|
1086
1201
|
const a = 0, r = this.areaBodyCenterGeo.width, d = this.tableModel.getPadding(), h = this.tableModel.getAreaModel(e), p = h.getRowCount();
|
|
1087
1202
|
for (; this.cleanupFunctions[e].length; ) {
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1203
|
+
const u = this.cleanupFunctions[e].shift();
|
|
1204
|
+
u && u();
|
|
1090
1205
|
}
|
|
1091
1206
|
let S = t;
|
|
1092
|
-
const f = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount(),
|
|
1093
|
-
for (let
|
|
1094
|
-
const
|
|
1095
|
-
if (
|
|
1096
|
-
this.firstVisibleRowIndex =
|
|
1097
|
-
let
|
|
1098
|
-
const
|
|
1207
|
+
const f = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount(), m = this.tableModel.getFixedLeftColumnCount();
|
|
1208
|
+
for (let u = 0; u < p; u++) {
|
|
1209
|
+
const w = S, x = u === p - 1, C = this.tableModel.getRowHeight(e, u);
|
|
1210
|
+
if (w + C > 0) {
|
|
1211
|
+
this.firstVisibleRowIndex = u;
|
|
1212
|
+
let y = { left: a, width: r, height: C, top: w, index: u }, v = this.dom.addRowDiv(i, y, u, e, "center");
|
|
1213
|
+
const E = m;
|
|
1099
1214
|
if (this.adjustColumnsToRowParent({
|
|
1100
1215
|
areaIdent: e,
|
|
1101
1216
|
sideIdent: "center",
|
|
1102
1217
|
areaModel: h,
|
|
1103
|
-
geo:
|
|
1104
|
-
parent:
|
|
1105
|
-
rowIndex:
|
|
1106
|
-
columnIndexStart:
|
|
1218
|
+
geo: y,
|
|
1219
|
+
parent: v,
|
|
1220
|
+
rowIndex: u,
|
|
1221
|
+
columnIndexStart: E,
|
|
1107
1222
|
columnIndexEnd: f - c - 1,
|
|
1108
1223
|
verticalFixed: !1,
|
|
1109
|
-
lastRowOfModel:
|
|
1110
|
-
}), d.left > 0 && (
|
|
1224
|
+
lastRowOfModel: x
|
|
1225
|
+
}), d.left > 0 && (y = { left: a, width: this.areaBodyWestGeo.width, height: C, top: w, index: u }, v = this.dom.addRowDiv(s, y, u, e, "west"), this.adjustColumnsToRowParent({
|
|
1111
1226
|
areaIdent: e,
|
|
1112
1227
|
sideIdent: "west",
|
|
1113
1228
|
areaModel: h,
|
|
1114
|
-
geo:
|
|
1115
|
-
parent:
|
|
1116
|
-
rowIndex:
|
|
1229
|
+
geo: y,
|
|
1230
|
+
parent: v,
|
|
1231
|
+
rowIndex: u,
|
|
1117
1232
|
columnIndexStart: 0,
|
|
1118
|
-
columnIndexEnd:
|
|
1233
|
+
columnIndexEnd: E - 1,
|
|
1119
1234
|
verticalFixed: !0,
|
|
1120
|
-
lastRowOfModel:
|
|
1121
|
-
})), d.right > 0 && (
|
|
1235
|
+
lastRowOfModel: x
|
|
1236
|
+
})), d.right > 0 && (y = { left: a, width: this.areaBodyEastGeo.width, height: C, top: w, index: u }, v = this.dom.addRowDiv(o, y, u, e, "east"), this.adjustColumnsToRowParent({
|
|
1122
1237
|
areaIdent: e,
|
|
1123
1238
|
sideIdent: "east",
|
|
1124
1239
|
areaModel: h,
|
|
1125
|
-
geo:
|
|
1126
|
-
parent:
|
|
1127
|
-
rowIndex:
|
|
1240
|
+
geo: y,
|
|
1241
|
+
parent: v,
|
|
1242
|
+
rowIndex: u,
|
|
1128
1243
|
columnIndexStart: f - c,
|
|
1129
1244
|
columnIndexEnd: f - 1,
|
|
1130
1245
|
verticalFixed: !0,
|
|
1131
|
-
lastRowOfModel:
|
|
1132
|
-
})), e === "header" && this.tree &&
|
|
1133
|
-
const
|
|
1246
|
+
lastRowOfModel: x
|
|
1247
|
+
})), e === "header" && this.tree && u === p - 1) {
|
|
1248
|
+
const A = this.dom.applyStyle(
|
|
1134
1249
|
this.dom.setAttribute(
|
|
1135
|
-
this.dom.addDiv(
|
|
1250
|
+
this.dom.addDiv(v, new T(16, 20, 20, 8)),
|
|
1136
1251
|
"data-ge-action",
|
|
1137
1252
|
"toggleExpandCollapseAll"
|
|
1138
1253
|
),
|
|
1139
1254
|
{ cursor: "pointer" }
|
|
1140
|
-
),
|
|
1141
|
-
if (
|
|
1142
|
-
const B = this.dom.domService.createText(
|
|
1143
|
-
this.dom.domService.appendChild(
|
|
1255
|
+
), R = this.tableOptions.treeOptions.arrowExpandCollapseAll;
|
|
1256
|
+
if (R) {
|
|
1257
|
+
const B = this.dom.domService.createText(R.content);
|
|
1258
|
+
this.dom.domService.appendChild(A, B), R.style && this.dom.applyStyleString(A, R.style);
|
|
1144
1259
|
}
|
|
1145
1260
|
}
|
|
1146
1261
|
}
|
|
1147
|
-
if (S = S +
|
|
1262
|
+
if (S = S + C, S > n)
|
|
1148
1263
|
break;
|
|
1149
1264
|
}
|
|
1150
1265
|
if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
|
|
1151
|
-
const
|
|
1152
|
-
if (
|
|
1153
|
-
for (const
|
|
1154
|
-
let
|
|
1155
|
-
if (
|
|
1156
|
-
|
|
1157
|
-
else if (c > 0 &&
|
|
1158
|
-
|
|
1266
|
+
const u = ((g = this.colAndRowspanModels[e]) == null ? void 0 : g.getRanges()) ?? [];
|
|
1267
|
+
if (u.length)
|
|
1268
|
+
for (const w of u) {
|
|
1269
|
+
let x = 0, C = i.child, y = "center";
|
|
1270
|
+
if (w.c1 < m)
|
|
1271
|
+
C = s.child, y = "west";
|
|
1272
|
+
else if (c > 0 && w.c1 >= f - c)
|
|
1273
|
+
C = o.child, y = "east";
|
|
1159
1274
|
else {
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1275
|
+
const v = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1276
|
+
x = this.scrollFactorX * v - this.areaBodyWestGeo.width, y = "center";
|
|
1162
1277
|
}
|
|
1163
|
-
this.drawBigCell(
|
|
1278
|
+
this.drawBigCell(w, x, t, h, C, y);
|
|
1164
1279
|
}
|
|
1165
1280
|
}
|
|
1166
1281
|
}
|
|
@@ -1175,13 +1290,13 @@ class Ne extends Pe {
|
|
|
1175
1290
|
* @protected
|
|
1176
1291
|
*/
|
|
1177
1292
|
drawBigCell(e, t, s, i, o, n) {
|
|
1178
|
-
const a = s + this.getRowHeights(0, e.r1 - 1, i).reduce((
|
|
1293
|
+
const a = s + this.getRowHeights(0, e.r1 - 1, i).reduce((g, u) => g + u, 0), r = this.tableModel.getColumnCount(), d = this.tableModel.getFixedRightColumnCount();
|
|
1179
1294
|
let h = 0;
|
|
1180
1295
|
d > 0 && e.c1 >= r - d && (h = r - d);
|
|
1181
|
-
const p = t + this.getColumnWidths(h, e.c1 - 1).reduce((
|
|
1296
|
+
const p = t + this.getColumnWidths(h, e.c1 - 1).reduce((g, u) => g + u, 0), S = this.getRowHeights(e.r1, e.r2, i).reduce((g, u) => g + u, 0), f = this.getColumnWidths(e.c1, e.c2).reduce((g, u) => g + u, 0);
|
|
1182
1297
|
let c = !1;
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1298
|
+
const m = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
1299
|
+
m && (c = m.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? (console.info("TODO here", e), this.renderCell({
|
|
1185
1300
|
areaModel: i,
|
|
1186
1301
|
areaIdent: i.areaIdent,
|
|
1187
1302
|
sideIdent: n,
|
|
@@ -1242,56 +1357,56 @@ class Ne extends Pe {
|
|
|
1242
1357
|
verticalFixed: d = !1,
|
|
1243
1358
|
lastRowOfModel: h = !1
|
|
1244
1359
|
}) {
|
|
1245
|
-
var
|
|
1360
|
+
var m;
|
|
1246
1361
|
this.scrollViewportLeft = this.scrollViewport.scrollLeft;
|
|
1247
1362
|
let p = 0;
|
|
1248
1363
|
if (!d) {
|
|
1249
|
-
const
|
|
1250
|
-
p = this.scrollFactorX *
|
|
1364
|
+
const g = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1365
|
+
p = this.scrollFactorX * g;
|
|
1251
1366
|
}
|
|
1252
1367
|
const S = 0, f = !!(e === "body" && t);
|
|
1253
1368
|
let c = p;
|
|
1254
|
-
for (let
|
|
1255
|
-
const
|
|
1256
|
-
if (
|
|
1257
|
-
let
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1260
|
-
let
|
|
1261
|
-
|
|
1262
|
-
let
|
|
1263
|
-
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (
|
|
1264
|
-
this.renderDragTargetDiv(o,
|
|
1265
|
-
const
|
|
1266
|
-
this.dom.addColumnBorderDivs(this.tableOptions, o,
|
|
1369
|
+
for (let g = a; g <= r; g++) {
|
|
1370
|
+
const u = c, w = this.tableModel.getColumnWidth(g);
|
|
1371
|
+
if (w > 0 && u + w > 0) {
|
|
1372
|
+
let x = i.height;
|
|
1373
|
+
const C = s.getRowspanAt(n, g), y = s.getColspanAt(n, g);
|
|
1374
|
+
C > 1 && (x = this.getRowHeights(n, n + C - 1, s).reduce((A, R) => A + R, 0));
|
|
1375
|
+
let v = w;
|
|
1376
|
+
y > 1 && (v = this.getColumnWidths(g, g + y - 1).reduce((A, R) => A + R, 0));
|
|
1377
|
+
let E = !1;
|
|
1378
|
+
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (m = this.colAndRowspanModels[e]) != null && m.isInRange(n, g) && (E = !0), this.draggingTargetColumnIndex === g && e !== "header") {
|
|
1379
|
+
this.renderDragTargetDiv(o, u, S, v, x);
|
|
1380
|
+
const A = { left: u, top: S, width: v, height: x };
|
|
1381
|
+
this.dom.addColumnBorderDivs(this.tableOptions, o, A, e, t);
|
|
1267
1382
|
} else {
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1383
|
+
const A = this.renderSelectedBackgroundDiv(E, f, t, s, n, g, o, u, S, v, x);
|
|
1384
|
+
E || this.renderCell({
|
|
1270
1385
|
areaModel: s,
|
|
1271
1386
|
areaIdent: e,
|
|
1272
1387
|
sideIdent: t,
|
|
1273
1388
|
rowIndex: n,
|
|
1274
|
-
columnIndex:
|
|
1275
|
-
left:
|
|
1389
|
+
columnIndex: g,
|
|
1390
|
+
left: u,
|
|
1276
1391
|
top: S,
|
|
1277
|
-
width:
|
|
1278
|
-
height:
|
|
1392
|
+
width: v,
|
|
1393
|
+
height: x,
|
|
1279
1394
|
parent: o,
|
|
1280
|
-
cellSelected:
|
|
1395
|
+
cellSelected: A,
|
|
1281
1396
|
lastRowOfModel: h,
|
|
1282
1397
|
gammaRange: !0
|
|
1283
1398
|
}), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
1284
1399
|
rowIndex: n,
|
|
1285
|
-
columnIndex:
|
|
1286
|
-
cellLeft:
|
|
1400
|
+
columnIndex: g,
|
|
1401
|
+
cellLeft: u,
|
|
1287
1402
|
cellTop: S,
|
|
1288
|
-
cellWidth:
|
|
1289
|
-
cellHeight:
|
|
1403
|
+
cellWidth: v,
|
|
1404
|
+
cellHeight: x,
|
|
1290
1405
|
parent: o
|
|
1291
1406
|
});
|
|
1292
1407
|
}
|
|
1293
1408
|
}
|
|
1294
|
-
if (c = c +
|
|
1409
|
+
if (c = c + w, c > this.areaBodyCenterGeo.width)
|
|
1295
1410
|
break;
|
|
1296
1411
|
}
|
|
1297
1412
|
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(c - 1, 1, i.height, 0), o);
|
|
@@ -1310,49 +1425,50 @@ class Ne extends Pe {
|
|
|
1310
1425
|
height: r,
|
|
1311
1426
|
top: d,
|
|
1312
1427
|
parent: h,
|
|
1313
|
-
lastRowOfModel: p
|
|
1428
|
+
lastRowOfModel: p,
|
|
1429
|
+
gammaRange: S
|
|
1314
1430
|
}) {
|
|
1315
|
-
var
|
|
1316
|
-
const
|
|
1431
|
+
var Z;
|
|
1432
|
+
const c = this.editorRenderer && this.editorRendererRow === i && this.editorRendererColumn === o ? this.editorRenderer : e.getCellRenderer(i, o), m = { left: n, width: a, height: r, top: d, index: o }, g = e.getRowByIndex(i);
|
|
1317
1433
|
let u = "none";
|
|
1318
|
-
if (o === this.getTreeArrowColumnIndex() && j(
|
|
1319
|
-
const
|
|
1320
|
-
(
|
|
1434
|
+
if (o === this.getTreeArrowColumnIndex() && j(g)) {
|
|
1435
|
+
const b = g;
|
|
1436
|
+
(Z = b.children) != null && Z.length ? b.expanded ? u = "expanded" : u = "collapsed" : u = "hidden";
|
|
1321
1437
|
}
|
|
1322
1438
|
let x;
|
|
1323
1439
|
if (t === "header") {
|
|
1324
|
-
const
|
|
1325
|
-
(!(
|
|
1440
|
+
const b = this.tableModel.getColumnDef(o);
|
|
1441
|
+
(!(b != null && b.sortIconVisible) || b != null && b.sortIconVisible()) && (x = b == null ? void 0 : b.sortState);
|
|
1326
1442
|
}
|
|
1327
|
-
const C = e.getValueAt(i, o),
|
|
1443
|
+
const C = e.getValueAt(i, o), y = c ? "" : `${C}`, v = e.isRowChecked(i), E = this.dom.addColumnDiv(
|
|
1328
1444
|
h,
|
|
1329
|
-
|
|
1445
|
+
m,
|
|
1330
1446
|
i,
|
|
1331
1447
|
o,
|
|
1332
1448
|
t,
|
|
1333
1449
|
s,
|
|
1334
|
-
|
|
1450
|
+
y,
|
|
1335
1451
|
u,
|
|
1336
1452
|
this.tableOptions,
|
|
1337
1453
|
v,
|
|
1338
1454
|
x
|
|
1339
|
-
),
|
|
1340
|
-
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1343
|
-
let
|
|
1344
|
-
|
|
1345
|
-
const
|
|
1346
|
-
if (
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1455
|
+
), A = e.getTooltipAt(i, o);
|
|
1456
|
+
A && this.dom.setAttribute(E, "title", A);
|
|
1457
|
+
const R = this.tableModel.getColumnDef(o);
|
|
1458
|
+
R && R.classes[t] && this.dom.addClasses(R.classes[t], E);
|
|
1459
|
+
let B;
|
|
1460
|
+
c && (B = c.render(E, i, o, t, e, C, this.dom.domService));
|
|
1461
|
+
const Q = e.getCustomClassesAt(i, o);
|
|
1462
|
+
if (Q.length && this.dom.addClasses(Q, E), this.dom.addColumnBorderDivs(this.tableOptions, h, m, t, s), p && this.dom.addHorizontalBorder({ left: n, width: a, height: r, top: d + r }, h), this.getFocusModel && t === "body") {
|
|
1463
|
+
const b = this.getFocusModel();
|
|
1464
|
+
b != null && b.hasFocus(i, o) && this.dom.addFocusBorderDivs(h, m, {});
|
|
1349
1465
|
}
|
|
1350
|
-
t === "header" && this.dom.setAttribute(
|
|
1466
|
+
t === "header" && this.dom.setAttribute(E, "data-ge-action", "drag-column");
|
|
1351
1467
|
const H = e.getCustomStyleAt(i, o);
|
|
1352
1468
|
if (H)
|
|
1353
|
-
for (const
|
|
1354
|
-
this.dom.setStyle(
|
|
1355
|
-
return [
|
|
1469
|
+
for (const b in H)
|
|
1470
|
+
this.dom.setStyle(E, b, H[b]);
|
|
1471
|
+
return [E, B];
|
|
1356
1472
|
}
|
|
1357
1473
|
applyCssClasses(e, t = {}) {
|
|
1358
1474
|
e && Object.entries(t).forEach(([s, i]) => {
|
|
@@ -1442,12 +1558,12 @@ class Ne extends Pe {
|
|
|
1442
1558
|
if (f) {
|
|
1443
1559
|
const c = f.getSelectionCount(o, n);
|
|
1444
1560
|
S = c > 0;
|
|
1445
|
-
for (let
|
|
1446
|
-
const
|
|
1561
|
+
for (let m = 0; m < c; m++) {
|
|
1562
|
+
const g = this.dom.applyStylePosistionAbsolute(
|
|
1447
1563
|
// ge-table-body-west-selected-range
|
|
1448
1564
|
this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`, a)
|
|
1449
1565
|
);
|
|
1450
|
-
this.dom.setStyle(
|
|
1566
|
+
this.dom.setStyle(g, "left", `${r}px`), this.dom.setStyle(g, "top", `${d}px`), this.dom.setStyle(g, "width", `${h}px`), this.dom.setStyle(g, "height", `${p}px`);
|
|
1451
1567
|
}
|
|
1452
1568
|
}
|
|
1453
1569
|
}
|
|
@@ -1468,7 +1584,7 @@ class Ne extends Pe {
|
|
|
1468
1584
|
lastRowOfModel: S,
|
|
1469
1585
|
gammaRange: f
|
|
1470
1586
|
}) {
|
|
1471
|
-
const [c,
|
|
1587
|
+
const [c, m] = this.addAndRenderCellDiv({
|
|
1472
1588
|
areaModel: e,
|
|
1473
1589
|
areaIdent: t,
|
|
1474
1590
|
sideIdent: s,
|
|
@@ -1482,22 +1598,30 @@ class Ne extends Pe {
|
|
|
1482
1598
|
lastRowOfModel: S,
|
|
1483
1599
|
gammaRange: f
|
|
1484
1600
|
});
|
|
1485
|
-
p && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, c),
|
|
1601
|
+
p && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, c), m && this.cleanupFunctions[t].push(m);
|
|
1486
1602
|
}
|
|
1487
1603
|
renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: s, cellTop: i, cellWidth: o, cellHeight: n, parent: a }) {
|
|
1488
1604
|
const r = this.dom.domService, d = this.tableOptions.columnResizeHandleWidthInPx ?? 2, h = r.createElement("div");
|
|
1489
1605
|
r.setAttribute(h, "data-col-index", `${t}`), r.setAttribute(h, "data-row-index", `${e}`), r.setAttribute(h, "data-area", "header"), r.setAttribute(h, "data-ge-action", "resize-column"), r.addClass(h, "ge-table-column-resize-handle"), r.setStyle(h, "display", "clip"), r.setStyle(h, "position", "absolute"), r.setStyle(h, "cursor", "col-resize"), r.setStyle(h, "left", `${s + o - d}px`), r.setStyle(h, "top", `${i}px`), r.setStyle(h, "width", `${d}px`), r.setStyle(h, "height", `${n}px`), r.appendChild(a, h);
|
|
1490
1606
|
}
|
|
1491
1607
|
}
|
|
1492
|
-
class
|
|
1608
|
+
class Xe {
|
|
1493
1609
|
constructor(e, t) {
|
|
1494
1610
|
this.columnIndex = e, this.sortState = t;
|
|
1495
1611
|
}
|
|
1496
1612
|
}
|
|
1497
|
-
class
|
|
1613
|
+
class ze {
|
|
1498
1614
|
constructor(e) {
|
|
1499
1615
|
this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
|
|
1500
1616
|
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Handles the onHostElementChanged event.
|
|
1619
|
+
* In case that the element is an input field, the tableScope.updateModelValueAfterEdit() method is triggered.
|
|
1620
|
+
*
|
|
1621
|
+
* @param {Event} event - The event object.
|
|
1622
|
+
*
|
|
1623
|
+
* @return {void}
|
|
1624
|
+
*/
|
|
1501
1625
|
onHostElementChanged(e) {
|
|
1502
1626
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
|
|
1503
1627
|
const t = e.target, s = t.getAttribute("data-area"), i = t.getAttribute("data-row-index"), o = t.getAttribute("data-col-index");
|
|
@@ -1508,7 +1632,7 @@ class Xe {
|
|
|
1508
1632
|
}
|
|
1509
1633
|
}
|
|
1510
1634
|
}
|
|
1511
|
-
class
|
|
1635
|
+
class Ke {
|
|
1512
1636
|
constructor(e = -1, t = -1) {
|
|
1513
1637
|
this.rowIndex = e, this.columnIndex = t;
|
|
1514
1638
|
}
|
|
@@ -1518,10 +1642,10 @@ class U {
|
|
|
1518
1642
|
this.cells = e;
|
|
1519
1643
|
}
|
|
1520
1644
|
static createSingle(e, t) {
|
|
1521
|
-
return new U([new
|
|
1645
|
+
return new U([new Ke(e, t)]);
|
|
1522
1646
|
}
|
|
1523
1647
|
}
|
|
1524
|
-
class
|
|
1648
|
+
class Ye {
|
|
1525
1649
|
constructor(e) {
|
|
1526
1650
|
var t, s;
|
|
1527
1651
|
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);
|
|
@@ -1531,7 +1655,7 @@ class Ke {
|
|
|
1531
1655
|
let s = !1, i = !1;
|
|
1532
1656
|
if (this.getSelectionModel && this.getFocusModel) {
|
|
1533
1657
|
const S = this.getSelectionModel(), f = this.getFocusModel();
|
|
1534
|
-
S && f && (f.hasFocus(e.rowIndex, e.columnIndex) || (f.setFocus(e.rowIndex, e.columnIndex), s = !0), (o = e.originalEvent) != null && o.shiftKey || S.hasSelection() && (S.clear(), s = !0), (n = e.originalEvent) != null && n.shiftKey && this.previousEvt ? (S.addSelection(this.createRangeByEvents(e, this.previousEvt)), i = !0, s = !0) : (a = e.originalEvent) != null && a.ctrlKey || (r = e.originalEvent) != null && r.metaKey ? (S.addSelection(
|
|
1658
|
+
S && f && (f.hasFocus(e.rowIndex, e.columnIndex) || (f.setFocus(e.rowIndex, e.columnIndex), s = !0), (o = e.originalEvent) != null && o.shiftKey || S.hasSelection() && (S.clear(), s = !0), (n = e.originalEvent) != null && n.shiftKey && this.previousEvt ? (S.addSelection(this.createRangeByEvents(e, this.previousEvt)), i = !0, s = !0) : (a = e.originalEvent) != null && a.ctrlKey || (r = e.originalEvent) != null && r.metaKey ? (S.addSelection(M.singleCell(e.rowIndex, e.columnIndex)), i = !0, s = !0) : (d = e.originalEvent) != null && d.altKey && ((h = e.originalEvent) != null && h.ctrlKey || (p = e.originalEvent) != null && p.metaKey) && (S.removeSelection(M.singleCell(e.rowIndex, e.columnIndex)), i = !0, s = !0));
|
|
1535
1659
|
}
|
|
1536
1660
|
return i ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
|
|
1537
1661
|
}
|
|
@@ -1554,7 +1678,7 @@ class Ke {
|
|
|
1554
1678
|
createRangeByEvents(e, t) {
|
|
1555
1679
|
t || (t = e);
|
|
1556
1680
|
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), n = Math.max(e.columnIndex, t == null ? void 0 : t.columnIndex);
|
|
1557
|
-
return
|
|
1681
|
+
return M.create({
|
|
1558
1682
|
rowIndex1: s,
|
|
1559
1683
|
columnIndex1: o,
|
|
1560
1684
|
rowIndex2: i,
|
|
@@ -1562,7 +1686,7 @@ class Ke {
|
|
|
1562
1686
|
});
|
|
1563
1687
|
}
|
|
1564
1688
|
}
|
|
1565
|
-
class
|
|
1689
|
+
class qe {
|
|
1566
1690
|
get() {
|
|
1567
1691
|
return {
|
|
1568
1692
|
f2: "START_EDITING",
|
|
@@ -1580,7 +1704,7 @@ class Ye {
|
|
|
1580
1704
|
};
|
|
1581
1705
|
}
|
|
1582
1706
|
}
|
|
1583
|
-
class
|
|
1707
|
+
class Ue {
|
|
1584
1708
|
get() {
|
|
1585
1709
|
return {
|
|
1586
1710
|
f2: "START_EDITING",
|
|
@@ -1600,7 +1724,7 @@ class qe {
|
|
|
1600
1724
|
};
|
|
1601
1725
|
}
|
|
1602
1726
|
}
|
|
1603
|
-
class
|
|
1727
|
+
class Je {
|
|
1604
1728
|
constructor(e) {
|
|
1605
1729
|
this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
|
|
1606
1730
|
}
|
|
@@ -1608,7 +1732,7 @@ class Ue {
|
|
|
1608
1732
|
this.listener.includes(e) || this.listener.push(e);
|
|
1609
1733
|
}
|
|
1610
1734
|
init() {
|
|
1611
|
-
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new
|
|
1735
|
+
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new Ue().get()) : Object.assign(this.shortcutActionIdMapping, new qe().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));
|
|
1612
1736
|
}
|
|
1613
1737
|
isMacintosh() {
|
|
1614
1738
|
return navigator.platform.indexOf("Mac") > -1;
|
|
@@ -1652,7 +1776,7 @@ class Ue {
|
|
|
1652
1776
|
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();
|
|
1653
1777
|
}
|
|
1654
1778
|
}
|
|
1655
|
-
class
|
|
1779
|
+
class se {
|
|
1656
1780
|
onCheckboxChanged(e) {
|
|
1657
1781
|
}
|
|
1658
1782
|
onContextmenu(e) {
|
|
@@ -1668,7 +1792,7 @@ class te {
|
|
|
1668
1792
|
onMouseMoved(e) {
|
|
1669
1793
|
}
|
|
1670
1794
|
}
|
|
1671
|
-
class
|
|
1795
|
+
class de {
|
|
1672
1796
|
setStyle(e, t, s) {
|
|
1673
1797
|
return e.style[t] = s, e;
|
|
1674
1798
|
}
|
|
@@ -1695,7 +1819,7 @@ class ae {
|
|
|
1695
1819
|
e.setAttribute(t, s);
|
|
1696
1820
|
}
|
|
1697
1821
|
}
|
|
1698
|
-
class
|
|
1822
|
+
class Qe {
|
|
1699
1823
|
render(e, t, s, i, o, n, a) {
|
|
1700
1824
|
if (o.isEditable(t, s)) {
|
|
1701
1825
|
a.addClass(e, "ge-table-row-input-div");
|
|
@@ -1716,7 +1840,7 @@ class Je {
|
|
|
1716
1840
|
}
|
|
1717
1841
|
}
|
|
1718
1842
|
}
|
|
1719
|
-
class
|
|
1843
|
+
class Ze {
|
|
1720
1844
|
constructor(e = "none", t = "single") {
|
|
1721
1845
|
this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
|
|
1722
1846
|
}
|
|
@@ -1751,16 +1875,16 @@ class Qe {
|
|
|
1751
1875
|
if (this.selectionType === "none")
|
|
1752
1876
|
return;
|
|
1753
1877
|
let t = e;
|
|
1754
|
-
this.selectionType === "row" ? t =
|
|
1878
|
+
this.selectionType === "row" ? t = M.singleRow(e.r1) : this.selectionType === "column" && (t = M.singleColumn(e.c1)), this.negativeRanges.push(t);
|
|
1755
1879
|
}
|
|
1756
1880
|
togglePoint(e, t) {
|
|
1757
|
-
this.getSelectionCount(e, t) > 0 ? this.removeSelection(
|
|
1881
|
+
this.getSelectionCount(e, t) > 0 ? this.removeSelection(M.singleCell(e, t)) : this.addSelection(M.singleCell(e, t));
|
|
1758
1882
|
}
|
|
1759
1883
|
addRange(e) {
|
|
1760
1884
|
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));
|
|
1761
1885
|
}
|
|
1762
1886
|
}
|
|
1763
|
-
class
|
|
1887
|
+
class et {
|
|
1764
1888
|
constructor(e = "none") {
|
|
1765
1889
|
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1;
|
|
1766
1890
|
}
|
|
@@ -1783,31 +1907,42 @@ class Ze {
|
|
|
1783
1907
|
return [this.rowIndex, this.columnIndex];
|
|
1784
1908
|
}
|
|
1785
1909
|
}
|
|
1786
|
-
const
|
|
1787
|
-
class
|
|
1910
|
+
const tt = new Ze(), st = new et("cell");
|
|
1911
|
+
class he {
|
|
1788
1912
|
constructor() {
|
|
1789
1913
|
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 = {
|
|
1790
1914
|
header: 34,
|
|
1791
1915
|
body: 34,
|
|
1792
1916
|
footer: 34
|
|
1793
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new
|
|
1917
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new ne(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new ae(), this.sortOrder = ["asc", "desc"], this.getEditRenderer = (e, t) => new Qe(), this.getSelectionModel = () => tt, this.getFocusModel = () => st;
|
|
1794
1918
|
}
|
|
1795
1919
|
}
|
|
1796
|
-
class J extends
|
|
1920
|
+
class J extends je {
|
|
1797
1921
|
constructor(e, t, s, i, o) {
|
|
1798
1922
|
var n;
|
|
1799
1923
|
if (super(
|
|
1800
1924
|
e,
|
|
1801
1925
|
t,
|
|
1802
|
-
new
|
|
1926
|
+
new Oe(s),
|
|
1803
1927
|
i
|
|
1804
|
-
), this.eventListener = o, this.selectionService = new
|
|
1928
|
+
), this.eventListener = o, this.selectionService = new Ye(this), this.api = new Be(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, o || (this.eventListener = new se()), (n = this.tableOptions) != null && n.autoRestoreOptions) {
|
|
1805
1929
|
const a = this.tableOptions.autoRestoreOptions, r = a.getStorageKeyFn;
|
|
1806
|
-
r && (a.autoRestoreScrollPosition && (this.storeScrollPosStateService = new
|
|
1930
|
+
r && (a.autoRestoreScrollPosition && (this.storeScrollPosStateService = new We(r)), a.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new ke(r)), a.autoRestoreSortingState && (this.storeSortingService = new Pe(r)));
|
|
1807
1931
|
}
|
|
1808
|
-
this.mouseHandler = new
|
|
1932
|
+
this.mouseHandler = new _e(this), this.inputHandler = new ze(this), this.shortcutService = new Je(this), this.shortcutService.addListener(this.selectionService);
|
|
1809
1933
|
}
|
|
1810
|
-
|
|
1934
|
+
/**
|
|
1935
|
+
* Creates a TableScope instance.
|
|
1936
|
+
*
|
|
1937
|
+
* @param {HTMLDivElement} hostElement - The HTML div element that will contain the table.
|
|
1938
|
+
* @param {TableModelIf} tableModel - The table model object.
|
|
1939
|
+
* @param {TableOptionsIf} [tableOptions=new TableOptions()] - The optional table options object.
|
|
1940
|
+
* @param {EventListenerIf} [eventListener=new EventAdapter()] - The optional event listener object.
|
|
1941
|
+
* @param {DomServiceIf} [domService=new SimpleDomService()] - The optional DOM service object.
|
|
1942
|
+
*
|
|
1943
|
+
* @return {TableScope} - The newly created TableScope instance.
|
|
1944
|
+
*/
|
|
1945
|
+
static create(e, t, s = new he(), i = new se(), o = new de()) {
|
|
1811
1946
|
return new J(
|
|
1812
1947
|
e,
|
|
1813
1948
|
t,
|
|
@@ -1832,16 +1967,32 @@ class J extends Ne {
|
|
|
1832
1967
|
updateModelValueAfterEdit(e, t, s, i) {
|
|
1833
1968
|
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, i) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(U.createSingle(t, s)), this.hostElement.focus());
|
|
1834
1969
|
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Retrieves the TableApi object.
|
|
1972
|
+
*
|
|
1973
|
+
* @return {TableApi} The TableApi object.
|
|
1974
|
+
*/
|
|
1835
1975
|
getApi() {
|
|
1836
1976
|
return this.api;
|
|
1837
1977
|
}
|
|
1838
|
-
|
|
1839
|
-
* Called by the table component
|
|
1978
|
+
/**
|
|
1979
|
+
* Initializes the table. Called by the table component.
|
|
1980
|
+
*
|
|
1981
|
+
* @function firstInit
|
|
1982
|
+
* @memberof TableScope
|
|
1983
|
+
*
|
|
1984
|
+
* @returns {TableScope} This instance of the table scope.
|
|
1840
1985
|
*/
|
|
1841
1986
|
firstInit() {
|
|
1842
1987
|
var e;
|
|
1843
1988
|
return this.tableModel.init(), (e = this.tableOptions) != null && e.externalFilterFunction && this.externalFilterChanged(!1), this.autoRestoreCollapsedExpandedState(), this.autoRestoreSortingState(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.autoRestoreScrollPosition(), this;
|
|
1844
1989
|
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Creates a GeMouseEvent object based on a MouseEvent.
|
|
1992
|
+
*
|
|
1993
|
+
* @param {MouseEvent} mouseEvent - The MouseEvent object to create the GeMouseEvent from.
|
|
1994
|
+
* @return {GeMouseEvent} - The created GeMouseEvent object.
|
|
1995
|
+
*/
|
|
1845
1996
|
createGeMouseEvent(e) {
|
|
1846
1997
|
const t = new K();
|
|
1847
1998
|
if (t.originalEvent = e, e) {
|
|
@@ -1857,26 +2008,72 @@ class J extends Ne {
|
|
|
1857
2008
|
}
|
|
1858
2009
|
return t;
|
|
1859
2010
|
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Handles the mouse down event.
|
|
2013
|
+
*
|
|
2014
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
2015
|
+
* @return {void}
|
|
2016
|
+
*/
|
|
1860
2017
|
onMouseDown(e) {
|
|
1861
2018
|
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));
|
|
1862
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Handles mouse dragging on the frame.
|
|
2022
|
+
*
|
|
2023
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
2024
|
+
*/
|
|
1863
2025
|
mouseDraggingOnFrame(e) {
|
|
1864
2026
|
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());
|
|
1865
2027
|
}
|
|
2028
|
+
/**
|
|
2029
|
+
* Handles the end of mouse dragging event on a frame.
|
|
2030
|
+
*
|
|
2031
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
2032
|
+
*
|
|
2033
|
+
* @returns {void}
|
|
2034
|
+
*/
|
|
1866
2035
|
mouseDraggingEndOnFrame(e) {
|
|
1867
2036
|
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 = "";
|
|
1868
2037
|
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Handles the mouse move event.
|
|
2040
|
+
*
|
|
2041
|
+
* @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
|
|
2042
|
+
* @return {void}
|
|
2043
|
+
*/
|
|
1869
2044
|
mouseMove(e) {
|
|
1870
2045
|
this.eventListener.onMouseMoved(e), this.adjustHoverRows(e), this.adjustHoverColumns(e);
|
|
1871
2046
|
}
|
|
2047
|
+
/**
|
|
2048
|
+
* Triggers the context menu event based on the mouse move event.
|
|
2049
|
+
*
|
|
2050
|
+
* @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
|
|
2051
|
+
* @return {void}
|
|
2052
|
+
*/
|
|
1872
2053
|
contextmenu(e) {
|
|
1873
2054
|
this.eventListener.onContextmenu(e);
|
|
1874
2055
|
}
|
|
2056
|
+
/**
|
|
2057
|
+
* Toggles the expand or collapse state of all items in the body area model.
|
|
2058
|
+
*
|
|
2059
|
+
* @param {boolean} [expand=true] - Whether to expand or collapse all items. Default is true.
|
|
2060
|
+
*
|
|
2061
|
+
* @return {void}
|
|
2062
|
+
*/
|
|
1875
2063
|
toggleExpandCollapseAll(e = !0) {
|
|
1876
2064
|
var s;
|
|
1877
2065
|
const t = this.tableModel.getBodyModel();
|
|
1878
2066
|
X(t) && (t.toggleExpandCollapseAll(e), this.repaint(), (s = this.storeStateCollapsedExpandService) == null || s.collapsedStateAll(e));
|
|
1879
2067
|
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Toggles the checkbox state of a specific row in a table.
|
|
2070
|
+
*
|
|
2071
|
+
* @param {number} rowIdx - The index of the row to toggle the checkbox state.
|
|
2072
|
+
* @param {number} _colIdx - The index of the column. This parameter is unused.
|
|
2073
|
+
* @param {AreaIdent} areaIdent - The identifier of the table area.
|
|
2074
|
+
*
|
|
2075
|
+
* @return {void} - This method does not return anything.
|
|
2076
|
+
*/
|
|
1880
2077
|
toggleRowCheckbox(e, t, s) {
|
|
1881
2078
|
var r;
|
|
1882
2079
|
const i = this.tableModel.getAreaModel(s), o = i.isRowChecked(e), n = o === void 0 || o === "semi" || o === "none";
|
|
@@ -1884,6 +2081,13 @@ class J extends Ne {
|
|
|
1884
2081
|
const a = (r = i.rowSelectionModel) == null ? void 0 : r.getCheckedRows();
|
|
1885
2082
|
this.eventListener.onCheckboxChanged(a || []);
|
|
1886
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Handle mouse click events.
|
|
2086
|
+
*
|
|
2087
|
+
* @param {GeMouseEvent} evt - The mouse click event.
|
|
2088
|
+
* @param {GeMouseEvent | undefined} previousEvt - The previous mouse click event, if any.
|
|
2089
|
+
* @returns {void}
|
|
2090
|
+
*/
|
|
1887
2091
|
onMouseClicked(e, t) {
|
|
1888
2092
|
let s = this.selectionService.onMouseClicked(e, t);
|
|
1889
2093
|
if (!s && this.getFocusModel) {
|
|
@@ -1892,19 +2096,41 @@ class J extends Ne {
|
|
|
1892
2096
|
}
|
|
1893
2097
|
this.eventListener.onMouseClicked(e), s && this.debounce(this.repaint.bind(this), 10);
|
|
1894
2098
|
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Updates the table (repaint) when an external filter is changed.
|
|
2101
|
+
*
|
|
2102
|
+
* @param {boolean} clearSelection - Indicates whether to clear the selection model or not. Default value is true.
|
|
2103
|
+
* @return {void}
|
|
2104
|
+
*/
|
|
1895
2105
|
externalFilterChanged(e = !0) {
|
|
1896
2106
|
const t = this.tableOptions.externalFilterFunction;
|
|
1897
2107
|
t && (e && this.clearSelectionModel(), this.tableModel.externalFilterChanged(t), this.scrollViewport.scrollTo(0, 0), this.tableModel.recalcHeightAndPadding(), this.resetSizeOfWrapperDiv(), this.repaint());
|
|
1898
2108
|
}
|
|
2109
|
+
/**
|
|
2110
|
+
* Handle the double click event on the table header.
|
|
2111
|
+
*
|
|
2112
|
+
* @param {MouseEvent} event - The mouse event that triggered the double click.
|
|
2113
|
+
* @param {number} _rowIdx - The row index of the header.
|
|
2114
|
+
* @param {number} colIdx - The column index of the header.
|
|
2115
|
+
*
|
|
2116
|
+
* @return {void}
|
|
2117
|
+
*/
|
|
1899
2118
|
onHeaderDblClicked(e, t, s) {
|
|
1900
2119
|
var o, n;
|
|
1901
2120
|
const i = this.tableModel.getColumnDef(s);
|
|
1902
2121
|
if (i != null && i.sortable && i.sortable()) {
|
|
1903
2122
|
e.preventDefault(), e.stopPropagation();
|
|
1904
|
-
const a = i.sortStatesOrder ? i.sortStatesOrder : this.tableOptions.sortOrder, r = i.sortState ?? "", d = a[(a.indexOf(r) + 1) % a.length], h = new
|
|
2123
|
+
const a = i.sortStatesOrder ? i.sortStatesOrder : this.tableOptions.sortOrder, r = i.sortState ?? "", d = a[(a.indexOf(r) + 1) % a.length], h = new Xe(s, d);
|
|
1905
2124
|
this.tableModel.doSort([h]) && ((o = this.tableModel.getColumnDefs()) == null || o.forEach((S) => S.sortState = ""), i.sortState = d), this.repaint(), (n = this.storeSortingService) == null || n.setSortItems([h]);
|
|
1906
2125
|
}
|
|
1907
2126
|
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Changes the focus cell using the specified deltas.
|
|
2129
|
+
*
|
|
2130
|
+
* @param {number} dx - The delta for the column index.
|
|
2131
|
+
* @param {number} dy - The delta for the row index.
|
|
2132
|
+
* @return {boolean} - True if the focus cell was changed, false otherwise.
|
|
2133
|
+
*/
|
|
1908
2134
|
changeFocusCell(e, t) {
|
|
1909
2135
|
if (!this.isEditing() && this.getFocusModel) {
|
|
1910
2136
|
const s = this.getFocusModel();
|
|
@@ -1915,9 +2141,19 @@ class J extends Ne {
|
|
|
1915
2141
|
}
|
|
1916
2142
|
return !1;
|
|
1917
2143
|
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Resizes the column based on the mouse event.
|
|
2146
|
+
*
|
|
2147
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event that triggered the resize.
|
|
2148
|
+
*/
|
|
1918
2149
|
resizeColumn(e) {
|
|
1919
2150
|
this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
|
|
1920
2151
|
}
|
|
2152
|
+
/**
|
|
2153
|
+
* Clears the selection model, if available.
|
|
2154
|
+
*
|
|
2155
|
+
* @return {void}
|
|
2156
|
+
*/
|
|
1921
2157
|
clearSelectionModel() {
|
|
1922
2158
|
var e;
|
|
1923
2159
|
this.getSelectionModel && ((e = this.getSelectionModel()) == null || e.clear());
|
|
@@ -1926,6 +2162,14 @@ class J extends Ne {
|
|
|
1926
2162
|
var s;
|
|
1927
2163
|
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);
|
|
1928
2164
|
}
|
|
2165
|
+
/**
|
|
2166
|
+
* Restores the scroll position of the table if auto restore options are enabled.
|
|
2167
|
+
*
|
|
2168
|
+
* @private
|
|
2169
|
+
* @memberof ClassName
|
|
2170
|
+
*
|
|
2171
|
+
* @returns {void}
|
|
2172
|
+
*/
|
|
1929
2173
|
autoRestoreScrollPosition() {
|
|
1930
2174
|
var e;
|
|
1931
2175
|
if ((e = this.tableOptions) != null && e.autoRestoreOptions && this.storeScrollPosStateService && this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition) {
|
|
@@ -1933,6 +2177,20 @@ class J extends Ne {
|
|
|
1933
2177
|
s && this.scrollViewport.scrollTo(...s);
|
|
1934
2178
|
}
|
|
1935
2179
|
}
|
|
2180
|
+
/**
|
|
2181
|
+
* Automatically restores the sorting state of the table.
|
|
2182
|
+
*
|
|
2183
|
+
* @private
|
|
2184
|
+
* @function autoRestoreSortingState
|
|
2185
|
+
* @memberof ClassName
|
|
2186
|
+
*
|
|
2187
|
+
* @description
|
|
2188
|
+
* This method checks if the autoRestoreSortingState option is enabled in the tableOptions.
|
|
2189
|
+
* If enabled, it uses the storeSortingService to retrieve the sort items array.
|
|
2190
|
+
* If there are sort items present, it applies them to the table's body model using the doSort method.
|
|
2191
|
+
*
|
|
2192
|
+
* @returns {void}
|
|
2193
|
+
*/
|
|
1936
2194
|
autoRestoreSortingState() {
|
|
1937
2195
|
var e, t;
|
|
1938
2196
|
if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreSortingState && this.storeSortingService) {
|
|
@@ -1940,6 +2198,12 @@ class J extends Ne {
|
|
|
1940
2198
|
s != null && s.length && this.tableModel.getBodyModel().doSort(s);
|
|
1941
2199
|
}
|
|
1942
2200
|
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Restores the collapsed/expanded state of the rows in the table based on the autoRestoreOptions
|
|
2203
|
+
* specified in the tableOptions. This method is private and should not be called directly.
|
|
2204
|
+
*
|
|
2205
|
+
* @private
|
|
2206
|
+
*/
|
|
1943
2207
|
autoRestoreCollapsedExpandedState() {
|
|
1944
2208
|
var e, t;
|
|
1945
2209
|
if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.getRowId && this.storeStateCollapsedExpandService) {
|
|
@@ -1966,27 +2230,27 @@ class J extends Ne {
|
|
|
1966
2230
|
}
|
|
1967
2231
|
}
|
|
1968
2232
|
}
|
|
1969
|
-
function
|
|
2233
|
+
function it(l) {
|
|
1970
2234
|
let e;
|
|
1971
2235
|
return {
|
|
1972
2236
|
c() {
|
|
1973
|
-
e =
|
|
2237
|
+
e = be("div"), e.innerHTML = "", ye(e, "class", "ge-table"), L(e, "width", "100%"), L(e, "height", "100%"), L(e, "background-color", "transparent"), L(e, "padding", "0"), L(e, "margin", "0");
|
|
1974
2238
|
},
|
|
1975
2239
|
m(t, s) {
|
|
1976
|
-
|
|
2240
|
+
me(t, e, s), l[3](e);
|
|
1977
2241
|
},
|
|
1978
2242
|
p: F,
|
|
1979
2243
|
i: F,
|
|
1980
2244
|
o: F,
|
|
1981
2245
|
d(t) {
|
|
1982
|
-
t &&
|
|
2246
|
+
t && le(e), l[3](null);
|
|
1983
2247
|
}
|
|
1984
2248
|
};
|
|
1985
2249
|
}
|
|
1986
|
-
function
|
|
1987
|
-
let { tableModel: s } = e, { tableOptions: i = new
|
|
1988
|
-
const n =
|
|
1989
|
-
|
|
2250
|
+
function ot(l, e, t) {
|
|
2251
|
+
let { tableModel: s } = e, { tableOptions: i = new he() } = e, o;
|
|
2252
|
+
const n = ue();
|
|
2253
|
+
Se(() => {
|
|
1990
2254
|
const r = {
|
|
1991
2255
|
onCheckboxChanged: (h) => {
|
|
1992
2256
|
n("checkboxChanged", h);
|
|
@@ -2009,7 +2273,7 @@ function it(l, e, t) {
|
|
|
2009
2273
|
onMouseMoved: (h) => {
|
|
2010
2274
|
n("mouseMoved", h);
|
|
2011
2275
|
}
|
|
2012
|
-
}, d = new J(o, s, new
|
|
2276
|
+
}, d = new J(o, s, new de(), i, r);
|
|
2013
2277
|
d.firstInit(), n("tableReady", d.getApi());
|
|
2014
2278
|
});
|
|
2015
2279
|
function a(r) {
|
|
@@ -2021,12 +2285,12 @@ function it(l, e, t) {
|
|
|
2021
2285
|
"tableModel" in r && t(1, s = r.tableModel), "tableOptions" in r && t(2, i = r.tableOptions);
|
|
2022
2286
|
}, [o, s, i, a];
|
|
2023
2287
|
}
|
|
2024
|
-
class
|
|
2288
|
+
class nt extends $e {
|
|
2025
2289
|
constructor(e) {
|
|
2026
|
-
super(),
|
|
2290
|
+
super(), Ie(this, e, ot, it, ge, { tableModel: 1, tableOptions: 2 });
|
|
2027
2291
|
}
|
|
2028
2292
|
}
|
|
2029
|
-
class
|
|
2293
|
+
class at {
|
|
2030
2294
|
constructor(e) {
|
|
2031
2295
|
this.Component = e;
|
|
2032
2296
|
}
|
|
@@ -2048,6 +2312,6 @@ class nt {
|
|
|
2048
2312
|
}
|
|
2049
2313
|
}
|
|
2050
2314
|
export {
|
|
2051
|
-
|
|
2052
|
-
|
|
2315
|
+
at as ComponentRendererWrapper,
|
|
2316
|
+
nt as GuiexpertTable
|
|
2053
2317
|
};
|