comins-table 0.1.4 → 0.1.6
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/CHANGELOG.md +21 -0
- package/README.md +28 -6
- package/THIRD_PARTY_NOTICES.md +123 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +135 -90
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +23 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1732 -925
- package/dist/index.js.map +1 -1
- package/dist/row-detail.d.ts +23 -0
- package/dist/row-detail.d.ts.map +1 -0
- package/dist/table-icons.d.ts +15 -0
- package/dist/table-icons.d.ts.map +1 -0
- package/dist/virtual-layout.d.ts +109 -0
- package/dist/virtual-layout.d.ts.map +1 -0
- package/package.json +12 -9
- package/styles.css +240 -50
package/dist/core.js
CHANGED
|
@@ -44,25 +44,58 @@ function s(e, t) {
|
|
|
44
44
|
return e.find((e) => e.id === t);
|
|
45
45
|
}
|
|
46
46
|
function c(e, t, n = []) {
|
|
47
|
-
let r = new Set(e.map((e) => e.id)), i = (t?.order ?? []).filter((e) => r.has(e)), a = e.map((e) => e.id).filter((e) => !i.includes(e)), s = [...i, ...a]
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
let r = new Set(e.map((e) => e.id)), i = (t?.order ?? []).filter((e) => r.has(e)), a = e.map((e) => e.id).filter((e) => !i.includes(e)), s = [...i, ...a], c = new Map(e.map((e) => [e.id, e])), l = o(n), u = new Map(n.map((e) => [e.id, e])), d = (e) => {
|
|
48
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
49
|
+
for (let r of e) {
|
|
50
|
+
let i = l.get(r);
|
|
51
|
+
if (!i) {
|
|
52
|
+
n.push({
|
|
53
|
+
columnIds: [r],
|
|
54
|
+
key: `column:${r}`,
|
|
55
|
+
locked: c.get(r)?.lockPosition === !0
|
|
56
|
+
});
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (t.has(i)) continue;
|
|
60
|
+
let a = u.get(i);
|
|
61
|
+
if (!a) {
|
|
62
|
+
n.push({
|
|
63
|
+
columnIds: [r],
|
|
64
|
+
key: `column:${r}`,
|
|
65
|
+
locked: c.get(r)?.lockPosition === !0
|
|
66
|
+
});
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
let o = e.filter((e) => a.children.includes(e));
|
|
70
|
+
n.push({
|
|
71
|
+
columnIds: o,
|
|
72
|
+
key: `group:${i}`,
|
|
73
|
+
locked: a.lockPosition || o.some((e) => c.get(e)?.lockPosition === !0)
|
|
74
|
+
}), t.add(i);
|
|
61
75
|
}
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
return n;
|
|
77
|
+
}, f = d(e.map((e) => e.id)), p = d(s), m = new Map(f.map((e) => [e.key, e])), h = /* @__PURE__ */ new Map(), g = 0;
|
|
78
|
+
for (let e of f) h.set(e.key, g), e.locked && (g += 1);
|
|
79
|
+
let _ = Array.from({ length: g + 1 }, () => []), v = new Map(p.map((e) => [e.key, e]));
|
|
80
|
+
for (let e of p) {
|
|
81
|
+
let t = m.get(e.key);
|
|
82
|
+
!t || t.locked || _[h.get(e.key) ?? 0]?.push(e);
|
|
64
83
|
}
|
|
65
|
-
|
|
84
|
+
let y = [], b = 0;
|
|
85
|
+
for (let e of f) e.locked && (y.push(..._[b] ?? []), y.push(v.get(e.key) ?? e), b += 1);
|
|
86
|
+
return y.push(..._[b] ?? []), y.flatMap((e) => {
|
|
87
|
+
let t = m.get(e.key);
|
|
88
|
+
if (!t || e.columnIds.length === 1) return e.columnIds;
|
|
89
|
+
let n = new Set(t.columnIds.filter((e) => c.get(e)?.lockPosition));
|
|
90
|
+
if (n.size === 0) return e.columnIds;
|
|
91
|
+
let r = /* @__PURE__ */ new Map(), i = 0;
|
|
92
|
+
for (let e of t.columnIds) r.set(e, i), n.has(e) && (i += 1);
|
|
93
|
+
let a = Array.from({ length: i + 1 }, () => []);
|
|
94
|
+
for (let t of e.columnIds) n.has(t) || a[r.get(t) ?? 0]?.push(t);
|
|
95
|
+
let o = [], s = 0;
|
|
96
|
+
for (let e of t.columnIds) n.has(e) && (o.push(...a[s] ?? []), o.push(e), s += 1);
|
|
97
|
+
return o.push(...a[s] ?? []), o;
|
|
98
|
+
});
|
|
66
99
|
}
|
|
67
100
|
function l() {
|
|
68
101
|
return {
|
|
@@ -138,7 +171,7 @@ function v(e, t, n, r) {
|
|
|
138
171
|
selected: e.selection.rowIds.includes(n)
|
|
139
172
|
},
|
|
140
173
|
selection: { selectedRowCount: e.selection.rowIds.length },
|
|
141
|
-
value:
|
|
174
|
+
value: q(e, t, r.id)
|
|
142
175
|
};
|
|
143
176
|
}
|
|
144
177
|
function y(e, t) {
|
|
@@ -149,7 +182,7 @@ function b(e, t, n, r) {
|
|
|
149
182
|
return typeof a == "function" ? a(i) : a;
|
|
150
183
|
}
|
|
151
184
|
function x(e, t) {
|
|
152
|
-
let n =
|
|
185
|
+
let n = G(e), r = f(e, t.anchor.rowId), i = f(e, t.focus.rowId), a = n.findIndex((e) => e.id === t.anchor.columnId), o = n.findIndex((e) => e.id === t.focus.columnId);
|
|
153
186
|
return r < 0 || i < 0 || a < 0 || o < 0 ? null : {
|
|
154
187
|
columnEnd: Math.max(a, o),
|
|
155
188
|
columnStart: Math.min(a, o),
|
|
@@ -164,20 +197,20 @@ function S(e, t) {
|
|
|
164
197
|
id: t
|
|
165
198
|
} : e;
|
|
166
199
|
}
|
|
167
|
-
function
|
|
200
|
+
function ee(e, t) {
|
|
168
201
|
let n = 1, r = `${String(t)}-copy-${n}`, i = new Set(e.map(String));
|
|
169
202
|
for (; i.has(r);) n += 1, r = `${String(t)}-copy-${n}`;
|
|
170
203
|
return r;
|
|
171
204
|
}
|
|
172
|
-
function
|
|
205
|
+
function C(e, t, n, r, i) {
|
|
173
206
|
if (t === void 0) return !1;
|
|
174
207
|
let a = v(e, t, n, r), o = b(e, t, n, r);
|
|
175
208
|
return o?.disabled !== void 0 && y(o.disabled, a) === !0 ? !1 : y(i === "copy" ? o?.copyable : o?.pasteable, a);
|
|
176
209
|
}
|
|
177
|
-
function
|
|
210
|
+
function te(e, t) {
|
|
178
211
|
return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
|
|
179
212
|
}
|
|
180
|
-
function
|
|
213
|
+
function w({ columnLayout: o, columnGroups: s, columns: u, getRowId: d = e, pagination: f, rows: p, showHeader: m = !0, sort: g = null, sortModel: _, theme: v = {} }) {
|
|
181
214
|
let y = t(p), b = n(u), x = r(b, s), S = h(b, _ ?? (g ? [g] : []));
|
|
182
215
|
return {
|
|
183
216
|
columnOrder: c(b, o, x),
|
|
@@ -199,7 +232,7 @@ function ee({ columnLayout: o, columnGroups: s, columns: u, getRowId: d = e, pag
|
|
|
199
232
|
theme: v
|
|
200
233
|
};
|
|
201
234
|
}
|
|
202
|
-
function
|
|
235
|
+
function T(e, t) {
|
|
203
236
|
return t ? e.rows.filter(t) : [...e.rows];
|
|
204
237
|
}
|
|
205
238
|
function ne(e, n) {
|
|
@@ -260,10 +293,10 @@ function k(e, t) {
|
|
|
260
293
|
sortModel: n
|
|
261
294
|
};
|
|
262
295
|
}
|
|
263
|
-
function
|
|
296
|
+
function A(e) {
|
|
264
297
|
return k(e, []);
|
|
265
298
|
}
|
|
266
|
-
function
|
|
299
|
+
function se(e, t, n) {
|
|
267
300
|
return {
|
|
268
301
|
...e,
|
|
269
302
|
columnState: {
|
|
@@ -275,7 +308,7 @@ function ce(e, t, n) {
|
|
|
275
308
|
}
|
|
276
309
|
};
|
|
277
310
|
}
|
|
278
|
-
function
|
|
311
|
+
function ce(e, t, n) {
|
|
279
312
|
return {
|
|
280
313
|
...e,
|
|
281
314
|
columnState: {
|
|
@@ -287,7 +320,7 @@ function le(e, t, n) {
|
|
|
287
320
|
}
|
|
288
321
|
};
|
|
289
322
|
}
|
|
290
|
-
function
|
|
323
|
+
function le(e, t, n) {
|
|
291
324
|
return s(e.columnGroups, t) ? {
|
|
292
325
|
...e,
|
|
293
326
|
columnGroupState: {
|
|
@@ -299,38 +332,38 @@ function ue(e, t, n) {
|
|
|
299
332
|
}
|
|
300
333
|
} : e;
|
|
301
334
|
}
|
|
302
|
-
function
|
|
335
|
+
function ue(e, t) {
|
|
303
336
|
return e.columnState[t.id]?.width ?? t.width ?? 100;
|
|
304
337
|
}
|
|
305
|
-
function A(e) {
|
|
306
|
-
return Math.max(50, e.minWidth ?? 50);
|
|
307
|
-
}
|
|
308
338
|
function j(e) {
|
|
339
|
+
return Math.max(88, e.minWidth ?? 88);
|
|
340
|
+
}
|
|
341
|
+
function M(e) {
|
|
309
342
|
return e.maxWidth ?? Infinity;
|
|
310
343
|
}
|
|
311
|
-
function
|
|
344
|
+
function N(e, t, n) {
|
|
312
345
|
return Math.min(n, Math.max(t, e));
|
|
313
346
|
}
|
|
314
|
-
function
|
|
315
|
-
let r = t.map((t) =>
|
|
347
|
+
function P(e, t, n) {
|
|
348
|
+
let r = t.map((t) => N(ue(e, t), j(t), M(t))), i = new Set(t.map((e, t) => t)), a = t.map(j), o = t.map(M), s = N(n, a.reduce((e, t) => e + t, 0), o.reduce((e, t) => e + t, 0));
|
|
316
349
|
for (; i.size > 0;) {
|
|
317
350
|
let e = s - r.reduce((e, t) => e + t, 0);
|
|
318
351
|
if (Math.abs(e) < .001) break;
|
|
319
352
|
let t = [...i], n = t.reduce((e, t) => e + Math.max(r[t] ?? 0, 0), 0), c = !1;
|
|
320
353
|
for (let s of t) {
|
|
321
|
-
let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d =
|
|
354
|
+
let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d = N(u, a[s] ?? 0, o[s] ?? Infinity);
|
|
322
355
|
r[s] = d, Math.abs(d - u) > .001 && (i.delete(s), c = !0);
|
|
323
356
|
}
|
|
324
357
|
if (!c) break;
|
|
325
358
|
}
|
|
326
359
|
return r;
|
|
327
360
|
}
|
|
328
|
-
function
|
|
361
|
+
function F(e, t, n) {
|
|
329
362
|
let r = s(e.columnGroups, t);
|
|
330
363
|
if (!r || e.columnGroupState[r.id]?.hidden === !0) return e;
|
|
331
364
|
let i = r.children.map((t) => p(e, t)).filter((e) => !!e).filter((t) => e.columnState[t.id]?.hidden !== !0);
|
|
332
365
|
if (i.length === 0) return e;
|
|
333
|
-
let a =
|
|
366
|
+
let a = P(e, i, n), o = { ...e.columnState };
|
|
334
367
|
return i.forEach((e, t) => {
|
|
335
368
|
o[e.id] = {
|
|
336
369
|
...o[e.id],
|
|
@@ -341,29 +374,41 @@ function P(e, t, n) {
|
|
|
341
374
|
columnState: o
|
|
342
375
|
};
|
|
343
376
|
}
|
|
344
|
-
function
|
|
345
|
-
let
|
|
346
|
-
if (
|
|
347
|
-
let
|
|
348
|
-
|
|
349
|
-
let
|
|
377
|
+
function I(e, t) {
|
|
378
|
+
let n = new Map(e.columnOrder.map((e, t) => [e, t])), r = new Map(t.map((e, t) => [e, t]));
|
|
379
|
+
for (let t of e.columns) if (t.lockPosition && n.get(t.id) !== r.get(t.id)) return !0;
|
|
380
|
+
for (let t of e.columnGroups) {
|
|
381
|
+
if (!t.lockPosition) continue;
|
|
382
|
+
let e = t.children.map((e) => n.get(e)).filter((e) => e !== void 0).sort((e, t) => e - t), i = t.children.map((e) => r.get(e)).filter((e) => e !== void 0).sort((e, t) => e - t);
|
|
383
|
+
if (e.length !== i.length || e.some((e, t) => e !== i[t])) return !0;
|
|
384
|
+
}
|
|
385
|
+
return !1;
|
|
386
|
+
}
|
|
387
|
+
function L(e, t, n) {
|
|
388
|
+
let r = p(e, t);
|
|
389
|
+
if (!r || r.lockPosition) return e;
|
|
390
|
+
let i = o(e.columnGroups).get(t), a = e.columnOrder.filter((e) => e !== t);
|
|
391
|
+
if (a.length === e.columnOrder.length) return e;
|
|
392
|
+
let c = Math.max(0, Math.min(n, a.length));
|
|
393
|
+
if (i) {
|
|
394
|
+
let t = s(e.columnGroups, i);
|
|
350
395
|
if (!t) return e;
|
|
351
|
-
let n =
|
|
352
|
-
if (
|
|
396
|
+
let n = a.filter((e) => t.children.includes(e)), r = a.findIndex((e) => t.children.includes(e)), o = r + n.length;
|
|
397
|
+
if (c < r || c > o) return e;
|
|
353
398
|
} else if (e.columnGroups.length > 0) for (let t of e.columnGroups) {
|
|
354
|
-
let n =
|
|
399
|
+
let n = a.filter((e) => t.children.includes(e));
|
|
355
400
|
if (n.length === 0) continue;
|
|
356
|
-
let r =
|
|
357
|
-
if (
|
|
401
|
+
let r = a.findIndex((e) => t.children.includes(e)), i = r + n.length;
|
|
402
|
+
if (c > r && c < i) return e;
|
|
358
403
|
}
|
|
359
|
-
return
|
|
404
|
+
return a.splice(c, 0, t), I(e, a) || a.every((t, n) => t === e.columnOrder[n]) ? e : {
|
|
360
405
|
...e,
|
|
361
|
-
columnOrder:
|
|
406
|
+
columnOrder: a
|
|
362
407
|
};
|
|
363
408
|
}
|
|
364
|
-
function
|
|
409
|
+
function R(e, t, n) {
|
|
365
410
|
let r = s(e.columnGroups, t);
|
|
366
|
-
if (!r) return e;
|
|
411
|
+
if (!r || r.lockPosition) return e;
|
|
367
412
|
let i = e.columnOrder.filter((e) => r.children.includes(e));
|
|
368
413
|
if (i.length === 0) return e;
|
|
369
414
|
let a = e.columnOrder.filter((e) => !r.children.includes(e)), o = Math.max(0, Math.min(n, a.length)), c = [
|
|
@@ -371,12 +416,12 @@ function I(e, t, n) {
|
|
|
371
416
|
...i,
|
|
372
417
|
...a.slice(o)
|
|
373
418
|
];
|
|
374
|
-
return {
|
|
419
|
+
return I(e, c) || c.every((t, n) => t === e.columnOrder[n]) ? e : {
|
|
375
420
|
...e,
|
|
376
421
|
columnOrder: c
|
|
377
422
|
};
|
|
378
423
|
}
|
|
379
|
-
function
|
|
424
|
+
function z(e) {
|
|
380
425
|
let t = e.columnGroups.length === 0 ? void 0 : Object.fromEntries(e.columnGroups.map((t) => [t.id, { ...e.columnGroupState[t.id] }]));
|
|
381
426
|
return {
|
|
382
427
|
columns: { ...e.columnState },
|
|
@@ -384,7 +429,7 @@ function L(e) {
|
|
|
384
429
|
order: [...e.columnOrder]
|
|
385
430
|
};
|
|
386
431
|
}
|
|
387
|
-
function
|
|
432
|
+
function B(e, t) {
|
|
388
433
|
return {
|
|
389
434
|
...e,
|
|
390
435
|
columnOrder: c(e.columns, t, e.columnGroups),
|
|
@@ -392,7 +437,7 @@ function R(e, t) {
|
|
|
392
437
|
columnState: i(e.columns, t)
|
|
393
438
|
};
|
|
394
439
|
}
|
|
395
|
-
function
|
|
440
|
+
function V(e, t, n = {}) {
|
|
396
441
|
let r = e.selection.rowIds, i = r.includes(t), a = n.multi ? n.toggle && i ? r.filter((e) => e !== t) : i ? r : [...r, t] : n.toggle && i ? [] : [t];
|
|
397
442
|
return {
|
|
398
443
|
...e,
|
|
@@ -402,7 +447,7 @@ function z(e, t, n = {}) {
|
|
|
402
447
|
}
|
|
403
448
|
};
|
|
404
449
|
}
|
|
405
|
-
function
|
|
450
|
+
function H(e, t) {
|
|
406
451
|
return {
|
|
407
452
|
...e,
|
|
408
453
|
selection: {
|
|
@@ -411,7 +456,7 @@ function B(e, t) {
|
|
|
411
456
|
}
|
|
412
457
|
};
|
|
413
458
|
}
|
|
414
|
-
function
|
|
459
|
+
function U(e, t) {
|
|
415
460
|
return {
|
|
416
461
|
...e,
|
|
417
462
|
selection: {
|
|
@@ -421,7 +466,7 @@ function V(e, t) {
|
|
|
421
466
|
}
|
|
422
467
|
};
|
|
423
468
|
}
|
|
424
|
-
function
|
|
469
|
+
function de(e, t) {
|
|
425
470
|
return {
|
|
426
471
|
...e,
|
|
427
472
|
selection: {
|
|
@@ -452,9 +497,9 @@ function me(e, t) {
|
|
|
452
497
|
function he(e, t) {
|
|
453
498
|
return e.selection.cell?.rowId === t.rowId && e.selection.cell.columnId === t.columnId;
|
|
454
499
|
}
|
|
455
|
-
function
|
|
500
|
+
function W(e, t = e.selection.range) {
|
|
456
501
|
if (!t) return [];
|
|
457
|
-
let n =
|
|
502
|
+
let n = G(e), r = x(e, t);
|
|
458
503
|
if (!r) return [];
|
|
459
504
|
let i = [];
|
|
460
505
|
for (let t = r.rowStart; t <= r.rowEnd; t += 1) {
|
|
@@ -470,9 +515,9 @@ function U(e, t = e.selection.range) {
|
|
|
470
515
|
return i;
|
|
471
516
|
}
|
|
472
517
|
function ge(e, t) {
|
|
473
|
-
return
|
|
518
|
+
return W(e).some((e) => e.rowId === t.rowId && e.columnId === t.columnId);
|
|
474
519
|
}
|
|
475
|
-
function
|
|
520
|
+
function G(e) {
|
|
476
521
|
let t = o(e.columnGroups);
|
|
477
522
|
return e.columnOrder.map((t) => p(e, t)).filter((e) => !!e).filter((n) => {
|
|
478
523
|
let r = t.get(n.id);
|
|
@@ -480,7 +525,7 @@ function W(e) {
|
|
|
480
525
|
});
|
|
481
526
|
}
|
|
482
527
|
function _e(e) {
|
|
483
|
-
let t =
|
|
528
|
+
let t = G(e);
|
|
484
529
|
if (e.columnGroups.length === 0) return [t.map((e) => ({
|
|
485
530
|
colSpan: 1,
|
|
486
531
|
column: e,
|
|
@@ -529,14 +574,14 @@ function _e(e) {
|
|
|
529
574
|
}
|
|
530
575
|
return [s, c];
|
|
531
576
|
}
|
|
532
|
-
function
|
|
577
|
+
function K(e) {
|
|
533
578
|
let t = e.rows.map((e, t) => t);
|
|
534
579
|
return e.sortModel.length === 0 ? t : [...t].sort((t, n) => {
|
|
535
580
|
let r = e.rows[t], i = e.rows[n];
|
|
536
581
|
for (let t of e.sortModel) {
|
|
537
582
|
let n = p(e, t.columnId);
|
|
538
583
|
if (!n?.sort) continue;
|
|
539
|
-
let a =
|
|
584
|
+
let a = q(e, r, n.id), o = q(e, i, n.id), s = typeof n.sort == "function" ? n.sort(a, o, r, i) : te(a, o);
|
|
540
585
|
if (s !== 0) return t.direction === "desc" ? s * -1 : s;
|
|
541
586
|
}
|
|
542
587
|
return t - n;
|
|
@@ -544,14 +589,14 @@ function G(e) {
|
|
|
544
589
|
}
|
|
545
590
|
function ve(e, t) {
|
|
546
591
|
let n = O(e, t);
|
|
547
|
-
return d(n,
|
|
592
|
+
return d(n, K(n).map((e) => n.rows[e]));
|
|
548
593
|
}
|
|
549
594
|
function ye(e, t = {}) {
|
|
550
595
|
let n = t.pageIndex ?? e.pagination.pageIndex, r = t.pageSize ?? e.pagination.pageSize, i = Math.max(0, n) * Math.max(1, r);
|
|
551
|
-
return
|
|
596
|
+
return K(e).slice(i, i + Math.max(1, r)).map((t) => e.rows[t]);
|
|
552
597
|
}
|
|
553
598
|
function be(e, { overscan: t = 2, rowHeight: n, scrollTop: r, viewportHeight: i }) {
|
|
554
|
-
let a = Math.max(1, n), o =
|
|
599
|
+
let a = Math.max(1, n), o = K(e), s = o.length, c = s * a, l = Math.max(0, Math.floor(Math.max(0, r) / a) - Math.max(0, t)), u = Math.min(s, Math.ceil((Math.max(0, r) + Math.max(0, i)) / a) + Math.max(0, t)), d = l * a;
|
|
555
600
|
return {
|
|
556
601
|
bottomSpacerHeight: Math.max(0, c - d - (u - l) * a),
|
|
557
602
|
endIndex: u,
|
|
@@ -567,12 +612,12 @@ function xe(e, t, n) {
|
|
|
567
612
|
let i = [...e.rows], [a] = i.splice(r, 1);
|
|
568
613
|
return a === void 0 ? e : (i.splice(Math.max(0, Math.min(n, i.length)), 0, a), d(e, i));
|
|
569
614
|
}
|
|
570
|
-
function
|
|
615
|
+
function q(e, t, n) {
|
|
571
616
|
let r = p(e, n);
|
|
572
617
|
return r ? g(t, r.field) : void 0;
|
|
573
618
|
}
|
|
574
619
|
function Se(e, t, n, r) {
|
|
575
|
-
let i =
|
|
620
|
+
let i = q(e, t, r.id);
|
|
576
621
|
return r.cell?.format ? r.cell.format(v(e, t, n, r)) : i == null ? "" : String(i);
|
|
577
622
|
}
|
|
578
623
|
function Ce(e, t, n, r) {
|
|
@@ -596,7 +641,7 @@ function Ee(e, t) {
|
|
|
596
641
|
text: JSON.stringify(n)
|
|
597
642
|
};
|
|
598
643
|
}
|
|
599
|
-
function
|
|
644
|
+
function De(e, t, n) {
|
|
600
645
|
if (n.mode === "append") {
|
|
601
646
|
let r = n.getNewRowId?.(t.row);
|
|
602
647
|
return E(e, [r === void 0 ? t.row : S(t.row, r)]);
|
|
@@ -604,7 +649,7 @@ function q(e, t, n) {
|
|
|
604
649
|
if (n.mode === "insert-after") {
|
|
605
650
|
let r = f(e, n.targetRowId);
|
|
606
651
|
if (r < 0) return e;
|
|
607
|
-
let i = e.getRowId(t.row, r), a = n.getPastedRowId?.(t.row) ??
|
|
652
|
+
let i = e.getRowId(t.row, r), a = n.getPastedRowId?.(t.row) ?? ee(e.rowIds, i), o = S(t.row, a), s = [...e.rows];
|
|
608
653
|
return s.splice(r + 1, 0, o), d(e, s);
|
|
609
654
|
}
|
|
610
655
|
return D(e, [{
|
|
@@ -614,8 +659,8 @@ function q(e, t, n) {
|
|
|
614
659
|
}
|
|
615
660
|
function J(e, { columnId: t, rowId: n }) {
|
|
616
661
|
let r = e.rows[f(e, n)], i = p(e, t);
|
|
617
|
-
if (!i || !
|
|
618
|
-
let a =
|
|
662
|
+
if (!i || !C(e, r, n, i, "copy")) return null;
|
|
663
|
+
let a = q(e, r, t);
|
|
619
664
|
return {
|
|
620
665
|
kind: "cell",
|
|
621
666
|
text: a == null ? "" : String(a),
|
|
@@ -624,12 +669,12 @@ function J(e, { columnId: t, rowId: n }) {
|
|
|
624
669
|
}
|
|
625
670
|
function Y(e, { columnId: t, rowId: n }, r) {
|
|
626
671
|
let i = p(e, t), a = e.rows[f(e, n)];
|
|
627
|
-
return !r || !i || !
|
|
672
|
+
return !r || !i || !C(e, a, n, i, "paste") ? e : D(e, [{
|
|
628
673
|
id: n,
|
|
629
674
|
patch: (e) => _(e, i.field, r.value)
|
|
630
675
|
}]);
|
|
631
676
|
}
|
|
632
|
-
function
|
|
677
|
+
function Oe(e, t = e.selection.range) {
|
|
633
678
|
if (!t) return null;
|
|
634
679
|
let n = x(e, t);
|
|
635
680
|
if (!n) return null;
|
|
@@ -638,11 +683,11 @@ function De(e, t = e.selection.range) {
|
|
|
638
683
|
let i = e.rows[t], a = e.rowIds[t], o = [];
|
|
639
684
|
for (let t = n.columnStart; t <= n.columnEnd; t += 1) {
|
|
640
685
|
let r = n.visibleColumns[t];
|
|
641
|
-
if (i === void 0 || a === void 0 || !r || !
|
|
686
|
+
if (i === void 0 || a === void 0 || !r || !C(e, i, a, r, "copy")) {
|
|
642
687
|
o.push(null);
|
|
643
688
|
continue;
|
|
644
689
|
}
|
|
645
|
-
let s =
|
|
690
|
+
let s = q(e, i, r.id);
|
|
646
691
|
o.push({
|
|
647
692
|
columnId: r.id,
|
|
648
693
|
text: s == null ? "" : String(s),
|
|
@@ -657,33 +702,33 @@ function De(e, t = e.selection.range) {
|
|
|
657
702
|
text: r.map((e) => e.map((e) => e?.text ?? "").join(" ")).join("\n")
|
|
658
703
|
};
|
|
659
704
|
}
|
|
660
|
-
function
|
|
705
|
+
function ke(e, t, n) {
|
|
661
706
|
if (!n) return e;
|
|
662
|
-
let r =
|
|
707
|
+
let r = G(e), i = f(e, t.rowId), a = r.findIndex((e) => e.id === t.columnId), o = [...e.rows];
|
|
663
708
|
if (i < 0 || a < 0) return e;
|
|
664
709
|
let s = !1;
|
|
665
710
|
return n.rows.forEach((t, n) => {
|
|
666
711
|
let c = i + n, l = o[c], u = e.rowIds[c];
|
|
667
712
|
l === void 0 || u === void 0 || t.forEach((t, n) => {
|
|
668
713
|
let i = r[a + n];
|
|
669
|
-
!t || !i || !
|
|
714
|
+
!t || !i || !C(e, l, u, i, "paste") || (o[c] = _(o[c], i.field, t.value), s = !0);
|
|
670
715
|
});
|
|
671
716
|
}), s ? d(e, o) : e;
|
|
672
717
|
}
|
|
673
|
-
function
|
|
718
|
+
function Ae(e, { source: t, target: n }) {
|
|
674
719
|
let r = J(e, t);
|
|
675
|
-
return r ?
|
|
720
|
+
return r ? W(e, n).reduce((e, t) => Y(e, t, r), e) : e;
|
|
676
721
|
}
|
|
677
722
|
function X({ columnOrder: e, columns: t }) {
|
|
678
723
|
if (!e?.length) return t;
|
|
679
724
|
let n = new Map(t.map((e) => [e.id, e]));
|
|
680
725
|
return e.map((e) => n.get(e)).filter((e) => !!e);
|
|
681
726
|
}
|
|
682
|
-
function
|
|
727
|
+
function je(e) {
|
|
683
728
|
return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? String(e) : JSON.stringify(e);
|
|
684
729
|
}
|
|
685
730
|
function Z(e) {
|
|
686
|
-
let t =
|
|
731
|
+
let t = je(e);
|
|
687
732
|
return /[",\r\n]/u.test(t) ? `"${t.replaceAll("\"", "\"\"")}"` : t;
|
|
688
733
|
}
|
|
689
734
|
function Q(e, t) {
|
|
@@ -692,14 +737,14 @@ function Q(e, t) {
|
|
|
692
737
|
function $(e, t, n, r) {
|
|
693
738
|
return r === "formatted" && e.format ? e.format(t, n) : e.value(t, n);
|
|
694
739
|
}
|
|
695
|
-
function
|
|
740
|
+
function Me({ columnOrder: e, columns: t, headerOverrides: n, rows: r, valueSource: i = "raw" }) {
|
|
696
741
|
let a = X({
|
|
697
742
|
columnOrder: e,
|
|
698
743
|
columns: t
|
|
699
744
|
});
|
|
700
745
|
return [a.map((e) => Z(Q(e, n))).join(","), ...r.map((e, t) => a.map((n) => Z($(n, e, t, i))).join(","))].join("\n");
|
|
701
746
|
}
|
|
702
|
-
function
|
|
747
|
+
function Ne({ columnOrder: e, columns: t, headerOverrides: n, rows: r, valueSource: i = "raw" }) {
|
|
703
748
|
let a = X({
|
|
704
749
|
columnOrder: e,
|
|
705
750
|
columns: t
|
|
@@ -707,6 +752,6 @@ function Me({ columnOrder: e, columns: t, headerOverrides: n, rows: r, valueSour
|
|
|
707
752
|
return JSON.stringify(o, null, 2);
|
|
708
753
|
}
|
|
709
754
|
//#endregion
|
|
710
|
-
export { E as addCominsRows,
|
|
755
|
+
export { E as addCominsRows, B as applyCominsColumnLayout, fe as clearCominsCellRange, pe as clearCominsSelection, A as clearCominsSortState, J as copyCominsCell, Oe as copyCominsCellRange, Ee as copyCominsRow, w as createCominsTableState, re as deleteCominsRows, Me as exportCominsRowsToCsv, Ne as exportCominsRowsToJson, Ae as fillCominsCellRange, Se as formatCominsCellValue, we as getCominsCellClassName, Te as getCominsCellStyle, q as getCominsCellValue, _e as getCominsHeaderRows, ye as getCominsPageRows, W as getCominsSelectedCellRange, K as getCominsSortedRowIndexes, be as getCominsVirtualRows, G as getCominsVisibleColumns, Ce as isCominsCellDisabled, ge as isCominsCellInSelectedRange, he as isCominsCellSelected, me as isCominsRowSelected, L as moveCominsColumn, R as moveCominsColumnGroup, xe as moveCominsRow, Y as pasteCominsCell, ke as pasteCominsCellRange, De as pasteCominsRow, T as queryCominsRows, ne as replaceCominsRows, U as selectCell, de as selectCellRange, V as selectRow, H as selectRows, z as serializeCominsColumnLayout, le as setCominsColumnGroupHidden, F as setCominsColumnGroupWidth, ce as setCominsColumnHidden, se as setCominsColumnWidth, ae as setCominsHeaderVisible, oe as setCominsPagination, k as setCominsSortModel, O as setCominsSortState, ie as setCominsTableTheme, ve as sortCominsRows, D as updateCominsRows };
|
|
711
756
|
|
|
712
757
|
//# sourceMappingURL=core.js.map
|