@nice2dev/ui 1.0.31 → 1.1.5

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 (84) hide show
  1. package/CHANGELOG.md +353 -0
  2. package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
  3. package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
  4. package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
  5. package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
  6. package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
  7. package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
  8. package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
  9. package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
  10. package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
  11. package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
  12. package/dist/NiceForm-C6F0HvrX.cjs +1 -0
  13. package/dist/NiceForm-CCyfWgIs.js +4805 -0
  14. package/dist/NiceGantt-CSFLZD2y.js +328 -0
  15. package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
  16. package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
  17. package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
  18. package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
  19. package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
  20. package/dist/NiceMention-CWoLD0SE.js +11082 -0
  21. package/dist/NiceMention-J1lUDLhg.cjs +430 -0
  22. package/dist/NiceMention.css +1 -0
  23. package/dist/NiceModal-0UxviEYE.cjs +1 -0
  24. package/dist/NiceModal-D-iOonog.js +95 -0
  25. package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
  26. package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
  27. package/dist/NiceModuleLifecyclePanel.css +1 -1
  28. package/dist/NicePagination-CPn-Q1h_.js +172 -0
  29. package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
  30. package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
  31. package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
  32. package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
  33. package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
  34. package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
  35. package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
  36. package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
  37. package/dist/NiceSelect-DHowflmX.js +433 -0
  38. package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
  39. package/dist/NiceWindow-xnTSHdHv.js +1623 -0
  40. package/dist/charts-B-sl1V9y.cjs +882 -0
  41. package/dist/charts-DO2z6Ziu.js +31920 -0
  42. package/dist/charts.cjs +1 -1
  43. package/dist/charts.mjs +7 -7
  44. package/dist/core-C2KhqEaU.cjs +1 -0
  45. package/dist/core-K2DIxXLn.js +795 -0
  46. package/dist/data-branching-DC6hcBQN.cjs +1 -0
  47. package/dist/data-branching-DykdTpjJ.js +6255 -0
  48. package/dist/data-branching.cjs +1 -1
  49. package/dist/data-branching.mjs +1 -1
  50. package/dist/data.cjs +1 -1
  51. package/dist/data.d.ts +29 -7
  52. package/dist/data.mjs +18 -16
  53. package/dist/devops-CU0sOVEA.cjs +17 -0
  54. package/dist/devops-CXyEwQeM.js +8165 -0
  55. package/dist/devops.cjs +1 -1
  56. package/dist/devops.mjs +1 -1
  57. package/dist/editors.cjs +1 -1
  58. package/dist/editors.d.ts +73 -1
  59. package/dist/editors.mjs +58 -54
  60. package/dist/feedback.cjs +1 -1
  61. package/dist/feedback.d.ts +1 -1
  62. package/dist/feedback.mjs +3 -3
  63. package/dist/index.cjs +5137 -1
  64. package/dist/index.css +1 -1
  65. package/dist/index.d.ts +115 -13
  66. package/dist/index.mjs +66371 -992
  67. package/dist/lazy.cjs +1 -1
  68. package/dist/lazy.mjs +24 -24
  69. package/dist/navigation.cjs +1 -1
  70. package/dist/navigation.d.ts +6 -0
  71. package/dist/navigation.mjs +4 -4
  72. package/dist/no-code-C58g8_fb.cjs +332 -0
  73. package/dist/no-code-Cj4xJ3w9.js +7425 -0
  74. package/dist/no-code.cjs +1 -1
  75. package/dist/no-code.mjs +1 -1
  76. package/dist/overlays.cjs +1 -1
  77. package/dist/overlays.d.ts +2 -0
  78. package/dist/overlays.mjs +2 -2
  79. package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
  80. package/dist/pickerCommons-COiSUiP2.js +1122 -0
  81. package/dist/style.css +6 -6
  82. package/dist/vendor-BPVpdtPp.js +271 -0
  83. package/dist/vendor-Bo2Q64AF.cjs +1 -0
  84. package/package.json +17 -17
@@ -0,0 +1,152 @@
1
+ "use strict";const s=require("react/jsx-runtime"),M=require("./charts-B-sl1V9y.cjs"),j=require("react"),ve=require("react-dom"),ce=require("./NiceSelect-BVoqtfYN.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;