@nice2dev/ui 1.4.19 → 1.4.21
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/NiceGantt-Drl4gvw9.cjs +1 -0
- package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
- package/dist/NiceWindow-DQyf5wat.cjs +1 -0
- package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-DirbU7jp.cjs} +1 -1
- package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
- package/dist/display/NiceLeaderboard.mjs +47 -40
- package/dist/display/NiceQuestCard.mjs +93 -76
- package/dist/docs/NiceGantt.doc.json.mjs +9 -9
- package/dist/documentation/utils.mjs +1 -1
- package/dist/index.cjs +94 -94
- package/dist/index.d.ts +58 -2
- package/dist/index.mjs +778 -776
- package/dist/navigation/NiceMenu.mjs +249 -248
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/overlays/NiceResponsiveBox.mjs +51 -24
- package/dist/overlays/NiceTutorial.mjs +136 -127
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +25 -2
- package/dist/planning/NiceGantt.mjs +130 -121
- package/dist/planning/NiceStepper.mjs +36 -35
- package/dist/style.css +2 -2
- package/dist/tools/NiceDraggable.mjs +44 -29
- package/dist/tools/NiceSortable.mjs +66 -48
- package/dist/tools/NiceSpeechToText.mjs +67 -52
- package/dist/tools/NiceValidationBuilder.mjs +210 -119
- package/dist/tools/NiceViewRegistry.mjs +67 -34
- package/package.json +4 -4
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
- package/dist/NiceGantt-BygumlaY.cjs +0 -1
- package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
- package/dist/NiceWindow-BklnkBpu.cjs +0 -1
- package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),E=require("@nice2dev/ui-core"),l=require("react"),de=[],p=(u,N)=>{const j=new Date(u);return j.setDate(j.getDate()+N),j},M=(u,N)=>Math.ceil((N.getTime()-u.getTime())/864e5),P=({tasks:u=de,columns:N,scale:j="day",rowHeight:_=36,dayWidth:Q=30,onTaskClick:L,onTaskUpdate:x,showDependencies:Y=!0,dependencyStyle:F="square",draggable:D,zoomControls:G,className:J,style:K,accessMode:V,id:Z,"data-testid":k})=>{const{t:H}=E.useNiceTranslation(),U=E.useNiceAccessMode(V,Z)==="hidden",{t:he}=E.useNiceTranslation(),[o,A]=l.useState(Q),[f,z]=l.useState(null),S=N||[{field:"title",title:H("gantt.task","Task"),width:200}],C=S.reduce((e,t)=>e+(t.width||120),0),B=l.useRef(null),q=l.useRef(null),R=l.useRef(!1);l.useEffect(()=>{const e=B.current,t=q.current;if(!e||!t)return;const s=(c,i)=>()=>{R.current||(R.current=!0,i.scrollTop=c.scrollTop,requestAnimationFrame(()=>{R.current=!1}))},n=s(e,t),r=s(t,e);return e.addEventListener("scroll",n,{passive:!0}),t.addEventListener("scroll",r,{passive:!0}),()=>{e.removeEventListener("scroll",n),t.removeEventListener("scroll",r)}},[]);const d=l.useMemo(()=>{const e=t=>u.filter(n=>(n.parentId??null)===t).flatMap(n=>[n,...e(n.id)]);return e(null)},[u]),m=l.useMemo(()=>{if(d.length===0)return{start:new Date,end:new Date,days:30};let e=new Date(d[0].start),t=new Date(d[0].end);return d.forEach(s=>{new Date(s.start)<e&&(e=new Date(s.start)),new Date(s.end)>t&&(t=new Date(s.end))}),e=p(e,-2),t=p(t,2),{start:e,end:t,days:M(e,t)}},[d]),I=m.days*o;l.useEffect(()=>{if(!f||!x)return;const e=s=>{const n=s.clientX-f.startX,r=Math.round(n/o);if(r===0)return;const c=u.find(i=>i.id===f.taskId);if(c)if(f.mode==="move")x({...c,start:p(f.origStart,r),end:p(f.origEnd,r)});else{const i=p(f.origEnd,r);i>f.origStart&&x({...c,end:i})}},t=()=>z(null);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[f,o,u,x]);const O=l.useCallback((e,t,s)=>{if(!D||!x)return;s.stopPropagation();const n=u.find(r=>r.id===e);n&&z({taskId:e,mode:t,startX:s.clientX,origStart:new Date(n.start),origEnd:new Date(n.end)})},[D,u,x]),ee=l.useCallback(()=>A(e=>Math.min(100,e+5)),[]),te=l.useCallback(()=>A(e=>Math.max(8,e-5)),[]),ne=()=>{const e=[],t=[];new Date(m.start);const s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(j==="day"){let n=-1,r=0;for(let c=0;c<m.days;c++){const i=p(m.start,c);i.getMonth()!==n&&(n>=0&&e.push(a.jsxs("div",{className:"nice-gantt__header-cell",style:{width:(c-r)*o},children:[s[n]," ",i.getFullYear()]},`m${n}-${r}`)),n=i.getMonth(),r=c);const h=i.getDay()===0||i.getDay()===6;t.push(a.jsx("div",{className:`nice-gantt__header-cell nice-gantt__header-cell--sub ${h?"nice-gantt__header-cell--weekend":""}`,style:{width:o},children:i.getDate()},c))}n>=0&&e.push(a.jsx("div",{className:"nice-gantt__header-cell",style:{width:(m.days-r)*o},children:s[n]},`m${n}-last`))}return a.jsxs("div",{className:"nice-gantt__chart-header",children:[a.jsx("div",{className:"nice-gantt__header-row",children:e}),a.jsx("div",{className:"nice-gantt__header-row",children:t})]})},se=(e,t)=>{const s=M(m.start,new Date(e.start))*o,n=Math.max(M(new Date(e.start),new Date(e.end))*o,o),r=t*_+4,c=_-8,i=e.progress??0;return a.jsxs("div",{role:L?"button":void 0,tabIndex:L?0:void 0,onKeyDown:L?E.clickOnActivationKey:void 0,className:`nice-gantt__bar ${D?"nice-gantt__bar--draggable":""}`,title:`${e.title} (${Math.round(i)}%)`,style:{left:s,top:r,width:n,height:c,backgroundColor:e.color||"var(--nice-color-primary, #3b82f6)"},onClick:()=>L?.(e),onMouseDown:D?h=>O(e.id,"move",h):void 0,children:[i>0&&a.jsx("div",{className:"nice-gantt__bar-progress",style:{width:`${i}%`}}),a.jsx("span",{className:"nice-gantt__bar-label",children:e.title}),D&&a.jsx("div",{className:"nice-gantt__bar-resize",onMouseDown:h=>O(e.id,"resize",h)})]},e.id)},ae=(e,t,s,n,r)=>{const h=e+10,y=s-14,W=(t+n)/2,w=n>=t?1:-1,T=Math.abs(n-t)<1,X=y<=h+4,b=T?t:W,g=X?Math.max(h,e+10):h,v=X?Math.min(y,s-10):y;if(T||!r)return[`M ${e} ${t}`,`L ${g} ${t}`,`L ${g} ${b}`,`L ${v} ${b}`,`L ${v} ${n}`,`L ${s} ${n}`].join(" ");const ie=Math.max(0,v-g),ce=Math.abs(n-t),oe=Math.min(ce/2||10,ie/2||10),$=Math.max(2,Math.min(10,oe));return[`M ${e} ${t}`,`L ${g-$} ${t}`,`Q ${g} ${t} ${g} ${t+w*$}`,`L ${g} ${b-w*$}`,`Q ${g} ${b} ${g+$} ${b}`,`L ${v-$} ${b}`,`Q ${v} ${b} ${v} ${b+w*$}`,`L ${v} ${n-w*$}`,`Q ${v} ${n} ${v+$} ${n}`,`L ${s} ${n}`].join(" ")},re=()=>{if(!Y)return null;const e=[],t=new Map(d.map((s,n)=>[s.id,n]));return d.forEach(s=>{(s.dependencies||[]).forEach(n=>{const r=t.get(n),c=t.get(s.id);if(r==null||c==null)return;const i=d[r],h=M(m.start,new Date(i.end))*o,y=r*_+_/2,W=M(m.start,new Date(s.start))*o,w=c*_+_/2;e.push(a.jsx("path",{d:ae(h,y,W,w,F==="rounded"),fill:"none",stroke:"var(--nice-text-secondary, #6b7280)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",markerEnd:"url(#arrowhead)"},`${n}-${s.id}`))})}),a.jsxs("svg",{className:"nice-gantt__deps",width:I,height:d.length*_,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[a.jsx("defs",{children:a.jsx("marker",{id:"arrowhead",markerWidth:"6",markerHeight:"4",refX:"5",refY:"2",orient:"auto",children:a.jsx("polygon",{points:"0 0, 6 2, 0 4",fill:"var(--nice-text-secondary, #6b7280)"})})}),e]})};return U?null:a.jsxs("div",{className:`nice-gantt ${J||""}`,style:K,"data-testid":k,children:[G&&a.jsxs("div",{className:"nice-gantt__zoom-controls",children:[a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:te,children:"−"}),a.jsxs("span",{className:"nice-gantt__zoom-label",children:[o,"px"]}),a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:ee,children:"+"})]}),a.jsxs("div",{className:"nice-gantt__container",children:[a.jsxs("div",{className:"nice-gantt__table",style:{width:C,minWidth:C},children:[a.jsxs("div",{className:"nice-gantt__table-header",children:[a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--main","aria-hidden":"true",children:" "}),a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--sub",children:S.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-header-cell",style:{width:e.width||120},children:e.title},t))})]}),a.jsx("div",{className:"nice-gantt__table-body",ref:B,children:d.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-row",style:{height:_},children:S.map((s,n)=>a.jsx("div",{className:"nice-gantt__table-cell",style:{width:s.width||120},children:e[s.field]},n))},e.id))})]}),a.jsx("div",{className:"nice-gantt__chart",children:a.jsxs("div",{className:"nice-gantt__chart-body-wrap",ref:q,children:[ne(),a.jsxs("div",{className:"nice-gantt__chart-body",style:{width:I,height:d.length*_,position:"relative"},children:[Array.from({length:m.days},(e,t)=>{const s=p(m.start,t),n=s.getDay()===0||s.getDay()===6;return a.jsx("div",{className:`nice-gantt__gridline ${n?"nice-gantt__gridline--weekend":""}`,style:{left:t*o,width:o,height:"100%",position:"absolute",top:0}},t)}),d.map((e,t)=>se(e,t)),re()]})]})})]})]})};process.env.NODE_ENV!=="production"&&(P.displayName="NiceGantt");exports.NiceGantt=P;
|