@dcs-tech/ui 0.6.0 → 0.8.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 (56) hide show
  1. package/README.md +43 -0
  2. package/dist/{ChartImageMenu-CuuFnW9q.js → ChartImageMenu-AsfvmdTH.js} +99 -81
  3. package/dist/{ChartView-nS4f4EU_.js → ChartView-CW3m4Z_1.js} +1 -1
  4. package/dist/{SummaryChart-CVg6i2mx.js → SummaryChart-CxRjK_HU.js} +2 -2
  5. package/dist/{SummaryImage-CoEFzMl6.js → SummaryImage-DeYs2Jgj.js} +2 -2
  6. package/dist/{SummarySeeAll-C_OUs3kn.js → SummarySeeAll-CrmROhBv.js} +5 -5
  7. package/dist/assets/fileTask.worker-BHT1olUk.js +1 -0
  8. package/dist/{columnValue-K98ElfJc.js → columnValue-DwUqueZ6.js} +1 -1
  9. package/dist/{exportContext-CJaIv8R-.js → exportContext-BKFnNQ0q.js} +1 -1
  10. package/dist/{exportEngine-CDLYHH0d.js → exportEngine-CZ22cX7a.js} +377 -382
  11. package/dist/file-worker.js +1 -0
  12. package/dist/{fileActions-KSaVGnaE.js → fileActions-COf5Q4Eg.js} +2 -2
  13. package/dist/{geometry-ChwYB45B.js → geometry-yZmKN662.js} +11 -2
  14. package/dist/index.js +6534 -6118
  15. package/dist/runFileTask--4YjQH7Y.js +210 -0
  16. package/dist/scrollArea-Dd2dNMV4.js +236 -0
  17. package/dist/style.css +1 -1
  18. package/dist/{summaryChartData-pNvzaEHp.js → summaryChartData-CARqGRUl.js} +1 -1
  19. package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  20. package/dist/types/components/DataTable/export/exportEngine.d.ts +11 -4
  21. package/dist/types/components/DataTable/layout/useFillHeight.d.ts +1 -0
  22. package/dist/types/components/DataTable/rows/RowActions.d.ts +5 -2
  23. package/dist/types/components/DataTable/types.d.ts +1 -0
  24. package/dist/types/components/Dialog/DialogHost.d.ts +1 -0
  25. package/dist/types/components/Dialog/dialogOpen.d.ts +7 -0
  26. package/dist/types/components/Dialog/index.d.ts +1 -0
  27. package/dist/types/components/Fields/Field.d.ts +1 -1
  28. package/dist/types/components/Fields/hooks/useFieldBlur.d.ts +1 -1
  29. package/dist/types/components/FileEngine/FileEngineProvider.d.ts +20 -1
  30. package/dist/types/components/FileEngine/index.d.ts +1 -1
  31. package/dist/types/components/Popover/floatingPosition.d.ts +11 -1
  32. package/dist/types/components/Scroll/ScrollStrip.d.ts +4 -2
  33. package/dist/types/components/Sidebar/Sidebar.d.ts +12 -3
  34. package/dist/types/components/Sidebar/index.d.ts +1 -1
  35. package/dist/types/components/UIProvider/UIHostContext.d.ts +20 -0
  36. package/dist/types/components/UIProvider/UILabelsContext.d.ts +9 -0
  37. package/dist/types/components/UIProvider/UIProvider.d.ts +2 -0
  38. package/dist/types/components/UIProvider/index.d.ts +2 -0
  39. package/dist/types/core/logic/index.d.ts +1 -0
  40. package/dist/types/core/logic/popover.logic.d.ts +2 -0
  41. package/dist/types/core/logic/standardSchema.logic.d.ts +9 -0
  42. package/dist/types/core/types/fields.types.d.ts +2 -0
  43. package/dist/types/core/types/fileEngine.types.d.ts +51 -0
  44. package/dist/types/core/types/form.types.d.ts +4 -0
  45. package/dist/types/core/types/index.d.ts +1 -0
  46. package/dist/types/core/types/standardSchema.types.d.ts +30 -0
  47. package/dist/types/core/types/suggest.types.d.ts +1 -0
  48. package/dist/types/core/types/tooltip.types.d.ts +2 -0
  49. package/dist/types/file/fileEngine.d.ts +2 -1
  50. package/dist/types/file/tasks/runFileTask.d.ts +4 -1
  51. package/dist/types/file/workerPool.d.ts +1 -0
  52. package/dist/types/index.d.ts +11 -6
  53. package/package.json +7 -3
  54. package/dist/assets/fileTask.worker-FQSUtwcz.js +0 -1
  55. package/dist/runFileTask-BClLQjmv.js +0 -109
  56. package/dist/scrollArea-DAlVT5U7.js +0 -214
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o } from "./exportContext-CJaIv8R-.js";
3
- import { a as s, c, i as l, o as u, r as d, s as f, u as p } from "./fileActions-KSaVGnaE.js";
4
- 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-BKFnNQ0q.js";
5
5
  // src/components/DataTable/export/exportEngine.ts
