@wimi/vtable-gantt 1.0.3 → 1.0.4
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/cjs/Gantt.d.ts +19 -0
- package/cjs/Gantt.js +135 -9
- package/cjs/Gantt.js.map +1 -1
- package/cjs/event/event-manager.js +17 -6
- package/cjs/event/event-manager.js.map +1 -1
- package/cjs/event/scroll.js +2 -1
- package/cjs/event/touch.js +0 -1
- package/cjs/gantt-helper.d.ts +7 -0
- package/cjs/gantt-helper.js +76 -66
- package/cjs/gantt-helper.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/plugins/index.js.map +1 -1
- package/cjs/scenegraph/dependency-link.js +28 -38
- package/cjs/scenegraph/dependency-link.js.map +1 -1
- package/cjs/scenegraph/grid.js +11 -10
- package/cjs/scenegraph/grid.js.map +1 -1
- package/cjs/scenegraph/mark-line.js +10 -12
- package/cjs/scenegraph/mark-line.js.map +1 -1
- package/cjs/scenegraph/task-bar.d.ts +11 -1
- package/cjs/scenegraph/task-bar.js +189 -29
- package/cjs/scenegraph/task-bar.js.map +1 -1
- package/cjs/scenegraph/timeline-header.js +2 -6
- package/cjs/scenegraph/timeline-header.js.map +1 -1
- package/cjs/state/state-manager.js +23 -18
- package/cjs/state/state-manager.js.map +1 -1
- package/cjs/tools/isx.d.ts +1 -1
- package/cjs/tools/util.js +2 -1
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/gantt-engine.d.ts +8 -0
- package/cjs/ts-types/gantt-engine.js +2 -1
- package/cjs/ts-types/gantt-engine.js.map +1 -1
- package/cjs/zoom-scale/DataZoomIntegration.d.ts +2 -0
- package/cjs/zoom-scale/DataZoomIntegration.js +32 -20
- package/cjs/zoom-scale/DataZoomIntegration.js.map +1 -1
- package/cjs/zoom-scale/ZoomScaleManager.js +1 -2
- package/dist/vtable-gantt.js +4153 -1803
- package/dist/vtable-gantt.min.js +1 -15
- package/es/Gantt.d.ts +19 -0
- package/es/Gantt.js +135 -8
- package/es/Gantt.js.map +1 -1
- package/es/event/event-manager.js +17 -6
- package/es/event/event-manager.js.map +1 -1
- package/es/event/scroll.js +2 -1
- package/es/event/touch.js +1 -2
- package/es/gantt-helper.d.ts +7 -0
- package/es/gantt-helper.js +75 -63
- package/es/gantt-helper.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/plugins/index.js.map +1 -1
- package/es/scenegraph/dependency-link.js +29 -27
- package/es/scenegraph/dependency-link.js.map +1 -1
- package/es/scenegraph/grid.js +9 -11
- package/es/scenegraph/grid.js.map +1 -1
- package/es/scenegraph/mark-line.js +10 -11
- package/es/scenegraph/mark-line.js.map +1 -1
- package/es/scenegraph/task-bar.d.ts +11 -1
- package/es/scenegraph/task-bar.js +190 -29
- package/es/scenegraph/task-bar.js.map +1 -1
- package/es/scenegraph/timeline-header.js +3 -5
- package/es/scenegraph/timeline-header.js.map +1 -1
- package/es/state/state-manager.js +24 -19
- package/es/state/state-manager.js.map +1 -1
- package/es/tools/isx.d.ts +1 -1
- package/es/tools/util.js +2 -1
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/gantt-engine.d.ts +8 -0
- package/es/ts-types/gantt-engine.js +2 -1
- package/es/ts-types/gantt-engine.js.map +1 -1
- package/es/zoom-scale/DataZoomIntegration.d.ts +2 -0
- package/es/zoom-scale/DataZoomIntegration.js +32 -20
- package/es/zoom-scale/DataZoomIntegration.js.map +1 -1
- package/es/zoom-scale/ZoomScaleManager.js +1 -2
- package/package.json +11 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,MAAM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AC,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","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 cellBackgroundRectsGroup: 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.createHorizontalBackgroundRects();\n this.createVerticalLines();\n this.createHorizontalLines();\n this.createTimeLineHeaderBottomLine();\n this.createCellBackgroundRects();\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 createCellBackgroundRects() {\n const cellBackgroundColor = this._scene._gantt.parsedOptions.grid.cellBackgroundColor;\n\n // 没配置就不画\n if (!cellBackgroundColor) {\n return;\n }\n\n // 建一个 group 专门放背景 rect\n const bgGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n bgGroup.name = 'grid-cell-background';\n\n this.cellBackgroundRectsGroup = bgGroup;\n this.group.appendChild(bgGroup);\n\n const rowCount = this.rowCount;\n // 取第一层时间刻度(reverseSortedTimelineScales[0])\n const scale = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const timelineDates = scale?.timelineDates ?? [];\n const colCount = timelineDates.length;\n const timelineColWidth: number = this._scene._gantt.parsedOptions.timelineColWidth;\n let y = 0;\n\n for (let r = 0; r < rowCount; r++) {\n const rowHeight: number = this._scene._gantt.getRowHeightByIndex(r);\n\n let x = 0;\n\n for (let c = 0; c < colCount; c++) {\n const cellStart: Date | undefined = timelineDates[c]?.startDate;\n const cellEnd: Date | undefined = timelineDates[c]?.endDate;\n\n // 没有时间范围就跳过\n if (!cellStart || !cellEnd) {\n x += timelineColWidth;\n continue;\n }\n // 计算当前单元格的背景配置结果\n const result =\n typeof cellBackgroundColor === 'function'\n ? cellBackgroundColor({\n rowIndex: r,\n colIndex: c,\n date: cellStart,\n ganttInstance: this._scene._gantt\n })\n : cellBackgroundColor[(r + c) % cellBackgroundColor.length];\n // 没结果就跳过\n if (!result) {\n x += timelineColWidth;\n continue;\n }\n\n // 统一转成数组处理:要么 [string],要么 segments[]\n const resultArray = Array.isArray(result) ? result : [result];\n\n // 情况1:只有一个 string,整格纯色\n if (resultArray.length === 1 && typeof resultArray[0] === 'string') {\n const rect = createRect({\n pickable: false,\n fill: resultArray[0],\n x,\n y,\n width: timelineColWidth,\n height: rowHeight\n });\n\n bgGroup.appendChild(rect);\n x += timelineColWidth;\n continue;\n }\n\n // 情况2:分段着色(按时间切片映射到像素宽度)\n const cs = cellStart.getTime();\n const ce = cellEnd.getTime();\n const total = ce - cs;\n\n for (const seg of resultArray) {\n if (!seg) {\n continue;\n }\n\n const { startTime, endTime, color } = seg;\n if (!startTime || !endTime || !color) {\n continue;\n }\n\n const ss = startTime.getTime();\n const se = endTime.getTime();\n\n // 完全不相交就跳过\n if (se <= cs || ss >= ce) {\n continue;\n }\n\n // 将时间段裁剪到 [cs, ce],映射到 [x, x+timelineColWidth]\n const startOffset = (Math.max(ss, cs) - cs) / total;\n const pixelStartX = x + startOffset * timelineColWidth;\n\n const endOffset = (Math.min(se, ce) - cs) / total;\n const pixelWidth = (endOffset - startOffset) * timelineColWidth;\n\n const rect = createRect({\n pickable: false,\n fill: color,\n x: pixelStartX,\n y,\n width: pixelWidth,\n height: rowHeight\n });\n\n bgGroup.appendChild(rect);\n }\n\n x += timelineColWidth;\n }\n\n y += rowHeight;\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 this.createCellBackgroundRects();\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 this.cellBackgroundRectsGroup?.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 this.cellBackgroundRectsGroup?.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,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI5E,MAAM,OAAO,IAAI;IAqBf,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,IAA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AA,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;QAC1D,MAAA,IAAI,CAAC,wBAAwB,0CAAE,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACtD,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","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 cellBackgroundRectsGroup: 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 this.createCellBackgroundRects();\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 createCellBackgroundRects() {\n const cellBackgroundColor = this._scene._gantt.parsedOptions.grid.cellBackgroundColor;\n\n // 没配置就不画\n if (!cellBackgroundColor) {\n return;\n }\n\n // 建一个 group 专门放背景 rect\n const bgGroup = new Group({\n x: 0,\n y: 0,\n width: this.allGridWidth,\n height: this.allGridHeight\n });\n bgGroup.name = 'grid-cell-background';\n\n this.cellBackgroundRectsGroup = bgGroup;\n this.group.appendChild(bgGroup);\n\n const rowCount = this.rowCount;\n // 取第一层时间刻度(reverseSortedTimelineScales[0])\n const scale = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];\n const timelineDates = scale?.timelineDates ?? [];\n const colCount = timelineDates.length;\n const timelineColWidth: number = this._scene._gantt.parsedOptions.timelineColWidth;\n let y = 0;\n\n for (let r = 0; r < rowCount; r++) {\n const rowHeight: number = this._scene._gantt.getRowHeightByIndex(r);\n\n let x = 0;\n\n for (let c = 0; c < colCount; c++) {\n const cellStart: Date | undefined = timelineDates[c]?.startDate;\n const cellEnd: Date | undefined = timelineDates[c]?.endDate;\n\n // 没有时间范围就跳过\n if (!cellStart || !cellEnd) {\n x += timelineColWidth;\n continue;\n }\n // 计算当前单元格的背景配置结果\n const result =\n typeof cellBackgroundColor === 'function'\n ? cellBackgroundColor({\n rowIndex: r,\n colIndex: c,\n date: cellStart,\n ganttInstance: this._scene._gantt\n })\n : cellBackgroundColor[(r + c) % cellBackgroundColor.length];\n // 没结果就跳过\n if (!result) {\n x += timelineColWidth;\n continue;\n }\n\n // 统一转成数组处理:要么 [string],要么 segments[]\n const resultArray = Array.isArray(result) ? result : [result];\n\n // 情况1:只有一个 string,整格纯色\n if (resultArray.length === 1 && typeof resultArray[0] === 'string') {\n const rect = createRect({\n pickable: false,\n fill: resultArray[0],\n x,\n y,\n width: timelineColWidth,\n height: rowHeight\n });\n\n bgGroup.appendChild(rect);\n x += timelineColWidth;\n continue;\n }\n\n // 情况2:分段着色(按时间切片映射到像素宽度)\n const cs = cellStart.getTime();\n const ce = cellEnd.getTime();\n const total = ce - cs;\n\n for (const seg of resultArray) {\n if (!seg) {\n continue;\n }\n\n const { startTime, endTime, color } = seg;\n if (!startTime || !endTime || !color) {\n continue;\n }\n\n const ss = startTime.getTime();\n const se = endTime.getTime();\n\n // 完全不相交就跳过\n if (se <= cs || ss >= ce) {\n continue;\n }\n\n // 将时间段裁剪到 [cs, ce],映射到 [x, x+timelineColWidth]\n const startOffset = (Math.max(ss, cs) - cs) / total;\n const pixelStartX = x + startOffset * timelineColWidth;\n\n const endOffset = (Math.min(se, ce) - cs) / total;\n const pixelWidth = (endOffset - startOffset) * timelineColWidth;\n\n const rect = createRect({\n pickable: false,\n fill: color,\n x: pixelStartX,\n y,\n width: pixelWidth,\n height: rowHeight\n });\n\n bgGroup.appendChild(rect);\n }\n\n x += timelineColWidth;\n }\n\n y += rowHeight;\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 this.createCellBackgroundRects();\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 this.cellBackgroundRectsGroup?.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 this.cellBackgroundRectsGroup?.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createDateAtMidnight } from "../tools/util";
|
|
2
2
|
|
|
3
3
|
import { Group, createLine, Text } from "@visactor/vtable/es/vrender";
|
|
4
4
|
|
|
@@ -30,15 +30,14 @@ export class MarkLine {
|
|
|
30
30
|
height: height
|
|
31
31
|
}), this.markLIneContainer.setAttribute("width", this._scene._gantt.getAllDateColsWidth()),
|
|
32
32
|
this.markLIneContainer.setAttribute("height", height);
|
|
33
|
-
const markLine = this._scene._gantt.parsedOptions.markLine
|
|
34
|
-
minDate && markLine.forEach((line => {
|
|
35
|
-
const style = line.style, contentStyle = line.contentStyle || {},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const dateX = this._scene._gantt.parsedOptions.timelineColWidth * (Math.floor(unitCount) + positionOffset), markLineGroup = new Group({
|
|
33
|
+
const markLine = this._scene._gantt.parsedOptions.markLine;
|
|
34
|
+
this._scene._gantt.parsedOptions.minDate && markLine.forEach((line => {
|
|
35
|
+
const style = line.style, contentStyle = line.contentStyle || {}, dateTime = (this._scene._gantt.parsedOptions.timeScaleIncludeHour ? createDateAtMidnight(line.date) : createDateAtMidnight(line.date, !0)).getTime();
|
|
36
|
+
if (dateTime < this._scene._gantt.parsedOptions._minDateTime || dateTime > this._scene._gantt.parsedOptions._maxDateTime) return;
|
|
37
|
+
const cellIndex = this._scene._gantt.getDateIndexByTime(dateTime), cellStartX = cellIndex >= 1 ? this._scene._gantt.getDateColsWidth(0, cellIndex - 1) : 0, cellWidth = this._scene._gantt.getDateColWidth(cellIndex);
|
|
38
|
+
let dateX = cellStartX;
|
|
39
|
+
"date" === line.position ? dateX = this._scene._gantt.getXByTime(dateTime) : "right" === line.position ? dateX = cellStartX + cellWidth : "middle" === line.position && (dateX = cellStartX + cellWidth / 2);
|
|
40
|
+
const markLineGroup = new Group({
|
|
42
41
|
pickable: !1,
|
|
43
42
|
x: dateX - this.markLineContainerWidth / 2,
|
|
44
43
|
y: 0,
|
|
@@ -60,7 +59,7 @@ export class MarkLine {
|
|
|
60
59
|
} ]
|
|
61
60
|
});
|
|
62
61
|
if (markLineGroup.appendChild(lineObj), line.content) {
|
|
63
|
-
const textMaxLineWidth = this._scene._gantt.
|
|
62
|
+
const textMaxLineWidth = Math.max(this._scene._gantt.getDateColWidth(cellIndex), 1), textContainerHeight = contentStyle.lineHeight || 18, textGroup = new Group({
|
|
64
63
|
x: this.markLineContainerWidth / 2,
|
|
65
64
|
y: 0,
|
|
66
65
|
cursor: "pointer",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/mark-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAI9E,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,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AAM,EAAE,SAAS;wBACjB,UAAU,EAAE,mBAAmB;wBAC/B,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,QAAQ;wBAC/C,IAAI,EAAE,YAAY,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS;wBAC3C,QAAQ,EAAE,YAAY,CAAC,QAAQ,IAAI,EAAE;wBACrC,MAAM,EAAE;4BACN,QAAQ,EAAE,KAAK;4BACf,EAAE,EAAE,gBAAgB,GAAG,CAAC;4BACxB,EAAE,EAAE,CAAC,mBAAmB,GAAG,CAAC;yBAC7B;qBACK,CAAC,CAAC;oBACV,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;iBAC7B;YACH,CAAC,CAAC,CAAC;IACP,CAAC;IAGD,OAAO;QACL,IAAI,CAAC,MAAM;YACT,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC9E,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAC9C,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,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","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,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAIrD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,OAAO,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,KAAK,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,KAAK,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;YACnB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,IAAI;SACX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I,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","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"]}
|
|
@@ -17,15 +17,25 @@ export declare class TaskBar {
|
|
|
17
17
|
hoverBarLeftIcon: Image;
|
|
18
18
|
hoverBarRightIcon: Image;
|
|
19
19
|
hoverBarProgressHandle: Group;
|
|
20
|
+
locateIconsGroup?: Group;
|
|
21
|
+
currentHoverLocateIcon: Group | null;
|
|
20
22
|
_scene: Scenegraph;
|
|
21
23
|
width: number;
|
|
22
24
|
height: number;
|
|
23
25
|
selectedBorders: Group[];
|
|
24
26
|
constructor(scene: Scenegraph);
|
|
25
27
|
initBars(): void;
|
|
26
|
-
initBar(index: number, childIndex?: number | number[], childrenLength?: number):
|
|
28
|
+
initBar(index: number, childIndex?: number | number[], childrenLength?: number): {
|
|
29
|
+
barGroupBox: GanttTaskBarNode;
|
|
30
|
+
baselineBar: any;
|
|
31
|
+
};
|
|
27
32
|
updateTaskBarNode(index: number, sub_task_index?: number): void;
|
|
28
33
|
initHoverBarIcons(): void;
|
|
34
|
+
initLocateIconsGroup(): void;
|
|
35
|
+
applyLocateIconStyle(icon: Group, hover: boolean): void;
|
|
36
|
+
createLocateIcon(side: 'left' | 'right', target: GanttTaskBarNode): Group;
|
|
37
|
+
setLocateIconHover(icon: Group | null): void;
|
|
38
|
+
updateOffscreenIndicators(): void;
|
|
29
39
|
setX(x: number): void;
|
|
30
40
|
setY(y: number): void;
|
|
31
41
|
refresh(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Group, createText, createRect, Image, Circle, Line, Polygon } from "@visactor/vtable/es/vrender";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { parseStringTemplate, toBoxArray } from "../tools/util";
|
|
4
4
|
|
|
5
5
|
import { isValid } from "@visactor/vutils";
|
|
6
6
|
|
|
@@ -14,6 +14,8 @@ const TASKBAR_HOVER_ICON = '<svg width="100" height="200" xmlns="http://www.w3.o
|
|
|
14
14
|
|
|
15
15
|
export const TASKBAR_HOVER_ICON_WIDTH = 10;
|
|
16
16
|
|
|
17
|
+
const LOCATE_ICON_SIZE = 22, LOCATE_ICON_PADDING = 4, LOCATE_ICON_BG = "#f2f3f5", LOCATE_ICON_BG_HOVER = "#4080ff", LOCATE_ICON_ARROW = "#4e5969", LOCATE_ICON_ARROW_HOVER = "#ffffff";
|
|
18
|
+
|
|
17
19
|
export class TaskBar {
|
|
18
20
|
formatMilestoneText(text, record) {
|
|
19
21
|
if (!text) return "";
|
|
@@ -62,7 +64,7 @@ export class TaskBar {
|
|
|
62
64
|
pickable: !1,
|
|
63
65
|
clip: !0
|
|
64
66
|
}), this.group.name = "task-bar-container", scene.ganttGroup.addChild(this.group),
|
|
65
|
-
this.initBars(), this.initHoverBarIcons();
|
|
67
|
+
this.initBars(), this.initHoverBarIcons(), scene._gantt.parsedOptions.taskBarLocateIcon && this.initLocateIconsGroup();
|
|
66
68
|
}
|
|
67
69
|
initBars() {
|
|
68
70
|
var _a, _b, _c;
|
|
@@ -75,8 +77,8 @@ export class TaskBar {
|
|
|
75
77
|
clip: !0
|
|
76
78
|
}), this.group.appendChild(this.barContainer);
|
|
77
79
|
for (let i = 0; i < this._scene._gantt.itemCount; i++) if (this._scene._gantt.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Inline && this._scene._gantt.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Separate && this._scene._gantt.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Arrange && this._scene._gantt.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Compact) if (this._scene._gantt.parsedOptions.tasksShowMode !== TasksShowMode.Project_Sub_Tasks_Inline) {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
+
const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i);
|
|
81
|
+
baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
|
|
80
82
|
} else {
|
|
81
83
|
const record = this._scene._gantt.getRecordByIndex(i), isExpanded = "expand" === record.hierarchyState;
|
|
82
84
|
if (record.type === TaskType.PROJECT && (null === (_c = record.children) || void 0 === _c ? void 0 : _c.length) > 0 && !isExpanded) {
|
|
@@ -85,42 +87,89 @@ export class TaskBar {
|
|
|
85
87
|
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++) {
|
|
86
88
|
const child_record = record.children[j];
|
|
87
89
|
if (child_record.type !== TaskType.PROJECT) {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
+
const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i, [ ...sub_task_indexs, j ], record.children.length);
|
|
91
|
+
baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
|
|
90
92
|
} else callInitBar(child_record, [ ...sub_task_indexs, j ]);
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
95
|
callInitBar(record, sub_task_indexs);
|
|
94
96
|
} else {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
+
const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i);
|
|
98
|
+
baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
|
|
97
99
|
}
|
|
98
100
|
} else {
|
|
99
101
|
const record = this._scene._gantt.getRecordByIndex(i);
|
|
100
102
|
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++) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
+
const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i, j, record.children.length);
|
|
104
|
+
baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
|
|
103
105
|
} else {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
+
const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(i);
|
|
107
|
+
baselineBar && this.barContainer.appendChild(baselineBar), barGroupBox && this.barContainer.appendChild(barGroupBox);
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
initBar(index, childIndex, childrenLength) {
|
|
110
|
-
var _a, _b, _c, _d, _e;
|
|
112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
111
113
|
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 === TaskType.MILESTONE;
|
|
112
|
-
if (isMilestone && !startDate || !isMilestone && (taskDays <= 0 || !startDate || !endDate || startDate.getTime() > endDate.getTime())) return
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
if (isMilestone && !startDate || !isMilestone && (taskDays <= 0 || !startDate || !endDate || startDate.getTime() > endDate.getTime())) return {
|
|
115
|
+
barGroupBox: null,
|
|
116
|
+
baselineBar: null
|
|
117
|
+
};
|
|
118
|
+
let taskBarSize = this._scene._gantt.getXByTime(endDate.getTime() + 1) - this._scene._gantt.getXByTime(startDate.getTime());
|
|
115
119
|
const taskBarStyle = this._scene._gantt.getTaskBarStyle(index, childIndex), taskbarHeight = taskBarStyle.width;
|
|
116
120
|
isValid(taskBarStyle.minSize) && (taskBarSize = Math.max(taskBarSize, taskBarStyle.minSize));
|
|
117
|
-
const oneTaskHeigth = this._scene._gantt.parsedOptions.rowHeight, milestoneTaskBarHeight = this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width, x =
|
|
121
|
+
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);
|
|
122
|
+
let y = this._scene._gantt.getRowsHeightByIndex(0, index - 1) + (this._scene._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate ? (null !== (_a = childIndex) && void 0 !== _a ? _a : 0) * oneTaskHeigth : this._scene._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange || this._scene._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact ? taskRecord.vtable_gantt_showIndex * oneTaskHeigth : 0);
|
|
123
|
+
const baselineInfo = this._scene._gantt.getBaselineInfoByTaskListIndex(index, childIndex), hasBaseline = baselineInfo.baselineStartDate && baselineInfo.baselineEndDate && baselineInfo.baselineDays > 0, baselinePosition = this._scene._gantt.parsedOptions.baselinePosition;
|
|
124
|
+
let baselineBar = null, taskBarYOffset = 0;
|
|
125
|
+
if (hasBaseline && !isMilestone) {
|
|
126
|
+
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());
|
|
127
|
+
let baselineY;
|
|
128
|
+
const taskBarPaddingTop = null !== (_b = taskBarStyle.paddingTop) && void 0 !== _b ? _b : void 0, baselinePaddingTop = null !== (_c = baselineStyle.paddingTop) && void 0 !== _c ? _c : void 0;
|
|
129
|
+
if ("overlap" === baselinePosition) baselineY = void 0 !== taskBarPaddingTop ? y + taskBarPaddingTop : y + (oneTaskHeigth - baselineStyle.width) / 2; else if ("top" === baselinePosition) {
|
|
130
|
+
const gap = 4;
|
|
131
|
+
if (void 0 !== baselinePaddingTop && void 0 !== taskBarPaddingTop) baselineY = y + baselinePaddingTop,
|
|
132
|
+
taskBarYOffset = taskBarPaddingTop; else if (void 0 !== baselinePaddingTop) baselineY = y + baselinePaddingTop,
|
|
133
|
+
taskBarYOffset = baselinePaddingTop + baselineStyle.width + gap; else if (void 0 !== taskBarPaddingTop) {
|
|
134
|
+
baselineY = y + (oneTaskHeigth - (baselineStyle.width + gap + taskbarHeight)) / 2,
|
|
135
|
+
taskBarYOffset = taskBarPaddingTop;
|
|
136
|
+
} else {
|
|
137
|
+
const startY = (oneTaskHeigth - (baselineStyle.width + gap + taskbarHeight)) / 2;
|
|
138
|
+
baselineY = y + startY, taskBarYOffset = startY + baselineStyle.width + gap;
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
const gap = 4;
|
|
142
|
+
if (void 0 !== taskBarPaddingTop && void 0 !== baselinePaddingTop) taskBarYOffset = taskBarPaddingTop,
|
|
143
|
+
baselineY = y + baselinePaddingTop; else if (void 0 !== taskBarPaddingTop) taskBarYOffset = taskBarPaddingTop,
|
|
144
|
+
baselineY = y + taskBarPaddingTop + taskbarHeight + gap; else if (void 0 !== baselinePaddingTop) {
|
|
145
|
+
taskBarYOffset = (oneTaskHeigth - (taskbarHeight + gap + baselineStyle.width)) / 2,
|
|
146
|
+
baselineY = y + baselinePaddingTop;
|
|
147
|
+
} else {
|
|
148
|
+
const startY = (oneTaskHeigth - (taskbarHeight + gap + baselineStyle.width)) / 2;
|
|
149
|
+
taskBarYOffset = startY, baselineY = y + startY + taskbarHeight + gap;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
baselineBar = createRect({
|
|
153
|
+
x: baselineX,
|
|
154
|
+
y: baselineY,
|
|
155
|
+
width: Math.max(baselineWidth, baselineStyle.minSize || 0),
|
|
156
|
+
height: baselineStyle.width,
|
|
157
|
+
fill: baselineStyle.barColor,
|
|
158
|
+
cornerRadius: baselineStyle.cornerRadius,
|
|
159
|
+
lineWidth: 2 * (null !== (_d = baselineStyle.borderLineWidth) && void 0 !== _d ? _d : baselineStyle.borderWidth),
|
|
160
|
+
stroke: baselineStyle.borderColor,
|
|
161
|
+
pickable: !1
|
|
162
|
+
}), baselineBar.name = "baseline-bar";
|
|
163
|
+
}
|
|
164
|
+
const taskBarPaddingTop = null !== (_e = taskBarStyle.paddingTop) && void 0 !== _e ? _e : void 0;
|
|
165
|
+
y += hasBaseline && !isMilestone && "overlap" !== baselinePosition ? taskBarYOffset : void 0 !== taskBarPaddingTop ? taskBarPaddingTop : (oneTaskHeigth - (isMilestone ? milestoneTaskBarHeight : taskbarHeight)) / 2 + taskBarYOffset;
|
|
166
|
+
const barGroupBox = new GanttTaskBarNode({
|
|
118
167
|
x: x,
|
|
119
168
|
y: y,
|
|
120
169
|
width: isMilestone ? milestoneTaskBarHeight : taskBarSize,
|
|
121
170
|
height: isMilestone ? milestoneTaskBarHeight : taskbarHeight,
|
|
122
171
|
cornerRadius: isMilestone ? this._scene._gantt.parsedOptions.taskBarMilestoneStyle.cornerRadius : taskBarStyle.cornerRadius,
|
|
123
|
-
lineWidth: isMilestone ? 2 * this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth : 2 * (null !== (
|
|
172
|
+
lineWidth: isMilestone ? 2 * this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderLineWidth : 2 * (null !== (_f = taskBarStyle.borderLineWidth) && void 0 !== _f ? _f : taskBarStyle.borderWidth),
|
|
124
173
|
stroke: isMilestone ? this._scene._gantt.parsedOptions.taskBarMilestoneStyle.borderColor : taskBarStyle.borderColor,
|
|
125
174
|
angle: isMilestone ? .25 * Math.PI : 0,
|
|
126
175
|
anchor: isMilestone ? [ x + milestoneTaskBarHeight / 2, y + milestoneTaskBarHeight / 2 ] : void 0
|
|
@@ -153,8 +202,8 @@ export class TaskBar {
|
|
|
153
202
|
ganttInstance: this._scene._gantt
|
|
154
203
|
});
|
|
155
204
|
} else customLayoutObj = taskBarCustomLayout;
|
|
156
|
-
customLayoutObj && (rootContainer = customLayoutObj.rootContainer, renderDefaultBar = null !== (
|
|
157
|
-
renderDefaultText = null !== (
|
|
205
|
+
customLayoutObj && (rootContainer = customLayoutObj.rootContainer, renderDefaultBar = null !== (_g = customLayoutObj.renderDefaultBar) && void 0 !== _g && _g,
|
|
206
|
+
renderDefaultText = null !== (_h = customLayoutObj.renderDefaultText) && void 0 !== _h && _h,
|
|
158
207
|
rootContainer && (rootContainer.name = "task-bar-custom-render"));
|
|
159
208
|
}
|
|
160
209
|
if (renderDefaultBar) {
|
|
@@ -200,7 +249,7 @@ export class TaskBar {
|
|
|
200
249
|
barGroupBox.updateTextPosition();
|
|
201
250
|
}
|
|
202
251
|
if (renderDefaultText && "milestone" === taskRecord.type && this._scene._gantt.parsedOptions.taskBarMilestoneStyle.labelText) {
|
|
203
|
-
const milestoneStyle = this._scene._gantt.parsedOptions.taskBarMilestoneStyle, textStyle = milestoneStyle.labelTextStyle || {}, pos = this.calculateMilestoneTextPosition(milestoneStyle.textOrient || "right", milestoneStyle.width, null !== (
|
|
252
|
+
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 Group({
|
|
204
253
|
x: x,
|
|
205
254
|
y: y,
|
|
206
255
|
width: milestoneStyle.width,
|
|
@@ -221,13 +270,17 @@ export class TaskBar {
|
|
|
221
270
|
textContainer.appendChild(milestoneLabel), this.barContainer.appendChild(textContainer),
|
|
222
271
|
barGroupBox.milestoneTextLabel = milestoneLabel, barGroupBox.milestoneTextContainer = textContainer;
|
|
223
272
|
}
|
|
224
|
-
return
|
|
273
|
+
return {
|
|
274
|
+
barGroupBox: barGroupBox,
|
|
275
|
+
baselineBar: baselineBar
|
|
276
|
+
};
|
|
225
277
|
}
|
|
226
278
|
updateTaskBarNode(index, sub_task_index) {
|
|
227
279
|
const taskbarGroup = this.getTaskBarNodeByIndex(index, sub_task_index);
|
|
228
280
|
taskbarGroup && this.barContainer.removeChild(taskbarGroup);
|
|
229
|
-
const
|
|
230
|
-
|
|
281
|
+
const {barGroupBox: barGroupBox, baselineBar: baselineBar} = this.initBar(index, sub_task_index);
|
|
282
|
+
barGroupBox && (this.barContainer.insertInto(barGroupBox, index), barGroupBox.updateTextPosition()),
|
|
283
|
+
baselineBar && this.barContainer.insertBefore(baselineBar, barGroupBox), this.updateOffscreenIndicators();
|
|
231
284
|
}
|
|
232
285
|
initHoverBarIcons() {
|
|
233
286
|
var _a, _b;
|
|
@@ -293,26 +346,134 @@ export class TaskBar {
|
|
|
293
346
|
progressHandle.appendChild(triangleHandle), progressHandle.name = "task-bar-progress-handle",
|
|
294
347
|
this.hoverBarProgressHandle = progressHandle, hoverBarGroup.appendChild(progressHandle);
|
|
295
348
|
}
|
|
349
|
+
initLocateIconsGroup() {
|
|
350
|
+
const locateIconsGroup = new Group({
|
|
351
|
+
x: 0,
|
|
352
|
+
y: 0,
|
|
353
|
+
width: this.width,
|
|
354
|
+
height: this.height,
|
|
355
|
+
clip: !0,
|
|
356
|
+
pickable: !1
|
|
357
|
+
});
|
|
358
|
+
this.locateIconsGroup = locateIconsGroup, locateIconsGroup.name = "task-bar-locate-icons",
|
|
359
|
+
this.group.appendChild(locateIconsGroup);
|
|
360
|
+
}
|
|
361
|
+
applyLocateIconStyle(icon, hover) {
|
|
362
|
+
const background = icon.background, arrow = icon.arrow;
|
|
363
|
+
background && background.setAttribute("fill", hover ? "#4080ff" : "#f2f3f5"), arrow && arrow.setAttribute("fill", hover ? "#ffffff" : "#4e5969");
|
|
364
|
+
}
|
|
365
|
+
createLocateIcon(side, target) {
|
|
366
|
+
const iconGroup = new Group({
|
|
367
|
+
x: 0,
|
|
368
|
+
y: 0,
|
|
369
|
+
width: 22,
|
|
370
|
+
height: 22,
|
|
371
|
+
pickable: !0,
|
|
372
|
+
cursor: "pointer",
|
|
373
|
+
visibleAll: !1
|
|
374
|
+
});
|
|
375
|
+
iconGroup.name = "left" === side ? "task-bar-locate-icon-left" : "task-bar-locate-icon-right",
|
|
376
|
+
iconGroup.attachedToTaskBarNode = target, iconGroup.side = side;
|
|
377
|
+
const background = createRect({
|
|
378
|
+
x: 0,
|
|
379
|
+
y: 0,
|
|
380
|
+
width: 22,
|
|
381
|
+
height: 22,
|
|
382
|
+
cornerRadius: 4,
|
|
383
|
+
fill: "#f2f3f5",
|
|
384
|
+
pickable: !1
|
|
385
|
+
}), arrow = new Polygon("left" === side ? {
|
|
386
|
+
points: [ {
|
|
387
|
+
x: 14,
|
|
388
|
+
y: 5
|
|
389
|
+
}, {
|
|
390
|
+
x: 8,
|
|
391
|
+
y: 11
|
|
392
|
+
}, {
|
|
393
|
+
x: 14,
|
|
394
|
+
y: 17
|
|
395
|
+
} ],
|
|
396
|
+
fill: "#4e5969",
|
|
397
|
+
pickable: !1
|
|
398
|
+
} : {
|
|
399
|
+
points: [ {
|
|
400
|
+
x: 8,
|
|
401
|
+
y: 5
|
|
402
|
+
}, {
|
|
403
|
+
x: 14,
|
|
404
|
+
y: 11
|
|
405
|
+
}, {
|
|
406
|
+
x: 8,
|
|
407
|
+
y: 17
|
|
408
|
+
} ],
|
|
409
|
+
fill: "#4e5969",
|
|
410
|
+
pickable: !1
|
|
411
|
+
});
|
|
412
|
+
return iconGroup.appendChild(background), iconGroup.appendChild(arrow), iconGroup.background = background,
|
|
413
|
+
iconGroup.arrow = arrow, this.applyLocateIconStyle(iconGroup, !1), iconGroup;
|
|
414
|
+
}
|
|
415
|
+
setLocateIconHover(icon) {
|
|
416
|
+
this.currentHoverLocateIcon && this.currentHoverLocateIcon !== icon && this.applyLocateIconStyle(this.currentHoverLocateIcon, !1),
|
|
417
|
+
icon && this.applyLocateIconStyle(icon, !0), this.currentHoverLocateIcon = icon,
|
|
418
|
+
this._scene.updateNextFrame();
|
|
419
|
+
}
|
|
420
|
+
updateOffscreenIndicators() {
|
|
421
|
+
if (!this.locateIconsGroup) return;
|
|
422
|
+
const gantt = this._scene._gantt, scrollLeft = gantt.stateManager.scrollLeft, scrollTop = gantt.stateManager.scrollTop, viewWidth = gantt.tableNoFrameWidth, visibleLeft = scrollLeft, visibleRight = scrollLeft + viewWidth, visibleTop = scrollTop, visibleBottom = scrollTop + this.height;
|
|
423
|
+
let child = this.barContainer.firstChild;
|
|
424
|
+
for (;child; ) {
|
|
425
|
+
if ("task-bar" === child.name) {
|
|
426
|
+
const bar = child, barLeft = bar.attribute.x, barRight = barLeft + bar.attribute.width, barTop = bar.attribute.y;
|
|
427
|
+
let side = null;
|
|
428
|
+
barTop + bar.attribute.height >= visibleTop && barTop <= visibleBottom && (barRight < visibleLeft ? side = "left" : barLeft > visibleRight && (side = "right"));
|
|
429
|
+
const leftIcon = bar.locateLeftIcon, rightIcon = bar.locateRightIcon;
|
|
430
|
+
if (side) {
|
|
431
|
+
let icon = "left" === side ? leftIcon : rightIcon;
|
|
432
|
+
icon ? icon.parent !== this.locateIconsGroup && this.locateIconsGroup.appendChild(icon) : (icon = this.createLocateIcon(side, bar),
|
|
433
|
+
"left" === side ? bar.locateLeftIcon = icon : bar.locateRightIcon = icon, this.locateIconsGroup.appendChild(icon));
|
|
434
|
+
const iconX = "left" === side ? 4 : viewWidth - 22 - 4, iconY = barTop - scrollTop + (bar.attribute.height - 22) / 2;
|
|
435
|
+
icon.setAttributes({
|
|
436
|
+
x: iconX,
|
|
437
|
+
y: iconY,
|
|
438
|
+
visibleAll: !0
|
|
439
|
+
});
|
|
440
|
+
const otherIcon = "left" === side ? rightIcon : leftIcon;
|
|
441
|
+
null == otherIcon || otherIcon.setAttribute("visibleAll", !1), this.currentHoverLocateIcon === otherIcon && this.setLocateIconHover(null);
|
|
442
|
+
} else null == leftIcon || leftIcon.setAttribute("visibleAll", !1), null == rightIcon || rightIcon.setAttribute("visibleAll", !1),
|
|
443
|
+
this.currentHoverLocateIcon !== leftIcon && this.currentHoverLocateIcon !== rightIcon || this.setLocateIconHover(null);
|
|
444
|
+
}
|
|
445
|
+
child = child._next;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
296
448
|
setX(x) {
|
|
297
|
-
this.barContainer.setAttribute("x", x);
|
|
449
|
+
this.barContainer.setAttribute("x", x), this.updateOffscreenIndicators();
|
|
298
450
|
}
|
|
299
451
|
setY(y) {
|
|
300
|
-
this.barContainer.setAttribute("y", y);
|
|
452
|
+
this.barContainer.setAttribute("y", y), this.updateOffscreenIndicators();
|
|
301
453
|
}
|
|
302
454
|
refresh() {
|
|
455
|
+
var _a, _b;
|
|
303
456
|
this.width = this._scene._gantt.tableNoFrameWidth, this.height = this._scene._gantt.gridHeight,
|
|
304
457
|
this.group.setAttributes({
|
|
305
458
|
height: this.height,
|
|
306
459
|
width: this.width,
|
|
307
460
|
y: this._scene._gantt.getAllHeaderRowsHeight()
|
|
308
|
-
})
|
|
461
|
+
}), null === (_a = this.locateIconsGroup) || void 0 === _a || _a.setAttributes({
|
|
462
|
+
width: this.width,
|
|
463
|
+
height: this.height
|
|
464
|
+
}), null === (_b = this.locateIconsGroup) || void 0 === _b || _b.removeAllChild();
|
|
309
465
|
const x = this.barContainer.attribute.x, y = this.barContainer.attribute.y;
|
|
310
466
|
this.barContainer.removeAllChild(), this.group.removeChild(this.barContainer), this.initBars(),
|
|
311
|
-
this.setX(x), this.setY(y);
|
|
467
|
+
this.setX(x), this.setY(y), this.updateOffscreenIndicators();
|
|
312
468
|
}
|
|
313
469
|
resize() {
|
|
470
|
+
var _a;
|
|
314
471
|
this.width = this._scene._gantt.tableNoFrameWidth, this.height = this._scene._gantt.gridHeight,
|
|
315
|
-
this.group.setAttribute("width", this.width), this.group.setAttribute("height", this.height)
|
|
472
|
+
this.group.setAttribute("width", this.width), this.group.setAttribute("height", this.height),
|
|
473
|
+
null === (_a = this.locateIconsGroup) || void 0 === _a || _a.setAttributes({
|
|
474
|
+
width: this.width,
|
|
475
|
+
height: this.height
|
|
476
|
+
}), this.updateOffscreenIndicators();
|
|
316
477
|
}
|
|
317
478
|
showHoverBar(x, y, width, height, target) {
|
|
318
479
|
var _a, _b, _c, _d, _e;
|