@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,6 +1,6 @@
1
1
  "use client";
2
- import { t as e } from "./ChartView-Cehrcr05.js";
3
- import { n as t } from "./summaryChartData-Djo73zb8.js";
2
+ import { t as e } from "./ChartView-nS4f4EU_.js";
3
+ import { n as t } from "./summaryChartData-pNvzaEHp.js";
4
4
  import { jsx as n } from "react/jsx-runtime";
5
5
  // src/components/DataTable/summary/SummaryChart.tsx
6
6
  var r = {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { t as e } from "./ChartImageMenu-HILSfn5A.js";
3
- import { n as t } from "./summaryChartData-Djo73zb8.js";
2
+ import { t as e } from "./ChartImageMenu-C6MwKKjc.js";
3
+ import { n as t } from "./summaryChartData-pNvzaEHp.js";
4
4
  import { jsx as n } from "react/jsx-runtime";
5
5
  // src/components/DataTable/summary/SummaryImage.tsx
6
6
  function r({ item: r, report: i, context: a, branding: o, format: s, locale: c, labels: l }) {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { t as e } from "./ChartImageMenu-HILSfn5A.js";
3
- import { t } from "./ChartView-Cehrcr05.js";
4
- import { J as n, Tt as r, U as i, ot as a } from "./geometry-CG2nOEnw.js";
5
- import { n as o, o as s, s as c } from "./scrollArea-CkPGDYH2.js";
6
- import { r as l, t as u } from "./summaryChartData-Djo73zb8.js";
2
+ import { t as e } from "./ChartImageMenu-C6MwKKjc.js";
3
+ import { t } from "./ChartView-nS4f4EU_.js";
4
+ import { J as n, Tt as r, U as i, ot as a } from "./geometry-ChwYB45B.js";
5
+ import { n as o, o as s, s as c } from "./scrollArea-DAlVT5U7.js";
6
+ import { r as l, t as u } from "./summaryChartData-pNvzaEHp.js";
7
7
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
8
8
  // src/components/DataTable/summary/SummarySeeAll.tsx
9
9
  function m({ item: m, all: h, onClose: g, onSelect: _, image: v, labels: y }) {
@@ -0,0 +1 @@
1
+ const e=()=>new DOMException(`Aborted`,`AbortError`);async function t(t,n){if(n.signal?.aborted)throw e();switch(t.kind){case`xlsx`:return l(t.workbook,n);case`pdf`:return p(t,n);default:throw Error(`Unknown file task: ${t.kind}`)}}const n=globalThis;async function r(){let e=await import(`exceljs`),t=[e.default?.default,e.default,e,n.ExcelJS].find(e=>e&&typeof e.Workbook==`function`);if(!t)throw Error(`ExcelJS did not load`);return t}async function i(){let e=await import(`pdfmake/build/pdfmake.js`),t=[e.default?.default,e.default,e,n.pdfMake].find(e=>e&&typeof e.createPdf==`function`);if(!t)throw Error(`pdfmake did not load`);let r=await import(`pdfmake/build/vfs_fonts.js`);return{pdfMake:t,vfs:[r?.default,r,r?.pdfMake?.vfs,r?.default?.pdfMake?.vfs,t.vfs,n.pdfMake?.vfs].find(e=>e&&e[`Roboto-Regular.ttf`])}}const a=e=>ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e,o=e=>`FF`+e.replace(`#`,``).toUpperCase();function s(e,t){if(t&&((t.bold!==void 0||t.italic!==void 0||t.size||t.color)&&(e.font={...e.font??{},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.size?{size:t.size}:{},...t.color?{color:{argb:o(t.color)}}:{}}),t.fill&&(e.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:o(t.fill)}}),t.align&&(e.alignment={horizontal:t.align,vertical:`middle`}),t.numFmt&&(typeof e.value==`number`||e.value instanceof Date)&&(e.numFmt=t.numFmt),t.borderTop||t.borderBottom)){let n=e=>({style:e.style,...e.color?{color:{argb:o(e.color)}}:{}});e.border={...t.borderTop?{top:n(t.borderTop)}:{},...t.borderBottom?{bottom:n(t.borderBottom)}:{}}}}function c(e,t,n){let r=e.addRow(t.values);t.style?.bold&&(r.font={bold:!0}),t.merge&&n>1&&e.mergeCells(r.number,1,r.number,n);let i=t.merge?1:Math.max(t.values.length,0);for(let e=0;e<i;e++){let n=r.getCell(e+1);s(n,t.style),s(n,t.cells?.[e])}}async function l(t,n){let i=new(await(r())).Workbook,l=Math.max(1,t.sheets.reduce((e,t)=>e+t.rows.length,0)),u=Math.max(1,Math.floor(l/50)),d=0;for(let r of t.sheets){let t=i.addWorksheet(r.name),a=r.columns.length;t.columns=r.columns.map((e,t)=>({key:String(t),width:e.width}));for(let e of r.before??[])c(t,e,a);let f=t.addRow(r.columns.map(e=>e.header));f.font={bold:r.headerStyle?.bold??!0},f.eachCell((e,t)=>{let n=r.columns[t-1]?.align;n&&(e.alignment={horizontal:n,vertical:`middle`}),s(e,r.headerStyle)});let p=f.number;r.freeze?t.views=[{state:`frozen`,ySplit:r.freeze.rows??0,xSplit:r.freeze.cols??0}]:r.freezeHeader!==!1&&(t.views=[{state:`frozen`,ySplit:p}]),r.rows.forEach((i,a)=>{let c=t.addRow(i),f=r.cellStyles?.[a],p=r.stripe&&a%2==1;if(r.columns.forEach((e,t)=>{let n=c.getCell(t+1);e.numFmt&&(typeof n.value==`number`||n.value instanceof Date)&&(n.numFmt=e.numFmt),e.align&&(n.alignment={horizontal:e.align,vertical:`middle`}),p&&(n.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:o(r.stripe)}}),s(n,e.style),s(n,f?.[t])}),++d%u===0){if(n.signal?.aborted)throw e();n.progress(d/l*.9)}}),r.autoFilter&&r.rows.length>0&&(t.autoFilter={from:{row:p,column:1},to:{row:p,column:a}});for(let e of r.after??[])c(t,e,a)}let f=await i.xlsx.writeBuffer();return n.progress(1),a(f)}const u={Roboto:{normal:`Roboto-Regular.ttf`,bold:`Roboto-Medium.ttf`,italics:`Roboto-Italic.ttf`,bolditalics:`Roboto-MediumItalic.ttf`}};function d(e){let t=e.hLineWidth??1,n=e.edgeLineWidth??t;return{hLineWidth:(e,r)=>e===0||e===(r.table.headerRows??0)||e===r.table.body.length?n:t,vLineWidth:()=>e.vLineWidth??1,...e.hLineColor?{hLineColor:()=>e.hLineColor}:{},...e.vLineColor?{vLineColor:()=>e.vLineColor}:{},...e.paddingX===void 0?{}:{paddingLeft:()=>e.paddingX,paddingRight:()=>e.paddingX},...e.paddingY===void 0?{}:{paddingTop:()=>e.paddingY,paddingBottom:()=>e.paddingY}}}function f(e){return(t,n)=>({text:e.text.replace(/\{page\}/g,String(t)).replace(/\{pages\}/g,String(n)),...e.font?{font:e.font}:{},alignment:e.alignment??`center`,fontSize:e.fontSize??8,...e.color?{color:e.color}:{},...e.margin?{margin:e.margin}:{}})}async function p(t,n){let r=n.pdfFonts?{fonts:{...n.pdfFonts.fonts,...t.fonts?.fonts},vfs:n.pdfFonts.vfs||t.fonts?.vfs?{...n.pdfFonts.vfs,...t.fonts?.vfs}:void 0}:t.fonts,a=t.footer?{...t.document,footer:f(t.footer)}:t.document,o=t.tableLayouts?Object.fromEntries(Object.entries(t.tableLayouts).map(([e,t])=>[e,d(t)])):void 0,{pdfMake:s,vfs:c}=await i();if(n.progress(.1),n.signal?.aborted)throw e();let l={...u,...r?.fonts??{}},p=r?.vfs?{...c??{},...r.vfs}:c,m=await new Promise((e,t)=>{try{let n=s.createPdf(a,o,l,p).getStream(),r=[];n.on(`data`,e=>r.push(e)),n.on(`error`,t),n.on(`end`,()=>{let t=new Uint8Array(r.reduce((e,t)=>e+t.byteLength,0)),n=0;for(let e of r)t.set(e,n),n+=e.byteLength;e(t.buffer)}),n.end()}catch(e){t(e)}});return n.progress(1),m}let m;const h=self;h.onmessage=async e=>{if(e.data.type===`init`){m=e.data.pdfFonts;return}let{id:n,task:r}=e.data;try{let e=await t(r,{progress:e=>h.postMessage({type:`progress`,id:n,fraction:e}),pdfFonts:m});h.postMessage({type:`done`,id:n,buffer:e},[e])}catch(e){h.postMessage({type:`error`,id:n,message:e instanceof Error?e.message:String(e)})}};
@@ -0,0 +1,610 @@
1
+ "use client";
2
+ var e = (e) => String(e).padStart(2, "0"), t = (e, t) => new Date(e, t, 0).getDate();
3
+ function n({ y: e, m: n, d: r }) {
4
+ return !Number.isInteger(e) || !Number.isInteger(n) || !Number.isInteger(r) || e < 1900 || e > 9999 || n < 1 || n > 12 ? !1 : r >= 1 && r <= t(e, n);
5
+ }
6
+ var r = ({ y: t, m: n, d: r }) => `${String(t).padStart(4, "0")}-${e(n)}-${e(r)}`;
7
+ function i(e) {
8
+ let t = /^(\d{4})-(\d{2})-(\d{2})(?:[T ].*)?$/.exec(String(e ?? "").trim());
9
+ if (!t) return null;
10
+ let r = {
11
+ y: Number(t[1]),
12
+ m: Number(t[2]),
13
+ d: Number(t[3])
14
+ };
15
+ return n(r) ? r : null;
16
+ }
17
+ var a = (e = /* @__PURE__ */ new Date()) => r({
18
+ y: e.getFullYear(),
19
+ m: e.getMonth() + 1,
20
+ d: e.getDate()
21
+ }), o = (e) => {
22
+ let t = i(e);
23
+ return t ? r(t) : "";
24
+ }, s = (e, t) => e < t ? -1 : +(e > t);
25
+ function c(e, t) {
26
+ let n = i(e);
27
+ if (!n) return "";
28
+ let a = new Date(n.y, n.m - 1, n.d + t);
29
+ return r({
30
+ y: a.getFullYear(),
31
+ m: a.getMonth() + 1,
32
+ d: a.getDate()
33
+ });
34
+ }
35
+ function l(e, n) {
36
+ let a = i(e);
37
+ if (!a) return "";
38
+ let o = a.y * 12 + (a.m - 1) + n, s = Math.floor(o / 12), c = (o % 12 + 12) % 12 + 1;
39
+ return r({
40
+ y: s,
41
+ m: c,
42
+ d: Math.min(a.d, t(s, c))
43
+ });
44
+ }
45
+ var u = (e, t) => l(e, t * 12);
46
+ function d(e) {
47
+ let t = i(e);
48
+ return t ? r({
49
+ ...t,
50
+ d: 1
51
+ }) : "";
52
+ }
53
+ function f(e) {
54
+ let n = i(e);
55
+ return n ? r({
56
+ ...n,
57
+ d: t(n.y, n.m)
58
+ }) : "";
59
+ }
60
+ function p(e) {
61
+ let t = i(e);
62
+ return t ? new Date(t.y, t.m - 1, t.d).getDay() : -1;
63
+ }
64
+ var m = (e, t, n) => {
65
+ let r = o(t), i = o(n);
66
+ return !(r && s(e, r) < 0 || i && s(e, i) > 0);
67
+ };
68
+ function h(e, t, n) {
69
+ let r = o(t), i = o(n);
70
+ return r && s(e, r) < 0 ? r : i && s(e, i) > 0 ? i : e;
71
+ }
72
+ function g(t) {
73
+ let n = /^(\d{1,2}):(\d{2})(?::\d{2})?$/.exec(String(t ?? "").trim());
74
+ if (!n) return "";
75
+ let r = Number(n[1]), i = Number(n[2]);
76
+ return r > 23 || i > 59 ? "" : `${e(r)}:${e(i)}`;
77
+ }
78
+ function _(e) {
79
+ let [t = "", n = ""] = String(e ?? "").trim().replace(" ", "T").split("T");
80
+ return {
81
+ day: o(t),
82
+ time: g(n)
83
+ };
84
+ }
85
+ function v(e, t) {
86
+ let n = o(e);
87
+ if (!n) return "";
88
+ let r = g(t);
89
+ return r ? `${n}T${r}` : n;
90
+ }
91
+ function y(e, t) {
92
+ if (e > 99) return e;
93
+ let n = (t + 19) % 100, r = Math.floor((t + 19) / 100) * 100;
94
+ return e <= n ? r + e : r - 100 + e;
95
+ }
96
+ var b = /^(\d{2}|\d{4})$/, x = /^\d{1,2}$/;
97
+ function S(e, t, i) {
98
+ if (e.length === 1) {
99
+ let t = e[0];
100
+ if (t.length !== 8) return null;
101
+ let i = {
102
+ y: Number(t.slice(0, 4)),
103
+ m: Number(t.slice(4, 6)),
104
+ d: Number(t.slice(6, 8))
105
+ };
106
+ return n(i) ? r(i) : null;
107
+ }
108
+ if (!b.test(e[0]) || !x.test(e[1]) || e.length === 3 && !x.test(e[2])) return null;
109
+ let a = {
110
+ y: y(Number(e[0]), i),
111
+ m: Number(e[1]),
112
+ d: e.length === 3 ? Number(e[2]) : t.d
113
+ };
114
+ return n(a) ? r(a) : null;
115
+ }
116
+ function C(e, t = {}) {
117
+ let o = String(e ?? "").trim();
118
+ if (!o) return null;
119
+ let s = i(t.today) ?? i(a()), c = i(t.within) ?? s, l = t.order ?? "dmy", u = o.split(/[^0-9]+/).filter(Boolean);
120
+ if (!u.length || u.length > 3) return null;
121
+ if (l === "ymd") return S(u, c, s.y);
122
+ let d = "", f = "", p = "";
123
+ if (u.length === 1) {
124
+ let e = u[0];
125
+ if (e.length <= 2) d = e;
126
+ else if (e.length <= 4) d = e.slice(0, 2), f = e.slice(2);
127
+ else if (e.length === 6) d = e.slice(0, 2), f = e.slice(2, 4), p = e.slice(4, 6);
128
+ else if (e.length === 8) d = e.slice(0, 2), f = e.slice(2, 4), p = e.slice(4, 8);
129
+ else return null;
130
+ } else {
131
+ if (!x.test(u[0]) || !x.test(u[1])) return null;
132
+ if (d = u[0], f = u[1], u.length === 3) {
133
+ if (!b.test(u[2])) return null;
134
+ p = u[2];
135
+ }
136
+ }
137
+ if (l === "mdy" && f) {
138
+ let e = d;
139
+ d = f, f = e;
140
+ }
141
+ let m = {
142
+ d: Number(d),
143
+ m: f ? Number(f) : c.m,
144
+ y: p ? y(Number(p), s.y) : f ? s.y : c.y
145
+ };
146
+ return n(m) ? r(m) : null;
147
+ }
148
+ function w(e, t = {}) {
149
+ let n = String(e ?? "").trim(), r = n.indexOf("+");
150
+ if (r <= 0 || r >= n.length - 1) return null;
151
+ let i = C(n.slice(0, r), t);
152
+ if (!i) return null;
153
+ let a = C(n.slice(r + 1), {
154
+ ...t,
155
+ within: i
156
+ });
157
+ return a ? {
158
+ from: i,
159
+ to: s(a, i) < 0 ? u(a, 1) : a
160
+ } : null;
161
+ }
162
+ function T(t, n = "dd-mm-yyyy") {
163
+ let r = i(t);
164
+ if (!r) return "";
165
+ let a = e(r.d), o = e(r.m), s = String(r.y).padStart(4, "0");
166
+ return n === "yyyy-mm-dd" ? `${s}-${o}-${a}` : n === "dd/mm/yyyy" ? `${a}/${o}/${s}` : `${a}-${o}-${s}`;
167
+ }
168
+ var ee = (e = "dd-mm-yyyy", t = !1) => t ? `${e} hh:mm` : e;
169
+ function te(e, t = "dd-mm-yyyy", n = !1) {
170
+ let { day: r, time: i } = _(e);
171
+ if (!r) return "";
172
+ let a = T(r, t);
173
+ return n && i ? `${a} ${i}` : a;
174
+ }
175
+ function ne(e, t = {}) {
176
+ let n = String(e ?? "").trim(), r = "";
177
+ if (t.withTime) {
178
+ let e = /[\s,]*(\d{1,2}:\d{2})$/.exec(n);
179
+ if (e) {
180
+ if (r = g(e[1]), !r) return null;
181
+ n = n.slice(0, e.index);
182
+ }
183
+ }
184
+ let i = C(n, t);
185
+ return i ? {
186
+ day: i,
187
+ time: r
188
+ } : null;
189
+ }
190
+ function E(e) {
191
+ let n = i(e.month) ?? i(a()), l = r({
192
+ ...n,
193
+ d: 1
194
+ }), u = (Math.trunc(e.weekStart ?? 0) % 7 + 7) % 7, d = o(e.today ?? a()), h = o(e.selected), g = o(e.highlighted), _ = o(e.rangeFrom), v = o(e.rangeTo), y = _ && v ? s(_, v) <= 0 ? _ : v : _ || v, b = _ && v ? s(_, v) <= 0 ? v : _ : _ || v, x = (p(l) - u + 7) % 7, S = t(n.y, n.m), C = e.fixedWeeks === !1 ? Math.ceil((x + S) / 7) : 6, w = c(l, -x), T = [];
195
+ for (let t = 0; t < C; t++) {
196
+ let r = [];
197
+ for (let a = 0; a < 7; a++) {
198
+ let o = c(w, t * 7 + a), l = i(o);
199
+ r.push({
200
+ day: o,
201
+ date: l.d,
202
+ inMonth: l.y === n.y && l.m === n.m,
203
+ isToday: !!d && o === d,
204
+ isSelected: !!h && o === h,
205
+ isHighlighted: !!g && o === g,
206
+ inRange: !!y && !!b && s(o, y) > 0 && s(o, b) < 0,
207
+ isRangeStart: !!y && o === y,
208
+ isRangeEnd: !!b && o === b,
209
+ disabled: !m(o, e.min, e.max)
210
+ });
211
+ }
212
+ T.push(r);
213
+ }
214
+ return {
215
+ month: l,
216
+ year: n.y,
217
+ monthIndex: n.m,
218
+ weeks: T,
219
+ weekdays: Array.from({ length: 7 }, (e, t) => (u + t) % 7),
220
+ canPagePrev: m(c(l, -1), e.min, e.max),
221
+ canPageNext: m(c(f(l), 1), e.min, e.max)
222
+ };
223
+ }
224
+ var re = [
225
+ "highlightLeft",
226
+ "highlightRight",
227
+ "highlightPrev",
228
+ "highlightNext",
229
+ "highlightFirst",
230
+ "highlightLast",
231
+ "highlightPrevPage",
232
+ "highlightNextPage"
233
+ ];
234
+ function ie(e, t, n = {}) {
235
+ let r = o(e) || a();
236
+ return h(t === "highlightLeft" ? c(r, -1) : t === "highlightRight" ? c(r, 1) : t === "highlightPrev" ? c(r, -7) : t === "highlightNext" ? c(r, 7) : t === "highlightFirst" ? d(r) : t === "highlightLast" ? f(r) : t === "highlightPrevPage" ? l(r, -1) : l(r, 1), n.min, n.max);
237
+ }
238
+ function ae(e, t = {}) {
239
+ let { day: n } = _(e);
240
+ return n || h(o(t.today ?? a()) || a(), t.min, t.max);
241
+ }
242
+ function D(e, t = 4) {
243
+ let n = i(e) ?? i(a()), o = Math.min(12, Math.max(1, Math.trunc(t) || 1)), s = r({
244
+ y: n.m >= o ? n.y : n.y - 1,
245
+ m: o,
246
+ d: 1
247
+ });
248
+ return {
249
+ from: s,
250
+ to: c(u(s, 1), -1)
251
+ };
252
+ }
253
+ function oe(e, t = 0) {
254
+ let n = o(e) || a(), r = (Math.trunc(t) % 7 + 7) % 7;
255
+ return c(n, -(((p(n) - r) % 7 + 7) % 7));
256
+ }
257
+ function O(e, t = 4) {
258
+ let n = D(e, t), r = i(e).y * 12 + i(e).m - (i(n.from).y * 12 + i(n.from).m), a = l(n.from, Math.floor(r / 3) * 3);
259
+ return {
260
+ from: a,
261
+ to: f(l(a, 2))
262
+ };
263
+ }
264
+ function se(e = {}) {
265
+ let t = o(e.today ?? a()) || a(), n = e.fyStartMonth ?? 4, r = e.weekStart ?? 0, i = D(t, n), s = D(c(i.from, -1), n), u = oe(t, r), p = c(u, -7), m = l(t, -1), h = O(t, n), g = O(c(h.from, -1), n), _ = [
266
+ {
267
+ key: "today",
268
+ label: "Today",
269
+ single: !0,
270
+ from: t,
271
+ to: t
272
+ },
273
+ {
274
+ key: "yesterday",
275
+ label: "Yesterday",
276
+ single: !0,
277
+ from: c(t, -1),
278
+ to: c(t, -1)
279
+ },
280
+ {
281
+ key: "last7",
282
+ label: "Last 7 days",
283
+ from: c(t, -6),
284
+ to: t
285
+ },
286
+ {
287
+ key: "last30",
288
+ label: "Last 30 days",
289
+ from: c(t, -29),
290
+ to: t
291
+ },
292
+ {
293
+ key: "thisWeek",
294
+ label: "This Week",
295
+ from: u,
296
+ to: c(u, 6)
297
+ },
298
+ {
299
+ key: "lastWeek",
300
+ label: "Last Week",
301
+ from: p,
302
+ to: c(p, 6)
303
+ },
304
+ {
305
+ key: "thisMonth",
306
+ label: "This Month",
307
+ from: d(t),
308
+ to: f(t)
309
+ },
310
+ {
311
+ key: "lastMonth",
312
+ label: "Last Month",
313
+ from: d(m),
314
+ to: f(m)
315
+ },
316
+ {
317
+ key: "thisQuarter",
318
+ label: "This Quarter",
319
+ from: h.from,
320
+ to: h.to
321
+ },
322
+ {
323
+ key: "lastQuarter",
324
+ label: "Last Quarter",
325
+ from: g.from,
326
+ to: g.to
327
+ },
328
+ {
329
+ key: "thisFY",
330
+ label: "This FY",
331
+ from: i.from,
332
+ to: i.to
333
+ },
334
+ {
335
+ key: "lastFY",
336
+ label: "Last FY",
337
+ from: s.from,
338
+ to: s.to
339
+ },
340
+ {
341
+ key: "ytd",
342
+ label: "Year to date",
343
+ from: i.from,
344
+ to: t
345
+ }
346
+ ];
347
+ if (e.labels) for (let t of _) t.label = e.labels[t.key] ?? t.label;
348
+ return e.only ? e.only.map((e) => _.find((t) => t.key === e)).filter((e) => !!e) : _;
349
+ }
350
+ function ce(e, t) {
351
+ let n = String(t ?? "").trim().toLowerCase();
352
+ return n ? e.filter((e) => e.label.toLowerCase().includes(n)) : e;
353
+ }
354
+ function le(e, t, n = {}) {
355
+ let r = o(e);
356
+ if (!r) return d(a());
357
+ let s = Math.max(1, Math.trunc(n.months ?? 1)), c = n.currentMonthSide ?? "right", u = d(r), f = d(o(t) || r), p = i(u), m = i(f), h = (m.y - p.y) * 12 + (m.m - p.m) + 1;
358
+ return c === "right" ? l(h <= s ? f : u, -(s - 1)) : u;
359
+ }
360
+ function k(e, t) {
361
+ let n = o(t);
362
+ if (!n) return {
363
+ from: o(e?.from),
364
+ to: o(e?.to)
365
+ };
366
+ let r = o(e?.from), i = o(e?.to);
367
+ return r ? n === r && n === i ? {
368
+ from: "",
369
+ to: ""
370
+ } : n === r || n === i ? {
371
+ from: n,
372
+ to: n
373
+ } : s(n, r) < 0 ? {
374
+ from: n,
375
+ to: i || r
376
+ } : {
377
+ from: r,
378
+ to: n
379
+ } : {
380
+ from: n,
381
+ to: n
382
+ };
383
+ }
384
+ function A(e) {
385
+ let t, n;
386
+ try {
387
+ t = new Intl.DateTimeFormat(e, {
388
+ month: "long",
389
+ timeZone: "UTC"
390
+ }), n = new Intl.DateTimeFormat(e, {
391
+ weekday: "short",
392
+ timeZone: "UTC"
393
+ });
394
+ } catch {
395
+ t = new Intl.DateTimeFormat(void 0, {
396
+ month: "long",
397
+ timeZone: "UTC"
398
+ }), n = new Intl.DateTimeFormat(void 0, {
399
+ weekday: "short",
400
+ timeZone: "UTC"
401
+ });
402
+ }
403
+ let r = n.resolvedOptions().locale.toLowerCase().startsWith("en");
404
+ return {
405
+ months: Array.from({ length: 12 }, (e, n) => t.format(Date.UTC(2024, n, 1))),
406
+ weekdays: Array.from({ length: 7 }, (e, t) => {
407
+ let i = n.format(Date.UTC(2024, 0, 7 + t));
408
+ return r ? i.slice(0, 2) : i;
409
+ })
410
+ };
411
+ }
412
+ // src/core/logic/tableDate.logic.ts
413
+ var j = (e) => String(e).padStart(2, "0");
414
+ function M(e) {
415
+ if (Number.isNaN(e.getTime())) return null;
416
+ let t = r({
417
+ y: e.getFullYear(),
418
+ m: e.getMonth() + 1,
419
+ d: e.getDate()
420
+ }), n = e.getHours(), i = e.getMinutes();
421
+ return n === 0 && i === 0 ? t : `${t}T${j(n)}:${j(i)}`;
422
+ }
423
+ function N(e, t, i, a, o) {
424
+ if (!n({
425
+ y: e,
426
+ m: t,
427
+ d: i
428
+ })) return null;
429
+ let s = r({
430
+ y: e,
431
+ m: t,
432
+ d: i
433
+ });
434
+ if (a === void 0 || o === void 0) return s;
435
+ let c = Number(a), l = Number(o);
436
+ return c > 23 || l > 59 ? null : c === 0 && l === 0 ? s : `${s}T${j(c)}:${j(l)}`;
437
+ }
438
+ var P = "(?:[T ](\\d{1,2}):(\\d{2})(?::\\d{2}(?:\\.\\d+)?)?)?", ue = RegExp(`^(\\d{4})-(\\d{2})-(\\d{2})${P}$`), F = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})$/i, de = RegExp(`^(\\d{1,2})[-/.](\\d{1,2})[-/.](\\d{4})${P}$`), I = RegExp(`^(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})${P}$`);
439
+ function L(e, t) {
440
+ if (e == null || e === "") return null;
441
+ if (e instanceof Date) return M(e);
442
+ if (typeof e == "number") return Number.isFinite(e) ? M(new Date(e)) : null;
443
+ if (typeof e != "string") return null;
444
+ let n = e.trim();
445
+ if (!n) return null;
446
+ let r = ue.exec(n);
447
+ return r && !F.test(n) ? N(Number(r[1]), Number(r[2]), Number(r[3]), r[4], r[5]) : F.test(n) ? M(new Date(n)) : t === "dd-mm-yyyy" || t === "dd/mm/yyyy" ? (r = de.exec(n), r ? N(Number(r[3]), Number(r[2]), Number(r[1]), r[4], r[5]) : null) : t === "yyyy-mm-dd" ? (r = I.exec(n), r ? N(Number(r[1]), Number(r[2]), Number(r[3]), r[4], r[5]) : null) : /[a-z]/i.test(n) ? M(new Date(n)) : null;
448
+ }
449
+ var R = (e) => e ? e.slice(0, 10) : null, z = (e, t) => e < t ? -1 : +(e > t);
450
+ function B(e, t = "dd-mm-yyyy") {
451
+ if (!e) return "";
452
+ let n = T(e.slice(0, 10), t);
453
+ return e.length > 10 ? `${n} ${e.slice(11, 16)}` : n;
454
+ }
455
+ function V(e, t, n, r) {
456
+ let i = e == null, a = t == null;
457
+ return i && a ? 0 : i ? n ? -1 : 1 : a ? n ? 1 : -1 : r(e, t);
458
+ }
459
+ var H = {
460
+ pageSize: 25,
461
+ pageSizeOptions: [
462
+ 25,
463
+ 50,
464
+ 100,
465
+ 500,
466
+ -1
467
+ ]
468
+ }, U = {
469
+ multiSort: !1,
470
+ defaultSort: []
471
+ }, W = { advanced: !0 }, fe = [
472
+ "xlsx",
473
+ "pdf",
474
+ "csv",
475
+ "html",
476
+ "json"
477
+ ], G = { mode: "multiple" };
478
+ function pe() {
479
+ return {
480
+ id: q(),
481
+ logic: "AND",
482
+ conditions: []
483
+ };
484
+ }
485
+ function me(e) {
486
+ return e.pagination === !1 ? !1 : e.pagination === !0 || e.pagination === void 0 ? H : {
487
+ ...H,
488
+ ...e.pagination
489
+ };
490
+ }
491
+ function he(e) {
492
+ return e.sorting === !1 ? !1 : e.sorting === !0 || e.sorting === void 0 ? U : {
493
+ ...U,
494
+ ...e.sorting
495
+ };
496
+ }
497
+ function K(e) {
498
+ return e.filtering === !1 ? !1 : e.filtering === !0 || e.filtering === void 0 ? W : {
499
+ ...W,
500
+ ...e.filtering
501
+ };
502
+ }
503
+ function ge(e) {
504
+ if (!e.export) return !1;
505
+ let t = { ...e.export };
506
+ return t.quick && (t.quick.enabled === void 0 && (t.quick = {
507
+ ...t.quick,
508
+ enabled: !0
509
+ }), t.quick.formats || (t.quick = {
510
+ ...t.quick,
511
+ formats: fe
512
+ }), t.quick.fileNameAs || (t.quick = {
513
+ ...t.quick,
514
+ fileNameAs: "title-date-generated"
515
+ })), t;
516
+ }
517
+ function _e(e) {
518
+ let t = e.selection;
519
+ return t ? t === !0 || t === "onDemand" ? {
520
+ ...G,
521
+ show: "onDemand"
522
+ } : t === "always" ? {
523
+ ...G,
524
+ show: "always"
525
+ } : {
526
+ ...G,
527
+ ...t,
528
+ show: t.show ?? "onDemand"
529
+ } : !1;
530
+ }
531
+ function q() {
532
+ return Math.random().toString(36).substring(2, 10);
533
+ }
534
+ function J(e, t) {
535
+ return t.split(".").reduce((e, t) => e?.[t], e);
536
+ }
537
+ // src/components/DataTable/columnValue.ts
538
+ var ve = "dd-mm-yyyy";
539
+ function Y(e, t) {
540
+ return e.value ? e.value(t) : J(t, e.key);
541
+ }
542
+ function X(e, t, n) {
543
+ return L(typeof e.parse == "function" ? e.parse(t, n) : t, typeof e.parse == "string" ? e.parse : void 0);
544
+ }
545
+ var ye = (e, t) => X(e, Y(e, t), t);
546
+ function be(e, t, n) {
547
+ return e.filterAccessor ? L(e.filterAccessor(t), typeof e.parse == "string" ? e.parse : void 0) : X(e, t, n);
548
+ }
549
+ function Z(e, t, n) {
550
+ let r = X(e, t, n);
551
+ return r ? B(r, e.dateFormat ?? "dd-mm-yyyy") : t == null ? "" : String(t);
552
+ }
553
+ function xe(e, t, n) {
554
+ switch (t) {
555
+ case "integer": return n.number(e, 0);
556
+ case "amount": return n.number(e, 2);
557
+ case "currency": return n.money(e);
558
+ case "percent": return n.percent(e);
559
+ default: return String(e);
560
+ }
561
+ }
562
+ function Q(e, t, n, r) {
563
+ if (e.format) {
564
+ let n = e.format(t, r);
565
+ return n == null ? "" : String(n);
566
+ }
567
+ if (e.type === "date" || t instanceof Date) return Z(e, t, r);
568
+ if (t == null) return "";
569
+ if (Array.isArray(t)) return t.map((t) => Q({
570
+ ...e,
571
+ format: void 0
572
+ }, t, n, r)).filter(Boolean).join(", ");
573
+ if (typeof t == "boolean") return t ? n.yes : n.no;
574
+ let i = e.filterOptions?.find((e) => String(e.value) === String(t));
575
+ return i ? i.label : typeof t == "number" && e.numberFormat && n.fmt && Number.isFinite(t) ? xe(t, e.numberFormat, n.fmt) : typeof t == "object" ? "" : String(t);
576
+ }
577
+ var Se = (e, t, n) => Q(e, Y(e, t), n, t);
578
+ function Ce(e, t, n) {
579
+ let r = Y(e, t);
580
+ if (e.searchText) return e.searchText(r, t) ?? "";
581
+ let i = Q(e, r, n, t), a = r == null || typeof r == "object" ? "" : String(r);
582
+ return a && a !== i ? `${i} ${a}` : i;
583
+ }
584
+ var $ = (e) => e == null || e === "" || typeof e == "number" && Number.isNaN(e);
585
+ function we(e, t, n, r) {
586
+ if (e.sortValue) {
587
+ let r = e.sortValue(t, n);
588
+ return $(r) ? null : r;
589
+ }
590
+ if (e.type === "date") return X(e, t, n);
591
+ if ($(t)) return null;
592
+ if (e.type === "number") {
593
+ let e = typeof t == "number" ? t : Number(t);
594
+ return Number.isFinite(e) ? e : null;
595
+ }
596
+ if (typeof t == "boolean") return +!!t;
597
+ let i = Q({
598
+ ...e,
599
+ format: void 0,
600
+ numberFormat: void 0
601
+ }, t, r, n);
602
+ return i === "" ? null : i;
603
+ }
604
+ function Te(e, t) {
605
+ return typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t), void 0, {
606
+ numeric: !0,
607
+ sensitivity: "base"
608
+ });
609
+ }
610
+ export { ee as A, ne as B, R as C, se as D, E, v as F, a as G, l as H, ce as I, le as K, ie as L, te as M, T as N, A as O, m as P, ae as R, B as S, re as T, _ as U, i as V, d as W, me as _, Y as a, V as b, be as c, Q as d, pe as f, K as g, ge as h, Se as i, k as j, s as k, Ce as l, J as m, ye as n, Te as o, q as p, X as r, Z as s, ve as t, we as u, _e as v, L as w, z as x, he as y, w as z };