@ninebone/table 0.0.111 β 0.0.112
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/dist/nine-table.js +340 -334
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +4 -4
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var ke = Object.defineProperty;
|
|
2
|
+
var Le = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var v = (w, s,
|
|
8
|
-
var
|
|
9
|
-
var
|
|
5
|
+
var $e = (w, s, e) => s in w ? ke(w, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : w[s] = e;
|
|
6
|
+
var a = (w, s) => ke(w, "name", { value: s, configurable: !0 });
|
|
7
|
+
var v = (w, s, e) => $e(w, typeof s != "symbol" ? s + "" : s, e), Ae = (w, s, e) => s.has(w) || Le("Cannot " + e);
|
|
8
|
+
var t = (w, s, e) => (Ae(w, s, "read from private field"), e ? e.call(w) : s.get(w)), u = (w, s, e) => s.has(w) ? Le("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(w) : s.set(w, e), y = (w, s, e, i) => (Ae(w, s, "write to private field"), i ? i.call(w, e) : s.set(w, e), e);
|
|
9
|
+
var _e = (w, s, e, i) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
y(w, s, n,
|
|
11
|
+
y(w, s, n, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return
|
|
14
|
+
return t(w, s, i);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as Ie } from "@ninebone/util";
|
|
18
|
+
const ve = class ve extends Ie.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
var
|
|
27
|
-
const
|
|
23
|
+
a(ve, "Trace");
|
|
24
|
+
let he = ve;
|
|
25
|
+
const X = new he();
|
|
26
|
+
var A, H, p, W, O, z, Z, B, j;
|
|
27
|
+
const xe = class xe extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!
|
|
38
|
-
const
|
|
39
|
-
|
|
30
|
+
u(this, A);
|
|
31
|
+
u(this, H, !1);
|
|
32
|
+
u(this, p);
|
|
33
|
+
u(this, W);
|
|
34
|
+
u(this, O);
|
|
35
|
+
u(this, z);
|
|
36
|
+
u(this, Z, /* @__PURE__ */ a(() => {
|
|
37
|
+
if (!t(this, A)) return;
|
|
38
|
+
const e = t(this, A).querySelector(".ng-container-body");
|
|
39
|
+
e && (y(this, z, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})),
|
|
41
|
+
})), t(this, z).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
v(this, "refresh", /* @__PURE__ */
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
+
if (!t(this, A) || !t(this, p) || t(this, H)) return;
|
|
45
|
+
const e = t(this, p).container, i = e.querySelector("table");
|
|
46
46
|
if (!i) return;
|
|
47
|
-
const n =
|
|
48
|
-
if (
|
|
47
|
+
const n = t(this, p).track, o = t(this, p).thumb, r = t(this, A).querySelector(".ng-container-bottom"), l = e.clientWidth, d = i.scrollWidth;
|
|
48
|
+
if (l !== 0 && d > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
@@ -53,7 +53,7 @@ const me = class me extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const c = n.clientWidth;
|
|
55
55
|
if (c <= 0) return;
|
|
56
|
-
const g = Math.max(Math.min(c * (
|
|
56
|
+
const g = Math.max(Math.min(c * (l / d), c), 20);
|
|
57
57
|
o.style.width = `${g}px`;
|
|
58
58
|
let h = 0;
|
|
59
59
|
const b = i.style.transform;
|
|
@@ -62,56 +62,56 @@ const me = class me extends HTMLElement {
|
|
|
62
62
|
x && x[1] && (h = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
64
|
h = parseInt(i.style.left || 0, 10);
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
65
|
+
let f = parseInt(Math.abs(h) * c / d, 10);
|
|
66
|
+
f < 0 && (f = 0);
|
|
67
|
+
const E = c - g;
|
|
68
|
+
f > E && (f = E), o.style.left = `${f}px`, t(this, p).left.disabled = f === 0, t(this, p).right.disabled = f >= E - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
|
|
71
|
-
if (!
|
|
72
|
-
const i =
|
|
70
|
+
u(this, B, /* @__PURE__ */ a((e) => {
|
|
71
|
+
if (!t(this, p)) return !1;
|
|
72
|
+
const i = t(this, p).container, n = i.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
|
-
const o =
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
74
|
+
const o = t(this, p).track.getBoundingClientRect(), r = t(this, p).thumb.clientWidth;
|
|
75
|
+
let l = e;
|
|
76
|
+
l < 0 && (l = 0);
|
|
77
|
+
const d = o.width - r;
|
|
78
|
+
l > d && (l = d), l = parseInt(l, 10), t(this, p).thumb.style.left = `${l}px`, t(this, p).left.disabled = l === 0, t(this, p).right.disabled = l >= d - 1;
|
|
79
79
|
const c = i.clientWidth, g = n.scrollWidth;
|
|
80
|
-
let h =
|
|
81
|
-
return -h > g - c && (h = -(g - c)), -h + 5 > g - c && (h = -(g - c)), c >= g && (h = 0), n.style.transform = `translateX(${h}px)`,
|
|
80
|
+
let h = d > 0 ? -l * (g - c) / d : 0;
|
|
81
|
+
return -h > g - c && (h = -(g - c)), -h + 5 > g - c && (h = -(g - c)), c >= g && (h = 0), n.style.transform = `translateX(${h}px)`, l > 0 && l < d - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
clearInterval(
|
|
86
|
-
const o = parseInt(
|
|
87
|
-
|
|
88
|
-
clearInterval(
|
|
89
|
-
const r = parseInt(
|
|
90
|
-
|
|
83
|
+
u(this, j, /* @__PURE__ */ a(() => {
|
|
84
|
+
const e = /* @__PURE__ */ a((n) => {
|
|
85
|
+
clearInterval(t(this, W)), clearInterval(t(this, O));
|
|
86
|
+
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
87
|
+
t(this, B).call(this, o + n), y(this, W, setInterval(() => {
|
|
88
|
+
clearInterval(t(this, W)), y(this, O, setInterval(() => {
|
|
89
|
+
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
90
|
+
t(this, B).call(this, r + n) || clearInterval(t(this, O));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
|
-
}, "delayScroll"), i = /* @__PURE__ */
|
|
94
|
-
clearInterval(
|
|
93
|
+
}, "delayScroll"), i = /* @__PURE__ */ a(() => {
|
|
94
|
+
clearInterval(t(this, W)), clearInterval(t(this, O));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
|
-
|
|
98
|
-
}),
|
|
99
|
-
n.button === 0 &&
|
|
100
|
-
}),
|
|
101
|
-
n.button === 0 &&
|
|
102
|
-
}),
|
|
97
|
+
t(this, p).left.addEventListener(n, i), t(this, p).right.addEventListener(n, i), t(this, p).track.addEventListener(n, i);
|
|
98
|
+
}), t(this, p).left.addEventListener("mousedown", (n) => {
|
|
99
|
+
n.button === 0 && e(-20);
|
|
100
|
+
}), t(this, p).right.addEventListener("mousedown", (n) => {
|
|
101
|
+
n.button === 0 && e(20);
|
|
102
|
+
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (n) => {
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
|
-
const o =
|
|
106
|
-
|
|
107
|
-
}),
|
|
105
|
+
const o = t(this, p).track.getBoundingClientRect(), r = t(this, p).thumb.clientWidth;
|
|
106
|
+
t(this, B).call(this, n.clientX - o.left - r / 2);
|
|
107
|
+
}), t(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(), y(this, H, !0), this.shiftX = n.clientX -
|
|
110
|
-
const o = /* @__PURE__ */
|
|
111
|
-
if (!
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
}, "onMouseMove"), r = /* @__PURE__ */
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), y(this, H, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
110
|
+
const o = /* @__PURE__ */ a((l) => {
|
|
111
|
+
if (!t(this, H)) return;
|
|
112
|
+
const d = t(this, p).track.getBoundingClientRect();
|
|
113
|
+
t(this, B).call(this, l.clientX - d.left - this.shiftX);
|
|
114
|
+
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
115
115
|
y(this, H, !1), i(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
117
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
@@ -119,7 +119,7 @@ const me = class me extends HTMLElement {
|
|
|
119
119
|
}, "#init"));
|
|
120
120
|
}
|
|
121
121
|
connectedCallback() {
|
|
122
|
-
if (y(this,
|
|
122
|
+
if (y(this, A, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, A)) return;
|
|
123
123
|
this.innerHTML = `
|
|
124
124
|
<style>
|
|
125
125
|
nine-table-hscrollbar {
|
|
@@ -183,10 +183,10 @@ const me = class me extends HTMLElement {
|
|
|
183
183
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
184
184
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
185
185
|
`;
|
|
186
|
-
const
|
|
187
|
-
const i =
|
|
186
|
+
const e = /* @__PURE__ */ a(() => {
|
|
187
|
+
const i = t(this, A).querySelector(".ng-container-body");
|
|
188
188
|
if (!i) {
|
|
189
|
-
setTimeout(
|
|
189
|
+
setTimeout(e, 10);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
y(this, p, {
|
|
@@ -195,134 +195,140 @@ const me = class me extends HTMLElement {
|
|
|
195
195
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
196
196
|
left: this.querySelector(".ng-scroll-left"),
|
|
197
197
|
right: this.querySelector(".ng-scroll-right")
|
|
198
|
-
}),
|
|
198
|
+
}), t(this, j).call(this), t(this, Z).call(this), this.refresh();
|
|
199
199
|
}, "initWhenReady");
|
|
200
|
-
|
|
200
|
+
e();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
|
|
203
|
+
t(this, z) && t(this, z).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
207
|
-
let
|
|
208
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
209
|
-
var G,
|
|
210
|
-
const
|
|
206
|
+
A = new WeakMap(), H = new WeakMap(), p = new WeakMap(), W = new WeakMap(), O = new WeakMap(), z = new WeakMap(), Z = new WeakMap(), B = new WeakMap(), j = new WeakMap(), a(xe, "NineTableHScrollBar");
|
|
207
|
+
let de = xe;
|
|
208
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", de);
|
|
209
|
+
var G, _, J, Q;
|
|
210
|
+
const Ee = class Ee {
|
|
211
211
|
constructor(s) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
v(this, "initTemplate", /* @__PURE__ */
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
217
|
-
const i = Array.from(
|
|
218
|
-
y(this,
|
|
212
|
+
u(this, G);
|
|
213
|
+
u(this, _, []);
|
|
214
|
+
v(this, "initTemplate", /* @__PURE__ */ a((s) => {
|
|
215
|
+
const e = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
216
|
+
if (!e) return;
|
|
217
|
+
const i = Array.from(e.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
218
|
+
y(this, _, i.map((n) => n.cloneNode(!0))), console.log(`[RowManager] Template initialized with ${t(this, _).length} row(s).`);
|
|
219
219
|
}, "initTemplate"));
|
|
220
220
|
/**
|
|
221
|
-
* π― ν
νλ¦Ώ 1μΈνΈμ μ΄ λμ΄λ₯Ό κ³μ°ν©λλ€. (
|
|
221
|
+
* π― ν
νλ¦Ώ 1μΈνΈμ μ΄ λμ΄λ₯Ό κ³μ°ν©λλ€. (Private λ©μλ)
|
|
222
222
|
*/
|
|
223
|
-
|
|
224
|
-
if (
|
|
223
|
+
u(this, J, /* @__PURE__ */ a(() => {
|
|
224
|
+
if (t(this, _).length === 0)
|
|
225
|
+
throw new Error("[RowManager] Template TRs are empty. Cannot calculate height.");
|
|
225
226
|
let s = 0;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}),
|
|
234
|
-
|
|
227
|
+
const e = document.createElement("div");
|
|
228
|
+
e.style.position = "absolute", e.style.visibility = "hidden", e.style.pointerEvents = "none", e.style.width = "100%";
|
|
229
|
+
const i = document.createElement("table");
|
|
230
|
+
i.style.width = "100%", i.style.tableLayout = "fixed", e.appendChild(i);
|
|
231
|
+
const n = document.createElement("tbody");
|
|
232
|
+
return t(this, _).forEach((r) => {
|
|
233
|
+
n.appendChild(r.cloneNode(!0));
|
|
234
|
+
}), i.appendChild(n), document.body.appendChild(e), n.querySelectorAll("tr").forEach((r, l) => {
|
|
235
|
+
const d = r.offsetHeight;
|
|
236
|
+
if (d === 0)
|
|
237
|
+
throw new Error(`[RowManager] Template TR[${l}] offsetHeight is 0. Check CSS or layout styles.`);
|
|
238
|
+
s += d, X.log(`[RowManager] Template TR[${l}] measured height: ${d}px`);
|
|
239
|
+
}), document.body.removeChild(e), X.log(`[RowManager] Total Template Set Height: ${s}px`), s;
|
|
240
|
+
}, "#getTemplateHeight"));
|
|
235
241
|
/**
|
|
236
|
-
* π― 컨ν
μ΄λ λμ΄μ ν
νλ¦Ώ λμ΄λ₯Ό λ°νμΌλ‘ νμν TR μ
νΈ(ν) κ°μλ₯Ό λμ μ°μ ν©λλ€. (
|
|
242
|
+
* π― 컨ν
μ΄λ λμ΄μ ν
νλ¦Ώ λμ΄λ₯Ό λ°νμΌλ‘ νμν TR μ
νΈ(ν) κ°μλ₯Ό λμ μ°μ ν©λλ€. (Private λ©μλ)
|
|
237
243
|
*/
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
return console.log(`[RowManager] Container Height: ${
|
|
241
|
-
}, "calculateRequiredRowCount"));
|
|
242
|
-
v(this, "renderRows", /* @__PURE__ */
|
|
243
|
-
if (
|
|
244
|
+
u(this, Q, /* @__PURE__ */ a((s) => {
|
|
245
|
+
const e = s.clientHeight || s.getBoundingClientRect().height || 400, i = t(this, J).call(this), n = Math.ceil(e / i), o = 20, r = n + o;
|
|
246
|
+
return console.log(`[RowManager] Container Height: ${e}px | Visible Rows: ${n} | Buffer: ${o} | Final Target Rows: ${r}`), r;
|
|
247
|
+
}, "#calculateRequiredRowCount"));
|
|
248
|
+
v(this, "renderRows", /* @__PURE__ */ a((s, e = null) => {
|
|
249
|
+
if (t(this, _).length === 0) {
|
|
244
250
|
console.warn("[RowManager] Cannot render rows because template is empty.");
|
|
245
251
|
return;
|
|
246
252
|
}
|
|
247
253
|
const i = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
248
254
|
if (!i) return;
|
|
249
|
-
i.querySelectorAll("tr:not(.nodata)").forEach((
|
|
250
|
-
const n = i.querySelector("tr.nodata"), o = document.createDocumentFragment(), r =
|
|
255
|
+
i.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
256
|
+
const n = i.querySelector("tr.nodata"), o = document.createDocumentFragment(), r = e !== null ? e : t(this, Q).call(this, s);
|
|
251
257
|
console.log(`[RowManager] Rendering ${r} row sets into container...`);
|
|
252
|
-
for (let
|
|
253
|
-
|
|
254
|
-
o.appendChild(
|
|
258
|
+
for (let l = 0; l < r; l++)
|
|
259
|
+
t(this, _).forEach((d) => {
|
|
260
|
+
o.appendChild(d.cloneNode(!0));
|
|
255
261
|
});
|
|
256
262
|
n ? n.before(o) : i.appendChild(o), console.log(`[RowManager] Successfully rendered. Total DOM tr count in tbody: ${i.querySelectorAll("tr:not(.nodata)").length}`);
|
|
257
263
|
}, "renderRows"));
|
|
258
264
|
y(this, G, s);
|
|
259
265
|
}
|
|
260
266
|
get templateLength() {
|
|
261
|
-
return
|
|
267
|
+
return t(this, _).length || 1;
|
|
262
268
|
}
|
|
263
269
|
};
|
|
264
|
-
G = new WeakMap(),
|
|
265
|
-
let
|
|
266
|
-
var
|
|
267
|
-
const
|
|
270
|
+
G = new WeakMap(), _ = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), a(Ee, "RowManager");
|
|
271
|
+
let fe = Ee;
|
|
272
|
+
var k, $, ee;
|
|
273
|
+
const F = class F extends HTMLElement {
|
|
268
274
|
constructor() {
|
|
269
275
|
super();
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
v(this, "init", /* @__PURE__ */
|
|
273
|
-
if (!
|
|
274
|
-
const i = /* @__PURE__ */
|
|
275
|
-
const g = /* @__PURE__ */
|
|
276
|
+
u(this, k, null);
|
|
277
|
+
u(this, $);
|
|
278
|
+
v(this, "init", /* @__PURE__ */ a((e) => {
|
|
279
|
+
if (!e) return;
|
|
280
|
+
const i = /* @__PURE__ */ a((c) => {
|
|
281
|
+
const g = /* @__PURE__ */ a((b) => {
|
|
276
282
|
if (b.querySelector("colgroup")) return;
|
|
277
|
-
const
|
|
278
|
-
for (let
|
|
279
|
-
const
|
|
280
|
-
|
|
283
|
+
const f = b.querySelector("tbody tr") || b.querySelector("tr"), E = f ? f.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), C = Math.max(Math.floor((b.clientWidth || 600) / E), 100);
|
|
284
|
+
for (let R = 0; R < E; R++) {
|
|
285
|
+
const ce = document.createElement("col");
|
|
286
|
+
ce.setAttribute("width", C), x.appendChild(ce);
|
|
281
287
|
}
|
|
282
288
|
b.prepend(x);
|
|
283
|
-
}, "ensureColgroup"), h = /* @__PURE__ */
|
|
289
|
+
}, "ensureColgroup"), h = /* @__PURE__ */ a((b) => {
|
|
284
290
|
if (b.querySelector("thead")) return;
|
|
285
|
-
const
|
|
286
|
-
|
|
291
|
+
const f = document.createElement("thead"), E = b.querySelector("colgroup");
|
|
292
|
+
E ? E.after(f) : b.prepend(f);
|
|
287
293
|
}, "ensureThead");
|
|
288
294
|
return g(c), h(c), c.classList.add("nine-table-element"), c;
|
|
289
|
-
}, "initializeTable"), n =
|
|
290
|
-
y(this,
|
|
291
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"),
|
|
292
|
-
const b = c.cloneNode(!0),
|
|
293
|
-
return
|
|
294
|
-
const
|
|
295
|
-
(h ? !
|
|
296
|
-
}),
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
|
|
295
|
+
}, "initializeTable"), n = e.cloneNode(!0);
|
|
296
|
+
y(this, k, i(n)), t(this, k).style.display = "table", t(this, $).initTemplate(t(this, k));
|
|
297
|
+
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), d = /* @__PURE__ */ a((c, g, h = !1) => {
|
|
298
|
+
const b = c.cloneNode(!0), f = Array.from(b.querySelectorAll("colgroup col")), E = [];
|
|
299
|
+
return f.forEach((x, C) => {
|
|
300
|
+
const R = x.getAttribute("fixed");
|
|
301
|
+
(h ? !R || R === "" : R === g) || E.push(C);
|
|
302
|
+
}), E.reverse().forEach((x) => {
|
|
303
|
+
f[x] && f[x].remove(), b.querySelectorAll("tr").forEach((C) => {
|
|
304
|
+
const R = C.querySelectorAll("th, td");
|
|
305
|
+
R[x] && R[x].remove();
|
|
300
306
|
});
|
|
301
307
|
}), b;
|
|
302
308
|
}, "filterTableByFixed");
|
|
303
309
|
if (r) {
|
|
304
|
-
const c =
|
|
305
|
-
r.innerHTML = "", r.appendChild(c),
|
|
310
|
+
const c = d(t(this, k), null, !0);
|
|
311
|
+
r.innerHTML = "", r.appendChild(c), t(this, $).renderRows(r);
|
|
306
312
|
}
|
|
307
313
|
if (o) {
|
|
308
|
-
const c =
|
|
314
|
+
const c = d(t(this, k), "left", !1);
|
|
309
315
|
let g = 0;
|
|
310
316
|
c.querySelectorAll("col").forEach((b) => {
|
|
311
|
-
const
|
|
312
|
-
isNaN(
|
|
313
|
-
}), o.innerHTML = "", o.appendChild(c),
|
|
317
|
+
const f = parseInt(b.getAttribute("width"), 10);
|
|
318
|
+
isNaN(f) || (g += f);
|
|
319
|
+
}), o.innerHTML = "", o.appendChild(c), t(this, $).renderRows(o);
|
|
314
320
|
const h = g > 0 ? g : 0;
|
|
315
321
|
o.style.flex = `0 0 ${h}px`, o.style.width = `${h}px`;
|
|
316
322
|
}
|
|
317
|
-
if (
|
|
318
|
-
const c =
|
|
323
|
+
if (l) {
|
|
324
|
+
const c = d(t(this, k), "right", !1);
|
|
319
325
|
let g = 0;
|
|
320
326
|
c.querySelectorAll("col").forEach((b) => {
|
|
321
|
-
const
|
|
322
|
-
isNaN(
|
|
323
|
-
}),
|
|
327
|
+
const f = parseInt(b.getAttribute("width"), 10);
|
|
328
|
+
isNaN(f) || (g += f);
|
|
329
|
+
}), l.innerHTML = "", l.appendChild(c), t(this, $).renderRows(l);
|
|
324
330
|
const h = g > 0 ? g : 0;
|
|
325
|
-
|
|
331
|
+
l.style.flex = `0 0 ${h}px`, l.style.width = `${h}px`;
|
|
326
332
|
}
|
|
327
333
|
if (r) {
|
|
328
334
|
const c = this.getRowCount();
|
|
@@ -334,19 +340,19 @@ const X = class X extends HTMLElement {
|
|
|
334
340
|
setTimeout(() => {
|
|
335
341
|
const c = this.querySelector("nine-table-hscrollbar");
|
|
336
342
|
c && typeof c.refresh == "function" && c.refresh();
|
|
337
|
-
}, 0),
|
|
343
|
+
}, 0), X.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
338
344
|
}, "init"));
|
|
339
|
-
v(this, "getRowCount", /* @__PURE__ */
|
|
340
|
-
v(this, "scrollToX", /* @__PURE__ */
|
|
345
|
+
v(this, "getRowCount", /* @__PURE__ */ a(() => t(this, k) ? t(this, k).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
346
|
+
v(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
341
347
|
const i = this.querySelector(".ng-container-body");
|
|
342
|
-
i && (i.scrollLeft =
|
|
348
|
+
i && (i.scrollLeft = e);
|
|
343
349
|
}, "scrollToX"));
|
|
344
|
-
v(this, "scrollToY", /* @__PURE__ */
|
|
350
|
+
v(this, "scrollToY", /* @__PURE__ */ a((e) => {
|
|
345
351
|
const i = this.querySelector(".ng-container-body");
|
|
346
|
-
i && (i.scrollTop =
|
|
352
|
+
i && (i.scrollTop = e);
|
|
347
353
|
}, "scrollToY"));
|
|
348
|
-
|
|
349
|
-
const
|
|
354
|
+
u(this, ee, /* @__PURE__ */ a(() => {
|
|
355
|
+
const e = F.SCROLLBAR_SIZE;
|
|
350
356
|
this.innerHTML = `
|
|
351
357
|
<style>
|
|
352
358
|
nine-table-sheet {
|
|
@@ -365,7 +371,7 @@ const X = class X extends HTMLElement {
|
|
|
365
371
|
flex-direction: row;
|
|
366
372
|
flex: 1 1 auto;
|
|
367
373
|
width: 100%;
|
|
368
|
-
height: calc(100% - ${
|
|
374
|
+
height: calc(100% - ${e}px);
|
|
369
375
|
overflow: hidden;
|
|
370
376
|
position: relative;
|
|
371
377
|
}
|
|
@@ -402,8 +408,8 @@ const X = class X extends HTMLElement {
|
|
|
402
408
|
nine-table-sheet .ng-container-bottom {
|
|
403
409
|
display: flex;
|
|
404
410
|
flex-direction: row;
|
|
405
|
-
height: ${
|
|
406
|
-
min-height: ${
|
|
411
|
+
height: ${e}px;
|
|
412
|
+
min-height: ${e}px;
|
|
407
413
|
flex-shrink: 0;
|
|
408
414
|
background: #f9fafb;
|
|
409
415
|
border-top: 1px solid #e5e7eb;
|
|
@@ -418,8 +424,8 @@ const X = class X extends HTMLElement {
|
|
|
418
424
|
} */
|
|
419
425
|
|
|
420
426
|
nine-table-sheet .ng-scroll-edge {
|
|
421
|
-
width: ${
|
|
422
|
-
min-width: ${
|
|
427
|
+
width: ${e}px;
|
|
428
|
+
min-width: ${e}px;
|
|
423
429
|
height: 100%;
|
|
424
430
|
flex-shrink: 0;
|
|
425
431
|
background: #f3f4f6;
|
|
@@ -462,55 +468,55 @@ const X = class X extends HTMLElement {
|
|
|
462
468
|
</div>
|
|
463
469
|
`;
|
|
464
470
|
}, "#render"));
|
|
465
|
-
y(this,
|
|
471
|
+
y(this, $, new fe(this));
|
|
466
472
|
}
|
|
467
473
|
connectedCallback() {
|
|
468
|
-
|
|
474
|
+
t(this, ee).call(this);
|
|
469
475
|
}
|
|
470
476
|
disconnectedCallback() {
|
|
471
|
-
this.innerHTML = "",
|
|
477
|
+
this.innerHTML = "", X.log("NineTableSheet destroyed.");
|
|
472
478
|
}
|
|
473
479
|
};
|
|
474
|
-
|
|
475
|
-
let
|
|
476
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
477
|
-
var
|
|
478
|
-
const
|
|
480
|
+
k = new WeakMap(), $ = new WeakMap(), ee = new WeakMap(), a(F, "NineTableSheet"), v(F, "SCROLLBAR_SIZE", 16);
|
|
481
|
+
let ue = F;
|
|
482
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ue);
|
|
483
|
+
var te;
|
|
484
|
+
const Se = class Se extends HTMLElement {
|
|
479
485
|
constructor() {
|
|
480
486
|
super();
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
487
|
+
u(this, te, /* @__PURE__ */ a(() => {
|
|
488
|
+
const e = this.querySelector(".nine-tab-bar");
|
|
489
|
+
e && (e.addEventListener("click", (i) => {
|
|
484
490
|
const n = i.target.closest(".nine-tab-item");
|
|
485
491
|
if (!n) return;
|
|
486
492
|
const o = i.ctrlKey || i.metaKey || i.shiftKey, r = parseInt(n.dataset.index, 10);
|
|
487
493
|
this.switchSheet(r, o);
|
|
488
494
|
}), this.switchSheet(0, !1));
|
|
489
495
|
}, "#init"));
|
|
490
|
-
v(this, "switchSheet", /* @__PURE__ */
|
|
491
|
-
const n = /* @__PURE__ */
|
|
496
|
+
v(this, "switchSheet", /* @__PURE__ */ a((e, i = !1) => {
|
|
497
|
+
const n = /* @__PURE__ */ a(() => {
|
|
492
498
|
const h = this.querySelector("nine-table-sheets-body");
|
|
493
|
-
h.querySelectorAll("nine-splitter").forEach((
|
|
494
|
-
const
|
|
495
|
-
x &&
|
|
499
|
+
h.querySelectorAll("nine-splitter").forEach((f) => {
|
|
500
|
+
const E = parseInt(f.dataset.splitIndex, 10), x = h.querySelector(`nine-table-sheet[data-index="${E - 1}"]`), C = h.querySelector(`nine-table-sheet[data-index="${E}"]`);
|
|
501
|
+
x && C && x.classList.contains("active") && C.classList.contains("active") ? f.classList.add("active") : f.classList.remove("active");
|
|
496
502
|
});
|
|
497
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"),
|
|
498
|
-
if (!
|
|
503
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), d = r.querySelectorAll("nine-table-sheet");
|
|
504
|
+
if (!l[e]) return;
|
|
499
505
|
if (!i)
|
|
500
|
-
|
|
501
|
-
h.classList.toggle("active", b ===
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
}),
|
|
505
|
-
h.classList.toggle("active", b ===
|
|
506
|
+
l.forEach((h, b) => {
|
|
507
|
+
h.classList.toggle("active", b === e);
|
|
508
|
+
const f = r.querySelector(`nine-table-sheet[data-index="${b}"]`);
|
|
509
|
+
f && (f.style.flex = "");
|
|
510
|
+
}), d.forEach((h, b) => {
|
|
511
|
+
h.classList.toggle("active", b === e);
|
|
506
512
|
});
|
|
507
513
|
else {
|
|
508
|
-
const h =
|
|
514
|
+
const h = l[e], b = o.querySelectorAll(".nine-tab-item.active");
|
|
509
515
|
if (h.classList.contains("active") && b.length <= 1)
|
|
510
516
|
return;
|
|
511
517
|
h.classList.toggle("active");
|
|
512
|
-
const
|
|
513
|
-
|
|
518
|
+
const f = r.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
519
|
+
f && (f.classList.toggle("active"), f.classList.contains("active") || (f.style.flex = ""));
|
|
514
520
|
}
|
|
515
521
|
const c = Array.from(r.querySelectorAll("nine-table-sheet.active"));
|
|
516
522
|
if (c.length > 1) {
|
|
@@ -531,36 +537,36 @@ const xe = class xe extends HTMLElement {
|
|
|
531
537
|
}, "switchSheet"));
|
|
532
538
|
}
|
|
533
539
|
connectedCallback() {
|
|
534
|
-
|
|
540
|
+
t(this, te).call(this);
|
|
535
541
|
}
|
|
536
542
|
};
|
|
537
|
-
|
|
538
|
-
let
|
|
539
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
540
|
-
var
|
|
541
|
-
const
|
|
543
|
+
te = new WeakMap(), a(Se, "NineTableSheets");
|
|
544
|
+
let be = Se;
|
|
545
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", be);
|
|
546
|
+
var L, Y, se, U, ie;
|
|
547
|
+
const Re = class Re {
|
|
542
548
|
constructor(s) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const s =
|
|
547
|
-
s && (y(this, Y, new ResizeObserver((
|
|
548
|
-
for (let i of
|
|
549
|
-
s.getAttribute("auto-height") === "true" &&
|
|
550
|
-
})),
|
|
549
|
+
u(this, L);
|
|
550
|
+
u(this, Y, null);
|
|
551
|
+
u(this, se, /* @__PURE__ */ a(() => {
|
|
552
|
+
const s = t(this, L).host;
|
|
553
|
+
s && (y(this, Y, new ResizeObserver((e) => {
|
|
554
|
+
for (let i of e)
|
|
555
|
+
s.getAttribute("auto-height") === "true" && t(this, U).call(this, s);
|
|
556
|
+
})), t(this, Y).observe(s));
|
|
551
557
|
}, "#observeResize"));
|
|
552
|
-
|
|
553
|
-
var
|
|
554
|
-
const
|
|
555
|
-
if (!
|
|
556
|
-
const i = ((
|
|
557
|
-
s.style.height = `${
|
|
558
|
-
const x =
|
|
558
|
+
u(this, U, /* @__PURE__ */ a((s) => {
|
|
559
|
+
var C, R;
|
|
560
|
+
const e = (C = s.shadowRoot) == null ? void 0 : C.querySelector("nine-table-sheet.active");
|
|
561
|
+
if (!e) return;
|
|
562
|
+
const i = ((R = e.getRowCount) == null ? void 0 : R.call(e)) || 0, n = parseInt(s.getAttribute("max-display-row"), 10) || 10, o = Math.min(i, n), r = e.querySelector("tbody tr") || e.querySelector("tr"), l = r ? r.getBoundingClientRect().height : 32, d = t(this, L).querySelector("nine-table-header"), c = t(this, L).querySelector("nine-table-sheets-footer"), g = d ? d.getBoundingClientRect().height : 40, h = c ? c.getBoundingClientRect().height : 32, f = g + h + 16, E = o * l + f;
|
|
563
|
+
s.style.height = `${E}px`, s.style.maxHeight = `${n * l + f}px`;
|
|
564
|
+
const x = t(this, L).querySelector("nine-table-sheets-body");
|
|
559
565
|
x && (x.style.overflowY = i > n ? "auto" : "hidden");
|
|
560
566
|
}, "#applyAutoHeight"));
|
|
561
|
-
|
|
562
|
-
const s =
|
|
563
|
-
|
|
567
|
+
u(this, ie, /* @__PURE__ */ a(() => {
|
|
568
|
+
const s = t(this, L).host, i = Array.from(s.children).filter((d) => d.tagName === "TABLE"), n = s.getAttribute("auto-height") === "true", o = i.map((d, c) => `<nine-table-sheet class="${c === 0 ? "active" : ""}" data-index="${c}"></nine-table-sheet>`).join(""), r = i.map((d, c) => `<div class="nine-tab-item ${c === 0 ? "active" : ""}" data-index="${c}">Sheet ${c + 1}</div>`).join("");
|
|
569
|
+
t(this, L).innerHTML = `
|
|
564
570
|
<style>
|
|
565
571
|
:host {
|
|
566
572
|
display: flex;
|
|
@@ -658,172 +664,172 @@ const Se = class Se {
|
|
|
658
664
|
</nine-table-body>
|
|
659
665
|
<nine-table-footer></nine-table-footer>
|
|
660
666
|
`;
|
|
661
|
-
const
|
|
662
|
-
|
|
667
|
+
const l = t(this, L).querySelectorAll("nine-table-sheet");
|
|
668
|
+
l == null || l.forEach((d, c) => {
|
|
663
669
|
i[c] && setTimeout(() => {
|
|
664
|
-
|
|
670
|
+
d.init(i[c]), n && t(this, U).call(this, s);
|
|
665
671
|
});
|
|
666
672
|
});
|
|
667
673
|
}, "#render"));
|
|
668
|
-
y(this,
|
|
674
|
+
y(this, L, s), t(this, ie).call(this), t(this, se).call(this);
|
|
669
675
|
}
|
|
670
676
|
};
|
|
671
|
-
|
|
672
|
-
let
|
|
673
|
-
var
|
|
674
|
-
const
|
|
677
|
+
L = new WeakMap(), Y = new WeakMap(), se = new WeakMap(), U = new WeakMap(), ie = new WeakMap(), a(Re, "LayoutManager");
|
|
678
|
+
let ge = Re;
|
|
679
|
+
var I, N;
|
|
680
|
+
const Te = class Te {
|
|
675
681
|
constructor(s) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
v(this, "count", /* @__PURE__ */
|
|
679
|
-
y(this,
|
|
682
|
+
u(this, I);
|
|
683
|
+
u(this, N, -1);
|
|
684
|
+
v(this, "count", /* @__PURE__ */ a(() => t(this, I).rawRecords.length, "count"));
|
|
685
|
+
y(this, I, s);
|
|
680
686
|
}
|
|
681
687
|
get at() {
|
|
682
|
-
return
|
|
688
|
+
return t(this, N);
|
|
683
689
|
}
|
|
684
690
|
set at(s) {
|
|
685
691
|
var i, n;
|
|
686
|
-
y(this,
|
|
687
|
-
const
|
|
688
|
-
|
|
692
|
+
y(this, N, parseInt(s, 10));
|
|
693
|
+
const e = ((n = (i = t(this, I).owner).querySelector) == null ? void 0 : n.call(i, ".ng-container-body")) || t(this, I).owner.body;
|
|
694
|
+
e && !e.querySelector(`tbody.bindable tr[data-row="${t(this, N)}"]`) && setTimeout(() => {
|
|
689
695
|
var o, r;
|
|
690
|
-
(r = (o =
|
|
696
|
+
(r = (o = t(this, I).owner).scrollTo_V1) == null || r.call(o, t(this, N));
|
|
691
697
|
});
|
|
692
698
|
}
|
|
693
699
|
};
|
|
694
|
-
|
|
695
|
-
let
|
|
696
|
-
var
|
|
700
|
+
I = new WeakMap(), N = new WeakMap(), a(Te, "ngRow");
|
|
701
|
+
let pe = Te;
|
|
702
|
+
var S, m, q, P, ne, M, re, K, oe, le, V;
|
|
697
703
|
const T = class T {
|
|
698
|
-
constructor(s,
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
704
|
+
constructor(s, e) {
|
|
705
|
+
u(this, S);
|
|
706
|
+
u(this, m);
|
|
707
|
+
u(this, q, []);
|
|
708
|
+
u(this, P, []);
|
|
709
|
+
u(this, ne, 0);
|
|
710
|
+
u(this, M, []);
|
|
711
|
+
u(this, re, /* @__PURE__ */ a(() => {
|
|
706
712
|
y(this, M, []);
|
|
707
|
-
const s =
|
|
708
|
-
Array.from(s).forEach((
|
|
713
|
+
const s = t(this, S).template || [];
|
|
714
|
+
Array.from(s).forEach((e) => {
|
|
709
715
|
var i;
|
|
710
|
-
|
|
711
|
-
}), (
|
|
712
|
-
|
|
716
|
+
t(this, M).push(((i = e.getBoundingClientRect) == null ? void 0 : i.call(e).height) || 24);
|
|
717
|
+
}), (t(this, m).rawRecords || []).forEach((e) => {
|
|
718
|
+
e.__ng || (e.__ng = t(this, K).call(this)), e.__ng.height = t(this, M).slice();
|
|
713
719
|
});
|
|
714
720
|
}, "#initialize"));
|
|
715
|
-
v(this, "set", /* @__PURE__ */
|
|
721
|
+
v(this, "set", /* @__PURE__ */ a((s) => {
|
|
716
722
|
this.clear(), this.add(s, !1);
|
|
717
723
|
}, "set"));
|
|
718
|
-
|
|
724
|
+
u(this, K, /* @__PURE__ */ a(() => ({
|
|
719
725
|
rowState: T.ROW_STATE.EMPTY,
|
|
720
726
|
deleted: !1,
|
|
721
727
|
filtered: !1,
|
|
722
|
-
height:
|
|
728
|
+
height: t(this, M).slice(),
|
|
723
729
|
o: {},
|
|
724
730
|
c: {},
|
|
725
|
-
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1,
|
|
731
|
+
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, M).slice(), -1, {}, {}]
|
|
726
732
|
}), "#getDefaultMeta"));
|
|
727
|
-
v(this, "reset", /* @__PURE__ */
|
|
733
|
+
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
728
734
|
y(this, q, []), y(this, P, []);
|
|
729
735
|
}, "reset"));
|
|
730
|
-
v(this, "clear", /* @__PURE__ */
|
|
736
|
+
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
731
737
|
var s;
|
|
732
|
-
|
|
738
|
+
t(this, m).rawRecords = [], y(this, q, []), y(this, P, []), (s = t(this, m).viewRecords) != null && s.reset && t(this, m).viewRecords.reset();
|
|
733
739
|
}, "clear"));
|
|
734
|
-
|
|
740
|
+
u(this, oe, /* @__PURE__ */ a((s) => {
|
|
735
741
|
var n;
|
|
736
742
|
Array.isArray(s) || (s = [s]);
|
|
737
|
-
const
|
|
743
|
+
const e = typeof ((n = t(this, S).fields) == null ? void 0 : n.get) == "function" ? t(this, S).fields.get() : Object.keys(s[0] || {}), i = [];
|
|
738
744
|
return s.forEach((o) => {
|
|
739
745
|
const r = { v: [] };
|
|
740
|
-
|
|
741
|
-
r.v.push(o[
|
|
746
|
+
e.forEach((l) => {
|
|
747
|
+
r.v.push(o[l] !== void 0 && o[l] !== null ? o[l] : "");
|
|
742
748
|
}), i.push(r);
|
|
743
749
|
}), i;
|
|
744
750
|
}, "#json2Array"));
|
|
745
|
-
|
|
746
|
-
|
|
751
|
+
u(this, le, /* @__PURE__ */ a((s) => (Array.isArray(s) || (s = [s]), s.forEach((e) => {
|
|
752
|
+
e.__ng = t(this, K).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = T.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
747
753
|
}), s), "#defaultInsert"));
|
|
748
|
-
v(this, "add", /* @__PURE__ */
|
|
754
|
+
v(this, "add", /* @__PURE__ */ a((s, e = !0) => {
|
|
749
755
|
var o;
|
|
750
756
|
s === void 0 && (s = {});
|
|
751
|
-
const i =
|
|
752
|
-
|
|
757
|
+
const i = t(this, oe).call(this, s);
|
|
758
|
+
t(this, m).rawRecords = t(this, m).rawRecords.concat(t(this, le).call(this, i)), this.resetRecords();
|
|
753
759
|
const n = this.count() - 1;
|
|
754
|
-
return
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
}), (o =
|
|
760
|
+
return e || i.forEach((r, l) => {
|
|
761
|
+
const d = t(this, m).rawRecords[n - l];
|
|
762
|
+
d && (d.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
763
|
+
}), (o = t(this, m).viewRecords) != null && o.reset && t(this, m).viewRecords.reset(), n;
|
|
758
764
|
}, "add"));
|
|
759
|
-
v(this, "delete", /* @__PURE__ */
|
|
765
|
+
v(this, "delete", /* @__PURE__ */ a((s) => {
|
|
760
766
|
var i;
|
|
761
|
-
let
|
|
762
|
-
Array.isArray(s) ?
|
|
763
|
-
if (
|
|
764
|
-
const o =
|
|
765
|
-
|
|
767
|
+
let e = [];
|
|
768
|
+
Array.isArray(s) ? e = s : typeof s > "u" ? e = [t(this, m).owner.row.at] : e = [parseInt(s, 10)], e.sort((n, o) => o - n).forEach((n) => {
|
|
769
|
+
if (t(this, q)[n]) {
|
|
770
|
+
const o = t(this, q)[n].__ng.rowid;
|
|
771
|
+
t(this, q)[n].__ng.rowState === T.ROW_STATE.INSERT ? t(this, m).rawRecords = t(this, m).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, m).rawRecords.forEach((r) => {
|
|
766
772
|
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
767
773
|
});
|
|
768
774
|
}
|
|
769
|
-
}), this.resetRecords(), (i =
|
|
775
|
+
}), this.resetRecords(), (i = t(this, m).viewRecords) != null && i.reset && t(this, m).viewRecords.reset();
|
|
770
776
|
}, "delete"));
|
|
771
|
-
v(this, "setValue", /* @__PURE__ */
|
|
772
|
-
var
|
|
777
|
+
v(this, "setValue", /* @__PURE__ */ a((s, e, i) => {
|
|
778
|
+
var d;
|
|
773
779
|
s = parseInt(s, 10);
|
|
774
|
-
const o = (typeof ((
|
|
780
|
+
const o = (typeof ((d = t(this, S).fields) == null ? void 0 : d.get) == "function" ? t(this, S).fields.get() : []).indexOf(e);
|
|
775
781
|
if (o < 0) return;
|
|
776
782
|
const r = this.getValidData()[s];
|
|
777
783
|
if (!r) return;
|
|
778
|
-
const
|
|
779
|
-
|
|
784
|
+
const l = r.v[o];
|
|
785
|
+
l !== i && r.__ng.rowState !== T.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(e) || (r.__ng.o[e] = l), r.__ng.rowState = T.ROW_STATE.UPDATE), r.v[o] = i, t(this, m).owner.refreshData && t(this, m).owner.refreshData(s);
|
|
780
786
|
}, "setValue"));
|
|
781
|
-
v(this, "resetRecords", /* @__PURE__ */
|
|
782
|
-
y(this, P,
|
|
783
|
-
s.__ng.rowidx =
|
|
784
|
-
}),
|
|
785
|
-
s.__ng.i =
|
|
787
|
+
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
788
|
+
y(this, P, t(this, m).rawRecords.filter((s) => !s.__ng.deleted)), y(this, q, t(this, m).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), t(this, m).rawRecords.forEach((s, e) => {
|
|
789
|
+
s.__ng.rowidx = e;
|
|
790
|
+
}), t(this, q).forEach((s, e) => {
|
|
791
|
+
s.__ng.i = e;
|
|
786
792
|
});
|
|
787
793
|
}, "resetRecords"));
|
|
788
|
-
v(this, "getValidData", /* @__PURE__ */
|
|
789
|
-
|
|
794
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, q).length === 0 && t(this, m).rawRecords.length > 0 && this.resetRecords(), t(this, q)), "getValidData"));
|
|
795
|
+
u(this, V, /* @__PURE__ */ a((s) => {
|
|
790
796
|
var i;
|
|
791
797
|
if (!s) return s;
|
|
792
|
-
const
|
|
798
|
+
const e = typeof ((i = t(this, S).fields) == null ? void 0 : i.get) == "function" ? t(this, S).fields.get() : [];
|
|
793
799
|
return Array.isArray(s) ? s.filter((n) => !n.__ng.deleted).map((n) => {
|
|
794
800
|
const o = {};
|
|
795
|
-
return
|
|
796
|
-
o[r] = n.v ? n.v[
|
|
801
|
+
return e.forEach((r, l) => {
|
|
802
|
+
o[r] = n.v ? n.v[l] : n[r];
|
|
797
803
|
}), o.__ng = n.__ng, o;
|
|
798
804
|
}) : s;
|
|
799
805
|
}, "#conv2"));
|
|
800
|
-
v(this, "count", /* @__PURE__ */
|
|
801
|
-
v(this, "get", /* @__PURE__ */
|
|
806
|
+
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
807
|
+
v(this, "get", /* @__PURE__ */ a((s, e) => {
|
|
802
808
|
var o;
|
|
803
809
|
const i = this.getValidData();
|
|
804
810
|
if (!i || i.length <= 0) return;
|
|
805
|
-
if (s == null) return
|
|
811
|
+
if (s == null) return t(this, V).call(this, i);
|
|
806
812
|
if (s < 0 || s >= i.length) return null;
|
|
807
|
-
const n = typeof ((o =
|
|
808
|
-
if (
|
|
809
|
-
const r = n.indexOf(
|
|
813
|
+
const n = typeof ((o = t(this, S).fields) == null ? void 0 : o.get) == "function" ? t(this, S).fields.get() : [];
|
|
814
|
+
if (e != null) {
|
|
815
|
+
const r = n.indexOf(e);
|
|
810
816
|
return r >= 0 ? i[s].v[r] : null;
|
|
811
817
|
}
|
|
812
|
-
return
|
|
818
|
+
return t(this, V).call(this, i[s]);
|
|
813
819
|
}, "get"));
|
|
814
|
-
y(this,
|
|
820
|
+
y(this, S, s), y(this, m, e), t(this, re).call(this);
|
|
815
821
|
}
|
|
816
822
|
get source() {
|
|
817
|
-
return
|
|
823
|
+
return t(this, V).call(this, t(this, m).rawRecords);
|
|
818
824
|
}
|
|
819
825
|
set source(s) {
|
|
820
826
|
this.clear(), this.add(s, !1);
|
|
821
827
|
}
|
|
822
828
|
get nextId() {
|
|
823
|
-
return ++
|
|
829
|
+
return ++_e(this, ne)._;
|
|
824
830
|
}
|
|
825
831
|
};
|
|
826
|
-
|
|
832
|
+
S = new WeakMap(), m = new WeakMap(), q = new WeakMap(), P = new WeakMap(), ne = new WeakMap(), M = new WeakMap(), re = new WeakMap(), K = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), V = new WeakMap(), a(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
827
833
|
v(T, "ROW_STATE", {
|
|
828
834
|
EMPTY: "EMPTY",
|
|
829
835
|
NORMAL: "NORMAL",
|
|
@@ -831,57 +837,57 @@ v(T, "ROW_STATE", {
|
|
|
831
837
|
UPDATE: "UPDATE",
|
|
832
838
|
DELETE: "DELETE"
|
|
833
839
|
});
|
|
834
|
-
let
|
|
835
|
-
const
|
|
840
|
+
let ye = T;
|
|
841
|
+
const qe = class qe {
|
|
836
842
|
constructor(s) {
|
|
837
|
-
this.owner = s, this.row = new
|
|
838
|
-
var
|
|
839
|
-
(
|
|
840
|
-
}, this.setDataSource = (
|
|
841
|
-
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(
|
|
842
|
-
}, this.getRowState = (
|
|
843
|
+
this.owner = s, this.row = new pe(this), this.data = new ye(s, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
844
|
+
var e;
|
|
845
|
+
(e = this.owner.view) != null && e.redraw && this.owner.view.redraw();
|
|
846
|
+
}, this.setDataSource = (e) => {
|
|
847
|
+
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
848
|
+
}, this.getRowState = (e) => {
|
|
843
849
|
var n, o;
|
|
844
|
-
const i = parseInt(
|
|
850
|
+
const i = parseInt(e, 10);
|
|
845
851
|
if (!(i >= this.data.count()))
|
|
846
852
|
return (o = (n = this.data.getValidData()[i]) == null ? void 0 : n.__ng) == null ? void 0 : o.rowState;
|
|
847
|
-
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (
|
|
848
|
-
this.row.at =
|
|
849
|
-
}, this.scrollTo_V1 = (
|
|
850
|
-
|
|
853
|
+
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
854
|
+
this.row.at = e;
|
|
855
|
+
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, i) => this.data.get(e, i), this.setColumn = (e, i, n) => {
|
|
856
|
+
e = parseInt(e, 10), this.data.setValue(e, i, n);
|
|
851
857
|
}, this.setDataSource([]);
|
|
852
858
|
}
|
|
853
859
|
};
|
|
854
|
-
|
|
855
|
-
let
|
|
856
|
-
var
|
|
857
|
-
const
|
|
860
|
+
a(qe, "ngDataManager");
|
|
861
|
+
let we = qe;
|
|
862
|
+
var D, ae;
|
|
863
|
+
const Ce = class Ce extends HTMLElement {
|
|
858
864
|
constructor() {
|
|
859
865
|
super();
|
|
860
866
|
//#created = false;
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
this.attachShadow({ mode: "open" }), y(this,
|
|
867
|
+
u(this, D);
|
|
868
|
+
u(this, ae);
|
|
869
|
+
this.attachShadow({ mode: "open" }), y(this, D, new we(this));
|
|
864
870
|
}
|
|
865
871
|
connectedCallback() {
|
|
866
|
-
y(this,
|
|
872
|
+
y(this, ae, new ge(this.shadowRoot)), X.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
867
873
|
}
|
|
868
874
|
disconnectedCallback() {
|
|
869
|
-
|
|
875
|
+
X.log("NineTable disconnected.");
|
|
870
876
|
}
|
|
871
877
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
872
878
|
get data() {
|
|
873
|
-
return
|
|
879
|
+
return t(this, D).data;
|
|
874
880
|
}
|
|
875
881
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
876
882
|
get row() {
|
|
877
|
-
return
|
|
883
|
+
return t(this, D).row;
|
|
878
884
|
}
|
|
879
885
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
880
886
|
get dataManager() {
|
|
881
|
-
return
|
|
887
|
+
return t(this, D);
|
|
882
888
|
}
|
|
883
889
|
};
|
|
884
|
-
|
|
885
|
-
let
|
|
886
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
890
|
+
D = new WeakMap(), ae = new WeakMap(), a(Ce, "NineTable");
|
|
891
|
+
let me = Ce;
|
|
892
|
+
customElements.get("nine-table") || customElements.define("nine-table", me);
|
|
887
893
|
//# sourceMappingURL=nine-table.js.map
|