@visactor/vtable-gantt 1.23.3-alpha.0 → 1.24.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.
Files changed (55) hide show
  1. package/cjs/Gantt.d.ts +18 -0
  2. package/cjs/Gantt.js +135 -9
  3. package/cjs/Gantt.js.map +1 -1
  4. package/cjs/gantt-helper.d.ts +7 -0
  5. package/cjs/gantt-helper.js +75 -66
  6. package/cjs/gantt-helper.js.map +1 -1
  7. package/cjs/index.d.ts +1 -1
  8. package/cjs/index.js +1 -1
  9. package/cjs/index.js.map +1 -1
  10. package/cjs/plugins/index.js.map +1 -1
  11. package/cjs/scenegraph/dependency-link.js +28 -38
  12. package/cjs/scenegraph/dependency-link.js.map +1 -1
  13. package/cjs/scenegraph/grid.js +8 -7
  14. package/cjs/scenegraph/grid.js.map +1 -1
  15. package/cjs/scenegraph/mark-line.js +10 -12
  16. package/cjs/scenegraph/mark-line.js.map +1 -1
  17. package/cjs/scenegraph/task-bar.d.ts +4 -1
  18. package/cjs/scenegraph/task-bar.js +73 -23
  19. package/cjs/scenegraph/task-bar.js.map +1 -1
  20. package/cjs/scenegraph/timeline-header.js +1 -4
  21. package/cjs/scenegraph/timeline-header.js.map +1 -1
  22. package/cjs/state/state-manager.js +22 -18
  23. package/cjs/state/state-manager.js.map +1 -1
  24. package/cjs/tools/isx.d.ts +1 -1
  25. package/cjs/ts-types/gantt-engine.d.ts +7 -0
  26. package/cjs/ts-types/gantt-engine.js.map +1 -1
  27. package/dist/vtable-gantt.js +1374 -694
  28. package/dist/vtable-gantt.min.js +2 -2
  29. package/es/Gantt.d.ts +18 -0
  30. package/es/Gantt.js +135 -8
  31. package/es/Gantt.js.map +1 -1
  32. package/es/gantt-helper.d.ts +7 -0
  33. package/es/gantt-helper.js +74 -63
  34. package/es/gantt-helper.js.map +1 -1
  35. package/es/index.d.ts +1 -1
  36. package/es/index.js +1 -1
  37. package/es/index.js.map +1 -1
  38. package/es/plugins/index.js.map +1 -1
  39. package/es/scenegraph/dependency-link.js +29 -27
  40. package/es/scenegraph/dependency-link.js.map +1 -1
  41. package/es/scenegraph/grid.js +6 -8
  42. package/es/scenegraph/grid.js.map +1 -1
  43. package/es/scenegraph/mark-line.js +10 -11
  44. package/es/scenegraph/mark-line.js.map +1 -1
  45. package/es/scenegraph/task-bar.d.ts +4 -1
  46. package/es/scenegraph/task-bar.js +74 -23
  47. package/es/scenegraph/task-bar.js.map +1 -1
  48. package/es/scenegraph/timeline-header.js +2 -3
  49. package/es/scenegraph/timeline-header.js.map +1 -1
  50. package/es/state/state-manager.js +22 -18
  51. package/es/state/state-manager.js.map +1 -1
  52. package/es/tools/isx.d.ts +1 -1
  53. package/es/ts-types/gantt-engine.d.ts +7 -0
  54. package/es/ts-types/gantt-engine.js.map +1 -1
  55. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scenegraph/grid.ts"],"names":[],"mappings":";;;AAAA,yDAA4E;AAI5E,wCAAwD;AACxD,MAAa,IAAI;IAoBf,YAAY,KAAiB;;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAC9F,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC;QACtD,IAAI,CAAC,QAAQ,G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,CAAC;IACD,IAAI,CAAC,CAAS;;QACZ,MAAA,IAAI,CAAC,iBAAiB,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC7C,MAAA,IAAI,CAAC,mBAAmB,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC/C,MAAA,IAAI,CAAC,4BAA4B,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACxD,MAAA,IAAI,CAAC,8BAA8B,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM;QACJ,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAC1G,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;CACF;AA9UD,oBA8UC","file":"grid.js","sourcesContent":["import { Group, createLine, createRect } from '@visactor/vtable/es/vrender';\n\nimport type { Scenegraph } from './scenegraph';\nimport type { IGrid } from '../ts-types';\nimport { computeCountToTimeScale } from '../tools/util';\nexport class Grid {\n // verticalLineSpace: number;\n // horizontalLineSpace: number;\n gridStyle: IGrid;\n scrollLeft: number;\n scrollTop: number;\n x: number;\n y: number;\n width: number;\n height: number;\n rowHeight: number;\n rowCount: number;\n group: Group;\n verticalLineGroup: Group;\n horizontalLineGroup: Group;\n verticalBackgroundRectsGroup: Group;\n horizontalBackgroundRectsGroup: Group;\n allGridHeight: number;\n allGridWidth: number;\n _scene: Scenegraph;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n\n this.scrollLeft = 0;\n this.scrollTop = 0;\n this.x = 0;\n this.y = scene._gantt.getAllHeaderRowsHeight();\n this.width = scene.ganttGroup.attribute.width;\n this.height = scene.ganttGroup.attribute.height - scene.timelineHeader.group.attribute.height;\n this.rowHeight = scene._gantt.parsedOptions.rowHeight;\n this.rowCount = scene._gantt.itemCount;\n this.allGridWidth = scene._gantt.getAllDateColsWidth();\n this.allGridHeight = scene._gantt.getAllTaskBarsHeight();\n this.group = new Group({\n x: this.x,\n y: this.y,\n width: this.width,\n height: this.height,\n clip: true,\n fill: scene._gantt.parsedOptions.grid?.backgroundColor\n });\n this.group.name = 'grid-container';\n scene.ganttGroup.addChild(this.group);\n this.createVerticalBackgroundRects();\n this.createHorizontalBackgroundRects();\n this.createVerticalLines();\n this.createHorizontalLines();\n this.createTimeLineHeaderBottomLine();\n }\n\n createTimeLineHeaderBottomLine() {\n const options = this._scene._gantt.parsedOptions;\n //补充timelineHeader中不好绘制的底部的边线\n const horizontalSplitLineWidth =\n options.horizontalSplitLine?.lineWidth ?? options.timelineHeaderHorizontalLineStyle?.lineWidth;\n const bottomLineY = (horizontalSplitLineWidth & 1 ? -0.5 : 0) + horizontalSplitLineWidth / 2; // 原来是(horizontalSplitLineWidth & 1 ? 0.5 : 0) 这里改成-0.5为了和左侧表格的水平分割线对齐\n const line = createLine({\n pickable: false,\n stroke: options.horizontalSplitLine?.lineColor ?? options.timelineHeaderHorizontalLineStyle?.lineColor,\n lineWidth: horizontalSplitLineWidth + (horizontalSplitLineWidth & 1 ? 1 : 0), // 加上后面这个1是为了和左侧表格的水平分割线对齐\n lineDash: options.horizontalSplitLine?.lineDash ?? options.timelineHeaderHorizontalLineStyle?.lineDash,\n points: [\n { x: 0, y: bottomLineY },\n {\n x: this._scene._gantt.getAllDateColsWidth(),\n y: bottomLineY\n }\n ]\n });\n line.name = 'timeLine-header-bottom-line';\n this.group.addChild(line);\n }\n\n createVerticalLines() {\n const gridStyle = this._scene._gantt.parsedOptions.grid;\n const verticalLineDependenceOnTimeScale =\n gridStyle.verticalLineDependenceOnTimeScale ??\n this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;\n\n if (gridStyle.verticalLine) {\n this.verticalLineGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.verticalLineGroup.name = 'grid-vertical';\n this.group.appendChild(this.verticalLineGroup);\n\n const dependenceOnTimeScale =\n this._scene._gantt.parsedOptions.reverseSortedTimelineScales.find(\n scale => scale.unit === verticalLineDependenceOnTimeScale\n ) ?? this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const { unit: minUnit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const { timelineDates } = dependenceOnTimeScale;\n const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;\n\n if (typeof gridStyle.verticalLine === 'function') {\n for (let i = 0; i < timelineDates?.length - 1; i++) {\n const { endDate } = timelineDates[i];\n const verticalLine_style = gridStyle.verticalLine({\n index: i,\n dateIndex: timelineDates[i].dateIndex,\n date: timelineDates[i].endDate,\n ganttInstance: this._scene._gantt\n });\n const x =\n Math.ceil(\n computeCountToTimeScale(endDate, this._scene._gantt.parsedOptions.minDate, minUnit, step, 1) *\n timelineColWidth\n ) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n // const x = Math.ceil(timelineColWidth * (i + 1)) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n const line = createLine({\n pickable: false,\n stroke: verticalLine_style.lineColor,\n lineWidth: verticalLine_style.lineWidth,\n lineDash: verticalLine_style.lineDash,\n points: [\n { x, y: 0 },\n { x, y: this.allGridHeight }\n ]\n });\n this.verticalLineGroup.appendChild(line);\n }\n } else {\n const verticalLine_style = gridStyle.verticalLine;\n for (let i = 0; i < timelineDates?.length - 1; i++) {\n const { endDate } = timelineDates[i];\n const x =\n Math.ceil(\n computeCountToTimeScale(endDate, this._scene._gantt.parsedOptions.minDate, minUnit, step, 1) *\n timelineColWidth\n ) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n // const x = Math.ceil(timelineColWidth * (i + 1)) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n const line = createLine({\n pickable: false,\n stroke: verticalLine_style.lineColor,\n lineWidth: verticalLine_style.lineWidth,\n lineDash: verticalLine_style.lineDash,\n points: [\n { x, y: 0 },\n { x, y: this.allGridHeight }\n ]\n });\n this.verticalLineGroup.appendChild(line);\n }\n }\n }\n }\n createHorizontalLines() {\n const gridStyle = this._scene._gantt.parsedOptions.grid;\n if (gridStyle.horizontalLine) {\n this.horizontalLineGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.horizontalLineGroup.name = 'grid-horizontal';\n this.group.appendChild(this.horizontalLineGroup);\n if (typeof gridStyle.horizontalLine === 'function') {\n let y = 0.5; //确保大多数情况 LineWidth为1时是准确的\n for (let i = 0; i < this.rowCount - 1; i++) {\n const horizontalLine_style = gridStyle.horizontalLine({\n index: i,\n ganttInstance: this._scene._gantt\n });\n y = y + this._scene._gantt.getRowHeightByIndex(i); // Math.floor(this.rowHeight);\n const line = createLine({\n pickable: false,\n stroke: horizontalLine_style.lineColor,\n lineWidth: horizontalLine_style.lineWidth,\n lineDash: horizontalLine_style.lineDash,\n points: [\n { x: 0, y },\n { x: this.allGridWidth, y }\n ]\n });\n this.horizontalLineGroup.appendChild(line);\n }\n } else {\n const horizontalLine_style = gridStyle.horizontalLine;\n let y = 0;\n if (horizontalLine_style.lineWidth & 1) {\n y += 0.5;\n }\n for (let i = 0; i < this.rowCount - 1; i++) {\n y = y + this._scene._gantt.getRowHeightByIndex(i); // Math.floor(this.rowHeight);\n const line = createLine({\n pickable: false,\n stroke: horizontalLine_style.lineColor,\n lineWidth: horizontalLine_style.lineWidth,\n lineDash: horizontalLine_style.lineDash,\n points: [\n { x: 0, y },\n { x: this.allGridWidth, y }\n ]\n });\n this.horizontalLineGroup.appendChild(line);\n }\n }\n }\n }\n\n createVerticalBackgroundRects() {\n const verticalBackgroundColor = this._scene._gantt.parsedOptions.grid.verticalBackgroundColor;\n const weekendBackgroundColor = this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;\n if (verticalBackgroundColor || weekendBackgroundColor) {\n this.verticalBackgroundRectsGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.verticalBackgroundRectsGroup.name = 'grid-vertical-background';\n this.group.appendChild(this.verticalBackgroundRectsGroup);\n\n const { timelineDates, unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;\n\n if (verticalBackgroundColor || weekendBackgroundColor) {\n for (let i = 0; i <= timelineDates?.length - 1; i++) {\n let backgroundColor;\n if (\n weekendBackgroundColor &&\n unit === 'day' &&\n step === 1 &&\n (timelineDates[i].startDate.getDay() === 0 || timelineDates[i].startDate.getDay() === 6)\n ) {\n backgroundColor = weekendBackgroundColor;\n } else if (typeof verticalBackgroundColor === 'function') {\n backgroundColor = verticalBackgroundColor({\n index: i,\n dateIndex: timelineDates[i].dateIndex,\n date: timelineDates[i].endDate,\n ganttInstance: this._scene._gantt\n });\n } else if (verticalBackgroundColor) {\n backgroundColor = verticalBackgroundColor[i % verticalBackgroundColor.length];\n }\n if (backgroundColor) {\n const x = Math.ceil(timelineColWidth * i);\n const rect = createRect({\n pickable: false,\n fill: backgroundColor,\n x,\n y: 0,\n width: timelineColWidth,\n height: this.allGridHeight\n });\n this.verticalBackgroundRectsGroup.appendChild(rect);\n }\n }\n }\n }\n }\n createHorizontalBackgroundRects() {\n const horizontalBackgroundColor = this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;\n if (horizontalBackgroundColor) {\n this.horizontalBackgroundRectsGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.horizontalBackgroundRectsGroup.name = 'grid-horizontal-background';\n this.group.appendChild(this.horizontalBackgroundRectsGroup);\n\n let y = 0;\n for (let i = 0; i <= this.rowCount - 1; i++) {\n let backgroundColor;\n if (typeof horizontalBackgroundColor === 'function') {\n backgroundColor = horizontalBackgroundColor({\n index: i,\n ganttInstance: this._scene._gantt\n });\n } else {\n backgroundColor = horizontalBackgroundColor[i % horizontalBackgroundColor.length];\n }\n\n const rect = createRect({\n pickable: false,\n fill: backgroundColor,\n x: 0,\n y,\n width: this.allGridWidth,\n height: this._scene._gantt.getRowHeightByIndex(i)\n });\n this.horizontalBackgroundRectsGroup.appendChild(rect);\n y += this._scene._gantt.getRowHeightByIndex(i);\n }\n }\n }\n /** 重新创建网格线场景树结点 */\n refresh() {\n this.width = this._scene.ganttGroup.attribute.width;\n this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;\n this.group.setAttributes({\n width: this.width,\n height: this.height,\n y: this._scene._gantt.getAllHeaderRowsHeight()\n });\n this.rowCount = this._scene._gantt.itemCount;\n this.allGridWidth = this._scene._gantt.getAllDateColsWidth();\n this.allGridHeight = this._scene._gantt.getAllTaskBarsHeight();\n this.group.removeAllChild();\n // this.verticalLineGroup?.parent.removeChild(this.verticalLineGroup);\n // this.horizontalLineGroup?.parent.removeChild(this.horizontalLineGroup);\n // this.verticalBackgroundRectsGroup?.parent.removeChild(this.verticalBackgroundRectsGroup);\n // this.horizontalBackgroundRectsGroup?.parent.removeChild(this.horizontalBackgroundRectsGroup);\n this.createVerticalBackgroundRects();\n this.createHorizontalBackgroundRects();\n this.createVerticalLines();\n this.createHorizontalLines();\n this.createTimeLineHeaderBottomLine();\n }\n setX(x: number) {\n this.verticalLineGroup?.setAttribute('x', x);\n this.horizontalLineGroup?.setAttribute('x', x);\n this.verticalBackgroundRectsGroup?.setAttribute('x', x);\n this.horizontalBackgroundRectsGroup?.setAttribute('x', x);\n }\n setY(y: number) {\n this.verticalLineGroup?.setAttribute('y', y);\n this.horizontalLineGroup?.setAttribute('y', y);\n this.verticalBackgroundRectsGroup?.setAttribute('y', y);\n this.horizontalBackgroundRectsGroup?.setAttribute('y', y);\n }\n resize() {\n this.width = this._scene.ganttGroup.attribute.width;\n this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;\n this.group.setAttribute('width', this.width);\n this.group.setAttribute('height', this.height);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/grid.ts"],"names":[],"mappings":";;;AAAA,yDAA4E;AAI5E,MAAa,IAAI;IAoBf,YAAY,KAAiB;;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAC9F,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC;QACtD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACzD,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC;YACrB,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAA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,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAC1G,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;CACF;AAxUD,oBAwUC","file":"grid.js","sourcesContent":["import { Group, createLine, createRect } from '@visactor/vtable/es/vrender';\n\nimport type { Scenegraph } from './scenegraph';\nimport type { IGrid } from '../ts-types';\nexport class Grid {\n // verticalLineSpace: number;\n // horizontalLineSpace: number;\n gridStyle: IGrid;\n scrollLeft: number;\n scrollTop: number;\n x: number;\n y: number;\n width: number;\n height: number;\n rowHeight: number;\n rowCount: number;\n group: Group;\n verticalLineGroup: Group;\n horizontalLineGroup: Group;\n verticalBackgroundRectsGroup: Group;\n horizontalBackgroundRectsGroup: Group;\n allGridHeight: number;\n allGridWidth: number;\n _scene: Scenegraph;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n\n this.scrollLeft = 0;\n this.scrollTop = 0;\n this.x = 0;\n this.y = scene._gantt.getAllHeaderRowsHeight();\n this.width = scene.ganttGroup.attribute.width;\n this.height = scene.ganttGroup.attribute.height - scene.timelineHeader.group.attribute.height;\n this.rowHeight = scene._gantt.parsedOptions.rowHeight;\n this.rowCount = scene._gantt.itemCount;\n this.allGridWidth = scene._gantt.getAllDateColsWidth();\n this.allGridHeight = scene._gantt.getAllTaskBarsHeight();\n this.group = new Group({\n x: this.x,\n y: this.y,\n width: this.width,\n height: this.height,\n clip: true,\n fill: scene._gantt.parsedOptions.grid?.backgroundColor\n });\n this.group.name = 'grid-container';\n scene.ganttGroup.addChild(this.group);\n this.createVerticalBackgroundRects();\n this.createHorizontalBackgroundRects();\n this.createVerticalLines();\n this.createHorizontalLines();\n this.createTimeLineHeaderBottomLine();\n }\n\n createTimeLineHeaderBottomLine() {\n const options = this._scene._gantt.parsedOptions;\n //补充timelineHeader中不好绘制的底部的边线\n const horizontalSplitLineWidth =\n options.horizontalSplitLine?.lineWidth ?? options.timelineHeaderHorizontalLineStyle?.lineWidth;\n const bottomLineY = (horizontalSplitLineWidth & 1 ? -0.5 : 0) + horizontalSplitLineWidth / 2; // 原来是(horizontalSplitLineWidth & 1 ? 0.5 : 0) 这里改成-0.5为了和左侧表格的水平分割线对齐\n const line = createLine({\n pickable: false,\n stroke: options.horizontalSplitLine?.lineColor ?? options.timelineHeaderHorizontalLineStyle?.lineColor,\n lineWidth: horizontalSplitLineWidth + (horizontalSplitLineWidth & 1 ? 1 : 0), // 加上后面这个1是为了和左侧表格的水平分割线对齐\n lineDash: options.horizontalSplitLine?.lineDash ?? options.timelineHeaderHorizontalLineStyle?.lineDash,\n points: [\n { x: 0, y: bottomLineY },\n {\n x: this._scene._gantt.getAllDateColsWidth(),\n y: bottomLineY\n }\n ]\n });\n line.name = 'timeLine-header-bottom-line';\n this.group.addChild(line);\n }\n\n createVerticalLines() {\n const gridStyle = this._scene._gantt.parsedOptions.grid;\n const verticalLineDependenceOnTimeScale =\n gridStyle.verticalLineDependenceOnTimeScale ??\n this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0].unit;\n\n if (gridStyle.verticalLine) {\n this.verticalLineGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.verticalLineGroup.name = 'grid-vertical';\n this.group.appendChild(this.verticalLineGroup);\n\n const dependenceOnTimeScale =\n this._scene._gantt.parsedOptions.reverseSortedTimelineScales.find(\n scale => scale.unit === verticalLineDependenceOnTimeScale\n ) ?? this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const { timelineDates } = dependenceOnTimeScale;\n\n if (typeof gridStyle.verticalLine === 'function') {\n for (let i = 0; i < timelineDates?.length - 1; i++) {\n const { endDate } = timelineDates[i];\n const verticalLine_style = gridStyle.verticalLine({\n index: i,\n dateIndex: timelineDates[i].dateIndex,\n date: timelineDates[i].endDate,\n ganttInstance: this._scene._gantt\n });\n const x =\n Math.ceil(this._scene._gantt.getXByTime(endDate.getTime() + 1)) +\n (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n // const x = Math.ceil(timelineColWidth * (i + 1)) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n const line = createLine({\n pickable: false,\n stroke: verticalLine_style.lineColor,\n lineWidth: verticalLine_style.lineWidth,\n lineDash: verticalLine_style.lineDash,\n points: [\n { x, y: 0 },\n { x, y: this.allGridHeight }\n ]\n });\n this.verticalLineGroup.appendChild(line);\n }\n } else {\n const verticalLine_style = gridStyle.verticalLine;\n for (let i = 0; i < timelineDates?.length - 1; i++) {\n const { endDate } = timelineDates[i];\n const x =\n Math.ceil(this._scene._gantt.getXByTime(endDate.getTime() + 1)) +\n (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n // const x = Math.ceil(timelineColWidth * (i + 1)) + (verticalLine_style.lineWidth & 1 ? 0.5 : 0);\n const line = createLine({\n pickable: false,\n stroke: verticalLine_style.lineColor,\n lineWidth: verticalLine_style.lineWidth,\n lineDash: verticalLine_style.lineDash,\n points: [\n { x, y: 0 },\n { x, y: this.allGridHeight }\n ]\n });\n this.verticalLineGroup.appendChild(line);\n }\n }\n }\n }\n createHorizontalLines() {\n const gridStyle = this._scene._gantt.parsedOptions.grid;\n if (gridStyle.horizontalLine) {\n this.horizontalLineGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.horizontalLineGroup.name = 'grid-horizontal';\n this.group.appendChild(this.horizontalLineGroup);\n if (typeof gridStyle.horizontalLine === 'function') {\n let y = 0.5; //确保大多数情况 LineWidth为1时是准确的\n for (let i = 0; i < this.rowCount - 1; i++) {\n const horizontalLine_style = gridStyle.horizontalLine({\n index: i,\n ganttInstance: this._scene._gantt\n });\n y = y + this._scene._gantt.getRowHeightByIndex(i); // Math.floor(this.rowHeight);\n const line = createLine({\n pickable: false,\n stroke: horizontalLine_style.lineColor,\n lineWidth: horizontalLine_style.lineWidth,\n lineDash: horizontalLine_style.lineDash,\n points: [\n { x: 0, y },\n { x: this.allGridWidth, y }\n ]\n });\n this.horizontalLineGroup.appendChild(line);\n }\n } else {\n const horizontalLine_style = gridStyle.horizontalLine;\n let y = 0;\n if (horizontalLine_style.lineWidth & 1) {\n y += 0.5;\n }\n for (let i = 0; i < this.rowCount - 1; i++) {\n y = y + this._scene._gantt.getRowHeightByIndex(i); // Math.floor(this.rowHeight);\n const line = createLine({\n pickable: false,\n stroke: horizontalLine_style.lineColor,\n lineWidth: horizontalLine_style.lineWidth,\n lineDash: horizontalLine_style.lineDash,\n points: [\n { x: 0, y },\n { x: this.allGridWidth, y }\n ]\n });\n this.horizontalLineGroup.appendChild(line);\n }\n }\n }\n }\n\n createVerticalBackgroundRects() {\n const verticalBackgroundColor = this._scene._gantt.parsedOptions.grid.verticalBackgroundColor;\n const weekendBackgroundColor = this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;\n if (verticalBackgroundColor || weekendBackgroundColor) {\n this.verticalBackgroundRectsGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.verticalBackgroundRectsGroup.name = 'grid-vertical-background';\n this.group.appendChild(this.verticalBackgroundRectsGroup);\n\n const { timelineDates, unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n\n if (verticalBackgroundColor || weekendBackgroundColor) {\n for (let i = 0; i <= timelineDates?.length - 1; i++) {\n let backgroundColor;\n if (\n weekendBackgroundColor &&\n unit === 'day' &&\n step === 1 &&\n (timelineDates[i].startDate.getDay() === 0 || timelineDates[i].startDate.getDay() === 6)\n ) {\n backgroundColor = weekendBackgroundColor;\n } else if (typeof verticalBackgroundColor === 'function') {\n backgroundColor = verticalBackgroundColor({\n index: i,\n dateIndex: timelineDates[i].dateIndex,\n date: timelineDates[i].endDate,\n ganttInstance: this._scene._gantt\n });\n } else if (verticalBackgroundColor) {\n backgroundColor = verticalBackgroundColor[i % verticalBackgroundColor.length];\n }\n if (backgroundColor) {\n const x = i >= 1 ? Math.ceil(this._scene._gantt.getDateColsWidth(0, i - 1)) : 0;\n const width = this._scene._gantt.getDateColWidth(i);\n const rect = createRect({\n pickable: false,\n fill: backgroundColor,\n x,\n y: 0,\n width,\n height: this.allGridHeight\n });\n this.verticalBackgroundRectsGroup.appendChild(rect);\n }\n }\n }\n }\n }\n createHorizontalBackgroundRects() {\n const horizontalBackgroundColor = this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;\n if (horizontalBackgroundColor) {\n this.horizontalBackgroundRectsGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n this.horizontalBackgroundRectsGroup.name = 'grid-horizontal-background';\n this.group.appendChild(this.horizontalBackgroundRectsGroup);\n\n let y = 0;\n for (let i = 0; i <= this.rowCount - 1; i++) {\n let backgroundColor;\n if (typeof horizontalBackgroundColor === 'function') {\n backgroundColor = horizontalBackgroundColor({\n index: i,\n ganttInstance: this._scene._gantt\n });\n } else {\n backgroundColor = horizontalBackgroundColor[i % horizontalBackgroundColor.length];\n }\n\n const rect = createRect({\n pickable: false,\n fill: backgroundColor,\n x: 0,\n y,\n width: this.allGridWidth,\n height: this._scene._gantt.getRowHeightByIndex(i)\n });\n this.horizontalBackgroundRectsGroup.appendChild(rect);\n y += this._scene._gantt.getRowHeightByIndex(i);\n }\n }\n }\n /** 重新创建网格线场景树结点 */\n refresh() {\n this.width = this._scene.ganttGroup.attribute.width;\n this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;\n this.group.setAttributes({\n width: this.width,\n height: this.height,\n y: this._scene._gantt.getAllHeaderRowsHeight()\n });\n this.rowCount = this._scene._gantt.itemCount;\n this.allGridWidth = this._scene._gantt.getAllDateColsWidth();\n this.allGridHeight = this._scene._gantt.getAllTaskBarsHeight();\n this.group.removeAllChild();\n // this.verticalLineGroup?.parent.removeChild(this.verticalLineGroup);\n // this.horizontalLineGroup?.parent.removeChild(this.horizontalLineGroup);\n // this.verticalBackgroundRectsGroup?.parent.removeChild(this.verticalBackgroundRectsGroup);\n // this.horizontalBackgroundRectsGroup?.parent.removeChild(this.horizontalBackgroundRectsGroup);\n this.createVerticalBackgroundRects();\n this.createHorizontalBackgroundRects();\n this.createVerticalLines();\n this.createHorizontalLines();\n this.createTimeLineHeaderBottomLine();\n }\n setX(x: number) {\n this.verticalLineGroup?.setAttribute('x', x);\n this.horizontalLineGroup?.setAttribute('x', x);\n this.verticalBackgroundRectsGroup?.setAttribute('x', x);\n this.horizontalBackgroundRectsGroup?.setAttribute('x', x);\n }\n setY(y: number) {\n this.verticalLineGroup?.setAttribute('y', y);\n this.horizontalLineGroup?.setAttribute('y', y);\n this.verticalBackgroundRectsGroup?.setAttribute('y', y);\n this.horizontalBackgroundRectsGroup?.setAttribute('y', y);\n }\n resize() {\n this.width = this._scene.ganttGroup.attribute.width;\n this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;\n this.group.setAttribute('width', this.width);\n this.group.setAttribute('height', this.height);\n }\n}\n"]}
@@ -34,17 +34,15 @@ class MarkLine {
34
34
  height: height
35
35
  }), this.markLIneContainer.setAttribute("width", this._scene._gantt.getAllDateColsWidth()),
