gantt-task-react-powern 0.3.11 → 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/components/task-list/task-list-table.d.ts +1 -0
- package/dist/components/task-list/task-list.d.ts +4 -1
- package/dist/index.css +0 -24
- package/dist/index.js +63 -55
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +63 -55
- package/dist/index.modern.js.map +1 -1
- package/dist/types/bar-task.d.ts +5 -0
- package/dist/types/public-types.d.ts +5 -0
- package/package.json +5 -2
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);
|
|
@@ -342,7 +346,11 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
342
346
|
fontFamily = _ref.fontFamily,
|
|
343
347
|
fontSize = _ref.fontSize,
|
|
344
348
|
locale = _ref.locale,
|
|
345
|
-
onExpanderClick = _ref.onExpanderClick
|
|
349
|
+
onExpanderClick = _ref.onExpanderClick,
|
|
350
|
+
_ref$taskLabelRendere = _ref.taskLabelRenderer,
|
|
351
|
+
taskLabelRenderer = _ref$taskLabelRendere === void 0 ? function (t) {
|
|
352
|
+
return " " + t.name;
|
|
353
|
+
} : _ref$taskLabelRendere;
|
|
346
354
|
var toLocaleDateString = useMemo(function () {
|
|
347
355
|
return toLocaleDateStringFactory(locale);
|
|
348
356
|
}, [locale]);
|
|
@@ -387,7 +395,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
387
395
|
minWidth: rowWidth,
|
|
388
396
|
maxWidth: rowWidth
|
|
389
397
|
}
|
|
390
|
-
},
|
|
398
|
+
}, taskLabelRenderer(t)), React.createElement("div", {
|
|
391
399
|
className: styles$1.taskListCell,
|
|
392
400
|
style: {
|
|
393
401
|
minWidth: rowWidth,
|
|
@@ -559,7 +567,8 @@ var TaskList = function TaskList(_ref) {
|
|
|
559
567
|
taskListRef = _ref.taskListRef,
|
|
560
568
|
horizontalContainerClass = _ref.horizontalContainerClass,
|
|
561
569
|
TaskListHeader = _ref.TaskListHeader,
|
|
562
|
-
TaskListTable = _ref.TaskListTable
|
|
570
|
+
TaskListTable = _ref.TaskListTable,
|
|
571
|
+
taskLabelRenderer = _ref.taskLabelRenderer;
|
|
563
572
|
var horizontalContainerRef = useRef(null);
|
|
564
573
|
useEffect(function () {
|
|
565
574
|
if (horizontalContainerRef.current) {
|
|
@@ -582,7 +591,8 @@ var TaskList = function TaskList(_ref) {
|
|
|
582
591
|
locale: locale,
|
|
583
592
|
selectedTaskId: selectedTaskId,
|
|
584
593
|
setSelectedTask: setSelectedTask,
|
|
585
|
-
onExpanderClick: onExpanderClick
|
|
594
|
+
onExpanderClick: onExpanderClick,
|
|
595
|
+
taskLabelRenderer: taskLabelRenderer
|
|
586
596
|
};
|
|
587
597
|
return React.createElement("div", {
|
|
588
598
|
ref: taskListRef
|
|
@@ -1144,15 +1154,25 @@ var convertToBarTask = function convertToBarTask(task, index, dates, columnWidth
|
|
|
1144
1154
|
var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) {
|
|
1145
1155
|
var x1;
|
|
1146
1156
|
var x2;
|
|
1157
|
+
var actualx1;
|
|
1158
|
+
var actualx2;
|
|
1159
|
+
var progressStartWidth;
|
|
1160
|
+
var progressEndWidth;
|
|
1147
1161
|
|
|
1148
1162
|
if (rtl) {
|
|
1149
1163
|
x2 = taskXCoordinateRTL(task.start, dates, columnWidth);
|
|
1150
1164
|
x1 = taskXCoordinateRTL(task.end, dates, columnWidth);
|
|
1165
|
+
actualx1 = taskXCoordinateRTL(task.actualStart, dates, columnWidth);
|
|
1166
|
+
actualx2 = taskXCoordinateRTL(task.actualEnd, dates, columnWidth);
|
|
1151
1167
|
} else {
|
|
1152
1168
|
x1 = taskXCoordinate(task.start, dates, columnWidth);
|
|
1153
1169
|
x2 = taskXCoordinate(task.end, dates, columnWidth);
|
|
1170
|
+
actualx1 = taskXCoordinate(task.actualStart, dates, columnWidth);
|
|
1171
|
+
actualx2 = taskXCoordinate(task.actualEnd, dates, columnWidth);
|
|
1154
1172
|
}
|
|
1155
1173
|
|
|
1174
|
+
progressStartWidth = Math.abs(actualx1 - x1);
|
|
1175
|
+
progressEndWidth = Math.abs(actualx2 - x2);
|
|
1156
1176
|
var typeInternal = task.type;
|
|
1157
1177
|
|
|
1158
1178
|
if (typeInternal === "task" && x2 - x1 < handleWidth * 2) {
|
|
@@ -1160,7 +1180,7 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
1160
1180
|
x2 = x1 + handleWidth * 2;
|
|
1161
1181
|
}
|
|
1162
1182
|
|
|
1163
|
-
var _progressWithByParams = progressWithByParams(
|
|
1183
|
+
var _progressWithByParams = progressWithByParams(actualx1, actualx2, task.progress, rtl),
|
|
1164
1184
|
progressWidth = _progressWithByParams[0],
|
|
1165
1185
|
progressX = _progressWithByParams[1];
|
|
1166
1186
|
|
|
@@ -1178,6 +1198,10 @@ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHei
|
|
|
1178
1198
|
typeInternal: typeInternal,
|
|
1179
1199
|
x1: x1,
|
|
1180
1200
|
x2: x2,
|
|
1201
|
+
actualx1: actualx1,
|
|
1202
|
+
actualx2: actualx2,
|
|
1203
|
+
progressStartWidth: progressStartWidth,
|
|
1204
|
+
progressEndWidth: progressEndWidth,
|
|
1181
1205
|
y: y,
|
|
1182
1206
|
index: index,
|
|
1183
1207
|
progressX: progressX,
|
|
@@ -1209,6 +1233,10 @@ var convertToMilestone = function convertToMilestone(task, index, dates, columnW
|
|
|
1209
1233
|
end: task.start,
|
|
1210
1234
|
x1: x1,
|
|
1211
1235
|
x2: x2,
|
|
1236
|
+
actualx1: x1,
|
|
1237
|
+
actualx2: x2,
|
|
1238
|
+
progressStartWidth: 0,
|
|
1239
|
+
progressEndWidth: 0,
|
|
1212
1240
|
y: y,
|
|
1213
1241
|
index: index,
|
|
1214
1242
|
progressX: 0,
|
|
@@ -1532,6 +1560,8 @@ var styles$6 = {"barWrapper":"_KxSXS","barHandle":"_3w_5u","barBackground":"_31E
|
|
|
1532
1560
|
var BarDisplay = function BarDisplay(_ref) {
|
|
1533
1561
|
var x = _ref.x,
|
|
1534
1562
|
y = _ref.y,
|
|
1563
|
+
actualX1 = _ref.actualX1,
|
|
1564
|
+
actualX2 = _ref.actualX2,
|
|
1535
1565
|
width = _ref.width,
|
|
1536
1566
|
height = _ref.height,
|
|
1537
1567
|
isSelected = _ref.isSelected,
|
|
@@ -1555,16 +1585,24 @@ var BarDisplay = function BarDisplay(_ref) {
|
|
|
1555
1585
|
x: x,
|
|
1556
1586
|
width: width,
|
|
1557
1587
|
y: y,
|
|
1558
|
-
height: height,
|
|
1588
|
+
height: height / 2,
|
|
1559
1589
|
ry: barCornerRadius,
|
|
1560
1590
|
rx: barCornerRadius,
|
|
1561
1591
|
fill: getBarColor(),
|
|
1562
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
|
|
1563
1601
|
}), React.createElement("rect", {
|
|
1564
1602
|
x: progressX,
|
|
1565
1603
|
width: progressWidth,
|
|
1566
|
-
y: y,
|
|
1567
|
-
height: height,
|
|
1604
|
+
y: y + height / 2,
|
|
1605
|
+
height: height / 2,
|
|
1568
1606
|
ry: barCornerRadius,
|
|
1569
1607
|
rx: barCornerRadius,
|
|
1570
1608
|
fill: getProcessColor()
|
|
@@ -1591,13 +1629,9 @@ var BarDateHandle = function BarDateHandle(_ref) {
|
|
|
1591
1629
|
};
|
|
1592
1630
|
|
|
1593
1631
|
var BarProgressHandle = function BarProgressHandle(_ref) {
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
return React.createElement("
|
|
1597
|
-
className: styles$6.barHandle,
|
|
1598
|
-
points: progressPoint,
|
|
1599
|
-
onMouseDown: onMouseDown
|
|
1600
|
-
});
|
|
1632
|
+
_objectDestructuringEmpty(_ref);
|
|
1633
|
+
|
|
1634
|
+
return React.createElement("div", null);
|
|
1601
1635
|
};
|
|
1602
1636
|
|
|
1603
1637
|
var Bar = function Bar(_ref) {
|
|
@@ -1615,6 +1649,10 @@ var Bar = function Bar(_ref) {
|
|
|
1615
1649
|
}, React.createElement(BarDisplay, {
|
|
1616
1650
|
x: task.x1,
|
|
1617
1651
|
y: task.y,
|
|
1652
|
+
actualX1: task.actualx1,
|
|
1653
|
+
actualX2: task.actualx2,
|
|
1654
|
+
startProgressWidth: task.progressStartWidth,
|
|
1655
|
+
endProgressWidth: task.progressEndWidth,
|
|
1618
1656
|
width: task.x2 - task.x1,
|
|
1619
1657
|
height: task.height,
|
|
1620
1658
|
progressX: task.progressX,
|
|
@@ -1666,6 +1704,10 @@ var BarSmall = function BarSmall(_ref) {
|
|
|
1666
1704
|
}, React.createElement(BarDisplay, {
|
|
1667
1705
|
x: task.x1,
|
|
1668
1706
|
y: task.y,
|
|
1707
|
+
actualX1: task.actualx1,
|
|
1708
|
+
actualX2: task.actualx2,
|
|
1709
|
+
startProgressWidth: task.progressStartWidth,
|
|
1710
|
+
endProgressWidth: task.progressEndWidth,
|
|
1669
1711
|
width: task.x2 - task.x1,
|
|
1670
1712
|
height: task.height,
|
|
1671
1713
|
progressX: task.progressX,
|
|
@@ -1768,28 +1810,17 @@ var Project = function Project(_ref) {
|
|
|
1768
1810
|
}));
|
|
1769
1811
|
};
|
|
1770
1812
|
|
|
1771
|
-
var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
|
|
1772
|
-
|
|
1773
1813
|
var TaskItem = function TaskItem(props) {
|
|
1774
1814
|
var _props = _extends({}, props),
|
|
1775
1815
|
task = _props.task,
|
|
1776
|
-
arrowIndent = _props.arrowIndent,
|
|
1777
1816
|
isDelete = _props.isDelete,
|
|
1778
|
-
taskHeight = _props.taskHeight,
|
|
1779
1817
|
isSelected = _props.isSelected,
|
|
1780
|
-
rtl = _props.rtl,
|
|
1781
1818
|
onEventStart = _props.onEventStart;
|
|
1782
1819
|
|
|
1783
|
-
var textRef = useRef(null);
|
|
1784
|
-
|
|
1785
1820
|
var _useState = useState(React.createElement("div", null)),
|
|
1786
1821
|
taskItem = _useState[0],
|
|
1787
1822
|
setTaskItem = _useState[1];
|
|
1788
1823
|
|
|
1789
|
-
var _useState2 = useState(true),
|
|
1790
|
-
isTextInside = _useState2[0],
|
|
1791
|
-
setIsTextInside = _useState2[1];
|
|
1792
|
-
|
|
1793
1824
|
useEffect(function () {
|
|
1794
1825
|
switch (task.typeInternal) {
|
|
1795
1826
|
case "milestone":
|
|
@@ -1809,27 +1840,6 @@ var TaskItem = function TaskItem(props) {
|
|
|
1809
1840
|
break;
|
|
1810
1841
|
}
|
|
1811
1842
|
}, [task, isSelected]);
|
|
1812
|
-
useEffect(function () {
|
|
1813
|
-
if (textRef.current) {
|
|
1814
|
-
setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
|
|
1815
|
-
}
|
|
1816
|
-
}, [textRef, task]);
|
|
1817
|
-
|
|
1818
|
-
var getX = function getX() {
|
|
1819
|
-
var width = task.x2 - task.x1;
|
|
1820
|
-
var hasChild = task.barChildren.length > 0;
|
|
1821
|
-
|
|
1822
|
-
if (isTextInside) {
|
|
1823
|
-
return task.x1 + width * 0.5;
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
|
-
if (rtl && textRef.current) {
|
|
1827
|
-
return task.x1 - textRef.current.getBBox().width - arrowIndent * +hasChild - arrowIndent * 0.2;
|
|
1828
|
-
} else {
|
|
1829
|
-
return task.x1 + width + arrowIndent * +hasChild + arrowIndent * 0.2;
|
|
1830
|
-
}
|
|
1831
|
-
};
|
|
1832
|
-
|
|
1833
1843
|
return React.createElement("g", {
|
|
1834
1844
|
onKeyDown: function onKeyDown(e) {
|
|
1835
1845
|
switch (e.key) {
|
|
@@ -1857,12 +1867,7 @@ var TaskItem = function TaskItem(props) {
|
|
|
1857
1867
|
onFocus: function onFocus() {
|
|
1858
1868
|
onEventStart("select", task);
|
|
1859
1869
|
}
|
|
1860
|
-
}, taskItem
|
|
1861
|
-
x: getX(),
|
|
1862
|
-
y: task.y + taskHeight * 0.5,
|
|
1863
|
-
className: isTextInside ? style.barLabel : style.barLabelOutside,
|
|
1864
|
-
ref: textRef
|
|
1865
|
-
}, task.name));
|
|
1870
|
+
}, taskItem);
|
|
1866
1871
|
};
|
|
1867
1872
|
|
|
1868
1873
|
var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
@@ -2285,7 +2290,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
2285
2290
|
onClick = _ref.onClick,
|
|
2286
2291
|
onDelete = _ref.onDelete,
|
|
2287
2292
|
onSelect = _ref.onSelect,
|
|
2288
|
-
onExpanderClick = _ref.onExpanderClick
|
|
2293
|
+
onExpanderClick = _ref.onExpanderClick,
|
|
2294
|
+
taskLabelRenderer = _ref.taskLabelRenderer;
|
|
2289
2295
|
var wrapperRef = useRef(null);
|
|
2290
2296
|
var taskListRef = useRef(null);
|
|
2291
2297
|
|
|
@@ -2657,8 +2663,10 @@ var Gantt = function Gantt(_ref) {
|
|
|
2657
2663
|
taskListRef: taskListRef,
|
|
2658
2664
|
setSelectedTask: handleSelectedTask,
|
|
2659
2665
|
onExpanderClick: handleExpanderClick,
|
|
2666
|
+
onDoubleClick: onDoubleClick,
|
|
2660
2667
|
TaskListHeader: TaskListHeader,
|
|
2661
|
-
TaskListTable: TaskListTable
|
|
2668
|
+
TaskListTable: TaskListTable,
|
|
2669
|
+
taskLabelRenderer: taskLabelRenderer
|
|
2662
2670
|
};
|
|
2663
2671
|
return React.createElement("div", null, React.createElement("div", {
|
|
2664
2672
|
className: styles$9.wrapper,
|