@dcs-tech/ui 0.4.0 → 0.7.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.
Files changed (70) hide show
  1. package/README.md +27 -0
  2. package/dist/ChartImageMenu-C6MwKKjc.js +1494 -0
  3. package/dist/{ChartView-Cehrcr05.js → ChartView-nS4f4EU_.js} +514 -514
  4. package/dist/{SummaryChart-y27q_BBN.js → SummaryChart-CVg6i2mx.js} +2 -2
  5. package/dist/{SummaryImage-DDNEEu_K.js → SummaryImage-OHJHjCqe.js} +2 -2
  6. package/dist/{SummarySeeAll-0dX-_LFe.js → SummarySeeAll-BYrvXSJ6.js} +5 -5
  7. package/dist/assets/fileTask.worker-BHT1olUk.js +1 -0
  8. package/dist/columnValue-K98ElfJc.js +610 -0
  9. package/dist/exportContext-CJaIv8R-.js +166 -0
  10. package/dist/{exportEngine-DL-jEXFU.js → exportEngine-S8JHzYbS.js} +355 -356
  11. package/dist/file-worker.js +1 -0
  12. package/dist/fileActions-COf5Q4Eg.js +144 -0
  13. package/dist/{geometry-CG2nOEnw.js → geometry-ChwYB45B.js} +433 -497
  14. package/dist/index.js +8817 -8596
  15. package/dist/{defaults-DL745PK1.js → labels-CnqqTrne.js} +3 -79
  16. package/dist/runFileTask--4YjQH7Y.js +210 -0
  17. package/dist/scrollArea-DAlVT5U7.js +214 -0
  18. package/dist/style.css +1 -1
  19. package/dist/{summaryChartData-Djo73zb8.js → summaryChartData-pNvzaEHp.js} +1 -1
  20. package/dist/types/components/Charts/parts.d.ts +1 -1
  21. package/dist/types/components/Collapsible/index.d.ts +1 -1
  22. package/dist/types/components/DataTable/DataTable.d.ts +1 -1
  23. package/dist/types/components/DataTable/cards/cardFields.d.ts +2 -4
  24. package/dist/types/components/DataTable/columnValue.d.ts +19 -0
  25. package/dist/types/components/DataTable/export/exportCells.d.ts +13 -0
  26. package/dist/types/components/DataTable/export/exportEngine.d.ts +13 -4
  27. package/dist/types/components/DataTable/export/useTableExport.d.ts +2 -0
  28. package/dist/types/components/DataTable/host.d.ts +2 -0
  29. package/dist/types/components/DataTable/index.d.ts +1 -1
  30. package/dist/types/components/DataTable/labels.d.ts +2 -0
  31. package/dist/types/components/DataTable/types.d.ts +11 -0
  32. package/dist/types/components/DataTable/useTable.d.ts +4 -1
  33. package/dist/types/components/DataTable/vendor/index.d.ts +1 -1
  34. package/dist/types/components/Dialog/DialogHost.d.ts +1 -0
  35. package/dist/types/components/EditableTable/EditableTableCell.d.ts +1 -1
  36. package/dist/types/components/FileEngine/FileEngineContext.d.ts +17 -0
  37. package/dist/types/components/FileEngine/FileEngineProvider.d.ts +31 -0
  38. package/dist/types/components/FileEngine/FileJobsTray.d.ts +10 -0
  39. package/dist/types/components/FileEngine/index.d.ts +8 -0
  40. package/dist/types/components/FileEngine/labels.d.ts +29 -0
  41. package/dist/types/components/Toast/ToastHost.d.ts +1 -0
  42. package/dist/types/components/UIProvider/UIFormatContext.d.ts +7 -0
  43. package/dist/types/components/UIProvider/UIHostContext.d.ts +20 -0
  44. package/dist/types/components/UIProvider/UILabelsContext.d.ts +116 -0
  45. package/dist/types/components/UIProvider/UIProvider.d.ts +8 -1
  46. package/dist/types/components/UIProvider/index.d.ts +6 -0
  47. package/dist/types/core/logic/collapsible.logic.d.ts +6 -1
  48. package/dist/types/core/logic/datePicker.logic.d.ts +5 -0
  49. package/dist/types/core/logic/exportSafety.logic.d.ts +1 -0
  50. package/dist/types/core/logic/fileQueue.logic.d.ts +28 -0
  51. package/dist/types/core/logic/format.logic.d.ts +4 -0
  52. package/dist/types/core/logic/index.d.ts +4 -0
  53. package/dist/types/core/logic/tableDate.logic.d.ts +7 -0
  54. package/dist/types/core/logic/tableSummary.logic.d.ts +2 -2
  55. package/dist/types/core/types/collapsible.types.d.ts +4 -16
  56. package/dist/types/core/types/fileEngine.types.d.ts +116 -0
  57. package/dist/types/core/types/form.types.d.ts +4 -0
  58. package/dist/types/core/types/format.types.d.ts +15 -0
  59. package/dist/types/core/types/index.d.ts +2 -0
  60. package/dist/types/core/types/table.types.d.ts +1 -0
  61. package/dist/types/{components/DataTable/vendor → file}/fileActions.d.ts +17 -7
  62. package/dist/types/file/fileEngine.d.ts +49 -0
  63. package/dist/types/file/tasks/fileTask.worker.d.ts +1 -0
  64. package/dist/types/file/tasks/runFileTask.d.ts +9 -0
  65. package/dist/types/file/workerPool.d.ts +18 -0
  66. package/dist/types/index.d.ts +11 -2
  67. package/package.json +3 -2
  68. package/dist/ChartImageMenu-HILSfn5A.js +0 -1115
  69. package/dist/exportContext-CdpsOzE8.js +0 -235
  70. package/dist/scrollArea-CkPGDYH2.js +0 -210
@@ -1,9 +1,10 @@
1
1
  "use client";
2
- import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, u as p } from "./exportContext-CdpsOzE8.js";
3
- import m from "exceljs";
2
+ import { t as e } from "./runFileTask--4YjQH7Y.js";
3
+ import { a as t, c as n, f as r, i, l as a, n as o, o as s, s as c } from "./fileActions-COf5Q4Eg.js";
4
+ import { a as l, c as u, i as d, n as f, o as p, r as m, s as h } from "./exportContext-CJaIv8R-.js";
4
5
  // src/components/DataTable/export/exportEngine.ts
