@nice2dev/ui 1.1.6 → 1.1.7

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 (162) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +50 -29
  3. package/css/legacy-bg-text-aliases.css +65 -61
  4. package/dist/NiceCodeEditor-Bc81wiaN.js +1134 -0
  5. package/dist/NiceCodeEditor-D6f8KdHN.js +1134 -0
  6. package/dist/NiceCodeEditor-DE3saxyt.cjs +260 -0
  7. package/dist/NiceCodeEditor-DZM16My5.cjs +260 -0
  8. package/dist/NiceCodeEditor-HqmcJjmZ.js +1179 -0
  9. package/dist/NiceColorPicker-6EqXaDj0.cjs +1 -0
  10. package/dist/NiceColorPicker-BiEWqWnd.js +596 -0
  11. package/dist/NiceColorPicker-Cuc6YXqz.cjs +1 -0
  12. package/dist/NiceColorPicker-DMATcNWG.js +596 -0
  13. package/dist/NiceColorPicker-R3O1nemp.js +596 -0
  14. package/dist/NiceConfirmDialog-B0e10fRL.cjs +1 -0
  15. package/dist/NiceConfirmDialog-BBDgEMHv.js +81 -0
  16. package/dist/NiceConfirmDialog-C7kdr8jJ.js +81 -0
  17. package/dist/NiceConfirmDialog-DMHqPfFM.js +81 -0
  18. package/dist/NiceConfirmDialog-ZJpQLQQS.cjs +1 -0
  19. package/dist/NiceDataGrid-BzUw4dSu.cjs +10 -0
  20. package/dist/NiceDataGrid-CPKcVOVz.js +1743 -0
  21. package/dist/NiceDataGrid-DJr33WMy.cjs +10 -0
  22. package/dist/NiceDataGrid-D_4gZ1Hu.js +1736 -0
  23. package/dist/NiceDataGrid-DlUAaXhD.js +1736 -0
  24. package/dist/NiceDocumentViewer-8ghRVtfO.js +672 -0
  25. package/dist/NiceDocumentViewer-ChWtA_Ry.cjs +180 -0
  26. package/dist/NiceDocumentViewer-DwLUV7Tc.js +672 -0
  27. package/dist/NiceDocumentViewer-goMzF1w3.cjs +180 -0
  28. package/dist/NiceDocumentViewer-gt1mxzP8.js +672 -0
  29. package/dist/NiceForm-CHEAHxDw.js +4805 -0
  30. package/dist/NiceForm-CJUp1CL0.cjs +1 -0
  31. package/dist/NiceForm-Cp_RH3Yj.js +4805 -0
  32. package/dist/NiceForm-a6tGr6ss.js +4819 -0
  33. package/dist/NiceForm-jU89oe2S.cjs +1 -0
  34. package/dist/NiceGantt-BnQwyTfG.cjs +1 -0
  35. package/dist/NiceGantt-D8coFAvK.js +328 -0
  36. package/dist/NiceGantt-DOZfT6r5.js +328 -0
  37. package/dist/NiceGantt-DQzH1V-R.js +328 -0
  38. package/dist/NiceGantt-jQ8ZpXko.cjs +1 -0
  39. package/dist/NiceHtmlEditor-B1nlXJNW.cjs +10 -0
  40. package/dist/NiceHtmlEditor-Bv3VqJPG.js +862 -0
  41. package/dist/NiceHtmlEditor-CKsGj-Ei.cjs +10 -0
  42. package/dist/NiceHtmlEditor-CloMgyzg.js +841 -0
  43. package/dist/NiceHtmlEditor-DUAHmkWI.js +841 -0
  44. package/dist/NiceLoginForm-Ce_QLnLf.js +736 -0
  45. package/dist/NiceLoginForm-DLpNTQlR.cjs +1 -0
  46. package/dist/NiceLoginForm-Dg0286Cc.js +736 -0
  47. package/dist/NiceLoginForm-X05Vadeg.js +708 -0
  48. package/dist/NiceLoginForm-f_dBCnUi.cjs +1 -0
  49. package/dist/NiceMention-BByI4nFG.js +11120 -0
  50. package/dist/NiceMention-C2TPiMph.cjs +430 -0
  51. package/dist/NiceMention-C67vT6m0.js +11145 -0
  52. package/dist/NiceMention-D1cdy63w.cjs +430 -0
  53. package/dist/NiceMention-QIuggb9Y.js +11122 -0
  54. package/dist/NiceMention.css +1 -1
  55. package/dist/NiceModal-CHaan9al.js +95 -0
  56. package/dist/NiceModal-Czq6OEAT.js +95 -0
  57. package/dist/NiceModal-D-HFwawr.js +95 -0
  58. package/dist/NiceModal-DOy2XTzc.cjs +1 -0
  59. package/dist/NiceModal-DkawKzEE.cjs +1 -0
  60. package/dist/NiceModuleLifecyclePanel-1CsP8Zst.js +6997 -0
  61. package/dist/NiceModuleLifecyclePanel-Bkx4Yg-3.cjs +1 -0
  62. package/dist/NiceModuleLifecyclePanel-C5oYtczk.js +6999 -0
  63. package/dist/NiceModuleLifecyclePanel-DCcy2yYi.cjs +1 -0
  64. package/dist/NiceModuleLifecyclePanel-DqdgW-0s.js +7004 -0
  65. package/dist/NiceModuleLifecyclePanel.css +1 -1
  66. package/dist/NicePagination-7od5KUa3.cjs +1 -0
  67. package/dist/NicePagination-DMrkR8hH.cjs +1 -0
  68. package/dist/NicePagination-DQmZpsSQ.js +179 -0
  69. package/dist/NicePagination-DipQRjPq.js +172 -0
  70. package/dist/NicePagination-KhlVXYaT.js +172 -0
  71. package/dist/NicePivotGrid-B-KthuqL.cjs +152 -0
  72. package/dist/NicePivotGrid-CLCTHkKO.cjs +152 -0
  73. package/dist/NicePivotGrid-DV54FCsH.js +1174 -0
  74. package/dist/NicePivotGrid-DoWLUPUs.js +1167 -0
  75. package/dist/NicePivotGrid-etwpfccz.js +1167 -0
  76. package/dist/NiceSavedQueryPanel-BABkTNc5.js +5129 -0
  77. package/dist/NiceSavedQueryPanel-Cfeig83P.cjs +586 -0
  78. package/dist/NiceSavedQueryPanel-DTWRLseb.cjs +586 -0
  79. package/dist/NiceSavedQueryPanel-Dy154sxE.js +5129 -0
  80. package/dist/NiceSavedQueryPanel-v7AffOOe.js +5129 -0
  81. package/dist/NiceSavedQueryPanel.css +1 -1
  82. package/dist/NiceScheduler-BEgB7ZgF.cjs +5 -0
  83. package/dist/NiceScheduler-C9JprsEI.cjs +5 -0
  84. package/dist/NiceScheduler-DSP-PPh0.js +1645 -0
  85. package/dist/NiceScheduler-DuPnaA3t.js +1652 -0
  86. package/dist/NiceScheduler-Oa89YZx9.js +1645 -0
  87. package/dist/NiceSelect-A336yeLZ.js +433 -0
  88. package/dist/NiceSelect-B5hTbqi2.js +433 -0
  89. package/dist/NiceSelect-BYSgDYzq.cjs +1 -0
  90. package/dist/NiceSelect-Dudf2T5T.js +433 -0
  91. package/dist/NiceSelect-DwBAIrX7.cjs +1 -0
  92. package/dist/NiceWindow-B6zjBTl9.cjs +1 -0
  93. package/dist/NiceWindow-BKQEx7Vf.js +1623 -0
  94. package/dist/NiceWindow-BnTH7Gy0.js +1623 -0
  95. package/dist/NiceWindow-CZN9NVZw.cjs +1 -0
  96. package/dist/NiceWindow-lxtPR7yZ.js +1623 -0
  97. package/dist/NiceWindow.css +1 -1
  98. package/dist/charts-B8_V3_nq.cjs +882 -0
  99. package/dist/charts-BZgyyybE.js +31933 -0
  100. package/dist/charts-FuDk5-r6.js +31958 -0
  101. package/dist/charts-INj3yFo5.js +31946 -0
  102. package/dist/charts-NolNXKUL.cjs +882 -0
  103. package/dist/charts.cjs +1 -1
  104. package/dist/charts.css +1 -1
  105. package/dist/charts.mjs +1 -1
  106. package/dist/core-A_A6c7an.js +795 -0
  107. package/dist/core-B2iH2J_X.js +795 -0
  108. package/dist/core-BmspZEfD.js +795 -0
  109. package/dist/core-DAfLOet6.cjs +1 -0
  110. package/dist/core-ZG3bgnBR.cjs +1 -0
  111. package/dist/data-branching-B3TOqXAO.cjs +1 -0
  112. package/dist/data-branching-BUGiICDZ.js +6275 -0
  113. package/dist/data-branching-DMXmcocj.js +6275 -0
  114. package/dist/data-branching-YE8P9M5P.js +6275 -0
  115. package/dist/data-branching-t6uhAwIm.cjs +1 -0
  116. package/dist/data-branching.cjs +1 -1
  117. package/dist/data-branching.mjs +1 -1
  118. package/dist/data.cjs +1 -1
  119. package/dist/data.d.ts +7 -2
  120. package/dist/data.mjs +3 -3
  121. package/dist/devops-BhV3OmF7.js +8285 -0
  122. package/dist/devops-BqUxnbRi.cjs +17 -0
  123. package/dist/devops-Bx-Qwj9w.cjs +17 -0
  124. package/dist/devops-DYZatW45.js +8251 -0
  125. package/dist/devops-R98k2zpd.js +8251 -0
  126. package/dist/devops.cjs +1 -1
  127. package/dist/devops.d.ts +29 -16
  128. package/dist/devops.mjs +1 -1
  129. package/dist/editors.cjs +1 -1
  130. package/dist/editors.d.ts +35 -20
  131. package/dist/editors.mjs +7 -7
  132. package/dist/feedback.cjs +1 -1
  133. package/dist/feedback.mjs +3 -3
  134. package/dist/index.cjs +445 -445
  135. package/dist/index.css +1 -1
  136. package/dist/index.d.ts +190 -111
  137. package/dist/index.mjs +16635 -16351
  138. package/dist/lazy.cjs +1 -1
  139. package/dist/lazy.d.ts +31 -18
  140. package/dist/lazy.mjs +24 -24
  141. package/dist/navigation.cjs +1 -1
  142. package/dist/navigation.d.ts +17 -14
  143. package/dist/navigation.mjs +130 -130
  144. package/dist/no-code-BPaAS4wW.cjs +332 -0
  145. package/dist/no-code-CBwUVL1i.js +7447 -0
  146. package/dist/no-code-CjktkQ50.js +7447 -0
  147. package/dist/no-code-DW2NrRba.js +7447 -0
  148. package/dist/no-code-DmFxrZ5T.cjs +332 -0
  149. package/dist/no-code.cjs +1 -1
  150. package/dist/no-code.d.ts +2 -2
  151. package/dist/no-code.mjs +1 -1
  152. package/dist/overlays.cjs +1 -1
  153. package/dist/overlays.d.ts +4 -4
  154. package/dist/overlays.mjs +2 -2
  155. package/dist/pickerCommons-C4XWRUvH.cjs +1 -0
  156. package/dist/pickerCommons-C_BpYs_m.cjs +1 -0
  157. package/dist/pickerCommons-DAOXH_u5.js +1122 -0
  158. package/dist/pickerCommons-Dn4wnDco.js +1122 -0
  159. package/dist/pickerCommons-DskswPS5.js +1122 -0
  160. package/dist/pickerCommons.css +1 -1
  161. package/dist/style.css +7 -7
  162. package/package.json +3 -3