6
- var h = (e) => JSON.stringify(e).replace(/</g, "\\u003c");
7
- function g(e = "", t = {}, n) {
6
+ var g = (e) => JSON.stringify(e).replace(/</g, "\\u003c");
7
+ function _(e = "", t = {}, n) {
8
8
  let r = e && n ? n(String(e)) : void 0;
9
9
  return r ? {
10
10
  text: e,
@@ -15,7 +15,7 @@ function g(e = "", t = {}, n) {
15
15
  ...t
16
16
  };
17
17
  }
18
- function _(e, t) {
18
+ function v(e, t) {
19
19
  return t.map((t) => {
20
20
  let n = e.find((e) => (e.exportHeader || e.header) === t);
21
21
  if (!n) return { header: t };
@@ -23,7 +23,7 @@ function _(e, t) {
23
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;
24
24
  });
25
25
  }
26
- function v(e, t, n, r, i) {
26
+ function y(e, t, n, r, i) {
27
27
  if (!n && !r) return null;
28
28
  let a = /* @__PURE__ */ new Set();
29
29
  if (n && r) for (let e of n) {
@@ -42,28 +42,28 @@ function v(e, t, n, r, i) {
42
42
  }
43
43
  return o;
44
44
  }
45
- function y(e, t, r, i, o, s) {
46
- let c = (e) => {
45
+ function b(e, t, n, r, i, a) {
46
+ let o = (e) => {
47
47
  if (e == null) return "";
48
48
  let t = String(e);
49
49
  return t.includes(",") || t.includes("\"") || t.includes("\n") ? `"${t.replace(/"/g, "\"\"")}"` : t;
50
- }, l = [];
51
- if (o) {
52
- let e = a(o);
53
- for (let [t, n] of e) l.push(`${c(t)},${c(n)}`);
54
- s && l.push(c(s)), l.push("");
55
- } else s && (l.push(c(s)), l.push(""));
56
- if (l.push(e.map(c).join(","), ...t.map((t) => e.map((e) => c(t[e])).join(","))), r && l.push(e.map((e) => c(r[e])).join(",")), i && Object.keys(i.items).length > 0) {
57
- l.push(""), l.push(c(n(o).exportSummaryLabel));
58
- for (let [e, t] of Object.entries(i.items)) l.push(`${c(e)},${c(t)}`);
50
+ }, s = [];
51
+ if (i) {
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)}`);
59
59
  }
60
- for (let e of i?.tables ?? []) {
61
- l.push(""), l.push(c(e.title)), l.push(e.header.map(c).join(","));
62
- for (let t of e.rows) l.push(`${c(t.label)},${c(t.count)}`);
60
+ for (let e of r?.tables ?? []) {
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)}`);
63
63
  }
64
- return new Blob(["" + l.join("\n")], { type: "text/csv;charset=utf-8;" });
64
+ return new Blob(["" + s.join("\n")], { type: "text/csv;charset=utf-8;" });
65
65
  }
66
- function b(e) {
66
+ function x(e) {
67
67
  if (e) {
68
68
  if (e.numFmt) return e.numFmt;
69
69
  switch (e.format) {
@@ -75,226 +75,211 @@ function b(e) {
75
75
  }
76
76
  }
77
77
  }
78
- async function x(t, i, a) {
79
- let { totals: o, summary: s, style: c, sheetName: l, columnMeta: u, cellStyles: d, metadata: f, subtitle: p } = a || {}, h = new m.Workbook(), g = h.addWorksheet(l || "Sheet1"), _ = 0;
80
- if (f) {
81
- if (f.businessName) {
82
- let e = g.addRow([f.businessName]);
83
- e.getCell(1).font = {
84
- bold: !0,
85
- size: 14
86
- }, t.length > 1 && g.mergeCells(1, 1, 1, t.length), _++;
87
- }
88
- let n = [];
89
- if (f.businessAddress && n.push(f.businessAddress), f.businessPhone && n.push(f.businessPhone), n.length > 0) {
90
- let e = g.addRow([n.join(" | ")]);
91
- e.getCell(1).font = {
92
- size: 10,
93
- color: { argb: "FF666666" }
94
- }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
95
- }
96
- if (f.taxNumber) {
97
- let n = g.addRow([`${e(f)}: ${f.taxNumber}`]);
98
- n.getCell(1).font = { size: 10 }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
99
- }
100
- if (p) {
101
- let e = g.addRow([p]);
102
- e.getCell(1).font = {
103
- size: 10,
104
- italic: !0,
105
- color: { argb: "FF555555" }
106
- }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
107
- }
108
- let i = r(f);
109
- if (i) {
110
- let e = g.addRow([i]);
111
- e.getCell(1).font = {
112
- size: 9,
113
- italic: !0
114
- }, t.length > 1 && g.mergeCells(_ + 1, 1, _ + 1, t.length), _++;
115
- }
116
- g.addRow([]), _++;
117
- } else if (p) {
118
- let e = 0, n = g.addRow([p]);
119
- 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, {
120
101
  size: 10,
121
102
  italic: !0,
122
- color: { argb: "FF555555" }
123
- }, t.length > 1 && g.mergeCells(1, 1, 1, t.length), e++, g.addRow([]), e++, _ += e;
124
- }
125
- let v = _ + 1, y = c?.headerStyle?.fill || "#1a73e8", x = c?.headerStyle?.fontColor || "#FFFFFF", S = c?.headerStyle?.bold !== !1;
126
- if (g.columns = t.map((e, t) => {
127
- let n = u?.[t], r = c?.columnStyles?.[e]?.width || n?.width;
128
- if (!r) {
129
- let t = Math.max(e.length, ...i.slice(0, 50).map((t) => String(t[e] ?? "").length));
130
- r = 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);
131
120
  }
132
- return _ > 0 ? {
133
- key: e,
134
- width: r
135
- } : {
121
+ let c = i?.numFmt || x(r), l = i?.align || r?.align;
122
+ return {
136
123
  header: e,
137
- key: e,
138
- width: r
124
+ width: o,
125
+ ...c ? { numFmt: c } : {},
126
+ ...l ? { align: l } : {},
127
+ ...i?.bold ? { style: { bold: !0 } } : {}
139
128
  };
140
- }), _ > 0 && g.addRow(t), g.getRow(v).eachCell((e, n) => {
141
- let r = u?.[n - 1], i = c?.columnStyles?.[t[n - 1]]?.align;
142
- e.font = {
143
- bold: S,
144
- color: { argb: x.replace("#", "FF") },
145
- size: c?.headerStyle?.fontSize || 11
146
- }, e.fill = {
147
- type: "pattern",
148
- pattern: "solid",
149
- fgColor: { argb: y.replace("#", "FF") }
150
- }, e.alignment = {
151
- horizontal: i || r?.align || "left",
152
- vertical: "middle"
153
- }, e.border = { bottom: {
154
- style: "thin",
155
- color: { argb: "FF999999" }
156
- } };
157
- }), g.views = [{
158
- state: "frozen",
159
- ySplit: c?.freezeRows ?? v,
160
- xSplit: c?.freezeCols || 0
161
- }], i.forEach((e, n) => {
162
- let r = g.addRow(t.map((t) => e[t] ?? "")), i = n % 2 == 1;
163
- r.eachCell((e, r) => {
164
- let a = u?.[r - 1], o = t[r - 1], s = c?.columnStyles?.[o], l = d?.[n]?.[o], f = l?.align || s?.align || a?.align;
165
- f && (e.alignment = {
166
- horizontal: f,
167
- vertical: "middle"
168
- });
169
- let p = s?.numFmt || b(a);
170
- p && (typeof e.value == "number" || e.value instanceof Date) && (e.numFmt = p);
171
- let m = {};
172
- (s?.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 = {
173
- type: "pattern",
174
- pattern: "solid",
175
- fgColor: { argb: "FF" + l.backgroundColor.replace("#", "") }
176
- } : i && (e.fill = {
177
- type: "pattern",
178
- pattern: "solid",
179
- fgColor: { argb: "FFF8F9FA" }
180
- });
181
- });
182
- }), o) {
183
- let e = t.map((e) => o[e] ?? ""), n = g.addRow(e), r = c?.totalsStyle?.fill || "#e8e8e8", i = c?.totalsStyle?.bold !== !1, a = c?.totalsStyle?.border || "thin";
184
- n.eachCell((e, n) => {
185
- let s = u?.[n - 1], l = t[n - 1], d = c?.columnStyles?.[l], f = s?.cellStyle?.(o[l], {}), p = f?.align || d?.align || s?.align, m = { bold: i };
186
- f?.color && (m.color = { argb: "FF" + f.color.replace("#", "") }), f?.fontSize && (m.size = f.fontSize), e.font = m, e.fill = f?.backgroundColor ? {
187
- type: "pattern",
188
- pattern: "solid",
189
- fgColor: { argb: "FF" + f.backgroundColor.replace("#", "") }
190
- } : {
191
- type: "pattern",
192
- pattern: "solid",
193
- fgColor: { argb: r.replace("#", "FF") }
194
- }, e.border = { top: {
195
- style: a,
196
- color: { argb: "FF333333" }
197
- } }, p && (e.alignment = {
198
- horizontal: p,
199
- vertical: "middle"
200
- });
201
- let h = d?.numFmt || b(s);
202
- h && (typeof e.value == "number" || e.value instanceof Date) && (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
203
150
  });
204
151
  }
205
- if (c?.autoFilter !== !1 && i.length > 0 && (g.autoFilter = {
206
- from: {
207
- row: v,
208
- column: 1
209
- },
210
- to: {
211
- row: v,
212
- column: t.length
213
- }
214
- }), s && Object.keys(s.items).length > 0) {
215
- g.addRow([]);
216
- let e = g.addRow([n(f).exportSummaryLabel]);
217
- e.getCell(1).font = {
218
- bold: !0,
219
- size: 12
220
- };
221
- for (let [e, t] of Object.entries(s.items)) {
222
- let n = g.addRow([e, t]);
223
- n.getCell(1).font = { bold: !0 }, typeof t == "number" && (n.getCell(2).numFmt = "#,##0.00");
224
- }
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
+ });
225
167
  }
226
- for (let e of s?.tables ?? []) {
227
- g.addRow([]), g.addRow([e.title]).getCell(1).font = {
228
- bold: !0,
229
- size: 12
230
- };
231
- let t = g.addRow(e.header);
232
- t.font = { bold: !0 }, t.eachCell((e) => {
233
- 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" } }
234
185
  });
235
- for (let t of e.rows) g.addRow([t.label, t.count]).getCell(2).numFmt = "#,##0";
236
186
  }
237
- let C = await h.xlsx.writeBuffer();
238
- 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 });
239
224
  }
240
- function S(t, n, r, i) {
241
- let a = n ? {
242
- ...n.items,
243
- ...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) => ({
244
229
  title: e.title,
245
230
  header: e.header,
246
231
  rows: e.rows
247
232
  })) } : {}
248
233
  } : void 0;
249
- if (r) {
250
- let n = { exportedAt: (/* @__PURE__ */ new Date()).toISOString() };
251
- 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 = {
252
- total: r.totalRows,
253
- filtered: r.filteredRows,
254
- exported: r.resultRows,
255
- 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
256
241
  };
257
- let o = {
258
- metadata: n,
259
- data: t
242
+ let a = {
243
+ metadata: t,
244
+ data: e
260
245
  };
261
- 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" });
262
247
  }
263
- let o = i ? {
264
- subtitle: i,
265
- data: t
266
- } : a ? {
267
- data: t,
268
- summary: a
269
- } : t;
270
- 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" });
271
256
  }
272
- function C(t, i, a) {
273
- let { title: o, subtitle: s, totals: c, summary: l, customStyles: u, columnMeta: d, cellStyles: f, metadata: p, branding: m } = a || {}, g = n(p), _ = m ? `<footer class="export-footer">
274
- ${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>` : ""}
275
260
  </footer>` : "", v = (e) => e == null ? "" : String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), y = (e) => {
276
- let t = d?.[e];
261
+ let t = c?.[e];
277
262
  return t?.align ? ` style="text-align:${t.align}"` : "";
278
263
  }, b = (e, t, n) => {
279
- let r = [], i = d?.[n];
264
+ let r = [], i = c?.[n];
280
265
  i?.align && r.push(`text-align:${i.align}`);
281
- let a = f?.[e]?.[t];
266
+ let a = u?.[e]?.[t];
282
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}"` : "";
283
268
  };
284
- t.map((e, t) => `<th${y(t)}>${v(e)}</th>`).join("");
285
- let x = i.map((e, n) => `<tr>${t.map((t, r) => `<td${b(n, t, r)}>${v(e[t])}</td>`).join("")}</tr>`).join("\n"), S = c ? `<tr class="totals">${t.map((e, t) => {
286
- let n = d?.[t]?.cellStyle?.(c[e], {}), r = [], i = d?.[t];
287
- 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(c[e])}</td>`;
288
- }).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 || void 0, {
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, {
289
274
  day: "2-digit",
290
275
  month: "2-digit",
291
276
  year: "numeric"
292
- }), O = `<!DOCTYPE html>
277
+ }), D = `<!DOCTYPE html>
293
278
  <html lang="${v((p?.locale || "en").split("-")[0])}" data-theme="system">
