@operato/gantt 7.0.21 → 7.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/src/draw-time-scale-header.d.ts +5 -0
- package/dist/src/draw-time-scale-header.js +154 -0
- package/dist/src/draw-time-scale-header.js.map +1 -0
- package/dist/src/gantt-chart-controller.d.ts +1 -1
- package/dist/src/gantt-chart-controller.js +6 -161
- package/dist/src/gantt-chart-controller.js.map +1 -1
- package/dist/src/ox-gantt-chart.d.ts +2 -0
- package/dist/src/ox-gantt-chart.js +26 -0
- package/dist/src/ox-gantt-chart.js.map +1 -1
- package/dist/src/ox-gantt.d.ts +1 -4
- package/dist/src/ox-gantt.js +37 -27
- package/dist/src/ox-gantt.js.map +1 -1
- package/dist/src/ox-resource-chart.d.ts +27 -4
- package/dist/src/ox-resource-chart.js +162 -39
- package/dist/src/ox-resource-chart.js.map +1 -1
- package/dist/stories/ox-gantt.stories.js +17 -10
- package/dist/stories/ox-gantt.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/draw-time-scale-header.ts +192 -0
- package/src/gantt-chart-controller.ts +6 -189
- package/src/ox-gantt-chart.ts +30 -0
- package/src/ox-gantt.ts +41 -25
- package/src/ox-resource-chart.ts +179 -43
- package/stories/ox-gantt.stories.ts +17 -10
- package/translations/en.json +3 -1
- package/translations/ja.json +3 -1
- package/translations/ko.json +3 -1
- package/translations/ms.json +3 -1
- package/translations/zh.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-gantt-chart.js","sourceRoot":"","sources":["../../src/ox-gantt-chart.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,wBAAwB,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAoC,MAAM,KAAK,CAAA;AAC7E,OAAO,EAAE,aAAa,EAA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AAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CAAmB;AACc;IAA1D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;oDAAwB;AACtD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAyB;AAE9B;IAArB,KAAK,CAAC,aAAa,CAAC;+CAAuB;AACxB;IAAnB,KAAK,CAAC,WAAW,CAAC;6CAAqB;AACZ;IAA3B,KAAK,CAAC,mBAAmB,CAAC;+CAA2B;AAC5B;IAAzB,KAAK,CAAC,iBAAiB,CAAC;6CAAwB;AAjEtC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CA8axB","sourcesContent":["import './ox-task-tooltip.js'\nimport './ox-resource-chart.js'\n\nimport { LitElement, html, css, PropertyValues, PropertyValueMap } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport * as d3 from 'd3'\nimport { locales } from './locales'\n\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { GanttChartController } from './gantt-chart-controller'\nimport { Task, TimeScale } from './types.js'\nimport { levelDown, levelUp } from './utils'\nimport { OxTaskTooltip } from './ox-task-tooltip.js'\n\n@customElement('ox-gantt-chart')\nexport class OxGanttChart extends LitElement {\n static styles = [\n MDTypeScaleStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n overflow: hidden;\n position: relative;\n }\n div[chart-container] {\n display: block;\n overflow-x: auto;\n overflow-y: hidden;\n }\n svg {\n min-width: 100%;\n }\n svg[header] {\n display: block;\n min-width: 100%;\n box-sizing: border-box;\n border-bottom: 1px solid var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));\n height: 40px;\n background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));\n color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));\n position: sticky;\n top: 0;\n z-index: 1;\n }\n .top-axis text,\n .bottom-axis text {\n font-size: 12px;\n }\n .grid line {\n stroke: #e0e0e0;\n }\n .grid path {\n stroke-width: 0;\n }\n .no-select {\n user-select: none;\n }\n .selected {\n stroke-width: 2px;\n stroke: var(--ox-gantt-selected-color, blue);\n }\n `\n ]\n\n @property({ type: String, attribute: 'from-date' }) fromDate: string = new Date(new Date().getFullYear(), 0, 1)\n .toISOString()\n .split('T')[0]\n @property({ type: String, attribute: 'to-date' }) toDate: string = new Date(new Date().getFullYear(), 11, 31)\n .toISOString()\n .split('T')[0]\n @property({ type: String, attribute: 'axis-scale' }) axisScale: TimeScale = 'week-day'\n @property({ type: Boolean, attribute: 'extend-grid-lines' }) extendGridLines: boolean = false\n @property({ type: Array }) tasks: Task[] = []\n @property({ type: String, attribute: 'selected-task-id' }) selectedTaskId?: string\n @property({ type: String }) locale: string = 'en-US'\n\n @query('svg[header]') svgHeader!: SVGElement\n @query('svg[body]') svgBody!: SVGElement\n @query('[chart-container]') container!: HTMLDivElement\n @query('ox-task-tooltip') tooltip!: OxTaskTooltip\n\n private ganttChartController: GanttChartController\n\n constructor() {\n super()\n this.ganttChartController = new GanttChartController(this, this.fromDate, this.toDate, this.axisScale)\n }\n\n protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n this.initHeaderGestureHandlers()\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('fromDate') || changedProperties.has('toDate')) {\n this.ganttChartController.updateRange(this.fromDate, this.toDate)\n }\n\n if (changedProperties.has('tasks')) {\n this.ganttChartController.setTasks(this.flattenTasks(this.tasks))\n this.svgBody.style.height = Math.max(this.tasks.length * 30, 2000) + 'px'\n }\n\n if (changedProperties.has('locale')) {\n this.updateLocale(this.locale)\n }\n\n if (changedProperties.has('selectedTaskId')) {\n this.ganttChartController.selectedTaskId = this.selectedTaskId\n }\n\n if (changedProperties.has('extendGridLines')) {\n this.ganttChartController.extendGridLines = this.extendGridLines\n }\n\n if (changedProperties.has('axisScale')) {\n this.ganttChartController.level = this.axisScale\n this.ganttChartController.updateTimeScale()\n }\n\n this.ganttChartController.drawAxes(this.svgHeader)\n this.ganttChartController.drawBody(this.svgBody, this.tooltip)\n }\n\n render() {\n return html`\n <div\n chart-container\n @wheel=${(e: WheelEvent) => this.ganttChartController.handleWheelForBody(e, this.container)}\n @touchstart=${(e: TouchEvent) => this.ganttChartController.handleTouchStartForBody(e, this.container)}\n @touchmove=${(e: TouchEvent) => this.ganttChartController.handleTouchMoveForBody(e, this.container)}\n >\n <svg\n header\n @date-range-selected=${(e: CustomEvent) => this.handleDateRangeSelected(e)}\n @wheel=${this.handleWheelForHeader.bind(this)}\n ></svg>\n <svg body></svg>\n <ox-task-tooltip></ox-task-tooltip>\n </div>\n `\n }\n\n flattenTasks(tasks: Task[], level: number = 0): Task[] {\n return tasks.flatMap(task => [{ ...task, level }, ...this.flattenTasks(task.children || [], level + 1)])\n }\n\n setVerticalOffset(offset: number) {\n this.container.scrollTop = offset\n }\n\n getVerticalOffset(): number {\n return this.container.scrollTop\n }\n\n handleWheelForHeader(event: WheelEvent) {\n event.preventDefault()\n event.stopPropagation()\n\n if (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey) {\n this.container.scrollBy({\n left: event.shiftKey ? event.deltaX : event.deltaY\n })\n } else {\n const zoomFactor = event.deltaY < 0 ? 1.1 : 0.9\n this.ganttChartController.baseWidth *= zoomFactor\n\n if (this.ganttChartController.baseWidth > 40) {\n if (this.ganttChartController.level == 'week-day') {\n this.ganttChartController.baseWidth = 40\n } else {\n this.ganttChartController.level = levelDown(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 30\n }\n } else if (this.ganttChartController.baseWidth < 30) {\n if (this.ganttChartController.level == 'year-quarter') {\n this.ganttChartController.baseWidth = 30\n }\n }\n if (this.ganttChartController.baseWidth < 20) {\n this.ganttChartController.level = levelUp(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 30\n }\n\n this.ganttChartController.updateTimeScale()\n this.requestUpdate()\n }\n }\n\n handleDateRangeSelected(event: CustomEvent) {\n const detail = event.detail\n this.dispatchEvent(new CustomEvent('date-range-selected', { detail }))\n }\n\n updateLocale(locale: string) {\n const localeDefinition = (locales as any)[locale || 'en-US']\n if (localeDefinition) {\n d3.timeFormatDefaultLocale(localeDefinition)\n this.ganttChartController.updateTimeScale()\n }\n }\n\n initHeaderGestureHandlers() {\n const header = d3.select(this.svgHeader)\n\n let isDragging = false\n let startX: number | null = null\n let lastTouchDistance: number | null = null\n\n const handleTouchStart = (event: TouchEvent) => {\n event.preventDefault()\n\n if (event.touches.length === 2) {\n lastTouchDistance = getTouchDistance(event.touches)\n } else {\n isDragging = true\n const touch = event.touches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n startX = touch.clientX - containerOffsetX\n }\n }\n\n const handleTouchMove = (event: TouchEvent) => {\n event.preventDefault()\n\n if (event.touches.length === 2 && lastTouchDistance !== null) {\n const currentDistance = getTouchDistance(event.touches)\n const zoomFactor = currentDistance / lastTouchDistance\n this.ganttChartController.baseWidth *= zoomFactor\n\n if (this.ganttChartController.baseWidth > 60) {\n if (this.ganttChartController.level == 'year-quarter') {\n this.ganttChartController.baseWidth = 60\n } else {\n this.ganttChartController.level = levelUp(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 30\n }\n } else if (this.ganttChartController.baseWidth < 30) {\n if (this.ganttChartController.level == 'week-day') {\n this.ganttChartController.baseWidth = 30\n } else {\n this.ganttChartController.level = levelDown(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 60\n }\n }\n\n lastTouchDistance = currentDistance\n this.ganttChartController.updateTimeScale()\n this.requestUpdate()\n } else if (isDragging && startX !== null) {\n const touch = event.touches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const currentX = touch.clientX - containerOffsetX\n this.highlightSelection(startX, currentX)\n }\n }\n\n const handleTouchEnd = (event: TouchEvent) => {\n event.preventDefault()\n\n if (event.touches.length < 2) {\n lastTouchDistance = null\n }\n\n if (!isDragging || startX === null) {\n const touch = event.changedTouches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const clickX = touch.clientX - containerOffsetX\n this.finalizeSelection(clickX, clickX)\n return\n }\n\n const touch = event.changedTouches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const endX = touch.clientX - containerOffsetX\n this.finalizeSelection(startX, endX)\n\n isDragging = false\n startX = null\n }\n\n const getTouchDistance = (touches: TouchList): number => {\n const dx = touches[0].clientX - touches[1].clientX\n const dy = touches[0].clientY - touches[1].clientY\n return Math.sqrt(dx * dx + dy * dy)\n }\n\n const handleMouseDown = (event: MouseEvent) => {\n isDragging = true\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n startX = event.clientX - containerOffsetX\n }\n\n const handleMouseMove = (event: MouseEvent) => {\n if (!isDragging || startX === null) return\n\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const currentX = event.clientX - containerOffsetX\n this.highlightSelection(startX, currentX)\n }\n\n const handleMouseUp = (event: MouseEvent) => {\n if (!isDragging || startX === null) {\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const clickX = event.clientX - containerOffsetX\n this.finalizeSelection(clickX, clickX)\n return\n }\n\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const endX = event.clientX - containerOffsetX\n this.finalizeSelection(startX, endX)\n\n isDragging = false\n startX = null\n }\n\n header.on('mousedown', handleMouseDown)\n header.on('mousemove', handleMouseMove)\n header.on('mouseup', handleMouseUp)\n header.on('touchstart', handleTouchStart)\n header.on('touchmove', handleTouchMove)\n header.on('touchend', handleTouchEnd)\n }\n\n highlightSelection(startX: number, endX: number) {\n const header = d3.select(this.svgHeader)\n const body = d3.select(this.svgBody)\n\n let startDate = this.ganttChartController.timeScale.invert(startX)\n let endDate = this.ganttChartController.timeScale.invert(endX)\n\n let start, end\n\n if (this.ganttChartController.level === 'week-day') {\n start = d3.timeDay.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeDay.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'quarter-week') {\n start = d3.timeWeek.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeWeek.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-month') {\n start = d3.timeMonth.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-quarter') {\n start = d3.timeMonth.every(3)!.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.every(3)!.ceil(d3.max([startDate, endDate])!), -1)\n }\n\n header.selectAll('.selection-rect').remove()\n body.selectAll('.selection-rect').remove()\n\n header\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 20)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', 20)\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n\n body\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 0)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', '100%')\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n }\n\n finalizeSelection(startX: number, endX: number) {\n const header = d3.select(this.svgHeader)\n const body = d3.select(this.svgBody)\n\n let startDate = this.ganttChartController.timeScale.invert(startX)\n let endDate = this.ganttChartController.timeScale.invert(endX)\n\n let start, end\n\n if (this.ganttChartController.level === 'week-day') {\n start = d3.timeDay.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeDay.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'quarter-week') {\n start = d3.timeWeek.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeWeek.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-month') {\n start = d3.timeMonth.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-quarter') {\n start = d3.timeMonth.every(3)!.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.every(3)!.ceil(d3.max([startDate, endDate])!), -1)\n }\n\n header.selectAll('.selection-rect').remove()\n body.selectAll('.selection-rect').remove()\n\n header\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 20)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', 20)\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n\n body\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 0)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', '100%')\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n\n const formatDate = d3.timeFormat('%Y-%m-%d')\n const customEvent = new CustomEvent('date-range-selected', {\n detail: { start: formatDate(start!), end: formatDate(end!) }\n })\n\n header.node()?.dispatchEvent(customEvent)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ox-gantt-chart.js","sourceRoot":"","sources":["../../src/ox-gantt-chart.ts"],"names":[],"mappings":";AAAA,OAAO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C,WAAW,CAAC;6CAAqB;AACZ;IAA3B,KAAK,CAAC,mBAAmB,CAAC;+CAA2B;AAC5B;IAAzB,KAAK,CAAC,iBAAiB,CAAC;6CAAwB;AAjEtC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CA4cxB","sourcesContent":["import './ox-task-tooltip.js'\nimport './ox-resource-chart.js'\n\nimport { LitElement, html, css, PropertyValues, PropertyValueMap } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport * as d3 from 'd3'\nimport { locales } from './locales'\n\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { GanttChartController } from './gantt-chart-controller'\nimport { Task, TimeScale } from './types.js'\nimport { levelDown, levelUp } from './utils'\nimport { OxTaskTooltip } from './ox-task-tooltip.js'\n\n@customElement('ox-gantt-chart')\nexport class OxGanttChart extends LitElement {\n static styles = [\n MDTypeScaleStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n overflow: hidden;\n position: relative;\n }\n div[chart-container] {\n display: block;\n overflow-x: auto;\n overflow-y: hidden;\n }\n svg {\n min-width: 100%;\n }\n svg[header] {\n display: block;\n min-width: 100%;\n box-sizing: border-box;\n border-bottom: 1px solid var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));\n height: 40px;\n background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));\n color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));\n position: sticky;\n top: 0;\n z-index: 1;\n }\n .top-axis text,\n .bottom-axis text {\n font-size: 12px;\n }\n .grid line {\n stroke: #e0e0e0;\n }\n .grid path {\n stroke-width: 0;\n }\n .no-select {\n user-select: none;\n }\n .selected {\n stroke-width: 2px;\n stroke: var(--ox-gantt-selected-color, blue);\n }\n `\n ]\n\n @property({ type: String, attribute: 'from-date' }) fromDate: string = new Date(new Date().getFullYear(), 0, 1)\n .toISOString()\n .split('T')[0]\n @property({ type: String, attribute: 'to-date' }) toDate: string = new Date(new Date().getFullYear(), 11, 31)\n .toISOString()\n .split('T')[0]\n @property({ type: String, attribute: 'axis-scale' }) axisScale: TimeScale = 'week-day'\n @property({ type: Boolean, attribute: 'extend-grid-lines' }) extendGridLines: boolean = false\n @property({ type: Array }) tasks: Task[] = []\n @property({ type: String, attribute: 'selected-task-id' }) selectedTaskId?: string\n @property({ type: String }) locale: string = 'en-US'\n\n @query('svg[header]') svgHeader!: SVGElement\n @query('svg[body]') svgBody!: SVGElement\n @query('[chart-container]') container!: HTMLDivElement\n @query('ox-task-tooltip') tooltip!: OxTaskTooltip\n\n private ganttChartController: GanttChartController\n\n constructor() {\n super()\n this.ganttChartController = new GanttChartController(this, this.fromDate, this.toDate, this.axisScale)\n }\n\n protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n this.initHeaderGestureHandlers()\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('fromDate') || changedProperties.has('toDate')) {\n this.ganttChartController.updateRange(this.fromDate, this.toDate)\n }\n\n if (changedProperties.has('tasks')) {\n this.ganttChartController.setTasks(this.flattenTasks(this.tasks))\n this.svgBody.style.height = Math.max(this.tasks.length * 30, 2000) + 'px'\n }\n\n if (changedProperties.has('locale')) {\n this.updateLocale(this.locale)\n }\n\n if (changedProperties.has('selectedTaskId')) {\n this.ganttChartController.selectedTaskId = this.selectedTaskId\n }\n\n if (changedProperties.has('extendGridLines')) {\n this.ganttChartController.extendGridLines = this.extendGridLines\n }\n\n if (changedProperties.has('axisScale')) {\n this.ganttChartController.level = this.axisScale\n this.ganttChartController.updateTimeScale()\n }\n\n this.ganttChartController.drawAxes(this.svgHeader)\n this.ganttChartController.drawBody(this.svgBody, this.tooltip)\n }\n\n render() {\n return html`\n <div\n chart-container\n @wheel=${(e: WheelEvent) => this.ganttChartController.handleWheelForBody(e, this.container)}\n @touchstart=${(e: TouchEvent) => this.ganttChartController.handleTouchStartForBody(e, this.container)}\n @touchmove=${(e: TouchEvent) => this.ganttChartController.handleTouchMoveForBody(e, this.container)}\n >\n <svg\n header\n @date-range-selected=${(e: CustomEvent) => this.handleDateRangeSelected(e)}\n @wheel=${this.handleWheelForHeader.bind(this)}\n ></svg>\n <svg body></svg>\n <ox-task-tooltip></ox-task-tooltip>\n </div>\n `\n }\n\n flattenTasks(tasks: Task[], level: number = 0): Task[] {\n return tasks.flatMap(task => [{ ...task, level }, ...this.flattenTasks(task.children || [], level + 1)])\n }\n\n setVerticalOffset(offset: number) {\n this.container.scrollTop = offset\n }\n\n getVerticalOffset(): number {\n return this.container.scrollTop\n }\n\n setHorizontalOffset(offset: number) {\n this.container.scrollLeft = offset\n }\n\n getHorizontalOffset(): number {\n return this.container.scrollLeft\n }\n\n handleWheelForHeader(event: WheelEvent) {\n event.preventDefault()\n event.stopPropagation()\n\n if (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey) {\n this.container.scrollBy({\n left: event.shiftKey ? event.deltaX : event.deltaY\n })\n } else {\n const zoomFactor = event.deltaY < 0 ? 1.1 : 0.9\n this.ganttChartController.baseWidth *= zoomFactor\n\n if (this.ganttChartController.baseWidth > 40) {\n if (this.ganttChartController.level == 'week-day') {\n this.ganttChartController.baseWidth = 40\n } else {\n this.ganttChartController.level = levelDown(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 30\n }\n } else if (this.ganttChartController.baseWidth < 30) {\n if (this.ganttChartController.level == 'year-quarter') {\n this.ganttChartController.baseWidth = 30\n }\n }\n if (this.ganttChartController.baseWidth < 20) {\n this.ganttChartController.level = levelUp(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 30\n }\n\n this.ganttChartController.updateTimeScale()\n this.requestUpdate()\n\n // Dispatch custom event to sync with ox-resource-chart\n const customEvent = new CustomEvent('timescale-changed', {\n detail: {\n baseWidth: this.ganttChartController.baseWidth,\n level: this.ganttChartController.level\n },\n bubbles: true,\n composed: true\n })\n this.dispatchEvent(customEvent)\n }\n }\n\n handleDateRangeSelected(event: CustomEvent) {\n const detail = event.detail\n this.dispatchEvent(new CustomEvent('date-range-selected', { detail }))\n }\n\n updateLocale(locale: string) {\n const localeDefinition = (locales as any)[locale || 'en-US']\n if (localeDefinition) {\n d3.timeFormatDefaultLocale(localeDefinition)\n this.ganttChartController.updateTimeScale()\n }\n }\n\n initHeaderGestureHandlers() {\n const header = d3.select(this.svgHeader)\n\n let isDragging = false\n let startX: number | null = null\n let lastTouchDistance: number | null = null\n\n const handleTouchStart = (event: TouchEvent) => {\n event.preventDefault()\n\n if (event.touches.length === 2) {\n lastTouchDistance = getTouchDistance(event.touches)\n } else {\n isDragging = true\n const touch = event.touches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n startX = touch.clientX - containerOffsetX\n }\n }\n\n const handleTouchMove = (event: TouchEvent) => {\n event.preventDefault()\n\n if (event.touches.length === 2 && lastTouchDistance !== null) {\n const currentDistance = getTouchDistance(event.touches)\n const zoomFactor = currentDistance / lastTouchDistance\n this.ganttChartController.baseWidth *= zoomFactor\n\n if (this.ganttChartController.baseWidth > 60) {\n if (this.ganttChartController.level == 'year-quarter') {\n this.ganttChartController.baseWidth = 60\n } else {\n this.ganttChartController.level = levelUp(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 30\n }\n } else if (this.ganttChartController.baseWidth < 30) {\n if (this.ganttChartController.level == 'week-day') {\n this.ganttChartController.baseWidth = 30\n } else {\n this.ganttChartController.level = levelDown(this.ganttChartController.level)\n this.ganttChartController.baseWidth = 60\n }\n }\n\n lastTouchDistance = currentDistance\n this.ganttChartController.updateTimeScale()\n this.requestUpdate()\n\n // Dispatch custom event to sync with ox-resource-chart\n const customEvent = new CustomEvent('timescale-changed', {\n detail: {\n baseWidth: this.ganttChartController.baseWidth,\n level: this.ganttChartController.level\n },\n bubbles: true,\n composed: true\n })\n this.dispatchEvent(customEvent)\n } else if (isDragging && startX !== null) {\n const touch = event.touches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const currentX = touch.clientX - containerOffsetX\n this.highlightSelection(startX, currentX)\n }\n }\n\n const handleTouchEnd = (event: TouchEvent) => {\n event.preventDefault()\n\n if (event.touches.length < 2) {\n lastTouchDistance = null\n }\n\n if (!isDragging || startX === null) {\n const touch = event.changedTouches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const clickX = touch.clientX - containerOffsetX\n this.finalizeSelection(clickX, clickX)\n return\n }\n\n const touch = event.changedTouches[0]\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const endX = touch.clientX - containerOffsetX\n this.finalizeSelection(startX, endX)\n\n isDragging = false\n startX = null\n }\n\n const getTouchDistance = (touches: TouchList): number => {\n const dx = touches[0].clientX - touches[1].clientX\n const dy = touches[0].clientY - touches[1].clientY\n return Math.sqrt(dx * dx + dy * dy)\n }\n\n const handleMouseDown = (event: MouseEvent) => {\n isDragging = true\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n startX = event.clientX - containerOffsetX\n }\n\n const handleMouseMove = (event: MouseEvent) => {\n if (!isDragging || startX === null) return\n\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const currentX = event.clientX - containerOffsetX\n this.highlightSelection(startX, currentX)\n }\n\n const handleMouseUp = (event: MouseEvent) => {\n if (!isDragging || startX === null) {\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const clickX = event.clientX - containerOffsetX\n this.finalizeSelection(clickX, clickX)\n return\n }\n\n const containerOffsetX = header.node()!.getBoundingClientRect().left\n const endX = event.clientX - containerOffsetX\n this.finalizeSelection(startX, endX)\n\n isDragging = false\n startX = null\n }\n\n header.on('mousedown', handleMouseDown)\n header.on('mousemove', handleMouseMove)\n header.on('mouseup', handleMouseUp)\n header.on('touchstart', handleTouchStart)\n header.on('touchmove', handleTouchMove)\n header.on('touchend', handleTouchEnd)\n }\n\n highlightSelection(startX: number, endX: number) {\n const header = d3.select(this.svgHeader)\n const body = d3.select(this.svgBody)\n\n let startDate = this.ganttChartController.timeScale.invert(startX)\n let endDate = this.ganttChartController.timeScale.invert(endX)\n\n let start, end\n\n if (this.ganttChartController.level === 'week-day') {\n start = d3.timeDay.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeDay.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'quarter-week') {\n start = d3.timeWeek.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeWeek.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-month') {\n start = d3.timeMonth.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-quarter') {\n start = d3.timeMonth.every(3)!.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.every(3)!.ceil(d3.max([startDate, endDate])!), -1)\n }\n\n header.selectAll('.selection-rect').remove()\n body.selectAll('.selection-rect').remove()\n\n header\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 20)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', 20)\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n\n body\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 0)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', '100%')\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n }\n\n finalizeSelection(startX: number, endX: number) {\n const header = d3.select(this.svgHeader)\n const body = d3.select(this.svgBody)\n\n let startDate = this.ganttChartController.timeScale.invert(startX)\n let endDate = this.ganttChartController.timeScale.invert(endX)\n\n let start, end\n\n if (this.ganttChartController.level === 'week-day') {\n start = d3.timeDay.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeDay.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'quarter-week') {\n start = d3.timeWeek.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeWeek.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-month') {\n start = d3.timeMonth.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.ceil(d3.max([startDate, endDate])!), -1)\n } else if (this.ganttChartController.level === 'year-quarter') {\n start = d3.timeMonth.every(3)!.floor(d3.min([startDate, endDate])!)\n end = d3.timeDay.offset(d3.timeMonth.every(3)!.ceil(d3.max([startDate, endDate])!), -1)\n }\n\n header.selectAll('.selection-rect').remove()\n body.selectAll('.selection-rect').remove()\n\n header\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 20)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', 20)\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n\n body\n .append('rect')\n .attr('class', 'selection-rect')\n .attr('x', this.ganttChartController.timeScale(start!))\n .attr('y', 0)\n .attr(\n 'width',\n this.ganttChartController.timeScale(end!) -\n this.ganttChartController.timeScale(start!) +\n this.ganttChartController.baseWidth / this.ganttChartController.getScale()\n )\n .attr('height', '100%')\n .attr('fill', 'var(--ox-gantt-selection-color, var(--md-sys-color-secondary))')\n .attr('opacity', '.2')\n\n const formatDate = d3.timeFormat('%Y-%m-%d')\n const customEvent = new CustomEvent('date-range-selected', {\n detail: { start: formatDate(start!), end: formatDate(end!) }\n })\n\n header.node()?.dispatchEvent(customEvent)\n }\n}\n"]}
|
package/dist/src/ox-gantt.d.ts
CHANGED
|
@@ -17,10 +17,8 @@ export declare class OxGantt extends LitElement {
|
|
|
17
17
|
selectedTaskId?: string;
|
|
18
18
|
taskContainer: HTMLDivElement;
|
|
19
19
|
taskTableContainer: HTMLDivElement;
|
|
20
|
-
taskChartContainer: HTMLDivElement;
|
|
21
20
|
resourceContainer: HTMLDivElement;
|
|
22
21
|
resourceTableContainer: HTMLDivElement;
|
|
23
|
-
resourceChartContainer: HTMLDivElement;
|
|
24
22
|
taskTable: HTMLTableElement;
|
|
25
23
|
ganttChart: OxGanttChart;
|
|
26
24
|
resourceChart: OxResourceChart;
|
|
@@ -39,8 +37,7 @@ export declare class OxGantt extends LitElement {
|
|
|
39
37
|
updated(changedProperties: PropertyValues<this>): void;
|
|
40
38
|
aggregateResources(tasks: Task[]): Resource[];
|
|
41
39
|
syncScroll(e: Event): void;
|
|
42
|
-
|
|
43
|
-
syncTaskChartScroll(e: CustomEvent): void;
|
|
40
|
+
syncTimeScale(e: CustomEvent): void;
|
|
44
41
|
resizeHorizontalStart(e: CustomEvent): void;
|
|
45
42
|
resizeHorizontalDrag(e: CustomEvent): void;
|
|
46
43
|
resizeHorizontalEnd(e: CustomEvent): void;
|
package/dist/src/ox-gantt.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement, html, css, nothing } from 'lit';
|
|
3
|
+
import * as d3 from 'd3';
|
|
3
4
|
import i18next from 'i18next';
|
|
4
5
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
5
6
|
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles';
|
|
@@ -163,6 +164,7 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
163
164
|
th {
|
|
164
165
|
height: 40px;
|
|
165
166
|
box-sizing: border-box;
|
|
167
|
+
text-align: center;
|
|
166
168
|
}
|
|
167
169
|
|
|
168
170
|
td {
|
|
@@ -188,10 +190,7 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
188
190
|
></ox-gantt-resize-splitter>
|
|
189
191
|
<ox-gantt-chart
|
|
190
192
|
class="task-chart-container"
|
|
191
|
-
@scroll=${
|
|
192
|
-
this.syncScroll(e);
|
|
193
|
-
this.syncResourceChartScroll(e);
|
|
194
|
-
}}
|
|
193
|
+
@scroll=${this.syncScroll}
|
|
195
194
|
.fromDate=${this.fromDate}
|
|
196
195
|
.toDate=${this.toDate}
|
|
197
196
|
.tasks=${this.tasks}
|
|
@@ -199,6 +198,7 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
199
198
|
.axisScale=${this.timeScale}
|
|
200
199
|
?extend-grid-lines=${this.extendGridLines}
|
|
201
200
|
@task-clicked=${this.handleTaskClicked}
|
|
201
|
+
@timescale-changed=${(e) => this.syncTimeScale(e)}
|
|
202
202
|
></ox-gantt-chart>
|
|
203
203
|
</div>
|
|
204
204
|
<ox-gantt-resize-splitter
|
|
@@ -208,12 +208,12 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
208
208
|
@splitter-dragend=${(e) => this.resizeVerticalEnd(e)}
|
|
209
209
|
></ox-gantt-resize-splitter>
|
|
210
210
|
<div class="resource-container">
|
|
211
|
-
<div class="resource-table-container">
|
|
211
|
+
<div class="resource-table-container" @scroll=${this.syncScroll}>
|
|
212
212
|
<table>
|
|
213
213
|
<thead>
|
|
214
214
|
<tr>
|
|
215
|
-
<th style="width: 100px"
|
|
216
|
-
<th
|
|
215
|
+
<th style="width: 100px">${i18next.t('label.gantt-resource-type')}</th>
|
|
216
|
+
<th>${i18next.t('label.gantt-resource-allocated')}</th>
|
|
217
217
|
</tr>
|
|
218
218
|
</thead>
|
|
219
219
|
<tbody>
|
|
@@ -231,9 +231,10 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
231
231
|
class="resource-chart-container"
|
|
232
232
|
.fromDate=${this.fromDate}
|
|
233
233
|
.toDate=${this.toDate}
|
|
234
|
+
.tasks=${this.tasks}
|
|
234
235
|
.resources=${this.resources}
|
|
235
236
|
.axisScale=${this.timeScale}
|
|
236
|
-
@scroll=${this.
|
|
237
|
+
@scroll=${this.syncScroll}
|
|
237
238
|
></ox-resource-chart>
|
|
238
239
|
</div>
|
|
239
240
|
</div>
|
|
@@ -246,7 +247,7 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
246
247
|
// Sort columns by the configured order
|
|
247
248
|
const sortedColumns = [...this.columnConfig].sort((a, b) => a.order - b.order);
|
|
248
249
|
return html `
|
|
249
|
-
<table>
|
|
250
|
+
<table class="task-table">
|
|
250
251
|
<thead>
|
|
251
252
|
<tr>
|
|
252
253
|
${sortedColumns.map(col => col.visible ? html `<th style="width: ${col.width}px">${col.label}</th>` : nothing)}
|
|
@@ -268,7 +269,7 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
268
269
|
return html `
|
|
269
270
|
<tr class=${this.selectedTaskId === task.id ? 'selected' : ''} @click=${() => this.selectTask(task.id)}>
|
|
270
271
|
${this.columnConfig.map(col => col.visible
|
|
271
|
-
? html `<td class="task-row" style="padding-left: ${col.name == '
|
|
272
|
+
? html `<td class="task-row" style="padding-left: ${col.name == 'title' ? level * 8 + 4 : 4}px">
|
|
272
273
|
${this.getTaskFieldValue(task, col.name)}
|
|
273
274
|
</td>`
|
|
274
275
|
: null)}
|
|
@@ -329,11 +330,16 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
329
330
|
const traverseTasks = (tasks) => {
|
|
330
331
|
tasks.forEach(task => {
|
|
331
332
|
if (task.resources) {
|
|
333
|
+
const startDate = new Date(task.startDate);
|
|
334
|
+
const endDate = new Date(task.endDate);
|
|
335
|
+
const durationDays = d3.timeDay.count(startDate, d3.timeDay.offset(endDate, 1));
|
|
332
336
|
task.resources.forEach(resource => {
|
|
337
|
+
const totalAllocation = resource.allocated * durationDays;
|
|
333
338
|
if (!resourceMap[resource.type]) {
|
|
334
339
|
resourceMap[resource.type] = 0;
|
|
335
340
|
}
|
|
336
|
-
resourceMap[resource.type] +=
|
|
341
|
+
resourceMap[resource.type] += totalAllocation;
|
|
342
|
+
console.log(resource.type, resource.allocated, durationDays, totalAllocation);
|
|
337
343
|
});
|
|
338
344
|
}
|
|
339
345
|
if (task.children) {
|
|
@@ -350,27 +356,37 @@ let OxGantt = class OxGantt extends LitElement {
|
|
|
350
356
|
syncScroll(e) {
|
|
351
357
|
const target = e.target;
|
|
352
358
|
if (target === this.taskTableContainer) {
|
|
353
|
-
// Sync chart scroll with table scroll
|
|
354
359
|
const newScrollTop = this.taskTableContainer.scrollTop;
|
|
355
360
|
this.ganttChart.setVerticalOffset(newScrollTop);
|
|
356
|
-
// Ensure chart scroll matches table scroll
|
|
357
361
|
if (this.ganttChart.getVerticalOffset() !== newScrollTop) {
|
|
358
362
|
this.ganttChart.setVerticalOffset(newScrollTop);
|
|
359
363
|
}
|
|
360
364
|
}
|
|
361
365
|
else if (target === this.ganttChart) {
|
|
362
|
-
// Sync table scroll with chart scroll
|
|
363
366
|
const newScrollTop = this.ganttChart.getVerticalOffset();
|
|
364
367
|
this.taskTableContainer.scrollTop = newScrollTop;
|
|
365
|
-
// Ensure table scroll matches chart scroll
|
|
366
368
|
this.ganttChart.setVerticalOffset(this.taskTableContainer.scrollTop);
|
|
369
|
+
const newScrollLeft = this.ganttChart.getHorizontalOffset();
|
|
370
|
+
this.resourceChart.setHorizontalOffset(newScrollLeft);
|
|
371
|
+
}
|
|
372
|
+
else if (target === this.resourceChart) {
|
|
373
|
+
const newScrollTop = this.ganttChart.getVerticalOffset();
|
|
374
|
+
this.resourceTableContainer.scrollTop = newScrollTop;
|
|
375
|
+
this.resourceChart.setVerticalOffset(this.taskTableContainer.scrollTop);
|
|
376
|
+
const newScrollLeft = this.resourceChart.getHorizontalOffset();
|
|
377
|
+
this.ganttChart.setHorizontalOffset(newScrollLeft);
|
|
378
|
+
}
|
|
379
|
+
else if (target === this.resourceTableContainer) {
|
|
380
|
+
const newScrollTop = this.taskTableContainer.scrollTop;
|
|
381
|
+
this.resourceChart.setVerticalOffset(newScrollTop);
|
|
382
|
+
if (this.resourceChart.getVerticalOffset() !== newScrollTop) {
|
|
383
|
+
this.resourceChart.setVerticalOffset(newScrollTop);
|
|
384
|
+
}
|
|
367
385
|
}
|
|
368
386
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
syncTaskChartScroll(e) {
|
|
373
|
-
this.ganttChart.renderRoot.querySelector('div[chart-container]').scrollLeft = e.detail.offset;
|
|
387
|
+
syncTimeScale(e) {
|
|
388
|
+
const detail = e.detail;
|
|
389
|
+
this.resourceChart.syncTimeScale(detail);
|
|
374
390
|
}
|
|
375
391
|
resizeHorizontalStart(e) {
|
|
376
392
|
this._startWidth = e.target?.previousElementSibling?.offsetWidth;
|
|
@@ -430,9 +446,6 @@ __decorate([
|
|
|
430
446
|
__decorate([
|
|
431
447
|
query('.task-table-container')
|
|
432
448
|
], OxGantt.prototype, "taskTableContainer", void 0);
|
|
433
|
-
__decorate([
|
|
434
|
-
query('.task-chart-container')
|
|
435
|
-
], OxGantt.prototype, "taskChartContainer", void 0);
|
|
436
449
|
__decorate([
|
|
437
450
|
query('.resource-container')
|
|
438
451
|
], OxGantt.prototype, "resourceContainer", void 0);
|
|
@@ -440,10 +453,7 @@ __decorate([
|
|
|
440
453
|
query('.resource-table-container')
|
|
441
454
|
], OxGantt.prototype, "resourceTableContainer", void 0);
|
|
442
455
|
__decorate([
|
|
443
|
-
query('.
|
|
444
|
-
], OxGantt.prototype, "resourceChartContainer", void 0);
|
|
445
|
-
__decorate([
|
|
446
|
-
query('table')
|
|
456
|
+
query('.task-table')
|
|
447
457
|
], OxGantt.prototype, "taskTable", void 0);
|
|
448
458
|
__decorate([
|
|
449
459
|
query('ox-gantt-chart')
|
package/dist/src/ox-gantt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-gantt.js","sourceRoot":"","sources":["../../src/ox-gantt.ts"],"names":[],"mappings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,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;uCACsC;AAC1B;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;gDAAiC;AACxC;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;0CAAkC;AAC3D;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CA+CzB;AAEQ;IAAR,KAAK,EAAE;+CAAwB;AAEN;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8CAA+B;AACxB;IAA/B,KAAK,CAAC,uBAAuB,CAAC;mDAAoC;AACnC;IAA/B,KAAK,CAAC,uBAAuB,CAAC;mDAAoC;AACrC;IAA7B,KAAK,CAAC,qBAAqB,CAAC;kDAAmC;AAC5B;IAAnC,KAAK,CAAC,2BAA2B,CAAC;uDAAwC;AACvC;IAAnC,KAAK,CAAC,2BAA2B,CAAC;uDAAwC;AAC3D;IAAf,KAAK,CAAC,OAAO,CAAC;0CAA6B;AACnB;IAAxB,KAAK,CAAC,gBAAgB,CAAC;2CAA0B;AACtB;IAA3B,KAAK,CAAC,mBAAmB,CAAC;8CAAgC;AAhLhD,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAkbnB","sourcesContent":["import { LitElement, html, css, PropertyValues, PropertyValueMap, nothing, TemplateResult } from 'lit'\nimport i18next from 'i18next'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport './ox-gantt-chart.js'\nimport './ox-resource-chart.js'\nimport './ox-gantt-resize-splitter.js'\nimport { OxGanttChart } from './ox-gantt-chart.js'\nimport { OxResourceChart } from './ox-resource-chart.js'\nimport { ColumnConfig, Task, TimeScale, Resource } from './types.js'\n\n@customElement('ox-gantt')\nexport class OxGantt extends LitElement {\n static styles = [\n MDTypeScaleStyles,\n ScrollbarStyles,\n css`\n :host {\n display: block;\n font-family: Arial, sans-serif;\n text-wrap: nowrap;\n position: relative;\n }\n\n .container {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n\n .resource-container {\n height: 300px;\n\n display: flex;\n overflow: hidden;\n box-sizing: border-box;\n }\n\n .resource-table-container {\n padding: 0;\n overflow: auto;\n overflow-y: overlay;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .resource-chart-container {\n flex: 1;\n padding: 0;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .task-container {\n flex: 1;\n\n display: flex;\n overflow: hidden;\n box-sizing: border-box;\n }\n\n .task-table-container {\n padding: 0;\n overflow: auto;\n overflow-y: overlay;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .task-chart-container {\n flex: 1;\n padding: 0;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n table {\n width: 100%;\n border-collapse: collapse;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n margin: -1px;\n margin-right: 0;\n }\n\n thead th {\n position: sticky;\n top: -1px;\n z-index: 1;\n background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));\n border-color: var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));\n color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));\n text-transform: capitalize;\n }\n\n th,\n td {\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n padding: 4px;\n text-align: left;\n }\n\n th {\n height: 40px;\n box-sizing: border-box;\n }\n\n td {\n height: 30px;\n box-sizing: border-box;\n }\n\n tr.selected {\n background-color: var(--ox-gantt-selected-background-color, var(--md-sys-color-surface-variant));\n }\n `\n ]\n\n @property({ type: Array }) tasks: Task[] = []\n @property({ type: Array }) resources: Resource[] = []\n @property({ type: String, attribute: 'from-date' })\n fromDate: string = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0] /* beginning of this year */\n @property({ type: String, attribute: 'to-date' })\n toDate: string = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */\n @property({ type: Boolean, attribute: 'extend-grid-lines' }) extendGridLines: boolean = false\n @property({ type: String, attribute: 'time-scale' }) timeScale: TimeScale = 'week-day'\n @property({ type: Array }) columnConfig: ColumnConfig[] = [\n { name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: 50, order: 1 },\n {\n name: 'section',\n label: i18next.t('label.gantt-task-section') || 'section',\n visible: true,\n width: 100,\n order: 2\n },\n { name: 'title', label: i18next.t('label.gantt-task-title') || 'title', visible: true, width: 150, order: 3 },\n { name: 'type', label: i18next.t('label.gantt-task-type') || 'type', visible: true, width: 100, order: 4 },\n {\n name: 'startDate',\n label: i18next.t('label.gantt-task-start-date') || 'start date',\n visible: true,\n width: 100,\n order: 5\n },\n {\n name: 'endDate',\n label: i18next.t('label.gantt-task-end-date') || 'end date',\n visible: true,\n width: 100,\n order: 6\n },\n { name: 'tags', label: i18next.t('label.gantt-task-tags') || 'tags', visible: true, width: 100, order: 7 },\n {\n name: 'progress',\n label: i18next.t('label.gantt-task-progress') || 'progress',\n visible: true,\n width: 100,\n order: 8\n },\n {\n name: 'dependsOn',\n label: i18next.t('label.gantt-task-previous') || 'previous',\n visible: true,\n width: 100,\n order: 9\n },\n {\n name: 'resources',\n label: i18next.t('label.gantt-task-resources') || 'resources',\n visible: true,\n width: 100,\n order: 10\n }\n ]\n\n @state() selectedTaskId?: string\n\n @query('.task-container') taskContainer!: HTMLDivElement\n @query('.task-table-container') taskTableContainer!: HTMLDivElement\n @query('.task-chart-container') taskChartContainer!: HTMLDivElement\n @query('.resource-container') resourceContainer!: HTMLDivElement\n @query('.resource-table-container') resourceTableContainer!: HTMLDivElement\n @query('.resource-chart-container') resourceChartContainer!: HTMLDivElement\n @query('table') taskTable!: HTMLTableElement\n @query('ox-gantt-chart') ganttChart!: OxGanttChart\n @query('ox-resource-chart') resourceChart!: OxResourceChart\n\n private _startWidth: number = 0\n private _startHeight: number = 0\n private _isDragging: boolean = false\n\n render() {\n return html`\n <div class=\"container md-typescale-body-medium\">\n <div class=\"task-container\">\n <div class=\"task-table-container\" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>\n <ox-gantt-resize-splitter\n vertical\n @splitter-dragstart=${(e: CustomEvent) => this.resizeHorizontalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeHorizontalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeHorizontalEnd(e)}\n ></ox-gantt-resize-splitter>\n <ox-gantt-chart\n class=\"task-chart-container\"\n @scroll=${(e: CustomEvent) => {\n this.syncScroll(e)\n this.syncResourceChartScroll(e)\n }}\n .fromDate=${this.fromDate}\n .toDate=${this.toDate}\n .tasks=${this.tasks}\n .selectedTaskId=${this.selectedTaskId}\n .axisScale=${this.timeScale}\n ?extend-grid-lines=${this.extendGridLines}\n @task-clicked=${this.handleTaskClicked}\n ></ox-gantt-chart>\n </div>\n <ox-gantt-resize-splitter\n horizontal\n @splitter-dragstart=${(e: CustomEvent) => this.resizeVerticalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeVerticalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeVerticalEnd(e)}\n ></ox-gantt-resize-splitter>\n <div class=\"resource-container\">\n <div class=\"resource-table-container\">\n <table>\n <thead>\n <tr>\n <th style=\"width: 100px\">type</th>\n <th>allocated</th>\n </tr>\n </thead>\n <tbody>\n ${this.resources.map(resource => this.renderResourceRow(resource))}\n </tbody>\n </table>\n </div>\n <ox-gantt-resize-splitter\n vertical\n @splitter-dragstart=${(e: CustomEvent) => this.resizeHorizontalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeHorizontalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeHorizontalEnd(e)}\n ></ox-gantt-resize-splitter>\n <ox-resource-chart\n class=\"resource-chart-container\"\n .fromDate=${this.fromDate}\n .toDate=${this.toDate}\n .resources=${this.resources}\n .axisScale=${this.timeScale}\n @scroll=${this.syncTaskChartScroll}\n ></ox-resource-chart>\n </div>\n </div>\n `\n }\n\n renderTaskTable() {\n if (!this.columnConfig) {\n return\n }\n\n // Sort columns by the configured order\n const sortedColumns = [...this.columnConfig].sort((a, b) => a.order - b.order)\n\n return html`\n <table>\n <thead>\n <tr>\n ${sortedColumns.map(col =>\n col.visible ? html`<th style=\"width: ${col.width}px\">${col.label}</th>` : nothing\n )}\n </tr>\n </thead>\n <tbody>\n ${this.renderTaskRows(this.tasks)}\n </tbody>\n </table>\n `\n }\n\n renderTaskRows(tasks: Task[], level: number = 0): TemplateResult[] {\n return tasks.flatMap(task => [\n this.renderTaskRow(task, level),\n ...this.renderTaskRows(task.children || [], level + 1)\n ])\n }\n\n renderTaskRow(task: Task, level: number) {\n return html`\n <tr class=${this.selectedTaskId === task.id ? 'selected' : ''} @click=${() => this.selectTask(task.id)}>\n ${this.columnConfig.map(col =>\n col.visible\n ? html`<td class=\"task-row\" style=\"padding-left: ${col.name == 'id' ? level * 20 : 0}px\">\n ${this.getTaskFieldValue(task, col.name)}\n </td>`\n : null\n )}\n </tr>\n `\n }\n\n renderResourceRow(resource: Resource) {\n return html`\n <tr>\n <td>${resource.type}</td>\n <td>${resource.allocated}</td>\n </tr>\n `\n }\n\n getTaskFieldValue(task: Task, field: string) {\n switch (field) {\n case 'id':\n return task.id\n case 'section':\n return task.section?.name || ''\n case 'title':\n return task.title\n case 'type':\n return task.type\n case 'startDate':\n return new Date(task.startDate).toISOString().split('T')[0]\n case 'endDate':\n return new Date(task.endDate).toISOString().split('T')[0]\n case 'tags':\n return task.tags?.join(', ') || ''\n case 'progress':\n return task.progress || ''\n case 'dependsOn':\n return task.dependsOn || ''\n case 'resources':\n return task.resources?.map(res => `${res.type}: ${res.allocated}`).join(', ') || ''\n default:\n return ''\n }\n }\n\n selectTask(taskId: string) {\n this.selectedTaskId = taskId\n }\n\n handleTaskClicked(event: CustomEvent) {\n this.selectedTaskId = event.detail.taskId\n }\n\n protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n this.taskTableContainer.style.width = '254px'\n this.resourceTableContainer.style.width = '254px'\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('tasks')) {\n this.resources = this.aggregateResources(this.tasks)\n }\n }\n\n aggregateResources(tasks: Task[]): Resource[] {\n const resourceMap: { [key: string]: number } = {}\n\n const traverseTasks = (tasks: Task[]) => {\n tasks.forEach(task => {\n if (task.resources) {\n task.resources.forEach(resource => {\n if (!resourceMap[resource.type]) {\n resourceMap[resource.type] = 0\n }\n resourceMap[resource.type] += resource.allocated\n })\n }\n if (task.children) {\n traverseTasks(task.children)\n }\n })\n }\n\n traverseTasks(tasks)\n\n return Object.keys(resourceMap).map(type => ({\n type,\n allocated: resourceMap[type]\n }))\n }\n\n syncScroll(e: Event) {\n const target = e.target as HTMLElement\n if (target === this.taskTableContainer) {\n // Sync chart scroll with table scroll\n const newScrollTop = this.taskTableContainer.scrollTop\n this.ganttChart.setVerticalOffset(newScrollTop)\n\n // Ensure chart scroll matches table scroll\n if (this.ganttChart.getVerticalOffset() !== newScrollTop) {\n this.ganttChart.setVerticalOffset(newScrollTop)\n }\n } else if (target === this.ganttChart) {\n // Sync table scroll with chart scroll\n const newScrollTop = this.ganttChart.getVerticalOffset()\n this.taskTableContainer.scrollTop = newScrollTop\n\n // Ensure table scroll matches chart scroll\n this.ganttChart.setVerticalOffset(this.taskTableContainer.scrollTop)\n }\n }\n\n syncResourceChartScroll(e: CustomEvent) {\n this.resourceChart.renderRoot!.querySelector('div[chart-container]')!.scrollLeft = e.detail.offset\n }\n\n syncTaskChartScroll(e: CustomEvent) {\n this.ganttChart.renderRoot!.querySelector('div[chart-container]')!.scrollLeft = e.detail.offset\n }\n\n resizeHorizontalStart(e: CustomEvent) {\n this._startWidth = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement)?.offsetWidth\n this._isDragging = true\n }\n\n resizeHorizontalDrag(e: CustomEvent) {\n if (!this._isDragging) return\n const delta = e.detail\n this.taskTableContainer.style.width = `${this._startWidth + delta.x}px`\n this.resourceTableContainer.style.width = `${this._startWidth + delta.x}px`\n }\n\n resizeHorizontalEnd(e: CustomEvent) {\n this._isDragging = false\n }\n\n resizeVerticalStart(e: CustomEvent) {\n this._startHeight = ((e.target as HTMLElement)?.nextElementSibling as HTMLElement)?.offsetHeight\n this._isDragging = true\n }\n\n resizeVerticalDrag(e: CustomEvent) {\n if (!this._isDragging) return\n const delta = e.detail\n\n this.resourceContainer.style.height = `${this._startHeight - delta.y}px`\n }\n\n resizeVerticalEnd(e: CustomEvent) {\n this._isDragging = false\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ox-gantt.js","sourceRoot":"","sources":["../../src/ox-gantt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAoC,OAAO,EAAkB,MAAM,KAAK,CAAA;AACtG,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,qBAAqB,CAAA;AAC5B,OAAO,wBAAwB,CAAA;AAC/B,OAAO,+BAA+B,CAAA;AAM/B,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QA8GsB,UAAK,GAAW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AAnC,KAAK,CAAC,2BAA2B,CAAC;uDAAwC;AACrD;IAArB,KAAK,CAAC,aAAa,CAAC;0CAA6B;AACzB;IAAxB,KAAK,CAAC,gBAAgB,CAAC;2CAA0B;AACtB;IAA3B,KAAK,CAAC,mBAAmB,CAAC;8CAAgC;AA/KhD,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAicnB","sourcesContent":["import { LitElement, html, css, PropertyValues, PropertyValueMap, nothing, TemplateResult } from 'lit'\nimport * as d3 from 'd3'\nimport i18next from 'i18next'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport './ox-gantt-chart.js'\nimport './ox-resource-chart.js'\nimport './ox-gantt-resize-splitter.js'\nimport { OxGanttChart } from './ox-gantt-chart.js'\nimport { OxResourceChart } from './ox-resource-chart.js'\nimport { ColumnConfig, Task, TimeScale, Resource } from './types.js'\n\n@customElement('ox-gantt')\nexport class OxGantt extends LitElement {\n static styles = [\n MDTypeScaleStyles,\n ScrollbarStyles,\n css`\n :host {\n display: block;\n font-family: Arial, sans-serif;\n text-wrap: nowrap;\n position: relative;\n }\n\n .container {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n\n .resource-container {\n height: 300px;\n\n display: flex;\n overflow: hidden;\n box-sizing: border-box;\n }\n\n .resource-table-container {\n padding: 0;\n overflow: auto;\n overflow-y: overlay;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .resource-chart-container {\n flex: 1;\n padding: 0;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .task-container {\n flex: 1;\n\n display: flex;\n overflow: hidden;\n box-sizing: border-box;\n }\n\n .task-table-container {\n padding: 0;\n overflow: auto;\n overflow-y: overlay;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n .task-chart-container {\n flex: 1;\n padding: 0;\n box-sizing: border-box;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n }\n\n table {\n width: 100%;\n border-collapse: collapse;\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n margin: -1px;\n margin-right: 0;\n }\n\n thead th {\n position: sticky;\n top: -1px;\n z-index: 1;\n background-color: var(--ox-gantt-header-background-color, var(--md-sys-color-secondary-container));\n border-color: var(--ox-gantt-header-border-color, var(--md-sys-color-on-secondary-container));\n color: var(--ox-gantt-header-color, var(--md-sys-color-on-secondary-container));\n text-transform: capitalize;\n }\n\n th,\n td {\n border: 1px solid var(--ox-gantt-border-color, var(--md-sys-color-on-surface));\n padding: 4px;\n text-align: left;\n }\n\n th {\n height: 40px;\n box-sizing: border-box;\n text-align: center;\n }\n\n td {\n height: 30px;\n box-sizing: border-box;\n }\n\n tr.selected {\n background-color: var(--ox-gantt-selected-background-color, var(--md-sys-color-surface-variant));\n }\n `\n ]\n\n @property({ type: Array }) tasks: Task[] = []\n @property({ type: Array }) resources: Resource[] = []\n @property({ type: String, attribute: 'from-date' })\n fromDate: string = new Date(new Date().getFullYear(), 0, 1).toISOString().split('T')[0] /* beginning of this year */\n @property({ type: String, attribute: 'to-date' })\n toDate: string = new Date(new Date().getFullYear(), 11, 31).toISOString().split('T')[0] /* end of this year */\n @property({ type: Boolean, attribute: 'extend-grid-lines' }) extendGridLines: boolean = false\n @property({ type: String, attribute: 'time-scale' }) timeScale: TimeScale = 'week-day'\n @property({ type: Array }) columnConfig: ColumnConfig[] = [\n { name: 'id', label: i18next.t('label.gantt-task-id') || 'ID', visible: true, width: 50, order: 1 },\n {\n name: 'section',\n label: i18next.t('label.gantt-task-section') || 'section',\n visible: true,\n width: 100,\n order: 2\n },\n { name: 'title', label: i18next.t('label.gantt-task-title') || 'title', visible: true, width: 150, order: 3 },\n { name: 'type', label: i18next.t('label.gantt-task-type') || 'type', visible: true, width: 100, order: 4 },\n {\n name: 'startDate',\n label: i18next.t('label.gantt-task-start-date') || 'start date',\n visible: true,\n width: 100,\n order: 5\n },\n {\n name: 'endDate',\n label: i18next.t('label.gantt-task-end-date') || 'end date',\n visible: true,\n width: 100,\n order: 6\n },\n { name: 'tags', label: i18next.t('label.gantt-task-tags') || 'tags', visible: true, width: 100, order: 7 },\n {\n name: 'progress',\n label: i18next.t('label.gantt-task-progress') || 'progress',\n visible: true,\n width: 100,\n order: 8\n },\n {\n name: 'dependsOn',\n label: i18next.t('label.gantt-task-previous') || 'previous',\n visible: true,\n width: 100,\n order: 9\n },\n {\n name: 'resources',\n label: i18next.t('label.gantt-task-resources') || 'resources',\n visible: true,\n width: 100,\n order: 10\n }\n ]\n\n @state() selectedTaskId?: string\n\n @query('.task-container') taskContainer!: HTMLDivElement\n @query('.task-table-container') taskTableContainer!: HTMLDivElement\n @query('.resource-container') resourceContainer!: HTMLDivElement\n @query('.resource-table-container') resourceTableContainer!: HTMLDivElement\n @query('.task-table') taskTable!: HTMLTableElement\n @query('ox-gantt-chart') ganttChart!: OxGanttChart\n @query('ox-resource-chart') resourceChart!: OxResourceChart\n\n private _startWidth: number = 0\n private _startHeight: number = 0\n private _isDragging: boolean = false\n\n render() {\n return html`\n <div class=\"container md-typescale-body-medium\">\n <div class=\"task-container\">\n <div class=\"task-table-container\" @scroll=${this.syncScroll}>${this.renderTaskTable()}</div>\n <ox-gantt-resize-splitter\n vertical\n @splitter-dragstart=${(e: CustomEvent) => this.resizeHorizontalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeHorizontalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeHorizontalEnd(e)}\n ></ox-gantt-resize-splitter>\n <ox-gantt-chart\n class=\"task-chart-container\"\n @scroll=${this.syncScroll}\n .fromDate=${this.fromDate}\n .toDate=${this.toDate}\n .tasks=${this.tasks}\n .selectedTaskId=${this.selectedTaskId}\n .axisScale=${this.timeScale}\n ?extend-grid-lines=${this.extendGridLines}\n @task-clicked=${this.handleTaskClicked}\n @timescale-changed=${(e: CustomEvent) => this.syncTimeScale(e)}\n ></ox-gantt-chart>\n </div>\n <ox-gantt-resize-splitter\n horizontal\n @splitter-dragstart=${(e: CustomEvent) => this.resizeVerticalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeVerticalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeVerticalEnd(e)}\n ></ox-gantt-resize-splitter>\n <div class=\"resource-container\">\n <div class=\"resource-table-container\" @scroll=${this.syncScroll}>\n <table>\n <thead>\n <tr>\n <th style=\"width: 100px\">${i18next.t('label.gantt-resource-type')}</th>\n <th>${i18next.t('label.gantt-resource-allocated')}</th>\n </tr>\n </thead>\n <tbody>\n ${this.resources.map(resource => this.renderResourceRow(resource))}\n </tbody>\n </table>\n </div>\n <ox-gantt-resize-splitter\n vertical\n @splitter-dragstart=${(e: CustomEvent) => this.resizeHorizontalStart(e)}\n @splitter-drag=${(e: CustomEvent) => this.resizeHorizontalDrag(e)}\n @splitter-dragend=${(e: CustomEvent) => this.resizeHorizontalEnd(e)}\n ></ox-gantt-resize-splitter>\n <ox-resource-chart\n class=\"resource-chart-container\"\n .fromDate=${this.fromDate}\n .toDate=${this.toDate}\n .tasks=${this.tasks}\n .resources=${this.resources}\n .axisScale=${this.timeScale}\n @scroll=${this.syncScroll}\n ></ox-resource-chart>\n </div>\n </div>\n `\n }\n\n renderTaskTable() {\n if (!this.columnConfig) {\n return\n }\n\n // Sort columns by the configured order\n const sortedColumns = [...this.columnConfig].sort((a, b) => a.order - b.order)\n\n return html`\n <table class=\"task-table\">\n <thead>\n <tr>\n ${sortedColumns.map(col =>\n col.visible ? html`<th style=\"width: ${col.width}px\">${col.label}</th>` : nothing\n )}\n </tr>\n </thead>\n <tbody>\n ${this.renderTaskRows(this.tasks)}\n </tbody>\n </table>\n `\n }\n\n renderTaskRows(tasks: Task[], level: number = 0): TemplateResult[] {\n return tasks.flatMap(task => [\n this.renderTaskRow(task, level),\n ...this.renderTaskRows(task.children || [], level + 1)\n ])\n }\n\n renderTaskRow(task: Task, level: number) {\n return html`\n <tr class=${this.selectedTaskId === task.id ? 'selected' : ''} @click=${() => this.selectTask(task.id)}>\n ${this.columnConfig.map(col =>\n col.visible\n ? html`<td class=\"task-row\" style=\"padding-left: ${col.name == 'title' ? level * 8 + 4 : 4}px\">\n ${this.getTaskFieldValue(task, col.name)}\n </td>`\n : null\n )}\n </tr>\n `\n }\n\n renderResourceRow(resource: Resource) {\n return html`\n <tr>\n <td>${resource.type}</td>\n <td>${resource.allocated}</td>\n </tr>\n `\n }\n\n getTaskFieldValue(task: Task, field: string) {\n switch (field) {\n case 'id':\n return task.id\n case 'section':\n return task.section?.name || ''\n case 'title':\n return task.title\n case 'type':\n return task.type\n case 'startDate':\n return new Date(task.startDate).toISOString().split('T')[0]\n case 'endDate':\n return new Date(task.endDate).toISOString().split('T')[0]\n case 'tags':\n return task.tags?.join(', ') || ''\n case 'progress':\n return task.progress || ''\n case 'dependsOn':\n return task.dependsOn || ''\n case 'resources':\n return task.resources?.map(res => `${res.type}: ${res.allocated}`).join(', ') || ''\n default:\n return ''\n }\n }\n\n selectTask(taskId: string) {\n this.selectedTaskId = taskId\n }\n\n handleTaskClicked(event: CustomEvent) {\n this.selectedTaskId = event.detail.taskId\n }\n\n protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {\n this.taskTableContainer.style.width = '254px'\n this.resourceTableContainer.style.width = '254px'\n }\n\n updated(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('tasks')) {\n this.resources = this.aggregateResources(this.tasks)\n }\n }\n\n aggregateResources(tasks: Task[]): Resource[] {\n const resourceMap: { [key: string]: number } = {}\n\n const traverseTasks = (tasks: Task[]) => {\n tasks.forEach(task => {\n if (task.resources) {\n const startDate = new Date(task.startDate)\n const endDate = new Date(task.endDate)\n const durationDays = d3.timeDay.count(startDate, d3.timeDay.offset(endDate, 1))\n\n task.resources.forEach(resource => {\n const totalAllocation = resource.allocated * durationDays\n if (!resourceMap[resource.type]) {\n resourceMap[resource.type] = 0\n }\n resourceMap[resource.type] += totalAllocation\n console.log(resource.type, resource.allocated, durationDays, totalAllocation)\n })\n }\n\n if (task.children) {\n traverseTasks(task.children)\n }\n })\n }\n\n traverseTasks(tasks)\n\n return Object.keys(resourceMap).map(type => ({\n type,\n allocated: resourceMap[type]\n }))\n }\n\n syncScroll(e: Event) {\n const target = e.target as HTMLElement\n\n if (target === this.taskTableContainer) {\n const newScrollTop = this.taskTableContainer.scrollTop\n this.ganttChart.setVerticalOffset(newScrollTop)\n\n if (this.ganttChart.getVerticalOffset() !== newScrollTop) {\n this.ganttChart.setVerticalOffset(newScrollTop)\n }\n } else if (target === this.ganttChart) {\n const newScrollTop = this.ganttChart.getVerticalOffset()\n this.taskTableContainer.scrollTop = newScrollTop\n this.ganttChart.setVerticalOffset(this.taskTableContainer.scrollTop)\n\n const newScrollLeft = this.ganttChart.getHorizontalOffset()\n this.resourceChart.setHorizontalOffset(newScrollLeft)\n } else if (target === this.resourceChart) {\n const newScrollTop = this.ganttChart.getVerticalOffset()\n this.resourceTableContainer.scrollTop = newScrollTop\n this.resourceChart.setVerticalOffset(this.taskTableContainer.scrollTop)\n\n const newScrollLeft = this.resourceChart.getHorizontalOffset()\n this.ganttChart.setHorizontalOffset(newScrollLeft)\n } else if (target === this.resourceTableContainer) {\n const newScrollTop = this.taskTableContainer.scrollTop\n this.resourceChart.setVerticalOffset(newScrollTop)\n\n if (this.resourceChart.getVerticalOffset() !== newScrollTop) {\n this.resourceChart.setVerticalOffset(newScrollTop)\n }\n }\n }\n\n syncTimeScale(e: CustomEvent) {\n const detail = e.detail\n this.resourceChart.syncTimeScale(detail)\n }\n\n resizeHorizontalStart(e: CustomEvent) {\n this._startWidth = ((e.target as HTMLElement)?.previousElementSibling as HTMLElement)?.offsetWidth\n this._isDragging = true\n }\n\n resizeHorizontalDrag(e: CustomEvent) {\n if (!this._isDragging) return\n const delta = e.detail\n this.taskTableContainer.style.width = `${this._startWidth + delta.x}px`\n this.resourceTableContainer.style.width = `${this._startWidth + delta.x}px`\n }\n\n resizeHorizontalEnd(e: CustomEvent) {\n this._isDragging = false\n }\n\n resizeVerticalStart(e: CustomEvent) {\n this._startHeight = ((e.target as HTMLElement)?.nextElementSibling as HTMLElement)?.offsetHeight\n this._isDragging = true\n }\n\n resizeVerticalDrag(e: CustomEvent) {\n if (!this._isDragging) return\n const delta = e.detail\n\n this.resourceContainer.style.height = `${this._startHeight - delta.y}px`\n }\n\n resizeVerticalEnd(e: CustomEvent) {\n this._isDragging = false\n }\n}\n"]}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import * as d3 from 'd3';
|
|
3
|
+
import { Task, TimeScale } from './types';
|
|
2
4
|
export declare class OxResourceChart extends LitElement {
|
|
3
5
|
static styles: import("lit").CSSResult[];
|
|
4
6
|
fromDate: string;
|
|
5
7
|
toDate: string;
|
|
6
8
|
axisScale: string;
|
|
7
9
|
resources: any[];
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
private
|
|
10
|
+
tasks: Task[];
|
|
11
|
+
private timeScale;
|
|
12
|
+
private baseWidth;
|
|
13
|
+
private level;
|
|
14
|
+
private fromTime?;
|
|
15
|
+
private toTime?;
|
|
16
|
+
container: HTMLDivElement;
|
|
17
|
+
svgHeader: SVGSVGElement;
|
|
18
|
+
svgBody: SVGSVGElement;
|
|
11
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
12
20
|
updated(changedProperties: PropertyValues<this>): void;
|
|
13
21
|
updateTimeScale(): void;
|
|
@@ -15,5 +23,20 @@ export declare class OxResourceChart extends LitElement {
|
|
|
15
23
|
getScale(): number;
|
|
16
24
|
drawAxes(): void;
|
|
17
25
|
drawBody(): void;
|
|
18
|
-
|
|
26
|
+
renderResourceAllocations(body: d3.Selection<SVGSVGElement, unknown, null, undefined>, ticks: Date[]): void;
|
|
27
|
+
calculateResourceAllocations(ticks: Date[]): {
|
|
28
|
+
[key: string]: {
|
|
29
|
+
[key: string]: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
getTickEnd(tick: Date): Date;
|
|
33
|
+
formatDateKey(start: Date, end: Date): string;
|
|
34
|
+
syncTimeScale(detail: {
|
|
35
|
+
baseWidth: number;
|
|
36
|
+
level: TimeScale;
|
|
37
|
+
}): void;
|
|
38
|
+
setVerticalOffset(offset: number): void;
|
|
39
|
+
getVerticalOffset(): number;
|
|
40
|
+
setHorizontalOffset(offset: number): void;
|
|
41
|
+
getHorizontalOffset(): number;
|
|
19
42
|
}
|