@smallwebco/tinypivot-vue 1.0.0

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.
@@ -0,0 +1,3068 @@
1
+ import { ref as M, computed as T, watch as Ue, defineComponent as Qe, onMounted as xt, nextTick as je, onUnmounted as Tt, createElementBlock as u, openBlock as r, createElementVNode as e, toDisplayString as R, normalizeClass as q, withDirectives as it, createCommentVNode as z, vModelText as rt, createTextVNode as I, Fragment as W, renderList as J, withModifiers as He, unref as S, normalizeStyle as ve, createVNode as Ye, createBlock as io, Transition as ro, withCtx as uo, withKeys as vo, Teleport as co } from "vue";
2
+ import { useVueTable as go, getFilteredRowModel as po, getSortedRowModel as fo, getCoreRowModel as mo } from "@tanstack/vue-table";
3
+ function ho(t) {
4
+ const i = t.filter((c) => c != null && c !== "");
5
+ if (i.length === 0)
6
+ return "string";
7
+ const n = i.slice(0, 100);
8
+ let l = 0, v = 0, m = 0;
9
+ for (const c of n)
10
+ typeof c == "boolean" ? m++ : typeof c == "number" || !Number.isNaN(Number(c)) && c !== "" ? l++ : (c instanceof Date || !Number.isNaN(Date.parse(String(c)))) && v++;
11
+ const y = n.length * 0.8;
12
+ return m >= y ? "boolean" : l >= y ? "number" : v >= y ? "date" : "string";
13
+ }
14
+ function wo(t, i) {
15
+ const l = t.map((c) => c[i]).filter((c) => c != null && c !== "").slice(0, 100);
16
+ let v = 0;
17
+ const m = /* @__PURE__ */ new Set();
18
+ for (const c of l)
19
+ m.add(String(c)), (typeof c == "number" || !Number.isNaN(Number(c)) && c !== "") && v++;
20
+ const y = v >= l.length * 0.8;
21
+ return {
22
+ field: i,
23
+ type: y ? "number" : "string",
24
+ uniqueCount: m.size,
25
+ isNumeric: y
26
+ };
27
+ }
28
+ function ko(t, i, n = 500) {
29
+ const l = [];
30
+ let v = 0;
31
+ for (const c of t) {
32
+ const b = c[i];
33
+ b == null || b === "" ? v++ : l.push(b);
34
+ }
35
+ const m = /* @__PURE__ */ new Set();
36
+ for (const c of l)
37
+ if (m.add(String(c)), m.size >= n)
38
+ break;
39
+ return {
40
+ uniqueValues: Array.from(m).sort((c, b) => {
41
+ const C = Number.parseFloat(c), V = Number.parseFloat(b);
42
+ return !Number.isNaN(C) && !Number.isNaN(V) ? C - V : c.localeCompare(b);
43
+ }),
44
+ totalCount: t.length,
45
+ nullCount: v,
46
+ type: ho(l)
47
+ };
48
+ }
49
+ function Co(t, i) {
50
+ if (t == null || t === "")
51
+ return "";
52
+ switch (i) {
53
+ case "number": {
54
+ const n = typeof t == "number" ? t : Number.parseFloat(String(t));
55
+ return Number.isNaN(n) ? String(t) : Math.abs(n) >= 1e3 ? n.toLocaleString("en-US", { maximumFractionDigits: 2 }) : n.toLocaleString("en-US", { maximumFractionDigits: 4 });
56
+ }
57
+ case "date": {
58
+ const n = t instanceof Date ? t : new Date(String(t));
59
+ return Number.isNaN(n.getTime()) ? String(t) : n.toLocaleDateString("en-US", {
60
+ year: "numeric",
61
+ month: "short",
62
+ day: "numeric"
63
+ });
64
+ }
65
+ case "boolean":
66
+ return t ? "Yes" : "No";
67
+ default:
68
+ return String(t);
69
+ }
70
+ }
71
+ function Ft(t, i) {
72
+ return i.map((n) => String(t[n] ?? "(blank)")).join("|||");
73
+ }
74
+ function St(t) {
75
+ return t.split("|||");
76
+ }
77
+ function Ze(t, i) {
78
+ if (t.length === 0)
79
+ return null;
80
+ switch (i) {
81
+ case "sum":
82
+ return t.reduce((n, l) => n + l, 0);
83
+ case "count":
84
+ return t.length;
85
+ case "avg":
86
+ return t.reduce((n, l) => n + l, 0) / t.length;
87
+ case "min":
88
+ return Math.min(...t);
89
+ case "max":
90
+ return Math.max(...t);
91
+ case "countDistinct":
92
+ return new Set(t).size;
93
+ default:
94
+ return t.reduce((n, l) => n + l, 0);
95
+ }
96
+ }
97
+ function Je(t, i) {
98
+ return t === null ? "-" : i === "count" || i === "countDistinct" ? Math.round(t).toLocaleString() : Math.abs(t) >= 1e3 ? t.toLocaleString("en-US", { maximumFractionDigits: 2 }) : t.toLocaleString("en-US", { maximumFractionDigits: 4 });
99
+ }
100
+ function Rt(t) {
101
+ return {
102
+ sum: "Sum",
103
+ count: "Count",
104
+ avg: "Average",
105
+ min: "Min",
106
+ max: "Max",
107
+ countDistinct: "Count Distinct"
108
+ }[t];
109
+ }
110
+ function yo(t) {
111
+ return t.length === 0 ? [] : Object.keys(t[0]).map((n) => wo(t, n));
112
+ }
113
+ function bo(t, i, n, l) {
114
+ const v = /* @__PURE__ */ new Set([
115
+ ...i,
116
+ ...n,
117
+ ...l.map((m) => m.field)
118
+ ]);
119
+ return t.filter((m) => !v.has(m.field));
120
+ }
121
+ function Vt(t) {
122
+ return (t.rowFields.length > 0 || t.columnFields.length > 0) && t.valueFields.length > 0;
123
+ }
124
+ function Fo(t, i) {
125
+ const { rowFields: n, columnFields: l, valueFields: v, showRowTotals: m, showColumnTotals: y } = i;
126
+ if (!Vt(i) || t.length === 0)
127
+ return null;
128
+ const c = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map();
129
+ for (const f of t) {
130
+ const s = n.length > 0 ? Ft(f, n) : "__all__", d = l.length > 0 ? Ft(f, l) : "__all__";
131
+ c.add(s), b.add(d), C.has(s) || C.set(s, /* @__PURE__ */ new Map());
132
+ const F = C.get(s);
133
+ F.has(d) || F.set(d, v.map(() => []));
134
+ const g = F.get(d);
135
+ for (let w = 0; w < v.length; w++) {
136
+ const x = v[w], L = f[x.field];
137
+ if (L != null && L !== "") {
138
+ const ee = typeof L == "number" ? L : Number.parseFloat(String(L));
139
+ Number.isNaN(ee) ? (x.aggregation === "count" || x.aggregation === "countDistinct") && g[w].push(1) : g[w].push(ee);
140
+ }
141
+ }
142
+ }
143
+ const V = Array.from(c).sort(), $ = Array.from(b).sort(), U = [];
144
+ if (l.length > 0)
145
+ for (let f = 0; f < l.length; f++) {
146
+ const s = [];
147
+ for (const d of $) {
148
+ const F = St(d);
149
+ s.push(F[f] || "");
150
+ }
151
+ U.push(s);
152
+ }
153
+ if (v.length > 1 || U.length === 0) {
154
+ const f = [];
155
+ for (const s of $)
156
+ for (const d of v)
157
+ f.push(`${d.label || d.field} (${Rt(d.aggregation)})`);
158
+ $.length === 1 && $[0] === "__all__" ? U.push(v.map((s) => `${s.label || s.field} (${Rt(s.aggregation)})`)) : U.push(f);
159
+ }
160
+ const D = V.map((f) => f === "__all__" ? ["Total"] : St(f)), H = [], O = [], _ = /* @__PURE__ */ new Map();
161
+ for (const f of V) {
162
+ const s = [], d = v.map(() => []);
163
+ let F = 0;
164
+ for (const g of $) {
165
+ const w = C.get(f), x = (w == null ? void 0 : w.get(g)) || v.map(() => []);
166
+ for (let L = 0; L < v.length; L++) {
167
+ const ee = v[L], ie = x[L], me = Ze(ie, ee.aggregation);
168
+ s.push({
169
+ value: me,
170
+ count: ie.length,
171
+ formattedValue: Je(me, ee.aggregation)
172
+ }), d[L].push(...ie), _.has(F) || _.set(F, v.map(() => [])), _.get(F)[L].push(...ie), F++;
173
+ }
174
+ }
175
+ if (H.push(s), m && $.length > 1) {
176
+ const g = {
177
+ value: null,
178
+ count: 0,
179
+ formattedValue: "-"
180
+ };
181
+ if (v.length > 0) {
182
+ const w = v[0], x = d[0], L = Ze(x, w.aggregation);
183
+ g.value = L, g.count = x.length, g.formattedValue = Je(L, w.aggregation);
184
+ }
185
+ O.push(g);
186
+ }
187
+ }
188
+ const X = [];
189
+ if (y && V.length > 1)
190
+ for (let f = 0; f < $.length * v.length; f++) {
191
+ const s = f % v.length, d = v[s], F = [];
192
+ for (const w of V) {
193
+ const x = C.get(w), L = $[Math.floor(f / v.length)], ee = (x == null ? void 0 : x.get(L)) || v.map(() => []);
194
+ F.push(...ee[s]);
195
+ }
196
+ const g = Ze(F, d.aggregation);
197
+ X.push({
198
+ value: g,
199
+ count: F.length,
200
+ formattedValue: Je(g, d.aggregation)
201
+ });
202
+ }
203
+ const B = { value: null, count: 0, formattedValue: "-" };
204
+ if (m && y && v.length > 0) {
205
+ const f = v[0], s = [];
206
+ for (const F of t) {
207
+ const g = F[f.field];
208
+ if (g != null && g !== "") {
209
+ const w = typeof g == "number" ? g : Number.parseFloat(String(g));
210
+ Number.isNaN(w) ? (f.aggregation === "count" || f.aggregation === "countDistinct") && s.push(1) : s.push(w);
211
+ }
212
+ }
213
+ const d = Ze(s, f.aggregation);
214
+ B.value = d, B.count = s.length, B.formattedValue = Je(d, f.aggregation);
215
+ }
216
+ return {
217
+ headers: U,
218
+ rowHeaders: D,
219
+ data: H,
220
+ rowTotals: O,
221
+ columnTotals: X,
222
+ grandTotal: B
223
+ };
224
+ }
225
+ const So = "vpg-pivot-";
226
+ function Ro(t) {
227
+ const n = [...t].sort().join("|").substring(0, 100);
228
+ return `${So}${n}`;
229
+ }
230
+ function $o(t, i) {
231
+ try {
232
+ sessionStorage.setItem(t, JSON.stringify(i));
233
+ } catch {
234
+ }
235
+ }
236
+ function Mo(t) {
237
+ try {
238
+ const i = sessionStorage.getItem(t);
239
+ if (i)
240
+ return JSON.parse(i);
241
+ } catch {
242
+ }
243
+ return null;
244
+ }
245
+ function lt(t, i) {
246
+ const n = new Set(i);
247
+ return [
248
+ ...t.rowFields,
249
+ ...t.columnFields,
250
+ ...t.valueFields.map((v) => v.field)
251
+ ].every((v) => n.has(v));
252
+ }
253
+ const Dt = {
254
+ type: "free",
255
+ isValid: !0,
256
+ features: {
257
+ pivot: !1,
258
+ advancedAggregations: !1,
259
+ percentageMode: !1,
260
+ sessionPersistence: !1,
261
+ noWatermark: !1
262
+ }
263
+ }, st = {
264
+ type: "free",
265
+ isValid: !1,
266
+ features: {
267
+ pivot: !1,
268
+ advancedAggregations: !1,
269
+ percentageMode: !1,
270
+ sessionPersistence: !1,
271
+ noWatermark: !1
272
+ }
273
+ }, xo = {
274
+ type: "free",
275
+ isValid: !0,
276
+ features: {
277
+ pivot: !0,
278
+ advancedAggregations: !0,
279
+ percentageMode: !0,
280
+ sessionPersistence: !0,
281
+ noWatermark: !1
282
+ // Still show watermark in demo
283
+ }
284
+ };
285
+ async function To(t, i, n) {
286
+ const l = globalThis.__TP_LICENSE_SECRET__;
287
+ if (!l)
288
+ return console.warn("[TinyPivot] License secret not configured. Call configureLicenseSecret() first."), !1;
289
+ const v = `TP-${t}-${n}`;
290
+ try {
291
+ const m = new TextEncoder(), y = m.encode(l), c = m.encode(v), b = await crypto.subtle.importKey("raw", y, { name: "HMAC", hash: "SHA-256" }, !1, ["sign"]), C = await crypto.subtle.sign("HMAC", b, c), $ = Array.from(new Uint8Array(C)).map((U) => U.toString(16).padStart(2, "0")).join("").slice(0, 12).toUpperCase();
292
+ return i === $;
293
+ } catch {
294
+ return !1;
295
+ }
296
+ }
297
+ async function Vo(t) {
298
+ if (!t || t === "")
299
+ return Dt;
300
+ const i = t.split("-");
301
+ if (i.length !== 4 || i[0] !== "TP")
302
+ return st;
303
+ const n = i[1], l = i[2], v = i[3];
304
+ if (!await To(n, l, v))
305
+ return st;
306
+ const y = Number.parseInt(v.slice(0, 4)), c = Number.parseInt(v.slice(4, 6)) - 1, b = Number.parseInt(v.slice(6, 8)), C = new Date(y, c, b);
307
+ if (C < /* @__PURE__ */ new Date())
308
+ return { ...st, expiresAt: C };
309
+ let V = "free";
310
+ return n === "PRO1" ? V = "pro-single" : n === "PROU" ? V = "pro-unlimited" : n === "PROT" && (V = "pro-team"), {
311
+ type: V,
312
+ isValid: !0,
313
+ expiresAt: C,
314
+ features: {
315
+ pivot: V !== "free",
316
+ advancedAggregations: V !== "free",
317
+ percentageMode: V !== "free",
318
+ sessionPersistence: V !== "free",
319
+ noWatermark: V !== "free"
320
+ }
321
+ };
322
+ }
323
+ function Do(t) {
324
+ globalThis.__TP_LICENSE_SECRET__ = t;
325
+ }
326
+ function zo() {
327
+ return xo;
328
+ }
329
+ function Ao() {
330
+ return Dt;
331
+ }
332
+ function Lo(t) {
333
+ return t.features.pivot;
334
+ }
335
+ function Po(t) {
336
+ return t.isValid && t.type !== "free";
337
+ }
338
+ function Eo(t, i) {
339
+ return i || !t.features.noWatermark;
340
+ }
341
+ function No(t) {
342
+ console.warn(`[TinyPivot] "${t}" requires a Pro license. Visit https://tiny-pivot.com/#pricing to upgrade.`);
343
+ }
344
+ function le(t, i = ",") {
345
+ if (t == null)
346
+ return "";
347
+ const n = String(t);
348
+ return n.includes(i) || n.includes('"') || n.includes(`
349
+ `) ? `"${n.replace(/"/g, '""')}"` : n;
350
+ }
351
+ function Bo(t, i, n = {}) {
352
+ const { filename: l = "export.csv", includeHeaders: v = !0, delimiter: m = "," } = n, y = [];
353
+ v && y.push(i.map((b) => le(b, m)).join(m));
354
+ for (const b of t) {
355
+ const C = i.map((V) => le(b[V], m));
356
+ y.push(C.join(m));
357
+ }
358
+ const c = y.join(`
359
+ `);
360
+ zt(c, l, "text/csv;charset=utf-8;");
361
+ }
362
+ function jo(t, i, n, l, v = {}) {
363
+ const { filename: m = "pivot-export.csv", delimiter: y = "," } = v, c = [], { headers: b, rowHeaders: C, data: V, rowTotals: $, columnTotals: U, grandTotal: D, showRowTotals: H, showColumnTotals: O } = t, _ = i.length || 1;
364
+ if (b.length > 0)
365
+ for (let B = 0; B < b.length; B++) {
366
+ const f = [];
367
+ for (let s = 0; s < _; s++)
368
+ f.push(B === b.length - 1 ? le(i[s] || "", y) : "");
369
+ for (const s of b[B])
370
+ f.push(le(s, y));
371
+ if (H && $ && $.length > 0)
372
+ if (B === b.length - 1)
373
+ for (const s of l)
374
+ f.push(le(`Total (${s.aggregation})`, y));
375
+ else
376
+ for (let s = 0; s < l.length; s++)
377
+ f.push("");
378
+ c.push(f.join(y));
379
+ }
380
+ else {
381
+ const B = [];
382
+ for (let f = 0; f < _; f++)
383
+ B.push(le(i[f] || "", y));
384
+ for (const f of l)
385
+ B.push(le(`${f.field} (${f.aggregation})`, y));
386
+ H && $ && $.length > 0 && B.push(le("Total", y)), c.push(B.join(y));
387
+ }
388
+ for (let B = 0; B < C.length; B++) {
389
+ const f = [], s = C[B] || [];
390
+ for (let F = 0; F < _; F++)
391
+ f.push(le(s[F] || "", y));
392
+ const d = V[B] || [];
393
+ for (const F of d)
394
+ f.push(le((F == null ? void 0 : F.formattedValue) || "", y));
395
+ H && $ && $[B] && f.push(le($[B].formattedValue || "", y)), c.push(f.join(y));
396
+ }
397
+ if (O && U && U.length > 0) {
398
+ const B = [];
399
+ B.push(le("Total", y));
400
+ for (let f = 1; f < _; f++)
401
+ B.push("");
402
+ for (const f of U)
403
+ B.push(le((f == null ? void 0 : f.formattedValue) || "", y));
404
+ H && D && B.push(le(D.formattedValue || "", y)), c.push(B.join(y));
405
+ }
406
+ const X = c.join(`
407
+ `);
408
+ zt(X, m, "text/csv;charset=utf-8;");
409
+ }
410
+ function zt(t, i, n) {
411
+ const l = new Blob([t], { type: n }), v = URL.createObjectURL(l), m = document.createElement("a");
412
+ m.href = v, m.download = i, m.style.display = "none", document.body.appendChild(m), m.click(), document.body.removeChild(m), URL.revokeObjectURL(v);
413
+ }
414
+ function Ho(t, i, n) {
415
+ navigator.clipboard.writeText(t).then(i).catch(n);
416
+ }
417
+ function Uo(t, i, n) {
418
+ const { minRow: l, maxRow: v, minCol: m, maxCol: y } = n, c = [];
419
+ for (let b = l; b <= v; b++) {
420
+ const C = t[b];
421
+ if (!C)
422
+ continue;
423
+ const V = [];
424
+ for (let $ = m; $ <= y; $++) {
425
+ const U = i[$];
426
+ if (!U)
427
+ continue;
428
+ const D = C[U];
429
+ V.push(D == null ? "" : String(D));
430
+ }
431
+ c.push(V.join(" "));
432
+ }
433
+ return c.join(`
434
+ `);
435
+ }
436
+ const $t = (t, i, n) => {
437
+ if (!n || !Array.isArray(n) || n.length === 0)
438
+ return !0;
439
+ const l = t.getValue(i), v = l == null || l === "" ? "(blank)" : String(l);
440
+ return n.includes(v);
441
+ };
442
+ function Ko(t) {
443
+ const { data: i, enableSorting: n = !0, enableFiltering: l = !0 } = t, v = M([]), m = M([]), y = M({}), c = M(""), b = M({}), C = T(() => i.value.length === 0 ? [] : Object.keys(i.value[0]));
444
+ function V(g) {
445
+ const w = `${g}-${i.value.length}`;
446
+ return b.value[w] || (b.value[w] = ko(i.value, g)), b.value[w];
447
+ }
448
+ function $() {
449
+ b.value = {};
450
+ }
451
+ const U = T(() => C.value.map((g) => {
452
+ const w = V(g);
453
+ return {
454
+ id: g,
455
+ accessorKey: g,
456
+ header: g,
457
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
458
+ cell: (x) => Co(x.getValue(), w.type),
459
+ filterFn: $t,
460
+ meta: {
461
+ type: w.type,
462
+ uniqueCount: w.uniqueValues.length
463
+ }
464
+ };
465
+ })), D = go({
466
+ get data() {
467
+ return i.value;
468
+ },
469
+ get columns() {
470
+ return U.value;
471
+ },
472
+ state: {
473
+ get sorting() {
474
+ return v.value;
475
+ },
476
+ get columnFilters() {
477
+ return m.value;
478
+ },
479
+ get columnVisibility() {
480
+ return y.value;
481
+ },
482
+ get globalFilter() {
483
+ return c.value;
484
+ }
485
+ },
486
+ onSortingChange: (g) => {
487
+ v.value = typeof g == "function" ? g(v.value) : g;
488
+ },
489
+ onColumnFiltersChange: (g) => {
490
+ m.value = typeof g == "function" ? g(m.value) : g;
491
+ },
492
+ getCoreRowModel: mo(),
493
+ getSortedRowModel: n ? fo() : void 0,
494
+ getFilteredRowModel: l ? po() : void 0,
495
+ filterFns: {
496
+ multiSelect: $t
497
+ },
498
+ enableSorting: n,
499
+ enableFilters: l
500
+ }), H = T(() => D.getFilteredRowModel().rows.length), O = T(() => i.value.length), _ = T(() => m.value.map((g) => ({
501
+ column: g.id,
502
+ values: g.value
503
+ })));
504
+ function X(g) {
505
+ const w = D.getColumn(g);
506
+ if (!w) return !1;
507
+ const x = w.getFilterValue();
508
+ return x !== void 0 && Array.isArray(x) && x.length > 0;
509
+ }
510
+ function B(g, w) {
511
+ const x = D.getColumn(g);
512
+ x && (x.setFilterValue(w.length === 0 ? void 0 : w), m.value = D.getState().columnFilters);
513
+ }
514
+ function f() {
515
+ D.resetColumnFilters(), c.value = "", m.value = [];
516
+ }
517
+ function s(g) {
518
+ const w = D.getColumn(g);
519
+ if (!w) return [];
520
+ const x = w.getFilterValue();
521
+ return Array.isArray(x) ? x : [];
522
+ }
523
+ function d(g) {
524
+ const w = v.value.find((x) => x.id === g);
525
+ w ? w.desc ? v.value = [] : v.value = [{ id: g, desc: !0 }] : v.value = [{ id: g, desc: !1 }];
526
+ }
527
+ function F(g) {
528
+ const w = v.value.find((x) => x.id === g);
529
+ return w ? w.desc ? "desc" : "asc" : null;
530
+ }
531
+ return Ue(i, () => {
532
+ $();
533
+ }), {
534
+ // Table instance
535
+ table: D,
536
+ // State
537
+ sorting: v,
538
+ columnFilters: m,
539
+ columnVisibility: y,
540
+ globalFilter: c,
541
+ columnKeys: C,
542
+ // Computed
543
+ filteredRowCount: H,
544
+ totalRowCount: O,
545
+ activeFilters: _,
546
+ // Methods
547
+ getColumnStats: V,
548
+ clearStatsCache: $,
549
+ hasActiveFilter: X,
550
+ setColumnFilter: B,
551
+ getColumnFilterValues: s,
552
+ clearAllFilters: f,
553
+ toggleSort: d,
554
+ getSortDirection: F
555
+ };
556
+ }
557
+ const Wo = M(null), $e = M(!1), ce = M(Ao());
558
+ let at = null;
559
+ async function As(t) {
560
+ Wo.value = t, at = Vo(t), ce.value = await at, at = null, ce.value.isValid ? ce.value.type !== "free" && console.info(`[TinyPivot] Pro license activated (${ce.value.type})`) : console.warn("[TinyPivot] Invalid or expired license key. Running in free mode.");
561
+ }
562
+ function Ls() {
563
+ $e.value = !0, ce.value = zo(), console.info("[TinyPivot] Demo mode enabled - all Pro features unlocked for evaluation");
564
+ }
565
+ function Ps(t) {
566
+ Do(t);
567
+ }
568
+ function Ie() {
569
+ const t = T(() => $e.value), i = T(() => $e.value || Po(ce.value)), n = T(() => $e.value || Lo(ce.value)), l = T(
570
+ () => $e.value || ce.value.features.advancedAggregations
571
+ ), v = T(
572
+ () => $e.value || ce.value.features.percentageMode
573
+ ), m = T(() => Eo(ce.value, $e.value));
574
+ function y(c) {
575
+ return i.value ? !0 : (No(c), !1);
576
+ }
577
+ return {
578
+ licenseInfo: T(() => ce.value),
579
+ isDemo: t,
580
+ isPro: i,
581
+ canUsePivot: n,
582
+ canUseAdvancedAggregations: l,
583
+ canUsePercentageMode: v,
584
+ showWatermark: m,
585
+ requirePro: y
586
+ };
587
+ }
588
+ function _o(t) {
589
+ const { canUsePivot: i, requirePro: n } = Ie(), l = M([]), v = M([]), m = M([]), y = M(!0), c = M(!0), b = M(null), C = T(() => yo(t.value)), V = T(() => bo(
590
+ C.value,
591
+ l.value,
592
+ v.value,
593
+ m.value
594
+ )), $ = T(() => Vt({
595
+ rowFields: l.value,
596
+ columnFields: v.value,
597
+ valueFields: m.value,
598
+ showRowTotals: y.value,
599
+ showColumnTotals: c.value
600
+ })), U = T(() => !$.value || !i.value ? null : Fo(t.value, {
601
+ rowFields: l.value,
602
+ columnFields: v.value,
603
+ valueFields: m.value,
604
+ showRowTotals: y.value,
605
+ showColumnTotals: c.value
606
+ }));
607
+ function D(g) {
608
+ n("Pivot Table - Row Fields") && (l.value.includes(g) || (l.value = [...l.value, g]));
609
+ }
610
+ function H(g) {
611
+ l.value = l.value.filter((w) => w !== g);
612
+ }
613
+ function O(g) {
614
+ n("Pivot Table - Column Fields") && (v.value.includes(g) || (v.value = [...v.value, g]));
615
+ }
616
+ function _(g) {
617
+ v.value = v.value.filter((w) => w !== g);
618
+ }
619
+ function X(g, w = "sum") {
620
+ n("Pivot Table - Value Fields") && (m.value.some((x) => x.field === g && x.aggregation === w) || (m.value = [...m.value, { field: g, aggregation: w }]));
621
+ }
622
+ function B(g, w) {
623
+ w ? m.value = m.value.filter(
624
+ (x) => !(x.field === g && x.aggregation === w)
625
+ ) : m.value = m.value.filter((x) => x.field !== g);
626
+ }
627
+ function f(g, w, x) {
628
+ m.value = m.value.map((L) => L.field === g && L.aggregation === w ? { ...L, aggregation: x } : L);
629
+ }
630
+ function s() {
631
+ l.value = [], v.value = [], m.value = [];
632
+ }
633
+ function d(g, w) {
634
+ if (g.area === w.area) {
635
+ if (g.area === "row") {
636
+ const x = [...l.value], [L] = x.splice(g.index, 1);
637
+ x.splice(w.index, 0, L), l.value = x;
638
+ } else if (g.area === "column") {
639
+ const x = [...v.value], [L] = x.splice(g.index, 1);
640
+ x.splice(w.index, 0, L), v.value = x;
641
+ }
642
+ }
643
+ }
644
+ function F() {
645
+ if (!n("Pivot Table - Auto Suggest") || C.value.length === 0) return;
646
+ const g = C.value.filter((x) => !x.isNumeric && x.uniqueCount < 50), w = C.value.filter((x) => x.isNumeric);
647
+ g.length > 0 && w.length > 0 && (l.value = [g[0].field], m.value = [{ field: w[0].field, aggregation: "sum" }]);
648
+ }
649
+ return Ue(
650
+ t,
651
+ (g) => {
652
+ if (g.length === 0) return;
653
+ const w = Object.keys(g[0]), x = Ro(w);
654
+ if (x !== b.value) {
655
+ b.value = x;
656
+ const L = Mo(x);
657
+ if (L && lt(L, w))
658
+ l.value = L.rowFields, v.value = L.columnFields, m.value = L.valueFields, y.value = L.showRowTotals, c.value = L.showColumnTotals;
659
+ else {
660
+ const ee = {
661
+ rowFields: l.value,
662
+ columnFields: v.value,
663
+ valueFields: m.value,
664
+ showRowTotals: y.value,
665
+ showColumnTotals: c.value
666
+ };
667
+ lt(ee, w) || s();
668
+ }
669
+ } else {
670
+ const L = {
671
+ rowFields: l.value,
672
+ columnFields: v.value,
673
+ valueFields: m.value,
674
+ showRowTotals: y.value,
675
+ showColumnTotals: c.value
676
+ };
677
+ lt(L, w) || s();
678
+ }
679
+ },
680
+ { immediate: !0 }
681
+ ), Ue(
682
+ [l, v, m, y, c],
683
+ () => {
684
+ if (!b.value) return;
685
+ const g = {
686
+ rowFields: l.value,
687
+ columnFields: v.value,
688
+ valueFields: m.value,
689
+ showRowTotals: y.value,
690
+ showColumnTotals: c.value
691
+ };
692
+ $o(b.value, g);
693
+ },
694
+ { deep: !0 }
695
+ ), {
696
+ // State
697
+ rowFields: l,
698
+ columnFields: v,
699
+ valueFields: m,
700
+ showRowTotals: y,
701
+ showColumnTotals: c,
702
+ // Computed
703
+ availableFields: C,
704
+ unassignedFields: V,
705
+ isConfigured: $,
706
+ pivotResult: U,
707
+ // Actions
708
+ addRowField: D,
709
+ removeRowField: H,
710
+ addColumnField: O,
711
+ removeColumnField: _,
712
+ addValueField: X,
713
+ removeValueField: B,
714
+ updateValueFieldAggregation: f,
715
+ clearConfig: s,
716
+ moveField: d,
717
+ autoSuggestConfig: F
718
+ };
719
+ }
720
+ function qo(t, i, n) {
721
+ Bo(t, i, n);
722
+ }
723
+ function Oo(t, i, n, l, v) {
724
+ jo(t, i, n, l, v);
725
+ }
726
+ function Go(t, i, n) {
727
+ Ho(t, i, n);
728
+ }
729
+ function Xo(t, i, n) {
730
+ return Uo(t, i, n);
731
+ }
732
+ function Es(t, i = {}) {
733
+ const n = M(i.pageSize ?? 50), l = M(i.currentPage ?? 1), v = T(
734
+ () => Math.max(1, Math.ceil(t.value.length / n.value))
735
+ ), m = T(() => {
736
+ const H = (l.value - 1) * n.value, O = H + n.value;
737
+ return t.value.slice(H, O);
738
+ }), y = T(() => (l.value - 1) * n.value + 1), c = T(
739
+ () => Math.min(l.value * n.value, t.value.length)
740
+ );
741
+ function b(H) {
742
+ l.value = Math.max(1, Math.min(H, v.value));
743
+ }
744
+ function C() {
745
+ l.value < v.value && l.value++;
746
+ }
747
+ function V() {
748
+ l.value > 1 && l.value--;
749
+ }
750
+ function $() {
751
+ l.value = 1;
752
+ }
753
+ function U() {
754
+ l.value = v.value;
755
+ }
756
+ function D(H) {
757
+ n.value = H, l.value = 1;
758
+ }
759
+ return {
760
+ pageSize: n,
761
+ currentPage: l,
762
+ totalPages: v,
763
+ paginatedData: m,
764
+ startIndex: y,
765
+ endIndex: c,
766
+ goToPage: b,
767
+ nextPage: C,
768
+ prevPage: V,
769
+ firstPage: $,
770
+ lastPage: U,
771
+ setPageSize: D
772
+ };
773
+ }
774
+ function Ns(t, i) {
775
+ const n = M(""), l = M(!1), v = T(() => {
776
+ if (!n.value.trim())
777
+ return t.value;
778
+ const y = l.value ? n.value.trim() : n.value.trim().toLowerCase();
779
+ return t.value.filter((c) => {
780
+ for (const b of i.value) {
781
+ const C = c[b];
782
+ if (C == null) continue;
783
+ if ((l.value ? String(C) : String(C).toLowerCase()).includes(y))
784
+ return !0;
785
+ }
786
+ return !1;
787
+ });
788
+ });
789
+ function m() {
790
+ n.value = "";
791
+ }
792
+ return {
793
+ searchTerm: n,
794
+ caseSensitive: l,
795
+ filteredData: v,
796
+ clearSearch: m
797
+ };
798
+ }
799
+ function Bs(t) {
800
+ const i = M(/* @__PURE__ */ new Set()), n = T(() => Array.from(i.value).sort((D, H) => D - H).map((D) => t.value[D]).filter(Boolean)), l = T(() => t.value.length > 0 && i.value.size === t.value.length), v = T(() => i.value.size > 0 && i.value.size < t.value.length);
801
+ function m(D) {
802
+ i.value.has(D) ? i.value.delete(D) : i.value.add(D), i.value = new Set(i.value);
803
+ }
804
+ function y(D) {
805
+ i.value.add(D), i.value = new Set(i.value);
806
+ }
807
+ function c(D) {
808
+ i.value.delete(D), i.value = new Set(i.value);
809
+ }
810
+ function b() {
811
+ i.value = new Set(t.value.map((D, H) => H));
812
+ }
813
+ function C() {
814
+ i.value = /* @__PURE__ */ new Set();
815
+ }
816
+ function V() {
817
+ l.value ? C() : b();
818
+ }
819
+ function $(D) {
820
+ return i.value.has(D);
821
+ }
822
+ function U(D, H) {
823
+ const O = Math.min(D, H), _ = Math.max(D, H);
824
+ for (let X = O; X <= _; X++)
825
+ i.value.add(X);
826
+ i.value = new Set(i.value);
827
+ }
828
+ return {
829
+ selectedRowIndices: i,
830
+ selectedRows: n,
831
+ allSelected: l,
832
+ someSelected: v,
833
+ toggleRow: m,
834
+ selectRow: y,
835
+ deselectRow: c,
836
+ selectAll: b,
837
+ deselectAll: C,
838
+ toggleAll: V,
839
+ isSelected: $,
840
+ selectRange: U
841
+ };
842
+ }
843
+ function js(t, i = 60, n = 600) {
844
+ const l = M({ ...t.value }), v = M(!1), m = M(null);
845
+ function y(C, V) {
846
+ v.value = !0, m.value = C;
847
+ const $ = V.clientX, U = l.value[C] || 150, D = (O) => {
848
+ const _ = O.clientX - $, X = Math.max(i, Math.min(n, U + _));
849
+ l.value = {
850
+ ...l.value,
851
+ [C]: X
852
+ };
853
+ }, H = () => {
854
+ v.value = !1, m.value = null, document.removeEventListener("mousemove", D), document.removeEventListener("mouseup", H);
855
+ };
856
+ document.addEventListener("mousemove", D), document.addEventListener("mouseup", H);
857
+ }
858
+ function c(C) {
859
+ t.value[C] && (l.value = {
860
+ ...l.value,
861
+ [C]: t.value[C]
862
+ });
863
+ }
864
+ function b() {
865
+ l.value = { ...t.value };
866
+ }
867
+ return {
868
+ columnWidths: l,
869
+ isResizing: v,
870
+ resizingColumn: m,
871
+ startResize: y,
872
+ resetColumnWidth: c,
873
+ resetAllWidths: b
874
+ };
875
+ }
876
+ const Yo = { class: "vpg-filter-header" }, Zo = { class: "vpg-filter-title" }, Jo = { class: "vpg-filter-count" }, Qo = { class: "vpg-sort-controls" }, Io = { class: "vpg-search-container" }, en = { class: "vpg-values-list" }, tn = ["checked", "onChange"], on = {
877
+ key: 0,
878
+ class: "vpg-no-results"
879
+ }, nn = /* @__PURE__ */ Qe({
880
+ __name: "ColumnFilter",
881
+ props: {
882
+ columnId: {},
883
+ columnName: {},
884
+ stats: {},
885
+ selectedValues: {},
886
+ sortDirection: {}
887
+ },
888
+ emits: ["filter", "sort", "close"],
889
+ setup(t, { emit: i }) {
890
+ const n = t, l = i, v = M(""), m = M(), y = M();
891
+ T(() => {
892
+ const s = [...n.stats.uniqueValues];
893
+ return n.stats.nullCount > 0 && s.unshift("(blank)"), s;
894
+ });
895
+ const c = M(new Set(n.selectedValues)), b = T(() => n.stats.nullCount > 0), C = T(() => {
896
+ const s = n.stats.uniqueValues;
897
+ if (!v.value)
898
+ return s;
899
+ const d = v.value.toLowerCase();
900
+ return s.filter((F) => F.toLowerCase().includes(d));
901
+ }), V = T(() => {
902
+ const s = [...C.value];
903
+ return b.value && (!v.value || "(blank)".includes(v.value.toLowerCase())) && s.unshift("(blank)"), s;
904
+ });
905
+ T(() => V.value.every((s) => c.value.has(s))), T(() => c.value.size === 0);
906
+ function $(s) {
907
+ c.value.has(s) ? c.value.delete(s) : c.value.add(s), c.value = new Set(c.value);
908
+ }
909
+ function U() {
910
+ for (const s of V.value)
911
+ c.value.add(s);
912
+ c.value = new Set(c.value);
913
+ }
914
+ function D() {
915
+ c.value.clear(), c.value = new Set(c.value);
916
+ }
917
+ function H() {
918
+ c.value.size === 0 ? l("filter", []) : l("filter", Array.from(c.value)), l("close");
919
+ }
920
+ function O() {
921
+ l("sort", n.sortDirection === "asc" ? null : "asc");
922
+ }
923
+ function _() {
924
+ l("sort", n.sortDirection === "desc" ? null : "desc");
925
+ }
926
+ function X() {
927
+ c.value.clear(), c.value = new Set(c.value), l("filter", []), l("close");
928
+ }
929
+ function B(s) {
930
+ m.value && !m.value.contains(s.target) && l("close");
931
+ }
932
+ function f(s) {
933
+ s.key === "Escape" ? l("close") : s.key === "Enter" && s.ctrlKey && H();
934
+ }
935
+ return xt(() => {
936
+ je(() => {
937
+ var s;
938
+ (s = y.value) == null || s.focus();
939
+ }), document.addEventListener("mousedown", B), document.addEventListener("keydown", f);
940
+ }), Tt(() => {
941
+ document.removeEventListener("mousedown", B), document.removeEventListener("keydown", f);
942
+ }), Ue(() => n.selectedValues, (s) => {
943
+ c.value = new Set(s);
944
+ }, { immediate: !0 }), (s, d) => (r(), u("div", {
945
+ ref_key: "dropdownRef",
946
+ ref: m,
947
+ class: "vpg-filter-dropdown"
948
+ }, [
949
+ e("div", Yo, [
950
+ e("span", Zo, R(t.columnName), 1),
951
+ e("span", Jo, R(t.stats.uniqueValues.length.toLocaleString()) + " unique ", 1)
952
+ ]),
953
+ e("div", Qo, [
954
+ e("button", {
955
+ class: q(["vpg-sort-btn", { active: t.sortDirection === "asc" }]),
956
+ title: "Sort A to Z",
957
+ onClick: O
958
+ }, [...d[2] || (d[2] = [
959
+ e("svg", {
960
+ class: "vpg-icon-sm",
961
+ fill: "none",
962
+ stroke: "currentColor",
963
+ viewBox: "0 0 24 24"
964
+ }, [
965
+ e("path", {
966
+ "stroke-linecap": "round",
967
+ "stroke-linejoin": "round",
968
+ "stroke-width": "2",
969
+ d: "M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"
970
+ })
971
+ ], -1),
972
+ e("span", null, "A→Z", -1)
973
+ ])], 2),
974
+ e("button", {
975
+ class: q(["vpg-sort-btn", { active: t.sortDirection === "desc" }]),
976
+ title: "Sort Z to A",
977
+ onClick: _
978
+ }, [...d[3] || (d[3] = [
979
+ e("svg", {
980
+ class: "vpg-icon-sm",
981
+ fill: "none",
982
+ stroke: "currentColor",
983
+ viewBox: "0 0 24 24"
984
+ }, [
985
+ e("path", {
986
+ "stroke-linecap": "round",
987
+ "stroke-linejoin": "round",
988
+ "stroke-width": "2",
989
+ d: "M3 4h13M3 8h9m-9 4h9m5-4v12m0 0l-4-4m4 4l4-4"
990
+ })
991
+ ], -1),
992
+ e("span", null, "Z→A", -1)
993
+ ])], 2)
994
+ ]),
995
+ d[7] || (d[7] = e("div", { class: "vpg-divider" }, null, -1)),
996
+ e("div", Io, [
997
+ d[4] || (d[4] = e("svg", {
998
+ class: "vpg-search-icon",
999
+ fill: "none",
1000
+ stroke: "currentColor",
1001
+ viewBox: "0 0 24 24"
1002
+ }, [
1003
+ e("path", {
1004
+ "stroke-linecap": "round",
1005
+ "stroke-linejoin": "round",
1006
+ "stroke-width": "2",
1007
+ d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
1008
+ })
1009
+ ], -1)),
1010
+ it(e("input", {
1011
+ ref_key: "searchInputRef",
1012
+ ref: y,
1013
+ "onUpdate:modelValue": d[0] || (d[0] = (F) => v.value = F),
1014
+ type: "text",
1015
+ placeholder: "Search values...",
1016
+ class: "vpg-search-input"
1017
+ }, null, 512), [
1018
+ [rt, v.value]
1019
+ ]),
1020
+ v.value ? (r(), u("button", {
1021
+ key: 0,
1022
+ class: "vpg-clear-search",
1023
+ onClick: d[1] || (d[1] = (F) => v.value = "")
1024
+ }, " × ")) : z("", !0)
1025
+ ]),
1026
+ e("div", { class: "vpg-bulk-actions" }, [
1027
+ e("button", {
1028
+ class: "vpg-bulk-btn",
1029
+ onClick: U
1030
+ }, [...d[5] || (d[5] = [
1031
+ e("svg", {
1032
+ class: "vpg-icon-sm",
1033
+ fill: "none",
1034
+ stroke: "currentColor",
1035
+ viewBox: "0 0 24 24"
1036
+ }, [
1037
+ e("path", {
1038
+ "stroke-linecap": "round",
1039
+ "stroke-linejoin": "round",
1040
+ "stroke-width": "2",
1041
+ d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
1042
+ })
1043
+ ], -1),
1044
+ I(" Select All ", -1)
1045
+ ])]),
1046
+ e("button", {
1047
+ class: "vpg-bulk-btn",
1048
+ onClick: D
1049
+ }, [...d[6] || (d[6] = [
1050
+ e("svg", {
1051
+ class: "vpg-icon-sm",
1052
+ fill: "none",
1053
+ stroke: "currentColor",
1054
+ viewBox: "0 0 24 24"
1055
+ }, [
1056
+ e("path", {
1057
+ "stroke-linecap": "round",
1058
+ "stroke-linejoin": "round",
1059
+ "stroke-width": "2",
1060
+ d: "M6 18L18 6M6 6l12 12"
1061
+ })
1062
+ ], -1),
1063
+ I(" Clear All ", -1)
1064
+ ])])
1065
+ ]),
1066
+ e("div", en, [
1067
+ (r(!0), u(W, null, J(V.value, (F) => (r(), u("label", {
1068
+ key: F,
1069
+ class: q(["vpg-value-item", { selected: c.value.has(F) }])
1070
+ }, [
1071
+ e("input", {
1072
+ type: "checkbox",
1073
+ checked: c.value.has(F),
1074
+ class: "vpg-value-checkbox",
1075
+ onChange: (g) => $(F)
1076
+ }, null, 40, tn),
1077
+ e("span", {
1078
+ class: q(["vpg-value-text", { "vpg-blank": F === "(blank)" }])
1079
+ }, R(F), 3)
1080
+ ], 2))), 128)),
1081
+ V.value.length === 0 ? (r(), u("div", on, " No matching values ")) : z("", !0)
1082
+ ]),
1083
+ e("div", { class: "vpg-filter-footer" }, [
1084
+ e("button", {
1085
+ class: "vpg-btn-clear",
1086
+ onClick: X
1087
+ }, " Clear Filter "),
1088
+ e("button", {
1089
+ class: "vpg-btn-apply",
1090
+ onClick: H
1091
+ }, " Apply ")
1092
+ ])
1093
+ ], 512));
1094
+ }
1095
+ }), et = (t, i) => {
1096
+ const n = t.__vccOpts || t;
1097
+ for (const [l, v] of i)
1098
+ n[l] = v;
1099
+ return n;
1100
+ }, ln = /* @__PURE__ */ et(nn, [["__scopeId", "data-v-0e340167"]]), sn = { class: "vpg-pivot-config" }, an = { class: "vpg-config-header" }, rn = { class: "vpg-header-actions" }, un = {
1101
+ key: 0,
1102
+ class: "vpg-assigned-section"
1103
+ }, vn = { class: "vpg-assigned-list" }, cn = ["title", "onDragstart"], dn = { class: "vpg-item-main" }, gn = { class: "vpg-item-name" }, pn = { class: "vpg-item-actions" }, fn = ["title", "onClick"], mn = ["value", "onChange"], hn = ["value"], wn = ["onClick"], kn = { class: "vpg-unassigned-section" }, Cn = { class: "vpg-section-header" }, yn = { class: "vpg-section-label" }, bn = { class: "vpg-count" }, Fn = { class: "vpg-field-search" }, Sn = { class: "vpg-field-list" }, Rn = ["title", "onDragstart"], $n = ["title"], Mn = { class: "vpg-field-name" }, xn = { class: "vpg-unique-count" }, Tn = {
1104
+ key: 0,
1105
+ class: "vpg-empty-hint"
1106
+ }, Vn = {
1107
+ key: 1,
1108
+ class: "vpg-empty-hint"
1109
+ }, Dn = { class: "vpg-options-section" }, zn = { class: "vpg-option-toggle" }, An = ["checked"], Ln = {
1110
+ key: 1,
1111
+ class: "vpg-watermark"
1112
+ }, Pn = /* @__PURE__ */ Qe({
1113
+ __name: "PivotConfig",
1114
+ props: {
1115
+ availableFields: {},
1116
+ rowFields: {},
1117
+ columnFields: {},
1118
+ valueFields: {},
1119
+ showRowTotals: { type: Boolean },
1120
+ showColumnTotals: { type: Boolean }
1121
+ },
1122
+ emits: ["update:showRowTotals", "update:showColumnTotals", "clearConfig", "autoSuggest", "dragStart", "dragEnd", "updateAggregation", "addRowField", "removeRowField", "addColumnField", "removeColumnField", "addValueField", "removeValueField"],
1123
+ setup(t, { emit: i }) {
1124
+ const n = t, l = i, { isPro: v, showWatermark: m } = Ie(), y = [
1125
+ { value: "sum", label: "Sum", symbol: "Σ" },
1126
+ { value: "count", label: "Count", symbol: "#" },
1127
+ { value: "avg", label: "Avg", symbol: "x̄" },
1128
+ { value: "min", label: "Min", symbol: "↓" },
1129
+ { value: "max", label: "Max", symbol: "↑" },
1130
+ { value: "countDistinct", label: "Unique", symbol: "◇" }
1131
+ ];
1132
+ function c(f) {
1133
+ var s;
1134
+ return ((s = y.find((d) => d.value === f)) == null ? void 0 : s.symbol) || "Σ";
1135
+ }
1136
+ const b = T(() => {
1137
+ const f = new Set(n.rowFields), s = new Set(n.columnFields), d = new Map(n.valueFields.map((F) => [F.field, F]));
1138
+ return n.availableFields.filter((F) => f.has(F.field) || s.has(F.field) || d.has(F.field)).map((F) => ({
1139
+ ...F,
1140
+ assignedTo: f.has(F.field) ? "row" : s.has(F.field) ? "column" : "value",
1141
+ valueConfig: d.get(F.field)
1142
+ }));
1143
+ }), C = T(() => {
1144
+ const f = new Set(n.rowFields), s = new Set(n.columnFields), d = new Set(n.valueFields.map((F) => F.field));
1145
+ return n.availableFields.filter(
1146
+ (F) => !f.has(F.field) && !s.has(F.field) && !d.has(F.field)
1147
+ );
1148
+ }), V = T(() => b.value.length), $ = M(""), U = T(() => {
1149
+ if (!$.value.trim())
1150
+ return C.value;
1151
+ const f = $.value.toLowerCase().trim();
1152
+ return C.value.filter((s) => s.field.toLowerCase().includes(f));
1153
+ });
1154
+ function D(f) {
1155
+ switch (f) {
1156
+ case "number":
1157
+ return "#";
1158
+ case "date":
1159
+ return "📅";
1160
+ case "boolean":
1161
+ return "✓";
1162
+ default:
1163
+ return "Aa";
1164
+ }
1165
+ }
1166
+ function H(f, s) {
1167
+ var d;
1168
+ (d = s.dataTransfer) == null || d.setData("text/plain", f), s.dataTransfer.effectAllowed = "move", l("dragStart", f, s);
1169
+ }
1170
+ function O() {
1171
+ l("dragEnd");
1172
+ }
1173
+ function _(f, s, d) {
1174
+ l("updateAggregation", f, s, d);
1175
+ }
1176
+ function X(f, s) {
1177
+ s === "row" ? (l("removeRowField", f), l("addColumnField", f)) : (l("removeColumnField", f), l("addRowField", f));
1178
+ }
1179
+ function B(f, s, d) {
1180
+ s === "row" ? l("removeRowField", f) : s === "column" ? l("removeColumnField", f) : d && l("removeValueField", f, d.aggregation);
1181
+ }
1182
+ return (f, s) => (r(), u("div", sn, [
1183
+ e("div", an, [
1184
+ s[7] || (s[7] = e("h3", { class: "vpg-config-title" }, [
1185
+ e("svg", {
1186
+ class: "vpg-icon",
1187
+ fill: "none",
1188
+ stroke: "currentColor",
1189
+ viewBox: "0 0 24 24"
1190
+ }, [
1191
+ e("path", {
1192
+ "stroke-linecap": "round",
1193
+ "stroke-linejoin": "round",
1194
+ "stroke-width": "2",
1195
+ d: "M4 6h16M4 10h16M4 14h16M4 18h16"
1196
+ })
1197
+ ]),
1198
+ I(" Fields ")
1199
+ ], -1)),
1200
+ e("div", rn, [
1201
+ V.value > 0 ? (r(), u("button", {
1202
+ key: 0,
1203
+ class: "vpg-action-btn vpg-clear-btn",
1204
+ title: "Clear all",
1205
+ onClick: s[0] || (s[0] = (d) => l("clearConfig"))
1206
+ }, [...s[6] || (s[6] = [
1207
+ e("svg", {
1208
+ class: "vpg-icon-sm",
1209
+ fill: "none",
1210
+ stroke: "currentColor",
1211
+ viewBox: "0 0 24 24"
1212
+ }, [
1213
+ e("path", {
1214
+ "stroke-linecap": "round",
1215
+ "stroke-linejoin": "round",
1216
+ "stroke-width": "2",
1217
+ d: "M6 18L18 6M6 6l12 12"
1218
+ })
1219
+ ], -1)
1220
+ ])])) : z("", !0)
1221
+ ])
1222
+ ]),
1223
+ V.value > 0 ? (r(), u("div", un, [
1224
+ s[9] || (s[9] = e("div", { class: "vpg-section-label" }, "Active", -1)),
1225
+ e("div", vn, [
1226
+ (r(!0), u(W, null, J(b.value, (d) => {
1227
+ var F;
1228
+ return r(), u("div", {
1229
+ key: d.field,
1230
+ class: q(["vpg-assigned-item", [`vpg-type-${d.assignedTo}`]]),
1231
+ title: d.field,
1232
+ draggable: "true",
1233
+ onDragstart: (g) => H(d.field, g),
1234
+ onDragend: O
1235
+ }, [
1236
+ e("div", dn, [
1237
+ e("span", {
1238
+ class: q(["vpg-item-badge", d.assignedTo])
1239
+ }, R(d.assignedTo === "row" ? "R" : d.assignedTo === "column" ? "C" : c(((F = d.valueConfig) == null ? void 0 : F.aggregation) || "sum")), 3),
1240
+ e("span", gn, R(d.field), 1)
1241
+ ]),
1242
+ e("div", pn, [
1243
+ d.assignedTo === "row" || d.assignedTo === "column" ? (r(), u("button", {
1244
+ key: 0,
1245
+ class: "vpg-toggle-btn",
1246
+ title: d.assignedTo === "row" ? "Move to Columns" : "Move to Rows",
1247
+ onClick: He((g) => X(d.field, d.assignedTo), ["stop"])
1248
+ }, [...s[8] || (s[8] = [
1249
+ e("svg", {
1250
+ class: "vpg-icon-xs",
1251
+ fill: "none",
1252
+ stroke: "currentColor",
1253
+ viewBox: "0 0 24 24"
1254
+ }, [
1255
+ e("path", {
1256
+ "stroke-linecap": "round",
1257
+ "stroke-linejoin": "round",
1258
+ "stroke-width": "2",
1259
+ d: "M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"
1260
+ })
1261
+ ], -1)
1262
+ ])], 8, fn)) : z("", !0),
1263
+ d.assignedTo === "value" && d.valueConfig ? (r(), u("select", {
1264
+ key: 1,
1265
+ class: "vpg-agg-select",
1266
+ value: d.valueConfig.aggregation,
1267
+ onChange: (g) => _(d.field, d.valueConfig.aggregation, g.target.value),
1268
+ onClick: s[1] || (s[1] = He(() => {
1269
+ }, ["stop"]))
1270
+ }, [
1271
+ (r(), u(W, null, J(y, (g) => e("option", {
1272
+ key: g.value,
1273
+ value: g.value
1274
+ }, R(g.symbol) + " " + R(g.label), 9, hn)), 64))
1275
+ ], 40, mn)) : z("", !0),
1276
+ e("button", {
1277
+ class: "vpg-remove-btn",
1278
+ title: "Remove",
1279
+ onClick: He((g) => B(d.field, d.assignedTo, d.valueConfig), ["stop"])
1280
+ }, " × ", 8, wn)
1281
+ ])
1282
+ ], 42, cn);
1283
+ }), 128))
1284
+ ])
1285
+ ])) : z("", !0),
1286
+ e("div", kn, [
1287
+ e("div", Cn, [
1288
+ e("div", yn, [
1289
+ s[10] || (s[10] = I(" Available ", -1)),
1290
+ e("span", bn, R(C.value.length), 1)
1291
+ ])
1292
+ ]),
1293
+ e("div", Fn, [
1294
+ s[12] || (s[12] = e("svg", {
1295
+ class: "vpg-search-icon",
1296
+ fill: "none",
1297
+ stroke: "currentColor",
1298
+ viewBox: "0 0 24 24"
1299
+ }, [
1300
+ e("path", {
1301
+ "stroke-linecap": "round",
1302
+ "stroke-linejoin": "round",
1303
+ "stroke-width": "2",
1304
+ d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
1305
+ })
1306
+ ], -1)),
1307
+ it(e("input", {
1308
+ "onUpdate:modelValue": s[2] || (s[2] = (d) => $.value = d),
1309
+ type: "text",
1310
+ placeholder: "Search fields...",
1311
+ class: "vpg-search-input"
1312
+ }, null, 512), [
1313
+ [rt, $.value]
1314
+ ]),
1315
+ $.value ? (r(), u("button", {
1316
+ key: 0,
1317
+ class: "vpg-clear-search",
1318
+ onClick: s[3] || (s[3] = (d) => $.value = "")
1319
+ }, [...s[11] || (s[11] = [
1320
+ e("svg", {
1321
+ class: "vpg-icon-xs",
1322
+ fill: "none",
1323
+ stroke: "currentColor",
1324
+ viewBox: "0 0 24 24"
1325
+ }, [
1326
+ e("path", {
1327
+ "stroke-linecap": "round",
1328
+ "stroke-linejoin": "round",
1329
+ "stroke-width": "2",
1330
+ d: "M6 18L18 6M6 6l12 12"
1331
+ })
1332
+ ], -1)
1333
+ ])])) : z("", !0)
1334
+ ]),
1335
+ e("div", Sn, [
1336
+ (r(!0), u(W, null, J(U.value, (d) => (r(), u("div", {
1337
+ key: d.field,
1338
+ class: q(["vpg-field-item", { "vpg-is-numeric": d.isNumeric }]),
1339
+ title: d.field,
1340
+ draggable: "true",
1341
+ onDragstart: (F) => H(d.field, F),
1342
+ onDragend: O
1343
+ }, [
1344
+ e("span", {
1345
+ class: "vpg-field-type-icon",
1346
+ title: d.type
1347
+ }, R(D(d.type)), 9, $n),
1348
+ e("span", Mn, R(d.field), 1),
1349
+ e("span", xn, R(d.uniqueCount), 1)
1350
+ ], 42, Rn))), 128)),
1351
+ U.value.length === 0 && $.value ? (r(), u("div", Tn, ' No fields match "' + R($.value) + '" ', 1)) : C.value.length === 0 ? (r(), u("div", Vn, " All fields assigned ")) : z("", !0)
1352
+ ])
1353
+ ]),
1354
+ e("div", Dn, [
1355
+ e("label", zn, [
1356
+ e("input", {
1357
+ type: "checkbox",
1358
+ checked: t.showRowTotals,
1359
+ onChange: s[4] || (s[4] = (d) => l("update:showRowTotals", d.target.checked))
1360
+ }, null, 40, An),
1361
+ s[13] || (s[13] = e("span", null, "Totals", -1))
1362
+ ]),
1363
+ e("button", {
1364
+ class: "vpg-auto-btn",
1365
+ onClick: s[5] || (s[5] = (d) => l("autoSuggest"))
1366
+ }, [...s[14] || (s[14] = [
1367
+ e("svg", {
1368
+ class: "vpg-icon-sm",
1369
+ fill: "none",
1370
+ stroke: "currentColor",
1371
+ viewBox: "0 0 24 24"
1372
+ }, [
1373
+ e("path", {
1374
+ "stroke-linecap": "round",
1375
+ "stroke-linejoin": "round",
1376
+ "stroke-width": "2",
1377
+ d: "M13 10V3L4 14h7v7l9-11h-7z"
1378
+ })
1379
+ ], -1),
1380
+ I(" Auto ", -1)
1381
+ ])])
1382
+ ]),
1383
+ S(m) ? (r(), u("div", Ln, [...s[15] || (s[15] = [
1384
+ e("a", {
1385
+ href: "https://tiny-pivot.com",
1386
+ target: "_blank",
1387
+ rel: "noopener"
1388
+ }, " TinyPivot ", -1)
1389
+ ])])) : z("", !0)
1390
+ ]));
1391
+ }
1392
+ }), En = /* @__PURE__ */ et(Pn, [["__scopeId", "data-v-6663dd14"]]), Nn = { class: "vpg-skeleton-header" }, Bn = { class: "vpg-header-right" }, jn = { class: "vpg-filter-text" }, Hn = {
1393
+ key: 0,
1394
+ class: "vpg-filter-count"
1395
+ }, Un = {
1396
+ key: 0,
1397
+ class: "vpg-filter-tooltip"
1398
+ }, Kn = { class: "vpg-tooltip-column" }, Wn = { class: "vpg-tooltip-values" }, _n = {
1399
+ key: 0,
1400
+ class: "vpg-tooltip-more"
1401
+ }, qn = {
1402
+ key: 0,
1403
+ class: "vpg-tooltip-summary"
1404
+ }, On = {
1405
+ key: 1,
1406
+ class: "vpg-config-summary"
1407
+ }, Gn = { class: "vpg-summary-badge vpg-rows" }, Xn = { class: "vpg-summary-badge vpg-cols" }, Yn = { class: "vpg-summary-badge vpg-vals" }, Zn = {
1408
+ key: 2,
1409
+ class: "vpg-font-size-toggle"
1410
+ }, Jn = ["onClick"], Qn = {
1411
+ key: 0,
1412
+ class: "vpg-pro-required"
1413
+ }, In = { class: "vpg-config-bar" }, el = { class: "vpg-zone-chips" }, tl = ["onDragstart", "onDragover", "onDrop"], ol = { class: "vpg-mini-name" }, nl = ["onClick"], ll = {
1414
+ key: 0,
1415
+ class: "vpg-zone-hint"
1416
+ }, sl = { class: "vpg-zone-chips" }, al = ["onDragstart", "onDragover", "onDrop"], il = { class: "vpg-mini-name" }, rl = ["onClick"], ul = {
1417
+ key: 0,
1418
+ class: "vpg-zone-hint"
1419
+ }, vl = { class: "vpg-zone-chips" }, cl = { class: "vpg-agg-symbol" }, dl = { class: "vpg-mini-name" }, gl = ["onClick"], pl = {
1420
+ key: 0,
1421
+ class: "vpg-zone-hint"
1422
+ }, fl = {
1423
+ key: 0,
1424
+ class: "vpg-placeholder"
1425
+ }, ml = { class: "vpg-placeholder-content" }, hl = { class: "vpg-placeholder-text" }, wl = {
1426
+ key: 1,
1427
+ class: "vpg-table-container"
1428
+ }, kl = { class: "vpg-pivot-table" }, Cl = ["rowspan"], yl = { class: "vpg-header-content" }, bl = ["colspan", "onClick"], Fl = { class: "vpg-header-content" }, Sl = ["rowspan"], Rl = ["onClick"], $l = {
1429
+ key: 0,
1430
+ class: "vpg-data-cell vpg-total-cell"
1431
+ }, Ml = {
1432
+ key: 0,
1433
+ class: "vpg-totals-row"
1434
+ }, xl = {
1435
+ key: 0,
1436
+ class: "vpg-data-cell vpg-grand-total-cell"
1437
+ }, Tl = {
1438
+ key: 2,
1439
+ class: "vpg-skeleton-footer"
1440
+ }, Vl = {
1441
+ key: 1,
1442
+ href: "https://tiny-pivot.com",
1443
+ target: "_blank",
1444
+ rel: "noopener"
1445
+ }, Dl = /* @__PURE__ */ Qe({
1446
+ __name: "PivotSkeleton",
1447
+ props: {
1448
+ rowFields: {},
1449
+ columnFields: {},
1450
+ valueFields: {},
1451
+ isConfigured: { type: Boolean },
1452
+ draggingField: {},
1453
+ pivotResult: {},
1454
+ fontSize: {},
1455
+ activeFilters: {},
1456
+ totalRowCount: {},
1457
+ filteredRowCount: {}
1458
+ },
1459
+ emits: ["addRowField", "removeRowField", "addColumnField", "removeColumnField", "addValueField", "removeValueField", "updateAggregation", "reorderRowFields", "reorderColumnFields"],
1460
+ setup(t, { emit: i }) {
1461
+ const n = t, l = i, { showWatermark: v, canUsePivot: m, isDemo: y } = Ie(), c = M(null), b = M(null), C = M(null), V = {
1462
+ sum: "Sum",
1463
+ count: "Count",
1464
+ avg: "Average",
1465
+ min: "Min",
1466
+ max: "Max",
1467
+ countDistinct: "Count Distinct"
1468
+ };
1469
+ function $(E) {
1470
+ return V[E];
1471
+ }
1472
+ function U(E) {
1473
+ return {
1474
+ sum: "Σ",
1475
+ count: "#",
1476
+ avg: "x̄",
1477
+ min: "↓",
1478
+ max: "↑",
1479
+ countDistinct: "◇"
1480
+ }[E] || "Σ";
1481
+ }
1482
+ const D = M(n.fontSize || "xs"), H = [
1483
+ { value: "xs", label: "S" },
1484
+ { value: "sm", label: "M" },
1485
+ { value: "base", label: "L" }
1486
+ ], O = T(() => n.activeFilters && n.activeFilters.length > 0), _ = T(() => !n.activeFilters || n.activeFilters.length === 0 ? "" : n.activeFilters.map((p) => p.column).join(", ")), X = T(() => !n.activeFilters || n.activeFilters.length === 0 ? [] : n.activeFilters.map((E) => {
1487
+ const P = E.values.slice(0, 5), k = E.values.length - 5;
1488
+ return {
1489
+ column: E.column,
1490
+ values: P,
1491
+ remaining: k > 0 ? k : 0
1492
+ };
1493
+ })), B = M(!1), f = M("asc"), s = M("row");
1494
+ function d(E = "row") {
1495
+ s.value === E ? f.value = f.value === "asc" ? "desc" : "asc" : (s.value = E, f.value = "asc");
1496
+ }
1497
+ const F = T(() => {
1498
+ if (!n.pivotResult)
1499
+ return [];
1500
+ const E = n.pivotResult.rowHeaders.map((k, A) => A), p = n.pivotResult.rowHeaders, P = n.pivotResult.data;
1501
+ return E.sort((k, A) => {
1502
+ var G, Me, Le, Pe, Ee, Ne;
1503
+ let N;
1504
+ if (s.value === "row") {
1505
+ const be = ((G = p[k]) == null ? void 0 : G.join(" / ")) || "", ke = ((Me = p[A]) == null ? void 0 : Me.join(" / ")) || "";
1506
+ N = be.localeCompare(ke, void 0, { numeric: !0, sensitivity: "base" });
1507
+ } else {
1508
+ const be = s.value, ke = ((Pe = (Le = P[k]) == null ? void 0 : Le[be]) == null ? void 0 : Pe.value) ?? null, Be = ((Ne = (Ee = P[A]) == null ? void 0 : Ee[be]) == null ? void 0 : Ne.value) ?? null;
1509
+ ke === null && Be === null ? N = 0 : ke === null ? N = 1 : Be === null ? N = -1 : N = ke - Be;
1510
+ }
1511
+ return f.value === "asc" ? N : -N;
1512
+ }), E;
1513
+ }), g = T(() => {
1514
+ if (!n.pivotResult || n.pivotResult.headers.length === 0)
1515
+ return [n.valueFields.map((p) => ({
1516
+ label: `${p.field} (${$(p.aggregation)})`,
1517
+ colspan: 1
1518
+ }))];
1519
+ const E = [];
1520
+ for (let p = 0; p < n.pivotResult.headers.length; p++) {
1521
+ const P = n.pivotResult.headers[p], k = [];
1522
+ let A = 0;
1523
+ for (; A < P.length; ) {
1524
+ const N = P[A];
1525
+ let G = 1;
1526
+ for (; A + G < P.length && P[A + G] === N; )
1527
+ G++;
1528
+ k.push({ label: N, colspan: G }), A += G;
1529
+ }
1530
+ E.push(k);
1531
+ }
1532
+ return E;
1533
+ }), w = M(null);
1534
+ function x(E, p) {
1535
+ w.value = { row: E, col: p };
1536
+ }
1537
+ function L(E, p) {
1538
+ var P, k;
1539
+ return ((P = w.value) == null ? void 0 : P.row) === E && ((k = w.value) == null ? void 0 : k.col) === p;
1540
+ }
1541
+ function ee(E, p) {
1542
+ p.preventDefault(), p.dataTransfer.dropEffect = "move", c.value = E;
1543
+ }
1544
+ function ie() {
1545
+ c.value = null;
1546
+ }
1547
+ function me(E, p) {
1548
+ var A;
1549
+ p.preventDefault();
1550
+ const P = (A = p.dataTransfer) == null ? void 0 : A.getData("text/plain");
1551
+ if (!P || P.startsWith("reorder:")) {
1552
+ c.value = null;
1553
+ return;
1554
+ }
1555
+ n.rowFields.includes(P) && l("removeRowField", P), n.columnFields.includes(P) && l("removeColumnField", P);
1556
+ const k = n.valueFields.find((N) => N.field === P);
1557
+ switch (k && l("removeValueField", P, k.aggregation), E) {
1558
+ case "row":
1559
+ l("addRowField", P);
1560
+ break;
1561
+ case "column":
1562
+ l("addColumnField", P);
1563
+ break;
1564
+ case "value":
1565
+ l("addValueField", P, "sum");
1566
+ break;
1567
+ }
1568
+ c.value = null;
1569
+ }
1570
+ function Ke(E, p, P) {
1571
+ b.value = { zone: E, index: p }, P.dataTransfer.effectAllowed = "move", P.dataTransfer.setData("text/plain", `reorder:${E}:${p}`), requestAnimationFrame(() => {
1572
+ c.value = null;
1573
+ });
1574
+ }
1575
+ function ye() {
1576
+ b.value = null, C.value = null;
1577
+ }
1578
+ function he(E, p, P) {
1579
+ P.preventDefault(), b.value && b.value.zone === E && (P.dataTransfer.dropEffect = "move", C.value = { zone: E, index: p });
1580
+ }
1581
+ function re() {
1582
+ C.value = null;
1583
+ }
1584
+ function We(E, p, P) {
1585
+ if (P.preventDefault(), P.stopPropagation(), !b.value || b.value.zone !== E)
1586
+ return;
1587
+ const k = b.value.index;
1588
+ if (k === p) {
1589
+ b.value = null, C.value = null;
1590
+ return;
1591
+ }
1592
+ const A = E === "row" ? [...n.rowFields] : [...n.columnFields], [N] = A.splice(k, 1);
1593
+ A.splice(p, 0, N), l(E === "row" ? "reorderRowFields" : "reorderColumnFields", A), b.value = null, C.value = null;
1594
+ }
1595
+ function ze(E, p) {
1596
+ var P, k;
1597
+ return ((P = b.value) == null ? void 0 : P.zone) === E && ((k = b.value) == null ? void 0 : k.index) === p;
1598
+ }
1599
+ function _e(E, p) {
1600
+ var P, k;
1601
+ return ((P = C.value) == null ? void 0 : P.zone) === E && ((k = C.value) == null ? void 0 : k.index) === p;
1602
+ }
1603
+ const Ae = M(180), we = M(80);
1604
+ return (E, p) => {
1605
+ var P;
1606
+ return r(), u("div", {
1607
+ class: q(["vpg-pivot-skeleton", [
1608
+ `vpg-font-${D.value}`,
1609
+ { "vpg-is-dragging": t.draggingField }
1610
+ ]])
1611
+ }, [
1612
+ e("div", Nn, [
1613
+ p[12] || (p[12] = e("div", { class: "vpg-skeleton-title" }, [
1614
+ e("svg", {
1615
+ class: "vpg-icon",
1616
+ fill: "none",
1617
+ stroke: "currentColor",
1618
+ viewBox: "0 0 24 24"
1619
+ }, [
1620
+ e("path", {
1621
+ "stroke-linecap": "round",
1622
+ "stroke-linejoin": "round",
1623
+ "stroke-width": "2",
1624
+ d: "M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"
1625
+ })
1626
+ ]),
1627
+ e("span", null, "Pivot Table")
1628
+ ], -1)),
1629
+ e("div", Bn, [
1630
+ O.value ? (r(), u("div", {
1631
+ key: 0,
1632
+ class: "vpg-filter-indicator",
1633
+ onMouseenter: p[0] || (p[0] = (k) => B.value = !0),
1634
+ onMouseleave: p[1] || (p[1] = (k) => B.value = !1)
1635
+ }, [
1636
+ p[11] || (p[11] = e("svg", {
1637
+ class: "vpg-filter-icon",
1638
+ fill: "none",
1639
+ stroke: "currentColor",
1640
+ viewBox: "0 0 24 24"
1641
+ }, [
1642
+ e("path", {
1643
+ "stroke-linecap": "round",
1644
+ "stroke-linejoin": "round",
1645
+ "stroke-width": "2",
1646
+ d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"
1647
+ })
1648
+ ], -1)),
1649
+ e("span", jn, [
1650
+ p[9] || (p[9] = I(" Filtered: ", -1)),
1651
+ e("strong", null, R(_.value), 1),
1652
+ t.filteredRowCount !== void 0 && t.totalRowCount !== void 0 ? (r(), u("span", Hn, " (" + R(t.filteredRowCount.toLocaleString()) + " of " + R(t.totalRowCount.toLocaleString()) + " rows) ", 1)) : z("", !0)
1653
+ ]),
1654
+ B.value ? (r(), u("div", Un, [
1655
+ p[10] || (p[10] = e("div", { class: "vpg-tooltip-header" }, "Active Filters", -1)),
1656
+ (r(!0), u(W, null, J(X.value, (k) => (r(), u("div", {
1657
+ key: k.column,
1658
+ class: "vpg-tooltip-filter"
1659
+ }, [
1660
+ e("div", Kn, R(k.column), 1),
1661
+ e("div", Wn, [
1662
+ (r(!0), u(W, null, J(k.values, (A, N) => (r(), u("span", {
1663
+ key: N,
1664
+ class: "vpg-tooltip-value"
1665
+ }, R(A), 1))), 128)),
1666
+ k.remaining > 0 ? (r(), u("span", _n, " +" + R(k.remaining) + " more ", 1)) : z("", !0)
1667
+ ])
1668
+ ]))), 128)),
1669
+ t.filteredRowCount !== void 0 && t.totalRowCount !== void 0 ? (r(), u("div", qn, " Showing " + R(t.filteredRowCount.toLocaleString()) + " of " + R(t.totalRowCount.toLocaleString()) + " rows ", 1)) : z("", !0)
1670
+ ])) : z("", !0)
1671
+ ], 32)) : z("", !0),
1672
+ t.isConfigured ? (r(), u("div", On, [
1673
+ e("span", Gn, R(t.rowFields.length) + " row" + R(t.rowFields.length !== 1 ? "s" : ""), 1),
1674
+ e("span", Xn, R(t.columnFields.length) + " col" + R(t.columnFields.length !== 1 ? "s" : ""), 1),
1675
+ e("span", Yn, R(t.valueFields.length) + " val" + R(t.valueFields.length !== 1 ? "s" : ""), 1)
1676
+ ])) : z("", !0),
1677
+ t.isConfigured && t.pivotResult ? (r(), u("div", Zn, [
1678
+ (r(), u(W, null, J(H, (k) => e("button", {
1679
+ key: k.value,
1680
+ class: q(["vpg-font-size-btn", { active: D.value === k.value }]),
1681
+ onClick: (A) => D.value = k.value
1682
+ }, R(k.label), 11, Jn)), 64))
1683
+ ])) : z("", !0)
1684
+ ])
1685
+ ]),
1686
+ S(m) ? (r(), u(W, { key: 1 }, [
1687
+ e("div", In, [
1688
+ e("div", {
1689
+ class: q(["vpg-drop-zone vpg-row-zone", { "vpg-drag-over": c.value === "row" }]),
1690
+ onDragover: p[2] || (p[2] = (k) => ee("row", k)),
1691
+ onDragleave: ie,
1692
+ onDrop: p[3] || (p[3] = (k) => me("row", k))
1693
+ }, [
1694
+ p[15] || (p[15] = e("div", { class: "vpg-zone-header" }, [
1695
+ e("span", { class: "vpg-zone-icon vpg-row-icon" }, "↓"),
1696
+ e("span", { class: "vpg-zone-label" }, "Rows")
1697
+ ], -1)),
1698
+ e("div", el, [
1699
+ (r(!0), u(W, null, J(t.rowFields, (k, A) => (r(), u("div", {
1700
+ key: k,
1701
+ class: q(["vpg-mini-chip vpg-row-chip", {
1702
+ "vpg-chip-dragging": ze("row", A),
1703
+ "vpg-chip-drop-target": _e("row", A)
1704
+ }]),
1705
+ draggable: "true",
1706
+ onDragstart: (N) => Ke("row", A, N),
1707
+ onDragend: ye,
1708
+ onDragover: (N) => he("row", A, N),
1709
+ onDragleave: re,
1710
+ onDrop: (N) => We("row", A, N)
1711
+ }, [
1712
+ p[14] || (p[14] = e("span", { class: "vpg-drag-handle" }, "⋮⋮", -1)),
1713
+ e("span", ol, R(k), 1),
1714
+ e("button", {
1715
+ class: "vpg-mini-remove",
1716
+ onClick: He((N) => l("removeRowField", k), ["stop"])
1717
+ }, "×", 8, nl)
1718
+ ], 42, tl))), 128)),
1719
+ t.rowFields.length === 0 ? (r(), u("span", ll, "Drop here")) : z("", !0)
1720
+ ])
1721
+ ], 34),
1722
+ e("div", {
1723
+ class: q(["vpg-drop-zone vpg-column-zone", { "vpg-drag-over": c.value === "column" }]),
1724
+ onDragover: p[4] || (p[4] = (k) => ee("column", k)),
1725
+ onDragleave: ie,
1726
+ onDrop: p[5] || (p[5] = (k) => me("column", k))
1727
+ }, [
1728
+ p[17] || (p[17] = e("div", { class: "vpg-zone-header" }, [
1729
+ e("span", { class: "vpg-zone-icon vpg-column-icon" }, "→"),
1730
+ e("span", { class: "vpg-zone-label" }, "Columns")
1731
+ ], -1)),
1732
+ e("div", sl, [
1733
+ (r(!0), u(W, null, J(t.columnFields, (k, A) => (r(), u("div", {
1734
+ key: k,
1735
+ class: q(["vpg-mini-chip vpg-column-chip", {
1736
+ "vpg-chip-dragging": ze("column", A),
1737
+ "vpg-chip-drop-target": _e("column", A)
1738
+ }]),
1739
+ draggable: "true",
1740
+ onDragstart: (N) => Ke("column", A, N),
1741
+ onDragend: ye,
1742
+ onDragover: (N) => he("column", A, N),
1743
+ onDragleave: re,
1744
+ onDrop: (N) => We("column", A, N)
1745
+ }, [
1746
+ p[16] || (p[16] = e("span", { class: "vpg-drag-handle" }, "⋮⋮", -1)),
1747
+ e("span", il, R(k), 1),
1748
+ e("button", {
1749
+ class: "vpg-mini-remove",
1750
+ onClick: He((N) => l("removeColumnField", k), ["stop"])
1751
+ }, "×", 8, rl)
1752
+ ], 42, al))), 128)),
1753
+ t.columnFields.length === 0 ? (r(), u("span", ul, "Drop here")) : z("", !0)
1754
+ ])
1755
+ ], 34),
1756
+ e("div", {
1757
+ class: q(["vpg-drop-zone vpg-value-zone", { "vpg-drag-over": c.value === "value" }]),
1758
+ onDragover: p[6] || (p[6] = (k) => ee("value", k)),
1759
+ onDragleave: ie,
1760
+ onDrop: p[7] || (p[7] = (k) => me("value", k))
1761
+ }, [
1762
+ p[18] || (p[18] = e("div", { class: "vpg-zone-header" }, [
1763
+ e("span", { class: "vpg-zone-icon vpg-value-icon" }, "Σ"),
1764
+ e("span", { class: "vpg-zone-label" }, "Values")
1765
+ ], -1)),
1766
+ e("div", vl, [
1767
+ (r(!0), u(W, null, J(t.valueFields, (k) => (r(), u("div", {
1768
+ key: `${k.field}-${k.aggregation}`,
1769
+ class: "vpg-mini-chip vpg-value-chip"
1770
+ }, [
1771
+ e("span", cl, R(U(k.aggregation)), 1),
1772
+ e("span", dl, R(k.field), 1),
1773
+ e("button", {
1774
+ class: "vpg-mini-remove",
1775
+ onClick: (A) => l("removeValueField", k.field, k.aggregation)
1776
+ }, "×", 8, gl)
1777
+ ]))), 128)),
1778
+ t.valueFields.length === 0 ? (r(), u("span", pl, "Drop numeric")) : z("", !0)
1779
+ ])
1780
+ ], 34)
1781
+ ]),
1782
+ !t.isConfigured || !t.pivotResult ? (r(), u("div", fl, [
1783
+ e("div", ml, [
1784
+ p[27] || (p[27] = e("svg", {
1785
+ class: "vpg-placeholder-icon",
1786
+ fill: "none",
1787
+ viewBox: "0 0 24 24",
1788
+ stroke: "currentColor"
1789
+ }, [
1790
+ e("path", {
1791
+ "stroke-linecap": "round",
1792
+ "stroke-linejoin": "round",
1793
+ "stroke-width": "1.5",
1794
+ d: "M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"
1795
+ })
1796
+ ], -1)),
1797
+ e("span", hl, [
1798
+ t.valueFields.length === 0 ? (r(), u(W, { key: 0 }, [
1799
+ p[19] || (p[19] = I(" Add a ", -1)),
1800
+ p[20] || (p[20] = e("strong", null, "Values", -1)),
1801
+ p[21] || (p[21] = I(" field to see your pivot table ", -1))
1802
+ ], 64)) : t.rowFields.length === 0 && t.columnFields.length === 0 ? (r(), u(W, { key: 1 }, [
1803
+ p[22] || (p[22] = I(" Add ", -1)),
1804
+ p[23] || (p[23] = e("strong", null, "Row", -1)),
1805
+ p[24] || (p[24] = I(" or ", -1)),
1806
+ p[25] || (p[25] = e("strong", null, "Column", -1)),
1807
+ p[26] || (p[26] = I(" fields to group your data ", -1))
1808
+ ], 64)) : (r(), u(W, { key: 2 }, [
1809
+ I(" Your pivot table will appear here ")
1810
+ ], 64))
1811
+ ])
1812
+ ])
1813
+ ])) : (r(), u("div", wl, [
1814
+ e("table", kl, [
1815
+ e("thead", null, [
1816
+ (r(!0), u(W, null, J(g.value, (k, A) => (r(), u("tr", {
1817
+ key: `header-${A}`,
1818
+ class: "vpg-column-header-row"
1819
+ }, [
1820
+ A === 0 ? (r(), u("th", {
1821
+ key: 0,
1822
+ class: "vpg-row-header-label",
1823
+ rowspan: g.value.length,
1824
+ style: ve({ width: `${Ae.value}px` }),
1825
+ onClick: p[8] || (p[8] = (N) => d("row"))
1826
+ }, [
1827
+ e("div", yl, [
1828
+ e("span", null, R(t.rowFields.join(" / ") || "Rows"), 1),
1829
+ e("span", {
1830
+ class: q(["vpg-sort-indicator", { active: s.value === "row" }])
1831
+ }, R(s.value === "row" ? f.value === "asc" ? "↑" : "↓" : "⇅"), 3)
1832
+ ])
1833
+ ], 12, Cl)) : z("", !0),
1834
+ (r(!0), u(W, null, J(k, (N, G) => (r(), u("th", {
1835
+ key: G,
1836
+ class: "vpg-column-header-cell",
1837
+ colspan: N.colspan,
1838
+ style: ve({ width: `${we.value * N.colspan}px` }),
1839
+ onClick: (Me) => A === g.value.length - 1 && d(G)
1840
+ }, [
1841
+ e("div", Fl, [
1842
+ e("span", null, R(N.label), 1),
1843
+ A === g.value.length - 1 ? (r(), u("span", {
1844
+ key: 0,
1845
+ class: q(["vpg-sort-indicator", { active: s.value === G }])
1846
+ }, R(s.value === G ? f.value === "asc" ? "↑" : "↓" : "⇅"), 3)) : z("", !0)
1847
+ ])
1848
+ ], 12, bl))), 128)),
1849
+ t.pivotResult.rowTotals.length > 0 && A === 0 ? (r(), u("th", {
1850
+ key: 1,
1851
+ class: "vpg-total-header",
1852
+ rowspan: g.value.length
1853
+ }, " Total ", 8, Sl)) : z("", !0)
1854
+ ]))), 128))
1855
+ ]),
1856
+ e("tbody", null, [
1857
+ (r(!0), u(W, null, J(F.value, (k) => (r(), u("tr", {
1858
+ key: k,
1859
+ class: "vpg-data-row"
1860
+ }, [
1861
+ e("th", {
1862
+ class: "vpg-row-header-cell",
1863
+ style: ve({ width: `${Ae.value}px` })
1864
+ }, [
1865
+ (r(!0), u(W, null, J(t.pivotResult.rowHeaders[k], (A, N) => (r(), u("span", {
1866
+ key: N,
1867
+ class: "vpg-row-value"
1868
+ }, R(A), 1))), 128))
1869
+ ], 4),
1870
+ (r(!0), u(W, null, J(t.pivotResult.data[k], (A, N) => (r(), u("td", {
1871
+ key: N,
1872
+ class: q(["vpg-data-cell", [
1873
+ L(k, N) && "selected",
1874
+ A.value === null && "vpg-is-null"
1875
+ ]]),
1876
+ style: ve({ width: `${we.value}px` }),
1877
+ onClick: (G) => x(k, N)
1878
+ }, R(A.formattedValue), 15, Rl))), 128)),
1879
+ t.pivotResult.rowTotals[k] ? (r(), u("td", $l, R(t.pivotResult.rowTotals[k].formattedValue), 1)) : z("", !0)
1880
+ ]))), 128)),
1881
+ t.pivotResult.columnTotals.length > 0 ? (r(), u("tr", Ml, [
1882
+ e("th", {
1883
+ class: "vpg-row-header-cell vpg-total-label",
1884
+ style: ve({ width: `${Ae.value}px` })
1885
+ }, " Total ", 4),
1886
+ (r(!0), u(W, null, J(t.pivotResult.columnTotals, (k, A) => (r(), u("td", {
1887
+ key: A,
1888
+ class: "vpg-data-cell vpg-total-cell",
1889
+ style: ve({ width: `${we.value}px` })
1890
+ }, R(k.formattedValue), 5))), 128)),
1891
+ t.pivotResult.rowTotals.length > 0 ? (r(), u("td", xl, R(t.pivotResult.grandTotal.formattedValue), 1)) : z("", !0)
1892
+ ])) : z("", !0)
1893
+ ])
1894
+ ])
1895
+ ])),
1896
+ t.isConfigured && t.pivotResult ? (r(), u("div", Tl, [
1897
+ e("span", null, R(t.pivotResult.rowHeaders.length) + " rows × " + R(((P = t.pivotResult.data[0]) == null ? void 0 : P.length) || 0) + " columns", 1)
1898
+ ])) : z("", !0)
1899
+ ], 64)) : (r(), u("div", Qn, [...p[13] || (p[13] = [
1900
+ e("div", { class: "vpg-pro-content" }, [
1901
+ e("svg", {
1902
+ class: "vpg-pro-icon",
1903
+ fill: "none",
1904
+ viewBox: "0 0 24 24",
1905
+ stroke: "currentColor"
1906
+ }, [
1907
+ e("path", {
1908
+ "stroke-linecap": "round",
1909
+ "stroke-linejoin": "round",
1910
+ "stroke-width": "2",
1911
+ d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
1912
+ })
1913
+ ]),
1914
+ e("h3", null, "Pro Feature"),
1915
+ e("p", null, "Pivot Table functionality requires a Pro license."),
1916
+ e("a", {
1917
+ href: "https://tiny-pivot.com/#pricing",
1918
+ target: "_blank",
1919
+ class: "vpg-pro-link"
1920
+ }, " Get Pro License → ")
1921
+ ], -1)
1922
+ ])])),
1923
+ S(v) && S(m) ? (r(), u("div", {
1924
+ key: 2,
1925
+ class: q(["vpg-watermark", { "vpg-demo-mode": S(y) }])
1926
+ }, [
1927
+ S(y) ? (r(), u(W, { key: 0 }, [
1928
+ p[28] || (p[28] = e("span", { class: "vpg-demo-badge" }, "DEMO", -1)),
1929
+ p[29] || (p[29] = e("span", null, "Pro features unlocked for evaluation", -1)),
1930
+ p[30] || (p[30] = e("a", {
1931
+ href: "https://tiny-pivot.com/#pricing",
1932
+ target: "_blank",
1933
+ rel: "noopener",
1934
+ class: "vpg-get-pro"
1935
+ }, " Get Pro License → ", -1))
1936
+ ], 64)) : (r(), u("a", Vl, " Powered by TinyPivot "))
1937
+ ], 2)) : z("", !0)
1938
+ ], 2);
1939
+ };
1940
+ }
1941
+ }), zl = /* @__PURE__ */ et(Dl, [["__scopeId", "data-v-ccaad6a3"]]), Al = {
1942
+ key: 0,
1943
+ class: "vpg-toast"
1944
+ }, Ll = { class: "vpg-toolbar" }, Pl = { class: "vpg-toolbar-left" }, El = {
1945
+ key: 0,
1946
+ class: "vpg-view-toggle"
1947
+ }, Nl = {
1948
+ key: 0,
1949
+ class: "vpg-search-container"
1950
+ }, Bl = {
1951
+ key: 1,
1952
+ class: "vpg-search-box"
1953
+ }, jl = { class: "vpg-font-size-control" }, Hl = { class: "vpg-font-size-toggle" }, Ul = ["onClick"], Kl = {
1954
+ key: 1,
1955
+ class: "vpg-filter-info"
1956
+ }, Wl = {
1957
+ key: 2,
1958
+ class: "vpg-search-info"
1959
+ }, _l = {
1960
+ key: 0,
1961
+ class: "vpg-pivot-status"
1962
+ }, ql = { class: "vpg-toolbar-right" }, Ol = ["title"], Gl = {
1963
+ key: 0,
1964
+ class: "vpg-loading"
1965
+ }, Xl = {
1966
+ key: 1,
1967
+ class: "vpg-empty"
1968
+ }, Yl = {
1969
+ key: 2,
1970
+ class: "vpg-empty"
1971
+ }, Zl = {
1972
+ key: 3,
1973
+ class: "vpg-table-wrapper"
1974
+ }, Jl = ["onClick"], Ql = { class: "vpg-header-content" }, Il = { class: "vpg-header-text" }, es = { class: "vpg-header-icons" }, ts = {
1975
+ key: 0,
1976
+ class: "vpg-sort-indicator"
1977
+ }, os = {
1978
+ key: 0,
1979
+ class: "vpg-icon-sm",
1980
+ fill: "currentColor",
1981
+ viewBox: "0 0 20 20"
1982
+ }, ns = {
1983
+ key: 1,
1984
+ class: "vpg-icon-sm",
1985
+ fill: "currentColor",
1986
+ viewBox: "0 0 20 20"
1987
+ }, ls = {
1988
+ key: 1,
1989
+ class: "vpg-filter-indicator"
1990
+ }, ss = ["onMousedown"], as = ["data-row", "data-col", "onMousedown", "onMouseenter"], is = {
1991
+ key: 1,
1992
+ class: "vpg-pivot-container"
1993
+ }, rs = {
1994
+ key: 0,
1995
+ class: "vpg-pivot-config-panel"
1996
+ }, us = { class: "vpg-footer" }, vs = { class: "vpg-footer-left" }, cs = {
1997
+ key: 0,
1998
+ class: "vpg-filtered-note"
1999
+ }, ds = { key: 1 }, gs = { class: "vpg-filtered-count" }, ps = {
2000
+ key: 0,
2001
+ class: "vpg-pagination"
2002
+ }, fs = ["disabled"], ms = ["disabled"], hs = { class: "vpg-page-info" }, ws = ["disabled"], ks = ["disabled"], Cs = {
2003
+ key: 1,
2004
+ class: "vpg-selection-stats"
2005
+ }, ys = { class: "vpg-stat" }, bs = { class: "vpg-stat-value" }, Fs = { class: "vpg-stat" }, Ss = { class: "vpg-stat-value" }, Rs = { class: "vpg-stat" }, $s = { class: "vpg-stat-value" }, Ms = { class: "vpg-footer-right" }, xs = {
2006
+ key: 0,
2007
+ class: "vpg-demo-banner"
2008
+ }, Ts = {
2009
+ key: 1,
2010
+ class: "vpg-watermark-inline"
2011
+ }, Ce = 120, Mt = 350, Vs = /* @__PURE__ */ Qe({
2012
+ __name: "DataGrid",
2013
+ props: {
2014
+ data: {},
2015
+ loading: { type: Boolean, default: !1 },
2016
+ rowHeight: { default: 36 },
2017
+ headerHeight: { default: 40 },
2018
+ fontSize: { default: "xs" },
2019
+ showPivot: { type: Boolean, default: !0 },
2020
+ enableExport: { type: Boolean, default: !0 },
2021
+ enableSearch: { type: Boolean, default: !0 },
2022
+ enablePagination: { type: Boolean, default: !1 },
2023
+ pageSize: { default: 50 },
2024
+ enableColumnResize: { type: Boolean, default: !0 },
2025
+ enableClipboard: { type: Boolean, default: !0 },
2026
+ theme: { default: "light" },
2027
+ stripedRows: { type: Boolean, default: !0 },
2028
+ exportFilename: { default: "data-export.csv" },
2029
+ enableVerticalResize: { type: Boolean, default: !0 },
2030
+ initialHeight: { default: 600 },
2031
+ minHeight: { default: 300 },
2032
+ maxHeight: { default: 1200 }
2033
+ },
2034
+ emits: ["cellClick", "selectionChange", "export", "copy"],
2035
+ setup(t, { emit: i }) {
2036
+ const n = t, l = i, { showWatermark: v, canUsePivot: m, isDemo: y } = Ie(), c = T(() => {
2037
+ var a;
2038
+ return n.theme === "auto" ? (a = window.matchMedia) != null && a.call(window, "(prefers-color-scheme: dark)").matches ? "dark" : "light" : n.theme;
2039
+ }), b = M(n.fontSize), C = M(""), V = M(!1), $ = M(1), U = M(null), D = M(0), H = M(0), O = M(n.initialHeight), _ = M(!1), X = M(0), B = M(0), f = M(!1), s = M(""), d = [
2040
+ { value: "xs", label: "S" },
2041
+ { value: "sm", label: "M" },
2042
+ { value: "base", label: "L" }
2043
+ ], F = T(() => n.data), {
2044
+ table: g,
2045
+ columnKeys: w,
2046
+ filteredRowCount: x,
2047
+ totalRowCount: L,
2048
+ getColumnStats: ee,
2049
+ hasActiveFilter: ie,
2050
+ setColumnFilter: me,
2051
+ getColumnFilterValues: Ke,
2052
+ clearAllFilters: ye,
2053
+ toggleSort: he,
2054
+ getSortDirection: re,
2055
+ columnFilters: We,
2056
+ activeFilters: ze
2057
+ } = Ko({ data: F }), _e = T(() => g.getFilteredRowModel().rows.map((o) => o.original)), Ae = T(() => ze.value.length === 0 ? null : ze.value.map((a) => {
2058
+ var o;
2059
+ return {
2060
+ column: a.column,
2061
+ valueCount: ((o = a.values) == null ? void 0 : o.length) || 0,
2062
+ values: a.values || []
2063
+ };
2064
+ })), {
2065
+ rowFields: we,
2066
+ columnFields: E,
2067
+ valueFields: p,
2068
+ showRowTotals: P,
2069
+ showColumnTotals: k,
2070
+ availableFields: A,
2071
+ isConfigured: N,
2072
+ pivotResult: G,
2073
+ addRowField: Me,
2074
+ removeRowField: Le,
2075
+ addColumnField: Pe,
2076
+ removeColumnField: Ee,
2077
+ addValueField: Ne,
2078
+ removeValueField: be,
2079
+ updateValueFieldAggregation: ke,
2080
+ clearConfig: Be,
2081
+ autoSuggestConfig: At
2082
+ } = _o(_e), qe = T(() => {
2083
+ if (!C.value.trim() || !n.enableSearch)
2084
+ return Fe.value;
2085
+ const a = C.value.toLowerCase().trim();
2086
+ return Fe.value.filter((o) => {
2087
+ for (const h of w.value) {
2088
+ const j = o.original[h];
2089
+ if (j != null && String(j).toLowerCase().includes(a))
2090
+ return !0;
2091
+ }
2092
+ return !1;
2093
+ });
2094
+ }), de = T(() => qe.value.length), xe = T(() => n.enablePagination ? Math.max(1, Math.ceil(de.value / n.pageSize)) : 1), ut = T(() => {
2095
+ if (!n.enablePagination) return qe.value;
2096
+ const a = ($.value - 1) * n.pageSize, o = a + n.pageSize;
2097
+ return qe.value.slice(a, o);
2098
+ }), Lt = T(() => de.value === 0 ? 0 : ($.value - 1) * n.pageSize + 1), Pt = T(
2099
+ () => Math.min($.value * n.pageSize, de.value)
2100
+ );
2101
+ function Et() {
2102
+ $.value < xe.value && $.value++;
2103
+ }
2104
+ function Nt() {
2105
+ $.value > 1 && $.value--;
2106
+ }
2107
+ function Bt() {
2108
+ if (te.value === "pivot") {
2109
+ jt();
2110
+ return;
2111
+ }
2112
+ const a = n.enableSearch && C.value.trim() ? qe.value.map((o) => o.original) : Fe.value.map((o) => o.original);
2113
+ qo(a, w.value, {
2114
+ filename: n.exportFilename,
2115
+ includeHeaders: !0
2116
+ }), l("export", { rowCount: a.length, filename: n.exportFilename });
2117
+ }
2118
+ function jt() {
2119
+ if (!G.value) return;
2120
+ const a = n.exportFilename.replace(".csv", "-pivot.csv");
2121
+ Oo(
2122
+ {
2123
+ headers: G.value.headers,
2124
+ rowHeaders: G.value.rowHeaders,
2125
+ data: G.value.data,
2126
+ rowTotals: G.value.rowTotals,
2127
+ columnTotals: G.value.columnTotals,
2128
+ grandTotal: G.value.grandTotal,
2129
+ showRowTotals: P.value,
2130
+ showColumnTotals: k.value
2131
+ },
2132
+ we.value,
2133
+ E.value,
2134
+ p.value,
2135
+ { filename: a }
2136
+ );
2137
+ const o = G.value.rowHeaders.length;
2138
+ l("export", { rowCount: o, filename: a });
2139
+ }
2140
+ function Ht(a, o) {
2141
+ n.enableColumnResize && (o.preventDefault(), o.stopPropagation(), U.value = a, D.value = o.clientX, H.value = ge.value[a] || Ce, document.addEventListener("mousemove", vt), document.addEventListener("mouseup", ct));
2142
+ }
2143
+ function vt(a) {
2144
+ if (!U.value) return;
2145
+ const o = a.clientX - D.value, h = Math.max(Ce, Math.min(Mt, H.value + o));
2146
+ ge.value = {
2147
+ ...ge.value,
2148
+ [U.value]: h
2149
+ };
2150
+ }
2151
+ function ct() {
2152
+ U.value = null, document.removeEventListener("mousemove", vt), document.removeEventListener("mouseup", ct);
2153
+ }
2154
+ function Ut(a) {
2155
+ n.enableVerticalResize && (a.preventDefault(), _.value = !0, X.value = a.clientY, B.value = O.value, document.addEventListener("mousemove", dt), document.addEventListener("mouseup", gt));
2156
+ }
2157
+ function dt(a) {
2158
+ if (!_.value) return;
2159
+ const o = a.clientY - X.value, h = Math.max(
2160
+ n.minHeight,
2161
+ Math.min(n.maxHeight, B.value + o)
2162
+ );
2163
+ O.value = h;
2164
+ }
2165
+ function gt() {
2166
+ _.value = !1, document.removeEventListener("mousemove", dt), document.removeEventListener("mouseup", gt);
2167
+ }
2168
+ function pt() {
2169
+ if (!ae.value || !n.enableClipboard) return;
2170
+ const a = Xo(
2171
+ Fe.value.map((o) => o.original),
2172
+ w.value,
2173
+ ae.value
2174
+ );
2175
+ Go(
2176
+ a,
2177
+ () => {
2178
+ const o = (ae.value.maxRow - ae.value.minRow + 1) * (ae.value.maxCol - ae.value.minCol + 1);
2179
+ s.value = `Copied ${o} cell${o > 1 ? "s" : ""}`, f.value = !0, setTimeout(() => {
2180
+ f.value = !1;
2181
+ }, 2e3), l("copy", { text: a, cellCount: o });
2182
+ },
2183
+ (o) => {
2184
+ s.value = "Copy failed", f.value = !0, setTimeout(() => {
2185
+ f.value = !1;
2186
+ }, 2e3), console.error("Copy failed:", o);
2187
+ }
2188
+ );
2189
+ }
2190
+ const te = M("grid"), Te = M(!0), tt = M(null);
2191
+ function Kt(a) {
2192
+ tt.value = a;
2193
+ }
2194
+ function Wt() {
2195
+ tt.value = null;
2196
+ }
2197
+ function _t(a) {
2198
+ we.value = a;
2199
+ }
2200
+ function qt(a) {
2201
+ E.value = a;
2202
+ }
2203
+ const ot = M(), ft = M(), Fe = T(() => g.getRowModel().rows), ne = M(null), Oe = M({ top: 0, left: 0, maxHeight: 400 }), ge = M({});
2204
+ function mt() {
2205
+ if (n.data.length === 0)
2206
+ return;
2207
+ const a = {}, o = Math.min(100, n.data.length), j = document.createElement("canvas").getContext("2d");
2208
+ if (j) {
2209
+ j.font = "13px system-ui, -apple-system, sans-serif";
2210
+ for (const K of w.value) {
2211
+ let Q = j.measureText(K).width + 56;
2212
+ for (let Z = 0; Z < o; Z++) {
2213
+ const Y = n.data[Z][K], oe = Y == null ? "" : String(Y), fe = j.measureText(oe).width + 28;
2214
+ Q = Math.max(Q, fe);
2215
+ }
2216
+ a[K] = Math.min(Math.max(Q, Ce), Mt);
2217
+ }
2218
+ ge.value = a;
2219
+ }
2220
+ }
2221
+ function Ot(a, o) {
2222
+ o.stopPropagation();
2223
+ const h = o.currentTarget, j = h.closest(".vpg-header-cell"), K = (j == null ? void 0 : j.getBoundingClientRect()) || h.getBoundingClientRect(), Q = 280, Z = 12;
2224
+ let Y = K.left;
2225
+ Y + Q > window.innerWidth - Z && (Y = window.innerWidth - Q - Z), Y = Math.max(Z, Y);
2226
+ const oe = window.innerHeight - K.bottom - Z, fe = K.top - Z;
2227
+ let Se, Re;
2228
+ oe >= 300 || oe >= fe ? (Se = K.bottom + 4, Re = Math.min(400, oe - 4)) : (Re = Math.min(400, fe - 4), Se = K.top - Re - 4), Oe.value = { top: Se, left: Y, maxHeight: Re }, ne.value = a;
2229
+ }
2230
+ function Ge() {
2231
+ ne.value = null;
2232
+ }
2233
+ function Gt(a, o) {
2234
+ me(a, o);
2235
+ }
2236
+ function Xt(a, o) {
2237
+ if (o === null)
2238
+ re(a) && (he(a), re(a) && he(a));
2239
+ else {
2240
+ const h = re(a);
2241
+ h === null ? (he(a), o === "desc" && re(a) === "asc" && he(a)) : h !== o && he(a);
2242
+ }
2243
+ }
2244
+ const Xe = T(() => We.value.length), pe = M(null), ue = M(null), se = M(null), nt = M(!1);
2245
+ function Yt(a) {
2246
+ const o = Fe.value.length - 1;
2247
+ o < 0 || (ue.value = { row: 0, col: a }, se.value = { row: o, col: a }, pe.value = { row: 0, col: a });
2248
+ }
2249
+ function Zt(a, o) {
2250
+ if (o.target.closest(".vpg-dropdown-arrow")) {
2251
+ const j = w.value[a];
2252
+ Ot(j, o);
2253
+ } else
2254
+ Yt(a);
2255
+ }
2256
+ const ae = T(() => !ue.value || !se.value ? null : {
2257
+ minRow: Math.min(ue.value.row, se.value.row),
2258
+ maxRow: Math.max(ue.value.row, se.value.row),
2259
+ minCol: Math.min(ue.value.col, se.value.col),
2260
+ maxCol: Math.max(ue.value.col, se.value.col)
2261
+ });
2262
+ function Jt(a, o) {
2263
+ if (!ae.value)
2264
+ return !1;
2265
+ const { minRow: h, maxRow: j, minCol: K, maxCol: Q } = ae.value;
2266
+ return a >= h && a <= j && o >= K && o <= Q;
2267
+ }
2268
+ const Ve = T(() => {
2269
+ if (!ae.value)
2270
+ return null;
2271
+ const { minRow: a, maxRow: o, minCol: h, maxCol: j } = ae.value, K = [];
2272
+ let Q = 0;
2273
+ for (let oe = a; oe <= o; oe++) {
2274
+ const fe = Fe.value[oe];
2275
+ if (fe)
2276
+ for (let Se = h; Se <= j; Se++) {
2277
+ const Re = w.value[Se];
2278
+ if (!Re)
2279
+ continue;
2280
+ const De = fe.original[Re];
2281
+ if (Q++, De != null && De !== "") {
2282
+ const bt = typeof De == "number" ? De : Number.parseFloat(String(De));
2283
+ Number.isNaN(bt) || K.push(bt);
2284
+ }
2285
+ }
2286
+ }
2287
+ if (K.length === 0)
2288
+ return { count: Q, sum: null, avg: null, numericCount: 0 };
2289
+ const Z = K.reduce((oe, fe) => oe + fe, 0), Y = Z / K.length;
2290
+ return { count: Q, sum: Z, avg: Y, numericCount: K.length };
2291
+ });
2292
+ function ht(a) {
2293
+ return a === null ? "-" : Math.abs(a) >= 1e3 ? a.toLocaleString("en-US", { maximumFractionDigits: 2 }) : a.toLocaleString("en-US", { maximumFractionDigits: 4 });
2294
+ }
2295
+ function wt(a) {
2296
+ if ((a.ctrlKey || a.metaKey) && a.key === "c" && ae.value) {
2297
+ a.preventDefault(), pt();
2298
+ return;
2299
+ }
2300
+ if ((a.ctrlKey || a.metaKey) && a.key === "f" && n.enableSearch) {
2301
+ a.preventDefault(), V.value = !0, je(() => {
2302
+ const Y = document.querySelector(".vpg-search-input");
2303
+ Y == null || Y.focus();
2304
+ });
2305
+ return;
2306
+ }
2307
+ if (!pe.value || ne.value)
2308
+ return;
2309
+ const { row: o, col: h } = pe.value, K = ut.value.length - 1, Q = w.value.length - 1;
2310
+ function Z(Y, oe) {
2311
+ a.shiftKey ? (ue.value || (ue.value = { row: o, col: h }), se.value = { row: Y, col: oe }) : (ue.value = { row: Y, col: oe }, se.value = { row: Y, col: oe }), pe.value = { row: Y, col: oe }, Qt(Y, oe);
2312
+ }
2313
+ switch (a.key) {
2314
+ case "ArrowUp":
2315
+ a.preventDefault(), o > 0 && Z(o - 1, h);
2316
+ break;
2317
+ case "ArrowDown":
2318
+ a.preventDefault(), o < K && Z(o + 1, h);
2319
+ break;
2320
+ case "ArrowLeft":
2321
+ a.preventDefault(), h > 0 && Z(o, h - 1);
2322
+ break;
2323
+ case "ArrowRight":
2324
+ a.preventDefault(), h < Q && Z(o, h + 1);
2325
+ break;
2326
+ case "Escape":
2327
+ pe.value = null, ue.value = null, se.value = null, V.value = !1, C.value = "";
2328
+ break;
2329
+ }
2330
+ }
2331
+ function Qt(a, o) {
2332
+ je(() => {
2333
+ var j;
2334
+ const h = (j = ft.value) == null ? void 0 : j.querySelector(
2335
+ `[data-row="${a}"][data-col="${o}"]`
2336
+ );
2337
+ h == null || h.scrollIntoView({ block: "nearest", inline: "nearest" });
2338
+ });
2339
+ }
2340
+ function It(a, o, h) {
2341
+ h.preventDefault(), h.shiftKey && pe.value ? se.value = { row: a, col: o } : (pe.value = { row: a, col: o }, ue.value = { row: a, col: o }, se.value = { row: a, col: o }, nt.value = !0);
2342
+ const j = Fe.value[a];
2343
+ if (j) {
2344
+ const K = w.value[o];
2345
+ l("cellClick", {
2346
+ row: a,
2347
+ col: o,
2348
+ value: j.original[K],
2349
+ rowData: j.original
2350
+ });
2351
+ }
2352
+ }
2353
+ function eo(a, o) {
2354
+ nt.value && (se.value = { row: a, col: o });
2355
+ }
2356
+ function kt() {
2357
+ nt.value = !1;
2358
+ }
2359
+ function to(a, o) {
2360
+ var h, j;
2361
+ return Jt(a, o) ? !0 : ((h = pe.value) == null ? void 0 : h.row) === a && ((j = pe.value) == null ? void 0 : j.col) === o;
2362
+ }
2363
+ const oo = /^(?:.*_)?(?:id|code|year|month|quarter|day|week|date|zip|phone|fax|ssn|ein|npi|ndc|gpi|hcpcs|icd|cpt|rx|bin|pcn|group|member|claim|rx_number|script|fill)(?:_.*)?$/i;
2364
+ function no(a) {
2365
+ return !oo.test(a);
2366
+ }
2367
+ function lo(a, o) {
2368
+ if (a == null || a === "")
2369
+ return "";
2370
+ if (ee(o).type === "number") {
2371
+ const j = typeof a == "number" ? a : Number.parseFloat(String(a));
2372
+ return Number.isNaN(j) ? String(a) : no(o) && Math.abs(j) >= 1e3 ? j.toLocaleString("en-US", { maximumFractionDigits: 2 }) : Number.isInteger(j) ? String(j) : j.toLocaleString("en-US", { maximumFractionDigits: 4, useGrouping: !1 });
2373
+ }
2374
+ return String(a);
2375
+ }
2376
+ function Ct() {
2377
+ ne.value && Ge();
2378
+ }
2379
+ function yt(a) {
2380
+ var o;
2381
+ if (ne.value) {
2382
+ const h = a.target;
2383
+ if (h && ((o = h.closest) != null && o.call(h, ".vpg-filter-portal")))
2384
+ return;
2385
+ Ge();
2386
+ }
2387
+ }
2388
+ xt(() => {
2389
+ mt(), document.addEventListener("keydown", wt), document.addEventListener("mouseup", kt), je(() => {
2390
+ var a;
2391
+ (a = ot.value) == null || a.addEventListener("scroll", Ct, { passive: !0 });
2392
+ }), window.addEventListener("scroll", yt, { passive: !0, capture: !0 });
2393
+ }), Tt(() => {
2394
+ var a;
2395
+ document.removeEventListener("keydown", wt), document.removeEventListener("mouseup", kt), (a = ot.value) == null || a.removeEventListener("scroll", Ct), window.removeEventListener("scroll", yt, { capture: !0 });
2396
+ }), Ue(() => n.data, () => {
2397
+ je(mt);
2398
+ }, { immediate: !0 });
2399
+ const so = T(() => w.value.reduce((a, o) => a + (ge.value[o] || Ce), 0));
2400
+ function ao(a) {
2401
+ ne.value && (a.target.closest(".vpg-filter-portal") || Ge());
2402
+ }
2403
+ return (a, o) => (r(), u("div", {
2404
+ class: q(["vpg-data-grid", [
2405
+ `vpg-font-${b.value}`,
2406
+ `vpg-theme-${c.value}`,
2407
+ { "vpg-striped": t.stripedRows },
2408
+ { "vpg-resizing": U.value },
2409
+ { "vpg-resizing-vertical": _.value }
2410
+ ]]),
2411
+ style: ve({ height: `${O.value}px` }),
2412
+ onClick: ao
2413
+ }, [
2414
+ Ye(ro, { name: "vpg-toast" }, {
2415
+ default: uo(() => [
2416
+ f.value ? (r(), u("div", Al, [
2417
+ o[15] || (o[15] = e("svg", {
2418
+ class: "vpg-icon",
2419
+ fill: "none",
2420
+ stroke: "currentColor",
2421
+ viewBox: "0 0 24 24"
2422
+ }, [
2423
+ e("path", {
2424
+ "stroke-linecap": "round",
2425
+ "stroke-linejoin": "round",
2426
+ "stroke-width": "2",
2427
+ d: "M5 13l4 4L19 7"
2428
+ })
2429
+ ], -1)),
2430
+ I(" " + R(s.value), 1)
2431
+ ])) : z("", !0)
2432
+ ]),
2433
+ _: 1
2434
+ }),
2435
+ e("div", Ll, [
2436
+ e("div", Pl, [
2437
+ t.showPivot ? (r(), u("div", El, [
2438
+ e("button", {
2439
+ class: q(["vpg-view-btn", { active: te.value === "grid" }]),
2440
+ onClick: o[0] || (o[0] = (h) => te.value = "grid")
2441
+ }, [...o[16] || (o[16] = [
2442
+ e("svg", {
2443
+ class: "vpg-icon",
2444
+ fill: "none",
2445
+ stroke: "currentColor",
2446
+ viewBox: "0 0 24 24"
2447
+ }, [
2448
+ e("path", {
2449
+ "stroke-linecap": "round",
2450
+ "stroke-linejoin": "round",
2451
+ "stroke-width": "2",
2452
+ d: "M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"
2453
+ })
2454
+ ], -1),
2455
+ I(" Grid ", -1)
2456
+ ])], 2),
2457
+ e("button", {
2458
+ class: q(["vpg-view-btn vpg-pivot-btn", { active: te.value === "pivot" }]),
2459
+ onClick: o[1] || (o[1] = (h) => te.value = "pivot")
2460
+ }, [...o[17] || (o[17] = [
2461
+ e("svg", {
2462
+ class: "vpg-icon",
2463
+ fill: "none",
2464
+ stroke: "currentColor",
2465
+ viewBox: "0 0 24 24"
2466
+ }, [
2467
+ e("path", {
2468
+ "stroke-linecap": "round",
2469
+ "stroke-linejoin": "round",
2470
+ "stroke-width": "2",
2471
+ d: "M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"
2472
+ })
2473
+ ], -1),
2474
+ I(" Pivot ", -1)
2475
+ ])], 2)
2476
+ ])) : z("", !0),
2477
+ te.value === "grid" ? (r(), u(W, { key: 1 }, [
2478
+ t.enableSearch ? (r(), u("div", Nl, [
2479
+ V.value ? (r(), u("div", Bl, [
2480
+ o[20] || (o[20] = e("svg", {
2481
+ class: "vpg-search-icon",
2482
+ fill: "none",
2483
+ stroke: "currentColor",
2484
+ viewBox: "0 0 24 24"
2485
+ }, [
2486
+ e("path", {
2487
+ "stroke-linecap": "round",
2488
+ "stroke-linejoin": "round",
2489
+ "stroke-width": "2",
2490
+ d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
2491
+ })
2492
+ ], -1)),
2493
+ it(e("input", {
2494
+ "onUpdate:modelValue": o[3] || (o[3] = (h) => C.value = h),
2495
+ type: "text",
2496
+ class: "vpg-search-input",
2497
+ placeholder: "Search all columns...",
2498
+ onKeydown: o[4] || (o[4] = vo((h) => {
2499
+ V.value = !1, C.value = "";
2500
+ }, ["escape"]))
2501
+ }, null, 544), [
2502
+ [rt, C.value]
2503
+ ]),
2504
+ C.value ? (r(), u("button", {
2505
+ key: 0,
2506
+ class: "vpg-search-clear",
2507
+ onClick: o[5] || (o[5] = (h) => C.value = "")
2508
+ }, [...o[19] || (o[19] = [
2509
+ e("svg", {
2510
+ class: "vpg-icon-xs",
2511
+ fill: "none",
2512
+ stroke: "currentColor",
2513
+ viewBox: "0 0 24 24"
2514
+ }, [
2515
+ e("path", {
2516
+ "stroke-linecap": "round",
2517
+ "stroke-linejoin": "round",
2518
+ "stroke-width": "2",
2519
+ d: "M6 18L18 6M6 6l12 12"
2520
+ })
2521
+ ], -1)
2522
+ ])])) : z("", !0)
2523
+ ])) : (r(), u("button", {
2524
+ key: 0,
2525
+ class: "vpg-icon-btn",
2526
+ title: "Search (Ctrl+F)",
2527
+ onClick: o[2] || (o[2] = (h) => V.value = !0)
2528
+ }, [...o[18] || (o[18] = [
2529
+ e("svg", {
2530
+ class: "vpg-icon",
2531
+ fill: "none",
2532
+ stroke: "currentColor",
2533
+ viewBox: "0 0 24 24"
2534
+ }, [
2535
+ e("path", {
2536
+ "stroke-linecap": "round",
2537
+ "stroke-linejoin": "round",
2538
+ "stroke-width": "2",
2539
+ d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
2540
+ })
2541
+ ], -1)
2542
+ ])]))
2543
+ ])) : z("", !0),
2544
+ e("div", jl, [
2545
+ o[21] || (o[21] = e("span", { class: "vpg-label" }, "Size:", -1)),
2546
+ e("div", Hl, [
2547
+ (r(), u(W, null, J(d, (h) => e("button", {
2548
+ key: h.value,
2549
+ class: q(["vpg-font-size-btn", { active: b.value === h.value }]),
2550
+ onClick: (j) => b.value = h.value
2551
+ }, R(h.label), 11, Ul)), 64))
2552
+ ])
2553
+ ]),
2554
+ Xe.value > 0 ? (r(), u("div", Kl, [
2555
+ o[22] || (o[22] = e("svg", {
2556
+ class: "vpg-icon",
2557
+ fill: "currentColor",
2558
+ viewBox: "0 0 20 20"
2559
+ }, [
2560
+ e("path", {
2561
+ "fill-rule": "evenodd",
2562
+ d: "M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z",
2563
+ "clip-rule": "evenodd"
2564
+ })
2565
+ ], -1)),
2566
+ e("span", null, R(Xe.value) + " filter" + R(Xe.value > 1 ? "s" : ""), 1)
2567
+ ])) : z("", !0),
2568
+ C.value ? (r(), u("div", Wl, [
2569
+ e("span", null, R(de.value) + " match" + R(de.value !== 1 ? "es" : ""), 1)
2570
+ ])) : z("", !0)
2571
+ ], 64)) : z("", !0),
2572
+ te.value === "pivot" && S(m) ? (r(), u(W, { key: 2 }, [
2573
+ e("button", {
2574
+ class: q(["vpg-config-toggle", { active: Te.value }]),
2575
+ onClick: o[6] || (o[6] = (h) => Te.value = !Te.value)
2576
+ }, [
2577
+ o[23] || (o[23] = e("svg", {
2578
+ class: "vpg-icon",
2579
+ fill: "none",
2580
+ stroke: "currentColor",
2581
+ viewBox: "0 0 24 24"
2582
+ }, [
2583
+ e("path", {
2584
+ "stroke-linecap": "round",
2585
+ "stroke-linejoin": "round",
2586
+ "stroke-width": "2",
2587
+ d: "M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"
2588
+ })
2589
+ ], -1)),
2590
+ I(" " + R(Te.value ? "Hide" : "Show") + " Config ", 1)
2591
+ ], 2),
2592
+ S(N) ? (r(), u("div", _l, [...o[24] || (o[24] = [
2593
+ e("svg", {
2594
+ class: "vpg-icon",
2595
+ fill: "currentColor",
2596
+ viewBox: "0 0 20 20"
2597
+ }, [
2598
+ e("path", {
2599
+ "fill-rule": "evenodd",
2600
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
2601
+ "clip-rule": "evenodd"
2602
+ })
2603
+ ], -1),
2604
+ e("span", null, "Pivot configured", -1)
2605
+ ])])) : z("", !0)
2606
+ ], 64)) : z("", !0)
2607
+ ]),
2608
+ e("div", ql, [
2609
+ te.value === "grid" && Xe.value > 0 ? (r(), u("button", {
2610
+ key: 0,
2611
+ class: "vpg-clear-filters",
2612
+ onClick: o[7] || (o[7] = //@ts-ignore
2613
+ (...h) => S(ye) && S(ye)(...h))
2614
+ }, [...o[25] || (o[25] = [
2615
+ e("svg", {
2616
+ class: "vpg-icon",
2617
+ fill: "none",
2618
+ stroke: "currentColor",
2619
+ viewBox: "0 0 24 24"
2620
+ }, [
2621
+ e("path", {
2622
+ "stroke-linecap": "round",
2623
+ "stroke-linejoin": "round",
2624
+ "stroke-width": "2",
2625
+ d: "M6 18L18 6M6 6l12 12"
2626
+ })
2627
+ ], -1),
2628
+ I(" Clear Filters ", -1)
2629
+ ])])) : z("", !0),
2630
+ t.enableClipboard && ae.value && te.value === "grid" ? (r(), u("button", {
2631
+ key: 1,
2632
+ class: "vpg-icon-btn",
2633
+ title: "Copy selection (Ctrl+C)",
2634
+ onClick: pt
2635
+ }, [...o[26] || (o[26] = [
2636
+ e("svg", {
2637
+ class: "vpg-icon",
2638
+ fill: "none",
2639
+ stroke: "currentColor",
2640
+ viewBox: "0 0 24 24"
2641
+ }, [
2642
+ e("path", {
2643
+ "stroke-linecap": "round",
2644
+ "stroke-linejoin": "round",
2645
+ "stroke-width": "2",
2646
+ d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
2647
+ })
2648
+ ], -1)
2649
+ ])])) : z("", !0),
2650
+ t.enableExport && (te.value === "grid" || te.value === "pivot" && S(N)) ? (r(), u("button", {
2651
+ key: 2,
2652
+ class: "vpg-export-btn",
2653
+ title: te.value === "pivot" ? "Export Pivot to CSV" : "Export to CSV",
2654
+ onClick: Bt
2655
+ }, [
2656
+ o[27] || (o[27] = e("svg", {
2657
+ class: "vpg-icon",
2658
+ fill: "none",
2659
+ stroke: "currentColor",
2660
+ viewBox: "0 0 24 24"
2661
+ }, [
2662
+ e("path", {
2663
+ "stroke-linecap": "round",
2664
+ "stroke-linejoin": "round",
2665
+ "stroke-width": "2",
2666
+ d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
2667
+ })
2668
+ ], -1)),
2669
+ I(" Export" + R(te.value === "pivot" ? " Pivot" : ""), 1)
2670
+ ], 8, Ol)) : z("", !0)
2671
+ ])
2672
+ ]),
2673
+ te.value === "grid" ? (r(), u("div", {
2674
+ key: 0,
2675
+ ref_key: "tableContainerRef",
2676
+ ref: ot,
2677
+ class: "vpg-grid-container",
2678
+ tabindex: "0"
2679
+ }, [
2680
+ t.loading ? (r(), u("div", Gl, [...o[28] || (o[28] = [
2681
+ e("div", { class: "vpg-spinner" }, null, -1),
2682
+ e("span", null, "Loading data...", -1)
2683
+ ])])) : t.data.length === 0 ? (r(), u("div", Xl, [...o[29] || (o[29] = [
2684
+ e("div", { class: "vpg-empty-icon" }, [
2685
+ e("svg", {
2686
+ class: "vpg-icon-lg",
2687
+ fill: "none",
2688
+ stroke: "currentColor",
2689
+ viewBox: "0 0 24 24"
2690
+ }, [
2691
+ e("path", {
2692
+ "stroke-linecap": "round",
2693
+ "stroke-linejoin": "round",
2694
+ "stroke-width": "1.5",
2695
+ d: "M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
2696
+ })
2697
+ ])
2698
+ ], -1),
2699
+ e("span", null, "No data available", -1)
2700
+ ])])) : S(x) === 0 ? (r(), u("div", Yl, [
2701
+ o[30] || (o[30] = e("div", { class: "vpg-empty-icon vpg-warning" }, [
2702
+ e("svg", {
2703
+ class: "vpg-icon-lg",
2704
+ fill: "none",
2705
+ stroke: "currentColor",
2706
+ viewBox: "0 0 24 24"
2707
+ }, [
2708
+ e("path", {
2709
+ "stroke-linecap": "round",
2710
+ "stroke-linejoin": "round",
2711
+ "stroke-width": "1.5",
2712
+ d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"
2713
+ })
2714
+ ])
2715
+ ], -1)),
2716
+ o[31] || (o[31] = e("span", null, "No matching records", -1)),
2717
+ e("button", {
2718
+ class: "vpg-clear-link",
2719
+ onClick: o[8] || (o[8] = //@ts-ignore
2720
+ (...h) => S(ye) && S(ye)(...h))
2721
+ }, " Clear all filters ")
2722
+ ])) : (r(), u("div", Zl, [
2723
+ e("table", {
2724
+ class: "vpg-table",
2725
+ style: ve({ minWidth: `${so.value}px` })
2726
+ }, [
2727
+ e("thead", null, [
2728
+ e("tr", null, [
2729
+ (r(!0), u(W, null, J(S(w), (h, j) => (r(), u("th", {
2730
+ key: h,
2731
+ class: q(["vpg-header-cell", {
2732
+ "vpg-has-filter": S(ie)(h),
2733
+ "vpg-is-sorted": S(re)(h) !== null,
2734
+ "vpg-is-active": ne.value === h
2735
+ }]),
2736
+ style: ve({ width: `${ge.value[h] || Ce}px`, minWidth: `${ge.value[h] || Ce}px` }),
2737
+ onClick: (K) => Zt(j, K)
2738
+ }, [
2739
+ e("div", Ql, [
2740
+ e("span", Il, R(h), 1),
2741
+ e("div", es, [
2742
+ S(re)(h) ? (r(), u("span", ts, [
2743
+ S(re)(h) === "asc" ? (r(), u("svg", os, [...o[32] || (o[32] = [
2744
+ e("path", {
2745
+ "fill-rule": "evenodd",
2746
+ d: "M14.707 12.707a1 1 0 01-1.414 0L10 9.414l-3.293 3.293a1 1 0 01-1.414-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 010 1.414z",
2747
+ "clip-rule": "evenodd"
2748
+ }, null, -1)
2749
+ ])])) : (r(), u("svg", ns, [...o[33] || (o[33] = [
2750
+ e("path", {
2751
+ "fill-rule": "evenodd",
2752
+ d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
2753
+ "clip-rule": "evenodd"
2754
+ }, null, -1)
2755
+ ])]))
2756
+ ])) : z("", !0),
2757
+ S(ie)(h) ? (r(), u("span", ls, [...o[34] || (o[34] = [
2758
+ e("svg", {
2759
+ class: "vpg-icon-xs",
2760
+ fill: "currentColor",
2761
+ viewBox: "0 0 20 20"
2762
+ }, [
2763
+ e("path", {
2764
+ "fill-rule": "evenodd",
2765
+ d: "M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z",
2766
+ "clip-rule": "evenodd"
2767
+ })
2768
+ ], -1)
2769
+ ])])) : z("", !0),
2770
+ o[35] || (o[35] = e("span", {
2771
+ class: "vpg-dropdown-arrow",
2772
+ title: "Filter & Sort"
2773
+ }, [
2774
+ e("svg", {
2775
+ class: "vpg-icon-sm",
2776
+ fill: "none",
2777
+ stroke: "currentColor",
2778
+ viewBox: "0 0 24 24"
2779
+ }, [
2780
+ e("path", {
2781
+ "stroke-linecap": "round",
2782
+ "stroke-linejoin": "round",
2783
+ "stroke-width": "2",
2784
+ d: "M19 9l-7 7-7-7"
2785
+ })
2786
+ ])
2787
+ ], -1))
2788
+ ])
2789
+ ]),
2790
+ t.enableColumnResize ? (r(), u("div", {
2791
+ key: 0,
2792
+ class: "vpg-resize-handle",
2793
+ onMousedown: (K) => Ht(h, K)
2794
+ }, null, 40, ss)) : z("", !0)
2795
+ ], 14, Jl))), 128))
2796
+ ])
2797
+ ]),
2798
+ e("tbody", {
2799
+ ref_key: "tableBodyRef",
2800
+ ref: ft
2801
+ }, [
2802
+ (r(!0), u(W, null, J(ut.value, (h, j) => (r(), u("tr", {
2803
+ key: h.id,
2804
+ class: "vpg-row"
2805
+ }, [
2806
+ (r(!0), u(W, null, J(S(w), (K, Q) => (r(), u("td", {
2807
+ key: K,
2808
+ class: q(["vpg-cell", {
2809
+ "vpg-selected": to(j, Q),
2810
+ "vpg-is-number": S(ee)(K).type === "number"
2811
+ }]),
2812
+ "data-row": j,
2813
+ "data-col": Q,
2814
+ style: ve({ width: `${ge.value[K] || Ce}px`, minWidth: `${ge.value[K] || Ce}px` }),
2815
+ onMousedown: (Z) => It(j, Q, Z),
2816
+ onMouseenter: (Z) => eo(j, Q)
2817
+ }, R(lo(h.original[K], K)), 47, as))), 128))
2818
+ ]))), 128))
2819
+ ], 512)
2820
+ ], 4)
2821
+ ]))
2822
+ ], 512)) : (r(), u("div", is, [
2823
+ Te.value && S(m) ? (r(), u("div", rs, [
2824
+ Ye(En, {
2825
+ "available-fields": S(A),
2826
+ "row-fields": S(we),
2827
+ "column-fields": S(E),
2828
+ "value-fields": S(p),
2829
+ "show-row-totals": S(P),
2830
+ "show-column-totals": S(k),
2831
+ "onUpdate:showRowTotals": o[9] || (o[9] = (h) => P.value = h),
2832
+ "onUpdate:showColumnTotals": o[10] || (o[10] = (h) => k.value = h),
2833
+ onClearConfig: S(Be),
2834
+ onAutoSuggest: S(At),
2835
+ onDragStart: Kt,
2836
+ onDragEnd: Wt,
2837
+ onUpdateAggregation: S(ke),
2838
+ onAddRowField: S(Me),
2839
+ onRemoveRowField: S(Le),
2840
+ onAddColumnField: S(Pe),
2841
+ onRemoveColumnField: S(Ee),
2842
+ onAddValueField: S(Ne),
2843
+ onRemoveValueField: S(be)
2844
+ }, null, 8, ["available-fields", "row-fields", "column-fields", "value-fields", "show-row-totals", "show-column-totals", "onClearConfig", "onAutoSuggest", "onUpdateAggregation", "onAddRowField", "onRemoveRowField", "onAddColumnField", "onRemoveColumnField", "onAddValueField", "onRemoveValueField"])
2845
+ ])) : z("", !0),
2846
+ e("div", {
2847
+ class: q(["vpg-pivot-main", { "vpg-full-width": !Te.value }])
2848
+ }, [
2849
+ Ye(zl, {
2850
+ "row-fields": S(we),
2851
+ "column-fields": S(E),
2852
+ "value-fields": S(p),
2853
+ "is-configured": S(N),
2854
+ "dragging-field": tt.value,
2855
+ "pivot-result": S(G),
2856
+ "font-size": b.value,
2857
+ "active-filters": Ae.value,
2858
+ "total-row-count": S(L),
2859
+ "filtered-row-count": S(x),
2860
+ onAddRowField: S(Me),
2861
+ onRemoveRowField: S(Le),
2862
+ onAddColumnField: S(Pe),
2863
+ onRemoveColumnField: S(Ee),
2864
+ onAddValueField: S(Ne),
2865
+ onRemoveValueField: S(be),
2866
+ onUpdateAggregation: S(ke),
2867
+ onReorderRowFields: _t,
2868
+ onReorderColumnFields: qt
2869
+ }, null, 8, ["row-fields", "column-fields", "value-fields", "is-configured", "dragging-field", "pivot-result", "font-size", "active-filters", "total-row-count", "filtered-row-count", "onAddRowField", "onRemoveRowField", "onAddColumnField", "onRemoveColumnField", "onAddValueField", "onRemoveValueField", "onUpdateAggregation"])
2870
+ ], 2)
2871
+ ])),
2872
+ e("div", us, [
2873
+ e("div", vs, [
2874
+ te.value === "grid" ? (r(), u(W, { key: 0 }, [
2875
+ t.enablePagination ? (r(), u(W, { key: 0 }, [
2876
+ e("span", null, R(Lt.value.toLocaleString()) + "-" + R(Pt.value.toLocaleString()), 1),
2877
+ o[36] || (o[36] = e("span", { class: "vpg-separator" }, "of", -1)),
2878
+ e("span", null, R(de.value.toLocaleString()), 1),
2879
+ de.value !== S(L) ? (r(), u("span", cs, " (" + R(S(L).toLocaleString()) + " total) ", 1)) : z("", !0)
2880
+ ], 64)) : S(x) === S(L) && de.value === S(L) ? (r(), u("span", ds, R(S(L).toLocaleString()) + " records", 1)) : (r(), u(W, { key: 2 }, [
2881
+ e("span", gs, R(de.value.toLocaleString()), 1),
2882
+ o[37] || (o[37] = e("span", { class: "vpg-separator" }, "of", -1)),
2883
+ e("span", null, R(S(L).toLocaleString()), 1),
2884
+ o[38] || (o[38] = e("span", { class: "vpg-separator" }, "records", -1))
2885
+ ], 64))
2886
+ ], 64)) : (r(), u(W, { key: 1 }, [
2887
+ o[39] || (o[39] = e("span", { class: "vpg-pivot-label" }, "Pivot Table", -1)),
2888
+ o[40] || (o[40] = e("span", { class: "vpg-separator" }, "•", -1)),
2889
+ e("span", null, R(S(L).toLocaleString()) + " source records", 1)
2890
+ ], 64))
2891
+ ]),
2892
+ t.enablePagination && te.value === "grid" && xe.value > 1 ? (r(), u("div", ps, [
2893
+ e("button", {
2894
+ class: "vpg-page-btn",
2895
+ disabled: $.value === 1,
2896
+ onClick: o[11] || (o[11] = (h) => $.value = 1)
2897
+ }, [...o[41] || (o[41] = [
2898
+ e("svg", {
2899
+ class: "vpg-icon-sm",
2900
+ fill: "none",
2901
+ stroke: "currentColor",
2902
+ viewBox: "0 0 24 24"
2903
+ }, [
2904
+ e("path", {
2905
+ "stroke-linecap": "round",
2906
+ "stroke-linejoin": "round",
2907
+ "stroke-width": "2",
2908
+ d: "M11 19l-7-7 7-7m8 14l-7-7 7-7"
2909
+ })
2910
+ ], -1)
2911
+ ])], 8, fs),
2912
+ e("button", {
2913
+ class: "vpg-page-btn",
2914
+ disabled: $.value === 1,
2915
+ onClick: Nt
2916
+ }, [...o[42] || (o[42] = [
2917
+ e("svg", {
2918
+ class: "vpg-icon-sm",
2919
+ fill: "none",
2920
+ stroke: "currentColor",
2921
+ viewBox: "0 0 24 24"
2922
+ }, [
2923
+ e("path", {
2924
+ "stroke-linecap": "round",
2925
+ "stroke-linejoin": "round",
2926
+ "stroke-width": "2",
2927
+ d: "M15 19l-7-7 7-7"
2928
+ })
2929
+ ], -1)
2930
+ ])], 8, ms),
2931
+ e("span", hs, " Page " + R($.value) + " of " + R(xe.value), 1),
2932
+ e("button", {
2933
+ class: "vpg-page-btn",
2934
+ disabled: $.value === xe.value,
2935
+ onClick: Et
2936
+ }, [...o[43] || (o[43] = [
2937
+ e("svg", {
2938
+ class: "vpg-icon-sm",
2939
+ fill: "none",
2940
+ stroke: "currentColor",
2941
+ viewBox: "0 0 24 24"
2942
+ }, [
2943
+ e("path", {
2944
+ "stroke-linecap": "round",
2945
+ "stroke-linejoin": "round",
2946
+ "stroke-width": "2",
2947
+ d: "M9 5l7 7-7 7"
2948
+ })
2949
+ ], -1)
2950
+ ])], 8, ws),
2951
+ e("button", {
2952
+ class: "vpg-page-btn",
2953
+ disabled: $.value === xe.value,
2954
+ onClick: o[12] || (o[12] = (h) => $.value = xe.value)
2955
+ }, [...o[44] || (o[44] = [
2956
+ e("svg", {
2957
+ class: "vpg-icon-sm",
2958
+ fill: "none",
2959
+ stroke: "currentColor",
2960
+ viewBox: "0 0 24 24"
2961
+ }, [
2962
+ e("path", {
2963
+ "stroke-linecap": "round",
2964
+ "stroke-linejoin": "round",
2965
+ "stroke-width": "2",
2966
+ d: "M13 5l7 7-7 7M5 5l7 7-7 7"
2967
+ })
2968
+ ], -1)
2969
+ ])], 8, ks)
2970
+ ])) : z("", !0),
2971
+ te.value === "grid" && Ve.value && Ve.value.count > 1 ? (r(), u("div", Cs, [
2972
+ e("span", ys, [
2973
+ o[45] || (o[45] = e("span", { class: "vpg-stat-label" }, "Count:", -1)),
2974
+ e("span", bs, R(Ve.value.count), 1)
2975
+ ]),
2976
+ Ve.value.numericCount > 0 ? (r(), u(W, { key: 0 }, [
2977
+ o[48] || (o[48] = e("span", { class: "vpg-stat-divider" }, "|", -1)),
2978
+ e("span", Fs, [
2979
+ o[46] || (o[46] = e("span", { class: "vpg-stat-label" }, "Sum:", -1)),
2980
+ e("span", Ss, R(ht(Ve.value.sum)), 1)
2981
+ ]),
2982
+ o[49] || (o[49] = e("span", { class: "vpg-stat-divider" }, "|", -1)),
2983
+ e("span", Rs, [
2984
+ o[47] || (o[47] = e("span", { class: "vpg-stat-label" }, "Avg:", -1)),
2985
+ e("span", $s, R(ht(Ve.value.avg)), 1)
2986
+ ])
2987
+ ], 64)) : z("", !0)
2988
+ ])) : z("", !0),
2989
+ e("div", Ms, [
2990
+ S(y) ? (r(), u("div", xs, [...o[50] || (o[50] = [
2991
+ e("span", { class: "vpg-demo-badge" }, "DEMO", -1),
2992
+ e("span", null, "Pro features enabled", -1),
2993
+ e("a", {
2994
+ href: "https://tiny-pivot.com/#pricing",
2995
+ target: "_blank",
2996
+ rel: "noopener"
2997
+ }, "Get License →", -1)
2998
+ ])])) : S(v) ? (r(), u("span", Ts, [...o[51] || (o[51] = [
2999
+ e("a", {
3000
+ href: "https://tiny-pivot.com",
3001
+ target: "_blank",
3002
+ rel: "noopener"
3003
+ }, "TinyPivot", -1)
3004
+ ])])) : z("", !0)
3005
+ ])
3006
+ ]),
3007
+ t.enableVerticalResize ? (r(), u("div", {
3008
+ key: 2,
3009
+ class: "vpg-vertical-resize-handle",
3010
+ onMousedown: Ut
3011
+ }, [...o[52] || (o[52] = [
3012
+ e("div", { class: "vpg-resize-grip" }, [
3013
+ e("span"),
3014
+ e("span"),
3015
+ e("span")
3016
+ ], -1)
3017
+ ])], 32)) : z("", !0),
3018
+ (r(), io(co, { to: "body" }, [
3019
+ ne.value ? (r(), u("div", {
3020
+ key: 0,
3021
+ class: "vpg-filter-portal",
3022
+ style: ve({
3023
+ position: "fixed",
3024
+ top: `${Oe.value.top}px`,
3025
+ left: `${Oe.value.left}px`,
3026
+ maxHeight: `${Oe.value.maxHeight}px`,
3027
+ zIndex: 9999
3028
+ })
3029
+ }, [
3030
+ Ye(ln, {
3031
+ "column-id": ne.value,
3032
+ "column-name": ne.value,
3033
+ stats: S(ee)(ne.value),
3034
+ "selected-values": S(Ke)(ne.value),
3035
+ "sort-direction": S(re)(ne.value),
3036
+ onFilter: o[13] || (o[13] = (h) => Gt(ne.value, h)),
3037
+ onSort: o[14] || (o[14] = (h) => Xt(ne.value, h)),
3038
+ onClose: Ge
3039
+ }, null, 8, ["column-id", "column-name", "stats", "selected-values", "sort-direction"])
3040
+ ], 4)) : z("", !0)
3041
+ ]))
3042
+ ], 6));
3043
+ }
3044
+ }), Hs = /* @__PURE__ */ et(Vs, [["__scopeId", "data-v-2f0c0741"]]);
3045
+ export {
3046
+ ln as ColumnFilter,
3047
+ Hs as DataGrid,
3048
+ En as PivotConfig,
3049
+ zl as PivotSkeleton,
3050
+ Ps as configureLicenseSecret,
3051
+ Go as copyToClipboard,
3052
+ Ls as enableDemoMode,
3053
+ Oo as exportPivotToCSV,
3054
+ qo as exportToCSV,
3055
+ Co as formatCellValue,
3056
+ Xo as formatSelectionForClipboard,
3057
+ Rt as getAggregationLabel,
3058
+ ko as getColumnUniqueValues,
3059
+ As as setLicenseKey,
3060
+ js as useColumnResize,
3061
+ Ko as useExcelGrid,
3062
+ Ns as useGlobalSearch,
3063
+ Ie as useLicense,
3064
+ Es as usePagination,
3065
+ _o as usePivotTable,
3066
+ Bs as useRowSelection
3067
+ };
3068
+ //# sourceMappingURL=tinypivot-vue.js.map