294
279
  <head>
295
280
  <meta charset="UTF-8">
296
281
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
297
- <title>${v(o || g.export)}</title>
282
+ <title>${v(r || h.export)}</title>
298
283
  <style>
299
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}
300
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}
@@ -355,37 +340,37 @@ tr.hidden-row{display:none}
355
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}}
356
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}}
357
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}}
358
- ${u || ""}
343
+ ${s || ""}
359
344
  </style>
360
345
  </head>
361
346
  <body>
362
347
  ${p ? (() => {
363
- let t = ["<div class=\"export-meta\">"];
364
- p.businessName && t.push(`<h2>${v(p.businessName)}</h2>`);
365
- let n = [];
366
- 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>`), o && t.push(`<h3 style="margin:8px 0 4px;font-size:15px">${v(o)}</h3>`), s && t.push(`<div style="font-size:12px;color:var(--text-secondary);margin-bottom:4px">${v(s)}</div>`);
367
- let i = r(p);
368
- return i && t.push(`<div class="meta-filters">${v(i)}</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");
369
354
  })() : ""}
370
- ${!p && o ? `<h1>${v(o)}</h1>` : ""}
371
- ${!p && s ? `<p class="subtitle">${v(s)}</p>` : ""}
355
+ ${!p && r ? `<h1>${v(r)}</h1>` : ""}
356
+ ${!p && i ? `<p class="subtitle">${v(i)}</p>` : ""}
372
357
  <div class="toolbar">
