gantt-task-react-powern 0.3.12 → 0.4.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/dist/components/task-item/bar/bar-display.d.ts +5 -0
- package/dist/index.css +0 -24
- package/dist/index.js +50 -49
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +50 -49
- package/dist/index.modern.js.map +1 -1
- package/dist/types/bar-task.d.ts +5 -0
- package/dist/types/public-types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -2,6 +2,10 @@ import React from "react";
|
|
|
2
2
|
declare type BarDisplayProps = {
|
|
3
3
|
x: number;
|
|
4
4
|
y: number;
|
|
5
|
+
actualX1: number;
|
|
6
|
+
actualX2: number;
|
|
7
|
+
startProgressWidth: number;
|
|
8
|
+
endProgressWidth: number;
|
|
5
9
|
width: number;
|
|
6
10
|
height: number;
|
|
7
11
|
isSelected: boolean;
|
|
@@ -9,6 +13,7 @@ declare type BarDisplayProps = {
|
|
|
9
13
|
progressWidth: number;
|
|
10
14
|
barCornerRadius: number;
|
|
11
15
|
styles: {
|
|
16
|
+
taskProgressColor?: string;
|
|
12
17
|
backgroundColor: string;
|
|
13
18
|
backgroundSelectedColor: string;
|
|
14
19
|
progressColor: string;
|
package/dist/index.css
CHANGED
|
@@ -231,30 +231,6 @@
|
|
|
231
231
|
user-select: none;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
._3zRJQ {
|
|
235
|
-
fill: #fff;
|
|
236
|
-
text-anchor: middle;
|
|
237
|
-
font-weight: lighter;
|
|
238
|
-
dominant-baseline: central;
|
|
239
|
-
-webkit-touch-callout: none;
|
|
240
|
-
-webkit-user-select: none;
|
|
241
|
-
-moz-user-select: none;
|
|
242
|
-
-ms-user-select: none;
|
|
243
|
-
user-select: none;
|
|
244
|
-
pointer-events: none;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
._3KcaM {
|
|
248
|
-
fill: #555;
|
|
249
|
-
text-anchor: start;
|
|
250
|
-
-webkit-touch-callout: none;
|
|
251
|
-
-webkit-user-select: none;
|
|
252
|
-
-moz-user-select: none;
|
|
253
|
-
-ms-user-select: none;
|
|
254
|
-
user-select: none;
|
|
255
|
-
pointer-events: none;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
234
|
._CZjuD {
|
|
259
235
|
overflow: hidden;
|
|
260
236
|
font-size: 0;
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,10 @@ function _extends() {
|
|
|
21
21
|
return _extends.apply(this, arguments);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function _objectDestructuringEmpty(obj) {
|
|
25
|
+
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
function _unsupportedIterableToArray(o, minLen) {
|
|
25
29
|
if (!o) return;
|
|
26
30
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -1151,15 +1155,25 @@ var convertToBarTask = function convertToBarTask(task, index, dates, columnWidth
|
|
|
1151
1155
|
var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) {
|
|
1152
1156
|
var x1;
|
|
1153
1157
|
var x2;
|
|
1158
|
+
var actualx1;
|
|
1159
|
+
var actualx2;
|
|
1160
|
+
var progressStartWidth;
|
|
1161
|
+
var progressEndWidth;
|
|
1154
1162
|
|
|
1155
1163
|
if (rtl) {
|
|
1156
1164
|
x2 = taskXCoordinateRTL(task.start, dates, columnWidth);
|
|
1157
1165
|
x1 = taskXCoordinateRTL(task.end, dates, columnWidth);
|
|
1166
|
+
actualx1 = taskXCoordinateRTL(task.actualStart, dates, columnWidth);
|
|
1167
|
+
actualx2 = taskXCoordinateRTL(task.actualEnd, dates, columnWidth);
|
|
1158
1168
|
} else {
|
|
1159
1169
|
x1 = taskXCoordinate(task.start, dates, columnWidth);
|
|
1160
1170
|
x2 = taskXCoordinate(task.end, dates, columnWidth);
|
|
1171
|
+
actualx1 = taskXCoordinate(task.actualStart, dates, columnWidth);
|
|
1172
|
+
actualx2 = taskXCoordinate(task.actualEnd, dates, columnWidth);
|
|
1161
1173
|
}
|
|
1162
1174
|
|
|
1175
|
+
progressStartWidth = Math.abs(actualx1 - x1);
|
|
1176
|
+
progressEndWidth = Math.abs(actualx2 - x2);
|
|
1163
1177
|
var typeInternal = task.type;
|
|
1164
1178
|
|
|
1165
1179
|
if (typeInternal === "task" && x2 - x1 < handleWidth * 2) {
|
|
@@ -1167,7 +1181,7 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
1167
1181
|
x2 = x1 + handleWidth * 2;
|
|
1168
1182
|
}
|
|
1169
1183
|
|
|
1170
|
-
var _progressWithByParams = progressWithByParams(
|
|
1184
|
+
var _progressWithByParams = progressWithByParams(actualx1, actualx2, task.progress, rtl),
|
|
1171
1185
|
progressWidth = _progressWithByParams[0],
|
|
1172
1186
|
progressX = _progressWithByParams[1];
|
|
1173
1187
|
|
|
@@ -1185,6 +1199,10 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
1185
1199
|
typeInternal: typeInternal,
|
|
1186
1200
|
x1: x1,
|
|
1187
1201
|
x2: x2,
|
|
1202
|
+
actualx1: actualx1,
|
|
1203
|
+
actualx2: actualx2,
|
|
1204
|
+
progressStartWidth: progressStartWidth,
|
|
1205
|
+
progressEndWidth: progressEndWidth,
|
|
1188
1206
|
y: y,
|
|
1189
1207
|
index: index,
|
|
1190
1208
|
progressX: progressX,
|
|
@@ -1216,6 +1234,10 @@ var convertToMilestone = function convertToMilestone(task, index, dates, columnW
|
|
|
1216
1234
|
end: task.start,
|
|
1217
1235
|
x1: x1,
|
|
1218
1236
|
x2: x2,
|
|
1237
|
+
actualx1: x1,
|
|
1238
|
+
actualx2: x2,
|
|
1239
|
+
progressStartWidth: 0,
|
|
1240
|
+
progressEndWidth: 0,
|
|
1219
1241
|
y: y,
|
|
1220
1242
|
index: index,
|
|
1221
1243
|
progressX: 0,
|
|
@@ -1232,9 +1254,11 @@ var convertToMilestone = function convertToMilestone(task, index, dates, columnW
|
|
|
1232
1254
|
};
|
|
1233
1255
|
|
|
1234
1256
|
var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
|
|
1257
|
+
console.log(dates);
|
|
1235
1258
|
var index = dates.findIndex(function (d) {
|
|
1236
1259
|
return d.getTime() >= xDate.getTime();
|
|
1237
1260
|
}) - 1;
|
|
1261
|
+
console.log(index);
|
|
1238
1262
|
var remainderMillis = xDate.getTime() - dates[index].getTime();
|
|
1239
1263
|
var percentOfInterval = remainderMillis / (dates[index + 1].getTime() - dates[index].getTime());
|
|
1240
1264
|
var x = index * columnWidth + percentOfInterval * columnWidth;
|
|
@@ -1539,6 +1563,8 @@ var styles$6 = {"barWrapper":"_KxSXS","barHandle":"_3w_5u","barBackground":"_31E
|
|
|
1539
1563
|
var BarDisplay = function BarDisplay(_ref) {
|
|
1540
1564
|
var x = _ref.x,
|
|
1541
1565
|
y = _ref.y,
|
|
1566
|
+
actualX1 = _ref.actualX1,
|
|
1567
|
+
actualX2 = _ref.actualX2,
|
|
1542
1568
|
width = _ref.width,
|
|
1543
1569
|
height = _ref.height,
|
|
1544
1570
|
isSelected = _ref.isSelected,
|
|
@@ -1562,16 +1588,24 @@ var BarDisplay = function BarDisplay(_ref) {
|
|
|
1562
1588
|
x: x,
|
|
1563
1589
|
width: width,
|
|
1564
1590
|
y: y,
|
|
1565
|
-
height: height,
|
|
1591
|
+
height: height / 2,
|
|
1566
1592
|
ry: barCornerRadius,
|
|
1567
1593
|
rx: barCornerRadius,
|
|
1568
1594
|
fill: getBarColor(),
|
|
1569
1595
|
className: styles$6.barBackground
|
|
1596
|
+
}), React__default.createElement("rect", {
|
|
1597
|
+
x: actualX1,
|
|
1598
|
+
width: actualX2 - actualX1,
|
|
1599
|
+
y: y + height / 2,
|
|
1600
|
+
height: height / 2,
|
|
1601
|
+
ry: barCornerRadius,
|
|
1602
|
+
rx: barCornerRadius,
|
|
1603
|
+
fill: styles.taskProgressColor
|
|
1570
1604
|
}), React__default.createElement("rect", {
|
|
1571
1605
|
x: progressX,
|
|
1572
1606
|
width: progressWidth,
|
|
1573
|
-
y: y,
|
|
1574
|
-
height: height,
|
|
1607
|
+
y: y + height / 2,
|
|
1608
|
+
height: height / 2,
|
|
1575
1609
|
ry: barCornerRadius,
|
|
1576
1610
|
rx: barCornerRadius,
|
|
1577
1611
|
fill: getProcessColor()
|
|
@@ -1598,13 +1632,9 @@ var BarDateHandle = function BarDateHandle(_ref) {
|
|
|
1598
1632
|
};
|
|
1599
1633
|
|
|
1600
1634
|
var BarProgressHandle = function BarProgressHandle(_ref) {
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
return React__default.createElement("
|
|
1604
|
-
className: styles$6.barHandle,
|
|
1605
|
-
points: progressPoint,
|
|
1606
|
-
onMouseDown: onMouseDown
|
|
1607
|
-
});
|
|
1635
|
+
_objectDestructuringEmpty(_ref);
|
|
1636
|
+
|
|
1637
|
+
return React__default.createElement("div", null);
|
|
1608
1638
|
};
|
|
1609
1639
|
|
|
1610
1640
|
var Bar = function Bar(_ref) {
|
|
@@ -1622,6 +1652,10 @@ var Bar = function Bar(_ref) {
|
|
|
1622
1652
|
}, React__default.createElement(BarDisplay, {
|
|
1623
1653
|
x: task.x1,
|
|
1624
1654
|
y: task.y,
|
|
1655
|
+
actualX1: task.actualx1,
|
|
1656
|
+
actualX2: task.actualx2,
|
|
1657
|
+
startProgressWidth: task.progressStartWidth,
|
|
1658
|
+
endProgressWidth: task.progressEndWidth,
|
|
1625
1659
|
width: task.x2 - task.x1,
|
|
1626
1660
|
height: task.height,
|
|
1627
1661
|
progressX: task.progressX,
|
|
@@ -1673,6 +1707,10 @@ var BarSmall = function BarSmall(_ref) {
|
|
|
1673
1707
|
}, React__default.createElement(BarDisplay, {
|
|
1674
1708
|
x: task.x1,
|
|
1675
1709
|
y: task.y,
|
|
1710
|
+
actualX1: task.actualx1,
|
|
1711
|
+
actualX2: task.actualx2,
|
|
1712
|
+
startProgressWidth: task.progressStartWidth,
|
|
1713
|
+
endProgressWidth: task.progressEndWidth,
|
|
1676
1714
|
width: task.x2 - task.x1,
|
|
1677
1715
|
height: task.height,
|
|
1678
1716
|
progressX: task.progressX,
|
|
@@ -1775,28 +1813,17 @@ var Project = function Project(_ref) {
|
|
|
1775
1813
|
}));
|
|
1776
1814
|
};
|
|
1777
1815
|
|
|
1778
|
-
var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
|
|
1779
|
-
|
|
1780
1816
|
var TaskItem = function TaskItem(props) {
|
|
1781
1817
|
var _props = _extends({}, props),
|
|
1782
1818
|
task = _props.task,
|
|
1783
|
-
arrowIndent = _props.arrowIndent,
|
|
1784
1819
|
isDelete = _props.isDelete,
|
|
1785
|
-
taskHeight = _props.taskHeight,
|
|
1786
1820
|
isSelected = _props.isSelected,
|
|
1787
|
-
rtl = _props.rtl,
|
|
1788
1821
|
onEventStart = _props.onEventStart;
|
|
1789
1822
|
|
|
1790
|
-
var textRef = React.useRef(null);
|
|
1791
|
-
|
|
1792
1823
|
var _useState = React.useState(React__default.createElement("div", null)),
|
|
1793
1824
|
taskItem = _useState[0],
|
|
1794
1825
|
setTaskItem = _useState[1];
|
|
1795
1826
|
|
|
1796
|
-
var _useState2 = React.useState(true),
|
|
1797
|
-
isTextInside = _useState2[0],
|
|
1798
|
-
setIsTextInside = _useState2[1];
|
|
1799
|
-
|
|
1800
1827
|
React.useEffect(function () {
|
|
1801
1828
|
switch (task.typeInternal) {
|
|
1802
1829
|
case "milestone":
|
|
@@ -1816,27 +1843,6 @@ var TaskItem = function TaskItem(props) {
|
|
|
1816
1843
|
break;
|
|
1817
1844
|
}
|
|
1818
1845
|
}, [task, isSelected]);
|
|
1819
|
-
React.useEffect(function () {
|
|
1820
|
-
if (textRef.current) {
|
|
1821
|
-
setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
|
|
1822
|
-
}
|
|
1823
|
-
}, [textRef, task]);
|
|
1824
|
-
|
|
1825
|
-
var getX = function getX() {
|
|
1826
|
-
var width = task.x2 - task.x1;
|
|
1827
|
-
var hasChild = task.barChildren.length > 0;
|
|
1828
|
-
|
|
1829
|
-
if (isTextInside) {
|
|
1830
|
-
return task.x1 + width * 0.5;
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
if (rtl && textRef.current) {
|
|
1834
|
-
return task.x1 - textRef.current.getBBox().width - arrowIndent * +hasChild - arrowIndent * 0.2;
|
|
1835
|
-
} else {
|
|
1836
|
-
return task.x1 + width + arrowIndent * +hasChild + arrowIndent * 0.2;
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
|
|
1840
1846
|
return React__default.createElement("g", {
|
|
1841
1847
|
onKeyDown: function onKeyDown(e) {
|
|
1842
1848
|
switch (e.key) {
|
|
@@ -1864,12 +1870,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
1864
1870
|
onFocus: function onFocus() {
|
|
1865
1871
|
onEventStart("select", task);
|
|
1866
1872
|
}
|
|
1867
|
-
}, taskItem
|
|
1868
|
-
x: getX(),
|
|
1869
|
-
y: task.y + taskHeight * 0.5,
|
|
1870
|
-
className: isTextInside ? style.barLabel : style.barLabelOutside,
|
|
1871
|
-
ref: textRef
|
|
1872
|
-
}, task.name));
|
|
1873
|
+
}, taskItem);
|
|
1873
1874
|
};
|
|
1874
1875
|
|
|
1875
1876
|
var TaskGanttContent = function TaskGanttContent(_ref) {
|