@nice2dev/ui 1.3.9 → 1.3.11
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 +88 -0
- package/README.md +16 -18
- package/dist/NiceColorPicker-BLwYNSXJ.cjs +1 -0
- package/dist/NiceColorPicker-DS59tNkP.js +552 -0
- package/dist/NiceDataGrid-CL2_7fS7.cjs +10 -0
- package/dist/NiceDataGrid-CpJrRN_H.js +2269 -0
- package/dist/NiceForm-BQj-K7p7.cjs +1 -0
- package/dist/NiceForm-HQ4h7hX_.js +5023 -0
- package/dist/NiceGantt-BygumlaY.cjs +1 -0
- package/dist/NiceGantt-DTC7OH-v.js +334 -0
- package/dist/NiceHtmlEditor-BtpuaLln.js +901 -0
- package/dist/NiceHtmlEditor-C1OVtLQ6.cjs +10 -0
- package/dist/NiceMention-CVxxCVtQ.js +11668 -0
- package/dist/NiceMention-Te66Oid1.cjs +430 -0
- package/dist/NiceModuleLifecyclePanel-DCrFyUH8.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-Mt80MdET.js +7441 -0
- package/dist/NicePagination-CKsAP38Q.cjs +1 -0
- package/dist/NicePagination-zOed5QxG.js +202 -0
- package/dist/NicePivotGrid-Clue9FM5.js +1184 -0
- package/dist/NicePivotGrid-Cnkr9WkC.cjs +152 -0
- package/dist/NicePropertyGrid.doc-BWNyWrWq.cjs +7 -0
- package/dist/NicePropertyGrid.doc-C_I3F4w8.js +31 -0
- package/dist/NiceSavedQueryPanel-NgG58w6i.js +6226 -0
- package/dist/NiceSavedQueryPanel-lTWY2plm.cjs +587 -0
- package/dist/NiceScheduler-BWwqFKEc.js +1712 -0
- package/dist/NiceScheduler-DqWEJU7g.cjs +5 -0
- package/dist/NiceSelect-BNPXs6FQ.cjs +1 -0
- package/dist/NiceSelect-DEruWHan.js +495 -0
- package/dist/NiceWindow-D3V7A69Q.js +2247 -0
- package/dist/NiceWindow-pgR4c-kQ.cjs +1 -0
- package/dist/core-lazy-Bjdu111n.js +351 -0
- package/dist/core-lazy-Bx_8BOlG.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +47 -6
- package/dist/data.mjs +3 -3
- package/dist/devops-CqhA0rjL.js +9130 -0
- package/dist/devops-cgRBnZVX.cjs +18 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/index.cjs +137 -151
- package/dist/index.css +1 -1
- package/dist/index.d.ts +113 -50
- package/dist/index.mjs +16556 -16423
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +15 -15
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +2 -0
- package/dist/navigation.mjs +3 -3
- package/dist/no-code-BQqK8mvU.cjs +331 -0
- package/dist/no-code-Cppb-xz3.js +8320 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BA3-D5RC.js +663 -0
- package/dist/pickerCommons-KrBqCBDn.cjs +1 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),L=require("@nice2dev/ui-core"),k=require("react"),Ne=require("react-dom"),fe=require("./devops-cgRBnZVX.cjs"),Ce=require("./NiceSelect-BNPXs6FQ.cjs"),je=[],me=({text:e,label:n,icon:o,items:r=je,variant:f="primary",size:p="md",disabled:d,readOnly:m,loading:l,onItemClick:u,splitButton:a,onClick:v,className:_,style:g,id:c,title:t,"data-testid":i,accessMode:w,displayStyle:U,error:C,errorPlacement:$="bottom"})=>{const{t:b}=L.useNiceTranslation(),E=L.useComponentDisplayStyle("button",U),D=L.useComponentDisplayClass("button",U),x=L.useNiceAccessMode(w,c),N=x==="hidden";x==="disabled"&&(d=!0),l&&(d=!0);const j=!d&&(m||x==="readOnly"),A=L.normalizeVariant(f),H=e||n,[O,X]=k.useState(!1),G=k.useRef(null),I=k.useRef(null),W=k.useRef(null),Y=k.useRef(null);L.useMenuButton(a?W:I,Y,{open:O,onOpenChange:y=>{(!y||!j)&&X(y)}});const[K,h]=k.useState(void 0),[S,T]=k.useState(null),[F,P]=k.useState("");k.useLayoutEffect(()=>{h(void 0)},[p,f]),k.useLayoutEffect(()=>{if(I.current){const y=I.current.offsetWidth;h(B=>B==null||y>B?y:B)}},[H,l]);let R=E;if(A!=="primary"){const y={...E};delete y.background,delete y.color,(A==="outline"||A==="ghost")&&(delete y.border,delete y.borderColor,delete y.borderWidth,delete y.borderStyle,delete y.boxShadow),R=y}const M={...R,...K?{minWidth:K}:{}},z=k.useCallback(()=>{const y=G.current;if(!y)return;const B=y.getBoundingClientRect();T({top:B.bottom,left:B.left,width:B.width}),P(fe.scopeThemeClass(y))},[]);k.useLayoutEffect(()=>{if(O)return z(),window.addEventListener("scroll",z,!0),window.addEventListener("resize",z),()=>{window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)}},[O,z]),k.useEffect(()=>{if(!O)return;const y=B=>{const ae=B.target;G.current?.contains(ae)||Y.current?.contains(ae)||X(!1)};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y)}},[O]);const te=s.jsxs("div",{className:`nice-dropdown-btn ${_||""}`,style:{position:"relative",display:"inline-flex",...g},ref:G,"data-testid":i,"aria-busy":l||void 0,children:[a?s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:I,type:"button",className:`nice-btn nice-btn--${A} nice-btn--${p} nice-btn--ds-${D} ${l?"nice-btn--loading":""} ${j?"nice-btn--readonly":""}`,style:M,disabled:d,"aria-readonly":j||void 0,onClick:()=>{j||v?.()},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:H})]}),s.jsx("button",{ref:W,type:"button",className:`nice-btn nice-btn--${A} nice-btn--${p} nice-btn--ds-${D} nice-dropdown-btn__caret ${j?"nice-btn--readonly":""}`,style:R,disabled:d,"aria-readonly":j||void 0,"aria-haspopup":"menu","aria-expanded":O,onClick:()=>{j||X(!O)},"aria-label":b("dropDownButton.toggleDropdown","Toggle dropdown"),children:s.jsx(L.NiceIcon,{name:"chevron-down",size:"xs"})})]}):s.jsxs("button",{ref:I,type:"button",className:`nice-btn nice-btn--${A} nice-btn--${p} nice-btn--ds-${D} ${l?"nice-btn--loading":""} ${j?"nice-btn--readonly":""}`,style:M,disabled:d,"aria-readonly":j||void 0,title:t,"aria-label":!H&&t?t:void 0,"aria-haspopup":"menu","aria-expanded":O,onClick:()=>{j||X(!O)},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:H}),s.jsx("span",{style:{marginLeft:"auto",paddingLeft:4,display:"inline-flex",...l?{visibility:"hidden"}:{}},children:s.jsx(L.NiceIcon,{name:"chevron-down",size:"xs"})})]}),O&&S&&typeof document<"u"&&Ne.createPortal(s.jsx("ul",{ref:Y,className:`nice-dropdown__list nice-dropdown-btn__menu nice-dropdown-btn__menu--${p} ${F}`,"data-theme":F==="nice-dark"?"dark":F==="nice-light"?"light":void 0,role:"menu",style:{position:"fixed",top:S.top,left:S.left,minWidth:S.width,marginTop:0,zIndex:1e3},children:r.map(y=>s.jsxs("li",{role:"menuitem","aria-disabled":y.disabled||void 0,className:`nice-dropdown__option ${y.disabled?"nice-dropdown__option--disabled":""} ${y.danger?"nice-dropdown__option--danger":""}`,onClick:()=>{y.disabled||(y.onClick?.(),u?.(y),X(!1))},children:[y.icon&&s.jsx("span",{className:"nice-dropdown-btn__item-icon",children:y.icon}),y.text]},y.key))}),document.body)]});if(!C)return te;const ie=s.jsx("div",{className:"nice-field__error",role:"alert",children:C});return $==="right"?s.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${p}`,children:[te,ie]}):N?null:s.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${p}`,children:[te,ie]})};function pe(e,n,o={}){const{delimiter:r=",",lineEnding:f=`
|
|
2
|
+
`,quoteChar:p='"',alwaysQuote:d=!1,includeHeaders:m=!0,includeRowNumbers:l=!1,locale:u="en-US",dateTimeFormat:a="yyyy-MM-dd HH:mm:ss"}=o,v=n.filter(t=>t.visible!==!1),_=[],g=t=>{if(d||t.includes(r)||t.includes(p)||t.includes(`
|
|
3
|
+
`)||t.includes("\r")){const w=t.replace(new RegExp(p,"g"),p+p);return`${p}${w}${p}`}return t},c=(t,i,w)=>{if(t==null)return"";if(i.format)return i.format(t,w);switch(i.dataType){case"date":return oe(t,i.dateFormat??a);case"number":return re(t,i.numberFormat,u);case"currency":return se(t,i.currencyCode??"USD",u);case"boolean":return t?"Yes":"No";default:return String(t)}};if(m){const t=[];l&&t.push(g("#"));for(const i of v)t.push(g(i.header));_.push(t.join(r))}return e.forEach((t,i)=>{const w=[];l&&w.push(String(i+1));for(const U of v){const C=t[U.field],$=c(C,U,t);w.push(g($))}_.push(w.join(r))}),_.join(f)}function he(e,n,o={}){const{fileName:r="export",includeTimestamp:f=!1,includeBOM:p=!0,encoding:d="utf-8"}=o,m=pe(e,n,o),l=f?`_${ee()}`:"",u=`${r}${l}.csv`;let a=m;p&&d==="utf-8"&&(a="\uFEFF"+m);const v=new Blob([a],{type:`text/csv;charset=${d}`});Z(v,u)}function Se(){return{sheets:new Map,activeSheet:""}}function Te(e,n){const o={name:n,cells:new Map,columns:[],merges:[]};return e.sheets.set(n,o),e.activeSheet||(e.activeSheet=n),o}function q(e,n,o,r){const f=Q(n,o);e.cells.set(f,r)}function Q(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 De(e){const n=new TextEncoder,o=Array.from(e.sheets.entries()),r=o.map(([l,u],a)=>{const v=[];let _=0,g=0;u.cells.forEach((t,i)=>{const w=i.match(/([A-Z]+)(\d+)/);if(w){const U=Ue(w[1]),C=parseInt(w[2],10);_=Math.max(_,C),g=Math.max(g,U)}});for(let t=1;t<=_;t++){const i=[];for(let w=0;w<=g;w++){const U=Q(t-1,w),C=u.cells.get(U);if(C){const $=C.type==="s"?' t="inlineStr"':C.type==="b"?' t="b"':"";let b;C.type==="s"?b=`<is><t>${le(String(C.value))}</t></is>`:C.type==="b"?b=`<v>${C.value?1:0}</v>`:b=`<v>${C.value}</v>`,i.push(`<c r="${U}"${$}>${b}</c>`)}}i.length>0&&v.push(`<row r="${t}">${i.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="${_>0?`A1:${Q(_-1,g)}`:"A1"}"/>
|
|
6
|
+
<sheetData>${v.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],u)=>`<sheet name="${le(l)}" sheetId="${u+1}" r:id="rId${u+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
|
+
${o.map((l,u)=>`<Relationship Id="rId${u+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${u+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
|
+
${o.map((l,u)=>`<Override PartName="/xl/worksheets/sheet${u+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join(`
|
|
20
|
+
`)}
|
|
21
|
+
</Types>`;return Fe([{path:"[Content_Types].xml",content:n.encode(d)},{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(p)},...r.map((l,u)=>({path:`xl/worksheets/sheet${u+1}.xml`,content:n.encode(l)}))])}function Ue(e){let n=0;for(let o=0;o<e.length;o++)n=n*26+(e.charCodeAt(o)-64);return n-1}function le(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Fe(e){const n=[],o=[];let r=0;for(const a of e){const v=new TextEncoder().encode(a.path),_=new Uint8Array(30+v.length),g=new DataView(_.buffer);g.setUint32(0,67324752,!0),g.setUint16(4,20,!0),g.setUint16(6,0,!0),g.setUint16(8,0,!0),g.setUint16(10,0,!0),g.setUint16(12,0,!0),g.setUint32(14,ce(a.content),!0),g.setUint32(18,a.content.length,!0),g.setUint32(22,a.content.length,!0),g.setUint16(26,v.length,!0),g.setUint16(28,0,!0),_.set(v,30),n.push(_),n.push(a.content);const c=new Uint8Array(46+v.length),t=new DataView(c.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,ce(a.content),!0),t.setUint32(20,a.content.length,!0),t.setUint32(24,a.content.length,!0),t.setUint16(28,v.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),c.set(v,46),o.push(c),r+=_.length+a.content.length}const f=o.reduce((a,v)=>a+v.length,0),p=new Uint8Array(22),d=new DataView(p.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 m=r+f+p.length,l=new Uint8Array(m);let u=0;for(const a of n)l.set(a,u),u+=a.length;for(const a of o)l.set(a,u),u+=a.length;return l.set(p,u),l.buffer}function ce(e){let n=4294967295;const o=Ee();for(let r=0;r<e.length;r++)n=n>>>8^o[(n^e[r])&255];return(n^4294967295)>>>0}let J=null;function Ee(){if(J)return J;J=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;J[e]=n}return J}function be(e,n,o={}){const{sheetName:r="Sheet1",title:f,subtitle:p,includeHeaders:d=!0,includeRowNumbers:m=!1,freezeHeader:l=!0,autoFilter:u=!0,styles:a={},locale:v="en-US",dateTimeFormat:_="yyyy-MM-dd HH:mm:ss"}=o,g=n.filter($=>$.visible!==!1),c=Se(),t=Te(c,r);let i=0;const w=m?1:0;f&&(q(t,i,0,{value:f,type:"s",style:{font:{bold:!0,size:16}}}),i++),p&&(q(t,i,0,{value:p,type:"s",style:{font:{italic:!0,size:12}}}),i++);const U=i;d&&(m&&q(t,i,0,{value:"#",type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:"center"}}}),g.forEach(($,b)=>{q(t,i,b+w,{value:$.header,type:"s",style:{font:{bold:a.headerFontWeight==="bold",color:a.headerColor},fill:{color:a.headerBackground},alignment:{horizontal:$.align??"left"}}})}),i++),e.forEach(($,b)=>{m&&q(t,i,0,{value:b+1,type:"n"}),g.forEach((E,D)=>{const x=$[E.field];let N;if(x==null)N={value:"",type:"s"};else if(E.format)N={value:E.format(x,$),type:"s"};else switch(E.dataType){case"number":case"currency":N={value:Number(x),type:"n",numberFormat:E.numberFormat};break;case"date":{N={value:Me(x),type:"n",numberFormat:E.dateFormat??"yyyy-mm-dd"};break}case"boolean":N={value:x,type:"b"};break;default:N={value:String(x),type:"s"}}a.alternateRows&&b%2===1&&(N.style={...N.style,fill:{color:a.alternateBackground??"var(--nice-text-primary, #f5f5f5)"}}),q(t,i,D+w,N)}),i++});const C=g.map($=>$.width??100);if(m&&C.unshift(40),t.columns=C.map($=>({width:$/7})),l&&d&&(t.freezePane={row:U+1,col:0}),u&&d&&e.length>0){const $=Q(U,0),b=Q(i-1,g.length-1+w);t.autoFilter={start:$,end:b}}return De(c)}function ne(e,n,o={}){const{fileName:r="export",includeTimestamp:f=!1}=o,p=be(e,n,o),d=f?`_${ee()}`:"",m=`${r}${d}.xlsx`,l=new Blob([p],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Z(l,m)}function ge(e,n,o={}){const{title:r,subtitle:f,orientation:p="portrait",pageSize:d="A4",margins:m={top:20,right:20,bottom:20,left:20},header:l,footer:u,logo:a,logoWidth:v=100,logoHeight:_,watermark:g,includeHeaders:c=!0,includeRowNumbers:t=!1,styles:i={},locale:w="en-US",dateTimeFormat:U="yyyy-MM-dd HH:mm:ss"}=o,C=n.filter(D=>D.visible!==!1),$=(D,x,N)=>{if(D==null)return"";if(x.format)return x.format(D,N);switch(x.dataType){case"date":return oe(D,x.dateFormat??U);case"number":return re(D,x.numberFormat,w);case"currency":return se(D,x.currencyCode??"USD",w);case"boolean":return D?"✓":"✗";default:return String(D)}};let b=`
|
|
25
|
+
<!DOCTYPE html>
|
|
26
|
+
<html>
|
|
27
|
+
<head>
|
|
28
|
+
<meta charset="utf-8">
|
|
29
|
+
<title>${V(r??"Export")}</title>
|
|
30
|
+
<style>
|
|
31
|
+
@page {
|
|
32
|
+
size: ${d} ${p};
|
|
33
|
+
margin: ${m.top}mm ${m.right}mm ${m.bottom}mm ${m.left}mm;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
body {
|
|
37
|
+
font-family: ${i.fontFamily??"Arial, sans-serif"};
|
|
38
|
+
font-size: ${i.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: ${v}px;
|
|
62
|
+
${_?`max-height: ${_}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 ${i.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: ${i.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
|
|
85
|
+
color: ${i.headerColor??"var(--nice-text, #333)"};
|
|
86
|
+
font-weight: ${i.headerFontWeight??"bold"};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
tr:nth-child(even) {
|
|
90
|
+
background-color: ${i.alternateRows!==!1?i.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(g&&(b+=`<div class="watermark">${V(g)}</div>`),b+='<div class="header">',a&&(b+=`<img src="${a}" class="logo" alt="Logo">`),r&&(b+=`<h1 class="title">${V(r)}</h1>`),f&&(b+=`<p class="subtitle">${V(f)}</p>`),b+="</div>",b+="<table>",c){b+="<thead><tr>",t&&(b+='<th class="text-center">#</th>');for(const D of C){const x=D.align??"left";b+=`<th class="text-${x}" style="width: ${D.width??"auto"}px">${V(D.header)}</th>`}b+="</tr></thead>"}b+="<tbody>",e.forEach((D,x)=>{b+="<tr>",t&&(b+=`<td class="text-center">${x+1}</td>`);for(const N of C){const j=$(D[N.field],N,D),A=N.align??"left";b+=`<td class="text-${A}">${V(j)}</td>`}b+="</tr>"}),b+="</tbody>",b+="</table>",b+="</body></html>";const E=window.open("","_blank");E&&(E.document.write(b),E.document.close(),E.onload=()=>{E.print()})}function xe(e,n,o={}){ge(e,n,o)}function ye(e,n={}){const{pretty:o=!0,indent:r=2,fields:f,transform:p}=n;let d=e;return p&&(d=e.map((m,l)=>p(m,l))),f?.length&&(d=d.map(m=>{const l={};for(const u of f)u in m&&(l[u]=m[u]);return l})),JSON.stringify(d,null,o?r:void 0)}function we(e,n={}){const{fileName:o="export",includeTimestamp:r=!1}=n,f=ye(e,n),p=r?`_${ee()}`:"",d=`${o}${p}.json`,m=new Blob([f],{type:"application/json;charset=utf-8"});Z(m,d)}function ve(e,n,o={}){const{title:r,includeHeaders:f=!0,includeRowNumbers:p=!1,inlineStyles:d=!0,tableClass:m="nice-export-table",standalone:l=!0,styles:u={},locale:a="en-US",dateTimeFormat:v="yyyy-MM-dd HH:mm:ss"}=o,_=n.filter(t=>t.visible!==!1),g=(t,i,w)=>{if(t==null)return"";if(i.format)return i.format(t,w);switch(i.dataType){case"date":return oe(t,i.dateFormat??v);case"number":return re(t,i.numberFormat,a);case"currency":return se(t,i.currencyCode??"USD",a);case"boolean":return t?"Yes":"No";default:return String(t)}};let c="";if(l&&(c+=`<!DOCTYPE html>
|
|
124
|
+
<html>
|
|
125
|
+
<head>
|
|
126
|
+
<meta charset="utf-8">
|
|
127
|
+
<title>${V(r??"Export")}</title>
|
|
128
|
+
<style>
|
|
129
|
+
.${m} {
|
|
130
|
+
border-collapse: collapse;
|
|
131
|
+
width: 100%;
|
|
132
|
+
font-family: ${u.fontFamily??"Arial, sans-serif"};
|
|
133
|
+
font-size: ${u.fontSize??12}px;
|
|
134
|
+
}
|
|
135
|
+
.${m} th, .${m} td {
|
|
136
|
+
border: 1px solid ${u.borderColor??"var(--nice-border, #ddd)"};
|
|
137
|
+
padding: var(--nice-space-2, 8px);
|
|
138
|
+
text-align: left;
|
|
139
|
+
}
|
|
140
|
+
.${m} th {
|
|
141
|
+
background-color: ${u.headerBackground??"var(--nice-bg-secondary, #f5f5f5)"};
|
|
142
|
+
color: ${u.headerColor??"var(--nice-text, #333)"};
|
|
143
|
+
font-weight: ${u.headerFontWeight??"bold"};
|
|
144
|
+
}
|
|
145
|
+
.${m} tr:nth-child(even) {
|
|
146
|
+
background-color: ${u.alternateRows!==!1?u.alternateBackground??"var(--nice-bg-secondary, #fafafa)":"transparent"};
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
149
|
+
</head>
|
|
150
|
+
<body>
|
|
151
|
+
`,r&&(c+=`<h1>${V(r)}</h1>`)),c+=`<table class="${m}"${!l&&d?' style="border-collapse:collapse;width:100%"':""}>`,f){c+="<thead><tr>",p&&(c+="<th>#</th>");for(const t of _)c+=`<th>${V(t.header)}</th>`;c+="</tr></thead>"}return c+="<tbody>",e.forEach((t,i)=>{c+="<tr>",p&&(c+=`<td>${i+1}</td>`);for(const w of _){const U=g(t[w.field],w,t);c+=`<td>${V(U)}</td>`}c+="</tr>"}),c+="</tbody></table>",l&&(c+="</body></html>"),c}function $e(e,n,o={}){const{fileName:r="export",includeTimestamp:f=!1}=o,p=ve(e,n,{...o,standalone:!0}),d=f?`_${ee()}`:"",m=`${r}${d}.html`,l=new Blob([p],{type:"text/html;charset=utf-8"});Z(l,m)}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 ee(){return new Date().toISOString().slice(0,19).replace(/[T:]/g,"-")}function oe(e,n,o){const r=e instanceof Date?e:new Date(e);if(isNaN(r.getTime()))return String(e);const f=p=>String(p).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 re(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 se(e,n,o){return e.toLocaleString(o,{style:"currency",currency:n})}function Me(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 V(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Le(e){const{data:n,columns:o,format:r,options:f={}}=e;switch(r){case"csv":he(n,o,f);break;case"xlsx":ne(n,o,f);break;case"pdf":xe(n,o,f);break;case"json":we(n,f);break;case"html":$e(n,o,f);break;default:throw new Error(`Unsupported export format: ${r}`)}}function Re(e,n={}){const{maxSample:o=100,exclude:r=[]}=n;if(e.length===0)return[];const f=e.slice(0,o),p=e[0],d=[];for(const m of Object.keys(p)){if(r.includes(m))continue;let l="string";for(const u of f){const a=u[m];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}}}d.push({field:m,header:Oe(m),dataType:l})}return d}function Oe(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 Ae=[],He=[{key:void 0,label:"Available Fields"},{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],ze=[{value:"",label:"Available"},{value:"row",label:"Rows"},{value:"column",label:"Columns"},{value:"data",label:"Values"},{value:"filter",label:"Filters"}],ke=({fields:e=Ae,onChange:n,showAreaSelect:o=!1,className:r,style:f,"data-testid":p})=>{const{t:d}=L.useNiceTranslation(),[m,l]=k.useState(null),[u,a]=k.useState("none"),v=(c,t)=>{n(e.map(i=>i.field===c?{...i,area:t}:i))},_=c=>t=>{t.preventDefault();const i=t.dataTransfer.getData("text/plain")||m;i&&v(i,c),l(null),a("none")},g=c=>s.jsxs("li",{className:"nice-field-chooser__item",draggable:!0,onDragStart:t=>{t.dataTransfer.setData("text/plain",c.field),t.dataTransfer.effectAllowed="move",l(c.field)},onDragEnd:()=>{l(null),a("none")},children:[s.jsx("span",{className:"nice-field-chooser__grip","aria-hidden":"true",children:s.jsx(L.NiceIcon,{name:"menu",size:14})}),s.jsxs("span",{className:"nice-field-chooser__label",children:[c.caption,c.dataType&&s.jsxs("small",{className:"nice-field-chooser__type",children:[" (",c.dataType,")"]})]}),o&&s.jsx(Ce.NiceSelect,{size:"sm",value:c.area??"",options:ze,onChange:t=>v(c.field,t||void 0),"aria-label":d("pivotGridFieldChooser.assignToArea","Assign {caption} to area").replace("{caption}",String(c.caption))}),c.area&&s.jsx("button",{type:"button",className:"nice-field-chooser__remove",onClick:()=>v(c.field,void 0),"aria-label":d("pivotGridFieldChooser.remove","Remove {caption}").replace("{caption}",String(c.caption)),children:s.jsx(L.NiceIcon,{name:"close",size:14})})]},c.field);return s.jsx("div",{className:`nice-field-chooser ${r||""}`,style:f,"data-testid":p,children:s.jsx("div",{className:"nice-field-chooser__panel",children:He.map(c=>{const t=e.filter(i=>c.key?i.area===c.key:!i.area);return s.jsxs("div",{className:`nice-field-chooser__section${u===c.key&&m?" nice-field-chooser__section--over":""}`,onDragOver:i=>{i.preventDefault(),a(c.key)},onDragLeave:()=>a("none"),onDrop:_(c.key),children:[s.jsx("h4",{children:c.label}),s.jsxs("ul",{children:[t.map(g),t.length===0&&s.jsx("li",{className:"nice-field-chooser__empty","aria-hidden":"true",children:d("pivotGridFieldChooser.dropFieldsHere","Drop fields here")})]})]},c.label)})})})},Pe=[],de="__row";function Ve(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 ue(e,n){return[...new Set(e.map(o=>String(o[n]??"")))].sort()}const _e=({data:e=Pe,fields:n,defaultFields:o,onFieldsChange:r,showFieldChooser:f,loading:p,emptyText:d,headerText:m,exportCsv:l,exportFilename:u="pivot-export",onDrillThrough:a,className:v,style:_,accessMode:g,id:c,"data-testid":t})=>{const w=L.useNiceAccessMode(g,c)==="hidden",{t:U}=L.useNiceTranslation(),C=n!==void 0&&r!==void 0,[$,b]=L.useControllableState({value:C?n:void 0,defaultValue:C?o:o??n,fallbackValue:[],onChange:r,componentName:"NicePivotGrid"});fe.useIgnoredPropChangeWarning("NicePivotGrid","fields","onFieldsChange",n,C);const[E,D]=k.useState(!1),x=k.useMemo(()=>$.filter(h=>h.area==="row"),[$]),N=k.useMemo(()=>$.filter(h=>h.area==="column"),[$]),j=k.useMemo(()=>$.filter(h=>h.area==="data"),[$]),A=k.useMemo(()=>x.length===0?["Total"]:ue(e,x[0].field),[e,x]),H=k.useMemo(()=>N.length===0?["Total"]:ue(e,N[0].field),[e,N]),O=k.useCallback((h,S,T)=>{let F=e;x.length>0&&(F=F.filter(M=>String(M[x[0].field])===h)),N.length>0&&(F=F.filter(M=>String(M[N[0].field])===S));const P=F.map(M=>Number(M[T.field])||0),R=Ve(P,T.summaryType||"sum");return T.format?T.format(R):R},[e,x,N]),X=k.useCallback(h=>{b(h)},[b]),G=k.useCallback((h,S)=>{let T=e;return x.length>0&&(T=T.filter(F=>String(F[x[0].field])===h)),N.length>0&&(T=T.filter(F=>String(F[N[0].field])===S)),T},[e,x,N]),I=k.useCallback((h,S)=>{a&&a(h,S,G(h,S))},[a,G]),W=k.useCallback(()=>{const h=[{field:de,header:x.map(T=>T.caption).join(" / ")||""}];H.forEach((T,F)=>{j.length>0?j.forEach((P,R)=>h.push({field:`c${F}d${R}`,header:`${T} - ${P.caption}`})):h.push({field:`c${F}`,header:T})});const S=A.map(T=>{const F={[de]:T};return H.forEach((P,R)=>{j.length>0?j.forEach((M,z)=>{F[`c${R}d${z}`]=O(T,P,M)}):F[`c${R}`]="—"}),F});return{columns:h,rows:S}},[H,A,j,x,O]),Y=k.useCallback(()=>{const{columns:h,rows:S}=W(),T=[h.map(M=>M.header),...S.map(M=>h.map(z=>String(M[z.field]??"")))].map(M=>M.map(z=>`"${String(z).replace(/"/g,'""')}"`).join(",")).join(`
|
|
152
|
+
`),F=new Blob(["\uFEFF"+T],{type:"text/csv;charset=utf-8;"}),P=URL.createObjectURL(F),R=document.createElement("a");R.href=P,R.download=`${u}.csv`,R.click(),URL.revokeObjectURL(P)},[W,u]),K=k.useCallback(()=>{const{columns:h,rows:S}=W();ne(S,h,{fileName:u,sheetName:"Pivot"})},[W,u]);return w?null:s.jsxs("div",{className:`nice-pivotgrid ${v||""}`,style:_,"data-testid":t,children:[(f||l||m)&&s.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[m&&s.jsx("span",{className:"nice-pivotgrid__header-text",children:m}),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:()=>D(!E),title:U("controls.fieldChooser","Field Chooser"),"aria-label":U("controls.fieldChooser","Field Chooser"),"aria-pressed":E,children:s.jsx(L.NiceIcon,{name:"filter",size:16})}),l&&s.jsx(me,{size:"sm",variant:"outline",icon:s.jsx(L.NiceIcon,{name:"download",size:16}),title:U("controls.export","Export"),items:[{key:"csv",text:"CSV",onClick:Y},{key:"xlsx",text:"XLSX",onClick:K}]})]})]}),E&&s.jsx(ke,{fields:$,onChange:X}),p?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:x.map(h=>h.caption).join(" / ")||""}),H.map(h=>s.jsx("th",{colSpan:j.length||1,children:h},h))]}),j.length>1&&s.jsxs("tr",{children:[s.jsx("th",{}),H.map(h=>j.map(S=>s.jsx("th",{children:S.caption},`${h}-${S.field}`)))]})]}),s.jsx("tbody",{children:A.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:1+H.length*Math.max(j.length,1),className:"nice-pivotgrid__empty",children:d||U("controls.noData","No data available")})}):A.map(h=>s.jsxs("tr",{children:[s.jsx("td",{className:"nice-pivotgrid__row-header",children:h}),H.map(S=>j.length>0?j.map(T=>s.jsx("td",{className:`nice-pivotgrid__cell ${a?"nice-pivotgrid__cell--clickable":""}`,onClick:a?()=>I(h,S):void 0,children:O(h,S,T)},`${S}-${T.field}`)):s.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},S))]},h))})]})})]})},Be=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:_e},Symbol.toStringTag,{value:"Module"}));exports.NiceDropDownButton=me;exports.NicePivotGrid=_e;exports.NicePivotGrid$1=Be;exports.NicePivotGridFieldChooser=ke;exports.autoDetectColumns=Re;exports.downloadBlob=Z;exports.downloadCSV=he;exports.downloadHTML=$e;exports.downloadJSON=we;exports.downloadPDF=xe;exports.downloadXLSX=ne;exports.exportToCSV=pe;exports.exportToHTML=ve;exports.exportToJSON=ye;exports.exportToPDF=ge;exports.exportToXLSX=be;exports.niceExport=Le;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",r="NicePropertyGrid",t="Property grid for editing object properties in a structured layout.",o="data",a="1.0.0",s="planned",i=[{name:"properties",type:"Property[]",required:!0,description:"Property definitions"},{name:"values",type:"Record<string, any>",required:!0,description:"Property values"},{name:"onChange",type:"(key: string, value: any) => void",description:"Change callback"},{name:"categories",type:"string[]",description:"Property categories"},{name:"collapsible",type:"boolean",default:"true",description:"Collapsible categories"},{name:"searchable",type:"boolean",default:"true",description:"Enable search"},{name:"readOnly",type:"boolean",default:"false",description:"Read-only mode"}],n=[{title:"Property Grid",description:"Edit properties",code:`<NicePropertyGrid
|
|
2
|
+
properties={propertyDefs}
|
|
3
|
+
values={objectValues}
|
|
4
|
+
onChange={(key, value) => updateProperty(key, value)}
|
|
5
|
+
categories={['General', 'Appearance', 'Behavior']}
|
|
6
|
+
searchable
|
|
7
|
+
/>`}],c={keyboard:["Tab through properties"],aria:["Property grid","Category regions"]},p=["NiceForm","NiceSchemaForm"],d={$schema:e,name:r,description:t,category:o,since:a,status:s,props:i,examples:n,accessibility:c,seeAlso:p};exports.$schema=e;exports.accessibility=c;exports.category=o;exports.default=d;exports.description=t;exports.examples=n;exports.name=r;exports.props=i;exports.seeAlso=p;exports.since=a;exports.status=s;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const e = "https://nice2dev.com/schemas/component-doc-v1.json", r = "NicePropertyGrid", t = "Property grid for editing object properties in a structured layout.", o = "data", a = "1.0.0", n = "planned", i = [{ name: "properties", type: "Property[]", required: !0, description: "Property definitions" }, { name: "values", type: "Record<string, any>", required: !0, description: "Property values" }, { name: "onChange", type: "(key: string, value: any) => void", description: "Change callback" }, { name: "categories", type: "string[]", description: "Property categories" }, { name: "collapsible", type: "boolean", default: "true", description: "Collapsible categories" }, { name: "searchable", type: "boolean", default: "true", description: "Enable search" }, { name: "readOnly", type: "boolean", default: "false", description: "Read-only mode" }], s = [{ title: "Property Grid", description: "Edit properties", code: `<NicePropertyGrid
|
|
2
|
+
properties={propertyDefs}
|
|
3
|
+
values={objectValues}
|
|
4
|
+
onChange={(key, value) => updateProperty(key, value)}
|
|
5
|
+
categories={['General', 'Appearance', 'Behavior']}
|
|
6
|
+
searchable
|
|
7
|
+
/>` }], c = { keyboard: ["Tab through properties"], aria: ["Property grid", "Category regions"] }, p = ["NiceForm", "NiceSchemaForm"], d = {
|
|
8
|
+
$schema: e,
|
|
9
|
+
name: r,
|
|
10
|
+
description: t,
|
|
11
|
+
category: o,
|
|
12
|
+
since: a,
|
|
13
|
+
status: n,
|
|
14
|
+
props: i,
|
|
15
|
+
examples: s,
|
|
16
|
+
accessibility: c,
|
|
17
|
+
seeAlso: p
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
e as $schema,
|
|
21
|
+
c as accessibility,
|
|
22
|
+
o as category,
|
|
23
|
+
d as default,
|
|
24
|
+
t as description,
|
|
25
|
+
s as examples,
|
|
26
|
+
r as name,
|
|
27
|
+
i as props,
|
|
28
|
+
p as seeAlso,
|
|
29
|
+
a as since,
|
|
30
|
+
n as status
|
|
31
|
+
};
|