36
36
  this.markLIneContainer.setAttribute("height", height);
37
- const markLine = this._scene._gantt.parsedOptions.markLine, minDate = this._scene._gantt.parsedOptions.minDate;
38
- minDate && markLine.forEach((line => {
39
- const style = line.style, contentStyle = line.contentStyle || {}, date = this._scene._gantt.parsedOptions.timeScaleIncludeHour ? (0,
40
- util_1.createDateAtMidnight)(line.date) : (0, util_1.createDateAtMidnight)(line.date, !0), {unit: unit, step: step} = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0], unitCount = (0,
41
- util_1.computeCountToTimeScale)(date, minDate, unit, step);
42
- let positionOffset = 0;
43
- if ("right" === line.position) positionOffset = 1; else if ("middle" === line.position) positionOffset = .5; else if ("date" === line.position) {
44
- const date = (0, util_1.createDateAtMidnight)(line.date), unitCount = (0, util_1.computeCountToTimeScale)(date, minDate, unit, step);
45
- positionOffset = unitCount - Math.floor(unitCount);
46
- }
47
- const dateX = this._scene._gantt.parsedOptions.timelineColWidth * (Math.floor(unitCount) + positionOffset), markLineGroup = new vrender_1.Group({
37
+ const markLine = this._scene._gantt.parsedOptions.markLine;
38
+ this._scene._gantt.parsedOptions.minDate && markLine.forEach((line => {
39
+ const style = line.style, contentStyle = line.contentStyle || {}, dateTime = (this._scene._gantt.parsedOptions.timeScaleIncludeHour ? (0,
40
+ util_1.createDateAtMidnight)(line.date) : (0, util_1.createDateAtMidnight)(line.date, !0)).getTime();
41
+ if (dateTime < this._scene._gantt.parsedOptions._minDateTime || dateTime > this._scene._gantt.parsedOptions._maxDateTime) return;
42
+ const cellIndex = this._scene._gantt.getDateIndexByTime(dateTime), cellStartX = cellIndex >= 1 ? this._scene._gantt.getDateColsWidth(0, cellIndex - 1) : 0, cellWidth = this._scene._gantt.getDateColWidth(cellIndex);
43
+ let dateX = cellStartX;
44
+ "date" === line.position ? dateX = this._scene._gantt.getXByTime(dateTime) : "right" === line.position ? dateX = cellStartX + cellWidth : "middle" === line.position && (dateX = cellStartX + cellWidth / 2);
45
+ const markLineGroup = new vrender_1.Group({
48
46
  pickable: !1,
49
47
  x: dateX - this.markLineContainerWidth / 2,
50
48
  y: 0,
@@ -66,7 +64,7 @@ class MarkLine {
66
64
  } ]
67
65
  });
68
66
  if (markLineGroup.appendChild(lineObj), line.content) {
69
- const textMaxLineWidth = this._scene._gantt.parsedOptions.timelineColWidth, textContainerHeight = contentStyle.lineHeight || 18, textGroup = new vrender_1.Group({
67
+ const textMaxLineWidth = Math.max(this._scene._gantt.getDateColWidth(cellIndex), 1), textContainerHeight = contentStyle.lineHeight || 18, textGroup = new vrender_1.Group({
70
68
  x: this.markLineContainerWid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","file":"mark-line.js","sourcesContent":["import { computeCountToTimeScale, createDateAtMidnight } from '../tools/util';\nimport { DayTimes } from '../gantt-helper';\n//import type { IMarkLine } from '../ts-types';\nimport type { Scenegraph } from './scenegraph';\nimport { Group, createLine, Text } from '@visactor/vtable/es/vrender';\n\nexport class MarkLine {\n _scene: Scenegraph;\n group: Group;\n markLIneContainer: Group;\n markLineContainerWidth: number = 20;\n height: number;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n this.height =\n Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight) - scene._gantt.getAllHeaderRowsHeight();\n this.group = new Group({\n x: 0,\n y: scene._gantt.getAllHeaderRowsHeight(),\n width: scene._gantt.tableNoFrameWidth,\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.name = 'mark-line-container';\n scene.ganttGroup.addChild(this.group);\n\n this.markLIneContainer = new Group({\n x: 0,\n y: 0,\n width: this._scene._gantt.getAllDateColsWidth(),\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.appendChild(this.markLIneContainer);\n this.initMarkLines();\n }\n initMarkLines() {\n //#region 重置markLine容器大小\n const height =\n Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) -\n this._scene._gantt.getAllHeaderRowsHeight();\n this.group.setAttributes({\n y: this._scene._gantt.getAllHeaderRowsHeight(),\n width: this._scene._gantt.tableNoFrameWidth,\n height: height\n });\n this.markLIneContainer.setAttribute('width', this._scene._gantt.getAllDateColsWidth());\n this.markLIneContainer.setAttribute('height', height);\n //#endregion\n const markLine = this._scene._gantt.parsedOptions.markLine;\n const minDate = this._scene._gantt.parsedOptions.minDate;\n minDate &&\n markLine.forEach(line => {\n const style = line.style;\n const contentStyle = line.contentStyle || {};\n const date = this._scene._gantt.parsedOptions.timeScaleIncludeHour\n ? createDateAtMidnight(line.date)\n : createDateAtMidnight(line.date, true);\n const { unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const unitCount = computeCountToTimeScale(date, minDate, unit, step);\n let positionOffset = 0;\n if (line.position === 'right') {\n positionOffset = 1;\n } else if (line.position === 'middle') {\n positionOffset = 0.5;\n } else if (line.position === 'date') {\n const date = createDateAtMidnight(line.date);\n const unitCount = computeCountToTimeScale(date, minDate, unit, step);\n const cellIndex = Math.floor(unitCount);\n positionOffset = unitCount - cellIndex;\n }\n const dateX = this._scene._gantt.parsedOptions.timelineColWidth * (Math.floor(unitCount) + positionOffset);\n const markLineGroup = new Group({\n pickable: false,\n x: dateX - this.markLineContainerWidth / 2,\n y: 0,\n width: this.markLineContainerWidth,\n height: this.height\n });\n markLineGroup.name = 'mark-line';\n this.markLIneContainer.appendChild(markLineGroup);\n // 创建整个任务条rect\n const lineObj = createLine({\n pickable: false,\n stroke: style.lineColor,\n lineWidth: style.lineWidth,\n lineDash: style.lineDash,\n points: [\n { x: this.markLineContainerWidth / 2, y: 0 },\n { x: this.markLineContainerWidth / 2, y: this.height }\n ]\n });\n markLineGroup.appendChild(lineObj);\n if (line.content) {\n const textMaxLineWidth = this._scene._gantt.parsedOptions.timelineColWidth;\n const textContainerHeight = contentStyle.lineHeight || 18;\n // 创建内容区\n const textGroup = new Group({\n x: this.markLineContainerWidth / 2,\n y: 0,\n cursor: 'pointer',\n height: textContainerHeight,\n clip: false,\n fill: contentStyle.backgroundColor || style.lineColor,\n display: 'flex',\n cornerRadius: contentStyle.cornerRadius || [0, 2, 2, 0]\n });\n textGroup.name = 'mark-line-content';\n (textGroup as any).data = line;\n markLineGroup.appendChild(textGroup);\n // 创建内容\n const text = new Text({\n maxLineWidth: textMaxLineWidth,\n text: line.content,\n cursor: 'pointer',\n lineHeight: textContainerHeight,\n fontWeight: contentStyle.fontWeight || 'normal',\n fill: contentStyle.color || style.lineColor,\n fontSize: contentStyle.fontSize || 12,\n poptip: {\n position: 'top',\n dx: textMaxLineWidth / 4,\n dy: -textContainerHeight / 4\n }\n } as any);\n textGroup.appendChild(text);\n }\n });\n }\n\n /** 重新场景场景树节点 */\n refresh() {\n this.height =\n Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) -\n this._scene._gantt.getAllHeaderRowsHeight();\n this.markLIneContainer.removeAllChild();\n this.group.setAttribute('height', this.height);\n this.markLIneContainer.setAttribute('height', this.height);\n this.initMarkLines();\n }\n setX(x: number) {\n this.markLIneContainer.setAttribute('x', x);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/mark-line.ts"],"names":[],"mappings":";;;AAAA,wCAAqD;AAIrD,yDAAsE;AAEtE,MAAa,QAAQ;IAMnB,YAAY,KAAiB;QAF7B,2BAAsB,GAAW,EAAE,CAAC;QAGlC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM;YACT,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAC7G,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC;YACrB,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE;YACxC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB;YACrC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,qBAAqB,CAAC;QACxC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEtC,IAAI,CAAC,iBAAiB,GAAG,IAAI,eAAK,CAAC;YACjC,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE;YAC/C,MAAM,EAAE,IAAI,CAAC,MAAM;Y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,CAAC;QAC/C,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IACD,IAAI,CAAC,CAAS;QACZ,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF;AA/ID,4BA+IC","file":"mark-line.js","sourcesContent":["import { createDateAtMidnight } from '../tools/util';\nimport { DayTimes } from '../gantt-helper';\n//import type { IMarkLine } from '../ts-types';\nimport type { Scenegraph } from './scenegraph';\nimport { Group, createLine, Text } from '@visactor/vtable/es/vrender';\n\nexport class MarkLine {\n _scene: Scenegraph;\n group: Group;\n markLIneContainer: Group;\n markLineContainerWidth: number = 20;\n height: number;\n constructor(scene: Scenegraph) {\n this._scene = scene;\n this.height =\n Math.min(scene._gantt.tableNoFrameHeight, scene._gantt.drawHeight) - scene._gantt.getAllHeaderRowsHeight();\n this.group = new Group({\n x: 0,\n y: scene._gantt.getAllHeaderRowsHeight(),\n width: scene._gantt.tableNoFrameWidth,\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.name = 'mark-line-container';\n scene.ganttGroup.addChild(this.group);\n\n this.markLIneContainer = new Group({\n x: 0,\n y: 0,\n width: this._scene._gantt.getAllDateColsWidth(),\n height: this.height,\n pickable: false,\n clip: true\n });\n this.group.appendChild(this.markLIneContainer);\n this.initMarkLines();\n }\n initMarkLines() {\n //#region 重置markLine容器大小\n const height =\n Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) -\n this._scene._gantt.getAllHeaderRowsHeight();\n this.group.setAttributes({\n y: this._scene._gantt.getAllHeaderRowsHeight(),\n width: this._scene._gantt.tableNoFrameWidth,\n height: height\n });\n this.markLIneContainer.setAttribute('width', this._scene._gantt.getAllDateColsWidth());\n this.markLIneContainer.setAttribute('height', height);\n //#endregion\n const markLine = this._scene._gantt.parsedOptions.markLine;\n const minDate = this._scene._gantt.parsedOptions.minDate;\n minDate &&\n markLine.forEach(line => {\n const style = line.style;\n const contentStyle = line.contentStyle || {};\n const date = this._scene._gantt.parsedOptions.timeScaleIncludeHour\n ? createDateAtMidnight(line.date)\n : createDateAtMidnight(line.date, true);\n const dateTime = date.getTime();\n if (\n dateTime < this._scene._gantt.parsedOptions._minDateTime ||\n dateTime > this._scene._gantt.parsedOptions._maxDateTime\n ) {\n return;\n }\n const cellIndex = this._scene._gantt.getDateIndexByTime(dateTime);\n const cellStartX = cellIndex >= 1 ? this._scene._gantt.getDateColsWidth(0, cellIndex - 1) : 0;\n const cellWidth = this._scene._gantt.getDateColWidth(cellIndex);\n let dateX = cellStartX;\n if (line.position === 'date') {\n dateX = this._scene._gantt.getXByTime(dateTime);\n } else if (line.position === 'right') {\n dateX = cellStartX + cellWidth;\n } else if (line.position === 'middle') {\n dateX = cellStartX + cellWidth / 2;\n }\n const markLineGroup = new Group({\n pickable: false,\n x: dateX - this.markLineContainerWidth / 2,\n y: 0,\n width: this.markLineContainerWidth,\n height: this.height\n });\n markLineGroup.name = 'mark-line';\n this.markLIneContainer.appendChild(markLineGroup);\n // 创建整个任务条rect\n const lineObj = createLine({\n pickable: false,\n stroke: style.lineColor,\n lineWidth: style.lineWidth,\n lineDash: style.lineDash,\n points: [\n { x: this.markLineContainerWidth / 2, y: 0 },\n { x: this.markLineContainerWidth / 2, y: this.height }\n ]\n });\n markLineGroup.appendChild(lineObj);\n if (line.content) {\n const textMaxLineWidth = Math.max(this._scene._gantt.getDateColWidth(cellIndex), 1);\n const textContainerHeight = contentStyle.lineHeight || 18;\n // 创建内容区\n const textGroup = new Group({\n x: this.markLineContainerWidth / 2,\n y: 0,\n cursor: 'pointer',\n height: textContainerHeight,\n clip: false,\n fill: contentStyle.backgroundColor || style.lineColor,\n display: 'flex',\n cornerRadius: contentStyle.cornerRadius || [0, 2, 2, 0]\n });\n textGroup.name = 'mark-line-content';\n (textGroup as any).data = line;\n markLineGroup.appendChild(textGroup);\n // 创建内容\n const text = new Text({\n maxLineWidth: textMaxLineWidth,\n text: line.content,\n cursor: 'pointer',\n lineHeight: textContainerHeight,\n fontWeight: contentStyle.fontWeight || 'normal',\n fill: contentStyle.color || style.lineColor,\n fontSize: contentStyle.fontSize || 12,\n poptip: {\n position: 'top',\n dx: textMaxLineWidth / 4,\n dy: -textContainerHeight / 4\n }\n } as any);\n textGroup.appendChild(text);\n }\n });\n }\n\n /** 重新场景场景树节点 */\n refresh() {\n this.height =\n Math.min(this._scene._gantt.tableNoFrameHeight, this._scene._gantt.drawHeight) -\n this._scene._gantt.getAllHeaderRowsHeight();\n this.markLIneContainer.removeAllChild();\n this.group.setAttribute('height', this.height);\n this.markLIneContainer.setAttribute('height', this.height);\n this.initMarkLines();\n }\n setX(x: number) {\n this.markLIneContainer.setAttribute('x', x);\n }\n}\n"]}
@@ -23,7 +23,10 @@ export declare class TaskBar {
23
23
  selectedBorders: Group[];
24
24
  constructor(scene: Scenegraph);
25
25
  initBars(): void;
26
- initBar(index: number, childIndex?: number | number[], childrenLength?: number): GanttTaskBarNode;
26
+ initBar(index: number, childIndex?: number | number[], childrenLength?: number): {
27
+ barGroupBox: GanttTaskBarNode;
28
+ baselineBar: any;
29
+ };
27
30
  updateTaskBarNode(index: number, sub_task_index?: number): void;
28
31
  initHoverBarIcons(): void;
29
32
  setX(x: number): void;
@@ -69,8 +69,8 @@ class TaskBar {
69
69
  clip: !0
70
70
  }), this.group.appendChild(this.barContainer);
71
71
  for (let i = 0; i < this._scene._gantt.itemCount; i++) if (this._scene._gantt.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Inline && this._scene._gantt.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Separate && this._scene._gantt.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Arrange && this._scene._gantt.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Sub_Tasks_Compact) if (this._scene._gantt.parsedOptions.tasksShowMode !== ts_types_1.TasksShowMode.Project_Sub_Tasks_Inline) {
72
- const barGroup = this.initBar(i);
73
- barGroup && this.barContainer.appendChild(barGroup);
72
+ const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i);
73
+ baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
74
74
  } else {
75
75
  const record = this._scene._gantt.getRecordByIndex(i), isExpanded = "expand" === record.hierarchyState;
76
76
  if (record.type === ts_types_1.TaskType.PROJECT && (null === (_c = record.children) || void 0 === _c ? void 0 : _c.length) > 0 && !isExpanded) {
@@ -79,43 +79,89 @@ class TaskBar {
79
79
  if ((null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) > 0) for (let j = 0; j < (null === (_b = record.children) || void 0 === _b ? void 0 : _b.length); j++) {
80
80
  const child_record = record.children[j];
81
81
  if (child_record.type !== ts_types_1.TaskType.PROJECT) {
82
- const barGroup = this.initBar(i, [ ...sub_task_indexs, j ], record.children.length);
83
- barGroup && this.barContainer.appendChild(barGroup);
82
+ const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i, [ ...sub_task_indexs, j ], record.children.length);
83
+ baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
84
84
  } else callInitBar(child_record, [ ...sub_task_indexs, j ]);
85
85
  }
86
86
  };
87
87
  callInitBar(record, sub_task_indexs);
88
88
  } else {
89
- const barGroup = this.initBar(i);
90
- barGroup && this.barContainer.appendChild(barGroup);
89
+ const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i);
90
+ baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
91
91
  }
92
92
  } else {
93
93
  const record = this._scene._gantt.getRecordByIndex(i);
94
94
  if ((null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) > 0) for (let j = 0; j < (null === (_b = record.children) || void 0 === _b ? void 0 : _b.length); j++) {
95
- const barGroup = this.initBar(i, j, record.children.length);
96
- barGroup && this.barContainer.appendChild(barGroup);
95
+ const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i, j, record.children.length);
96
+ baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
97
97
  } else {
98
- const barGroup = this.initBar(i);
99
- barGroup && this.barContainer.appendChild(barGroup);
98
+ const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i);
99
+ baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
100
100
  }
101
101
  }
102
102
  }
103
103
  initBar(index, childIndex, childrenLength) {
104
- var _a, _b, _c, _d, _e;
104
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
105
105
  const taskBarCustomLayout = this._scene._gantt.parsedOptions.taskBarCustomLayout, {startDate: startDate, endDate: endDate, taskDays: taskDays, progress: progress, taskRecord: taskRecord} = this._scene._gantt.getTaskInfoByTaskListIndex(index, childIndex), isMilestone = taskRecord.type === ts_types_1.TaskType.MILESTONE;
106
- if (isMilestone && !startDate || !isMilestone && (taskDays <= 0 || !startDate || !endDate || startDate.getTime() > endDate.getTime())) return null;
107
- const {unit: unit, step: step} = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
108
- let taskBarSize = (0, util_1.computeCountToTimeScale)(endDate, startDate, unit, step, 1) * this._scene._gantt.parsedOptions.timelineColWidth;
106
+ if (isMilestone && !startDate || !isMilestone && (taskDays <= 0 || !startDate || !endDate || startDate.getTime() > endDate.getTime())) return {
107
+ barGroupBox: null,
108
+ baselineBar: null
109
+ };
110
+ let taskBarSize = this._scene._gantt.getXByTime(endDate.getTime() + 1) - this._scene._gantt.getXByTime(startDate.getTime());
109
111
  const taskBarStyle = this._scene._gantt.getTaskBarStyle(index, childIndex), taskbarHeight = taskBarStyle.width;
110
112
  (0, vutils_1.isValid)(taskBarStyle.minSize) && (taskBarSize = Math.max(taskBarSize, taskBarStyle.minSize));
111
- const oneTaskHeigth = this._scene._gantt.parsedOptions.rowHeight, milestoneTaskBarHeight = this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width, x = (0,
112
- util_1.computeCountToTimeScale)(startDate, this._scene._gantt.parsedOptions.minDate, unit, step) * this._scene._gantt.parsedOptions.timelineColWidth - (isMilestone ? milestoneTaskBarHeight / 2 : 0), y = this._scene._gantt.getRowsHeightByIndex(0, index - 1) + (this._scene._gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Separate ? (null !== (_a = childIndex) && void 0 !== _a ? _a : 0) * oneTaskHeigth : this._scene._gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Arrange || this._scene._gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Compact ? taskRecord.vtable_gantt_showIndex * oneTaskHeigth : 0) + (oneTaskHeigth - (isMilestone ? milestoneTaskBarHeight : taskbarHeight)) / 2, barGroupBox = new gantt_node_1.GanttTaskBarNode({
113
+ const oneTaskHeigth = this._scene._gantt.parsedOptions.rowHeight, milestoneTaskBarHeight = this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width, x = this._scene._gantt.getXByTime(startDate.getTime()) - (isMilestone ? milestoneTaskBarHeight / 2 : 0);
114
+ let y = this._scene._gantt.getRowsHeightByIndex(0, index - 1) + (this._scene._gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Separate ? (null !== (_a = childIndex) && void 0 !== _a ? _a : 0) * oneTaskHeigth : this._scene._gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Arrange || this._scene._gantt.parsedOptions.tasksShowMode === ts_types_1.TasksShowMode.Sub_Tasks_Compact ? taskRecord.vtable_gantt_showIndex * oneTaskHeigth : 0);
115
+ const baselineInfo = this._scene._gantt.getBaselineInfoByTaskListIndex(index, childIndex), hasBaseline = baselineInfo.baselineStartDate && baselineInfo.baselineEndDate && baselineInfo.baselineDays > 0, baselinePosition = this._scene._gantt.parsedOptions.baselinePosition;
116
+ let baselineBar = null, taskBarYOffset = 0;
117
+ if (hasBaseline && !isMilestone) {
118
+ const baselineStyle = this._scene._gantt.getBaselineStyle(index, childIndex), baselineX = this._scene._gantt.getXByTime(baselineInfo.baselineStartDate.getTime()), baselineWidth = this._scene._gantt.getXByTime(baselineInfo.baselineEndDate.getTime() + 1) - this._scene._gantt.getXByTime(baselineInfo.baselineStartDate.getTime());
119
+ let baselineY;
120
+ const taskBarPaddingTop = null !== (_b = taskBarStyle.paddingTop) && void 0 !== _b ? _b : void 0, baselinePaddingTop = null !== (_c = baselineStyle.paddingTop) && void 0 !== _c ? _c : void 0;
121
+ if ("overlap" === baselinePosition) baselineY = void 0 !== taskBarPaddingTop ? y + taskBarPaddingTop : y + (oneTaskHeigth - baselineStyle.width) / 2; else if ("top" === baselinePosition) {
122
+ const gap = 4;
123
+ if (void 0 !== baselinePaddingTop && void 0 !== taskBarPaddingTop) baselineY = y + baselinePaddingTop,
124
+ taskBarYOffset = taskBarPaddingTop; else if (void 0 !== baselinePaddingTop) baselineY = y + baselinePaddingTop,
125
+ taskBarYOffset = baselinePaddingTop + baselineStyle.width + gap; else if (void 0 !== taskBarPaddingTop) {
126
+ baselineY = y + (oneTaskHeigth - (baselineStyle.width + gap + taskbarHeight)) / 2,
127
+ taskBarYOffset = taskBarPaddingTop;
128
+ } else {
129
+ const startY = (oneTaskHeigth - (baselineStyle.width + gap + taskbarHeight)) / 2;
130
+ baselineY = y + startY, taskBarYOffset = startY + baselineStyle.width + gap;
131
+ }
132
+ } else {
133
+ const gap = 4;
134
+ if (void 0 !== taskBarPaddingTop && void 0 !== baselinePaddingTop) taskBarYOffset = taskBarPaddingTop,
135
+ baselineY = y + baselinePaddingTop; else if (void 0 !== taskBarPaddingTop) taskBarYOffset = taskBarPaddingTop,
136
+ baselineY = y + taskBarPaddingTop + taskbarHeight + gap; else if (void 0 !== baselinePaddingTop) {
137
+ taskBarYOffset = (oneTaskHeigth - (taskbarHeight + gap + baselineStyle.width)) / 2,
138
+ baselineY = y + baselinePaddingTop;
139
+ } else {
140
+ const startY = (oneTaskHeigth - (taskbarHeight + gap + baselineStyle.width)) / 2;
141
+ taskBarYOffset = startY, baselineY = y + startY + taskbarHeight + gap;
142
+ }
143
+ }
144
+ baselineBar = (0, vrender_1.createRect)({
145
+ x: baselineX,
146
+ y: baselineY,
147
+ width: Math.max(baselineWidth, baselineStyle.minSize || 0),
148
+ height: baselineStyle.width,
149
+ fill: baselineStyle.barColor,
150
+ cornerRadius: baselineStyle.cornerRadius,
151
+ lineWidth: 2 * (null !== (_d = baselineStyle.borderLineWidth) && void 0 !== _d ? _d : baselineStyle.borderWidth),
152
+ stroke: baselineStyle.borderColor,
153
+ pickable: !1
154
+ }), baselineBar.name = "baseline-bar";
155
+ }
156
+ const taskBarPaddingTop = null !== (_e = taskBarStyle.paddingTop) && void 0 !== _e ? _e : void 0;
157
+ y += hasBaseline && !isMilestone && "overlap" !== baselinePosition ? taskBarYOffset : void 0 !== taskBarPaddingTop ? taskBarPaddingTop : (oneTaskHeigth - (isMilestone ? milestoneTaskBarHeight : taskbarHeight)) / 2 + taskBarYOffset;
158
+ const barGroupBox = new gantt_node_1.GanttTaskBarNode({
113
159
  x: x,
114
160
  y: y,
115
161
  width: isMilestone ? milestoneTaskBarHeight : taskBarSize,
116
162
  height: isMilestone ? milestoneTaskBarHeight : taskbarHeight,
117
163
  cornerRadius: isMilestone ? this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius : taskBarStyle.cornerRadius,
118
- lineWidth: isMilestone ? 2 * this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth : 2 * (null !== (_b = taskBarStyle.borderLineWidth) && void 0 !== _b ? _b : taskBarStyle.borderWidth),
164
+ lineWidth: isMilestone ? 2 * this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth : 2 * (null !== (_f = taskBarStyle.borderLineWidth) && void 0 !== _f ? _f : taskBarStyle.borderWidth),
119
165
  stroke: isMilestone ? this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderColor : taskBarStyle.borderColor,
120
166
  angle: isMilestone ? .25 * Math.PI : 0,
121
167
  anchor: isMilestone ? [ x + milestoneTaskBarHeight / 2, y + milestoneTaskBarHeight / 2 ] : void 0
@@ -148,8 +194,8 @@ class TaskBar {
148
194
  ganttInstance: this._scene._gantt
149
195
  });
150
196
  } else customLayoutObj = taskBarCustomLayout;
151
- customLayoutObj && (rootContainer = customLayoutObj.rootContainer, renderDefaultBar = null !== (_c = customLayoutObj.renderDefaultBar) && void 0 !== _c && _c,
152
- renderDefaultText = null !== (_d = customLayoutObj.renderDefaultText) && void 0 !== _d && _d,
197
+ customLayoutObj && (rootContainer = customLayoutObj.rootContainer, renderDefaultBar = null !== (_g = customLayoutObj.renderDefaultBar) && void 0 !== _g && _g,
198
+ renderDefaultText = null !== (_h = customLayoutObj.renderDefaultText) && void 0 !== _h && _h,
153
199
  rootContainer && (rootContainer.name = "task-bar-custom-render"));
154
200
  }
155
201
  if (renderDefaultBar) {
@@ -198,7 +244,7 @@ class TaskBar {
198
244
  barGroupBox.updateTextPosition();
199
245
  }
200
246
  if (renderDefaultText && "milestone" === taskRecord.type && this._scene._gantt.parsedOptions.taskBarMilestoneStyle.labelText) {
201
- const milestoneStyle = this._scene._gantt.parsedOptions.taskBarMilestoneStyle, textStyle = milestoneStyle.labelTextStyle || {}, pos = this.calculateMilestoneTextPosition(milestoneStyle.textOrient || "right", milestoneStyle.width, null !== (_e = textStyle.padding) && void 0 !== _e ? _e : 4), textContainer = new vrender_1.Group({
247
+ const milestoneStyle = this._scene._gantt.parsedOptions.taskBarMilestoneStyle, textStyle = milestoneStyle.labelTextStyle || {}, pos = this.calculateMilestoneTextPosition(milestoneStyle.textOrient || "right", milestoneStyle.width, null !== (_j = textStyle.padding) && void 0 !== _j ? _j : 4), textContainer = new vrender_1.Group({
202
248
  x: x,
203
249
  y: y,
204
250
  width: milestoneStyle.width,
@@ -219,13 +265,17 @@ class TaskBar {
219
265
  textContainer.appendChild(milestoneLabel), this.barContainer.appendChild(textContainer),
220
266
  barGroupBox.milestoneTextLabel = milestoneLabel, barGroupBox.milestoneTextContainer = textContainer;
221
267
  }
222
- return barGroupBox;
268
+ return {
269
+ barGroupBox: barGroupBox,
270
+ baselineBar: baselineBar
271
+ };
223
272
  }
224
273
  updateTaskBarNode(index, sub_task_index) {
225
274
  const taskbarGroup = this.getTaskBarNodeByIndex(index, sub_task_index);
226
275
  taskbarGroup && this.barContainer.removeChild(taskbarGroup);
227
- const barGroup = this.initBar(index, sub_task_index);
228
- barGroup && (this.barContainer.insertInto(barGroup, index), barGroup.updateTextPosition());
276
+ const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(index, sub_task_index);
277
+ barGroupBox && (this.barContainer.insertInto(barGroupBox, index), barGroupBox.updateTextPosition()),
278
+ baselineBar && this.barContainer.insertBefore(baselineBar, barGroupBox);
229
279
  }
230
280
  initHoverBarIcons() {
231
281
  var _a, _b;