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