comins-table 0.1.3 → 0.1.5
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 +12 -0
- package/README.md +25 -5
- package/THIRD_PARTY_NOTICES.md +71 -0
- package/dist/core.d.ts +21 -31
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +120 -99
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +690 -671
- package/dist/index.js.map +1 -1
- package/package.json +4 -6
- package/styles.css +62 -0
package/dist/core.js
CHANGED
|
@@ -90,11 +90,22 @@ function p(e, t) {
|
|
|
90
90
|
return e.columns.find((e) => e.id === t);
|
|
91
91
|
}
|
|
92
92
|
function m(e, t) {
|
|
93
|
+
return e.length === t.length && e.every((e, n) => e.columnId === t[n]?.columnId && e.direction === t[n]?.direction);
|
|
94
|
+
}
|
|
95
|
+
function h(e, t) {
|
|
96
|
+
let n = new Set(e.filter((e) => !!e.sort).map((e) => e.id)), r = /* @__PURE__ */ new Set(), i = [];
|
|
97
|
+
for (let e of t) !n.has(e.columnId) || r.has(e.columnId) || e.direction !== "asc" && e.direction !== "desc" || (r.add(e.columnId), i.push({
|
|
98
|
+
columnId: e.columnId,
|
|
99
|
+
direction: e.direction
|
|
100
|
+
}));
|
|
101
|
+
return i;
|
|
102
|
+
}
|
|
103
|
+
function g(e, t) {
|
|
93
104
|
return t.split(".").reduce((e, t) => {
|
|
94
105
|
if (!(typeof e != "object" || !e)) return e[t];
|
|
95
106
|
}, e);
|
|
96
107
|
}
|
|
97
|
-
function
|
|
108
|
+
function _(e, t, n) {
|
|
98
109
|
if (!e || typeof e != "object") return e;
|
|
99
110
|
let r = t.split("."), [i] = r;
|
|
100
111
|
if (!i) return e;
|
|
@@ -108,7 +119,7 @@ function h(e, t, n) {
|
|
|
108
119
|
o[e] = a, n && (o = a);
|
|
109
120
|
}), o[r.at(-1)] = n, a;
|
|
110
121
|
}
|
|
111
|
-
function
|
|
122
|
+
function v(e, t, n, r) {
|
|
112
123
|
let i = e.rowIds.indexOf(n);
|
|
113
124
|
return {
|
|
114
125
|
column: {
|
|
@@ -130,14 +141,14 @@ function g(e, t, n, r) {
|
|
|
130
141
|
value: K(e, t, r.id)
|
|
131
142
|
};
|
|
132
143
|
}
|
|
133
|
-
function
|
|
144
|
+
function y(e, t) {
|
|
134
145
|
return e === void 0 ? !0 : typeof e == "boolean" ? e : e(t);
|
|
135
146
|
}
|
|
136
|
-
function
|
|
137
|
-
let i =
|
|
147
|
+
function b(e, t, n, r) {
|
|
148
|
+
let i = v(e, t, n, r), a = r.cell?.props;
|
|
138
149
|
return typeof a == "function" ? a(i) : a;
|
|
139
150
|
}
|
|
140
|
-
function
|
|
151
|
+
function x(e, t) {
|
|
141
152
|
let n = W(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);
|
|
142
153
|
return r < 0 || i < 0 || a < 0 || o < 0 ? null : {
|
|
143
154
|
columnEnd: Math.max(a, o),
|
|
@@ -147,56 +158,57 @@ function y(e, t) {
|
|
|
147
158
|
visibleColumns: n
|
|
148
159
|
};
|
|
149
160
|
}
|
|
150
|
-
function
|
|
161
|
+
function S(e, t) {
|
|
151
162
|
return e && typeof e == "object" && "id" in e ? {
|
|
152
163
|
...e,
|
|
153
164
|
id: t
|
|
154
165
|
} : e;
|
|
155
166
|
}
|
|
156
|
-
function
|
|
167
|
+
function C(e, t) {
|
|
157
168
|
let n = 1, r = `${String(t)}-copy-${n}`, i = new Set(e.map(String));
|
|
158
169
|
for (; i.has(r);) n += 1, r = `${String(t)}-copy-${n}`;
|
|
159
170
|
return r;
|
|
160
171
|
}
|
|
161
|
-
function
|
|
172
|
+
function w(e, t, n, r, i) {
|
|
162
173
|
if (t === void 0) return !1;
|
|
163
|
-
let a =
|
|
164
|
-
return o?.disabled !== void 0 &&
|
|
174
|
+
let a = v(e, t, n, r), o = b(e, t, n, r);
|
|
175
|
+
return o?.disabled !== void 0 && y(o.disabled, a) === !0 ? !1 : y(i === "copy" ? o?.copyable : o?.pasteable, a);
|
|
165
176
|
}
|
|
166
|
-
function
|
|
177
|
+
function T(e, t) {
|
|
167
178
|
return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
|
|
168
179
|
}
|
|
169
|
-
function
|
|
170
|
-
let
|
|
180
|
+
function ee({ columnLayout: o, columnGroups: s, columns: u, getRowId: d = e, pagination: f, rows: p, showHeader: m = !0, sort: g = null, sortModel: _, theme: v = {} }) {
|
|
181
|
+
let y = t(p), b = n(u), x = r(b, s), S = h(b, _ ?? (g ? [g] : []));
|
|
171
182
|
return {
|
|
172
|
-
columnOrder: c(
|
|
173
|
-
columnGroups:
|
|
174
|
-
columnGroupState: a(
|
|
175
|
-
columns:
|
|
176
|
-
columnState: i(
|
|
183
|
+
columnOrder: c(b, o, x),
|
|
184
|
+
columnGroups: x,
|
|
185
|
+
columnGroupState: a(x, o),
|
|
186
|
+
columns: b,
|
|
187
|
+
columnState: i(b, o),
|
|
177
188
|
getRowId: d,
|
|
178
189
|
pagination: {
|
|
179
190
|
pageIndex: f?.pageIndex ?? 0,
|
|
180
|
-
pageSize: f?.pageSize ?? Math.max(
|
|
191
|
+
pageSize: f?.pageSize ?? Math.max(y.length, 1)
|
|
181
192
|
},
|
|
182
|
-
rowIds:
|
|
183
|
-
rows:
|
|
193
|
+
rowIds: y.map(d),
|
|
194
|
+
rows: y,
|
|
184
195
|
selection: l(),
|
|
185
196
|
showHeader: m,
|
|
186
|
-
sort:
|
|
187
|
-
|
|
197
|
+
sort: S[0] ?? null,
|
|
198
|
+
sortModel: S,
|
|
199
|
+
theme: v
|
|
188
200
|
};
|
|
189
201
|
}
|
|
190
|
-
function
|
|
202
|
+
function te(e, t) {
|
|
191
203
|
return t ? e.rows.filter(t) : [...e.rows];
|
|
192
204
|
}
|
|
193
|
-
function
|
|
205
|
+
function ne(e, n) {
|
|
194
206
|
return d(e, t(n), { resetSelection: !0 });
|
|
195
207
|
}
|
|
196
|
-
function
|
|
208
|
+
function E(e, t) {
|
|
197
209
|
return d(e, [...e.rows, ...t]);
|
|
198
210
|
}
|
|
199
|
-
function
|
|
211
|
+
function D(e, t) {
|
|
200
212
|
let n = new Map(t.map((e) => [e.id, e.patch]));
|
|
201
213
|
return d(e, e.rows.map((t, r) => {
|
|
202
214
|
let i = e.rowIds[r], a = i === void 0 ? void 0 : n.get(i);
|
|
@@ -237,14 +249,19 @@ function oe(e, t) {
|
|
|
237
249
|
}
|
|
238
250
|
};
|
|
239
251
|
}
|
|
240
|
-
function
|
|
241
|
-
return
|
|
252
|
+
function O(e, t) {
|
|
253
|
+
return k(e, t ? [t] : []);
|
|
254
|
+
}
|
|
255
|
+
function k(e, t) {
|
|
256
|
+
let n = h(e.columns, t), r = n[0] ?? null;
|
|
257
|
+
return m(e.sortModel, n) ? e : {
|
|
242
258
|
...e,
|
|
243
|
-
sort:
|
|
259
|
+
sort: r,
|
|
260
|
+
sortModel: n
|
|
244
261
|
};
|
|
245
262
|
}
|
|
246
263
|
function se(e) {
|
|
247
|
-
return
|
|
264
|
+
return k(e, []);
|
|
248
265
|
}
|
|
249
266
|
function ce(e, t, n) {
|
|
250
267
|
return {
|
|
@@ -285,35 +302,35 @@ function ue(e, t, n) {
|
|
|
285
302
|
function de(e, t) {
|
|
286
303
|
return e.columnState[t.id]?.width ?? t.width ?? 100;
|
|
287
304
|
}
|
|
288
|
-
function
|
|
305
|
+
function A(e) {
|
|
289
306
|
return Math.max(50, e.minWidth ?? 50);
|
|
290
307
|
}
|
|
291
|
-
function
|
|
308
|
+
function j(e) {
|
|
292
309
|
return e.maxWidth ?? Infinity;
|
|
293
310
|
}
|
|
294
|
-
function
|
|
311
|
+
function M(e, t, n) {
|
|
295
312
|
return Math.min(n, Math.max(t, e));
|
|
296
313
|
}
|
|
297
|
-
function
|
|
298
|
-
let r = t.map((t) =>
|
|
314
|
+
function N(e, t, n) {
|
|
315
|
+
let r = t.map((t) => M(de(e, t), A(t), j(t))), i = new Set(t.map((e, t) => t)), a = t.map(A), o = t.map(j), s = M(n, a.reduce((e, t) => e + t, 0), o.reduce((e, t) => e + t, 0));
|
|
299
316
|
for (; i.size > 0;) {
|
|
300
317
|
let e = s - r.reduce((e, t) => e + t, 0);
|
|
301
318
|
if (Math.abs(e) < .001) break;
|
|
302
319
|
let t = [...i], n = t.reduce((e, t) => e + Math.max(r[t] ?? 0, 0), 0), c = !1;
|
|
303
320
|
for (let s of t) {
|
|
304
|
-
let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d =
|
|
321
|
+
let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d = M(u, a[s] ?? 0, o[s] ?? Infinity);
|
|
305
322
|
r[s] = d, Math.abs(d - u) > .001 && (i.delete(s), c = !0);
|
|
306
323
|
}
|
|
307
324
|
if (!c) break;
|
|
308
325
|
}
|
|
309
326
|
return r;
|
|
310
327
|
}
|
|
311
|
-
function
|
|
328
|
+
function P(e, t, n) {
|
|
312
329
|
let r = s(e.columnGroups, t);
|
|
313
330
|
if (!r || e.columnGroupState[r.id]?.hidden === !0) return e;
|
|
314
331
|
let i = r.children.map((t) => p(e, t)).filter((e) => !!e).filter((t) => e.columnState[t.id]?.hidden !== !0);
|
|
315
332
|
if (i.length === 0) return e;
|
|
316
|
-
let a =
|
|
333
|
+
let a = N(e, i, n), o = { ...e.columnState };
|
|
317
334
|
return i.forEach((e, t) => {
|
|
318
335
|
o[e.id] = {
|
|
319
336
|
...o[e.id],
|
|
@@ -324,7 +341,7 @@ function j(e, t, n) {
|
|
|
324
341
|
columnState: o
|
|
325
342
|
};
|
|
326
343
|
}
|
|
327
|
-
function
|
|
344
|
+
function F(e, t, n) {
|
|
328
345
|
let r = o(e.columnGroups).get(t), i = e.columnOrder.filter((e) => e !== t);
|
|
329
346
|
if (i.length === e.columnOrder.length) return e;
|
|
330
347
|
let a = Math.max(0, Math.min(n, i.length));
|
|
@@ -344,7 +361,7 @@ function M(e, t, n) {
|
|
|
344
361
|
columnOrder: i
|
|
345
362
|
};
|
|
346
363
|
}
|
|
347
|
-
function
|
|
364
|
+
function I(e, t, n) {
|
|
348
365
|
let r = s(e.columnGroups, t);
|
|
349
366
|
if (!r) return e;
|
|
350
367
|
let i = e.columnOrder.filter((e) => r.children.includes(e));
|
|
@@ -359,7 +376,7 @@ function N(e, t, n) {
|
|
|
359
376
|
columnOrder: c
|
|
360
377
|
};
|
|
361
378
|
}
|
|
362
|
-
function
|
|
379
|
+
function L(e) {
|
|
363
380
|
let t = e.columnGroups.length === 0 ? void 0 : Object.fromEntries(e.columnGroups.map((t) => [t.id, { ...e.columnGroupState[t.id] }]));
|
|
364
381
|
return {
|
|
365
382
|
columns: { ...e.columnState },
|
|
@@ -367,7 +384,7 @@ function P(e) {
|
|
|
367
384
|
order: [...e.columnOrder]
|
|
368
385
|
};
|
|
369
386
|
}
|
|
370
|
-
function
|
|
387
|
+
function R(e, t) {
|
|
371
388
|
return {
|
|
372
389
|
...e,
|
|
373
390
|
columnOrder: c(e.columns, t, e.columnGroups),
|
|
@@ -375,7 +392,7 @@ function F(e, t) {
|
|
|
375
392
|
columnState: i(e.columns, t)
|
|
376
393
|
};
|
|
377
394
|
}
|
|
378
|
-
function
|
|
395
|
+
function z(e, t, n = {}) {
|
|
379
396
|
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];
|
|
380
397
|
return {
|
|
381
398
|
...e,
|
|
@@ -385,7 +402,7 @@ function I(e, t, n = {}) {
|
|
|
385
402
|
}
|
|
386
403
|
};
|
|
387
404
|
}
|
|
388
|
-
function
|
|
405
|
+
function B(e, t) {
|
|
389
406
|
return {
|
|
390
407
|
...e,
|
|
391
408
|
selection: {
|
|
@@ -394,7 +411,7 @@ function L(e, t) {
|
|
|
394
411
|
}
|
|
395
412
|
};
|
|
396
413
|
}
|
|
397
|
-
function
|
|
414
|
+
function V(e, t) {
|
|
398
415
|
return {
|
|
399
416
|
...e,
|
|
400
417
|
selection: {
|
|
@@ -404,7 +421,7 @@ function R(e, t) {
|
|
|
404
421
|
}
|
|
405
422
|
};
|
|
406
423
|
}
|
|
407
|
-
function
|
|
424
|
+
function H(e, t) {
|
|
408
425
|
return {
|
|
409
426
|
...e,
|
|
410
427
|
selection: {
|
|
@@ -414,7 +431,7 @@ function z(e, t) {
|
|
|
414
431
|
}
|
|
415
432
|
};
|
|
416
433
|
}
|
|
417
|
-
function
|
|
434
|
+
function fe(e) {
|
|
418
435
|
return {
|
|
419
436
|
...e,
|
|
420
437
|
selection: {
|
|
@@ -423,21 +440,21 @@ function B(e) {
|
|
|
423
440
|
}
|
|
424
441
|
};
|
|
425
442
|
}
|
|
426
|
-
function
|
|
443
|
+
function pe(e) {
|
|
427
444
|
return {
|
|
428
445
|
...e,
|
|
429
446
|
selection: l()
|
|
430
447
|
};
|
|
431
448
|
}
|
|
432
|
-
function
|
|
449
|
+
function me(e, t) {
|
|
433
450
|
return e.selection.rowIds.includes(t);
|
|
434
451
|
}
|
|
435
|
-
function
|
|
452
|
+
function he(e, t) {
|
|
436
453
|
return e.selection.cell?.rowId === t.rowId && e.selection.cell.columnId === t.columnId;
|
|
437
454
|
}
|
|
438
455
|
function U(e, t = e.selection.range) {
|
|
439
456
|
if (!t) return [];
|
|
440
|
-
let n = W(e), r =
|
|
457
|
+
let n = W(e), r = x(e, t);
|
|
441
458
|
if (!r) return [];
|
|
442
459
|
let i = [];
|
|
443
460
|
for (let t = r.rowStart; t <= r.rowEnd; t += 1) {
|
|
@@ -452,7 +469,7 @@ function U(e, t = e.selection.range) {
|
|
|
452
469
|
}
|
|
453
470
|
return i;
|
|
454
471
|
}
|
|
455
|
-
function
|
|
472
|
+
function ge(e, t) {
|
|
456
473
|
return U(e).some((e) => e.rowId === t.rowId && e.columnId === t.columnId);
|
|
457
474
|
}
|
|
458
475
|
function W(e) {
|
|
@@ -462,7 +479,7 @@ function W(e) {
|
|
|
462
479
|
return e.columnState[n.id]?.hidden !== !0 && (!r || e.columnGroupState[r]?.hidden !== !0);
|
|
463
480
|
});
|
|
464
481
|
}
|
|
465
|
-
function
|
|
482
|
+
function _e(e) {
|
|
466
483
|
let t = W(e);
|
|
467
484
|
if (e.columnGroups.length === 0) return [t.map((e) => ({
|
|
468
485
|
colSpan: 1,
|
|
@@ -514,22 +531,26 @@ function me(e) {
|
|
|
514
531
|
}
|
|
515
532
|
function G(e) {
|
|
516
533
|
let t = e.rows.map((e, t) => t);
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
534
|
+
return e.sortModel.length === 0 ? t : [...t].sort((t, n) => {
|
|
535
|
+
let r = e.rows[t], i = e.rows[n];
|
|
536
|
+
for (let t of e.sortModel) {
|
|
537
|
+
let n = p(e, t.columnId);
|
|
538
|
+
if (!n?.sort) continue;
|
|
539
|
+
let a = K(e, r, n.id), o = K(e, i, n.id), s = typeof n.sort == "function" ? n.sort(a, o, r, i) : T(a, o);
|
|
540
|
+
if (s !== 0) return t.direction === "desc" ? s * -1 : s;
|
|
541
|
+
}
|
|
542
|
+
return t - n;
|
|
522
543
|
});
|
|
523
544
|
}
|
|
524
|
-
function
|
|
525
|
-
let n =
|
|
545
|
+
function ve(e, t) {
|
|
546
|
+
let n = O(e, t);
|
|
526
547
|
return d(n, G(n).map((e) => n.rows[e]));
|
|
527
548
|
}
|
|
528
|
-
function
|
|
549
|
+
function ye(e, t = {}) {
|
|
529
550
|
let n = t.pageIndex ?? e.pagination.pageIndex, r = t.pageSize ?? e.pagination.pageSize, i = Math.max(0, n) * Math.max(1, r);
|
|
530
551
|
return G(e).slice(i, i + Math.max(1, r)).map((t) => e.rows[t]);
|
|
531
552
|
}
|
|
532
|
-
function
|
|
553
|
+
function be(e, { overscan: t = 2, rowHeight: n, scrollTop: r, viewportHeight: i }) {
|
|
533
554
|
let a = Math.max(1, n), o = G(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;
|
|
534
555
|
return {
|
|
535
556
|
bottomSpacerHeight: Math.max(0, c - d - (u - l) * a),
|
|
@@ -540,7 +561,7 @@ function _e(e, { overscan: t = 2, rowHeight: n, scrollTop: r, viewportHeight: i
|
|
|
540
561
|
totalHeight: c
|
|
541
562
|
};
|
|
542
563
|
}
|
|
543
|
-
function
|
|
564
|
+
function xe(e, t, n) {
|
|
544
565
|
let r = f(e, t);
|
|
545
566
|
if (r < 0) return e;
|
|
546
567
|
let i = [...e.rows], [a] = i.splice(r, 1);
|
|
@@ -548,25 +569,25 @@ function ve(e, t, n) {
|
|
|
548
569
|
}
|
|
549
570
|
function K(e, t, n) {
|
|
550
571
|
let r = p(e, n);
|
|
551
|
-
return r ?
|
|
572
|
+
return r ? g(t, r.field) : void 0;
|
|
552
573
|
}
|
|
553
|
-
function
|
|
574
|
+
function Se(e, t, n, r) {
|
|
554
575
|
let i = K(e, t, r.id);
|
|
555
|
-
return r.cell?.format ? r.cell.format(
|
|
576
|
+
return r.cell?.format ? r.cell.format(v(e, t, n, r)) : i == null ? "" : String(i);
|
|
556
577
|
}
|
|
557
|
-
function
|
|
558
|
-
let i =
|
|
559
|
-
return i?.disabled !== void 0 &&
|
|
578
|
+
function Ce(e, t, n, r) {
|
|
579
|
+
let i = b(e, t, n, r);
|
|
580
|
+
return i?.disabled !== void 0 && y(i.disabled, v(e, t, n, r)) === !0;
|
|
560
581
|
}
|
|
561
|
-
function
|
|
562
|
-
let i =
|
|
582
|
+
function we(e, t, n, r) {
|
|
583
|
+
let i = v(e, t, n, r), a = b(e, t, n, r)?.className;
|
|
563
584
|
return typeof a == "function" ? a(i) : a;
|
|
564
585
|
}
|
|
565
|
-
function
|
|
566
|
-
let i =
|
|
586
|
+
function Te(e, t, n, r) {
|
|
587
|
+
let i = v(e, t, n, r), a = b(e, t, n, r)?.style;
|
|
567
588
|
return typeof a == "function" ? a(i) : a;
|
|
568
589
|
}
|
|
569
|
-
function
|
|
590
|
+
function Ee(e, t) {
|
|
570
591
|
let n = e.rows[f(e, t)];
|
|
571
592
|
if (n === void 0) throw Error(`Cannot copy missing row: ${String(t)}`);
|
|
572
593
|
return {
|
|
@@ -575,25 +596,25 @@ function Ce(e, t) {
|
|
|
575
596
|
text: JSON.stringify(n)
|
|
576
597
|
};
|
|
577
598
|
}
|
|
578
|
-
function
|
|
599
|
+
function q(e, t, n) {
|
|
579
600
|
if (n.mode === "append") {
|
|
580
601
|
let r = n.getNewRowId?.(t.row);
|
|
581
|
-
return
|
|
602
|
+
return E(e, [r === void 0 ? t.row : S(t.row, r)]);
|
|
582
603
|
}
|
|
583
604
|
if (n.mode === "insert-after") {
|
|
584
605
|
let r = f(e, n.targetRowId);
|
|
585
606
|
if (r < 0) return e;
|
|
586
|
-
let i = e.getRowId(t.row, r), a = n.getPastedRowId?.(t.row) ??
|
|
607
|
+
let i = e.getRowId(t.row, r), a = n.getPastedRowId?.(t.row) ?? C(e.rowIds, i), o = S(t.row, a), s = [...e.rows];
|
|
587
608
|
return s.splice(r + 1, 0, o), d(e, s);
|
|
588
609
|
}
|
|
589
|
-
return
|
|
610
|
+
return D(e, [{
|
|
590
611
|
id: n.targetRowId,
|
|
591
|
-
patch:
|
|
612
|
+
patch: S(t.row, n.targetRowId)
|
|
592
613
|
}]);
|
|
593
614
|
}
|
|
594
|
-
function
|
|
615
|
+
function J(e, { columnId: t, rowId: n }) {
|
|
595
616
|
let r = e.rows[f(e, n)], i = p(e, t);
|
|
596
|
-
if (!i || !
|
|
617
|
+
if (!i || !w(e, r, n, i, "copy")) return null;
|
|
597
618
|
let a = K(e, r, t);
|
|
598
619
|
return {
|
|
599
620
|
kind: "cell",
|
|
@@ -601,23 +622,23 @@ function q(e, { columnId: t, rowId: n }) {
|
|
|
601
622
|
value: a
|
|
602
623
|
};
|
|
603
624
|
}
|
|
604
|
-
function
|
|
625
|
+
function Y(e, { columnId: t, rowId: n }, r) {
|
|
605
626
|
let i = p(e, t), a = e.rows[f(e, n)];
|
|
606
|
-
return !r || !i || !
|
|
627
|
+
return !r || !i || !w(e, a, n, i, "paste") ? e : D(e, [{
|
|
607
628
|
id: n,
|
|
608
|
-
patch: (e) =>
|
|
629
|
+
patch: (e) => _(e, i.field, r.value)
|
|
609
630
|
}]);
|
|
610
631
|
}
|
|
611
|
-
function
|
|
632
|
+
function De(e, t = e.selection.range) {
|
|
612
633
|
if (!t) return null;
|
|
613
|
-
let n =
|
|
634
|
+
let n = x(e, t);
|
|
614
635
|
if (!n) return null;
|
|
615
636
|
let r = [];
|
|
616
637
|
for (let t = n.rowStart; t <= n.rowEnd; t += 1) {
|
|
617
638
|
let i = e.rows[t], a = e.rowIds[t], o = [];
|
|
618
639
|
for (let t = n.columnStart; t <= n.columnEnd; t += 1) {
|
|
619
640
|
let r = n.visibleColumns[t];
|
|
620
|
-
if (i === void 0 || a === void 0 || !r || !
|
|
641
|
+
if (i === void 0 || a === void 0 || !r || !w(e, i, a, r, "copy")) {
|
|
621
642
|
o.push(null);
|
|
622
643
|
continue;
|
|
623
644
|
}
|
|
@@ -636,7 +657,7 @@ function Y(e, t = e.selection.range) {
|
|
|
636
657
|
text: r.map((e) => e.map((e) => e?.text ?? "").join(" ")).join("\n")
|
|
637
658
|
};
|
|
638
659
|
}
|
|
639
|
-
function
|
|
660
|
+
function Oe(e, t, n) {
|
|
640
661
|
if (!n) return e;
|
|
641
662
|
let r = W(e), i = f(e, t.rowId), a = r.findIndex((e) => e.id === t.columnId), o = [...e.rows];
|
|
642
663
|
if (i < 0 || a < 0) return e;
|
|
@@ -645,24 +666,24 @@ function Te(e, t, n) {
|
|
|
645
666
|
let c = i + n, l = o[c], u = e.rowIds[c];
|
|
646
667
|
l === void 0 || u === void 0 || t.forEach((t, n) => {
|
|
647
668
|
let i = r[a + n];
|
|
648
|
-
!t || !i || !
|
|
669
|
+
!t || !i || !w(e, l, u, i, "paste") || (o[c] = _(o[c], i.field, t.value), s = !0);
|
|
649
670
|
});
|
|
650
671
|
}), s ? d(e, o) : e;
|
|
651
672
|
}
|
|
652
|
-
function
|
|
653
|
-
let r =
|
|
654
|
-
return r ? U(e, n).reduce((e, t) =>
|
|
673
|
+
function ke(e, { source: t, target: n }) {
|
|
674
|
+
let r = J(e, t);
|
|
675
|
+
return r ? U(e, n).reduce((e, t) => Y(e, t, r), e) : e;
|
|
655
676
|
}
|
|
656
677
|
function X({ columnOrder: e, columns: t }) {
|
|
657
678
|
if (!e?.length) return t;
|
|
658
679
|
let n = new Map(t.map((e) => [e.id, e]));
|
|
659
680
|
return e.map((e) => n.get(e)).filter((e) => !!e);
|
|
660
681
|
}
|
|
661
|
-
function
|
|
682
|
+
function Ae(e) {
|
|
662
683
|
return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? String(e) : JSON.stringify(e);
|
|
663
684
|
}
|
|
664
685
|
function Z(e) {
|
|
665
|
-
let t =
|
|
686
|
+
let t = Ae(e);
|
|
666
687
|
return /[",\r\n]/u.test(t) ? `"${t.replaceAll("\"", "\"\"")}"` : t;
|
|
667
688
|
}
|
|
668
689
|
function Q(e, t) {
|
|
@@ -671,14 +692,14 @@ function Q(e, t) {
|
|
|
671
692
|
function $(e, t, n, r) {
|
|
672
693
|
return r === "formatted" && e.format ? e.format(t, n) : e.value(t, n);
|
|
673
694
|
}
|
|
674
|
-
function
|
|
695
|
+
function je({ columnOrder: e, columns: t, headerOverrides: n, rows: r, valueSource: i = "raw" }) {
|
|
675
696
|
let a = X({
|
|
676
697
|
columnOrder: e,
|
|
677
698
|
columns: t
|
|
678
699
|
});
|
|
679
700
|
return [a.map((e) => Z(Q(e, n))).join(","), ...r.map((e, t) => a.map((n) => Z($(n, e, t, i))).join(","))].join("\n");
|
|
680
701
|
}
|
|
681
|
-
function
|
|
702
|
+
function Me({ columnOrder: e, columns: t, headerOverrides: n, rows: r, valueSource: i = "raw" }) {
|
|
682
703
|
let a = X({
|
|
683
704
|
columnOrder: e,
|
|
684
705
|
columns: t
|
|
@@ -686,6 +707,6 @@ function ke({ columnOrder: e, columns: t, headerOverrides: n, rows: r, valueSour
|
|
|
686
707
|
return JSON.stringify(o, null, 2);
|
|
687
708
|
}
|
|
688
709
|
//#endregion
|
|
689
|
-
export {
|
|
710
|
+
export { E as addCominsRows, R as applyCominsColumnLayout, fe as clearCominsCellRange, pe as clearCominsSelection, se as clearCominsSortState, J as copyCominsCell, De as copyCominsCellRange, Ee as copyCominsRow, ee as createCominsTableState, re as deleteCominsRows, je as exportCominsRowsToCsv, Me as exportCominsRowsToJson, ke as fillCominsCellRange, Se as formatCominsCellValue, we as getCominsCellClassName, Te as getCominsCellStyle, K as getCominsCellValue, _e as getCominsHeaderRows, ye as getCominsPageRows, U as getCominsSelectedCellRange, G as getCominsSortedRowIndexes, be as getCominsVirtualRows, W as getCominsVisibleColumns, Ce as isCominsCellDisabled, ge as isCominsCellInSelectedRange, he as isCominsCellSelected, me as isCominsRowSelected, F as moveCominsColumn, I as moveCominsColumnGroup, xe as moveCominsRow, Y as pasteCominsCell, Oe as pasteCominsCellRange, q as pasteCominsRow, te as queryCominsRows, ne as replaceCominsRows, V as selectCell, H as selectCellRange, z as selectRow, B as selectRows, L as serializeCominsColumnLayout, ue as setCominsColumnGroupHidden, P as setCominsColumnGroupWidth, le as setCominsColumnHidden, ce as setCominsColumnWidth, ae as setCominsHeaderVisible, oe as setCominsPagination, k as setCominsSortModel, O as setCominsSortState, ie as setCominsTableTheme, ve as sortCominsRows, D as updateCominsRows };
|
|
690
711
|
|
|
691
712
|
//# sourceMappingURL=core.js.map
|