@nice2dev/ui 1.1.10 → 1.2.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 +76 -0
- package/README.md +12 -20
- package/dist/NiceButton-5tWvfXKl.cjs +1 -0
- package/dist/NiceButton-DHSgQT1_.js +112 -0
- package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
- package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
- package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
- package/dist/NiceColorPicker-DK30kJgy.js +486 -0
- package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
- package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
- package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
- package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
- package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
- package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
- package/dist/NiceForm-BCEXovJR.cjs +1 -0
- package/dist/NiceForm-D7oyWHXg.js +4820 -0
- package/dist/NiceForm-DUhxXArr.js +4817 -0
- package/dist/NiceForm-uCeVmTrD.cjs +1 -0
- package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
- package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
- package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
- package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
- package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
- package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
- package/dist/NiceLoginForm.css +1 -0
- package/dist/NiceMention-CA7CL5BI.js +11263 -0
- package/dist/NiceMention-CHcKRl-L.cjs +430 -0
- package/dist/NiceMention-DJD0BLcp.js +11269 -0
- package/dist/NiceMention-DcaUEMSg.cjs +430 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-C4p8a82e.cjs +1 -0
- package/dist/NiceModal-TNlkaL_i.js +85 -0
- package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
- package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
- package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
- package/dist/NicePagination-8XsBbMNx.js +165 -0
- package/dist/NicePagination-CkOoXf0f.js +165 -0
- package/dist/NicePagination-D7lek1G7.cjs +1 -0
- package/dist/NicePagination-OjTEfZJE.cjs +1 -0
- package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
- package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
- package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
- package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
- package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
- package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
- package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
- package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
- package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
- package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
- package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
- package/dist/NiceSelect-DZB1Rs9x.js +435 -0
- package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
- package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
- package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
- package/dist/NiceWindow-BEov3s9F.js +2094 -0
- package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-C047IMVn.cjs +768 -0
- package/dist/charts-CCXSb3xk.js +4752 -0
- package/dist/charts-CqETcUhH.js +4752 -0
- package/dist/charts-DouiiHOT.cjs +768 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-BL-KmGYC.js +795 -0
- package/dist/core-Chg-oYCr.cjs +1 -0
- package/dist/core-CxBnKAhs.cjs +1 -0
- package/dist/core-D_LRh59n.js +795 -0
- package/dist/data-branching-Km4lc8P_.cjs +1 -0
- package/dist/data-branching-YQtJJEtn.js +6273 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +0 -51
- package/dist/data.mjs +3 -3
- package/dist/devops-D5yIDM3e.js +8312 -0
- package/dist/devops-rVpB0ZAX.cjs +17 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +6 -25
- package/dist/editors.mjs +55 -54
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.mjs +2 -2
- package/dist/index.cjs +284 -284
- package/dist/index.css +1 -1
- package/dist/index.d.ts +194 -208
- package/dist/index.mjs +20312 -19511
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +29 -29
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.mjs +3 -3
- package/dist/no-code-6WyYb3hL.cjs +331 -0
- package/dist/no-code-BH5oVFC6.js +8186 -0
- package/dist/no-code-CnHG5_Vn.js +8186 -0
- package/dist/no-code-DMKlg1Zl.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.css +1 -1
- package/dist/no-code.d.ts +25 -18
- package/dist/no-code.mjs +3 -3
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +24 -24
- package/dist/overlays.mjs +24 -490
- package/dist/pickerCommons-0vyK1Knv.js +547 -0
- package/dist/pickerCommons-BFbItm8o.cjs +1 -0
- package/dist/pickerCommons-BHirHJyn.js +548 -0
- package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +10 -7
- package/package.json +4 -6
- package/css/legacy-bg-text-aliases.css +0 -87
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),R=require("@nice2dev/ui-core"),j=require("react"),$e=require("react-dom"),ce=require("./NiceSelect-tMz9QQUs.cjs"),ke=require("./devops-rVpB0ZAX.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:N="bottom"})=>{const C=R.useComponentDisplayStyle("button",w),g=R.useComponentDisplayClass("button",w),F=R.useNiceAccessMode(c,b),$=F==="hidden";F==="disabled"&&(d=!0),i&&(d=!0);const x=!d&&(p||F==="readOnly"),v=R.normalizeVariant(f),O=e||t,[L,V]=j.useState(!1),q=j.useRef(null),X=j.useRef(null),Y=j.useRef(null),[B,Q]=j.useState(void 0),[I,y]=j.useState(null),[T,S]=j.useState("");j.useLayoutEffect(()=>{Q(void 0)},[m,f]),j.useLayoutEffect(()=>{if(X.current){const k=X.current.offsetWidth;Q(z=>z==null||k>z?k:z)}},[O,i]);let D=C;if(v!=="primary"){const k={...C};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,...B?{minWidth:B}:{}},E=j.useCallback(()=>{const k=q.current;if(!k)return;const z=k.getBoundingClientRect();y({top:z.bottom,left:z.left,width:z.width}),S(ce.scopeThemeClass(k))},[]);j.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]),j.useEffect(()=>{if(!L)return;const k=z=>{const re=z.target;q.current?.contains(re)||Y.current?.contains(re)||V(!1)};return document.addEventListener("mousedown",k),document.addEventListener("touchstart",k),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("touchstart",k)}},[L]);const M=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:X,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(R.NiceIcon,{name:"chevron-down",size:"xs"})})]}):s.jsxs("button",{ref:X,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(R.NiceIcon,{name:"chevron-down",size:"xs"})})]}),L&&I&&typeof document<"u"&&$e.createPortal(s.jsx("ul",{ref:Y,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:I.top,left:I.left,minWidth:I.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 M;const P=s.jsx("div",{className:"nice-field__error",role:"alert",children:U});return N==="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:[M,P]}):$?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:[M,P]})};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 N=o[U.field],C=b(N,U,o);w.push(h(C))}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 _e(){return{sheets:new Map,activeSheet:""}}function Ne(e,t){const n={name:t,cells:new Map,columns:[],merges:[]};return e.sheets.set(t,n),e.activeSheet||(e.activeSheet=t),n}function W(e,t,n,r){const f=J(t,n);e.cells.set(f,r)}function J(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=Ce(w[1]),N=parseInt(w[2],10);u=Math.max(u,N),h=Math.max(h,U)}});for(let o=1;o<=u;o++){const c=[];for(let w=0;w<=h;w++){const U=J(o-1,w),N=l.cells.get(U);if(N){const C=N.type==="s"?' t="inlineStr"':N.type==="b"?' t="b"':"";let g;N.type==="s"?g=`<is><t>${se(String(N.value))}</t></is>`:N.type==="b"?g=`<v>${N.value?1:0}</v>`:g=`<v>${N.value}</v>`,c.push(`<c r="${U}"${C}>${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:${J(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 Ce(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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}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=Te();for(let r=0;r<e.length;r++)t=t>>>8^n[(t^e[r])&255];return(t^4294967295)>>>0}let G=null;function Te(){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(C=>C.visible!==!1),b=_e(),o=Ne(b,r);let c=0;const w=p?1:0;f&&(W(o,c,0,{value:f,type:"s",style:{font:{bold:!0,size:16}}}),c++),m&&(W(o,c,0,{value:m,type:"s",style:{font:{italic:!0,size:12}}}),c++);const U=c;d&&(p&&W(o,c,0,{value:"#",type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:"center"}}}),h.forEach((C,g)=>{W(o,c,g+w,{value:C.header,type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:C.align??"left"}}})}),c++),e.forEach((C,g)=>{p&&W(o,c,0,{value:g+1,type:"n"}),h.forEach((F,$)=>{const x=C[F.field];let v;if(x==null)v={value:"",type:"s"};else if(F.format)v={value:F.format(x,C),type:"s"};else switch(F.dataType){case"number":case"currency":v={value:Number(x),type:"n",numberFormat:F.numberFormat};break;case"date":{v={value:De(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-text-primary, #f5f5f5)"}}),W(o,c,$+w,v)}),c++});const N=h.map(C=>C.width??100);if(p&&N.unshift(40),o.columns=N.map(C=>({width:C/7})),i&&d&&(o.freezePane={row:U+1,col:0}),l&&d&&e.length>0){const C=J(U,0),g=J(c-1,h.length-1+w);o.autoFilter={start:C,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,N=t.filter($=>$.visible!==!1),C=($,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>${A(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">${A(h)}</div>`),g+='<div class="header">',a&&(g+=`<img src="${a}" class="logo" alt="Logo">`),r&&(g+=`<h1 class="title">${A(r)}</h1>`),f&&(g+=`<p class="subtitle">${A(f)}</p>`),g+="</div>",g+="<table>",b){g+="<thead><tr>",o&&(g+='<th class="text-center">#</th>');for(const $ of N){const x=$.align??"left";g+=`<th class="text-${x}" style="width: ${$.width??"auto"}px">${A($.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 N){const O=C($[v.field],v,$),L=v.align??"left";g+=`<td class="text-${L}">${A(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>${A(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>${A(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>${A(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>${A(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 De(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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ue(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 Fe(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:Ee(p),dataType:i})}return d}function Ee(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 Le=[{key:void 0,label:"Available Fields"},{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],Me=[{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]=j.useState(null),[p,i]=j.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(R.NiceIcon,{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:Me,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(R.NiceIcon,{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:Le.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=R.useNiceAccessMode(h,b)==="hidden",{t:w}=R.useNiceTranslation(),U=t!==void 0&&r!==void 0,[N,C]=R.useControllableState({value:U?t:void 0,defaultValue:U?n:n??t,fallbackValue:[],onChange:r,componentName:"NicePivotGrid"});ke.useIgnoredPropChangeWarning("NicePivotGrid","fields","onFieldsChange",t,U);const[g,F]=j.useState(!1),$=j.useMemo(()=>N.filter(y=>y.area==="row"),[N]),x=j.useMemo(()=>N.filter(y=>y.area==="column"),[N]),v=j.useMemo(()=>N.filter(y=>y.area==="data"),[N]),O=j.useMemo(()=>$.length===0?["Total"]:le(e,$[0].field),[e,$]),L=j.useMemo(()=>x.length===0?["Total"]:le(e,x[0].field),[e,x]),V=j.useCallback((y,T,S)=>{let D=e;$.length>0&&(D=D.filter(M=>String(M[$[0].field])===y)),x.length>0&&(D=D.filter(M=>String(M[x[0].field])===T));const H=D.map(M=>Number(M[S.field])||0),E=Re(H,S.summaryType||"sum");return S.format?S.format(E):E},[e,$,x]),q=j.useCallback(y=>{C(y)},[C]),X=j.useCallback((y,T)=>{let S=e;return $.length>0&&(S=S.filter(D=>String(D[$[0].field])===y)),x.length>0&&(S=S.filter(D=>String(D[x[0].field])===T)),S},[e,$,x]),Y=j.useCallback((y,T)=>{a&&a(y,T,X(y,T))},[a,X]),B=j.useCallback(()=>{const y=[{field:ae,header:$.map(S=>S.caption).join(" / ")||""}];L.forEach((S,D)=>{v.length>0?v.forEach((H,E)=>y.push({field:`c${D}d${E}`,header:`${S} - ${H.caption}`})):y.push({field:`c${D}`,header:S})});const T=O.map(S=>{const D={[ae]:S};return L.forEach((H,E)=>{v.length>0?v.forEach((M,P)=>{D[`c${E}d${P}`]=V(S,H,M)}):D[`c${E}`]="—"}),D});return{columns:y,rows:T}},[L,O,v,$,V]),Q=j.useCallback(()=>{const{columns:y,rows:T}=B(),S=[y.map(M=>M.header),...T.map(M=>y.map(P=>String(M[P.field]??"")))].map(M=>M.map(P=>`"${String(P).replace(/"/g,'""')}"`).join(",")).join(`
|
|
152
|
+
`),D=new Blob(["\uFEFF"+S],{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)},[B,l]),I=j.useCallback(()=>{const{columns:y,rows:T}=B();ee(T,y,{fileName:l,sheetName:"Pivot"})},[B,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(R.NiceIcon,{name:"filter",size:16})}),i&&s.jsx(de,{size:"sm",variant:"outline",icon:s.jsx(R.NiceIcon,{name:"download",size:16}),title:w("controls.export","Export"),items:[{key:"csv",text:"CSV",onClick:Q},{key:"xlsx",text:"XLSX",onClick:I}]})]})]}),g&&s.jsx(we,{fields:N,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(S=>s.jsx("td",{className:`nice-pivotgrid__cell ${a?"nice-pivotgrid__cell--clickable":""}`,onClick:a?()=>Y(y,T):void 0,children:V(y,T,S)},`${T}-${S.field}`)):s.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},T))]},y))})]})})]})},Oe=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:ve},Symbol.toStringTag,{value:"Module"}));exports.NiceDropDownButton=de;exports.NicePivotGrid=ve;exports.NicePivotGrid$1=Oe;exports.NicePivotGridFieldChooser=we;exports.autoDetectColumns=Fe;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=Ue;
|