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.modern.js
CHANGED
@@ -134,68 +134,6 @@ var CALENDAR_TYPE;
|
|
134
134
|
CALENDAR_TYPE["LMS"] = "LMS";
|
135
135
|
})(CALENDAR_TYPE || (CALENDAR_TYPE = {}));
|
136
136
|
|
137
|
-
var _convertType;
|
138
|
-
var customDateFormat = function customDateFormat(value, formatStr) {
|
139
|
-
return dayjs(value).format(formatStr);
|
140
|
-
};
|
141
|
-
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);
|
142
|
-
var daysOfWeekKeys = Object.values(DAYS_OF_WEEK);
|
143
|
-
var calculateNormOfWeek = function calculateNormOfWeek(norms, events, startDate, endDate) {
|
144
|
-
var norm = norms.find(function (norm) {
|
145
|
-
return startDate.isBetween(norm.startDate, norm.endDate, 'day', '[]') && endDate.isBetween(norm.startDate, norm.endDate, 'day', '[]');
|
146
|
-
});
|
147
|
-
if (!norm) {
|
148
|
-
return {
|
149
|
-
normOfWeek: 0,
|
150
|
-
totalNorm: 0
|
151
|
-
};
|
152
|
-
}
|
153
|
-
var normsOfWeek = events.filter(function (event) {
|
154
|
-
return dayjs(event.startDate).isBetween(startDate, endDate, 'day', '[]') && endDate.isBetween(startDate, endDate, 'day', '[]') && event.type === EVENT_TYPES.TEACHING;
|
155
|
-
});
|
156
|
-
return {
|
157
|
-
normOfWeek: normsOfWeek.length,
|
158
|
-
totalNorm: norm.maxShift
|
159
|
-
};
|
160
|
-
};
|
161
|
-
var splitEventsIntoDays = function splitEventsIntoDays(events) {
|
162
|
-
var splittedEvents = [];
|
163
|
-
for (var _iterator = _createForOfIteratorHelperLoose(events), _step; !(_step = _iterator()).done;) {
|
164
|
-
var event = _step.value;
|
165
|
-
var startDate = dayjs(event.startDate);
|
166
|
-
var endDate = dayjs(event.endDate);
|
167
|
-
var isSameDay = startDate.isSame(endDate, 'day');
|
168
|
-
if (isSameDay) {
|
169
|
-
splittedEvents.push(event);
|
170
|
-
continue;
|
171
|
-
}
|
172
|
-
splittedEvents.push(_extends({}, event, {
|
173
|
-
startDate: startDate.toDate(),
|
174
|
-
endDate: startDate.endOf('day').toDate()
|
175
|
-
}));
|
176
|
-
var currentDate = startDate.startOf('day').add(1, 'day');
|
177
|
-
while (currentDate.isBefore(endDate, 'day')) {
|
178
|
-
splittedEvents.push(_extends({}, event, {
|
179
|
-
startDate: currentDate.startOf('day').toDate(),
|
180
|
-
endDate: currentDate.endOf('day').toDate()
|
181
|
-
}));
|
182
|
-
currentDate = currentDate.add(1, 'day');
|
183
|
-
}
|
184
|
-
splittedEvents.push(_extends({}, event, {
|
185
|
-
startDate: endDate.startOf('day').toDate(),
|
186
|
-
endDate: endDate.toDate()
|
187
|
-
}));
|
188
|
-
}
|
189
|
-
return splittedEvents;
|
190
|
-
};
|
191
|
-
var checkIsAllday = function checkIsAllday(startDate, endDate) {
|
192
|
-
if (!startDate.isValid() || !endDate.isValid()) {
|
193
|
-
return false;
|
194
|
-
}
|
195
|
-
return startDate.format(TIME_FORMAT) === startDate.startOf('day').format(TIME_FORMAT) && endDate.format(TIME_FORMAT) === endDate.endOf('day').format(TIME_FORMAT) && startDate.isBefore(endDate);
|
196
|
-
};
|
197
|
-
var hoursOfDayKeys = Object.values(HOUR_OF_DAY);
|
198
|
-
|
199
137
|
var _getIconEvent;
|
200
138
|
var Left = function Left() {
|
201
139
|
return React.createElement("svg", {
|
@@ -445,6 +383,9 @@ var getIconEvent = (_getIconEvent = {}, _getIconEvent[EVENT_TYPES.TEACHING] = Re
|
|
445
383
|
var getIconforEvent = function getIconforEvent(event) {
|
446
384
|
if (event.source === CALENDAR_TYPE.LMS) {
|
447
385
|
var icon = [];
|
386
|
+
if (event.type === EVENT_TYPES.HOLIDAY) {
|
387
|
+
return [];
|
388
|
+
}
|
448
389
|
if (event.isCaseStudy) {
|
449
390
|
icon.push(React.createElement(GoldStarIcon, null));
|
450
391
|
}
|
@@ -460,6 +401,75 @@ var getIconforEvent = function getIconforEvent(event) {
|
|
460
401
|
}
|
461
402
|
};
|
462
403
|
|
404
|
+
var _convertType;
|
405
|
+
var customDateFormat = function customDateFormat(value, formatStr) {
|
406
|
+
return dayjs(value).format(formatStr);
|
407
|
+
};
|
408
|
+
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);
|
409
|
+
var daysOfWeekKeys = Object.values(DAYS_OF_WEEK);
|
410
|
+
var calculateNormOfWeek = function calculateNormOfWeek(norms, events, startDate, endDate) {
|
411
|
+
var norm = norms.find(function (norm) {
|
412
|
+
return startDate.isBetween(norm.startDate, norm.endDate, 'day', '[]') && endDate.isBetween(norm.startDate, norm.endDate, 'day', '[]');
|
413
|
+
});
|
414
|
+
if (!norm) {
|
415
|
+
return {
|
416
|
+
normOfWeek: 0,
|
417
|
+
totalNorm: 0
|
418
|
+
};
|
419
|
+
}
|
420
|
+
var normsOfWeek = events.filter(function (event) {
|
421
|
+
return dayjs(event.startDate).isBetween(startDate, endDate, 'day', '[]') && endDate.isBetween(startDate, endDate, 'day', '[]') && event.type === EVENT_TYPES.TEACHING;
|
422
|
+
});
|
423
|
+
return {
|
424
|
+
normOfWeek: normsOfWeek.length,
|
425
|
+
totalNorm: norm.maxShift
|
426
|
+
};
|
427
|
+
};
|
428
|
+
var splitEventsIntoDays = function splitEventsIntoDays(events) {
|
429
|
+
var splittedEvents = [];
|
430
|
+
for (var _iterator = _createForOfIteratorHelperLoose(events), _step; !(_step = _iterator()).done;) {
|
431
|
+
var event = _step.value;
|
432
|
+
var startDate = dayjs(event.startDate);
|
433
|
+
var endDate = dayjs(event.endDate);
|
434
|
+
var isSameDay = startDate.isSame(endDate, 'day');
|
435
|
+
if (isSameDay) {
|
436
|
+
splittedEvents.push(event);
|
437
|
+
continue;
|
438
|
+
}
|
439
|
+
splittedEvents.push(_extends({}, event, {
|
440
|
+
startDate: startDate.toDate(),
|
441
|
+
endDate: startDate.endOf('day').toDate()
|
442
|
+
}));
|
443
|
+
var currentDate = startDate.startOf('day').add(1, 'day');
|
444
|
+
while (currentDate.isBefore(endDate, 'day')) {
|
445
|
+
splittedEvents.push(_extends({}, event, {
|
446
|
+
startDate: currentDate.startOf('day').toDate(),
|
447
|
+
endDate: currentDate.endOf('day').toDate()
|
448
|
+
}));
|
449
|
+
currentDate = currentDate.add(1, 'day');
|
450
|
+
}
|
451
|
+
splittedEvents.push(_extends({}, event, {
|
452
|
+
startDate: endDate.startOf('day').toDate(),
|
453
|
+
endDate: endDate.toDate()
|
454
|
+
}));
|
455
|
+
}
|
456
|
+
return splittedEvents;
|
457
|
+
};
|
458
|
+
var checkIsAllday = function checkIsAllday(startDate, endDate) {
|
459
|
+
if (!startDate.isValid() || !endDate.isValid()) {
|
460
|
+
return false;
|
461
|
+
}
|
462
|
+
return startDate.format(TIME_FORMAT) === startDate.startOf('day').format(TIME_FORMAT) && endDate.format(TIME_FORMAT) === endDate.endOf('day').format(TIME_FORMAT) && startDate.isBefore(endDate);
|
463
|
+
};
|
464
|
+
var hoursOfDayKeys = Object.values(HOUR_OF_DAY);
|
465
|
+
var isDisplayIcon = function isDisplayIcon(event) {
|
466
|
+
var iconList = getIconforEvent(event);
|
467
|
+
if (event.source === 'LMS') {
|
468
|
+
return Array.isArray(iconList) && iconList.length > 0;
|
469
|
+
}
|
470
|
+
return !!iconList;
|
471
|
+
};
|
472
|
+
|
463
473
|
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"};
|
464
474
|
|
465
475
|
var Button = function Button(_ref) {
|
@@ -560,7 +570,9 @@ var CustomTooltip = function CustomTooltip(_ref) {
|
|
560
570
|
className: styles['text-gray-600']
|
561
571
|
}, title),
|
562
572
|
placement: placement
|
563
|
-
}, React.createElement("div",
|
573
|
+
}, React.createElement("div", {
|
574
|
+
className: styles['trucate-text']
|
575
|
+
}, children));
|
564
576
|
};
|
565
577
|
|
566
578
|
var MonthlyEvent = function MonthlyEvent(_ref) {
|
@@ -570,14 +582,6 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
570
582
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
571
583
|
var formattedDateStart = customDateFormat(event.startDate, TIME_FORMAT);
|
572
584
|
var iconList = getIconforEvent(event);
|
573
|
-
var isDisplayIcon = function isDisplayIcon() {
|
574
|
-
var iconList = getIconforEvent(event);
|
575
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
576
|
-
return true;
|
577
|
-
} else {
|
578
|
-
return !!iconList;
|
579
|
-
}
|
580
|
-
};
|
581
585
|
return React.createElement(React.Fragment, null, React.createElement("li", {
|
582
586
|
className: styles["event-" + (isSameMonth ? convertType[event.type] : 'default')],
|
583
587
|
style: {
|
@@ -588,13 +592,11 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
588
592
|
}
|
589
593
|
}, React.createElement("div", {
|
590
594
|
className: styles['monthly-event__title']
|
591
|
-
}, isDisplayIcon() && React.createElement("div", {
|
595
|
+
}, isDisplayIcon(event) && React.createElement("div", {
|
592
596
|
className: styles['weekly-event__title_icon']
|
593
597
|
}, iconList), React.createElement(CustomTooltip, {
|
594
598
|
title: event.title
|
595
|
-
}, React.createElement("div", {
|
596
|
-
className: styles['truncate-text']
|
597
|
-
}, event.title))), React.createElement("div", {
|
599
|
+
}, event.title)), React.createElement("div", {
|
598
600
|
className: styles['monthly-event__date']
|
599
601
|
}, React.createElement(CustomTooltip, {
|
600
602
|
title: formattedDate
|
@@ -782,14 +784,6 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
782
784
|
var isMinHeight = height < MIN_HEIGHT_EVENT;
|
783
785
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
784
786
|
var iconList = getIconforEvent(event);
|
785
|
-
var isDisplayIcon = function isDisplayIcon() {
|
786
|
-
var iconList = getIconforEvent(event);
|
787
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
788
|
-
return true;
|
789
|
-
} else {
|
790
|
-
return !!iconList;
|
791
|
-
}
|
792
|
-
};
|
793
787
|
return React.createElement("div", {
|
794
788
|
className: clsx$1(styles["event-" + convertType[event.type]], isMinHeight && styles['event--min-height']),
|
795
789
|
onClick: function onClick() {
|
@@ -807,13 +801,11 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
807
801
|
className: clsx$1(height <= MIN_HEIGHT_HIDE_DETAILS && styles['weekly-event--collapse'])
|
808
802
|
}, React.createElement("div", {
|
809
803
|
className: styles['weekly-event__title']
|
810
|
-
}, isDisplayIcon() && React.createElement("div", {
|
804
|
+
}, isDisplayIcon(event) && React.createElement("div", {
|
811
805
|
className: styles['weekly-event__title_icon']
|
812
806
|
}, iconList), React.createElement(CustomTooltip, {
|
813
807
|
title: event.title
|
814
|
-
}, React.createElement("div", {
|
815
|
-
className: styles['truncate-text']
|
816
|
-
}, event.title))), React.createElement("div", {
|
808
|
+
}, event.title)), React.createElement("div", {
|
817
809
|
className: styles['weekly-event__date']
|
818
810
|
}, React.createElement(CustomTooltip, {
|
819
811
|
title: formattedDate
|
@@ -1002,14 +994,6 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1002
994
|
width = _calculateBoxSize.width,
|
1003
995
|
left = _calculateBoxSize.left;
|
1004
996
|
var iconList = getIconforEvent(event);
|
1005
|
-
var isDisplayIcon = function isDisplayIcon() {
|
1006
|
-
var iconList = getIconforEvent(event);
|
1007
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
1008
|
-
return true;
|
1009
|
-
} else {
|
1010
|
-
return !!iconList;
|
1011
|
-
}
|
1012
|
-
};
|
1013
997
|
return React.createElement("div", {
|
1014
998
|
className: styles["event-" + convertType[event.type]],
|
1015
999
|
onClick: function onClick() {
|
@@ -1029,13 +1013,11 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1029
1013
|
className: clsx$1(styles['weekly-event--collapse'])
|
1030
1014
|
}, React.createElement("div", {
|
1031
1015
|
className: styles['weekly-event__title']
|
1032
|
-
}, isDisplayIcon() && React.createElement("div", {
|
1016
|
+
}, isDisplayIcon(event) && React.createElement("div", {
|
1033
1017
|
className: styles['weekly-event__title_icon']
|
1034
1018
|
}, iconList), React.createElement(CustomTooltip, {
|
1035
1019
|
title: event.title
|
1036
|
-
}, React.createElement("div", {
|
1037
|
-
className: styles['truncate-text']
|
1038
|
-
}, event.title)))), React.createElement("div", {
|
1020
|
+
}, event.title))), React.createElement("div", {
|
1039
1021
|
className: styles['weekly-event__date']
|
1040
1022
|
}, React.createElement(CustomTooltip, {
|
1041
1023
|
title: formattedDate
|