@operato/gantt 8.0.0 → 9.0.0-beta.10
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 +167 -9
- package/dist/src/draw-time-scale-header.d.ts +1 -1
- package/dist/src/draw-time-scale-header.js.map +1 -1
- package/dist/src/gantt-chart-controller.d.ts +7 -8
- package/dist/src/gantt-chart-controller.js +96 -33
- package/dist/src/gantt-chart-controller.js.map +1 -1
- package/dist/src/ox-gantt-chart.d.ts +378 -3
- package/dist/src/ox-gantt-chart.js +97 -186
- package/dist/src/ox-gantt-chart.js.map +1 -1
- package/dist/src/ox-gantt-resize-splitter.d.ts +6 -2
- package/dist/src/ox-gantt-resize-splitter.js +73 -44
- package/dist/src/ox-gantt-resize-splitter.js.map +1 -1
- package/dist/src/ox-gantt.js +84 -79
- package/dist/src/ox-gantt.js.map +1 -1
- package/dist/src/ox-resource-chart.d.ts +1 -1
- package/dist/src/ox-resource-chart.js +15 -9
- package/dist/src/ox-resource-chart.js.map +1 -1
- package/dist/src/ox-task-tooltip.d.ts +3 -1
- package/dist/src/ox-task-tooltip.js +43 -20
- package/dist/src/ox-task-tooltip.js.map +1 -1
- package/dist/src/resource-chart-controller.d.ts +1 -1
- package/dist/src/resource-chart-controller.js +14 -4
- package/dist/src/resource-chart-controller.js.map +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/stories/ox-gantt-chart.stories.js +1 -1
- package/dist/stories/ox-gantt-chart.stories.js.map +1 -1
- package/dist/stories/ox-gantt.stories.js +38 -2
- package/dist/stories/ox-gantt.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -14
- package/assets/images/icon-editor-gradient-direction.png +0 -0
- package/assets/images/icon-properties-label.png +0 -0
- package/assets/images/icon-properties-line-type.png +0 -0
- package/assets/images/icon-properties-table.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,44 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [
|
|
6
|
+
## [9.0.0-beta.10](https://github.com/hatiolab/operato/compare/v9.0.0-beta.9...v9.0.0-beta.10) (2025-01-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* i18next@24.2.1 ([1c5920c](https://github.com/hatiolab/operato/commit/1c5920c6f77d28f07051a0a49997b9fb1dbf08bf))
|
|
12
|
+
* tweak tsconfig.json ([3c424b1](https://github.com/hatiolab/operato/commit/3c424b18d046f95d5619076d113d49a4b4dc9bbb))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [9.0.0-beta.6](https://github.com/hatiolab/operato/compare/v9.0.0-beta.5...v9.0.0-beta.6) (2025-01-20)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### :bug: Bug Fix
|
|
20
|
+
|
|
21
|
+
* esm module ([9642b97](https://github.com/hatiolab/operato/commit/9642b97650623d9ce71f6db0fd1995a2379205b5))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [9.0.0-beta.5](https://github.com/hatiolab/operato/compare/v9.0.0-beta.4...v9.0.0-beta.5) (2025-01-20)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### :bug: Bug Fix
|
|
29
|
+
|
|
30
|
+
* esm module ([1319b00](https://github.com/hatiolab/operato/commit/1319b00d6955a514f63b3469fb514a28f84168a2))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [9.0.0-beta.4](https://github.com/hatiolab/operato/compare/v9.0.0-beta.3...v9.0.0-beta.4) (2025-01-20)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### :bug: Bug Fix
|
|
38
|
+
|
|
39
|
+
* esm module ([0402232](https://github.com/hatiolab/operato/commit/04022327fa47eac64eaf3c56eeec55b9ace13e0e))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [9.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-beta.11...v9.0.0-beta.0) (2025-01-13)
|
|
7
44
|
|
|
8
45
|
**Note:** Version bump only for package @operato/gantt
|
|
9
46
|
|
|
@@ -11,26 +48,103 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
48
|
|
|
12
49
|
|
|
13
50
|
|
|
14
|
-
|
|
51
|
+
## [8.0.0-beta.2](https://github.com/hatiolab/operato/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2025-01-08)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### :bug: Bug Fix
|
|
55
|
+
|
|
56
|
+
* typo .npmignore ([d9c0c8c](https://github.com/hatiolab/operato/commit/d9c0c8c79abc688c3c2cfb6c37fcb689483a5977))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### :bug: Bug Fix
|
|
64
|
+
|
|
65
|
+
* missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
|
|
70
|
+
|
|
71
|
+
**Note:** Version bump only for package @operato/gantt
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## [8.0.0-alpha.50](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.49...v8.0.0-alpha.50) (2024-11-16)
|
|
78
|
+
|
|
79
|
+
**Note:** Version bump only for package @operato/gantt
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## [8.0.0-alpha.47](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.46...v8.0.0-alpha.47) (2024-10-25)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### :bug: Bug Fix
|
|
89
|
+
|
|
90
|
+
* add style for gantt-chart task type ([a1ffa38](https://github.com/hatiolab/operato/commit/a1ffa38134be200e337287bf2db7a30353779d56))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## [8.0.0-alpha.43](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.42...v8.0.0-alpha.43) (2024-10-22)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### :bug: Bug Fix
|
|
98
|
+
|
|
99
|
+
* non-volatile date-range-selected for ox-gantt ([0284204](https://github.com/hatiolab/operato/commit/0284204e52c7bf65978254495c116530e7dc8fcb))
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## [8.0.0-alpha.40](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.39...v8.0.0-alpha.40) (2024-10-21)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### :bug: Bug Fix
|
|
107
|
+
|
|
108
|
+
* bubbling event date-range-selected for ox-gantt ([723af32](https://github.com/hatiolab/operato/commit/723af32318228f91ad3f630d2f6961baecccfd10))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
## [8.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.36...v8.0.0-alpha.37) (2024-10-20)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### :bug: Bug Fix
|
|
116
|
+
|
|
117
|
+
* update dev-dependencies version ([d6fe342](https://github.com/hatiolab/operato/commit/d6fe342de738c6bad3528550a862b5a1d2573161))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## [8.0.0-alpha.36](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.35...v8.0.0-alpha.36) (2024-10-17)
|
|
15
122
|
|
|
16
123
|
|
|
17
124
|
### :bug: Bug Fix
|
|
18
125
|
|
|
19
|
-
*
|
|
20
|
-
* typo .npmignore ([df91cae](https://github.com/hatiolab/operato/commit/df91caea0f5938a3febd9307184e5b036a65e2bd))
|
|
126
|
+
* apply gesture for ox-gantt-chart ([dc1db7a](https://github.com/hatiolab/operato/commit/dc1db7afd6fc08ee5395e50217a901a7a8ec06c7))
|
|
21
127
|
|
|
22
128
|
|
|
23
129
|
|
|
24
|
-
|
|
130
|
+
## [8.0.0-alpha.35](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.34...v8.0.0-alpha.35) (2024-10-15)
|
|
25
131
|
|
|
26
132
|
|
|
27
133
|
### :bug: Bug Fix
|
|
28
134
|
|
|
29
|
-
*
|
|
135
|
+
* gestures for gantt ([0f15280](https://github.com/hatiolab/operato/commit/0f152808b69fc4d385cfbada826e1ac1bf9245eb))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## [8.0.0-alpha.33](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.32...v8.0.0-alpha.33) (2024-10-14)
|
|
140
|
+
|
|
141
|
+
**Note:** Version bump only for package @operato/gantt
|
|
142
|
+
|
|
143
|
+
|
|
30
144
|
|
|
31
145
|
|
|
32
146
|
|
|
33
|
-
|
|
147
|
+
## [8.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.28...v8.0.0-alpha.29) (2024-10-10)
|
|
34
148
|
|
|
35
149
|
**Note:** Version bump only for package @operato/gantt
|
|
36
150
|
|
|
@@ -38,12 +152,56 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
38
152
|
|
|
39
153
|
|
|
40
154
|
|
|
41
|
-
|
|
155
|
+
## [8.0.0-alpha.27](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.26...v8.0.0-alpha.27) (2024-10-06)
|
|
42
156
|
|
|
43
157
|
|
|
44
158
|
### :bug: Bug Fix
|
|
45
159
|
|
|
46
|
-
*
|
|
160
|
+
* calendar css variables ([9ea1918](https://github.com/hatiolab/operato/commit/9ea191844c72de5f920a8da85ad50209ba77cc07))
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
## [8.0.0-alpha.25](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.24...v8.0.0-alpha.25) (2024-10-06)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### :bug: Bug Fix
|
|
168
|
+
|
|
169
|
+
* ox-gantt ([a05370d](https://github.com/hatiolab/operato/commit/a05370d6bc3c9f7d35819f21b1b19b7c40c8e3fe))
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
## [8.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.9...v8.0.0-alpha.10) (2024-09-18)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### :bug: Bug Fix
|
|
177
|
+
|
|
178
|
+
* remove unused files ([7c84a82](https://github.com/hatiolab/operato/commit/7c84a82e62897f0844423f6e2cb27d8f4ef0942f))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## [8.0.0-alpha.6](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.5...v8.0.0-alpha.6) (2024-09-14)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
### :bug: Bug Fix
|
|
186
|
+
|
|
187
|
+
* safe Intl.DateTimeFormat(..) ([0df6827](https://github.com/hatiolab/operato/commit/0df6827b18b3819336c6518e19d63a77a0c4f919))
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## [8.0.0-alpha.4](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.3...v8.0.0-alpha.4) (2024-09-07)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
### :bug: Bug Fix
|
|
195
|
+
|
|
196
|
+
* dataset components & styles ([be44acd](https://github.com/hatiolab/operato/commit/be44acde8f25980e5b27afc481a2c149f8c23dbd))
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
## [8.0.0-alpha.0](https://github.com/hatiolab/operato/compare/v7.1.1...v8.0.0-alpha.0) (2024-09-01)
|
|
201
|
+
|
|
202
|
+
**Note:** Version bump only for package @operato/gantt
|
|
203
|
+
|
|
204
|
+
|
|
47
205
|
|
|
48
206
|
|
|
49
207
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as d3 from 'd3';
|
|
2
|
-
import { TimeScale } from './types';
|
|
2
|
+
import { TimeScale } from './types.js';
|
|
3
3
|
export declare function drawTimeScaleHeader(svgHeader: SVGElement, timeScale: d3.ScaleTime<number, number, never>, fromTime: Date, toTime: Date, baseWidth: number, level: TimeScale, isTwoLevelHeader?: boolean): void;
|
|
4
4
|
export declare function getChartWidth(fromTime: Date, toTime: Date, baseWidth: number, level: TimeScale): number;
|
|
5
5
|
export declare function getScale(level: TimeScale): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw-time-scale-header.js","sourceRoot":"","sources":["../../src/draw-time-scale-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGxB,MAAM,UAAU,mBAAmB,CACjC,SAAqB,EACrB,SAA8C,EAC9C,QAAc,EACd,MAAY,EACZ,SAAiB,EACjB,KAAgB,EAChB,mBAA4B,IAAI;IAEhC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAEnC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;IAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAEvE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,CAAC,IAAI,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IAC7F,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;IAC1E,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAgB;IACvC,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;SAAM,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;QAClC,OAAO,EAAE,GAAG,CAAC,CAAA;IACf,CAAC;SAAM,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;QACpC,OAAO,EAAE,GAAG,CAAC,CAAA;IACf,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["import * as d3 from 'd3'\nimport { TimeScale } from './types'\n\nexport function drawTimeScaleHeader(\n svgHeader: SVGElement,\n timeScale: d3.ScaleTime<number, number, never>,\n fromTime: Date,\n toTime: Date,\n baseWidth: number,\n level: TimeScale,\n isTwoLevelHeader: boolean = true\n) {\n const header = d3.select(svgHeader)\n\n header.selectAll('*').remove()\n header.attr('width', getChartWidth(fromTime, toTime, baseWidth, level))\n\n if (!isTwoLevelHeader) {\n header.attr('height', '30px')\n } else {\n header.attr('height', '40px')\n }\n\n const addGridLines = (ticks: Date[], yStart: number, yEnd: number) => {\n ticks.forEach(tick => {\n const startX = timeScale(tick)\n header\n .append('line')\n .attr('x1', startX)\n .attr('x2', startX)\n .attr('y1', yStart)\n .attr('y2', yEnd)\n .attr('stroke', 'var(--ox-gantt-color-gridlines, var(--md-sys-color-outline))')\n .attr('stroke-width', 1)\n })\n }\n\n const centerLabel = (\n selection: d3.Selection<SVGGElement, unknown, null, undefined>,\n tickInterval: d3.CountableTimeInterval\n ) => {\n selection.selectAll('text').attr('transform', (d: any) => {\n const tickIntervalWidth = timeScale(tickInterval.offset(d, 1)) - timeScale(d)\n return `translate(${tickIntervalWidth / 2}, ${isTwoLevelHeader ? -2 : -8})`\n })\n }\n\n const drawLevel = (\n mainTicks: Date[],\n mainFormat: (d: Date) => string,\n mainInterval: d3.CountableTimeInterval,\n detailTicks: Date[],\n detailFormat: (d: Date) => string,\n detailInterval: d3.CountableTimeInterval\n ) => {\n if (isTwoLevelHeader) {\n const mainAxis = d3\n .axisTop(timeScale)\n .ticks(mainInterval)\n .tickFormat(mainFormat as any)\n .tickSize(0)\n addGridLines(mainTicks, 0, 20)\n\n const mainAxisG = header\n .append('g')\n .classed('main-axis no-select md-typescale-label-small', true)\n .attr('transform', 'translate(0, 20)')\n .call(mainAxis)\n\n centerLabel(mainAxisG, mainInterval)\n }\n\n const detailAxis = d3\n .axisTop(timeScale)\n .ticks(detailInterval)\n .tickFormat(detailFormat as any)\n .tickSize(0)\n addGridLines(detailTicks, isTwoLevelHeader ? 20 : 0, isTwoLevelHeader ? 40 : 30)\n\n const detailAxisG = header\n .append('g')\n .classed('detail-axis no-select md-typescale-label-small', true)\n .attr('transform', `translate(0, ${isTwoLevelHeader ? 40 : 30})`)\n .call(detailAxis)\n\n centerLabel(detailAxisG, detailInterval)\n }\n\n if (level === 'week-day') {\n drawLevel(\n d3.timeWeek.every(1)!.range(d3.timeWeek.floor(fromTime), d3.timeWeek.offset(toTime, 1)),\n d3.timeFormat('%B %d'),\n d3.timeWeek,\n d3.timeDay.every(1)!.range(d3.timeDay.floor(fromTime), d3.timeDay.offset(toTime, 1)),\n d3.timeFormat('%d'),\n d3.timeDay\n )\n } else if (level === 'quarter-week') {\n drawLevel(\n d3.timeMonth.every(3)!.range(d3.timeMonth.floor(fromTime), d3.timeMonth.offset(toTime, 3)),\n d3.timeFormat('%Y %b'),\n d3.timeMonth.every(3)! as any,\n d3.timeWeek.every(1)!.range(d3.timeWeek.floor(fromTime), d3.timeWeek.offset(toTime, 1)),\n d3.timeFormat('%b %d'),\n d3.timeWeek\n )\n } else if (level === 'year-month') {\n drawLevel(\n d3.timeYear.every(1)!.range(d3.timeYear.floor(fromTime), d3.timeYear.offset(toTime, 1)),\n d3.timeFormat('%Y'),\n d3.timeYear,\n d3.timeMonth.every(1)!.range(d3.timeMonth.floor(fromTime), d3.timeMonth.offset(toTime, 1)),\n d3.timeFormat('%b'),\n d3.timeMonth\n )\n } else if (level === 'year-quarter') {\n drawLevel(\n d3.timeYear.every(1)!.range(d3.timeYear.floor(fromTime), d3.timeYear.offset(toTime, 1)),\n d3.timeFormat('%Y'),\n d3.timeYear,\n d3.timeMonth.every(3)!.range(d3.timeMonth.floor(fromTime), d3.timeMonth.offset(toTime, 3)),\n d3.timeFormat('%Y %b'),\n d3.timeMonth.every(3)! as any\n )\n }\n}\n\nexport function getChartWidth(fromTime: Date, toTime: Date, baseWidth: number, level: TimeScale): number {\n const totalDays = d3.timeDay.count(fromTime, d3.timeDay.offset(toTime, 1))\n return (totalDays * baseWidth) / getScale(level)\n}\n\nexport function getScale(level: TimeScale): number {\n if (level === 'quarter-week') {\n return 7 / 2\n } else if (level === 'year-month') {\n return 30 / 2\n } else if (level === 'year-quarter') {\n return 90 / 2\n }\n return 1\n}\n"]}
|
|
1
|
+
{"version":3,"file":"draw-time-scale-header.js","sourceRoot":"","sources":["../../src/draw-time-scale-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGxB,MAAM,UAAU,mBAAmB,CACjC,SAAqB,EACrB,SAA8C,EAC9C,QAAc,EACd,MAAY,EACZ,SAAiB,EACjB,KAAgB,EAChB,mBAA4B,IAAI;IAEhC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAEnC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;IAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,M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S,CAC9B,CAAA;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAc,EAAE,MAAY,EAAE,SAAiB,EAAE,KAAgB;IAC7F,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;IAC1E,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAgB;IACvC,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;SAAM,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;QAClC,OAAO,EAAE,GAAG,CAAC,CAAA;IACf,CAAC;SAAM,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;QACpC,OAAO,EAAE,GAAG,CAAC,CAAA;IACf,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["import * as d3 from 'd3'\nimport { TimeScale } from './types.js'\n\nexport function drawTimeScaleHeader(\n svgHeader: SVGElement,\n timeScale: d3.ScaleTime<number, number, never>,\n fromTime: Date,\n toTime: Date,\n baseWidth: number,\n level: TimeScale,\n isTwoLevelHeader: boolean = true\n) {\n const header = d3.select(svgHeader)\n\n header.selectAll('*').remove()\n header.attr('width', getChartWidth(fromTime, toTime, baseWidth, level))\n\n if (!isTwoLevelHeader) {\n header.attr('height', '30px')\n } else {\n header.attr('height', '40px')\n }\n\n const addGridLines = (ticks: Date[], yStart: number, yEnd: number) => {\n ticks.forEach(tick => {\n const startX = timeScale(tick)\n header\n .append('line')\n .attr('x1', startX)\n .attr('x2', startX)\n .attr('y1', yStart)\n .attr('y2', yEnd)\n .attr('stroke', 'var(--ox-gantt-color-gridlines, var(--md-sys-color-outline))')\n .attr('stroke-width', 1)\n })\n }\n\n const centerLabel = (\n selection: d3.Selection<SVGGElement, unknown, null, undefined>,\n tickInterval: d3.CountableTimeInterval\n ) => {\n selection.selectAll('text').attr('transform', (d: any) => {\n const tickIntervalWidth = timeScale(tickInterval.offset(d, 1)) - timeScale(d)\n return `translate(${tickIntervalWidth / 2}, ${isTwoLevelHeader ? -2 : -8})`\n })\n }\n\n const drawLevel = (\n mainTicks: Date[],\n mainFormat: (d: Date) => string,\n mainInterval: d3.CountableTimeInterval,\n detailTicks: Date[],\n detailFormat: (d: Date) => string,\n detailInterval: d3.CountableTimeInterval\n ) => {\n if (isTwoLevelHeader) {\n const mainAxis = d3\n .axisTop(timeScale)\n .ticks(mainInterval)\n .tickFormat(mainFormat as any)\n .tickSize(0)\n addGridLines(mainTicks, 0, 20)\n\n const mainAxisG = header\n .append('g')\n .classed('main-axis no-select md-typescale-label-small', true)\n .attr('transform', 'translate(0, 20)')\n .call(mainAxis)\n\n centerLabel(mainAxisG, mainInterval)\n }\n\n const detailAxis = d3\n .axisTop(timeScale)\n .ticks(detailInterval)\n .tickFormat(detailFormat as any)\n .tickSize(0)\n addGridLines(detailTicks, isTwoLevelHeader ? 20 : 0, isTwoLevelHeader ? 40 : 30)\n\n const detailAxisG = header\n .append('g')\n .classed('detail-axis no-select md-typescale-label-small', true)\n .attr('transform', `translate(0, ${isTwoLevelHeader ? 40 : 30})`)\n .call(detailAxis)\n\n centerLabel(detailAxisG, detailInterval)\n }\n\n if (level === 'week-day') {\n drawLevel(\n d3.timeWeek.every(1)!.range(d3.timeWeek.floor(fromTime), d3.timeWeek.offset(toTime, 1)),\n d3.timeFormat('%B %d'),\n d3.timeWeek,\n d3.timeDay.every(1)!.range(d3.timeDay.floor(fromTime), d3.timeDay.offset(toTime, 1)),\n d3.timeFormat('%d'),\n d3.timeDay\n )\n } else if (level === 'quarter-week') {\n drawLevel(\n d3.timeMonth.every(3)!.range(d3.timeMonth.floor(fromTime), d3.timeMonth.offset(toTime, 3)),\n d3.timeFormat('%Y %b'),\n d3.timeMonth.every(3)! as any,\n d3.timeWeek.every(1)!.range(d3.timeWeek.floor(fromTime), d3.timeWeek.offset(toTime, 1)),\n d3.timeFormat('%b %d'),\n d3.timeWeek\n )\n } else if (level === 'year-month') {\n drawLevel(\n d3.timeYear.every(1)!.range(d3.timeYear.floor(fromTime), d3.timeYear.offset(toTime, 1)),\n d3.timeFormat('%Y'),\n d3.timeYear,\n d3.timeMonth.every(1)!.range(d3.timeMonth.floor(fromTime), d3.timeMonth.offset(toTime, 1)),\n d3.timeFormat('%b'),\n d3.timeMonth\n )\n } else if (level === 'year-quarter') {\n drawLevel(\n d3.timeYear.every(1)!.range(d3.timeYear.floor(fromTime), d3.timeYear.offset(toTime, 1)),\n d3.timeFormat('%Y'),\n d3.timeYear,\n d3.timeMonth.every(3)!.range(d3.timeMonth.floor(fromTime), d3.timeMonth.offset(toTime, 3)),\n d3.timeFormat('%Y %b'),\n d3.timeMonth.every(3)! as any\n )\n }\n}\n\nexport function getChartWidth(fromTime: Date, toTime: Date, baseWidth: number, level: TimeScale): number {\n const totalDays = d3.timeDay.count(fromTime, d3.timeDay.offset(toTime, 1))\n return (totalDays * baseWidth) / getScale(level)\n}\n\nexport function getScale(level: TimeScale): number {\n if (level === 'quarter-week') {\n return 7 / 2\n } else if (level === 'year-month') {\n return 30 / 2\n } else if (level === 'year-quarter') {\n return 90 / 2\n }\n return 1\n}\n"]}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { LitElement, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
2
|
import * as d3 from 'd3';
|
|
3
|
-
import { TimeScale, Task, TaskTag } from './types';
|
|
4
|
-
import { OxTaskTooltip } from './ox-task-tooltip';
|
|
3
|
+
import { TimeScale, Task, TaskTag } from './types.js';
|
|
4
|
+
import { OxTaskTooltip } from './ox-task-tooltip.js';
|
|
5
|
+
import { GestureEventPinch, GestureEventDoubleTap, GestureEventDrag } from '@operato/utils/gesture-mixin.js';
|
|
5
6
|
export declare class GanttChartController implements ReactiveController {
|
|
6
7
|
private host;
|
|
7
8
|
private fromTime;
|
|
8
9
|
private toTime;
|
|
9
10
|
private totalDays;
|
|
10
11
|
private _timeScale?;
|
|
11
|
-
private touchStartX?;
|
|
12
|
-
private touchStartY?;
|
|
13
|
-
private scrollStartX?;
|
|
14
|
-
private scrollStartY?;
|
|
15
12
|
private colorProvider?;
|
|
16
13
|
baseWidth: number;
|
|
17
14
|
level: TimeScale;
|
|
@@ -19,6 +16,7 @@ export declare class GanttChartController implements ReactiveController {
|
|
|
19
16
|
tasks: Task[];
|
|
20
17
|
extendGridLines: boolean;
|
|
21
18
|
constructor(host: ReactiveControllerHost & LitElement, fromDate: string, toDate: string, axisScale: TimeScale);
|
|
19
|
+
dispose(): void;
|
|
22
20
|
hostConnected(): void;
|
|
23
21
|
setColorProvider(colorProvider: (task: Task) => string): void;
|
|
24
22
|
get timeScale(): d3.ScaleTime<number, number, never>;
|
|
@@ -31,6 +29,7 @@ export declare class GanttChartController implements ReactiveController {
|
|
|
31
29
|
drawBody(svgBody: SVGElement, tooltip: OxTaskTooltip): void;
|
|
32
30
|
getTaskColor(tags: TaskTag[]): string;
|
|
33
31
|
handleWheelForBody(event: WheelEvent, container: HTMLDivElement): void;
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
handlePinchForBody: (event: GestureEventPinch) => void;
|
|
33
|
+
handleDoubleTapForBody: (event: GestureEventDoubleTap) => void;
|
|
34
|
+
handleDragForBody: (event: GestureEventDrag) => void;
|
|
36
35
|
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import * as d3 from 'd3';
|
|
2
|
-
import { drawTimeScaleHeader, getScale, getChartWidth } from './draw-time-scale-header';
|
|
2
|
+
import { drawTimeScaleHeader, getScale, getChartWidth } from './draw-time-scale-header.js';
|
|
3
|
+
import { levelDown, levelUp } from './utils.js';
|
|
3
4
|
export class GanttChartController {
|
|
5
|
+
host;
|
|
6
|
+
fromTime;
|
|
7
|
+
toTime;
|
|
8
|
+
totalDays;
|
|
9
|
+
_timeScale;
|
|
10
|
+
colorProvider;
|
|
11
|
+
baseWidth = 30;
|
|
12
|
+
level;
|
|
13
|
+
selectedTaskId;
|
|
14
|
+
tasks = [];
|
|
15
|
+
extendGridLines = false;
|
|
4
16
|
constructor(host, fromDate, toDate, axisScale) {
|
|
5
|
-
this.baseWidth = 30;
|
|
6
|
-
this.tasks = [];
|
|
7
|
-
this.extendGridLines = false;
|
|
8
17
|
this.host = host;
|
|
9
18
|
this.fromTime = new Date(fromDate);
|
|
10
19
|
this.toTime = new Date(toDate);
|
|
@@ -12,6 +21,9 @@ export class GanttChartController {
|
|
|
12
21
|
this.totalDays = d3.timeDay.count(this.fromTime, d3.timeDay.offset(this.toTime, 1));
|
|
13
22
|
this.host.addController(this);
|
|
14
23
|
}
|
|
24
|
+
dispose() {
|
|
25
|
+
this.host = null;
|
|
26
|
+
}
|
|
15
27
|
hostConnected() {
|
|
16
28
|
this.updateTimeScale();
|
|
17
29
|
}
|
|
@@ -32,11 +44,11 @@ export class GanttChartController {
|
|
|
32
44
|
this.toTime = new Date(toDate);
|
|
33
45
|
this.totalDays = d3.timeDay.count(this.fromTime, d3.timeDay.offset(this.toTime, 1));
|
|
34
46
|
this._timeScale = undefined;
|
|
35
|
-
this.host
|
|
47
|
+
this.host?.requestUpdate();
|
|
36
48
|
}
|
|
37
49
|
setTasks(tasks) {
|
|
38
50
|
this.tasks = tasks;
|
|
39
|
-
this.host
|
|
51
|
+
this.host?.requestUpdate();
|
|
40
52
|
}
|
|
41
53
|
updateTimeScale() {
|
|
42
54
|
this.timeScale.range([0, this.getChartWidth()]);
|
|
@@ -60,7 +72,7 @@ export class GanttChartController {
|
|
|
60
72
|
.append('marker')
|
|
61
73
|
.attr('id', 'arrow')
|
|
62
74
|
.attr('viewBox', '0 0 10 10')
|
|
63
|
-
.attr('refX', 10)
|
|
75
|
+
.attr('refX', 10)
|
|
64
76
|
.attr('refY', 5)
|
|
65
77
|
.attr('markerWidth', 6)
|
|
66
78
|
.attr('markerHeight', 6)
|
|
@@ -114,12 +126,16 @@ export class GanttChartController {
|
|
|
114
126
|
const taskWidth = endX - startX + this.baseWidth / this.getScale();
|
|
115
127
|
const taskY = index * 30 + 7.5;
|
|
116
128
|
const showTooltip = (event) => {
|
|
129
|
+
tooltip.hide();
|
|
130
|
+
const touch = 'touches' in event;
|
|
131
|
+
const x = touch ? event.touches[0].clientX : event.clientX;
|
|
132
|
+
const y = touch ? event.touches[0].clientY : event.clientY;
|
|
117
133
|
tooltip.title = task.title;
|
|
118
134
|
tooltip.startDate = startDate.toISOString().split('T')[0];
|
|
119
135
|
tooltip.endDate = endDate.toISOString().split('T')[0];
|
|
120
136
|
tooltip.progress = task.progress ?? 0;
|
|
121
137
|
tooltip.type = task.type;
|
|
122
|
-
tooltip.show(
|
|
138
|
+
tooltip.show(x, y);
|
|
123
139
|
};
|
|
124
140
|
const hideTooltip = () => {
|
|
125
141
|
tooltip.hide();
|
|
@@ -143,15 +159,16 @@ export class GanttChartController {
|
|
|
143
159
|
.attr('stroke', 'black')
|
|
144
160
|
.attr('stroke-width', 1);
|
|
145
161
|
taskBar
|
|
146
|
-
.on('click',
|
|
162
|
+
.on('click', e => {
|
|
147
163
|
this.selectedTaskId = task.id;
|
|
148
164
|
const customEvent = new CustomEvent('task-clicked', {
|
|
149
165
|
detail: { taskId: task.id },
|
|
150
166
|
bubbles: true,
|
|
151
167
|
composed: true
|
|
152
168
|
});
|
|
153
|
-
|
|
154
|
-
this.host
|
|
169
|
+
showTooltip(e);
|
|
170
|
+
this.host?.dispatchEvent(customEvent);
|
|
171
|
+
this.host?.requestUpdate();
|
|
155
172
|
})
|
|
156
173
|
.on('mouseover', showTooltip)
|
|
157
174
|
.on('mouseout', hideTooltip);
|
|
@@ -165,15 +182,16 @@ export class GanttChartController {
|
|
|
165
182
|
.attr('height', 7.5)
|
|
166
183
|
.attr('fill', 'lightgreen');
|
|
167
184
|
progressBar
|
|
168
|
-
.on('click',
|
|
185
|
+
.on('click', e => {
|
|
169
186
|
this.selectedTaskId = task.id;
|
|
170
187
|
const customEvent = new CustomEvent('task-clicked', {
|
|
171
188
|
detail: { taskId: task.id },
|
|
172
189
|
bubbles: true,
|
|
173
190
|
composed: true
|
|
174
191
|
});
|
|
175
|
-
|
|
176
|
-
this.host
|
|
192
|
+
showTooltip(e);
|
|
193
|
+
this.host?.dispatchEvent(customEvent);
|
|
194
|
+
this.host?.requestUpdate();
|
|
177
195
|
})
|
|
178
196
|
.on('mouseover', showTooltip)
|
|
179
197
|
.on('mouseout', hideTooltip);
|
|
@@ -204,7 +222,7 @@ export class GanttChartController {
|
|
|
204
222
|
.attr('stroke', 'var(--md-sys-color-on-primary-container, black)')
|
|
205
223
|
.attr('fill', 'none')
|
|
206
224
|
.attr('stroke-width', 1)
|
|
207
|
-
.attr('marker-end', 'url(#arrow)');
|
|
225
|
+
.attr('marker-end', 'url(#arrow)');
|
|
208
226
|
}
|
|
209
227
|
});
|
|
210
228
|
}
|
|
@@ -225,6 +243,7 @@ export class GanttChartController {
|
|
|
225
243
|
handleWheelForBody(event, container) {
|
|
226
244
|
event.preventDefault();
|
|
227
245
|
event.stopPropagation();
|
|
246
|
+
const { offsetHeight } = container;
|
|
228
247
|
const deltaModeFactor = event.deltaMode === WheelEvent.DOM_DELTA_LINE
|
|
229
248
|
? 16
|
|
230
249
|
: event.deltaMode === WheelEvent.DOM_DELTA_PAGE
|
|
@@ -234,7 +253,8 @@ export class GanttChartController {
|
|
|
234
253
|
const deltaY = event.deltaY * deltaModeFactor;
|
|
235
254
|
// 가로 스크롤 및 세로 스크롤 모두 처리
|
|
236
255
|
container.scrollLeft += deltaX;
|
|
237
|
-
container.scrollTop += deltaY
|
|
256
|
+
// container.scrollTop += deltaY
|
|
257
|
+
container.scrollTop = Math.min(this.tasks.length * 30 - (offsetHeight - 40), container.scrollTop + deltaY);
|
|
238
258
|
const customEvent = new CustomEvent('scroll', {
|
|
239
259
|
detail: {
|
|
240
260
|
scrollLeft: container.scrollLeft,
|
|
@@ -243,22 +263,65 @@ export class GanttChartController {
|
|
|
243
263
|
bubbles: true,
|
|
244
264
|
composed: true
|
|
245
265
|
});
|
|
246
|
-
this.host
|
|
266
|
+
this.host?.dispatchEvent(customEvent);
|
|
247
267
|
}
|
|
248
|
-
|
|
249
|
-
event.
|
|
250
|
-
this.
|
|
251
|
-
this.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
268
|
+
handlePinchForBody = (event) => {
|
|
269
|
+
const { scale } = event.detail;
|
|
270
|
+
this.baseWidth *= scale;
|
|
271
|
+
if (this.baseWidth > 40) {
|
|
272
|
+
if (this.level === 'week-day') {
|
|
273
|
+
this.baseWidth = 40;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
this.level = levelDown(this.level);
|
|
277
|
+
this.baseWidth = 30;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
else if (this.baseWidth < 30) {
|
|
281
|
+
if (this.level === 'year-quarter') {
|
|
282
|
+
this.baseWidth = 30;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (this.baseWidth < 20) {
|
|
286
|
+
this.level = levelUp(this.level);
|
|
287
|
+
this.baseWidth = 30;
|
|
288
|
+
}
|
|
289
|
+
this.updateTimeScale();
|
|
290
|
+
this.host?.requestUpdate();
|
|
291
|
+
const customEvent = new CustomEvent('timescale-changed', {
|
|
292
|
+
detail: {
|
|
293
|
+
baseWidth: this.baseWidth,
|
|
294
|
+
level: this.level
|
|
295
|
+
},
|
|
296
|
+
bubbles: true,
|
|
297
|
+
composed: true
|
|
298
|
+
});
|
|
299
|
+
this.host?.dispatchEvent(customEvent);
|
|
300
|
+
};
|
|
301
|
+
handleDoubleTapForBody = (event) => {
|
|
302
|
+
const container = this.host.container;
|
|
303
|
+
container.scrollLeft = 0;
|
|
304
|
+
container.scrollTop = 0;
|
|
305
|
+
this.baseWidth = 30;
|
|
306
|
+
this.level = 'week-day';
|
|
307
|
+
this.updateTimeScale();
|
|
308
|
+
this.host?.requestUpdate();
|
|
309
|
+
const customEvent = new CustomEvent('timescale-changed', {
|
|
310
|
+
detail: {
|
|
311
|
+
baseWidth: this.baseWidth,
|
|
312
|
+
level: this.level
|
|
313
|
+
},
|
|
314
|
+
bubbles: true,
|
|
315
|
+
composed: true
|
|
316
|
+
});
|
|
317
|
+
this.host?.dispatchEvent(customEvent);
|
|
318
|
+
};
|
|
319
|
+
handleDragForBody = (event) => {
|
|
320
|
+
const { deltaX: dx, deltaY: dy } = event.detail;
|
|
321
|
+
const container = this.host.container;
|
|
322
|
+
const { offsetHeight } = container;
|
|
323
|
+
container.scrollLeft -= dx;
|
|
324
|
+
container.scrollTop = Math.min(this.tasks.length * 30 - (offsetHeight - 40), container.scrollTop - dy);
|
|
262
325
|
const customEvent = new CustomEvent('scroll', {
|
|
263
326
|
detail: {
|
|
264
327
|
scrollLeft: container.scrollLeft,
|
|
@@ -267,7 +330,7 @@ export class GanttChartController {
|
|
|
267
330
|
bubbles: true,
|
|
268
331
|
composed: true
|
|
269
332
|
});
|
|
270
|
-
this.host
|
|
271
|
-
}
|
|
333
|
+
this.host?.dispatchEvent(customEvent);
|
|
334
|
+
};
|
|
272
335
|
}
|
|
273
336
|
//# sourceMappingURL=gantt-chart-controller.js.map
|