@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),C=require("@nice2dev/ui-core"),o=require("react"),f=({height:e=200})=>r.jsx("div",{className:"ntd-lazy-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",height:e,background:"var(--ntd-color-surface, #f5f5f5)",borderRadius:"var(--ntd-radius, 8px)",animation:"ntd-pulse 1.5s ease-in-out infinite"},children:r.jsx("div",{className:"ntd-lazy-loading-spinner",style:{width:24,height:24,border:"2px solid var(--ntd-color-border, #ddd)",borderTopColor:"var(--ntd-color-primary, #6366f1)",borderRadius:"50%",animation:"ntd-spin 0.8s linear infinite"}})}),L=(e,t)=>{const{t:a}=C.useNiceTranslation();return r.jsxs("div",{className:"ntd-lazy-error",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:24,background:"var(--ntd-color-error-bg, #fee2e2)",borderRadius:"var(--ntd-radius, 8px)",color:"var(--ntd-color-error, #dc2626)"},children:[r.jsx(C.NiceIcon,{name:"error",size:32}),r.jsx("p",{style:{margin:"12px 0 8px",fontWeight:500},children:a("lazy.failedToLoadComponent","Failed to load component")}),r.jsx("p",{style:{margin:0,fontSize:"0.875em",opacity:.8},children:e.message}),r.jsx("button",{onClick:t,style:{marginTop:16,padding:"8px 16px",border:"none",borderRadius:"var(--ntd-radius, 8px)",background:"var(--ntd-color-error, #dc2626)",color:"var(--nice-color-white, #fff)",cursor:"pointer",fontSize:"0.875em"},children:a("lazy.retry","Retry")})]})};class D extends o.Component{constructor(){super(...arguments),this.state={error:null},this.handleRetry=()=>{this.setState({error:null})}}static getDerivedStateFromError(t){return{error:t}}render(){return this.state.error?this.props.fallback(this.state.error,this.handleRetry):this.props.children}}function i(e,t={}){const{fallback:a=r.jsx(f,{}),preloadOnMount:l=!1,preloadOnHover:p=!1,preloadAfterIdle:n,minLoadingTime:m=0,ssrFallback:c,errorFallback:S=L,displayName:P}=t;let b=null,h=!1;const y=async()=>{if(b)return b;const x=Date.now();b=e();const v=await b;if(m>0){const w=Date.now()-x;w<m&&await new Promise(u=>setTimeout(u,m-w))}return h=!0,v},I=o.lazy(y),q=x=>{const v=o.useRef(null);return o.useEffect(()=>{l&&!h&&y()},[]),o.useEffect(()=>{if(n&&!h){const u="requestIdleCallback"in window?window.requestIdleCallback(()=>y(),{timeout:n}):setTimeout(()=>y(),n);return()=>{"cancelIdleCallback"in window?window.cancelIdleCallback(u):clearTimeout(u)}}},[]),o.useEffect(()=>{if(!p||h)return;const u=v.current;if(!u)return;const N=()=>{h||y()};return u.addEventListener("mouseenter",N,{once:!0}),()=>u.removeEventListener("mouseenter",N)},[]),typeof window>"u"&&c?r.jsx(r.Fragment,{children:c}):r.jsx("div",{ref:v,className:"ntd-lazy-wrapper",children:r.jsx(D,{fallback:S,children:r.jsx(o.Suspense,{fallback:a,children:r.jsx(I,{...x})})})})},R=async()=>{h||await y()},k=q;return k.preload=R,k.displayName=P||"LazyComponent",k}function G(e=.1,t="100px"){const a=o.useRef(null),[l,p]=o.useState(!1);return o.useEffect(()=>{if(!a.current||l)return;const n=new IntersectionObserver(([m])=>{m.isIntersecting&&(p(!0),n.disconnect())},{threshold:e,rootMargin:t});return n.observe(a.current),()=>n.disconnect()},[e,t,l]),[a,l]}function V(e,t=2e3){o.useEffect(()=>{if("requestIdleCallback"in window){const a=window.requestIdleCallback(()=>{e.forEach(l=>l())},{timeout:t});return()=>window.cancelIdleCallback(a)}else{const a=setTimeout(()=>{e.forEach(l=>l())},t);return()=>clearTimeout(a)}},[])}function T(e,t){const a=o.useRef(new Set);o.useEffect(()=>{const l=document.querySelectorAll("a[href]"),p=n=>{const c=n.currentTarget.getAttribute("href");c&&e[c]&&!a.current.has(c)&&(e[c](),a.current.add(c))};return l.forEach(n=>{n.addEventListener("mouseenter",p)}),()=>{l.forEach(n=>{n.removeEventListener("mouseenter",p)})}},[t,e])}const z=()=>r.jsx(f,{height:400}),g=()=>r.jsx(f,{height:300}),j=()=>r.jsx(f,{height:500}),E=()=>r.jsx(f,{height:600}),d=e=>e,s={CodeEditor:i(d(()=>Promise.resolve().then(()=>require("./NiceCodeEditor-CBgbzwjx.cjs")).then(e=>({default:e.NiceCodeEditor}))),{fallback:r.jsx(z,{}),preloadOnHover:!0,displayName:"LazyCodeEditor"}),HtmlEditor:i(d(()=>Promise.resolve().then(()=>require("./NiceHtmlEditor-BEWNA_UI.cjs")).then(e=>({default:e.NiceHtmlEditor}))),{fallback:r.jsx(z,{}),preloadOnHover:!0,displayName:"LazyHtmlEditor"}),DocumentViewer:i(d(()=>Promise.resolve().then(()=>require("./NiceDocumentViewer-CDXAmPp7.cjs")).then(e=>({default:e.NiceDocumentViewer}))),{fallback:r.jsx(f,{height:600}),displayName:"LazyDocumentViewer"}),Chart:i(d(()=>Promise.resolve().then(()=>require("./charts-C9B548D2.cjs")).then(e=>e.NiceChart$1).then(e=>({default:e.NiceChart}))),{fallback:r.jsx(g,{}),preloadAfterIdle:3e3,displayName:"LazyChart"}),VectorMap:i(d(()=>Promise.resolve().then(()=>require("./charts-C9B548D2.cjs")).then(e=>e.NiceVectorMap$1).then(e=>({default:e.NiceVectorMap}))),{fallback:r.jsx(f,{height:400}),displayName:"LazyVectorMap"}),Sankey:i(d(()=>Promise.resolve().then(()=>require("./charts-C9B548D2.cjs")).then(e=>e.NiceSankey$1).then(e=>({default:e.NiceSankey}))),{fallback:r.jsx(g,{}),displayName:"LazySankey"}),Scheduler:i(d(()=>Promise.resolve().then(()=>require("./NiceScheduler-Dff8fuq_.cjs")).then(e=>e.NiceScheduler$1).then(e=>({default:e.NiceScheduler}))),{fallback:r.jsx(E,{}),displayName:"LazyScheduler"}),Gantt:i(d(()=>Promise.resolve().then(()=>require("./NiceGantt-Drl4gvw9.cjs")).then(e=>({default:e.NiceGantt}))),{fallback:r.jsx(E,{}),displayName:"LazyGantt"}),PivotGrid:i(d(()=>Promise.resolve().then(()=>require("./NicePivotGrid-B5Fgi5E_.cjs")).then(e=>e.NicePivotGrid$1).then(e=>({default:e.NicePivotGrid}))),{fallback:r.jsx(j,{}),displayName:"LazyPivotGrid"}),DataGrid:i(d(()=>Promise.resolve().then(()=>require("./NiceDataGrid-Cszjz8NV.cjs")).then(e=>e.NiceDataGrid$1).then(e=>({default:e.NiceDataGrid}))),{fallback:r.jsx(j,{}),preloadAfterIdle:2e3,displayName:"LazyDataGrid"})};async function H(){await Promise.all([s.CodeEditor.preload(),s.HtmlEditor.preload(),s.DocumentViewer.preload(),s.Chart.preload(),s.VectorMap.preload(),s.Sankey.preload(),s.Scheduler.preload(),s.Gantt.preload(),s.PivotGrid.preload()])}async function O(e){await Promise.all(e.map(t=>s[t].preload()))}exports.DefaultErrorFallback=L;exports.DefaultLoadingFallback=f;exports.LazyComponents=s;exports.createLazyComponent=i;exports.preloadAllHeavyComponents=H;exports.preloadComponents=O;exports.useLazyOnVisible=G;exports.usePreloadOnIdle=V;exports.usePreloadOnRouteHint=T;
|