gantt-task-react-powern 0.3.12 → 0.4.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/dist/components/task-item/bar/bar-display.d.ts +5 -0
- package/dist/index.css +0 -24
- package/dist/index.js +48 -49
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +48 -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
package/dist/index.modern.js
CHANGED
|
@@ -18,6 +18,10 @@ function _extends() {
|
|
|
18
18
|
return _extends.apply(this, arguments);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
function _objectDestructuringEmpty(obj) {
|
|
22
|
+
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
function _unsupportedIterableToArray(o, minLen) {
|
|
22
26
|
if (!o) return;
|
|
23
27
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -1150,15 +1154,25 @@ var convertToBarTask = function convertToBarTask(task, index, dates, columnWidth
|
|
|
1150
1154
|
var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) {
|
|
1151
1155
|
var x1;
|
|
1152
1156
|
var x2;
|
|
1157
|
+
var actualx1;
|
|
1158
|
+
var actualx2;
|
|
1159
|
+
var progressStartWidth;
|
|
1160
|
+
var progressEndWidth;
|
|
1153
1161
|
|
|
1154
1162
|
if (rtl) {
|
|
1155
1163
|
x2 = taskXCoordinateRTL(task.start, dates, columnWidth);
|
|
1156
1164
|
x1 = taskXCoordinateRTL(task.end, dates, columnWidth);
|
|
1165
|
+
actualx1 = taskXCoordinateRTL(task.actualStart, dates, columnWidth);
|
|
1166
|
+
actualx2 = taskXCoordinateRTL(task.actualEnd, dates, columnWidth);
|
|
1157
1167
|
} else {
|
|
1158
1168
|
x1 = taskXCoordinate(task.start, dates, columnWidth);
|
|
1159
1169
|
x2 = taskXCoordinate(task.end, dates, columnWidth);
|
|
1170
|
+
actualx1 = taskXCoordinate(task.actualStart, dates, columnWidth);
|
|
1171
|
+
actualx2 = taskXCoordinate(task.actualEnd, dates, columnWidth);
|
|
1160
1172
|
}
|
|
1161
1173
|
|
|
1174
|
+
progressStartWidth = Math.abs(actualx1 - x1);
|
|
1175
|
+
progressEndWidth = Math.abs(actualx2 - x2);
|
|
1162
1176
|
var typeInternal = task.type;
|
|
1163
1177
|
|
|
1164
1178
|
if (typeInternal === "task" && x2 - x1 < handleWidth * 2) {
|
|
@@ -1166,7 +1180,7 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
1166
1180
|
x2 = x1 + handleWidth * 2;
|
|
1167
1181
|
}
|
|
1168
1182
|
|
|
1169
|
-
var _progressWithByParams = progressWithByParams(
|
|
1183
|
+
var _progressWithByParams = progressWithByParams(actualx1, actualx2, task.progress, rtl),
|
|
1170
1184
|
progressWidth = _progressWithByParams[0],
|
|
1171
1185
|
progressX = _progressWithByParams[1];
|
|
1172
1186
|
|
|
@@ -1184,6 +1198,10 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
1184
1198
|
typeInternal: typeInternal,
|
|
1185
1199
|
x1: x1,
|
|
1186
1200
|
x2: x2,
|
|
1201
|
+
actualx1: actualx1,
|
|
1202
|
+
actualx2: actualx2,
|
|
1203
|
+
progressStartWidth: progressStartWidth,
|
|
1204
|
+
progressEndWidth: progressEndWidth,
|
|
1187
1205
|
y: y,
|
|
1188
1206
|
index: index,
|
|
1189
1207
|
progressX: progressX,
|
|
@@ -1215,6 +1233,10 @@ var convertToMilestone = function convertToMilestone(task, index, dates, columnW
|
|
|
1215
1233
|
end: task.start,
|
|
1216
1234
|
x1: x1,
|
|
1217
1235
|
x2: x2,
|
|
1236
|
+
actualx1: x1,
|
|
1237
|
+
actualx2: x2,
|
|
1238
|
+
progressStartWidth: 0,
|
|
1239
|
+
progressEndWidth: 0,
|
|
1218
1240
|
y: y,
|
|
1219
1241
|
index: index,
|
|
1220
1242
|
progressX: 0,
|
|
@@ -1538,6 +1560,8 @@ var styles$6 = {"barWrapper":"_KxSXS","barHandle":"_3w_5u","barBackground":"_31E
|
|
|
1538
1560
|
var BarDisplay = function BarDisplay(_ref) {
|
|
1539
1561
|
var x = _ref.x,
|
|
1540
1562
|
y = _ref.y,
|
|
1563
|
+
actualX1 = _ref.actualX1,
|
|
1564
|
+
actualX2 = _ref.actualX2,
|
|
1541
1565
|
width = _ref.width,
|
|
1542
1566
|
height = _ref.height,
|
|
1543
1567
|
isSelected = _ref.isSelected,
|
|
@@ -1561,16 +1585,24 @@ var BarDisplay = function BarDisplay(_ref) {
|
|
|
1561
1585
|
x: x,
|
|
1562
1586
|
width: width,
|
|
1563
1587
|
y: y,
|
|
1564
|
-
height: height,
|
|
1588
|
+
height: height / 2,
|
|
1565
1589
|
ry: barCornerRadius,
|
|
1566
1590
|
rx: barCornerRadius,
|
|
1567
1591
|
fill: getBarColor(),
|
|
1568
1592
|
className: styles$6.barBackground
|
|
1593
|
+
}), React.createElement("rect", {
|
|
1594
|
+
x: actualX1,
|
|
1595
|
+
width: actualX2 - actualX1,
|
|
1596
|
+
y: y + height / 2,
|
|
1597
|
+
height: height / 2,
|
|
1598
|
+
ry: barCornerRadius,
|
|
1599
|
+
rx: barCornerRadius,
|
|
1600
|
+
fill: styles.taskProgressColor
|
|
1569
1601
|
}), React.createElement("rect", {
|
|
1570
1602
|
x: progressX,
|
|
1571
1603
|
width: progressWidth,
|
|
1572
|
-
y: y,
|
|
1573
|
-
height: height,
|
|
1604
|
+
y: y + height / 2,
|
|
1605
|
+
height: height / 2,
|
|
1574
1606
|
ry: barCornerRadius,
|
|
1575
1607
|
rx: barCornerRadius,
|
|
1576
1608
|
fill: getProcessColor()
|
|
@@ -1597,13 +1629,9 @@ var BarDateHandle = function BarDateHandle(_ref) {
|
|
|
1597
1629
|
};
|
|
1598
1630
|
|
|
1599
1631
|
var BarProgressHandle = function BarProgressHandle(_ref) {
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
return React.createElement("
|
|
1603
|
-
className: styles$6.barHandle,
|
|
1604
|
-
points: progressPoint,
|
|
1605
|
-
onMouseDown: onMouseDown
|
|
1606
|
-
});
|
|
1632
|
+
_objectDestructuringEmpty(_ref);
|
|
1633
|
+
|
|
1634
|
+
return React.createElement("div", null);
|
|
1607
1635
|
};
|
|
1608
1636
|
|
|
1609
1637
|
var Bar = function Bar(_ref) {
|
|
@@ -1621,6 +1649,10 @@ var Bar = function Bar(_ref) {
|
|
|
1621
1649
|
}, React.createElement(BarDisplay, {
|
|
1622
1650
|
x: task.x1,
|
|
1623
1651
|
y: task.y,
|
|
1652
|
+
actualX1: task.actualx1,
|
|
1653
|
+
actualX2: task.actualx2,
|
|
1654
|
+
startProgressWidth: task.progressStartWidth,
|
|
1655
|
+
endProgressWidth: task.progressEndWidth,
|
|
1624
1656
|
width: task.x2 - task.x1,
|
|
1625
1657
|
height: task.height,
|
|
1626
1658
|
progressX: task.progressX,
|
|
@@ -1672,6 +1704,10 @@ var BarSmall = function BarSmall(_ref) {
|
|
|
1672
1704
|
}, React.createElement(BarDisplay, {
|
|
1673
1705
|
x: task.x1,
|
|
1674
1706
|
y: task.y,
|
|
1707
|
+
actualX1: task.actualx1,
|
|
1708
|
+
actualX2: task.actualx2,
|
|
1709
|
+
startProgressWidth: task.progressStartWidth,
|
|
1710
|
+
endProgressWidth: task.progressEndWidth,
|
|
1675
1711
|
width: task.x2 - task.x1,
|
|
1676
1712
|
height: task.height,
|
|
1677
1713
|
progressX: task.progressX,
|
|
@@ -1774,28 +1810,17 @@ var Project = function Project(_ref) {
|
|
|
1774
1810
|
}));
|
|
1775
1811
|
};
|
|
1776
1812
|
|
|
1777
|
-
var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
|
|
1778
|
-
|
|
1779
1813
|
var TaskItem = function TaskItem(props) {
|
|
1780
1814
|
var _props = _extends({}, props),
|
|
1781
1815
|
task = _props.task,
|
|
1782
|
-
arrowIndent = _props.arrowIndent,
|
|
1783
1816
|
isDelete = _props.isDelete,
|
|
1784
|
-
taskHeight = _props.taskHeight,
|
|
1785
1817
|
isSelected = _props.isSelected,
|
|
1786
|
-
rtl = _props.rtl,
|
|
1787
1818
|
onEventStart = _props.onEventStart;
|
|
1788
1819
|
|
|
1789
|
-
var textRef = useRef(null);
|
|
1790
|
-
|
|
1791
1820
|
var _useState = useState(React.createElement("div", null)),
|
|
1792
1821
|
taskItem = _useState[0],
|
|
1793
1822
|
setTaskItem = _useState[1];
|
|
1794
1823
|
|
|
1795
|
-
var _useState2 = useState(true),
|
|
1796
|
-
isTextInside = _useState2[0],
|
|
1797
|
-
setIsTextInside = _useState2[1];
|
|
1798
|
-
|
|
1799
1824
|
useEffect(function () {
|
|
1800
1825
|
switch (task.typeInternal) {
|
|
1801
1826
|
case "milestone":
|
|
@@ -1815,27 +1840,6 @@ var TaskItem = function TaskItem(props) {
|
|
|
1815
1840
|
break;
|
|
1816
1841
|
}
|
|
1817
1842
|
}, [task, isSelected]);
|
|
1818
|
-
useEffect(function () {
|
|
1819
|
-
if (textRef.current) {
|
|
1820
|
-
setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
|
|
1821
|
-
}
|
|
1822
|
-
}, [textRef, task]);
|
|
1823
|
-
|
|
1824
|
-
var getX = function getX() {
|
|
1825
|
-
var width = task.x2 - task.x1;
|
|
1826
|
-
var hasChild = task.barChildren.length > 0;
|
|
1827
|
-
|
|
1828
|
-
if (isTextInside) {
|
|
1829
|
-
return task.x1 + width * 0.5;
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
if (rtl && textRef.current) {
|
|
1833
|
-
return task.x1 - textRef.current.getBBox().width - arrowIndent * +hasChild - arrowIndent * 0.2;
|
|
1834
|
-
} else {
|
|
1835
|
-
return task.x1 + width + arrowIndent * +hasChild + arrowIndent * 0.2;
|
|
1836
|
-
}
|
|
1837
|
-
};
|
|
1838
|
-
|
|
1839
1843
|
return React.createElement("g", {
|
|
1840
1844
|
onKeyDown: function onKeyDown(e) {
|
|
1841
1845
|
switch (e.key) {
|
|
@@ -1863,12 +1867,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
1863
1867
|
onFocus: function onFocus() {
|
|
1864
1868
|
onEventStart("select", task);
|
|
1865
1869
|
}
|
|
1866
|
-
}, taskItem
|
|
1867
|
-
x: getX(),
|
|
1868
|
-
y: task.y + taskHeight * 0.5,
|
|
1869
|
-
className: isTextInside ? style.barLabel : style.barLabelOutside,
|
|
1870
|
-
ref: textRef
|
|
1871
|
-
}, task.name));
|
|
1870
|
+
}, taskItem);
|
|
1872
1871
|
};
|
|
1873
1872
|
|
|
1874
1873
|
var TaskGanttContent = function TaskGanttContent(_ref) {
|