sapp-common-package-test-final 1.7.0 → 1.7.2
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/index.js +72 -89
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +72 -89
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -138,68 +138,6 @@ var CALENDAR_TYPE;
|
|
138
138
|
CALENDAR_TYPE["LMS"] = "LMS";
|
139
139
|
})(CALENDAR_TYPE || (CALENDAR_TYPE = {}));
|
140
140
|
|
141
|
-
var _convertType;
|
142
|
-
var customDateFormat = function customDateFormat(value, formatStr) {
|
143
|
-
return dayjs(value).format(formatStr);
|
144
|
-
};
|
145
|
-
var convertType = (_convertType = {}, _convertType[EVENT_TYPES.TEACHING] = 'info', _convertType[EVENT_TYPES.BUSY] = 'error', _convertType[EVENT_TYPES.HOLIDAY] = 'warning', _convertType[EVENT_TYPES.OTHER] = 'success', _convertType[EVENT_TYPES.LIVE_ONLINE] = 'purple', _convertType);
|
146
|
-
var daysOfWeekKeys = Object.values(DAYS_OF_WEEK);
|
147
|
-
var calculateNormOfWeek = function calculateNormOfWeek(norms, events, startDate, endDate) {
|
148
|
-
var norm = norms.find(function (norm) {
|
149
|
-
return startDate.isBetween(norm.startDate, norm.endDate, 'day', '[]') && endDate.isBetween(norm.startDate, norm.endDate, 'day', '[]');
|
150
|
-
});
|
151
|
-
if (!norm) {
|
152
|
-
return {
|
153
|
-
normOfWeek: 0,
|
154
|
-
totalNorm: 0
|
155
|
-
};
|
156
|
-
}
|
157
|
-
var normsOfWeek = events.filter(function (event) {
|
158
|
-
return dayjs(event.startDate).isBetween(startDate, endDate, 'day', '[]') && endDate.isBetween(startDate, endDate, 'day', '[]') && event.type === EVENT_TYPES.TEACHING;
|
159
|
-
});
|
160
|
-
return {
|
161
|
-
normOfWeek: normsOfWeek.length,
|
162
|
-
totalNorm: norm.maxShift
|
163
|
-
};
|
164
|
-
};
|
165
|
-
var splitEventsIntoDays = function splitEventsIntoDays(events) {
|
166
|
-
var splittedEvents = [];
|
167
|
-
for (var _iterator = _createForOfIteratorHelperLoose(events), _step; !(_step = _iterator()).done;) {
|
168
|
-
var event = _step.value;
|
169
|
-
var startDate = dayjs(event.startDate);
|
170
|
-
var endDate = dayjs(event.endDate);
|
171
|
-
var isSameDay = startDate.isSame(endDate, 'day');
|
172
|
-
if (isSameDay) {
|
173
|
-
splittedEvents.push(event);
|
174
|
-
continue;
|
175
|
-
}
|
176
|
-
splittedEvents.push(_extends({}, event, {
|
177
|
-
startDate: startDate.toDate(),
|
178
|
-
endDate: startDate.endOf('day').toDate()
|
179
|
-
}));
|
180
|
-
var currentDate = startDate.startOf('day').add(1, 'day');
|
181
|
-
while (currentDate.isBefore(endDate, 'day')) {
|
182
|
-
splittedEvents.push(_extends({}, event, {
|
183
|
-
startDate: currentDate.startOf('day').toDate(),
|
184
|
-
endDate: currentDate.endOf('day').toDate()
|
185
|
-
}));
|
186
|
-
currentDate = currentDate.add(1, 'day');
|
187
|
-
}
|
188
|
-
splittedEvents.push(_extends({}, event, {
|
189
|
-
startDate: endDate.startOf('day').toDate(),
|
190
|
-
endDate: endDate.toDate()
|
191
|
-
}));
|
192
|
-
}
|
193
|
-
return splittedEvents;
|
194
|
-
};
|
195
|
-
var checkIsAllday = function checkIsAllday(startDate, endDate) {
|
196
|
-
if (!startDate.isValid() || !endDate.isValid()) {
|
197
|
-
return false;
|
198
|
-
}
|
199
|
-
return startDate.format(TIME_FORMAT) === startDate.startOf('day').format(TIME_FORMAT) && endDate.format(TIME_FORMAT) === endDate.endOf('day').format(TIME_FORMAT) && startDate.isBefore(endDate);
|
200
|
-
};
|
201
|
-
var hoursOfDayKeys = Object.values(HOUR_OF_DAY);
|
202
|
-
|
203
141
|
var _getIconEvent;
|
204
142
|
var Left = function Left() {
|
205
143
|
return React__default.createElement("svg", {
|
@@ -467,6 +405,75 @@ var getIconforEvent = function getIconforEvent(event) {
|
|
467
405
|
}
|
468
406
|
};
|
469
407
|
|
408
|
+
var _convertType;
|
409
|
+
var customDateFormat = function customDateFormat(value, formatStr) {
|
410
|
+
return dayjs(value).format(formatStr);
|
411
|
+
};
|
412
|
+
var convertType = (_convertType = {}, _convertType[EVENT_TYPES.TEACHING] = 'info', _convertType[EVENT_TYPES.BUSY] = 'error', _convertType[EVENT_TYPES.HOLIDAY] = 'warning', _convertType[EVENT_TYPES.OTHER] = 'success', _convertType[EVENT_TYPES.LIVE_ONLINE] = 'purple', _convertType);
|
413
|
+
var daysOfWeekKeys = Object.values(DAYS_OF_WEEK);
|
414
|
+
var calculateNormOfWeek = function calculateNormOfWeek(norms, events, startDate, endDate) {
|
415
|
+
var norm = norms.find(function (norm) {
|
416
|
+
return startDate.isBetween(norm.startDate, norm.endDate, 'day', '[]') && endDate.isBetween(norm.startDate, norm.endDate, 'day', '[]');
|
417
|
+
});
|
418
|
+
if (!norm) {
|
419
|
+
return {
|
420
|
+
normOfWeek: 0,
|
421
|
+
totalNorm: 0
|
422
|
+
};
|
423
|
+
}
|
424
|
+
var normsOfWeek = events.filter(function (event) {
|
425
|
+
return dayjs(event.startDate).isBetween(startDate, endDate, 'day', '[]') && endDate.isBetween(startDate, endDate, 'day', '[]') && event.type === EVENT_TYPES.TEACHING;
|
426
|
+
});
|
427
|
+
return {
|
428
|
+
normOfWeek: normsOfWeek.length,
|
429
|
+
totalNorm: norm.maxShift
|
430
|
+
};
|
431
|
+
};
|
432
|
+
var splitEventsIntoDays = function splitEventsIntoDays(events) {
|
433
|
+
var splittedEvents = [];
|
434
|
+
for (var _iterator = _createForOfIteratorHelperLoose(events), _step; !(_step = _iterator()).done;) {
|
435
|
+
var event = _step.value;
|
436
|
+
var startDate = dayjs(event.startDate);
|
437
|
+
var endDate = dayjs(event.endDate);
|
438
|
+
var isSameDay = startDate.isSame(endDate, 'day');
|
439
|
+
if (isSameDay) {
|
440
|
+
splittedEvents.push(event);
|
441
|
+
continue;
|
442
|
+
}
|
443
|
+
splittedEvents.push(_extends({}, event, {
|
444
|
+
startDate: startDate.toDate(),
|
445
|
+
endDate: startDate.endOf('day').toDate()
|
446
|
+
}));
|
447
|
+
var currentDate = startDate.startOf('day').add(1, 'day');
|
448
|
+
while (currentDate.isBefore(endDate, 'day')) {
|
449
|
+
splittedEvents.push(_extends({}, event, {
|
450
|
+
startDate: currentDate.startOf('day').toDate(),
|
451
|
+
endDate: currentDate.endOf('day').toDate()
|
452
|
+
}));
|
453
|
+
currentDate = currentDate.add(1, 'day');
|
454
|
+
}
|
455
|
+
splittedEvents.push(_extends({}, event, {
|
456
|
+
startDate: endDate.startOf('day').toDate(),
|
457
|
+
endDate: endDate.toDate()
|
458
|
+
}));
|
459
|
+
}
|
460
|
+
return splittedEvents;
|
461
|
+
};
|
462
|
+
var checkIsAllday = function checkIsAllday(startDate, endDate) {
|
463
|
+
if (!startDate.isValid() || !endDate.isValid()) {
|
464
|
+
return false;
|
465
|
+
}
|
466
|
+
return startDate.format(TIME_FORMAT) === startDate.startOf('day').format(TIME_FORMAT) && endDate.format(TIME_FORMAT) === endDate.endOf('day').format(TIME_FORMAT) && startDate.isBefore(endDate);
|
467
|
+
};
|
468
|
+
var hoursOfDayKeys = Object.values(HOUR_OF_DAY);
|
469
|
+
var isDisplayIcon = function isDisplayIcon(event) {
|
470
|
+
var iconList = getIconforEvent(event);
|
471
|
+
if (event.source === 'LMS') {
|
472
|
+
return Array.isArray(iconList) && iconList.length > 0;
|
473
|
+
}
|
474
|
+
return !!iconList;
|
475
|
+
};
|
476
|
+
|
470
477
|
var styles = {"transform":"_3-Pu9","cursor-pointer":"_2Mcv6","resize":"_uCXxT","rounded-none":"_3EfQZ","border":"_3-abu","border-gray-4":"_3-NVJ","bg-button":"_3-gs3","bg-info/10":"_2ENMR","bg-white":"_rF-HF","!text-error":"_3mBZd","text-black":"_Irb_H","text-gray-600":"_1pL5w","text-info":"_NLvfI","text-secondary-text":"_H-zEU","!filter":"_3vIFr","filter":"_p0OEu","sapp-calendar":"_18t93","btn":"_1oiD_","icon":"_-E7rn","btn-default":"_3WrnL","btn-primary":"_2-qBL","event-info":"_xYqjb","event-warning":"_1oq3N","event-success":"_1hTMm","event-purple":"_30cym","event-error":"_1hEJk","event-default":"_8FWXy","sapp-calendar__container":"_102cL","header-calendar":"_3Yvs5","header-calendar__nav":"_18m93","header-calendar__date-picker":"_2GTYD","header-calendar__title":"_35LQ0","header-calendar__controls":"_FqVqb","header-calendar__divider":"_3kHog","monthly-calendar":"_2NDGW","weekly-calendar":"_1QrJs","monthly-calendar__title":"_3Tsy4","monthly-calendar__title-active":"_1Dyjm","weekly-norm__cell":"_sGK9m","weekly-norm__value":"_1Jsb-","monthly-calendar__cell":"_2hVZ4","monthly-calendar__cell--active":"_1uenJ","calendar-tooltip":"_2Uo1f","monthly-event__title":"_2gsg7","monthly-event__date":"_2GtPn","weekly-calendar__title":"_5WuQ8","weekly-calendar__cell":"_3lPkV","event--min-height":"_ZZSJH","weekly-event":"_hnHem","weekly-event__title":"_21a0T","weekly-event__date":"_PiKmX","weekly-event--collapse":"_1pvXT","btn-lms-default":"_1GA3p","ant-select-dropdown":"__OFBr","text-lms-primary":"_1gLzS","header-calendar_filter":"_1fd_Y","ant-picker-calendar-header":"_2IWLV","ant-picker-calendar-mode-switch":"_2jvy8","hover-item":"_3im6B","weekly-event__title_icon":"_3OUWM","monthly-event__date_tablet":"_2HhKK","calendar-filter":"_2n63y","see-more":"_1uakm","weekly-calendar-lms__cell":"__PqI3","truncate-text":"_184xQ"};
|
471
478
|
|
472
479
|
var Button = function Button(_ref) {
|
@@ -577,14 +584,6 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
577
584
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
578
585
|
var formattedDateStart = customDateFormat(event.startDate, TIME_FORMAT);
|
579
586
|
var iconList = getIconforEvent(event);
|
580
|
-
var isDisplayIcon = function isDisplayIcon() {
|
581
|
-
var iconList = getIconforEvent(event);
|
582
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
583
|
-
return true;
|
584
|
-
} else {
|
585
|
-
return !!iconList;
|
586
|
-
}
|
587
|
-
};
|
588
587
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("li", {
|
589
588
|
className: styles["event-" + (isSameMonth ? convertType[event.type] : 'default')],
|
590
589
|
style: {
|
@@ -595,7 +594,7 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
595
594
|
}
|
596
595
|
}, React__default.createElement("div", {
|
597
596
|
className: styles['monthly-event__title']
|
598
|
-
}, isDisplayIcon() && React__default.createElement("div", {
|
597
|
+
}, isDisplayIcon(event) && React__default.createElement("div", {
|
599
598
|
className: styles['weekly-event__title_icon']
|
600
599
|
}, iconList), React__default.createElement(CustomTooltip, {
|
601
600
|
title: event.title
|
@@ -789,14 +788,6 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
789
788
|
var isMinHeight = height < MIN_HEIGHT_EVENT;
|
790
789
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
791
790
|
var iconList = getIconforEvent(event);
|
792
|
-
var isDisplayIcon = function isDisplayIcon() {
|
793
|
-
var iconList = getIconforEvent(event);
|
794
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
795
|
-
return true;
|
796
|
-
} else {
|
797
|
-
return !!iconList;
|
798
|
-
}
|
799
|
-
};
|
800
791
|
return React__default.createElement("div", {
|
801
792
|
className: clsx__default(styles["event-" + convertType[event.type]], isMinHeight && styles['event--min-height']),
|
802
793
|
onClick: function onClick() {
|
@@ -814,7 +805,7 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
814
805
|
className: clsx__default(height <= MIN_HEIGHT_HIDE_DETAILS && styles['weekly-event--collapse'])
|
815
806
|
}, React__default.createElement("div", {
|
816
807
|
className: styles['weekly-event__title']
|
817
|
-
}, isDisplayIcon() && React__default.createElement("div", {
|
808
|
+
}, isDisplayIcon(event) && React__default.createElement("div", {
|
818
809
|
className: styles['weekly-event__title_icon']
|
819
810
|
}, iconList), React__default.createElement(CustomTooltip, {
|
820
811
|
title: event.title
|
@@ -1009,14 +1000,6 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1009
1000
|
width = _calculateBoxSize.width,
|
1010
1001
|
left = _calculateBoxSize.left;
|
1011
1002
|
var iconList = getIconforEvent(event);
|
1012
|
-
var isDisplayIcon = function isDisplayIcon() {
|
1013
|
-
var iconList = getIconforEvent(event);
|
1014
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
1015
|
-
return true;
|
1016
|
-
} else {
|
1017
|
-
return !!iconList;
|
1018
|
-
}
|
1019
|
-
};
|
1020
1003
|
return React__default.createElement("div", {
|
1021
1004
|
className: styles["event-" + convertType[event.type]],
|
1022
1005
|
onClick: function onClick() {
|
@@ -1036,7 +1019,7 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1036
1019
|
className: clsx__default(styles['weekly-event--collapse'])
|
1037
1020
|
}, React__default.createElement("div", {
|
1038
1021
|
className: styles['weekly-event__title']
|
1039
|
-
}, isDisplayIcon() && React__default.createElement("div", {
|
1022
|
+
}, isDisplayIcon(event) && React__default.createElement("div", {
|
1040
1023
|
className: styles['weekly-event__title_icon']
|
1041
1024
|
}, iconList), React__default.createElement(CustomTooltip, {
|
1042
1025
|
title: event.title
|