@nice2dev/ui 1.4.23 → 1.4.24
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 +57 -0
- package/dist/{NicePivotGrid-B5Fgi5E_.cjs → NicePivotGrid-D53CQ2cY.cjs} +1 -1
- package/dist/charts/NiceAdvancedCharts.mjs +586 -773
- package/dist/charts/NiceChartRangeSelector.mjs +159 -0
- package/dist/charts/NiceHeatMap.mjs +140 -70
- package/dist/charts/NiceOrganizationChart.mjs +183 -90
- package/dist/charts/NiceSankey.mjs +166 -93
- package/dist/charts/NiceStockChart.mjs +258 -157
- package/dist/charts-CSgOgfES.cjs +867 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +126 -102
- package/dist/charts.mjs +22 -24
- package/dist/core/lazy.mjs +50 -63
- package/dist/core-lazy-sO0xvg64.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/demo/docs/docPreviews.mjs +450 -466
- package/dist/demo/docs/docRegistry.mjs +5 -35
- package/dist/index.cjs +60 -67
- package/dist/index.d.ts +121 -172
- package/dist/index.mjs +831 -836
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +41 -23
- package/dist/lazy.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/tools/NiceShowcase.mjs +1 -2
- package/package.json +4 -4
- package/dist/charts/NiceRangeSelector.mjs +0 -135
- package/dist/charts/NiceTreeMap.mjs +0 -100
- package/dist/charts/NiceVectorMap.mjs +0 -59
- package/dist/charts-C9B548D2.cjs +0 -924
- package/dist/core-lazy-B54FdghB.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# [1.0.27] — 2026-06-07
|
|
2
2
|
|
|
3
|
+
## 1.4.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 44c39e4: Charts B (round 44, 1.4.24): merges and rebuilds.
|
|
8
|
+
|
|
9
|
+
**Breaking:** removals and renames in a patch release. The user chose this for round 44; see
|
|
10
|
+
`documentation/omniverk/OMNIVERK_UPGRADE_1.4.24.md`.
|
|
11
|
+
|
|
12
|
+
| Removed | Use instead |
|
|
13
|
+
| ------------------------------------------------------------------------ | ------------------------------------------------------- |
|
|
14
|
+
| `NiceSankeyChart`, `SankeyNode`, `SankeyLink` | `NiceSankey`, `NiceSankeyNode`, `NiceSankeyLink` |
|
|
15
|
+
| `NiceTreeMapChart`, `NiceTreeMapChartProps`, `TreeMapNode` | `NiceTreeMap`, `NiceTreeMapProps`, `NiceTreeMapNode` |
|
|
16
|
+
| The old `NiceTreeMap` (nodes with `key` / `label`) | Nodes with `id` / `name` |
|
|
17
|
+
| `NiceVectorMap`, `NiceVectorMapProps`, `NiceMapRegion`, lazy `VectorMap` | `NiceMapChart`, `MapRegion` |
|
|
18
|
+
| `NiceRangeSelector`, `NiceRangeSelectorProps` | `NiceChartRangeSelector`, `NiceChartRangeSelectorProps` |
|
|
19
|
+
- **NiceSankey** (merged with NiceSankeyChart):
|
|
20
|
+
- a column per depth, for any number of columns, with sinks on the right;
|
|
21
|
+
- square node ends and outlined labels;
|
|
22
|
+
- tooltips, `onNodeClick`, `onLinkClick`, `showValues`, gradient flows;
|
|
23
|
+
- it scales down in a narrow container.
|
|
24
|
+
- **NiceTreeMap** (NiceTreeMapChart under the short name):
|
|
25
|
+
- the drill path holds node ids and resets when `data` changes;
|
|
26
|
+
- siblings take distinct colours;
|
|
27
|
+
- square tiles, larger text with a halo.
|
|
28
|
+
- **NiceMapChart** (NiceVectorMap merged in):
|
|
29
|
+
- new `selectedRegionId` and `bounds` (geographic projection of bubbles);
|
|
30
|
+
- `type="heat"` works;
|
|
31
|
+
- no NaN when every value is the same;
|
|
32
|
+
- pans in viewBox units;
|
|
33
|
+
- `mapSvg` is drawn as an image, not injected as HTML;
|
|
34
|
+
- a chart without regions no longer draws placeholder polygons.
|
|
35
|
+
- **NiceChartRangeSelector:** the window drags as a whole, the handles are keyboard sliders, and it
|
|
36
|
+
follows its container's width (`responsive`).
|
|
37
|
+
- **NiceHeatMap**, rebuilt:
|
|
38
|
+
- the browser mixes the colours, so theme variables work (they used to parse to NaN);
|
|
39
|
+
- two or three colour stops;
|
|
40
|
+
- **changed default:** values are hidden unless `showValues` is set;
|
|
41
|
+
- legend, tooltip and axis titles;
|
|
42
|
+
- `min`, `max`, `cellGap`, `cellRadius`, `emptyColor`, `formatValue`;
|
|
43
|
+
- a grid that fills its container.
|
|
44
|
+
- **NiceStockChart:**
|
|
45
|
+
- one volume band (it was reserved twice);
|
|
46
|
+
- wicks no longer cross hollow bodies;
|
|
47
|
+
- doji drawn as a bar;
|
|
48
|
+
- crosshair with the day's O/H/L/C/V;
|
|
49
|
+
- new `responsive` and `formatPrice`.
|
|
50
|
+
- **NiceOrganizationChart:**
|
|
51
|
+
- the root no longer jumps when a branch collapses or expands;
|
|
52
|
+
- drag with the hand (`pannable`) and zoom with Ctrl and the wheel (`wheelZoom`);
|
|
53
|
+
- search (`searchable`);
|
|
54
|
+
- new `collapsedDepth`, `highlightKeys` and `onNodeClick`.
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [44c39e4]
|
|
57
|
+
- @nice2dev/ui-core@1.4.24
|
|
58
|
+
- @nice2dev/i18n@1.4.24
|
|
59
|
+
|
|
3
60
|
## 1.4.23
|
|
4
61
|
|
|
5
62
|
### Patch Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),f=require("@nice2dev/ui-core"),s=require("react"),se=require("react-dom"),ee=require("./devops-o6Zm0VKB.cjs"),oe=require("./charts-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),f=require("@nice2dev/ui-core"),s=require("react"),se=require("react-dom"),ee=require("./devops-o6Zm0VKB.cjs"),oe=require("./charts-CSgOgfES.cjs"),re=require("./no-code-DPc82kyy.cjs"),le=[],ne=({text:l,label:g,icon:h,items:y=le,variant:M="primary",size:C="md",disabled:j,readOnly:L,loading:d,onItemClick:R,splitButton:_,onClick:F,className:V,style:B,id:i,title:u,"data-testid":v,accessMode:U,displayStyle:T,error:I,errorPlacement:E="bottom"})=>{const{t:X}=f.useNiceTranslation(),G=f.useComponentDisplayStyle("button",T),q=f.useComponentDisplayClass("button",T),p=f.useNiceAccessMode(U,i),k=p==="hidden";p==="disabled"&&(j=!0),d&&(j=!0);const a=!j&&(L||p==="readOnly"),$=f.normalizeVariant(M),N=l||g,[x,O]=s.useState(!1),W=s.useRef(null),P=s.useRef(null),A=s.useRef(null),z=s.useRef(null);f.useMenuButton(_?A:P,z,{open:x,onOpenChange:t=>{(!t||!a)&&O(t)}});const[H,n]=s.useState(void 0),[o,r]=s.useState(null),[c,S]=s.useState("");s.useLayoutEffect(()=>{n(void 0)},[C,M]),s.useLayoutEffect(()=>{if(P.current){const t=P.current.offsetWidth;n(D=>D==null||t>D?t:D)}},[N,d]);let b=G;if($!=="primary"){const t={...G};delete t.background,delete t.color,($==="outline"||$==="ghost")&&(delete t.border,delete t.borderColor,delete t.borderWidth,delete t.borderStyle,delete t.boxShadow),b=t}const m={...b,...H?{minWidth:H}:{}},w=s.useCallback(()=>{const t=W.current;if(!t)return;const D=t.getBoundingClientRect();r({top:D.bottom,left:D.left,width:D.width}),S(ee.scopeThemeClass(t))},[]);s.useLayoutEffect(()=>{if(x)return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[x,w]),s.useEffect(()=>{if(!x)return;const t=D=>{const K=D.target;W.current?.contains(K)||z.current?.contains(K)||O(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}},[x]);const Y=e.jsxs("div",{className:`nice-dropdown-btn ${V||""}`,style:{position:"relative",display:"inline-flex",...B},ref:W,"data-testid":v,"aria-busy":d||void 0,children:[_?e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:P,type:"button",className:`nice-btn nice-btn--${$} nice-btn--${C} nice-btn--ds-${q} ${d?"nice-btn--loading":""} ${a?"nice-btn--readonly":""}`,style:m,disabled:j,"aria-readonly":a||void 0,onClick:()=>{a||F?.()},children:[d&&e.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),h&&e.jsx("span",{className:"nice-btn__icon",style:d?{visibility:"hidden"}:void 0,children:h}),e.jsx("span",{style:d?{visibility:"hidden"}:void 0,children:N})]}),e.jsx("button",{ref:A,type:"button",className:`nice-btn nice-btn--${$} nice-btn--${C} nice-btn--ds-${q} nice-dropdown-btn__caret ${a?"nice-btn--readonly":""}`,style:b,disabled:j,"aria-readonly":a||void 0,"aria-haspopup":"menu","aria-expanded":x,onClick:()=>{a||O(!x)},"aria-label":X("dropDownButton.toggleDropdown","Toggle dropdown"),children:e.jsx(f.NiceIcon,{name:"chevron-down",size:"xs"})})]}):e.jsxs("button",{ref:P,type:"button",className:`nice-btn nice-btn--${$} nice-btn--${C} nice-btn--ds-${q} ${d?"nice-btn--loading":""} ${a?"nice-btn--readonly":""}`,style:m,disabled:j,"aria-readonly":a||void 0,title:u,"aria-label":!N&&u?u:void 0,"aria-haspopup":"menu","aria-expanded":x,onClick:()=>{a||O(!x)},children:[d&&e.jsx("svg",{className:"nice-btn__spinner",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3","aria-hidden":"true",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),h&&e.jsx("span",{className:"nice-btn__icon",style:d?{visibility:"hidden"}:void 0,children:h}),e.jsx("span",{style:d?{visibility:"hidden"}:void 0,children:N}),e.jsx("span",{style:{marginLeft:"auto",paddingLeft:4,display:"inline-flex",...d?{visibility:"hidden"}:{}},children:e.jsx(f.NiceIcon,{name:"chevron-down",size:"xs"})})]}),x&&o&&typeof document<"u"&&se.createPortal(e.jsx("ul",{ref:z,className:`nice-dropdown__list nice-dropdown-btn__menu nice-dropdown-btn__menu--${C} ${c}`,"data-theme":c==="nice-dark"?"dark":c==="nice-light"?"light":void 0,role:"menu",style:{position:"fixed",top:o.top,left:o.left,minWidth:o.width,marginTop:0,zIndex:1e3},children:y.map(t=>e.jsxs("li",{role:"menuitem","aria-disabled":t.disabled||void 0,className:`nice-dropdown__option ${t.disabled?"nice-dropdown__option--disabled":""} ${t.danger?"nice-dropdown__option--danger":""}`,onClick:()=>{t.disabled||(t.onClick?.(),R?.(t),O(!1))},children:[t.icon&&e.jsx("span",{className:"nice-dropdown-btn__item-icon",children:t.icon}),t.text]},t.key))}),document.body)]});if(!I)return Y;const J=e.jsx("div",{className:"nice-field__error",role:"alert",children:I});return E==="right"?e.jsxs("span",{className:`nice-btn-field nice-btn-field--right nice-field--${C}`,children:[Y,J]}):k?null:e.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom nice-field--${C}`,children:[Y,J]})},ae=[],ce=[{key:void 0,label:"Available Fields"},{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],de=[{value:"",label:"Available"},{value:"row",label:"Rows"},{value:"column",label:"Columns"},{value:"data",label:"Values"},{value:"filter",label:"Filters"}],te=({fields:l=ae,onChange:g,showAreaSelect:h=!1,className:y,style:M,"data-testid":C})=>{const{t:j}=f.useNiceTranslation(),[L,d]=s.useState(null),[R,_]=s.useState("none"),F=(i,u)=>{g(l.map(v=>v.field===i?{...v,area:u}:v))},V=i=>u=>{u.preventDefault();const v=u.dataTransfer.getData("text/plain")||L;v&&F(v,i),d(null),_("none")},B=i=>e.jsxs("li",{className:"nice-field-chooser__item",draggable:!0,onDragStart:u=>{u.dataTransfer.setData("text/plain",i.field),u.dataTransfer.effectAllowed="move",d(i.field)},onDragEnd:()=>{d(null),_("none")},children:[e.jsx("span",{className:"nice-field-chooser__grip","aria-hidden":"true",children:e.jsx(f.NiceIcon,{name:"menu",size:14})}),e.jsxs("span",{className:"nice-field-chooser__label",children:[i.caption,i.dataType&&e.jsxs("small",{className:"nice-field-chooser__type",children:[" (",i.dataType,")"]})]}),h&&e.jsx(re.NiceSelect,{size:"sm",value:i.area??"",options:de,onChange:u=>F(i.field,u||void 0),"aria-label":j("pivotGridFieldChooser.assignToArea","Assign {caption} to area").replace("{caption}",String(i.caption))}),i.area&&e.jsx("button",{type:"button",className:"nice-field-chooser__remove",onClick:()=>F(i.field,void 0),"aria-label":j("pivotGridFieldChooser.remove","Remove {caption}").replace("{caption}",String(i.caption)),children:e.jsx(f.NiceIcon,{name:"close",size:14})})]},i.field);return e.jsx("div",{className:`nice-field-chooser ${y||""}`,style:M,"data-testid":C,children:e.jsx("div",{className:"nice-field-chooser__panel",children:ce.map(i=>{const u=l.filter(v=>i.key?v.area===i.key:!v.area);return e.jsxs("div",{className:`nice-field-chooser__section${R===i.key&&L?" nice-field-chooser__section--over":""}`,onDragOver:v=>{v.preventDefault(),_(i.key)},onDragLeave:()=>_("none"),onDrop:V(i.key),children:[e.jsx("h4",{children:i.label}),e.jsxs("ul",{children:[u.map(B),u.length===0&&e.jsx("li",{className:"nice-field-chooser__empty","aria-hidden":"true",children:j("pivotGridFieldChooser.dropFieldsHere","Drop fields here")})]})]},i.label)})})})},ue=[],Q="__row";function he(l,g){if(l.length===0)return 0;switch(g){case"sum":return l.reduce((h,y)=>h+y,0);case"count":return l.length;case"avg":return l.reduce((h,y)=>h+y,0)/l.length;case"min":return Math.min(...l);case"max":return Math.max(...l);default:return l.reduce((h,y)=>h+y,0)}}function Z(l,g){return[...new Set(l.map(h=>String(h[g]??"")))].sort()}const ie=({data:l=ue,fields:g,defaultFields:h,onFieldsChange:y,showFieldChooser:M,loading:C,emptyText:j,headerText:L,exportCsv:d,exportFilename:R="pivot-export",onDrillThrough:_,className:F,style:V,accessMode:B,id:i,"data-testid":u})=>{const U=f.useNiceAccessMode(B,i)==="hidden",{t:T}=f.useNiceTranslation(),I=g!==void 0&&y!==void 0,[E,X]=f.useControllableState({value:I?g:void 0,defaultValue:I?h:h??g,fallbackValue:[],onChange:y,componentName:"NicePivotGrid"});ee.useIgnoredPropChangeWarning("NicePivotGrid","fields","onFieldsChange",g,I);const[G,q]=s.useState(!1),p=s.useMemo(()=>E.filter(n=>n.area==="row"),[E]),k=s.useMemo(()=>E.filter(n=>n.area==="column"),[E]),a=s.useMemo(()=>E.filter(n=>n.area==="data"),[E]),$=s.useMemo(()=>p.length===0?["Total"]:Z(l,p[0].field),[l,p]),N=s.useMemo(()=>k.length===0?["Total"]:Z(l,k[0].field),[l,k]),x=s.useCallback((n,o,r)=>{let c=l;p.length>0&&(c=c.filter(m=>String(m[p[0].field])===n)),k.length>0&&(c=c.filter(m=>String(m[k[0].field])===o));const S=c.map(m=>Number(m[r.field])||0),b=he(S,r.summaryType||"sum");return r.format?r.format(b):b},[l,p,k]),O=s.useCallback(n=>{X(n)},[X]),W=s.useCallback((n,o)=>{let r=l;return p.length>0&&(r=r.filter(c=>String(c[p[0].field])===n)),k.length>0&&(r=r.filter(c=>String(c[k[0].field])===o)),r},[l,p,k]),P=s.useCallback((n,o)=>{_&&_(n,o,W(n,o))},[_,W]),A=s.useCallback(()=>{const n=[{field:Q,header:p.map(r=>r.caption).join(" / ")||""}];N.forEach((r,c)=>{a.length>0?a.forEach((S,b)=>n.push({field:`c${c}d${b}`,header:`${r} - ${S.caption}`})):n.push({field:`c${c}`,header:r})});const o=$.map(r=>{const c={[Q]:r};return N.forEach((S,b)=>{a.length>0?a.forEach((m,w)=>{c[`c${b}d${w}`]=x(r,S,m)}):c[`c${b}`]="—"}),c});return{columns:n,rows:o}},[N,$,a,p,x]),z=s.useCallback(()=>{const{columns:n,rows:o}=A(),r=[n.map(m=>m.header),...o.map(m=>n.map(w=>String(m[w.field]??"")))].map(m=>m.map(w=>`"${String(w).replace(/"/g,'""')}"`).join(",")).join(`
|
|
2
2
|
`),c=new Blob(["\uFEFF"+r],{type:"text/csv;charset=utf-8;"}),S=URL.createObjectURL(c),b=document.createElement("a");b.href=S,b.download=`${R}.csv`,b.click(),URL.revokeObjectURL(S)},[A,R]),H=s.useCallback(()=>{const{columns:n,rows:o}=A();oe.downloadXLSX(o,n,{fileName:R,sheetName:"Pivot"})},[A,R]);return U?null:e.jsxs("div",{className:`nice-pivotgrid ${F||""}`,style:V,"data-testid":u,children:[(M||d||L)&&e.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[L&&e.jsx("span",{className:"nice-pivotgrid__header-text",children:L}),e.jsxs("div",{className:"nice-pivotgrid__toolbar-actions",children:[M&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-btn--icon-only",onClick:()=>q(!G),title:T("controls.fieldChooser","Field Chooser"),"aria-label":T("controls.fieldChooser","Field Chooser"),"aria-pressed":G,children:e.jsx(f.NiceIcon,{name:"filter",size:16})}),d&&e.jsx(ne,{size:"sm",variant:"outline",icon:e.jsx(f.NiceIcon,{name:"download",size:16}),title:T("controls.export","Export"),items:[{key:"csv",text:"CSV",onClick:z},{key:"xlsx",text:"XLSX",onClick:H}]})]})]}),G&&e.jsx(te,{fields:E,onChange:O}),C?e.jsx("div",{className:"nice-pivotgrid__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):e.jsx("div",{className:"nice-pivotgrid__table-wrap",children:e.jsxs("table",{className:"nice-pivotgrid__table",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:p.map(n=>n.caption).join(" / ")||""}),N.map(n=>e.jsx("th",{colSpan:a.length||1,children:n},n))]}),a.length>1&&e.jsxs("tr",{children:[e.jsx("th",{}),N.map(n=>a.map(o=>e.jsx("th",{children:o.caption},`${n}-${o.field}`)))]})]}),e.jsx("tbody",{children:$.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:1+N.length*Math.max(a.length,1),className:"nice-pivotgrid__empty",children:j||T("controls.noData","No data available")})}):$.map(n=>e.jsxs("tr",{children:[e.jsx("td",{className:"nice-pivotgrid__row-header",children:n}),N.map(o=>a.length>0?a.map(r=>e.jsx("td",{className:`nice-pivotgrid__cell ${_?"nice-pivotgrid__cell--clickable":""}`,onClick:_?()=>P(n,o):void 0,children:x(n,o,r)},`${o}-${r.field}`)):e.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},o))]},n))})]})})]})},pe=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:ie},Symbol.toStringTag,{value:"Module"}));exports.NiceDropDownButton=ne;exports.NicePivotGrid=ie;exports.NicePivotGrid$1=pe;exports.NicePivotGridFieldChooser=te;
|