@guiexpert/svelte-table 1.0.7 → 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 +7 -7
- package/index.js +876 -580
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
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
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
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
|
-
function L(l, e, t,
|
|
41
|
-
t == null ? l.style.removeProperty(e) : l.style.setProperty(e, t,
|
|
40
|
+
function L(l, e, t, s) {
|
|
41
|
+
t == null ? l.style.removeProperty(e) : l.style.setProperty(e, t, s ? "important" : "");
|
|
42
42
|
}
|
|
43
|
-
let
|
|
43
|
+
let z;
|
|
44
44
|
function _(l) {
|
|
45
|
-
|
|
45
|
+
z = 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
|
-
const l =
|
|
62
|
+
const l = z;
|
|
63
63
|
do {
|
|
64
64
|
try {
|
|
65
65
|
for (; I < $.length; ) {
|
|
@@ -77,8 +77,8 @@ 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
84
|
function we(l) {
|
|
@@ -88,30 +88,30 @@ function we(l) {
|
|
|
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
|
-
O.forEach((
|
|
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
|
|
100
|
-
const { fragment:
|
|
101
|
-
|
|
102
|
-
const o = l.$$.on_mount.map(ie).filter(
|
|
99
|
+
function Re(l, e, t) {
|
|
100
|
+
const { fragment: s, after_update: i } = l.$$;
|
|
101
|
+
s && s.m(e, t), N(() => {
|
|
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
|
|
114
|
-
const r =
|
|
113
|
+
function Ie(l, e, t, s, i, o, n = null, a = [-1]) {
|
|
114
|
+
const r = z;
|
|
115
115
|
_(l);
|
|
116
116
|
const d = l.$$ = {
|
|
117
117
|
fragment: null,
|
|
@@ -119,8 +119,8 @@ function De(l, e, t, i, s, o, n = null, a = [-1]) {
|
|
|
119
119
|
// state
|
|
120
120
|
props: o,
|
|
121
121
|
update: F,
|
|
122
|
-
not_equal:
|
|
123
|
-
bound:
|
|
122
|
+
not_equal: i,
|
|
123
|
+
bound: ee(),
|
|
124
124
|
// lifecycle
|
|
125
125
|
on_mount: [],
|
|
126
126
|
on_destroy: [],
|
|
@@ -129,27 +129,27 @@ function De(l, e, t, i, s, 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
|
|
136
136
|
};
|
|
137
137
|
n && n(d.root);
|
|
138
138
|
let h = !1;
|
|
139
|
-
if (d.ctx = t ? t(l, e.props || {}, (p,
|
|
140
|
-
const c = f.length ? f[0] :
|
|
141
|
-
return d.ctx &&
|
|
142
|
-
}) : [], d.update(), h = !0, W(d.before_update), d.fragment =
|
|
139
|
+
if (d.ctx = t ? t(l, e.props || {}, (p, S, ...f) => {
|
|
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 && De(l, p)), S;
|
|
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,12 +179,12 @@ class Ie {
|
|
|
179
179
|
* @returns {() => void}
|
|
180
180
|
*/
|
|
181
181
|
$on(e, t) {
|
|
182
|
-
if (!
|
|
182
|
+
if (!oe(t))
|
|
183
183
|
return F;
|
|
184
|
-
const
|
|
185
|
-
return
|
|
186
|
-
const
|
|
187
|
-
|
|
184
|
+
const s = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
185
|
+
return s.push(t), () => {
|
|
186
|
+
const i = s.indexOf(t);
|
|
187
|
+
i !== -1 && s.splice(i, 1);
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
@@ -192,20 +192,20 @@ 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
|
}
|
|
203
|
-
function
|
|
203
|
+
function X(l) {
|
|
204
204
|
return l && l.type === "AreaModelTree";
|
|
205
205
|
}
|
|
206
206
|
class K {
|
|
207
|
-
constructor(e = -1, t = -1,
|
|
208
|
-
this.rowIndex = e, this.rowTop = t, this.columnIndex =
|
|
207
|
+
constructor(e = -1, t = -1, s = -1, i = -1, o, n, a, r = 0, d = 0, h = 0, p = "") {
|
|
208
|
+
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = i, this.areaIdent = o, this.sideIdent = n, this.originalEvent = a, this.clickCount = r, this.draggingX = d, this.draggingY = h, this.action = p;
|
|
209
209
|
}
|
|
210
210
|
clone() {
|
|
211
211
|
return new K(
|
|
@@ -224,11 +224,11 @@ class K {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
class D {
|
|
227
|
-
constructor(e = ">", t = "",
|
|
228
|
-
this.content = e, this.style = t, this.classes =
|
|
227
|
+
constructor(e = ">", t = "", s = []) {
|
|
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;",
|
|
@@ -237,33 +237,33 @@ class re {
|
|
|
237
237
|
">",
|
|
238
238
|
"",
|
|
239
239
|
["ge-table-tree-arrow-collapsed"]
|
|
240
|
-
),
|
|
240
|
+
), s = new D(
|
|
241
241
|
">",
|
|
242
242
|
"color:transparent;",
|
|
243
243
|
["gt-table-tree-arrow-hidden"]
|
|
244
|
-
),
|
|
244
|
+
), i = new D(
|
|
245
245
|
"↕",
|
|
246
246
|
"",
|
|
247
247
|
["gt-table-tree-arrow-expanded-all"]
|
|
248
248
|
)) {
|
|
249
|
-
this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder =
|
|
249
|
+
this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = s, this.arrowExpandCollapseAll = i;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
class
|
|
253
|
-
constructor(e = new D("↑", "", ["ge-header-sorted-asc"]), t = new D("↓", "", ["ge-header-sorted-desc"]),
|
|
254
|
-
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder =
|
|
252
|
+
class ae {
|
|
253
|
+
constructor(e = new D("↑", "", ["ge-header-sorted-asc"]), t = new D("↓", "", ["ge-header-sorted-desc"]), s = new D("↑", "color:transparent;", [])) {
|
|
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
|
}
|
|
261
|
-
setStyle(e, t,
|
|
262
|
-
return this.domService.setStyle(e, t,
|
|
261
|
+
setStyle(e, t, s) {
|
|
262
|
+
return this.domService.setStyle(e, t, s), e;
|
|
263
263
|
}
|
|
264
264
|
applyStyle(e, t) {
|
|
265
|
-
for (const
|
|
266
|
-
this.domService.setStyle(e,
|
|
265
|
+
for (const s in t)
|
|
266
|
+
this.domService.setStyle(e, s, t[s]);
|
|
267
267
|
return e;
|
|
268
268
|
}
|
|
269
269
|
applyDisplayNoneStyle(e) {
|
|
@@ -273,7 +273,7 @@ class Fe {
|
|
|
273
273
|
return this.domService.setStyle(e, "display", "block"), e;
|
|
274
274
|
}
|
|
275
275
|
applyStyleInPx(e, t) {
|
|
276
|
-
return Object.entries(t).forEach(([
|
|
276
|
+
return Object.entries(t).forEach(([s, i]) => this.domService.setStyle(e, s, i + "px")), e;
|
|
277
277
|
}
|
|
278
278
|
applyStylePosistionRelative(e) {
|
|
279
279
|
return this.domService.setStyle(e, "position", "relative"), this.domService.setStyle(e, "overflow", "clip"), e;
|
|
@@ -284,8 +284,8 @@ class Fe {
|
|
|
284
284
|
applyStyleFullSize(e) {
|
|
285
285
|
return this.domService.setStyle(e, "width", "100%"), this.domService.setStyle(e, "height", "100%"), e;
|
|
286
286
|
}
|
|
287
|
-
applyStyleOverflowAuto(e = "auto", t = "auto",
|
|
288
|
-
return this.domService.setStyle(
|
|
287
|
+
applyStyleOverflowAuto(e = "auto", t = "auto", s) {
|
|
288
|
+
return this.domService.setStyle(s, "overflow-x", e), this.domService.setStyle(s, "overflow-y", t), s;
|
|
289
289
|
}
|
|
290
290
|
applyStyleNoPadding(e) {
|
|
291
291
|
return this.domService.setStyle(e, "padding", "0"), this.domService.setStyle(e, "margin", "0"), this.domService.setStyle(e, "border", "0"), e;
|
|
@@ -301,189 +301,212 @@ class Fe {
|
|
|
301
301
|
return this.domService.appendChild(e, t), this.applyStylePosistionAbsolute(e), { parent: e, child: t, cache: {} };
|
|
302
302
|
}
|
|
303
303
|
appendText(e, t) {
|
|
304
|
-
const
|
|
305
|
-
return this.domService.appendChild(e,
|
|
304
|
+
const s = this.domService.createText(t);
|
|
305
|
+
return this.domService.appendChild(e, s), s;
|
|
306
306
|
}
|
|
307
307
|
addClass(e, t) {
|
|
308
|
-
return e.includes(" ") ? e.split(" ").forEach((
|
|
308
|
+
return e.includes(" ") ? e.split(" ").forEach((s) => this.domService.addClass(t, s)) : this.domService.addClass(t, e), t;
|
|
309
|
+
}
|
|
310
|
+
removeClass(e, t) {
|
|
311
|
+
return e.includes(" ") ? e.split(" ").forEach((s) => this.domService.removeClass(t, s)) : this.domService.removeClass(t, e), t;
|
|
309
312
|
}
|
|
310
313
|
addClasses(e, t) {
|
|
311
314
|
if (e)
|
|
312
|
-
for (const
|
|
313
|
-
this.domService.addClass(t,
|
|
315
|
+
for (const s of e)
|
|
316
|
+
this.domService.addClass(t, s);
|
|
314
317
|
return t;
|
|
315
318
|
}
|
|
316
|
-
setAttribute(e, t,
|
|
317
|
-
return t &&
|
|
319
|
+
setAttribute(e, t, s) {
|
|
320
|
+
return t && s && this.domService.setAttribute(e, t, s), e;
|
|
318
321
|
}
|
|
319
|
-
createAreaDivWithClass(e, t,
|
|
322
|
+
createAreaDivWithClass(e, t, s, i) {
|
|
320
323
|
const o = this.domService.createElement("div");
|
|
321
|
-
return this.addClass(e, o), this.domService.setAttribute(o, "data-area",
|
|
324
|
+
return this.addClass(e, o), this.domService.setAttribute(o, "data-area", s), this.domService.setAttribute(o, "data-side", i), this.domService.appendChild(t, o), o;
|
|
322
325
|
}
|
|
323
326
|
createDivWithClass(e, t) {
|
|
324
|
-
const
|
|
325
|
-
return this.addClass(e,
|
|
327
|
+
const s = this.domService.createElement("div");
|
|
328
|
+
return this.addClass(e, s), this.domService.appendChild(t, s), s;
|
|
326
329
|
}
|
|
327
|
-
addRowDiv(e, t,
|
|
330
|
+
addRowDiv(e, t, s = -1, i, o, n = "") {
|
|
328
331
|
const a = t.index ?? -1, r = this.getDivOrCreateDiv(a, e);
|
|
329
|
-
if (this.domService.addClass(r, "ge-table-row-div"), this.domService.addClass(r, `ge-table-row-div-${t.index}`),
|
|
332
|
+
if (this.domService.addClass(r, "ge-table-row-div"), this.domService.addClass(r, `ge-table-row-div-${t.index}`), i === "body" && o === "center") {
|
|
330
333
|
const d = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
|
|
331
334
|
this.domService.addClass(r, `ge-table-row-${d}`);
|
|
332
335
|
}
|
|
333
|
-
if (this.domService.setStyle(r, "display", "clip"), this.domService.setStyle(r, "position", "absolute"), this.domService.setStyle(r, "left", `${t.left}px`), this.domService.setStyle(r, "top", `${t.top}px`), this.domService.setStyle(r, "width", `${t.width}px`), this.domService.setStyle(r, "height", `${t.height}px`), this.domService.setAttribute(r, "data-row-index", `${
|
|
336
|
+
if (this.domService.setStyle(r, "display", "clip"), this.domService.setStyle(r, "position", "absolute"), this.domService.setStyle(r, "left", `${t.left}px`), this.domService.setStyle(r, "top", `${t.top}px`), this.domService.setStyle(r, "width", `${t.width}px`), this.domService.setStyle(r, "height", `${t.height}px`), this.domService.setAttribute(r, "data-row-index", `${s}`), this.domService.setAttribute(r, "data-area", `${i}`), n) {
|
|
334
337
|
const d = this.domService.createText(n);
|
|
335
338
|
this.domService.appendChild(r, d);
|
|
336
339
|
}
|
|
337
340
|
return this.domService.appendChild(e.child, r), r;
|
|
338
341
|
}
|
|
339
|
-
addColumnDiv(e, t,
|
|
340
|
-
const
|
|
341
|
-
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", `${
|
|
342
|
-
const
|
|
343
|
-
if (o === "body" && n === "center" && this.domService.addClass(c, `ge-table-column-${
|
|
344
|
-
const
|
|
345
|
-
this.addLabelDiv(c, a,
|
|
342
|
+
addColumnDiv(e, t, s = -1, i = -1, o, n, a = "", r, d, h = void 0, p) {
|
|
343
|
+
const S = d == null ? void 0 : d.treeOptions, f = d == null ? void 0 : d.showCheckboxWihoutExtraColumn, c = this.domService.createElement("div");
|
|
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 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);
|
|
346
349
|
}
|
|
347
|
-
return p && this.addSortedIcon(c, p, d == null ? void 0 : d.sortedOptions,
|
|
350
|
+
return p && this.addSortedIcon(c, p, d == null ? void 0 : d.sortedOptions, i), this.domService.appendChild(e, c), c;
|
|
348
351
|
}
|
|
349
|
-
addCheckboxToDiv(e, t,
|
|
352
|
+
addCheckboxToDiv(e, t, s, i) {
|
|
350
353
|
const o = this.domService.createElement("div"), n = t === "full" ? "checked" : "";
|
|
351
354
|
return o.innerHTML = `
|
|
352
355
|
<input
|
|
353
356
|
type="checkbox"
|
|
354
|
-
data-area="${
|
|
355
|
-
data-row-index="${
|
|
357
|
+
data-area="${s}"
|
|
358
|
+
data-row-index="${i}"
|
|
356
359
|
data-input-type="checkbox"
|
|
357
360
|
${n}
|
|
358
|
-
class="ge-table-row-checkbox"> `, this.domService.setStyle(o, "display", "inline"), this.domService.setStyle(o, "width", "inherit"), this.domService.setAttribute(o, "data-row-index", `${
|
|
361
|
+
class="ge-table-row-checkbox"> `, this.domService.setStyle(o, "display", "inline"), this.domService.setStyle(o, "width", "inherit"), this.domService.setAttribute(o, "data-row-index", `${i}`), this.domService.appendChild(e, o), o;
|
|
359
362
|
}
|
|
360
|
-
addLabelDiv(e, t = "",
|
|
363
|
+
addLabelDiv(e, t = "", s = !1, i = -1, o = -1, n = "body") {
|
|
361
364
|
const a = this.domService.createElement("div");
|
|
362
|
-
if (this.domService.addClass(a, "ge-table-label-div"), this.domService.setStyle(a, "position", "relative"), this.domService.setStyle(a, "background", "transparent"), this.domService.setStyle(a, "width", "100%"), this.domService.setStyle(a, "height", "100%"), this.domService.setAttribute(a, "data-row-index", `${
|
|
363
|
-
if (
|
|
365
|
+
if (this.domService.addClass(a, "ge-table-label-div"), this.domService.setStyle(a, "position", "relative"), this.domService.setStyle(a, "background", "transparent"), this.domService.setStyle(a, "width", "100%"), this.domService.setStyle(a, "height", "100%"), this.domService.setAttribute(a, "data-row-index", `${i}`), this.domService.setAttribute(a, "data-col-index", `${o}`), this.domService.setAttribute(a, "data-area", `${n}`), t)
|
|
366
|
+
if (s) {
|
|
364
367
|
const r = this.domService.createText(t);
|
|
365
368
|
this.domService.appendChild(a, r);
|
|
366
369
|
} else {
|
|
367
370
|
const r = this.domService.createElement("div");
|
|
368
371
|
this.domService.appendChild(a, r);
|
|
369
372
|
const d = this.domService.createText(t);
|
|
370
|
-
this.domService.addClass(r, "ge-table-label"), this.domService.appendChild(r, d), this.domService.setAttribute(r, "data-row-index", `${
|
|
373
|
+
this.domService.addClass(r, "ge-table-label"), this.domService.appendChild(r, d), this.domService.setAttribute(r, "data-row-index", `${i}`), this.domService.setAttribute(r, "data-col-index", `${o}`), this.domService.setAttribute(r, "data-area", `${n}`);
|
|
371
374
|
}
|
|
372
375
|
return this.domService.appendChild(e, a), a;
|
|
373
376
|
}
|
|
374
|
-
addSortedIcon(e, t = "",
|
|
377
|
+
addSortedIcon(e, t = "", s = new ae(), i = -1) {
|
|
375
378
|
const o = this.domService.createElement("div");
|
|
376
|
-
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", `${
|
|
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");
|
|
377
380
|
let n;
|
|
378
|
-
t === "asc" ? n =
|
|
381
|
+
t === "asc" ? n = s.iconAsc : t === "desc" ? n = s.iconDesc : n = s.iconPlaceholder;
|
|
379
382
|
const a = n.content, r = this.domService.createText(a);
|
|
380
383
|
this.domService.appendChild(o, r), n.style && this.applyStyleString(o, n.style);
|
|
381
384
|
for (const d of n.classes)
|
|
382
385
|
this.domService.addClass(o, d);
|
|
383
386
|
return this.domService.appendChild(e, o), o;
|
|
384
387
|
}
|
|
385
|
-
addArrowDiv(e, t = "none",
|
|
388
|
+
addArrowDiv(e, t = "none", s = new ne(), i = -1, o = -1, n = "body") {
|
|
386
389
|
const a = this.domService.createElement("div");
|
|
387
|
-
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", `${
|
|
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}`);
|
|
388
391
|
let r;
|
|
389
|
-
t === "expanded" ? r =
|
|
392
|
+
t === "expanded" ? r = s.arrowExpanded : t === "collapsed" ? r = s.arrowCollapsed : r = s.arrowPlaceholder;
|
|
390
393
|
const d = r.content, h = this.domService.createText(d);
|
|
391
394
|
this.domService.appendChild(a, h), r.style && this.applyStyleString(a, r.style);
|
|
392
395
|
for (const p of r.classes)
|
|
393
396
|
this.domService.addClass(a, p);
|
|
394
397
|
return this.domService.appendChild(e, a), a;
|
|
395
398
|
}
|
|
396
|
-
addColumnBorderDivs(e, t,
|
|
399
|
+
addColumnBorderDivs(e, t, s, i, o) {
|
|
397
400
|
if (e.verticalBorderVisible) {
|
|
398
|
-
const n = `ge-table-${
|
|
399
|
-
this.addVerticalBorder(
|
|
401
|
+
const n = `ge-table-${i}-${o}-vertical-border`;
|
|
402
|
+
this.addVerticalBorder(s, t, n);
|
|
400
403
|
}
|
|
401
404
|
if (e.horizontalBorderVisible) {
|
|
402
|
-
const n = `ge-table-${
|
|
403
|
-
this.addHorizontalBorder(
|
|
405
|
+
const n = `ge-table-${i}-${o}-horizontal-border`;
|
|
406
|
+
this.addHorizontalBorder(s, t, n);
|
|
404
407
|
}
|
|
405
408
|
return t;
|
|
406
409
|
}
|
|
407
|
-
addHorizontalBorder(e, t,
|
|
408
|
-
const
|
|
409
|
-
return this.domService.addClass(
|
|
410
|
+
addHorizontalBorder(e, t, s = "ge-table-body-center-horizontal-border") {
|
|
411
|
+
const i = this.domService.createElement("div");
|
|
412
|
+
return this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${e.left}px`), this.domService.setStyle(i, "top", `${e.top}px`), this.domService.setStyle(i, "width", `${e.width}px`), this.domService.setStyle(i, "height", "1px"), this.domService.appendChild(t, i), i;
|
|
410
413
|
}
|
|
411
|
-
addFocusBorderDivs(e, t,
|
|
412
|
-
let
|
|
413
|
-
return this.domService.addClass(
|
|
414
|
+
addFocusBorderDivs(e, t, s) {
|
|
415
|
+
let i = this.domService.createElement("div");
|
|
416
|
+
return this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${t.height}px`), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left + t.width - 1}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${t.height}px`), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", "1px"), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top + t.height - 1}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", "1px"), this.applyStyle(i, s), this.domService.appendChild(e, i), e;
|
|
414
417
|
}
|
|
415
|
-
addVerticalBorder(e, t,
|
|
416
|
-
const
|
|
417
|
-
return this.domService.addClass(
|
|
418
|
+
addVerticalBorder(e, t, s = "ge-table-body-center-vertical-border") {
|
|
419
|
+
const i = this.domService.createElement("div");
|
|
420
|
+
return this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${e.left}px`), this.domService.setStyle(i, "top", `${e.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${e.height}px`), this.domService.appendChild(t, i), i;
|
|
418
421
|
}
|
|
419
|
-
addDiv(e, t,
|
|
420
|
-
const
|
|
421
|
-
return
|
|
422
|
+
addDiv(e, t, s = "") {
|
|
423
|
+
const i = this.domService.createElement("div");
|
|
424
|
+
return s && this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", `${t.height}px`), this.domService.appendChild(e, i), i;
|
|
422
425
|
}
|
|
423
426
|
applyStyleString(e, t) {
|
|
424
|
-
const
|
|
425
|
-
for (const
|
|
426
|
-
const [o, n] =
|
|
427
|
+
const s = t.split(";").map((i) => i.trim()).filter((i) => i);
|
|
428
|
+
for (const i of s) {
|
|
429
|
+
const [o, n] = i.split(":");
|
|
427
430
|
this.domService.setStyle(e, o.trim(), n.trim());
|
|
428
431
|
}
|
|
429
432
|
}
|
|
430
433
|
getDivOrCreateDiv(e, t) {
|
|
431
|
-
let
|
|
432
|
-
return
|
|
434
|
+
let s = t.cache[e];
|
|
435
|
+
return s ? (s.innerText = "", s) : (s = this.domService.createElement("div"), t.cache[e] = s, s);
|
|
433
436
|
}
|
|
434
437
|
}
|
|
435
438
|
const Y = (l) => l === "header" ? "header" : l === "footer" ? "footer" : "body";
|
|
436
|
-
class
|
|
439
|
+
class Le {
|
|
437
440
|
constructor(e, t) {
|
|
438
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)) {
|
|
439
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"));
|
|
440
|
-
const
|
|
441
|
-
if (
|
|
442
|
-
const
|
|
443
|
-
this.value =
|
|
443
|
+
const s = e.getAttribute("data-area");
|
|
444
|
+
if (s && (this.areaIdent = Y(s), this.areaModel = t.tableModel.getAreaModel(this.areaIdent), this.row = this.areaModel.getRowByIndex(this.rowIdx)), e instanceof HTMLInputElement) {
|
|
445
|
+
const i = e;
|
|
446
|
+
this.value = i.value;
|
|
444
447
|
}
|
|
445
448
|
}
|
|
446
449
|
}
|
|
447
450
|
}
|
|
448
|
-
class
|
|
451
|
+
class _e {
|
|
449
452
|
constructor(e) {
|
|
450
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(
|
|
451
454
|
(t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
|
|
452
455
|
);
|
|
453
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Handles the "contextmenu" event.
|
|
459
|
+
*
|
|
460
|
+
* @private
|
|
461
|
+
* @param {MouseEvent} evt - The mouse event object.
|
|
462
|
+
* @return {void}
|
|
463
|
+
*/
|
|
454
464
|
onContextmenu(e) {
|
|
455
465
|
this.mouseEvent = e;
|
|
456
466
|
const t = this.tableScope.createGeMouseEvent(this.mouseEvent);
|
|
457
467
|
this.tableScope.contextmenu(t);
|
|
458
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Handles the click event on the host element.
|
|
471
|
+
*
|
|
472
|
+
* @param {MouseEvent} event - The click event.
|
|
473
|
+
*
|
|
474
|
+
* @return {void}
|
|
475
|
+
*/
|
|
459
476
|
onHostElementClicked(e) {
|
|
460
|
-
const t = new
|
|
477
|
+
const t = new Le(e.target, this.tableScope);
|
|
461
478
|
if (t.action === "toggleExpandCollapseAll")
|
|
462
479
|
this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
|
|
463
480
|
else if (t.inputType === "checkbox" && t.areaIdent)
|
|
464
481
|
this.tableScope.toggleRowCheckbox(t.rowIdx, t.colIdx, t.areaIdent), e.preventDefault(), e.stopPropagation();
|
|
465
482
|
else if (j(t.row) && t.areaModel) {
|
|
466
|
-
const
|
|
467
|
-
if (console.info(
|
|
483
|
+
const s = t.colIdx === this.getArrowColumnIndex() && e.altKey, i = t.className.includes("ge-table-tree-arrow-div");
|
|
484
|
+
if (console.info(i, s), s || i) {
|
|
468
485
|
e.preventDefault(), e.stopPropagation();
|
|
469
486
|
const o = t.row;
|
|
470
487
|
o.expanded = !o.expanded, "recalcVisibleTreeRows" in t.areaModel && t.areaModel.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(o);
|
|
471
488
|
}
|
|
472
489
|
}
|
|
473
490
|
if (t.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
|
|
474
|
-
const
|
|
475
|
-
|
|
491
|
+
const s = this.tableScope.tableOptions.getFocusModel();
|
|
492
|
+
s == null || s.clear(), s == null || s.setFocus(t.rowIdx, t.colIdx);
|
|
476
493
|
}
|
|
477
494
|
this.publishGeMouseEvent(e, 1);
|
|
478
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
|
+
*/
|
|
479
502
|
onHostElementDblClicked(e) {
|
|
480
503
|
if (e.target instanceof HTMLElement) {
|
|
481
|
-
const t = e.target,
|
|
482
|
-
if (
|
|
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);
|
|
505
|
+
if (s && i === "header")
|
|
483
506
|
this.tableScope.tableModel.isSortable(n) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, o, n));
|
|
484
507
|
else if (t.getAttribute("data-row-index")) {
|
|
485
508
|
const r = a.getRowByIndex(o);
|
|
486
|
-
if (
|
|
509
|
+
if (s && i === "body" && a.isEditable(o, n) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(o, n)), j(r) && n === this.getArrowColumnIndex()) {
|
|
487
510
|
e.preventDefault(), e.stopPropagation();
|
|
488
511
|
const d = r;
|
|
489
512
|
d.expanded = !d.expanded, "recalcVisibleTreeRows" in a && a.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(d);
|
|
@@ -492,13 +515,27 @@ class Le {
|
|
|
492
515
|
}
|
|
493
516
|
this.publishGeMouseEvent(e, 2);
|
|
494
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
|
+
*/
|
|
495
526
|
publishGeMouseEvent(e, t) {
|
|
496
|
-
var
|
|
497
|
-
this.mouseEvent = e, this.geMouseEventOld = (
|
|
527
|
+
var s;
|
|
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);
|
|
498
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
|
+
*/
|
|
499
536
|
updateCollapsedExpandedState(e) {
|
|
500
|
-
var
|
|
501
|
-
const t = (
|
|
537
|
+
var s, i, o, n, a;
|
|
538
|
+
const t = (i = (s = this.tableScope.tableOptions) == null ? void 0 : s.autoRestoreOptions) == null ? void 0 : i.getRowId;
|
|
502
539
|
if (t) {
|
|
503
540
|
const r = (o = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : o.collapsedExpandedStateGet().mode, d = r === "collapsed" && !e.expanded || r === "expanded" && e.expanded, h = r === "collapsed" && e.expanded || r === "expanded" && !e.expanded, p = t(e.data);
|
|
504
541
|
d ? (n = this.tableScope.storeStateCollapsedExpandService) == null || n.collapsedStateIdsPush(p) : h && ((a = this.tableScope.storeStateCollapsedExpandService) == null || a.collapsedStateIdsRemove(p));
|
|
@@ -537,35 +574,107 @@ class Le {
|
|
|
537
574
|
}
|
|
538
575
|
}
|
|
539
576
|
}
|
|
540
|
-
class
|
|
577
|
+
class Be {
|
|
541
578
|
constructor(e) {
|
|
542
579
|
this.tableScope = e;
|
|
543
580
|
}
|
|
544
|
-
|
|
545
|
-
|
|
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
|
+
*/
|
|
589
|
+
updateCells(e, t = !1) {
|
|
590
|
+
this.tableScope.updateCells(e, t);
|
|
546
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* Notifies that the external filter has changed.
|
|
594
|
+
*
|
|
595
|
+
* @return {void}
|
|
596
|
+
*/
|
|
547
597
|
externalFilterChanged() {
|
|
548
598
|
this.tableScope.externalFilterChanged();
|
|
549
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
|
+
*/
|
|
550
607
|
scrollToPixel(e = 0, t = 0) {
|
|
551
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
|
+
*/
|
|
552
617
|
scrollToIndex(e = 0, t = 0) {
|
|
553
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
|
+
*/
|
|
554
626
|
setHeaderVisible(e = !0) {
|
|
555
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
|
+
*/
|
|
556
636
|
setColumnVisible(e, t = !0) {
|
|
557
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
|
+
*/
|
|
558
644
|
isColumnVisible(e) {
|
|
559
645
|
return !0;
|
|
560
646
|
}
|
|
647
|
+
/**
|
|
648
|
+
* Checks if the header is visible.
|
|
649
|
+
*
|
|
650
|
+
* @return {boolean} - Returns true if the header is visible, otherwise returns false.
|
|
651
|
+
*/
|
|
561
652
|
isHeaderVisible() {
|
|
562
653
|
return !0;
|
|
563
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
|
+
*/
|
|
564
662
|
setFooterVisible(e = !0) {
|
|
565
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Determines if the footer is visible.
|
|
666
|
+
*
|
|
667
|
+
* @returns {boolean} True if the footer is visible, false otherwise.
|
|
668
|
+
*/
|
|
566
669
|
isFooterVisible() {
|
|
567
670
|
return !0;
|
|
568
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
|
+
*/
|
|
569
678
|
repaint() {
|
|
570
679
|
this.tableScope.repaint();
|
|
571
680
|
}
|
|
@@ -577,23 +686,23 @@ class q {
|
|
|
577
686
|
autoConvertMapToObject(e) {
|
|
578
687
|
const t = {};
|
|
579
688
|
if (e instanceof Map) {
|
|
580
|
-
const
|
|
581
|
-
for (const
|
|
689
|
+
const s = e;
|
|
690
|
+
for (const i of [...s]) {
|
|
582
691
|
const [
|
|
583
692
|
o,
|
|
584
693
|
n
|
|
585
|
-
] =
|
|
694
|
+
] = i;
|
|
586
695
|
t[o] = n;
|
|
587
696
|
}
|
|
588
697
|
}
|
|
589
698
|
return t;
|
|
590
699
|
}
|
|
591
700
|
checkAndPersistItem(e, t) {
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
596
|
-
const o =
|
|
701
|
+
const s = this.getStorageKeyFn;
|
|
702
|
+
if (s) {
|
|
703
|
+
const i = s();
|
|
704
|
+
if (i) {
|
|
705
|
+
const o = i + e;
|
|
597
706
|
if ((t + "").includes("Map")) {
|
|
598
707
|
const n = this.autoConvertMapToObject(t);
|
|
599
708
|
this.persistItem(o, n);
|
|
@@ -645,7 +754,7 @@ class q {
|
|
|
645
754
|
// }
|
|
646
755
|
// }
|
|
647
756
|
}
|
|
648
|
-
class
|
|
757
|
+
class We extends q {
|
|
649
758
|
constructor(e) {
|
|
650
759
|
super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
|
|
651
760
|
}
|
|
@@ -660,21 +769,21 @@ class Be extends q {
|
|
|
660
769
|
if (e) {
|
|
661
770
|
const t = e();
|
|
662
771
|
if (t) {
|
|
663
|
-
const
|
|
664
|
-
let
|
|
665
|
-
this.scrollOffset =
|
|
772
|
+
const s = t + this.SCROLL_STATE;
|
|
773
|
+
let i = this.loadFromLocalStorage(s);
|
|
774
|
+
this.scrollOffset = i || [0, 0];
|
|
666
775
|
}
|
|
667
776
|
}
|
|
668
777
|
}
|
|
669
778
|
}
|
|
670
|
-
class
|
|
671
|
-
constructor(e = "collapsed", t = [],
|
|
672
|
-
this.mode = e, this.rowIds = t, this.allCollapsed =
|
|
779
|
+
class He {
|
|
780
|
+
constructor(e = "collapsed", t = [], s = !1, i = !1) {
|
|
781
|
+
this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = i;
|
|
673
782
|
}
|
|
674
783
|
}
|
|
675
|
-
class
|
|
784
|
+
class ke extends q {
|
|
676
785
|
constructor(e) {
|
|
677
|
-
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new
|
|
786
|
+
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new He(), this.load();
|
|
678
787
|
}
|
|
679
788
|
collapsedExpandedStateGet() {
|
|
680
789
|
return this.collapsedExpandedState;
|
|
@@ -697,8 +806,8 @@ class He extends q {
|
|
|
697
806
|
if (e) {
|
|
698
807
|
const t = e();
|
|
699
808
|
if (t) {
|
|
700
|
-
const
|
|
701
|
-
|
|
809
|
+
const s = t + this.COLLAPSED_EXPANDED_STATE, i = this.loadFromLocalStorage(s);
|
|
810
|
+
i && (this.collapsedExpandedState = i);
|
|
702
811
|
}
|
|
703
812
|
}
|
|
704
813
|
}
|
|
@@ -706,7 +815,7 @@ class He extends q {
|
|
|
706
815
|
this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
|
|
707
816
|
}
|
|
708
817
|
}
|
|
709
|
-
class
|
|
818
|
+
class Pe extends q {
|
|
710
819
|
constructor(e) {
|
|
711
820
|
super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
|
|
712
821
|
}
|
|
@@ -721,95 +830,95 @@ class ke extends q {
|
|
|
721
830
|
if (e) {
|
|
722
831
|
const t = e();
|
|
723
832
|
if (t) {
|
|
724
|
-
const
|
|
725
|
-
let
|
|
726
|
-
this.sortItems =
|
|
833
|
+
const s = t + this.SORTING_STATE;
|
|
834
|
+
let i = this.loadFromLocalStorage(s);
|
|
835
|
+
this.sortItems = i || [];
|
|
727
836
|
}
|
|
728
837
|
}
|
|
729
838
|
}
|
|
730
839
|
}
|
|
731
840
|
class T {
|
|
732
|
-
constructor(e = 0, t = 0,
|
|
733
|
-
this.left = e, this.width = t, this.height =
|
|
841
|
+
constructor(e = 0, t = 0, s = 0, i = 0, o) {
|
|
842
|
+
this.left = e, this.width = t, this.height = s, this.top = i, this.index = o;
|
|
734
843
|
}
|
|
735
844
|
}
|
|
736
|
-
class
|
|
737
|
-
constructor(e, t,
|
|
738
|
-
this.hostElement = e, this.tableModel = t, this.dom =
|
|
845
|
+
class Ve {
|
|
846
|
+
constructor(e, t, s, i) {
|
|
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();
|
|
739
848
|
const o = this.hostElement;
|
|
740
849
|
o.innerText = "", this.dom.setAttribute(o, "tabindex", "0"), this.dom.setStyle(
|
|
741
850
|
this.dom.addClass("ge-table", o),
|
|
742
851
|
"position",
|
|
743
852
|
"relative"
|
|
744
|
-
), this.hoverRow =
|
|
745
|
-
|
|
746
|
-
), this.hoverColumn =
|
|
747
|
-
|
|
748
|
-
), this.areaHeaderWest =
|
|
749
|
-
|
|
750
|
-
|
|
853
|
+
), this.hoverRow = s.applyStylePosistionAbsolute(
|
|
854
|
+
s.createDivWithClass("ge-table-hover-row", o)
|
|
855
|
+
), this.hoverColumn = s.applyStylePosistionAbsolute(
|
|
856
|
+
s.createDivWithClass("ge-table-hover-column", o)
|
|
857
|
+
), this.areaHeaderWest = s.appendRelativeChildDiv(
|
|
858
|
+
s.applyStylePosistionAbsolute(
|
|
859
|
+
s.createAreaDivWithClass("ge-table-header ge-table-header-west", o, "header", "west")
|
|
751
860
|
)
|
|
752
|
-
), this.areaHeaderCenter =
|
|
753
|
-
|
|
754
|
-
|
|
861
|
+
), this.areaHeaderCenter = s.appendRelativeChildDiv(
|
|
862
|
+
s.applyStylePosistionAbsolute(
|
|
863
|
+
s.createAreaDivWithClass("ge-table-header ge-table-header-center", o, "header", "center")
|
|
755
864
|
)
|
|
756
|
-
), this.areaHeaderEast =
|
|
757
|
-
|
|
758
|
-
|
|
865
|
+
), this.areaHeaderEast = s.appendRelativeChildDiv(
|
|
866
|
+
s.applyStylePosistionAbsolute(
|
|
867
|
+
s.createAreaDivWithClass("ge-table-header ge-table-header-east", o, "body", "east")
|
|
759
868
|
)
|
|
760
|
-
), this.areaBodyWest =
|
|
761
|
-
|
|
762
|
-
|
|
869
|
+
), this.areaBodyWest = s.appendRelativeChildDiv(
|
|
870
|
+
s.applyStylePosistionAbsolute(
|
|
871
|
+
s.createAreaDivWithClass("ge-table-body ge-table-body-west", o, "body", "west")
|
|
763
872
|
)
|
|
764
|
-
), this.areaBodyEast =
|
|
765
|
-
|
|
766
|
-
|
|
873
|
+
), this.areaBodyEast = s.appendRelativeChildDiv(
|
|
874
|
+
s.applyStylePosistionAbsolute(
|
|
875
|
+
s.createAreaDivWithClass("ge-table-body ge-table-body-east", o, "body", "east")
|
|
767
876
|
)
|
|
768
|
-
), this.areaFooterWest =
|
|
769
|
-
|
|
770
|
-
|
|
877
|
+
), this.areaFooterWest = s.appendRelativeChildDiv(
|
|
878
|
+
s.applyStylePosistionAbsolute(
|
|
879
|
+
s.createAreaDivWithClass("ge-table-footer ge-table-footer-west", o, "footer", "west")
|
|
771
880
|
)
|
|
772
|
-
), this.areaFooterCenter =
|
|
773
|
-
|
|
774
|
-
|
|
881
|
+
), this.areaFooterCenter = s.appendRelativeChildDiv(
|
|
882
|
+
s.applyStylePosistionAbsolute(
|
|
883
|
+
s.createAreaDivWithClass("ge-table-footer ge-table-footer-center", o, "footer", "center")
|
|
775
884
|
)
|
|
776
|
-
), this.areaFooterEast =
|
|
777
|
-
|
|
778
|
-
|
|
885
|
+
), this.areaFooterEast = s.appendRelativeChildDiv(
|
|
886
|
+
s.applyStylePosistionAbsolute(
|
|
887
|
+
s.createAreaDivWithClass("ge-table-footer ge-table-footer-east", o, "footer", "east")
|
|
779
888
|
)
|
|
780
|
-
), this.scrollViewport =
|
|
889
|
+
), this.scrollViewport = s.applyStyleOverflowAuto(
|
|
781
890
|
this.tableOptions.overflowX ?? "auto",
|
|
782
891
|
this.tableOptions.overflowY ?? "auto",
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
892
|
+
s.applyStyleNoPadding(
|
|
893
|
+
s.applyStylePosistionAbsolute(
|
|
894
|
+
s.createAreaDivWithClass("ge-table-scroll-viewport", o, "body", "center")
|
|
786
895
|
)
|
|
787
896
|
)
|
|
788
|
-
), this.contentWrapperDiv =
|
|
789
|
-
|
|
790
|
-
|
|
897
|
+
), this.contentWrapperDiv = s.applyStyleNoPadding(
|
|
898
|
+
s.applyStylePosistionRelative(
|
|
899
|
+
s.createDivWithClass("ge-table-scroll-content-wrapper", this.scrollViewport)
|
|
791
900
|
)
|
|
792
|
-
), this.contentDiv =
|
|
793
|
-
|
|
794
|
-
|
|
901
|
+
), this.contentDiv = s.applyStyleNoPadding(
|
|
902
|
+
s.applyStylePosistionRelative(
|
|
903
|
+
s.createDivWithClass("ge-table-scroll-content", this.contentWrapperDiv)
|
|
795
904
|
)
|
|
796
|
-
), this.areaBodyCenter =
|
|
797
|
-
|
|
798
|
-
), this.borderHeaderBottom =
|
|
799
|
-
|
|
800
|
-
), this.borderFixedWest =
|
|
801
|
-
|
|
802
|
-
), this.borderFixedEast =
|
|
803
|
-
|
|
804
|
-
), this.borderFooterTop =
|
|
805
|
-
|
|
905
|
+
), this.areaBodyCenter = s.appendRelativeChildDiv(
|
|
906
|
+
s.createDivWithClass("ge-table-body-center", this.contentDiv)
|
|
907
|
+
), this.borderHeaderBottom = s.applyStylePosistionAbsolute(
|
|
908
|
+
s.createDivWithClass("ge-table-header-border", o)
|
|
909
|
+
), this.borderFixedWest = s.applyStylePosistionAbsolute(
|
|
910
|
+
s.createDivWithClass("ge-table-west-fixed-column-border", o)
|
|
911
|
+
), this.borderFixedEast = s.applyStylePosistionAbsolute(
|
|
912
|
+
s.createDivWithClass("ge-table-east-fixed-column-border", o)
|
|
913
|
+
), this.borderFooterTop = s.applyStylePosistionAbsolute(
|
|
914
|
+
s.createDivWithClass("ge-table-footer-border", o)
|
|
806
915
|
);
|
|
807
916
|
}
|
|
808
917
|
adjustContainersAndRows() {
|
|
809
|
-
const e = this.tableModel.getPadding(), t = this.hostElement.clientWidth,
|
|
918
|
+
const e = this.tableModel.getPadding(), t = this.hostElement.clientWidth, s = this.hostElement.clientHeight;
|
|
810
919
|
this.dom.applyStyle(this.scrollViewport, {
|
|
811
920
|
width: `${t - e.left}px`,
|
|
812
|
-
height: `${
|
|
921
|
+
height: `${s - e.top}px`,
|
|
813
922
|
top: `${e.top}px`,
|
|
814
923
|
left: `${e.left}px`
|
|
815
924
|
}), this.scrollTop = this.scrollViewport.scrollTop, this.dom.applyStyle(this.contentDiv, {
|
|
@@ -817,21 +926,21 @@ class Pe {
|
|
|
817
926
|
height: `${this.scrollViewport.clientHeight}px`,
|
|
818
927
|
top: `${this.scrollTop}px`,
|
|
819
928
|
left: `${this.scrollViewport.scrollLeft}px`
|
|
820
|
-
}), this.areaBodyWestGeo.width = e.left, this.areaBodyWestGeo.height =
|
|
929
|
+
}), this.areaBodyWestGeo.width = e.left, this.areaBodyWestGeo.height = s - e.top - e.bottom, this.areaBodyWestGeo.top = e.top, this.areaBodyWestGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyWest.parent, this.areaBodyWestGeo), this.tableOptions.fixedWestSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
|
|
821
930
|
this.dom.applyStyle(this.borderFixedWest, {
|
|
822
931
|
width: "1px",
|
|
823
932
|
height: `${this.areaBodyWestGeo.height}px`,
|
|
824
933
|
top: `${this.areaBodyWestGeo.top}px`,
|
|
825
934
|
left: `${this.areaBodyWestGeo.width}px`
|
|
826
935
|
})
|
|
827
|
-
) : this.dom.applyDisplayNoneStyle(this.borderFixedWest), this.areaBodyEastGeo.width = e.right, this.areaBodyEastGeo.height =
|
|
936
|
+
) : this.dom.applyDisplayNoneStyle(this.borderFixedWest), this.areaBodyEastGeo.width = e.right, this.areaBodyEastGeo.height = s - e.top - e.bottom, this.areaBodyEastGeo.top = e.top, this.areaBodyEastGeo.left = t - e.right, this.dom.applyStyleInPx(this.areaBodyEast.parent, this.areaBodyEastGeo), this.tableOptions.fixedEastSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
|
|
828
937
|
this.dom.applyStyle(this.borderFixedEast, {
|
|
829
938
|
width: "1px",
|
|
830
939
|
height: `${this.areaBodyEastGeo.height}px`,
|
|
831
940
|
top: `${this.areaBodyEastGeo.top}px`,
|
|
832
941
|
left: `${this.areaBodyEastGeo.left}px`
|
|
833
942
|
})
|
|
834
|
-
) : this.dom.applyDisplayNoneStyle(this.borderFixedEast), this.areaBodyCenterGeo.width = t - e.left - e.right, this.areaBodyCenterGeo.height =
|
|
943
|
+
) : this.dom.applyDisplayNoneStyle(this.borderFixedEast), this.areaBodyCenterGeo.width = t - e.left - e.right, this.areaBodyCenterGeo.height = s - e.top - e.bottom, this.areaBodyCenterGeo.top = 0, this.areaBodyCenterGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyCenter.parent, this.areaBodyCenterGeo), this.dom.applyStyle(this.areaHeaderCenter.parent, {
|
|
835
944
|
width: `${t - e.left - e.right}px`,
|
|
836
945
|
height: `${e.top}px`,
|
|
837
946
|
top: "0",
|
|
@@ -856,23 +965,23 @@ class Pe {
|
|
|
856
965
|
) : this.dom.applyDisplayNoneStyle(this.borderHeaderBottom), this.dom.applyStyle(this.areaFooterWest.parent, {
|
|
857
966
|
width: `${e.left}px`,
|
|
858
967
|
height: `${e.bottom}px`,
|
|
859
|
-
top: `${
|
|
968
|
+
top: `${s - e.bottom}px`,
|
|
860
969
|
left: "0"
|
|
861
970
|
}), this.dom.applyStyle(this.areaFooterCenter.parent, {
|
|
862
971
|
width: `${t - e.left - e.right}px`,
|
|
863
972
|
height: `${e.bottom}px`,
|
|
864
|
-
top: `${
|
|
973
|
+
top: `${s - e.bottom}px`,
|
|
865
974
|
left: `${e.left}px`
|
|
866
975
|
}), this.dom.applyStyle(this.areaFooterEast.parent, {
|
|
867
976
|
width: `${e.right}px`,
|
|
868
977
|
height: `${e.bottom}px`,
|
|
869
|
-
top: `${
|
|
978
|
+
top: `${s - e.bottom}px`,
|
|
870
979
|
left: `${t - e.right}px`
|
|
871
980
|
}), this.tableOptions.footerSeparatorBorderVisible && this.tableModel.isFooterVisibe() ? this.dom.applyDisplayBlockStyle(
|
|
872
981
|
this.dom.applyStyle(this.borderFooterTop, {
|
|
873
982
|
width: `${t}px`,
|
|
874
983
|
height: "1px",
|
|
875
|
-
top: `${
|
|
984
|
+
top: `${s - e.bottom}px`,
|
|
876
985
|
left: "0px"
|
|
877
986
|
})
|
|
878
987
|
) : this.dom.applyDisplayNoneStyle(this.borderFooterTop), this.adjustAfterScrolling();
|
|
@@ -884,12 +993,21 @@ class Pe {
|
|
|
884
993
|
this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
|
|
885
994
|
}
|
|
886
995
|
}
|
|
887
|
-
class
|
|
888
|
-
|
|
889
|
-
|
|
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
|
+
*/
|
|
1006
|
+
constructor(e, t, s, i, o = !1) {
|
|
1007
|
+
this.r1 = e, this.c1 = t, this.r2 = s, this.c2 = i, this.gammaRange = o;
|
|
890
1008
|
}
|
|
891
1009
|
static create(e) {
|
|
892
|
-
return e.gammaRange === void 0 && (e.gammaRange = !1), new
|
|
1010
|
+
return e.gammaRange === void 0 && (e.gammaRange = !1), new M(
|
|
893
1011
|
e.rowIndex1,
|
|
894
1012
|
e.columnIndex1,
|
|
895
1013
|
e.rowIndex2,
|
|
@@ -898,19 +1016,19 @@ class A {
|
|
|
898
1016
|
);
|
|
899
1017
|
}
|
|
900
1018
|
static singleCell(e, t) {
|
|
901
|
-
return new
|
|
1019
|
+
return new M(e, t, e, t);
|
|
902
1020
|
}
|
|
903
1021
|
static singleRow(e) {
|
|
904
|
-
return new
|
|
1022
|
+
return new M(e, 0, e, Number.MAX_SAFE_INTEGER);
|
|
905
1023
|
}
|
|
906
1024
|
static singleColumn(e) {
|
|
907
|
-
return new
|
|
1025
|
+
return new M(0, e, Number.MAX_SAFE_INTEGER, e);
|
|
908
1026
|
}
|
|
909
1027
|
isInRange(e, t) {
|
|
910
1028
|
return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
|
|
911
1029
|
}
|
|
912
1030
|
}
|
|
913
|
-
class
|
|
1031
|
+
class Ge {
|
|
914
1032
|
constructor(e, t) {
|
|
915
1033
|
this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
|
|
916
1034
|
}
|
|
@@ -919,14 +1037,14 @@ class Ve {
|
|
|
919
1037
|
return;
|
|
920
1038
|
this.colAndRowspanRanges = [];
|
|
921
1039
|
const e = this.areaModel.getRowCount(), t = this.tableModel.getColumnCount();
|
|
922
|
-
for (let
|
|
923
|
-
for (let
|
|
924
|
-
let o = this.areaModel.getColspanAt(
|
|
1040
|
+
for (let s = 0; s < e; s++)
|
|
1041
|
+
for (let i = 0; i < t; i++) {
|
|
1042
|
+
let o = this.areaModel.getColspanAt(s, i), n = this.areaModel.getRowspanAt(s, i);
|
|
925
1043
|
if (o > 1 || n > 1) {
|
|
926
1044
|
o === 0 && (o = 1), n === 0 && (n = 1);
|
|
927
1045
|
const a = this.areaModel.hasOwnProperty("gammaCells");
|
|
928
1046
|
this.colAndRowspanRanges.push(
|
|
929
|
-
new
|
|
1047
|
+
new M(s, i, s + n - 1, i + o - 1, a)
|
|
930
1048
|
);
|
|
931
1049
|
}
|
|
932
1050
|
}
|
|
@@ -936,29 +1054,29 @@ class Ve {
|
|
|
936
1054
|
}
|
|
937
1055
|
isInRange(e, t) {
|
|
938
1056
|
if (this.colAndRowspanRanges) {
|
|
939
|
-
for (const
|
|
940
|
-
if (
|
|
1057
|
+
for (const s of this.colAndRowspanRanges)
|
|
1058
|
+
if (s.isInRange(e, t))
|
|
941
1059
|
return !0;
|
|
942
1060
|
}
|
|
943
1061
|
return !1;
|
|
944
1062
|
}
|
|
945
1063
|
}
|
|
946
|
-
class
|
|
947
|
-
constructor(e, t,
|
|
948
|
-
this.header = e, this.body = t, this.footer =
|
|
1064
|
+
class Ne {
|
|
1065
|
+
constructor(e, t, s) {
|
|
1066
|
+
this.header = e, this.body = t, this.footer = s;
|
|
949
1067
|
}
|
|
950
1068
|
}
|
|
951
|
-
class
|
|
952
|
-
constructor(e, t,
|
|
1069
|
+
class je extends Ve {
|
|
1070
|
+
constructor(e, t, s, i) {
|
|
953
1071
|
var n, a;
|
|
954
|
-
super(e, t,
|
|
1072
|
+
super(e, t, s, i), this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
955
1073
|
header: [],
|
|
956
1074
|
body: [],
|
|
957
1075
|
footer: []
|
|
958
|
-
}, 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(
|
|
959
1077
|
(r) => {
|
|
960
1078
|
var d;
|
|
961
|
-
this.colAndRowspanModels[r] = new
|
|
1079
|
+
this.colAndRowspanModels[r] = new Ge(t, t.getAreaModel(r)), (d = this.colAndRowspanModels[r]) == null || d.init();
|
|
962
1080
|
}
|
|
963
1081
|
);
|
|
964
1082
|
}
|
|
@@ -975,10 +1093,10 @@ class Ne extends Pe {
|
|
|
975
1093
|
}
|
|
976
1094
|
}
|
|
977
1095
|
initRenderEditor(e, t) {
|
|
978
|
-
var
|
|
979
|
-
let
|
|
980
|
-
if (
|
|
981
|
-
if (this.editorRenderer =
|
|
1096
|
+
var i;
|
|
1097
|
+
let s = (i = this.tableModel.getColumnDef(t)) == null ? void 0 : i.getEditRenderer;
|
|
1098
|
+
if (s || (s = this.tableOptions.getEditRenderer), s)
|
|
1099
|
+
if (this.editorRenderer = s(e, t), this.editorRenderer) {
|
|
982
1100
|
this.editorRendererRow = e, this.editorRendererColumn = t, this.editing = !0, this.repaint();
|
|
983
1101
|
const o = document.querySelector("input.ge-table-cell-editor-input");
|
|
984
1102
|
o && o.focus();
|
|
@@ -1014,16 +1132,18 @@ class Ne extends Pe {
|
|
|
1014
1132
|
var e, t;
|
|
1015
1133
|
this.storeScrollPosStateService && ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreScrollPosition) && this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft, this.scrollTop]);
|
|
1016
1134
|
}
|
|
1017
|
-
updateCells(e) {
|
|
1135
|
+
updateCells(e, t = !1) {
|
|
1018
1136
|
e.forEach(
|
|
1019
|
-
(
|
|
1020
|
-
|
|
1137
|
+
(s) => {
|
|
1138
|
+
this.tableModel.getAreaModel(s.area).setValue(s.rowIndex, s.columnIndex, s.value), t || this.rerenderCellContent(s);
|
|
1139
|
+
}
|
|
1140
|
+
), t && this.repaint();
|
|
1021
1141
|
}
|
|
1022
1142
|
getAreaAndSideIdentByAttr(e) {
|
|
1023
1143
|
if (e) {
|
|
1024
|
-
const t = this.getStringByAttr(e, "data-area"),
|
|
1025
|
-
if (
|
|
1026
|
-
return [t,
|
|
1144
|
+
const t = this.getStringByAttr(e, "data-area"), s = this.getStringByAttr(e, "data-side");
|
|
1145
|
+
if (s && t)
|
|
1146
|
+
return [t, s];
|
|
1027
1147
|
}
|
|
1028
1148
|
return [void 0, void 0];
|
|
1029
1149
|
}
|
|
@@ -1057,105 +1177,105 @@ class Ne extends Pe {
|
|
|
1057
1177
|
this.dom.setStyle(this.contentDiv, "top", `${this.scrollTop}px`), this.dom.setStyle(this.contentDiv, "left", `${this.scrollViewport.scrollLeft}px`), this.adjustArea("body", t);
|
|
1058
1178
|
}
|
|
1059
1179
|
getNumberByAttr(e, t) {
|
|
1060
|
-
var
|
|
1180
|
+
var s;
|
|
1061
1181
|
if (e) {
|
|
1062
|
-
const
|
|
1063
|
-
if (
|
|
1064
|
-
return Number(
|
|
1182
|
+
const i = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
|
|
1183
|
+
if (i)
|
|
1184
|
+
return Number(i);
|
|
1065
1185
|
}
|
|
1066
1186
|
return -1;
|
|
1067
1187
|
}
|
|
1068
1188
|
getStringByAttr(e, t) {
|
|
1069
|
-
var
|
|
1189
|
+
var s;
|
|
1070
1190
|
if (e) {
|
|
1071
|
-
const
|
|
1072
|
-
if (
|
|
1073
|
-
return
|
|
1191
|
+
const i = (s = e.closest("[" + t + "]")) == null ? void 0 : s.getAttribute(t);
|
|
1192
|
+
if (i)
|
|
1193
|
+
return i;
|
|
1074
1194
|
}
|
|
1075
1195
|
return "";
|
|
1076
1196
|
}
|
|
1077
1197
|
adjustArea(e, t = 0) {
|
|
1078
|
-
var
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1198
|
+
var g;
|
|
1199
|
+
const s = this.getArea(e, "west"), i = this.getArea(e, "center"), o = this.getArea(e, "east"), n = i.child.clientHeight;
|
|
1200
|
+
s.child.innerText = "", i.child.innerText = "", o.child.innerText = "";
|
|
1081
1201
|
const a = 0, r = this.areaBodyCenterGeo.width, d = this.tableModel.getPadding(), h = this.tableModel.getAreaModel(e), p = h.getRowCount();
|
|
1082
1202
|
for (; this.cleanupFunctions[e].length; ) {
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1203
|
+
const u = this.cleanupFunctions[e].shift();
|
|
1204
|
+
u && u();
|
|
1085
1205
|
}
|
|
1086
|
-
let
|
|
1087
|
-
const f = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount(),
|
|
1088
|
-
for (let
|
|
1089
|
-
const
|
|
1090
|
-
if (
|
|
1091
|
-
this.firstVisibleRowIndex =
|
|
1092
|
-
let
|
|
1093
|
-
const
|
|
1206
|
+
let S = t;
|
|
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;
|
|
1094
1214
|
if (this.adjustColumnsToRowParent({
|
|
1095
1215
|
areaIdent: e,
|
|
1096
1216
|
sideIdent: "center",
|
|
1097
1217
|
areaModel: h,
|
|
1098
|
-
geo:
|
|
1099
|
-
parent:
|
|
1100
|
-
rowIndex:
|
|
1101
|
-
columnIndexStart:
|
|
1218
|
+
geo: y,
|
|
1219
|
+
parent: v,
|
|
1220
|
+
rowIndex: u,
|
|
1221
|
+
columnIndexStart: E,
|
|
1102
1222
|
columnIndexEnd: f - c - 1,
|
|
1103
1223
|
verticalFixed: !1,
|
|
1104
|
-
lastRowOfModel:
|
|
1105
|
-
}), 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({
|
|
1106
1226
|
areaIdent: e,
|
|
1107
1227
|
sideIdent: "west",
|
|
1108
1228
|
areaModel: h,
|
|
1109
|
-
geo:
|
|
1110
|
-
parent:
|
|
1111
|
-
rowIndex:
|
|
1229
|
+
geo: y,
|
|
1230
|
+
parent: v,
|
|
1231
|
+
rowIndex: u,
|
|
1112
1232
|
columnIndexStart: 0,
|
|
1113
|
-
columnIndexEnd:
|
|
1233
|
+
columnIndexEnd: E - 1,
|
|
1114
1234
|
verticalFixed: !0,
|
|
1115
|
-
lastRowOfModel:
|
|
1116
|
-
})), 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({
|
|
1117
1237
|
areaIdent: e,
|
|
1118
1238
|
sideIdent: "east",
|
|
1119
1239
|
areaModel: h,
|
|
1120
|
-
geo:
|
|
1121
|
-
parent:
|
|
1122
|
-
rowIndex:
|
|
1240
|
+
geo: y,
|
|
1241
|
+
parent: v,
|
|
1242
|
+
rowIndex: u,
|
|
1123
1243
|
columnIndexStart: f - c,
|
|
1124
1244
|
columnIndexEnd: f - 1,
|
|
1125
1245
|
verticalFixed: !0,
|
|
1126
|
-
lastRowOfModel:
|
|
1127
|
-
})), e === "header" && this.tree &&
|
|
1128
|
-
const
|
|
1246
|
+
lastRowOfModel: x
|
|
1247
|
+
})), e === "header" && this.tree && u === p - 1) {
|
|
1248
|
+
const A = this.dom.applyStyle(
|
|
1129
1249
|
this.dom.setAttribute(
|
|
1130
|
-
this.dom.addDiv(
|
|
1250
|
+
this.dom.addDiv(v, new T(16, 20, 20, 8)),
|
|
1131
1251
|
"data-ge-action",
|
|
1132
1252
|
"toggleExpandCollapseAll"
|
|
1133
1253
|
),
|
|
1134
1254
|
{ cursor: "pointer" }
|
|
1135
|
-
),
|
|
1136
|
-
if (
|
|
1137
|
-
const B = this.dom.domService.createText(
|
|
1138
|
-
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);
|
|
1139
1259
|
}
|
|
1140
1260
|
}
|
|
1141
1261
|
}
|
|
1142
|
-
if (
|
|
1262
|
+
if (S = S + C, S > n)
|
|
1143
1263
|
break;
|
|
1144
1264
|
}
|
|
1145
1265
|
if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
|
|
1146
|
-
const
|
|
1147
|
-
if (
|
|
1148
|
-
for (const
|
|
1149
|
-
let
|
|
1150
|
-
if (
|
|
1151
|
-
C =
|
|
1152
|
-
else if (c > 0 &&
|
|
1153
|
-
C = o.child,
|
|
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";
|
|
1154
1274
|
else {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1275
|
+
const v = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1276
|
+
x = this.scrollFactorX * v - this.areaBodyWestGeo.width, y = "center";
|
|
1157
1277
|
}
|
|
1158
|
-
this.drawBigCell(
|
|
1278
|
+
this.drawBigCell(w, x, t, h, C, y);
|
|
1159
1279
|
}
|
|
1160
1280
|
}
|
|
1161
1281
|
}
|
|
@@ -1169,58 +1289,58 @@ class Ne extends Pe {
|
|
|
1169
1289
|
* @param sideIdent SideIdent (west,center,east)
|
|
1170
1290
|
* @protected
|
|
1171
1291
|
*/
|
|
1172
|
-
drawBigCell(e, t,
|
|
1173
|
-
const a =
|
|
1292
|
+
drawBigCell(e, t, s, i, o, n) {
|
|
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();
|
|
1174
1294
|
let h = 0;
|
|
1175
1295
|
d > 0 && e.c1 >= r - d && (h = r - d);
|
|
1176
|
-
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);
|
|
1177
1297
|
let c = !1;
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
areaModel:
|
|
1181
|
-
areaIdent:
|
|
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({
|
|
1300
|
+
areaModel: i,
|
|
1301
|
+
areaIdent: i.areaIdent,
|
|
1182
1302
|
sideIdent: n,
|
|
1183
1303
|
rowIndex: e.r1,
|
|
1184
1304
|
columnIndex: e.c1,
|
|
1185
1305
|
left: p,
|
|
1186
1306
|
top: a,
|
|
1187
1307
|
width: f,
|
|
1188
|
-
height:
|
|
1308
|
+
height: S,
|
|
1189
1309
|
parent: o,
|
|
1190
1310
|
cellSelected: c,
|
|
1191
1311
|
lastRowOfModel: !0,
|
|
1192
1312
|
gammaRange: e.gammaRange
|
|
1193
1313
|
})) : this.renderCell({
|
|
1194
|
-
areaModel:
|
|
1195
|
-
areaIdent:
|
|
1314
|
+
areaModel: i,
|
|
1315
|
+
areaIdent: i.areaIdent,
|
|
1196
1316
|
sideIdent: n,
|
|
1197
1317
|
rowIndex: e.r1,
|
|
1198
1318
|
columnIndex: e.c1,
|
|
1199
1319
|
left: p,
|
|
1200
1320
|
top: a,
|
|
1201
1321
|
width: f,
|
|
1202
|
-
height:
|
|
1322
|
+
height: S,
|
|
1203
1323
|
parent: o,
|
|
1204
1324
|
cellSelected: c,
|
|
1205
1325
|
lastRowOfModel: !0,
|
|
1206
1326
|
gammaRange: e.gammaRange
|
|
1207
|
-
}),
|
|
1327
|
+
}), i.areaIdent === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
1208
1328
|
rowIndex: e.r1,
|
|
1209
1329
|
columnIndex: e.c1,
|
|
1210
1330
|
cellLeft: p,
|
|
1211
1331
|
cellTop: a,
|
|
1212
1332
|
cellWidth: f,
|
|
1213
|
-
cellHeight:
|
|
1333
|
+
cellHeight: S,
|
|
1214
1334
|
parent: o
|
|
1215
1335
|
});
|
|
1216
1336
|
}
|
|
1217
|
-
findRowOfImportantRowspanCell(e, t,
|
|
1218
|
-
const
|
|
1337
|
+
findRowOfImportantRowspanCell(e, t, s) {
|
|
1338
|
+
const i = e.getMaxRowspan();
|
|
1219
1339
|
for (let o = t - 1; o > -1; o--) {
|
|
1220
|
-
const n = e.getRowspanAt(o,
|
|
1340
|
+
const n = e.getRowspanAt(o, s);
|
|
1221
1341
|
if (n > 1 && o + n + 1 >= t)
|
|
1222
1342
|
return o;
|
|
1223
|
-
if (t - o >
|
|
1343
|
+
if (t - o > i)
|
|
1224
1344
|
return -1;
|
|
1225
1345
|
}
|
|
1226
1346
|
return -1;
|
|
@@ -1228,8 +1348,8 @@ class Ne extends Pe {
|
|
|
1228
1348
|
adjustColumnsToRowParent({
|
|
1229
1349
|
areaIdent: e,
|
|
1230
1350
|
sideIdent: t,
|
|
1231
|
-
areaModel:
|
|
1232
|
-
geo:
|
|
1351
|
+
areaModel: s,
|
|
1352
|
+
geo: i,
|
|
1233
1353
|
parent: o,
|
|
1234
1354
|
rowIndex: n,
|
|
1235
1355
|
columnIndexStart: a,
|
|
@@ -1237,59 +1357,59 @@ class Ne extends Pe {
|
|
|
1237
1357
|
verticalFixed: d = !1,
|
|
1238
1358
|
lastRowOfModel: h = !1
|
|
1239
1359
|
}) {
|
|
1240
|
-
var
|
|
1360
|
+
var m;
|
|
1241
1361
|
this.scrollViewportLeft = this.scrollViewport.scrollLeft;
|
|
1242
1362
|
let p = 0;
|
|
1243
1363
|
if (!d) {
|
|
1244
|
-
const
|
|
1245
|
-
p = this.scrollFactorX *
|
|
1364
|
+
const g = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1365
|
+
p = this.scrollFactorX * g;
|
|
1246
1366
|
}
|
|
1247
|
-
const
|
|
1367
|
+
const S = 0, f = !!(e === "body" && t);
|
|
1248
1368
|
let c = p;
|
|
1249
|
-
for (let
|
|
1250
|
-
const
|
|
1251
|
-
if (
|
|
1252
|
-
let
|
|
1253
|
-
const C =
|
|
1254
|
-
C > 1 && (
|
|
1255
|
-
let
|
|
1256
|
-
|
|
1257
|
-
let
|
|
1258
|
-
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (
|
|
1259
|
-
this.renderDragTargetDiv(o,
|
|
1260
|
-
const
|
|
1261
|
-
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);
|
|
1262
1382
|
} else {
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
areaModel:
|
|
1383
|
+
const A = this.renderSelectedBackgroundDiv(E, f, t, s, n, g, o, u, S, v, x);
|
|
1384
|
+
E || this.renderCell({
|
|
1385
|
+
areaModel: s,
|
|
1266
1386
|
areaIdent: e,
|
|
1267
1387
|
sideIdent: t,
|
|
1268
1388
|
rowIndex: n,
|
|
1269
|
-
columnIndex:
|
|
1270
|
-
left:
|
|
1271
|
-
top:
|
|
1272
|
-
width:
|
|
1273
|
-
height:
|
|
1389
|
+
columnIndex: g,
|
|
1390
|
+
left: u,
|
|
1391
|
+
top: S,
|
|
1392
|
+
width: v,
|
|
1393
|
+
height: x,
|
|
1274
1394
|
parent: o,
|
|
1275
|
-
cellSelected:
|
|
1395
|
+
cellSelected: A,
|
|
1276
1396
|
lastRowOfModel: h,
|
|
1277
1397
|
gammaRange: !0
|
|
1278
1398
|
}), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
1279
1399
|
rowIndex: n,
|
|
1280
|
-
columnIndex:
|
|
1281
|
-
cellLeft:
|
|
1282
|
-
cellTop:
|
|
1283
|
-
cellWidth:
|
|
1284
|
-
cellHeight:
|
|
1400
|
+
columnIndex: g,
|
|
1401
|
+
cellLeft: u,
|
|
1402
|
+
cellTop: S,
|
|
1403
|
+
cellWidth: v,
|
|
1404
|
+
cellHeight: x,
|
|
1285
1405
|
parent: o
|
|
1286
1406
|
});
|
|
1287
1407
|
}
|
|
1288
1408
|
}
|
|
1289
|
-
if (c = c +
|
|
1409
|
+
if (c = c + w, c > this.areaBodyCenterGeo.width)
|
|
1290
1410
|
break;
|
|
1291
1411
|
}
|
|
1292
|
-
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(c - 1, 1,
|
|
1412
|
+
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(c - 1, 1, i.height, 0), o);
|
|
1293
1413
|
}
|
|
1294
1414
|
getTreeArrowColumnIndex() {
|
|
1295
1415
|
return this.tableOptions.showCheckboxWihoutExtraColumn ? 0 : this.tableModel.isRowCheckboxVisible() ? 1 : 0;
|
|
@@ -1297,78 +1417,103 @@ class Ne extends Pe {
|
|
|
1297
1417
|
addAndRenderCellDiv({
|
|
1298
1418
|
areaModel: e,
|
|
1299
1419
|
areaIdent: t,
|
|
1300
|
-
sideIdent:
|
|
1301
|
-
rowIndex:
|
|
1420
|
+
sideIdent: s,
|
|
1421
|
+
rowIndex: i,
|
|
1302
1422
|
index: o,
|
|
1303
1423
|
left: n,
|
|
1304
1424
|
width: a,
|
|
1305
1425
|
height: r,
|
|
1306
1426
|
top: d,
|
|
1307
1427
|
parent: h,
|
|
1308
|
-
lastRowOfModel: p
|
|
1428
|
+
lastRowOfModel: p,
|
|
1429
|
+
gammaRange: S
|
|
1309
1430
|
}) {
|
|
1310
|
-
var
|
|
1311
|
-
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);
|
|
1312
1433
|
let u = "none";
|
|
1313
|
-
if (o === this.getTreeArrowColumnIndex() && j(
|
|
1314
|
-
const
|
|
1315
|
-
(
|
|
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";
|
|
1316
1437
|
}
|
|
1317
1438
|
let x;
|
|
1318
1439
|
if (t === "header") {
|
|
1319
|
-
const
|
|
1320
|
-
(!(
|
|
1440
|
+
const b = this.tableModel.getColumnDef(o);
|
|
1441
|
+
(!(b != null && b.sortIconVisible) || b != null && b.sortIconVisible()) && (x = b == null ? void 0 : b.sortState);
|
|
1321
1442
|
}
|
|
1322
|
-
const
|
|
1443
|
+
const C = e.getValueAt(i, o), y = c ? "" : `${C}`, v = e.isRowChecked(i), E = this.dom.addColumnDiv(
|
|
1323
1444
|
h,
|
|
1324
|
-
|
|
1325
|
-
|
|
1445
|
+
m,
|
|
1446
|
+
i,
|
|
1326
1447
|
o,
|
|
1327
1448
|
t,
|
|
1328
|
-
|
|
1329
|
-
|
|
1449
|
+
s,
|
|
1450
|
+
y,
|
|
1330
1451
|
u,
|
|
1331
1452
|
this.tableOptions,
|
|
1332
1453
|
v,
|
|
1333
1454
|
x
|
|
1334
|
-
),
|
|
1335
|
-
|
|
1336
|
-
const
|
|
1337
|
-
|
|
1338
|
-
let
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1341
|
-
if (
|
|
1342
|
-
const
|
|
1343
|
-
|
|
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, {});
|
|
1344
1465
|
}
|
|
1345
|
-
t === "header" && this.dom.setAttribute(
|
|
1346
|
-
const H = e.getCustomStyleAt(
|
|
1466
|
+
t === "header" && this.dom.setAttribute(E, "data-ge-action", "drag-column");
|
|
1467
|
+
const H = e.getCustomStyleAt(i, o);
|
|
1347
1468
|
if (H)
|
|
1348
|
-
for (const
|
|
1349
|
-
this.dom.setStyle(
|
|
1350
|
-
return [
|
|
1469
|
+
for (const b in H)
|
|
1470
|
+
this.dom.setStyle(E, b, H[b]);
|
|
1471
|
+
return [E, B];
|
|
1351
1472
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1473
|
+
applyCssClasses(e, t = {}) {
|
|
1474
|
+
e && Object.entries(t).forEach(([s, i]) => {
|
|
1475
|
+
i ? this.dom.addClass(s, e) : this.dom.removeClass(s, e);
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
rerenderCellContent({ area: e, rowIndex: t, columnIndex: s, value: i, cssClasses: o }) {
|
|
1479
|
+
const n = this.tableModel.getAreaModel(e), a = 'div[data-col-index="' + s + '"][data-row-index="' + t + '"][data-area="' + e + '"]', r = document.querySelector(a);
|
|
1480
|
+
if (r) {
|
|
1481
|
+
let d;
|
|
1482
|
+
const p = this.editorRenderer && this.editorRendererRow === t && this.editorRendererColumn === s ? this.editorRenderer : n.getCellRenderer(t, s);
|
|
1483
|
+
if (r.innerText = "", this.applyCssClasses(r, o), p)
|
|
1484
|
+
d = p.render(r, t, s, e, n, i, this.dom.domService), d && this.cleanupFunctions[e].push(d);
|
|
1485
|
+
else {
|
|
1486
|
+
const c = `${i}`;
|
|
1487
|
+
this.dom.addLabelDiv(r, c, !1, t, s, e);
|
|
1488
|
+
}
|
|
1489
|
+
const S = n.getCustomClassesAt(t, s);
|
|
1490
|
+
S.length && this.dom.addClasses(S, r);
|
|
1491
|
+
const f = n.getCustomStyleAt(t, s);
|
|
1492
|
+
if (f)
|
|
1493
|
+
for (const c in f)
|
|
1494
|
+
this.dom.setStyle(r, c, f[c]);
|
|
1495
|
+
}
|
|
1357
1496
|
}
|
|
1358
|
-
|
|
1497
|
+
getColumnWidths(e, t) {
|
|
1359
1498
|
const s = [];
|
|
1360
|
-
for (let
|
|
1361
|
-
s.push(
|
|
1499
|
+
for (let i = e; i <= t; i++)
|
|
1500
|
+
s.push(this.tableModel.getColumnWidth(i));
|
|
1362
1501
|
return s;
|
|
1363
1502
|
}
|
|
1503
|
+
getRowHeights(e, t, s) {
|
|
1504
|
+
const i = [];
|
|
1505
|
+
for (let o = e; o <= t; o++)
|
|
1506
|
+
i.push(s.getRowHeight(o));
|
|
1507
|
+
return i;
|
|
1508
|
+
}
|
|
1364
1509
|
adjustHoverRows(e) {
|
|
1365
1510
|
if (this.tableOptions.hoverRowVisible && e.rowIndex > -1) {
|
|
1366
|
-
const t = this.hostElement.clientWidth,
|
|
1511
|
+
const t = this.hostElement.clientWidth, s = this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex), i = e.rowTop + this.areaHeaderCenter.parent.clientHeight - this.scrollTop;
|
|
1367
1512
|
this.dom.applyStyle(this.hoverRow, {
|
|
1368
1513
|
left: "0",
|
|
1369
|
-
top:
|
|
1514
|
+
top: i + "px",
|
|
1370
1515
|
width: t + "px",
|
|
1371
|
-
height:
|
|
1516
|
+
height: s + "px",
|
|
1372
1517
|
display: "block"
|
|
1373
1518
|
});
|
|
1374
1519
|
} else
|
|
@@ -1381,11 +1526,11 @@ class Ne extends Pe {
|
|
|
1381
1526
|
}
|
|
1382
1527
|
adjustHoverColumns(e) {
|
|
1383
1528
|
if (this.tableOptions.hoverColumnVisible && e.rowIndex > -1) {
|
|
1384
|
-
const t = this.hostElement.clientHeight,
|
|
1529
|
+
const t = this.hostElement.clientHeight, s = this.tableModel.getColumnWidth(e.columnIndex), i = this.areaBodyWestGeo.width, o = e.columnLeft + this.tableModel.getPadding().left - this.scrollLeft - i;
|
|
1385
1530
|
this.dom.applyStyle(this.hoverColumn, {
|
|
1386
1531
|
left: o + "px",
|
|
1387
1532
|
top: "0px",
|
|
1388
|
-
width:
|
|
1533
|
+
width: s + "px",
|
|
1389
1534
|
height: t + "px",
|
|
1390
1535
|
display: "block"
|
|
1391
1536
|
});
|
|
@@ -1400,35 +1545,35 @@ class Ne extends Pe {
|
|
|
1400
1545
|
debounce(e, t = 1e3) {
|
|
1401
1546
|
this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(e.bind(this), t);
|
|
1402
1547
|
}
|
|
1403
|
-
renderDragTargetDiv(e, t,
|
|
1548
|
+
renderDragTargetDiv(e, t, s, i, o) {
|
|
1404
1549
|
const n = this.dom.applyStylePosistionAbsolute(
|
|
1405
1550
|
this.dom.createDivWithClass("ge-table-drop-zone", e)
|
|
1406
1551
|
);
|
|
1407
|
-
return this.dom.setStyle(n, "left", `${t}px`), this.dom.setStyle(n, "top", `${
|
|
1552
|
+
return this.dom.setStyle(n, "left", `${t}px`), this.dom.setStyle(n, "top", `${s}px`), this.dom.setStyle(n, "width", `${i}px`), this.dom.setStyle(n, "height", `${o}px`), n;
|
|
1408
1553
|
}
|
|
1409
|
-
renderSelectedBackgroundDiv(e, t,
|
|
1410
|
-
let
|
|
1411
|
-
if (!e && t &&
|
|
1554
|
+
renderSelectedBackgroundDiv(e, t, s, i, o, n, a, r, d, h, p) {
|
|
1555
|
+
let S = !1;
|
|
1556
|
+
if (!e && t && i.isSelectable(o, n) && this.getSelectionModel) {
|
|
1412
1557
|
const f = this.getSelectionModel();
|
|
1413
1558
|
if (f) {
|
|
1414
1559
|
const c = f.getSelectionCount(o, n);
|
|
1415
|
-
|
|
1416
|
-
for (let
|
|
1417
|
-
const
|
|
1560
|
+
S = c > 0;
|
|
1561
|
+
for (let m = 0; m < c; m++) {
|
|
1562
|
+
const g = this.dom.applyStylePosistionAbsolute(
|
|
1418
1563
|
// ge-table-body-west-selected-range
|
|
1419
|
-
this.dom.createDivWithClass(`ge-table-${
|
|
1564
|
+
this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`, a)
|
|
1420
1565
|
);
|
|
1421
|
-
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`);
|
|
1422
1567
|
}
|
|
1423
1568
|
}
|
|
1424
1569
|
}
|
|
1425
|
-
return
|
|
1570
|
+
return S;
|
|
1426
1571
|
}
|
|
1427
1572
|
renderCell({
|
|
1428
1573
|
areaModel: e,
|
|
1429
1574
|
areaIdent: t,
|
|
1430
|
-
sideIdent:
|
|
1431
|
-
rowIndex:
|
|
1575
|
+
sideIdent: s,
|
|
1576
|
+
rowIndex: i,
|
|
1432
1577
|
columnIndex: o,
|
|
1433
1578
|
left: n,
|
|
1434
1579
|
top: a,
|
|
@@ -1436,31 +1581,31 @@ class Ne extends Pe {
|
|
|
1436
1581
|
height: d,
|
|
1437
1582
|
parent: h,
|
|
1438
1583
|
cellSelected: p,
|
|
1439
|
-
lastRowOfModel:
|
|
1584
|
+
lastRowOfModel: S,
|
|
1440
1585
|
gammaRange: f
|
|
1441
1586
|
}) {
|
|
1442
|
-
const [c,
|
|
1587
|
+
const [c, m] = this.addAndRenderCellDiv({
|
|
1443
1588
|
areaModel: e,
|
|
1444
1589
|
areaIdent: t,
|
|
1445
|
-
sideIdent:
|
|
1446
|
-
rowIndex:
|
|
1590
|
+
sideIdent: s,
|
|
1591
|
+
rowIndex: i,
|
|
1447
1592
|
index: o,
|
|
1448
1593
|
left: n,
|
|
1449
1594
|
width: r,
|
|
1450
1595
|
height: d,
|
|
1451
1596
|
top: a,
|
|
1452
1597
|
parent: h,
|
|
1453
|
-
lastRowOfModel:
|
|
1598
|
+
lastRowOfModel: S,
|
|
1454
1599
|
gammaRange: f
|
|
1455
1600
|
});
|
|
1456
|
-
p && this.dom.addClass(`ge-table-${t}-${
|
|
1601
|
+
p && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, c), m && this.cleanupFunctions[t].push(m);
|
|
1457
1602
|
}
|
|
1458
|
-
renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft:
|
|
1603
|
+
renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: s, cellTop: i, cellWidth: o, cellHeight: n, parent: a }) {
|
|
1459
1604
|
const r = this.dom.domService, d = this.tableOptions.columnResizeHandleWidthInPx ?? 2, h = r.createElement("div");
|
|
1460
|
-
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", `${
|
|
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);
|
|
1461
1606
|
}
|
|
1462
1607
|
}
|
|
1463
|
-
class
|
|
1608
|
+
class Xe {
|
|
1464
1609
|
constructor(e, t) {
|
|
1465
1610
|
this.columnIndex = e, this.sortState = t;
|
|
1466
1611
|
}
|
|
@@ -1469,17 +1614,25 @@ class ze {
|
|
|
1469
1614
|
constructor(e) {
|
|
1470
1615
|
this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
|
|
1471
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
|
+
*/
|
|
1472
1625
|
onHostElementChanged(e) {
|
|
1473
1626
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
|
|
1474
|
-
const t = e.target,
|
|
1475
|
-
if (
|
|
1476
|
-
const n = Y(
|
|
1627
|
+
const t = e.target, s = t.getAttribute("data-area"), i = t.getAttribute("data-row-index"), o = t.getAttribute("data-col-index");
|
|
1628
|
+
if (s && i && o) {
|
|
1629
|
+
const n = Y(s), a = Number(i), r = Number(o);
|
|
1477
1630
|
this.tableScope.updateModelValueAfterEdit(n, a, r, t.value);
|
|
1478
1631
|
}
|
|
1479
1632
|
}
|
|
1480
1633
|
}
|
|
1481
1634
|
}
|
|
1482
|
-
class
|
|
1635
|
+
class Ke {
|
|
1483
1636
|
constructor(e = -1, t = -1) {
|
|
1484
1637
|
this.rowIndex = e, this.columnIndex = t;
|
|
1485
1638
|
}
|
|
@@ -1489,34 +1642,34 @@ class U {
|
|
|
1489
1642
|
this.cells = e;
|
|
1490
1643
|
}
|
|
1491
1644
|
static createSingle(e, t) {
|
|
1492
|
-
return new U([new
|
|
1645
|
+
return new U([new Ke(e, t)]);
|
|
1493
1646
|
}
|
|
1494
1647
|
}
|
|
1495
|
-
class
|
|
1648
|
+
class Ye {
|
|
1496
1649
|
constructor(e) {
|
|
1497
|
-
var t,
|
|
1498
|
-
this.tableScope = e, (t = this.tableScope.tableOptions) != null && t.getSelectionModel && (this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel), (
|
|
1650
|
+
var t, s;
|
|
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);
|
|
1499
1652
|
}
|
|
1500
1653
|
onMouseClicked(e, t) {
|
|
1501
1654
|
var o, n, a, r, d, h, p;
|
|
1502
|
-
let
|
|
1655
|
+
let s = !1, i = !1;
|
|
1503
1656
|
if (this.getSelectionModel && this.getFocusModel) {
|
|
1504
|
-
const
|
|
1505
|
-
|
|
1657
|
+
const S = this.getSelectionModel(), f = this.getFocusModel();
|
|
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));
|
|
1506
1659
|
}
|
|
1507
|
-
return
|
|
1660
|
+
return i ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
|
|
1508
1661
|
}
|
|
1509
1662
|
onActionTriggered(e) {
|
|
1510
1663
|
if (this.getSelectionModel && this.getFocusModel) {
|
|
1511
|
-
const t = this.getSelectionModel(),
|
|
1512
|
-
if (t &&
|
|
1664
|
+
const t = this.getSelectionModel(), s = this.getFocusModel();
|
|
1665
|
+
if (t && s) {
|
|
1513
1666
|
if (e === "SELECT_ALL")
|
|
1514
1667
|
return t.selectAll(), this.tableScope.repaint(), !0;
|
|
1515
1668
|
if (e === "DESELECT_ALL")
|
|
1516
1669
|
return t.clear(), this.tableScope.repaint(), !0;
|
|
1517
1670
|
if (e === "TOGGLE_SELECTION") {
|
|
1518
|
-
const [
|
|
1519
|
-
return t.togglePoint(
|
|
1671
|
+
const [i, o] = s.getFocus();
|
|
1672
|
+
return t.togglePoint(i, o), this.tableScope.repaint(), !0;
|
|
1520
1673
|
}
|
|
1521
1674
|
}
|
|
1522
1675
|
}
|
|
@@ -1524,16 +1677,16 @@ class Ke {
|
|
|
1524
1677
|
}
|
|
1525
1678
|
createRangeByEvents(e, t) {
|
|
1526
1679
|
t || (t = e);
|
|
1527
|
-
const
|
|
1528
|
-
return
|
|
1529
|
-
rowIndex1:
|
|
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);
|
|
1681
|
+
return M.create({
|
|
1682
|
+
rowIndex1: s,
|
|
1530
1683
|
columnIndex1: o,
|
|
1531
|
-
rowIndex2:
|
|
1684
|
+
rowIndex2: i,
|
|
1532
1685
|
columnIndex2: n
|
|
1533
1686
|
});
|
|
1534
1687
|
}
|
|
1535
1688
|
}
|
|
1536
|
-
class
|
|
1689
|
+
class qe {
|
|
1537
1690
|
get() {
|
|
1538
1691
|
return {
|
|
1539
1692
|
f2: "START_EDITING",
|
|
@@ -1551,7 +1704,7 @@ class Ye {
|
|
|
1551
1704
|
};
|
|
1552
1705
|
}
|
|
1553
1706
|
}
|
|
1554
|
-
class
|
|
1707
|
+
class Ue {
|
|
1555
1708
|
get() {
|
|
1556
1709
|
return {
|
|
1557
1710
|
f2: "START_EDITING",
|
|
@@ -1571,7 +1724,7 @@ class qe {
|
|
|
1571
1724
|
};
|
|
1572
1725
|
}
|
|
1573
1726
|
}
|
|
1574
|
-
class
|
|
1727
|
+
class Je {
|
|
1575
1728
|
constructor(e) {
|
|
1576
1729
|
this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
|
|
1577
1730
|
}
|
|
@@ -1579,7 +1732,7 @@ class Ue {
|
|
|
1579
1732
|
this.listener.includes(e) || this.listener.push(e);
|
|
1580
1733
|
}
|
|
1581
1734
|
init() {
|
|
1582
|
-
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));
|
|
1583
1736
|
}
|
|
1584
1737
|
isMacintosh() {
|
|
1585
1738
|
return navigator.platform.indexOf("Mac") > -1;
|
|
@@ -1597,24 +1750,24 @@ class Ue {
|
|
|
1597
1750
|
emit(e) {
|
|
1598
1751
|
this.isDebug() && console.debug("ShortcutService emit:", e);
|
|
1599
1752
|
let t = !1;
|
|
1600
|
-
for (const
|
|
1601
|
-
|
|
1753
|
+
for (const s of this.listener)
|
|
1754
|
+
s.onActionTriggered(e) && (t = !0);
|
|
1602
1755
|
return t;
|
|
1603
1756
|
}
|
|
1604
1757
|
findEnty(e) {
|
|
1605
1758
|
const t = this.getTokenByEvent(e);
|
|
1606
1759
|
this.isDebug() && console.debug("ShortcutService tokens:", t);
|
|
1607
|
-
for (const
|
|
1608
|
-
const
|
|
1609
|
-
if (this.areTokensEquals(t,
|
|
1610
|
-
return this.shortcutActionIdMapping[
|
|
1760
|
+
for (const s in this.shortcutActionIdMapping) {
|
|
1761
|
+
const i = s.replace(/opt/g, "alt").replace(/cmd/g, "meta").split(/[\+ ]/g).sort();
|
|
1762
|
+
if (this.areTokensEquals(t, i))
|
|
1763
|
+
return this.shortcutActionIdMapping[s];
|
|
1611
1764
|
}
|
|
1612
1765
|
}
|
|
1613
1766
|
areTokensEquals(e, t) {
|
|
1614
1767
|
if (e.length !== t.length || e.length === 0)
|
|
1615
1768
|
return !1;
|
|
1616
|
-
for (let
|
|
1617
|
-
if (e[
|
|
1769
|
+
for (let s = 0; s < e.length; s++)
|
|
1770
|
+
if (e[s] !== t[s])
|
|
1618
1771
|
return !1;
|
|
1619
1772
|
return !0;
|
|
1620
1773
|
}
|
|
@@ -1623,7 +1776,7 @@ class Ue {
|
|
|
1623
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();
|
|
1624
1777
|
}
|
|
1625
1778
|
}
|
|
1626
|
-
class
|
|
1779
|
+
class se {
|
|
1627
1780
|
onCheckboxChanged(e) {
|
|
1628
1781
|
}
|
|
1629
1782
|
onContextmenu(e) {
|
|
@@ -1639,16 +1792,19 @@ class te {
|
|
|
1639
1792
|
onMouseMoved(e) {
|
|
1640
1793
|
}
|
|
1641
1794
|
}
|
|
1642
|
-
class
|
|
1643
|
-
setStyle(e, t,
|
|
1644
|
-
return e.style[t] =
|
|
1795
|
+
class de {
|
|
1796
|
+
setStyle(e, t, s) {
|
|
1797
|
+
return e.style[t] = s, e;
|
|
1645
1798
|
}
|
|
1646
1799
|
appendText(e, t) {
|
|
1647
|
-
const
|
|
1648
|
-
return this.appendChild(e,
|
|
1800
|
+
const s = this.createText(t);
|
|
1801
|
+
return this.appendChild(e, s), s;
|
|
1649
1802
|
}
|
|
1650
1803
|
addClass(e, t) {
|
|
1651
|
-
return t.includes(" ") ? t.split(" ").forEach((
|
|
1804
|
+
return t.includes(" ") ? t.split(" ").forEach((s) => e.classList.add(s)) : e.classList.add(t), e;
|
|
1805
|
+
}
|
|
1806
|
+
removeClass(e, t) {
|
|
1807
|
+
return t.includes(" ") ? t.split(" ").forEach((s) => e.classList.remove(s)) : e.classList.remove(t), e;
|
|
1652
1808
|
}
|
|
1653
1809
|
appendChild(e, t) {
|
|
1654
1810
|
e.appendChild(t);
|
|
@@ -1659,15 +1815,15 @@ class ae {
|
|
|
1659
1815
|
createText(e) {
|
|
1660
1816
|
return document.createTextNode(e);
|
|
1661
1817
|
}
|
|
1662
|
-
setAttribute(e, t,
|
|
1663
|
-
e.setAttribute(t,
|
|
1818
|
+
setAttribute(e, t, s) {
|
|
1819
|
+
e.setAttribute(t, s);
|
|
1664
1820
|
}
|
|
1665
1821
|
}
|
|
1666
|
-
class
|
|
1667
|
-
render(e, t,
|
|
1668
|
-
if (o.isEditable(t,
|
|
1822
|
+
class Qe {
|
|
1823
|
+
render(e, t, s, i, o, n, a) {
|
|
1824
|
+
if (o.isEditable(t, s)) {
|
|
1669
1825
|
a.addClass(e, "ge-table-row-input-div");
|
|
1670
|
-
const r = o.getValueAt(t,
|
|
1826
|
+
const r = o.getValueAt(t, s);
|
|
1671
1827
|
e.innerHTML = `
|
|
1672
1828
|
<input
|
|
1673
1829
|
type="text"
|
|
@@ -1675,28 +1831,28 @@ class Je {
|
|
|
1675
1831
|
autofocus
|
|
1676
1832
|
onfocus="this.setSelectionRange(0, this.value.length)"
|
|
1677
1833
|
data-listen="change"
|
|
1678
|
-
data-area="${
|
|
1834
|
+
data-area="${i}"
|
|
1679
1835
|
data-row-index="${t}"
|
|
1680
|
-
data-col-index="${
|
|
1836
|
+
data-col-index="${s}"
|
|
1681
1837
|
data-input-type="text"
|
|
1682
1838
|
style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
|
|
1683
1839
|
class="ge-table-cell-editor-input">`;
|
|
1684
1840
|
}
|
|
1685
1841
|
}
|
|
1686
1842
|
}
|
|
1687
|
-
class
|
|
1843
|
+
class Ze {
|
|
1688
1844
|
constructor(e = "none", t = "single") {
|
|
1689
1845
|
this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
|
|
1690
1846
|
}
|
|
1691
1847
|
getSelectionCount(e, t) {
|
|
1692
|
-
let
|
|
1693
|
-
for (const
|
|
1694
|
-
|
|
1695
|
-
return this.allSelected &&
|
|
1848
|
+
let s = 0;
|
|
1849
|
+
for (const i of this.ranges)
|
|
1850
|
+
i.isInRange(e, t) && s++;
|
|
1851
|
+
return this.allSelected && s++, this.isInNegativeRange(e, t) && (s = 0), s;
|
|
1696
1852
|
}
|
|
1697
1853
|
isInNegativeRange(e, t) {
|
|
1698
|
-
for (const
|
|
1699
|
-
if (
|
|
1854
|
+
for (const s of this.negativeRanges)
|
|
1855
|
+
if (s.isInRange(e, t))
|
|
1700
1856
|
return !0;
|
|
1701
1857
|
return !1;
|
|
1702
1858
|
}
|
|
@@ -1719,16 +1875,16 @@ class Qe {
|
|
|
1719
1875
|
if (this.selectionType === "none")
|
|
1720
1876
|
return;
|
|
1721
1877
|
let t = e;
|
|
1722
|
-
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);
|
|
1723
1879
|
}
|
|
1724
1880
|
togglePoint(e, t) {
|
|
1725
|
-
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));
|
|
1726
1882
|
}
|
|
1727
1883
|
addRange(e) {
|
|
1728
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));
|
|
1729
1885
|
}
|
|
1730
1886
|
}
|
|
1731
|
-
class
|
|
1887
|
+
class et {
|
|
1732
1888
|
constructor(e = "none") {
|
|
1733
1889
|
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1;
|
|
1734
1890
|
}
|
|
@@ -1751,37 +1907,48 @@ class Ze {
|
|
|
1751
1907
|
return [this.rowIndex, this.columnIndex];
|
|
1752
1908
|
}
|
|
1753
1909
|
}
|
|
1754
|
-
const
|
|
1755
|
-
class
|
|
1910
|
+
const tt = new Ze(), st = new et("cell");
|
|
1911
|
+
class he {
|
|
1756
1912
|
constructor() {
|
|
1757
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 = {
|
|
1758
1914
|
header: 34,
|
|
1759
1915
|
body: 34,
|
|
1760
1916
|
footer: 34
|
|
1761
|
-
}, 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;
|
|
1762
1918
|
}
|
|
1763
1919
|
}
|
|
1764
|
-
class J extends
|
|
1765
|
-
constructor(e, t,
|
|
1920
|
+
class J extends je {
|
|
1921
|
+
constructor(e, t, s, i, o) {
|
|
1766
1922
|
var n;
|
|
1767
1923
|
if (super(
|
|
1768
1924
|
e,
|
|
1769
1925
|
t,
|
|
1770
|
-
new
|
|
1771
|
-
|
|
1772
|
-
), this.eventListener = o, this.selectionService = new
|
|
1926
|
+
new Oe(s),
|
|
1927
|
+
i
|
|
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) {
|
|
1773
1929
|
const a = this.tableOptions.autoRestoreOptions, r = a.getStorageKeyFn;
|
|
1774
|
-
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)));
|
|
1775
1931
|
}
|
|
1776
|
-
this.mouseHandler = new
|
|
1932
|
+
this.mouseHandler = new _e(this), this.inputHandler = new ze(this), this.shortcutService = new Je(this), this.shortcutService.addListener(this.selectionService);
|
|
1777
1933
|
}
|
|
1778
|
-
|
|
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()) {
|
|
1779
1946
|
return new J(
|
|
1780
1947
|
e,
|
|
1781
1948
|
t,
|
|
1782
1949
|
o,
|
|
1783
|
-
|
|
1784
|
-
|
|
1950
|
+
s,
|
|
1951
|
+
i
|
|
1785
1952
|
);
|
|
1786
1953
|
}
|
|
1787
1954
|
onActionTriggered(e) {
|
|
@@ -1790,131 +1957,260 @@ class J extends Ne {
|
|
|
1790
1957
|
if (e === "START_EDITING" && this.getFocusModel) {
|
|
1791
1958
|
const t = this.getFocusModel();
|
|
1792
1959
|
if (t) {
|
|
1793
|
-
const [
|
|
1794
|
-
this.tableModel.getBodyModel().isEditable(
|
|
1960
|
+
const [s, i] = t.getFocus();
|
|
1961
|
+
this.tableModel.getBodyModel().isEditable(s, i) && (this.clearSelection(), this.initRenderEditor(s, i));
|
|
1795
1962
|
}
|
|
1796
1963
|
return !0;
|
|
1797
1964
|
}
|
|
1798
1965
|
return !1;
|
|
1799
1966
|
}
|
|
1800
|
-
updateModelValueAfterEdit(e, t,
|
|
1801
|
-
e === "body" && this.tableModel.getAreaModel(e).setValue(t,
|
|
1967
|
+
updateModelValueAfterEdit(e, t, s, i) {
|
|
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());
|
|
1802
1969
|
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Retrieves the TableApi object.
|
|
1972
|
+
*
|
|
1973
|
+
* @return {TableApi} The TableApi object.
|
|
1974
|
+
*/
|
|
1803
1975
|
getApi() {
|
|
1804
1976
|
return this.api;
|
|
1805
1977
|
}
|
|
1806
|
-
|
|
1807
|
-
* 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.
|
|
1808
1985
|
*/
|
|
1809
1986
|
firstInit() {
|
|
1810
1987
|
var e;
|
|
1811
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;
|
|
1812
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
|
+
*/
|
|
1813
1996
|
createGeMouseEvent(e) {
|
|
1814
1997
|
const t = new K();
|
|
1815
1998
|
if (t.originalEvent = e, e) {
|
|
1816
|
-
const
|
|
1817
|
-
if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(
|
|
1818
|
-
const
|
|
1819
|
-
t.rowTop =
|
|
1999
|
+
const s = e.target;
|
|
2000
|
+
if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(s), t.rowIndex = this.getNumberByAttr(s, "data-row-index"), t.columnIndex = this.getNumberByAttr(s, "data-col-index"), t.action = this.getStringByAttr(s, "data-ge-action"), t.areaIdent) {
|
|
2001
|
+
const i = this.tableModel.getAreaModel(t.areaIdent);
|
|
2002
|
+
t.rowTop = i.getYPosByRowIndex(t.rowIndex);
|
|
1820
2003
|
}
|
|
1821
2004
|
if (t.columnLeft = this.tableModel.getXPosByColumnIndex(t.columnIndex), e.ctrlKey && e.altKey) {
|
|
1822
|
-
const
|
|
1823
|
-
this.debugOnce(o,
|
|
2005
|
+
const i = e.clientY - this.hostElement.offsetTop - this.areaHeaderCenter.parent.clientHeight, o = e.clientX - this.hostElement.offsetLeft - this.areaBodyWestGeo.width;
|
|
2006
|
+
this.debugOnce(o, i);
|
|
1824
2007
|
}
|
|
1825
2008
|
}
|
|
1826
2009
|
return t;
|
|
1827
2010
|
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Handles the mouse down event.
|
|
2013
|
+
*
|
|
2014
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
2015
|
+
* @return {void}
|
|
2016
|
+
*/
|
|
1828
2017
|
onMouseDown(e) {
|
|
1829
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));
|
|
1830
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Handles mouse dragging on the frame.
|
|
2022
|
+
*
|
|
2023
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event object.
|
|
2024
|
+
*/
|
|
1831
2025
|
mouseDraggingOnFrame(e) {
|
|
1832
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());
|
|
1833
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
|
+
*/
|
|
1834
2035
|
mouseDraggingEndOnFrame(e) {
|
|
1835
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 = "";
|
|
1836
2037
|
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Handles the mouse move event.
|
|
2040
|
+
*
|
|
2041
|
+
* @param {GeMouseEvent} mouseMoveEvent - The mouse move event object.
|
|
2042
|
+
* @return {void}
|
|
2043
|
+
*/
|
|
1837
2044
|
mouseMove(e) {
|
|
1838
2045
|
this.eventListener.onMouseMoved(e), this.adjustHoverRows(e), this.adjustHoverColumns(e);
|
|
1839
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
|
+
*/
|
|
1840
2053
|
contextmenu(e) {
|
|
1841
2054
|
this.eventListener.onContextmenu(e);
|
|
1842
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
|
+
*/
|
|
1843
2063
|
toggleExpandCollapseAll(e = !0) {
|
|
1844
|
-
var
|
|
2064
|
+
var s;
|
|
1845
2065
|
const t = this.tableModel.getBodyModel();
|
|
1846
|
-
|
|
2066
|
+
X(t) && (t.toggleExpandCollapseAll(e), this.repaint(), (s = this.storeStateCollapsedExpandService) == null || s.collapsedStateAll(e));
|
|
1847
2067
|
}
|
|
1848
|
-
|
|
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
|
+
*/
|
|
2077
|
+
toggleRowCheckbox(e, t, s) {
|
|
1849
2078
|
var r;
|
|
1850
|
-
const
|
|
1851
|
-
|
|
1852
|
-
const a = (r =
|
|
2079
|
+
const i = this.tableModel.getAreaModel(s), o = i.isRowChecked(e), n = o === void 0 || o === "semi" || o === "none";
|
|
2080
|
+
i.setRowChecked(e, n), this.repaint();
|
|
2081
|
+
const a = (r = i.rowSelectionModel) == null ? void 0 : r.getCheckedRows();
|
|
1853
2082
|
this.eventListener.onCheckboxChanged(a || []);
|
|
1854
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
|
+
*/
|
|
1855
2091
|
onMouseClicked(e, t) {
|
|
1856
|
-
let
|
|
1857
|
-
if (!
|
|
1858
|
-
const
|
|
1859
|
-
|
|
2092
|
+
let s = this.selectionService.onMouseClicked(e, t);
|
|
2093
|
+
if (!s && this.getFocusModel) {
|
|
2094
|
+
const i = this.getFocusModel();
|
|
2095
|
+
i && (s = i.hasChanged(), i.clearChanged(), s && this.resetEditorRenderer());
|
|
1860
2096
|
}
|
|
1861
|
-
this.eventListener.onMouseClicked(e),
|
|
2097
|
+
this.eventListener.onMouseClicked(e), s && this.debounce(this.repaint.bind(this), 10);
|
|
1862
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
|
+
*/
|
|
1863
2105
|
externalFilterChanged(e = !0) {
|
|
1864
2106
|
const t = this.tableOptions.externalFilterFunction;
|
|
1865
2107
|
t && (e && this.clearSelectionModel(), this.tableModel.externalFilterChanged(t), this.scrollViewport.scrollTo(0, 0), this.tableModel.recalcHeightAndPadding(), this.resetSizeOfWrapperDiv(), this.repaint());
|
|
1866
2108
|
}
|
|
1867
|
-
|
|
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
|
+
*/
|
|
2118
|
+
onHeaderDblClicked(e, t, s) {
|
|
1868
2119
|
var o, n;
|
|
1869
|
-
const
|
|
1870
|
-
if (
|
|
2120
|
+
const i = this.tableModel.getColumnDef(s);
|
|
2121
|
+
if (i != null && i.sortable && i.sortable()) {
|
|
1871
2122
|
e.preventDefault(), e.stopPropagation();
|
|
1872
|
-
const a =
|
|
1873
|
-
this.tableModel.doSort([h]) && ((o = this.tableModel.getColumnDefs()) == null || o.forEach((
|
|
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);
|
|
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]);
|
|
1874
2125
|
}
|
|
1875
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
|
+
*/
|
|
1876
2134
|
changeFocusCell(e, t) {
|
|
1877
2135
|
if (!this.isEditing() && this.getFocusModel) {
|
|
1878
|
-
const
|
|
1879
|
-
if (
|
|
1880
|
-
const [
|
|
1881
|
-
return
|
|
2136
|
+
const s = this.getFocusModel();
|
|
2137
|
+
if (s) {
|
|
2138
|
+
const [i, o] = s.getFocus();
|
|
2139
|
+
return s.setFocus(i + t, o + e), this.repaint(), !0;
|
|
1882
2140
|
}
|
|
1883
2141
|
}
|
|
1884
2142
|
return !1;
|
|
1885
2143
|
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Resizes the column based on the mouse event.
|
|
2146
|
+
*
|
|
2147
|
+
* @param {GeMouseEvent} mouseEvent - The mouse event that triggered the resize.
|
|
2148
|
+
*/
|
|
1886
2149
|
resizeColumn(e) {
|
|
1887
2150
|
this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
|
|
1888
2151
|
}
|
|
2152
|
+
/**
|
|
2153
|
+
* Clears the selection model, if available.
|
|
2154
|
+
*
|
|
2155
|
+
* @return {void}
|
|
2156
|
+
*/
|
|
1889
2157
|
clearSelectionModel() {
|
|
1890
2158
|
var e;
|
|
1891
2159
|
this.getSelectionModel && ((e = this.getSelectionModel()) == null || e.clear());
|
|
1892
2160
|
}
|
|
1893
2161
|
debugOnce(e, t) {
|
|
1894
|
-
var
|
|
1895
|
-
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", (
|
|
2162
|
+
var s;
|
|
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);
|
|
1896
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
|
+
*/
|
|
1897
2173
|
autoRestoreScrollPosition() {
|
|
1898
2174
|
var e;
|
|
1899
2175
|
if ((e = this.tableOptions) != null && e.autoRestoreOptions && this.storeScrollPosStateService && this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition) {
|
|
1900
|
-
const
|
|
1901
|
-
|
|
2176
|
+
const s = this.storeScrollPosStateService.getScrollOffset();
|
|
2177
|
+
s && this.scrollViewport.scrollTo(...s);
|
|
1902
2178
|
}
|
|
1903
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
|
+
*/
|
|
1904
2194
|
autoRestoreSortingState() {
|
|
1905
2195
|
var e, t;
|
|
1906
2196
|
if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreSortingState && this.storeSortingService) {
|
|
1907
|
-
const
|
|
1908
|
-
|
|
2197
|
+
const s = this.storeSortingService.getSortItems();
|
|
2198
|
+
s != null && s.length && this.tableModel.getBodyModel().doSort(s);
|
|
1909
2199
|
}
|
|
1910
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
|
+
*/
|
|
1911
2207
|
autoRestoreCollapsedExpandedState() {
|
|
1912
2208
|
var e, t;
|
|
1913
2209
|
if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.getRowId && this.storeStateCollapsedExpandService) {
|
|
1914
|
-
const
|
|
1915
|
-
if (
|
|
2210
|
+
const s = this.tableOptions.autoRestoreOptions, i = s.getRowId;
|
|
2211
|
+
if (s.autoRestoreCollapsedExpandedState && i) {
|
|
1916
2212
|
const o = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(), n = this.tableModel.getAreaModel("body");
|
|
1917
|
-
if (
|
|
2213
|
+
if (X(n)) {
|
|
1918
2214
|
const a = n, r = n.getRowCount();
|
|
1919
2215
|
for (let d = 0; d < r; d++) {
|
|
1920
2216
|
const h = n.getRowByIndex(d);
|
|
@@ -1924,7 +2220,7 @@ class J extends Ne {
|
|
|
1924
2220
|
else if (o.allCollapsed)
|
|
1925
2221
|
h.expanded = !1;
|
|
1926
2222
|
else {
|
|
1927
|
-
const p =
|
|
2223
|
+
const p = i(h.data);
|
|
1928
2224
|
o.mode === "expanded" ? h.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(p) : o.mode === "collapsed" && (h.expanded = !this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(p));
|
|
1929
2225
|
}
|
|
1930
2226
|
}
|
|
@@ -1938,23 +2234,23 @@ function it(l) {
|
|
|
1938
2234
|
let e;
|
|
1939
2235
|
return {
|
|
1940
2236
|
c() {
|
|
1941
|
-
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");
|
|
1942
2238
|
},
|
|
1943
|
-
m(t,
|
|
1944
|
-
|
|
2239
|
+
m(t, s) {
|
|
2240
|
+
me(t, e, s), l[3](e);
|
|
1945
2241
|
},
|
|
1946
2242
|
p: F,
|
|
1947
2243
|
i: F,
|
|
1948
2244
|
o: F,
|
|
1949
2245
|
d(t) {
|
|
1950
|
-
t &&
|
|
2246
|
+
t && le(e), l[3](null);
|
|
1951
2247
|
}
|
|
1952
2248
|
};
|
|
1953
2249
|
}
|
|
1954
|
-
function
|
|
1955
|
-
let { tableModel:
|
|
1956
|
-
const n =
|
|
1957
|
-
|
|
2250
|
+
function ot(l, e, t) {
|
|
2251
|
+
let { tableModel: s } = e, { tableOptions: i = new he() } = e, o;
|
|
2252
|
+
const n = ue();
|
|
2253
|
+
Se(() => {
|
|
1958
2254
|
const r = {
|
|
1959
2255
|
onCheckboxChanged: (h) => {
|
|
1960
2256
|
n("checkboxChanged", h);
|
|
@@ -1977,7 +2273,7 @@ function st(l, e, t) {
|
|
|
1977
2273
|
onMouseMoved: (h) => {
|
|
1978
2274
|
n("mouseMoved", h);
|
|
1979
2275
|
}
|
|
1980
|
-
}, d = new J(o,
|
|
2276
|
+
}, d = new J(o, s, new de(), i, r);
|
|
1981
2277
|
d.firstInit(), n("tableReady", d.getApi());
|
|
1982
2278
|
});
|
|
1983
2279
|
function a(r) {
|
|
@@ -1986,26 +2282,26 @@ function st(l, e, t) {
|
|
|
1986
2282
|
});
|
|
1987
2283
|
}
|
|
1988
2284
|
return l.$$set = (r) => {
|
|
1989
|
-
"tableModel" in r && t(1,
|
|
1990
|
-
}, [o,
|
|
2285
|
+
"tableModel" in r && t(1, s = r.tableModel), "tableOptions" in r && t(2, i = r.tableOptions);
|
|
2286
|
+
}, [o, s, i, a];
|
|
1991
2287
|
}
|
|
1992
|
-
class
|
|
2288
|
+
class nt extends $e {
|
|
1993
2289
|
constructor(e) {
|
|
1994
|
-
super(),
|
|
2290
|
+
super(), Ie(this, e, ot, it, ge, { tableModel: 1, tableOptions: 2 });
|
|
1995
2291
|
}
|
|
1996
2292
|
}
|
|
1997
|
-
class
|
|
2293
|
+
class at {
|
|
1998
2294
|
constructor(e) {
|
|
1999
2295
|
this.Component = e;
|
|
2000
2296
|
}
|
|
2001
|
-
render(e, t,
|
|
2297
|
+
render(e, t, s, i, o, n, a) {
|
|
2002
2298
|
const r = new this.Component({
|
|
2003
2299
|
target: e,
|
|
2004
2300
|
props: {
|
|
2005
2301
|
cellDiv: e,
|
|
2006
2302
|
rowIndex: t,
|
|
2007
|
-
columnIndex:
|
|
2008
|
-
areaIdent:
|
|
2303
|
+
columnIndex: s,
|
|
2304
|
+
areaIdent: i,
|
|
2009
2305
|
areaModel: o,
|
|
2010
2306
|
cellValue: n
|
|
2011
2307
|
}
|
|
@@ -2016,6 +2312,6 @@ class nt {
|
|
|
2016
2312
|
}
|
|
2017
2313
|
}
|
|
2018
2314
|
export {
|
|
2019
|
-
|
|
2020
|
-
|
|
2315
|
+
at as ComponentRendererWrapper,
|
|
2316
|
+
nt as GuiexpertTable
|
|
2021
2317
|
};
|