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