@diagrammo/dgmo 0.46.0 → 0.48.0
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/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70107
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.js +1 -1
- package/dist/auto.mjs +1 -1
- package/dist/block.js +83 -69417
- package/dist/calculator-LDYQCDDY.js +11 -0
- package/dist/charts-d3-QOZHKTCT.js +25 -0
- package/dist/chunk-2DXMZRWJ.js +800 -0
- package/dist/chunk-2LACINWN.js +786 -0
- package/dist/chunk-33LCUH4H.js +893 -0
- package/dist/chunk-3CIOJ5YJ.js +35 -0
- package/dist/chunk-3HDBAXF5.js +86 -0
- package/dist/chunk-3JLKYGBQ.js +290 -0
- package/dist/chunk-3MQQNXPD.js +415 -0
- package/dist/chunk-3R5POCTZ.js +967 -0
- package/dist/chunk-3SMGIJDD.js +112 -0
- package/dist/chunk-44CM72SQ.js +409 -0
- package/dist/chunk-4GRI7MEB.js +1604 -0
- package/dist/chunk-4OHACBGX.js +606 -0
- package/dist/chunk-5DH3KYFH.js +21 -0
- package/dist/chunk-5MLYVTYM.js +76 -0
- package/dist/chunk-5QXL4NYS.js +553 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EK55ART.js +117 -0
- package/dist/chunk-6FZYCKXB.js +2065 -0
- package/dist/chunk-6HO5ZTXK.js +277 -0
- package/dist/chunk-6KFWC4CO.js +7 -0
- package/dist/chunk-6MTWIQVO.js +121 -0
- package/dist/chunk-6NYWYNBI.js +329 -0
- package/dist/chunk-6SM5NJQH.js +620 -0
- package/dist/chunk-725LDASD.js +422 -0
- package/dist/chunk-76OWZ3BA.js +130 -0
- package/{src/block/parser.ts → dist/chunk-7JEGTRLD.js} +100 -189
- package/dist/chunk-A44USUV7.js +923 -0
- package/dist/chunk-A4GOY3PE.js +25 -0
- package/dist/chunk-A4VFQH5G.js +251 -0
- package/dist/chunk-AELOBFW5.js +375 -0
- package/dist/chunk-AN2MOO5T.js +522 -0
- package/dist/chunk-BMR4CIEO.js +41 -0
- package/dist/chunk-BS7SV7C3.js +51 -0
- package/dist/chunk-BUPDIHML.js +613 -0
- package/dist/chunk-BUVJFRPY.js +887 -0
- package/dist/chunk-C3Z4DX3V.js +112 -0
- package/dist/chunk-CI2G3OEB.js +1818 -0
- package/dist/chunk-CKNVO24D.js +54 -0
- package/dist/chunk-CUVHQHZ7.js +391 -0
- package/dist/chunk-CXK4DZH3.js +114 -0
- package/dist/{editor.cjs → chunk-DKEPS5LH.js} +14 -225
- package/dist/chunk-DU7W62N5.js +487 -0
- package/dist/chunk-DZAQBW35.js +751 -0
- package/dist/chunk-EB6FPQUP.js +316 -0
- package/dist/chunk-EMS2SK26.js +376 -0
- package/dist/chunk-ERLBPDGU.js +510 -0
- package/dist/chunk-EVCVDTXE.js +732 -0
- package/dist/chunk-FCIIHT24.js +384 -0
- package/dist/chunk-FFUN5D66.js +97 -0
- package/dist/chunk-FITOLXSX.js +714 -0
- package/dist/chunk-FMDSF3OV.js +68 -0
- package/dist/chunk-FNB3PNGF.js +410 -0
- package/dist/chunk-G2H74XJZ.js +2104 -0
- package/dist/chunk-GMR5MFHJ.js +339 -0
- package/dist/chunk-H6PI3KJT.js +305 -0
- package/dist/chunk-I46X5VUA.js +59 -0
- package/dist/chunk-I5IGB56C.js +255 -0
- package/dist/chunk-IH6ZMVQ5.js +3950 -0
- package/dist/chunk-IJZFN3HM.js +463 -0
- package/dist/chunk-IPWPWM6R.js +3079 -0
- package/dist/chunk-IYULMRBE.js +23 -0
- package/dist/chunk-IZMRON6C.js +167 -0
- package/dist/chunk-J5FIXQRT.js +813 -0
- package/dist/chunk-JED6ZDEE.js +73 -0
- package/dist/chunk-JEUJOX5X.js +136 -0
- package/dist/chunk-JM4LEPY3.js +436 -0
- package/dist/chunk-L3UHP6TD.js +101 -0
- package/dist/chunk-L66GEFB6.js +524 -0
- package/dist/chunk-LIOHW36Z.js +469 -0
- package/dist/chunk-LP7EC4MI.js +16 -0
- package/dist/chunk-MITI6NOL.js +548 -0
- package/dist/chunk-MO5YHHMQ.js +168 -0
- package/dist/chunk-MZSBFAPJ.js +885 -0
- package/dist/chunk-NNAAJVBU.js +9 -0
- package/dist/chunk-NOTA6TEI.js +47 -0
- package/dist/chunk-NURGB5Z4.js +335 -0
- package/dist/chunk-NX4EQS3U.js +1062 -0
- package/dist/chunk-NXMESY4J.js +1 -0
- package/dist/chunk-OJR3MQYV.js +1458 -0
- package/dist/chunk-OURHMODR.js +454 -0
- package/dist/chunk-P235SVAH.js +1057 -0
- package/dist/chunk-P4RH4OSP.js +1038 -0
- package/dist/chunk-P6T66CCZ.js +226 -0
- package/dist/chunk-PBAHEPLQ.js +223 -0
- package/dist/chunk-PBHE5UG6.js +1530 -0
- package/dist/chunk-PDKUANDZ.js +35 -0
- package/dist/chunk-PWIHZ6NJ.js +296 -0
- package/{src/c4/layout.ts → dist/chunk-QEBUY5NY.js} +384 -1140
- package/dist/chunk-QLCCJEJI.js +253 -0
- package/dist/chunk-QOOUC2J5.js +52 -0
- package/dist/chunk-QYTPPDAO.js +402 -0
- package/dist/chunk-R3XI2VC7.js +801 -0
- package/dist/chunk-RCERWOJR.js +154 -0
- package/dist/chunk-RJE5JTVK.js +362 -0
- package/dist/chunk-RTLBSQ3G.js +1155 -0
- package/dist/chunk-RUNNI6VE.js +448 -0
- package/dist/chunk-RVMRZAPB.js +354 -0
- package/dist/chunk-RYEGFMUO.js +955 -0
- package/dist/chunk-RZCF2VVM.js +528 -0
- package/dist/chunk-SML67VPV.js +1025 -0
- package/dist/chunk-SQ7IY53Q.js +44 -0
- package/dist/chunk-SQAG3UXH.js +161 -0
- package/dist/chunk-SRTU6HMQ.js +1851 -0
- package/dist/chunk-T2OE3YQB.js +550 -0
- package/dist/chunk-T3UBLACL.js +299 -0
- package/dist/chunk-TLVIHFRO.js +296 -0
- package/dist/chunk-TYS6CSS5.js +52 -0
- package/dist/chunk-U6EQI3U6.js +130 -0
- package/dist/chunk-UJ4FJLBF.js +86 -0
- package/dist/chunk-ULOEATBZ.js +347 -0
- package/dist/chunk-UNCCZ3NU.js +127 -0
- package/dist/chunk-USZW2HHU.js +197 -0
- package/dist/chunk-UWN33VNX.js +1610 -0
- package/dist/chunk-UZ7EZW3B.js +40 -0
- package/dist/chunk-VOKGH627.js +37 -0
- package/dist/chunk-WBRZJOEC.js +204 -0
- package/dist/chunk-WCSOJFU3.js +380 -0
- package/dist/chunk-WCT3NYCV.js +160 -0
- package/dist/chunk-WVAJFAIA.js +529 -0
- package/dist/chunk-X5LCYCL5.js +394 -0
- package/dist/chunk-XAKEUMEJ.js +1256 -0
- package/dist/chunk-Y2ZE3MSG.js +590 -0
- package/dist/chunk-Y3J7VR52.js +646 -0
- package/dist/chunk-Y5QGVTVC.js +33 -0
- package/dist/chunk-YAA6IID3.js +548 -0
- package/dist/chunk-YGJTDXVR.js +692 -0
- package/{src/utils/time-ticks.ts → dist/chunk-YRYKTYMQ.js} +45 -112
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/{src/gantt/calculator.ts → dist/chunk-Z72XRXD4.js} +236 -428
- package/dist/chunk-ZGR7ULFJ.js +978 -0
- package/dist/chunk-ZJEL4H2R.js +851 -0
- package/dist/chunk-ZO27FGJS.js +554 -0
- package/dist/collapse-CLPJD2RL.js +11 -0
- package/dist/collapse-SLINJQW6.js +9 -0
- package/dist/collapse-ZWUFFCK2.js +9 -0
- package/dist/compute-G55RG53N.js +8 -0
- package/dist/dgmo-router-DZCIDUO5.js +73 -0
- package/dist/dimensions-J3FHIMJ6.js +22 -0
- package/dist/element.js +1 -1
- package/dist/element.mjs +1 -1
- package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
- package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
- package/dist/index.d.ts +3 -469
- package/dist/index.js +137 -69685
- package/dist/layout-46N4JJYK.js +17 -0
- package/dist/layout-5RA6QWR6.js +26 -0
- package/dist/layout-5T6RH5M6.js +14 -0
- package/dist/layout-7QXCNOVS.js +13 -0
- package/dist/layout-EE6GE46Y.js +17 -0
- package/dist/layout-G23F7LDH.js +9 -0
- package/dist/layout-HRBZPFCN.js +23 -0
- package/dist/layout-HWDSRX5E.js +20 -0
- package/dist/layout-HYZPWAK5.js +18 -0
- package/dist/layout-N76NR4ZO.js +19 -0
- package/dist/layout-OB3RI63S.js +14 -0
- package/dist/layout-S2QBYSK2.js +15 -0
- package/dist/layout-UM5F4DJB.js +15 -0
- package/dist/layout-search-OYV77HHS.js +1655 -0
- package/dist/load-data-EHDDZ5ZS.js +8 -0
- package/dist/palettes-PRJ2RI6D.js +56 -0
- package/dist/parser-2MFP2H2E.js +11 -0
- package/dist/parser-3STE62GB.js +21 -0
- package/dist/parser-4FL2CMDG.js +18 -0
- package/dist/parser-4OGOBJJ4.js +13 -0
- package/dist/parser-6BTRLKRZ.js +15 -0
- package/dist/parser-AQETEVRW.js +21 -0
- package/dist/parser-CFZD5IBL.js +12 -0
- package/dist/parser-FUSKFGZN.js +16 -0
- package/dist/parser-I6KXEYFK.js +13 -0
- package/dist/parser-IXSZZQHY.js +18 -0
- package/dist/parser-JAL2HD4I.js +13 -0
- package/dist/parser-KNSQSKQO.js +20 -0
- package/dist/parser-N5O4IHUN.js +13 -0
- package/dist/parser-NGU3ETO6.js +16 -0
- package/dist/parser-NRAI6O25.js +19 -0
- package/dist/parser-O5J4VBII.js +11 -0
- package/dist/parser-OV7NOBW6.js +21 -0
- package/dist/parser-PQ3POX45.js +23 -0
- package/dist/parser-TFZFBVWN.js +11 -0
- package/dist/parser-TRTHDFPP.js +18 -0
- package/dist/parser-VQP2UJ6W.js +11 -0
- package/dist/parser-XDVELHRK.js +13 -0
- package/dist/parser-XKRP7QKP.js +11 -0
- package/dist/parser-Y6WTBU76.js +14 -0
- package/dist/parser-ZSDPZYQP.js +12 -0
- package/dist/renderer-2XQQQ6QR.js +28 -0
- package/dist/renderer-5NDVNDAZ.js +26 -0
- package/dist/renderer-6EEZHMH4.js +26 -0
- package/dist/renderer-6W5462RB.js +43 -0
- package/dist/renderer-7MVLWWQD.js +22 -0
- package/dist/renderer-AWWAF6XD.js +33 -0
- package/dist/renderer-BYCNMBF7.js +34 -0
- package/dist/renderer-CLJHQPBJ.js +29 -0
- package/dist/renderer-GHPZMFU2.js +15 -0
- package/dist/renderer-JGBKUCZD.js +16 -0
- package/dist/renderer-KQB7UGDS.js +19 -0
- package/dist/renderer-PGX2TKVS.js +24 -0
- package/dist/renderer-QIWVHWZO.js +15 -0
- package/dist/renderer-RPOA5YPZ.js +35 -0
- package/dist/renderer-SMIBCRVB.js +24 -0
- package/dist/renderer-T7YKC5VP.js +28 -0
- package/dist/renderer-TOCOVLHS.js +37 -0
- package/dist/renderer-UWA5XS74.js +39 -0
- package/dist/renderer-VACVQYML.js +25 -0
- package/dist/renderer-W4M6QLIJ.js +37 -0
- package/dist/renderer-WZRREQ2P.js +23 -0
- package/dist/renderer-YY2OSF6E.js +27 -0
- package/dist/renderer-Z7I3W2PP.js +24 -0
- package/dist/renderer-ZGNTUWC4.js +22 -0
- package/dist/renderer-ZTR3DER3.js +19 -0
- package/dist/renderer-radial-C32GPJQ7.js +21 -0
- package/dist/resolver-NOAA7ID7.js +13 -0
- package/dist/state-collapse-HCGD6IVJ.js +8 -0
- package/dist/state-parser-Z2V23ATR.js +18 -0
- package/dist/state-renderer-RFYHSP4K.js +34 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +19 -70
- package/dist/advanced.cjs +0 -71648
- package/dist/advanced.d.cts +0 -6571
- package/dist/auto.cjs +0 -70648
- package/dist/auto.d.cts +0 -54
- package/dist/block.cjs +0 -70208
- package/dist/block.d.cts +0 -115
- package/dist/editor.d.cts +0 -26
- package/dist/element.cjs +0 -70530
- package/dist/element.d.cts +0 -62
- package/dist/highlight.cjs +0 -852
- package/dist/highlight.d.cts +0 -49
- package/dist/index.cjs +0 -70491
- package/dist/index.d.cts +0 -626
- package/dist/pert.cjs +0 -325
- package/dist/pert.d.cts +0 -559
- package/src/advanced.ts +0 -873
- package/src/arc/parser.ts +0 -15
- package/src/arc/renderer.ts +0 -633
- package/src/auto/index.ts +0 -621
- package/src/auto/shared.ts +0 -370
- package/src/auto/styles.ts +0 -73
- package/src/block/layout.ts +0 -198
- package/src/block/renderer.ts +0 -484
- package/src/block/types.ts +0 -67
- package/src/boxes-and-lines/collapse.ts +0 -96
- package/src/boxes-and-lines/focus.ts +0 -257
- package/src/boxes-and-lines/label-placement.ts +0 -339
- package/src/boxes-and-lines/layout-grouped.ts +0 -912
- package/src/boxes-and-lines/layout-layered.ts +0 -722
- package/src/boxes-and-lines/layout-search.ts +0 -1678
- package/src/boxes-and-lines/layout.ts +0 -398
- package/src/boxes-and-lines/parser.ts +0 -1181
- package/src/boxes-and-lines/renderer.ts +0 -1465
- package/src/boxes-and-lines/types.ts +0 -66
- package/src/c4/parser.ts +0 -1158
- package/src/c4/renderer.ts +0 -2008
- package/src/c4/types.ts +0 -89
- package/src/chart-type-registry.ts +0 -529
- package/src/chart-types.ts +0 -225
- package/src/chart.ts +0 -685
- package/src/charts-d3/bar.ts +0 -338
- package/src/charts-d3/chord.ts +0 -140
- package/src/charts-d3/function.ts +0 -147
- package/src/charts-d3/funnel.ts +0 -104
- package/src/charts-d3/heatmap.ts +0 -145
- package/src/charts-d3/index.ts +0 -337
- package/src/charts-d3/interactions.ts +0 -477
- package/src/charts-d3/line.ts +0 -344
- package/src/charts-d3/mount.ts +0 -151
- package/src/charts-d3/pie.ts +0 -117
- package/src/charts-d3/polar.ts +0 -89
- package/src/charts-d3/radar.ts +0 -0
- package/src/charts-d3/sankey.ts +0 -0
- package/src/charts-d3/scatter.ts +0 -185
- package/src/charts-d3/shared.ts +0 -208
- package/src/class/layout.ts +0 -326
- package/src/class/parser.ts +0 -635
- package/src/class/renderer.ts +0 -793
- package/src/class/types.ts +0 -58
- package/src/cli-banner.ts +0 -106
- package/src/cli.ts +0 -1080
- package/src/colors-diagnostics.ts +0 -35
- package/src/colors.ts +0 -379
- package/src/completion-types.ts +0 -27
- package/src/completion.ts +0 -2668
- package/src/cycle/layout.ts +0 -1026
- package/src/cycle/parser.ts +0 -387
- package/src/cycle/renderer.ts +0 -653
- package/src/cycle/types.ts +0 -101
- package/src/d3.ts +0 -1434
- package/src/data-chart-parser.ts +0 -1007
- package/src/dgmo-router.ts +0 -296
- package/src/diagnostics-registry.ts +0 -108
- package/src/diagnostics.ts +0 -0
- package/src/dimensions.ts +0 -20
- package/src/directives-registry.ts +0 -396
- package/src/editor/dgmo.grammar +0 -76
- package/src/editor/dgmo.grammar.d.ts +0 -2
- package/src/editor/dgmo.grammar.js +0 -18
- package/src/editor/dgmo.grammar.terms.d.ts +0 -5
- package/src/editor/dgmo.grammar.terms.js +0 -35
- package/src/editor/highlight-api.ts +0 -596
- package/src/editor/highlight.ts +0 -36
- package/src/editor/index.ts +0 -27
- package/src/editor/keywords.ts +0 -128
- package/src/editor/tokens.ts +0 -30
- package/src/element/index.ts +0 -432
- package/src/embed/css.ts +0 -312
- package/src/embed/escape.ts +0 -15
- package/src/embed/index.ts +0 -280
- package/src/er/classify.ts +0 -228
- package/src/er/layout.ts +0 -530
- package/src/er/parser.ts +0 -750
- package/src/er/renderer.ts +0 -725
- package/src/er/types.ts +0 -52
- package/src/error-card.ts +0 -269
- package/src/event-line/diagnostics.ts +0 -117
- package/src/event-line/parser.ts +0 -643
- package/src/event-line/renderer.ts +0 -1742
- package/src/event-line/types.ts +0 -74
- package/src/fonts.ts +0 -3
- package/src/gantt/parser.ts +0 -1641
- package/src/gantt/renderer.ts +0 -3787
- package/src/gantt/resolver.ts +0 -172
- package/src/gantt/types.ts +0 -206
- package/src/graph/diagnostics.ts +0 -64
- package/src/graph/edge-spline.ts +0 -29
- package/src/graph/flowchart-parser.ts +0 -759
- package/src/graph/flowchart-renderer.ts +0 -817
- package/src/graph/layout.ts +0 -472
- package/src/graph/notes.ts +0 -21
- package/src/graph/state-collapse.ts +0 -78
- package/src/graph/state-parser.ts +0 -574
- package/src/graph/state-renderer.ts +0 -653
- package/src/graph/types.ts +0 -65
- package/src/index.ts +0 -261
- package/src/infra/compute.ts +0 -1385
- package/src/infra/layout.ts +0 -888
- package/src/infra/parser.ts +0 -1234
- package/src/infra/renderer.ts +0 -2534
- package/src/infra/roles.ts +0 -75
- package/src/infra/types.ts +0 -216
- package/src/infra/validation.ts +0 -201
- package/src/journey-map/layout.ts +0 -490
- package/src/journey-map/parser.ts +0 -557
- package/src/journey-map/renderer.ts +0 -1580
- package/src/journey-map/types.ts +0 -47
- package/src/kanban/mutations.ts +0 -175
- package/src/kanban/parser.ts +0 -509
- package/src/kanban/renderer.ts +0 -1449
- package/src/kanban/types.ts +0 -39
- package/src/label-layout.ts +0 -368
- package/src/map/colorize.ts +0 -54
- package/src/map/completion.ts +0 -316
- package/src/map/context-labels.ts +0 -609
- package/src/map/data/PROVENANCE.json +0 -1
- package/src/map/data/README.md +0 -40
- package/src/map/data/airport-collisions.json +0 -1
- package/src/map/data/airports.json +0 -1
- package/src/map/data/gazetteer.json +0 -1
- package/src/map/data/lakes.json +0 -1
- package/src/map/data/mountain-ranges.json +0 -1
- package/src/map/data/na-lakes.json +0 -1
- package/src/map/data/na-land.json +0 -1
- package/src/map/data/region-names.json +0 -1
- package/src/map/data/rivers.json +0 -1
- package/src/map/data/types.ts +0 -121
- package/src/map/data/us-states.json +0 -1
- package/src/map/data/water-bodies.json +0 -1
- package/src/map/data/world-coarse.json +0 -1
- package/src/map/data/world-detail.json +0 -1
- package/src/map/diagnostics.ts +0 -134
- package/src/map/dimensions.ts +0 -150
- package/src/map/geo-query.ts +0 -295
- package/src/map/geo.ts +0 -438
- package/src/map/invert.ts +0 -111
- package/src/map/layout.ts +0 -5069
- package/src/map/legend-band.ts +0 -127
- package/src/map/load-data.ts +0 -186
- package/src/map/parser.ts +0 -783
- package/src/map/renderer.ts +0 -1445
- package/src/map/resolved-types.ts +0 -160
- package/src/map/resolver.ts +0 -1146
- package/src/map/types.ts +0 -194
- package/src/mindmap/collapse.ts +0 -67
- package/src/mindmap/layout.ts +0 -649
- package/src/mindmap/parser.ts +0 -430
- package/src/mindmap/renderer.ts +0 -637
- package/src/mindmap/text-wrap.ts +0 -218
- package/src/mindmap/types.ts +0 -56
- package/src/org/collapse.ts +0 -151
- package/src/org/layout.ts +0 -1262
- package/src/org/parser.ts +0 -519
- package/src/org/renderer.ts +0 -866
- package/src/org/resolver.ts +0 -636
- package/src/palettes/atlas.ts +0 -77
- package/src/palettes/blueprint.ts +0 -73
- package/src/palettes/catppuccin.ts +0 -84
- package/src/palettes/color-utils.ts +0 -443
- package/src/palettes/index.ts +0 -67
- package/src/palettes/nord.ts +0 -67
- package/src/palettes/registry.ts +0 -114
- package/src/palettes/slate.ts +0 -73
- package/src/palettes/tidewater.ts +0 -73
- package/src/palettes/tokyo-night.ts +0 -86
- package/src/palettes/types.ts +0 -88
- package/src/pert/analyzer.ts +0 -1183
- package/src/pert/diagnostics.ts +0 -110
- package/src/pert/index.ts +0 -43
- package/src/pert/internal.ts +0 -252
- package/src/pert/layout.ts +0 -971
- package/src/pert/monte-carlo.ts +0 -446
- package/src/pert/parser.ts +0 -1606
- package/src/pert/renderer.ts +0 -4009
- package/src/pert/share-normalize.ts +0 -62
- package/src/pert/types.ts +0 -604
- package/src/pyramid/parser.ts +0 -185
- package/src/pyramid/renderer.ts +0 -768
- package/src/pyramid/types.ts +0 -28
- package/src/quadrant/parser.ts +0 -18
- package/src/quadrant/renderer.ts +0 -638
- package/src/raci/diagnostics.ts +0 -213
- package/src/raci/index.ts +0 -23
- package/src/raci/mutations.ts +0 -321
- package/src/raci/parser.ts +0 -699
- package/src/raci/renderer.ts +0 -1627
- package/src/raci/types.ts +0 -82
- package/src/raci/variants.ts +0 -320
- package/src/render.ts +0 -268
- package/src/ring/parser.ts +0 -212
- package/src/ring/renderer.ts +0 -490
- package/src/ring/types.ts +0 -27
- package/src/sequence/collapse.ts +0 -174
- package/src/sequence/parser.ts +0 -1596
- package/src/sequence/participant-inference.ts +0 -152
- package/src/sequence/renderer.ts +0 -3168
- package/src/sequence/tag-resolution.ts +0 -164
- package/src/sharing.ts +0 -211
- package/src/sitemap/collapse.ts +0 -100
- package/src/sitemap/layout.ts +0 -925
- package/src/sitemap/parser.ts +0 -755
- package/src/sitemap/renderer.ts +0 -828
- package/src/sitemap/types.ts +0 -42
- package/src/slope/parser.ts +0 -18
- package/src/slope/renderer.ts +0 -378
- package/src/swimlane/diagnostics.ts +0 -94
- package/src/swimlane/layout.ts +0 -597
- package/src/swimlane/parser.ts +0 -613
- package/src/swimlane/renderer.ts +0 -681
- package/src/swimlane/types.ts +0 -151
- package/src/tech-radar/interactive.ts +0 -1129
- package/src/tech-radar/layout.ts +0 -197
- package/src/tech-radar/parser.ts +0 -436
- package/src/tech-radar/renderer.ts +0 -1239
- package/src/tech-radar/shared.ts +0 -151
- package/src/tech-radar/types.ts +0 -86
- package/src/themes.ts +0 -22
- package/src/timeline/parser.ts +0 -472
- package/src/timeline/renderer.ts +0 -3024
- package/src/timeline/types.ts +0 -33
- package/src/timeline/viz-parser.ts +0 -21
- package/src/treemap/diagnostics.ts +0 -62
- package/src/treemap/layout-radial.ts +0 -233
- package/src/treemap/layout.ts +0 -189
- package/src/treemap/parser.ts +0 -463
- package/src/treemap/renderer-radial.ts +0 -438
- package/src/treemap/renderer.ts +0 -572
- package/src/treemap/treemap-shared.ts +0 -309
- package/src/treemap/types.ts +0 -60
- package/src/utils/arrow-markers.ts +0 -51
- package/src/utils/arrows-diagnostics.ts +0 -62
- package/src/utils/arrows.ts +0 -227
- package/src/utils/brand.ts +0 -61
- package/src/utils/card.ts +0 -183
- package/src/utils/collapse-engine/tree-edges.ts +0 -115
- package/src/utils/collapse-engine/tree.ts +0 -117
- package/src/utils/d3-helpers.ts +0 -219
- package/src/utils/d3-types.ts +0 -9
- package/src/utils/description-helpers.ts +0 -38
- package/src/utils/duration.ts +0 -312
- package/src/utils/export-container.ts +0 -41
- package/src/utils/expr-eval.ts +0 -27
- package/src/utils/fit-canvas.ts +0 -64
- package/src/utils/hover-styles.ts +0 -673
- package/src/utils/inline-markdown.ts +0 -96
- package/src/utils/legend-constants.ts +0 -48
- package/src/utils/legend-d3.ts +0 -618
- package/src/utils/legend-integration.ts +0 -107
- package/src/utils/legend-layout.ts +0 -776
- package/src/utils/legend-svg.ts +0 -214
- package/src/utils/legend-types.ts +0 -272
- package/src/utils/name-normalize.ts +0 -163
- package/src/utils/note-box/constants.ts +0 -25
- package/src/utils/note-box/index.ts +0 -11
- package/src/utils/note-box/metrics.ts +0 -90
- package/src/utils/note-box/svg.ts +0 -331
- package/src/utils/notes/bounds.ts +0 -30
- package/src/utils/notes/build.ts +0 -131
- package/src/utils/notes/index.ts +0 -18
- package/src/utils/notes/model.ts +0 -19
- package/src/utils/notes/parse.ts +0 -131
- package/src/utils/notes/place.ts +0 -177
- package/src/utils/notes/resolve.ts +0 -88
- package/src/utils/number-format.ts +0 -36
- package/src/utils/parsing.ts +0 -953
- package/src/utils/reserved-key-registry.ts +0 -239
- package/src/utils/safe-href.ts +0 -38
- package/src/utils/scaling.ts +0 -97
- package/src/utils/svg-embed.ts +0 -251
- package/src/utils/tag-groups.ts +0 -607
- package/src/utils/text-measure.ts +0 -122
- package/src/utils/title-constants.ts +0 -24
- package/src/utils/visual-conventions.ts +0 -61
- package/src/utils/wrapped-desc.ts +0 -87
- package/src/venn/parser.ts +0 -18
- package/src/venn/renderer.ts +0 -1047
- package/src/version-control/diagnostics.ts +0 -67
- package/src/version-control/parser.ts +0 -544
- package/src/version-control/renderer.ts +0 -724
- package/src/version-control/types.ts +0 -100
- package/src/visualizations/parse.ts +0 -1560
- package/src/visualizations/types.ts +0 -262
- package/src/wireframe/layout.ts +0 -479
- package/src/wireframe/parser.ts +0 -1114
- package/src/wireframe/renderer.ts +0 -1318
- package/src/wireframe/types.ts +0 -110
- package/src/wordcloud/parser.ts +0 -18
- package/src/wordcloud/renderer.ts +0 -357
|
@@ -0,0 +1,2104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MONTH_ABBR,
|
|
3
|
+
computeTimeTicks
|
|
4
|
+
} from "./chunk-YRYKTYMQ.js";
|
|
5
|
+
import {
|
|
6
|
+
renderIntegratedLegend
|
|
7
|
+
} from "./chunk-PWIHZ6NJ.js";
|
|
8
|
+
import {
|
|
9
|
+
ScaleContext
|
|
10
|
+
} from "./chunk-YYVTBZZC.js";
|
|
11
|
+
import {
|
|
12
|
+
controlsGroupCapsuleWidth,
|
|
13
|
+
getMaxLegendReservedHeight
|
|
14
|
+
} from "./chunk-YAA6IID3.js";
|
|
15
|
+
import {
|
|
16
|
+
TITLE_FONT_SIZE,
|
|
17
|
+
TITLE_FONT_WEIGHT,
|
|
18
|
+
TITLE_Y
|
|
19
|
+
} from "./chunk-A4GOY3PE.js";
|
|
20
|
+
import {
|
|
21
|
+
FONT_FAMILY
|
|
22
|
+
} from "./chunk-6KFWC4CO.js";
|
|
23
|
+
import {
|
|
24
|
+
LEGEND_CAPSULE_PAD,
|
|
25
|
+
LEGEND_DOT_R,
|
|
26
|
+
LEGEND_ENTRY_DOT_GAP,
|
|
27
|
+
LEGEND_ENTRY_FONT_SIZE,
|
|
28
|
+
LEGEND_ENTRY_TRAIL,
|
|
29
|
+
LEGEND_GEAR_PILL_W,
|
|
30
|
+
LEGEND_GROUP_GAP,
|
|
31
|
+
LEGEND_HEIGHT,
|
|
32
|
+
LEGEND_ICON_W,
|
|
33
|
+
LEGEND_PILL_FONT_SIZE,
|
|
34
|
+
LEGEND_PILL_PAD,
|
|
35
|
+
measureLegendText,
|
|
36
|
+
truncateLegendText
|
|
37
|
+
} from "./chunk-QOOUC2J5.js";
|
|
38
|
+
import {
|
|
39
|
+
CHAR_WIDTH_RATIO,
|
|
40
|
+
measureText,
|
|
41
|
+
truncateText
|
|
42
|
+
} from "./chunk-WCT3NYCV.js";
|
|
43
|
+
import {
|
|
44
|
+
contrastText,
|
|
45
|
+
getSeriesColors,
|
|
46
|
+
mix,
|
|
47
|
+
shapeFill
|
|
48
|
+
} from "./chunk-P6T66CCZ.js";
|
|
49
|
+
import {
|
|
50
|
+
resolveActiveTagGroup,
|
|
51
|
+
resolveTagColor,
|
|
52
|
+
tagAttrKey
|
|
53
|
+
} from "./chunk-QLCCJEJI.js";
|
|
54
|
+
import {
|
|
55
|
+
normalizeName
|
|
56
|
+
} from "./chunk-NOTA6TEI.js";
|
|
57
|
+
|
|
58
|
+
// src/gantt/renderer.ts
|
|
59
|
+
import * as d3Scale from "d3-scale";
|
|
60
|
+
import * as d3Selection from "d3-selection";
|
|
61
|
+
var BAR_H = 22;
|
|
62
|
+
var ROW_GAP = 6;
|
|
63
|
+
var GROUP_GAP = 14;
|
|
64
|
+
var MILESTONE_SIZE = 10;
|
|
65
|
+
var MIN_LEFT_MARGIN = 120;
|
|
66
|
+
var BOTTOM_MARGIN = 40;
|
|
67
|
+
var RIGHT_MARGIN = 20;
|
|
68
|
+
var LABEL_PAD = 8;
|
|
69
|
+
var LABEL_GAP = 5;
|
|
70
|
+
function computeBarLabel(label, x1, barWidth, innerWidth, textColor, onFillColor, fontSize = 10, labelPad = LABEL_PAD, labelGap = LABEL_GAP) {
|
|
71
|
+
const textWidth = measureText(label, fontSize);
|
|
72
|
+
const x2 = x1 + barWidth;
|
|
73
|
+
if (textWidth < barWidth - labelPad) {
|
|
74
|
+
return {
|
|
75
|
+
x: x1 + 6,
|
|
76
|
+
anchor: "start",
|
|
77
|
+
fill: onFillColor ?? textColor,
|
|
78
|
+
text: label
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (x2 + labelGap + textWidth <= innerWidth) {
|
|
82
|
+
return { x: x2 + labelGap, anchor: "start", fill: textColor, text: label };
|
|
83
|
+
}
|
|
84
|
+
if (x1 - labelGap - textWidth >= 0) {
|
|
85
|
+
return { x: x1 - labelGap, anchor: "end", fill: textColor, text: label };
|
|
86
|
+
}
|
|
87
|
+
const availWidth = x1 - labelGap;
|
|
88
|
+
if (availWidth > fontSize * CHAR_WIDTH_RATIO * 3) {
|
|
89
|
+
const truncated = truncateText(label, fontSize, availWidth);
|
|
90
|
+
if (!truncated) return null;
|
|
91
|
+
return {
|
|
92
|
+
x: x1 - labelGap,
|
|
93
|
+
anchor: "end",
|
|
94
|
+
fill: textColor,
|
|
95
|
+
text: truncated
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
var BAND_ACCENT_W = 4;
|
|
101
|
+
var BAND_RADIUS = 4;
|
|
102
|
+
var bandClipCounter = 0;
|
|
103
|
+
function renderLabelBand(svg, y, leftMargin, color, palette, isDark, cssPrefix, dataAttr, solid, barH = BAR_H, bandRadius = BAND_RADIUS, bandAccentW = BAND_ACCENT_W) {
|
|
104
|
+
const bandX = 5;
|
|
105
|
+
const bandW = leftMargin - 7;
|
|
106
|
+
const bandY = y - barH / 2;
|
|
107
|
+
const clipId = `gantt-band-clip-${bandClipCounter++}`;
|
|
108
|
+
svg.append("clipPath").attr("id", clipId).append("rect").attr("x", bandX).attr("y", bandY).attr("width", bandW).attr("height", barH).attr("rx", bandRadius);
|
|
109
|
+
const tint = svg.append("rect").attr("class", `gantt-${cssPrefix}-band-bg`).attr("x", bandX).attr("y", bandY).attr("width", bandW).attr("height", barH).attr("rx", bandRadius).attr(
|
|
110
|
+
"fill",
|
|
111
|
+
shapeFill(palette, color, isDark, {
|
|
112
|
+
...solid !== void 0 && { solid }
|
|
113
|
+
})
|
|
114
|
+
).style("pointer-events", "none");
|
|
115
|
+
const accent = svg.append("rect").attr("class", `gantt-${cssPrefix}-band-accent`).attr("x", bandX).attr("y", bandY).attr("width", bandAccentW).attr("height", barH).attr("fill", color).attr("clip-path", `url(#${clipId})`).style("pointer-events", "none");
|
|
116
|
+
if (dataAttr) {
|
|
117
|
+
tint.attr(dataAttr.key, dataAttr.value);
|
|
118
|
+
accent.attr(dataAttr.key, dataAttr.value);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function appendTaskIcon(textEl, label, isMilestone, iconColor, textColor) {
|
|
122
|
+
const icon = isMilestone ? "\u25C6" : "\u25CF";
|
|
123
|
+
textEl.append("tspan").attr("fill", iconColor).text(icon);
|
|
124
|
+
textEl.append("tspan").attr("fill", textColor).text(" " + label);
|
|
125
|
+
}
|
|
126
|
+
function renderGantt(container, resolved, palette, isDark, options, exportDims) {
|
|
127
|
+
container.innerHTML = "";
|
|
128
|
+
bandClipCounter = 0;
|
|
129
|
+
if (resolved.tasks.length === 0) return;
|
|
130
|
+
const solid = false;
|
|
131
|
+
const onClickItem = options?.onClickItem;
|
|
132
|
+
const collapsedGroups = options?.collapsedGroups ?? new Set(resolved.groups.filter((g2) => g2.collapsed).map((g2) => g2.name));
|
|
133
|
+
const onToggleGroup = options?.onToggleGroup;
|
|
134
|
+
const viewMode = options?.viewMode ?? false;
|
|
135
|
+
const currentSwimlaneGroup = options?.currentSwimlaneGroup ?? null;
|
|
136
|
+
const onSwimlaneChange = options?.onSwimlaneChange;
|
|
137
|
+
const onActiveGroupChange = options?.onActiveGroupChange;
|
|
138
|
+
const collapsedLanes = options?.collapsedLanes;
|
|
139
|
+
const onToggleLane = options?.onToggleLane;
|
|
140
|
+
const controlsHost = options?.controlsHost ?? "inline";
|
|
141
|
+
const seriesColors = getSeriesColors(palette);
|
|
142
|
+
let currentActiveGroup = resolveActiveTagGroup(
|
|
143
|
+
resolved.tagGroups,
|
|
144
|
+
resolved.options.activeTag ?? void 0,
|
|
145
|
+
options?.currentActiveGroup
|
|
146
|
+
);
|
|
147
|
+
let criticalPathActive = options?.criticalPathActive ?? false;
|
|
148
|
+
let dependenciesActive = options?.dependenciesActive ?? false;
|
|
149
|
+
let controlsExpanded = false;
|
|
150
|
+
const tagRows = currentSwimlaneGroup ? buildTagLaneRowList(resolved, currentSwimlaneGroup, collapsedLanes) : null;
|
|
151
|
+
const rows = tagRows ?? buildRowList(resolved, collapsedGroups);
|
|
152
|
+
const isTagMode = tagRows !== null;
|
|
153
|
+
const LABEL_FONT = 11;
|
|
154
|
+
const labelWidths = isTagMode ? [
|
|
155
|
+
...rows.filter((r) => r.type === "lane-header").map((r) => measureText(r.laneName, LABEL_FONT)),
|
|
156
|
+
...rows.filter((r) => r.type === "task").map((r) => measureText("\u25CF " + r.task.task.label, LABEL_FONT))
|
|
157
|
+
] : [
|
|
158
|
+
...resolved.tasks.map(
|
|
159
|
+
(t) => measureText("\u25CF " + t.task.label, LABEL_FONT)
|
|
160
|
+
),
|
|
161
|
+
...resolved.groups.map((g2) => {
|
|
162
|
+
const indentPx = g2.depth <= 2 ? g2.depth * 14 : 2 * 14 + (g2.depth - 2) * 8;
|
|
163
|
+
return indentPx + measureText(g2.name, LABEL_FONT);
|
|
164
|
+
})
|
|
165
|
+
];
|
|
166
|
+
const maxLabelWidth = Math.max(
|
|
167
|
+
...labelWidths,
|
|
168
|
+
measureText("0000000000", LABEL_FONT)
|
|
169
|
+
);
|
|
170
|
+
const leftMargin = Math.max(MIN_LEFT_MARGIN, maxLabelWidth + 30);
|
|
171
|
+
const totalRows = rows.length;
|
|
172
|
+
const hasCriticalPath = resolved.options.criticalPath && resolved.tasks.some((t) => t.isCriticalPath);
|
|
173
|
+
const hasDependencies = resolved.options.dependencies && resolved.tasks.some((t) => t.task.dependencies.length > 0);
|
|
174
|
+
let resolvedTodayDate = null;
|
|
175
|
+
if (resolved.options.todayMarker !== "off") {
|
|
176
|
+
const d = resolved.options.todayMarker === "on" ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(resolved.options.todayMarker + "T00:00:00");
|
|
177
|
+
if (d >= resolved.startDate && d <= resolved.endDate) {
|
|
178
|
+
resolvedTodayDate = d;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const title = resolved.options.title;
|
|
182
|
+
const showTitle = !!title && !resolved.options.noTitle;
|
|
183
|
+
const titleHeight = showTitle ? 50 : 20;
|
|
184
|
+
const containerWidth = exportDims?.width ?? (container.clientWidth || 800);
|
|
185
|
+
const hasTagLegend = resolved.tagGroups.length > 0 || hasCriticalPath || hasDependencies;
|
|
186
|
+
const tagLegendReserve = hasTagLegend ? getMaxLegendReservedHeight(
|
|
187
|
+
{
|
|
188
|
+
groups: resolved.tagGroups.map((tg) => ({
|
|
189
|
+
name: tg.name,
|
|
190
|
+
entries: tg.entries
|
|
191
|
+
})),
|
|
192
|
+
position: { placement: "top-center", titleRelation: "below-title" },
|
|
193
|
+
mode: "preview",
|
|
194
|
+
capsulePillAddonWidth: LEGEND_ICON_W
|
|
195
|
+
},
|
|
196
|
+
containerWidth
|
|
197
|
+
) + 8 : 0;
|
|
198
|
+
const topDateLabelReserve = 22;
|
|
199
|
+
const HEADER_ROW_H = 18;
|
|
200
|
+
const eraReserve = resolved.eras.length > 0 ? HEADER_ROW_H : 0;
|
|
201
|
+
const markerReserve = resolved.markers.length > 0 ? HEADER_ROW_H : 0;
|
|
202
|
+
const todayReserve = resolvedTodayDate ? HEADER_ROW_H : 0;
|
|
203
|
+
const sprintLabelReserve = resolved.sprints.length > 0 ? 16 : 0;
|
|
204
|
+
const CONTENT_TOP_PAD = 16;
|
|
205
|
+
const idealWidth = leftMargin + totalRows * 20 + RIGHT_MARGIN + 200;
|
|
206
|
+
const ctx = exportDims ? ScaleContext.identity() : ScaleContext.from(containerWidth, idealWidth);
|
|
207
|
+
const sBarH = ctx.structural(BAR_H);
|
|
208
|
+
const sRowGap = ctx.structural(ROW_GAP);
|
|
209
|
+
const sGroupGap = ctx.structural(GROUP_GAP);
|
|
210
|
+
const sMilestoneSize = ctx.structural(MILESTONE_SIZE);
|
|
211
|
+
const sBottomMargin = ctx.aesthetic(BOTTOM_MARGIN);
|
|
212
|
+
const sRightMargin = ctx.aesthetic(RIGHT_MARGIN);
|
|
213
|
+
const sLabelPad = ctx.structural(LABEL_PAD);
|
|
214
|
+
const sLabelGap = ctx.structural(LABEL_GAP);
|
|
215
|
+
const sBandAccentW = ctx.structural(BAND_ACCENT_W);
|
|
216
|
+
const sBandRadius = ctx.structural(BAND_RADIUS);
|
|
217
|
+
const sTitleFontSize = ctx.text(TITLE_FONT_SIZE);
|
|
218
|
+
const sTitleY = ctx.aesthetic(TITLE_Y);
|
|
219
|
+
const sHeaderRowH = ctx.structural(HEADER_ROW_H);
|
|
220
|
+
const sContentTopPad = ctx.aesthetic(CONTENT_TOP_PAD);
|
|
221
|
+
const sTopDateLabelReserve = ctx.structural(topDateLabelReserve);
|
|
222
|
+
const sSprintLabelReserve = ctx.structural(sprintLabelReserve);
|
|
223
|
+
const sTitleHeight = ctx.aesthetic(titleHeight);
|
|
224
|
+
const sTagLegendReserve = ctx.structural(tagLegendReserve);
|
|
225
|
+
const sEraReserve = ctx.structural(eraReserve);
|
|
226
|
+
const sMarkerReserve = ctx.structural(markerReserve);
|
|
227
|
+
const sTodayReserve = ctx.structural(todayReserve);
|
|
228
|
+
const sFont10 = ctx.text(10);
|
|
229
|
+
const sFont11 = ctx.text(11);
|
|
230
|
+
const sMarginTop = sTitleHeight + sTagLegendReserve + sEraReserve + sMarkerReserve + sTodayReserve + sTopDateLabelReserve + sSprintLabelReserve;
|
|
231
|
+
const sTodayLabelY = sTodayReserve ? -(sTopDateLabelReserve + sHeaderRowH / 2) : 0;
|
|
232
|
+
const sMarkerLabelY = sMarkerReserve ? -(sTopDateLabelReserve + sTodayReserve + sHeaderRowH / 2) : 0;
|
|
233
|
+
const sEraLabelY = sEraReserve ? -(sTopDateLabelReserve + sTodayReserve + sMarkerReserve + sHeaderRowH / 2) : 0;
|
|
234
|
+
const sContentH = isTagMode ? totalRows * (sBarH + sRowGap) : totalRows * (sBarH + sRowGap) + sGroupGap * resolved.groups.length;
|
|
235
|
+
const sInnerHeight = sContentTopPad + sContentH;
|
|
236
|
+
const sOuterHeight = sMarginTop + sInnerHeight + sBottomMargin;
|
|
237
|
+
const sprintRightPad = resolved.sprints.length > 0 ? 50 : 0;
|
|
238
|
+
const innerWidth = containerWidth - leftMargin - sRightMargin - sprintRightPad;
|
|
239
|
+
const svg = d3Selection.select(container).append("svg").attr("viewBox", `0 0 ${containerWidth} ${sOuterHeight}`).attr("width", exportDims ? containerWidth : "100%").attr("preserveAspectRatio", "xMidYMin meet").attr("font-family", FONT_FAMILY).style("overflow", "visible");
|
|
240
|
+
const g = svg.append("g").attr("transform", `translate(${leftMargin}, ${sMarginTop})`);
|
|
241
|
+
if (showTitle) {
|
|
242
|
+
svg.append("text").attr("class", "chart-title").attr("x", containerWidth / 2).attr("y", sTitleY).attr("text-anchor", "middle").attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("fill", palette.text).text(title);
|
|
243
|
+
}
|
|
244
|
+
function drawLegend() {
|
|
245
|
+
svg.selectAll(".gantt-tag-legend-container").remove();
|
|
246
|
+
if (resolved.tagGroups.length > 0 || hasCriticalPath || hasDependencies) {
|
|
247
|
+
const legendY = sTitleHeight;
|
|
248
|
+
renderTagLegend(
|
|
249
|
+
svg,
|
|
250
|
+
g,
|
|
251
|
+
resolved.tagGroups,
|
|
252
|
+
currentActiveGroup,
|
|
253
|
+
leftMargin,
|
|
254
|
+
innerWidth,
|
|
255
|
+
legendY,
|
|
256
|
+
palette,
|
|
257
|
+
isDark,
|
|
258
|
+
hasCriticalPath,
|
|
259
|
+
criticalPathActive,
|
|
260
|
+
resolved.options.optionLineNumbers,
|
|
261
|
+
(groupName) => {
|
|
262
|
+
currentActiveGroup = currentActiveGroup?.toLowerCase() === groupName.toLowerCase() ? null : groupName;
|
|
263
|
+
if (onActiveGroupChange) onActiveGroupChange(currentActiveGroup);
|
|
264
|
+
drawLegend();
|
|
265
|
+
recolorBars();
|
|
266
|
+
},
|
|
267
|
+
() => {
|
|
268
|
+
controlsExpanded = !controlsExpanded;
|
|
269
|
+
drawLegend();
|
|
270
|
+
},
|
|
271
|
+
currentSwimlaneGroup,
|
|
272
|
+
onSwimlaneChange,
|
|
273
|
+
viewMode,
|
|
274
|
+
resolved.tasks,
|
|
275
|
+
controlsExpanded,
|
|
276
|
+
hasDependencies,
|
|
277
|
+
dependenciesActive,
|
|
278
|
+
(toggleId, active) => {
|
|
279
|
+
if (toggleId === "critical-path") {
|
|
280
|
+
criticalPathActive = active;
|
|
281
|
+
if (active) {
|
|
282
|
+
applyCriticalPathHighlight(svg, g);
|
|
283
|
+
} else {
|
|
284
|
+
svg.attr("data-critical-path-active", null);
|
|
285
|
+
resetHighlightAll(svg, g);
|
|
286
|
+
}
|
|
287
|
+
} else if (toggleId === "dependencies") {
|
|
288
|
+
dependenciesActive = active;
|
|
289
|
+
g.selectAll(
|
|
290
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead, .gantt-dep-label"
|
|
291
|
+
).attr("display", active ? null : "none");
|
|
292
|
+
}
|
|
293
|
+
drawLegend();
|
|
294
|
+
},
|
|
295
|
+
options?.exportMode ?? false,
|
|
296
|
+
controlsHost
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function restoreHighlight() {
|
|
301
|
+
if (criticalPathActive) {
|
|
302
|
+
applyCriticalPathHighlight(svg, g);
|
|
303
|
+
} else {
|
|
304
|
+
svg.attr("data-critical-path-active", null);
|
|
305
|
+
resetHighlight(g, svg);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function recolorBars() {
|
|
309
|
+
g.selectAll(".gantt-task").each(function() {
|
|
310
|
+
const el = d3Selection.select(this);
|
|
311
|
+
const taskId = el.attr("data-task-id");
|
|
312
|
+
const rt = resolved.tasks.find((t) => t.task.id === taskId);
|
|
313
|
+
if (!rt) return;
|
|
314
|
+
const color = resolveTaskColor(
|
|
315
|
+
rt,
|
|
316
|
+
currentActiveGroup,
|
|
317
|
+
resolved,
|
|
318
|
+
seriesColors,
|
|
319
|
+
palette
|
|
320
|
+
);
|
|
321
|
+
const fillColor = shapeFill(palette, color, isDark, { solid });
|
|
322
|
+
el.select("rect").attr("fill", fillColor).attr("stroke", color);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
drawLegend();
|
|
326
|
+
const startTime = dateToFractionalYear(resolved.startDate);
|
|
327
|
+
const endTime = dateToFractionalYear(resolved.endDate);
|
|
328
|
+
const domainPad = Math.max((endTime - startTime) * 0.02, 0.01);
|
|
329
|
+
const domainMin = startTime - domainPad;
|
|
330
|
+
const domainMax = endTime + domainPad;
|
|
331
|
+
const xScale = d3Scale.scaleLinear().domain([domainMin, domainMax]).range([0, innerWidth]);
|
|
332
|
+
renderTimeScaleHorizontal(g, xScale, innerWidth, sInnerHeight, palette.text);
|
|
333
|
+
renderWeekendBands(g, resolved, xScale, sInnerHeight, palette, isDark);
|
|
334
|
+
renderHolidayBands(
|
|
335
|
+
g,
|
|
336
|
+
svg,
|
|
337
|
+
resolved,
|
|
338
|
+
xScale,
|
|
339
|
+
sInnerHeight,
|
|
340
|
+
palette,
|
|
341
|
+
isDark,
|
|
342
|
+
sMarginTop - 4,
|
|
343
|
+
leftMargin,
|
|
344
|
+
onClickItem
|
|
345
|
+
);
|
|
346
|
+
renderErasAndMarkers(
|
|
347
|
+
g,
|
|
348
|
+
svg,
|
|
349
|
+
resolved,
|
|
350
|
+
xScale,
|
|
351
|
+
sInnerHeight,
|
|
352
|
+
palette,
|
|
353
|
+
sEraLabelY,
|
|
354
|
+
sMarkerLabelY
|
|
355
|
+
);
|
|
356
|
+
renderSprintBands(g, svg, resolved, xScale, sInnerHeight, palette);
|
|
357
|
+
const todayDate = resolvedTodayDate;
|
|
358
|
+
let todayX = -1;
|
|
359
|
+
const todayColor = palette.accent || "#e74c3c";
|
|
360
|
+
const todayMarkerLineNum = resolved.options.optionLineNumbers["today-marker"];
|
|
361
|
+
if (todayDate) {
|
|
362
|
+
todayX = xScale(dateToFractionalYear(todayDate));
|
|
363
|
+
if (todayX >= 0 && todayX <= innerWidth) {
|
|
364
|
+
const todayLine = g.append("line").attr("class", "gantt-today").attr("x1", todayX).attr("y1", 0).attr("x2", todayX).attr("y2", sInnerHeight + 10).attr("stroke", todayColor).attr("stroke-width", 2).attr("stroke-dasharray", "6 4").attr("opacity", 0.7).attr("pointer-events", "none");
|
|
365
|
+
if (todayMarkerLineNum)
|
|
366
|
+
todayLine.attr("data-line-number", String(todayMarkerLineNum));
|
|
367
|
+
const todayLabel = g.append("text").attr("class", "gantt-today").attr("x", todayX).attr("y", sTodayLabelY).attr("text-anchor", "middle").attr("font-size", `${sFont10}px`).attr("fill", todayColor).attr("opacity", 0.7).attr("pointer-events", "none").text("Today");
|
|
368
|
+
if (todayMarkerLineNum)
|
|
369
|
+
todayLabel.attr("data-line-number", String(todayMarkerLineNum));
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const taskPositions = /* @__PURE__ */ new Map();
|
|
373
|
+
const groupPositions = /* @__PURE__ */ new Map();
|
|
374
|
+
const lanePositions = /* @__PURE__ */ new Map();
|
|
375
|
+
const taskLaneMap = /* @__PURE__ */ new Map();
|
|
376
|
+
if (isTagMode && currentSwimlaneGroup) {
|
|
377
|
+
const tagGroup = resolved.tagGroups.find(
|
|
378
|
+
(tg) => tg.name.toLowerCase() === currentSwimlaneGroup.toLowerCase()
|
|
379
|
+
);
|
|
380
|
+
if (tagGroup) {
|
|
381
|
+
const tagKey = tagAttrKey(tagGroup.name);
|
|
382
|
+
for (const rt of resolved.tasks) {
|
|
383
|
+
let value = rt.effectiveMetadata[tagKey];
|
|
384
|
+
if (!value && tagGroup.defaultValue) value = tagGroup.defaultValue;
|
|
385
|
+
if (value) {
|
|
386
|
+
const entry = tagGroup.entries.find(
|
|
387
|
+
(e) => e.value.toLowerCase() === value.toLowerCase()
|
|
388
|
+
);
|
|
389
|
+
if (entry) taskLaneMap.set(rt.task.id, entry.value);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
let yOffset = sContentTopPad;
|
|
395
|
+
for (const row of rows) {
|
|
396
|
+
if (row.type === "lane-header") {
|
|
397
|
+
const laneColor = row.laneColor === "#999999" ? palette.textMuted : row.laneColor;
|
|
398
|
+
const toggleIcon = row.isCollapsed ? "\u25B6" : "\u25BC";
|
|
399
|
+
const labelX = 10;
|
|
400
|
+
let lx1 = 0;
|
|
401
|
+
let lx2 = innerWidth;
|
|
402
|
+
let laneBarWidth = innerWidth;
|
|
403
|
+
if (row.laneStartDate && row.laneEndDate) {
|
|
404
|
+
lx1 = xScale(dateToFractionalYear(row.laneStartDate));
|
|
405
|
+
lx2 = xScale(dateToFractionalYear(row.laneEndDate));
|
|
406
|
+
laneBarWidth = Math.max(lx2 - lx1, 2);
|
|
407
|
+
}
|
|
408
|
+
lanePositions.set(row.laneName, {
|
|
409
|
+
x1: lx1,
|
|
410
|
+
x2: lx1 + laneBarWidth,
|
|
411
|
+
y: yOffset + sBarH / 2
|
|
412
|
+
});
|
|
413
|
+
renderLabelBand(
|
|
414
|
+
svg,
|
|
415
|
+
sMarginTop + yOffset + sBarH / 2,
|
|
416
|
+
leftMargin,
|
|
417
|
+
laneColor,
|
|
418
|
+
palette,
|
|
419
|
+
isDark,
|
|
420
|
+
"lane",
|
|
421
|
+
{ key: "data-lane", value: row.laneName },
|
|
422
|
+
solid,
|
|
423
|
+
sBarH,
|
|
424
|
+
sBandRadius,
|
|
425
|
+
sBandAccentW
|
|
426
|
+
);
|
|
427
|
+
const labelG = svg.append("g").attr("class", "gantt-lane-header").attr(`data-tag-${row.tagKey}`, row.laneName.toLowerCase()).attr("data-lane", row.laneName).style("cursor", onToggleLane ? "pointer" : "default").on("click", () => {
|
|
428
|
+
if (onToggleLane) onToggleLane(row.laneName);
|
|
429
|
+
}).on("mouseenter", () => {
|
|
430
|
+
highlightLane(g, svg, row.tagKey, row.laneName);
|
|
431
|
+
if (row.laneStartDate && row.laneEndDate) {
|
|
432
|
+
showGanttDateIndicators(
|
|
433
|
+
g,
|
|
434
|
+
xScale,
|
|
435
|
+
row.laneStartDate,
|
|
436
|
+
row.laneEndDate,
|
|
437
|
+
sInnerHeight,
|
|
438
|
+
laneColor
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
}).on("mouseleave", () => {
|
|
442
|
+
restoreHighlight();
|
|
443
|
+
hideGanttDateIndicators(g);
|
|
444
|
+
});
|
|
445
|
+
labelG.append("text").attr("x", labelX).attr("y", sMarginTop + yOffset + sBarH / 2).attr("dy", "0.35em").attr("text-anchor", "start").attr("font-size", `${sFont11}px`).attr("font-weight", "bold").attr("fill", laneColor).text(
|
|
446
|
+
toggleIcon + " " + row.laneName + (row.aggregateProgress !== null ? ` ${Math.round(row.aggregateProgress)}%` : "")
|
|
447
|
+
);
|
|
448
|
+
if (laneBarWidth > 0) {
|
|
449
|
+
const barFill = shapeFill(palette, laneColor, isDark, { solid });
|
|
450
|
+
const laneBandG = g.append("g").attr("class", "gantt-lane-band-group").attr("data-lane", row.laneName).on("mouseenter", () => {
|
|
451
|
+
highlightLane(g, svg, row.tagKey, row.laneName);
|
|
452
|
+
if (row.laneStartDate && row.laneEndDate) {
|
|
453
|
+
showGanttDateIndicators(
|
|
454
|
+
g,
|
|
455
|
+
xScale,
|
|
456
|
+
row.laneStartDate,
|
|
457
|
+
row.laneEndDate,
|
|
458
|
+
sInnerHeight,
|
|
459
|
+
laneColor
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
}).on("mouseleave", () => {
|
|
463
|
+
resetHighlight(g, svg);
|
|
464
|
+
hideGanttDateIndicators(g);
|
|
465
|
+
});
|
|
466
|
+
laneBandG.append("rect").attr("class", "gantt-lane-band").attr("x", lx1).attr("y", yOffset).attr("width", laneBarWidth).attr("height", sBarH).attr("rx", 4).attr("fill", barFill).attr("stroke", laneColor).attr("stroke-width", 2);
|
|
467
|
+
if (row.aggregateProgress !== null && row.aggregateProgress > 0) {
|
|
468
|
+
laneBandG.append("rect").attr("class", "gantt-lane-progress").attr("x", lx1).attr("y", yOffset).attr(
|
|
469
|
+
"width",
|
|
470
|
+
laneBarWidth * Math.min(row.aggregateProgress / 100, 1)
|
|
471
|
+
).attr("height", sBarH).attr("fill", laneColor).attr("opacity", 0.5).attr("pointer-events", "none");
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
yOffset += sBarH + sRowGap;
|
|
475
|
+
} else if (row.type === "group") {
|
|
476
|
+
const group = row.group;
|
|
477
|
+
const isCollapsed = collapsedGroups?.has(group.name) ?? false;
|
|
478
|
+
const toggleIcon = isCollapsed ? "\u25B6" : "\u25BC";
|
|
479
|
+
const tagColor = resolveTagColor(
|
|
480
|
+
group.metadata,
|
|
481
|
+
resolved.tagGroups,
|
|
482
|
+
currentActiveGroup,
|
|
483
|
+
true
|
|
484
|
+
);
|
|
485
|
+
const groupColor = tagColor && tagColor !== "#999999" ? tagColor : group.color || palette.textMuted;
|
|
486
|
+
renderLabelBand(
|
|
487
|
+
svg,
|
|
488
|
+
sMarginTop + yOffset + sBarH / 2,
|
|
489
|
+
leftMargin,
|
|
490
|
+
groupColor,
|
|
491
|
+
palette,
|
|
492
|
+
isDark,
|
|
493
|
+
"group",
|
|
494
|
+
{ key: "data-group", value: group.name },
|
|
495
|
+
solid,
|
|
496
|
+
sBarH,
|
|
497
|
+
sBandRadius,
|
|
498
|
+
sBandAccentW
|
|
499
|
+
);
|
|
500
|
+
const labelG = svg.append("g").attr("class", "gantt-group-label").attr("data-group", group.name).attr("data-line-number", String(group.lineNumber)).style("cursor", onToggleGroup ? "pointer" : "default").on("click", () => {
|
|
501
|
+
if (onToggleGroup) onToggleGroup(group.name);
|
|
502
|
+
}).on("mouseenter", () => {
|
|
503
|
+
highlightGroup(g, svg, group.name);
|
|
504
|
+
showGanttDateIndicators(
|
|
505
|
+
g,
|
|
506
|
+
xScale,
|
|
507
|
+
group.startDate,
|
|
508
|
+
group.endDate,
|
|
509
|
+
sInnerHeight,
|
|
510
|
+
groupColor
|
|
511
|
+
);
|
|
512
|
+
}).on("mouseleave", () => {
|
|
513
|
+
resetHighlight(g, svg);
|
|
514
|
+
hideGanttDateIndicators(g);
|
|
515
|
+
});
|
|
516
|
+
const groupIndent = group.depth <= 2 ? group.depth * 14 : 2 * 14 + (group.depth - 2) * 8;
|
|
517
|
+
const labelX = 10 + groupIndent;
|
|
518
|
+
labelG.append("text").attr("x", labelX).attr("y", sMarginTop + yOffset + sBarH / 2).attr("dy", "0.35em").attr("text-anchor", "start").attr("font-size", `${sFont11}px`).attr("font-weight", "bold").attr("fill", palette.text).text(
|
|
519
|
+
toggleIcon + " " + group.name + (group.progress !== null ? ` ${Math.round(group.progress)}%` : "")
|
|
520
|
+
);
|
|
521
|
+
const gStart = dateToFractionalYear(group.startDate);
|
|
522
|
+
const gEnd = dateToFractionalYear(group.endDate);
|
|
523
|
+
const gx1 = xScale(gStart);
|
|
524
|
+
const gx2 = xScale(gEnd);
|
|
525
|
+
if (gx2 > gx1) {
|
|
526
|
+
if (isCollapsed) {
|
|
527
|
+
const barWidth = Math.max(gx2 - gx1, 2);
|
|
528
|
+
const summaryG = g.append("g").attr("class", "gantt-group-summary").attr("data-group", group.name).attr("data-line-number", String(group.lineNumber)).on("mouseenter", () => {
|
|
529
|
+
highlightGroup(g, svg, group.name);
|
|
530
|
+
showGanttDateIndicators(
|
|
531
|
+
g,
|
|
532
|
+
xScale,
|
|
533
|
+
group.startDate,
|
|
534
|
+
group.endDate,
|
|
535
|
+
sInnerHeight,
|
|
536
|
+
groupColor
|
|
537
|
+
);
|
|
538
|
+
}).on("mouseleave", () => {
|
|
539
|
+
resetHighlight(g, svg);
|
|
540
|
+
hideGanttDateIndicators(g);
|
|
541
|
+
});
|
|
542
|
+
summaryG.append("rect").attr("x", gx1).attr("y", yOffset).attr("width", barWidth).attr("height", sBarH).attr("rx", 4).attr("fill", shapeFill(palette, groupColor, isDark, { solid })).attr("stroke", groupColor).attr("stroke-width", 2);
|
|
543
|
+
if (group.progress !== null && group.progress > 0) {
|
|
544
|
+
summaryG.append("rect").attr("x", gx1).attr("y", yOffset).attr("width", barWidth * Math.min(group.progress / 100, 1)).attr("height", sBarH).attr("fill", groupColor).attr("opacity", 0.5);
|
|
545
|
+
}
|
|
546
|
+
const summaryLabel = group.name + (group.progress !== null ? ` ${Math.round(group.progress)}%` : "");
|
|
547
|
+
const summaryPlacement = computeBarLabel(
|
|
548
|
+
summaryLabel,
|
|
549
|
+
gx1,
|
|
550
|
+
barWidth,
|
|
551
|
+
innerWidth,
|
|
552
|
+
palette.text,
|
|
553
|
+
contrastText(
|
|
554
|
+
shapeFill(palette, groupColor, isDark, { solid }),
|
|
555
|
+
palette.textOnFillLight,
|
|
556
|
+
palette.textOnFillDark
|
|
557
|
+
),
|
|
558
|
+
sFont10,
|
|
559
|
+
sLabelPad,
|
|
560
|
+
sLabelGap
|
|
561
|
+
);
|
|
562
|
+
if (summaryPlacement) {
|
|
563
|
+
summaryG.append("text").attr("x", summaryPlacement.x).attr("y", yOffset + sBarH / 2).attr("dy", "0.35em").attr("font-size", `${sFont10}px`).attr("font-weight", "bold").attr("text-anchor", summaryPlacement.anchor).attr("fill", summaryPlacement.fill).attr("pointer-events", "none").text(summaryPlacement.text);
|
|
564
|
+
}
|
|
565
|
+
groupPositions.set(group.name, {
|
|
566
|
+
x1: gx1,
|
|
567
|
+
x2: gx1 + barWidth,
|
|
568
|
+
y: yOffset + sBarH / 2
|
|
569
|
+
});
|
|
570
|
+
} else {
|
|
571
|
+
const groupBarWidth = Math.max(gx2 - gx1, 2);
|
|
572
|
+
const bandFill = shapeFill(palette, groupColor, isDark, { solid });
|
|
573
|
+
const groupBarG = g.append("g").attr("class", "gantt-group-bar").attr("data-group", group.name).attr("data-line-number", String(group.lineNumber)).on("mouseenter", () => {
|
|
574
|
+
highlightGroup(g, svg, group.name);
|
|
575
|
+
showGanttDateIndicators(
|
|
576
|
+
g,
|
|
577
|
+
xScale,
|
|
578
|
+
group.startDate,
|
|
579
|
+
group.endDate,
|
|
580
|
+
sInnerHeight,
|
|
581
|
+
groupColor
|
|
582
|
+
);
|
|
583
|
+
}).on("mouseleave", () => {
|
|
584
|
+
resetHighlight(g, svg);
|
|
585
|
+
hideGanttDateIndicators(g);
|
|
586
|
+
});
|
|
587
|
+
groupBarG.append("rect").attr("x", gx1).attr("y", yOffset).attr("width", groupBarWidth).attr("height", sBarH).attr("rx", 4).attr("fill", bandFill).attr("stroke", groupColor).attr("stroke-width", 2);
|
|
588
|
+
if (group.progress !== null && group.progress > 0) {
|
|
589
|
+
groupBarG.append("rect").attr("class", "gantt-group-progress").attr("x", gx1).attr("y", yOffset).attr("width", groupBarWidth * Math.min(group.progress / 100, 1)).attr("height", sBarH).attr("fill", groupColor).attr("opacity", 0.5);
|
|
590
|
+
}
|
|
591
|
+
const expandedLabel = group.name + (group.progress !== null ? ` ${Math.round(group.progress)}%` : "");
|
|
592
|
+
const expandedPlacement = computeBarLabel(
|
|
593
|
+
expandedLabel,
|
|
594
|
+
gx1,
|
|
595
|
+
groupBarWidth,
|
|
596
|
+
innerWidth,
|
|
597
|
+
palette.text,
|
|
598
|
+
contrastText(
|
|
599
|
+
shapeFill(palette, groupColor, isDark, { solid }),
|
|
600
|
+
palette.textOnFillLight,
|
|
601
|
+
palette.textOnFillDark
|
|
602
|
+
),
|
|
603
|
+
sFont10,
|
|
604
|
+
sLabelPad,
|
|
605
|
+
sLabelGap
|
|
606
|
+
);
|
|
607
|
+
if (expandedPlacement) {
|
|
608
|
+
groupBarG.append("text").attr("x", expandedPlacement.x).attr("y", yOffset + sBarH / 2).attr("dy", "0.35em").attr("font-size", `${sFont10}px`).attr("font-weight", "bold").attr("text-anchor", expandedPlacement.anchor).attr("fill", expandedPlacement.fill).attr("pointer-events", "none").text(expandedPlacement.text);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
yOffset += sBarH + sRowGap;
|
|
613
|
+
} else if (row.type === "task") {
|
|
614
|
+
const rt = row.task;
|
|
615
|
+
const task = rt.task;
|
|
616
|
+
const barColor = resolveTaskColor(
|
|
617
|
+
rt,
|
|
618
|
+
currentActiveGroup,
|
|
619
|
+
resolved,
|
|
620
|
+
seriesColors,
|
|
621
|
+
palette
|
|
622
|
+
);
|
|
623
|
+
const depth = rt.groupPath.length;
|
|
624
|
+
const indent = depth <= 2 ? depth * 14 : 2 * 14 + (depth - 2) * 8;
|
|
625
|
+
const taskLabelX = isTagMode ? 20 : 6 + indent;
|
|
626
|
+
const topGroup = rt.groupPath.length > 0 ? rt.groupPath[0] : null;
|
|
627
|
+
const taskLabel = svg.append("text").attr("class", "gantt-task-label").attr("x", taskLabelX).attr("y", sMarginTop + yOffset + sBarH / 2).attr("dy", "0.35em").attr("text-anchor", "start").attr("font-size", `${sFont11}px`).attr("fill", palette.text).attr("data-line-number", String(task.lineNumber)).attr("data-task-id", task.id).attr("data-group", topGroup).style("cursor", onClickItem ? "pointer" : "default").on("click", () => {
|
|
628
|
+
if (onClickItem) onClickItem(task.lineNumber);
|
|
629
|
+
}).on("mouseenter", () => {
|
|
630
|
+
if (rt.isMilestone) {
|
|
631
|
+
highlightMilestone(g, svg, task.id);
|
|
632
|
+
} else {
|
|
633
|
+
highlightTask(g, svg, task.id);
|
|
634
|
+
}
|
|
635
|
+
}).on("mouseleave", () => {
|
|
636
|
+
resetHighlight(g, svg);
|
|
637
|
+
});
|
|
638
|
+
appendTaskIcon(
|
|
639
|
+
taskLabel,
|
|
640
|
+
task.label,
|
|
641
|
+
rt.isMilestone,
|
|
642
|
+
barColor,
|
|
643
|
+
palette.text
|
|
644
|
+
);
|
|
645
|
+
for (const [key, value] of Object.entries(rt.effectiveMetadata)) {
|
|
646
|
+
taskLabel.attr(`data-tag-${key}`, value.toLowerCase());
|
|
647
|
+
}
|
|
648
|
+
if (rt.isCriticalPath) {
|
|
649
|
+
taskLabel.attr("data-critical-path", "true");
|
|
650
|
+
}
|
|
651
|
+
if (rt.isMilestone) {
|
|
652
|
+
const mx = xScale(dateToFractionalYear(rt.startDate));
|
|
653
|
+
const my = yOffset + sBarH / 2;
|
|
654
|
+
g.append("polygon").attr("class", "gantt-milestone").attr("points", diamondPoints(mx, my, sMilestoneSize)).attr("fill", barColor).attr("stroke", barColor).attr("stroke-width", 1.5).attr("data-line-number", String(task.lineNumber)).attr("data-task-name", task.label).attr("data-task-id", task.id).attr("data-group", topGroup).style("cursor", onClickItem ? "pointer" : "default").on("click", () => {
|
|
655
|
+
if (onClickItem) onClickItem(task.lineNumber);
|
|
656
|
+
}).on("mouseenter", () => {
|
|
657
|
+
highlightMilestone(g, svg, task.id);
|
|
658
|
+
showGanttDateIndicators(
|
|
659
|
+
g,
|
|
660
|
+
xScale,
|
|
661
|
+
rt.startDate,
|
|
662
|
+
null,
|
|
663
|
+
sInnerHeight,
|
|
664
|
+
barColor
|
|
665
|
+
);
|
|
666
|
+
g.append("text").attr("class", "gantt-milestone-hover-label").attr("x", mx - sMilestoneSize - 4).attr("y", my).attr("dy", "0.35em").attr("text-anchor", "end").attr("font-size", `${sFont10}px`).attr("fill", barColor).attr("font-weight", "600").text(task.label);
|
|
667
|
+
}).on("mouseleave", () => {
|
|
668
|
+
restoreHighlight();
|
|
669
|
+
hideGanttDateIndicators(g);
|
|
670
|
+
g.selectAll(".gantt-milestone-hover-label").remove();
|
|
671
|
+
});
|
|
672
|
+
taskPositions.set(task.id, { x1: mx, x2: mx, y: my });
|
|
673
|
+
} else {
|
|
674
|
+
const tStart = dateToFractionalYear(rt.startDate);
|
|
675
|
+
const tEnd = dateToFractionalYear(rt.endDate);
|
|
676
|
+
const x1 = xScale(tStart);
|
|
677
|
+
const x2 = xScale(tEnd);
|
|
678
|
+
const barWidth = Math.max(x2 - x1, 2);
|
|
679
|
+
const fillColor = shapeFill(palette, barColor, isDark, { solid });
|
|
680
|
+
const taskG = g.append("g").attr("class", "gantt-task").attr("data-line-number", String(task.lineNumber)).attr("data-task-name", task.label).attr("data-task-id", task.id).attr("data-group", topGroup).style("cursor", onClickItem ? "pointer" : "default").on("click", () => {
|
|
681
|
+
if (onClickItem) onClickItem(task.lineNumber);
|
|
682
|
+
}).on("mouseenter", () => {
|
|
683
|
+
if (resolved.options.dependencies) {
|
|
684
|
+
highlightDeps(g, svg, task.id, resolved);
|
|
685
|
+
}
|
|
686
|
+
highlightTaskLabel(svg, task.lineNumber);
|
|
687
|
+
showGanttDateIndicators(
|
|
688
|
+
g,
|
|
689
|
+
xScale,
|
|
690
|
+
rt.startDate,
|
|
691
|
+
rt.endDate,
|
|
692
|
+
sInnerHeight,
|
|
693
|
+
barColor
|
|
694
|
+
);
|
|
695
|
+
}).on("mouseleave", () => {
|
|
696
|
+
if (resolved.options.dependencies) {
|
|
697
|
+
restoreHighlight();
|
|
698
|
+
}
|
|
699
|
+
resetTaskLabels(svg);
|
|
700
|
+
hideGanttDateIndicators(g);
|
|
701
|
+
});
|
|
702
|
+
for (const [key, value] of Object.entries(rt.effectiveMetadata)) {
|
|
703
|
+
taskG.attr(`data-tag-${key}`, value.toLowerCase());
|
|
704
|
+
}
|
|
705
|
+
const showUncertainFade = rt.isUncertain && (task.progress === null || task.progress <= 80);
|
|
706
|
+
let barFill = fillColor;
|
|
707
|
+
let barStroke = barColor;
|
|
708
|
+
if (showUncertainFade) {
|
|
709
|
+
const defs = svg.select("defs").empty() ? svg.append("defs") : svg.select("defs");
|
|
710
|
+
const fillGradId = `gantt-uncertain-fill-${task.id}`;
|
|
711
|
+
const fillGrad = defs.append("linearGradient").attr("id", fillGradId).attr("x1", "0").attr("x2", "1").attr("y1", "0").attr("y2", "0");
|
|
712
|
+
fillGrad.append("stop").attr("offset", "0%").attr("stop-color", fillColor).attr("stop-opacity", 1);
|
|
713
|
+
fillGrad.append("stop").attr("offset", "50%").attr("stop-color", fillColor).attr("stop-opacity", 1);
|
|
714
|
+
fillGrad.append("stop").attr("offset", "100%").attr("stop-color", fillColor).attr("stop-opacity", 0);
|
|
715
|
+
const strokeGradId = `gantt-uncertain-stroke-${task.id}`;
|
|
716
|
+
const strokeGrad = defs.append("linearGradient").attr("id", strokeGradId).attr("x1", "0").attr("x2", "1").attr("y1", "0").attr("y2", "0");
|
|
717
|
+
strokeGrad.append("stop").attr("offset", "0%").attr("stop-color", barColor).attr("stop-opacity", 1);
|
|
718
|
+
strokeGrad.append("stop").attr("offset", "50%").attr("stop-color", barColor).attr("stop-opacity", 1);
|
|
719
|
+
strokeGrad.append("stop").attr("offset", "100%").attr("stop-color", barColor).attr("stop-opacity", 0);
|
|
720
|
+
barFill = `url(#${fillGradId})`;
|
|
721
|
+
barStroke = `url(#${strokeGradId})`;
|
|
722
|
+
}
|
|
723
|
+
taskG.append("rect").attr("x", x1).attr("y", yOffset).attr("width", barWidth).attr("height", sBarH).attr("rx", 4).attr("fill", barFill).attr("stroke", barStroke).attr("stroke-width", 2);
|
|
724
|
+
if (task.progress !== null && task.progress > 0) {
|
|
725
|
+
const progressWidth = barWidth * Math.min(task.progress / 100, 1);
|
|
726
|
+
let progressFill = barColor;
|
|
727
|
+
if (showUncertainFade) {
|
|
728
|
+
const ratio = barWidth / progressWidth;
|
|
729
|
+
const fadeStart = Math.min(50 * ratio, 100);
|
|
730
|
+
const defs = svg.select("defs");
|
|
731
|
+
const progGradId = `gantt-uncertain-progress-${task.id}`;
|
|
732
|
+
const progGrad = defs.append("linearGradient").attr("id", progGradId).attr("x1", "0").attr("x2", "1").attr("y1", "0").attr("y2", "0");
|
|
733
|
+
progGrad.append("stop").attr("offset", "0%").attr("stop-color", barColor).attr("stop-opacity", 1);
|
|
734
|
+
progGrad.append("stop").attr("offset", `${fadeStart}%`).attr("stop-color", barColor).attr("stop-opacity", 1);
|
|
735
|
+
progGrad.append("stop").attr("offset", "100%").attr("stop-color", barColor).attr("stop-opacity", 0);
|
|
736
|
+
progressFill = `url(#${progGradId})`;
|
|
737
|
+
}
|
|
738
|
+
taskG.append("rect").attr("class", "gantt-progress").attr("x", x1).attr("y", yOffset).attr("width", progressWidth).attr("height", sBarH).attr("fill", progressFill).attr("opacity", 0.5);
|
|
739
|
+
}
|
|
740
|
+
if (rt.isCriticalPath) {
|
|
741
|
+
taskG.attr("data-critical-path", "true");
|
|
742
|
+
}
|
|
743
|
+
const labelPlacement = computeBarLabel(
|
|
744
|
+
task.label,
|
|
745
|
+
x1,
|
|
746
|
+
barWidth,
|
|
747
|
+
innerWidth,
|
|
748
|
+
palette.text,
|
|
749
|
+
contrastText(
|
|
750
|
+
shapeFill(palette, barColor, isDark, { solid }),
|
|
751
|
+
palette.textOnFillLight,
|
|
752
|
+
palette.textOnFillDark
|
|
753
|
+
),
|
|
754
|
+
sFont10,
|
|
755
|
+
sLabelPad,
|
|
756
|
+
sLabelGap
|
|
757
|
+
);
|
|
758
|
+
if (labelPlacement) {
|
|
759
|
+
taskG.append("text").attr("x", labelPlacement.x).attr("y", yOffset + sBarH / 2).attr("dy", "0.35em").attr("font-size", `${sFont10}px`).attr("text-anchor", labelPlacement.anchor).attr("fill", labelPlacement.fill).attr("pointer-events", "none").text(labelPlacement.text);
|
|
760
|
+
}
|
|
761
|
+
taskPositions.set(task.id, {
|
|
762
|
+
x1,
|
|
763
|
+
x2: x1 + barWidth,
|
|
764
|
+
y: yOffset + sBarH / 2
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
yOffset += sBarH + sRowGap;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
if (todayDate && todayX >= 0 && todayX <= innerWidth) {
|
|
771
|
+
const todayHoverG = g.append("g").attr("class", "gantt-today-hover").style("cursor", "pointer");
|
|
772
|
+
todayHoverG.append("rect").attr("x", todayX - 10).attr("y", -6).attr("width", 20).attr("height", sInnerHeight + 16).attr("fill", "transparent").attr("pointer-events", "all");
|
|
773
|
+
const todayDateObj = todayDate;
|
|
774
|
+
todayHoverG.on("mouseenter", () => {
|
|
775
|
+
g.selectAll(".gantt-task").attr(
|
|
776
|
+
"opacity",
|
|
777
|
+
FADE_OPACITY
|
|
778
|
+
);
|
|
779
|
+
g.selectAll(".gantt-milestone").attr(
|
|
780
|
+
"opacity",
|
|
781
|
+
FADE_OPACITY
|
|
782
|
+
);
|
|
783
|
+
g.selectAll(
|
|
784
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
785
|
+
).attr("opacity", FADE_OPACITY);
|
|
786
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
787
|
+
svg.selectAll(".gantt-task-label").attr("opacity", FADE_OPACITY);
|
|
788
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
789
|
+
g.selectAll(
|
|
790
|
+
".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
|
|
791
|
+
).attr("opacity", FADE_OPACITY);
|
|
792
|
+
g.selectAll(
|
|
793
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
794
|
+
).attr("opacity", FADE_OPACITY);
|
|
795
|
+
g.selectAll(".gantt-era-group").attr(
|
|
796
|
+
"opacity",
|
|
797
|
+
FADE_OPACITY
|
|
798
|
+
);
|
|
799
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
800
|
+
"opacity",
|
|
801
|
+
FADE_OPACITY
|
|
802
|
+
);
|
|
803
|
+
showGanttDateIndicators(
|
|
804
|
+
g,
|
|
805
|
+
xScale,
|
|
806
|
+
todayDateObj,
|
|
807
|
+
null,
|
|
808
|
+
sInnerHeight,
|
|
809
|
+
todayColor
|
|
810
|
+
);
|
|
811
|
+
}).on("mouseleave", () => {
|
|
812
|
+
resetHighlight(g, svg);
|
|
813
|
+
hideGanttDateIndicators(g);
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
if (resolved.options.dependencies) {
|
|
817
|
+
renderDependencyArrows(
|
|
818
|
+
g,
|
|
819
|
+
resolved,
|
|
820
|
+
taskPositions,
|
|
821
|
+
groupPositions,
|
|
822
|
+
collapsedGroups,
|
|
823
|
+
palette,
|
|
824
|
+
isDark,
|
|
825
|
+
isTagMode,
|
|
826
|
+
lanePositions,
|
|
827
|
+
collapsedLanes,
|
|
828
|
+
taskLaneMap
|
|
829
|
+
);
|
|
830
|
+
if (!dependenciesActive) {
|
|
831
|
+
g.selectAll(
|
|
832
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead, .gantt-dep-label"
|
|
833
|
+
).attr("display", "none");
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
var JS_DAY_TO_WEEKDAY = [
|
|
838
|
+
"sun",
|
|
839
|
+
"mon",
|
|
840
|
+
"tue",
|
|
841
|
+
"wed",
|
|
842
|
+
"thu",
|
|
843
|
+
"fri",
|
|
844
|
+
"sat"
|
|
845
|
+
];
|
|
846
|
+
function renderWeekendBands(g, resolved, xScale, innerHeight, palette, isDark) {
|
|
847
|
+
const workweek = new Set(resolved.holidays.workweek);
|
|
848
|
+
const start = new Date(resolved.startDate);
|
|
849
|
+
start.setDate(start.getDate() - 1);
|
|
850
|
+
const end = new Date(resolved.endDate);
|
|
851
|
+
end.setDate(end.getDate() + 1);
|
|
852
|
+
const current = new Date(start);
|
|
853
|
+
let bandStart = null;
|
|
854
|
+
while (current <= end) {
|
|
855
|
+
const dayName = JS_DAY_TO_WEEKDAY[current.getDay()];
|
|
856
|
+
const isWeekend = !workweek.has(dayName);
|
|
857
|
+
if (isWeekend && !bandStart) {
|
|
858
|
+
bandStart = new Date(current);
|
|
859
|
+
} else if (!isWeekend && bandStart) {
|
|
860
|
+
drawBand(
|
|
861
|
+
g,
|
|
862
|
+
xScale,
|
|
863
|
+
bandStart,
|
|
864
|
+
current,
|
|
865
|
+
innerHeight,
|
|
866
|
+
palette,
|
|
867
|
+
isDark,
|
|
868
|
+
"gantt-weekend-band",
|
|
869
|
+
0.04
|
|
870
|
+
);
|
|
871
|
+
bandStart = null;
|
|
872
|
+
}
|
|
873
|
+
current.setDate(current.getDate() + 1);
|
|
874
|
+
}
|
|
875
|
+
if (bandStart) {
|
|
876
|
+
drawBand(
|
|
877
|
+
g,
|
|
878
|
+
xScale,
|
|
879
|
+
bandStart,
|
|
880
|
+
current,
|
|
881
|
+
innerHeight,
|
|
882
|
+
palette,
|
|
883
|
+
isDark,
|
|
884
|
+
"gantt-weekend-band",
|
|
885
|
+
0.04
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function renderHolidayBands(g, svg, resolved, xScale, innerHeight, palette, isDark, headerY, chartLeftMargin, onClickItem) {
|
|
890
|
+
for (const h of resolved.holidays.dates) {
|
|
891
|
+
const start = /* @__PURE__ */ new Date(h.date + "T00:00:00");
|
|
892
|
+
const end = new Date(start);
|
|
893
|
+
end.setDate(end.getDate() + 1);
|
|
894
|
+
drawHolidayBand(
|
|
895
|
+
g,
|
|
896
|
+
svg,
|
|
897
|
+
xScale,
|
|
898
|
+
start,
|
|
899
|
+
end,
|
|
900
|
+
innerHeight,
|
|
901
|
+
palette,
|
|
902
|
+
isDark,
|
|
903
|
+
h.label,
|
|
904
|
+
h.lineNumber,
|
|
905
|
+
headerY,
|
|
906
|
+
chartLeftMargin,
|
|
907
|
+
onClickItem
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
for (const r of resolved.holidays.ranges) {
|
|
911
|
+
const start = /* @__PURE__ */ new Date(r.startDate + "T00:00:00");
|
|
912
|
+
const end = /* @__PURE__ */ new Date(r.endDate + "T00:00:00");
|
|
913
|
+
end.setDate(end.getDate() + 1);
|
|
914
|
+
drawHolidayBand(
|
|
915
|
+
g,
|
|
916
|
+
svg,
|
|
917
|
+
xScale,
|
|
918
|
+
start,
|
|
919
|
+
end,
|
|
920
|
+
innerHeight,
|
|
921
|
+
palette,
|
|
922
|
+
isDark,
|
|
923
|
+
r.label,
|
|
924
|
+
r.lineNumber,
|
|
925
|
+
headerY,
|
|
926
|
+
chartLeftMargin,
|
|
927
|
+
onClickItem
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
function drawBand(g, xScale, start, end, height, palette, _isDark, className, opacity) {
|
|
932
|
+
const x1 = xScale(dateToFractionalYear(start));
|
|
933
|
+
const x2 = xScale(dateToFractionalYear(end));
|
|
934
|
+
if (x2 <= x1) return;
|
|
935
|
+
g.append("rect").attr("class", className).attr("x", x1).attr("y", 0).attr("width", x2 - x1).attr("height", height).attr("fill", palette.text).attr("opacity", opacity).attr("pointer-events", "none");
|
|
936
|
+
}
|
|
937
|
+
function drawHolidayBand(g, svg, xScale, start, end, height, palette, _isDark, label, lineNumber, headerY, chartLeftMargin, onClickItem) {
|
|
938
|
+
const x1 = xScale(dateToFractionalYear(start));
|
|
939
|
+
const x2 = xScale(dateToFractionalYear(end));
|
|
940
|
+
if (x2 <= x1) return;
|
|
941
|
+
const bandW = Math.max(x2 - x1, 4);
|
|
942
|
+
const baseOpacity = 0.08;
|
|
943
|
+
const hoverOpacity = 0.18;
|
|
944
|
+
const bandG = g.append("g").attr("class", "gantt-holiday-band").attr("data-line-number", String(lineNumber)).style("cursor", onClickItem ? "pointer" : "default");
|
|
945
|
+
const bandRect = bandG.append("rect").attr("x", x1).attr("y", 0).attr("width", bandW).attr("height", height).attr("fill", palette.text).attr("opacity", baseOpacity);
|
|
946
|
+
const labelX = chartLeftMargin + x1 + bandW / 2;
|
|
947
|
+
const textLen = measureText(label, 10) + 8;
|
|
948
|
+
const labelBg = svg.append("rect").attr("class", "gantt-holiday-hover-bg").attr("data-line-number", String(lineNumber)).attr("x", labelX - textLen / 2).attr("y", headerY - 11).attr("width", textLen).attr("height", 14).attr("rx", 3).attr("fill", palette.bg).attr("opacity", 0).attr("pointer-events", "none");
|
|
949
|
+
const labelText = svg.append("text").attr("class", "gantt-holiday-hover-label").attr("data-line-number", String(lineNumber)).attr("x", labelX).attr("y", headerY).attr("text-anchor", "middle").attr("font-size", "10px").attr("font-weight", "500").attr("fill", palette.text).attr("opacity", 0).attr("pointer-events", "none").text(label);
|
|
950
|
+
bandG.on("mouseenter", () => {
|
|
951
|
+
bandRect.attr("opacity", hoverOpacity);
|
|
952
|
+
labelBg.attr("opacity", 1);
|
|
953
|
+
labelText.attr("opacity", 1);
|
|
954
|
+
showGanttDateIndicators(g, xScale, start, end, height, palette.textMuted);
|
|
955
|
+
}).on("mouseleave", () => {
|
|
956
|
+
bandRect.attr("opacity", baseOpacity);
|
|
957
|
+
labelBg.attr("opacity", 0);
|
|
958
|
+
labelText.attr("opacity", 0);
|
|
959
|
+
hideGanttDateIndicators(g);
|
|
960
|
+
}).on("click", () => {
|
|
961
|
+
if (onClickItem) onClickItem(lineNumber);
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
function findCollapsedGroupPos(rt, collapsedGroups, groupPositions) {
|
|
965
|
+
if (!collapsedGroups) return void 0;
|
|
966
|
+
for (const groupName of rt.groupPath) {
|
|
967
|
+
if (collapsedGroups.has(groupName)) {
|
|
968
|
+
return groupPositions.get(groupName);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return void 0;
|
|
972
|
+
}
|
|
973
|
+
function findCollapsedLanePos(rt, collapsedLanes, taskLaneMap, lanePositions) {
|
|
974
|
+
if (!collapsedLanes) return void 0;
|
|
975
|
+
const laneName = taskLaneMap.get(rt.task.id);
|
|
976
|
+
if (laneName && collapsedLanes.has(laneName)) {
|
|
977
|
+
return lanePositions.get(laneName);
|
|
978
|
+
}
|
|
979
|
+
return void 0;
|
|
980
|
+
}
|
|
981
|
+
function renderDependencyArrows(g, resolved, taskPositions, groupPositions, collapsedGroups, palette, _isDark, isTagMode, lanePositions, collapsedLanes, taskLaneMap) {
|
|
982
|
+
const drawnArrows = /* @__PURE__ */ new Set();
|
|
983
|
+
for (const rt of resolved.tasks) {
|
|
984
|
+
const sourcePos = taskPositions.get(rt.task.id) ?? (isTagMode ? findCollapsedLanePos(rt, collapsedLanes, taskLaneMap, lanePositions) : findCollapsedGroupPos(rt, collapsedGroups, groupPositions));
|
|
985
|
+
if (!sourcePos) continue;
|
|
986
|
+
for (const dep of rt.task.dependencies) {
|
|
987
|
+
const depKey = normalizeName(dep.targetName);
|
|
988
|
+
const targetTask = resolved.tasks.find(
|
|
989
|
+
(t) => normalizeName(t.task.label) === depKey || normalizeName(`${t.groupPath.join(".")}.${t.task.label}`).endsWith(
|
|
990
|
+
depKey
|
|
991
|
+
)
|
|
992
|
+
);
|
|
993
|
+
if (!targetTask) continue;
|
|
994
|
+
const targetPos = taskPositions.get(targetTask.task.id) ?? (isTagMode ? findCollapsedLanePos(
|
|
995
|
+
targetTask,
|
|
996
|
+
collapsedLanes,
|
|
997
|
+
taskLaneMap,
|
|
998
|
+
lanePositions
|
|
999
|
+
) : findCollapsedGroupPos(targetTask, collapsedGroups, groupPositions));
|
|
1000
|
+
if (!targetPos) continue;
|
|
1001
|
+
if (sourcePos === targetPos) continue;
|
|
1002
|
+
const arrowKey = `${sourcePos.x1},${sourcePos.y}->${targetPos.x1},${targetPos.y}`;
|
|
1003
|
+
if (drawnArrows.has(arrowKey)) continue;
|
|
1004
|
+
drawnArrows.add(arrowKey);
|
|
1005
|
+
const sx = sourcePos.x2;
|
|
1006
|
+
const sy = sourcePos.y;
|
|
1007
|
+
const tx = targetPos.x1;
|
|
1008
|
+
const ty = targetPos.y;
|
|
1009
|
+
const dx = Math.abs(tx - sx);
|
|
1010
|
+
const dy = Math.abs(ty - sy);
|
|
1011
|
+
const cpOffset = Math.max(dx * 0.3, 15, dy * 0.4);
|
|
1012
|
+
const path = `M ${sx} ${sy} C ${sx + cpOffset} ${sy}, ${tx - cpOffset} ${ty}, ${tx} ${ty}`;
|
|
1013
|
+
const arrowColor = mix(palette.text, palette.bg, 50);
|
|
1014
|
+
const isCpArrow = rt.isCriticalPath && targetTask.isCriticalPath;
|
|
1015
|
+
g.append("path").attr("class", "gantt-dep-arrow").attr("data-dep-from", rt.task.id).attr("data-dep-to", targetTask.task.id).attr("data-line-number", String(dep.lineNumber)).attr("data-critical-path", isCpArrow ? "true" : null).attr("d", path).attr("fill", "none").attr("stroke", arrowColor).attr("stroke-width", 1.5).attr("opacity", 0.5);
|
|
1016
|
+
const headSize = 5;
|
|
1017
|
+
const angle = 0;
|
|
1018
|
+
g.append("polygon").attr("class", "gantt-dep-arrowhead").attr("data-dep-from", rt.task.id).attr("data-dep-to", targetTask.task.id).attr("data-line-number", String(dep.lineNumber)).attr("data-critical-path", isCpArrow ? "true" : null).attr("points", arrowheadPoints(tx, ty, headSize, angle)).attr("fill", arrowColor).attr("opacity", 0.5);
|
|
1019
|
+
if (dep.label) {
|
|
1020
|
+
const midX = (sx + tx) / 2;
|
|
1021
|
+
const midY = (sy + ty) / 2;
|
|
1022
|
+
const labelEl = g.append("text").attr("class", "gantt-dep-label").attr("data-dep-from", rt.task.id).attr("data-dep-to", targetTask.task.id).attr("x", midX).attr("y", midY - 4).attr("text-anchor", "middle").attr("font-size", 10).attr("font-family", FONT_FAMILY).attr("fill", palette.text).attr("opacity", 0.7).text(dep.label);
|
|
1023
|
+
const bbox = labelEl.node()?.getBBox?.();
|
|
1024
|
+
if (bbox && bbox.width > 0) {
|
|
1025
|
+
g.insert("rect", ".gantt-dep-label:last-of-type").attr("class", "gantt-dep-label-bg").attr("x", bbox.x - 2).attr("y", bbox.y - 1).attr("width", bbox.width + 4).attr("height", bbox.height + 2).attr("fill", palette.bg).attr("opacity", 0.8).attr("rx", 2);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
function arrowheadPoints(x, y, size, angle) {
|
|
1032
|
+
const a1 = angle + Math.PI * 0.8;
|
|
1033
|
+
const a2 = angle - Math.PI * 0.8;
|
|
1034
|
+
return `${x},${y} ${x + size * Math.cos(a1)},${y + size * Math.sin(a1)} ${x + size * Math.cos(a2)},${y + size * Math.sin(a2)}`;
|
|
1035
|
+
}
|
|
1036
|
+
function applyCriticalPathHighlight(svg, chartG) {
|
|
1037
|
+
svg.attr("data-critical-path-active", "true");
|
|
1038
|
+
chartG.selectAll(".gantt-task").each(function() {
|
|
1039
|
+
const el = d3Selection.select(this);
|
|
1040
|
+
el.attr(
|
|
1041
|
+
"opacity",
|
|
1042
|
+
el.attr("data-critical-path") === "true" ? 1 : FADE_OPACITY
|
|
1043
|
+
);
|
|
1044
|
+
});
|
|
1045
|
+
chartG.selectAll(".gantt-milestone").attr("opacity", FADE_OPACITY);
|
|
1046
|
+
chartG.selectAll(".gantt-group-bar, .gantt-group-summary").attr("opacity", FADE_OPACITY);
|
|
1047
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1048
|
+
const el = d3Selection.select(this);
|
|
1049
|
+
el.attr(
|
|
1050
|
+
"opacity",
|
|
1051
|
+
el.attr("data-critical-path") === "true" ? 1 : FADE_OPACITY
|
|
1052
|
+
);
|
|
1053
|
+
});
|
|
1054
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1055
|
+
svg.selectAll(".gantt-group-band-bg, .gantt-group-band-accent").attr("opacity", FADE_OPACITY);
|
|
1056
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1057
|
+
svg.selectAll(".gantt-lane-band-bg, .gantt-lane-band-accent").attr("opacity", FADE_OPACITY);
|
|
1058
|
+
chartG.selectAll(".gantt-lane-band, .gantt-lane-accent").attr("opacity", FADE_OPACITY);
|
|
1059
|
+
chartG.selectAll(".gantt-dep-arrow, .gantt-dep-arrowhead").each(function() {
|
|
1060
|
+
const el = d3Selection.select(this);
|
|
1061
|
+
el.attr(
|
|
1062
|
+
"opacity",
|
|
1063
|
+
el.attr("data-critical-path") === "true" ? 0.7 : FADE_OPACITY
|
|
1064
|
+
);
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
function resetHighlightAll(svg, chartG) {
|
|
1068
|
+
chartG.selectAll(".gantt-task, .gantt-milestone").attr("opacity", 1);
|
|
1069
|
+
chartG.selectAll(".gantt-group-bar, .gantt-group-summary").attr("opacity", 1);
|
|
1070
|
+
svg.selectAll(".gantt-task-label").attr("opacity", 1);
|
|
1071
|
+
svg.selectAll(".gantt-group-label").attr("opacity", 1);
|
|
1072
|
+
svg.selectAll(".gantt-group-band-bg, .gantt-group-band-accent").attr("opacity", 1);
|
|
1073
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", 1);
|
|
1074
|
+
svg.selectAll(".gantt-lane-band-bg, .gantt-lane-band-accent").attr("opacity", 1);
|
|
1075
|
+
chartG.selectAll(".gantt-lane-band, .gantt-lane-accent").attr("opacity", 1);
|
|
1076
|
+
chartG.selectAll(".gantt-dep-arrow, .gantt-dep-arrowhead").attr("opacity", 0.5);
|
|
1077
|
+
}
|
|
1078
|
+
function drawSwimlaneIcon(parent, x, y, isActive, palette) {
|
|
1079
|
+
const iconG = parent.append("g").attr("class", "gantt-swimlane-icon").attr("transform", `translate(${x}, ${y})`);
|
|
1080
|
+
iconG.append("rect").attr("x", -5).attr("y", -5).attr("width", 22).attr("height", 18).attr("fill", "transparent");
|
|
1081
|
+
const color = isActive ? palette.primary : palette.textMuted;
|
|
1082
|
+
const opacity = isActive ? 1 : 0.35;
|
|
1083
|
+
const barWidths = [8, 12, 6];
|
|
1084
|
+
const barH = 2;
|
|
1085
|
+
const gap = 3;
|
|
1086
|
+
for (let i = 0; i < barWidths.length; i++) {
|
|
1087
|
+
iconG.append("rect").attr("x", 0).attr("y", i * gap).attr("width", barWidths[i]).attr("height", barH).attr("rx", 1).attr("fill", color).attr("opacity", opacity);
|
|
1088
|
+
}
|
|
1089
|
+
return iconG;
|
|
1090
|
+
}
|
|
1091
|
+
function buildControlsToggles(hasCriticalPath, criticalPathActive, hasDependencies, dependenciesActive) {
|
|
1092
|
+
const toggles = [];
|
|
1093
|
+
if (hasCriticalPath) {
|
|
1094
|
+
toggles.push({
|
|
1095
|
+
id: "critical-path",
|
|
1096
|
+
type: "toggle",
|
|
1097
|
+
label: "Critical Path",
|
|
1098
|
+
active: criticalPathActive,
|
|
1099
|
+
onToggle: () => {
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
if (hasDependencies) {
|
|
1104
|
+
toggles.push({
|
|
1105
|
+
id: "dependencies",
|
|
1106
|
+
type: "toggle",
|
|
1107
|
+
label: "Dependencies",
|
|
1108
|
+
active: dependenciesActive,
|
|
1109
|
+
onToggle: () => {
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
return toggles;
|
|
1114
|
+
}
|
|
1115
|
+
function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargin, chartInnerWidth, legendY, palette, isDark, hasCriticalPath, criticalPathActive, _optionLineNumbers, onToggle, onToggleControlsExpand, currentSwimlaneGroup, onSwimlaneChange, legendViewMode, resolvedTasks, controlsExpanded = false, hasDependencies = false, dependenciesActive = false, onControlsToggle, exportMode = false, controlsHost = "inline") {
|
|
1116
|
+
let visibleGroups;
|
|
1117
|
+
if (activeGroupName) {
|
|
1118
|
+
const activeGroup = tagGroups.filter(
|
|
1119
|
+
(g) => g.name.toLowerCase() === activeGroupName.toLowerCase()
|
|
1120
|
+
);
|
|
1121
|
+
const swimlaneGroup = currentSwimlaneGroup && currentSwimlaneGroup.toLowerCase() !== activeGroupName.toLowerCase() ? tagGroups.filter(
|
|
1122
|
+
(g) => g.name.toLowerCase() === currentSwimlaneGroup.toLowerCase()
|
|
1123
|
+
) : [];
|
|
1124
|
+
visibleGroups = [...swimlaneGroup, ...activeGroup];
|
|
1125
|
+
} else {
|
|
1126
|
+
visibleGroups = tagGroups;
|
|
1127
|
+
}
|
|
1128
|
+
const usedValues = /* @__PURE__ */ new Map();
|
|
1129
|
+
if (resolvedTasks) {
|
|
1130
|
+
for (const group of visibleGroups) {
|
|
1131
|
+
const key = tagAttrKey(group.name);
|
|
1132
|
+
const used = /* @__PURE__ */ new Set();
|
|
1133
|
+
for (const rt of resolvedTasks) {
|
|
1134
|
+
const val = rt.effectiveMetadata[key];
|
|
1135
|
+
if (val) used.add(val.toLowerCase());
|
|
1136
|
+
}
|
|
1137
|
+
usedValues.set(key, used);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
const filteredEntries = /* @__PURE__ */ new Map();
|
|
1141
|
+
for (const group of visibleGroups) {
|
|
1142
|
+
const key = tagAttrKey(group.name);
|
|
1143
|
+
const used = usedValues.get(key);
|
|
1144
|
+
if (used && used.size > 0) {
|
|
1145
|
+
filteredEntries.set(
|
|
1146
|
+
key,
|
|
1147
|
+
group.entries.filter((e) => used.has(e.value.toLowerCase()))
|
|
1148
|
+
);
|
|
1149
|
+
} else {
|
|
1150
|
+
filteredEntries.set(key, group.entries);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
const groupWidths = [];
|
|
1154
|
+
let totalW = 0;
|
|
1155
|
+
for (const group of visibleGroups) {
|
|
1156
|
+
const isActive = activeGroupName?.toLowerCase() === group.name.toLowerCase();
|
|
1157
|
+
const isSwimlane = currentSwimlaneGroup?.toLowerCase() === group.name.toLowerCase();
|
|
1158
|
+
const showIcon = !legendViewMode && tagGroups.length > 0;
|
|
1159
|
+
const iconReserve = showIcon && isActive ? LEGEND_ICON_W : 0;
|
|
1160
|
+
const pillW = measureLegendText(group.name, LEGEND_PILL_FONT_SIZE) + LEGEND_PILL_PAD + iconReserve;
|
|
1161
|
+
let groupW = pillW;
|
|
1162
|
+
if (isActive) {
|
|
1163
|
+
const entries = filteredEntries.get(tagAttrKey(group.name)) ?? group.entries;
|
|
1164
|
+
let entriesW = 0;
|
|
1165
|
+
for (const entry of entries) {
|
|
1166
|
+
entriesW += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + measureLegendText(entry.value, LEGEND_ENTRY_FONT_SIZE) + LEGEND_ENTRY_TRAIL;
|
|
1167
|
+
}
|
|
1168
|
+
groupW = LEGEND_CAPSULE_PAD * 2 + pillW + 4 + entriesW;
|
|
1169
|
+
} else if (isSwimlane && !isActive) {
|
|
1170
|
+
groupW = pillW;
|
|
1171
|
+
}
|
|
1172
|
+
groupWidths.push(groupW);
|
|
1173
|
+
totalW += groupW;
|
|
1174
|
+
}
|
|
1175
|
+
totalW += Math.max(0, (visibleGroups.length - 1) * LEGEND_GROUP_GAP);
|
|
1176
|
+
const hasControls = hasCriticalPath || hasDependencies;
|
|
1177
|
+
const controlsToggleLabels = [];
|
|
1178
|
+
if (hasCriticalPath) controlsToggleLabels.push({ label: "Critical Path" });
|
|
1179
|
+
if (hasDependencies) controlsToggleLabels.push({ label: "Dependencies" });
|
|
1180
|
+
if (hasControls) {
|
|
1181
|
+
if (visibleGroups.length > 0) totalW += LEGEND_GROUP_GAP;
|
|
1182
|
+
totalW += controlsExpanded ? controlsGroupCapsuleWidth(controlsToggleLabels) : LEGEND_GEAR_PILL_W;
|
|
1183
|
+
}
|
|
1184
|
+
const containerWidth = chartLeftMargin + chartInnerWidth + RIGHT_MARGIN;
|
|
1185
|
+
const legendX = (containerWidth - totalW) / 2;
|
|
1186
|
+
const legendRow = svg.append("g").attr("class", "gantt-tag-legend-container").attr("transform", `translate(${legendX}, ${legendY})`);
|
|
1187
|
+
if (visibleGroups.length > 0) {
|
|
1188
|
+
const showIcon = !legendViewMode && tagGroups.length > 0;
|
|
1189
|
+
const iconReserve = showIcon ? LEGEND_ICON_W : 0;
|
|
1190
|
+
const legendGroups = visibleGroups.map((g) => {
|
|
1191
|
+
const key = g.name.toLowerCase();
|
|
1192
|
+
const entries = filteredEntries.get(key) ?? g.entries;
|
|
1193
|
+
return {
|
|
1194
|
+
name: g.name,
|
|
1195
|
+
entries: entries.map((e) => ({ value: e.value, color: e.color }))
|
|
1196
|
+
};
|
|
1197
|
+
});
|
|
1198
|
+
const controlsToggles = buildControlsToggles(
|
|
1199
|
+
hasCriticalPath,
|
|
1200
|
+
criticalPathActive,
|
|
1201
|
+
hasDependencies,
|
|
1202
|
+
dependenciesActive
|
|
1203
|
+
);
|
|
1204
|
+
let tagGroupsW = (
|
|
1205
|
+
// In-bounds: groupWidths has one entry per visibleGroups item.
|
|
1206
|
+
visibleGroups.reduce((s, _, i) => s + groupWidths[i], 0) + Math.max(0, (visibleGroups.length - 1) * LEGEND_GROUP_GAP)
|
|
1207
|
+
);
|
|
1208
|
+
if (hasControls) {
|
|
1209
|
+
if (visibleGroups.length > 0) tagGroupsW += LEGEND_GROUP_GAP;
|
|
1210
|
+
tagGroupsW += controlsExpanded ? controlsGroupCapsuleWidth(controlsToggleLabels) : LEGEND_GEAR_PILL_W;
|
|
1211
|
+
}
|
|
1212
|
+
const tagGroupG = legendRow.append("g");
|
|
1213
|
+
const legendCallbacks = {
|
|
1214
|
+
...onToggle !== void 0 && { onGroupToggle: onToggle },
|
|
1215
|
+
...onToggleControlsExpand !== void 0 && {
|
|
1216
|
+
onControlsExpand: onToggleControlsExpand
|
|
1217
|
+
},
|
|
1218
|
+
...onControlsToggle !== void 0 && { onControlsToggle },
|
|
1219
|
+
onEntryHover: (groupName, entryValue) => {
|
|
1220
|
+
const tagKey = tagAttrKey(groupName);
|
|
1221
|
+
if (entryValue) {
|
|
1222
|
+
const ev = entryValue.toLowerCase();
|
|
1223
|
+
chartG.selectAll(".gantt-task").each(function() {
|
|
1224
|
+
const el = d3Selection.select(this);
|
|
1225
|
+
el.attr(
|
|
1226
|
+
"opacity",
|
|
1227
|
+
el.attr(`data-tag-${tagKey}`) === ev ? 1 : FADE_OPACITY
|
|
1228
|
+
);
|
|
1229
|
+
});
|
|
1230
|
+
chartG.selectAll(".gantt-milestone").attr("opacity", FADE_OPACITY);
|
|
1231
|
+
chartG.selectAll(".gantt-group-bar, .gantt-group-summary").attr("opacity", FADE_OPACITY);
|
|
1232
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1233
|
+
const el = d3Selection.select(this);
|
|
1234
|
+
el.attr(
|
|
1235
|
+
"opacity",
|
|
1236
|
+
el.attr(`data-tag-${tagKey}`) === ev ? 1 : FADE_OPACITY
|
|
1237
|
+
);
|
|
1238
|
+
});
|
|
1239
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1240
|
+
svg.selectAll(".gantt-lane-header").each(function() {
|
|
1241
|
+
const el = d3Selection.select(this);
|
|
1242
|
+
el.attr(
|
|
1243
|
+
"opacity",
|
|
1244
|
+
el.attr(`data-tag-${tagKey}`) === ev ? 1 : FADE_OPACITY
|
|
1245
|
+
);
|
|
1246
|
+
});
|
|
1247
|
+
chartG.selectAll(".gantt-lane-band, .gantt-lane-accent").attr("opacity", FADE_OPACITY);
|
|
1248
|
+
} else {
|
|
1249
|
+
if (criticalPathActive) {
|
|
1250
|
+
applyCriticalPathHighlight(svg, chartG);
|
|
1251
|
+
} else {
|
|
1252
|
+
resetHighlightAll(svg, chartG);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
},
|
|
1256
|
+
onGroupRendered: (groupName, groupEl, _isActive) => {
|
|
1257
|
+
const group = visibleGroups.find((g) => g.name === groupName);
|
|
1258
|
+
if (group) {
|
|
1259
|
+
groupEl.attr("data-tag-group", group.name).attr("data-line-number", String(group.lineNumber));
|
|
1260
|
+
}
|
|
1261
|
+
if (showIcon && _isActive) {
|
|
1262
|
+
const isSwimlane = currentSwimlaneGroup?.toLowerCase() === groupName.toLowerCase();
|
|
1263
|
+
const textW = measureLegendText(groupName, LEGEND_PILL_FONT_SIZE) + LEGEND_PILL_PAD;
|
|
1264
|
+
const pillXOff = LEGEND_CAPSULE_PAD;
|
|
1265
|
+
const iconX = pillXOff + textW + 3;
|
|
1266
|
+
const iconY = (LEGEND_HEIGHT - 10) / 2;
|
|
1267
|
+
const iconEl = drawSwimlaneIcon(
|
|
1268
|
+
groupEl,
|
|
1269
|
+
iconX,
|
|
1270
|
+
iconY,
|
|
1271
|
+
isSwimlane,
|
|
1272
|
+
palette
|
|
1273
|
+
);
|
|
1274
|
+
iconEl.append("title").text(`Group by ${groupName}`);
|
|
1275
|
+
iconEl.style("cursor", "pointer").on("click", (event) => {
|
|
1276
|
+
event.stopPropagation();
|
|
1277
|
+
if (onSwimlaneChange) {
|
|
1278
|
+
onSwimlaneChange(
|
|
1279
|
+
currentSwimlaneGroup?.toLowerCase() === groupName.toLowerCase() ? null : groupName
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
};
|
|
1286
|
+
renderIntegratedLegend(tagGroupG, {
|
|
1287
|
+
groups: legendGroups,
|
|
1288
|
+
palette,
|
|
1289
|
+
isDark,
|
|
1290
|
+
width: tagGroupsW,
|
|
1291
|
+
mode: exportMode ? "export" : "preview",
|
|
1292
|
+
capsulePillAddonWidth: iconReserve,
|
|
1293
|
+
...controlsToggles.length > 0 && {
|
|
1294
|
+
controlsGroup: { toggles: controlsToggles }
|
|
1295
|
+
},
|
|
1296
|
+
// 'app' suppresses the inline gear so the desktop ControlsStrip hosts the
|
|
1297
|
+
// Critical Path / Dependencies toggles instead (export keeps inline).
|
|
1298
|
+
...controlsHost === "app" && !exportMode && { controlsHost: "app" },
|
|
1299
|
+
activeGroup: activeGroupName,
|
|
1300
|
+
controlsExpanded,
|
|
1301
|
+
callbacks: legendCallbacks
|
|
1302
|
+
});
|
|
1303
|
+
} else if (hasControls) {
|
|
1304
|
+
const controlsToggles = buildControlsToggles(
|
|
1305
|
+
hasCriticalPath,
|
|
1306
|
+
criticalPathActive,
|
|
1307
|
+
hasDependencies,
|
|
1308
|
+
dependenciesActive
|
|
1309
|
+
);
|
|
1310
|
+
const tagGroupG = legendRow.append("g");
|
|
1311
|
+
renderIntegratedLegend(tagGroupG, {
|
|
1312
|
+
groups: [],
|
|
1313
|
+
palette,
|
|
1314
|
+
isDark,
|
|
1315
|
+
width: totalW,
|
|
1316
|
+
mode: exportMode ? "export" : "preview",
|
|
1317
|
+
controlsGroup: { toggles: controlsToggles },
|
|
1318
|
+
...controlsHost === "app" && !exportMode && { controlsHost: "app" },
|
|
1319
|
+
activeGroup: null,
|
|
1320
|
+
controlsExpanded,
|
|
1321
|
+
callbacks: {
|
|
1322
|
+
...onToggleControlsExpand !== void 0 && {
|
|
1323
|
+
onControlsExpand: onToggleControlsExpand
|
|
1324
|
+
},
|
|
1325
|
+
...onControlsToggle !== void 0 && { onControlsToggle }
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
if (criticalPathActive) {
|
|
1330
|
+
applyCriticalPathHighlight(svg, chartG);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
var ERA_COLORS = ["#3b6ea5", "#5b9357", "#c9a227", "#cc7a33", "#7d5ba6"];
|
|
1334
|
+
function renderErasAndMarkers(g, svg, resolved, xScale, innerHeight, palette, eraLabelY, markerLabelY) {
|
|
1335
|
+
for (let i = 0; i < resolved.eras.length; i++) {
|
|
1336
|
+
const era = resolved.eras[i];
|
|
1337
|
+
if (!era) continue;
|
|
1338
|
+
const color = era.color || ERA_COLORS[i % ERA_COLORS.length];
|
|
1339
|
+
const sx = xScale(parseDateToFractionalYear(era.startDate));
|
|
1340
|
+
const ex = xScale(parseDateToFractionalYear(era.endDate));
|
|
1341
|
+
if (ex <= sx) continue;
|
|
1342
|
+
const baseEraOpacity = 0.08;
|
|
1343
|
+
const hoverEraOpacity = 0.16;
|
|
1344
|
+
const eraStartDate = parseDateStringToDate(era.startDate);
|
|
1345
|
+
const eraEndDate = parseDateStringToDate(era.endDate);
|
|
1346
|
+
const eraG = g.append("g").attr("class", "gantt-era-group").attr("data-line-number", String(era.lineNumber));
|
|
1347
|
+
const eraRect = eraG.append("rect").attr("class", "gantt-era").attr("x", sx).attr("y", 0).attr("width", ex - sx).attr("height", innerHeight).attr("fill", color).attr("opacity", baseEraOpacity);
|
|
1348
|
+
const eraLabelMaxW = Math.max(0, ex - sx - 8);
|
|
1349
|
+
const eraDisplayLabel = truncateLegendText(era.label, 10, eraLabelMaxW);
|
|
1350
|
+
const eraTruncated = eraDisplayLabel !== era.label;
|
|
1351
|
+
const eraLabel = eraG.append("text").attr("class", "gantt-era-label").attr("x", (sx + ex) / 2).attr("y", eraLabelY).attr("text-anchor", "middle").attr("font-size", "10px").attr("fill", color).attr("opacity", 0.7).style("cursor", "pointer").text(eraDisplayLabel);
|
|
1352
|
+
eraG.on("mouseenter", () => {
|
|
1353
|
+
g.selectAll(".gantt-task").attr(
|
|
1354
|
+
"opacity",
|
|
1355
|
+
FADE_OPACITY
|
|
1356
|
+
);
|
|
1357
|
+
g.selectAll(".gantt-milestone").attr(
|
|
1358
|
+
"opacity",
|
|
1359
|
+
FADE_OPACITY
|
|
1360
|
+
);
|
|
1361
|
+
g.selectAll(
|
|
1362
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1363
|
+
).attr("opacity", FADE_OPACITY);
|
|
1364
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1365
|
+
svg.selectAll(".gantt-task-label").attr("opacity", FADE_OPACITY);
|
|
1366
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1367
|
+
g.selectAll(
|
|
1368
|
+
".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
|
|
1369
|
+
).attr("opacity", FADE_OPACITY);
|
|
1370
|
+
g.selectAll(
|
|
1371
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
1372
|
+
).attr("opacity", FADE_OPACITY);
|
|
1373
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1374
|
+
"opacity",
|
|
1375
|
+
FADE_OPACITY
|
|
1376
|
+
);
|
|
1377
|
+
eraRect.attr("opacity", hoverEraOpacity);
|
|
1378
|
+
if (eraTruncated) eraLabel.text(era.label);
|
|
1379
|
+
showGanttDateIndicators(
|
|
1380
|
+
g,
|
|
1381
|
+
xScale,
|
|
1382
|
+
eraStartDate,
|
|
1383
|
+
eraEndDate,
|
|
1384
|
+
innerHeight,
|
|
1385
|
+
color
|
|
1386
|
+
);
|
|
1387
|
+
}).on("mouseleave", () => {
|
|
1388
|
+
resetHighlight(g, svg);
|
|
1389
|
+
eraRect.attr("opacity", baseEraOpacity);
|
|
1390
|
+
if (eraTruncated) eraLabel.text(eraDisplayLabel);
|
|
1391
|
+
hideGanttDateIndicators(g);
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
const markerXs = resolved.markers.map(
|
|
1395
|
+
(m) => xScale(parseDateToFractionalYear(m.date))
|
|
1396
|
+
);
|
|
1397
|
+
const innerWidth = xScale.range()[1];
|
|
1398
|
+
for (let i = 0; i < resolved.markers.length; i++) {
|
|
1399
|
+
const marker = resolved.markers[i];
|
|
1400
|
+
if (!marker) continue;
|
|
1401
|
+
const color = marker.color || palette.accent || "#3a9188";
|
|
1402
|
+
const mx = markerXs[i];
|
|
1403
|
+
const markerDate = parseDateStringToDate(marker.date);
|
|
1404
|
+
const diamondSize = 5;
|
|
1405
|
+
const labelY = markerLabelY;
|
|
1406
|
+
const diamondY = -2;
|
|
1407
|
+
let nearestDist = Math.min(mx, innerWidth - mx);
|
|
1408
|
+
for (let j = 0; j < markerXs.length; j++) {
|
|
1409
|
+
if (j === i) continue;
|
|
1410
|
+
const d = Math.abs(markerXs[j] - mx);
|
|
1411
|
+
if (d < nearestDist) nearestDist = d;
|
|
1412
|
+
}
|
|
1413
|
+
const markerLabelMaxW = Math.max(0, nearestDist - 8);
|
|
1414
|
+
const markerDisplayLabel = truncateLegendText(
|
|
1415
|
+
marker.label,
|
|
1416
|
+
11,
|
|
1417
|
+
markerLabelMaxW
|
|
1418
|
+
);
|
|
1419
|
+
const markerTruncated = markerDisplayLabel !== marker.label;
|
|
1420
|
+
const markerG = g.append("g").attr("class", "gantt-marker-group").attr("data-line-number", String(marker.lineNumber)).style("cursor", "pointer");
|
|
1421
|
+
markerG.append("rect").attr("x", mx - 40).attr("y", labelY - 12).attr("width", 80).attr("height", innerHeight - labelY + 12).attr("fill", "transparent").attr("pointer-events", "all");
|
|
1422
|
+
const markerLabelEl = markerG.append("text").attr("class", "gantt-marker-label").attr("x", mx).attr("y", labelY).attr("text-anchor", "middle").attr("font-size", "11px").attr("font-weight", "600").attr("fill", color).text(markerDisplayLabel);
|
|
1423
|
+
markerG.append("path").attr(
|
|
1424
|
+
"d",
|
|
1425
|
+
`M${mx},${diamondY - diamondSize} l${diamondSize},${diamondSize} l-${diamondSize},${diamondSize} l-${diamondSize},-${diamondSize} Z`
|
|
1426
|
+
).attr("fill", color).attr("opacity", 0.9);
|
|
1427
|
+
markerG.append("line").attr("class", "gantt-marker").attr("x1", mx).attr("y1", diamondY + diamondSize).attr("x2", mx).attr("y2", innerHeight).attr("stroke", color).attr("stroke-width", 1.5).attr("stroke-dasharray", "6 4").attr("opacity", 0.5);
|
|
1428
|
+
const markerLine = markerG.select(".gantt-marker");
|
|
1429
|
+
const markerDiamond = markerG.select("path");
|
|
1430
|
+
markerG.on("mouseenter", () => {
|
|
1431
|
+
g.selectAll(".gantt-task").attr(
|
|
1432
|
+
"opacity",
|
|
1433
|
+
FADE_OPACITY
|
|
1434
|
+
);
|
|
1435
|
+
g.selectAll(".gantt-milestone").attr(
|
|
1436
|
+
"opacity",
|
|
1437
|
+
FADE_OPACITY
|
|
1438
|
+
);
|
|
1439
|
+
g.selectAll(
|
|
1440
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1441
|
+
).attr("opacity", FADE_OPACITY);
|
|
1442
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1443
|
+
svg.selectAll(".gantt-task-label").attr("opacity", FADE_OPACITY);
|
|
1444
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1445
|
+
g.selectAll(
|
|
1446
|
+
".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
|
|
1447
|
+
).attr("opacity", FADE_OPACITY);
|
|
1448
|
+
g.selectAll(
|
|
1449
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
1450
|
+
).attr("opacity", FADE_OPACITY);
|
|
1451
|
+
g.selectAll(".gantt-era-group").attr(
|
|
1452
|
+
"opacity",
|
|
1453
|
+
FADE_OPACITY
|
|
1454
|
+
);
|
|
1455
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1456
|
+
"opacity",
|
|
1457
|
+
FADE_OPACITY
|
|
1458
|
+
);
|
|
1459
|
+
markerG.attr("opacity", 1);
|
|
1460
|
+
markerLine.attr("opacity", 0.8);
|
|
1461
|
+
markerDiamond.attr("opacity", 0);
|
|
1462
|
+
if (markerTruncated) markerLabelEl.text(marker.label);
|
|
1463
|
+
showGanttDateIndicators(
|
|
1464
|
+
g,
|
|
1465
|
+
xScale,
|
|
1466
|
+
markerDate,
|
|
1467
|
+
null,
|
|
1468
|
+
innerHeight,
|
|
1469
|
+
color,
|
|
1470
|
+
{ skipStartLine: true }
|
|
1471
|
+
);
|
|
1472
|
+
}).on("mouseleave", () => {
|
|
1473
|
+
resetHighlight(g, svg);
|
|
1474
|
+
markerLine.attr("opacity", 0.5);
|
|
1475
|
+
markerDiamond.attr("opacity", 0.9);
|
|
1476
|
+
if (markerTruncated) markerLabelEl.text(markerDisplayLabel);
|
|
1477
|
+
hideGanttDateIndicators(g);
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
var SPRINT_BAND_OPACITY = 0.05;
|
|
1482
|
+
var SPRINT_HOVER_OPACITY = 0.12;
|
|
1483
|
+
var SPRINT_BOUNDARY_OPACITY = 0.3;
|
|
1484
|
+
function renderSprintBands(g, svg, resolved, xScale, innerHeight, palette) {
|
|
1485
|
+
if (resolved.sprints.length === 0) return;
|
|
1486
|
+
if (resolved.eras.length > 0) return;
|
|
1487
|
+
const bandColor = palette.textMuted || palette.text || "#888";
|
|
1488
|
+
const chartMinX = 0;
|
|
1489
|
+
for (let i = 0; i < resolved.sprints.length; i++) {
|
|
1490
|
+
const sprint = resolved.sprints[i];
|
|
1491
|
+
if (!sprint) continue;
|
|
1492
|
+
const rawSx = xScale(dateToFractionalYear(sprint.startDate));
|
|
1493
|
+
const rawEx = xScale(dateToFractionalYear(sprint.endDate));
|
|
1494
|
+
if (rawEx <= rawSx) continue;
|
|
1495
|
+
const sx = Math.max(rawSx, chartMinX);
|
|
1496
|
+
const ex = rawEx;
|
|
1497
|
+
const bandWidth = ex - sx;
|
|
1498
|
+
if (bandWidth <= 0) continue;
|
|
1499
|
+
const sprintG = g.append("g").attr("class", "gantt-sprint-group").style("cursor", "pointer");
|
|
1500
|
+
const sprintRect = sprintG.append("rect").attr("class", "gantt-sprint-band").attr("x", sx).attr("y", 0).attr("width", bandWidth).attr("height", innerHeight).attr("fill", bandColor).attr("opacity", sprint.number % 2 === 0 ? SPRINT_BAND_OPACITY : 0);
|
|
1501
|
+
if (sprint.number % 2 !== 0) {
|
|
1502
|
+
sprintG.append("rect").attr("x", sx).attr("y", 0).attr("width", bandWidth).attr("height", innerHeight).attr("fill", "transparent");
|
|
1503
|
+
}
|
|
1504
|
+
const sprintLabel = sprintG.append("text").attr("class", "gantt-sprint-label").attr("x", (sx + ex) / 2).attr("y", -22).attr("text-anchor", "middle").attr("font-size", "10px").attr("font-weight", "600").attr("fill", bandColor).attr("opacity", 0.4).text(String(sprint.number));
|
|
1505
|
+
if (i > 0 && rawSx >= chartMinX) {
|
|
1506
|
+
sprintG.append("line").attr("class", "gantt-sprint-boundary").attr("x1", sx).attr("y1", -6).attr("x2", sx).attr("y2", innerHeight).attr("stroke", bandColor).attr("stroke-width", 1).attr("stroke-dasharray", "3 3").attr("opacity", SPRINT_BOUNDARY_OPACITY);
|
|
1507
|
+
}
|
|
1508
|
+
const sprintStartMs = sprint.startDate.getTime();
|
|
1509
|
+
const sprintEndMs = sprint.endDate.getTime();
|
|
1510
|
+
const overlappingTaskIds = /* @__PURE__ */ new Set();
|
|
1511
|
+
for (const rt of resolved.tasks) {
|
|
1512
|
+
const taskStart = rt.startDate.getTime();
|
|
1513
|
+
const taskEnd = rt.endDate.getTime();
|
|
1514
|
+
if (taskStart < sprintEndMs && taskEnd > sprintStartMs) {
|
|
1515
|
+
overlappingTaskIds.add(rt.task.id);
|
|
1516
|
+
}
|
|
1517
|
+
if (taskStart === taskEnd && taskStart >= sprintStartMs && taskStart < sprintEndMs) {
|
|
1518
|
+
overlappingTaskIds.add(rt.task.id);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
const overlappingGroupNames = /* @__PURE__ */ new Set();
|
|
1522
|
+
for (const rg of resolved.groups) {
|
|
1523
|
+
const gStart = rg.startDate.getTime();
|
|
1524
|
+
const gEnd = rg.endDate.getTime();
|
|
1525
|
+
if (gStart < sprintEndMs && gEnd > sprintStartMs) {
|
|
1526
|
+
overlappingGroupNames.add(rg.name);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
const baseOpacity = sprint.number % 2 === 0 ? SPRINT_BAND_OPACITY : 0;
|
|
1530
|
+
sprintG.on("mouseenter", () => {
|
|
1531
|
+
g.selectAll(".gantt-task").each(function() {
|
|
1532
|
+
const el = d3Selection.select(this);
|
|
1533
|
+
const id = el.attr("data-task-id");
|
|
1534
|
+
el.attr(
|
|
1535
|
+
"opacity",
|
|
1536
|
+
id && overlappingTaskIds.has(id) ? 1 : FADE_OPACITY
|
|
1537
|
+
);
|
|
1538
|
+
});
|
|
1539
|
+
g.selectAll(".gantt-milestone").each(function() {
|
|
1540
|
+
const el = d3Selection.select(this);
|
|
1541
|
+
const id = el.attr("data-task-id");
|
|
1542
|
+
el.attr(
|
|
1543
|
+
"opacity",
|
|
1544
|
+
id && overlappingTaskIds.has(id) ? 1 : FADE_OPACITY
|
|
1545
|
+
);
|
|
1546
|
+
});
|
|
1547
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1548
|
+
const el = d3Selection.select(this);
|
|
1549
|
+
const id = el.attr("data-task-id");
|
|
1550
|
+
el.attr(
|
|
1551
|
+
"opacity",
|
|
1552
|
+
id && overlappingTaskIds.has(id) ? 1 : FADE_OPACITY
|
|
1553
|
+
);
|
|
1554
|
+
});
|
|
1555
|
+
g.selectAll(
|
|
1556
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1557
|
+
).each(function() {
|
|
1558
|
+
const el = d3Selection.select(this);
|
|
1559
|
+
const name = el.attr("data-group");
|
|
1560
|
+
el.attr(
|
|
1561
|
+
"opacity",
|
|
1562
|
+
name && overlappingGroupNames.has(name) ? 1 : FADE_OPACITY
|
|
1563
|
+
);
|
|
1564
|
+
});
|
|
1565
|
+
svg.selectAll(".gantt-group-label").each(function() {
|
|
1566
|
+
const el = d3Selection.select(this);
|
|
1567
|
+
const name = el.attr("data-group");
|
|
1568
|
+
el.attr(
|
|
1569
|
+
"opacity",
|
|
1570
|
+
name && overlappingGroupNames.has(name) ? 1 : FADE_OPACITY
|
|
1571
|
+
);
|
|
1572
|
+
});
|
|
1573
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1574
|
+
g.selectAll(
|
|
1575
|
+
".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
|
|
1576
|
+
).attr("opacity", FADE_OPACITY);
|
|
1577
|
+
g.selectAll(
|
|
1578
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
1579
|
+
).attr("opacity", FADE_OPACITY);
|
|
1580
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1581
|
+
"opacity",
|
|
1582
|
+
FADE_OPACITY
|
|
1583
|
+
);
|
|
1584
|
+
sprintRect.attr("opacity", SPRINT_HOVER_OPACITY);
|
|
1585
|
+
const startVisible = rawSx >= chartMinX;
|
|
1586
|
+
if (startVisible) {
|
|
1587
|
+
showGanttDateIndicators(
|
|
1588
|
+
g,
|
|
1589
|
+
xScale,
|
|
1590
|
+
sprint.startDate,
|
|
1591
|
+
sprint.endDate,
|
|
1592
|
+
innerHeight,
|
|
1593
|
+
bandColor
|
|
1594
|
+
);
|
|
1595
|
+
} else {
|
|
1596
|
+
showGanttDateIndicators(
|
|
1597
|
+
g,
|
|
1598
|
+
xScale,
|
|
1599
|
+
sprint.endDate,
|
|
1600
|
+
null,
|
|
1601
|
+
innerHeight,
|
|
1602
|
+
bandColor
|
|
1603
|
+
);
|
|
1604
|
+
}
|
|
1605
|
+
const accentColor = palette.accent || palette.text || bandColor;
|
|
1606
|
+
sprintLabel.text(`Sprint ${sprint.number}`).attr("font-size", "13px").attr("font-weight", "700").attr("fill", accentColor).attr("opacity", 1);
|
|
1607
|
+
}).on("mouseleave", () => {
|
|
1608
|
+
resetHighlight(g, svg);
|
|
1609
|
+
sprintRect.attr("opacity", baseOpacity);
|
|
1610
|
+
sprintLabel.text(String(sprint.number)).attr("font-size", "10px").attr("font-weight", "600").attr("fill", bandColor).attr("opacity", 0.4);
|
|
1611
|
+
hideGanttDateIndicators(g);
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
const lastSprint = resolved.sprints[resolved.sprints.length - 1];
|
|
1615
|
+
const lastEx = xScale(dateToFractionalYear(lastSprint.endDate));
|
|
1616
|
+
g.append("line").attr("class", "gantt-sprint-boundary").attr("x1", lastEx).attr("y1", -6).attr("x2", lastEx).attr("y2", innerHeight).attr("stroke", bandColor).attr("stroke-width", 1).attr("stroke-dasharray", "3 3").attr("opacity", SPRINT_BOUNDARY_OPACITY);
|
|
1617
|
+
}
|
|
1618
|
+
function parseDateStringToDate(s) {
|
|
1619
|
+
const parts = s.split("-").map((p) => parseInt(p, 10));
|
|
1620
|
+
const year = parts[0];
|
|
1621
|
+
const month = parts.length >= 2 ? parts[1] - 1 : 0;
|
|
1622
|
+
const day = parts.length >= 3 ? parts[2] : 1;
|
|
1623
|
+
return new Date(year, month, day);
|
|
1624
|
+
}
|
|
1625
|
+
function parseDateToFractionalYear(s) {
|
|
1626
|
+
return dateToFractionalYear(parseDateStringToDate(s));
|
|
1627
|
+
}
|
|
1628
|
+
var FADE_OPACITY = 0.1;
|
|
1629
|
+
function highlightDeps(g, svg, taskId, resolved) {
|
|
1630
|
+
const related = /* @__PURE__ */ new Set([taskId]);
|
|
1631
|
+
const task = resolved.tasks.find((t) => t.task.id === taskId);
|
|
1632
|
+
if (!task) return;
|
|
1633
|
+
for (const rt of resolved.tasks) {
|
|
1634
|
+
for (const dep of rt.task.dependencies) {
|
|
1635
|
+
const depKey = normalizeName(dep.targetName);
|
|
1636
|
+
if (depKey === normalizeName(task.task.label) || normalizeName(
|
|
1637
|
+
`${task.groupPath.join(".")}.${task.task.label}`
|
|
1638
|
+
).endsWith(depKey)) {
|
|
1639
|
+
related.add(rt.task.id);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
for (const dep of task.task.dependencies) {
|
|
1644
|
+
const target = resolved.tasks.find(
|
|
1645
|
+
(t) => t.task.label === dep.targetName || `${t.groupPath.join(".")}.${t.task.label}`.endsWith(dep.targetName)
|
|
1646
|
+
);
|
|
1647
|
+
if (target) related.add(target.task.id);
|
|
1648
|
+
}
|
|
1649
|
+
g.selectAll(".gantt-task").each(function() {
|
|
1650
|
+
const el = d3Selection.select(this);
|
|
1651
|
+
const id = el.attr("data-task-id");
|
|
1652
|
+
el.attr("opacity", id && related.has(id) ? 1 : FADE_OPACITY);
|
|
1653
|
+
});
|
|
1654
|
+
g.selectAll(".gantt-milestone").attr(
|
|
1655
|
+
"opacity",
|
|
1656
|
+
FADE_OPACITY
|
|
1657
|
+
);
|
|
1658
|
+
g.selectAll(
|
|
1659
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1660
|
+
).attr("opacity", FADE_OPACITY);
|
|
1661
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1662
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1663
|
+
g.selectAll(".gantt-lane-band, .gantt-lane-accent").attr(
|
|
1664
|
+
"opacity",
|
|
1665
|
+
FADE_OPACITY
|
|
1666
|
+
);
|
|
1667
|
+
g.selectAll(
|
|
1668
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
1669
|
+
).each(function() {
|
|
1670
|
+
const el = d3Selection.select(this);
|
|
1671
|
+
const from = el.attr("data-dep-from");
|
|
1672
|
+
const to = el.attr("data-dep-to");
|
|
1673
|
+
const isRelated = from && related.has(from) || to && related.has(to);
|
|
1674
|
+
el.attr("opacity", isRelated ? 0.5 : FADE_OPACITY);
|
|
1675
|
+
});
|
|
1676
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1677
|
+
"opacity",
|
|
1678
|
+
FADE_OPACITY
|
|
1679
|
+
);
|
|
1680
|
+
}
|
|
1681
|
+
function highlightGroup(g, svg, groupName) {
|
|
1682
|
+
g.selectAll(".gantt-task").each(function() {
|
|
1683
|
+
const el = d3Selection.select(this);
|
|
1684
|
+
el.attr("opacity", el.attr("data-group") === groupName ? 1 : FADE_OPACITY);
|
|
1685
|
+
});
|
|
1686
|
+
g.selectAll(".gantt-milestone").each(function() {
|
|
1687
|
+
const el = d3Selection.select(this);
|
|
1688
|
+
el.attr("opacity", el.attr("data-group") === groupName ? 1 : FADE_OPACITY);
|
|
1689
|
+
});
|
|
1690
|
+
g.selectAll(
|
|
1691
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1692
|
+
).each(function() {
|
|
1693
|
+
const el = d3Selection.select(this);
|
|
1694
|
+
el.attr("opacity", el.attr("data-group") === groupName ? 1 : FADE_OPACITY);
|
|
1695
|
+
});
|
|
1696
|
+
svg.selectAll(".gantt-group-label").each(function() {
|
|
1697
|
+
const el = d3Selection.select(this);
|
|
1698
|
+
el.attr("opacity", el.attr("data-group") === groupName ? 1 : FADE_OPACITY);
|
|
1699
|
+
});
|
|
1700
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1701
|
+
const el = d3Selection.select(this);
|
|
1702
|
+
el.attr("opacity", el.attr("data-group") === groupName ? 1 : FADE_OPACITY);
|
|
1703
|
+
});
|
|
1704
|
+
svg.selectAll(".gantt-group-band-bg, .gantt-group-band-accent").each(function() {
|
|
1705
|
+
const el = d3Selection.select(this);
|
|
1706
|
+
el.attr(
|
|
1707
|
+
"opacity",
|
|
1708
|
+
el.attr("data-group") === groupName ? 1 : FADE_OPACITY
|
|
1709
|
+
);
|
|
1710
|
+
});
|
|
1711
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1712
|
+
svg.selectAll(".gantt-lane-band-bg, .gantt-lane-band-accent").attr("opacity", FADE_OPACITY);
|
|
1713
|
+
g.selectAll(".gantt-lane-band, .gantt-lane-accent").attr(
|
|
1714
|
+
"opacity",
|
|
1715
|
+
FADE_OPACITY
|
|
1716
|
+
);
|
|
1717
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1718
|
+
"opacity",
|
|
1719
|
+
FADE_OPACITY
|
|
1720
|
+
);
|
|
1721
|
+
}
|
|
1722
|
+
function highlightLane(g, svg, tagKey, laneName) {
|
|
1723
|
+
const tagAttr = `data-tag-${tagKey}`;
|
|
1724
|
+
const laneValue = laneName.toLowerCase();
|
|
1725
|
+
g.selectAll(".gantt-task").each(function() {
|
|
1726
|
+
const el = d3Selection.select(this);
|
|
1727
|
+
el.attr("opacity", el.attr(tagAttr) === laneValue ? 1 : FADE_OPACITY);
|
|
1728
|
+
});
|
|
1729
|
+
g.selectAll(".gantt-milestone").each(function() {
|
|
1730
|
+
const el = d3Selection.select(this);
|
|
1731
|
+
el.attr("opacity", el.attr(tagAttr) === laneValue ? 1 : FADE_OPACITY);
|
|
1732
|
+
});
|
|
1733
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1734
|
+
const el = d3Selection.select(this);
|
|
1735
|
+
el.attr("opacity", el.attr(tagAttr) === laneValue ? 1 : FADE_OPACITY);
|
|
1736
|
+
});
|
|
1737
|
+
svg.selectAll(".gantt-lane-header").each(function() {
|
|
1738
|
+
const el = d3Selection.select(this);
|
|
1739
|
+
el.attr("opacity", el.attr("data-lane") === laneName ? 1 : FADE_OPACITY);
|
|
1740
|
+
});
|
|
1741
|
+
g.selectAll(".gantt-lane-band-group").each(function() {
|
|
1742
|
+
const el = d3Selection.select(this);
|
|
1743
|
+
el.attr("opacity", el.attr("data-lane") === laneName ? 1 : FADE_OPACITY);
|
|
1744
|
+
});
|
|
1745
|
+
svg.selectAll(".gantt-lane-band-bg, .gantt-lane-band-accent").each(function() {
|
|
1746
|
+
const el = d3Selection.select(this);
|
|
1747
|
+
el.attr("opacity", el.attr("data-lane") === laneName ? 1 : FADE_OPACITY);
|
|
1748
|
+
});
|
|
1749
|
+
g.selectAll(
|
|
1750
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1751
|
+
).attr("opacity", FADE_OPACITY);
|
|
1752
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1753
|
+
svg.selectAll(".gantt-group-band-bg, .gantt-group-band-accent").attr("opacity", FADE_OPACITY);
|
|
1754
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1755
|
+
"opacity",
|
|
1756
|
+
FADE_OPACITY
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
function highlightTask(g, svg, taskId) {
|
|
1760
|
+
g.selectAll(".gantt-task").each(function() {
|
|
1761
|
+
const el = d3Selection.select(this);
|
|
1762
|
+
el.attr("opacity", el.attr("data-task-id") === taskId ? 1 : FADE_OPACITY);
|
|
1763
|
+
});
|
|
1764
|
+
g.selectAll(".gantt-milestone").attr(
|
|
1765
|
+
"opacity",
|
|
1766
|
+
FADE_OPACITY
|
|
1767
|
+
);
|
|
1768
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1769
|
+
const el = d3Selection.select(this);
|
|
1770
|
+
el.attr("opacity", el.attr("data-task-id") === taskId ? 1 : FADE_OPACITY);
|
|
1771
|
+
});
|
|
1772
|
+
g.selectAll(
|
|
1773
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1774
|
+
).attr("opacity", FADE_OPACITY);
|
|
1775
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1776
|
+
svg.selectAll(".gantt-group-band-bg, .gantt-group-band-accent").attr("opacity", FADE_OPACITY);
|
|
1777
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1778
|
+
svg.selectAll(".gantt-lane-band-bg, .gantt-lane-band-accent").attr("opacity", FADE_OPACITY);
|
|
1779
|
+
g.selectAll(
|
|
1780
|
+
".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
|
|
1781
|
+
).attr("opacity", FADE_OPACITY);
|
|
1782
|
+
g.selectAll(
|
|
1783
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
1784
|
+
).attr("opacity", FADE_OPACITY);
|
|
1785
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1786
|
+
"opacity",
|
|
1787
|
+
FADE_OPACITY
|
|
1788
|
+
);
|
|
1789
|
+
}
|
|
1790
|
+
function highlightMilestone(g, svg, taskId) {
|
|
1791
|
+
g.selectAll(".gantt-task").attr(
|
|
1792
|
+
"opacity",
|
|
1793
|
+
FADE_OPACITY
|
|
1794
|
+
);
|
|
1795
|
+
g.selectAll(".gantt-milestone").each(function() {
|
|
1796
|
+
const el = d3Selection.select(this);
|
|
1797
|
+
el.attr("opacity", el.attr("data-task-id") === taskId ? 1 : FADE_OPACITY);
|
|
1798
|
+
});
|
|
1799
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1800
|
+
const el = d3Selection.select(this);
|
|
1801
|
+
el.attr("opacity", el.attr("data-task-id") === taskId ? 1 : FADE_OPACITY);
|
|
1802
|
+
});
|
|
1803
|
+
g.selectAll(
|
|
1804
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1805
|
+
).attr("opacity", FADE_OPACITY);
|
|
1806
|
+
svg.selectAll(".gantt-group-label").attr("opacity", FADE_OPACITY);
|
|
1807
|
+
svg.selectAll(".gantt-group-band-bg, .gantt-group-band-accent").attr("opacity", FADE_OPACITY);
|
|
1808
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", FADE_OPACITY);
|
|
1809
|
+
svg.selectAll(".gantt-lane-band-bg, .gantt-lane-band-accent").attr("opacity", FADE_OPACITY);
|
|
1810
|
+
g.selectAll(
|
|
1811
|
+
".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
|
|
1812
|
+
).attr("opacity", FADE_OPACITY);
|
|
1813
|
+
g.selectAll(
|
|
1814
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
1815
|
+
).attr("opacity", FADE_OPACITY);
|
|
1816
|
+
g.selectAll(".gantt-marker-group").attr(
|
|
1817
|
+
"opacity",
|
|
1818
|
+
FADE_OPACITY
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
function highlightTaskLabel(svg, lineNumber) {
|
|
1822
|
+
const ln = String(lineNumber);
|
|
1823
|
+
svg.selectAll(".gantt-task-label").each(function() {
|
|
1824
|
+
const el = d3Selection.select(this);
|
|
1825
|
+
el.attr("opacity", el.attr("data-line-number") === ln ? 1 : FADE_OPACITY);
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
function resetTaskLabels(svg) {
|
|
1829
|
+
svg.selectAll(".gantt-task-label").attr("opacity", 1);
|
|
1830
|
+
}
|
|
1831
|
+
function resetHighlight(g, svg) {
|
|
1832
|
+
if (svg.attr("data-critical-path-active") === "true") {
|
|
1833
|
+
applyCriticalPathHighlight(svg, g);
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1836
|
+
g.selectAll(".gantt-task, .gantt-milestone").attr(
|
|
1837
|
+
"opacity",
|
|
1838
|
+
1
|
|
1839
|
+
);
|
|
1840
|
+
g.selectAll(
|
|
1841
|
+
".gantt-group-bar, .gantt-group-summary"
|
|
1842
|
+
).attr("opacity", 1);
|
|
1843
|
+
svg.selectAll(".gantt-group-label").attr("opacity", 1);
|
|
1844
|
+
svg.selectAll(".gantt-group-band-bg, .gantt-group-band-accent").attr("opacity", 1);
|
|
1845
|
+
svg.selectAll(".gantt-task-label").attr("opacity", 1);
|
|
1846
|
+
svg.selectAll(".gantt-lane-header").attr("opacity", 1);
|
|
1847
|
+
svg.selectAll(".gantt-lane-band-bg, .gantt-lane-band-accent").attr("opacity", 1);
|
|
1848
|
+
g.selectAll(
|
|
1849
|
+
".gantt-lane-band, .gantt-lane-accent, .gantt-lane-band-group"
|
|
1850
|
+
).attr("opacity", 1);
|
|
1851
|
+
g.selectAll(
|
|
1852
|
+
".gantt-dep-arrow, .gantt-dep-arrowhead"
|
|
1853
|
+
).attr("opacity", 0.5);
|
|
1854
|
+
g.selectAll(".gantt-marker-group").attr("opacity", 1);
|
|
1855
|
+
g.selectAll(".gantt-era-group").attr("opacity", 1);
|
|
1856
|
+
}
|
|
1857
|
+
function buildRowList(resolved, collapsedGroups) {
|
|
1858
|
+
const rows = [];
|
|
1859
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
1860
|
+
for (const g of resolved.groups) {
|
|
1861
|
+
groupMap.set(g.name, g);
|
|
1862
|
+
}
|
|
1863
|
+
const groupOrder = /* @__PURE__ */ new Map();
|
|
1864
|
+
resolved.groups.forEach((g, i) => groupOrder.set(g.name, i));
|
|
1865
|
+
const sortedTasks = [...resolved.tasks].sort((a, b) => {
|
|
1866
|
+
const maxLen = Math.max(a.groupPath.length, b.groupPath.length);
|
|
1867
|
+
for (let i = 0; i < maxLen; i++) {
|
|
1868
|
+
const ga = a.groupPath[i];
|
|
1869
|
+
const gb = b.groupPath[i];
|
|
1870
|
+
if (ga === gb) continue;
|
|
1871
|
+
if (ga === void 0) return -1;
|
|
1872
|
+
if (gb === void 0) return 1;
|
|
1873
|
+
const oa = groupOrder.get(ga) ?? 0;
|
|
1874
|
+
const ob = groupOrder.get(gb) ?? 0;
|
|
1875
|
+
if (oa !== ob) return oa - ob;
|
|
1876
|
+
}
|
|
1877
|
+
return 0;
|
|
1878
|
+
});
|
|
1879
|
+
const seenGroups = /* @__PURE__ */ new Set();
|
|
1880
|
+
for (const rt of sortedTasks) {
|
|
1881
|
+
const isHidden = rt.groupPath.some((g) => collapsedGroups?.has(g));
|
|
1882
|
+
if (isHidden) {
|
|
1883
|
+
for (const groupName of rt.groupPath) {
|
|
1884
|
+
if (!seenGroups.has(groupName)) {
|
|
1885
|
+
seenGroups.add(groupName);
|
|
1886
|
+
const group = groupMap.get(groupName);
|
|
1887
|
+
if (group) {
|
|
1888
|
+
rows.push({ type: "group", group });
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
if (collapsedGroups?.has(groupName)) break;
|
|
1892
|
+
}
|
|
1893
|
+
continue;
|
|
1894
|
+
}
|
|
1895
|
+
for (let i = 0; i < rt.groupPath.length; i++) {
|
|
1896
|
+
const groupName = rt.groupPath[i];
|
|
1897
|
+
if (groupName === void 0) continue;
|
|
1898
|
+
if (!seenGroups.has(groupName)) {
|
|
1899
|
+
seenGroups.add(groupName);
|
|
1900
|
+
const group = groupMap.get(groupName);
|
|
1901
|
+
if (group) {
|
|
1902
|
+
rows.push({ type: "group", group });
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
rows.push({ type: "task", task: rt });
|
|
1907
|
+
}
|
|
1908
|
+
return rows;
|
|
1909
|
+
}
|
|
1910
|
+
function buildTagLaneRowList(resolved, swimlaneGroup, collapsedLanes) {
|
|
1911
|
+
const tagGroup = resolved.tagGroups.find(
|
|
1912
|
+
(g) => g.name.toLowerCase() === swimlaneGroup.toLowerCase()
|
|
1913
|
+
);
|
|
1914
|
+
if (!tagGroup) return null;
|
|
1915
|
+
const tagKey = tagAttrKey(tagGroup.name);
|
|
1916
|
+
const rows = [];
|
|
1917
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
1918
|
+
const unbucketed = [];
|
|
1919
|
+
for (const rt of resolved.tasks) {
|
|
1920
|
+
let value = rt.effectiveMetadata[tagKey];
|
|
1921
|
+
if (!value && tagGroup.defaultValue) {
|
|
1922
|
+
value = tagGroup.defaultValue;
|
|
1923
|
+
}
|
|
1924
|
+
if (value) {
|
|
1925
|
+
const key = value.toLowerCase();
|
|
1926
|
+
if (!buckets.has(key)) buckets.set(key, []);
|
|
1927
|
+
buckets.get(key).push(rt);
|
|
1928
|
+
} else {
|
|
1929
|
+
unbucketed.push(rt);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
for (const entry of tagGroup.entries) {
|
|
1933
|
+
const entryKey = entry.value.toLowerCase();
|
|
1934
|
+
const tasks = buckets.get(entryKey) ?? [];
|
|
1935
|
+
if (tasks.length === 0) continue;
|
|
1936
|
+
tasks.sort((a, b) => a.startDate.getTime() - b.startDate.getTime());
|
|
1937
|
+
const aggregateProgress = durationWeightedProgress(tasks);
|
|
1938
|
+
const laneStartDate = tasks.length > 0 ? new Date(Math.min(...tasks.map((t) => t.startDate.getTime()))) : null;
|
|
1939
|
+
const laneEndDate = tasks.length > 0 ? new Date(Math.max(...tasks.map((t) => t.endDate.getTime()))) : null;
|
|
1940
|
+
const isCollapsed = collapsedLanes?.has(entry.value) ?? false;
|
|
1941
|
+
rows.push({
|
|
1942
|
+
type: "lane-header",
|
|
1943
|
+
laneName: entry.value,
|
|
1944
|
+
laneColor: entry.color,
|
|
1945
|
+
aggregateProgress,
|
|
1946
|
+
tagKey,
|
|
1947
|
+
isCollapsed,
|
|
1948
|
+
laneStartDate,
|
|
1949
|
+
laneEndDate
|
|
1950
|
+
});
|
|
1951
|
+
if (!isCollapsed) {
|
|
1952
|
+
for (const rt of tasks) {
|
|
1953
|
+
rows.push({ type: "task", task: rt });
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
if (unbucketed.length > 0) {
|
|
1958
|
+
unbucketed.sort((a, b) => a.startDate.getTime() - b.startDate.getTime());
|
|
1959
|
+
const aggregateProgress = durationWeightedProgress(unbucketed);
|
|
1960
|
+
const noLaneStartDate = unbucketed.length > 0 ? new Date(Math.min(...unbucketed.map((t) => t.startDate.getTime()))) : null;
|
|
1961
|
+
const noLaneEndDate = unbucketed.length > 0 ? new Date(Math.max(...unbucketed.map((t) => t.endDate.getTime()))) : null;
|
|
1962
|
+
const noLaneName = `No ${tagGroup.name}`;
|
|
1963
|
+
const isCollapsed = collapsedLanes?.has(noLaneName) ?? false;
|
|
1964
|
+
rows.push({
|
|
1965
|
+
type: "lane-header",
|
|
1966
|
+
laneName: noLaneName,
|
|
1967
|
+
laneColor: "#999999",
|
|
1968
|
+
aggregateProgress,
|
|
1969
|
+
tagKey,
|
|
1970
|
+
isCollapsed,
|
|
1971
|
+
laneStartDate: noLaneStartDate,
|
|
1972
|
+
laneEndDate: noLaneEndDate
|
|
1973
|
+
});
|
|
1974
|
+
if (!isCollapsed) {
|
|
1975
|
+
for (const rt of unbucketed) {
|
|
1976
|
+
rows.push({ type: "task", task: rt });
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
return rows;
|
|
1981
|
+
}
|
|
1982
|
+
function durationWeightedProgress(tasks) {
|
|
1983
|
+
let totalDuration = 0;
|
|
1984
|
+
let totalProgress = 0;
|
|
1985
|
+
let hasProgress = false;
|
|
1986
|
+
for (const rt of tasks) {
|
|
1987
|
+
const dur = rt.endDate.getTime() - rt.startDate.getTime();
|
|
1988
|
+
totalDuration += dur;
|
|
1989
|
+
if (rt.task.progress !== null) {
|
|
1990
|
+
totalProgress += rt.task.progress * dur;
|
|
1991
|
+
hasProgress = true;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
return hasProgress && totalDuration > 0 ? totalProgress / totalDuration : null;
|
|
1995
|
+
}
|
|
1996
|
+
function dateToFractionalYear(d) {
|
|
1997
|
+
const y = d.getFullYear();
|
|
1998
|
+
const startOfYear = new Date(y, 0, 1);
|
|
1999
|
+
const endOfYear = new Date(y + 1, 0, 1);
|
|
2000
|
+
const fraction = (d.getTime() - startOfYear.getTime()) / (endOfYear.getTime() - startOfYear.getTime());
|
|
2001
|
+
return y + fraction;
|
|
2002
|
+
}
|
|
2003
|
+
function diamondPoints(cx, cy, size) {
|
|
2004
|
+
const half = size / 2;
|
|
2005
|
+
return `${cx},${cy - half} ${cx + half},${cy} ${cx},${cy + half} ${cx - half},${cy}`;
|
|
2006
|
+
}
|
|
2007
|
+
function formatGanttDate(d) {
|
|
2008
|
+
const base = `${MONTH_ABBR[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
|
|
2009
|
+
if (d.getHours() === 0 && d.getMinutes() === 0) return base;
|
|
2010
|
+
const hh = String(d.getHours()).padStart(2, "0");
|
|
2011
|
+
const mm = String(d.getMinutes()).padStart(2, "0");
|
|
2012
|
+
return `${base} ${hh}:${mm}`;
|
|
2013
|
+
}
|
|
2014
|
+
function showGanttDateIndicators(g, xScale, startDate, endDate, innerHeight, color, options) {
|
|
2015
|
+
g.selectAll(".gantt-scale-tick").attr("opacity", 0.05);
|
|
2016
|
+
g.selectAll(".gantt-today").attr("opacity", 0.05);
|
|
2017
|
+
const hg = g.append("g").attr("class", "gantt-hover-date").attr("pointer-events", "none");
|
|
2018
|
+
const tickLen = 6;
|
|
2019
|
+
const startPos = xScale(dateToFractionalYear(startDate));
|
|
2020
|
+
const startLabel = formatGanttDate(startDate);
|
|
2021
|
+
if (!options?.skipStartLine) {
|
|
2022
|
+
hg.append("line").attr("class", "gantt-hover-date").attr("x1", startPos).attr("y1", -tickLen).attr("x2", startPos).attr("y2", innerHeight).attr("stroke", color).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4").attr("opacity", 0.6);
|
|
2023
|
+
}
|
|
2024
|
+
hg.append("text").attr("class", "gantt-hover-date").attr("x", startPos).attr("y", -tickLen - 4).attr("text-anchor", "middle").attr("fill", color).attr("font-size", "10px").attr("font-weight", "600").text(startLabel);
|
|
2025
|
+
hg.append("text").attr("class", "gantt-hover-date").attr("x", startPos).attr("y", innerHeight + tickLen + 12).attr("text-anchor", "middle").attr("fill", color).attr("font-size", "10px").attr("font-weight", "600").text(startLabel);
|
|
2026
|
+
if (endDate && endDate.getTime() !== startDate.getTime()) {
|
|
2027
|
+
const endPos = xScale(dateToFractionalYear(endDate));
|
|
2028
|
+
const endLabel = formatGanttDate(endDate);
|
|
2029
|
+
const minLabelGap = 90;
|
|
2030
|
+
const gap = endPos - startPos;
|
|
2031
|
+
let startLabelX = startPos;
|
|
2032
|
+
let endLabelX = endPos;
|
|
2033
|
+
let startAnchor = "middle";
|
|
2034
|
+
let endAnchor = "middle";
|
|
2035
|
+
if (gap < minLabelGap) {
|
|
2036
|
+
const mid = (startPos + endPos) / 2;
|
|
2037
|
+
startLabelX = mid - minLabelGap / 2;
|
|
2038
|
+
endLabelX = mid + minLabelGap / 2;
|
|
2039
|
+
startAnchor = "middle";
|
|
2040
|
+
endAnchor = "middle";
|
|
2041
|
+
}
|
|
2042
|
+
hg.append("line").attr("class", "gantt-hover-date").attr("x1", endPos).attr("y1", -tickLen).attr("x2", endPos).attr("y2", innerHeight).attr("stroke", color).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4").attr("opacity", 0.6);
|
|
2043
|
+
hg.selectAll("text.gantt-hover-date").each(
|
|
2044
|
+
function() {
|
|
2045
|
+
const el = d3Selection.select(this);
|
|
2046
|
+
if (el.text() === startLabel) {
|
|
2047
|
+
el.attr("x", startLabelX).attr("text-anchor", startAnchor);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
);
|
|
2051
|
+
hg.append("text").attr("class", "gantt-hover-date").attr("x", endLabelX).attr("y", -tickLen - 4).attr("text-anchor", endAnchor).attr("fill", color).attr("font-size", "10px").attr("font-weight", "600").text(endLabel);
|
|
2052
|
+
hg.append("text").attr("class", "gantt-hover-date").attr("x", endLabelX).attr("y", innerHeight + tickLen + 12).attr("text-anchor", endAnchor).attr("fill", color).attr("font-size", "10px").attr("font-weight", "600").text(endLabel);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
function hideGanttDateIndicators(g) {
|
|
2056
|
+
g.selectAll(".gantt-hover-date").remove();
|
|
2057
|
+
g.selectAll(".gantt-scale-tick").each(function() {
|
|
2058
|
+
const el = d3Selection.select(this);
|
|
2059
|
+
const isDashed = el.attr("stroke-dasharray");
|
|
2060
|
+
el.attr("opacity", isDashed ? 0.15 : 0.4);
|
|
2061
|
+
});
|
|
2062
|
+
g.selectAll(".gantt-today").attr("opacity", 0.7);
|
|
2063
|
+
}
|
|
2064
|
+
function resolveTaskColor(rt, activeTagGroup, resolved, seriesColors, palette) {
|
|
2065
|
+
const tagColor = resolveTagColor(
|
|
2066
|
+
rt.effectiveMetadata,
|
|
2067
|
+
resolved.tagGroups,
|
|
2068
|
+
activeTagGroup
|
|
2069
|
+
);
|
|
2070
|
+
if (tagColor && tagColor !== "#999999") return tagColor;
|
|
2071
|
+
if (rt.groupPath.length > 0) {
|
|
2072
|
+
const topGroup = rt.groupPath[0];
|
|
2073
|
+
const groupIdx = resolved.groups.findIndex((g) => g.name === topGroup);
|
|
2074
|
+
if (groupIdx >= 0) {
|
|
2075
|
+
const group = resolved.groups[groupIdx];
|
|
2076
|
+
if (group.color) return group.color;
|
|
2077
|
+
return seriesColors[groupIdx % seriesColors.length];
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
return palette.accent || seriesColors[0] || "#4a90d9";
|
|
2081
|
+
}
|
|
2082
|
+
function renderTimeScaleHorizontal(g, scale, _innerWidth, innerHeight, textColor) {
|
|
2083
|
+
const domain = scale.domain();
|
|
2084
|
+
const domainMin = domain[0];
|
|
2085
|
+
const domainMax = domain[1];
|
|
2086
|
+
const ticks = computeTimeTicks(domainMin, domainMax, scale);
|
|
2087
|
+
if (ticks.length < 2) return;
|
|
2088
|
+
const tickLen = 6;
|
|
2089
|
+
const opacity = 0.4;
|
|
2090
|
+
const guideOpacity = 0.15;
|
|
2091
|
+
for (const tick of ticks) {
|
|
2092
|
+
g.append("line").attr("class", "gantt-scale-tick").attr("x1", tick.pos).attr("y1", 0).attr("x2", tick.pos).attr("y2", innerHeight).attr("stroke", textColor).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("opacity", guideOpacity);
|
|
2093
|
+
g.append("line").attr("class", "gantt-scale-tick").attr("x1", tick.pos).attr("y1", 0).attr("x2", tick.pos).attr("y2", -tickLen).attr("stroke", textColor).attr("stroke-width", 1).attr("opacity", opacity);
|
|
2094
|
+
g.append("text").attr("class", "gantt-scale-tick").attr("x", tick.pos).attr("y", -tickLen - 4).attr("text-anchor", "middle").attr("dominant-baseline", "auto").attr("font-size", "10px").attr("fill", textColor).attr("opacity", opacity).text(tick.label);
|
|
2095
|
+
g.append("line").attr("class", "gantt-scale-tick").attr("x1", tick.pos).attr("y1", innerHeight).attr("x2", tick.pos).attr("y2", innerHeight + tickLen).attr("stroke", textColor).attr("stroke-width", 1).attr("opacity", opacity);
|
|
2096
|
+
g.append("text").attr("class", "gantt-scale-tick").attr("x", tick.pos).attr("y", innerHeight + tickLen + 12).attr("text-anchor", "middle").attr("font-size", "10px").attr("fill", textColor).attr("opacity", opacity).text(tick.label);
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
export {
|
|
2101
|
+
renderGantt,
|
|
2102
|
+
buildTagLaneRowList
|
|
2103
|
+
};
|
|
2104
|
+
//# sourceMappingURL=chunk-G2H74XJZ.js.map
|