gantt-task-react-powern 0.4.48 → 0.4.50
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/helpers/date-helper.d.ts +1 -1
- package/dist/index.js +76 -14
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +76 -14
- package/dist/index.modern.js.map +1 -1
- package/dist/types/public-types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -69,6 +69,7 @@ var ViewMode;
|
|
|
69
69
|
ViewMode["Day"] = "Day";
|
|
70
70
|
ViewMode["Week"] = "Week";
|
|
71
71
|
ViewMode["Month"] = "Month";
|
|
72
|
+
ViewMode["Quarter"] = "Quarter";
|
|
72
73
|
ViewMode["Year"] = "Year";
|
|
73
74
|
})(ViewMode || (ViewMode = {}));
|
|
74
75
|
|
|
@@ -93,7 +94,7 @@ var addToDate = function addToDate(date, quantity, scale) {
|
|
|
93
94
|
return newDate;
|
|
94
95
|
};
|
|
95
96
|
var startOfDate = function startOfDate(date, scale) {
|
|
96
|
-
var scores = ["millisecond", "second", "minute", "hour", "day", "month", "year"];
|
|
97
|
+
var scores = ["millisecond", "second", "minute", "hour", "day", "month", "quarter", "year"];
|
|
97
98
|
|
|
98
99
|
var shouldReset = function shouldReset(_scale) {
|
|
99
100
|
var maxScore = scores.indexOf(scale);
|
|
@@ -104,8 +105,10 @@ var startOfDate = function startOfDate(date, scale) {
|
|
|
104
105
|
return newDate;
|
|
105
106
|
};
|
|
106
107
|
var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount) {
|
|
107
|
-
var
|
|
108
|
-
|
|
108
|
+
var _tasks$, _tasks$2;
|
|
109
|
+
|
|
110
|
+
var newStartDate = ((_tasks$ = tasks[0]) === null || _tasks$ === void 0 ? void 0 : _tasks$.start) || new Date();
|
|
111
|
+
var newEndDate = ((_tasks$2 = tasks[0]) === null || _tasks$2 === void 0 ? void 0 : _tasks$2.start) || new Date();
|
|
109
112
|
|
|
110
113
|
for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
|
|
111
114
|
var task = _step.value;
|
|
@@ -135,6 +138,13 @@ var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount) {
|
|
|
135
138
|
newEndDate = startOfDate(newEndDate, "year");
|
|
136
139
|
break;
|
|
137
140
|
|
|
141
|
+
case ViewMode.Quarter:
|
|
142
|
+
newStartDate = addToDate(newStartDate, -1 * preStepsCount, "year");
|
|
143
|
+
newStartDate = startOfDate(newStartDate, "year");
|
|
144
|
+
newEndDate = addToDate(newEndDate, 1, "year");
|
|
145
|
+
newEndDate = startOfDate(newEndDate, "quarter");
|
|
146
|
+
break;
|
|
147
|
+
|
|
138
148
|
case ViewMode.Month:
|
|
139
149
|
newStartDate = addToDate(newStartDate, -1 * preStepsCount, "month");
|
|
140
150
|
newStartDate = startOfDate(newStartDate, "month");
|
|
@@ -190,6 +200,10 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
|
|
|
190
200
|
currentDate = addToDate(currentDate, 1, "year");
|
|
191
201
|
break;
|
|
192
202
|
|
|
203
|
+
case ViewMode.Quarter:
|
|
204
|
+
currentDate = addToDate(currentDate, 3, "month");
|
|
205
|
+
break;
|
|
206
|
+
|
|
193
207
|
case ViewMode.Month:
|
|
194
208
|
currentDate = addToDate(currentDate, 1, "month");
|
|
195
209
|
break;
|
|
@@ -834,6 +848,47 @@ var Calendar = function Calendar(_ref) {
|
|
|
834
848
|
return [topValues, bottomValues];
|
|
835
849
|
};
|
|
836
850
|
|
|
851
|
+
var getCalendarValuesForQuarter = function getCalendarValuesForQuarter() {
|
|
852
|
+
var topValues = [];
|
|
853
|
+
var bottomValues = [];
|
|
854
|
+
var topDefaultHeight = headerHeight * 0.5;
|
|
855
|
+
|
|
856
|
+
for (var i = 0; i < dateSetup.dates.length; i++) {
|
|
857
|
+
var date = dateSetup.dates[i];
|
|
858
|
+
var quarter = Math.floor(date.getMonth() / 3) + 1;
|
|
859
|
+
var bottomValue = "Q" + quarter;
|
|
860
|
+
bottomValues.push(React.createElement("text", {
|
|
861
|
+
key: bottomValue + "-" + date.getFullYear(),
|
|
862
|
+
y: headerHeight * 0.8,
|
|
863
|
+
x: columnWidth * i + columnWidth * 0.5,
|
|
864
|
+
className: styles$5.calendarBottomText
|
|
865
|
+
}, bottomValue));
|
|
866
|
+
|
|
867
|
+
if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
|
|
868
|
+
var topValue = date.getFullYear().toString();
|
|
869
|
+
var xText = void 0;
|
|
870
|
+
|
|
871
|
+
if (rtl) {
|
|
872
|
+
xText = (3 + i + quarter) * columnWidth;
|
|
873
|
+
} else {
|
|
874
|
+
xText = (3 + i - quarter) * columnWidth;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
topValues.push(React.createElement(TopPartOfCalendar, {
|
|
878
|
+
key: topValue,
|
|
879
|
+
value: topValue,
|
|
880
|
+
x1Line: columnWidth * i,
|
|
881
|
+
y1Line: 0,
|
|
882
|
+
y2Line: headerHeight,
|
|
883
|
+
xText: xText,
|
|
884
|
+
yText: topDefaultHeight * 0.9
|
|
885
|
+
}));
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
return [topValues, bottomValues];
|
|
890
|
+
};
|
|
891
|
+
|
|
837
892
|
var getCalendarValuesForMonth = function getCalendarValuesForMonth() {
|
|
838
893
|
var topValues = [];
|
|
839
894
|
var bottomValues = [];
|
|
@@ -1043,40 +1098,47 @@ var Calendar = function Calendar(_ref) {
|
|
|
1043
1098
|
bottomValues = _getCalendarValuesFor[1];
|
|
1044
1099
|
break;
|
|
1045
1100
|
|
|
1046
|
-
case ViewMode.
|
|
1047
|
-
var _getCalendarValuesFor2 =
|
|
1101
|
+
case ViewMode.Quarter:
|
|
1102
|
+
var _getCalendarValuesFor2 = getCalendarValuesForQuarter();
|
|
1048
1103
|
|
|
1049
1104
|
topValues = _getCalendarValuesFor2[0];
|
|
1050
1105
|
bottomValues = _getCalendarValuesFor2[1];
|
|
1051
1106
|
break;
|
|
1052
1107
|
|
|
1053
|
-
case ViewMode.
|
|
1054
|
-
var _getCalendarValuesFor3 =
|
|
1108
|
+
case ViewMode.Month:
|
|
1109
|
+
var _getCalendarValuesFor3 = getCalendarValuesForMonth();
|
|
1055
1110
|
|
|
1056
1111
|
topValues = _getCalendarValuesFor3[0];
|
|
1057
1112
|
bottomValues = _getCalendarValuesFor3[1];
|
|
1058
1113
|
break;
|
|
1059
1114
|
|
|
1060
|
-
case ViewMode.
|
|
1061
|
-
var _getCalendarValuesFor4 =
|
|
1115
|
+
case ViewMode.Week:
|
|
1116
|
+
var _getCalendarValuesFor4 = getCalendarValuesForWeek();
|
|
1062
1117
|
|
|
1063
1118
|
topValues = _getCalendarValuesFor4[0];
|
|
1064
1119
|
bottomValues = _getCalendarValuesFor4[1];
|
|
1065
1120
|
break;
|
|
1066
1121
|
|
|
1067
|
-
case ViewMode.
|
|
1068
|
-
|
|
1069
|
-
var _getCalendarValuesFor5 = getCalendarValuesForPartOfDay();
|
|
1122
|
+
case ViewMode.Day:
|
|
1123
|
+
var _getCalendarValuesFor5 = getCalendarValuesForDay();
|
|
1070
1124
|
|
|
1071
1125
|
topValues = _getCalendarValuesFor5[0];
|
|
1072
1126
|
bottomValues = _getCalendarValuesFor5[1];
|
|
1073
1127
|
break;
|
|
1074
1128
|
|
|
1075
|
-
case ViewMode.
|
|
1076
|
-
|
|
1129
|
+
case ViewMode.QuarterDay:
|
|
1130
|
+
case ViewMode.HalfDay:
|
|
1131
|
+
var _getCalendarValuesFor6 = getCalendarValuesForPartOfDay();
|
|
1077
1132
|
|
|
1078
1133
|
topValues = _getCalendarValuesFor6[0];
|
|
1079
1134
|
bottomValues = _getCalendarValuesFor6[1];
|
|
1135
|
+
break;
|
|
1136
|
+
|
|
1137
|
+
case ViewMode.Hour:
|
|
1138
|
+
var _getCalendarValuesFor7 = getCalendarValuesForHour();
|
|
1139
|
+
|
|
1140
|
+
topValues = _getCalendarValuesFor7[0];
|
|
1141
|
+
bottomValues = _getCalendarValuesFor7[1];
|
|
1080
1142
|
}
|
|
1081
1143
|
|
|
1082
1144
|
return React.createElement("g", {
|