tltv-gantt-element 1.0.7 → 1.0.8
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.
|
@@ -13,7 +13,7 @@ export declare class GanttStepElement extends GanttSubStepsBase {
|
|
|
13
13
|
private recalculateLeft;
|
|
14
14
|
private recalculateWidth;
|
|
15
15
|
refresh(): void;
|
|
16
|
-
getGanttElement(): GanttElement
|
|
16
|
+
getGanttElement(): Promise<GanttElement>;
|
|
17
17
|
private _handleTouchStart;
|
|
18
18
|
private _handleMouseDown;
|
|
19
19
|
}
|
|
@@ -38,12 +38,24 @@ let GanttStepElement = class GanttStepElement extends GanttSubStepsBase {
|
|
|
38
38
|
cursor: e-resize;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
.step-label {
|
|
42
|
+
text-overflow: ellipsis;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
margin: 3px;
|
|
46
|
+
}
|
|
41
47
|
:host(.has-sub-steps:hover) > .step-label {
|
|
42
48
|
width: 100%;
|
|
43
49
|
background-color: rgba(246, 255, 99, 0.3);
|
|
44
50
|
border-radius: 6px;
|
|
45
51
|
transform: translate(0,-22px);
|
|
46
52
|
}
|
|
53
|
+
:host(.has-sub-steps:first-child:hover) {
|
|
54
|
+
z-index: 2;
|
|
55
|
+
}
|
|
56
|
+
:host(.has-sub-steps:first-child:hover) > .step-label {
|
|
57
|
+
transform: translate(0, 22px);
|
|
58
|
+
}
|
|
47
59
|
:host(.has-sub-steps:hover) > .step-label:hover {
|
|
48
60
|
cursor: move;
|
|
49
61
|
}
|
|
@@ -54,12 +66,6 @@ let GanttStepElement = class GanttStepElement extends GanttSubStepsBase {
|
|
|
54
66
|
position: absolute;
|
|
55
67
|
max-width: 100%;
|
|
56
68
|
}
|
|
57
|
-
.step-label {
|
|
58
|
-
text-overflow: ellipsis;
|
|
59
|
-
white-space: nowrap;
|
|
60
|
-
overflow: hidden;
|
|
61
|
-
margin: 3px;
|
|
62
|
-
}
|
|
63
69
|
|
|
64
70
|
:host(.step.invalid) {
|
|
65
71
|
visibility: hidden;
|
|
@@ -117,7 +123,7 @@ let GanttStepElement = class GanttStepElement extends GanttSubStepsBase {
|
|
|
117
123
|
this.uid = (this.substep) ? `${this.owner.uid}-${this.position}` : `${this.position}`;
|
|
118
124
|
}
|
|
119
125
|
recalculateLeft() {
|
|
120
|
-
this.getGanttElement().getTimeline()
|
|
126
|
+
this.getGanttElement().then(gantt => gantt.getTimeline()
|
|
121
127
|
.then(timeline => {
|
|
122
128
|
if (this.substep) {
|
|
123
129
|
this.calculateSubStepLeft(timeline).then(newLeft => {
|
|
@@ -126,14 +132,14 @@ let GanttStepElement = class GanttStepElement extends GanttSubStepsBase {
|
|
|
126
132
|
});
|
|
127
133
|
}
|
|
128
134
|
else {
|
|
129
|
-
this.stepLeft = timeline.getLeftPositionPercentageStringForDate(this.start,
|
|
135
|
+
this.stepLeft = timeline.getLeftPositionPercentageStringForDate(this.start, gantt.getContentWidth());
|
|
130
136
|
this._substeps.forEach(substep => substep.refresh());
|
|
131
137
|
this.updateLeft();
|
|
132
138
|
}
|
|
133
|
-
});
|
|
139
|
+
}));
|
|
134
140
|
}
|
|
135
141
|
recalculateWidth() {
|
|
136
|
-
this.getGanttElement().getTimeline()
|
|
142
|
+
this.getGanttElement().then(gantt => gantt.getTimeline()
|
|
137
143
|
.then(timeline => {
|
|
138
144
|
if (this.substep) {
|
|
139
145
|
this.calculateSubStepWidth(timeline).then(newWidth => {
|
|
@@ -146,23 +152,32 @@ let GanttStepElement = class GanttStepElement extends GanttSubStepsBase {
|
|
|
146
152
|
this._substeps.forEach(substep => substep.refresh());
|
|
147
153
|
this.updateWidth();
|
|
148
154
|
}
|
|
149
|
-
});
|
|
155
|
+
}));
|
|
150
156
|
}
|
|
151
157
|
refresh() {
|
|
152
158
|
this.recalculateLeft();
|
|
153
159
|
this.recalculateWidth();
|
|
154
160
|
}
|
|
155
|
-
getGanttElement() {
|
|
161
|
+
async getGanttElement() {
|
|
162
|
+
let getEl = () => this.parentElement;
|
|
156
163
|
if (this.substep) {
|
|
157
|
-
|
|
164
|
+
getEl = () => this.parentElement.parentElement;
|
|
158
165
|
}
|
|
159
|
-
|
|
166
|
+
let test = () => {
|
|
167
|
+
let el = getEl();
|
|
168
|
+
return el && el.isConnected && el.getTimeline;
|
|
169
|
+
};
|
|
170
|
+
let continueWhenGanttReady = function (resolve, isReady, notReady) {
|
|
171
|
+
requestAnimationFrame(() => (isReady()) ? resolve() : notReady(resolve, isReady, notReady));
|
|
172
|
+
};
|
|
173
|
+
await new Promise((resolve) => requestAnimationFrame(() => continueWhenGanttReady(resolve, test, continueWhenGanttReady)));
|
|
174
|
+
return getEl();
|
|
160
175
|
}
|
|
161
176
|
_handleTouchStart(event) {
|
|
162
|
-
this.getGanttElement().handleTouchStart(event);
|
|
177
|
+
this.getGanttElement().then(gantt => gantt.handleTouchStart(event));
|
|
163
178
|
}
|
|
164
179
|
_handleMouseDown(event) {
|
|
165
|
-
this.getGanttElement().handleMouseDown(event);
|
|
180
|
+
this.getGanttElement().then(gantt => gantt.handleMouseDown(event));
|
|
166
181
|
}
|
|
167
182
|
};
|
|
168
183
|
GanttStepElement.RESIZE_WIDTH = 10;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-step-element.js","sourceRoot":"","sources":["../../src/gantt-step-element.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAc,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAY,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"gantt-step-element.js","sourceRoot":"","sources":["../../src/gantt-step-element.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,E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KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IACvE,CAAC;CAEJ,CAAA;AAxLU,6BAAY,GAAW,EAAE,CAAA;AAFvB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA0L5B;SA1LY,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -35,12 +35,24 @@ export class GanttStepElement extends GanttSubStepsBase {
|
|
|
35
35
|
cursor: e-resize;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
.step-label {
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
margin: 3px;
|
|
43
|
+
}
|
|
38
44
|
:host(.has-sub-steps:hover) > .step-label {
|
|
39
45
|
width: 100%;
|
|
40
46
|
background-color: rgba(246, 255, 99, 0.3);
|
|
41
47
|
border-radius: 6px;
|
|
42
48
|
transform: translate(0,-22px);
|
|
43
49
|
}
|
|
50
|
+
:host(.has-sub-steps:first-child:hover) {
|
|
51
|
+
z-index: 2;
|
|
52
|
+
}
|
|
53
|
+
:host(.has-sub-steps:first-child:hover) > .step-label {
|
|
54
|
+
transform: translate(0, 22px);
|
|
55
|
+
}
|
|
44
56
|
:host(.has-sub-steps:hover) > .step-label:hover {
|
|
45
57
|
cursor: move;
|
|
46
58
|
}
|
|
@@ -51,12 +63,6 @@ export class GanttStepElement extends GanttSubStepsBase {
|
|
|
51
63
|
position: absolute;
|
|
52
64
|
max-width: 100%;
|
|
53
65
|
}
|
|
54
|
-
.step-label {
|
|
55
|
-
text-overflow: ellipsis;
|
|
56
|
-
white-space: nowrap;
|
|
57
|
-
overflow: hidden;
|
|
58
|
-
margin: 3px;
|
|
59
|
-
}
|
|
60
66
|
|
|
61
67
|
:host(.step.invalid) {
|
|
62
68
|
visibility: hidden;
|
|
@@ -123,7 +129,7 @@ export class GanttStepElement extends GanttSubStepsBase {
|
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
private recalculateLeft() {
|
|
126
|
-
this.getGanttElement().getTimeline()
|
|
132
|
+
this.getGanttElement().then(gantt => gantt.getTimeline()
|
|
127
133
|
.then(timeline => {
|
|
128
134
|
if (this.substep) {
|
|
129
135
|
this.calculateSubStepLeft(timeline).then(newLeft => {
|
|
@@ -131,15 +137,15 @@ export class GanttStepElement extends GanttSubStepsBase {
|
|
|
131
137
|
this.updateLeft();
|
|
132
138
|
});
|
|
133
139
|
} else {
|
|
134
|
-
this.stepLeft = timeline.getLeftPositionPercentageStringForDate(this.start,
|
|
140
|
+
this.stepLeft = timeline.getLeftPositionPercentageStringForDate(this.start, gantt.getContentWidth());
|
|
135
141
|
this._substeps.forEach(substep => substep.refresh());
|
|
136
142
|
this.updateLeft();
|
|
137
143
|
}
|
|
138
|
-
});
|
|
144
|
+
}));
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
private recalculateWidth() {
|
|
142
|
-
this.getGanttElement().getTimeline()
|
|
148
|
+
this.getGanttElement().then(gantt => gantt.getTimeline()
|
|
143
149
|
.then(timeline => {
|
|
144
150
|
if (this.substep) {
|
|
145
151
|
this.calculateSubStepWidth(timeline).then(newWidth => {
|
|
@@ -152,7 +158,7 @@ export class GanttStepElement extends GanttSubStepsBase {
|
|
|
152
158
|
this.updateWidth();
|
|
153
159
|
}
|
|
154
160
|
|
|
155
|
-
});
|
|
161
|
+
}));
|
|
156
162
|
}
|
|
157
163
|
|
|
158
164
|
public refresh() {
|
|
@@ -160,19 +166,28 @@ export class GanttStepElement extends GanttSubStepsBase {
|
|
|
160
166
|
this.recalculateWidth();
|
|
161
167
|
}
|
|
162
168
|
|
|
163
|
-
public getGanttElement(): GanttElement {
|
|
169
|
+
public async getGanttElement(): Promise<GanttElement> {
|
|
170
|
+
let getEl = () => <GanttElement>this.parentElement;
|
|
164
171
|
if (this.substep) {
|
|
165
|
-
|
|
172
|
+
getEl = () => <GanttElement>this.parentElement.parentElement;
|
|
173
|
+
}
|
|
174
|
+
let test = () => {
|
|
175
|
+
let el = getEl();
|
|
176
|
+
return el && el.isConnected && el.getTimeline;
|
|
177
|
+
};
|
|
178
|
+
let continueWhenGanttReady = function (resolve: any, isReady: Function, notReady: Function) {
|
|
179
|
+
requestAnimationFrame(() => (isReady()) ? resolve() : notReady(resolve, isReady, notReady));
|
|
166
180
|
}
|
|
167
|
-
|
|
181
|
+
await new Promise((resolve) => requestAnimationFrame(() => continueWhenGanttReady(resolve, test, continueWhenGanttReady)));
|
|
182
|
+
return getEl();
|
|
168
183
|
}
|
|
169
184
|
|
|
170
185
|
private _handleTouchStart(event: TouchEvent) {
|
|
171
|
-
this.getGanttElement().handleTouchStart(event);
|
|
186
|
+
this.getGanttElement().then(gantt => gantt.handleTouchStart(event));
|
|
172
187
|
}
|
|
173
188
|
|
|
174
189
|
private _handleMouseDown(event: MouseEvent) {
|
|
175
|
-
this.getGanttElement().handleMouseDown(event);
|
|
190
|
+
this.getGanttElement().then(gantt => gantt.handleMouseDown(event));
|
|
176
191
|
}
|
|
177
192
|
|
|
178
193
|
}
|