5
- var h = (e) => JSON.stringify(e).replace(/</g, "\\u003c");
6
- function g(e = "", t = {}, n) {
6
+ var g = (e) => JSON.stringify(e).replace(/</g, "\\u003c");
7
+ function _(e = "", t = {}, n) {
7
8
  let r = e && n ? n(String(e)) : void 0;
8
9
  return r ? {
9
10
  text: e,
@@ -14,7 +15,7 @@ function g(e = "", t = {}, n) {
14
15
  ...t
15
16
  };
16
17
  }
17
- function _(e, t) {
18
+ function v(e, t) {
18
19
  return t.map((t) => {
19
20
  let n = e.find((e) => (e.exportHeader || e.header) === t);
20
21
  if (!n) return { header: t };
@@ -22,7 +23,7 @@ function _(e, t) {
22
23
  return n.type && (r.type = n.type), n.align ? r.align = n.align : r.type === "number" && (r.align = "right"), n.width && (r.width = n.width), r.type === "number" ? r.format = "number" : r.type === "date" && (r.format = "date"), n.cellStyle && (r.cellStyle = n.cellStyle), r;
23
24
  });
24
25
  }
25
- function v(e, t, n, r, i) {
26
+ function y(e, t, n, r, i) {
26
27
  if (!n && !r) return null;
27
28
  let a = /* @__PURE__ */ new Set();
28
29
  if (n && r) for (let e of n) {
@@ -41,256 +42,244 @@ function v(e, t, n, r, i) {
41
42
  }
42
43
  return o;
43
44
  }
44
- function y(e, t, n, r, i, o) {
45
- let s = (e) => {
45
+ function b(e, t, n, r, i, a) {
46
+ let o = (e) => {
46
47
  if (e == null) return "";
47
48
  let t = String(e);
48
49
  return t.includes(",") || t.includes("\"") || t.includes("\n") ? `"${t.replace(/"/g, "\"\"")}"` : t;
49
- }, c = [];
50
+ }, s = [];
50
51
  if (i) {
51
- let e = d(i);
52
- for (let [t, n] of e) c.push(`${s(t)},${s(n)}`);
53
- o && c.push(s(o)), c.push("");
54
- } else o && (c.push(s(o)), c.push(""));
55
- if (c.push(e.map(s).join(","), ...t.map((t) => e.map((e) => s(t[e])).join(","))), n && c.push(e.map((e) => s(n[e])).join(",")), r && Object.keys(r.items).length > 0) {
56
- c.push(""), c.push(s(a(i).exportSummaryLabel));
57
- for (let [e, t] of Object.entries(r.items)) c.push(`${s(e)},${s(t)}`);
52
+ let e = m(i);
53
+ for (let [t, n] of e) s.push(`${o(t)},${o(n)}`);
54
+ a && s.push(o(a)), s.push("");
55
+ } else a && (s.push(o(a)), s.push(""));
56
+ if (s.push(e.map(o).join(","), ...t.map((t) => e.map((e) => o(t[e])).join(","))), n && s.push(e.map((e) => o(n[e])).join(",")), r && Object.keys(r.items).length > 0) {
57
+ s.push(""), s.push(o(d(i).exportSummaryLabel));
58
+ for (let [e, t] of Object.entries(r.items)) s.push(`${o(e)},${o(t)}`);
58
59
  }
59
60
  for (let e of r?.tables ?? []) {
60
- c.push(""), c.push(s(e.title)), c.push(e.header.map(s).join(","));
61
- for (let t of e.rows) c.push(`${s(t.label)},${s(t.count)}`);
61
+ s.push(""), s.push(o(e.title)), s.push(e.header.map(o).join(","));
62
+ for (let t of e.rows) s.push(`${o(t.label)},${o(t.count)}`);
62
63
  }
63
- return new Blob(["" + c.join("\n")], { type: "text/csv;charset=utf-8;" });
64
+ return new Blob(["" + s.join("\n")], { type: "text/csv;charset=utf-8;" });
64
65
  }
65
- function b(e) {
66
- if (e) switch (e.format) {
67
- case "currency": return "#,##0.00";
68
- case "number": return "#,##0";
69
- case "percentage": return "0.00%";
70
- case "date": return "DD/MM/YYYY";
71
- default: return;
66
+ function x(e) {
67
+ if (e) {
68
+ if (e.numFmt) return e.numFmt;
69
+ switch (e.format) {
70
+ case "currency": return "#,##0.00";
71
+ case "number": return "#,##0";
72
+ case "percentage": return "0.00%";
73
+ case "date": return "DD/MM/YYYY";
74
+ default: return;
75
+ }
72
76
  }
73
77
  }
74
- async function x(t, n, r) {
75
- let { totals: i, summary: o, style: s, sheetName: l, columnMeta: u, cellStyles: d, metadata: f, subtitle: p } = r || {}, h = new m.Workbook(), g = h.addWorksheet(l || "Sheet1"), _ = 0;
76
- if (f) {
77
- if (f.businessName) {
78
- let e = g.addRow([f.businessName]);
79
- e.getCell(1).font = {
80
- bold: !0,
81
- size: 14
82
- }, t.length > 1 && g.mergeCells(1, 1, 1, t.length), _++;
83
- }
84
- let n = [];
85
- if (f.businessAddress && n.push(f.businessAddress), f.businessPhone && n.push(f.businessPhone), n.length > 0) {
86
- let e = g.addRow([n.join(" | ")]);
87
- e.getCell(1).font = {
88
- size: 10,
89
- color: { argb: "FF666666" }
90
- }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
91
- }
92
- if (f.taxNumber) {
93
- let n = g.addRow([`${e(f)}: ${f.taxNumber}`]);
94
- n.getCell(1).font = { size: 10 }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
95
- }
96
- if (p) {
97
- let e = g.addRow([p]);
98
- e.getCell(1).font = {
99
- size: 10,
100
- italic: !0,
101
- color: { argb: "FF555555" }
102
- }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
103
- }
104
- let r = c(f);
105
- if (r) {
106
- let e = g.addRow([r]);
107
- e.getCell(1).font = {
108
- size: 9,
109
- italic: !0
110
- }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
111
- }
112
- g.addRow([]), _++;
113
- } else if (p) {
114
- let e = 0, n = g.addRow([p]);
115
- n.getCell(1).font = {
78
+ var S = (e) => e ? {
79
+ ...e.align ? { align: e.align } : {},
80
+ ...e.fontWeight === "bold" ? { bold: !0 } : {},
81
+ ...e.color ? { color: e.color } : {},
82
+ ...e.fontSize ? { size: e.fontSize } : {},
83
+ ...e.backgroundColor ? { fill: e.backgroundColor } : {}
84
+ } : void 0;
85
+ function C(e, t, n) {
86
+ let { totals: r, summary: i, style: a, sheetName: o, columnMeta: s, cellStyles: c, metadata: u, subtitle: p } = n || {}, m = [], h = (e, t) => m.push({
87
+ values: [e],
88
+ style: t,
89
+ merge: !0
90
+ });
91
+ if (u) {
92
+ u.businessName && h(u.businessName, {
93
+ bold: !0,
94
+ size: 14
95
+ });
96
+ let e = [u.businessAddress, u.businessPhone].filter(Boolean);
97
+ e.length > 0 && h(e.join(" | "), {
98
+ size: 10,
99
+ color: "#666666"
100
+ }), u.taxNumber && h(`${l(u)}: ${u.taxNumber}`, { size: 10 }), p && h(p, {
116
101
  size: 10,
117
102
  italic: !0,
118
- color: { argb: "FF555555" }
119
- }, t.length > 1 && g.mergeCells(1, 1, 1, t.length), e++, g.addRow([]), e++, _ += e;
120
- }
121
- let v = _ + 1, y = s?.headerStyle?.fill || "#1a73e8", x = s?.headerStyle?.fontColor || "#FFFFFF", S = s?.headerStyle?.bold !== !1;
122
- if (g.columns = t.map((e, t) => {
123
- let r = u?.[t], i = s?.columnStyles?.[e]?.width || r?.width;
124
- if (!i) {
125
- let t = Math.max(e.length, ...n.slice(0, 50).map((t) => String(t[e] ?? "").length));
126
- i = Math.min(Math.max(t + 2, 10), 40);
103
+ color: "#555555"
104
+ });
105
+ let t = f(u);
106
+ t && h(t, {
107
+ size: 9,
108
+ italic: !0
109
+ }), m.push({ values: [] });
110
+ } else p && (h(p, {
111
+ size: 10,
112
+ italic: !0,
113
+ color: "#555555"
114
+ }), m.push({ values: [] }));
115
+ let g = m.length + 1, _ = e.map((e, n) => {
116
+ let r = s?.[n], i = a?.columnStyles?.[e], o = i?.width || r?.width;
117
+ if (!o) {
118
+ let n = Math.max(e.length, ...t.slice(0, 50).map((t) => String(t[e] ?? "").length));
119
+ o = Math.min(Math.max(n + 2, 10), 40);
127
120
  }
128
- return _ > 0 ? {
129
- key: e,
130
- width: i
131
- } : {
121
+ let c = i?.numFmt || x(r), l = i?.align || r?.align;
122
+ return {
132
123
  header: e,
133
- key: e,
134
- width: i
124
+ width: o,
125
+ ...c ? { numFmt: c } : {},
126
+ ...l ? { align: l } : {},
127
+ ...i?.bold ? { style: { bold: !0 } } : {}
135
128
  };
136
- }), _ > 0 && g.addRow(t), g.getRow(v).eachCell((e, n) => {
137
- let r = u?.[n - 1], i = s?.columnStyles?.[t[n - 1]]?.align;
138
- e.font = {
139
- bold: S,
140
- color: { argb: x.replace("#", "FF") },
141
- size: s?.headerStyle?.fontSize || 11
142
- }, e.fill = {
143
- type: "pattern",
144
- pattern: "solid",
145
- fgColor: { argb: y.replace("#", "FF") }
146
- }, e.alignment = {
147
- horizontal: i || r?.align || "left",
148
- vertical: "middle"
149
- }, e.border = { bottom: {
150
- style: "thin",
151
- color: { argb: "FF999999" }
152
- } };
153
- }), g.views = [{
154
- state: "frozen",
155
- ySplit: s?.freezeRows ?? v,
156
- xSplit: s?.freezeCols || 0
157
- }], n.forEach((e, n) => {
158
- let r = g.addRow(t.map((t) => e[t] ?? "")), i = n % 2 == 1;
159
- r.eachCell((e, r) => {
160
- let a = u?.[r - 1], o = t[r - 1], c = s?.columnStyles?.[o], l = d?.[n]?.[o], f = l?.align || c?.align || a?.align;
161
- f && (e.alignment = {
162
- horizontal: f,
163
- vertical: "middle"
164
- });
165
- let p = c?.numFmt || b(a);
166
- p && typeof e.value == "number" && (e.numFmt = p);
167
- let m = {};
168
- (c?.bold || l?.fontWeight === "bold") && (m.bold = !0), l?.color && (m.color = { argb: "FF" + l.color.replace("#", "") }), l?.fontSize && (m.size = l.fontSize), Object.keys(m).length > 0 && (e.font = m), l?.backgroundColor ? e.fill = {
169
- type: "pattern",
170
- pattern: "solid",
171
- fgColor: { argb: "FF" + l.backgroundColor.replace("#", "") }
172
- } : i && (e.fill = {
173
- type: "pattern",
174
- pattern: "solid",
175
- fgColor: { argb: "FFF8F9FA" }
176
- });
177
- });
178
- }), i) {
179
- let e = t.map((e) => i[e] ?? ""), n = g.addRow(e), r = s?.totalsStyle?.fill || "#e8e8e8", a = s?.totalsStyle?.bold !== !1, o = s?.totalsStyle?.border || "thin";
180
- n.eachCell((e, n) => {
181
- let c = u?.[n - 1], l = t[n - 1], d = s?.columnStyles?.[l], f = c?.cellStyle?.(i[l], {}), p = f?.align || d?.align || c?.align, m = { bold: a };
182
- f?.color && (m.color = { argb: "FF" + f.color.replace("#", "") }), f?.fontSize && (m.size = f.fontSize), e.font = m, e.fill = f?.backgroundColor ? {
183
- type: "pattern",
184
- pattern: "solid",
185
- fgColor: { argb: "FF" + f.backgroundColor.replace("#", "") }
186
- } : {
187
- type: "pattern",
188
- pattern: "solid",
189
- fgColor: { argb: r.replace("#", "FF") }
190
- }, e.border = { top: {
191
- style: o,
192
- color: { argb: "FF333333" }
193
- } }, p && (e.alignment = {
194
- horizontal: p,
195
- vertical: "middle"
196
- });
197
- let h = d?.numFmt || b(c);
198
- h && typeof e.value == "number" && (e.numFmt = h);
129
+ }), v = [];
130
+ if (r) {
131
+ let t = {};
132
+ e.forEach((e, n) => {
133
+ let i = S(s?.[n]?.cellStyle?.(r[e], {})), a = _[n].numFmt, o = _[n].align;
134
+ t[n] = {
135
+ ...o ? { align: o } : {},
136
+ ...a ? { numFmt: a } : {},
137
+ ...i
138
+ };
139
+ }), v.push({
140
+ values: e.map((e) => r[e] ?? ""),
141
+ style: {
142
+ bold: a?.totalsStyle?.bold !== !1,
143
+ fill: a?.totalsStyle?.fill || "#e8e8e8",
144
+ borderTop: {
145
+ style: a?.totalsStyle?.border || "thin",
146
+ color: "#333333"
147
+ }
148
+ },
149
+ cells: t
199
150
  });
200
151
  }
201
- if (s?.autoFilter !== !1 && n.length > 0 && (g.autoFilter = {
202
- from: {
203
- row: v,
204
- column: 1
205
- },
206
- to: {
207
- row: v,
208
- column: t.length
209
- }
210
- }), o && Object.keys(o.items).length > 0) {
211
- g.addRow([]);
212
- let e = g.addRow([a(f).exportSummaryLabel]);
213
- e.getCell(1).font = {
214
- bold: !0,
215
- size: 12
216
- };
217
- for (let [e, t] of Object.entries(o.items)) {
218
- let n = g.addRow([e, t]);
219
- n.getCell(1).font = { bold: !0 }, typeof t == "number" && (n.getCell(2).numFmt = "#,##0.00");
220
- }
152
+ if (i && Object.keys(i.items).length > 0) {
153
+ v.push({ values: [] }), v.push({
154
+ values: [d(u).exportSummaryLabel],
155
+ style: {
156
+ bold: !0,
157
+ size: 12
158
+ }
159
+ });
160
+ for (let [e, t] of Object.entries(i.items)) v.push({
161
+ values: [e, t],
162
+ cells: {
163
+ 0: { bold: !0 },
164
+ 1: { numFmt: "#,##0.00" }
165
+ }
166
+ });
221
167
  }
222
- for (let e of o?.tables ?? []) {
223
- g.addRow([]), g.addRow([e.title]).getCell(1).font = {
224
- bold: !0,
225
- size: 12
226
- };
227
- let t = g.addRow(e.header);
228
- t.font = { bold: !0 }, t.eachCell((e) => {
229
- e.border = { bottom: { style: "thin" } };
168
+ for (let e of i?.tables ?? []) {
169
+ v.push({ values: [] }), v.push({
170
+ values: [e.title],
171
+ style: {
172
+ bold: !0,
173
+ size: 12
174
+ }
175
+ }), v.push({
176
+ values: e.header,
177
+ style: {
178
+ bold: !0,
179
+ borderBottom: { style: "thin" }
180
+ }
181
+ });
182
+ for (let t of e.rows) v.push({
183
+ values: [t.label, t.count],
184
+ cells: { 1: { numFmt: "#,##0" } }
230
185
  });
231
- for (let t of e.rows) g.addRow([t.label, t.count]).getCell(2).numFmt = "#,##0";
232
186
  }
233
- let C = await h.xlsx.writeBuffer();
234
- return new Blob([C], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
187
+ return { sheets: [{
188
+ name: o || "Sheet1",
189
+ columns: _,
190
+ rows: t.map((t) => e.map((e) => t[e] ?? "")),
191
+ before: m,
192
+ after: v,
193
+ headerStyle: {
194
+ bold: a?.headerStyle?.bold !== !1,
195
+ color: a?.headerStyle?.fontColor || "#FFFFFF",
196
+ size: a?.headerStyle?.fontSize || 11,
197
+ fill: a?.headerStyle?.fill || "#1a73e8",
198
+ borderBottom: {
199
+ style: "thin",
200
+ color: "#999999"
201
+ }
202
+ },
203
+ stripe: "#F8F9FA",
204
+ cellStyles: c?.map((t) => {
205
+ let n = {};
206
+ return e.forEach((e, r) => {
207
+ let i = S(t?.[e]);
208
+ i && (n[r] = i);
209
+ }), n;
210
+ }),
211
+ autoFilter: a?.autoFilter !== !1,
212
+ freeze: {
213
+ rows: a?.freezeRows ?? g,
214
+ cols: a?.freezeCols || 0
215
+ }
216
+ }] };
217
+ }
218
+ async function w(t, n, r) {
219
+ let i = await e({
220
+ kind: "xlsx",
221
+ workbook: C(t, n, r)
222
+ }, { progress: () => {} });
223
+ return new Blob([i], { type: o.xlsx });
235
224
  }
236
- function S(t, n, r, i) {
237
- let a = n ? {
238
- ...n.items,
239
- ...n.tables?.length ? { tables: n.tables.map((e) => ({
225
+ function T(e, t, n, r) {
226
+ let i = t ? {
227
+ ...t.items,
228
+ ...t.tables?.length ? { tables: t.tables.map((e) => ({
240
229
  title: e.title,
241
230
  header: e.header,
242
231
  rows: e.rows
243
232
  })) } : {}
244
233
  } : void 0;
245
- if (r) {
246
- let n = { exportedAt: (/* @__PURE__ */ new Date()).toISOString() };
247
- i && (n.subtitle = i), r.businessName && (n.businessName = r.businessName), r.businessAddress && (n.businessAddress = r.businessAddress), r.businessPhone && (n.businessPhone = r.businessPhone), r.taxNumber && (n[e(r)] = r.taxNumber), r.searchTerm && (n.search = r.searchTerm), r.filters && r.filters.length > 0 && (n.filters = r.filters), n.rows = {
248
- total: r.totalRows,
249
- filtered: r.filteredRows,
250
- exported: r.resultRows,
251
- selected: r.selectedRows
234
+ if (n) {
235
+ let t = { exportedAt: (/* @__PURE__ */ new Date()).toISOString() };
236
+ r && (t.subtitle = r), n.businessName && (t.businessName = n.businessName), n.businessAddress && (t.businessAddress = n.businessAddress), n.businessPhone && (t.businessPhone = n.businessPhone), n.taxNumber && (t[l(n)] = n.taxNumber), n.searchTerm && (t.search = n.searchTerm), n.filters && n.filters.length > 0 && (t.filters = n.filters), t.rows = {
237
+ total: n.totalRows,
238
+ filtered: n.filteredRows,
239
+ exported: n.resultRows,
240
+ selected: n.selectedRows
252
241
  };
253
- let o = {
254
- metadata: n,
255
- data: t
242
+ let a = {
243
+ metadata: t,
244
+ data: e
256
245
  };
257
- return a && (o.summary = a), new Blob([JSON.stringify(o, null, 2)], { type: "application/json" });
246
+ return i && (a.summary = i), new Blob([JSON.stringify(a, null, 2)], { type: "application/json" });
258
247
  }
259
- let o = i ? {
260
- subtitle: i,
261
- data: t
262
- } : a ? {
263
- data: t,
264
- summary: a
265
- } : t;
266
- return a && i && (o.summary = a), new Blob([JSON.stringify(o, null, 2)], { type: "application/json" });
248
+ let a = r ? {
249
+ subtitle: r,
250
+ data: e
251
+ } : i ? {
252
+ data: e,
253
+ summary: i
254
+ } : e;
255
+ return i && r && (a.summary = i), new Blob([JSON.stringify(a, null, 2)], { type: "application/json" });
267
256
  }
268
- function C(t, n, r) {
269
- let { title: i, subtitle: o, totals: s, summary: l, customStyles: u, columnMeta: d, cellStyles: f, metadata: p, branding: m } = r || {}, g = a(p), _ = m ? `<footer class="export-footer">
270
- ${D(g.exportGeneratedFrom)} <strong>${D(m.name)}</strong>${m.url ? ` &mdash; <a href="${D(m.url)}" target="_blank" rel="noopener">${D(m.url.replace(/^https?:\/\//, ""))}</a>` : ""}
257
+ function E(e, t, n) {
258
+ let { title: r, subtitle: i, totals: a, summary: o, customStyles: s, columnMeta: c, cellStyles: u, metadata: p, branding: m } = n || {}, h = d(p), _ = m ? `<footer class="export-footer">
259
+ ${j(h.exportGeneratedFrom)} <strong>${j(m.name)}</strong>${m.url ? ` &mdash; <a href="${j(m.url)}" target="_blank" rel="noopener">${j(m.url.replace(/^https?:\/\//, ""))}</a>` : ""}
271
260
  </footer>` : "", v = (e) => e == null ? "" : String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), y = (e) => {
272
- let t = d?.[e];
261
+ let t = c?.[e];
273
262
  return t?.align ? ` style="text-align:${t.align}"` : "";
274
263
  }, b = (e, t, n) => {
275
- let r = [], i = d?.[n];
264
+ let r = [], i = c?.[n];
276
265
  i?.align && r.push(`text-align:${i.align}`);
277
- let a = f?.[e]?.[t];
266
+ let a = u?.[e]?.[t];
278
267
  return a && (a.color && r.push(`color:${a.color}`), a.backgroundColor && r.push(`background:${a.backgroundColor}`), a.fontWeight && r.push(`font-weight:${a.fontWeight}`), a.fontSize && r.push(`font-size:${a.fontSize}px`), a.align && r.push(`text-align:${a.align}`)), r.length > 0 ? ` style="${r.join(";")}"` : i?.align ? ` style="text-align:${i.align}"` : "";
279
268
  };
280
- t.map((e, t) => `<th${y(t)}>${v(e)}</th>`).join("");
281
- let x = n.map((e, n) => `<tr>${t.map((t, r) => `<td${b(n, t, r)}>${v(e[t])}</td>`).join("")}</tr>`).join("\n"), S = s ? `<tr class="totals">${t.map((e, t) => {
282
- let n = d?.[t]?.cellStyle?.(s[e], {}), r = [], i = d?.[t];
283
- return i?.align && r.push(`text-align:${i.align}`), n?.color && r.push(`color:${n.color}`), n?.backgroundColor && r.push(`background:${n.backgroundColor}`), n?.fontWeight && r.push(`font-weight:${n.fontWeight}`), n?.fontSize && r.push(`font-size:${n.fontSize}px`), n?.align && r.push(`text-align:${n.align}`), `<td${r.length > 0 ? ` style="${r.join(";")}"` : ""}>${v(s[e])}</td>`;
284
- }).join("")}</tr>` : "", C = l && Object.keys(l.items).length > 0 ? `<h3>Summary</h3><dl>${Object.entries(l.items).map(([e, t]) => `<dt>${v(e)}</dt><dd>${v(t)}</dd>`).join("")}</dl>` : "", w = (l?.tables ?? []).map((e) => `<div class="summary-group"><h4>${v(e.title)}</h4><table class="summary-table"><thead><tr><th>${v(e.header[0])}</th><th class="num">${v(e.header[1])}</th></tr></thead><tbody>${e.rows.map((e) => `<tr><td>${v(e.label)}</td><td class="num">${v(e.count)}</td></tr>`).join("")}</tbody></table></div>`).join(""), T = C || w ? `<div class="summary">${C}${w}</div>` : "", E = (/* @__PURE__ */ new Date()).toLocaleDateString(p?.locale || "en-IN", {
269
+ e.map((e, t) => `<th${y(t)}>${v(e)}</th>`).join("");
270
+ let x = t.map((t, n) => `<tr>${e.map((e, r) => `<td${b(n, e, r)}>${v(t[e])}</td>`).join("")}</tr>`).join("\n"), S = a ? `<tr class="totals">${e.map((e, t) => {
271
+ let n = c?.[t]?.cellStyle?.(a[e], {}), r = [], i = c?.[t];
272
+ return i?.align && r.push(`text-align:${i.align}`), n?.color && r.push(`color:${n.color}`), n?.backgroundColor && r.push(`background:${n.backgroundColor}`), n?.fontWeight && r.push(`font-weight:${n.fontWeight}`), n?.fontSize && r.push(`font-size:${n.fontSize}px`), n?.align && r.push(`text-align:${n.align}`), `<td${r.length > 0 ? ` style="${r.join(";")}"` : ""}>${v(a[e])}</td>`;
273
+ }).join("")}</tr>` : "", C = o && Object.keys(o.items).length > 0 ? `<h3>Summary</h3><dl>${Object.entries(o.items).map(([e, t]) => `<dt>${v(e)}</dt><dd>${v(t)}</dd>`).join("")}</dl>` : "", w = (o?.tables ?? []).map((e) => `<div class="summary-group"><h4>${v(e.title)}</h4><table class="summary-table"><thead><tr><th>${v(e.header[0])}</th><th class="num">${v(e.header[1])}</th></tr></thead><tbody>${e.rows.map((e) => `<tr><td>${v(e.label)}</td><td class="num">${v(e.count)}</td></tr>`).join("")}</tbody></table></div>`).join(""), T = C || w ? `<div class="summary">${C}${w}</div>` : "", E = (/* @__PURE__ */ new Date()).toLocaleDateString(p?.locale || void 0, {
285
274
  day: "2-digit",
286
275
  month: "2-digit",
287
276
  year: "numeric"
288
- }), O = `<!DOCTYPE html>
277
+ }), D = `<!DOCTYPE html>
289
278
  <html lang="${v((p?.locale || "en").split("-")[0])}" data-theme="system">
290
279
  <head>
291
280
  <meta charset="UTF-8">
292
281
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
293
- <title>${v(i || g.export)}</title>
282
+ <title>${v(r || h.export)}</title>
294
283
  <style>
295
284
  :root{--bg:#ffffff;--bg-alt:#f8f9fa;--bg-hover:#f0f4ff;--text:#1a1a1a;--text-secondary:#666;--text-muted:#888;--border:#e8e8e8;--border-strong:#333;--th-bg:#1a73e8;--th-bg-hover:#1557b0;--th-color:#fff;--input-border:#d0d0d0;--input-focus:#1a73e8;--meta-bg:#f8f9fa;--meta-border:#e8e8e8;--summary-bg:#f8f9fa;--totals-bg:#f5f5f5;--btn-bg:#1a73e8;--btn-color:#fff;--btn-hover:#1557b0;--btn-secondary-bg:#f0f0f0;--btn-secondary-color:#333;--btn-secondary-hover:#e0e0e0;--footer-bg:#f8f9fa;--footer-border:#e8e8e8}
296
285
  [data-theme="dark"]{--bg:#1a1a2e;--bg-alt:#16213e;--bg-hover:#1a2745;--text:#e0e0e0;--text-secondary:#aaa;--text-muted:#888;--border:#2a2a4a;--border-strong:#555;--th-bg:#0f3460;--th-bg-hover:#1a4a7a;--th-color:#e0e0e0;--input-border:#3a3a5a;--input-focus:#4a8fe8;--meta-bg:#16213e;--meta-border:#2a2a4a;--summary-bg:#16213e;--totals-bg:#1a2745;--btn-bg:#0f3460;--btn-color:#e0e0e0;--btn-hover:#1a4a7a;--btn-secondary-bg:#2a2a4a;--btn-secondary-color:#ccc;--btn-secondary-hover:#3a3a5a;--footer-bg:#16213e;--footer-border:#2a2a4a}
@@ -351,37 +340,37 @@ tr.hidden-row{display:none}
351
340
  @media(max-width:768px){body{padding:12px}th,td{padding:7px 8px;font-size:12px}.toolbar{flex-direction:column;align-items:stretch}.toolbar input{min-width:unset}.toolbar-actions{justify-content:space-between;flex-wrap:wrap}}
352
341
  @media(max-width:480px){th,td{padding:5px 6px;font-size:11px}.export-meta{padding:10px}.export-meta h2{font-size:15px}.btn{padding:5px 10px;font-size:11px}}
353
342
  @media print{.toolbar,.toolbar-actions,.theme-toggle,.export-footer{display:none!important}body{padding:0;background:#fff!important;color:#000!important}th{background:#e8e8e8!important;color:#000!important;-webkit-print-color-adjust:exact;print-color-adjust:exact;cursor:default}td{border-color:#ccc!important}tr:nth-child(even){background:#f5f5f5!important}tr:hover td{background:transparent!important}.totals td{background:#eee!important}.export-meta,.summary{background:#f8f8f8!important;border-color:#ddd!important;color:#000!important}.export-meta h2,.export-meta h3,.summary h3{color:#000!important}.meta-details,.meta-filters,.meta-rows,.summary dt{color:#444!important}.summary dd{color:#000!important}tr{page-break-inside:avoid}.generated-info{color:#666!important}}
354
- ${u || ""}
343
+ ${s || ""}
355
344
  </style>
356
345
  </head>
357
346
  <body>
358
347
  ${p ? (() => {
359
- let t = ["<div class=\"export-meta\">"];
360
- p.businessName && t.push(`<h2>${v(p.businessName)}</h2>`);
361
- let n = [];
362
- p.businessAddress && n.push(`<span>${v(p.businessAddress)}</span>`), p.businessPhone && n.push(`<span>${v(p.businessPhone)}</span>`), p.taxNumber && n.push(`<span>${v(e(p))}: ${v(p.taxNumber)}</span>`), n.length > 0 && t.push(`<div class="meta-details">${n.join("")}</div>`), i && t.push(`<h3 style="margin:8px 0 4px;font-size:15px">${v(i)}</h3>`), o && t.push(`<div style="font-size:12px;color:var(--text-secondary);margin-bottom:4px">${v(o)}</div>`);
363
- let r = c(p);
364
- return r && t.push(`<div class="meta-filters">${v(r)}</div>`), t.push("</div>"), t.join("\n");
348
+ let e = ["<div class=\"export-meta\">"];
349
+ p.businessName && e.push(`<h2>${v(p.businessName)}</h2>`);
350
+ let t = [];
351
+ p.businessAddress && t.push(`<span>${v(p.businessAddress)}</span>`), p.businessPhone && t.push(`<span>${v(p.businessPhone)}</span>`), p.taxNumber && t.push(`<span>${v(l(p))}: ${v(p.taxNumber)}</span>`), t.length > 0 && e.push(`<div class="meta-details">${t.join("")}</div>`), r && e.push(`<h3 style="margin:8px 0 4px;font-size:15px">${v(r)}</h3>`), i && e.push(`<div style="font-size:12px;color:var(--text-secondary);margin-bottom:4px">${v(i)}</div>`);
352
+ let n = f(p);
353
+ return n && e.push(`<div class="meta-filters">${v(n)}</div>`), e.push("</div>"), e.join("\n");
365
354
  })() : ""}
366
- ${!p && i ? `<h1>${v(i)}</h1>` : ""}
367
- ${!p && o ? `<p class="subtitle">${v(o)}</p>` : ""}
355
+ ${!p && r ? `<h1>${v(r)}</h1>` : ""}
356
+ ${!p && i ? `<p class="subtitle">${v(i)}</p>` : ""}
368
357
  <div class="toolbar">
369
- <input type="text" id="globalSearch" placeholder="${v(g.exportHtmlSearch)}" aria-label="${v(g.exportHtmlSearch)}" autocomplete="off">
370
- <span class="count" id="rowCount">${v(g.rowsInfo(String(n.length)))}</span>
358
+ <input type="text" id="globalSearch" placeholder="${v(h.exportHtmlSearch)}" aria-label="${v(h.exportHtmlSearch)}" autocomplete="off">
359
+ <span class="count" id="rowCount">${v(h.rowsInfo(String(t.length)))}</span>
371
360
  <div class="toolbar-actions">
372
- <button class="btn btn-primary" id="btnDownload" title="${v(g.exportDownloadAs("HTML"))}"><svg viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>${v(g.exportDownload)}</button>
373
- <button class="btn btn-secondary" id="btnPrint" title="${v(g.exportPrint)}"><svg viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>${v(g.exportPrint)}</button>
361
+ <button class="btn btn-primary" id="btnDownload" title="${v(h.exportDownloadAs("HTML"))}"><svg viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>${v(h.exportDownload)}</button>
362
+ <button class="btn btn-secondary" id="btnPrint" title="${v(h.exportPrint)}"><svg viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>${v(h.exportPrint)}</button>
374
363
  <div class="theme-toggle">
375
- <button data-theme-val="light" title="${v(g.exportThemeLight)}" aria-label="${v(g.exportThemeLight)}">&#9788;</button>
376
- <button data-theme-val="dark" title="${v(g.exportThemeDark)}" aria-label="${v(g.exportThemeDark)}">&#9790;</button>
377
- <button data-theme-val="system" title="${v(g.exportThemeSystem)}" aria-label="${v(g.exportThemeSystem)}" class="active">&#9881;</button>
364
+ <button data-theme-val="light" title="${v(h.exportThemeLight)}" aria-label="${v(h.exportThemeLight)}">&#9788;</button>
365
+ <button data-theme-val="dark" title="${v(h.exportThemeDark)}" aria-label="${v(h.exportThemeDark)}">&#9790;</button>
366
+ <button data-theme-val="system" title="${v(h.exportThemeSystem)}" aria-label="${v(h.exportThemeSystem)}" class="active">&#9881;</button>
378
367
  </div>
379
368
  </div>
380
369
  </div>
381
- <div class="generated-info">${v(g.exportGeneratedOn(E))}</div>
370
+ <div class="generated-info">${v(h.exportGeneratedOn(E))}</div>
382
371
  <div class="dt-wrapper">
383
372
  <table id="dataTable">
384
- <thead><tr>${t.map((e, t) => `<th data-col="${t}"${y(t)}>${v(e)}<span class="sort-icon"></span></th>`).join("")}</tr></thead>
373
+ <thead><tr>${e.map((e, t) => `<th data-col="${t}"${y(t)}>${v(e)}<span class="sort-icon"></span></th>`).join("")}</tr></thead>
385
374
  <tbody>
386
375
  ${x}
387
376
  </tbody>
@@ -409,7 +398,7 @@ var show=!q||text.indexOf(q)>=0;
409
398
  r.classList.toggle('hidden-row',!show);
410
399
  if(show)visible++;
411
400
  });
412
- countEl.textContent=q?${h(g.rowsInfoFiltered("{v}", "{t}"))}.replace('{v}',visible).replace('{t}',total):${h(g.rowsInfo("{t}"))}.replace('{t}',total);
401
+ countEl.textContent=q?${g(h.rowsInfoFiltered("{v}", "{t}"))}.replace('{v}',visible).replace('{t}',total):${g(h.rowsInfo("{t}"))}.replace('{t}',total);
413
402
  });
414
403
 
415
404
  // Sort
@@ -468,9 +457,9 @@ this.classList.add('active');
468
457
  <\/script>
469
458
  </body>
470
459
  </html>`;
471
- return new Blob([O], { type: "text/html;charset=utf-8;" });
460
+ return new Blob([D], { type: "text/html;charset=utf-8;" });
472
461
  }
473
- var w = {
462
+ var D = {
474
463
  A4: {
475
464
  w: 595.28,
476
465
  h: 841.89
@@ -496,7 +485,7 @@ var w = {
496
485
  h: 1224
497
486
  }
498
487
  };
499
- function T(e, t, n, r) {
488
+ function O(e, t, n, r) {
500
489
  e.length;
501
490
  let i = e.map((e, i) => {
502
491
  let a = r?.columnStyles?.[e]?.width;
@@ -541,7 +530,7 @@ function T(e, t, n, r) {
541
530
  minFont: 6
542
531
  }
543
532
  ]) {
544
- let t = w[e.size], n = ((e.orient === "landscape" ? t.h : t.w) - e.margin * 2) / i;
533
+ let t = D[e.size], n = ((e.orient === "landscape" ? t.h : t.w) - e.margin * 2) / i;
545
534
  if (n >= .85) {
546
535
  let t = Math.max(e.minFont, Math.min(9, Math.round(9 * Math.min(n, 1))));
547
536
  return {
@@ -569,62 +558,63 @@ function T(e, t, n, r) {
569
558
  ]
570
559
  };
571
560
  }
572
- function E(t, n, r) {
573
- let { pdfConfig: i, totals: o, summary: s, subtitle: l, columnMeta: u, cellStyles: d, metadata: f, fontFor: p } = r || {}, m = a(f), h = (/* @__PURE__ */ new Date()).toLocaleDateString(f?.locale), _ = i?.title || m.export, v = i?.autoFit !== !1, y = i?.pageSize || "A4", b = i?.orientation || "portrait", x = i?.fontSize || 9, S = [
561
+ var k = "dcsTable";
562
+ function A(e, t, n) {
563
+ let { pdfConfig: r, totals: i, summary: a, subtitle: o, columnMeta: s, cellStyles: c, metadata: u, fontFor: p, fonts: m } = n || {}, h = d(u), g = (/* @__PURE__ */ new Date()).toLocaleDateString(u?.locale), v = r?.title || h.export, y = r?.autoFit !== !1, b = r?.pageSize || "A4", x = r?.orientation || "portrait", S = r?.fontSize || 9, C = [
574
564
  30,
575
565
  30,
576
566
  30,
577
567
  40
578
568
  ];
579
- if (v && !i?.orientation && !i?.pageSize) {
580
- let e = T(t, n, u, i);
581
- y = e.pageSize, b = e.orientation, i?.fontSize || (x = e.fontSize), S = e.margins;
569
+ if (y && !r?.orientation && !r?.pageSize) {
570
+ let n = O(e, t, s, r);
571
+ b = n.pageSize, x = n.orientation, r?.fontSize || (S = n.fontSize), C = n.margins;
582
572
  }
583
- i?.margin && (S = typeof i.margin == "number" ? [
584
- i.margin,
585
- i.margin,
586
- i.margin,
587
- i.margin
573
+ r?.margin && (C = typeof r.margin == "number" ? [
574
+ r.margin,
575
+ r.margin,
576
+ r.margin,
577
+ r.margin
588
578
  ] : [
589
- i.margin.left,
590
- i.margin.top,
591
- i.margin.right,
592
- i.margin.bottom
579
+ r.margin.left,
580
+ r.margin.top,
581
+ r.margin.right,
582
+ r.margin.bottom
593
583
  ]);
594
- let C = (e) => {
595
- let n = i?.columnStyles?.[t[e]];
596
- return n?.align ? n.align : u?.[e]?.align || "left";
597
- }, w = t.map((e, t) => ({
598
- ...g(e, { bold: !0 }, p),
599
- fontSize: x - 1,
584
+ let w = (t) => {
585
+ let n = r?.columnStyles?.[e[t]];
586
+ return n?.align ? n.align : s?.[t]?.align || "left";
587
+ }, T = e.map((e, t) => ({
588
+ ..._(e, { bold: !0 }, p),
589
+ fontSize: S - 1,
600
590
  color: "white",
601
591
  fillColor: "#1a73e8",
602
- alignment: C(t)
603
- })), E = n.map((e, n) => t.map((t, r) => {
604
- let i = d?.[n]?.[t];
592
+ alignment: w(t)
593
+ })), E = t.map((t, n) => e.map((e, r) => {
594
+ let i = c?.[n]?.[e];
605
595
  return {
606
- ...g(e[t] == null ? "" : String(e[t]), {}, p),
607
- fontSize: i?.fontSize || x,
596
+ ..._(t[e] == null ? "" : String(t[e]), {}, p),
597
+ fontSize: i?.fontSize || S,
608
598
  fillColor: i?.backgroundColor || (n % 2 == 0 ? null : "#f8f9fa"),
609
- alignment: i?.align || C(r),
599
+ alignment: i?.align || w(r),
610
600
  color: i?.color || void 0,
611
601
  bold: i?.fontWeight === "bold" || void 0
612
602
  };
613
- })), D = o ? t.map((e, t) => {
614
- let n = u?.[t]?.cellStyle?.(o[e], {});
603
+ })), D = i ? e.map((e, t) => {
604
+ let n = s?.[t]?.cellStyle?.(i[e], {});
615
605
  return {
616
- ...g(o[e] == null ? "" : String(o[e]), { bold: !0 }, p),
617
- fontSize: x,
606
+ ..._(i[e] == null ? "" : String(i[e]), { bold: !0 }, p),
607
+ fontSize: S,
618
608
  fillColor: n?.backgroundColor || "#e8e8e8",
619
- alignment: n?.align || C(t),
609
+ alignment: n?.align || w(t),
620
610
  color: n?.color || void 0
621
611
  };
622
- }) : null, O = [w, ...E];
623
- D && O.push(D);
624
- let k = t.map(() => "*"), A = t.length > 8 ? 4 : 6, j = t.length > 8 ? 3 : 4, M = [];
625
- if (f) {
626
- f.businessName && M.push({
627
- ...g(f.businessName, { bold: !0 }, p),
612
+ }) : null, A = [T, ...E];
613
+ D && A.push(D);
614
+ let j = e.map(() => "*"), M = e.length > 8 ? 4 : 6, N = e.length > 8 ? 3 : 4, P = [];
615
+ if (u) {
616
+ u.businessName && P.push({
617
+ ..._(u.businessName, { bold: !0 }, p),
628
618
  fontSize: 16,
629
619
  margin: [
630
620
  0,
@@ -633,9 +623,9 @@ function E(t, n, r) {
633
623
  2
634
624
  ]
635
625
  });
636
- let t = [];
637
- f.businessAddress && t.push(f.businessAddress), f.businessPhone && t.push(f.businessPhone), f.taxNumber && t.push(`${e(f)}: ${f.taxNumber}`), t.length > 0 && M.push({
638
- ...g(t.join(" | "), {}, p),
626
+ let e = [];
627
+ u.businessAddress && e.push(u.businessAddress), u.businessPhone && e.push(u.businessPhone), u.taxNumber && e.push(`${l(u)}: ${u.taxNumber}`), e.length > 0 && P.push({
628
+ ..._(e.join(" | "), {}, p),
639
629
  fontSize: 9,
640
630
  color: "#666666",
641
631
  margin: [
@@ -644,18 +634,18 @@ function E(t, n, r) {
644
634
  0,
645
635
  4
646
636
  ]
647
- }), M.push({
648
- ...g(_, { bold: !0 }, p),
637
+ }), P.push({
638
+ ..._(v, { bold: !0 }, p),
649
639
  fontSize: 12,
650
640
  color: "#333333",
651
641
  margin: [
652
642
  0,
653
643
  0,
654
644
  0,
655
- l ? 2 : 4
645
+ o ? 2 : 4
656
646
  ]
657
- }), l && M.push({
658
- ...g(l, { italics: !0 }, p),
647
+ }), o && P.push({
648
+ ..._(o, { italics: !0 }, p),
659
649
  fontSize: 9,
660
650
  color: "#555555",
661
651
  margin: [
@@ -665,9 +655,9 @@ function E(t, n, r) {
665
655
  4
666
656
  ]
667
657
  });
668
- let n = [c(f), m.exportGenerated(h)].filter(Boolean).join(" | ");
669
- M.push({
670
- ...g(n, {}, p),
658
+ let t = [f(u), h.exportGenerated(g)].filter(Boolean).join(" | ");
659
+ P.push({
660
+ ..._(t, {}, p),
671
661
  fontSize: 8,
672
662
  color: "#888888",
673
663
  margin: [
@@ -677,17 +667,17 @@ function E(t, n, r) {
677
667
  12
678
668
  ]
679
669
  });
680
- } else M.push({
681
- ...g(_, { bold: !0 }, p),
670
+ } else P.push({
671
+ ..._(v, { bold: !0 }, p),
682
672
  fontSize: 16,
683
673
  margin: [
684
674
  0,
685
675
  0,
686
676
  0,
687
- l ? 2 : 4
677
+ o ? 2 : 4
688
678
  ]
689
- }), l && M.push({
690
- ...g(l, { italics: !0 }, p),
679
+ }), o && P.push({
680
+ ..._(o, { italics: !0 }, p),
691
681
  fontSize: 10,
692
682
  color: "#555555",
693
683
  margin: [
@@ -696,8 +686,8 @@ function E(t, n, r) {
696
686
  0,
697
687
  4
698
688
  ]
699
- }), M.push({
700
- text: `${m.rowsInfo(String(n.length))} | ${m.exportGenerated(h)}`,
689
+ }), P.push({
690
+ text: `${h.rowsInfo(String(t.length))} | ${h.exportGenerated(g)}`,
701
691
  fontSize: 9,
702
692
  color: "#888",
703
693
  margin: [
@@ -707,24 +697,15 @@ function E(t, n, r) {
707
697
  12
708
698
  ]
709
699
  });
710
- if (M.push({
700
+ if (P.push({
711
701
  table: {
712
702
  headerRows: 1,
713
- widths: k,
714
- body: O
703
+ widths: j,
704
+ body: A
715
705
  },
716
- layout: {
717
- hLineWidth: (e, t) => e === 0 || e === 1 || e === t.table.body.length ? 1.5 : .5,
718
- vLineWidth: () => .5,
719
- hLineColor: () => "#cccccc",
720
- vLineColor: () => "#cccccc",
721
- paddingLeft: () => A,
722
- paddingRight: () => A,
723
- paddingTop: () => j,
724
- paddingBottom: () => j
725
- }
726
- }), s && Object.keys(s.items).length > 0) {
727
- M.push({
706
+ layout: k
707
+ }), a && Object.keys(a.items).length > 0) {
708
+ P.push({
728
709
  text: "",
729
710
  margin: [
730
711
  0,
@@ -732,8 +713,8 @@ function E(t, n, r) {
732
713
  0,
733
714
  0
734
715
  ]
735
- }), M.push({
736
- ...g(m.exportSummaryLabel, { bold: !0 }, p),
716
+ }), P.push({
717
+ ..._(h.exportSummaryLabel, { bold: !0 }, p),
737
718
  fontSize: 12,
738
719
  margin: [
739
720
  0,
@@ -742,14 +723,14 @@ function E(t, n, r) {
742
723
  6
743
724
  ]
744
725
  });
745
- let e = Object.entries(s.items).map(([e, t]) => [{
746
- ...g(e, { bold: !0 }, p),
726
+ let e = Object.entries(a.items).map(([e, t]) => [{
727
+ ..._(e, { bold: !0 }, p),
747
728
  fontSize: 9
748
729
  }, {
749
- ...g(String(t), {}, p),
730
+ ..._(String(t), {}, p),
750
731
  fontSize: 9
751
732
  }]);
752
- M.push({
733
+ P.push({
753
734
  table: {
754
735
  widths: ["auto", "*"],
755
736
  body: e
@@ -757,8 +738,8 @@ function E(t, n, r) {
757
738
  layout: "noBorders"
758
739
  });
759
740
  }
760
- for (let e of s?.tables ?? []) {
761
- M.push({
741
+ for (let e of a?.tables ?? []) {
742
+ P.push({
762
743
  text: "",
763
744
  margin: [
764
745
  0,
@@ -766,8 +747,8 @@ function E(t, n, r) {
766
747
  0,
767
748
  0
768
749
  ]
769
- }), M.push({
770
- ...g(e.title, { bold: !0 }, p),
750
+ }), P.push({
751
+ ..._(e.title, { bold: !0 }, p),
771
752
  fontSize: 10,
772
753
  margin: [
773
754
  0,
@@ -777,18 +758,18 @@ function E(t, n, r) {
777
758
  ]
778
759
  });
779
760
  let t = [e.header.map((e, t) => ({
780
- ...g(e, { bold: !0 }, p),
761
+ ..._(e, { bold: !0 }, p),
781
762
  fontSize: 9,
782
763
  ...t === 1 ? { alignment: "right" } : {}
783
764
  })), ...e.rows.map((e) => [{
784
- ...g(e.label, {}, p),
765
+ ..._(e.label, {}, p),
785
766
  fontSize: 9
786
767
  }, {
787
768
  text: String(e.count),
788
769
  fontSize: 9,
789
770
  alignment: "right"
790
771
  }])];
791
- M.push({
772
+ P.push({
792
773
  table: {
793
774
  headerRows: 1,
794
775
  widths: ["auto", "auto"],
@@ -797,13 +778,27 @@ function E(t, n, r) {
797
778
  layout: "lightHorizontalLines"
798
779
  });
799
780
  }
781
+ let F = p?.(h.exportPage("1", "1"));
800
782
  return {
801
- content: M,
802
- pageOrientation: b,
803
- pageSize: y,
804
- pageMargins: S,
805
- footer: (e, t) => ({
806
- ...g(m.exportPage(String(e), String(t)), {}, p),
783
+ kind: "pdf",
784
+ document: {
785
+ content: P,
786
+ pageOrientation: x,
787
+ pageSize: b,
788
+ pageMargins: C
789
+ },
790
+ tableLayouts: { [k]: {
791
+ hLineWidth: .5,
792
+ edgeLineWidth: 1.5,
793
+ vLineWidth: .5,
794
+ hLineColor: "#cccccc",
795
+ vLineColor: "#cccccc",
796
+ paddingX: M,
797
+ paddingY: N
798
+ } },
799
+ footer: {
800
+ text: h.exportPage("{page}", "{pages}"),
801
+ ...F ? { font: F } : {},
807
802
  alignment: "center",
808
803
  fontSize: 8,
809
804
  color: "#888",
@@ -813,15 +808,19 @@ function E(t, n, r) {
813
808
  0,
814
809
  0
815
810
  ]
816
- })
811
+ },
812
+ ...m?.fonts || m?.vfs ? { fonts: {
813
+ fonts: m.fonts,
814
+ vfs: m.vfs
815
+ } } : {}
817
816
  };
818
817
  }
819
- var D = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
820
- function O(e, t, n) {
821
- let { title: r, subtitle: i, totals: a, summary: o, metadata: s } = n || {}, c = D, l = (t) => e.map((e) => ` <field name="${c(e)}">${c(t[e])}</field>`).join("\n"), u = ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>", `<export${r ? ` title="${c(r)}"` : ""} generated="${(/* @__PURE__ */ new Date()).toISOString()}">`];
818
+ var j = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
819
+ function M(e, t, n) {
820
+ let { title: r, subtitle: i, totals: a, summary: o, metadata: s } = n || {}, c = j, l = (t) => e.map((e) => ` <field name="${c(e)}">${c(t[e])}</field>`).join("\n"), u = ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>", `<export${r ? ` title="${c(r)}"` : ""} generated="${(/* @__PURE__ */ new Date()).toISOString()}">`];
822
821
  if (i && u.push(` <subtitle>${c(i)}</subtitle>`), s) {
823
822
  u.push(" <metadata>");
824
- for (let [e, t] of d(s)) u.push(` <item name="${c(e)}">${c(t)}</item>`);
823
+ for (let [e, t] of m(s)) u.push(` <item name="${c(e)}">${c(t)}</item>`);
825
824
  u.push(" </metadata>");
826
825
  }
827
826
  u.push(` <rows count="${t.length}">`);
@@ -838,53 +837,53 @@ function O(e, t, n) {
838
837
  }
839
838
  return u.push("</export>"), new Blob([u.join("\n")], { type: "application/xml;charset=utf-8;" });
840
839
  }
841
- async function k(e, t, n, r) {
842
- let i = r?.totals ?? v(n, t, r?.totalKeys, r?.columns, a(r?.metadata)), o = r?.summary, s = r?.metadata, c = r?.subtitle || r?.pdf?.subtitle, l = r?.columns ? _(r.columns, t) : void 0;
840
+ async function N(e, t, n, r) {
841
+ let i = r?.totals ?? y(n, t, r?.totalKeys, r?.columns, d(r?.metadata)), a = r?.summary, o = r?.metadata, s = r?.subtitle || r?.pdf?.subtitle, c = r?.columnMeta ?? (r?.columns ? v(r.columns, t) : void 0);
843
842
  switch (e) {
844
- case "csv": return y(t, n, i, o, s, c);
845
- case "xlsx": return await x(t, n, {
843
+ case "csv": return b(t, n, i, a, o, s);
844
+ case "xlsx": return await w(t, n, {
846
845
  totals: i,
847
- summary: o,
846
+ summary: a,
848
847
  style: r?.xlsx,
849
848
  sheetName: r?.xlsx?.sheetName,
850
- columnMeta: l,
849
+ columnMeta: c,
851
850
  cellStyles: r?.cellStyles,
852
- metadata: s,
853
- subtitle: c
851
+ metadata: o,
852
+ subtitle: s
854
853
  });
855
- case "json": return S(n, o, s, c);
856
- case "html": return C(t, n, {
854
+ case "json": return T(n, a, o, s);
855
+ case "html": return E(t, n, {
857
856
  title: r?.html?.title || r?.title || r?.pdf?.title,
858
- subtitle: c,
857
+ subtitle: s,
859
858
  totals: i,
860
- summary: o,
859
+ summary: a,
861
860
  customStyles: r?.html?.styles,
862
- columnMeta: l,
861
+ columnMeta: c,
863
862
  cellStyles: r?.cellStyles,
864
- metadata: s,
863
+ metadata: o,
865
864
  branding: r?.branding
866
865
  });
867
- case "xml": return O(t, n, {
866
+ case "xml": return M(t, n, {
868
867
  title: r?.title,
869
- subtitle: c,
868
+ subtitle: s,
870
869
  totals: i,
871
- summary: o,
872
- metadata: s
870
+ summary: a,
871
+ metadata: o
873
872
  });
874
- case "pdf": return C(t, n, {
875
- title: r?.pdf?.title || r?.title || a(r?.metadata).export,
876
- subtitle: c,
873
+ case "pdf": return E(t, n, {
874
+ title: r?.pdf?.title || r?.title || d(r?.metadata).export,
875
+ subtitle: s,
877
876
  totals: i,
878
- summary: o,
877
+ summary: a,
879
878
  customStyles: `
880
879
  @page{size:${r?.pdf?.pageSize || "A4"} ${r?.pdf?.orientation || "portrait"};margin:15mm}
881
880
  body{font-size:${r?.pdf?.fontSize || 10}pt}
882
881
  `,
883
- columnMeta: l,
882
+ columnMeta: c,
884
883
  cellStyles: r?.cellStyles,
885
- metadata: s
884
+ metadata: o
886
885
  });
887
- default: return y(t, n, i, o, s, c);
886
+ default: return b(t, n, i, a, o, s);
888
887
  }
889
888
  }
890
- export { l as autoFormatValue, f as buildBusinessMeta, _ as buildColumnMeta, k as buildExportBlob, o as downloadBlob, p as executeFileAction, c as formatContextLine, d as formatMetadataLines, y as generateCSV, C as generateHTML, S as generateJSON, E as generateTablePDFDocDef, x as generateXLSX, O as generateXML, n as getExtension, r as getFormatLabel, u as openPreview, t as prepareExportRows, s as rawDataToBlob, i as shareFile };
889
+ export { p as autoFormatValue, h as buildBusinessMeta, v as buildColumnMeta, N as buildExportBlob, C as buildTableXlsxSpec, i as downloadBlob, t as executeFileAction, f as formatContextLine, m as formatMetadataLines, b as generateCSV, E as generateHTML, T as generateJSON, A as generateTablePDFTask, w as generateXLSX, M as generateXML, s as getExtension, c as getFormatLabel, n as openPreview, u as prepareExportRows, a as rawDataToBlob, r as shareFile };