@@ -0,0 +1,172 @@
1
+ import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
+ import { o as u } from "./charts-BZgyyybE.js";
3
+ import { a as k } from "./pickerCommons-DskswPS5.js";
4
+ function M(e, a, l) {
5
+ const r = [];
6
+ if (a <= 1)
7
+ return a === 1 && r.push(1), r;
8
+ const s = Math.max(2, e - l), o = Math.min(a - 1, e + l);
9
+ r.push(1), s > 2 && r.push("dots");
10
+ for (let c = s; c <= o; c++)
11
+ r.push(c);
12
+ return o < a - 1 && r.push("dots"), r.push(a), r;
13
+ }
14
+ const z = ({
15
+ page: e,
16
+ totalPages: a,
17
+ onChange: l,
18
+ showInfo: r = !0,
19
+ siblingCount: s = 2,
20
+ size: o = "md",
21
+ showFirstLast: c,
22
+ showJumpInput: h,
23
+ jumpInputLabel: f,
24
+ showPageSize: b,
25
+ pageSizeOptions: d,
26
+ pageSize: N,
27
+ onPageSizeChange: _,
28
+ disabled: t,
29
+ className: v,
30
+ style: g
31
+ }) => {
32
+ const x = M(e, a, s);
33
+ return /* @__PURE__ */ m(
34
+ "nav",
35
+ {
36
+ className: `nice-pagination nice-pagination--${o} ${v || ""}`,
37
+ style: g,
38
+ "aria-label": "Pagination",
39
+ children: [
40
+ c && /* @__PURE__ */ i(
41
+ "button",
42
+ {
43
+ className: "nice-pagination__btn",
44
+ disabled: t || e <= 1,
45
+ onClick: () => l(1),
46
+ "aria-label": "First page",
47
+ title: "First page",
48
+ children: /* @__PURE__ */ i(u, { name: "chevron-left", size: 14 })
49
+ }
50
+ ),
51
+ /* @__PURE__ */ i(
52
+ "button",
53
+ {
54
+ className: "nice-pagination__btn",
55
+ disabled: t || e <= 1,
56
+ onClick: () => l(e - 1),
57
+ "aria-label": "Previous",
58
+ children: /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ i(
59
+ "path",
60
+ {
61
+ fillRule: "evenodd",
62
+ d: "M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",
63
+ clipRule: "evenodd"
64
+ }
65
+ ) })
66
+ }
67
+ ),
68
+ x.map(
69
+ (n, p) => n === "dots" ? /* @__PURE__ */ i("span", { className: "nice-pagination__ellipsis", children: "…" }, `dots-${p}`) : /* @__PURE__ */ i(
70
+ "button",
71
+ {
72
+ className: `nice-pagination__btn ${n === e ? "nice-pagination__btn--active" : ""}`,
73
+ disabled: t,
74
+ onClick: () => l(n),
75
+ "aria-current": n === e ? "page" : void 0,
76
+ children: n
77
+ },
78
+ n
79
+ )
80
+ ),
81
+ /* @__PURE__ */ i(
82
+ "button",
83
+ {
84
+ className: "nice-pagination__btn",
85
+ disabled: t || e >= a,
86
+ onClick: () => l(e + 1),
87
+ "aria-label": "Next",
88
+ children: /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ i(
89
+ "path",
90
+ {
91
+ fillRule: "evenodd",
92
+ d: "M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",
93
+ clipRule: "evenodd"
94
+ }
95
+ ) })
96
+ }
97
+ ),
98
+ c && /* @__PURE__ */ i(
99
+ "button",
100
+ {
101
+ className: "nice-pagination__btn",
102
+ disabled: t || e >= a,
103
+ onClick: () => l(a),
104
+ "aria-label": "Last page",
105
+ title: "Last page",
106
+ children: /* @__PURE__ */ i(u, { name: "skip-forward", size: 14 })
107
+ }
108
+ ),
109
+ r && /* @__PURE__ */ m("span", { className: "nice-pagination__info", children: [
110
+ e,
111
+ " / ",
112
+ a
113
+ ] }),
114
+ h && /* @__PURE__ */ m(
115
+ "span",
116
+ {
117
+ className: "nice-pagination__jump",
118
+ style: { display: "inline-flex", alignItems: "center", gap: 6, marginLeft: 8 },
119
+ children: [
120
+ /* @__PURE__ */ i("span", { style: { fontSize: "0.85rem", color: "var(--nice-text-secondary)" }, children: f ?? "Go to" }),
121
+ /* @__PURE__ */ i(
122
+ k,
123
+ {
124
+ size: o === "lg" ? "md" : "sm",
125
+ min: 1,
126
+ max: a,
127
+ step: 1,
128
+ value: e,
129
+ disabled: t,
130
+ onChange: (n) => {
131
+ const p = typeof n == "number" ? n : Number(n);
132
+ if (!Number.isNaN(p)) {
133
+ const y = Math.max(1, Math.min(a, Math.floor(p)));
134
+ l(y);
135
+ }
136
+ }
137
+ }
138
+ )
139
+ ]
140
+ }
141
+ ),
142
+ b && d && d.length > 0 && /* @__PURE__ */ i(
143
+ "select",
144
+ {
145
+ className: "nice-pagination__size",
146
+ value: N ?? d[0],
147
+ disabled: t,
148
+ onChange: (n) => _?.(Number(n.target.value)),
149
+ style: {
150
+ marginLeft: 8,
151
+ padding: "4px 8px",
152
+ border: "1px solid var(--nice-border-color)",
153
+ borderRadius: 6,
154
+ background: "var(--nice-bg-primary)",
155
+ color: "var(--nice-text-primary)",
156
+ font: "inherit",
157
+ fontSize: "0.85rem"
158
+ },
159
+ "aria-label": "Rows per page",
160
+ children: d.map((n) => /* @__PURE__ */ m("option", { value: n, children: [
161
+ n,
162
+ " / page"
163
+ ] }, n))
164
+ }
165
+ )
166
+ ]
167
+ }
168
+ );
169
+ };
170
+ export {
171
+ z as N
172
+ };
@@ -0,0 +1,152 @@
1
+ "use strict";const s=require("react/jsx-runtime"),M=require("./charts-NolNXKUL.cjs"),N=require("react"),$e=require("react-dom"),ce=require("./NiceSelect-BYSgDYzq.cjs"),de=({text:e,label:t,icon:n,items:r,variant:f="primary",size:m="md",disabled:d,readOnly:p,loading:i,onItemClick:l,splitButton:a,onClick:_,className:u,style:h,id:b,title:o,accessMode:c,displayStyle:w,error:U,errorPlacement:j="bottom"})=>{const S=M.rc("button",w),g=M.ac("button",w),F=M.Dc(c,b),$=F==="hidden";F==="disabled"&&(d=!0),i&&(d=!0);const x=!d&&(p||F==="readOnly"),v=M.Ys(f),O=e||t,[L,V]=N.useState(!1),q=N.useRef(null),B=N.useRef(null),J=N.useRef(null),[P,Q]=N.useState(void 0),[W,y]=N.useState(null),[T,C]=N.useState("");N.useLayoutEffect(()=>{Q(void 0)},[m,f]),N.useLayoutEffect(()=>{if(B.current){const k=B.current.offsetWidth;Q(A=>A==null||k>A?k:A)}},[O,i]);let D=S;if(v!=="primary"){const k={...S};delete k.background,delete k.color,(v==="outline"||v==="ghost")&&(delete k.border,delete k.borderColor,delete k.borderWidth,delete k.borderStyle,delete k.boxShadow),D=k}const H={...D,...P?{minWidth:P}:{}},E=N.useCallback(()=>{const k=q.current;if(!k)return;const A=k.getBoundingClientRect();y({top:A.bottom,left:A.left,width:A.width}),C(ce.scopeThemeClass(k))},[]);N.useLayoutEffect(()=>{if(L)return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[L,E]),N.useEffect(()=>{if(!L)return;const k=A=>{const re=A.target;q.current?.contains(re)||J.current?.contains(re)||V(!1)};return document.addEventListener("mousedown",k),document.addEventListener("touchstart",k),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("touchstart",k)}},[L]);const R=s.jsxs("div",{className:`nice-dropdown-btn ${u||""}`,style:{position:"relative",display:"inline-flex",...h},ref:q,"aria-busy":i||void 0,children:[a?s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:B,type:"button",className:`nice-btn nice-btn--${v} nice-btn--${m} nice-btn--ds-${g} ${i?"nice-btn--loading":""} ${x?"nice-btn--readonly":""}`,style:H,disabled:d,"aria-readonly":x||void 0,onClick:()=>{x||_?.()},children:[i&&s.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:s.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),n&&s.jsx("span",{className:"nice-btn__icon",style:i?{visibility:"hidden"}:void 0,children:n}),s.jsx("span",{style:i?{visibility:"hidden"}:void 0,children:O})]}),s.jsx("button",{type:"button",className:`nice-btn nice-btn--${v} nice-btn--${m} nice-btn--ds-${g} nice-dropdown-btn__caret ${x?"nice-btn--readonly":""}`,style:D,disabled:d,"aria-readonly":x||void 0,onClick:()=>{x||V(!L)},"aria-label":"Toggle dropdown",children:s.jsx(M.oa,{name:"chevron-down",size:"xs"})})]}):s.jsxs("button",{ref:B,type:"button",className:`nice-btn nice-btn--${v} nice-btn--${m} nice-btn--ds-${g} ${i?"nice-btn--loading":""} ${x?"nice-btn--readonly":""}`,style:H,disabled:d,"aria-readonly":x||void 0,title:o,"aria-label":!O&&o?o:void 0,onClick:()=>{x||V(!L)},children:[i&&s.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:s.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),n&&s.jsx("span",{className:"nice-btn__icon",style:i?{visibility:"hidden"}:void 0,children:n}),s.jsx("span",{style:i?{visibility:"hidden"}:void 0,children:O}),s.jsx("span",{style:{marginLeft:"auto",paddingLeft:4,display:"inline-flex",...i?{visibility:"hidden"}:{}},children:s.jsx(M.oa,{name:"chevron-down",size:"xs"})})]}),L&&W&&typeof document<"u"&&$e.createPortal(s.jsx("ul",{ref:J,className:`nice-dropdown__list nice-dropdown-btn__menu nice-dropdown-btn__menu--${m} ${T}`,"data-theme":T==="nice-dark"?"dark":T==="nice-light"?"light":void 0,role:"menu",style:{position:"fixed",top:W.top,left:W.left,minWidth:W.width,marginTop:0,zIndex:1e3},children:r.map(k=>s.jsxs("li",{role:"menuitem",className:`nice-dropdown__option ${k.disabled?"nice-dropdown__option--disabled":""} ${k.danger?"nice-dropdown__option--danger":""}`,onClick:()=>{k.disabled||(k.onClick?.(),l?.(k),V(!1))},children:[k.icon&&s.jsx("span",{className:"nice-dropdown-btn__item-icon",children:k.icon}),k.text]},k.key))}),document.body)]});if(!U)return R;const X=s.jsx("div",{className:"nice-field__error",role:"alert",children:U});return j==="right"?s.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${m}`,style:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"fit-content"},children:[R,X]}):$?null:s.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${m}`,style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",width:"fit-content"},children:[R,X]})};function ue(e,t,n={}){const{delimiter:r=",",lineEnding:f=`
2
+ `,quoteChar:m='"',alwaysQuote:d=!1,includeHeaders:p=!0,includeRowNumbers:i=!1,locale:l="en-US",dateTimeFormat:a="yyyy-MM-dd HH:mm:ss"}=n,_=t.filter(o=>o.visible!==!1),u=[],h=o=>{if(d||o.includes(r)||o.includes(m)||o.includes(`
3
+ `)||o.includes("\r")){const w=o.replace(new RegExp(m,"g"),m+m);return`${m}${w}${m}`}return o},b=(o,c,w)=>{if(o==null)return"";if(c.format)return c.format(o,w);switch(c.dataType){case"date":return te(o,c.dateFormat??a);case"number":return ne(o,c.numberFormat,l);case"currency":return oe(o,c.currencyCode??"USD",l);case"boolean":return o?"Yes":"No";default:return String(o)}};if(p){const o=[];i&&o.push(h("#"));for(const c of _)o.push(h(c.header));u.push(o.join(r))}return e.forEach((o,c)=>{const w=[];i&&w.push(String(c+1));for(const U of _){const j=o[U.field],S=b(j,U,o);w.push(h(S))}u.push(w.join(r))}),u.join(f)}function fe(e,t,n={}){const{fileName:r="export",includeTimestamp:f=!1,includeBOM:m=!0,encoding:d="utf-8"}=n,p=ue(e,t,n),i=f?`_${K()}`:"",l=`${r}${i}.csv`;let a=p;m&&d==="utf-8"&&(a="\uFEFF"+p);const _=new Blob([a],{type:`text/csv;charset=${d}`});Z(_,l)}function ke(){return{sheets:new Map,activeSheet:""}}function _e(e,t){const n={name:t,cells:new Map,columns:[],merges:[]};return e.sheets.set(t,n),e.activeSheet||(e.activeSheet=t),n}function I(e,t,n,r){const f=Y(t,n);e.cells.set(f,r)}function Y(e,t){let n="",r=t;for(;r>=0;)n=String.fromCharCode(65+r%26)+n,r=Math.floor(r/26)-1;return`${n}${e+1}`}function je(e){const t=new TextEncoder,n=Array.from(e.sheets.entries()),r=n.map(([i,l],a)=>{const _=[];let u=0,h=0;l.cells.forEach((o,c)=>{const w=c.match(/([A-Z]+)(\d+)/);if(w){const U=Ne(w[1]),j=parseInt(w[2],10);u=Math.max(u,j),h=Math.max(h,U)}});for(let o=1;o<=u;o++){const c=[];for(let w=0;w<=h;w++){const U=Y(o-1,w),j=l.cells.get(U);if(j){const S=j.type==="s"?' t="inlineStr"':j.type==="b"?' t="b"':"";let g;j.type==="s"?g=`<is><t>${se(String(j.value))}</t></is>`:j.type==="b"?g=`<v>${j.value?1:0}</v>`:g=`<v>${j.value}</v>`,c.push(`<c r="${U}"${S}>${g}</c>`)}}c.length>0&&_.push(`<row r="${o}">${c.join("")}</row>`)}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
5
+ <dimension ref="${u>0?`A1:${Y(u-1,h)}`:"A1"}"/>
6
+ <sheetData>${_.join("")}</sheetData>
7
+ </worksheet>`}),f=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
8
+ <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
9
+ <sheets>${n.map(([i],l)=>`<sheet name="${se(i)}" sheetId="${l+1}" r:id="rId${l+1}"/>`).join("")}</sheets>
10
+ </workbook>`,m=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
11
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
12
+ ${n.map((i,l)=>`<Relationship Id="rId${l+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${l+1}.xml"/>`).join(`
13
+ `)}
14
+ </Relationships>`,d=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
15
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
16
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
17
+ <Default Extension="xml" ContentType="application/xml"/>
18
+ <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
19
+ ${n.map((i,l)=>`<Override PartName="/xl/worksheets/sheet${l+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join(`
20
+ `)}
21
+ </Types>`;return Se([{path:"[Content_Types].xml",content:t.encode(d)},{path:"_rels/.rels",content:t.encode(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
23
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
24
+ </Relationships>`)},{path:"xl/workbook.xml",content:t.encode(f)},{path:"xl/_rels/workbook.xml.rels",content:t.encode(m)},...r.map((i,l)=>({path:`xl/worksheets/sheet${l+1}.xml`,content:t.encode(i)}))])}function Ne(e){let t=0;for(let n=0;n<e.length;n++)t=t*26+(e.charCodeAt(n)-64);return t-1}function se(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Se(e){const t=[],n=[];let r=0;for(const a of e){const _=new TextEncoder().encode(a.path),u=new Uint8Array(30+_.length),h=new DataView(u.buffer);h.setUint32(0,67324752,!0),h.setUint16(4,20,!0),h.setUint16(6,0,!0),h.setUint16(8,0,!0),h.setUint16(10,0,!0),h.setUint16(12,0,!0),h.setUint32(14,ie(a.content),!0),h.setUint32(18,a.content.length,!0),h.setUint32(22,a.content.length,!0),h.setUint16(26,_.length,!0),h.setUint16(28,0,!0),u.set(_,30),t.push(u),t.push(a.content);const b=new Uint8Array(46+_.length),o=new DataView(b.buffer);o.setUint32(0,33639248,!0),o.setUint16(4,20,!0),o.setUint16(6,20,!0),o.setUint16(8,0,!0),o.setUint16(10,0,!0),o.setUint16(12,0,!0),o.setUint16(14,0,!0),o.setUint32(16,ie(a.content),!0),o.setUint32(20,a.content.length,!0),o.setUint32(24,a.content.length,!0),o.setUint16(28,_.length,!0),o.setUint16(30,0,!0),o.setUint16(32,0,!0),o.setUint16(34,0,!0),o.setUint16(36,0,!0),o.setUint32(38,0,!0),o.setUint32(42,r,!0),b.set(_,46),n.push(b),r+=u.length+a.content.length}const f=n.reduce((a,_)=>a+_.length,0),m=new Uint8Array(22),d=new DataView(m.buffer);d.setUint32(0,101010256,!0),d.setUint16(4,0,!0),d.setUint16(6,0,!0),d.setUint16(8,e.length,!0),d.setUint16(10,e.length,!0),d.setUint32(12,f,!0),d.setUint32(16,r,!0),d.setUint16(20,0,!0);const p=r+f+m.length,i=new Uint8Array(p);let l=0;for(const a of t)i.set(a,l),l+=a.length;for(const a of n)i.set(a,l),l+=a.length;return i.set(m,l),i.buffer}function ie(e){let t=4294967295;const n=Ce();for(let r=0;r<e.length;r++)t=t>>>8^n[(t^e[r])&255];return(t^4294967295)>>>0}let G=null;function Ce(){if(G)return G;G=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;G[e]=t}return G}function me(e,t,n={}){const{sheetName:r="Sheet1",title:f,subtitle:m,includeHeaders:d=!0,includeRowNumbers:p=!1,freezeHeader:i=!0,autoFilter:l=!0,styles:a={},locale:_="en-US",dateTimeFormat:u="yyyy-MM-dd HH:mm:ss"}=n,h=t.filter(S=>S.visible!==!1),b=ke(),o=_e(b,r);let c=0;const w=p?1:0;f&&(I(o,c,0,{value:f,type:"s",style:{font:{bold:!0,size:16}}}),c++),m&&(I(o,c,0,{value:m,type:"s",style:{font:{italic:!0,size:12}}}),c++);const U=c;d&&(p&&I(o,c,0,{value:"#",type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:"center"}}}),h.forEach((S,g)=>{I(o,c,g+w,{value:S.header,type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:S.align??"left"}}})}),c++),e.forEach((S,g)=>{p&&I(o,c,0,{value:g+1,type:"n"}),h.forEach((F,$)=>{const x=S[F.field];let v;if(x==null)v={value:"",type:"s"};else if(F.format)v={value:F.format(x,S),type:"s"};else switch(F.dataType){case"number":case"currency":v={value:Number(x),type:"n",numberFormat:F.numberFormat};break;case"date":{v={value:Te(x),type:"n",numberFormat:F.dateFormat??"yyyy-mm-dd"};break}case"boolean":v={value:x,type:"b"};break;default:v={value:String(x),type:"s"}}a.alternateRows&&g%2===1&&(v.style={...v.style,fill:{color:a.alternateBackground??"var(--nice-bg-secondary, #f5f5f5)"}}),I(o,c,$+w,v)}),c++});const j=h.map(S=>S.width??100);if(p&&j.unshift(40),o.columns=j.map(S=>({width:S/7})),i&&d&&(o.freezePane={row:U+1,col:0}),l&&d&&e.length>0){const S=Y(U,0),g=Y(c-1,h.length-1+w);o.autoFilter={start:S,end:g}}return je(b)}function ee(e,t,n={}){const{fileName:r="export",includeTimestamp:f=!1}=n,m=me(e,t,n),d=f?`_${K()}`:"",p=`${r}${d}.xlsx`,i=new Blob([m],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Z(i,p)}function pe(e,t,n={}){const{title:r,subtitle:f,orientation:m="portrait",pageSize:d="A4",margins:p={top:20,right:20,bottom:20,left:20},header:i,footer:l,logo:a,logoWidth:_=100,logoHeight:u,watermark:h,includeHeaders:b=!0,includeRowNumbers:o=!1,styles:c={},locale:w="en-US",dateTimeFormat:U="yyyy-MM-dd HH:mm:ss"}=n,j=t.filter($=>$.visible!==!1),S=($,x,v)=>{if($==null)return"";if(x.format)return x.format($,v);switch(x.dataType){case"date":return te($,x.dateFormat??U);case"number":return ne($,x.numberFormat,w);case"currency":return oe($,x.currencyCode??"USD",w);case"boolean":return $?"✓":"✗";default:return String($)}};let g=`
25
+ <!DOCTYPE html>
26
+ <html>
27
+ <head>
28
+ <meta charset="utf-8">
29
+ <title>${z(r??"Export")}</title>
30
+ <style>
31
+ @page {
32
+ size: ${d} ${m};
33
+ margin: ${p.top}mm ${p.right}mm ${p.bottom}mm ${p.left}mm;
34
+ }
35
+
36
+ body {
37
+ font-family: ${c.fontFamily??"Arial, sans-serif"};
38
+ font-size: ${c.fontSize??10}pt;
39
+ margin: 0;
40
+ padding: 0;
41
+ }
42
+
43
+ .header {
44
+ text-align: center;
45
+ margin-bottom: var(--nice-space-5, 20px);
46
+ }
47
+
48
+ .title {
49
+ font-size: 18pt;
50
+ font-weight: bold;
51
+ margin: 0 0 var(--nice-space-1-25, 5px) 0;
52
+ }
53
+
54
+ .subtitle {
55
+ font-size: 12pt;
56
+ color: var(--nice-text-secondary, #666);
57
+ margin: 0;
58
+ }
59
+
60
+ .logo {
61
+ max-width: ${_}px;
62
+ ${u?`max-height: ${u}px;`:""}
63
+ margin-bottom: var(--nice-space-2-5, 10px);
64
+ }
65
+
66
+ table {
67
+ width: 100%;
68
+ border-collapse: collapse;
69
+ page-break-inside: auto;
70
+ }
71
+
72
+ tr {
73
+ page-break-inside: avoid;
74
+ page-break-after: auto;
75
+ }
76
+
77
+ th, td {
78
+ border: 1px solid ${c.borderColor??"var(--nice-border, #ddd)"};
79
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2, 8px);
80
+ text-align: left;
81
+ }
82
+
83
+ th {
84
+ background-color: ${c.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
85
+ color: ${c.headerColor??"var(--nice-text, #333)"};
86
+ font-weight: ${c.headerFontWeight??"bold"};
87
+ }
88
+
89
+ tr:nth-child(even) {
90
+ background-color: ${c.alternateRows!==!1?c.alternateBackground??"var(--nice-bg-secondary, #fafafa)":"transparent"};
91
+ }
92
+
93
+ .text-left { text-align: left; }
94
+ .text-center { text-align: center; }
95
+ .text-right { text-align: right; }
96
+
97
+ .watermark {
98
+ position: fixed;
99
+ top: 50%;
100
+ left: 50%;
101
+ transform: translate(-50%, -50%) rotate(-45deg);
102
+ font-size: 72pt;
103
+ color: var(--nice-overlay-10, rgba(0, 0, 0, 0.1));
104
+ pointer-events: none;
105
+ z-index: -1;
106
+ }
107
+
108
+ .page-footer {
109
+ position: fixed;
110
+ bottom: 0;
111
+ width: 100%;
112
+ text-align: center;
113
+ font-size: 9pt;
114
+ color: var(--nice-text-secondary, #666);
115
+ }
116
+
117
+ @media print {
118
+ .no-print { display: none; }
119
+ }
120
+ </style>
121
+ </head>
122
+ <body>
123
+ `;if(h&&(g+=`<div class="watermark">${z(h)}</div>`),g+='<div class="header">',a&&(g+=`<img src="${a}" class="logo" alt="Logo">`),r&&(g+=`<h1 class="title">${z(r)}</h1>`),f&&(g+=`<p class="subtitle">${z(f)}</p>`),g+="</div>",g+="<table>",b){g+="<thead><tr>",o&&(g+='<th class="text-center">#</th>');for(const $ of j){const x=$.align??"left";g+=`<th class="text-${x}" style="width: ${$.width??"auto"}px">${z($.header)}</th>`}g+="</tr></thead>"}g+="<tbody>",e.forEach(($,x)=>{g+="<tr>",o&&(g+=`<td class="text-center">${x+1}</td>`);for(const v of j){const O=S($[v.field],v,$),L=v.align??"left";g+=`<td class="text-${L}">${z(O)}</td>`}g+="</tr>"}),g+="</tbody>",g+="</table>",g+="</body></html>";const F=window.open("","_blank");F&&(F.document.write(g),F.document.close(),F.onload=()=>{F.print()})}function he(e,t,n={}){pe(e,t,n)}function be(e,t={}){const{pretty:n=!0,indent:r=2,fields:f,transform:m}=t;let d=e;return m&&(d=e.map((p,i)=>m(p,i))),f?.length&&(d=d.map(p=>{const i={};for(const l of f)l in p&&(i[l]=p[l]);return i})),JSON.stringify(d,null,n?r:void 0)}function ge(e,t={}){const{fileName:n="export",includeTimestamp:r=!1}=t,f=be(e,t),m=r?`_${K()}`:"",d=`${n}${m}.json`,p=new Blob([f],{type:"application/json;charset=utf-8"});Z(p,d)}function xe(e,t,n={}){const{title:r,includeHeaders:f=!0,includeRowNumbers:m=!1,inlineStyles:d=!0,tableClass:p="nice-export-table",standalone:i=!0,styles:l={},locale:a="en-US",dateTimeFormat:_="yyyy-MM-dd HH:mm:ss"}=n,u=t.filter(o=>o.visible!==!1),h=(o,c,w)=>{if(o==null)return"";if(c.format)return c.format(o,w);switch(c.dataType){case"date":return te(o,c.dateFormat??_);case"number":return ne(o,c.numberFormat,a);case"currency":return oe(o,c.currencyCode??"USD",a);case"boolean":return o?"Yes":"No";default:return String(o)}};let b="";if(i&&(b+=`<!DOCTYPE html>
124
+ <html>
125
+ <head>
126
+ <meta charset="utf-8">
127
+ <title>${z(r??"Export")}</title>
128
+ <style>
129
+ .${p} {
130
+ border-collapse: collapse;
131
+ width: 100%;
132
+ font-family: ${l.fontFamily??"Arial, sans-serif"};
133
+ font-size: ${l.fontSize??12}px;
134
+ }
135
+ .${p} th, .${p} td {
136
+ border: 1px solid ${l.borderColor??"var(--nice-border, #ddd)"};
137
+ padding: var(--nice-space-2, 8px);
138
+ text-align: left;
139
+ }
140
+ .${p} th {
141
+ background-color: ${l.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
142
+ color: ${l.headerColor??"var(--nice-text, #333)"};
143
+ font-weight: ${l.headerFontWeight??"bold"};
144
+ }
145
+ .${p} tr:nth-child(even) {
146
+ background-color: ${l.alternateRows!==!1?l.alternateBackground??"var(--nice-bg-secondary, #fafafa)":"transparent"};
147
+ }
148
+ </style>
149
+ </head>
150
+ <body>
151
+ `,r&&(b+=`<h1>${z(r)}</h1>`)),b+=`<table class="${p}"${!i&&d?' style="border-collapse:collapse;width:100%"':""}>`,f){b+="<thead><tr>",m&&(b+="<th>#</th>");for(const o of u)b+=`<th>${z(o.header)}</th>`;b+="</tr></thead>"}return b+="<tbody>",e.forEach((o,c)=>{b+="<tr>",m&&(b+=`<td>${c+1}</td>`);for(const w of u){const U=h(o[w.field],w,o);b+=`<td>${z(U)}</td>`}b+="</tr>"}),b+="</tbody></table>",i&&(b+="</body></html>"),b}function ye(e,t,n={}){const{fileName:r="export",includeTimestamp:f=!1}=n,m=xe(e,t,{...n,standalone:!0}),d=f?`_${K()}`:"",p=`${r}${d}.html`,i=new Blob([m],{type:"text/html;charset=utf-8"});Z(i,p)}function Z(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function K(){return new Date().toISOString().slice(0,19).replace(/[T:]/g,"-")}function te(e,t,n){const r=e instanceof Date?e:new Date(e);if(isNaN(r.getTime()))return String(e);const f=m=>String(m).padStart(2,"0");return t.replace("yyyy",String(r.getFullYear())).replace("MM",f(r.getMonth()+1)).replace("dd",f(r.getDate())).replace("HH",f(r.getHours())).replace("mm",f(r.getMinutes())).replace("ss",f(r.getSeconds()))}function ne(e,t,n){if(t){const r=t.match(/0+$/)?.[0]?.length??0;return e.toLocaleString(n,{minimumFractionDigits:r,maximumFractionDigits:r})}return e.toLocaleString(n)}function oe(e,t,n){return e.toLocaleString(n,{style:"currency",currency:t})}function Te(e){const t=e instanceof Date?e:new Date(e),n=new Date(1899,11,30),r=1440*60*1e3;return(t.getTime()-n.getTime())/r}function z(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function De(e){const{data:t,columns:n,format:r,options:f={}}=e;switch(r){case"csv":fe(t,n,f);break;case"xlsx":ee(t,n,f);break;case"pdf":he(t,n,f);break;case"json":ge(t,f);break;case"html":ye(t,n,f);break;default:throw new Error(`Unsupported export format: ${r}`)}}function Ue(e,t={}){const{maxSample:n=100,exclude:r=[]}=t;if(e.length===0)return[];const f=e.slice(0,n),m=e[0],d=[];for(const p of Object.keys(m)){if(r.includes(p))continue;let i="string";for(const l of f){const a=l[p];if(a!=null){if(typeof a=="number"){i="number";break}if(typeof a=="boolean"){i="boolean";break}if(a instanceof Date){i="date";break}if(typeof a=="string"&&/^\d{4}-\d{2}-\d{2}/.test(a)&&!isNaN(Date.parse(a))){i="date";break}}}d.push({field:p,header:Fe(p),dataType:i})}return d}function Fe(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/^\s+/,"").split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const Ee=[{key:void 0,label:"Available Fields"},{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],Le=[{value:"",label:"Available"},{value:"row",label:"Rows"},{value:"column",label:"Columns"},{value:"data",label:"Values"},{value:"filter",label:"Filters"}],we=({fields:e,onChange:t,showAreaSelect:n=!1,className:r,style:f})=>{const[m,d]=N.useState(null),[p,i]=N.useState("none"),l=(u,h)=>{t(e.map(b=>b.field===u?{...b,area:h}:b))},a=u=>h=>{h.preventDefault();const b=h.dataTransfer.getData("text/plain")||m;b&&l(b,u),d(null),i("none")},_=u=>s.jsxs("li",{className:"nice-field-chooser__item",draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",u.field),h.dataTransfer.effectAllowed="move",d(u.field)},onDragEnd:()=>{d(null),i("none")},children:[s.jsx("span",{className:"nice-field-chooser__grip","aria-hidden":"true",children:s.jsx(M.oa,{name:"menu",size:14})}),s.jsxs("span",{className:"nice-field-chooser__label",children:[u.caption,u.dataType&&s.jsxs("small",{className:"nice-field-chooser__type",children:[" (",u.dataType,")"]})]}),n&&s.jsx(ce.NiceSelect,{size:"sm",value:u.area??"",options:Le,onChange:h=>l(u.field,h||void 0),"aria-label":`Assign ${u.caption} to area`}),u.area&&s.jsx("button",{type:"button",className:"nice-field-chooser__remove",onClick:()=>l(u.field,void 0),"aria-label":`Remove ${u.caption}`,children:s.jsx(M.oa,{name:"close",size:14})})]},u.field);return s.jsx("div",{className:`nice-field-chooser ${r||""}`,style:f,children:s.jsx("div",{className:"nice-field-chooser__panel",children:Ee.map(u=>{const h=e.filter(b=>u.key?b.area===u.key:!b.area);return s.jsxs("div",{className:`nice-field-chooser__section${p===u.key&&m?" nice-field-chooser__section--over":""}`,onDragOver:b=>{b.preventDefault(),i(u.key)},onDragLeave:()=>i("none"),onDrop:a(u.key),children:[s.jsx("h4",{children:u.label}),s.jsxs("ul",{children:[h.map(_),h.length===0&&s.jsx("li",{className:"nice-field-chooser__empty","aria-hidden":"true",children:"Drop fields here"})]})]},u.label)})})})},ae="__row";function Re(e,t){if(e.length===0)return 0;switch(t){case"sum":return e.reduce((n,r)=>n+r,0);case"count":return e.length;case"avg":return e.reduce((n,r)=>n+r,0)/e.length;case"min":return Math.min(...e);case"max":return Math.max(...e);default:return e.reduce((n,r)=>n+r,0)}}function le(e,t){return[...new Set(e.map(n=>String(n[t]??"")))].sort()}const ve=({data:e,fields:t,defaultFields:n,onFieldsChange:r,showFieldChooser:f,loading:m,emptyText:d,headerText:p,exportCsv:i,exportFilename:l="pivot-export",onDrillThrough:a,className:_,style:u,accessMode:h,id:b})=>{const c=M.Dc(h,b)==="hidden",{t:w}=M.Gt(),U=t!==void 0&&r!==void 0,[j,S]=M.Vu({value:U?t:void 0,defaultValue:U?n:n??t,fallbackValue:[],onChange:r,componentName:"NicePivotGrid"}),[g,F]=N.useState(!1),$=N.useMemo(()=>j.filter(y=>y.area==="row"),[j]),x=N.useMemo(()=>j.filter(y=>y.area==="column"),[j]),v=N.useMemo(()=>j.filter(y=>y.area==="data"),[j]),O=N.useMemo(()=>$.length===0?["Total"]:le(e,$[0].field),[e,$]),L=N.useMemo(()=>x.length===0?["Total"]:le(e,x[0].field),[e,x]),V=N.useCallback((y,T,C)=>{let D=e;$.length>0&&(D=D.filter(R=>String(R[$[0].field])===y)),x.length>0&&(D=D.filter(R=>String(R[x[0].field])===T));const H=D.map(R=>Number(R[C.field])||0),E=Re(H,C.summaryType||"sum");return C.format?C.format(E):E},[e,$,x]),q=N.useCallback(y=>{S(y)},[S]),B=N.useCallback((y,T)=>{let C=e;return $.length>0&&(C=C.filter(D=>String(D[$[0].field])===y)),x.length>0&&(C=C.filter(D=>String(D[x[0].field])===T)),C},[e,$,x]),J=N.useCallback((y,T)=>{a&&a(y,T,B(y,T))},[a,B]),P=N.useCallback(()=>{const y=[{field:ae,header:$.map(C=>C.caption).join(" / ")||""}];L.forEach((C,D)=>{v.length>0?v.forEach((H,E)=>y.push({field:`c${D}d${E}`,header:`${C} - ${H.caption}`})):y.push({field:`c${D}`,header:C})});const T=O.map(C=>{const D={[ae]:C};return L.forEach((H,E)=>{v.length>0?v.forEach((R,X)=>{D[`c${E}d${X}`]=V(C,H,R)}):D[`c${E}`]="—"}),D});return{columns:y,rows:T}},[L,O,v,$,V]),Q=N.useCallback(()=>{const{columns:y,rows:T}=P(),C=[y.map(R=>R.header),...T.map(R=>y.map(X=>String(R[X.field]??"")))].map(R=>R.map(X=>`"${String(X).replace(/"/g,'""')}"`).join(",")).join(`
152
+ `),D=new Blob(["\uFEFF"+C],{type:"text/csv;charset=utf-8;"}),H=URL.createObjectURL(D),E=document.createElement("a");E.href=H,E.download=`${l}.csv`,E.click(),URL.revokeObjectURL(H)},[P,l]),W=N.useCallback(()=>{const{columns:y,rows:T}=P();ee(T,y,{fileName:l,sheetName:"Pivot"})},[P,l]);return c?null:s.jsxs("div",{className:`nice-pivotgrid ${_||""}`,style:u,children:[(f||i||p)&&s.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[p&&s.jsx("span",{className:"nice-pivotgrid__header-text",children:p}),s.jsxs("div",{className:"nice-pivotgrid__toolbar-actions",children:[f&&s.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-btn--icon-only",onClick:()=>F(!g),title:w("controls.fieldChooser","Field Chooser"),"aria-label":w("controls.fieldChooser","Field Chooser"),"aria-pressed":g,children:s.jsx(M.oa,{name:"filter",size:16})}),i&&s.jsx(de,{size:"sm",variant:"outline",icon:s.jsx(M.oa,{name:"download",size:16}),title:w("controls.export","Export"),items:[{key:"csv",text:"CSV",onClick:Q},{key:"xlsx",text:"XLSX",onClick:W}]})]})]}),g&&s.jsx(we,{fields:j,onChange:q}),m?s.jsx("div",{className:"nice-pivotgrid__loading",children:s.jsx("div",{className:"nice-spinner nice-spinner--md"})}):s.jsx("div",{className:"nice-pivotgrid__table-wrap",children:s.jsxs("table",{className:"nice-pivotgrid__table",children:[s.jsxs("thead",{children:[s.jsxs("tr",{children:[s.jsx("th",{children:$.map(y=>y.caption).join(" / ")||""}),L.map(y=>s.jsx("th",{colSpan:v.length||1,children:y},y))]}),v.length>1&&s.jsxs("tr",{children:[s.jsx("th",{}),L.map(y=>v.map(T=>s.jsx("th",{children:T.caption},`${y}-${T.field}`)))]})]}),s.jsx("tbody",{children:O.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:1+L.length*Math.max(v.length,1),className:"nice-pivotgrid__empty",children:d||w("controls.noData","No data available")})}):O.map(y=>s.jsxs("tr",{children:[s.jsx("td",{className:"nice-pivotgrid__row-header",children:y}),L.map(T=>v.length>0?v.map(C=>s.jsx("td",{className:`nice-pivotgrid__cell ${a?"nice-pivotgrid__cell--clickable":""}`,onClick:a?()=>J(y,T):void 0,children:V(y,T,C)},`${T}-${C.field}`)):s.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},T))]},y))})]})})]})},Me=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:ve},Symbol.toStringTag,{value:"Module"}));exports.NiceDropDownButton=de;exports.NicePivotGrid=ve;exports.NicePivotGrid$1=Me;exports.NicePivotGridFieldChooser=we;exports.autoDetectColumns=Ue;exports.downloadCSV=fe;exports.downloadHTML=ye;exports.downloadJSON=ge;exports.downloadPDF=he;exports.downloadXLSX=ee;exports.exportToCSV=ue;exports.exportToHTML=xe;exports.exportToJSON=be;exports.exportToPDF=pe;exports.exportToXLSX=me;exports.niceExport=De;
@@ -0,0 +1,152 @@
1
+ "use strict";const s=require("react/jsx-runtime"),M=require("./charts-B8_V3_nq.cjs"),j=require("react"),ve=require("react-dom"),ce=require("./NiceSelect-DwBAIrX7.cjs"),de=({text:e,label:t,icon:n,items:r,variant:m="primary",size:p="md",disabled:c,readOnly:h,loading:i,onItemClick:l,splitButton:d,onClick:_,className:u,style:b,id:g,title:o,accessMode:a,displayStyle:y,error:F,errorPlacement:T="bottom"})=>{const D=M.rc("button",y),f=M.ac("button",y),S=M.Dc(a,g),w=S==="hidden";S==="disabled"&&(c=!0),i&&(c=!0);const $=!c&&(h||S==="readOnly"),v=M.Ys(m),O=e||t,[H,B]=j.useState(!1),W=j.useRef(null),P=j.useRef(null),G=j.useRef(null),[Y,x]=j.useState(void 0),[N,C]=j.useState(null),[U,z]=j.useState("");j.useLayoutEffect(()=>{x(void 0)},[p,m]),j.useLayoutEffect(()=>{if(P.current){const k=P.current.offsetWidth;x(X=>X==null||k>X?k:X)}},[O,i]);let L=D;if(v!=="primary"){const k={...D};delete k.background,delete k.color,(v==="outline"||v==="ghost")&&(delete k.border,delete k.borderColor,delete k.borderWidth,delete k.borderStyle,delete k.boxShadow),L=k}const E={...L,...Y?{minWidth:Y}:{}},R=j.useCallback(()=>{const k=W.current;if(!k)return;const X=k.getBoundingClientRect();C({top:X.bottom,left:X.left,width:X.width}),z(ce.scopeThemeClass(k))},[]);j.useLayoutEffect(()=>{if(H)return R(),window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[H,R]),j.useEffect(()=>{if(!H)return;const k=X=>{const re=X.target;W.current?.contains(re)||G.current?.contains(re)||B(!1)};return document.addEventListener("mousedown",k),document.addEventListener("touchstart",k),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("touchstart",k)}},[H]);const Z=s.jsxs("div",{className:`nice-dropdown-btn ${u||""}`,style:{position:"relative",display:"inline-flex",...b},ref:W,"aria-busy":i||void 0,children:[d?s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:P,type:"button",className:`nice-btn nice-btn--${v} nice-btn--${p} nice-btn--ds-${f} ${i?"nice-btn--loading":""} ${$?"nice-btn--readonly":""}`,style:E,disabled:c,"aria-readonly":$||void 0,onClick:()=>{$||_?.()},children:[i&&s.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:s.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),n&&s.jsx("span",{className:"nice-btn__icon",style:i?{visibility:"hidden"}:void 0,children:n}),s.jsx("span",{style:i?{visibility:"hidden"}:void 0,children:O})]}),s.jsx("button",{type:"button",className:`nice-btn nice-btn--${v} nice-btn--${p} nice-btn--ds-${f} nice-dropdown-btn__caret ${$?"nice-btn--readonly":""}`,style:L,disabled:c,"aria-readonly":$||void 0,onClick:()=>{$||B(!H)},"aria-label":"Toggle dropdown",children:s.jsx(M.oa,{name:"chevron-down",size:"xs"})})]}):s.jsxs("button",{ref:P,type:"button",className:`nice-btn nice-btn--${v} nice-btn--${p} nice-btn--ds-${f} ${i?"nice-btn--loading":""} ${$?"nice-btn--readonly":""}`,style:E,disabled:c,"aria-readonly":$||void 0,title:o,"aria-label":!O&&o?o:void 0,onClick:()=>{$||B(!H)},children:[i&&s.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:s.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),n&&s.jsx("span",{className:"nice-btn__icon",style:i?{visibility:"hidden"}:void 0,children:n}),s.jsx("span",{style:i?{visibility:"hidden"}:void 0,children:O}),s.jsx("span",{style:{marginLeft:"auto",paddingLeft:4,display:"inline-flex",...i?{visibility:"hidden"}:{}},children:s.jsx(M.oa,{name:"chevron-down",size:"xs"})})]}),H&&N&&typeof document<"u"&&ve.createPortal(s.jsx("ul",{ref:G,className:`nice-dropdown__list nice-dropdown-btn__menu nice-dropdown-btn__menu--${p} ${U}`,"data-theme":U==="nice-dark"?"dark":U==="nice-light"?"light":void 0,role:"menu",style:{position:"fixed",top:N.top,left:N.left,minWidth:N.width,marginTop:0,zIndex:1e3},children:r.map(k=>s.jsxs("li",{role:"menuitem",className:`nice-dropdown__option ${k.disabled?"nice-dropdown__option--disabled":""} ${k.danger?"nice-dropdown__option--danger":""}`,onClick:()=>{k.disabled||(k.onClick?.(),l?.(k),B(!1))},children:[k.icon&&s.jsx("span",{className:"nice-dropdown-btn__item-icon",children:k.icon}),k.text]},k.key))}),document.body)]});if(!F)return Z;const oe=s.jsx("div",{className:"nice-field__error",role:"alert",children:F});return T==="right"?s.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${p}`,style:{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"8px",width:"fit-content"},children:[Z,oe]}):w?null:s.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${p}`,style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:"4px",width:"fit-content"},children:[Z,oe]})};function ue(e,t,n={}){const{delimiter:r=",",lineEnding:m=`
2
+ `,quoteChar:p='"',alwaysQuote:c=!1,includeHeaders:h=!0,includeRowNumbers:i=!1,locale:l="en-US",dateTimeFormat:d="yyyy-MM-dd HH:mm:ss"}=n,_=t.filter(o=>o.visible!==!1),u=[],b=o=>{if(c||o.includes(r)||o.includes(p)||o.includes(`
3
+ `)||o.includes("\r")){const y=o.replace(new RegExp(p,"g"),p+p);return`${p}${y}${p}`}return o},g=(o,a,y)=>{if(o==null)return"";if(a.format)return a.format(o,y);switch(a.dataType){case"date":return ee(o,a.dateFormat??d);case"number":return te(o,a.numberFormat,l);case"currency":return ne(o,a.currencyCode??"USD",l);case"boolean":return o?"Yes":"No";default:return String(o)}};if(h){const o=[];i&&o.push(b("#"));for(const a of _)o.push(b(a.header));u.push(o.join(r))}return e.forEach((o,a)=>{const y=[];i&&y.push(String(a+1));for(const F of _){const T=o[F.field],D=g(T,F,o);y.push(b(D))}u.push(y.join(r))}),u.join(m)}function fe(e,t,n={}){const{fileName:r="export",includeTimestamp:m=!1,includeBOM:p=!0,encoding:c="utf-8"}=n,h=ue(e,t,n),i=m?`_${Q()}`:"",l=`${r}${i}.csv`;let d=h;p&&c==="utf-8"&&(d="\uFEFF"+h);const _=new Blob([d],{type:`text/csv;charset=${c}`});J(_,l)}function ke(){return{sheets:new Map,activeSheet:""}}function _e(e,t){const n={name:t,cells:new Map,columns:[],merges:[]};return e.sheets.set(t,n),e.activeSheet||(e.activeSheet=t),n}function V(e,t,n,r){const m=q(t,n);e.cells.set(m,r)}function q(e,t){let n="",r=t;for(;r>=0;)n=String.fromCharCode(65+r%26)+n,r=Math.floor(r/26)-1;return`${n}${e+1}`}function je(e){const t=new TextEncoder,n=Array.from(e.sheets.entries()),r=n.map(([i,l],d)=>{const _=[];let u=0,b=0;l.cells.forEach((o,a)=>{const y=a.match(/([A-Z]+)(\d+)/);if(y){const F=Se(y[1]),T=parseInt(y[2],10);u=Math.max(u,T),b=Math.max(b,F)}});for(let o=1;o<=u;o++){const a=[];for(let y=0;y<=b;y++){const F=q(o-1,y),T=l.cells.get(F);if(T){const D=T.type==="s"?' t="inlineStr"':T.type==="b"?' t="b"':"";let f;T.type==="s"?f=`<is><t>${se(String(T.value))}</t></is>`:T.type==="b"?f=`<v>${T.value?1:0}</v>`:f=`<v>${T.value}</v>`,a.push(`<c r="${F}"${D}>${f}</c>`)}}a.length>0&&_.push(`<row r="${o}">${a.join("")}</row>`)}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
5
+ <dimension ref="${u>0?`A1:${q(u-1,b)}`:"A1"}"/>
6
+ <sheetData>${_.join("")}</sheetData>
7
+ </worksheet>`}),m=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
8
+ <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
9
+ <sheets>${n.map(([i],l)=>`<sheet name="${se(i)}" sheetId="${l+1}" r:id="rId${l+1}"/>`).join("")}</sheets>
10
+ </workbook>`,p=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
11
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
12
+ ${n.map((i,l)=>`<Relationship Id="rId${l+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${l+1}.xml"/>`).join(`
13
+ `)}
14
+ </Relationships>`,c=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
15
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
16
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
17
+ <Default Extension="xml" ContentType="application/xml"/>
18
+ <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
19
+ ${n.map((i,l)=>`<Override PartName="/xl/worksheets/sheet${l+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join(`
20
+ `)}
21
+ </Types>`;return Ne([{path:"[Content_Types].xml",content:t.encode(c)},{path:"_rels/.rels",content:t.encode(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
23
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
24
+ </Relationships>`)},{path:"xl/workbook.xml",content:t.encode(m)},{path:"xl/_rels/workbook.xml.rels",content:t.encode(p)},...r.map((i,l)=>({path:`xl/worksheets/sheet${l+1}.xml`,content:t.encode(i)}))])}function Se(e){let t=0;for(let n=0;n<e.length;n++)t=t*26+(e.charCodeAt(n)-64);return t-1}function se(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Ne(e){const t=[],n=[];let r=0;for(const d of e){const _=new TextEncoder().encode(d.path),u=new Uint8Array(30+_.length),b=new DataView(u.buffer);b.setUint32(0,67324752,!0),b.setUint16(4,20,!0),b.setUint16(6,0,!0),b.setUint16(8,0,!0),b.setUint16(10,0,!0),b.setUint16(12,0,!0),b.setUint32(14,ie(d.content),!0),b.setUint32(18,d.content.length,!0),b.setUint32(22,d.content.length,!0),b.setUint16(26,_.length,!0),b.setUint16(28,0,!0),u.set(_,30),t.push(u),t.push(d.content);const g=new Uint8Array(46+_.length),o=new DataView(g.buffer);o.setUint32(0,33639248,!0),o.setUint16(4,20,!0),o.setUint16(6,20,!0),o.setUint16(8,0,!0),o.setUint16(10,0,!0),o.setUint16(12,0,!0),o.setUint16(14,0,!0),o.setUint32(16,ie(d.content),!0),o.setUint32(20,d.content.length,!0),o.setUint32(24,d.content.length,!0),o.setUint16(28,_.length,!0),o.setUint16(30,0,!0),o.setUint16(32,0,!0),o.setUint16(34,0,!0),o.setUint16(36,0,!0),o.setUint32(38,0,!0),o.setUint32(42,r,!0),g.set(_,46),n.push(g),r+=u.length+d.content.length}const m=n.reduce((d,_)=>d+_.length,0),p=new Uint8Array(22),c=new DataView(p.buffer);c.setUint32(0,101010256,!0),c.setUint16(4,0,!0),c.setUint16(6,0,!0),c.setUint16(8,e.length,!0),c.setUint16(10,e.length,!0),c.setUint32(12,m,!0),c.setUint32(16,r,!0),c.setUint16(20,0,!0);const h=r+m+p.length,i=new Uint8Array(h);let l=0;for(const d of t)i.set(d,l),l+=d.length;for(const d of n)i.set(d,l),l+=d.length;return i.set(p,l),i.buffer}function ie(e){let t=4294967295;const n=Ce();for(let r=0;r<e.length;r++)t=t>>>8^n[(t^e[r])&255];return(t^4294967295)>>>0}let I=null;function Ce(){if(I)return I;I=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;I[e]=t}return I}function me(e,t,n={}){const{sheetName:r="Sheet1",title:m,subtitle:p,includeHeaders:c=!0,includeRowNumbers:h=!1,freezeHeader:i=!0,autoFilter:l=!0,styles:d={},locale:_="en-US",dateTimeFormat:u="yyyy-MM-dd HH:mm:ss"}=n,b=t.filter(D=>D.visible!==!1),g=ke(),o=_e(g,r);let a=0;const y=h?1:0;m&&(V(o,a,0,{value:m,type:"s",style:{font:{bold:!0,size:16}}}),a++),p&&(V(o,a,0,{value:p,type:"s",style:{font:{italic:!0,size:12}}}),a++);const F=a;c&&(h&&V(o,a,0,{value:"#",type:"s",style:{font:{bold:d.headerFontWeight==="bold",color:d.headerColor},fill:{color:d.headerBackground},alignment:{horizontal:"center"}}}),b.forEach((D,f)=>{V(o,a,f+y,{value:D.header,type:"s",style:{font:{bold:d.headerFontWeight==="bold",color:d.headerColor},fill:{color:d.headerBackground},alignment:{horizontal:D.align??"left"}}})}),a++),e.forEach((D,f)=>{h&&V(o,a,0,{value:f+1,type:"n"}),b.forEach((S,w)=>{const $=D[S.field];let v;if($==null)v={value:"",type:"s"};else if(S.format)v={value:S.format($,D),type:"s"};else switch(S.dataType){case"number":case"currency":v={value:Number($),type:"n",numberFormat:S.numberFormat};break;case"date":{v={value:Te($),type:"n",numberFormat:S.dateFormat??"yyyy-mm-dd"};break}case"boolean":v={value:$,type:"b"};break;default:v={value:String($),type:"s"}}d.alternateRows&&f%2===1&&(v.style={...v.style,fill:{color:d.alternateBackground??"var(--nice-bg-secondary, #f5f5f5)"}}),V(o,a,w+y,v)}),a++});const T=b.map(D=>D.width??100);if(h&&T.unshift(40),o.columns=T.map(D=>({width:D/7})),i&&c&&(o.freezePane={row:F+1,col:0}),l&&c&&e.length>0){const D=q(F,0),f=q(a-1,b.length-1+y);o.autoFilter={start:D,end:f}}return je(g)}function K(e,t,n={}){const{fileName:r="export",includeTimestamp:m=!1}=n,p=me(e,t,n),c=m?`_${Q()}`:"",h=`${r}${c}.xlsx`,i=new Blob([p],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});J(i,h)}function pe(e,t,n={}){const{title:r,subtitle:m,orientation:p="portrait",pageSize:c="A4",margins:h={top:20,right:20,bottom:20,left:20},header:i,footer:l,logo:d,logoWidth:_=100,logoHeight:u,watermark:b,includeHeaders:g=!0,includeRowNumbers:o=!1,styles:a={},locale:y="en-US",dateTimeFormat:F="yyyy-MM-dd HH:mm:ss"}=n,T=t.filter(w=>w.visible!==!1),D=(w,$,v)=>{if(w==null)return"";if($.format)return $.format(w,v);switch($.dataType){case"date":return ee(w,$.dateFormat??F);case"number":return te(w,$.numberFormat,y);case"currency":return ne(w,$.currencyCode??"USD",y);case"boolean":return w?"✓":"✗";default:return String(w)}};let f=`
25
+ <!DOCTYPE html>
26
+ <html>
27
+ <head>
28
+ <meta charset="utf-8">
29
+ <title>${A(r??"Export")}</title>
30
+ <style>
31
+ @page {
32
+ size: ${c} ${p};
33
+ margin: ${h.top}mm ${h.right}mm ${h.bottom}mm ${h.left}mm;
34
+ }
35
+
36
+ body {
37
+ font-family: ${a.fontFamily??"Arial, sans-serif"};
38
+ font-size: ${a.fontSize??10}pt;
39
+ margin: 0;
40
+ padding: 0;
41
+ }
42
+
43
+ .header {
44
+ text-align: center;
45
+ margin-bottom: var(--nice-space-5, 20px);
46
+ }
47
+
48
+ .title {
49
+ font-size: 18pt;
50
+ font-weight: bold;
51
+ margin: 0 0 var(--nice-space-1-25, 5px) 0;
52
+ }
53
+
54
+ .subtitle {
55
+ font-size: 12pt;
56
+ color: var(--nice-text-secondary, #666);
57
+ margin: 0;
58
+ }
59
+
60
+ .logo {
61
+ max-width: ${_}px;
62
+ ${u?`max-height: ${u}px;`:""}
63
+ margin-bottom: var(--nice-space-2-5, 10px);
64
+ }
65
+
66
+ table {
67
+ width: 100%;
68
+ border-collapse: collapse;
69
+ page-break-inside: auto;
70
+ }
71
+
72
+ tr {
73
+ page-break-inside: avoid;
74
+ page-break-after: auto;
75
+ }
76
+
77
+ th, td {
78
+ border: 1px solid ${a.borderColor??"var(--nice-border, #ddd)"};
79
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2, 8px);
80
+ text-align: left;
81
+ }
82
+
83
+ th {
84
+ background-color: ${a.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
85
+ color: ${a.headerColor??"var(--nice-text, #333)"};
86
+ font-weight: ${a.headerFontWeight??"bold"};
87
+ }
88
+
89
+ tr:nth-child(even) {
90
+ background-color: ${a.alternateRows!==!1?a.alternateBackground??"var(--nice-bg-secondary, #fafafa)":"transparent"};
91
+ }
92
+
93
+ .text-left { text-align: left; }
94
+ .text-center { text-align: center; }
95
+ .text-right { text-align: right; }
96
+
97
+ .watermark {
98
+ position: fixed;
99
+ top: 50%;
100
+ left: 50%;
101
+ transform: translate(-50%, -50%) rotate(-45deg);
102
+ font-size: 72pt;
103
+ color: var(--nice-overlay-10, rgba(0, 0, 0, 0.1));
104
+ pointer-events: none;
105
+ z-index: -1;
106
+ }
107
+
108
+ .page-footer {
109
+ position: fixed;
110
+ bottom: 0;
111
+ width: 100%;
112
+ text-align: center;
113
+ font-size: 9pt;
114
+ color: var(--nice-text-secondary, #666);
115
+ }
116
+
117
+ @media print {
118
+ .no-print { display: none; }
119
+ }
120
+ </style>
121
+ </head>
122
+ <body>
123
+ `;if(b&&(f+=`<div class="watermark">${A(b)}</div>`),f+='<div class="header">',d&&(f+=`<img src="${d}" class="logo" alt="Logo">`),r&&(f+=`<h1 class="title">${A(r)}</h1>`),m&&(f+=`<p class="subtitle">${A(m)}</p>`),f+="</div>",f+="<table>",g){f+="<thead><tr>",o&&(f+='<th class="text-center">#</th>');for(const w of T){const $=w.align??"left";f+=`<th class="text-${$}" style="width: ${w.width??"auto"}px">${A(w.header)}</th>`}f+="</tr></thead>"}f+="<tbody>",e.forEach((w,$)=>{f+="<tr>",o&&(f+=`<td class="text-center">${$+1}</td>`);for(const v of T){const O=D(w[v.field],v,w),H=v.align??"left";f+=`<td class="text-${H}">${A(O)}</td>`}f+="</tr>"}),f+="</tbody>",f+="</table>",f+="</body></html>";const S=window.open("","_blank");S&&(S.document.write(f),S.document.close(),S.onload=()=>{S.print()})}function he(e,t,n={}){pe(e,t,n)}function be(e,t={}){const{pretty:n=!0,indent:r=2,fields:m,transform:p}=t;let c=e;return p&&(c=e.map((h,i)=>p(h,i))),m?.length&&(c=c.map(h=>{const i={};for(const l of m)l in h&&(i[l]=h[l]);return i})),JSON.stringify(c,null,n?r:void 0)}function ge(e,t={}){const{fileName:n="export",includeTimestamp:r=!1}=t,m=be(e,t),p=r?`_${Q()}`:"",c=`${n}${p}.json`,h=new Blob([m],{type:"application/json;charset=utf-8"});J(h,c)}function xe(e,t,n={}){const{title:r,includeHeaders:m=!0,includeRowNumbers:p=!1,inlineStyles:c=!0,tableClass:h="nice-export-table",standalone:i=!0,styles:l={},locale:d="en-US",dateTimeFormat:_="yyyy-MM-dd HH:mm:ss"}=n,u=t.filter(o=>o.visible!==!1),b=(o,a,y)=>{if(o==null)return"";if(a.format)return a.format(o,y);switch(a.dataType){case"date":return ee(o,a.dateFormat??_);case"number":return te(o,a.numberFormat,d);case"currency":return ne(o,a.currencyCode??"USD",d);case"boolean":return o?"Yes":"No";default:return String(o)}};let g="";if(i&&(g+=`<!DOCTYPE html>
124
+ <html>
125
+ <head>
126
+ <meta charset="utf-8">
127
+ <title>${A(r??"Export")}</title>
128
+ <style>
129
+ .${h} {
130
+ border-collapse: collapse;
131
+ width: 100%;
132
+ font-family: ${l.fontFamily??"Arial, sans-serif"};
133
+ font-size: ${l.fontSize??12}px;
134
+ }
135
+ .${h} th, .${h} td {
136
+ border: 1px solid ${l.borderColor??"var(--nice-border, #ddd)"};
137
+ padding: var(--nice-space-2, 8px);
138
+ text-align: left;
139
+ }
140
+ .${h} th {
141
+ background-color: ${l.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
142
+ color: ${l.headerColor??"var(--nice-text, #333)"};
143
+ font-weight: ${l.headerFontWeight??"bold"};
144
+ }
145
+ .${h} tr:nth-child(even) {
146
+ background-color: ${l.alternateRows!==!1?l.alternateBackground??"var(--nice-bg-secondary, #fafafa)":"transparent"};
147
+ }
148
+ </style>
149
+ </head>
150
+ <body>
151
+ `,r&&(g+=`<h1>${A(r)}</h1>`)),g+=`<table class="${h}"${!i&&c?' style="border-collapse:collapse;width:100%"':""}>`,m){g+="<thead><tr>",p&&(g+="<th>#</th>");for(const o of u)g+=`<th>${A(o.header)}</th>`;g+="</tr></thead>"}return g+="<tbody>",e.forEach((o,a)=>{g+="<tr>",p&&(g+=`<td>${a+1}</td>`);for(const y of u){const F=b(o[y.field],y,o);g+=`<td>${A(F)}</td>`}g+="</tr>"}),g+="</tbody></table>",i&&(g+="</body></html>"),g}function ye(e,t,n={}){const{fileName:r="export",includeTimestamp:m=!1}=n,p=xe(e,t,{...n,standalone:!0}),c=m?`_${Q()}`:"",h=`${r}${c}.html`,i=new Blob([p],{type:"text/html;charset=utf-8"});J(i,h)}function J(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Q(){return new Date().toISOString().slice(0,19).replace(/[T:]/g,"-")}function ee(e,t,n){const r=e instanceof Date?e:new Date(e);if(isNaN(r.getTime()))return String(e);const m=p=>String(p).padStart(2,"0");return t.replace("yyyy",String(r.getFullYear())).replace("MM",m(r.getMonth()+1)).replace("dd",m(r.getDate())).replace("HH",m(r.getHours())).replace("mm",m(r.getMinutes())).replace("ss",m(r.getSeconds()))}function te(e,t,n){if(t){const r=t.match(/0+$/)?.[0]?.length??0;return e.toLocaleString(n,{minimumFractionDigits:r,maximumFractionDigits:r})}return e.toLocaleString(n)}function ne(e,t,n){return e.toLocaleString(n,{style:"currency",currency:t})}function Te(e){const t=e instanceof Date?e:new Date(e),n=new Date(1899,11,30),r=1440*60*1e3;return(t.getTime()-n.getTime())/r}function A(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function De(e){const{data:t,columns:n,format:r,options:m={}}=e;switch(r){case"csv":fe(t,n,m);break;case"xlsx":K(t,n,m);break;case"pdf":he(t,n,m);break;case"json":ge(t,m);break;case"html":ye(t,n,m);break;default:throw new Error(`Unsupported export format: ${r}`)}}function Ue(e,t={}){const{maxSample:n=100,exclude:r=[]}=t;if(e.length===0)return[];const m=e.slice(0,n),p=e[0],c=[];for(const h of Object.keys(p)){if(r.includes(h))continue;let i="string";for(const l of m){const d=l[h];if(d!=null){if(typeof d=="number"){i="number";break}if(typeof d=="boolean"){i="boolean";break}if(d instanceof Date){i="date";break}if(typeof d=="string"&&/^\d{4}-\d{2}-\d{2}/.test(d)&&!isNaN(Date.parse(d))){i="date";break}}}c.push({field:h,header:Fe(h),dataType:i})}return c}function Fe(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/^\s+/,"").split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const Ee=[{key:void 0,label:"Available Fields"},{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],Le=[{value:"",label:"Available"},{value:"row",label:"Rows"},{value:"column",label:"Columns"},{value:"data",label:"Values"},{value:"filter",label:"Filters"}],we=({fields:e,onChange:t,showAreaSelect:n=!1,className:r,style:m})=>{const[p,c]=j.useState(null),[h,i]=j.useState("none"),l=(u,b)=>{t(e.map(g=>g.field===u?{...g,area:b}:g))},d=u=>b=>{b.preventDefault();const g=b.dataTransfer.getData("text/plain")||p;g&&l(g,u),c(null),i("none")},_=u=>s.jsxs("li",{className:"nice-field-chooser__item",draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/plain",u.field),b.dataTransfer.effectAllowed="move",c(u.field)},onDragEnd:()=>{c(null),i("none")},children:[s.jsx("span",{className:"nice-field-chooser__grip","aria-hidden":"true",children:s.jsx(M.oa,{name:"menu",size:14})}),s.jsxs("span",{className:"nice-field-chooser__label",children:[u.caption,u.dataType&&s.jsxs("small",{className:"nice-field-chooser__type",children:[" (",u.dataType,")"]})]}),n&&s.jsx(ce.NiceSelect,{size:"sm",value:u.area??"",options:Le,onChange:b=>l(u.field,b||void 0),"aria-label":`Assign ${u.caption} to area`}),u.area&&s.jsx("button",{type:"button",className:"nice-field-chooser__remove",onClick:()=>l(u.field,void 0),"aria-label":`Remove ${u.caption}`,children:s.jsx(M.oa,{name:"close",size:14})})]},u.field);return s.jsx("div",{className:`nice-field-chooser ${r||""}`,style:m,children:s.jsx("div",{className:"nice-field-chooser__panel",children:Ee.map(u=>{const b=e.filter(g=>u.key?g.area===u.key:!g.area);return s.jsxs("div",{className:`nice-field-chooser__section${h===u.key&&p?" nice-field-chooser__section--over":""}`,onDragOver:g=>{g.preventDefault(),i(u.key)},onDragLeave:()=>i("none"),onDrop:d(u.key),children:[s.jsx("h4",{children:u.label}),s.jsxs("ul",{children:[b.map(_),b.length===0&&s.jsx("li",{className:"nice-field-chooser__empty","aria-hidden":"true",children:"Drop fields here"})]})]},u.label)})})})},ae="__row";function Re(e,t){if(e.length===0)return 0;switch(t){case"sum":return e.reduce((n,r)=>n+r,0);case"count":return e.length;case"avg":return e.reduce((n,r)=>n+r,0)/e.length;case"min":return Math.min(...e);case"max":return Math.max(...e);default:return e.reduce((n,r)=>n+r,0)}}function le(e,t){return[...new Set(e.map(n=>String(n[t]??"")))].sort()}const $e=({data:e,fields:t,onFieldsChange:n,showFieldChooser:r,loading:m,emptyText:p,headerText:c,exportCsv:h,exportFilename:i="pivot-export",onDrillThrough:l,className:d,style:_,accessMode:u,id:b})=>{const o=M.Dc(u,b)==="hidden",{t:a}=M.Gt(),[y,F]=j.useState(t),[T,D]=j.useState(!1),f=j.useMemo(()=>y.filter(x=>x.area==="row"),[y]),S=j.useMemo(()=>y.filter(x=>x.area==="column"),[y]),w=j.useMemo(()=>y.filter(x=>x.area==="data"),[y]),$=j.useMemo(()=>f.length===0?["Total"]:le(e,f[0].field),[e,f]),v=j.useMemo(()=>S.length===0?["Total"]:le(e,S[0].field),[e,S]),O=j.useCallback((x,N,C)=>{let U=e;f.length>0&&(U=U.filter(E=>String(E[f[0].field])===x)),S.length>0&&(U=U.filter(E=>String(E[S[0].field])===N));const z=U.map(E=>Number(E[C.field])||0),L=Re(z,C.summaryType||"sum");return C.format?C.format(L):L},[e,f,S]),H=j.useCallback(x=>{F(x),n?.(x)},[n]),B=j.useCallback((x,N)=>{let C=e;return f.length>0&&(C=C.filter(U=>String(U[f[0].field])===x)),S.length>0&&(C=C.filter(U=>String(U[S[0].field])===N)),C},[e,f,S]),W=j.useCallback((x,N)=>{l&&l(x,N,B(x,N))},[l,B]),P=j.useCallback(()=>{const x=[{field:ae,header:f.map(C=>C.caption).join(" / ")||""}];v.forEach((C,U)=>{w.length>0?w.forEach((z,L)=>x.push({field:`c${U}d${L}`,header:`${C} - ${z.caption}`})):x.push({field:`c${U}`,header:C})});const N=$.map(C=>{const U={[ae]:C};return v.forEach((z,L)=>{w.length>0?w.forEach((E,R)=>{U[`c${L}d${R}`]=O(C,z,E)}):U[`c${L}`]="—"}),U});return{columns:x,rows:N}},[v,$,w,f,O]),G=j.useCallback(()=>{const{columns:x,rows:N}=P(),C=[x.map(E=>E.header),...N.map(E=>x.map(R=>String(E[R.field]??"")))].map(E=>E.map(R=>`"${String(R).replace(/"/g,'""')}"`).join(",")).join(`
152
+ `),U=new Blob(["\uFEFF"+C],{type:"text/csv;charset=utf-8;"}),z=URL.createObjectURL(U),L=document.createElement("a");L.href=z,L.download=`${i}.csv`,L.click(),URL.revokeObjectURL(z)},[P,i]),Y=j.useCallback(()=>{const{columns:x,rows:N}=P();K(N,x,{fileName:i,sheetName:"Pivot"})},[P,i]);return o?null:s.jsxs("div",{className:`nice-pivotgrid ${d||""}`,style:_,children:[(r||h||c)&&s.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[c&&s.jsx("span",{className:"nice-pivotgrid__header-text",children:c}),s.jsxs("div",{className:"nice-pivotgrid__toolbar-actions",children:[r&&s.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-btn--icon-only",onClick:()=>D(!T),title:a("controls.fieldChooser","Field Chooser"),"aria-label":a("controls.fieldChooser","Field Chooser"),"aria-pressed":T,children:s.jsx(M.oa,{name:"filter",size:16})}),h&&s.jsx(de,{size:"sm",variant:"outline",icon:s.jsx(M.oa,{name:"download",size:16}),title:a("controls.export","Export"),items:[{key:"csv",text:"CSV",onClick:G},{key:"xlsx",text:"XLSX",onClick:Y}]})]})]}),T&&s.jsx(we,{fields:y,onChange:H}),m?s.jsx("div",{className:"nice-pivotgrid__loading",children:s.jsx("div",{className:"nice-spinner nice-spinner--md"})}):s.jsx("div",{className:"nice-pivotgrid__table-wrap",children:s.jsxs("table",{className:"nice-pivotgrid__table",children:[s.jsxs("thead",{children:[s.jsxs("tr",{children:[s.jsx("th",{children:f.map(x=>x.caption).join(" / ")||""}),v.map(x=>s.jsx("th",{colSpan:w.length||1,children:x},x))]}),w.length>1&&s.jsxs("tr",{children:[s.jsx("th",{}),v.map(x=>w.map(N=>s.jsx("th",{children:N.caption},`${x}-${N.field}`)))]})]}),s.jsx("tbody",{children:$.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:1+v.length*Math.max(w.length,1),className:"nice-pivotgrid__empty",children:p||a("controls.noData","No data available")})}):$.map(x=>s.jsxs("tr",{children:[s.jsx("td",{className:"nice-pivotgrid__row-header",children:x}),v.map(N=>w.length>0?w.map(C=>s.jsx("td",{className:`nice-pivotgrid__cell ${l?"nice-pivotgrid__cell--clickable":""}`,onClick:l?()=>W(x,N):void 0,children:O(x,N,C)},`${N}-${C.field}`)):s.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},N))]},x))})]})})]})},Me=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:$e},Symbol.toStringTag,{value:"Module"}));exports.NiceDropDownButton=de;exports.NicePivotGrid=$e;exports.NicePivotGrid$1=Me;exports.NicePivotGridFieldChooser=we;exports.autoDetectColumns=Ue;exports.downloadCSV=fe;exports.downloadHTML=ye;exports.downloadJSON=ge;exports.downloadPDF=he;exports.downloadXLSX=K;exports.exportToCSV=ue;exports.exportToHTML=xe;exports.exportToJSON=be;exports.exportToPDF=pe;exports.exportToXLSX=me;exports.niceExport=De;