@nice2dev/ui 1.2.0 → 1.2.2
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 +150 -0
- package/dist/NiceApiExplorer.doc-CFJndg5h.js +25 -0
- package/dist/NiceApiExplorer.doc-TEx67kV5.cjs +1 -0
- package/dist/NiceBPMNDesigner.doc-6lK1pXRq.js +32 -0
- package/dist/NiceBPMNDesigner.doc-BY8t7qOi.cjs +8 -0
- package/dist/NiceBackupDiffViewer.doc-CYvOeX19.js +25 -0
- package/dist/NiceBackupDiffViewer.doc-ChQaZCg1.cjs +1 -0
- package/dist/NiceBackupList.doc-BdQCw0_D.cjs +1 -0
- package/dist/NiceBackupList.doc-BwjIAoqz.js +25 -0
- package/dist/NiceBackupRestoreDialog.doc-B2iiqTps.cjs +1 -0
- package/dist/NiceBackupRestoreDialog.doc-DuXSGJiD.js +25 -0
- package/dist/NiceBackupScheduler.doc-BpY45181.js +31 -0
- package/dist/NiceBackupScheduler.doc-ByeL3iH1.cjs +7 -0
- package/dist/NiceBackupStatusBadge.doc-BA3dYgiW.cjs +1 -0
- package/dist/NiceBackupStatusBadge.doc-CxwkVarP.js +25 -0
- package/dist/NiceBackupTagEditor.doc-Bej1KHco.cjs +7 -0
- package/dist/NiceBackupTagEditor.doc-CNy4uNws.js +31 -0
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +8 -0
- package/dist/NiceBottomSheet.doc-v-UPUKQk.js +32 -0
- package/dist/NiceBranchManager.doc-BTyRjX7X.cjs +6 -0
- package/dist/NiceBranchManager.doc-Cz4SyEqE.js +30 -0
- package/dist/NiceButton-3AcJJ15c.cjs +1 -0
- package/dist/NiceButton-vkI07DP0.js +88 -0
- package/dist/NiceCodeEditor-C43xFG8v.cjs +260 -0
- package/dist/NiceCodeEditor-CspuYLh6.js +1174 -0
- package/dist/NiceCodeEditor-VGIDWSkS.js +1181 -0
- package/dist/NiceCodeEditor-qX39PSnQ.cjs +260 -0
- package/dist/NiceColorPicker-CQhhjZ8w.cjs +1 -0
- package/dist/NiceColorPicker-Cbop7VMu.js +491 -0
- package/dist/NiceConnectorConfigForm.doc-BKrDuhXw.cjs +7 -0
- package/dist/NiceConnectorConfigForm.doc-BsHeXz3M.js +31 -0
- package/dist/NiceDataBranchGraph.doc-Axidz41W.js +29 -0
- package/dist/NiceDataBranchGraph.doc-sjLmrrtE.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B1-Rp2X4.cjs +6 -0
- package/dist/NiceDataBranchManager.doc-GUqfTFvW.js +30 -0
- package/dist/NiceDataConflictResolver.doc-CjQryrTu.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-L-TcnQMX.js +29 -0
- package/dist/NiceDataDiffViewer.doc-BzGrf0U-.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-goxhSldH.js +30 -0
- package/dist/NiceDataGrid-BDEIbuBS.js +2218 -0
- package/dist/NiceDataGrid-CS5aB-EN.cjs +10 -0
- package/dist/NiceDataGrid-CrD4HPlO.cjs +10 -0
- package/dist/NiceDataGrid-Dfg1DVbU.js +2224 -0
- package/dist/NiceDataMapper.doc-QmnmnvVq.js +30 -0
- package/dist/NiceDataMapper.doc-ytGVtYVr.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BcmzKxh2.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BvYa4aUJ.js +30 -0
- package/dist/NiceDataSnapshot.doc-C73K1biG.cjs +6 -0
- package/dist/NiceDataSnapshot.doc-hU7wnOzM.js +30 -0
- package/dist/NiceDesktopViews.doc-DJjYlyP2.cjs +1 -0
- package/dist/NiceDesktopViews.doc-ly-VUAJj.js +25 -0
- package/dist/NiceDeviceControlCard.doc-BZIo92-w.cjs +1 -0
- package/dist/NiceDeviceControlCard.doc-DIzZcW9L.js +25 -0
- package/dist/NiceDocumentViewer-B9VIVKyw.js +726 -0
- package/dist/NiceDocumentViewer-CDXAmPp7.cjs +180 -0
- package/dist/NiceDocumentationViewer.doc-BSNGa7a_.js +25 -0
- package/dist/NiceDocumentationViewer.doc-CrwlvPFg.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DW-jllDV.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DnEehTff.js +25 -0
- package/dist/NiceFeatureGate.doc-DN17uS_B.cjs +3 -0
- package/dist/NiceFeatureGate.doc-DNfFSRrh.js +27 -0
- package/dist/NiceForm-BcN4p2kG.cjs +1 -0
- package/dist/NiceForm-CISJyzoW.cjs +1 -0
- package/dist/NiceForm-DmH6k1b_.js +4775 -0
- package/dist/NiceForm-tIXS-M6b.js +4770 -0
- package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
- package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
- package/dist/NiceGantt-CHnq-n8f.cjs +1 -0
- package/dist/NiceGantt-CTbqCuwv.cjs +1 -0
- package/dist/NiceGantt-CX3jVNaF.js +330 -0
- package/dist/NiceGantt-Dao7pN9z.js +328 -0
- package/dist/NiceGantt.doc-B6YZcJvG.cjs +11 -0
- package/dist/NiceGantt.doc-DsI1QXly.js +48 -0
- package/dist/NiceGitBlame.doc-BQ2KvGkD.js +30 -0
- package/dist/NiceGitBlame.doc-DuTSjZVN.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-D24AGos_.js +30 -0
- package/dist/NiceGitDiffViewer.doc-D9FVquBC.cjs +6 -0
- package/dist/NiceGitGraph.doc-C-8VGMIz.js +29 -0
- package/dist/NiceGitGraph.doc-eRvTmefl.cjs +5 -0
- package/dist/NiceGitHooks.doc-DCTVw7HX.cjs +5 -0
- package/dist/NiceGitHooks.doc-OCFj5w6v.js +29 -0
- package/dist/NiceHtmlEditor-DUwcqj5N.cjs +10 -0
- package/dist/NiceHtmlEditor-DeK0Of98.js +883 -0
- package/dist/NiceHtmlEditor-DiAphF1k.js +889 -0
- package/dist/NiceHtmlEditor-DvVxl4Fu.cjs +10 -0
- package/dist/NiceInstanceMonitor.doc-BSDZp5xa.js +31 -0
- package/dist/NiceInstanceMonitor.doc-HVbLufnh.cjs +7 -0
- package/dist/NiceLocaleManager.doc-CbVHDEWu.js +25 -0
- package/dist/NiceLocaleManager.doc-XH6hMW0Z.cjs +1 -0
- package/dist/NiceLockButton.doc-BMhSj3TB.cjs +1 -0
- package/dist/NiceLockButton.doc-DvHGhcfm.js +25 -0
- package/dist/NiceLoginForm-CHXbz0eu.js +747 -0
- package/dist/NiceLoginForm-DQe77Isv.js +747 -0
- package/dist/NiceLoginForm-NBCo-DUZ.cjs +1 -0
- package/dist/NiceLoginForm-ix6J1adA.cjs +1 -0
- package/dist/NiceLoginForm.css +1 -1
- package/dist/NiceMAM.doc-CsQ57saR.cjs +8 -0
- package/dist/NiceMAM.doc-hjW7buTH.js +32 -0
- package/dist/NiceMention--3P3vO-W.cjs +430 -0
- package/dist/NiceMention-Co2cqkVM.js +11316 -0
- package/dist/NiceMention-DKhk3xdM.js +11321 -0
- package/dist/NiceMention-wp1AJ5oh.cjs +430 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-BbQwiEOp.cjs +1 -0
- package/dist/NiceModal-DQEfTcnZ.js +85 -0
- package/dist/NiceModuleLifecyclePanel-22CEEVbA.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-BCd9Wv5Y.js +6825 -0
- package/dist/NiceModuleLifecyclePanel-DV3F_QdI.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-gaZkIEtK.js +6825 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NiceNetworkDiscoveryPanel.doc-B0RtGaS3.js +25 -0
- package/dist/NiceNetworkDiscoveryPanel.doc-BFgFZI5G.cjs +1 -0
- package/dist/NicePagination-B3nZDZem.js +165 -0
- package/dist/NicePagination-B8rg1Y67.cjs +1 -0
- package/dist/NicePagination-BFGt1v0a.js +165 -0
- package/dist/NicePagination-DltL3-Sz.cjs +1 -0
- package/dist/NicePipelineEditor.doc-CjqDKe2x.js +29 -0
- package/dist/NicePipelineEditor.doc-DZ0pTVTp.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-C88-TagI.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-CFtH4XJx.js +29 -0
- package/dist/NicePivotGrid-BD87Na7P.js +1163 -0
- package/dist/NicePivotGrid-BPmnvbPQ.cjs +152 -0
- package/dist/NicePivotGrid-BaZa2YZW.js +1157 -0
- package/dist/NicePivotGrid-DyOPhPO8.cjs +152 -0
- package/dist/NiceRoomGrid.doc-DJPVUQVg.cjs +8 -0
- package/dist/NiceRoomGrid.doc-DLHJS_Wb.js +32 -0
- package/dist/NiceSavedQueryPanel-BC84uRfh.cjs +586 -0
- package/dist/NiceSavedQueryPanel-BSTiZvFg.js +5130 -0
- package/dist/NiceSavedQueryPanel-CMfcODIO.js +5120 -0
- package/dist/NiceSavedQueryPanel-DrR3sw4T.cjs +586 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceSceneBar.doc-09sc3yuF.cjs +1 -0
- package/dist/NiceSceneBar.doc-DLePMuVU.js +25 -0
- package/dist/NiceSceneSelector.doc-CPzCAy-d.cjs +7 -0
- package/dist/NiceSceneSelector.doc-FCLZvPc0.js +31 -0
- package/dist/NiceScheduler-BAJRzFQN.js +1690 -0
- package/dist/NiceScheduler-DvxJ8N0I.js +1698 -0
- package/dist/NiceScheduler-TIksdF0k.cjs +5 -0
- package/dist/NiceScheduler-dJ7gHDv7.cjs +5 -0
- package/dist/NiceSchedulerViews.doc-C9opZpgg.cjs +1 -0
- package/dist/NiceSchedulerViews.doc-Dy7ZH1iL.js +25 -0
- package/dist/NiceSelect-CZR8Zu_k.js +420 -0
- package/dist/NiceSelect-DIKGbaJo.cjs +1 -0
- package/dist/NiceSensorGaugePanel.doc-BHirbWLn.cjs +8 -0
- package/dist/NiceSensorGaugePanel.doc-DjKmooI6.js +32 -0
- package/dist/NiceSpotlight.doc-BVZFfDVI.cjs +10 -0
- package/dist/NiceSpotlight.doc-JqwkzrEm.js +34 -0
- package/dist/NiceStateDesigner.doc-CfnwiwfU.js +29 -0
- package/dist/NiceStateDesigner.doc-DV4zEC50.cjs +5 -0
- package/dist/NiceStepper.doc-5VjaLM6r.js +31 -0
- package/dist/NiceStepper.doc-f8lYpr33.cjs +7 -0
- package/dist/NiceTaskInbox.doc-CHrxthqp.js +32 -0
- package/dist/NiceTaskInbox.doc-CdCTfgBq.cjs +8 -0
- package/dist/NiceTestBuilder.doc-BoBzLfa0.js +30 -0
- package/dist/NiceTestBuilder.doc-Cj1fNTvk.cjs +6 -0
- package/dist/NiceTranscoder.doc-Dnirl3wg.cjs +7 -0
- package/dist/NiceTranscoder.doc-cInCYZh7.js +31 -0
- package/dist/NiceVideoAnnotator.doc-C1iEi7OM.cjs +7 -0
- package/dist/NiceVideoAnnotator.doc-C8zyfKH_.js +31 -0
- package/dist/NiceVideoEditor.doc-C6mhEb-q.cjs +7 -0
- package/dist/NiceVideoEditor.doc-lrwmKjqj.js +31 -0
- package/dist/NiceWindow-CWN8OCHF.js +2109 -0
- package/dist/NiceWindow-Dd8qjkIW.cjs +1 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-Bo2WAI5T.cjs +768 -0
- package/dist/charts-BpELGDXh.cjs +768 -0
- package/dist/charts-ByrdMeQP.js +4767 -0
- package/dist/charts-M6LuVI7F.js +4776 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.d.ts +28 -46
- package/dist/charts.mjs +1 -1
- package/dist/core-B8eBUE4m.js +438 -0
- package/dist/core-lBFqvT0V.cjs +1 -0
- package/dist/core-lazy-Bh2yg4Et.js +351 -0
- package/dist/core-lazy-CkWKjfc6.cjs +1 -0
- package/dist/core-lazy-Ctin_LwS.cjs +1 -0
- package/dist/core-lazy-iDiropM6.js +351 -0
- package/dist/data-branching-BgIAw01q.cjs +1 -0
- package/dist/data-branching-Dak1_ZKR.cjs +1 -0
- package/dist/data-branching-DiLAO4Qt.js +6386 -0
- package/dist/data-branching-bvB9K6KS.js +6386 -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 +22 -18
- package/dist/data.mjs +3 -3
- package/dist/devops-Bp-_aA-9.js +8682 -0
- package/dist/devops-CXBSjnyX.cjs +17 -0
- package/dist/devops-DkVluHBp.cjs +17 -0
- package/dist/devops-zsMUueTd.js +8648 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +3 -3
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +100 -38
- package/dist/editors.mjs +8 -8
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +71 -2
- package/dist/feedback.mjs +10 -9
- package/dist/index.cjs +263 -263
- package/dist/index.css +1 -1
- package/dist/index.d.ts +641 -253
- package/dist/index.mjs +26438 -26260
- package/dist/injectStyleOnce-BzC_BCs_.js +9 -0
- package/dist/injectStyleOnce-DeWaxcdf.cjs +1 -0
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +9 -7
- package/dist/lazy.mjs +51 -51
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.css +1 -0
- package/dist/navigation.d.ts +99 -43
- package/dist/navigation.mjs +504 -547
- package/dist/no-code-BNFk_BDO.js +8275 -0
- package/dist/no-code-CFdTp543.cjs +331 -0
- package/dist/no-code-DiTEnuRv.js +8288 -0
- package/dist/no-code-wG9c0z_T.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.css +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +12 -6
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BCRiHDE_.cjs +1 -0
- package/dist/pickerCommons-CMxFt9SW.js +548 -0
- package/dist/pickerCommons-Dc_hlz-e.cjs +1 -0
- package/dist/pickerCommons-DkumQ3KE.js +548 -0
- package/dist/style.css +12 -9
- package/package.json +3 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const e = "https://nice2dev.com/schemas/component-doc-v1.json", t = "NiceFormItem", n = "Form field wrapper with label and validation.", o = "form", a = "1.0.0", i = "stable", r = [{ name: "name", type: "string | (string | number)[]", description: "Field name/path" }, { name: "label", type: "React.ReactNode", description: "Field label" }, { name: "rules", type: "Rule[]", description: "Validation rules" }, { name: "required", type: "boolean", default: "false", description: "Required field" }, { name: "help", type: "React.ReactNode", description: "Help text" }, { name: "tooltip", type: "string | TooltipProps", description: "Tooltip help" }, { name: "extra", type: "React.ReactNode", description: "Extra content below input" }, { name: "children", type: "React.ReactNode", required: !0, description: "Form control" }], s = [{ title: "Form Item", description: "Field wrapper", code: `<NiceFormItem
|
|
2
|
+
name="username"
|
|
3
|
+
label="Username"
|
|
4
|
+
rules={[
|
|
5
|
+
{ required: true, message: 'Username is required' },
|
|
6
|
+
{ min: 3, message: 'Min 3 characters' }
|
|
7
|
+
]}
|
|
8
|
+
tooltip="Your display name"
|
|
9
|
+
hasFeedback
|
|
10
|
+
>
|
|
11
|
+
<NiceInput placeholder="Enter username" />
|
|
12
|
+
</NiceFormItem>` }], c = { keyboard: [], aria: ["Label association", "Error message"] }, l = ["NiceForm", "NiceInput"], p = {
|
|
13
|
+
$schema: e,
|
|
14
|
+
name: t,
|
|
15
|
+
description: n,
|
|
16
|
+
category: o,
|
|
17
|
+
since: a,
|
|
18
|
+
status: i,
|
|
19
|
+
props: r,
|
|
20
|
+
examples: s,
|
|
21
|
+
accessibility: c,
|
|
22
|
+
seeAlso: l
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
e as $schema,
|
|
26
|
+
c as accessibility,
|
|
27
|
+
o as category,
|
|
28
|
+
p as default,
|
|
29
|
+
n as description,
|
|
30
|
+
s as examples,
|
|
31
|
+
t as name,
|
|
32
|
+
r as props,
|
|
33
|
+
l as seeAlso,
|
|
34
|
+
a as since,
|
|
35
|
+
i as status
|
|
36
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceFormItem",n="Form field wrapper with label and validation.",o="form",a="1.0.0",i="stable",s=[{name:"name",type:"string | (string | number)[]",description:"Field name/path"},{name:"label",type:"React.ReactNode",description:"Field label"},{name:"rules",type:"Rule[]",description:"Validation rules"},{name:"required",type:"boolean",default:"false",description:"Required field"},{name:"help",type:"React.ReactNode",description:"Help text"},{name:"tooltip",type:"string | TooltipProps",description:"Tooltip help"},{name:"extra",type:"React.ReactNode",description:"Extra content below input"},{name:"children",type:"React.ReactNode",required:!0,description:"Form control"}],r=[{title:"Form Item",description:"Field wrapper",code:`<NiceFormItem
|
|
2
|
+
name="username"
|
|
3
|
+
label="Username"
|
|
4
|
+
rules={[
|
|
5
|
+
{ required: true, message: 'Username is required' },
|
|
6
|
+
{ min: 3, message: 'Min 3 characters' }
|
|
7
|
+
]}
|
|
8
|
+
tooltip="Your display name"
|
|
9
|
+
hasFeedback
|
|
10
|
+
>
|
|
11
|
+
<NiceInput placeholder="Enter username" />
|
|
12
|
+
</NiceFormItem>`}],c={keyboard:[],aria:["Label association","Error message"]},l=["NiceForm","NiceInput"],p={$schema:e,name:t,description:n,category:o,since:a,status:i,props:s,examples:r,accessibility:c,seeAlso:l};exports.$schema=e;exports.accessibility=c;exports.category=o;exports.default=p;exports.description=n;exports.examples=r;exports.name=t;exports.props=s;exports.seeAlso=l;exports.since=a;exports.status=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),R=require("@nice2dev/ui-core"),l=require("react"),oe=[],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),O=({tasks:u=oe,columns:N,scale:j="day",rowHeight:_=36,dayWidth:P=30,onTaskClick:Q,onTaskUpdate:x,showDependencies:Y=!0,dependencyStyle:F="square",draggable:D,zoomControls:G,className:J,style:k,accessMode:K,id:V})=>{const{t:Z}=R.useNiceTranslation(),H=R.useNiceAccessMode(K,V)==="hidden",{t:le}=R.useNiceTranslation(),[o,C]=l.useState(P),[f,W]=l.useState(null),L=N||[{field:"title",title:Z("gantt.task","Task"),width:200}],T=L.reduce((e,t)=>e+(t.width||120),0),z=l.useRef(null),A=l.useRef(null),E=l.useRef(!1);l.useEffect(()=>{const e=z.current,t=A.current;if(!e||!t)return;const s=(c,i)=>()=>{E.current||(E.current=!0,i.scrollTop=c.scrollTop,requestAnimationFrame(()=>{E.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]),B=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=()=>W(null);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[f,o,u,x]);const q=l.useCallback((e,t,s)=>{if(!D||!x)return;s.stopPropagation();const n=u.find(r=>r.id===e);n&&W({taskId:e,mode:t,startX:s.clientX,origStart:new Date(n.start),origEnd:new Date(n.end)})},[D,u,x]),U=l.useCallback(()=>C(e=>Math.min(100,e+5)),[]),ee=l.useCallback(()=>C(e=>Math.max(8,e-5)),[]),te=()=>{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})]})},ne=(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",{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:()=>Q?.(e),onMouseDown:D?h=>q(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=>q(e.id,"resize",h)})]},e.id)},se=(e,t,s,n,r)=>{const h=e+10,y=s-14,S=(t+n)/2,w=n>=t?1:-1,X=Math.abs(n-t)<1,I=y<=h+4,b=X?t:S,g=I?Math.max(h,e+10):h,v=I?Math.min(y,s-10):y;if(X||!r)return[`M ${e} ${t}`,`L ${g} ${t}`,`L ${g} ${b}`,`L ${v} ${b}`,`L ${v} ${n}`,`L ${s} ${n}`].join(" ");const re=Math.max(0,v-g),ie=Math.abs(n-t),ce=Math.min(ie/2||10,re/2||10),$=Math.max(2,Math.min(10,ce));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(" ")},ae=()=>{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,S=M(m.start,new Date(s.start))*o,w=c*_+_/2;e.push(a.jsx("path",{d:se(h,y,S,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:B,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 H?null:a.jsxs("div",{className:`nice-gantt ${J||""}`,style:k,children:[G&&a.jsxs("div",{className:"nice-gantt__zoom-controls",children:[a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:ee,children:"−"}),a.jsxs("span",{className:"nice-gantt__zoom-label",children:[o,"px"]}),a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:U,children:"+"})]}),a.jsxs("div",{className:"nice-gantt__container",children:[a.jsxs("div",{className:"nice-gantt__table",style:{width:T,minWidth:T},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:L.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:z,children:d.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-row",style:{height:_},children:L.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:A,children:[te(),a.jsxs("div",{className:"nice-gantt__chart-body",style:{width:B,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)=>ne(e,t)),ae()]})]})})]})]})};process.env.NODE_ENV!=="production"&&(O.displayName="NiceGantt");exports.NiceGantt=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),I=require("@nice2dev/ui-core"),l=require("react"),ce=[],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),O=({tasks:u=ce,columns:N,scale:j="day",rowHeight:_=36,dayWidth:P=30,onTaskClick:Q,onTaskUpdate:x,showDependencies:Y=!0,dependencyStyle:F="square",draggable:D,zoomControls:G,className:J,style:k,accessMode:K,id:V})=>{const Z=I.useNiceAccessMode(K,V)==="hidden",{t:de}=I.useNiceTranslation(),[o,R]=l.useState(P),[f,C]=l.useState(null),L=N||[{field:"title",title:"Task",width:200}],W=L.reduce((e,t)=>e+(t.width||120),0),z=l.useRef(null),A=l.useRef(null),E=l.useRef(!1);l.useEffect(()=>{const e=z.current,t=A.current;if(!e||!t)return;const s=(c,i)=>()=>{E.current||(E.current=!0,i.scrollTop=c.scrollTop,requestAnimationFrame(()=>{E.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]),T=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=()=>C(null);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[f,o,u,x]);const B=l.useCallback((e,t,s)=>{if(!D||!x)return;s.stopPropagation();const n=u.find(r=>r.id===e);n&&C({taskId:e,mode:t,startX:s.clientX,origStart:new Date(n.start),origEnd:new Date(n.end)})},[D,u,x]),H=l.useCallback(()=>R(e=>Math.min(100,e+5)),[]),U=l.useCallback(()=>R(e=>Math.max(8,e-5)),[]),ee=()=>{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})]})},te=(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",{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:()=>Q?.(e),onMouseDown:D?h=>B(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=>B(e.id,"resize",h)})]},e.id)},ne=(e,t,s,n,r)=>{const h=e+10,y=s-14,S=(t+n)/2,w=n>=t?1:-1,q=Math.abs(n-t)<1,X=y<=h+4,b=q?t:S,g=X?Math.max(h,e+10):h,v=X?Math.min(y,s-10):y;if(q||!r)return[`M ${e} ${t}`,`L ${g} ${t}`,`L ${g} ${b}`,`L ${v} ${b}`,`L ${v} ${n}`,`L ${s} ${n}`].join(" ");const ae=Math.max(0,v-g),re=Math.abs(n-t),ie=Math.min(re/2||10,ae/2||10),$=Math.max(2,Math.min(10,ie));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(" ")},se=()=>{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,S=M(m.start,new Date(s.start))*o,w=c*_+_/2;e.push(a.jsx("path",{d:ne(h,y,S,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:T,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 Z?null:a.jsxs("div",{className:`nice-gantt ${J||""}`,style:k,children:[G&&a.jsxs("div",{className:"nice-gantt__zoom-controls",children:[a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:U,children:"−"}),a.jsxs("span",{className:"nice-gantt__zoom-label",children:[o,"px"]}),a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:H,children:"+"})]}),a.jsxs("div",{className:"nice-gantt__container",children:[a.jsxs("div",{className:"nice-gantt__table",style:{width:W,minWidth:W},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:L.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:z,children:d.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-row",style:{height:_},children:L.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:A,children:[ee(),a.jsxs("div",{className:"nice-gantt__chart-body",style:{width:T,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)=>te(e,t)),se()]})]})})]})]})};process.env.NODE_ENV!=="production"&&(O.displayName="NiceGantt");exports.NiceGantt=O;
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { jsxs as l, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as F, useNiceAccessMode as me } from "@nice2dev/ui-core";
|
|
3
|
+
import { useState as J, useRef as R, useEffect as O, useMemo as P, useCallback as z } from "react";
|
|
4
|
+
const ue = [], b = (m, D) => {
|
|
5
|
+
const y = new Date(m);
|
|
6
|
+
return y.setDate(y.getDate() + D), y;
|
|
7
|
+
}, E = (m, D) => Math.ceil((D.getTime() - m.getTime()) / 864e5), _e = ({
|
|
8
|
+
tasks: m = ue,
|
|
9
|
+
columns: D,
|
|
10
|
+
scale: y = "day",
|
|
11
|
+
rowHeight: _ = 36,
|
|
12
|
+
dayWidth: q = 30,
|
|
13
|
+
onTaskClick: G,
|
|
14
|
+
onTaskUpdate: w,
|
|
15
|
+
showDependencies: K = !0,
|
|
16
|
+
dependencyStyle: V = "square",
|
|
17
|
+
draggable: M,
|
|
18
|
+
zoomControls: k,
|
|
19
|
+
className: Z,
|
|
20
|
+
style: H,
|
|
21
|
+
accessMode: U,
|
|
22
|
+
id: ee
|
|
23
|
+
}) => {
|
|
24
|
+
const { t: te } = F(), ne = me(U, ee) === "hidden", { t: ge } = F(), [o, A] = J(q), [f, C] = J(null), x = D || [
|
|
25
|
+
{ field: "title", title: te("gantt.task", "Task"), width: 200 }
|
|
26
|
+
], B = x.reduce((e, t) => e + (t.width || 120), 0), T = R(null), j = R(null), S = R(!1);
|
|
27
|
+
O(() => {
|
|
28
|
+
const e = T.current, t = j.current;
|
|
29
|
+
if (!e || !t)
|
|
30
|
+
return;
|
|
31
|
+
const a = (c, i) => () => {
|
|
32
|
+
S.current || (S.current = !0, i.scrollTop = c.scrollTop, requestAnimationFrame(() => {
|
|
33
|
+
S.current = !1;
|
|
34
|
+
}));
|
|
35
|
+
}, n = a(e, t), r = a(t, e);
|
|
36
|
+
return e.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("scroll", r, { passive: !0 }), () => {
|
|
37
|
+
e.removeEventListener("scroll", n), t.removeEventListener("scroll", r);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const d = P(() => {
|
|
41
|
+
const e = (t) => m.filter((n) => (n.parentId ?? null) === t).flatMap((n) => [n, ...e(n.id)]);
|
|
42
|
+
return e(null);
|
|
43
|
+
}, [m]), u = P(() => {
|
|
44
|
+
if (d.length === 0)
|
|
45
|
+
return { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date(), days: 30 };
|
|
46
|
+
let e = new Date(d[0].start), t = new Date(d[0].end);
|
|
47
|
+
return d.forEach((a) => {
|
|
48
|
+
new Date(a.start) < e && (e = new Date(a.start)), new Date(a.end) > t && (t = new Date(a.end));
|
|
49
|
+
}), e = b(e, -2), t = b(t, 2), { start: e, end: t, days: E(e, t) };
|
|
50
|
+
}, [d]), X = u.days * o;
|
|
51
|
+
O(() => {
|
|
52
|
+
if (!f || !w)
|
|
53
|
+
return;
|
|
54
|
+
const e = (a) => {
|
|
55
|
+
const n = a.clientX - f.startX, r = Math.round(n / o);
|
|
56
|
+
if (r === 0)
|
|
57
|
+
return;
|
|
58
|
+
const c = m.find((i) => i.id === f.taskId);
|
|
59
|
+
if (c)
|
|
60
|
+
if (f.mode === "move")
|
|
61
|
+
w({
|
|
62
|
+
...c,
|
|
63
|
+
start: b(f.origStart, r),
|
|
64
|
+
end: b(f.origEnd, r)
|
|
65
|
+
});
|
|
66
|
+
else {
|
|
67
|
+
const i = b(f.origEnd, r);
|
|
68
|
+
i > f.origStart && w({ ...c, end: i });
|
|
69
|
+
}
|
|
70
|
+
}, t = () => C(null);
|
|
71
|
+
return document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), () => {
|
|
72
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t);
|
|
73
|
+
};
|
|
74
|
+
}, [f, o, m, w]);
|
|
75
|
+
const I = z(
|
|
76
|
+
(e, t, a) => {
|
|
77
|
+
if (!M || !w)
|
|
78
|
+
return;
|
|
79
|
+
a.stopPropagation();
|
|
80
|
+
const n = m.find((r) => r.id === e);
|
|
81
|
+
n && C({
|
|
82
|
+
taskId: e,
|
|
83
|
+
mode: t,
|
|
84
|
+
startX: a.clientX,
|
|
85
|
+
origStart: new Date(n.start),
|
|
86
|
+
origEnd: new Date(n.end)
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
[M, m, w]
|
|
90
|
+
), ae = z(() => A((e) => Math.min(100, e + 5)), []), re = z(() => A((e) => Math.max(8, e - 5)), []), se = () => {
|
|
91
|
+
const e = [], t = [];
|
|
92
|
+
new Date(u.start);
|
|
93
|
+
const a = [
|
|
94
|
+
"Jan",
|
|
95
|
+
"Feb",
|
|
96
|
+
"Mar",
|
|
97
|
+
"Apr",
|
|
98
|
+
"May",
|
|
99
|
+
"Jun",
|
|
100
|
+
"Jul",
|
|
101
|
+
"Aug",
|
|
102
|
+
"Sep",
|
|
103
|
+
"Oct",
|
|
104
|
+
"Nov",
|
|
105
|
+
"Dec"
|
|
106
|
+
];
|
|
107
|
+
if (y === "day") {
|
|
108
|
+
let n = -1, r = 0;
|
|
109
|
+
for (let c = 0; c < u.days; c++) {
|
|
110
|
+
const i = b(u.start, c);
|
|
111
|
+
i.getMonth() !== n && (n >= 0 && e.push(
|
|
112
|
+
/* @__PURE__ */ l(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: "nice-gantt__header-cell",
|
|
116
|
+
style: { width: (c - r) * o },
|
|
117
|
+
children: [
|
|
118
|
+
a[n],
|
|
119
|
+
" ",
|
|
120
|
+
i.getFullYear()
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
`m${n}-${r}`
|
|
124
|
+
)
|
|
125
|
+
), n = i.getMonth(), r = c);
|
|
126
|
+
const h = i.getDay() === 0 || i.getDay() === 6;
|
|
127
|
+
t.push(
|
|
128
|
+
/* @__PURE__ */ s(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: `nice-gantt__header-cell nice-gantt__header-cell--sub ${h ? "nice-gantt__header-cell--weekend" : ""}`,
|
|
132
|
+
style: { width: o },
|
|
133
|
+
children: i.getDate()
|
|
134
|
+
},
|
|
135
|
+
c
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
n >= 0 && e.push(
|
|
140
|
+
/* @__PURE__ */ s(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
className: "nice-gantt__header-cell",
|
|
144
|
+
style: { width: (u.days - r) * o },
|
|
145
|
+
children: a[n]
|
|
146
|
+
},
|
|
147
|
+
`m${n}-last`
|
|
148
|
+
)
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return /* @__PURE__ */ l("div", { className: "nice-gantt__chart-header", children: [
|
|
152
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: e }),
|
|
153
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: t })
|
|
154
|
+
] });
|
|
155
|
+
}, ie = (e, t) => {
|
|
156
|
+
const a = E(u.start, new Date(e.start)) * o, n = Math.max(E(new Date(e.start), new Date(e.end)) * o, o), r = t * _ + 4, c = _ - 8, i = e.progress ?? 0;
|
|
157
|
+
return /* @__PURE__ */ l(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
className: `nice-gantt__bar ${M ? "nice-gantt__bar--draggable" : ""}`,
|
|
161
|
+
title: `${e.title} (${Math.round(i)}%)`,
|
|
162
|
+
style: {
|
|
163
|
+
left: a,
|
|
164
|
+
top: r,
|
|
165
|
+
width: n,
|
|
166
|
+
height: c,
|
|
167
|
+
backgroundColor: e.color || "var(--nice-color-primary, #3b82f6)"
|
|
168
|
+
},
|
|
169
|
+
onClick: () => G?.(e),
|
|
170
|
+
onMouseDown: M ? (h) => I(e.id, "move", h) : void 0,
|
|
171
|
+
children: [
|
|
172
|
+
i > 0 && /* @__PURE__ */ s("div", { className: "nice-gantt__bar-progress", style: { width: `${i}%` } }),
|
|
173
|
+
/* @__PURE__ */ s("span", { className: "nice-gantt__bar-label", children: e.title }),
|
|
174
|
+
M && /* @__PURE__ */ s(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
className: "nice-gantt__bar-resize",
|
|
178
|
+
onMouseDown: (h) => I(e.id, "resize", h)
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
e.id
|
|
184
|
+
);
|
|
185
|
+
}, ce = (e, t, a, n, r) => {
|
|
186
|
+
const h = e + 10, L = a - 14, W = (t + n) / 2, N = n >= t ? 1 : -1, Q = Math.abs(n - t) < 1, Y = L <= h + 4, p = Q ? t : W, g = Y ? Math.max(h, e + 10) : h, v = Y ? Math.min(L, a - 10) : L;
|
|
187
|
+
if (Q || !r)
|
|
188
|
+
return [
|
|
189
|
+
`M ${e} ${t}`,
|
|
190
|
+
`L ${g} ${t}`,
|
|
191
|
+
`L ${g} ${p}`,
|
|
192
|
+
`L ${v} ${p}`,
|
|
193
|
+
`L ${v} ${n}`,
|
|
194
|
+
`L ${a} ${n}`
|
|
195
|
+
].join(" ");
|
|
196
|
+
const de = Math.max(0, v - g), le = Math.abs(n - t), he = Math.min(le / 2 || 10, de / 2 || 10), $ = Math.max(2, Math.min(10, he));
|
|
197
|
+
return [
|
|
198
|
+
`M ${e} ${t}`,
|
|
199
|
+
`L ${g - $} ${t}`,
|
|
200
|
+
`Q ${g} ${t} ${g} ${t + N * $}`,
|
|
201
|
+
`L ${g} ${p - N * $}`,
|
|
202
|
+
`Q ${g} ${p} ${g + $} ${p}`,
|
|
203
|
+
`L ${v - $} ${p}`,
|
|
204
|
+
`Q ${v} ${p} ${v} ${p + N * $}`,
|
|
205
|
+
`L ${v} ${n - N * $}`,
|
|
206
|
+
`Q ${v} ${n} ${v + $} ${n}`,
|
|
207
|
+
`L ${a} ${n}`
|
|
208
|
+
].join(" ");
|
|
209
|
+
}, oe = () => {
|
|
210
|
+
if (!K)
|
|
211
|
+
return null;
|
|
212
|
+
const e = [], t = new Map(d.map((a, n) => [a.id, n]));
|
|
213
|
+
return d.forEach((a) => {
|
|
214
|
+
(a.dependencies || []).forEach((n) => {
|
|
215
|
+
const r = t.get(n), c = t.get(a.id);
|
|
216
|
+
if (r == null || c == null)
|
|
217
|
+
return;
|
|
218
|
+
const i = d[r], h = E(u.start, new Date(i.end)) * o, L = r * _ + _ / 2, W = E(u.start, new Date(a.start)) * o, N = c * _ + _ / 2;
|
|
219
|
+
e.push(
|
|
220
|
+
/* @__PURE__ */ s(
|
|
221
|
+
"path",
|
|
222
|
+
{
|
|
223
|
+
d: ce(h, L, W, N, V === "rounded"),
|
|
224
|
+
fill: "none",
|
|
225
|
+
stroke: "var(--nice-text-secondary, #6b7280)",
|
|
226
|
+
strokeWidth: 1.5,
|
|
227
|
+
strokeLinejoin: "round",
|
|
228
|
+
strokeLinecap: "round",
|
|
229
|
+
markerEnd: "url(#arrowhead)"
|
|
230
|
+
},
|
|
231
|
+
`${n}-${a.id}`
|
|
232
|
+
)
|
|
233
|
+
);
|
|
234
|
+
});
|
|
235
|
+
}), /* @__PURE__ */ l(
|
|
236
|
+
"svg",
|
|
237
|
+
{
|
|
238
|
+
className: "nice-gantt__deps",
|
|
239
|
+
width: X,
|
|
240
|
+
height: d.length * _,
|
|
241
|
+
style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" },
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ s("defs", { children: /* @__PURE__ */ s("marker", { id: "arrowhead", markerWidth: "6", markerHeight: "4", refX: "5", refY: "2", orient: "auto", children: /* @__PURE__ */ s("polygon", { points: "0 0, 6 2, 0 4", fill: "var(--nice-text-secondary, #6b7280)" }) }) }),
|
|
244
|
+
e
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
return ne ? null : /* @__PURE__ */ l("div", { className: `nice-gantt ${Z || ""}`, style: H, children: [
|
|
250
|
+
k && /* @__PURE__ */ l("div", { className: "nice-gantt__zoom-controls", children: [
|
|
251
|
+
/* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: re, children: "−" }),
|
|
252
|
+
/* @__PURE__ */ l("span", { className: "nice-gantt__zoom-label", children: [
|
|
253
|
+
o,
|
|
254
|
+
"px"
|
|
255
|
+
] }),
|
|
256
|
+
/* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: ae, children: "+" })
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ l("div", { className: "nice-gantt__container", children: [
|
|
259
|
+
/* @__PURE__ */ l("div", { className: "nice-gantt__table", style: { width: B, minWidth: B }, children: [
|
|
260
|
+
/* @__PURE__ */ l("div", { className: "nice-gantt__table-header", children: [
|
|
261
|
+
/* @__PURE__ */ s(
|
|
262
|
+
"div",
|
|
263
|
+
{
|
|
264
|
+
className: "nice-gantt__table-header-row nice-gantt__table-header-row--main",
|
|
265
|
+
"aria-hidden": "true",
|
|
266
|
+
children: " "
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__table-header-row nice-gantt__table-header-row--sub", children: x.map((e, t) => /* @__PURE__ */ s(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
className: "nice-gantt__table-header-cell",
|
|
273
|
+
style: { width: e.width || 120 },
|
|
274
|
+
children: e.title
|
|
275
|
+
},
|
|
276
|
+
t
|
|
277
|
+
)) })
|
|
278
|
+
] }),
|
|
279
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__table-body", ref: T, children: d.map((e, t) => /* @__PURE__ */ s("div", { className: "nice-gantt__table-row", style: { height: _ }, children: x.map((a, n) => /* @__PURE__ */ s(
|
|
280
|
+
"div",
|
|
281
|
+
{
|
|
282
|
+
className: "nice-gantt__table-cell",
|
|
283
|
+
style: { width: a.width || 120 },
|
|
284
|
+
children: e[a.field]
|
|
285
|
+
},
|
|
286
|
+
n
|
|
287
|
+
)) }, e.id)) })
|
|
288
|
+
] }),
|
|
289
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__chart", children: /* @__PURE__ */ l("div", { className: "nice-gantt__chart-body-wrap", ref: j, children: [
|
|
290
|
+
se(),
|
|
291
|
+
/* @__PURE__ */ l(
|
|
292
|
+
"div",
|
|
293
|
+
{
|
|
294
|
+
className: "nice-gantt__chart-body",
|
|
295
|
+
style: {
|
|
296
|
+
width: X,
|
|
297
|
+
height: d.length * _,
|
|
298
|
+
position: "relative"
|
|
299
|
+
},
|
|
300
|
+
children: [
|
|
301
|
+
Array.from({ length: u.days }, (e, t) => {
|
|
302
|
+
const a = b(u.start, t), n = a.getDay() === 0 || a.getDay() === 6;
|
|
303
|
+
return /* @__PURE__ */ s(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
className: `nice-gantt__gridline ${n ? "nice-gantt__gridline--weekend" : ""}`,
|
|
307
|
+
style: {
|
|
308
|
+
left: t * o,
|
|
309
|
+
width: o,
|
|
310
|
+
height: "100%",
|
|
311
|
+
position: "absolute",
|
|
312
|
+
top: 0
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
t
|
|
316
|
+
);
|
|
317
|
+
}),
|
|
318
|
+
d.map((e, t) => ie(e, t)),
|
|
319
|
+
oe()
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
] }) })
|
|
324
|
+
] })
|
|
325
|
+
] });
|
|
326
|
+
};
|
|
327
|
+
process.env.NODE_ENV !== "production" && (_e.displayName = "NiceGantt");
|
|
328
|
+
export {
|
|
329
|
+
_e as NiceGantt
|
|
330
|
+
};
|