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