373
- <input type="text" id="globalSearch" placeholder="${v(g.exportHtmlSearch)}" aria-label="${v(g.exportHtmlSearch)}" autocomplete="off">
374
- <span class="count" id="rowCount">${v(g.rowsInfo(String(i.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>
375
360
  <div class="toolbar-actions">
376
- <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>
377
- <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>
378
363
  <div class="theme-toggle">
379
- <button data-theme-val="light" title="${v(g.exportThemeLight)}" aria-label="${v(g.exportThemeLight)}">&#9788;</button>
380
- <button data-theme-val="dark" title="${v(g.exportThemeDark)}" aria-label="${v(g.exportThemeDark)}">&#9790;</button>
381
- <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>
382
367
  </div>
383
368
  </div>
384
369
  </div>
385
- <div class="generated-info">${v(g.exportGeneratedOn(E))}</div>
370
+ <div class="generated-info">${v(h.exportGeneratedOn(E))}</div>
386
371
  <div class="dt-wrapper">
387
372
  <table id="dataTable">
388
- <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>
389
374
  <tbody>
390
375
  ${x}
391
376
  </tbody>
@@ -413,7 +398,7 @@ var show=!q||text.indexOf(q)>=0;
413
398
  r.classList.toggle('hidden-row',!show);
414
399
  if(show)visible++;
415
400
  });
416
- 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);
417
402
  });
