@worktile/gantt 12.0.1 → 12.1.1
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/README.md +13 -116
- package/bundles/worktile-gantt.umd.js +3369 -0
- package/bundles/worktile-gantt.umd.js.map +1 -0
- package/class/date-point.d.ts +15 -0
- package/{packages/gantt/src/class/event.ts → class/event.d.ts} +6 -12
- package/class/group.d.ts +22 -0
- package/{packages/gantt/src/class/index.ts → class/index.d.ts} +0 -0
- package/class/item.d.ts +70 -0
- package/class/view-type.d.ts +7 -0
- package/components/bar/bar-drag.d.ts +37 -0
- package/components/bar/bar.component.d.ts +26 -0
- package/components/calendar/calendar.component.d.ts +28 -0
- package/components/drag-backdrop/drag-backdrop.component.d.ts +9 -0
- package/components/icon/icon.component.d.ts +13 -0
- package/components/icon/icons.d.ts +8 -0
- package/components/links/links.component.d.ts +47 -0
- package/components/main/gantt-main.component.d.ts +21 -0
- package/components/range/range.component.d.ts +13 -0
- package/components/table/gantt-table.component.d.ts +37 -0
- package/esm2015/class/date-point.js +10 -0
- package/esm2015/class/event.js +13 -0
- package/esm2015/class/group.js +17 -0
- package/esm2015/class/index.js +6 -0
- package/esm2015/class/item.js +78 -0
- package/esm2015/class/view-type.js +9 -0
- package/esm2015/components/bar/bar-drag.js +269 -0
- package/esm2015/components/bar/bar.component.js +98 -0
- package/esm2015/components/calendar/calendar.component.js +86 -0
- package/esm2015/components/drag-backdrop/drag-backdrop.component.js +21 -0
- package/esm2015/components/icon/icon.component.js +38 -0
- package/esm2015/components/icon/icons.js +87 -0
- package/esm2015/components/links/links.component.js +213 -0
- package/esm2015/components/main/gantt-main.component.js +53 -0
- package/esm2015/components/range/range.component.js +37 -0
- package/esm2015/components/table/gantt-table.component.js +149 -0
- package/esm2015/gantt-abstract.js +3 -0
- package/esm2015/gantt-dom.service.js +103 -0
- package/esm2015/gantt-drag-container.js +60 -0
- package/esm2015/gantt-item-upper.js +58 -0
- package/esm2015/gantt-print.service.js +94 -0
- package/esm2015/gantt-upper.js +280 -0
- package/esm2015/gantt.component.js +135 -0
- package/esm2015/gantt.config.js +13 -0
- package/esm2015/gantt.module.js +85 -0
- package/esm2015/gantt.pipe.js +43 -0
- package/esm2015/gantt.styles.js +15 -0
- package/esm2015/public-api.js +19 -0
- package/esm2015/root.component.js +123 -0
- package/esm2015/table/gantt-column.component.js +37 -0
- package/esm2015/table/gantt-table.component.js +20 -0
- package/esm2015/utils/date.js +160 -0
- package/esm2015/utils/helpers.js +55 -0
- package/esm2015/views/day.js +54 -0
- package/esm2015/views/factory.js +23 -0
- package/esm2015/views/month.js +48 -0
- package/esm2015/views/quarter.js +51 -0
- package/esm2015/views/view.js +123 -0
- package/esm2015/views/week.js +49 -0
- package/esm2015/views/year.js +50 -0
- package/esm2015/worktile-gantt.js +5 -0
- package/fesm2015/worktile-gantt.js +2697 -0
- package/fesm2015/worktile-gantt.js.map +1 -0
- package/{packages/gantt/src/gantt-abstract.ts → gantt-abstract.d.ts} +1 -3
- package/gantt-dom.service.d.ts +32 -0
- package/gantt-drag-container.d.ts +24 -0
- package/gantt-item-upper.d.ts +20 -0
- package/gantt-print.service.d.ts +13 -0
- package/gantt-upper.d.ts +69 -0
- package/gantt.component.d.ts +30 -0
- package/gantt.config.d.ts +23 -0
- package/gantt.module.d.ts +21 -0
- package/gantt.pipe.d.ts +18 -0
- package/gantt.styles.d.ts +15 -0
- package/main.bundle.scss +645 -0
- package/package.json +16 -113
- package/{packages/gantt/src/public-api.ts → public-api.d.ts} +1 -4
- package/root.component.d.ts +28 -0
- package/table/gantt-column.component.d.ts +15 -0
- package/table/gantt-table.component.d.ts +10 -0
- package/utils/date.d.ts +59 -0
- package/utils/helpers.d.ts +12 -0
- package/views/day.d.ts +14 -0
- package/views/factory.d.ts +8 -0
- package/views/month.d.ts +12 -0
- package/views/quarter.d.ts +12 -0
- package/views/view.d.ts +58 -0
- package/views/week.d.ts +12 -0
- package/views/year.d.ts +12 -0
- package/worktile-gantt.d.ts +5 -0
- package/.all-contributorsrc +0 -53
- package/.angulardoc.json +0 -4
- package/.circleci/config.yml +0 -17
- package/.coveralls.yml +0 -1
- package/.docgenirc.js +0 -64
- package/.editorconfig +0 -22
- package/.prettierrc +0 -24
- package/.travis.yml +0 -23
- package/CHANGELOG.md +0 -564
- package/Dockerfile +0 -4
- package/LICENSE +0 -21
- package/angular.json +0 -136
- package/docs/guides/basic/components.md +0 -54
- package/docs/guides/basic/event.md +0 -70
- package/docs/guides/basic/index.md +0 -4
- package/docs/guides/basic/style.md +0 -68
- package/docs/guides/basic/type.md +0 -70
- package/docs/guides/basic/usage.md +0 -189
- package/docs/guides/index.md +0 -5
- package/docs/guides/intro/getting-started.md +0 -79
- package/docs/guides/intro/index.md +0 -51
- package/docs/index.md +0 -0
- package/example/browserslist +0 -12
- package/example/src/app/app-routing.module.ts +0 -26
- package/example/src/app/app.component.html +0 -2
- package/example/src/app/app.component.ts +0 -11
- package/example/src/app/app.module.ts +0 -57
- package/example/src/app/components/components.component.html +0 -6
- package/example/src/app/components/components.component.ts +0 -33
- package/example/src/app/configuration/parameters/api/zh-cn.js +0 -350
- package/example/src/app/configuration/parameters/doc/zh-cn.md +0 -5
- package/example/src/app/gantt/gantt.component.html +0 -51
- package/example/src/app/gantt/gantt.component.ts +0 -119
- package/example/src/app/gantt-advanced/component/flat.component.html +0 -30
- package/example/src/app/gantt-advanced/component/flat.component.ts +0 -72
- package/example/src/app/gantt-advanced/component/flat.scss +0 -31
- package/example/src/app/gantt-advanced/gantt-advanced.component.html +0 -32
- package/example/src/app/gantt-advanced/gantt-advanced.component.ts +0 -34
- package/example/src/app/gantt-advanced/mocks.ts +0 -158
- package/example/src/app/gantt-groups/gantt-groups.component.html +0 -42
- package/example/src/app/gantt-groups/gantt-groups.component.ts +0 -62
- package/example/src/app/gantt-range/gantt-range.component.html +0 -66
- package/example/src/app/gantt-range/gantt-range.component.ts +0 -67
- package/example/src/app/gantt-range/mocks.ts +0 -150
- package/example/src/app/helper.ts +0 -38
- package/example/src/assets/.gitkeep +0 -0
- package/example/src/environments/environment.prod.ts +0 -3
- package/example/src/environments/environment.ts +0 -16
- package/example/src/favicon.ico +0 -0
- package/example/src/index.html +0 -13
- package/example/src/main.ts +0 -12
- package/example/src/polyfills.ts +0 -63
- package/example/src/styles.scss +0 -56
- package/example/tsconfig.app.json +0 -18
- package/nginx.conf +0 -17
- package/packages/gantt/README.md +0 -24
- package/packages/gantt/karma.conf.js +0 -46
- package/packages/gantt/ng-package.json +0 -7
- package/packages/gantt/ng-package.prod.json +0 -7
- package/packages/gantt/package.json +0 -16
- package/packages/gantt/src/class/date-point.ts +0 -14
- package/packages/gantt/src/class/group.ts +0 -36
- package/packages/gantt/src/class/item.ts +0 -129
- package/packages/gantt/src/class/test/group.spec.ts +0 -21
- package/packages/gantt/src/class/test/item.spec.ts +0 -102
- package/packages/gantt/src/class/view-type.ts +0 -7
- package/packages/gantt/src/components/bar/bar-drag.ts +0 -298
- package/packages/gantt/src/components/bar/bar.component.html +0 -17
- package/packages/gantt/src/components/bar/bar.component.scss +0 -169
- package/packages/gantt/src/components/bar/bar.component.ts +0 -109
- package/packages/gantt/src/components/bar/test/bar.component.spec.ts +0 -54
- package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +0 -196
- package/packages/gantt/src/components/calendar/calendar.component.html +0 -52
- package/packages/gantt/src/components/calendar/calendar.component.scss +0 -77
- package/packages/gantt/src/components/calendar/calendar.component.ts +0 -100
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +0 -6
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +0 -48
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +0 -13
- package/packages/gantt/src/components/icon/icon.component.scss +0 -13
- package/packages/gantt/src/components/icon/icon.component.ts +0 -28
- package/packages/gantt/src/components/icon/icons.ts +0 -86
- package/packages/gantt/src/components/links/links.component.html +0 -19
- package/packages/gantt/src/components/links/links.component.scss +0 -27
- package/packages/gantt/src/components/links/links.component.ts +0 -263
- package/packages/gantt/src/components/main/gantt-main.component.html +0 -35
- package/packages/gantt/src/components/main/gantt-main.component.ts +0 -35
- package/packages/gantt/src/components/range/range.component.html +0 -8
- package/packages/gantt/src/components/range/range.component.scss +0 -35
- package/packages/gantt/src/components/range/range.component.ts +0 -27
- package/packages/gantt/src/components/range/test/range.component.spec.ts +0 -80
- package/packages/gantt/src/components/table/gantt-table.component.html +0 -105
- package/packages/gantt/src/components/table/gantt-table.component.scss +0 -144
- package/packages/gantt/src/components/table/gantt-table.component.ts +0 -166
- package/packages/gantt/src/components/table/test/table.spec.ts +0 -129
- package/packages/gantt/src/gantt-dom.service.ts +0 -134
- package/packages/gantt/src/gantt-drag-container.ts +0 -73
- package/packages/gantt/src/gantt-item-upper.ts +0 -50
- package/packages/gantt/src/gantt-print.service.ts +0 -104
- package/packages/gantt/src/gantt-upper.ts +0 -289
- package/packages/gantt/src/gantt.component.html +0 -18
- package/packages/gantt/src/gantt.component.scss +0 -77
- package/packages/gantt/src/gantt.component.ts +0 -134
- package/packages/gantt/src/gantt.module.ts +0 -47
- package/packages/gantt/src/gantt.pipe.ts +0 -31
- package/packages/gantt/src/gantt.styles.ts +0 -28
- package/packages/gantt/src/root.component.html +0 -12
- package/packages/gantt/src/root.component.ts +0 -121
- package/packages/gantt/src/styles/index.scss +0 -9
- package/packages/gantt/src/styles/variables.scss +0 -46
- package/packages/gantt/src/table/gantt-column.component.ts +0 -25
- package/packages/gantt/src/table/gantt-table.component.ts +0 -14
- package/packages/gantt/src/table/test/table.spec.ts +0 -56
- package/packages/gantt/src/test/gantt.component.spec.ts +0 -404
- package/packages/gantt/src/test/mocks/data.ts +0 -303
- package/packages/gantt/src/test.ts +0 -21
- package/packages/gantt/src/utils/date.ts +0 -276
- package/packages/gantt/src/utils/helpers.ts +0 -66
- package/packages/gantt/src/utils/test/date.spec.ts +0 -105
- package/packages/gantt/src/utils/test/helpers.spec.ts +0 -73
- package/packages/gantt/src/utils/testing.ts +0 -64
- package/packages/gantt/src/views/day.ts +0 -74
- package/packages/gantt/src/views/factory.ts +0 -25
- package/packages/gantt/src/views/month.ts +0 -66
- package/packages/gantt/src/views/quarter.ts +0 -68
- package/packages/gantt/src/views/test/day.spec.ts +0 -45
- package/packages/gantt/src/views/test/factory.spec.ts +0 -41
- package/packages/gantt/src/views/test/mock.ts +0 -14
- package/packages/gantt/src/views/test/month.spec.ts +0 -45
- package/packages/gantt/src/views/test/quarter.spec.ts +0 -45
- package/packages/gantt/src/views/test/view.spec.ts +0 -144
- package/packages/gantt/src/views/test/week.spec.ts +0 -45
- package/packages/gantt/src/views/test/year.spec.ts +0 -45
- package/packages/gantt/src/views/view.ts +0 -186
- package/packages/gantt/src/views/week.ts +0 -66
- package/packages/gantt/src/views/year.ts +0 -62
- package/packages/gantt/tsconfig.lib.json +0 -20
- package/packages/gantt/tsconfig.lib.prod.json +0 -9
- package/packages/gantt/tsconfig.schematics.json +0 -25
- package/packages/gantt/tsconfig.spec.json +0 -17
- package/packages/gantt/tslint.json +0 -18
- package/scss-bundle.config.json +0 -7
- package/tsconfig.json +0 -26
- package/tslint.json +0 -51
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
$gantt-bar-layer-append-width: 32px;
|
|
2
|
-
$gantt-bar-layer-append-height: 42px;
|
|
3
|
-
$gantt-bar-link-height: 16px;
|
|
4
|
-
$gantt-bar-link-drop-border: 5px;
|
|
5
|
-
|
|
6
|
-
@mixin link-handles {
|
|
7
|
-
.link-handles {
|
|
8
|
-
.handle {
|
|
9
|
-
position: absolute;
|
|
10
|
-
display: inline-block;
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
width: $gantt-bar-link-height;
|
|
13
|
-
height: $gantt-bar-link-height;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
z-index: 1001;
|
|
18
|
-
|
|
19
|
-
&:first-child {
|
|
20
|
-
left: 0;
|
|
21
|
-
top: 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&:last-child {
|
|
25
|
-
right: 0;
|
|
26
|
-
bottom: 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.point {
|
|
30
|
-
color: #348fe4;
|
|
31
|
-
width: 10px;
|
|
32
|
-
height: 10px;
|
|
33
|
-
border-radius: 50%;
|
|
34
|
-
background: #348fe4;
|
|
35
|
-
transition: 0.3 ease;
|
|
36
|
-
|
|
37
|
-
&:hover {
|
|
38
|
-
width: 12px;
|
|
39
|
-
height: 12px;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@mixin drag-handles {
|
|
47
|
-
.drag-handles {
|
|
48
|
-
background: $gantt-bar-layer-bg;
|
|
49
|
-
width: 100%;
|
|
50
|
-
height: calc(100% - #{$gantt-bar-link-height} * 2);
|
|
51
|
-
position: absolute;
|
|
52
|
-
border-radius: 4px;
|
|
53
|
-
top: $gantt-bar-link-height;
|
|
54
|
-
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.15);
|
|
55
|
-
|
|
56
|
-
.handle {
|
|
57
|
-
width: 15px;
|
|
58
|
-
height: 100%;
|
|
59
|
-
position: absolute;
|
|
60
|
-
cursor: col-resize;
|
|
61
|
-
display: flex;
|
|
62
|
-
align-items: center;
|
|
63
|
-
justify-content: center;
|
|
64
|
-
|
|
65
|
-
&:before,
|
|
66
|
-
&:after {
|
|
67
|
-
content: '';
|
|
68
|
-
display: inline-block;
|
|
69
|
-
width: 1px;
|
|
70
|
-
height: $gantt-bar-handle-height;
|
|
71
|
-
background: $gantt-bar-handle-color;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&::before {
|
|
75
|
-
margin-right: 2px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&:first-child {
|
|
79
|
-
left: 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&:last-child {
|
|
83
|
-
right: 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@mixin active-bar {
|
|
90
|
-
z-index: 1000;
|
|
91
|
-
|
|
92
|
-
.gantt-bar-layer {
|
|
93
|
-
display: block;
|
|
94
|
-
z-index: 1;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.gantt-bar-content {
|
|
98
|
-
z-index: 1;
|
|
99
|
-
box-shadow: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.cdk-drag {
|
|
103
|
-
transition: none;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.gantt-bar {
|
|
108
|
-
position: absolute;
|
|
109
|
-
border-radius: 4px;
|
|
110
|
-
z-index: 2;
|
|
111
|
-
background: $gantt-bar-bg;
|
|
112
|
-
|
|
113
|
-
.gantt-bar-layer {
|
|
114
|
-
width: calc(100% + #{$gantt-bar-layer-append-width});
|
|
115
|
-
height: calc(100% + #{$gantt-bar-layer-append-height});
|
|
116
|
-
position: absolute;
|
|
117
|
-
border-radius: 4px;
|
|
118
|
-
left: $gantt-bar-layer-append-width / 2 * -1;
|
|
119
|
-
top: $gantt-bar-layer-append-height / 2 * -1;
|
|
120
|
-
display: none;
|
|
121
|
-
@include drag-handles();
|
|
122
|
-
@include link-handles();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.gantt-bar-border {
|
|
126
|
-
width: calc(100% + #{$gantt-bar-link-drop-border} * 2);
|
|
127
|
-
height: calc(100% + #{$gantt-bar-link-drop-border} * 2);
|
|
128
|
-
position: absolute;
|
|
129
|
-
border-radius: 4px;
|
|
130
|
-
left: $gantt-bar-link-drop-border * -1;
|
|
131
|
-
top: $gantt-bar-link-drop-border * -1;
|
|
132
|
-
display: none;
|
|
133
|
-
background: #fff;
|
|
134
|
-
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.gantt-bar-content {
|
|
138
|
-
width: 100%;
|
|
139
|
-
height: 100%;
|
|
140
|
-
position: absolute;
|
|
141
|
-
cursor: pointer;
|
|
142
|
-
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
|
143
|
-
border-radius: 4px;
|
|
144
|
-
background: $gantt-bar-background-color;
|
|
145
|
-
overflow: hidden;
|
|
146
|
-
box-sizing: border-box;
|
|
147
|
-
.gantt-bar-content-progress {
|
|
148
|
-
position: absolute;
|
|
149
|
-
left: 0;
|
|
150
|
-
top: 0;
|
|
151
|
-
height: 100%;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
&-active {
|
|
157
|
-
@include active-bar();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
&-link-drop {
|
|
161
|
-
.gantt-bar-border {
|
|
162
|
-
display: block;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.gantt-bar-content {
|
|
166
|
-
box-shadow: none;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
OnInit,
|
|
4
|
-
Input,
|
|
5
|
-
TemplateRef,
|
|
6
|
-
HostBinding,
|
|
7
|
-
ElementRef,
|
|
8
|
-
OnChanges,
|
|
9
|
-
OnDestroy,
|
|
10
|
-
Inject,
|
|
11
|
-
ViewChild,
|
|
12
|
-
Output,
|
|
13
|
-
EventEmitter,
|
|
14
|
-
AfterViewInit
|
|
15
|
-
} from '@angular/core';
|
|
16
|
-
import { takeUntil } from 'rxjs/operators';
|
|
17
|
-
import { GanttBarDrag } from './bar-drag';
|
|
18
|
-
import { hexToRgb } from '../../utils/helpers';
|
|
19
|
-
import { GanttDragContainer } from '../../gantt-drag-container';
|
|
20
|
-
import { barBackground } from '../../gantt.styles';
|
|
21
|
-
import { GanttBarClickEvent } from '../../class';
|
|
22
|
-
import { GANTT_UPPER_TOKEN, GanttUpper } from '../../gantt-upper';
|
|
23
|
-
import { GanttItemUpper } from '../../gantt-item-upper';
|
|
24
|
-
|
|
25
|
-
function linearGradient(sideOrCorner: string, color: string, stop: string) {
|
|
26
|
-
return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@Component({
|
|
30
|
-
selector: 'ngx-gantt-bar,gantt-bar',
|
|
31
|
-
templateUrl: './bar.component.html',
|
|
32
|
-
providers: [GanttBarDrag]
|
|
33
|
-
})
|
|
34
|
-
export class NgxGanttBarComponent extends GanttItemUpper implements OnInit, AfterViewInit, OnChanges, OnDestroy {
|
|
35
|
-
@Output() barClick = new EventEmitter<GanttBarClickEvent>();
|
|
36
|
-
|
|
37
|
-
@ViewChild('content') contentElementRef: ElementRef<HTMLDivElement>;
|
|
38
|
-
|
|
39
|
-
@HostBinding('class.gantt-bar') ganttItemClass = true;
|
|
40
|
-
|
|
41
|
-
color = 'red';
|
|
42
|
-
|
|
43
|
-
constructor(
|
|
44
|
-
private dragContainer: GanttDragContainer,
|
|
45
|
-
private drag: GanttBarDrag,
|
|
46
|
-
elementRef: ElementRef<HTMLDivElement>,
|
|
47
|
-
@Inject(GANTT_UPPER_TOKEN) public ganttUpper: GanttUpper
|
|
48
|
-
) {
|
|
49
|
-
super(elementRef, ganttUpper);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
ngOnInit() {
|
|
53
|
-
super.onInit();
|
|
54
|
-
this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
55
|
-
this.setContentBackground();
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
ngAfterViewInit() {
|
|
60
|
-
this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
|
|
61
|
-
this.setContentBackground();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
ngOnChanges(): void {
|
|
65
|
-
super.onChanges();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
onBarClick(event: Event) {
|
|
69
|
-
this.barClick.emit({ event, item: this.item.origin });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private setContentBackground() {
|
|
73
|
-
const contentElement = this.contentElementRef.nativeElement;
|
|
74
|
-
const color = this.item.color || barBackground;
|
|
75
|
-
const style: Partial<CSSStyleDeclaration> = this.item.barStyle || {};
|
|
76
|
-
if (this.item.origin.start && this.item.origin.end) {
|
|
77
|
-
style.background = color;
|
|
78
|
-
style.borderRadius = '';
|
|
79
|
-
}
|
|
80
|
-
if (this.item.origin.start && !this.item.origin.end) {
|
|
81
|
-
style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
82
|
-
style.borderRadius = '4px 12.5px 12.5px 4px';
|
|
83
|
-
}
|
|
84
|
-
if (!this.item.origin.start && this.item.origin.end) {
|
|
85
|
-
style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
86
|
-
style.borderRadius = '12.5px 4px 4px 12.5px';
|
|
87
|
-
}
|
|
88
|
-
if (this.item.progress >= 0) {
|
|
89
|
-
const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress') as HTMLDivElement;
|
|
90
|
-
style.background = hexToRgb(color, 0.3);
|
|
91
|
-
style.borderRadius = '';
|
|
92
|
-
contentProgressElement.style.background = color;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
for (const key in style) {
|
|
96
|
-
if (style.hasOwnProperty(key)) {
|
|
97
|
-
contentElement.style[key] = style[key];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
stopPropagation(event: Event) {
|
|
103
|
-
event.stopPropagation();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
ngOnDestroy() {
|
|
107
|
-
super.onDestroy();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, DebugElement } from '@angular/core';
|
|
3
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
4
|
-
import { By } from '@angular/platform-browser';
|
|
5
|
-
import { NgxGanttComponent } from '../../../gantt.component';
|
|
6
|
-
import { NgxGanttModule } from '../../../gantt.module';
|
|
7
|
-
import { GanttDate } from '../../../utils/date';
|
|
8
|
-
|
|
9
|
-
const mockBarItems = [
|
|
10
|
-
{
|
|
11
|
-
id: 'item-0101',
|
|
12
|
-
title: 'VERSION 0101',
|
|
13
|
-
start: new GanttDate('2020-05-31 22:34:35').getUnixTime(),
|
|
14
|
-
end: new GanttDate('2020-06-05 08:53:20').getUnixTime(),
|
|
15
|
-
progress: 0.5
|
|
16
|
-
}
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
@Component({
|
|
20
|
-
selector: 'test-gantt-bar',
|
|
21
|
-
template: ` <ngx-gantt #gantt [items]="items" [viewType]="viewType">
|
|
22
|
-
<ngx-gantt-table>
|
|
23
|
-
<ngx-gantt-column name="标题" width="200px">
|
|
24
|
-
<ng-template #cell let-item="item">
|
|
25
|
-
{{ item.title }}
|
|
26
|
-
</ng-template>
|
|
27
|
-
</ngx-gantt-column>
|
|
28
|
-
</ngx-gantt-table>
|
|
29
|
-
</ngx-gantt>`
|
|
30
|
-
})
|
|
31
|
-
export class TestGanttBarComponent {
|
|
32
|
-
constructor() {}
|
|
33
|
-
|
|
34
|
-
viewType = 'month';
|
|
35
|
-
|
|
36
|
-
items = mockBarItems;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
describe('ngx-gantt-bar', () => {
|
|
40
|
-
let fixture: ComponentFixture<TestGanttBarComponent>;
|
|
41
|
-
beforeEach(async () => {
|
|
42
|
-
TestBed.configureTestingModule({
|
|
43
|
-
imports: [CommonModule, NgxGanttModule],
|
|
44
|
-
declarations: [TestGanttBarComponent]
|
|
45
|
-
}).compileComponents();
|
|
46
|
-
fixture = TestBed.createComponent(TestGanttBarComponent);
|
|
47
|
-
fixture.detectChanges();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should has bar progress', () => {
|
|
51
|
-
const barProgress = fixture.debugElement.queryAll(By.css('.gantt-bar-content-progress'));
|
|
52
|
-
expect(barProgress.length).toEqual(1);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, DebugElement, Directive } from '@angular/core';
|
|
3
|
-
import { ComponentFixture, TestBed, fakeAsync, tick, flush } from '@angular/core/testing';
|
|
4
|
-
import { By } from '@angular/platform-browser';
|
|
5
|
-
import { GanttDragEvent, GanttLinkDragEvent } from '../../../class';
|
|
6
|
-
import { NgxGanttComponent } from '../../../gantt.component';
|
|
7
|
-
import { NgxGanttModule } from '../../../gantt.module';
|
|
8
|
-
import { NgxGanttRootComponent } from '../../../root.component';
|
|
9
|
-
import { GanttDate } from '../../../utils/date';
|
|
10
|
-
import { dispatchMouseEvent } from '../../../utils/testing';
|
|
11
|
-
import { NgxGanttBarComponent } from '../bar.component';
|
|
12
|
-
|
|
13
|
-
const activeClass = 'gantt-bar-active';
|
|
14
|
-
|
|
15
|
-
const mockBarItems = [
|
|
16
|
-
{
|
|
17
|
-
id: 'item-0101',
|
|
18
|
-
title: 'VERSION 0101',
|
|
19
|
-
start: new GanttDate('2020-03-31 22:34:35').getUnixTime(),
|
|
20
|
-
end: new GanttDate('2020-06-05 08:53:20').getUnixTime(),
|
|
21
|
-
color: '#FF0000'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: 'item-0203',
|
|
25
|
-
title: 'VERSION 0203',
|
|
26
|
-
start: new GanttDate('2020-04-23 20:07:55').getUnixTime(),
|
|
27
|
-
end: new GanttDate('2020-06-23 00:00:00').getUnixTime(),
|
|
28
|
-
links: ['item-0204']
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: 'item-0204',
|
|
32
|
-
title: 'VERSION 0204',
|
|
33
|
-
start: new GanttDate('2020-06-02 02:21:15').getUnixTime(),
|
|
34
|
-
end: new GanttDate('2020-06-18 02:26:40').getUnixTime(),
|
|
35
|
-
links: ['item-0101']
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
@Component({
|
|
40
|
-
selector: 'test-gantt-bar',
|
|
41
|
-
template: ` <ngx-gantt
|
|
42
|
-
#gantt
|
|
43
|
-
[items]="items"
|
|
44
|
-
[viewType]="viewType"
|
|
45
|
-
[draggable]="draggable"
|
|
46
|
-
[linkable]="linkable"
|
|
47
|
-
(dragEnded)="dragEnded($event)"
|
|
48
|
-
(dragStarted)="dragStarted($event)"
|
|
49
|
-
(linkDragEnded)="linkDragEnded($event)"
|
|
50
|
-
(linkDragStarted)="linkDragStarted($event)"
|
|
51
|
-
>
|
|
52
|
-
<ngx-gantt-table>
|
|
53
|
-
<ngx-gantt-column name="标题" width="200px">
|
|
54
|
-
<ng-template #cell let-item="item">
|
|
55
|
-
{{ item.title }}
|
|
56
|
-
</ng-template>
|
|
57
|
-
</ngx-gantt-column>
|
|
58
|
-
</ngx-gantt-table>
|
|
59
|
-
</ngx-gantt>`
|
|
60
|
-
})
|
|
61
|
-
export class TestGanttBarComponent {
|
|
62
|
-
constructor() {}
|
|
63
|
-
|
|
64
|
-
viewType = 'month';
|
|
65
|
-
|
|
66
|
-
items = mockBarItems;
|
|
67
|
-
|
|
68
|
-
draggable = true;
|
|
69
|
-
|
|
70
|
-
linkable = true;
|
|
71
|
-
|
|
72
|
-
dragEnded(event: GanttDragEvent) {
|
|
73
|
-
console.log(event);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
dragStarted(event: GanttDragEvent) {
|
|
77
|
-
console.log(event);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
linkDragEnded(event: GanttLinkDragEvent) {
|
|
81
|
-
console.log(event);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
linkDragStarted(event: GanttLinkDragEvent) {
|
|
85
|
-
console.log(event);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function dragEvent(fixture: ComponentFixture<TestGanttBarComponent>, dragElement: HTMLElement, barElement?: HTMLElement) {
|
|
90
|
-
const dragMaskElement = fixture.debugElement.query(By.css('.gantt-drag-mask')).nativeElement;
|
|
91
|
-
const dragBackdropElement = fixture.debugElement.query(By.css('.gantt-drag-backdrop')).nativeElement;
|
|
92
|
-
const dragStartSpy = spyOn(fixture.componentInstance, 'dragStarted');
|
|
93
|
-
const dragEndSpy = spyOn(fixture.componentInstance, 'dragEnded');
|
|
94
|
-
barElement = barElement || dragElement;
|
|
95
|
-
|
|
96
|
-
dispatchMouseEvent(dragElement, 'mousedown');
|
|
97
|
-
fixture.detectChanges();
|
|
98
|
-
|
|
99
|
-
dispatchMouseEvent(document, 'mousemove', 50);
|
|
100
|
-
fixture.detectChanges();
|
|
101
|
-
expect(dragStartSpy).toHaveBeenCalledTimes(1);
|
|
102
|
-
expect(barElement.style.getPropertyValue('pointer-events')).toEqual('none');
|
|
103
|
-
expect(barElement.classList).toContain('gantt-bar-draggable-drag');
|
|
104
|
-
|
|
105
|
-
dispatchMouseEvent(document, 'mousemove', 200);
|
|
106
|
-
fixture.detectChanges();
|
|
107
|
-
expect(dragMaskElement.style.getPropertyValue('display')).toEqual('block');
|
|
108
|
-
expect(dragBackdropElement.style.getPropertyValue('display')).toEqual('block');
|
|
109
|
-
|
|
110
|
-
dispatchMouseEvent(document, 'mouseup', 200);
|
|
111
|
-
fixture.detectChanges();
|
|
112
|
-
expect(barElement.style.getPropertyValue('pointer-events')).toEqual('');
|
|
113
|
-
expect(barElement.classList).not.toContain('gantt-bar-draggable-drag');
|
|
114
|
-
expect(dragMaskElement.style.getPropertyValue('display')).toEqual('none');
|
|
115
|
-
expect(dragBackdropElement.style.getPropertyValue('display')).toEqual('none');
|
|
116
|
-
expect(dragEndSpy).toHaveBeenCalledTimes(1);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function linkDragEvent(fixture: ComponentFixture<TestGanttBarComponent>, dragElement: HTMLElement) {
|
|
120
|
-
const root = fixture.debugElement.query(By.directive(NgxGanttRootComponent));
|
|
121
|
-
|
|
122
|
-
dispatchMouseEvent(dragElement, 'mousedown');
|
|
123
|
-
fixture.detectChanges();
|
|
124
|
-
|
|
125
|
-
dispatchMouseEvent(document, 'mousemove', 10, 10);
|
|
126
|
-
fixture.detectChanges();
|
|
127
|
-
|
|
128
|
-
const ganttLinkDragContainer = root.nativeElement.querySelector('.gantt-link-drag-container');
|
|
129
|
-
const linkDraggingLine = root.nativeElement.querySelector('.link-dragging-line');
|
|
130
|
-
expect(ganttLinkDragContainer).toBeTruthy();
|
|
131
|
-
expect(linkDraggingLine).toBeTruthy();
|
|
132
|
-
|
|
133
|
-
dispatchMouseEvent(document, 'mousemove', 200, -30);
|
|
134
|
-
fixture.detectChanges();
|
|
135
|
-
|
|
136
|
-
dispatchMouseEvent(document, 'mouseup', 200, -30);
|
|
137
|
-
fixture.detectChanges();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
describe('bar-drag', () => {
|
|
141
|
-
let fixture: ComponentFixture<TestGanttBarComponent>;
|
|
142
|
-
let ganttComponentInstance: TestGanttBarComponent;
|
|
143
|
-
let ganttDebugElement: DebugElement;
|
|
144
|
-
|
|
145
|
-
beforeEach(async () => {
|
|
146
|
-
TestBed.configureTestingModule({
|
|
147
|
-
imports: [CommonModule, NgxGanttModule],
|
|
148
|
-
declarations: [TestGanttBarComponent]
|
|
149
|
-
}).compileComponents();
|
|
150
|
-
fixture = TestBed.createComponent(TestGanttBarComponent);
|
|
151
|
-
ganttDebugElement = fixture.debugElement.query(By.directive(NgxGanttComponent));
|
|
152
|
-
ganttComponentInstance = fixture.componentInstance;
|
|
153
|
-
fixture.detectChanges();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('should active when mouse enter bar', () => {
|
|
157
|
-
const barElement = fixture.debugElement.query(By.directive(NgxGanttBarComponent)).nativeElement;
|
|
158
|
-
dispatchMouseEvent(barElement, 'mouseenter');
|
|
159
|
-
expect(barElement.classList).toContain(activeClass);
|
|
160
|
-
dispatchMouseEvent(barElement, 'mouseleave');
|
|
161
|
-
expect(barElement.classList).not.toContain(activeClass);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('should bar drag', () => {
|
|
165
|
-
const bar = fixture.debugElement.queryAll(By.directive(NgxGanttBarComponent))[0];
|
|
166
|
-
dragEvent(fixture, bar.nativeElement);
|
|
167
|
-
expect(bar.componentInstance.item.start.getUnixTime()).toEqual(new GanttDate('2020-04-21 00:00:00').getUnixTime());
|
|
168
|
-
expect(bar.componentInstance.item.end.getUnixTime()).toEqual(new GanttDate('2020-06-26 23:59:59').getUnixTime());
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('should first bar handle drag', () => {
|
|
172
|
-
const bar = fixture.debugElement.queryAll(By.directive(NgxGanttBarComponent))[1];
|
|
173
|
-
const firstHandleElement = bar.queryAll(By.css('.drag-handles .handle'))[0].nativeElement;
|
|
174
|
-
dragEvent(fixture, firstHandleElement, bar.nativeElement);
|
|
175
|
-
expect(bar.componentInstance.item.start.getUnixTime()).toEqual(new GanttDate('2020-05-14 00:00:00').getUnixTime());
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('should last bar handles drag', () => {
|
|
179
|
-
const bar = fixture.debugElement.queryAll(By.directive(NgxGanttBarComponent))[1];
|
|
180
|
-
const lastHandleElement = bar.queryAll(By.css('.drag-handles .handle'))[1].nativeElement;
|
|
181
|
-
dragEvent(fixture, lastHandleElement, bar.nativeElement);
|
|
182
|
-
expect(bar.componentInstance.item.end.getUnixTime()).toEqual(new GanttDate('2020-07-15 23:59:59').getUnixTime());
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it('should first bar link handle drag', () => {
|
|
186
|
-
const bar = fixture.debugElement.queryAll(By.directive(NgxGanttBarComponent))[2];
|
|
187
|
-
const firstHandleElement = bar.queryAll(By.css('.link-handles .handle'))[0].nativeElement;
|
|
188
|
-
linkDragEvent(fixture, firstHandleElement);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it('should last bar link handles drag', () => {
|
|
192
|
-
const bar = fixture.debugElement.queryAll(By.directive(NgxGanttBarComponent))[2];
|
|
193
|
-
const lastHandleElement = bar.queryAll(By.css('.link-handles .handle'))[1].nativeElement;
|
|
194
|
-
linkDragEvent(fixture, lastHandleElement);
|
|
195
|
-
});
|
|
196
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<div class="gantt-calendar-today-overlay" [style.width.px]="view.width">
|
|
2
|
-
<span class="today-rect" [hidden]="ganttUpper.viewType !== viewTypes.day"> </span>
|
|
3
|
-
<span class="today-line" *ngIf="ganttUpper.showTodayLine"> </span>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<svg class="gantt-calendar-overlay-main" [attr.width]="view.width" [attr.height]="headerHeight">
|
|
7
|
-
<g>
|
|
8
|
-
<text class="primary-text" *ngFor="let point of view.primaryDatePoints; trackBy: trackBy" [attr.x]="point.x" [attr.y]="point.y">
|
|
9
|
-
{{ point.text }}
|
|
10
|
-
</text>
|
|
11
|
-
<ng-container *ngFor="let point of view.secondaryDatePoints; trackBy: trackBy">
|
|
12
|
-
<text class="secondary-text" [class.secondary-text-weekend]="point.additions?.isWeekend" [attr.x]="point.x" [attr.y]="point.y">
|
|
13
|
-
{{ point.text }}
|
|
14
|
-
</text>
|
|
15
|
-
</ng-container>
|
|
16
|
-
|
|
17
|
-
<g>
|
|
18
|
-
<line
|
|
19
|
-
*ngFor="let point of view.primaryDatePoints; let i = index; trackBy: trackBy"
|
|
20
|
-
[attr.x1]="(i + 1) * view.primaryWidth"
|
|
21
|
-
[attr.x2]="(i + 1) * view.primaryWidth"
|
|
22
|
-
[attr.y1]="0"
|
|
23
|
-
[attr.y2]="mainHeight"
|
|
24
|
-
class="primary-line"
|
|
25
|
-
></line>
|
|
26
|
-
</g>
|
|
27
|
-
|
|
28
|
-
<g>
|
|
29
|
-
<line [attr.x1]="0" [attr.x2]="view.width" [attr.y1]="headerHeight" [attr.y2]="headerHeight" class="header-line"></line>
|
|
30
|
-
</g>
|
|
31
|
-
</g>
|
|
32
|
-
<g>
|
|
33
|
-
<g *ngIf="view.showTimeline">
|
|
34
|
-
<line
|
|
35
|
-
*ngFor="let point of view.secondaryDatePoints; let i = index; trackBy: trackBy"
|
|
36
|
-
[attr.x1]="(i + 1) * view.cellWidth"
|
|
37
|
-
[attr.x2]="(i + 1) * view.cellWidth"
|
|
38
|
-
[attr.y1]="headerHeight"
|
|
39
|
-
[attr.y2]="mainHeight"
|
|
40
|
-
class="secondary-line"
|
|
41
|
-
></line>
|
|
42
|
-
<line
|
|
43
|
-
*ngFor="let point of view.primaryDatePoints; let i = index; trackBy: trackBy"
|
|
44
|
-
[attr.x1]="(i + 1) * view.primaryWidth"
|
|
45
|
-
[attr.x2]="(i + 1) * view.primaryWidth"
|
|
46
|
-
[attr.y1]="0"
|
|
47
|
-
[attr.y2]="mainHeight"
|
|
48
|
-
class="primary-line"
|
|
49
|
-
></line>
|
|
50
|
-
</g>
|
|
51
|
-
</g>
|
|
52
|
-
</svg>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
.gantt-calendar-overlay {
|
|
2
|
-
display: block;
|
|
3
|
-
height: 100%;
|
|
4
|
-
overflow: hidden;
|
|
5
|
-
|
|
6
|
-
.gantt-calendar-today-overlay {
|
|
7
|
-
position: relative;
|
|
8
|
-
z-index: 2;
|
|
9
|
-
.today-rect {
|
|
10
|
-
width: 35px;
|
|
11
|
-
height: 24px;
|
|
12
|
-
position: absolute;
|
|
13
|
-
background: $gantt-date-today-color;
|
|
14
|
-
color: $gantt-date-today-text-color;
|
|
15
|
-
text-align: center;
|
|
16
|
-
border-radius: 4px;
|
|
17
|
-
}
|
|
18
|
-
.today-line {
|
|
19
|
-
position: absolute;
|
|
20
|
-
width: 3px;
|
|
21
|
-
background: $gantt-date-today-color;
|
|
22
|
-
transform: scaleX(0.5);
|
|
23
|
-
transform-origin: 100% 0;
|
|
24
|
-
margin-left: -2px;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.gantt-calendar-overlay-main {
|
|
29
|
-
position: relative;
|
|
30
|
-
z-index: 1;
|
|
31
|
-
background-color: $gantt-bg-color;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
svg {
|
|
35
|
-
overflow: visible;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
line {
|
|
39
|
-
shape-rendering: crispEdges;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.primary-text {
|
|
43
|
-
fill: $gantt-date-primary-color;
|
|
44
|
-
font-size: $gantt-date-primary-font-size;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.secondary-text {
|
|
48
|
-
fill: $gantt-date-secondary-color;
|
|
49
|
-
font-size: $gantt-date-secondary-font-size;
|
|
50
|
-
|
|
51
|
-
&-weekend {
|
|
52
|
-
fill: $gantt-date-secondary-weekend-color;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.primary-text,
|
|
57
|
-
.secondary-text {
|
|
58
|
-
text-anchor: middle;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.primary-line {
|
|
62
|
-
stroke: $gantt-date-primary-border;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.secondary-line {
|
|
66
|
-
stroke-dasharray: 2px 5px;
|
|
67
|
-
stroke: #cacaca;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.header-line {
|
|
71
|
-
stroke: $gantt-border-color;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.secondary-backdrop {
|
|
75
|
-
fill: $gantt-date-week-backdrop-bg;
|
|
76
|
-
}
|
|
77
|
-
}
|