@guiexpert/vue3-table 0.0.1 → 1.0.2
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/README.md +102 -0
- package/package.json +9 -2
- package/vue3-table.es.js +603 -414
- package/vue3-table.umd.js +5 -5
package/vue3-table.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
class
|
|
3
|
-
constructor(e = -1, t = -1, s = -1, i = -1, o,
|
|
4
|
-
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = i, this.areaIdent = o, this.sideIdent =
|
|
1
|
+
import { defineComponent as G, ref as N, onMounted as z, openBlock as j, createElementBlock as X, createVNode as K, render as k } from "vue";
|
|
2
|
+
class B {
|
|
3
|
+
constructor(e = -1, t = -1, s = -1, i = -1, o, r, l, n = 0, a = 0, d = 0, S = "") {
|
|
4
|
+
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = i, this.areaIdent = o, this.sideIdent = r, this.originalEvent = l, this.clickCount = n, this.draggingX = a, this.draggingY = d, this.action = S;
|
|
5
5
|
}
|
|
6
6
|
clone() {
|
|
7
|
-
return new
|
|
7
|
+
return new B(
|
|
8
8
|
this.rowIndex,
|
|
9
9
|
this.rowTop,
|
|
10
10
|
this.columnIndex,
|
|
@@ -19,38 +19,38 @@ class O {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
class
|
|
22
|
+
class I {
|
|
23
23
|
constructor(e = ">", t = "", s = []) {
|
|
24
24
|
this.content = e, this.style = t, this.classes = s;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
class
|
|
28
|
-
constructor(e = new
|
|
27
|
+
class H {
|
|
28
|
+
constructor(e = new I(
|
|
29
29
|
">",
|
|
30
30
|
"transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
|
|
31
|
-
["gt-tree-arrow-expanded"]
|
|
32
|
-
), t = new
|
|
31
|
+
["gt-table-tree-arrow-expanded"]
|
|
32
|
+
), t = new I(
|
|
33
33
|
">",
|
|
34
34
|
"",
|
|
35
|
-
["ge-tree-arrow-collapsed"]
|
|
36
|
-
), s = new
|
|
35
|
+
["ge-table-tree-arrow-collapsed"]
|
|
36
|
+
), s = new I(
|
|
37
37
|
">",
|
|
38
38
|
"color:transparent;",
|
|
39
|
-
["gt-tree-arrow-hidden"]
|
|
40
|
-
), i = new
|
|
39
|
+
["gt-table-tree-arrow-hidden"]
|
|
40
|
+
), i = new I(
|
|
41
41
|
"↕",
|
|
42
42
|
"",
|
|
43
|
-
["gt-tree-arrow-expanded-all"]
|
|
43
|
+
["gt-table-tree-arrow-expanded-all"]
|
|
44
44
|
)) {
|
|
45
45
|
this.arrowExpanded = e, this.arrowCollapsed = t, this.arrowPlaceholder = s, this.arrowExpandCollapseAll = i;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
class
|
|
49
|
-
constructor(e = new
|
|
48
|
+
class W {
|
|
49
|
+
constructor(e = new I("↑", "", ["ge-header-sorted-asc"]), t = new I("↓", "", ["ge-header-sorted-desc"]), s = new I("↑", "color:transparent;", [])) {
|
|
50
50
|
this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class Y {
|
|
54
54
|
constructor(e) {
|
|
55
55
|
this.domService = e;
|
|
56
56
|
}
|
|
@@ -120,77 +120,87 @@ class X {
|
|
|
120
120
|
const s = this.domService.createElement("div");
|
|
121
121
|
return this.addClass(e, s), this.domService.appendChild(t, s), s;
|
|
122
122
|
}
|
|
123
|
-
addRowDiv(e, t, s = -1, i, o = "") {
|
|
124
|
-
const l = t.index ?? -1,
|
|
125
|
-
this.domService.addClass(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const d = this.domService.createText(o);
|
|
129
|
-
this.domService.appendChild(r, d);
|
|
123
|
+
addRowDiv(e, t, s = -1, i, o, r = "") {
|
|
124
|
+
const l = t.index ?? -1, n = this.getDivOrCreateDiv(l, e);
|
|
125
|
+
if (this.domService.addClass(n, "ge-table-row-div"), this.domService.addClass(n, `ge-table-row-div-${t.index}`), i === "body" && o === "center") {
|
|
126
|
+
const a = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
|
|
127
|
+
this.domService.addClass(n, `ge-table-row-${a}`);
|
|
130
128
|
}
|
|
131
|
-
|
|
129
|
+
if (this.domService.setStyle(n, "display", "clip"), this.domService.setStyle(n, "position", "absolute"), this.domService.setStyle(n, "left", `${t.left}px`), this.domService.setStyle(n, "top", `${t.top}px`), this.domService.setStyle(n, "width", `${t.width}px`), this.domService.setStyle(n, "height", `${t.height}px`), this.domService.setAttribute(n, "data-row-index", `${s}`), this.domService.setAttribute(n, "data-area", `${i}`), r) {
|
|
130
|
+
const a = this.domService.createText(r);
|
|
131
|
+
this.domService.appendChild(n, a);
|
|
132
|
+
}
|
|
133
|
+
return this.domService.appendChild(e.child, n), n;
|
|
132
134
|
}
|
|
133
|
-
addColumnDiv(e, t, s = -1, i = -1, o, l = "",
|
|
134
|
-
const
|
|
135
|
+
addColumnDiv(e, t, s = -1, i = -1, o, r, l = "", n, a, d = void 0, S) {
|
|
136
|
+
const g = a == null ? void 0 : a.treeOptions, f = a == null ? void 0 : a.showCheckboxWihoutExtraColumn, c = this.domService.createElement("div");
|
|
135
137
|
this.domService.addClass(c, "ge-table-col-div"), this.domService.addClass(c, `ge-table-col-div-${t.index}`), this.domService.setAttribute(c, "data-col-index", `${t.index}`), this.domService.setAttribute(c, "data-row-index", `${s}`), this.domService.setAttribute(c, "data-area", `${o}`);
|
|
136
|
-
const
|
|
137
|
-
if (this.domService.addClass(c, `ge-table-
|
|
138
|
-
const
|
|
139
|
-
this.addLabelDiv(c, l,
|
|
138
|
+
const b = ((t == null ? void 0 : t.index) ?? 0) % 2 === 0 ? "even" : "odd";
|
|
139
|
+
if (o === "body" && r === "center" && this.domService.addClass(c, `ge-table-column-${b}`), this.domService.setStyle(c, "display", "clip"), this.domService.setStyle(c, "position", "absolute"), this.domService.setStyle(c, "left", `${t.left}px`), this.domService.setStyle(c, "top", `${t.top}px`), this.domService.setStyle(c, "width", `${t.width}px`), this.domService.setStyle(c, "height", `${t.height}px`), n && n !== "none" && (this.domService.addClass(c, "ge-table-col-tree"), this.addArrowDiv(c, n, g, s, i, o)), f && i === 0 && d && this.addCheckboxToDiv(c, d, o, s), l) {
|
|
140
|
+
const p = n !== "none" && i === 0;
|
|
141
|
+
this.addLabelDiv(c, l, p, s, i, o);
|
|
140
142
|
}
|
|
141
|
-
return
|
|
143
|
+
return S && this.addSortedIcon(c, S, a == null ? void 0 : a.sortedOptions, i), this.domService.appendChild(e, c), c;
|
|
142
144
|
}
|
|
143
145
|
addCheckboxToDiv(e, t, s, i) {
|
|
144
|
-
const o = this.domService.createElement("div"),
|
|
146
|
+
const o = this.domService.createElement("div"), r = t === "full" ? "checked" : "";
|
|
145
147
|
return o.innerHTML = `
|
|
146
148
|
<input
|
|
147
149
|
type="checkbox"
|
|
148
150
|
data-area="${s}"
|
|
149
151
|
data-row-index="${i}"
|
|
150
152
|
data-input-type="checkbox"
|
|
151
|
-
${
|
|
153
|
+
${r}
|
|
152
154
|
class="ge-table-row-checkbox"> `, this.domService.setStyle(o, "display", "inline"), this.domService.setStyle(o, "width", "inherit"), this.domService.setAttribute(o, "data-row-index", `${i}`), this.domService.appendChild(e, o), o;
|
|
153
155
|
}
|
|
154
|
-
addLabelDiv(e, t = "", s = !1, i = -1, o = -1,
|
|
155
|
-
const
|
|
156
|
-
if (this.domService.addClass(
|
|
156
|
+
addLabelDiv(e, t = "", s = !1, i = -1, o = -1, r = "body") {
|
|
157
|
+
const l = this.domService.createElement("div");
|
|
158
|
+
if (this.domService.addClass(l, "ge-table-label-div"), this.domService.setStyle(l, "position", "relative"), this.domService.setStyle(l, "background", "transparent"), this.domService.setStyle(l, "width", "100%"), this.domService.setStyle(l, "height", "100%"), this.domService.setAttribute(l, "data-row-index", `${i}`), this.domService.setAttribute(l, "data-col-index", `${o}`), this.domService.setAttribute(l, "data-area", `${r}`), t)
|
|
157
159
|
if (s) {
|
|
158
160
|
const n = this.domService.createText(t);
|
|
159
|
-
this.domService.appendChild(
|
|
161
|
+
this.domService.appendChild(l, n);
|
|
160
162
|
} else {
|
|
161
163
|
const n = this.domService.createElement("div");
|
|
162
|
-
this.domService.appendChild(
|
|
163
|
-
const
|
|
164
|
-
this.domService.addClass(n, "ge-table-label"), this.domService.appendChild(n,
|
|
164
|
+
this.domService.appendChild(l, n);
|
|
165
|
+
const a = this.domService.createText(t);
|
|
166
|
+
this.domService.addClass(n, "ge-table-label"), this.domService.appendChild(n, a), this.domService.setAttribute(n, "data-row-index", `${i}`), this.domService.setAttribute(n, "data-col-index", `${o}`), this.domService.setAttribute(n, "data-area", `${r}`);
|
|
165
167
|
}
|
|
166
|
-
return this.domService.appendChild(e,
|
|
168
|
+
return this.domService.appendChild(e, l), l;
|
|
167
169
|
}
|
|
168
|
-
addSortedIcon(e, t = "", s = new
|
|
170
|
+
addSortedIcon(e, t = "", s = new W(), i = -1) {
|
|
169
171
|
const o = this.domService.createElement("div");
|
|
170
172
|
this.domService.addClass(o, "ge-table-sorted-icon-div"), this.domService.setStyle(o, "position", "absolute"), this.domService.setStyle(o, "top", "0"), this.domService.setStyle(o, "right", "0"), this.domService.setStyle(o, "width", "20px"), this.domService.setStyle(o, "background", "transparent"), this.domService.setStyle(o, "cursor", "pointer"), this.domService.setAttribute(o, "data-col-index", `${i}`), this.domService.setAttribute(o, "data-area", "header");
|
|
171
|
-
let
|
|
172
|
-
t === "asc" ?
|
|
173
|
-
const
|
|
174
|
-
this.domService.appendChild(o, n),
|
|
175
|
-
for (const
|
|
176
|
-
this.domService.addClass(o,
|
|
173
|
+
let r;
|
|
174
|
+
t === "asc" ? r = s.iconAsc : t === "desc" ? r = s.iconDesc : r = s.iconPlaceholder;
|
|
175
|
+
const l = r.content, n = this.domService.createText(l);
|
|
176
|
+
this.domService.appendChild(o, n), r.style && this.applyStyleString(o, r.style);
|
|
177
|
+
for (const a of r.classes)
|
|
178
|
+
this.domService.addClass(o, a);
|
|
177
179
|
return this.domService.appendChild(e, o), o;
|
|
178
180
|
}
|
|
179
|
-
addArrowDiv(e, t = "none", s = new
|
|
180
|
-
const
|
|
181
|
-
this.domService.addClass(
|
|
181
|
+
addArrowDiv(e, t = "none", s = new H(), i = -1, o = -1, r = "body") {
|
|
182
|
+
const l = this.domService.createElement("div");
|
|
183
|
+
this.domService.addClass(l, "ge-table-tree-arrow-div"), this.domService.setStyle(l, "display", "inline-block"), this.domService.setStyle(l, "position", ""), this.domService.setStyle(l, "width", "20px"), this.domService.setStyle(l, "background", "transparent"), this.domService.setStyle(l, "cursor", "pointer"), this.domService.setAttribute(l, "data-row-index", `${i}`), this.domService.setAttribute(l, "data-col-index", `${o}`), this.domService.setAttribute(l, "data-area", `${r}`);
|
|
182
184
|
let n;
|
|
183
185
|
t === "expanded" ? n = s.arrowExpanded : t === "collapsed" ? n = s.arrowCollapsed : n = s.arrowPlaceholder;
|
|
184
|
-
const
|
|
185
|
-
this.domService.appendChild(
|
|
186
|
-
for (const
|
|
187
|
-
this.domService.addClass(
|
|
188
|
-
return this.domService.appendChild(e,
|
|
189
|
-
}
|
|
190
|
-
addColumnBorderDivs(e, t) {
|
|
191
|
-
|
|
186
|
+
const a = n.content, d = this.domService.createText(a);
|
|
187
|
+
this.domService.appendChild(l, d), n.style && this.applyStyleString(l, n.style);
|
|
188
|
+
for (const S of n.classes)
|
|
189
|
+
this.domService.addClass(l, S);
|
|
190
|
+
return this.domService.appendChild(e, l), l;
|
|
191
|
+
}
|
|
192
|
+
addColumnBorderDivs(e, t, s, i, o) {
|
|
193
|
+
if (e.verticalBorderVisible) {
|
|
194
|
+
const r = `ge-table-${i}-${o}-vertical-border`;
|
|
195
|
+
this.addVerticalBorder(s, t, r);
|
|
196
|
+
}
|
|
197
|
+
if (e.horizontalBorderVisible) {
|
|
198
|
+
const r = `ge-table-${i}-${o}-horizontal-border`;
|
|
199
|
+
this.addHorizontalBorder(s, t, r);
|
|
200
|
+
}
|
|
201
|
+
return t;
|
|
192
202
|
}
|
|
193
|
-
addHorizontalBorder(e, t, s = "ge-table-
|
|
203
|
+
addHorizontalBorder(e, t, s = "ge-table-body-center-horizontal-border") {
|
|
194
204
|
const i = this.domService.createElement("div");
|
|
195
205
|
return this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${e.left}px`), this.domService.setStyle(i, "top", `${e.top}px`), this.domService.setStyle(i, "width", `${e.width}px`), this.domService.setStyle(i, "height", "1px"), this.domService.appendChild(t, i), i;
|
|
196
206
|
}
|
|
@@ -198,7 +208,7 @@ class X {
|
|
|
198
208
|
let i = this.domService.createElement("div");
|
|
199
209
|
return this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${t.height}px`), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left + t.width - 1}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${t.height}px`), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", "1px"), this.applyStyle(i, s), this.domService.appendChild(e, i), i = this.domService.createElement("div"), this.domService.addClass(i, "ge-table-focus-border"), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${t.left}px`), this.domService.setStyle(i, "top", `${t.top + t.height - 1}px`), this.domService.setStyle(i, "width", `${t.width}px`), this.domService.setStyle(i, "height", "1px"), this.applyStyle(i, s), this.domService.appendChild(e, i), e;
|
|
200
210
|
}
|
|
201
|
-
addVerticalBorder(e, t, s = "ge-table-
|
|
211
|
+
addVerticalBorder(e, t, s = "ge-table-body-center-vertical-border") {
|
|
202
212
|
const i = this.domService.createElement("div");
|
|
203
213
|
return this.domService.addClass(i, s), this.domService.setStyle(i, "display", "clip"), this.domService.setStyle(i, "position", "absolute"), this.domService.setStyle(i, "left", `${e.left}px`), this.domService.setStyle(i, "top", `${e.top}px`), this.domService.setStyle(i, "width", "1px"), this.domService.setStyle(i, "height", `${e.height}px`), this.domService.appendChild(t, i), i;
|
|
204
214
|
}
|
|
@@ -209,8 +219,8 @@ class X {
|
|
|
209
219
|
applyStyleString(e, t) {
|
|
210
220
|
const s = t.split(";").map((i) => i.trim()).filter((i) => i);
|
|
211
221
|
for (const i of s) {
|
|
212
|
-
const [o,
|
|
213
|
-
this.domService.setStyle(e, o.trim(),
|
|
222
|
+
const [o, r] = i.split(":");
|
|
223
|
+
this.domService.setStyle(e, o.trim(), r.trim());
|
|
214
224
|
}
|
|
215
225
|
}
|
|
216
226
|
getDivOrCreateDiv(e, t) {
|
|
@@ -218,15 +228,27 @@ class X {
|
|
|
218
228
|
return s ? (s.innerText = "", s) : (s = this.domService.createElement("div"), t.cache[e] = s, s);
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
|
-
class
|
|
222
|
-
constructor(e, t = !0, s, i, o = 0,
|
|
223
|
-
this.data = e, this.expanded = t, this.children = s, this.parent = i, this.deep = o, this.checked =
|
|
231
|
+
class O {
|
|
232
|
+
constructor(e, t = !0, s, i, o = 0, r = !1, l = !1) {
|
|
233
|
+
this.data = e, this.expanded = t, this.children = s, this.parent = i, this.deep = o, this.checked = r, this.keep = l;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const $ = (h) => h === "header" ? "header" : h === "footer" ? "footer" : "body";
|
|
237
|
+
class q {
|
|
238
|
+
constructor(e, t) {
|
|
239
|
+
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)) {
|
|
240
|
+
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"));
|
|
241
|
+
const s = e.getAttribute("data-area");
|
|
242
|
+
if (s && (this.areaIdent = $(s), this.areaModel = t.tableModel.getAreaModel(this.areaIdent), this.row = this.areaModel.getRowByIndex(this.rowIdx)), e instanceof HTMLInputElement) {
|
|
243
|
+
const i = e;
|
|
244
|
+
this.value = i.value;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
224
247
|
}
|
|
225
248
|
}
|
|
226
|
-
|
|
227
|
-
class z {
|
|
249
|
+
class U {
|
|
228
250
|
constructor(e) {
|
|
229
|
-
this.tableScope = e, this.expandedAll = !0, this.mouseDown = !1, this.dragging = !1, this.tableScope.hostElement.addEventListener("click", this.onHostElementClicked.bind(this)), this.tableScope.hostElement.addEventListener("dblclick", this.onHostElementDblClicked.bind(this)), this.tableScope.hostElement.addEventListener("mousedown", this.onMouseDown.bind(this)), this.tableScope.hostElement.addEventListener("mousemove", this.onMouseMove.bind(this)), this.tableScope.hostElement.addEventListener("mouseup", this.onMouseUp.bind(this)), this.tableScope.hostElement.addEventListener("contextmenu", this.onContextmenu.bind(this)), this.tableScope.scrollViewport.addEventListener("scroll", this.tableScope.adjustAfterScrolling.bind(this.tableScope)), [window, this.tableScope.hostElement].forEach(
|
|
251
|
+
this.tableScope = e, this.expandedAll = !0, this.mouseDown = !1, this.dragging = !1, this.tableScope.hostElement.addEventListener("click", this.onHostElementClicked.bind(this)), this.tableScope.hostElement.addEventListener("dblclick", this.onHostElementDblClicked.bind(this)), this.tableScope.hostElement.addEventListener("mousedown", this.onMouseDown.bind(this)), this.tableScope.hostElement.addEventListener("mousemove", this.onMouseMove.bind(this)), this.tableScope.hostElement.addEventListener("mouseup", this.onMouseUp.bind(this)), this.tableScope.hostElement.addEventListener("contextmenu", this.onContextmenu.bind(this)), this.tableScope.hostElement._MouseHandler = "true", this.tableScope.scrollViewport.addEventListener("scroll", this.tableScope.adjustAfterScrolling.bind(this.tableScope)), [window, this.tableScope.hostElement].forEach(
|
|
230
252
|
(t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
|
|
231
253
|
);
|
|
232
254
|
}
|
|
@@ -236,44 +258,36 @@ class z {
|
|
|
236
258
|
this.tableScope.contextmenu(t);
|
|
237
259
|
}
|
|
238
260
|
onHostElementClicked(e) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
this.tableScope.toggleRowCheckbox(s, i, l), e.preventDefault();
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
if (n instanceof I) {
|
|
254
|
-
const d = i === this.getArrowColumnIndex() && e.altKey, a = t.className.includes("ge-table-tree-arrow-div");
|
|
255
|
-
if (d || a) {
|
|
256
|
-
e.preventDefault();
|
|
257
|
-
const p = n;
|
|
258
|
-
p.expanded = !p.expanded, "recalcVisibleTreeRows" in r && r.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(p);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
261
|
+
const t = new q(e.target, this.tableScope);
|
|
262
|
+
if (t.action === "toggleExpandCollapseAll")
|
|
263
|
+
this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
|
|
264
|
+
else if (t.inputType === "checkbox" && t.areaIdent)
|
|
265
|
+
this.tableScope.toggleRowCheckbox(t.rowIdx, t.colIdx, t.areaIdent), e.preventDefault(), e.stopPropagation();
|
|
266
|
+
else if (t.row instanceof O && t.areaModel) {
|
|
267
|
+
const s = t.colIdx === this.getArrowColumnIndex() && e.altKey, i = t.className.includes("ge-table-tree-arrow-div");
|
|
268
|
+
if (console.info(i, s), s || i) {
|
|
269
|
+
e.preventDefault(), e.stopPropagation();
|
|
270
|
+
const o = t.row;
|
|
271
|
+
o.expanded = !o.expanded, "recalcVisibleTreeRows" in t.areaModel && t.areaModel.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(o);
|
|
262
272
|
}
|
|
263
273
|
}
|
|
274
|
+
if (t.areaIdent === "body" && this.tableScope.tableOptions.getFocusModel) {
|
|
275
|
+
const s = this.tableScope.tableOptions.getFocusModel();
|
|
276
|
+
s == null || s.clear(), s == null || s.setFocus(t.rowIdx, t.colIdx);
|
|
277
|
+
}
|
|
264
278
|
this.publishGeMouseEvent(e, 1);
|
|
265
279
|
}
|
|
266
280
|
onHostElementDblClicked(e) {
|
|
267
281
|
if (e.target instanceof HTMLElement) {
|
|
268
|
-
const t = e.target, s = t.getAttribute("data-area"), i =
|
|
282
|
+
const t = e.target, s = t.getAttribute("data-area"), i = $(s), o = Number(t.getAttribute("data-row-index")), r = Number(t.getAttribute("data-col-index")), l = this.tableScope.tableModel.getAreaModel(i);
|
|
269
283
|
if (s && i === "header")
|
|
270
|
-
this.tableScope.tableModel.isSortable(
|
|
284
|
+
this.tableScope.tableModel.isSortable(r) && (this.tableScope.clearSelection(), this.tableScope.onHeaderDblClicked(e, o, r));
|
|
271
285
|
else if (t.getAttribute("data-row-index")) {
|
|
272
|
-
const n =
|
|
273
|
-
if (s && i === "body" &&
|
|
274
|
-
e.preventDefault();
|
|
275
|
-
const
|
|
276
|
-
|
|
286
|
+
const n = l.getRowByIndex(o);
|
|
287
|
+
if (s && i === "body" && l.isEditable(o, r) && (this.tableScope.clearSelection(), this.tableScope.initRenderEditor(o, r)), n instanceof O && r === this.getArrowColumnIndex()) {
|
|
288
|
+
e.preventDefault(), e.stopPropagation();
|
|
289
|
+
const a = n;
|
|
290
|
+
a.expanded = !a.expanded, "recalcVisibleTreeRows" in l && l.recalcVisibleTreeRows(), this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth), this.tableScope.adjustContainersAndRows(), this.updateCollapsedExpandedState(a);
|
|
277
291
|
}
|
|
278
292
|
}
|
|
279
293
|
}
|
|
@@ -284,11 +298,11 @@ class z {
|
|
|
284
298
|
this.mouseEvent = e, this.geMouseEventOld = (s = this.geMouseEvent) == null ? void 0 : s.clone(), this.geMouseEvent = this.tableScope.createGeMouseEvent(e), this.geMouseEvent && (this.geMouseEvent.clickCount = t), this.tableScope.onMouseClicked(this.geMouseEvent, this.geMouseEventOld);
|
|
285
299
|
}
|
|
286
300
|
updateCollapsedExpandedState(e) {
|
|
287
|
-
var s, i, o,
|
|
301
|
+
var s, i, o, r, l;
|
|
288
302
|
const t = (i = (s = this.tableScope.tableOptions) == null ? void 0 : s.autoRestoreOptions) == null ? void 0 : i.getRowId;
|
|
289
303
|
if (t) {
|
|
290
|
-
const n = (o = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : o.collapsedExpandedStateGet().mode,
|
|
291
|
-
|
|
304
|
+
const n = (o = this.tableScope.storeStateCollapsedExpandService) == null ? void 0 : o.collapsedExpandedStateGet().mode, a = n === "collapsed" && !e.expanded || n === "expanded" && e.expanded, d = n === "collapsed" && e.expanded || n === "expanded" && !e.expanded, S = t(e.data);
|
|
305
|
+
a ? (r = this.tableScope.storeStateCollapsedExpandService) == null || r.collapsedStateIdsPush(S) : d && ((l = this.tableScope.storeStateCollapsedExpandService) == null || l.collapsedStateIdsRemove(S));
|
|
292
306
|
}
|
|
293
307
|
}
|
|
294
308
|
getArrowColumnIndex() {
|
|
@@ -324,10 +338,13 @@ class z {
|
|
|
324
338
|
}
|
|
325
339
|
}
|
|
326
340
|
}
|
|
327
|
-
class
|
|
341
|
+
class J {
|
|
328
342
|
constructor(e) {
|
|
329
343
|
this.tableScope = e;
|
|
330
344
|
}
|
|
345
|
+
updateCells(e) {
|
|
346
|
+
this.tableScope.updateCells(e);
|
|
347
|
+
}
|
|
331
348
|
externalFilterChanged() {
|
|
332
349
|
this.tableScope.externalFilterChanged();
|
|
333
350
|
}
|
|
@@ -354,7 +371,7 @@ class K {
|
|
|
354
371
|
this.tableScope.repaint();
|
|
355
372
|
}
|
|
356
373
|
}
|
|
357
|
-
class
|
|
374
|
+
class Q {
|
|
358
375
|
flattenTree(e, t = []) {
|
|
359
376
|
var s;
|
|
360
377
|
for (const i of e)
|
|
@@ -365,9 +382,9 @@ class Y {
|
|
|
365
382
|
return e.parent ? e.parent.expanded ? this.isVisible(e.parent) : !1 : !0;
|
|
366
383
|
}
|
|
367
384
|
}
|
|
368
|
-
class
|
|
385
|
+
class Z {
|
|
369
386
|
constructor(e, t = [], s = -1) {
|
|
370
|
-
this.areaIdent = e, this.columnDefs = t, this.
|
|
387
|
+
this.areaIdent = e, this.columnDefs = t, this.defaultRowHeight = s, this.rowSelectionModel = void 0, this.yPositions = [], this.cellRenderers = t.map((i) => i.rendererMap[e]);
|
|
371
388
|
}
|
|
372
389
|
getTooltipAt(e, t) {
|
|
373
390
|
return "";
|
|
@@ -382,6 +399,8 @@ class q {
|
|
|
382
399
|
getCustomClassesAt(e, t) {
|
|
383
400
|
return [];
|
|
384
401
|
}
|
|
402
|
+
getCustomStyleAt(e, t) {
|
|
403
|
+
}
|
|
385
404
|
getRowspanAt(e, t) {
|
|
386
405
|
return 0;
|
|
387
406
|
}
|
|
@@ -408,10 +427,10 @@ class q {
|
|
|
408
427
|
return 31;
|
|
409
428
|
}
|
|
410
429
|
getYPosByRowIndex(e) {
|
|
411
|
-
return this.
|
|
430
|
+
return this.defaultRowHeight > 0 ? this.defaultRowHeight * e : this.yPositions[e];
|
|
412
431
|
}
|
|
413
432
|
init() {
|
|
414
|
-
!this.yPositions.length && this.getRowCount() !== void 0 && this.
|
|
433
|
+
!this.yPositions.length && this.getRowCount() !== void 0 && this.defaultRowHeight === -1 && this.calcYPositions();
|
|
415
434
|
}
|
|
416
435
|
isFilterable() {
|
|
417
436
|
return this.areaIdent === "body";
|
|
@@ -422,9 +441,12 @@ class q {
|
|
|
422
441
|
isEditable(e, t) {
|
|
423
442
|
return this.columnDefs && t < this.columnDefs.length && this.columnDefs[t].editable ? this.columnDefs[t].editable() : !1;
|
|
424
443
|
}
|
|
425
|
-
setValue(e, t, s
|
|
426
|
-
|
|
427
|
-
|
|
444
|
+
setValue(e, t, s) {
|
|
445
|
+
var l;
|
|
446
|
+
const i = (l = this.columnDefs[t]) == null ? void 0 : l.editInputPipe;
|
|
447
|
+
i && (s = i(s, e, t));
|
|
448
|
+
const o = this.getRowByIndex(e), r = this.columnDefs[t].property;
|
|
449
|
+
return r.includes(".") ? this.setPropertyValue(o, r.split("."), s) : (o[r] = s, !0);
|
|
428
450
|
}
|
|
429
451
|
isSelectable(e, t) {
|
|
430
452
|
return !0;
|
|
@@ -432,6 +454,14 @@ class q {
|
|
|
432
454
|
changeColumnOrder(e, t) {
|
|
433
455
|
this.arrayMove(this.cellRenderers, e, t);
|
|
434
456
|
}
|
|
457
|
+
setPropertyValue(e, t, s) {
|
|
458
|
+
const i = t.shift();
|
|
459
|
+
if (i) {
|
|
460
|
+
let o = e[i];
|
|
461
|
+
return o && t.length ? this.setPropertyValue(o, t, s) : (e[i] = s, !0);
|
|
462
|
+
}
|
|
463
|
+
return !1;
|
|
464
|
+
}
|
|
435
465
|
arrayMove(e, t, s) {
|
|
436
466
|
const i = e.splice(t, 1)[0];
|
|
437
467
|
return e.splice(s, 0, i), e;
|
|
@@ -443,7 +473,7 @@ class q {
|
|
|
443
473
|
this.yPositions[t + 1] = this.getRowHeight(t) + this.yPositions[t];
|
|
444
474
|
}
|
|
445
475
|
}
|
|
446
|
-
class
|
|
476
|
+
class ee {
|
|
447
477
|
genericSortComparator(e, t, s) {
|
|
448
478
|
if (typeof e == "number" && typeof t == "number")
|
|
449
479
|
return s * (e - t);
|
|
@@ -461,9 +491,9 @@ class J {
|
|
|
461
491
|
return s * ("" + e).localeCompare("" + t);
|
|
462
492
|
}
|
|
463
493
|
}
|
|
464
|
-
class L extends
|
|
494
|
+
class L extends Z {
|
|
465
495
|
constructor(e, t, s, i = []) {
|
|
466
|
-
super(e, i, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = i, this.sorterService = new
|
|
496
|
+
super(e, i, s), this.areaIdent = e, this.rows = t, this.defaultRowHeight = s, this.columnDefs = i, this.sorterService = new ee(), this.service = new Q(), this.properties = i.map((o) => o.property), this.flattenRows = this.service.flattenTree(t), this.filteredFlattenRows = [...this.flattenRows];
|
|
467
497
|
}
|
|
468
498
|
changeColumnOrder(e, t) {
|
|
469
499
|
this.arrayMove(this.properties, e, t), super.changeColumnOrder(e, t);
|
|
@@ -515,17 +545,20 @@ class L extends q {
|
|
|
515
545
|
return e.parent && (e.parent.keep = !0, this.setAllParentsOk(e.parent)), !1;
|
|
516
546
|
}
|
|
517
547
|
setValue(e, t, s) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
548
|
+
var r;
|
|
549
|
+
const i = (r = this.columnDefs[t]) == null ? void 0 : r.editInputPipe;
|
|
550
|
+
i && (s = i(s, e, t));
|
|
551
|
+
const o = this.getRowByIndex(e);
|
|
552
|
+
if (o) {
|
|
553
|
+
const l = o.data, n = this.columnDefs[t].property;
|
|
554
|
+
return n.includes(".") ? this.setPropertyValue(l, n.split("."), s) : (l[n] = s, !0);
|
|
522
555
|
}
|
|
523
556
|
return !1;
|
|
524
557
|
}
|
|
525
558
|
genericTreeTableSortComparator(e, t) {
|
|
526
559
|
return (s, i) => {
|
|
527
|
-
const o = this.getValueByT(s.data, e),
|
|
528
|
-
return this.sorterService.genericSortComparator(o,
|
|
560
|
+
const o = this.getValueByT(s.data, e), r = this.getValueByT(i.data, e);
|
|
561
|
+
return this.sorterService.genericSortComparator(o, r, t);
|
|
529
562
|
};
|
|
530
563
|
}
|
|
531
564
|
expandAllRecursive(e, t) {
|
|
@@ -562,7 +595,7 @@ class L extends q {
|
|
|
562
595
|
i.children && this.treeSort(i.children, t, s);
|
|
563
596
|
}
|
|
564
597
|
}
|
|
565
|
-
class
|
|
598
|
+
class P {
|
|
566
599
|
constructor(e) {
|
|
567
600
|
this.getStorageKeyFn = e;
|
|
568
601
|
}
|
|
@@ -573,9 +606,9 @@ class $ {
|
|
|
573
606
|
for (const i of [...s]) {
|
|
574
607
|
const [
|
|
575
608
|
o,
|
|
576
|
-
|
|
609
|
+
r
|
|
577
610
|
] = i;
|
|
578
|
-
t[o] =
|
|
611
|
+
t[o] = r;
|
|
579
612
|
}
|
|
580
613
|
}
|
|
581
614
|
return t;
|
|
@@ -587,8 +620,8 @@ class $ {
|
|
|
587
620
|
if (i) {
|
|
588
621
|
const o = i + e;
|
|
589
622
|
if ((t + "").includes("Map")) {
|
|
590
|
-
const
|
|
591
|
-
this.persistItem(o,
|
|
623
|
+
const r = this.autoConvertMapToObject(t);
|
|
624
|
+
this.persistItem(o, r);
|
|
592
625
|
} else
|
|
593
626
|
this.persistItem(o, t);
|
|
594
627
|
}
|
|
@@ -637,7 +670,7 @@ class $ {
|
|
|
637
670
|
// }
|
|
638
671
|
// }
|
|
639
672
|
}
|
|
640
|
-
class
|
|
673
|
+
class te extends P {
|
|
641
674
|
constructor(e) {
|
|
642
675
|
super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
|
|
643
676
|
}
|
|
@@ -659,14 +692,14 @@ class U extends $ {
|
|
|
659
692
|
}
|
|
660
693
|
}
|
|
661
694
|
}
|
|
662
|
-
class
|
|
695
|
+
class se {
|
|
663
696
|
constructor(e = "collapsed", t = [], s = !1, i = !1) {
|
|
664
697
|
this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = i;
|
|
665
698
|
}
|
|
666
699
|
}
|
|
667
|
-
class
|
|
700
|
+
class ie extends P {
|
|
668
701
|
constructor(e) {
|
|
669
|
-
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new
|
|
702
|
+
super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new se(), this.load();
|
|
670
703
|
}
|
|
671
704
|
collapsedExpandedStateGet() {
|
|
672
705
|
return this.collapsedExpandedState;
|
|
@@ -698,7 +731,7 @@ class Z extends $ {
|
|
|
698
731
|
this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
|
|
699
732
|
}
|
|
700
733
|
}
|
|
701
|
-
class
|
|
734
|
+
class oe extends P {
|
|
702
735
|
constructor(e) {
|
|
703
736
|
super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
|
|
704
737
|
}
|
|
@@ -725,7 +758,7 @@ class T {
|
|
|
725
758
|
this.left = e, this.width = t, this.height = s, this.top = i, this.index = o;
|
|
726
759
|
}
|
|
727
760
|
}
|
|
728
|
-
class
|
|
761
|
+
class re {
|
|
729
762
|
constructor(e, t, s, i) {
|
|
730
763
|
this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = i, this.scrollTop = 0, this.areaBodyWestGeo = new T(), this.areaBodyCenterGeo = new T(), this.areaBodyEastGeo = new T();
|
|
731
764
|
const o = this.hostElement;
|
|
@@ -809,14 +842,14 @@ class te {
|
|
|
809
842
|
height: `${this.scrollViewport.clientHeight}px`,
|
|
810
843
|
top: `${this.scrollTop}px`,
|
|
811
844
|
left: `${this.scrollViewport.scrollLeft}px`
|
|
812
|
-
}), this.areaBodyWestGeo.width = e.left, this.areaBodyWestGeo.height = s - e.top - e.bottom, this.areaBodyWestGeo.top = e.top, this.areaBodyWestGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyWest.parent, this.areaBodyWestGeo), this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
|
|
845
|
+
}), this.areaBodyWestGeo.width = e.left, this.areaBodyWestGeo.height = s - e.top - e.bottom, this.areaBodyWestGeo.top = e.top, this.areaBodyWestGeo.left = 0, this.dom.applyStyleInPx(this.areaBodyWest.parent, this.areaBodyWestGeo), this.tableOptions.fixedWestSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
|
|
813
846
|
this.dom.applyStyle(this.borderFixedWest, {
|
|
814
847
|
width: "1px",
|
|
815
848
|
height: `${this.areaBodyWestGeo.height}px`,
|
|
816
849
|
top: `${this.areaBodyWestGeo.top}px`,
|
|
817
850
|
left: `${this.areaBodyWestGeo.width}px`
|
|
818
851
|
})
|
|
819
|
-
) : this.dom.applyDisplayNoneStyle(this.borderFixedWest), this.areaBodyEastGeo.width = e.right, this.areaBodyEastGeo.height = s - e.top - e.bottom, this.areaBodyEastGeo.top = e.top, this.areaBodyEastGeo.left = t - e.right, this.dom.applyStyleInPx(this.areaBodyEast.parent, this.areaBodyEastGeo), this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
|
|
852
|
+
) : this.dom.applyDisplayNoneStyle(this.borderFixedWest), this.areaBodyEastGeo.width = e.right, this.areaBodyEastGeo.height = s - e.top - e.bottom, this.areaBodyEastGeo.top = e.top, this.areaBodyEastGeo.left = t - e.right, this.dom.applyStyleInPx(this.areaBodyEast.parent, this.areaBodyEastGeo), this.tableOptions.fixedEastSeparatorBorderVisible && this.tableModel.getFixedLeftColumnCount() ? this.dom.applyDisplayBlockStyle(
|
|
820
853
|
this.dom.applyStyle(this.borderFixedEast, {
|
|
821
854
|
width: "1px",
|
|
822
855
|
height: `${this.areaBodyEastGeo.height}px`,
|
|
@@ -838,7 +871,7 @@ class te {
|
|
|
838
871
|
height: `${e.top}px`,
|
|
839
872
|
top: "0",
|
|
840
873
|
left: `${t - e.right}px`
|
|
841
|
-
}), this.tableModel.isHeaderVisibe() ? this.dom.applyDisplayBlockStyle(
|
|
874
|
+
}), this.tableOptions.headerSeparatorBorderVisible && this.tableModel.isHeaderVisibe() ? this.dom.applyDisplayBlockStyle(
|
|
842
875
|
this.dom.applyStyle(this.borderHeaderBottom, {
|
|
843
876
|
width: `${t}px`,
|
|
844
877
|
height: "1px",
|
|
@@ -860,7 +893,7 @@ class te {
|
|
|
860
893
|
height: `${e.bottom}px`,
|
|
861
894
|
top: `${s - e.bottom}px`,
|
|
862
895
|
left: `${t - e.right}px`
|
|
863
|
-
}), this.tableModel.isFooterVisibe() ? this.dom.applyDisplayBlockStyle(
|
|
896
|
+
}), this.tableOptions.footerSeparatorBorderVisible && this.tableModel.isFooterVisibe() ? this.dom.applyDisplayBlockStyle(
|
|
864
897
|
this.dom.applyStyle(this.borderFooterTop, {
|
|
865
898
|
width: `${t}px`,
|
|
866
899
|
height: "1px",
|
|
@@ -872,36 +905,37 @@ class te {
|
|
|
872
905
|
adjustAfterScrolling() {
|
|
873
906
|
}
|
|
874
907
|
resetSizeOfWrapperDiv() {
|
|
875
|
-
const e = `${this.tableModel.getContentWidthInPixel()}px`, t = `${this.tableModel.getContentHeightInPixel()}px`;
|
|
908
|
+
const e = `${this.tableModel.getContentWidthInPixel()}px`, t = `${this.tableModel.getContentHeightInPixel() + 1}px`;
|
|
876
909
|
this.dom.setStyle(this.contentWrapperDiv, "width", e), this.dom.setStyle(this.contentWrapperDiv, "height", t);
|
|
877
910
|
}
|
|
878
911
|
}
|
|
879
|
-
class
|
|
880
|
-
constructor(e, t, s, i) {
|
|
881
|
-
this.r1 = e, this.c1 = t, this.r2 = s, this.c2 = i;
|
|
912
|
+
class A {
|
|
913
|
+
constructor(e, t, s, i, o = !1) {
|
|
914
|
+
this.r1 = e, this.c1 = t, this.r2 = s, this.c2 = i, this.gammaRange = o;
|
|
882
915
|
}
|
|
883
916
|
static create(e) {
|
|
884
|
-
return new
|
|
917
|
+
return e.gammaRange === void 0 && (e.gammaRange = !1), new A(
|
|
885
918
|
e.rowIndex1,
|
|
886
919
|
e.columnIndex1,
|
|
887
920
|
e.rowIndex2,
|
|
888
|
-
e.columnIndex2
|
|
921
|
+
e.columnIndex2,
|
|
922
|
+
e.gammaRange
|
|
889
923
|
);
|
|
890
924
|
}
|
|
891
925
|
static singleCell(e, t) {
|
|
892
|
-
return new
|
|
926
|
+
return new A(e, t, e, t);
|
|
893
927
|
}
|
|
894
928
|
static singleRow(e) {
|
|
895
|
-
return new
|
|
929
|
+
return new A(e, 0, e, Number.MAX_SAFE_INTEGER);
|
|
896
930
|
}
|
|
897
931
|
static singleColumn(e) {
|
|
898
|
-
return new
|
|
932
|
+
return new A(0, e, Number.MAX_SAFE_INTEGER, e);
|
|
899
933
|
}
|
|
900
934
|
isInRange(e, t) {
|
|
901
935
|
return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
|
|
902
936
|
}
|
|
903
937
|
}
|
|
904
|
-
class
|
|
938
|
+
class le {
|
|
905
939
|
constructor(e, t) {
|
|
906
940
|
this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
|
|
907
941
|
}
|
|
@@ -912,10 +946,14 @@ class se {
|
|
|
912
946
|
const e = this.areaModel.getRowCount(), t = this.tableModel.getColumnCount();
|
|
913
947
|
for (let s = 0; s < e; s++)
|
|
914
948
|
for (let i = 0; i < t; i++) {
|
|
915
|
-
let o = this.areaModel.getColspanAt(s, i),
|
|
916
|
-
(o > 1 ||
|
|
917
|
-
|
|
918
|
-
|
|
949
|
+
let o = this.areaModel.getColspanAt(s, i), r = this.areaModel.getRowspanAt(s, i);
|
|
950
|
+
if (o > 1 || r > 1) {
|
|
951
|
+
o === 0 && (o = 1), r === 0 && (r = 1);
|
|
952
|
+
const l = this.areaModel.hasOwnProperty("gammaCells");
|
|
953
|
+
this.colAndRowspanRanges.push(
|
|
954
|
+
new A(s, i, s + r - 1, i + o - 1, l)
|
|
955
|
+
);
|
|
956
|
+
}
|
|
919
957
|
}
|
|
920
958
|
}
|
|
921
959
|
getRanges() {
|
|
@@ -930,27 +968,30 @@ class se {
|
|
|
930
968
|
return !1;
|
|
931
969
|
}
|
|
932
970
|
}
|
|
933
|
-
class
|
|
971
|
+
class ne {
|
|
934
972
|
constructor(e, t, s) {
|
|
935
973
|
this.header = e, this.body = t, this.footer = s;
|
|
936
974
|
}
|
|
937
975
|
}
|
|
938
|
-
class
|
|
976
|
+
class ae extends re {
|
|
939
977
|
constructor(e, t, s, i) {
|
|
940
|
-
var
|
|
978
|
+
var r, l;
|
|
941
979
|
super(e, t, s, i), this.scrollLeft = 0, this.scrollViewportLeft = 0, this.scrollFactorY = 0, this.scrollFactorX = 0, this.cleanupFunctions = {
|
|
942
980
|
header: [],
|
|
943
981
|
body: [],
|
|
944
982
|
footer: []
|
|
945
|
-
}, this.tree = !1, this.
|
|
983
|
+
}, this.tree = !1, this.colAndRowspanModels = new ne(), this.firstVisibleRowIndex = -1, this.draggingTargetColumnIndex = -1, this.removables = [], this.editing = !1, this.tableModel.getSelectionModel ? this.getSelectionModel = this.tableModel.getSelectionModel : (r = this.tableOptions) != null && r.getSelectionModel && (this.getSelectionModel = this.tableOptions.getSelectionModel), (l = this.tableOptions) != null && l.getFocusModel && (this.getFocusModel = this.tableOptions.getFocusModel), t.getAreaModel("body") instanceof L && (this.tree = !0), ["header", "body", "footer"].forEach(
|
|
946
984
|
(n) => {
|
|
947
|
-
var
|
|
948
|
-
this.colAndRowspanModels[n] = new
|
|
985
|
+
var a;
|
|
986
|
+
this.colAndRowspanModels[n] = new le(t, t.getAreaModel(n)), (a = this.colAndRowspanModels[n]) == null || a.init();
|
|
949
987
|
}
|
|
950
988
|
);
|
|
951
989
|
}
|
|
990
|
+
isEditing() {
|
|
991
|
+
return this.editing;
|
|
992
|
+
}
|
|
952
993
|
resetEditorRenderer() {
|
|
953
|
-
this.editorRenderer = void 0, this.editorRendererRow = -1, this.editorRendererColumn = -1;
|
|
994
|
+
this.editorRenderer = void 0, this.editorRendererRow = -1, this.editorRendererColumn = -1, this.editing = !1;
|
|
954
995
|
}
|
|
955
996
|
clearSelection() {
|
|
956
997
|
if (this.getSelectionModel) {
|
|
@@ -963,32 +1004,46 @@ class oe extends te {
|
|
|
963
1004
|
let s = (i = this.tableModel.getColumnDef(t)) == null ? void 0 : i.getEditRenderer;
|
|
964
1005
|
if (s || (s = this.tableOptions.getEditRenderer), s)
|
|
965
1006
|
if (this.editorRenderer = s(e, t), this.editorRenderer) {
|
|
966
|
-
this.editorRendererRow = e, this.editorRendererColumn = t, this.repaint();
|
|
1007
|
+
this.editorRendererRow = e, this.editorRendererColumn = t, this.editing = !0, this.repaint();
|
|
967
1008
|
const o = document.querySelector("input.ge-table-cell-editor-input");
|
|
968
1009
|
o && o.focus();
|
|
969
1010
|
} else
|
|
970
|
-
this.
|
|
1011
|
+
this.resetEditorRenderer();
|
|
971
1012
|
}
|
|
972
1013
|
repaint() {
|
|
973
1014
|
this.adjustAfterScrolling();
|
|
974
1015
|
}
|
|
975
1016
|
adjustAfterScrolling() {
|
|
976
|
-
|
|
977
|
-
|
|
1017
|
+
var e;
|
|
1018
|
+
for (const t of this.removables)
|
|
1019
|
+
t.remove();
|
|
978
1020
|
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(
|
|
979
1021
|
new T(0, this.hostElement.clientWidth, 1, 0),
|
|
980
1022
|
this.hostElement,
|
|
981
|
-
"ge-table-
|
|
1023
|
+
"ge-table-border"
|
|
982
1024
|
)), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
|
|
983
1025
|
new T(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
|
|
984
1026
|
this.hostElement,
|
|
985
|
-
"ge-table-
|
|
1027
|
+
"ge-table-border"
|
|
1028
|
+
)), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
|
|
1029
|
+
new T(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
|
|
1030
|
+
this.hostElement,
|
|
1031
|
+
"ge-table-body-west-vertical-border"
|
|
1032
|
+
)), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
|
|
1033
|
+
new T(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
|
|
1034
|
+
this.hostElement,
|
|
1035
|
+
"ge-table-body-west-vertical-border"
|
|
986
1036
|
));
|
|
987
1037
|
}
|
|
988
1038
|
checkForScrollPosSaving() {
|
|
989
1039
|
var e, t;
|
|
990
1040
|
this.storeScrollPosStateService && ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.autoRestoreScrollPosition) && this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft, this.scrollTop]);
|
|
991
1041
|
}
|
|
1042
|
+
updateCells(e) {
|
|
1043
|
+
e.forEach(
|
|
1044
|
+
(t) => this.tableModel.getAreaModel(t.area).setValue(t.rowIndex, t.columnIndex, t.value)
|
|
1045
|
+
), this.repaint();
|
|
1046
|
+
}
|
|
992
1047
|
getAreaAndSideIdentByAttr(e) {
|
|
993
1048
|
if (e) {
|
|
994
1049
|
const t = this.getStringByAttr(e, "data-area"), s = this.getStringByAttr(e, "data-side");
|
|
@@ -1045,56 +1100,59 @@ class oe extends te {
|
|
|
1045
1100
|
return "";
|
|
1046
1101
|
}
|
|
1047
1102
|
adjustArea(e, t = 0) {
|
|
1048
|
-
var
|
|
1049
|
-
const s = this.getArea(e, "west"), i = this.getArea(e, "center"), o = this.getArea(e, "east"),
|
|
1103
|
+
var p;
|
|
1104
|
+
const s = this.getArea(e, "west"), i = this.getArea(e, "center"), o = this.getArea(e, "east"), r = i.child.clientHeight;
|
|
1050
1105
|
s.child.innerText = "", i.child.innerText = "", o.child.innerText = "";
|
|
1051
|
-
const
|
|
1106
|
+
const l = 0, n = this.areaBodyCenterGeo.width, a = this.tableModel.getPadding(), d = this.tableModel.getAreaModel(e), S = d.getRowCount();
|
|
1052
1107
|
for (; this.cleanupFunctions[e].length; ) {
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1108
|
+
const u = this.cleanupFunctions[e].shift();
|
|
1109
|
+
u && u();
|
|
1055
1110
|
}
|
|
1056
|
-
let
|
|
1057
|
-
const
|
|
1058
|
-
for (let
|
|
1059
|
-
const v =
|
|
1060
|
-
if (v +
|
|
1061
|
-
this.firstVisibleRowIndex =
|
|
1062
|
-
let
|
|
1063
|
-
const
|
|
1111
|
+
let g = t;
|
|
1112
|
+
const f = this.tableModel.getColumnCount(), c = this.tableModel.getFixedRightColumnCount(), b = this.tableModel.getFixedLeftColumnCount();
|
|
1113
|
+
for (let u = 0; u < S; u++) {
|
|
1114
|
+
const v = g, x = u === S - 1, C = this.tableModel.getRowHeight(e, u);
|
|
1115
|
+
if (v + C > 0) {
|
|
1116
|
+
this.firstVisibleRowIndex = u;
|
|
1117
|
+
let w = { left: l, width: n, height: C, top: v, index: u }, m = this.dom.addRowDiv(i, w, u, e, "center");
|
|
1118
|
+
const M = b;
|
|
1064
1119
|
if (this.adjustColumnsToRowParent({
|
|
1065
1120
|
areaIdent: e,
|
|
1066
1121
|
sideIdent: "center",
|
|
1067
|
-
areaModel:
|
|
1068
|
-
geo:
|
|
1069
|
-
parent:
|
|
1070
|
-
rowIndex:
|
|
1071
|
-
columnIndexStart:
|
|
1072
|
-
columnIndexEnd:
|
|
1073
|
-
verticalFixed: !1
|
|
1074
|
-
|
|
1122
|
+
areaModel: d,
|
|
1123
|
+
geo: w,
|
|
1124
|
+
parent: m,
|
|
1125
|
+
rowIndex: u,
|
|
1126
|
+
columnIndexStart: M,
|
|
1127
|
+
columnIndexEnd: f - c - 1,
|
|
1128
|
+
verticalFixed: !1,
|
|
1129
|
+
lastRowOfModel: x
|
|
1130
|
+
}), a.left > 0 && (w = { left: l, width: this.areaBodyWestGeo.width, height: C, top: v, index: u }, m = this.dom.addRowDiv(s, w, u, e, "west"), this.adjustColumnsToRowParent({
|
|
1075
1131
|
areaIdent: e,
|
|
1076
1132
|
sideIdent: "west",
|
|
1077
|
-
areaModel:
|
|
1078
|
-
geo:
|
|
1079
|
-
parent:
|
|
1080
|
-
rowIndex:
|
|
1133
|
+
areaModel: d,
|
|
1134
|
+
geo: w,
|
|
1135
|
+
parent: m,
|
|
1136
|
+
rowIndex: u,
|
|
1081
1137
|
columnIndexStart: 0,
|
|
1082
|
-
columnIndexEnd:
|
|
1083
|
-
verticalFixed: !0
|
|
1084
|
-
|
|
1138
|
+
columnIndexEnd: M - 1,
|
|
1139
|
+
verticalFixed: !0,
|
|
1140
|
+
lastRowOfModel: x
|
|
1141
|
+
})), a.right > 0 && (w = { left: l, width: this.areaBodyEastGeo.width, height: C, top: v, index: u }, m = this.dom.addRowDiv(o, w, u, e, "east"), this.adjustColumnsToRowParent({
|
|
1085
1142
|
areaIdent: e,
|
|
1086
1143
|
sideIdent: "east",
|
|
1087
|
-
areaModel:
|
|
1088
|
-
geo:
|
|
1089
|
-
parent:
|
|
1090
|
-
rowIndex:
|
|
1091
|
-
columnIndexStart:
|
|
1092
|
-
columnIndexEnd:
|
|
1093
|
-
verticalFixed: !0
|
|
1094
|
-
|
|
1144
|
+
areaModel: d,
|
|
1145
|
+
geo: w,
|
|
1146
|
+
parent: m,
|
|
1147
|
+
rowIndex: u,
|
|
1148
|
+
columnIndexStart: f - c,
|
|
1149
|
+
columnIndexEnd: f - 1,
|
|
1150
|
+
verticalFixed: !0,
|
|
1151
|
+
lastRowOfModel: x
|
|
1152
|
+
})), e === "header" && this.tree && u === S - 1) {
|
|
1095
1153
|
const E = this.dom.applyStyle(
|
|
1096
1154
|
this.dom.setAttribute(
|
|
1097
|
-
this.dom.addDiv(
|
|
1155
|
+
this.dom.addDiv(m, new T(16, 20, 20, 8)),
|
|
1098
1156
|
"data-ge-action",
|
|
1099
1157
|
"toggleExpandCollapseAll"
|
|
1100
1158
|
),
|
|
@@ -1106,95 +1164,157 @@ class oe extends te {
|
|
|
1106
1164
|
}
|
|
1107
1165
|
}
|
|
1108
1166
|
}
|
|
1109
|
-
if (
|
|
1167
|
+
if (g = g + C, g > r)
|
|
1110
1168
|
break;
|
|
1111
1169
|
}
|
|
1112
1170
|
if (this.colAndRowspanModels && this.colAndRowspanModels[e]) {
|
|
1113
|
-
const
|
|
1114
|
-
if (
|
|
1115
|
-
for (const v of
|
|
1116
|
-
let x = 0,
|
|
1117
|
-
if (v.c1 <
|
|
1118
|
-
|
|
1119
|
-
else if (
|
|
1120
|
-
|
|
1171
|
+
const u = ((p = this.colAndRowspanModels[e]) == null ? void 0 : p.getRanges()) ?? [];
|
|
1172
|
+
if (u.length)
|
|
1173
|
+
for (const v of u) {
|
|
1174
|
+
let x = 0, C = i.child, w = "center";
|
|
1175
|
+
if (v.c1 < b)
|
|
1176
|
+
C = s.child, w = "west";
|
|
1177
|
+
else if (c > 0 && v.c1 >= f - c)
|
|
1178
|
+
C = o.child, w = "east";
|
|
1121
1179
|
else {
|
|
1122
|
-
const
|
|
1123
|
-
x = this.scrollFactorX *
|
|
1180
|
+
const m = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1181
|
+
x = this.scrollFactorX * m - this.areaBodyWestGeo.width, w = "center";
|
|
1124
1182
|
}
|
|
1125
|
-
this.drawBigCell(v, x, t,
|
|
1183
|
+
this.drawBigCell(v, x, t, d, C, w);
|
|
1126
1184
|
}
|
|
1127
1185
|
}
|
|
1128
1186
|
}
|
|
1129
1187
|
/**
|
|
1130
1188
|
* Draws big cells (rowspan and or colspan) in body/center
|
|
1131
|
-
* @param range
|
|
1189
|
+
* @param range CellRange
|
|
1132
1190
|
* @param xStart X position in pixel for top left corner
|
|
1133
1191
|
* @param yStart Y position in pixel for top left corner
|
|
1134
1192
|
* @param areaModel AreaModelIf
|
|
1135
1193
|
* @param parentDiv Parent div as HTMLDivElement
|
|
1194
|
+
* @param sideIdent SideIdent (west,center,east)
|
|
1136
1195
|
* @protected
|
|
1137
1196
|
*/
|
|
1138
|
-
drawBigCell(e, t, s, i, o) {
|
|
1139
|
-
const l = s + this.getRowHeights(0, e.r1 - 1, i).reduce((
|
|
1197
|
+
drawBigCell(e, t, s, i, o, r) {
|
|
1198
|
+
const l = s + this.getRowHeights(0, e.r1 - 1, i).reduce((p, u) => p + u, 0), n = this.tableModel.getColumnCount(), a = this.tableModel.getFixedRightColumnCount();
|
|
1140
1199
|
let d = 0;
|
|
1141
|
-
|
|
1142
|
-
const
|
|
1200
|
+
a > 0 && e.c1 >= n - a && (d = n - a);
|
|
1201
|
+
const S = t + this.getColumnWidths(d, e.c1 - 1).reduce((p, u) => p + u, 0), g = this.getRowHeights(e.r1, e.r2, i).reduce((p, u) => p + u, 0), f = this.getColumnWidths(e.c1, e.c2).reduce((p, u) => p + u, 0);
|
|
1143
1202
|
let c = !1;
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1203
|
+
const b = this.getSelectionModel ? this.getSelectionModel() : void 0;
|
|
1204
|
+
b && (c = b.getSelectionCount(e.r1, e.c1) > 0), e.gammaRange ? (console.info("TODO here", e), this.renderCell({
|
|
1205
|
+
areaModel: i,
|
|
1206
|
+
areaIdent: i.areaIdent,
|
|
1207
|
+
sideIdent: r,
|
|
1208
|
+
rowIndex: e.r1,
|
|
1209
|
+
columnIndex: e.c1,
|
|
1210
|
+
left: S,
|
|
1211
|
+
top: l,
|
|
1212
|
+
width: f,
|
|
1213
|
+
height: g,
|
|
1214
|
+
parent: o,
|
|
1215
|
+
cellSelected: c,
|
|
1216
|
+
lastRowOfModel: !0,
|
|
1217
|
+
gammaRange: e.gammaRange
|
|
1218
|
+
})) : this.renderCell({
|
|
1219
|
+
areaModel: i,
|
|
1220
|
+
areaIdent: i.areaIdent,
|
|
1221
|
+
sideIdent: r,
|
|
1222
|
+
rowIndex: e.r1,
|
|
1223
|
+
columnIndex: e.c1,
|
|
1224
|
+
left: S,
|
|
1225
|
+
top: l,
|
|
1226
|
+
width: f,
|
|
1227
|
+
height: g,
|
|
1228
|
+
parent: o,
|
|
1229
|
+
cellSelected: c,
|
|
1230
|
+
lastRowOfModel: !0,
|
|
1231
|
+
gammaRange: e.gammaRange
|
|
1232
|
+
}), i.areaIdent === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
1233
|
+
rowIndex: e.r1,
|
|
1234
|
+
columnIndex: e.c1,
|
|
1235
|
+
cellLeft: S,
|
|
1236
|
+
cellTop: l,
|
|
1237
|
+
cellWidth: f,
|
|
1238
|
+
cellHeight: g,
|
|
1239
|
+
parent: o
|
|
1240
|
+
});
|
|
1146
1241
|
}
|
|
1147
1242
|
findRowOfImportantRowspanCell(e, t, s) {
|
|
1148
1243
|
const i = e.getMaxRowspan();
|
|
1149
1244
|
for (let o = t - 1; o > -1; o--) {
|
|
1150
|
-
const
|
|
1151
|
-
if (
|
|
1245
|
+
const r = e.getRowspanAt(o, s);
|
|
1246
|
+
if (r > 1 && o + r + 1 >= t)
|
|
1152
1247
|
return o;
|
|
1153
1248
|
if (t - o > i)
|
|
1154
1249
|
return -1;
|
|
1155
1250
|
}
|
|
1156
1251
|
return -1;
|
|
1157
1252
|
}
|
|
1158
|
-
// TODO skip cols in header because of colspan
|
|
1159
1253
|
adjustColumnsToRowParent({
|
|
1160
1254
|
areaIdent: e,
|
|
1161
1255
|
sideIdent: t,
|
|
1162
1256
|
areaModel: s,
|
|
1163
1257
|
geo: i,
|
|
1164
1258
|
parent: o,
|
|
1165
|
-
rowIndex:
|
|
1166
|
-
columnIndexStart:
|
|
1259
|
+
rowIndex: r,
|
|
1260
|
+
columnIndexStart: l,
|
|
1167
1261
|
columnIndexEnd: n,
|
|
1168
|
-
verticalFixed:
|
|
1262
|
+
verticalFixed: a = !1,
|
|
1263
|
+
lastRowOfModel: d = !1
|
|
1169
1264
|
}) {
|
|
1170
|
-
var
|
|
1265
|
+
var b;
|
|
1171
1266
|
this.scrollViewportLeft = this.scrollViewport.scrollLeft;
|
|
1172
|
-
let
|
|
1173
|
-
if (!
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1267
|
+
let S = 0;
|
|
1268
|
+
if (!a) {
|
|
1269
|
+
const p = this.areaBodyCenterGeo.width - this.tableModel.getContentWidthInPixel();
|
|
1270
|
+
S = this.scrollFactorX * p;
|
|
1176
1271
|
}
|
|
1177
|
-
const
|
|
1178
|
-
let c =
|
|
1179
|
-
for (let
|
|
1180
|
-
const
|
|
1181
|
-
if (
|
|
1182
|
-
let
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1272
|
+
const g = 0, f = !!(e === "body" && t);
|
|
1273
|
+
let c = S;
|
|
1274
|
+
for (let p = l; p <= n; p++) {
|
|
1275
|
+
const u = c, v = this.tableModel.getColumnWidth(p);
|
|
1276
|
+
if (v > 0 && u + v > 0) {
|
|
1277
|
+
let x = i.height;
|
|
1278
|
+
const C = s.getRowspanAt(r, p), w = s.getColspanAt(r, p);
|
|
1279
|
+
C > 1 && (x = this.getRowHeights(r, r + C - 1, s).reduce((E, R) => E + R, 0));
|
|
1280
|
+
let m = v;
|
|
1281
|
+
w > 1 && (m = this.getColumnWidths(p, p + w - 1).reduce((E, R) => E + R, 0));
|
|
1282
|
+
let M = !1;
|
|
1283
|
+
if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (b = this.colAndRowspanModels[e]) != null && b.isInRange(r, p) && (M = !0), this.draggingTargetColumnIndex === p && e !== "header") {
|
|
1284
|
+
this.renderDragTargetDiv(o, u, g, m, x);
|
|
1285
|
+
const E = { left: u, top: g, width: m, height: x };
|
|
1286
|
+
this.dom.addColumnBorderDivs(this.tableOptions, o, E, e, t);
|
|
1287
|
+
} else {
|
|
1288
|
+
const E = this.renderSelectedBackgroundDiv(M, f, t, s, r, p, o, u, g, m, x);
|
|
1289
|
+
M || this.renderCell({
|
|
1290
|
+
areaModel: s,
|
|
1291
|
+
areaIdent: e,
|
|
1292
|
+
sideIdent: t,
|
|
1293
|
+
rowIndex: r,
|
|
1294
|
+
columnIndex: p,
|
|
1295
|
+
left: u,
|
|
1296
|
+
top: g,
|
|
1297
|
+
width: m,
|
|
1298
|
+
height: x,
|
|
1299
|
+
parent: o,
|
|
1300
|
+
cellSelected: E,
|
|
1301
|
+
lastRowOfModel: d,
|
|
1302
|
+
gammaRange: !0
|
|
1303
|
+
}), e === "header" && this.tableOptions.columnsResizable && this.renderHeaderCellResizeHandle({
|
|
1304
|
+
rowIndex: r,
|
|
1305
|
+
columnIndex: p,
|
|
1306
|
+
cellLeft: u,
|
|
1307
|
+
cellTop: g,
|
|
1308
|
+
cellWidth: m,
|
|
1309
|
+
cellHeight: x,
|
|
1310
|
+
parent: o
|
|
1311
|
+
});
|
|
1192
1312
|
}
|
|
1193
1313
|
}
|
|
1194
|
-
if (c = c +
|
|
1314
|
+
if (c = c + v, c > this.areaBodyCenterGeo.width)
|
|
1195
1315
|
break;
|
|
1196
1316
|
}
|
|
1197
|
-
this.dom.addVerticalBorder(new T(c - 1, 1, i.height, 0), o);
|
|
1317
|
+
this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new T(c - 1, 1, i.height, 0), o);
|
|
1198
1318
|
}
|
|
1199
1319
|
getTreeArrowColumnIndex() {
|
|
1200
1320
|
return this.tableOptions.showCheckboxWihoutExtraColumn ? 0 : this.tableModel.isRowCheckboxVisible() ? 1 : 0;
|
|
@@ -1202,38 +1322,57 @@ class oe extends te {
|
|
|
1202
1322
|
addAndRenderCellDiv({
|
|
1203
1323
|
areaModel: e,
|
|
1204
1324
|
areaIdent: t,
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1325
|
+
sideIdent: s,
|
|
1326
|
+
rowIndex: i,
|
|
1327
|
+
index: o,
|
|
1328
|
+
left: r,
|
|
1208
1329
|
width: l,
|
|
1209
|
-
height:
|
|
1210
|
-
top:
|
|
1211
|
-
parent: d
|
|
1330
|
+
height: n,
|
|
1331
|
+
top: a,
|
|
1332
|
+
parent: d,
|
|
1333
|
+
lastRowOfModel: S
|
|
1212
1334
|
}) {
|
|
1213
|
-
var
|
|
1214
|
-
const
|
|
1215
|
-
let
|
|
1216
|
-
if (
|
|
1217
|
-
const
|
|
1218
|
-
(
|
|
1335
|
+
var _;
|
|
1336
|
+
const f = this.editorRenderer && this.editorRendererRow === i && this.editorRendererColumn === o ? this.editorRenderer : e.getCellRenderer(i, o), c = { left: r, width: l, height: n, top: a, index: o }, b = e.getRowByIndex(i);
|
|
1337
|
+
let p = "none";
|
|
1338
|
+
if (o === this.getTreeArrowColumnIndex() && b instanceof O) {
|
|
1339
|
+
const y = b;
|
|
1340
|
+
(_ = y.children) != null && _.length ? y.expanded ? p = "expanded" : p = "collapsed" : p = "hidden";
|
|
1219
1341
|
}
|
|
1220
|
-
let
|
|
1342
|
+
let v;
|
|
1221
1343
|
if (t === "header") {
|
|
1222
|
-
const
|
|
1223
|
-
(!(
|
|
1344
|
+
const y = this.tableModel.getColumnDef(o);
|
|
1345
|
+
(!(y != null && y.sortIconVisible) || y != null && y.sortIconVisible()) && (v = y == null ? void 0 : y.sortState);
|
|
1224
1346
|
}
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1347
|
+
const x = e.getValueAt(i, o), C = f ? "" : `${x}`, w = e.isRowChecked(i), m = this.dom.addColumnDiv(
|
|
1348
|
+
d,
|
|
1349
|
+
c,
|
|
1350
|
+
i,
|
|
1351
|
+
o,
|
|
1352
|
+
t,
|
|
1353
|
+
s,
|
|
1354
|
+
C,
|
|
1355
|
+
p,
|
|
1356
|
+
this.tableOptions,
|
|
1357
|
+
w,
|
|
1358
|
+
v
|
|
1359
|
+
), M = e.getTooltipAt(i, o);
|
|
1360
|
+
M && this.dom.setAttribute(m, "title", M);
|
|
1361
|
+
const E = this.tableModel.getColumnDef(o);
|
|
1362
|
+
E && E.classes[t] && this.dom.addClasses(E.classes[t], m);
|
|
1363
|
+
let R;
|
|
1364
|
+
f && (R = f.render(m, i, o, t, e, x, this.dom.domService));
|
|
1365
|
+
const D = e.getCustomClassesAt(i, o);
|
|
1366
|
+
if (D.length && this.dom.addClasses(D, m), this.dom.addColumnBorderDivs(this.tableOptions, d, c, t, s), S && this.dom.addHorizontalBorder({ left: r, width: l, height: n, top: a + n }, d), this.getFocusModel && t === "body") {
|
|
1367
|
+
const y = this.getFocusModel();
|
|
1368
|
+
y != null && y.hasFocus(i, o) && this.dom.addFocusBorderDivs(d, c, {});
|
|
1235
1369
|
}
|
|
1236
|
-
|
|
1370
|
+
t === "header" && this.dom.setAttribute(m, "data-ge-action", "drag-column");
|
|
1371
|
+
const F = e.getCustomStyleAt(i, o);
|
|
1372
|
+
if (F)
|
|
1373
|
+
for (const y in F)
|
|
1374
|
+
this.dom.setStyle(m, y, F[y]);
|
|
1375
|
+
return [m, R];
|
|
1237
1376
|
}
|
|
1238
1377
|
getColumnWidths(e, t) {
|
|
1239
1378
|
const s = [];
|
|
@@ -1267,9 +1406,9 @@ class oe extends te {
|
|
|
1267
1406
|
}
|
|
1268
1407
|
adjustHoverColumns(e) {
|
|
1269
1408
|
if (this.tableOptions.hoverColumnVisible && e.rowIndex > -1) {
|
|
1270
|
-
const t = this.hostElement.clientHeight, s = this.tableModel.getColumnWidth(e.columnIndex), i = e.columnLeft + this.tableModel.getPadding().left - this.scrollLeft;
|
|
1409
|
+
const t = this.hostElement.clientHeight, s = this.tableModel.getColumnWidth(e.columnIndex), i = this.areaBodyWestGeo.width, o = e.columnLeft + this.tableModel.getPadding().left - this.scrollLeft - i;
|
|
1271
1410
|
this.dom.applyStyle(this.hoverColumn, {
|
|
1272
|
-
left:
|
|
1411
|
+
left: o + "px",
|
|
1273
1412
|
top: "0px",
|
|
1274
1413
|
width: s + "px",
|
|
1275
1414
|
height: t + "px",
|
|
@@ -1287,53 +1426,71 @@ class oe extends te {
|
|
|
1287
1426
|
this.debounceTimeout && clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(e.bind(this), t);
|
|
1288
1427
|
}
|
|
1289
1428
|
renderDragTargetDiv(e, t, s, i, o) {
|
|
1290
|
-
const
|
|
1429
|
+
const r = this.dom.applyStylePosistionAbsolute(
|
|
1291
1430
|
this.dom.createDivWithClass("ge-table-drop-zone", e)
|
|
1292
1431
|
);
|
|
1293
|
-
return this.dom.setStyle(
|
|
1294
|
-
}
|
|
1295
|
-
renderSelectedBackgroundDiv(e, t, s, i, o,
|
|
1296
|
-
let
|
|
1297
|
-
if (!e && t &&
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
const c =
|
|
1301
|
-
|
|
1302
|
-
for (let
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1432
|
+
return this.dom.setStyle(r, "left", `${t}px`), this.dom.setStyle(r, "top", `${s}px`), this.dom.setStyle(r, "width", `${i}px`), this.dom.setStyle(r, "height", `${o}px`), r;
|
|
1433
|
+
}
|
|
1434
|
+
renderSelectedBackgroundDiv(e, t, s, i, o, r, l, n, a, d, S) {
|
|
1435
|
+
let g = !1;
|
|
1436
|
+
if (!e && t && i.isSelectable(o, r) && this.getSelectionModel) {
|
|
1437
|
+
const f = this.getSelectionModel();
|
|
1438
|
+
if (f) {
|
|
1439
|
+
const c = f.getSelectionCount(o, r);
|
|
1440
|
+
g = c > 0;
|
|
1441
|
+
for (let b = 0; b < c; b++) {
|
|
1442
|
+
const p = this.dom.applyStylePosistionAbsolute(
|
|
1443
|
+
// ge-table-body-west-selected-range
|
|
1444
|
+
this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`, l)
|
|
1305
1445
|
);
|
|
1306
|
-
this.dom.setStyle(
|
|
1446
|
+
this.dom.setStyle(p, "left", `${n}px`), this.dom.setStyle(p, "top", `${a}px`), this.dom.setStyle(p, "width", `${d}px`), this.dom.setStyle(p, "height", `${S}px`);
|
|
1307
1447
|
}
|
|
1308
1448
|
}
|
|
1309
1449
|
}
|
|
1310
|
-
return
|
|
1450
|
+
return g;
|
|
1311
1451
|
}
|
|
1312
|
-
renderCell(
|
|
1313
|
-
|
|
1452
|
+
renderCell({
|
|
1453
|
+
areaModel: e,
|
|
1454
|
+
areaIdent: t,
|
|
1455
|
+
sideIdent: s,
|
|
1456
|
+
rowIndex: i,
|
|
1457
|
+
columnIndex: o,
|
|
1458
|
+
left: r,
|
|
1459
|
+
top: l,
|
|
1460
|
+
width: n,
|
|
1461
|
+
height: a,
|
|
1462
|
+
parent: d,
|
|
1463
|
+
cellSelected: S,
|
|
1464
|
+
lastRowOfModel: g,
|
|
1465
|
+
gammaRange: f
|
|
1466
|
+
}) {
|
|
1467
|
+
const [c, b] = this.addAndRenderCellDiv({
|
|
1314
1468
|
areaModel: e,
|
|
1315
1469
|
areaIdent: t,
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1470
|
+
sideIdent: s,
|
|
1471
|
+
rowIndex: i,
|
|
1472
|
+
index: o,
|
|
1473
|
+
left: r,
|
|
1474
|
+
width: n,
|
|
1475
|
+
height: a,
|
|
1321
1476
|
top: l,
|
|
1322
|
-
parent: d
|
|
1477
|
+
parent: d,
|
|
1478
|
+
lastRowOfModel: g,
|
|
1479
|
+
gammaRange: f
|
|
1323
1480
|
});
|
|
1324
|
-
|
|
1481
|
+
S && this.dom.addClass(`ge-table-${t}-${s}-selected-range`, c), b && this.cleanupFunctions[t].push(b);
|
|
1325
1482
|
}
|
|
1326
|
-
renderHeaderCellResizeHandle(e, t, s, i, o,
|
|
1327
|
-
const n = this.dom.domService,
|
|
1328
|
-
n.setAttribute(
|
|
1483
|
+
renderHeaderCellResizeHandle({ rowIndex: e, columnIndex: t, cellLeft: s, cellTop: i, cellWidth: o, cellHeight: r, parent: l }) {
|
|
1484
|
+
const n = this.dom.domService, a = this.tableOptions.columnResizeHandleWidthInPx ?? 2, d = n.createElement("div");
|
|
1485
|
+
n.setAttribute(d, "data-col-index", `${t}`), n.setAttribute(d, "data-row-index", `${e}`), n.setAttribute(d, "data-area", "header"), n.setAttribute(d, "data-ge-action", "resize-column"), n.addClass(d, "ge-table-column-resize-handle"), n.setStyle(d, "display", "clip"), n.setStyle(d, "position", "absolute"), n.setStyle(d, "cursor", "col-resize"), n.setStyle(d, "left", `${s + o - a}px`), n.setStyle(d, "top", `${i}px`), n.setStyle(d, "width", `${a}px`), n.setStyle(d, "height", `${r}px`), n.appendChild(l, d);
|
|
1329
1486
|
}
|
|
1330
1487
|
}
|
|
1331
|
-
class
|
|
1488
|
+
class de {
|
|
1332
1489
|
constructor(e, t) {
|
|
1333
1490
|
this.columnIndex = e, this.sortState = t;
|
|
1334
1491
|
}
|
|
1335
1492
|
}
|
|
1336
|
-
class
|
|
1493
|
+
class he {
|
|
1337
1494
|
constructor(e) {
|
|
1338
1495
|
this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
|
|
1339
1496
|
}
|
|
@@ -1341,36 +1498,36 @@ class le {
|
|
|
1341
1498
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement || e.target instanceof HTMLTextAreaElement) {
|
|
1342
1499
|
const t = e.target, s = t.getAttribute("data-area"), i = t.getAttribute("data-row-index"), o = t.getAttribute("data-col-index");
|
|
1343
1500
|
if (s && i && o) {
|
|
1344
|
-
const
|
|
1345
|
-
this.tableScope.
|
|
1501
|
+
const r = $(s), l = Number(i), n = Number(o);
|
|
1502
|
+
this.tableScope.updateModelValueAfterEdit(r, l, n, t.value);
|
|
1346
1503
|
}
|
|
1347
1504
|
}
|
|
1348
1505
|
}
|
|
1349
1506
|
}
|
|
1350
|
-
class
|
|
1507
|
+
class ce {
|
|
1351
1508
|
constructor(e = -1, t = -1) {
|
|
1352
1509
|
this.rowIndex = e, this.columnIndex = t;
|
|
1353
1510
|
}
|
|
1354
1511
|
}
|
|
1355
|
-
class
|
|
1512
|
+
class V {
|
|
1356
1513
|
constructor(e) {
|
|
1357
1514
|
this.cells = e;
|
|
1358
1515
|
}
|
|
1359
1516
|
static createSingle(e, t) {
|
|
1360
|
-
return new
|
|
1517
|
+
return new V([new ce(e, t)]);
|
|
1361
1518
|
}
|
|
1362
1519
|
}
|
|
1363
|
-
class
|
|
1520
|
+
class pe {
|
|
1364
1521
|
constructor(e) {
|
|
1365
1522
|
var t, s;
|
|
1366
1523
|
this.tableScope = e, (t = this.tableScope.tableOptions) != null && t.getSelectionModel && (this.getSelectionModel = this.tableScope.tableOptions.getSelectionModel), (s = this.tableScope.tableOptions) != null && s.getFocusModel && (this.getFocusModel = this.tableScope.tableOptions.getFocusModel);
|
|
1367
1524
|
}
|
|
1368
1525
|
onMouseClicked(e, t) {
|
|
1369
|
-
var o,
|
|
1526
|
+
var o, r, l, n, a, d, S;
|
|
1370
1527
|
let s = !1, i = !1;
|
|
1371
1528
|
if (this.getSelectionModel && this.getFocusModel) {
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1529
|
+
const g = this.getSelectionModel(), f = this.getFocusModel();
|
|
1530
|
+
g && f && (f.hasFocus(e.rowIndex, e.columnIndex) || (f.setFocus(e.rowIndex, e.columnIndex), s = !0), (o = e.originalEvent) != null && o.shiftKey || g.hasSelection() && (g.clear(), s = !0), (r = e.originalEvent) != null && r.shiftKey && this.previousEvt ? (g.addSelection(this.createRangeByEvents(e, this.previousEvt)), i = !0, s = !0) : (l = e.originalEvent) != null && l.ctrlKey || (n = e.originalEvent) != null && n.metaKey ? (g.addSelection(A.singleCell(e.rowIndex, e.columnIndex)), i = !0, s = !0) : (a = e.originalEvent) != null && a.altKey && ((d = e.originalEvent) != null && d.ctrlKey || (S = e.originalEvent) != null && S.metaKey) && (g.removeSelection(A.singleCell(e.rowIndex, e.columnIndex)), i = !0, s = !0));
|
|
1374
1531
|
}
|
|
1375
1532
|
return i ? this.previousEvt = void 0 : this.previousEvt = e == null ? void 0 : e.clone(), s;
|
|
1376
1533
|
}
|
|
@@ -1392,16 +1549,16 @@ class ae {
|
|
|
1392
1549
|
}
|
|
1393
1550
|
createRangeByEvents(e, t) {
|
|
1394
1551
|
t || (t = e);
|
|
1395
|
-
const s = Math.min(e.rowIndex, t == null ? void 0 : t.rowIndex), i = Math.max(e.rowIndex, t == null ? void 0 : t.rowIndex), o = Math.min(e.columnIndex, t == null ? void 0 : t.columnIndex),
|
|
1396
|
-
return
|
|
1552
|
+
const s = Math.min(e.rowIndex, t == null ? void 0 : t.rowIndex), i = Math.max(e.rowIndex, t == null ? void 0 : t.rowIndex), o = Math.min(e.columnIndex, t == null ? void 0 : t.columnIndex), r = Math.max(e.columnIndex, t == null ? void 0 : t.columnIndex);
|
|
1553
|
+
return A.create({
|
|
1397
1554
|
rowIndex1: s,
|
|
1398
1555
|
columnIndex1: o,
|
|
1399
1556
|
rowIndex2: i,
|
|
1400
|
-
columnIndex2:
|
|
1557
|
+
columnIndex2: r
|
|
1401
1558
|
});
|
|
1402
1559
|
}
|
|
1403
1560
|
}
|
|
1404
|
-
class
|
|
1561
|
+
class ue {
|
|
1405
1562
|
get() {
|
|
1406
1563
|
return {
|
|
1407
1564
|
f2: "START_EDITING",
|
|
@@ -1411,11 +1568,15 @@ class de {
|
|
|
1411
1568
|
"ctrl+shift+a": "DESELECT_ALL",
|
|
1412
1569
|
"ctrl+x": "DESELECT_ALL",
|
|
1413
1570
|
"ctrl+num_subtract": "DESELECT_ALL",
|
|
1414
|
-
"cmd -": "DESELECT_ALL"
|
|
1571
|
+
"cmd -": "DESELECT_ALL",
|
|
1572
|
+
arrowup: "NAVIGATE_UP",
|
|
1573
|
+
arrowdown: "NAVIGATE_DOWN",
|
|
1574
|
+
arrowleft: "NAVIGATE_LEFT",
|
|
1575
|
+
arrowright: "NAVIGATE_RIGHT"
|
|
1415
1576
|
};
|
|
1416
1577
|
}
|
|
1417
1578
|
}
|
|
1418
|
-
class
|
|
1579
|
+
class Se {
|
|
1419
1580
|
get() {
|
|
1420
1581
|
return {
|
|
1421
1582
|
f2: "START_EDITING",
|
|
@@ -1427,11 +1588,15 @@ class he {
|
|
|
1427
1588
|
"cmd+shift+a": "DESELECT_ALL",
|
|
1428
1589
|
"ctrl+shift+a": "DESELECT_ALL",
|
|
1429
1590
|
"ctrl+num_subtract": "DESELECT_ALL",
|
|
1430
|
-
"ctrl -": "DESELECT_ALL"
|
|
1591
|
+
"ctrl -": "DESELECT_ALL",
|
|
1592
|
+
arrowup: "NAVIGATE_UP",
|
|
1593
|
+
arrowdown: "NAVIGATE_DOWN",
|
|
1594
|
+
arrowleft: "NAVIGATE_LEFT",
|
|
1595
|
+
arrowright: "NAVIGATE_RIGHT"
|
|
1431
1596
|
};
|
|
1432
1597
|
}
|
|
1433
1598
|
}
|
|
1434
|
-
class
|
|
1599
|
+
class ge {
|
|
1435
1600
|
constructor(e) {
|
|
1436
1601
|
this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
|
|
1437
1602
|
}
|
|
@@ -1439,20 +1604,23 @@ class ce {
|
|
|
1439
1604
|
this.listener.includes(e) || this.listener.push(e);
|
|
1440
1605
|
}
|
|
1441
1606
|
init() {
|
|
1442
|
-
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new
|
|
1607
|
+
this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new Se().get()) : Object.assign(this.shortcutActionIdMapping, new ue().get()), Object.assign(this.shortcutActionIdMapping, this.tableScope.tableOptions.shortcutActionIdMapping), this.isDebug() && console.debug("ShortcutService", this.shortcutActionIdMapping), this.tableScope.hostElement.addEventListener("keydown", this.onKeyDown.bind(this));
|
|
1443
1608
|
}
|
|
1444
1609
|
isMacintosh() {
|
|
1445
1610
|
return navigator.platform.indexOf("Mac") > -1;
|
|
1446
1611
|
}
|
|
1612
|
+
isDebug() {
|
|
1613
|
+
return this.isLocalhost();
|
|
1614
|
+
}
|
|
1447
1615
|
isLocalhost() {
|
|
1448
1616
|
return location.hostname === "localhost" || location.hostname === "127.0.0.1";
|
|
1449
1617
|
}
|
|
1450
1618
|
onKeyDown(e) {
|
|
1451
1619
|
const t = this.findEnty(e);
|
|
1452
|
-
t && this.emit(t) && e.preventDefault();
|
|
1620
|
+
t && this.emit(t) && (e.preventDefault(), e.stopPropagation());
|
|
1453
1621
|
}
|
|
1454
1622
|
emit(e) {
|
|
1455
|
-
this.
|
|
1623
|
+
this.isDebug() && console.debug("ShortcutService emit:", e);
|
|
1456
1624
|
let t = !1;
|
|
1457
1625
|
for (const s of this.listener)
|
|
1458
1626
|
s.onActionTriggered(e) && (t = !0);
|
|
@@ -1460,6 +1628,7 @@ class ce {
|
|
|
1460
1628
|
}
|
|
1461
1629
|
findEnty(e) {
|
|
1462
1630
|
const t = this.getTokenByEvent(e);
|
|
1631
|
+
this.isDebug() && console.debug("ShortcutService tokens:", t);
|
|
1463
1632
|
for (const s in this.shortcutActionIdMapping) {
|
|
1464
1633
|
const i = s.replace(/opt/g, "alt").replace(/cmd/g, "meta").split(/[\+ ]/g).sort();
|
|
1465
1634
|
if (this.areTokensEquals(t, i))
|
|
@@ -1479,7 +1648,7 @@ class ce {
|
|
|
1479
1648
|
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();
|
|
1480
1649
|
}
|
|
1481
1650
|
}
|
|
1482
|
-
class
|
|
1651
|
+
class fe {
|
|
1483
1652
|
onCheckboxChanged(e) {
|
|
1484
1653
|
}
|
|
1485
1654
|
onContextmenu(e) {
|
|
@@ -1495,32 +1664,35 @@ class pe {
|
|
|
1495
1664
|
onMouseMoved(e) {
|
|
1496
1665
|
}
|
|
1497
1666
|
}
|
|
1498
|
-
class
|
|
1667
|
+
class me extends ae {
|
|
1499
1668
|
constructor(e, t, s, i, o) {
|
|
1500
|
-
var
|
|
1669
|
+
var r;
|
|
1501
1670
|
if (super(
|
|
1502
1671
|
e,
|
|
1503
1672
|
t,
|
|
1504
|
-
new
|
|
1673
|
+
new Y(s),
|
|
1505
1674
|
i
|
|
1506
|
-
), this.eventListener = o, this.selectionService = new
|
|
1507
|
-
const
|
|
1508
|
-
n && (
|
|
1675
|
+
), this.eventListener = o, this.selectionService = new pe(this), this.api = new J(this), this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, o || (this.eventListener = new fe()), (r = this.tableOptions) != null && r.autoRestoreOptions) {
|
|
1676
|
+
const l = this.tableOptions.autoRestoreOptions, n = l.getStorageKeyFn;
|
|
1677
|
+
n && (l.autoRestoreScrollPosition && (this.storeScrollPosStateService = new te(n)), l.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new ie(n)), l.autoRestoreSortingState && (this.storeSortingService = new oe(n)));
|
|
1509
1678
|
}
|
|
1510
|
-
this.mouseHandler = new
|
|
1679
|
+
this.mouseHandler = new U(this), this.inputHandler = new he(this), this.shortcutService = new ge(this), this.shortcutService.addListener(this.selectionService);
|
|
1511
1680
|
}
|
|
1512
1681
|
onActionTriggered(e) {
|
|
1682
|
+
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))
|
|
1683
|
+
return !0;
|
|
1513
1684
|
if (e === "START_EDITING" && this.getFocusModel) {
|
|
1514
1685
|
const t = this.getFocusModel();
|
|
1515
1686
|
if (t) {
|
|
1516
1687
|
const [s, i] = t.getFocus();
|
|
1517
1688
|
this.tableModel.getBodyModel().isEditable(s, i) && (this.clearSelection(), this.initRenderEditor(s, i));
|
|
1518
1689
|
}
|
|
1690
|
+
return !0;
|
|
1519
1691
|
}
|
|
1520
1692
|
return !1;
|
|
1521
1693
|
}
|
|
1522
|
-
|
|
1523
|
-
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, i
|
|
1694
|
+
updateModelValueAfterEdit(e, t, s, i) {
|
|
1695
|
+
e === "body" && this.tableModel.getAreaModel(e).setValue(t, s, i) && (this.resetEditorRenderer(), this.repaint(), this.eventListener.onModelChanged(V.createSingle(t, s)), this.hostElement.focus());
|
|
1524
1696
|
}
|
|
1525
1697
|
getApi() {
|
|
1526
1698
|
return this.api;
|
|
@@ -1529,13 +1701,14 @@ class ue extends oe {
|
|
|
1529
1701
|
* Called by the table component
|
|
1530
1702
|
*/
|
|
1531
1703
|
firstInit() {
|
|
1532
|
-
|
|
1704
|
+
var e;
|
|
1705
|
+
this.tableModel.init(), (e = this.tableOptions) != null && e.externalFilterFunction && this.externalFilterChanged(!1), this.autoRestoreCollapsedExpandedState(), this.autoRestoreSortingState(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.autoRestoreScrollPosition();
|
|
1533
1706
|
}
|
|
1534
1707
|
createGeMouseEvent(e) {
|
|
1535
|
-
const t = new
|
|
1708
|
+
const t = new B();
|
|
1536
1709
|
if (t.originalEvent = e, e) {
|
|
1537
1710
|
const s = e.target;
|
|
1538
|
-
if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(s), t.rowIndex = this.getNumberByAttr(s, "data-row-index"), t.columnIndex = this.getNumberByAttr(s, "data-col-index"), t.action = this.getStringByAttr(s, "data-ge-action"),
|
|
1711
|
+
if ([t.areaIdent, t.sideIdent] = this.getAreaAndSideIdentByAttr(s), t.rowIndex = this.getNumberByAttr(s, "data-row-index"), t.columnIndex = this.getNumberByAttr(s, "data-col-index"), t.action = this.getStringByAttr(s, "data-ge-action"), t.areaIdent) {
|
|
1539
1712
|
const i = this.tableModel.getAreaModel(t.areaIdent);
|
|
1540
1713
|
t.rowTop = i.getYPosByRowIndex(t.rowIndex);
|
|
1541
1714
|
}
|
|
@@ -1555,9 +1728,6 @@ class ue extends oe {
|
|
|
1555
1728
|
mouseDraggingEndOnFrame(e) {
|
|
1556
1729
|
this.eventListener.onMouseDraggingEnd(e), this.draggingTargetColumnIndex = -1, this.mouseStartAction === "resize-column" ? this.resizeColumn(e) : this.mouseStartAction === "drag-column" && this.repaint(), this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.mouseStartAction = "";
|
|
1557
1730
|
}
|
|
1558
|
-
resizeColumn(e) {
|
|
1559
|
-
this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
|
|
1560
|
-
}
|
|
1561
1731
|
mouseMove(e) {
|
|
1562
1732
|
this.eventListener.onMouseMoved(e), this.adjustHoverRows(e), this.adjustHoverColumns(e);
|
|
1563
1733
|
}
|
|
@@ -1571,31 +1741,44 @@ class ue extends oe {
|
|
|
1571
1741
|
}
|
|
1572
1742
|
toggleRowCheckbox(e, t, s) {
|
|
1573
1743
|
var n;
|
|
1574
|
-
const i = this.tableModel.getAreaModel(s), o = i.isRowChecked(e),
|
|
1575
|
-
i.setRowChecked(e,
|
|
1576
|
-
const
|
|
1577
|
-
this.eventListener.onCheckboxChanged(
|
|
1744
|
+
const i = this.tableModel.getAreaModel(s), o = i.isRowChecked(e), r = o === void 0 || o === "semi" || o === "none";
|
|
1745
|
+
i.setRowChecked(e, r), this.repaint();
|
|
1746
|
+
const l = (n = i.rowSelectionModel) == null ? void 0 : n.getCheckedRows();
|
|
1747
|
+
this.eventListener.onCheckboxChanged(l || []);
|
|
1578
1748
|
}
|
|
1579
1749
|
onMouseClicked(e, t) {
|
|
1580
|
-
|
|
1750
|
+
let s = this.selectionService.onMouseClicked(e, t);
|
|
1751
|
+
if (!s && this.getFocusModel) {
|
|
1752
|
+
const i = this.getFocusModel();
|
|
1753
|
+
i && (s = i.hasChanged(), i.clearChanged(), s && this.resetEditorRenderer());
|
|
1754
|
+
}
|
|
1581
1755
|
this.eventListener.onMouseClicked(e), s && this.debounce(this.repaint.bind(this), 10);
|
|
1582
1756
|
}
|
|
1583
|
-
externalFilterChanged() {
|
|
1584
|
-
const
|
|
1585
|
-
e &&
|
|
1757
|
+
externalFilterChanged(e = !0) {
|
|
1758
|
+
const t = this.tableOptions.externalFilterFunction;
|
|
1759
|
+
t && (e && this.clearSelectionModel(), this.tableModel.externalFilterChanged(t), this.scrollViewport.scrollTo(0, 0), this.tableModel.recalcHeightAndPadding(), this.resetSizeOfWrapperDiv(), this.repaint());
|
|
1586
1760
|
}
|
|
1587
1761
|
onHeaderDblClicked(e, t, s) {
|
|
1588
|
-
var o,
|
|
1762
|
+
var o, r;
|
|
1589
1763
|
const i = this.tableModel.getColumnDef(s);
|
|
1590
1764
|
if (i != null && i.sortable && i.sortable()) {
|
|
1591
|
-
e.preventDefault();
|
|
1592
|
-
const
|
|
1593
|
-
this.tableModel.doSort([
|
|
1765
|
+
e.preventDefault(), e.stopPropagation();
|
|
1766
|
+
const l = i.sortStatesOrder ? i.sortStatesOrder : this.tableOptions.sortOrder, n = i.sortState ?? "", a = l[(l.indexOf(n) + 1) % l.length], d = new de(s, a);
|
|
1767
|
+
this.tableModel.doSort([d]) && ((o = this.tableModel.getColumnDefs()) == null || o.forEach((g) => g.sortState = ""), i.sortState = a), this.repaint(), (r = this.storeSortingService) == null || r.setSortItems([d]);
|
|
1594
1768
|
}
|
|
1595
1769
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1770
|
+
changeFocusCell(e, t) {
|
|
1771
|
+
if (!this.isEditing() && this.getFocusModel) {
|
|
1772
|
+
const s = this.getFocusModel();
|
|
1773
|
+
if (s) {
|
|
1774
|
+
const [i, o] = s.getFocus();
|
|
1775
|
+
return s.setFocus(i + t, o + e), this.repaint(), !0;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
return !1;
|
|
1779
|
+
}
|
|
1780
|
+
resizeColumn(e) {
|
|
1781
|
+
this.tableModel.setColumnWidth(this.mouseStartColumnIndex, this.mouseStartWidth + e.draggingX), this.tableModel.recalcPadding(), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows();
|
|
1599
1782
|
}
|
|
1600
1783
|
clearSelectionModel() {
|
|
1601
1784
|
var e;
|
|
@@ -1624,31 +1807,31 @@ class ue extends oe {
|
|
|
1624
1807
|
if ((t = (e = this.tableOptions) == null ? void 0 : e.autoRestoreOptions) != null && t.getRowId && this.storeStateCollapsedExpandService) {
|
|
1625
1808
|
const s = this.tableOptions.autoRestoreOptions, i = s.getRowId;
|
|
1626
1809
|
if (s.autoRestoreCollapsedExpandedState && i) {
|
|
1627
|
-
const o = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),
|
|
1628
|
-
if (
|
|
1629
|
-
const
|
|
1630
|
-
for (let
|
|
1631
|
-
const
|
|
1632
|
-
if (
|
|
1810
|
+
const o = this.storeStateCollapsedExpandService.collapsedExpandedStateGet(), r = this.tableModel.getAreaModel("body");
|
|
1811
|
+
if (r instanceof L) {
|
|
1812
|
+
const l = r, n = r.getRowCount();
|
|
1813
|
+
for (let a = 0; a < n; a++) {
|
|
1814
|
+
const d = r.getRowByIndex(a);
|
|
1815
|
+
if (d)
|
|
1633
1816
|
if (o.allExpanded)
|
|
1634
|
-
|
|
1817
|
+
d.expanded = !0;
|
|
1635
1818
|
else if (o.allCollapsed)
|
|
1636
|
-
|
|
1819
|
+
d.expanded = !1;
|
|
1637
1820
|
else {
|
|
1638
|
-
const
|
|
1639
|
-
o.mode === "expanded" ?
|
|
1821
|
+
const S = i(d.data);
|
|
1822
|
+
o.mode === "expanded" ? d.expanded = this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S) : o.mode === "collapsed" && (d.expanded = !this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(S));
|
|
1640
1823
|
}
|
|
1641
1824
|
}
|
|
1642
|
-
|
|
1825
|
+
l.recalcVisibleTreeRows();
|
|
1643
1826
|
}
|
|
1644
1827
|
}
|
|
1645
1828
|
}
|
|
1646
1829
|
}
|
|
1647
1830
|
}
|
|
1648
|
-
class
|
|
1649
|
-
render(e, t, s, i, o,
|
|
1831
|
+
class be {
|
|
1832
|
+
render(e, t, s, i, o, r, l) {
|
|
1650
1833
|
if (o.isEditable(t, s)) {
|
|
1651
|
-
|
|
1834
|
+
l.addClass(e, "ge-table-row-input-div");
|
|
1652
1835
|
const n = o.getValueAt(t, s);
|
|
1653
1836
|
e.innerHTML = `
|
|
1654
1837
|
<input
|
|
@@ -1661,12 +1844,12 @@ class Se {
|
|
|
1661
1844
|
data-row-index="${t}"
|
|
1662
1845
|
data-col-index="${s}"
|
|
1663
1846
|
data-input-type="text"
|
|
1664
|
-
style="width:100
|
|
1847
|
+
style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
|
|
1665
1848
|
class="ge-table-cell-editor-input">`;
|
|
1666
1849
|
}
|
|
1667
1850
|
}
|
|
1668
1851
|
}
|
|
1669
|
-
class
|
|
1852
|
+
class ye {
|
|
1670
1853
|
constructor(e = "none", t = "single") {
|
|
1671
1854
|
this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1;
|
|
1672
1855
|
}
|
|
@@ -1701,24 +1884,30 @@ class ge {
|
|
|
1701
1884
|
if (this.selectionType === "none")
|
|
1702
1885
|
return;
|
|
1703
1886
|
let t = e;
|
|
1704
|
-
this.selectionType === "row" ? t =
|
|
1887
|
+
this.selectionType === "row" ? t = A.singleRow(e.r1) : this.selectionType === "column" && (t = A.singleColumn(e.c1)), this.negativeRanges.push(t);
|
|
1705
1888
|
}
|
|
1706
1889
|
togglePoint(e, t) {
|
|
1707
|
-
this.getSelectionCount(e, t) > 0 ? this.removeSelection(
|
|
1890
|
+
this.getSelectionCount(e, t) > 0 ? this.removeSelection(A.singleCell(e, t)) : this.addSelection(A.singleCell(e, t));
|
|
1708
1891
|
}
|
|
1709
1892
|
addRange(e) {
|
|
1710
1893
|
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));
|
|
1711
1894
|
}
|
|
1712
1895
|
}
|
|
1713
|
-
class
|
|
1896
|
+
class we {
|
|
1714
1897
|
constructor(e = "none") {
|
|
1715
|
-
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1;
|
|
1898
|
+
this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1;
|
|
1899
|
+
}
|
|
1900
|
+
clearChanged() {
|
|
1901
|
+
this.changed = !1;
|
|
1902
|
+
}
|
|
1903
|
+
hasChanged() {
|
|
1904
|
+
return this.changed;
|
|
1716
1905
|
}
|
|
1717
1906
|
clear() {
|
|
1718
1907
|
this.rowIndex = -1, this.columnIndex = -1;
|
|
1719
1908
|
}
|
|
1720
1909
|
setFocus(e, t) {
|
|
1721
|
-
this.rowIndex = e, this.columnIndex = t;
|
|
1910
|
+
(this.rowIndex !== e || this.columnIndex !== t) && (this.rowIndex = e, this.columnIndex = t, this.changed = !0);
|
|
1722
1911
|
}
|
|
1723
1912
|
hasFocus(e, t) {
|
|
1724
1913
|
return this.rowIndex === e && this.columnIndex === t;
|
|
@@ -1727,17 +1916,17 @@ class fe {
|
|
|
1727
1916
|
return [this.rowIndex, this.columnIndex];
|
|
1728
1917
|
}
|
|
1729
1918
|
}
|
|
1730
|
-
const
|
|
1731
|
-
class
|
|
1919
|
+
const ve = new ye(), xe = new we("cell");
|
|
1920
|
+
class Ce {
|
|
1732
1921
|
constructor() {
|
|
1733
|
-
this.overflowX = "auto", this.overflowY = "auto", this.tableTopBorderVisible = !0, this.tableBottomBorderVisible = !0, this.hoverRowVisible = !0, this.hoverColumnVisible = !0, this.columnsResizable = !0, this.columnsDraggable = !0, this.columnResizeHandleWidthInPx = 4, this.defaultRowHeights = {
|
|
1922
|
+
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 = {
|
|
1734
1923
|
header: 34,
|
|
1735
1924
|
body: 34,
|
|
1736
1925
|
footer: 34
|
|
1737
|
-
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new
|
|
1926
|
+
}, this.footerVerticalSeparator = !1, this.headerToggleExpandCollapseIcons = !1, this.headerVerticalSeparator = !1, this.treeOptions = new H(), this.showCheckboxWihoutExtraColumn = !1, this.externalFilterFunction = void 0, this.sortedOptions = new W(), this.sortOrder = ["asc", "desc"], this.getEditRenderer = (e, t) => new be(), this.getSelectionModel = () => ve, this.getFocusModel = () => xe;
|
|
1738
1927
|
}
|
|
1739
1928
|
}
|
|
1740
|
-
class
|
|
1929
|
+
class Ee {
|
|
1741
1930
|
setStyle(e, t, s) {
|
|
1742
1931
|
return e.style[t] = s, e;
|
|
1743
1932
|
}
|
|
@@ -1761,7 +1950,7 @@ class ve {
|
|
|
1761
1950
|
e.setAttribute(t, s);
|
|
1762
1951
|
}
|
|
1763
1952
|
}
|
|
1764
|
-
const
|
|
1953
|
+
const Ae = G({
|
|
1765
1954
|
inheritAttrs: !1,
|
|
1766
1955
|
props: {
|
|
1767
1956
|
tableModel: {
|
|
@@ -1769,7 +1958,7 @@ const we = _({
|
|
|
1769
1958
|
},
|
|
1770
1959
|
tableOptions: {
|
|
1771
1960
|
required: !1,
|
|
1772
|
-
default: new
|
|
1961
|
+
default: new Ce()
|
|
1773
1962
|
},
|
|
1774
1963
|
debounceMouseClickDelay: {
|
|
1775
1964
|
required: !1,
|
|
@@ -1787,63 +1976,63 @@ const we = _({
|
|
|
1787
1976
|
"mouseMoved"
|
|
1788
1977
|
],
|
|
1789
1978
|
setup(h, { emit: e }) {
|
|
1790
|
-
const t =
|
|
1979
|
+
const t = N(null), s = (i) => {
|
|
1791
1980
|
const o = {
|
|
1792
|
-
onCheckboxChanged: (
|
|
1793
|
-
e("checkboxChanged",
|
|
1981
|
+
onCheckboxChanged: (l) => {
|
|
1982
|
+
e("checkboxChanged", l);
|
|
1794
1983
|
},
|
|
1795
|
-
onContextmenu: (
|
|
1796
|
-
e("contextmenu",
|
|
1984
|
+
onContextmenu: (l) => {
|
|
1985
|
+
e("contextmenu", l);
|
|
1797
1986
|
},
|
|
1798
|
-
onModelChanged: (
|
|
1799
|
-
e("modelChanged",
|
|
1987
|
+
onModelChanged: (l) => {
|
|
1988
|
+
e("modelChanged", l);
|
|
1800
1989
|
},
|
|
1801
|
-
onMouseClicked: (
|
|
1802
|
-
e("mouseClicked",
|
|
1990
|
+
onMouseClicked: (l) => {
|
|
1991
|
+
e("mouseClicked", l);
|
|
1803
1992
|
},
|
|
1804
|
-
onMouseDragging: (
|
|
1805
|
-
e("mouseDragging",
|
|
1993
|
+
onMouseDragging: (l) => {
|
|
1994
|
+
e("mouseDragging", l);
|
|
1806
1995
|
},
|
|
1807
|
-
onMouseDraggingEnd: (
|
|
1808
|
-
e("mouseDraggingEnd",
|
|
1996
|
+
onMouseDraggingEnd: (l) => {
|
|
1997
|
+
e("mouseDraggingEnd", l);
|
|
1809
1998
|
},
|
|
1810
|
-
onMouseMoved: (
|
|
1811
|
-
e("mouseMoved",
|
|
1999
|
+
onMouseMoved: (l) => {
|
|
2000
|
+
e("mouseMoved", l);
|
|
1812
2001
|
}
|
|
1813
|
-
},
|
|
2002
|
+
}, r = new me(
|
|
1814
2003
|
i,
|
|
1815
2004
|
h.tableModel,
|
|
1816
|
-
new
|
|
2005
|
+
new Ee(),
|
|
1817
2006
|
h.tableOptions,
|
|
1818
2007
|
o
|
|
1819
2008
|
);
|
|
1820
|
-
|
|
2009
|
+
r.firstInit(), e("tableReady", r.getApi());
|
|
1821
2010
|
};
|
|
1822
|
-
return
|
|
2011
|
+
return z(() => {
|
|
1823
2012
|
t.value && s(t.value);
|
|
1824
2013
|
}), {
|
|
1825
2014
|
root: t
|
|
1826
2015
|
};
|
|
1827
2016
|
}
|
|
1828
|
-
}),
|
|
2017
|
+
}), Re = (h, e) => {
|
|
1829
2018
|
const t = h.__vccOpts || h;
|
|
1830
2019
|
for (const [s, i] of e)
|
|
1831
2020
|
t[s] = i;
|
|
1832
2021
|
return t;
|
|
1833
|
-
},
|
|
2022
|
+
}, Me = {
|
|
1834
2023
|
ref: "root",
|
|
1835
2024
|
class: "container-div",
|
|
1836
2025
|
style: { width: "100%", height: "100%", "background-color": "transparent", padding: "0", margin: "0" }
|
|
1837
2026
|
};
|
|
1838
|
-
function
|
|
1839
|
-
return
|
|
2027
|
+
function Te(h, e, t, s, i, o) {
|
|
2028
|
+
return j(), X("div", Me, null, 512);
|
|
1840
2029
|
}
|
|
1841
|
-
const
|
|
1842
|
-
class
|
|
2030
|
+
const De = /* @__PURE__ */ Re(Ae, [["render", Te]]);
|
|
2031
|
+
class Fe {
|
|
1843
2032
|
constructor(e, t) {
|
|
1844
2033
|
this.component = e, this.appContext = t;
|
|
1845
2034
|
}
|
|
1846
|
-
render(e, t, s, i, o,
|
|
2035
|
+
render(e, t, s, i, o, r, l) {
|
|
1847
2036
|
return this.mount(
|
|
1848
2037
|
this.component,
|
|
1849
2038
|
{
|
|
@@ -1852,20 +2041,20 @@ class Me {
|
|
|
1852
2041
|
columnIndex: s,
|
|
1853
2042
|
areaIdent: i,
|
|
1854
2043
|
areaModel: o,
|
|
1855
|
-
cellValue:
|
|
2044
|
+
cellValue: r
|
|
1856
2045
|
},
|
|
1857
2046
|
this.appContext,
|
|
1858
2047
|
e
|
|
1859
2048
|
);
|
|
1860
2049
|
}
|
|
1861
2050
|
mount(e, t, s, i) {
|
|
1862
|
-
let o =
|
|
2051
|
+
let o = K(e, t);
|
|
1863
2052
|
return o.appContext = s, k(o, i), () => {
|
|
1864
2053
|
i && k(null, i);
|
|
1865
2054
|
};
|
|
1866
2055
|
}
|
|
1867
2056
|
}
|
|
1868
2057
|
export {
|
|
1869
|
-
|
|
1870
|
-
|
|
2058
|
+
Fe as ComponentRendererWrapper,
|
|
2059
|
+
De as GuiexpertTable
|
|
1871
2060
|
};
|