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