@worktile/gantt 12.2.0-next.1 → 12.2.0
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/bundles/worktile-gantt.umd.js +175 -145
- package/bundles/worktile-gantt.umd.js.map +1 -1
- package/class/event.d.ts +2 -0
- package/class/index.d.ts +1 -0
- package/class/item.d.ts +1 -1
- package/class/link.d.ts +5 -5
- package/components/links/{paths → lines}/curve.d.ts +2 -3
- package/components/links/lines/factory.d.ts +5 -0
- package/components/links/{paths/path.d.ts → lines/line.d.ts} +1 -4
- package/components/links/{paths/line.d.ts → lines/straight.d.ts} +2 -2
- package/components/links/links.component.d.ts +1 -1
- package/esm2015/class/event.js +1 -1
- package/esm2015/class/index.js +2 -1
- package/esm2015/class/item.js +4 -3
- package/esm2015/class/link.js +6 -6
- package/esm2015/components/bar/bar-drag.js +35 -12
- package/esm2015/components/bar/bar.component.js +1 -1
- package/esm2015/components/links/lines/curve.js +96 -0
- package/esm2015/components/links/lines/factory.js +14 -0
- package/esm2015/components/links/lines/line.js +24 -0
- package/esm2015/components/links/lines/straight.js +58 -0
- package/esm2015/components/links/links.component.js +4 -4
- package/esm2015/gantt-drag-container.js +55 -38
- package/esm2015/gantt-upper.js +10 -2
- package/esm2015/gantt.component.js +7 -11
- package/esm2015/gantt.config.js +3 -3
- package/fesm2015/worktile-gantt.js +136 -124
- package/fesm2015/worktile-gantt.js.map +1 -1
- package/gantt-drag-container.d.ts +20 -8
- package/gantt-upper.d.ts +5 -3
- package/gantt.component.d.ts +1 -3
- package/gantt.config.d.ts +2 -2
- package/main.bundle.scss +31 -1
- package/package.json +1 -1
- package/components/links/paths/factory.d.ts +0 -5
- package/esm2015/components/links/paths/curve.js +0 -118
- package/esm2015/components/links/paths/factory.js +0 -14
- package/esm2015/components/links/paths/line.js +0 -59
- package/esm2015/components/links/paths/path.js +0 -31
|
@@ -212,11 +212,11 @@ var GanttLinkType;
|
|
|
212
212
|
GanttLinkType[GanttLinkType["ss"] = 3] = "ss";
|
|
213
213
|
GanttLinkType[GanttLinkType["sf"] = 4] = "sf";
|
|
214
214
|
})(GanttLinkType || (GanttLinkType = {}));
|
|
215
|
-
var
|
|
216
|
-
(function (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
})(
|
|
215
|
+
var GanttLinkLineType;
|
|
216
|
+
(function (GanttLinkLineType) {
|
|
217
|
+
GanttLinkLineType["curve"] = "curve";
|
|
218
|
+
GanttLinkLineType["straight"] = "straight";
|
|
219
|
+
})(GanttLinkLineType || (GanttLinkLineType = {}));
|
|
220
220
|
var LinkColors;
|
|
221
221
|
(function (LinkColors) {
|
|
222
222
|
LinkColors["default"] = "#cacaca";
|
|
@@ -303,8 +303,9 @@ class GanttItemInternal {
|
|
|
303
303
|
this.expanded = expanded;
|
|
304
304
|
this.origin.expanded = expanded;
|
|
305
305
|
}
|
|
306
|
-
addLink(
|
|
307
|
-
|
|
306
|
+
addLink(link) {
|
|
307
|
+
console.log(link);
|
|
308
|
+
this.links = [...this.links, link];
|
|
308
309
|
this.origin.links = this.links;
|
|
309
310
|
}
|
|
310
311
|
}
|
|
@@ -338,7 +339,7 @@ const defaultConfig = {
|
|
|
338
339
|
linkOptions: {
|
|
339
340
|
dependencyTypes: [GanttLinkType.fs],
|
|
340
341
|
showArrow: false,
|
|
341
|
-
|
|
342
|
+
lineType: GanttLinkLineType.curve
|
|
342
343
|
}
|
|
343
344
|
};
|
|
344
345
|
const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
|
|
@@ -812,6 +813,12 @@ class GanttUpper {
|
|
|
812
813
|
this._multiple = false;
|
|
813
814
|
this.ganttClass = true;
|
|
814
815
|
}
|
|
816
|
+
set linkOptions(options) {
|
|
817
|
+
this._linkOptions = options;
|
|
818
|
+
}
|
|
819
|
+
get linkOptions() {
|
|
820
|
+
return Object.assign({}, defaultConfig.linkOptions, this.config.linkOptions, this._linkOptions);
|
|
821
|
+
}
|
|
815
822
|
set selectable(value) {
|
|
816
823
|
var _a;
|
|
817
824
|
this._selectable = coerceBooleanProperty(value);
|
|
@@ -1033,7 +1040,7 @@ class GanttUpper {
|
|
|
1033
1040
|
}
|
|
1034
1041
|
}
|
|
1035
1042
|
GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1036
|
-
GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], ngImport: i0 });
|
|
1043
|
+
GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], ngImport: i0 });
|
|
1037
1044
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttUpper, decorators: [{
|
|
1038
1045
|
type: Directive
|
|
1039
1046
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
@@ -1059,6 +1066,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
|
|
|
1059
1066
|
type: Input
|
|
1060
1067
|
}], viewOptions: [{
|
|
1061
1068
|
type: Input
|
|
1069
|
+
}], linkOptions: [{
|
|
1070
|
+
type: Input
|
|
1062
1071
|
}], disabledLoadOnScroll: [{
|
|
1063
1072
|
type: Input
|
|
1064
1073
|
}], selectable: [{
|
|
@@ -1567,63 +1576,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
|
|
|
1567
1576
|
type: Injectable
|
|
1568
1577
|
}], ctorParameters: function () { return []; } });
|
|
1569
1578
|
|
|
1579
|
+
function getDependencyType(path, dependencyTypes) {
|
|
1580
|
+
if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
|
|
1581
|
+
return GanttLinkType.ss;
|
|
1582
|
+
}
|
|
1583
|
+
if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
|
|
1584
|
+
return GanttLinkType.ff;
|
|
1585
|
+
}
|
|
1586
|
+
if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
|
|
1587
|
+
return GanttLinkType.sf;
|
|
1588
|
+
}
|
|
1589
|
+
return GanttLinkType.fs;
|
|
1590
|
+
}
|
|
1591
|
+
var InBarPosition;
|
|
1592
|
+
(function (InBarPosition) {
|
|
1593
|
+
InBarPosition["start"] = "start";
|
|
1594
|
+
InBarPosition["finish"] = "finish";
|
|
1595
|
+
})(InBarPosition || (InBarPosition = {}));
|
|
1570
1596
|
class GanttDragContainer {
|
|
1571
|
-
constructor() {
|
|
1597
|
+
constructor(ganttUpper) {
|
|
1598
|
+
this.ganttUpper = ganttUpper;
|
|
1572
1599
|
this.dragStarted = new EventEmitter();
|
|
1573
1600
|
this.dragMoved = new EventEmitter();
|
|
1574
1601
|
this.dragEnded = new EventEmitter();
|
|
1575
1602
|
this.linkDragStarted = new EventEmitter();
|
|
1576
1603
|
this.linkDragEntered = new EventEmitter();
|
|
1577
1604
|
this.linkDragEnded = new EventEmitter();
|
|
1605
|
+
this.linkDragPath = { from: null, to: null };
|
|
1578
1606
|
}
|
|
1579
|
-
emitLinkDragStarted(from
|
|
1580
|
-
this.linkDraggingId = item.id;
|
|
1581
|
-
this.
|
|
1582
|
-
this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
|
|
1583
|
-
this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
|
|
1607
|
+
emitLinkDragStarted(from) {
|
|
1608
|
+
this.linkDraggingId = from.item.id;
|
|
1609
|
+
this.linkDragPath.from = from;
|
|
1584
1610
|
this.linkDragStarted.emit({
|
|
1585
|
-
source:
|
|
1586
|
-
target:
|
|
1611
|
+
source: from.item.origin,
|
|
1612
|
+
target: null
|
|
1587
1613
|
});
|
|
1588
1614
|
}
|
|
1589
|
-
emitLinkDragEntered(
|
|
1590
|
-
|
|
1591
|
-
this.linkDragTarget = item;
|
|
1592
|
-
}
|
|
1593
|
-
else {
|
|
1594
|
-
this.linkDragSource = item;
|
|
1595
|
-
}
|
|
1615
|
+
emitLinkDragEntered(to) {
|
|
1616
|
+
this.linkDragPath.to = to;
|
|
1596
1617
|
this.linkDragEntered.emit({
|
|
1597
|
-
source: this.
|
|
1598
|
-
target:
|
|
1618
|
+
source: this.linkDragPath.from.item.origin,
|
|
1619
|
+
target: to.item.origin
|
|
1599
1620
|
});
|
|
1600
1621
|
}
|
|
1601
1622
|
emitLinkDragLeaved() {
|
|
1602
|
-
|
|
1603
|
-
this.linkDragTarget = null;
|
|
1604
|
-
}
|
|
1605
|
-
else {
|
|
1606
|
-
this.linkDragSource = null;
|
|
1607
|
-
}
|
|
1623
|
+
this.linkDragPath.to = null;
|
|
1608
1624
|
}
|
|
1609
|
-
emitLinkDragEnded() {
|
|
1625
|
+
emitLinkDragEnded(to) {
|
|
1626
|
+
var _a;
|
|
1627
|
+
this.linkDragPath.to = to;
|
|
1628
|
+
const dependencyType = getDependencyType(this.linkDragPath, (_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes);
|
|
1629
|
+
this.linkDragPath.from.item.addLink({
|
|
1630
|
+
link: this.linkDragPath.to.item.id,
|
|
1631
|
+
type: dependencyType
|
|
1632
|
+
});
|
|
1633
|
+
this.linkDragEnded.emit({
|
|
1634
|
+
source: this.linkDragPath.from.item.origin,
|
|
1635
|
+
target: this.linkDragPath.to.item.origin,
|
|
1636
|
+
type: dependencyType
|
|
1637
|
+
});
|
|
1610
1638
|
this.linkDraggingId = null;
|
|
1611
|
-
|
|
1612
|
-
this.linkDragSource.addLink(this.linkDragTarget.id);
|
|
1613
|
-
this.linkDragEnded.emit({
|
|
1614
|
-
source: this.linkDragSource.origin,
|
|
1615
|
-
target: this.linkDragTarget.origin
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
|
-
this.linkDragSource = null;
|
|
1619
|
-
this.linkDragTarget = null;
|
|
1639
|
+
this.linkDragPath = { from: null, to: null };
|
|
1620
1640
|
}
|
|
1621
1641
|
}
|
|
1622
|
-
GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1642
|
+
GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1623
1643
|
GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer });
|
|
1624
1644
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, decorators: [{
|
|
1625
1645
|
type: Injectable
|
|
1626
|
-
}], ctorParameters: function () { return [
|
|
1646
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
1647
|
+
type: Inject,
|
|
1648
|
+
args: [GANTT_UPPER_TOKEN]
|
|
1649
|
+
}] }]; } });
|
|
1627
1650
|
|
|
1628
1651
|
class GanttPrintService {
|
|
1629
1652
|
constructor() { }
|
|
@@ -1919,7 +1942,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
|
|
|
1919
1942
|
args: ['mainTemplate', { static: true }]
|
|
1920
1943
|
}] } });
|
|
1921
1944
|
|
|
1922
|
-
class
|
|
1945
|
+
class GanttLinkLine {
|
|
1923
1946
|
constructor() { }
|
|
1924
1947
|
generatePath(source, target, type) {
|
|
1925
1948
|
if (source.before && source.after && target.before && target.after) {
|
|
@@ -1941,17 +1964,11 @@ class GanttLinkPath {
|
|
|
1941
1964
|
}
|
|
1942
1965
|
}
|
|
1943
1966
|
}
|
|
1944
|
-
GanttLinkPath.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinkPath, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1945
|
-
GanttLinkPath.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinkPath });
|
|
1946
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinkPath, decorators: [{
|
|
1947
|
-
type: Injectable
|
|
1948
|
-
}], ctorParameters: function () { return []; } });
|
|
1949
1967
|
|
|
1950
|
-
let
|
|
1968
|
+
let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
|
|
1951
1969
|
constructor(ganttUpper) {
|
|
1952
1970
|
super();
|
|
1953
1971
|
this.ganttUpper = ganttUpper;
|
|
1954
|
-
this.bezierWeight = -0.5;
|
|
1955
1972
|
}
|
|
1956
1973
|
generateSSPath(source, target) {
|
|
1957
1974
|
const x1 = source.before.x;
|
|
@@ -1990,76 +2007,55 @@ let GanttLinkPathCurve = class GanttLinkPathCurve extends GanttLinkPath {
|
|
|
1990
2007
|
}
|
|
1991
2008
|
}
|
|
1992
2009
|
generateFSAndSFPath(source, target, type) {
|
|
2010
|
+
var _a;
|
|
1993
2011
|
let x1 = source.after.x;
|
|
1994
2012
|
let y1 = source.after.y;
|
|
1995
2013
|
let x4 = target.before.x;
|
|
1996
2014
|
let y4 = target.before.y;
|
|
2015
|
+
const bezierWeight = 0.5;
|
|
1997
2016
|
if (type === GanttLinkType.sf) {
|
|
1998
2017
|
x1 = target.after.x;
|
|
1999
2018
|
y1 = target.after.y;
|
|
2000
2019
|
x4 = source.before.x;
|
|
2001
2020
|
y4 = source.before.y;
|
|
2002
2021
|
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2022
|
+
let dx = Math.abs(x4 - x1) * bezierWeight;
|
|
2023
|
+
let x2 = x1 + dx;
|
|
2024
|
+
let x3 = x4 - dx;
|
|
2006
2025
|
const centerX = (x1 + x4) / 2;
|
|
2007
2026
|
const centerY = (y1 + y4) / 2;
|
|
2008
2027
|
let controlX = this.ganttUpper.styles.lineHeight / 2;
|
|
2009
2028
|
const controlY = this.ganttUpper.styles.lineHeight / 2;
|
|
2010
2029
|
if (x1 >= x4) {
|
|
2011
|
-
if (y4
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
C ${x4 - controlY} ${y4 - controlY} ${x4 - controlX} ${y4} ${x4} ${y4}`;
|
|
2017
|
-
}
|
|
2018
|
-
else {
|
|
2019
|
-
controlX = this.ganttUpper.styles.lineHeight;
|
|
2020
|
-
return `M ${x1} ${y1}
|
|
2021
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${centerX} ${centerY}
|
|
2022
|
-
C ${x4 - controlX} ${y4 - controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
|
|
2030
|
+
if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
|
|
2031
|
+
return `M ${x1} ${y1}
|
|
2032
|
+
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
|
|
2033
|
+
L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
|
|
2034
|
+
C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
|
|
2023
2035
|
`;
|
|
2024
|
-
}
|
|
2025
2036
|
}
|
|
2026
2037
|
else {
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${
|
|
2030
|
-
|
|
2031
|
-
C ${x4 - controlY} ${y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
|
|
2038
|
+
controlX = this.ganttUpper.styles.lineHeight;
|
|
2039
|
+
return `M ${x1} ${y1}
|
|
2040
|
+
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
|
|
2041
|
+
C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
|
|
2032
2042
|
`;
|
|
2033
|
-
}
|
|
2034
|
-
else {
|
|
2035
|
-
controlX = this.ganttUpper.styles.lineHeight;
|
|
2036
|
-
return `M ${x1} ${y1}
|
|
2037
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${centerX} ${centerY}
|
|
2038
|
-
C ${x4 - controlX} ${y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
|
|
2039
|
-
`;
|
|
2040
|
-
}
|
|
2041
2043
|
}
|
|
2042
2044
|
}
|
|
2043
|
-
else if (x4 - x1 <
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
return `M ${x1} ${y1}
|
|
2048
|
-
L ${x1 + lindWidth} ${y1}
|
|
2049
|
-
A ${radius} ${radius} 0 1 ${y4 > y1 ? 1 : 0} ${x1 + lindWidth} ${y4 > y1 ? y1 + 2 * radius : y1 - 2 * radius}
|
|
2050
|
-
L ${x4 - lindWidth} ${y4 > y1 ? y1 + 2 * radius : y1 - 2 * radius}
|
|
2051
|
-
A ${radius} ${radius} 0 1 ${y4 > y1 ? 0 : 1} ${x4 - lindWidth} ${y4}
|
|
2052
|
-
L ${x4} ${y4}
|
|
2053
|
-
`;
|
|
2045
|
+
else if (((_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.showArrow) && x4 - x1 < 200) {
|
|
2046
|
+
dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
|
|
2047
|
+
x2 = x1 + dx;
|
|
2048
|
+
x3 = x4 - dx;
|
|
2049
|
+
return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
|
|
2054
2050
|
}
|
|
2055
2051
|
return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
|
|
2056
2052
|
}
|
|
2057
2053
|
};
|
|
2058
|
-
|
|
2054
|
+
GanttLinkLineCurve = __decorate([
|
|
2059
2055
|
__param(0, Inject(GANTT_UPPER_TOKEN))
|
|
2060
|
-
],
|
|
2056
|
+
], GanttLinkLineCurve);
|
|
2061
2057
|
|
|
2062
|
-
class
|
|
2058
|
+
class GanttLinkLineStraight extends GanttLinkLine {
|
|
2063
2059
|
constructor() {
|
|
2064
2060
|
super();
|
|
2065
2061
|
this.pathControl = 20;
|
|
@@ -2070,7 +2066,6 @@ class GanttLinkPathLine extends GanttLinkPath {
|
|
|
2070
2066
|
const x4 = target.before.x;
|
|
2071
2067
|
const y4 = target.before.y;
|
|
2072
2068
|
const control = this.pathControl;
|
|
2073
|
-
const centerY = (y1 + y4) / 2;
|
|
2074
2069
|
return `M ${x1} ${y1}
|
|
2075
2070
|
L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
|
|
2076
2071
|
L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
|
|
@@ -2116,12 +2111,12 @@ class GanttLinkPathLine extends GanttLinkPath {
|
|
|
2116
2111
|
}
|
|
2117
2112
|
}
|
|
2118
2113
|
|
|
2119
|
-
function
|
|
2114
|
+
function createLineGenerator(type, ganttUpper) {
|
|
2120
2115
|
switch (type) {
|
|
2121
|
-
case
|
|
2122
|
-
return new
|
|
2123
|
-
case
|
|
2124
|
-
return new
|
|
2116
|
+
case GanttLinkLineType.curve:
|
|
2117
|
+
return new GanttLinkLineCurve(ganttUpper);
|
|
2118
|
+
case GanttLinkLineType.straight:
|
|
2119
|
+
return new GanttLinkLineStraight();
|
|
2125
2120
|
default:
|
|
2126
2121
|
throw new Error('gantt link path type invalid');
|
|
2127
2122
|
}
|
|
@@ -2145,7 +2140,7 @@ class GanttLinksComponent {
|
|
|
2145
2140
|
this.ganttLinksOverlay = true;
|
|
2146
2141
|
}
|
|
2147
2142
|
ngOnInit() {
|
|
2148
|
-
this.
|
|
2143
|
+
this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
|
|
2149
2144
|
this.showArrow = this.ganttUpper.linkOptions.showArrow;
|
|
2150
2145
|
this.buildLinks();
|
|
2151
2146
|
this.firstChange = false;
|
|
@@ -2217,7 +2212,7 @@ class GanttLinksComponent {
|
|
|
2217
2212
|
color = LinkColors.blocked;
|
|
2218
2213
|
}
|
|
2219
2214
|
this.links.push({
|
|
2220
|
-
path: this.
|
|
2215
|
+
path: this.linkLine.generatePath(source, target, link.type),
|
|
2221
2216
|
source: source.origin,
|
|
2222
2217
|
target: target.origin,
|
|
2223
2218
|
type: link.type,
|
|
@@ -2358,7 +2353,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
|
|
|
2358
2353
|
|
|
2359
2354
|
const dragMinWidth = 10;
|
|
2360
2355
|
const activeClass = 'gantt-bar-active';
|
|
2361
|
-
const
|
|
2356
|
+
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2357
|
+
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2362
2358
|
function createSvgElement(qualifiedName, className) {
|
|
2363
2359
|
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2364
2360
|
element.classList.add(className);
|
|
@@ -2379,13 +2375,21 @@ class GanttBarDrag {
|
|
|
2379
2375
|
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2380
2376
|
}
|
|
2381
2377
|
createMouseEvents() {
|
|
2378
|
+
var _a, _b, _c;
|
|
2379
|
+
const dropClass = ((_b = (_a = this.ganttUpper.config.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
|
|
2380
|
+
((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
|
|
2381
|
+
? singleDropActiveClass
|
|
2382
|
+
: dropActiveClass;
|
|
2382
2383
|
fromEvent(this.barElement, 'mouseenter')
|
|
2383
2384
|
.pipe(takeUntil(this.destroy$))
|
|
2384
|
-
.subscribe(() => {
|
|
2385
|
+
.subscribe((event) => {
|
|
2385
2386
|
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2386
2387
|
if (this.item.linkable) {
|
|
2387
|
-
this.barElement.classList.add(
|
|
2388
|
-
this.dragContainer.emitLinkDragEntered(
|
|
2388
|
+
this.barElement.classList.add(dropClass);
|
|
2389
|
+
this.dragContainer.emitLinkDragEntered({
|
|
2390
|
+
item: this.item,
|
|
2391
|
+
element: this.barElement
|
|
2392
|
+
});
|
|
2389
2393
|
}
|
|
2390
2394
|
}
|
|
2391
2395
|
else {
|
|
@@ -2394,14 +2398,14 @@ class GanttBarDrag {
|
|
|
2394
2398
|
});
|
|
2395
2399
|
fromEvent(this.barElement, 'mouseleave')
|
|
2396
2400
|
.pipe(takeUntil(this.destroy$))
|
|
2397
|
-
.subscribe(() => {
|
|
2401
|
+
.subscribe((event) => {
|
|
2398
2402
|
if (!this.dragContainer.linkDraggingId) {
|
|
2399
2403
|
this.barElement.classList.remove(activeClass);
|
|
2400
2404
|
}
|
|
2401
2405
|
else {
|
|
2402
2406
|
this.dragContainer.emitLinkDragLeaved();
|
|
2403
2407
|
}
|
|
2404
|
-
this.barElement.classList.remove(
|
|
2408
|
+
this.barElement.classList.remove(dropClass);
|
|
2405
2409
|
});
|
|
2406
2410
|
}
|
|
2407
2411
|
createBarDrag() {
|
|
@@ -2501,7 +2505,7 @@ class GanttBarDrag {
|
|
|
2501
2505
|
const dragRefs = [];
|
|
2502
2506
|
const handles = this.barElement.querySelectorAll('.link-handles .handle');
|
|
2503
2507
|
handles.forEach((handle, index) => {
|
|
2504
|
-
const
|
|
2508
|
+
const isBegin = index === 0;
|
|
2505
2509
|
const dragRef = this.dragDrop.createDrag(handle);
|
|
2506
2510
|
dragRef.withBoundaryElement(this.dom.root);
|
|
2507
2511
|
dragRef.beforeStarted.subscribe(() => {
|
|
@@ -2510,24 +2514,35 @@ class GanttBarDrag {
|
|
|
2510
2514
|
this.barDragRef.disabled = true;
|
|
2511
2515
|
}
|
|
2512
2516
|
this.createLinkDraggingLine();
|
|
2513
|
-
this.dragContainer.emitLinkDragStarted(
|
|
2517
|
+
this.dragContainer.emitLinkDragStarted({
|
|
2518
|
+
element: this.barElement,
|
|
2519
|
+
item: this.item,
|
|
2520
|
+
pos: isBegin ? InBarPosition.start : InBarPosition.finish
|
|
2521
|
+
});
|
|
2514
2522
|
});
|
|
2515
2523
|
dragRef.moved.subscribe(() => {
|
|
2516
|
-
const positions = this.calcLinkLinePositions(handle,
|
|
2524
|
+
const positions = this.calcLinkLinePositions(handle, isBegin);
|
|
2517
2525
|
this.linkDraggingLine.setAttribute('x1', positions.x1.toString());
|
|
2518
2526
|
this.linkDraggingLine.setAttribute('y1', positions.y1.toString());
|
|
2519
2527
|
this.linkDraggingLine.setAttribute('x2', positions.x2.toString());
|
|
2520
2528
|
this.linkDraggingLine.setAttribute('y2', positions.y2.toString());
|
|
2521
2529
|
});
|
|
2522
2530
|
dragRef.ended.subscribe((event) => {
|
|
2523
|
-
event.source.reset();
|
|
2524
2531
|
handle.style.pointerEvents = '';
|
|
2525
2532
|
if (this.barDragRef) {
|
|
2526
2533
|
this.barDragRef.disabled = false;
|
|
2527
2534
|
}
|
|
2535
|
+
// 计算line拖动的落点位于目标Bar的值,如果值大于Bar宽度的一半,说明是拖动到Begin位置,否则则为拖动到End位置
|
|
2536
|
+
if (this.dragContainer.linkDragPath.to) {
|
|
2537
|
+
const placePointX = event.source.getRootElement().getBoundingClientRect().x -
|
|
2538
|
+
this.dragContainer.linkDragPath.to.element.getBoundingClientRect().x;
|
|
2539
|
+
this.dragContainer.emitLinkDragEnded(Object.assign(Object.assign({}, this.dragContainer.linkDragPath.to), { pos: placePointX < this.dragContainer.linkDragPath.to.item.refs.width / 2
|
|
2540
|
+
? InBarPosition.start
|
|
2541
|
+
: InBarPosition.finish }));
|
|
2542
|
+
}
|
|
2543
|
+
event.source.reset();
|
|
2528
2544
|
this.barElement.classList.remove(activeClass);
|
|
2529
2545
|
this.destroyLinkDraggingLine();
|
|
2530
|
-
this.dragContainer.emitLinkDragEnded();
|
|
2531
2546
|
});
|
|
2532
2547
|
dragRefs.push(dragRef);
|
|
2533
2548
|
});
|
|
@@ -2576,6 +2591,7 @@ class GanttBarDrag {
|
|
|
2576
2591
|
if (!this.linkDraggingLine) {
|
|
2577
2592
|
const svgElement = createSvgElement('svg', 'gantt-link-drag-container');
|
|
2578
2593
|
const linElement = createSvgElement('line', 'link-dragging-line');
|
|
2594
|
+
linElement.style.pointerEvents = 'none';
|
|
2579
2595
|
svgElement.appendChild(linElement);
|
|
2580
2596
|
this.dom.root.appendChild(svgElement);
|
|
2581
2597
|
this.linkDraggingLine = linElement;
|
|
@@ -2762,9 +2778,7 @@ class NgxGanttComponent extends GanttUpper {
|
|
|
2762
2778
|
this.sideTableWidth = sideWidth;
|
|
2763
2779
|
}
|
|
2764
2780
|
ngOnInit() {
|
|
2765
|
-
var _a;
|
|
2766
2781
|
super.onInit();
|
|
2767
|
-
this.linkOptions = Object.assign({}, defaultConfig.linkOptions, (_a = this.config) === null || _a === void 0 ? void 0 : _a.linkOptions, this.linkOptions);
|
|
2768
2782
|
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
2769
2783
|
this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
|
|
2770
2784
|
this.linkDragStarted.emit(event);
|
|
@@ -2822,12 +2836,12 @@ class NgxGanttComponent extends GanttUpper {
|
|
|
2822
2836
|
this.selectionModel.toggle(selectedValue.id);
|
|
2823
2837
|
const selectedIds = this.selectionModel.selected;
|
|
2824
2838
|
if (this.multiple) {
|
|
2825
|
-
const
|
|
2826
|
-
this.selectedChange.emit({ event, selectedValue });
|
|
2839
|
+
const _selectedValue = this.getGanttItems(selectedIds).map((item) => item.origin);
|
|
2840
|
+
this.selectedChange.emit({ event, selectedValue: _selectedValue });
|
|
2827
2841
|
}
|
|
2828
2842
|
else {
|
|
2829
|
-
const
|
|
2830
|
-
this.selectedChange.emit({ event, selectedValue });
|
|
2843
|
+
const _selectedValue = (_a = this.getGanttItem(selectedIds[0])) === null || _a === void 0 ? void 0 : _a.origin;
|
|
2844
|
+
this.selectedChange.emit({ event, selectedValue: _selectedValue });
|
|
2831
2845
|
}
|
|
2832
2846
|
}
|
|
2833
2847
|
ngOnDestroy() {
|
|
@@ -2835,7 +2849,7 @@ class NgxGanttComponent extends GanttUpper {
|
|
|
2835
2849
|
}
|
|
2836
2850
|
}
|
|
2837
2851
|
NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
|
|
2838
|
-
NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable"
|
|
2852
|
+
NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
|
|
2839
2853
|
{
|
|
2840
2854
|
provide: GANTT_UPPER_TOKEN,
|
|
2841
2855
|
useExisting: NgxGanttComponent
|
|
@@ -2873,8 +2887,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
|
|
|
2873
2887
|
type: Input
|
|
2874
2888
|
}], linkable: [{
|
|
2875
2889
|
type: Input
|
|
2876
|
-
}], linkOptions: [{
|
|
2877
|
-
type: Input
|
|
2878
2890
|
}], linkDragStarted: [{
|
|
2879
2891
|
type: Output
|
|
2880
2892
|
}], linkDragEnded: [{
|
|
@@ -2969,5 +2981,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
|
|
|
2969
2981
|
* Generated bundle index. Do not edit.
|
|
2970
2982
|
*/
|
|
2971
2983
|
|
|
2972
|
-
export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLoadOnScrollEvent, GanttPrintService, GanttSelectedEvent, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, NgxGanttBarComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, defaultConfig, primaryDatePointTop, secondaryDatePointTop };
|
|
2984
|
+
export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttPrintService, GanttSelectedEvent, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, defaultConfig, primaryDatePointTop, secondaryDatePointTop };
|
|
2973
2985
|
//# sourceMappingURL=worktile-gantt.js.map
|