sapp-common-package-test-final 1.7.0 → 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 +78 -99
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +78 -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", {
|
@@ -463,6 +401,75 @@ var getIconforEvent = function getIconforEvent(event) {
|
|
463
401
|
}
|
464
402
|
};
|
465
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
|
+
|
466
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"};
|
467
474
|
|
468
475
|
var Button = function Button(_ref) {
|
@@ -563,7 +570,9 @@ var CustomTooltip = function CustomTooltip(_ref) {
|
|
563
570
|
className: styles['text-gray-600']
|
564
571
|
}, title),
|
565
572
|
placement: placement
|
566
|
-
}, React.createElement("div",
|
573
|
+
}, React.createElement("div", {
|
574
|
+
className: styles['trucate-text']
|
575
|
+
}, children));
|
567
576
|
};
|
568
577
|
|
569
578
|
var MonthlyEvent = function MonthlyEvent(_ref) {
|
@@ -573,14 +582,6 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
573
582
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
574
583
|
var formattedDateStart = customDateFormat(event.startDate, TIME_FORMAT);
|
575
584
|
var iconList = getIconforEvent(event);
|
576
|
-
var isDisplayIcon = function isDisplayIcon() {
|
577
|
-
var iconList = getIconforEvent(event);
|
578
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
579
|
-
return true;
|
580
|
-
} else {
|
581
|
-
return !!iconList;
|
582
|
-
}
|
583
|
-
};
|
584
585
|
return React.createElement(React.Fragment, null, React.createElement("li", {
|
585
586
|
className: styles["event-" + (isSameMonth ? convertType[event.type] : 'default')],
|
586
587
|
style: {
|
@@ -591,13 +592,11 @@ var MonthlyEvent = function MonthlyEvent(_ref) {
|
|
591
592
|
}
|
592
593
|
}, React.createElement("div", {
|
593
594
|
className: styles['monthly-event__title']
|
594
|
-
}, isDisplayIcon() && React.createElement("div", {
|
595
|
+
}, isDisplayIcon(event) && React.createElement("div", {
|
595
596
|
className: styles['weekly-event__title_icon']
|
596
597
|
}, iconList), React.createElement(CustomTooltip, {
|
597
598
|
title: event.title
|
598
|
-
}, React.createElement("div", {
|
599
|
-
className: styles['truncate-text']
|
600
|
-
}, event.title))), React.createElement("div", {
|
599
|
+
}, event.title)), React.createElement("div", {
|
601
600
|
className: styles['monthly-event__date']
|
602
601
|
}, React.createElement(CustomTooltip, {
|
603
602
|
title: formattedDate
|
@@ -785,14 +784,6 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
785
784
|
var isMinHeight = height < MIN_HEIGHT_EVENT;
|
786
785
|
var formattedDate = customDateFormat(event.startDate, TIME_FORMAT) + ' - ' + customDateFormat(event.endDate, TIME_FORMAT);
|
787
786
|
var iconList = getIconforEvent(event);
|
788
|
-
var isDisplayIcon = function isDisplayIcon() {
|
789
|
-
var iconList = getIconforEvent(event);
|
790
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
791
|
-
return true;
|
792
|
-
} else {
|
793
|
-
return !!iconList;
|
794
|
-
}
|
795
|
-
};
|
796
787
|
return React.createElement("div", {
|
797
788
|
className: clsx$1(styles["event-" + convertType[event.type]], isMinHeight && styles['event--min-height']),
|
798
789
|
onClick: function onClick() {
|
@@ -810,13 +801,11 @@ var WeeklyEvent = function WeeklyEvent(_ref) {
|
|
810
801
|
className: clsx$1(height <= MIN_HEIGHT_HIDE_DETAILS && styles['weekly-event--collapse'])
|
811
802
|
}, React.createElement("div", {
|
812
803
|
className: styles['weekly-event__title']
|
813
|
-
}, isDisplayIcon() && React.createElement("div", {
|
804
|
+
}, isDisplayIcon(event) && React.createElement("div", {
|
814
805
|
className: styles['weekly-event__title_icon']
|
815
806
|
}, iconList), React.createElement(CustomTooltip, {
|
816
807
|
title: event.title
|
817
|
-
}, React.createElement("div", {
|
818
|
-
className: styles['truncate-text']
|
819
|
-
}, event.title))), React.createElement("div", {
|
808
|
+
}, event.title)), React.createElement("div", {
|
820
809
|
className: styles['weekly-event__date']
|
821
810
|
}, React.createElement(CustomTooltip, {
|
822
811
|
title: formattedDate
|
@@ -1005,14 +994,6 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1005
994
|
width = _calculateBoxSize.width,
|
1006
995
|
left = _calculateBoxSize.left;
|
1007
996
|
var iconList = getIconforEvent(event);
|
1008
|
-
var isDisplayIcon = function isDisplayIcon() {
|
1009
|
-
var iconList = getIconforEvent(event);
|
1010
|
-
if (event.source === 'LMS' && Array.isArray(iconList) && iconList.length > 0) {
|
1011
|
-
return true;
|
1012
|
-
} else {
|
1013
|
-
return !!iconList;
|
1014
|
-
}
|
1015
|
-
};
|
1016
997
|
return React.createElement("div", {
|
1017
998
|
className: styles["event-" + convertType[event.type]],
|
1018
999
|
onClick: function onClick() {
|
@@ -1032,13 +1013,11 @@ var LMSWeeklyEvent = function LMSWeeklyEvent(_ref) {
|
|
1032
1013
|
className: clsx$1(styles['weekly-event--collapse'])
|
1033
1014
|
}, React.createElement("div", {
|
1034
1015
|
className: styles['weekly-event__title']
|
1035
|
-
}, isDisplayIcon() && React.createElement("div", {
|
1016
|
+
}, isDisplayIcon(event) && React.createElement("div", {
|
1036
1017
|
className: styles['weekly-event__title_icon']
|
1037
1018
|
}, iconList), React.createElement(CustomTooltip, {
|
1038
1019
|
title: event.title
|
1039
|
-
}, React.createElement("div", {
|
1040
|
-
className: styles['truncate-text']
|
1041
|
-
}, event.title)))), React.createElement("div", {
|
1020
|
+
}, event.title))), React.createElement("div", {
|
1042
1021
|
className: styles['weekly-event__date']
|
1043
1022
|
}, React.createElement(CustomTooltip, {
|
1044
1023
|
title: formattedDate
|