sapp-common-package-test-final 1.6.9 → 1.7.1
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 +81 -99
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +81 -99
- 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", {
|
@@ -449,6 +387,9 @@ var getIconEvent = (_getIconEvent = {}, _getIconEvent[EVENT_TYPES.TEACHING] = Re
|
|
449
387
|
var getIconforEvent = function getIconforEvent(event) {
|
450
388
|
if (event.source === CALENDAR_TYPE.LMS) {
|
451
389
|
var icon = [];
|
390
|
+
if (event.type === EVENT_TYPES.HOLIDAY) {
|
391
|
+
return [];
|
392
|
+
}
|
452
393
|
if (event.isCaseStudy) {
|
453
394
|
icon.push(React__default.createElement(GoldStarIcon, null));
|
454
395
|
}
|
@@ -464,6 +405,75 @@ var getIconforEvent = function getIconforEvent(event) {
|
|
464
405
|
}
|
465
406
|
};
|
466
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
|
+
|
467
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"};
|
468
478
|
|
469
479
|
var Button = function Button(_ref) {
|
@@ -564,7 +574,9 @@ var CustomTooltip = function CustomTooltip(_ref) {
|
|
564
574
|
className: styles['text-gray-600']
|
565
575
|
}, title),
|
566
576
|
placement: placement
|
567
|
-
}, React__default.createElement("div",
|
577
|
+
}, React__default.createElement("div", {
|
578
|
+
className: styles['trucate-text']
|
579
|
+
}, children));
|
568
580
|
};
|
569
581
|
|
570
582
|
var MonthlyEvent = function MonthlyEvent(_ref) {
|
@@ -574,14 +586,6 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
574
586
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
575
587
|
var formattedDateStart = customDateFormat(event.startDate, TIME_FORMAT);
|
576
588
|
var iconList = getIconforEvent(event);
|
577
|
-
var isDisplayIcon = function isDisplayIcon() {
|
578
|
-
var iconList = getIconforEvent(event);
|
579
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
580
|
-
return true;
|
581
|
-
} else {
|
582
|
-
return !!iconList;
|
583
|
-
}
|
584
|
-
};
|
585
589
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("li", {
|
586
590
|
className: styles["event-" + (isSameMonth ? convertType[event.type] : 'default')],
|
587
591
|
style: {
|
@@ -592,13 +596,11 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
592
596
|
}
|
593
597
|
}, React__default.createElement("div", {
|
594
598
|
className: styles['monthly-event__title']
|
595
|
-
}, isDisplayIcon() && React__default.createElement("div", {
|
599
|
+
}, isDisplayIcon(event) && React__default.createElement("div", {
|
596
600
|
className: styles['weekly-event__title_icon']
|
597
601
|
}, iconList), React__default.createElement(CustomTooltip, {
|
598
602
|
title: event.title
|
599
|
-
}, React__default.createElement("div", {
|
600
|
-
className: styles['truncate-text']
|
601
|
-
}, event.title))), React__default.createElement("div", {
|
603
|
+
}, event.title)), React__default.createElement("div", {
|
602
604
|
className: styles['monthly-event__date']
|
603
605
|
}, React__default.createElement(CustomTooltip, {
|
604
606
|
title: formattedDate
|
@@ -786,14 +788,6 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
786
788
|
var isMinHeight = height < MIN_HEIGHT_EVENT;
|
787
789
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
788
790
|
var iconList = getIconforEvent(event);
|
789
|
-
var isDisplayIcon = function isDisplayIcon() {
|
790
|
-
var iconList = getIconforEvent(event);
|
791
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
792
|
-
return true;
|
793
|
-
} else {
|
794
|
-
return !!iconList;
|
795
|
-
}
|
796
|
-
};
|
797
791
|
return React__default.createElement("div", {
|
798
792
|
className: clsx__default(styles["event-" + convertType[event.type]], isMinHeight && styles['event--min-height']),
|
799
793
|
onClick: function onClick() {
|
@@ -811,13 +805,11 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
811
805
|
className: clsx__default(height <= MIN_HEIGHT_HIDE_DETAILS && styles['weekly-event--collapse'])
|
812
806
|
}, React__default.createElement("div", {
|
813
807
|
className: styles['weekly-event__title']
|
814
|
-
}, isDisplayIcon() && React__default.createElement("div", {
|
808
|
+
}, isDisplayIcon(event) && React__default.createElement("div", {
|
815
809
|
className: styles['weekly-event__title_icon']
|
816
810
|
}, iconList), React__default.createElement(CustomTooltip, {
|
817
811
|
title: event.title
|
818
|
-
}, React__default.createElement("div", {
|
819
|
-
className: styles['truncate-text']
|
820
|
-
}, event.title))), React__default.createElement("div", {
|
812
|
+
}, event.title)), React__default.createElement("div", {
|
821
813
|
className: styles['weekly-event__date']
|
822
814
|
}, React__default.createElement(CustomTooltip, {
|
823
815
|
title: formattedDate
|
@@ -1006,14 +998,6 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1006
998
|
width = _calculateBoxSize.width,
|
1007
999
|
left = _calculateBoxSize.left;
|
1008
1000
|
var iconList = getIconforEvent(event);
|
1009
|
-
var isDisplayIcon = function isDisplayIcon() {
|
1010
|
-
var iconList = getIconforEvent(event);
|
1011
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
1012
|
-
return true;
|
1013
|
-
} else {
|
1014
|
-
return !!iconList;
|
1015
|
-
}
|
1016
|
-
};
|
1017
1001
|
return React__default.createElement("div", {
|
1018
1002
|
className: styles["event-" + convertType[event.type]],
|
1019
1003
|
onClick: function onClick() {
|
@@ -1033,13 +1017,11 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1033
1017
|
className: clsx__default(styles['weekly-event--collapse'])
|
1034
1018
|
}, React__default.createElement("div", {
|
1035
1019
|
className: styles['weekly-event__title']
|
1036
|
-
}, isDisplayIcon() && React__default.createElement("div", {
|
1020
|
+
}, isDisplayIcon(event) && React__default.createElement("div", {
|
1037
1021
|
className: styles['weekly-event__title_icon']
|
1038
1022
|
}, iconList), React__default.createElement(CustomTooltip, {
|
1039
1023
|
title: event.title
|
1040
|
-
}, React__default.createElement("div", {
|
1041
|
-
className: styles['truncate-text']
|
1042
|
-
}, event.title)))), React__default.createElement("div", {
|
1024
|
+
}, event.title))), React__default.createElement("div", {
|
1043
1025
|
className: styles['weekly-event__date']
|
1044
1026
|
}, React__default.createElement(CustomTooltip, {
|
1045
1027
|
title: formattedDate
|