@nice2dev/ui 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +476 -0
- package/dist/NiceButton-CnAIqCbd.js +101 -0
- package/dist/NiceButton-DzCqkG5a.cjs +1 -0
- package/dist/NiceCodeEditor-C43xFG8v.cjs +260 -0
- package/dist/NiceCodeEditor-CK6B54mu.js +1215 -0
- package/dist/NiceCodeEditor-CspuYLh6.js +1174 -0
- package/dist/NiceCodeEditor-bJReZPDO.cjs +268 -0
- package/dist/NiceColorPicker-BV3olE3M.cjs +1 -0
- package/dist/NiceColorPicker-CyY-4q89.js +552 -0
- package/dist/NiceDataGrid-BQIqitMM.cjs +10 -0
- package/dist/NiceDataGrid-C1eI6Pso.js +2267 -0
- package/dist/NiceDataGrid-CrD4HPlO.cjs +10 -0
- package/dist/NiceDataGrid-Dfg1DVbU.js +2224 -0
- package/dist/NiceForm-CISJyzoW.cjs +1 -0
- package/dist/NiceForm-CfAPcXdX.cjs +1 -0
- package/dist/NiceForm-DfKYNQti.js +5017 -0
- package/dist/NiceForm-DmH6k1b_.js +4775 -0
- package/dist/NiceGantt-CHnq-n8f.cjs +1 -0
- package/dist/NiceGantt-CX3jVNaF.js +330 -0
- package/dist/NiceGantt-TEXbAELi.js +333 -0
- package/dist/NiceGantt-s2cgt5zD.cjs +1 -0
- package/dist/NiceHtmlEditor-CDZeF_zG.cjs +10 -0
- package/dist/NiceHtmlEditor-CdWgddg3.js +901 -0
- package/dist/NiceHtmlEditor-DeK0Of98.js +883 -0
- package/dist/NiceHtmlEditor-DvVxl4Fu.cjs +10 -0
- package/dist/NiceLoginForm-CHXbz0eu.js +747 -0
- package/dist/NiceLoginForm-DRPldHXa.js +808 -0
- package/dist/NiceLoginForm-IGLUCQUE.cjs +1 -0
- package/dist/NiceLoginForm-ix6J1adA.cjs +1 -0
- package/dist/NiceMention-CgDp0sl9.cjs +430 -0
- package/dist/NiceMention-DBvFvx71.js +11653 -0
- package/dist/NiceMention-DKhk3xdM.js +11321 -0
- package/dist/NiceMention-wp1AJ5oh.cjs +430 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-BbQwiEOp.cjs +1 -0
- package/dist/NiceModal-BlYhFDhP.js +80 -0
- package/dist/NiceModal-DQEfTcnZ.js +85 -0
- package/dist/NiceModal-DmWz2PDM.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-22CEEVbA.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-BCd9Wv5Y.js +6825 -0
- package/dist/NiceModuleLifecyclePanel-D8EoXqBy.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-SN6G7t64.js +7189 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-BFGt1v0a.js +165 -0
- package/dist/NicePagination-BJS65foT.js +200 -0
- package/dist/NicePagination-D_3GfWp5.cjs +1 -0
- package/dist/NicePagination-DltL3-Sz.cjs +1 -0
- package/dist/NicePivotGrid-BD87Na7P.js +1163 -0
- package/dist/NicePivotGrid-BPmnvbPQ.cjs +152 -0
- package/dist/NicePivotGrid-D_kRF1Dt.js +1180 -0
- package/dist/NicePivotGrid-DqluEkCI.cjs +152 -0
- package/dist/NiceSavedQueryPanel-BSTiZvFg.js +5130 -0
- package/dist/NiceSavedQueryPanel-C2Tn1cMW.js +5311 -0
- package/dist/NiceSavedQueryPanel-DDKtL1AA.cjs +586 -0
- package/dist/NiceSavedQueryPanel-DrR3sw4T.cjs +586 -0
- package/dist/NiceScheduler-DvxJ8N0I.js +1698 -0
- package/dist/NiceScheduler-GJLvkXJ3.cjs +5 -0
- package/dist/NiceScheduler-TIksdF0k.cjs +5 -0
- package/dist/NiceScheduler-UT49u2Vq.js +1710 -0
- package/dist/NiceSelect-CdUHd8rj.cjs +1 -0
- package/dist/NiceSelect-fOelG_QB.js +495 -0
- package/dist/NiceWindow-CqSsTjrS.cjs +1 -0
- package/dist/NiceWindow-DZLPhXbR.js +2223 -0
- package/dist/charts-BYQwl_GS.js +4789 -0
- package/dist/charts-BpELGDXh.cjs +768 -0
- package/dist/charts-C6iOu0H6.cjs +768 -0
- package/dist/charts-M6LuVI7F.js +4776 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +1 -29
- package/dist/charts.mjs +1 -1
- package/dist/core-lazy-B_laOXNf.cjs +1 -0
- package/dist/core-lazy-Ctin_LwS.cjs +1 -0
- package/dist/core-lazy-VQEjdz0L.js +351 -0
- package/dist/core-lazy-iDiropM6.js +351 -0
- package/dist/data-branching-7rpktFJ-.cjs +1 -0
- package/dist/data-branching-BS0aFUMu.js +6428 -0
- package/dist/data-branching-BgIAw01q.cjs +1 -0
- package/dist/data-branching-bvB9K6KS.js +6386 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.mjs +3 -3
- package/dist/devops-Bp-_aA-9.js +8682 -0
- package/dist/devops-CFytAJQr.cjs +18 -0
- package/dist/devops-CW8YY_zA.js +9122 -0
- package/dist/devops-CXBSjnyX.cjs +17 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.css +1 -0
- package/dist/devops.mjs +5 -5
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +8 -8
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +21 -16
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +199 -194
- package/dist/index.css +1 -1
- package/dist/index.d.ts +378 -48
- package/dist/index.mjs +23248 -21783
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +31 -0
- package/dist/navigation.mjs +404 -354
- package/dist/no-code-BNFk_BDO.js +8275 -0
- package/dist/no-code-BaAI_sJR.js +8318 -0
- package/dist/no-code-CFdTp543.cjs +331 -0
- package/dist/no-code-oQTeAtnW.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +5 -0
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BQi6IEAt.js +661 -0
- package/dist/pickerCommons-CMxFt9SW.js +548 -0
- package/dist/pickerCommons-Dc_hlz-e.cjs +1 -0
- package/dist/pickerCommons-DvQptSPX.cjs +1 -0
- package/dist/style.css +7 -4
- package/package.json +4 -3
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),M=require("@nice2dev/ui-core"),j=require("react"),ke=require("react-dom"),de=require("./NiceSelect-DIKGbaJo.cjs"),_e=require("./devops-CXBSjnyX.cjs"),Ne=[],ue=({text:e,label:n,icon:o,items:r=Ne,variant:f="primary",size:m="md",disabled:p,readOnly:u,loading:l,onItemClick:c,splitButton:a,onClick:k,className:N,style:i,id:h,title:t,accessMode:d,displayStyle:y,error:D,errorPlacement:_="bottom"})=>{const{t:S}=M.useNiceTranslation(),g=M.useComponentDisplayStyle("button",y),E=M.useComponentDisplayClass("button",y),w=M.useNiceAccessMode(d,h),$=w==="hidden";w==="disabled"&&(p=!0),l&&(p=!0);const x=!p&&(u||w==="readOnly"),L=M.normalizeVariant(f),R=e||n,[H,X]=j.useState(!1),I=j.useRef(null),W=j.useRef(null),B=j.useRef(null),[J,Q]=j.useState(void 0),[b,T]=j.useState(null),[C,U]=j.useState("");j.useLayoutEffect(()=>{Q(void 0)},[m,f]),j.useLayoutEffect(()=>{if(W.current){const v=W.current.offsetWidth;Q(V=>V==null||v>V?v:V)}},[R,l]);let O=g;if(L!=="primary"){const v={...g};delete v.background,delete v.color,(L==="outline"||L==="ghost")&&(delete v.border,delete v.borderColor,delete v.borderWidth,delete v.borderStyle,delete v.boxShadow),O=v}const A={...O,...J?{minWidth:J}:{}},F=j.useCallback(()=>{const v=I.current;if(!v)return;const V=v.getBoundingClientRect();T({top:V.bottom,left:V.left,width:V.width}),U(de.scopeThemeClass(v))},[]);j.useLayoutEffect(()=>{if(H)return F(),window.addEventListener("scroll",F,!0),window.addEventListener("resize",F),()=>{window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",F)}},[H,F]),j.useEffect(()=>{if(!H)return;const v=V=>{const se=V.target;I.current?.contains(se)||B.current?.contains(se)||X(!1)};return document.addEventListener("mousedown",v),document.addEventListener("touchstart",v),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("touchstart",v)}},[H]);const P=s.jsxs("div",{className:`nice-dropdown-btn ${N||""}`,style:{position:"relative",display:"inline-flex",...i},ref:I,"aria-busy":l||void 0,children:[a?s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:W,type:"button",className:`nice-btn nice-btn--${L} nice-btn--${m} nice-btn--ds-${E} ${l?"nice-btn--loading":""} ${x?"nice-btn--readonly":""}`,style:A,disabled:p,"aria-readonly":x||void 0,onClick:()=>{x||k?.()},children:[l&&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"})}),o&&s.jsx("span",{className:"nice-btn__icon",style:l?{visibility:"hidden"}:void 0,children:o}),s.jsx("span",{style:l?{visibility:"hidden"}:void 0,children:R})]}),s.jsx("button",{type:"button",className:`nice-btn nice-btn--${L} nice-btn--${m} nice-btn--ds-${E} nice-dropdown-btn__caret ${x?"nice-btn--readonly":""}`,style:O,disabled:p,"aria-readonly":x||void 0,onClick:()=>{x||X(!H)},"aria-label":S("dropDownButton.toggleDropdown","Toggle dropdown"),children:s.jsx(M.NiceIcon,{name:"chevron-down",size:"xs"})})]}):s.jsxs("button",{ref:W,type:"button",className:`nice-btn nice-btn--${L} nice-btn--${m} nice-btn--ds-${E} ${l?"nice-btn--loading":""} ${x?"nice-btn--readonly":""}`,style:A,disabled:p,"aria-readonly":x||void 0,title:t,"aria-label":!R&&t?t:void 0,onClick:()=>{x||X(!H)},children:[l&&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"})}),o&&s.jsx("span",{className:"nice-btn__icon",style:l?{visibility:"hidden"}:void 0,children:o}),s.jsx("span",{style:l?{visibility:"hidden"}:void 0,children:R}),s.jsx("span",{style:{marginLeft:"auto",paddingLeft:4,display:"inline-flex",...l?{visibility:"hidden"}:{}},children:s.jsx(M.NiceIcon,{name:"chevron-down",size:"xs"})})]}),H&&b&&typeof document<"u"&&ke.createPortal(s.jsx("ul",{ref:B,className:`nice-dropdown__list nice-dropdown-btn__menu nice-dropdown-btn__menu--${m} ${C}`,"data-theme":C==="nice-dark"?"dark":C==="nice-light"?"light":void 0,role:"menu",style:{position:"fixed",top:b.top,left:b.left,minWidth:b.width,marginTop:0,zIndex:1e3},children:r.map(v=>s.jsxs("li",{role:"menuitem",className:`nice-dropdown__option ${v.disabled?"nice-dropdown__option--disabled":""} ${v.danger?"nice-dropdown__option--danger":""}`,onClick:()=>{v.disabled||(v.onClick?.(),c?.(v),X(!1))},children:[v.icon&&s.jsx("span",{className:"nice-dropdown-btn__item-icon",children:v.icon}),v.text]},v.key))}),document.body)]});if(!D)return P;const re=s.jsx("div",{className:"nice-field__error",role:"alert",children:D});return _==="right"?s.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${m}`,children:[P,re]}):$?null:s.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${m}`,children:[P,re]})};function fe(e,n,o={}){const{delimiter:r=",",lineEnding:f=`
|
|
2
|
+
`,quoteChar:m='"',alwaysQuote:p=!1,includeHeaders:u=!0,includeRowNumbers:l=!1,locale:c="en-US",dateTimeFormat:a="yyyy-MM-dd HH:mm:ss"}=o,k=n.filter(t=>t.visible!==!1),N=[],i=t=>{if(p||t.includes(r)||t.includes(m)||t.includes(`
|
|
3
|
+
`)||t.includes("\r")){const y=t.replace(new RegExp(m,"g"),m+m);return`${m}${y}${m}`}return t},h=(t,d,y)=>{if(t==null)return"";if(d.format)return d.format(t,y);switch(d.dataType){case"date":return te(t,d.dateFormat??a);case"number":return ne(t,d.numberFormat,c);case"currency":return oe(t,d.currencyCode??"USD",c);case"boolean":return t?"Yes":"No";default:return String(t)}};if(u){const t=[];l&&t.push(i("#"));for(const d of k)t.push(i(d.header));N.push(t.join(r))}return e.forEach((t,d)=>{const y=[];l&&y.push(String(d+1));for(const D of k){const _=t[D.field],S=h(_,D,t);y.push(i(S))}N.push(y.join(r))}),N.join(f)}function me(e,n,o={}){const{fileName:r="export",includeTimestamp:f=!1,includeBOM:m=!0,encoding:p="utf-8"}=o,u=fe(e,n,o),l=f?`_${K()}`:"",c=`${r}${l}.csv`;let a=u;m&&p==="utf-8"&&(a="\uFEFF"+u);const k=new Blob([a],{type:`text/csv;charset=${p}`});Z(k,c)}function Ce(){return{sheets:new Map,activeSheet:""}}function je(e,n){const o={name:n,cells:new Map,columns:[],merges:[]};return e.sheets.set(n,o),e.activeSheet||(e.activeSheet=n),o}function G(e,n,o,r){const f=Y(n,o);e.cells.set(f,r)}function Y(e,n){let o="",r=n;for(;r>=0;)o=String.fromCharCode(65+r%26)+o,r=Math.floor(r/26)-1;return`${o}${e+1}`}function Se(e){const n=new TextEncoder,o=Array.from(e.sheets.entries()),r=o.map(([l,c],a)=>{const k=[];let N=0,i=0;c.cells.forEach((t,d)=>{const y=d.match(/([A-Z]+)(\d+)/);if(y){const D=Te(y[1]),_=parseInt(y[2],10);N=Math.max(N,_),i=Math.max(i,D)}});for(let t=1;t<=N;t++){const d=[];for(let y=0;y<=i;y++){const D=Y(t-1,y),_=c.cells.get(D);if(_){const S=_.type==="s"?' t="inlineStr"':_.type==="b"?' t="b"':"";let g;_.type==="s"?g=`<is><t>${ie(String(_.value))}</t></is>`:_.type==="b"?g=`<v>${_.value?1:0}</v>`:g=`<v>${_.value}</v>`,d.push(`<c r="${D}"${S}>${g}</c>`)}}d.length>0&&k.push(`<row r="${t}">${d.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="${N>0?`A1:${Y(N-1,i)}`:"A1"}"/>
|
|
6
|
+
<sheetData>${k.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>${o.map(([l],c)=>`<sheet name="${ie(l)}" sheetId="${c+1}" r:id="rId${c+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
|
+
${o.map((l,c)=>`<Relationship Id="rId${c+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${c+1}.xml"/>`).join(`
|
|
13
|
+
`)}
|
|
14
|
+
</Relationships>`,p=`<?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
|
+
${o.map((l,c)=>`<Override PartName="/xl/worksheets/sheet${c+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join(`
|
|
20
|
+
`)}
|
|
21
|
+
</Types>`;return De([{path:"[Content_Types].xml",content:n.encode(p)},{path:"_rels/.rels",content:n.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:n.encode(f)},{path:"xl/_rels/workbook.xml.rels",content:n.encode(m)},...r.map((l,c)=>({path:`xl/worksheets/sheet${c+1}.xml`,content:n.encode(l)}))])}function Te(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.charCodeAt(o)-64);return n-1}function ie(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function De(e){const n=[],o=[];let r=0;for(const a of e){const k=new TextEncoder().encode(a.path),N=new Uint8Array(30+k.length),i=new DataView(N.buffer);i.setUint32(0,67324752,!0),i.setUint16(4,20,!0),i.setUint16(6,0,!0),i.setUint16(8,0,!0),i.setUint16(10,0,!0),i.setUint16(12,0,!0),i.setUint32(14,ae(a.content),!0),i.setUint32(18,a.content.length,!0),i.setUint32(22,a.content.length,!0),i.setUint16(26,k.length,!0),i.setUint16(28,0,!0),N.set(k,30),n.push(N),n.push(a.content);const h=new Uint8Array(46+k.length),t=new DataView(h.buffer);t.setUint32(0,33639248,!0),t.setUint16(4,20,!0),t.setUint16(6,20,!0),t.setUint16(8,0,!0),t.setUint16(10,0,!0),t.setUint16(12,0,!0),t.setUint16(14,0,!0),t.setUint32(16,ae(a.content),!0),t.setUint32(20,a.content.length,!0),t.setUint32(24,a.content.length,!0),t.setUint16(28,k.length,!0),t.setUint16(30,0,!0),t.setUint16(32,0,!0),t.setUint16(34,0,!0),t.setUint16(36,0,!0),t.setUint32(38,0,!0),t.setUint32(42,r,!0),h.set(k,46),o.push(h),r+=N.length+a.content.length}const f=o.reduce((a,k)=>a+k.length,0),m=new Uint8Array(22),p=new DataView(m.buffer);p.setUint32(0,101010256,!0),p.setUint16(4,0,!0),p.setUint16(6,0,!0),p.setUint16(8,e.length,!0),p.setUint16(10,e.length,!0),p.setUint32(12,f,!0),p.setUint32(16,r,!0),p.setUint16(20,0,!0);const u=r+f+m.length,l=new Uint8Array(u);let c=0;for(const a of n)l.set(a,c),c+=a.length;for(const a of o)l.set(a,c),c+=a.length;return l.set(m,c),l.buffer}function ae(e){let n=4294967295;const o=Ue();for(let r=0;r<e.length;r++)n=n>>>8^o[(n^e[r])&255];return(n^4294967295)>>>0}let q=null;function Ue(){if(q)return q;q=new Uint32Array(256);for(let e=0;e<256;e++){let n=e;for(let o=0;o<8;o++)n=n&1?3988292384^n>>>1:n>>>1;q[e]=n}return q}function pe(e,n,o={}){const{sheetName:r="Sheet1",title:f,subtitle:m,includeHeaders:p=!0,includeRowNumbers:u=!1,freezeHeader:l=!0,autoFilter:c=!0,styles:a={},locale:k="en-US",dateTimeFormat:N="yyyy-MM-dd HH:mm:ss"}=o,i=n.filter(S=>S.visible!==!1),h=Ce(),t=je(h,r);let d=0;const y=u?1:0;f&&(G(t,d,0,{value:f,type:"s",style:{font:{bold:!0,size:16}}}),d++),m&&(G(t,d,0,{value:m,type:"s",style:{font:{italic:!0,size:12}}}),d++);const D=d;p&&(u&&G(t,d,0,{value:"#",type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:"center"}}}),i.forEach((S,g)=>{G(t,d,g+y,{value:S.header,type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:S.align??"left"}}})}),d++),e.forEach((S,g)=>{u&&G(t,d,0,{value:g+1,type:"n"}),i.forEach((E,w)=>{const $=S[E.field];let x;if($==null)x={value:"",type:"s"};else if(E.format)x={value:E.format($,S),type:"s"};else switch(E.dataType){case"number":case"currency":x={value:Number($),type:"n",numberFormat:E.numberFormat};break;case"date":{x={value:Fe($),type:"n",numberFormat:E.dateFormat??"yyyy-mm-dd"};break}case"boolean":x={value:$,type:"b"};break;default:x={value:String($),type:"s"}}a.alternateRows&&g%2===1&&(x.style={...x.style,fill:{color:a.alternateBackground??"var(--nice-text-primary, #f5f5f5)"}}),G(t,d,w+y,x)}),d++});const _=i.map(S=>S.width??100);if(u&&_.unshift(40),t.columns=_.map(S=>({width:S/7})),l&&p&&(t.freezePane={row:D+1,col:0}),c&&p&&e.length>0){const S=Y(D,0),g=Y(d-1,i.length-1+y);t.autoFilter={start:S,end:g}}return Se(h)}function ee(e,n,o={}){const{fileName:r="export",includeTimestamp:f=!1}=o,m=pe(e,n,o),p=f?`_${K()}`:"",u=`${r}${p}.xlsx`,l=new Blob([m],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Z(l,u)}function he(e,n,o={}){const{title:r,subtitle:f,orientation:m="portrait",pageSize:p="A4",margins:u={top:20,right:20,bottom:20,left:20},header:l,footer:c,logo:a,logoWidth:k=100,logoHeight:N,watermark:i,includeHeaders:h=!0,includeRowNumbers:t=!1,styles:d={},locale:y="en-US",dateTimeFormat:D="yyyy-MM-dd HH:mm:ss"}=o,_=n.filter(w=>w.visible!==!1),S=(w,$,x)=>{if(w==null)return"";if($.format)return $.format(w,x);switch($.dataType){case"date":return te(w,$.dateFormat??D);case"number":return ne(w,$.numberFormat,y);case"currency":return oe(w,$.currencyCode??"USD",y);case"boolean":return w?"✓":"✗";default:return String(w)}};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: ${p} ${m};
|
|
33
|
+
margin: ${u.top}mm ${u.right}mm ${u.bottom}mm ${u.left}mm;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
body {
|
|
37
|
+
font-family: ${d.fontFamily??"Arial, sans-serif"};
|
|
38
|
+
font-size: ${d.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: ${k}px;
|
|
62
|
+
${N?`max-height: ${N}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 ${d.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: ${d.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
|
|
85
|
+
color: ${d.headerColor??"var(--nice-text, #333)"};
|
|
86
|
+
font-weight: ${d.headerFontWeight??"bold"};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
tr:nth-child(even) {
|
|
90
|
+
background-color: ${d.alternateRows!==!1?d.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(i&&(g+=`<div class="watermark">${z(i)}</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>",h){g+="<thead><tr>",t&&(g+='<th class="text-center">#</th>');for(const w of _){const $=w.align??"left";g+=`<th class="text-${$}" style="width: ${w.width??"auto"}px">${z(w.header)}</th>`}g+="</tr></thead>"}g+="<tbody>",e.forEach((w,$)=>{g+="<tr>",t&&(g+=`<td class="text-center">${$+1}</td>`);for(const x of _){const L=S(w[x.field],x,w),R=x.align??"left";g+=`<td class="text-${R}">${z(L)}</td>`}g+="</tr>"}),g+="</tbody>",g+="</table>",g+="</body></html>";const E=window.open("","_blank");E&&(E.document.write(g),E.document.close(),E.onload=()=>{E.print()})}function be(e,n,o={}){he(e,n,o)}function ge(e,n={}){const{pretty:o=!0,indent:r=2,fields:f,transform:m}=n;let p=e;return m&&(p=e.map((u,l)=>m(u,l))),f?.length&&(p=p.map(u=>{const l={};for(const c of f)c in u&&(l[c]=u[c]);return l})),JSON.stringify(p,null,o?r:void 0)}function xe(e,n={}){const{fileName:o="export",includeTimestamp:r=!1}=n,f=ge(e,n),m=r?`_${K()}`:"",p=`${o}${m}.json`,u=new Blob([f],{type:"application/json;charset=utf-8"});Z(u,p)}function ye(e,n,o={}){const{title:r,includeHeaders:f=!0,includeRowNumbers:m=!1,inlineStyles:p=!0,tableClass:u="nice-export-table",standalone:l=!0,styles:c={},locale:a="en-US",dateTimeFormat:k="yyyy-MM-dd HH:mm:ss"}=o,N=n.filter(t=>t.visible!==!1),i=(t,d,y)=>{if(t==null)return"";if(d.format)return d.format(t,y);switch(d.dataType){case"date":return te(t,d.dateFormat??k);case"number":return ne(t,d.numberFormat,a);case"currency":return oe(t,d.currencyCode??"USD",a);case"boolean":return t?"Yes":"No";default:return String(t)}};let h="";if(l&&(h+=`<!DOCTYPE html>
|
|
124
|
+
<html>
|
|
125
|
+
<head>
|
|
126
|
+
<meta charset="utf-8">
|
|
127
|
+
<title>${z(r??"Export")}</title>
|
|
128
|
+
<style>
|
|
129
|
+
.${u} {
|
|
130
|
+
border-collapse: collapse;
|
|
131
|
+
width: 100%;
|
|
132
|
+
font-family: ${c.fontFamily??"Arial, sans-serif"};
|
|
133
|
+
font-size: ${c.fontSize??12}px;
|
|
134
|
+
}
|
|
135
|
+
.${u} th, .${u} td {
|
|
136
|
+
border: 1px solid ${c.borderColor??"var(--nice-border, #ddd)"};
|
|
137
|
+
padding: var(--nice-space-2, 8px);
|
|
138
|
+
text-align: left;
|
|
139
|
+
}
|
|
140
|
+
.${u} th {
|
|
141
|
+
background-color: ${c.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
|
|
142
|
+
color: ${c.headerColor??"var(--nice-text, #333)"};
|
|
143
|
+
font-weight: ${c.headerFontWeight??"bold"};
|
|
144
|
+
}
|
|
145
|
+
.${u} tr:nth-child(even) {
|
|
146
|
+
background-color: ${c.alternateRows!==!1?c.alternateBackground??"var(--nice-bg-secondary, #fafafa)":"transparent"};
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
149
|
+
</head>
|
|
150
|
+
<body>
|
|
151
|
+
`,r&&(h+=`<h1>${z(r)}</h1>`)),h+=`<table class="${u}"${!l&&p?' style="border-collapse:collapse;width:100%"':""}>`,f){h+="<thead><tr>",m&&(h+="<th>#</th>");for(const t of N)h+=`<th>${z(t.header)}</th>`;h+="</tr></thead>"}return h+="<tbody>",e.forEach((t,d)=>{h+="<tr>",m&&(h+=`<td>${d+1}</td>`);for(const y of N){const D=i(t[y.field],y,t);h+=`<td>${z(D)}</td>`}h+="</tr>"}),h+="</tbody></table>",l&&(h+="</body></html>"),h}function we(e,n,o={}){const{fileName:r="export",includeTimestamp:f=!1}=o,m=ye(e,n,{...o,standalone:!0}),p=f?`_${K()}`:"",u=`${r}${p}.html`,l=new Blob([m],{type:"text/html;charset=utf-8"});Z(l,u)}function Z(e,n){const o=URL.createObjectURL(e),r=document.createElement("a");r.href=o,r.download=n,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)}function K(){return new Date().toISOString().slice(0,19).replace(/[T:]/g,"-")}function te(e,n,o){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 n.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,n,o){if(n){const r=n.match(/0+$/)?.[0]?.length??0;return e.toLocaleString(o,{minimumFractionDigits:r,maximumFractionDigits:r})}return e.toLocaleString(o)}function oe(e,n,o){return e.toLocaleString(o,{style:"currency",currency:n})}function Fe(e){const n=e instanceof Date?e:new Date(e),o=new Date(1899,11,30),r=1440*60*1e3;return(n.getTime()-o.getTime())/r}function z(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ee(e){const{data:n,columns:o,format:r,options:f={}}=e;switch(r){case"csv":me(n,o,f);break;case"xlsx":ee(n,o,f);break;case"pdf":be(n,o,f);break;case"json":xe(n,f);break;case"html":we(n,o,f);break;default:throw new Error(`Unsupported export format: ${r}`)}}function Me(e,n={}){const{maxSample:o=100,exclude:r=[]}=n;if(e.length===0)return[];const f=e.slice(0,o),m=e[0],p=[];for(const u of Object.keys(m)){if(r.includes(u))continue;let l="string";for(const c of f){const a=c[u];if(a!=null){if(typeof a=="number"){l="number";break}if(typeof a=="boolean"){l="boolean";break}if(a instanceof Date){l="date";break}if(typeof a=="string"&&/^\d{4}-\d{2}-\d{2}/.test(a)&&!isNaN(Date.parse(a))){l="date";break}}}p.push({field:u,header:Le(u),dataType:l})}return p}function Le(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/^\s+/,"").split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ")}const Re=[],Ae=[{key:void 0,label:"Available Fields"},{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],Oe=[{value:"",label:"Available"},{value:"row",label:"Rows"},{value:"column",label:"Columns"},{value:"data",label:"Values"},{value:"filter",label:"Filters"}],ve=({fields:e=Re,onChange:n,showAreaSelect:o=!1,className:r,style:f})=>{const{t:m}=M.useNiceTranslation(),[p,u]=j.useState(null),[l,c]=j.useState("none"),a=(i,h)=>{n(e.map(t=>t.field===i?{...t,area:h}:t))},k=i=>h=>{h.preventDefault();const t=h.dataTransfer.getData("text/plain")||p;t&&a(t,i),u(null),c("none")},N=i=>s.jsxs("li",{className:"nice-field-chooser__item",draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",i.field),h.dataTransfer.effectAllowed="move",u(i.field)},onDragEnd:()=>{u(null),c("none")},children:[s.jsx("span",{className:"nice-field-chooser__grip","aria-hidden":"true",children:s.jsx(M.NiceIcon,{name:"menu",size:14})}),s.jsxs("span",{className:"nice-field-chooser__label",children:[i.caption,i.dataType&&s.jsxs("small",{className:"nice-field-chooser__type",children:[" (",i.dataType,")"]})]}),o&&s.jsx(de.NiceSelect,{size:"sm",value:i.area??"",options:Oe,onChange:h=>a(i.field,h||void 0),"aria-label":m("pivotGridFieldChooser.assignToArea","Assign {caption} to area").replace("{caption}",String(i.caption))}),i.area&&s.jsx("button",{type:"button",className:"nice-field-chooser__remove",onClick:()=>a(i.field,void 0),"aria-label":m("pivotGridFieldChooser.remove","Remove {caption}").replace("{caption}",String(i.caption)),children:s.jsx(M.NiceIcon,{name:"close",size:14})})]},i.field);return s.jsx("div",{className:`nice-field-chooser ${r||""}`,style:f,children:s.jsx("div",{className:"nice-field-chooser__panel",children:Ae.map(i=>{const h=e.filter(t=>i.key?t.area===i.key:!t.area);return s.jsxs("div",{className:`nice-field-chooser__section${l===i.key&&p?" nice-field-chooser__section--over":""}`,onDragOver:t=>{t.preventDefault(),c(i.key)},onDragLeave:()=>c("none"),onDrop:k(i.key),children:[s.jsx("h4",{children:i.label}),s.jsxs("ul",{children:[h.map(N),h.length===0&&s.jsx("li",{className:"nice-field-chooser__empty","aria-hidden":"true",children:m("pivotGridFieldChooser.dropFieldsHere","Drop fields here")})]})]},i.label)})})})},He=[],le="__row";function ze(e,n){if(e.length===0)return 0;switch(n){case"sum":return e.reduce((o,r)=>o+r,0);case"count":return e.length;case"avg":return e.reduce((o,r)=>o+r,0)/e.length;case"min":return Math.min(...e);case"max":return Math.max(...e);default:return e.reduce((o,r)=>o+r,0)}}function ce(e,n){return[...new Set(e.map(o=>String(o[n]??"")))].sort()}const $e=({data:e=He,fields:n,defaultFields:o,onFieldsChange:r,showFieldChooser:f,loading:m,emptyText:p,headerText:u,exportCsv:l,exportFilename:c="pivot-export",onDrillThrough:a,className:k,style:N,accessMode:i,id:h})=>{const d=M.useNiceAccessMode(i,h)==="hidden",{t:y}=M.useNiceTranslation(),D=n!==void 0&&r!==void 0,[_,S]=M.useControllableState({value:D?n:void 0,defaultValue:D?o:o??n,fallbackValue:[],onChange:r,componentName:"NicePivotGrid"});_e.useIgnoredPropChangeWarning("NicePivotGrid","fields","onFieldsChange",n,D);const[g,E]=j.useState(!1),w=j.useMemo(()=>_.filter(b=>b.area==="row"),[_]),$=j.useMemo(()=>_.filter(b=>b.area==="column"),[_]),x=j.useMemo(()=>_.filter(b=>b.area==="data"),[_]),L=j.useMemo(()=>w.length===0?["Total"]:ce(e,w[0].field),[e,w]),R=j.useMemo(()=>$.length===0?["Total"]:ce(e,$[0].field),[e,$]),H=j.useCallback((b,T,C)=>{let U=e;w.length>0&&(U=U.filter(F=>String(F[w[0].field])===b)),$.length>0&&(U=U.filter(F=>String(F[$[0].field])===T));const O=U.map(F=>Number(F[C.field])||0),A=ze(O,C.summaryType||"sum");return C.format?C.format(A):A},[e,w,$]),X=j.useCallback(b=>{S(b)},[S]),I=j.useCallback((b,T)=>{let C=e;return w.length>0&&(C=C.filter(U=>String(U[w[0].field])===b)),$.length>0&&(C=C.filter(U=>String(U[$[0].field])===T)),C},[e,w,$]),W=j.useCallback((b,T)=>{a&&a(b,T,I(b,T))},[a,I]),B=j.useCallback(()=>{const b=[{field:le,header:w.map(C=>C.caption).join(" / ")||""}];R.forEach((C,U)=>{x.length>0?x.forEach((O,A)=>b.push({field:`c${U}d${A}`,header:`${C} - ${O.caption}`})):b.push({field:`c${U}`,header:C})});const T=L.map(C=>{const U={[le]:C};return R.forEach((O,A)=>{x.length>0?x.forEach((F,P)=>{U[`c${A}d${P}`]=H(C,O,F)}):U[`c${A}`]="—"}),U});return{columns:b,rows:T}},[R,L,x,w,H]),J=j.useCallback(()=>{const{columns:b,rows:T}=B(),C=[b.map(F=>F.header),...T.map(F=>b.map(P=>String(F[P.field]??"")))].map(F=>F.map(P=>`"${String(P).replace(/"/g,'""')}"`).join(",")).join(`
|
|
152
|
+
`),U=new Blob(["\uFEFF"+C],{type:"text/csv;charset=utf-8;"}),O=URL.createObjectURL(U),A=document.createElement("a");A.href=O,A.download=`${c}.csv`,A.click(),URL.revokeObjectURL(O)},[B,c]),Q=j.useCallback(()=>{const{columns:b,rows:T}=B();ee(T,b,{fileName:c,sheetName:"Pivot"})},[B,c]);return d?null:s.jsxs("div",{className:`nice-pivotgrid ${k||""}`,style:N,children:[(f||l||u)&&s.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[u&&s.jsx("span",{className:"nice-pivotgrid__header-text",children:u}),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:()=>E(!g),title:y("controls.fieldChooser","Field Chooser"),"aria-label":y("controls.fieldChooser","Field Chooser"),"aria-pressed":g,children:s.jsx(M.NiceIcon,{name:"filter",size:16})}),l&&s.jsx(ue,{size:"sm",variant:"outline",icon:s.jsx(M.NiceIcon,{name:"download",size:16}),title:y("controls.export","Export"),items:[{key:"csv",text:"CSV",onClick:J},{key:"xlsx",text:"XLSX",onClick:Q}]})]})]}),g&&s.jsx(ve,{fields:_,onChange:X}),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:w.map(b=>b.caption).join(" / ")||""}),R.map(b=>s.jsx("th",{colSpan:x.length||1,children:b},b))]}),x.length>1&&s.jsxs("tr",{children:[s.jsx("th",{}),R.map(b=>x.map(T=>s.jsx("th",{children:T.caption},`${b}-${T.field}`)))]})]}),s.jsx("tbody",{children:L.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:1+R.length*Math.max(x.length,1),className:"nice-pivotgrid__empty",children:p||y("controls.noData","No data available")})}):L.map(b=>s.jsxs("tr",{children:[s.jsx("td",{className:"nice-pivotgrid__row-header",children:b}),R.map(T=>x.length>0?x.map(C=>s.jsx("td",{className:`nice-pivotgrid__cell ${a?"nice-pivotgrid__cell--clickable":""}`,onClick:a?()=>W(b,T):void 0,children:H(b,T,C)},`${T}-${C.field}`)):s.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},T))]},b))})]})})]})},Pe=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:$e},Symbol.toStringTag,{value:"Module"}));exports.NiceDropDownButton=ue;exports.NicePivotGrid=$e;exports.NicePivotGrid$1=Pe;exports.NicePivotGridFieldChooser=ve;exports.autoDetectColumns=Me;exports.downloadCSV=me;exports.downloadHTML=we;exports.downloadJSON=xe;exports.downloadPDF=be;exports.downloadXLSX=ee;exports.exportToCSV=fe;exports.exportToHTML=ye;exports.exportToJSON=ge;exports.exportToPDF=he;exports.exportToXLSX=pe;exports.niceExport=Ee;
|