gantt-task-react-powern 0.4.48 → 0.4.49
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 +72 -12
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +72 -12
- 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);
|
|
@@ -135,6 +136,13 @@ var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount) {
|
|
|
135
136
|
newEndDate = startOfDate(newEndDate, "year");
|
|
136
137
|
break;
|
|
137
138
|
|
|
139
|
+
case ViewMode.Quarter:
|
|
140
|
+
newStartDate = addToDate(newStartDate, -1 * preStepsCount, "year");
|
|
141
|
+
newStartDate = startOfDate(newStartDate, "year");
|
|
142
|
+
newEndDate = addToDate(newEndDate, 1, "year");
|
|
143
|
+
newEndDate = startOfDate(newEndDate, "quarter");
|
|
144
|
+
break;
|
|
145
|
+
|
|
138
146
|
case ViewMode.Month:
|
|
139
147
|
newStartDate = addToDate(newStartDate, -1 * preStepsCount, "month");
|
|
140
148
|
newStartDate = startOfDate(newStartDate, "month");
|
|
@@ -190,6 +198,10 @@ var seedDates = function seedDates(startDate, endDate, viewMode) {
|
|
|
190
198
|
currentDate = addToDate(currentDate, 1, "year");
|
|
191
199
|
break;
|
|
192
200
|
|
|
201
|
+
case ViewMode.Quarter:
|
|
202
|
+
currentDate = addToDate(currentDate, 3, "month");
|
|
203
|
+
break;
|
|
204
|
+
|
|
193
205
|
case ViewMode.Month:
|
|
194
206
|
currentDate = addToDate(currentDate, 1, "month");
|
|
195
207
|
break;
|
|
@@ -834,6 +846,47 @@ var Calendar = function Calendar(_ref) {
|
|
|
834
846
|
return [topValues, bottomValues];
|
|
835
847
|
};
|
|
836
848
|
|
|
849
|
+
var getCalendarValuesForQuarter = function getCalendarValuesForQuarter() {
|
|
850
|
+
var topValues = [];
|
|
851
|
+
var bottomValues = [];
|
|
852
|
+
var topDefaultHeight = headerHeight * 0.5;
|
|
853
|
+
|
|
854
|
+
for (var i = 0; i < dateSetup.dates.length; i++) {
|
|
855
|
+
var date = dateSetup.dates[i];
|
|
856
|
+
var quarter = Math.floor(date.getMonth() / 3) + 1;
|
|
857
|
+
var bottomValue = "Q" + quarter;
|
|
858
|
+
bottomValues.push(React.createElement("text", {
|
|
859
|
+
key: bottomValue + "-" + date.getFullYear(),
|
|
860
|
+
y: headerHeight * 0.8,
|
|
861
|
+
x: columnWidth * i + columnWidth * 0.5,
|
|
862
|
+
className: styles$5.calendarBottomText
|
|
863
|
+
}, bottomValue));
|
|
864
|
+
|
|
865
|
+
if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
|
|
866
|
+
var topValue = date.getFullYear().toString();
|
|
867
|
+
var xText = void 0;
|
|
868
|
+
|
|
869
|
+
if (rtl) {
|
|
870
|
+
xText = (3 + i + quarter) * columnWidth;
|
|
871
|
+
} else {
|
|
872
|
+
xText = (3 + i - quarter) * columnWidth;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
topValues.push(React.createElement(TopPartOfCalendar, {
|
|
876
|
+
key: topValue,
|
|
877
|
+
value: topValue,
|
|
878
|
+
x1Line: columnWidth * i,
|
|
879
|
+
y1Line: 0,
|
|
880
|
+
y2Line: headerHeight,
|
|
881
|
+
xText: xText,
|
|
882
|
+
yText: topDefaultHeight * 0.9
|
|
883
|
+
}));
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
return [topValues, bottomValues];
|
|
888
|
+
};
|
|
889
|
+
|
|
837
890
|
var getCalendarValuesForMonth = function getCalendarValuesForMonth() {
|
|
838
891
|
var topValues = [];
|
|
839
892
|
var bottomValues = [];
|
|
@@ -1043,40 +1096,47 @@ var Calendar = function Calendar(_ref) {
|
|
|
1043
1096
|
bottomValues = _getCalendarValuesFor[1];
|
|
1044
1097
|
break;
|
|
1045
1098
|
|
|
1046
|
-
case ViewMode.
|
|
1047
|
-
var _getCalendarValuesFor2 =
|
|
1099
|
+
case ViewMode.Quarter:
|
|
1100
|
+
var _getCalendarValuesFor2 = getCalendarValuesForQuarter();
|
|
1048
1101
|
|
|
1049
1102
|
topValues = _getCalendarValuesFor2[0];
|
|
1050
1103
|
bottomValues = _getCalendarValuesFor2[1];
|
|
1051
1104
|
break;
|
|
1052
1105
|
|
|
1053
|
-
case ViewMode.
|
|
1054
|
-
var _getCalendarValuesFor3 =
|
|
1106
|
+
case ViewMode.Month:
|
|
1107
|
+
var _getCalendarValuesFor3 = getCalendarValuesForMonth();
|
|
1055
1108
|
|
|
1056
1109
|
topValues = _getCalendarValuesFor3[0];
|
|
1057
1110
|
bottomValues = _getCalendarValuesFor3[1];
|
|
1058
1111
|
break;
|
|
1059
1112
|
|
|
1060
|
-
case ViewMode.
|
|
1061
|
-
var _getCalendarValuesFor4 =
|
|
1113
|
+
case ViewMode.Week:
|
|
1114
|
+
var _getCalendarValuesFor4 = getCalendarValuesForWeek();
|
|
1062
1115
|
|
|
1063
1116
|
topValues = _getCalendarValuesFor4[0];
|
|
1064
1117
|
bottomValues = _getCalendarValuesFor4[1];
|
|
1065
1118
|
break;
|
|
1066
1119
|
|
|
1067
|
-
case ViewMode.
|
|
1068
|
-
|
|
1069
|
-
var _getCalendarValuesFor5 = getCalendarValuesForPartOfDay();
|
|
1120
|
+
case ViewMode.Day:
|
|
1121
|
+
var _getCalendarValuesFor5 = getCalendarValuesForDay();
|
|
1070
1122
|
|
|
1071
1123
|
topValues = _getCalendarValuesFor5[0];
|
|
1072
1124
|
bottomValues = _getCalendarValuesFor5[1];
|
|
1073
1125
|
break;
|
|
1074
1126
|
|
|
1075
|
-
case ViewMode.
|
|
1076
|
-
|
|
1127
|
+
case ViewMode.QuarterDay:
|
|
1128
|
+
case ViewMode.HalfDay:
|
|
1129
|
+
var _getCalendarValuesFor6 = getCalendarValuesForPartOfDay();
|
|
1077
1130
|
|
|
1078
1131
|
topValues = _getCalendarValuesFor6[0];
|
|
1079
1132
|
bottomValues = _getCalendarValuesFor6[1];
|
|
1133
|
+
break;
|
|
1134
|
+
|
|
1135
|
+
case ViewMode.Hour:
|
|
1136
|
+
var _getCalendarValuesFor7 = getCalendarValuesForHour();
|
|
1137
|
+
|
|
1138
|
+
topValues = _getCalendarValuesFor7[0];
|
|
1139
|
+
bottomValues = _getCalendarValuesFor7[1];
|
|
1080
1140
|
}
|
|
1081
1141
|
|
|
1082
1142
|
return React.createElement("g", {
|