418
403
 
419
404
  // Sort
@@ -472,9 +457,9 @@ this.classList.add('active');
472
457
  <\/script>
473
458
  </body>
474
459
  </html>`;
475
- return new Blob([O], { type: "text/html;charset=utf-8;" });
460
+ return new Blob([D], { type: "text/html;charset=utf-8;" });
476
461
  }
477
- var w = {
462
+ var D = {
478
463
  A4: {
479
464
  w: 595.28,
480
465
  h: 841.89
@@ -500,7 +485,7 @@ var w = {
500
485
  h: 1224
501
486
  }
502
487
  };
503
- function T(e, t, n, r) {
488
+ function O(e, t, n, r) {
504
489
  e.length;
505
490
  let i = e.map((e, i) => {
506
491
  let a = r?.columnStyles?.[e]?.width;
@@ -545,7 +530,7 @@ function T(e, t, n, r) {
545
530
  minFont: 6
546
531
  }
547
532
  ]) {
548
- 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;
549
534
  if (n >= .85) {
550
535
  let t = Math.max(e.minFont, Math.min(9, Math.round(9 * Math.min(n, 1))));
551
536
  return {
@@ -573,62 +558,63 @@ function T(e, t, n, r) {
573
558
  ]
574
559
  };
575
560
  }
576
- function E(t, i, a) {
577
- let { pdfConfig: o, totals: s, summary: c, subtitle: l, columnMeta: u, cellStyles: d, metadata: f, fontFor: p } = a || {}, m = n(f), h = (/* @__PURE__ */ new Date()).toLocaleDateString(f?.locale), _ = o?.title || m.export, v = o?.autoFit !== !1, y = o?.pageSize || "A4", b = o?.orientation || "portrait", x = o?.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 = [
578
564
  30,
579
565
  30,
580
566
  30,
581
567
  40
582
568
  ];
583
- if (v && !o?.orientation && !o?.pageSize) {
584
- let e = T(t, i, u, o);
585
- y = e.pageSize, b = e.orientation, o?.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;
586
572
  }
587
- o?.margin && (S = typeof o.margin == "number" ? [
588
- o.margin,
589
- o.margin,
590
- o.margin,
591
- o.margin
573
+ r?.margin && (C = typeof r.margin == "number" ? [
574
+ r.margin,
575
+ r.margin,
576
+ r.margin,
577
+ r.margin
592
578
  ] : [
593
- o.margin.left,
594
- o.margin.top,
595
- o.margin.right,
596
- o.margin.bottom
579
+ r.margin.left,
580
+ r.margin.top,
581
+ r.margin.right,
582
+ r.margin.bottom
597
583
  ]);
598
- let C = (e) => {
599
- let n = o?.columnStyles?.[t[e]];
600
- return n?.align ? n.align : u?.[e]?.align || "left";
601
- }, w = t.map((e, t) => ({
602
- ...g(e, { bold: !0 }, p),
603
- 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,
604
590
  color: "white",
605
591
  fillColor: "#1a73e8",
606
- alignment: C(t)
607
- })), E = i.map((e, n) => t.map((t, r) => {
608
- 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];
609
595
  return {
610
- ...g(e[t] == null ? "" : String(e[t]), {}, p),
611
- fontSize: i?.fontSize || x,
596
+ ..._(t[e] == null ? "" : String(t[e]), {}, p),
597
+ fontSize: i?.fontSize || S,
612
598
  fillColor: i?.backgroundColor || (n % 2 == 0 ? null : "#f8f9fa"),
613
- alignment: i?.align || C(r),
599
+ alignment: i?.align || w(r),
614
600
  color: i?.color || void 0,
615
601
  bold: i?.fontWeight === "bold" || void 0
616
602
  };
617
- })), D = s ? t.map((e, t) => {
618
- let n = u?.[t]?.cellStyle?.(s[e], {});
603
+ })), D = i ? e.map((e, t) => {
604
+ let n = s?.[t]?.cellStyle?.(i[e], {});
619
605
  return {
620
- ...g(s[e] == null ? "" : String(s[e]), { bold: !0 }, p),
621
- fontSize: x,
606
+ ..._(i[e] == null ? "" : String(i[e]), { bold: !0 }, p),
607
+ fontSize: S,
622
608
  fillColor: n?.backgroundColor || "#e8e8e8",
623
- alignment: n?.align || C(t),
609
+ alignment: n?.align || w(t),
624
610
  color: n?.color || void 0
625
611
  };
626
- }) : null, O = [w, ...E];
627
- D && O.push(D);
628
- let k = t.map(() => "*"), A = t.length > 8 ? 4 : 6, j = t.length > 8 ? 3 : 4, M = [];
629
- if (f) {
630
- f.businessName && M.push({
631
- ...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),
632
618
  fontSize: 16,
633
619
  margin: [
634
620
  0,
@@ -637,9 +623,9 @@ function E(t, i, a) {
637
623
  2
638
624
  ]
639
625
  });
640
- let t = [];
641
- 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({
642
- ...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),
643
629
  fontSize: 9,
644
630
  color: "#666666",
645
631
  margin: [
@@ -648,18 +634,18 @@ function E(t, i, a) {
648
634
  0,
649
635
  4
650
636
  ]
651
- }), M.push({
652
- ...g(_, { bold: !0 }, p),
637
+ }), P.push({
638
+ ..._(v, { bold: !0 }, p),
653
639
  fontSize: 12,
654
640
  color: "#333333",
655
641
  margin: [
656
642
  0,
657
643
  0,
658
644
  0,
659
- l ? 2 : 4
645
+ o ? 2 : 4
660
646
  ]
661
- }), l && M.push({
662
- ...g(l, { italics: !0 }, p),
647
+ }), o && P.push({
648
+ ..._(o, { italics: !0 }, p),
663
649
  fontSize: 9,
664
650
  color: "#555555",
665
651
  margin: [
@@ -669,9 +655,9 @@ function E(t, i, a) {
669
655
  4
670
656
  ]
671
657
  });
672
- let n = [r(f), m.exportGenerated(h)].filter(Boolean).join(" | ");
673
- M.push({
674
- ...g(n, {}, p),
658
+ let t = [f(u), h.exportGenerated(g)].filter(Boolean).join(" | ");
659
+ P.push({
660
+ ..._(t, {}, p),
675
661
  fontSize: 8,
676
662
  color: "#888888",
677
663
  margin: [
@@ -681,17 +667,17 @@ function E(t, i, a) {
681
667
  12
682
668
  ]
683
669
  });
684
- } else M.push({
685
- ...g(_, { bold: !0 }, p),
670
+ } else P.push({
671
+ ..._(v, { bold: !0 }, p),
686
672
  fontSize: 16,
687
673
  margin: [
688
674
  0,
689
675
  0,
690
676
  0,
691
- l ? 2 : 4
677
+ o ? 2 : 4
692
678
  ]
693
- }), l && M.push({
694
- ...g(l, { italics: !0 }, p),
679
+ }), o && P.push({
680
+ ..._(o, { italics: !0 }, p),
695
681
  fontSize: 10,
696
682
  color: "#555555",
697
683
  margin: [
@@ -700,8 +686,8 @@ function E(t, i, a) {
700
686
  0,
701
687
  4
702
688
  ]
703
- }), M.push({
704
- text: `${m.rowsInfo(String(i.length))} | ${m.exportGenerated(h)}`,
689
+ }), P.push({
690
+ text: `${h.rowsInfo(String(t.length))} | ${h.exportGenerated(g)}`,
705
691
  fontSize: 9,
706
692
  color: "#888",
707
693
  margin: [
@@ -711,24 +697,15 @@ function E(t, i, a) {
711
697
  12
712
698
  ]
713
699
  });
714
- if (M.push({
700
+ if (P.push({
715
701
  table: {
716
702
  headerRows: 1,
717
- widths: k,
718
- body: O
703
+ widths: j,
704
+ body: A
719
705
  },
720
- layout: {
721
- hLineWidth: (e, t) => e === 0 || e === 1 || e === t.table.body.length ? 1.5 : .5,
722
- vLineWidth: () => .5,
723
- hLineColor: () => "#cccccc",
724
- vLineColor: () => "#cccccc",
725
- paddingLeft: () => A,
726
- paddingRight: () => A,
727
- paddingTop: () => j,
728
- paddingBottom: () => j
729
- }
730
- }), c && Object.keys(c.items).length > 0) {
731
- M.push({
706
+ layout: k
707
+ }), a && Object.keys(a.items).length > 0) {
708
+ P.push({
732
709
  text: "",
733
710
  margin: [
734
711
  0,
@@ -736,8 +713,8 @@ function E(t, i, a) {
736
713
  0,
737
714
  0
738
715
  ]
739
- }), M.push({
740
- ...g(m.exportSummaryLabel, { bold: !0 }, p),
716
+ }), P.push({
717
+ ..._(h.exportSummaryLabel, { bold: !0 }, p),
741
718
  fontSize: 12,
742
719
  margin: [
743
720
  0,
@@ -746,14 +723,14 @@ function E(t, i, a) {
746
723
  6
747
724
  ]
748
725
  });
749
- let e = Object.entries(c.items).map(([e, t]) => [{
750
- ...g(e, { bold: !0 }, p),
726
+ let e = Object.entries(a.items).map(([e, t]) => [{
727
+ ..._(e, { bold: !0 }, p),
751
728
  fontSize: 9
752
729
  }, {
753
- ...g(String(t), {}, p),
730
+ ..._(String(t), {}, p),
754
731
  fontSize: 9
755
732
  }]);
756
- M.push({
733
+ P.push({
757
734
  table: {
758
735
  widths: ["auto", "*"],
759
736
  body: e
@@ -761,8 +738,8 @@ function E(t, i, a) {
761
738
  layout: "noBorders"
762
739
  });
763
740
  }
764
- for (let e of c?.tables ?? []) {
765
- M.push({
741
+ for (let e of a?.tables ?? []) {
742
+ P.push({
766
743
  text: "",
767
744
  margin: [
768
745
  0,
@@ -770,8 +747,8 @@ function E(t, i, a) {
770
747
  0,
771
748
  0
772
749
  ]
773
- }), M.push({
774
- ...g(e.title, { bold: !0 }, p),
750
+ }), P.push({
751
+ ..._(e.title, { bold: !0 }, p),
775
752
  fontSize: 10,
776
753
  margin: [
777
754
  0,
@@ -781,18 +758,18 @@ function E(t, i, a) {
781
758
  ]
782
759
  });
783
760
  let t = [e.header.map((e, t) => ({
784
- ...g(e, { bold: !0 }, p),
761
+ ..._(e, { bold: !0 }, p),
785
762
  fontSize: 9,
786
763
  ...t === 1 ? { alignment: "right" } : {}
787
764
  })), ...e.rows.map((e) => [{
788
- ...g(e.label, {}, p),
765
+ ..._(e.label, {}, p),
789
766
  fontSize: 9
790
767
  }, {
791
768
  text: String(e.count),
792
769
  fontSize: 9,
793
770
  alignment: "right"
794
771
  }])];
795
- M.push({
772
+ P.push({
796
773
  table: {
797
774
  headerRows: 1,
798
775
  widths: ["auto", "auto"],
@@ -801,13 +778,27 @@ function E(t, i, a) {
801
778
  layout: "lightHorizontalLines"
802
779
  });
803
780
  }
781
+ let F = p?.(h.exportPage("1", "1"));
804
782
  return {
805
- content: M,
806
- pageOrientation: b,
807
- pageSize: y,
808
- pageMargins: S,
809
- footer: (e, t) => ({
810
- ...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 } : {},
811
802
  alignment: "center",
812
803
  fontSize: 8,
813
804
  color: "#888",
@@ -817,78 +808,82 @@ function E(t, i, a) {
817
808
  0,
818
809
  0
819
810
  ]
820
- })
811
+ },
812
+ ...m?.fonts || m?.vfs ? { fonts: {
813
+ fonts: m.fonts,
814
+ vfs: m.vfs
815
+ } } : {}
821
816
  };
822
817
  }
823
- var D = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
824
- function O(e, t, n) {
825
- let { title: r, subtitle: i, totals: o, summary: s, metadata: c } = n || {}, l = D, u = (t) => e.map((e) => ` <field name="${l(e)}">${l(t[e])}</field>`).join("\n"), d = ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>", `<export${r ? ` title="${l(r)}"` : ""} generated="${(/* @__PURE__ */ new Date()).toISOString()}">`];
826
- if (i && d.push(` <subtitle>${l(i)}</subtitle>`), c) {
827
- d.push(" <metadata>");
828
- for (let [e, t] of a(c)) d.push(` <item name="${l(e)}">${l(t)}</item>`);
829
- d.push(" </metadata>");
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()}">`];
821
+ if (i && u.push(` <subtitle>${c(i)}</subtitle>`), s) {
822
+ u.push(" <metadata>");
823
+ for (let [e, t] of m(s)) u.push(` <item name="${c(e)}">${c(t)}</item>`);
824
+ u.push(" </metadata>");
830
825
  }
