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
|
@@ -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,
|
|
@@ -1539,6 +1561,8 @@ var styles$6 = {"barWrapper":"_KxSXS","barHandle":"_3w_5u","barBackground":"_31E
|
|
|
1539
1561
|
var BarDisplay = function BarDisplay(_ref) {
|
|
1540
1562
|
var x = _ref.x,
|
|
1541
1563
|
y = _ref.y,
|
|
1564
|
+
actualX1 = _ref.actualX1,
|
|
1565
|
+
actualX2 = _ref.actualX2,
|
|
1542
1566
|
width = _ref.width,
|
|
1543
1567
|
height = _ref.height,
|
|
1544
1568
|
isSelected = _ref.isSelected,
|
|
@@ -1562,16 +1586,24 @@ var BarDisplay = function BarDisplay(_ref) {
|
|
|
1562
1586
|
x: x,
|
|
1563
1587
|
width: width,
|
|
1564
1588
|
y: y,
|
|
1565
|
-
height: height,
|
|
1589
|
+
height: height / 2,
|
|
1566
1590
|
ry: barCornerRadius,
|
|
1567
1591
|
rx: barCornerRadius,
|
|
1568
1592
|
fill: getBarColor(),
|
|
1569
1593
|
className: styles$6.barBackground
|
|
1594
|
+
}), React__default.createElement("rect", {
|
|
1595
|
+
x: actualX1,
|
|
1596
|
+
width: actualX2 - actualX1,
|
|
1597
|
+
y: y + height / 2,
|
|
1598
|
+
height: height / 2,
|
|
1599
|
+
ry: barCornerRadius,
|
|
1600
|
+
rx: barCornerRadius,
|
|
1601
|
+
fill: styles.taskProgressColor
|
|
1570
1602
|
}), React__default.createElement("rect", {
|
|
1571
1603
|
x: progressX,
|
|
1572
1604
|
width: progressWidth,
|
|
1573
|
-
y: y,
|
|
1574
|
-
height: height,
|
|
1605
|
+
y: y + height / 2,
|
|
1606
|
+
height: height / 2,
|
|
1575
1607
|
ry: barCornerRadius,
|
|
1576
1608
|
rx: barCornerRadius,
|
|
1577
1609
|
fill: getProcessColor()
|
|
@@ -1598,13 +1630,9 @@ var BarDateHandle = function BarDateHandle(_ref) {
|
|
|
1598
1630
|
};
|
|
1599
1631
|
|
|
1600
1632
|
var BarProgressHandle = function BarProgressHandle(_ref) {
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
return React__default.createElement("
|
|
1604
|
-
className: styles$6.barHandle,
|
|
1605
|
-
points: progressPoint,
|
|
1606
|
-
onMouseDown: onMouseDown
|
|
1607
|
-
});
|
|
1633
|
+
_objectDestructuringEmpty(_ref);
|
|
1634
|
+
|
|
1635
|
+
return React__default.createElement("div", null);
|
|
1608
1636
|
};
|
|
1609
1637
|
|
|
1610
1638
|
var Bar = function Bar(_ref) {
|
|
@@ -1622,6 +1650,10 @@ var Bar = function Bar(_ref) {
|
|
|
1622
1650
|
}, React__default.createElement(BarDisplay, {
|
|
1623
1651
|
x: task.x1,
|
|
1624
1652
|
y: task.y,
|
|
1653
|
+
actualX1: task.actualx1,
|
|
1654
|
+
actualX2: task.actualx2,
|
|
1655
|
+
startProgressWidth: task.progressStartWidth,
|
|
1656
|
+
endProgressWidth: task.progressEndWidth,
|
|
1625
1657
|
width: task.x2 - task.x1,
|
|
1626
1658
|
height: task.height,
|
|
1627
1659
|
progressX: task.progressX,
|
|
@@ -1673,6 +1705,10 @@ var BarSmall = function BarSmall(_ref) {
|
|
|
1673
1705
|
}, React__default.createElement(BarDisplay, {
|
|
1674
1706
|
x: task.x1,
|
|
1675
1707
|
y: task.y,
|
|
1708
|
+
actualX1: task.actualx1,
|
|
1709
|
+
actualX2: task.actualx2,
|
|
1710
|
+
startProgressWidth: task.progressStartWidth,
|
|
1711
|
+
endProgressWidth: task.progressEndWidth,
|
|
1676
1712
|
width: task.x2 - task.x1,
|
|
1677
1713
|
height: task.height,
|
|
1678
1714
|
progressX: task.progressX,
|
|
@@ -1775,28 +1811,17 @@ var Project = function Project(_ref) {
|
|
|
1775
1811
|
}));
|
|
1776
1812
|
};
|
|
1777
1813
|
|
|
1778
|
-
var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
|
|
1779
|
-
|
|
1780
1814
|
var TaskItem = function TaskItem(props) {
|
|
1781
1815
|
var _props = _extends({}, props),
|
|
1782
1816
|
task = _props.task,
|
|
1783
|
-
arrowIndent = _props.arrowIndent,
|
|
1784
1817
|
isDelete = _props.isDelete,
|
|
1785
|
-
taskHeight = _props.taskHeight,
|
|
1786
1818
|
isSelected = _props.isSelected,
|
|
1787
|
-
rtl = _props.rtl,
|
|
1788
1819
|
onEventStart = _props.onEventStart;
|
|
1789
1820
|
|
|
1790
|
-
var textRef = React.useRef(null);
|
|
1791
|
-
|
|
1792
1821
|
var _useState = React.useState(React__default.createElement("div", null)),
|
|
1793
1822
|
taskItem = _useState[0],
|
|
1794
1823
|
setTaskItem = _useState[1];
|
|
1795
1824
|
|
|
1796
|
-
var _useState2 = React.useState(true),
|
|
1797
|
-
isTextInside = _useState2[0],
|
|
1798
|
-
setIsTextInside = _useState2[1];
|
|
1799
|
-
|
|
1800
1825
|
React.useEffect(function () {
|
|
1801
1826
|
switch (task.typeInternal) {
|
|
1802
1827
|
case "milestone":
|
|
@@ -1816,27 +1841,6 @@ var TaskItem = function TaskItem(props) {
|
|
|
1816
1841
|
break;
|
|
1817
1842
|
}
|
|
1818
1843
|
}, [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
1844
|
return React__default.createElement("g", {
|
|
1841
1845
|
onKeyDown: function onKeyDown(e) {
|
|
1842
1846
|
switch (e.key) {
|
|
@@ -1864,12 +1868,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
1864
1868
|
onFocus: function onFocus() {
|
|
1865
1869
|
onEventStart("select", task);
|
|
1866
1870
|
}
|
|
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));
|
|
1871
|
+
}, taskItem);
|
|
1873
1872
|
};
|
|
1874
1873
|
|
|
1875
1874
|
var TaskGanttContent = function TaskGanttContent(_ref) {
|