@ninebone/table 0.0.145 β 0.0.147
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 +262 -239
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +21 -13
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var $e = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var ze = (w,
|
|
6
|
-
var a = (w,
|
|
7
|
-
var v = (w,
|
|
8
|
-
var e = (w,
|
|
9
|
-
var He = (w,
|
|
5
|
+
var ze = (w, s, t) => s in w ? Me(w, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[s] = t;
|
|
6
|
+
var a = (w, s) => Me(w, "name", { value: s, configurable: !0 });
|
|
7
|
+
var v = (w, s, t) => ze(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)), u = (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 He = (w, s, t, i) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
p(w,
|
|
11
|
+
p(w, s, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return e(w,
|
|
14
|
+
return e(w, s, i);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as We } from "@ninebone/util";
|
|
@@ -42,10 +42,10 @@ const Te = class Te extends HTMLElement {
|
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
44
|
if (!e(this, _) || !e(this, y) || e(this, O)) return;
|
|
45
|
-
const t = e(this, y).container,
|
|
46
|
-
if (!
|
|
47
|
-
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, _).querySelector(".ng-container-bottom"), l = t.clientWidth,
|
|
48
|
-
if (l !== 0 &&
|
|
45
|
+
const t = e(this, y).container, i = t.querySelector("table");
|
|
46
|
+
if (!i) return;
|
|
47
|
+
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, _).querySelector(".ng-container-bottom"), l = t.clientWidth, b = i.scrollWidth;
|
|
48
|
+
if (l !== 0 && b > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
@@ -53,32 +53,32 @@ const Te = class Te extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const c = n.clientWidth;
|
|
55
55
|
if (c <= 0) return;
|
|
56
|
-
const h = Math.max(Math.min(c * (l /
|
|
56
|
+
const h = Math.max(Math.min(c * (l / b), c), 20);
|
|
57
57
|
o.style.width = `${h}px`;
|
|
58
58
|
let d = 0;
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const x =
|
|
59
|
+
const g = i.style.transform;
|
|
60
|
+
if (g && g.includes("translateX")) {
|
|
61
|
+
const x = g.match(/translateX\(([-\d.]+)px\)/);
|
|
62
62
|
x && x[1] && (d = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
|
-
d = parseInt(
|
|
65
|
-
let f = parseInt(Math.abs(d) * c /
|
|
64
|
+
d = parseInt(i.style.left || 0, 10);
|
|
65
|
+
let f = parseInt(Math.abs(d) * c / b, 10);
|
|
66
66
|
f < 0 && (f = 0);
|
|
67
67
|
const S = c - h;
|
|
68
68
|
f > S && (f = S), o.style.left = `${f}px`, e(this, y).left.disabled = f === 0, e(this, y).right.disabled = f >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
70
|
u(this, P, /* @__PURE__ */ a((t) => {
|
|
71
71
|
if (!e(this, y)) return !1;
|
|
72
|
-
const
|
|
72
|
+
const i = e(this, y).container, n = i.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
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 c =
|
|
80
|
-
let d =
|
|
81
|
-
return -d > h - c && (d = -(h - c)), -d + 5 > h - c && (d = -(h - c)), c >= h && (d = 0), n.style.transform = `translateX(${d}px)`, l > 0 && l <
|
|
77
|
+
const b = o.width - r;
|
|
78
|
+
l > b && (l = b), 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 >= b - 1;
|
|
79
|
+
const c = i.clientWidth, h = n.scrollWidth;
|
|
80
|
+
let d = b > 0 ? -l * (h - c) / b : 0;
|
|
81
|
+
return -d > h - c && (d = -(h - c)), -d + 5 > h - c && (d = -(h - c)), c >= h && (d = 0), n.style.transform = `translateX(${d}px)`, l > 0 && l < b - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
83
|
u(this, te, /* @__PURE__ */ a(() => {
|
|
84
84
|
const t = /* @__PURE__ */ a((n) => {
|
|
@@ -90,11 +90,11 @@ const Te = class Te extends HTMLElement {
|
|
|
90
90
|
e(this, P).call(this, r + n) || clearInterval(e(this, D));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
|
-
}, "delayScroll"),
|
|
93
|
+
}, "delayScroll"), i = /* @__PURE__ */ a(() => {
|
|
94
94
|
clearInterval(e(this, B)), clearInterval(e(this, D));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
|
-
e(this, y).left.addEventListener(n,
|
|
97
|
+
e(this, y).left.addEventListener(n, i), e(this, y).right.addEventListener(n, i), e(this, y).track.addEventListener(n, i);
|
|
98
98
|
}), e(this, y).left.addEventListener("mousedown", (n) => {
|
|
99
99
|
n.button === 0 && t(-20);
|
|
100
100
|
}), e(this, y).right.addEventListener("mousedown", (n) => {
|
|
@@ -109,10 +109,10 @@ const Te = class Te extends HTMLElement {
|
|
|
109
109
|
n.stopPropagation(), n.preventDefault(), p(this, O, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
110
|
const o = /* @__PURE__ */ a((l) => {
|
|
111
111
|
if (!e(this, O)) return;
|
|
112
|
-
const
|
|
113
|
-
e(this, P).call(this, l.clientX -
|
|
112
|
+
const b = e(this, y).track.getBoundingClientRect();
|
|
113
|
+
e(this, P).call(this, l.clientX - b.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
115
|
-
p(this, O, !1),
|
|
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
|
});
|
|
@@ -184,13 +184,13 @@ const Te = class Te extends HTMLElement {
|
|
|
184
184
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
185
185
|
`;
|
|
186
186
|
const t = /* @__PURE__ */ a(() => {
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
187
|
+
const i = e(this, _).querySelector(".ng-container-body");
|
|
188
|
+
if (!i) {
|
|
189
189
|
setTimeout(t, 10);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
p(this, y, {
|
|
193
|
-
container:
|
|
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"),
|
|
@@ -206,71 +206,71 @@ const Te = class Te extends HTMLElement {
|
|
|
206
206
|
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), ee = new WeakMap(), P = new WeakMap(), te = new WeakMap(), a(Te, "NineTableHScrollBar");
|
|
207
207
|
let ge = Te;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ge);
|
|
209
|
-
var
|
|
209
|
+
var V, M, q, I, $, H, se, ie;
|
|
210
210
|
const qe = class qe {
|
|
211
|
-
constructor(
|
|
212
|
-
u(this,
|
|
213
|
-
u(this,
|
|
211
|
+
constructor(s) {
|
|
212
|
+
u(this, V);
|
|
213
|
+
u(this, M, []);
|
|
214
214
|
u(this, q, null);
|
|
215
215
|
u(this, I, null);
|
|
216
|
-
u(this,
|
|
216
|
+
u(this, $, 0);
|
|
217
217
|
u(this, H, 0);
|
|
218
|
-
u(this,
|
|
219
|
-
e(this,
|
|
218
|
+
u(this, se, /* @__PURE__ */ a(() => {
|
|
219
|
+
e(this, ie).call(this);
|
|
220
220
|
}, "#init"));
|
|
221
221
|
/**
|
|
222
222
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
223
223
|
*/
|
|
224
|
-
u(this,
|
|
225
|
-
!e(this,
|
|
226
|
-
for (const t of
|
|
227
|
-
const
|
|
228
|
-
if (!
|
|
224
|
+
u(this, ie, /* @__PURE__ */ a(() => {
|
|
225
|
+
!e(this, V) || !(e(this, V) instanceof HTMLElement) || (p(this, I, new ResizeObserver((s) => {
|
|
226
|
+
for (const t of s) {
|
|
227
|
+
const i = t.target;
|
|
228
|
+
if (!i.classList.contains("active"))
|
|
229
229
|
continue;
|
|
230
230
|
const n = t.contentRect.height || (t.borderBoxSize && t.borderBoxSize[0] ? t.borderBoxSize[0].blockSize : 0);
|
|
231
231
|
if (n > 0) {
|
|
232
|
-
const o =
|
|
232
|
+
const o = i.clientHeight || i.getBoundingClientRect().height || n;
|
|
233
233
|
let r = 0;
|
|
234
|
-
const l =
|
|
235
|
-
|
|
234
|
+
const l = i.querySelector(".ng-container-body") || i, b = l.querySelector("thead"), c = l.querySelector("tfoot");
|
|
235
|
+
b && (r += b.offsetHeight || b.getBoundingClientRect().height), c && (r += c.offsetHeight || c.getBoundingClientRect().height);
|
|
236
236
|
const h = Math.max(o - r, 100);
|
|
237
|
-
if (e(this,
|
|
238
|
-
const d = Math.ceil(e(this,
|
|
239
|
-
p(this, H, d + 20), j.log(`[RowManager] Resized. Height: ${e(this,
|
|
240
|
-
const f =
|
|
237
|
+
if (e(this, $) !== h && (p(this, $, h), e(this, q) !== null)) {
|
|
238
|
+
const d = Math.ceil(e(this, $) / e(this, q));
|
|
239
|
+
p(this, H, d + 20), j.log(`[RowManager] Resized. Height: ${e(this, $)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
240
|
+
const f = i.querySelector(g);
|
|
241
241
|
f && f.querySelector("tbody") && this.renderRows(f);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
})), e(this, I).observe(e(this,
|
|
246
|
+
})), e(this, I).observe(e(this, V)));
|
|
247
247
|
}, "#initResizeObserver"));
|
|
248
|
-
v(this, "initTemplate", /* @__PURE__ */ a((
|
|
249
|
-
const t =
|
|
248
|
+
v(this, "initTemplate", /* @__PURE__ */ a((s) => {
|
|
249
|
+
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
250
250
|
if (!t) return;
|
|
251
|
-
const
|
|
252
|
-
p(this,
|
|
251
|
+
const i = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
252
|
+
p(this, M, i.map((n) => n.cloneNode(!0))), p(this, q, null), console.log(`[RowManager] Template initialized with ${e(this, M).length} row(s).`);
|
|
253
253
|
}, "initTemplate"));
|
|
254
|
-
v(this, "measureAndCacheHeight", /* @__PURE__ */ a((
|
|
254
|
+
v(this, "measureAndCacheHeight", /* @__PURE__ */ a((s) => {
|
|
255
255
|
if (e(this, q) !== null)
|
|
256
256
|
return e(this, q);
|
|
257
|
-
if (e(this,
|
|
257
|
+
if (e(this, M).length === 0)
|
|
258
258
|
throw new Error("[RowManager] Template TRs are empty.");
|
|
259
|
-
const t =
|
|
259
|
+
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
260
260
|
if (!t) return 24;
|
|
261
261
|
t.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
262
|
-
const
|
|
263
|
-
e(this,
|
|
262
|
+
const i = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
263
|
+
e(this, M).forEach((l) => {
|
|
264
264
|
n.appendChild(l.cloneNode(!0));
|
|
265
|
-
}),
|
|
265
|
+
}), i ? i.before(n) : t.appendChild(n);
|
|
266
266
|
let o = 0;
|
|
267
|
-
if (t.querySelectorAll("tr:not(.nodata)").forEach((l,
|
|
267
|
+
if (t.querySelectorAll("tr:not(.nodata)").forEach((l, b) => {
|
|
268
268
|
const c = l.offsetHeight;
|
|
269
269
|
if (c === 0)
|
|
270
|
-
throw new Error(`[RowManager] Rendered TR[${
|
|
270
|
+
throw new Error(`[RowManager] Rendered TR[${b}] height is 0. Check CSS styles.`);
|
|
271
271
|
o += c;
|
|
272
|
-
}), p(this, q, o), e(this,
|
|
273
|
-
const l = Math.ceil(e(this,
|
|
272
|
+
}), p(this, q, o), e(this, $) > 0) {
|
|
273
|
+
const l = Math.ceil(e(this, $) / e(this, q));
|
|
274
274
|
p(this, H, l + 20);
|
|
275
275
|
}
|
|
276
276
|
return console.log(`[RowManager] Template Height Cached: ${e(this, q)}px | RowCount: ${e(this, H)}`), e(this, q);
|
|
@@ -291,85 +291,85 @@ const qe = class qe {
|
|
|
291
291
|
/**
|
|
292
292
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
293
293
|
*/
|
|
294
|
-
v(this, "renderRows", /* @__PURE__ */ a((
|
|
295
|
-
if (e(this,
|
|
296
|
-
const t =
|
|
294
|
+
v(this, "renderRows", /* @__PURE__ */ a((s) => {
|
|
295
|
+
if (e(this, M).length === 0) return;
|
|
296
|
+
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
297
297
|
if (!t) return;
|
|
298
298
|
t.querySelectorAll("tr:not(.nodata)").forEach((r) => r.remove());
|
|
299
|
-
const
|
|
299
|
+
const i = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), o = e(this, H);
|
|
300
300
|
for (let r = 0; r < o; r++)
|
|
301
|
-
e(this,
|
|
301
|
+
e(this, M).forEach((l) => {
|
|
302
302
|
n.appendChild(l.cloneNode(!0));
|
|
303
303
|
});
|
|
304
|
-
|
|
304
|
+
i ? i.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${o} sets into DOM.`);
|
|
305
305
|
}, "renderRows"));
|
|
306
306
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
307
307
|
e(this, I) && (e(this, I).disconnect(), p(this, I, null));
|
|
308
308
|
}, "destroy"));
|
|
309
|
-
p(this,
|
|
309
|
+
p(this, V, s), e(this, se).call(this);
|
|
310
310
|
}
|
|
311
311
|
get templateLength() {
|
|
312
|
-
return e(this,
|
|
312
|
+
return e(this, M).length || 1;
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
|
-
|
|
315
|
+
V = new WeakMap(), M = new WeakMap(), q = new WeakMap(), I = new WeakMap(), $ = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), a(qe, "RowManager");
|
|
316
316
|
let pe = qe;
|
|
317
|
-
var
|
|
317
|
+
var L, F, ne;
|
|
318
318
|
const Z = class Z extends HTMLElement {
|
|
319
319
|
constructor() {
|
|
320
320
|
super();
|
|
321
|
-
u(this,
|
|
321
|
+
u(this, L, null);
|
|
322
322
|
u(this, F);
|
|
323
323
|
v(this, "init", /* @__PURE__ */ a((t) => {
|
|
324
324
|
if (!t) return;
|
|
325
|
-
const
|
|
326
|
-
const h = /* @__PURE__ */ a((
|
|
327
|
-
if (
|
|
328
|
-
const f =
|
|
325
|
+
const i = /* @__PURE__ */ a((c) => {
|
|
326
|
+
const h = /* @__PURE__ */ a((g) => {
|
|
327
|
+
if (g.querySelector("colgroup")) return;
|
|
328
|
+
const f = g.querySelector("tbody tr") || g.querySelector("tr"), S = f ? f.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), C = Math.max(Math.floor((g.clientWidth || 600) / S), 100);
|
|
329
329
|
for (let R = 0; R < S; R++) {
|
|
330
330
|
const ue = document.createElement("col");
|
|
331
331
|
ue.setAttribute("width", C), x.appendChild(ue);
|
|
332
332
|
}
|
|
333
|
-
|
|
334
|
-
}, "ensureColgroup"), d = /* @__PURE__ */ a((
|
|
335
|
-
if (
|
|
336
|
-
const f = document.createElement("thead"), S =
|
|
337
|
-
S ? S.after(f) :
|
|
333
|
+
g.prepend(x);
|
|
334
|
+
}, "ensureColgroup"), d = /* @__PURE__ */ a((g) => {
|
|
335
|
+
if (g.querySelector("thead")) return;
|
|
336
|
+
const f = document.createElement("thead"), S = g.querySelector("colgroup");
|
|
337
|
+
S ? S.after(f) : g.prepend(f);
|
|
338
338
|
}, "ensureThead");
|
|
339
339
|
return h(c), d(c), c.classList.add("nine-table-element"), c;
|
|
340
340
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
341
|
-
p(this,
|
|
342
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"),
|
|
343
|
-
const
|
|
341
|
+
p(this, L, i(n)), e(this, L).style.display = "table", e(this, F).initTemplate(e(this, L));
|
|
342
|
+
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), b = /* @__PURE__ */ a((c, h, d = !1) => {
|
|
343
|
+
const g = c.cloneNode(!0), f = Array.from(g.querySelectorAll("colgroup col")), S = [];
|
|
344
344
|
return f.forEach((x, C) => {
|
|
345
345
|
const R = x.getAttribute("fixed");
|
|
346
346
|
(d ? !R || R === "" : R === h) || S.push(C);
|
|
347
347
|
}), S.reverse().forEach((x) => {
|
|
348
|
-
f[x] && f[x].remove(),
|
|
348
|
+
f[x] && f[x].remove(), g.querySelectorAll("tr").forEach((C) => {
|
|
349
349
|
const R = C.querySelectorAll("th, td");
|
|
350
350
|
R[x] && R[x].remove();
|
|
351
351
|
});
|
|
352
|
-
}),
|
|
352
|
+
}), g;
|
|
353
353
|
}, "filterTableByFixed");
|
|
354
354
|
if (r) {
|
|
355
|
-
const c =
|
|
355
|
+
const c = b(e(this, L), null, !0);
|
|
356
356
|
r.innerHTML = "", r.appendChild(c), e(this, F).measureAndCacheHeight(r);
|
|
357
357
|
}
|
|
358
358
|
if (o) {
|
|
359
|
-
const c =
|
|
359
|
+
const c = b(e(this, L), "left", !1);
|
|
360
360
|
let h = 0;
|
|
361
|
-
c.querySelectorAll("col").forEach((
|
|
362
|
-
const f = parseInt(
|
|
361
|
+
c.querySelectorAll("col").forEach((g) => {
|
|
362
|
+
const f = parseInt(g.getAttribute("width"), 10);
|
|
363
363
|
isNaN(f) || (h += f);
|
|
364
364
|
}), o.innerHTML = "", o.appendChild(c);
|
|
365
365
|
const d = h > 0 ? h : 0;
|
|
366
366
|
o.style.flex = `0 0 ${d}px`, o.style.width = `${d}px`;
|
|
367
367
|
}
|
|
368
368
|
if (l) {
|
|
369
|
-
const c =
|
|
369
|
+
const c = b(e(this, L), "right", !1);
|
|
370
370
|
let h = 0;
|
|
371
|
-
c.querySelectorAll("col").forEach((
|
|
372
|
-
const f = parseInt(
|
|
371
|
+
c.querySelectorAll("col").forEach((g) => {
|
|
372
|
+
const f = parseInt(g.getAttribute("width"), 10);
|
|
373
373
|
isNaN(f) || (h += f);
|
|
374
374
|
}), l.innerHTML = "", l.appendChild(c);
|
|
375
375
|
const d = h > 0 ? h : 0;
|
|
@@ -387,14 +387,14 @@ const Z = class Z extends HTMLElement {
|
|
|
387
387
|
c && typeof c.refresh == "function" && c.refresh();
|
|
388
388
|
}, 0), j.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
389
389
|
}, "init"));
|
|
390
|
-
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this,
|
|
390
|
+
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this, L) ? e(this, L).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
391
391
|
v(this, "scrollToX", /* @__PURE__ */ a((t) => {
|
|
392
|
-
const
|
|
393
|
-
|
|
392
|
+
const i = this.querySelector(".ng-container-body");
|
|
393
|
+
i && (i.scrollLeft = t);
|
|
394
394
|
}, "scrollToX"));
|
|
395
395
|
v(this, "scrollToY", /* @__PURE__ */ a((t) => {
|
|
396
|
-
const
|
|
397
|
-
|
|
396
|
+
const i = this.querySelector(".ng-container-body");
|
|
397
|
+
i && (i.scrollTop = t);
|
|
398
398
|
}, "scrollToY"));
|
|
399
399
|
u(this, ne, /* @__PURE__ */ a(() => {
|
|
400
400
|
const t = Z.SCROLLBAR_SIZE;
|
|
@@ -522,7 +522,7 @@ const Z = class Z extends HTMLElement {
|
|
|
522
522
|
this.innerHTML = "", j.log("NineTableSheet destroyed.");
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
|
-
|
|
525
|
+
L = new WeakMap(), F = new WeakMap(), ne = new WeakMap(), a(Z, "NineTableSheet"), v(Z, "SCROLLBAR_SIZE", 16);
|
|
526
526
|
let ye = Z;
|
|
527
527
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ye);
|
|
528
528
|
var re;
|
|
@@ -531,33 +531,33 @@ const ke = class ke extends HTMLElement {
|
|
|
531
531
|
super();
|
|
532
532
|
u(this, re, /* @__PURE__ */ a(() => {
|
|
533
533
|
const t = this.querySelector(".nine-tab-bar");
|
|
534
|
-
t && (t.addEventListener("click", (
|
|
535
|
-
const n =
|
|
534
|
+
t && (t.addEventListener("click", (i) => {
|
|
535
|
+
const n = i.target.closest(".nine-tab-item");
|
|
536
536
|
if (!n) return;
|
|
537
|
-
const o =
|
|
537
|
+
const o = i.ctrlKey || i.metaKey || i.shiftKey, r = parseInt(n.dataset.index, 10);
|
|
538
538
|
this.switchSheet(r, o);
|
|
539
539
|
}), this.switchSheet(0, !1));
|
|
540
540
|
}, "#init"));
|
|
541
|
-
v(this, "switchSheet", /* @__PURE__ */ a((t,
|
|
541
|
+
v(this, "switchSheet", /* @__PURE__ */ a((t, i = !1) => {
|
|
542
542
|
const n = /* @__PURE__ */ a(() => {
|
|
543
543
|
const d = this.querySelector("nine-table-sheets-body");
|
|
544
544
|
d.querySelectorAll("nine-splitter").forEach((f) => {
|
|
545
545
|
const S = parseInt(f.dataset.splitIndex, 10), x = d.querySelector(`nine-table-sheet[data-index="${S - 1}"]`), C = d.querySelector(`nine-table-sheet[data-index="${S}"]`);
|
|
546
546
|
x && C && x.classList.contains("active") && C.classList.contains("active") ? f.classList.add("active") : f.classList.remove("active");
|
|
547
547
|
});
|
|
548
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"),
|
|
548
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), b = r.querySelectorAll("nine-table-sheet");
|
|
549
549
|
if (!l[t]) return;
|
|
550
|
-
if (!
|
|
551
|
-
l.forEach((d,
|
|
552
|
-
d.classList.toggle("active",
|
|
553
|
-
const f = r.querySelector(`nine-table-sheet[data-index="${
|
|
550
|
+
if (!i)
|
|
551
|
+
l.forEach((d, g) => {
|
|
552
|
+
d.classList.toggle("active", g === t);
|
|
553
|
+
const f = r.querySelector(`nine-table-sheet[data-index="${g}"]`);
|
|
554
554
|
f && (f.style.flex = "");
|
|
555
|
-
}),
|
|
556
|
-
d.classList.toggle("active",
|
|
555
|
+
}), b.forEach((d, g) => {
|
|
556
|
+
d.classList.toggle("active", g === t);
|
|
557
557
|
});
|
|
558
558
|
else {
|
|
559
|
-
const d = l[t],
|
|
560
|
-
if (d.classList.contains("active") &&
|
|
559
|
+
const d = l[t], g = o.querySelectorAll(".nine-tab-item.active");
|
|
560
|
+
if (d.classList.contains("active") && g.length <= 1)
|
|
561
561
|
return;
|
|
562
562
|
d.classList.toggle("active");
|
|
563
563
|
const f = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
@@ -566,8 +566,8 @@ const ke = class ke extends HTMLElement {
|
|
|
566
566
|
const c = Array.from(r.querySelectorAll("nine-table-sheet.active"));
|
|
567
567
|
if (c.length > 1) {
|
|
568
568
|
const d = 1 / c.length;
|
|
569
|
-
c.forEach((
|
|
570
|
-
(!
|
|
569
|
+
c.forEach((g) => {
|
|
570
|
+
(!g.style.flex || g.style.flex === "1 1 100%") && (g.style.flex = `${d} ${d} 0px`);
|
|
571
571
|
});
|
|
572
572
|
} else
|
|
573
573
|
c.forEach((d) => {
|
|
@@ -588,33 +588,48 @@ const ke = class ke extends HTMLElement {
|
|
|
588
588
|
re = new WeakMap(), a(ke, "NineTableSheets");
|
|
589
589
|
let we = ke;
|
|
590
590
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
591
|
-
var
|
|
592
|
-
const
|
|
593
|
-
constructor(
|
|
594
|
-
u(this,
|
|
591
|
+
var k, G, oe, J, le;
|
|
592
|
+
const Ae = class Ae {
|
|
593
|
+
constructor(s) {
|
|
594
|
+
u(this, k);
|
|
595
595
|
u(this, G, null);
|
|
596
596
|
u(this, oe, /* @__PURE__ */ a(() => {
|
|
597
|
-
const
|
|
598
|
-
|
|
599
|
-
for (let
|
|
600
|
-
|
|
601
|
-
})), e(this, G).observe(
|
|
597
|
+
const s = e(this, k).host;
|
|
598
|
+
s && (p(this, G, new ResizeObserver((t) => {
|
|
599
|
+
for (let i of t)
|
|
600
|
+
s.getAttribute("auto-height") === "true" && e(this, J).call(this, s);
|
|
601
|
+
})), e(this, G).observe(s));
|
|
602
602
|
}, "#observeResize"));
|
|
603
|
-
u(this, J, /* @__PURE__ */ a((
|
|
603
|
+
u(this, J, /* @__PURE__ */ a((s) => {
|
|
604
604
|
var C, R;
|
|
605
|
-
const t = (C =
|
|
605
|
+
const t = (C = s.shadowRoot) == null ? void 0 : C.querySelector("nine-table-sheet.active");
|
|
606
606
|
if (!t) return;
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
const x = e(this,
|
|
610
|
-
x && (x.style.overflowY =
|
|
607
|
+
const i = ((R = t.getRowCount) == null ? void 0 : R.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, b = e(this, k).querySelector("nine-table-header"), c = e(this, k).querySelector("nine-table-sheets-footer"), h = b ? b.getBoundingClientRect().height : 40, d = c ? c.getBoundingClientRect().height : 32, f = h + d + 16, S = o * l + f;
|
|
608
|
+
s.style.height = `${S}px`, s.style.maxHeight = `${n * l + f}px`;
|
|
609
|
+
const x = e(this, k).querySelector("nine-table-sheets-body");
|
|
610
|
+
x && (x.style.overflowY = i > n ? "auto" : "hidden");
|
|
611
611
|
}, "#applyAutoHeight"));
|
|
612
|
+
/**
|
|
613
|
+
* π― νλ©΄μ λμμ νμ±νλ μνΈλ€μ μΈμ μνμ λ°λΌ μ€ν리ν°(.h)λ₯Ό μ νν μΌκ³ λλ λ©μλ
|
|
614
|
+
*/
|
|
615
|
+
/**
|
|
616
|
+
* π― μνΈ κ°μμ λ·° μνμ λ§κ² μ€νλ¦¬ν° κ°μμ± μΌκ΄ λκΈ°ν
|
|
617
|
+
*/
|
|
618
|
+
v(this, "updateSplitters", /* @__PURE__ */ a(() => {
|
|
619
|
+
const s = e(this, k).querySelector("nine-table-sheets-body");
|
|
620
|
+
if (!s) return;
|
|
621
|
+
const t = Array.from(s.querySelectorAll("nine-table-sheet")), i = Array.from(s.querySelectorAll("nine-splitter.h")), o = t.filter((r) => r.classList.contains("active")).length > 1;
|
|
622
|
+
i.forEach((r, l) => {
|
|
623
|
+
const b = t[l], c = t[l + 1];
|
|
624
|
+
o && b && c && b.classList.contains("active") && c.classList.contains("active") ? r.style.display = "block" : r.style.display = "none";
|
|
625
|
+
});
|
|
626
|
+
}, "updateSplitters"));
|
|
612
627
|
u(this, le, /* @__PURE__ */ a(() => {
|
|
613
|
-
const
|
|
614
|
-
const
|
|
615
|
-
return
|
|
616
|
-
}).join(""), l =
|
|
617
|
-
e(this,
|
|
628
|
+
const s = e(this, k).host, i = Array.from(s.children).filter((c) => c.tagName === "TABLE"), n = s.getAttribute("auto-height") === "true", o = i.length, r = i.map((c, h) => {
|
|
629
|
+
const g = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, f = h < o - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
630
|
+
return g + f;
|
|
631
|
+
}).join(""), l = i.map((c, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
632
|
+
e(this, k).innerHTML = `
|
|
618
633
|
<style>
|
|
619
634
|
:host {
|
|
620
635
|
display: flex;
|
|
@@ -656,6 +671,16 @@ const Ce = class Ce {
|
|
|
656
671
|
nine-table-sheet.active {
|
|
657
672
|
display: block !important;
|
|
658
673
|
}
|
|
674
|
+
|
|
675
|
+
/* π― κΈ°λ³Έ μ€νλ¦¬ν° (.h) μ€νμΌ (λμ μ μ΄μ κΈ°μ ) */
|
|
676
|
+
nine-table-sheets-body nine-splitter.h {
|
|
677
|
+
width: 4px;
|
|
678
|
+
background: #e5e7eb;
|
|
679
|
+
cursor: col-resize;
|
|
680
|
+
flex-shrink: 0;
|
|
681
|
+
display: none; /* κΈ°λ³Έμ μ¨κΉ, updateSplittersλ‘ μ μ΄ */
|
|
682
|
+
}
|
|
683
|
+
|
|
659
684
|
nine-table-sheets-footer {
|
|
660
685
|
display: flex;
|
|
661
686
|
height: 32px;
|
|
@@ -685,6 +710,13 @@ const Ce = class Ce {
|
|
|
685
710
|
border-radius: 0 0 3px 3px;
|
|
686
711
|
user-select: none;
|
|
687
712
|
}
|
|
713
|
+
nine-table-sheets-body nine-splitter.h {
|
|
714
|
+
width: 4px;
|
|
715
|
+
background: #e5e7eb;
|
|
716
|
+
cursor: col-resize;
|
|
717
|
+
flex-shrink: 0;
|
|
718
|
+
display: ${o > 1 ? "block" : "none"};
|
|
719
|
+
}
|
|
688
720
|
nine-table-sheets .nine-tab-item.active {
|
|
689
721
|
background: #ffffff;
|
|
690
722
|
color: #111827;
|
|
@@ -697,15 +729,6 @@ const Ce = class Ce {
|
|
|
697
729
|
padding-left: 12px;
|
|
698
730
|
flex-shrink: 0;
|
|
699
731
|
}
|
|
700
|
-
|
|
701
|
-
/* π― νμ μ μμ μΌλ‘ μ μ§λλ μ€νλ¦¬ν° κΈ°λ³Έ μ€νμΌ λ° κΈ°λ³Έ λ
ΈμΆ */
|
|
702
|
-
nine-table-sheets-body nine-splitter.h {
|
|
703
|
-
width: 4px;
|
|
704
|
-
background: #e5e7eb;
|
|
705
|
-
cursor: col-resize;
|
|
706
|
-
flex-shrink: 0;
|
|
707
|
-
display: ${o > 1 ? "block" : "none"};
|
|
708
|
-
}
|
|
709
732
|
</style>
|
|
710
733
|
|
|
711
734
|
<nine-table-header></nine-table-header>
|
|
@@ -722,62 +745,62 @@ const Ce = class Ce {
|
|
|
722
745
|
</nine-table-body>
|
|
723
746
|
<nine-table-footer></nine-table-footer>
|
|
724
747
|
`;
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
c.init(
|
|
748
|
+
const b = e(this, k).querySelectorAll("nine-table-sheet");
|
|
749
|
+
b == null || b.forEach((c, h) => {
|
|
750
|
+
i[h] && setTimeout(() => {
|
|
751
|
+
c.init(i[h]), n && e(this, J).call(this, s), this.updateSplitters();
|
|
729
752
|
});
|
|
730
753
|
});
|
|
731
754
|
}, "#render"));
|
|
732
|
-
p(this,
|
|
755
|
+
p(this, k, s), e(this, le).call(this), e(this, oe).call(this);
|
|
733
756
|
}
|
|
734
757
|
};
|
|
735
|
-
|
|
736
|
-
let me =
|
|
737
|
-
var z,
|
|
738
|
-
const
|
|
739
|
-
constructor(
|
|
758
|
+
k = new WeakMap(), G = new WeakMap(), oe = new WeakMap(), J = new WeakMap(), le = new WeakMap(), a(Ae, "LayoutManager");
|
|
759
|
+
let me = Ae;
|
|
760
|
+
var z, X;
|
|
761
|
+
const Ce = class Ce {
|
|
762
|
+
constructor(s) {
|
|
740
763
|
u(this, z);
|
|
741
|
-
u(this,
|
|
764
|
+
u(this, X, -1);
|
|
742
765
|
v(this, "count", /* @__PURE__ */ a(() => e(this, z).rawRecords.length, "count"));
|
|
743
|
-
p(this, z,
|
|
766
|
+
p(this, z, s);
|
|
744
767
|
}
|
|
745
768
|
get at() {
|
|
746
|
-
return e(this,
|
|
769
|
+
return e(this, X);
|
|
747
770
|
}
|
|
748
|
-
set at(
|
|
749
|
-
var
|
|
750
|
-
p(this,
|
|
751
|
-
const t = ((n = (
|
|
752
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
771
|
+
set at(s) {
|
|
772
|
+
var i, n;
|
|
773
|
+
p(this, X, parseInt(s, 10));
|
|
774
|
+
const t = ((n = (i = e(this, z).owner).querySelector) == null ? void 0 : n.call(i, ".ng-container-body")) || e(this, z).owner.body;
|
|
775
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, X)}"]`) && setTimeout(() => {
|
|
753
776
|
var o, r;
|
|
754
|
-
(r = (o = e(this, z).owner).scrollTo_V1) == null || r.call(o, e(this,
|
|
777
|
+
(r = (o = e(this, z).owner).scrollTo_V1) == null || r.call(o, e(this, X));
|
|
755
778
|
});
|
|
756
779
|
}
|
|
757
780
|
};
|
|
758
|
-
z = new WeakMap(),
|
|
759
|
-
let ve =
|
|
760
|
-
var E, m,
|
|
781
|
+
z = new WeakMap(), X = new WeakMap(), a(Ce, "ngRow");
|
|
782
|
+
let ve = Ce;
|
|
783
|
+
var E, m, A, U, ae, W, ce, Q, he, de, K;
|
|
761
784
|
const T = class T {
|
|
762
|
-
constructor(
|
|
785
|
+
constructor(s, t) {
|
|
763
786
|
u(this, E);
|
|
764
787
|
u(this, m);
|
|
765
|
-
u(this,
|
|
788
|
+
u(this, A, []);
|
|
766
789
|
u(this, U, []);
|
|
767
790
|
u(this, ae, 0);
|
|
768
791
|
u(this, W, []);
|
|
769
792
|
u(this, ce, /* @__PURE__ */ a(() => {
|
|
770
793
|
p(this, W, []);
|
|
771
|
-
const
|
|
772
|
-
Array.from(
|
|
773
|
-
var
|
|
774
|
-
e(this, W).push(((
|
|
794
|
+
const s = e(this, E).template || [];
|
|
795
|
+
Array.from(s).forEach((t) => {
|
|
796
|
+
var i;
|
|
797
|
+
e(this, W).push(((i = t.getBoundingClientRect) == null ? void 0 : i.call(t).height) || 24);
|
|
775
798
|
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
776
799
|
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this, W).slice();
|
|
777
800
|
});
|
|
778
801
|
}, "#initialize"));
|
|
779
|
-
v(this, "set", /* @__PURE__ */ a((
|
|
780
|
-
this.clear(), this.add(
|
|
802
|
+
v(this, "set", /* @__PURE__ */ a((s) => {
|
|
803
|
+
this.clear(), this.add(s, !1);
|
|
781
804
|
}, "set"));
|
|
782
805
|
u(this, Q, /* @__PURE__ */ a(() => ({
|
|
783
806
|
rowState: T.ROW_STATE.EMPTY,
|
|
@@ -789,105 +812,105 @@ const T = class T {
|
|
|
789
812
|
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, W).slice(), -1, {}, {}]
|
|
790
813
|
}), "#getDefaultMeta"));
|
|
791
814
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
792
|
-
p(this,
|
|
815
|
+
p(this, A, []), p(this, U, []);
|
|
793
816
|
}, "reset"));
|
|
794
817
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
795
|
-
var
|
|
796
|
-
e(this, m).rawRecords = [], p(this,
|
|
818
|
+
var s;
|
|
819
|
+
e(this, m).rawRecords = [], p(this, A, []), p(this, U, []), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
797
820
|
}, "clear"));
|
|
798
|
-
u(this, he, /* @__PURE__ */ a((
|
|
821
|
+
u(this, he, /* @__PURE__ */ a((s) => {
|
|
799
822
|
var n;
|
|
800
|
-
Array.isArray(
|
|
801
|
-
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(
|
|
802
|
-
return
|
|
823
|
+
Array.isArray(s) || (s = [s]);
|
|
824
|
+
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(s[0] || {}), i = [];
|
|
825
|
+
return s.forEach((o) => {
|
|
803
826
|
const r = { v: [] };
|
|
804
827
|
t.forEach((l) => {
|
|
805
828
|
r.v.push(o[l] !== void 0 && o[l] !== null ? o[l] : "");
|
|
806
|
-
}),
|
|
807
|
-
}),
|
|
829
|
+
}), i.push(r);
|
|
830
|
+
}), i;
|
|
808
831
|
}, "#json2Array"));
|
|
809
|
-
u(this, de, /* @__PURE__ */ a((
|
|
832
|
+
u(this, de, /* @__PURE__ */ a((s) => (Array.isArray(s) || (s = [s]), s.forEach((t) => {
|
|
810
833
|
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = T.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
811
|
-
}),
|
|
812
|
-
v(this, "add", /* @__PURE__ */ a((
|
|
834
|
+
}), s), "#defaultInsert"));
|
|
835
|
+
v(this, "add", /* @__PURE__ */ a((s, t = !0) => {
|
|
813
836
|
var o;
|
|
814
|
-
|
|
815
|
-
const
|
|
816
|
-
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, de).call(this,
|
|
837
|
+
s === void 0 && (s = {});
|
|
838
|
+
const i = e(this, he).call(this, s);
|
|
839
|
+
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, de).call(this, i)), this.resetRecords();
|
|
817
840
|
const n = this.count() - 1;
|
|
818
|
-
return t ||
|
|
819
|
-
const
|
|
820
|
-
|
|
841
|
+
return t || i.forEach((r, l) => {
|
|
842
|
+
const b = e(this, m).rawRecords[n - l];
|
|
843
|
+
b && (b.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
821
844
|
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
822
845
|
}, "add"));
|
|
823
|
-
v(this, "delete", /* @__PURE__ */ a((
|
|
824
|
-
var
|
|
846
|
+
v(this, "delete", /* @__PURE__ */ a((s) => {
|
|
847
|
+
var i;
|
|
825
848
|
let t = [];
|
|
826
|
-
Array.isArray(
|
|
827
|
-
if (e(this,
|
|
828
|
-
const o = e(this,
|
|
829
|
-
e(this,
|
|
849
|
+
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) => {
|
|
850
|
+
if (e(this, A)[n]) {
|
|
851
|
+
const o = e(this, A)[n].__ng.rowid;
|
|
852
|
+
e(this, A)[n].__ng.rowState === T.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((r) => r.__ng.rowid !== o) : e(this, m).rawRecords.forEach((r) => {
|
|
830
853
|
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
831
854
|
});
|
|
832
855
|
}
|
|
833
|
-
}), this.resetRecords(), (
|
|
856
|
+
}), this.resetRecords(), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
834
857
|
}, "delete"));
|
|
835
|
-
v(this, "setValue", /* @__PURE__ */ a((
|
|
836
|
-
var
|
|
837
|
-
|
|
838
|
-
const o = (typeof ((
|
|
858
|
+
v(this, "setValue", /* @__PURE__ */ a((s, t, i) => {
|
|
859
|
+
var b;
|
|
860
|
+
s = parseInt(s, 10);
|
|
861
|
+
const o = (typeof ((b = e(this, E).fields) == null ? void 0 : b.get) == "function" ? e(this, E).fields.get() : []).indexOf(t);
|
|
839
862
|
if (o < 0) return;
|
|
840
|
-
const r = this.getValidData()[
|
|
863
|
+
const r = this.getValidData()[s];
|
|
841
864
|
if (!r) return;
|
|
842
865
|
const l = r.v[o];
|
|
843
|
-
l !==
|
|
866
|
+
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);
|
|
844
867
|
}, "setValue"));
|
|
845
868
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
846
|
-
p(this, U, e(this, m).rawRecords.filter((
|
|
847
|
-
|
|
848
|
-
}), e(this,
|
|
849
|
-
|
|
869
|
+
p(this, U, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), p(this, A, e(this, m).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), e(this, m).rawRecords.forEach((s, t) => {
|
|
870
|
+
s.__ng.rowidx = t;
|
|
871
|
+
}), e(this, A).forEach((s, t) => {
|
|
872
|
+
s.__ng.i = t;
|
|
850
873
|
});
|
|
851
874
|
}, "resetRecords"));
|
|
852
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this,
|
|
853
|
-
u(this, K, /* @__PURE__ */ a((
|
|
854
|
-
var
|
|
855
|
-
if (!
|
|
856
|
-
const t = typeof ((
|
|
857
|
-
return Array.isArray(
|
|
875
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this, A).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
876
|
+
u(this, K, /* @__PURE__ */ a((s) => {
|
|
877
|
+
var i;
|
|
878
|
+
if (!s) return s;
|
|
879
|
+
const t = typeof ((i = e(this, E).fields) == null ? void 0 : i.get) == "function" ? e(this, E).fields.get() : [];
|
|
880
|
+
return Array.isArray(s) ? s.filter((n) => !n.__ng.deleted).map((n) => {
|
|
858
881
|
const o = {};
|
|
859
882
|
return t.forEach((r, l) => {
|
|
860
883
|
o[r] = n.v ? n.v[l] : n[r];
|
|
861
884
|
}), o.__ng = n.__ng, o;
|
|
862
|
-
}) :
|
|
885
|
+
}) : s;
|
|
863
886
|
}, "#conv2"));
|
|
864
887
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
865
|
-
v(this, "get", /* @__PURE__ */ a((
|
|
888
|
+
v(this, "get", /* @__PURE__ */ a((s, t) => {
|
|
866
889
|
var o;
|
|
867
|
-
const
|
|
868
|
-
if (!
|
|
869
|
-
if (
|
|
870
|
-
if (
|
|
890
|
+
const i = this.getValidData();
|
|
891
|
+
if (!i || i.length <= 0) return;
|
|
892
|
+
if (s == null) return e(this, K).call(this, i);
|
|
893
|
+
if (s < 0 || s >= i.length) return null;
|
|
871
894
|
const n = typeof ((o = e(this, E).fields) == null ? void 0 : o.get) == "function" ? e(this, E).fields.get() : [];
|
|
872
895
|
if (t != null) {
|
|
873
896
|
const r = n.indexOf(t);
|
|
874
|
-
return r >= 0 ? s
|
|
897
|
+
return r >= 0 ? i[s].v[r] : null;
|
|
875
898
|
}
|
|
876
|
-
return e(this, K).call(this, s
|
|
899
|
+
return e(this, K).call(this, i[s]);
|
|
877
900
|
}, "get"));
|
|
878
|
-
p(this, E,
|
|
901
|
+
p(this, E, s), p(this, m, t), e(this, ce).call(this);
|
|
879
902
|
}
|
|
880
903
|
get source() {
|
|
881
904
|
return e(this, K).call(this, e(this, m).rawRecords);
|
|
882
905
|
}
|
|
883
|
-
set source(
|
|
884
|
-
this.clear(), this.add(
|
|
906
|
+
set source(s) {
|
|
907
|
+
this.clear(), this.add(s, !1);
|
|
885
908
|
}
|
|
886
909
|
get nextId() {
|
|
887
910
|
return ++He(this, ae)._;
|
|
888
911
|
}
|
|
889
912
|
};
|
|
890
|
-
E = new WeakMap(), m = new WeakMap(),
|
|
913
|
+
E = new WeakMap(), m = new WeakMap(), A = new WeakMap(), U = new WeakMap(), ae = new WeakMap(), W = new WeakMap(), ce = new WeakMap(), Q = new WeakMap(), he = new WeakMap(), de = new WeakMap(), K = new WeakMap(), a(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
891
914
|
v(T, "ROW_STATE", {
|
|
892
915
|
EMPTY: "EMPTY",
|
|
893
916
|
NORMAL: "NORMAL",
|
|
@@ -897,21 +920,21 @@ v(T, "ROW_STATE", {
|
|
|
897
920
|
});
|
|
898
921
|
let xe = T;
|
|
899
922
|
const Le = class Le {
|
|
900
|
-
constructor(
|
|
901
|
-
this.owner =
|
|
923
|
+
constructor(s) {
|
|
924
|
+
this.owner = s, this.row = new ve(this), this.data = new xe(s, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
902
925
|
var t;
|
|
903
926
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
904
927
|
}, this.setDataSource = (t) => {
|
|
905
928
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
906
929
|
}, this.getRowState = (t) => {
|
|
907
930
|
var n, o;
|
|
908
|
-
const
|
|
909
|
-
if (!(
|
|
910
|
-
return (o = (n = this.data.getValidData()[
|
|
931
|
+
const i = parseInt(t, 10);
|
|
932
|
+
if (!(i >= this.data.count()))
|
|
933
|
+
return (o = (n = this.data.getValidData()[i]) == null ? void 0 : n.__ng) == null ? void 0 : o.rowState;
|
|
911
934
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
912
935
|
this.row.at = t;
|
|
913
|
-
}, this.scrollTo_V1 = (t) => (t < 0 && (t = 0), t >= this.rawRecords.length && (t = this.rawRecords.length - 1), this.viewRecords.rawIndex = t, this.viewRecords.reset && this.viewRecords.reset(), !(t <= 0 || t >= this.rawRecords.length - 1)), this.getColumn = (t,
|
|
914
|
-
t = parseInt(t, 10), this.data.setValue(t,
|
|
936
|
+
}, this.scrollTo_V1 = (t) => (t < 0 && (t = 0), t >= this.rawRecords.length && (t = this.rawRecords.length - 1), this.viewRecords.rawIndex = t, this.viewRecords.reset && this.viewRecords.reset(), !(t <= 0 || t >= this.rawRecords.length - 1)), this.getColumn = (t, i) => this.data.get(t, i), this.setColumn = (t, i, n) => {
|
|
937
|
+
t = parseInt(t, 10), this.data.setValue(t, i, n);
|
|
915
938
|
}, this.setDataSource([]);
|
|
916
939
|
}
|
|
917
940
|
};
|