831
- d.push(` <rows count="${t.length}">`);
832
- for (let e of t) d.push(" <row>", u(e), " </row>");
833
- if (d.push(" </rows>"), o && d.push(" <totals>", u(o), " </totals>"), s && (Object.keys(s.items).length > 0 || s.tables?.length)) {
834
- d.push(" <summary>");
835
- for (let [e, t] of Object.entries(s.items)) d.push(` <item name="${l(e)}">${l(t)}</item>`);
836
- for (let e of s.tables || []) {
837
- d.push(` <table title="${l(e.title)}" label="${l(e.header[0])}" count="${l(e.header[1])}">`);
838
- for (let t of e.rows) d.push(` <row label="${l(t.label)}" count="${t.count}" />`);
839
- d.push(" </table>");
826
+ u.push(` <rows count="${t.length}">`);
827
+ for (let e of t) u.push(" <row>", l(e), " </row>");
828
+ if (u.push(" </rows>"), a && u.push(" <totals>", l(a), " </totals>"), o && (Object.keys(o.items).length > 0 || o.tables?.length)) {
829
+ u.push(" <summary>");
830
+ for (let [e, t] of Object.entries(o.items)) u.push(` <item name="${c(e)}">${c(t)}</item>`);
831
+ for (let e of o.tables || []) {
832
+ u.push(` <table title="${c(e.title)}" label="${c(e.header[0])}" count="${c(e.header[1])}">`);
833
+ for (let t of e.rows) u.push(` <row label="${c(t.label)}" count="${t.count}" />`);
834
+ u.push(" </table>");
840
835
  }
841
- d.push(" </summary>");
836
+ u.push(" </summary>");
842
837
  }
843
- return d.push("</export>"), new Blob([d.join("\n")], { type: "application/xml;charset=utf-8;" });
838
+ return u.push("</export>"), new Blob([u.join("\n")], { type: "application/xml;charset=utf-8;" });
844
839
  }
845
- async function k(e, t, r, i) {
846
- let a = i?.totals ?? v(r, t, i?.totalKeys, i?.columns, n(i?.metadata)), o = i?.summary, s = i?.metadata, c = i?.subtitle || i?.pdf?.subtitle, l = i?.columnMeta ?? (i?.columns ? _(i.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);
847
842
  switch (e) {
848
- case "csv": return y(t, r, a, o, s, c);
849
- case "xlsx": return await x(t, r, {
850
- totals: a,
851
- summary: o,
852
- style: i?.xlsx,
853
- sheetName: i?.xlsx?.sheetName,
854
- columnMeta: l,
855
- cellStyles: i?.cellStyles,
856
- metadata: s,
857
- subtitle: c
843
+ case "csv": return b(t, n, i, a, o, s);
844
+ case "xlsx": return await w(t, n, {
845
+ totals: i,
846
+ summary: a,
847
+ style: r?.xlsx,
848
+ sheetName: r?.xlsx?.sheetName,
849
+ columnMeta: c,
850
+ cellStyles: r?.cellStyles,
851
+ metadata: o,
852
+ subtitle: s
858
853
  });
859
- case "json": return S(r, o, s, c);
860
- case "html": return C(t, r, {
861
- title: i?.html?.title || i?.title || i?.pdf?.title,
862
- subtitle: c,
863
- totals: a,
864
- summary: o,
865
- customStyles: i?.html?.styles,
866
- columnMeta: l,
867
- cellStyles: i?.cellStyles,
868
- metadata: s,
869
- branding: i?.branding
854
+ case "json": return T(n, a, o, s);
855
+ case "html": return E(t, n, {
856
+ title: r?.html?.title || r?.title || r?.pdf?.title,
857
+ subtitle: s,
858
+ totals: i,
859
+ summary: a,
860
+ customStyles: r?.html?.styles,
861
+ columnMeta: c,
862
+ cellStyles: r?.cellStyles,
863
+ metadata: o,
864
+ branding: r?.branding
870
865
  });
871
- case "xml": return O(t, r, {
872
- title: i?.title,
873
- subtitle: c,
874
- totals: a,
875
- summary: o,
876
- metadata: s
866
+ case "xml": return M(t, n, {
867
+ title: r?.title,
868
+ subtitle: s,
869
+ totals: i,
870
+ summary: a,
871
+ metadata: o
877
872
  });
878
- case "pdf": return C(t, r, {
879
- title: i?.pdf?.title || i?.title || n(i?.metadata).export,
880
- subtitle: c,
881
- totals: a,
882
- summary: o,
873
+ case "pdf": return E(t, n, {
874
+ title: r?.pdf?.title || r?.title || d(r?.metadata).export,
875
+ subtitle: s,
876
+ totals: i,
877
+ summary: a,
883
878
  customStyles: `
884
- @page{size:${i?.pdf?.pageSize || "A4"} ${i?.pdf?.orientation || "portrait"};margin:15mm}
885
- body{font-size:${i?.pdf?.fontSize || 10}pt}
879
+ @page{size:${r?.pdf?.pageSize || "A4"} ${r?.pdf?.orientation || "portrait"};margin:15mm}
880
+ body{font-size:${r?.pdf?.fontSize || 10}pt}
886
881
  `,
887
- columnMeta: l,
888
- cellStyles: i?.cellStyles,
889
- metadata: s
882
+ columnMeta: c,
883
+ cellStyles: r?.cellStyles,
884
+ metadata: o
890
885
  });
891
- default: return y(t, r, a, o, s, c);
886
+ default: return b(t, n, i, a, o, s);
892
887
  }
893
888
  }
894
- export { i as autoFormatValue, o as buildBusinessMeta, _ as buildColumnMeta, k as buildExportBlob, d as downloadBlob, l as executeFileAction, r as formatContextLine, a as formatMetadataLines, y as generateCSV, C as generateHTML, S as generateJSON, E as generateTablePDFDocDef, x as generateXLSX, O as generateXML, s as getExtension, u as getFormatLabel, f as openPreview, t as prepareExportRows, c as rawDataToBlob, p 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 };