@coreui/vue-pro 5.0.0-alpha.0 → 5.0.0-alpha.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/README.md +1 -1
- package/dist/components/calendar/CCalendar.d.ts +58 -32
- package/dist/components/calendar/utils.d.ts +11 -4
- package/dist/components/close-button/CCloseButton.d.ts +9 -0
- package/dist/components/date-picker/CDatePicker.d.ts +89 -0
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +89 -0
- package/dist/components/dropdown/CDropdown.d.ts +13 -28
- package/dist/components/dropdown/CDropdownToggle.d.ts +19 -9
- package/dist/components/dropdown/types.d.ts +15 -0
- package/dist/components/dropdown/utils.d.ts +6 -0
- package/dist/components/form/CFormCheck.d.ts +4 -4
- package/dist/components/modal/CModal.d.ts +19 -0
- package/dist/components/multi-select/CMultiSelect.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +1 -1
- package/dist/components/multi-select/types.d.ts +2 -2
- package/dist/components/multi-select/utils.d.ts +2 -2
- package/dist/components/offcanvas/COffcanvas.d.ts +9 -0
- package/dist/components/progress/CProgress.d.ts +102 -3
- package/dist/components/progress/CProgressStacked.d.ts +10 -0
- package/dist/components/progress/index.d.ts +2 -1
- package/dist/components/smart-table/CSmartTable.d.ts +0 -4
- package/dist/components/smart-table/CSmartTableBody.d.ts +12 -1
- package/dist/components/smart-table/types.d.ts +2 -2
- package/dist/components/smart-table/utils.d.ts +4 -2
- package/dist/composables/index.d.ts +2 -1
- package/dist/composables/useDebouncedCallback.d.ts +1 -0
- package/dist/index.es.js +1035 -2716
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1035 -2714
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/components/breadcrumb/CBreadcrumb.ts +1 -0
- package/src/components/button/CButton.ts +5 -5
- package/src/components/calendar/CCalendar.ts +444 -179
- package/src/components/calendar/utils.ts +93 -55
- package/src/components/carousel/CCarousel.ts +2 -5
- package/src/components/close-button/CCloseButton.ts +5 -0
- package/src/components/date-picker/CDatePicker.ts +43 -0
- package/src/components/date-range-picker/CDateRangePicker.ts +130 -83
- package/src/components/date-range-picker/utils.ts +2 -2
- package/src/components/dropdown/CDropdown.ts +23 -43
- package/src/components/dropdown/CDropdownMenu.ts +4 -19
- package/src/components/dropdown/CDropdownToggle.ts +44 -38
- package/src/components/dropdown/types.ts +11 -0
- package/src/components/dropdown/utils.ts +71 -0
- package/src/components/form/CFormCheck.ts +4 -4
- package/src/components/modal/CModal.ts +15 -1
- package/src/components/multi-select/CMultiSelect.ts +5 -8
- package/src/components/multi-select/CMultiSelectOptions.ts +1 -1
- package/src/components/multi-select/CMultiSelectSelection.ts +3 -3
- package/src/components/multi-select/types.ts +2 -2
- package/src/components/multi-select/utils.ts +5 -5
- package/src/components/navbar/CNavbar.ts +1 -1
- package/src/components/offcanvas/COffcanvas.ts +6 -0
- package/src/components/picker/CPicker.ts +1 -1
- package/src/components/progress/CProgress.ts +67 -9
- package/src/components/progress/CProgressBar.ts +4 -6
- package/src/components/progress/CProgressStacked.ts +19 -0
- package/src/components/progress/index.ts +3 -1
- package/src/components/sidebar/CSidebar.ts +1 -1
- package/src/components/smart-pagination/CSmartPagination.ts +20 -5
- package/src/components/smart-table/CSmartTable.ts +21 -12
- package/src/components/smart-table/CSmartTableBody.ts +30 -31
- package/src/components/smart-table/CSmartTableHead.ts +39 -12
- package/src/components/smart-table/types.ts +2 -2
- package/src/components/smart-table/utils.ts +41 -5
- package/src/components/time-picker/CTimePicker.ts +4 -2
- package/src/components/tooltip/CTooltip.ts +1 -1
- package/src/components/widgets/CWidgetStatsA.ts +1 -3
- package/src/components/widgets/CWidgetStatsB.ts +2 -4
- package/src/components/widgets/CWidgetStatsC.ts +2 -2
- package/src/components/widgets/CWidgetStatsD.ts +1 -1
- package/src/components/widgets/CWidgetStatsE.ts +1 -1
- package/src/components/widgets/CWidgetStatsF.ts +1 -1
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsE.spec.ts.snap +1 -1
- package/src/composables/index.ts +2 -1
- package/src/composables/useDebouncedCallback.ts +16 -0
- package/src/utils/isObjectInArray.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -267,6 +267,10 @@ const CAccordionPlugin = {
|
|
|
267
267
|
const CCloseButton = vue.defineComponent({
|
|
268
268
|
name: 'CCloseButton',
|
|
269
269
|
props: {
|
|
270
|
+
/**
|
|
271
|
+
* Invert the default color.
|
|
272
|
+
*/
|
|
273
|
+
dark: Boolean,
|
|
270
274
|
/**
|
|
271
275
|
* Toggle the disabled state for the component.
|
|
272
276
|
*/
|
|
@@ -301,6 +305,7 @@ const CCloseButton = vue.defineComponent({
|
|
|
301
305
|
],
|
|
302
306
|
'aria-label': 'Close',
|
|
303
307
|
disabled: props.disabled,
|
|
308
|
+
...(props.dark && { 'data-coreui-theme': 'dark' }),
|
|
304
309
|
onClick: handleClick,
|
|
305
310
|
});
|
|
306
311
|
},
|
|
@@ -715,6 +720,7 @@ const CBreadcrumbItem = vue.defineComponent({
|
|
|
715
720
|
|
|
716
721
|
const CBreadcrumb = vue.defineComponent({
|
|
717
722
|
name: 'CBreadcrumb',
|
|
723
|
+
inheritAttrs: false,
|
|
718
724
|
setup(_, { slots, attrs }) {
|
|
719
725
|
return () => vue.h('nav', {
|
|
720
726
|
'aria-label': 'breadcrumb',
|
|
@@ -806,13 +812,14 @@ const CButton = vue.defineComponent({
|
|
|
806
812
|
'click',
|
|
807
813
|
],
|
|
808
814
|
setup(props, { emit, slots }) {
|
|
815
|
+
const component = props.href ? 'a' : props.component;
|
|
809
816
|
const handleClick = (event) => {
|
|
810
817
|
if (props.disabled) {
|
|
811
818
|
return;
|
|
812
819
|
}
|
|
813
820
|
emit('click', event);
|
|
814
821
|
};
|
|
815
|
-
return () => vue.h(
|
|
822
|
+
return () => vue.h(component, {
|
|
816
823
|
class: [
|
|
817
824
|
'btn',
|
|
818
825
|
props.variant ? `btn-${props.variant}-${props.color}` : `btn-${props.color}`,
|
|
@@ -823,10 +830,9 @@ const CButton = vue.defineComponent({
|
|
|
823
830
|
},
|
|
824
831
|
props.shape,
|
|
825
832
|
],
|
|
826
|
-
|
|
827
|
-
...(
|
|
828
|
-
...(
|
|
829
|
-
...(props.component === 'button' && { type: props.type }),
|
|
833
|
+
...(component === 'a' && props.disabled && { 'aria-disabled': true, tabIndex: -1 }),
|
|
834
|
+
...(component === 'a' && props.href && { href: props.href }),
|
|
835
|
+
...(component === 'button' && { type: props.type, disabled: props.disabled }),
|
|
830
836
|
onClick: handleClick,
|
|
831
837
|
}, slots.default && slots.default());
|
|
832
838
|
},
|
|
@@ -881,12 +887,61 @@ const CButtonGroupPlugin = {
|
|
|
881
887
|
},
|
|
882
888
|
};
|
|
883
889
|
|
|
890
|
+
const convertIsoWeekToDate = (isoWeek) => {
|
|
891
|
+
const [year, week] = isoWeek.split(/w/i);
|
|
892
|
+
// Get date for 4th of January for year
|
|
893
|
+
const date = new Date(Number(year), 0, 4);
|
|
894
|
+
// Get previous Monday, add 7 days for each week after first
|
|
895
|
+
date.setDate(date.getDate() - (date.getDay() || 7) + 1 + (Number(week) - 1) * 7);
|
|
896
|
+
return date;
|
|
897
|
+
};
|
|
898
|
+
const convertToDateObject = (date, selectionType) => {
|
|
899
|
+
// TODO: clean-up ?
|
|
900
|
+
// if (date === null) {
|
|
901
|
+
// return null
|
|
902
|
+
// }
|
|
903
|
+
if (date instanceof Date) {
|
|
904
|
+
return date;
|
|
905
|
+
}
|
|
906
|
+
if (selectionType === 'week') {
|
|
907
|
+
return convertIsoWeekToDate(date);
|
|
908
|
+
}
|
|
909
|
+
return new Date(Date.parse(date));
|
|
910
|
+
};
|
|
884
911
|
const createGroupsInArray = (arr, numberOfGroups) => {
|
|
885
912
|
const perGroup = Math.ceil(arr.length / numberOfGroups);
|
|
886
|
-
return
|
|
913
|
+
return Array.from({ length: numberOfGroups })
|
|
887
914
|
.fill('')
|
|
888
915
|
.map((_, i) => arr.slice(i * perGroup, (i + 1) * perGroup));
|
|
889
916
|
};
|
|
917
|
+
const getCalendarDate = (calendarDate, order, view) => {
|
|
918
|
+
if (order !== 0 && view === 'days') {
|
|
919
|
+
return new Date(Date.UTC(calendarDate.getFullYear(), calendarDate.getMonth() + order, 1));
|
|
920
|
+
}
|
|
921
|
+
if (order !== 0 && view === 'months') {
|
|
922
|
+
return new Date(Date.UTC(calendarDate.getFullYear() + order, calendarDate.getMonth(), 1));
|
|
923
|
+
}
|
|
924
|
+
if (order !== 0 && view === 'years') {
|
|
925
|
+
return new Date(Date.UTC(calendarDate.getFullYear() + (12 * order), calendarDate.getMonth(), 1));
|
|
926
|
+
}
|
|
927
|
+
return calendarDate;
|
|
928
|
+
};
|
|
929
|
+
const getDateBySelectionType = (date, selectionType) => {
|
|
930
|
+
if (date === null) {
|
|
931
|
+
return null;
|
|
932
|
+
}
|
|
933
|
+
if (selectionType === 'week') {
|
|
934
|
+
return `${date.getFullYear()}W${getWeekNumber(date)}`;
|
|
935
|
+
}
|
|
936
|
+
if (selectionType === 'month') {
|
|
937
|
+
const monthNumber = `0${date.getMonth() + 1}`.slice(-2);
|
|
938
|
+
return `${date.getFullYear()}-${monthNumber}`;
|
|
939
|
+
}
|
|
940
|
+
if (selectionType === 'year') {
|
|
941
|
+
return `${date.getFullYear()}`;
|
|
942
|
+
}
|
|
943
|
+
return date;
|
|
944
|
+
};
|
|
890
945
|
const getMonthsNames = (locale) => {
|
|
891
946
|
const months = [];
|
|
892
947
|
const d = new Date();
|
|
@@ -946,6 +1001,11 @@ const getTrailingDays = (year, month, leadingDays, monthDays) => {
|
|
|
946
1001
|
}
|
|
947
1002
|
return dates;
|
|
948
1003
|
};
|
|
1004
|
+
const getWeekNumber = (date) => {
|
|
1005
|
+
const week1 = new Date(date.getFullYear(), 0, 4);
|
|
1006
|
+
return (1 +
|
|
1007
|
+
Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7));
|
|
1008
|
+
};
|
|
949
1009
|
const getMonthDetails = (year, month, firstDayOfWeek) => {
|
|
950
1010
|
const daysPrevMonth = getLeadingDays(year, month, firstDayOfWeek);
|
|
951
1011
|
const daysThisMonth = getMonthDays(year, month);
|
|
@@ -954,9 +1014,14 @@ const getMonthDetails = (year, month, firstDayOfWeek) => {
|
|
|
954
1014
|
const weeks = [];
|
|
955
1015
|
days.forEach((day, index) => {
|
|
956
1016
|
if (index % 7 === 0 || weeks.length === 0) {
|
|
957
|
-
weeks.push(
|
|
1017
|
+
weeks.push({
|
|
1018
|
+
days: [],
|
|
1019
|
+
});
|
|
958
1020
|
}
|
|
959
|
-
|
|
1021
|
+
if ((index + 1) % 7 === 0) {
|
|
1022
|
+
weeks[weeks.length - 1].weekNumber = getWeekNumber(day.date);
|
|
1023
|
+
}
|
|
1024
|
+
weeks[weeks.length - 1].days.push(day);
|
|
960
1025
|
});
|
|
961
1026
|
return weeks;
|
|
962
1027
|
};
|
|
@@ -979,15 +1044,11 @@ const isDateDisabled = (date, min, max, dates) => {
|
|
|
979
1044
|
let disabled;
|
|
980
1045
|
if (dates) {
|
|
981
1046
|
dates.forEach((_date) => {
|
|
982
|
-
if (Array.isArray(_date)) {
|
|
983
|
-
|
|
984
|
-
disabled = true;
|
|
985
|
-
}
|
|
1047
|
+
if (Array.isArray(_date) && isDateInRange(date, _date[0], _date[1])) {
|
|
1048
|
+
disabled = true;
|
|
986
1049
|
}
|
|
987
|
-
if (_date instanceof Date) {
|
|
988
|
-
|
|
989
|
-
disabled = true;
|
|
990
|
-
}
|
|
1050
|
+
if (_date instanceof Date && isSameDateAs(date, _date)) {
|
|
1051
|
+
disabled = true;
|
|
991
1052
|
}
|
|
992
1053
|
});
|
|
993
1054
|
}
|
|
@@ -1005,15 +1066,6 @@ const isDateInRange = (date, start, end) => {
|
|
|
1005
1066
|
const isDateSelected = (date, start, end) => {
|
|
1006
1067
|
return (start && isSameDateAs(start, date)) || (end && isSameDateAs(end, date));
|
|
1007
1068
|
};
|
|
1008
|
-
const isEndDate = (date, start, end) => {
|
|
1009
|
-
return start && end && isSameDateAs(end, date) && start < end;
|
|
1010
|
-
};
|
|
1011
|
-
const isLastDayOfMonth = (date) => {
|
|
1012
|
-
const test = new Date(date.getTime());
|
|
1013
|
-
const month = test.getMonth();
|
|
1014
|
-
test.setDate(test.getDate() + 1);
|
|
1015
|
-
return test.getMonth() !== month;
|
|
1016
|
-
};
|
|
1017
1069
|
const isSameDateAs = (date, date2) => {
|
|
1018
1070
|
if (date instanceof Date && date2 instanceof Date) {
|
|
1019
1071
|
return (date.getDate() === date2.getDate() &&
|
|
@@ -1025,9 +1077,6 @@ const isSameDateAs = (date, date2) => {
|
|
|
1025
1077
|
}
|
|
1026
1078
|
return false;
|
|
1027
1079
|
};
|
|
1028
|
-
const isStartDate = (date, start, end) => {
|
|
1029
|
-
return start && end && isSameDateAs(start, date) && start < end;
|
|
1030
|
-
};
|
|
1031
1080
|
const isToday = (date) => {
|
|
1032
1081
|
const today = new Date();
|
|
1033
1082
|
return (date.getDate() === today.getDate() &&
|
|
@@ -1041,9 +1090,7 @@ const CCalendar = vue.defineComponent({
|
|
|
1041
1090
|
/**
|
|
1042
1091
|
* Default date of the component
|
|
1043
1092
|
*/
|
|
1044
|
-
calendarDate:
|
|
1045
|
-
type: [Date, String],
|
|
1046
|
-
},
|
|
1093
|
+
calendarDate: null,
|
|
1047
1094
|
/**
|
|
1048
1095
|
* The number of calendars that render on desktop devices.
|
|
1049
1096
|
*/
|
|
@@ -1083,9 +1130,7 @@ const CCalendar = vue.defineComponent({
|
|
|
1083
1130
|
/**
|
|
1084
1131
|
* Initial selected to date (range).
|
|
1085
1132
|
*/
|
|
1086
|
-
endDate:
|
|
1087
|
-
type: [Date, String],
|
|
1088
|
-
},
|
|
1133
|
+
endDate: null,
|
|
1089
1134
|
/**
|
|
1090
1135
|
* Sets the day of start week.
|
|
1091
1136
|
* - 0 - Sunday,
|
|
@@ -1110,15 +1155,11 @@ const CCalendar = vue.defineComponent({
|
|
|
1110
1155
|
/**
|
|
1111
1156
|
* Max selectable date.
|
|
1112
1157
|
*/
|
|
1113
|
-
maxDate:
|
|
1114
|
-
type: [Date, String],
|
|
1115
|
-
},
|
|
1158
|
+
maxDate: null,
|
|
1116
1159
|
/**
|
|
1117
1160
|
* Min selectable date.
|
|
1118
1161
|
*/
|
|
1119
|
-
minDate:
|
|
1120
|
-
type: [Date, String],
|
|
1121
|
-
},
|
|
1162
|
+
minDate: null,
|
|
1122
1163
|
/**
|
|
1123
1164
|
* Show arrows navigation.
|
|
1124
1165
|
*/
|
|
@@ -1146,6 +1187,16 @@ const CCalendar = vue.defineComponent({
|
|
|
1146
1187
|
* @since 4.9.0
|
|
1147
1188
|
*/
|
|
1148
1189
|
selectAdjacementDays: Boolean,
|
|
1190
|
+
/**
|
|
1191
|
+
* Specify the type of date selection as day, week, month, or year.
|
|
1192
|
+
*
|
|
1193
|
+
* @since 5.0.0-alpha.1
|
|
1194
|
+
*/
|
|
1195
|
+
selectionType: {
|
|
1196
|
+
type: String,
|
|
1197
|
+
default: 'day',
|
|
1198
|
+
validator: (value) => ['day', 'week', 'month', 'year'].includes(value),
|
|
1199
|
+
},
|
|
1149
1200
|
/**
|
|
1150
1201
|
* Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
|
|
1151
1202
|
*
|
|
@@ -1155,12 +1206,16 @@ const CCalendar = vue.defineComponent({
|
|
|
1155
1206
|
type: Boolean,
|
|
1156
1207
|
default: true,
|
|
1157
1208
|
},
|
|
1209
|
+
/**
|
|
1210
|
+
* Set whether to display week numbers in the calendar.
|
|
1211
|
+
*
|
|
1212
|
+
* @since 5.0.0-alpha.1
|
|
1213
|
+
*/
|
|
1214
|
+
showWeekNumber: Boolean,
|
|
1158
1215
|
/**
|
|
1159
1216
|
* Initial selected date.
|
|
1160
1217
|
*/
|
|
1161
|
-
startDate:
|
|
1162
|
-
type: [Date, String],
|
|
1163
|
-
},
|
|
1218
|
+
startDate: null,
|
|
1164
1219
|
/**
|
|
1165
1220
|
* Set length or format of day name.
|
|
1166
1221
|
*
|
|
@@ -1182,6 +1237,12 @@ const CCalendar = vue.defineComponent({
|
|
|
1182
1237
|
return false;
|
|
1183
1238
|
},
|
|
1184
1239
|
},
|
|
1240
|
+
/**
|
|
1241
|
+
* Label displayed over week numbers in the calendar.
|
|
1242
|
+
*
|
|
1243
|
+
* @since 5.0.0-alpha.1
|
|
1244
|
+
*/
|
|
1245
|
+
weekNumbersLabel: String,
|
|
1185
1246
|
},
|
|
1186
1247
|
emits: [
|
|
1187
1248
|
/**
|
|
@@ -1189,7 +1250,7 @@ const CCalendar = vue.defineComponent({
|
|
|
1189
1250
|
*
|
|
1190
1251
|
* @property {Date | null} date
|
|
1191
1252
|
*/
|
|
1192
|
-
'
|
|
1253
|
+
'date-hover',
|
|
1193
1254
|
/**
|
|
1194
1255
|
* Callback fired when the calendar date changed.
|
|
1195
1256
|
*
|
|
@@ -1210,53 +1271,70 @@ const CCalendar = vue.defineComponent({
|
|
|
1210
1271
|
'end-date-change',
|
|
1211
1272
|
],
|
|
1212
1273
|
setup(props, { slots, emit }) {
|
|
1274
|
+
const calendarRef = vue.ref();
|
|
1213
1275
|
const calendarDate = vue.ref(props.calendarDate
|
|
1214
|
-
?
|
|
1276
|
+
? convertToDateObject(props.calendarDate, props.selectionType)
|
|
1215
1277
|
: props.startDate
|
|
1216
|
-
?
|
|
1278
|
+
? convertToDateObject(props.startDate, props.selectionType)
|
|
1217
1279
|
: new Date());
|
|
1218
|
-
const startDate = vue.ref(props.startDate ?
|
|
1219
|
-
const endDate = vue.ref(props.endDate ?
|
|
1280
|
+
const startDate = vue.ref(props.startDate ? convertToDateObject(props.startDate, props.selectionType) : null);
|
|
1281
|
+
const endDate = vue.ref(props.endDate ? convertToDateObject(props.endDate, props.selectionType) : null);
|
|
1220
1282
|
const hoverDate = vue.ref(null);
|
|
1221
|
-
const maxDate = vue.ref(props.maxDate ?
|
|
1222
|
-
const minDate = vue.ref(props.minDate ?
|
|
1283
|
+
const maxDate = vue.ref(props.maxDate ? convertToDateObject(props.maxDate, props.selectionType) : null);
|
|
1284
|
+
const minDate = vue.ref(props.minDate ? convertToDateObject(props.minDate, props.selectionType) : null);
|
|
1223
1285
|
const selectEndDate = vue.ref(props.selectEndDate);
|
|
1224
1286
|
const view = vue.ref('days');
|
|
1287
|
+
vue.watch(() => props.selectionType, () => {
|
|
1288
|
+
if (props.selectionType === 'day' || props.selectionType === 'week') {
|
|
1289
|
+
view.value = 'days';
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
if (props.selectionType === 'month') {
|
|
1293
|
+
view.value = 'months';
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
if (props.selectionType === 'year') {
|
|
1297
|
+
view.value = 'years';
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
}, { immediate: true });
|
|
1225
1301
|
vue.watch(() => props.calendarDate, () => {
|
|
1226
1302
|
if (props.calendarDate) {
|
|
1227
1303
|
calendarDate.value = new Date(props.calendarDate);
|
|
1228
1304
|
}
|
|
1229
1305
|
});
|
|
1230
1306
|
vue.watch(() => props.startDate, () => {
|
|
1231
|
-
const date = props.startDate
|
|
1307
|
+
const date = props.startDate
|
|
1308
|
+
? convertToDateObject(props.startDate, props.selectionType)
|
|
1309
|
+
: null;
|
|
1232
1310
|
if (!isSameDateAs(date, startDate.value)) {
|
|
1233
1311
|
startDate.value = date;
|
|
1234
1312
|
}
|
|
1235
1313
|
});
|
|
1236
1314
|
vue.watch(() => props.endDate, () => {
|
|
1237
|
-
const date = props.endDate ?
|
|
1315
|
+
const date = props.endDate ? convertToDateObject(props.endDate, props.selectionType) : null;
|
|
1238
1316
|
if (!isSameDateAs(date, endDate.value)) {
|
|
1239
1317
|
endDate.value = date;
|
|
1240
1318
|
}
|
|
1241
1319
|
});
|
|
1242
1320
|
vue.watch(() => props.maxDate, () => {
|
|
1243
1321
|
if (props.maxDate) {
|
|
1244
|
-
maxDate.value =
|
|
1322
|
+
maxDate.value = convertToDateObject(props.maxDate, props.selectionType);
|
|
1245
1323
|
}
|
|
1246
1324
|
});
|
|
1247
1325
|
vue.watch(() => props.minDate, () => {
|
|
1248
1326
|
if (props.minDate) {
|
|
1249
|
-
minDate.value =
|
|
1327
|
+
minDate.value = convertToDateObject(props.minDate, props.selectionType);
|
|
1250
1328
|
}
|
|
1251
1329
|
});
|
|
1252
1330
|
vue.watch(() => props.selectEndDate, () => {
|
|
1253
1331
|
selectEndDate.value = props.selectEndDate;
|
|
1254
1332
|
});
|
|
1255
1333
|
vue.watch(startDate, () => {
|
|
1256
|
-
emit('start-date-change', startDate.value);
|
|
1334
|
+
emit('start-date-change', getDateBySelectionType(startDate.value, props.selectionType));
|
|
1257
1335
|
});
|
|
1258
1336
|
vue.watch(endDate, () => {
|
|
1259
|
-
emit('end-date-change', endDate.value);
|
|
1337
|
+
emit('end-date-change', getDateBySelectionType(endDate.value, props.selectionType));
|
|
1260
1338
|
});
|
|
1261
1339
|
const setCalendarPage = (years, months = 0, setMonth) => {
|
|
1262
1340
|
const year = calendarDate.value.getFullYear();
|
|
@@ -1268,10 +1346,26 @@ const CCalendar = vue.defineComponent({
|
|
|
1268
1346
|
calendarDate.value = d;
|
|
1269
1347
|
emit('calendar-date-change', d);
|
|
1270
1348
|
};
|
|
1271
|
-
const
|
|
1349
|
+
const handleCalendarClick = (date, index) => {
|
|
1272
1350
|
if (isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)) {
|
|
1273
1351
|
return;
|
|
1274
1352
|
}
|
|
1353
|
+
const _date = new Date(date);
|
|
1354
|
+
if (view.value === 'days') {
|
|
1355
|
+
calendarDate.value = index ? new Date(_date.setMonth(_date.getMonth() - index)) : _date;
|
|
1356
|
+
}
|
|
1357
|
+
if (view.value === 'months' && props.selectionType !== 'month') {
|
|
1358
|
+
calendarDate.value = index ? new Date(_date.setMonth(_date.getMonth() - index)) : _date;
|
|
1359
|
+
view.value = 'days';
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
if (view.value === 'years' && props.selectionType !== 'year') {
|
|
1363
|
+
calendarDate.value = index
|
|
1364
|
+
? new Date(_date.setFullYear(_date.getFullYear() - index))
|
|
1365
|
+
: _date;
|
|
1366
|
+
view.value = 'months';
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1275
1369
|
if (props.range) {
|
|
1276
1370
|
if (selectEndDate.value) {
|
|
1277
1371
|
selectEndDate.value = false;
|
|
@@ -1304,40 +1398,117 @@ const CCalendar = vue.defineComponent({
|
|
|
1304
1398
|
}
|
|
1305
1399
|
startDate.value = date;
|
|
1306
1400
|
};
|
|
1307
|
-
const
|
|
1401
|
+
const handleCalendarKeyDown = (event, date, index) => {
|
|
1308
1402
|
if (event.code === 'Space' || event.key === 'Enter') {
|
|
1309
1403
|
event.preventDefault();
|
|
1310
|
-
|
|
1311
|
-
|
|
1404
|
+
handleCalendarClick(date, index);
|
|
1405
|
+
}
|
|
1406
|
+
if (event.key === 'ArrowRight' ||
|
|
1407
|
+
event.key === 'ArrowLeft' ||
|
|
1408
|
+
event.key === 'ArrowUp' ||
|
|
1409
|
+
event.key === 'ArrowDown') {
|
|
1410
|
+
event.preventDefault();
|
|
1411
|
+
if (maxDate.value &&
|
|
1412
|
+
date >= convertToDateObject(maxDate.value, props.selectionType) &&
|
|
1413
|
+
(event.key === 'ArrowRight' || event.key === 'ArrowDown')) {
|
|
1414
|
+
return;
|
|
1415
|
+
}
|
|
1416
|
+
if (minDate.value &&
|
|
1417
|
+
date <= convertToDateObject(minDate.value, props.selectionType) &&
|
|
1418
|
+
(event.key === 'ArrowLeft' || event.key === 'ArrowUp')) {
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
let element = event.target;
|
|
1422
|
+
if (props.selectionType === 'week' && element.tabIndex === -1) {
|
|
1423
|
+
element = element.closest('tr[tabindex="0"]');
|
|
1424
|
+
}
|
|
1425
|
+
const list = calendarRef.value
|
|
1426
|
+
? Array.from(calendarRef.value.querySelectorAll(props.selectionType === 'week' ? 'tr[tabindex="0"]' : 'td.current'))
|
|
1427
|
+
: [];
|
|
1428
|
+
// const list: HTMLElement[] = [].concat(
|
|
1429
|
+
// ...Element.prototype.querySelectorAll.call(
|
|
1430
|
+
// calendarRef.value,
|
|
1431
|
+
// props.selectionType === 'week' ? 'tr[tabindex="0"]' : 'td.current',
|
|
1432
|
+
// ),
|
|
1433
|
+
// )
|
|
1434
|
+
const index = list.indexOf(element);
|
|
1435
|
+
const first = index === 0;
|
|
1436
|
+
const last = index === list.length - 1;
|
|
1437
|
+
const toBoundary = {
|
|
1438
|
+
start: index,
|
|
1439
|
+
end: list.length - (index + 1),
|
|
1440
|
+
};
|
|
1441
|
+
const gap = {
|
|
1442
|
+
ArrowRight: 1,
|
|
1443
|
+
ArrowLeft: -1,
|
|
1444
|
+
ArrowUp: props.selectionType === 'week' && view.value === 'days'
|
|
1445
|
+
? -1
|
|
1446
|
+
: view.value === 'days'
|
|
1447
|
+
? -7
|
|
1448
|
+
: -3,
|
|
1449
|
+
ArrowDown: props.selectionType === 'week' && view.value === 'days'
|
|
1450
|
+
? 1
|
|
1451
|
+
: view.value === 'days'
|
|
1452
|
+
? 7
|
|
1453
|
+
: 3,
|
|
1454
|
+
};
|
|
1455
|
+
if ((event.key === 'ArrowRight' && last) ||
|
|
1456
|
+
(event.key === 'ArrowDown' && toBoundary['end'] < gap['ArrowDown']) ||
|
|
1457
|
+
(event.key === 'ArrowLeft' && first) ||
|
|
1458
|
+
(event.key === 'ArrowUp' && toBoundary['start'] < Math.abs(gap['ArrowUp']))) {
|
|
1459
|
+
if (view.value === 'days') {
|
|
1460
|
+
setCalendarPage(0, event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1);
|
|
1461
|
+
}
|
|
1462
|
+
if (view.value === 'months') {
|
|
1463
|
+
setCalendarPage(event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1);
|
|
1464
|
+
}
|
|
1465
|
+
if (view.value === 'years') {
|
|
1466
|
+
setCalendarPage(event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 10 : -10);
|
|
1467
|
+
}
|
|
1468
|
+
setTimeout(() => {
|
|
1469
|
+
const _list = element.parentNode?.parentNode ? Array.from(element.parentNode.parentNode.querySelectorAll('td[tabindex="0"], tr[tabindex="0"]')) : [];
|
|
1470
|
+
if (_list.length && event.key === 'ArrowRight') {
|
|
1471
|
+
_list[0].focus();
|
|
1472
|
+
}
|
|
1473
|
+
if (_list.length && event.key === 'ArrowLeft') {
|
|
1474
|
+
_list[_list.length - 1].focus();
|
|
1475
|
+
}
|
|
1476
|
+
if (_list.length && event.key === 'ArrowDown') {
|
|
1477
|
+
_list[gap['ArrowDown'] - (list.length - index)].focus();
|
|
1478
|
+
}
|
|
1479
|
+
if (_list.length && event.key === 'ArrowUp') {
|
|
1480
|
+
_list[_list.length - (Math.abs(gap['ArrowUp']) + 1 - (index + 1))].focus();
|
|
1481
|
+
}
|
|
1482
|
+
}, 1);
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
if (list[index + gap[event.key]].tabIndex === 0) {
|
|
1486
|
+
list[index + gap[event.key]].focus();
|
|
1487
|
+
return;
|
|
1488
|
+
}
|
|
1489
|
+
for (let i = index; i < list.length; event.key === 'ArrowRight' || event.key === 'ArrowDown' ? i++ : i--) {
|
|
1490
|
+
if (list[i + gap[event.key]].tabIndex === 0) {
|
|
1491
|
+
list[i + gap[event.key]].focus();
|
|
1492
|
+
break;
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1312
1495
|
}
|
|
1313
1496
|
};
|
|
1314
|
-
const
|
|
1497
|
+
const handleCalendarMouseEnter = (date) => {
|
|
1315
1498
|
if (isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)) {
|
|
1316
1499
|
return;
|
|
1317
1500
|
}
|
|
1318
1501
|
hoverDate.value = date;
|
|
1319
|
-
emit('
|
|
1502
|
+
emit('date-hover', getDateBySelectionType(date, props.selectionType));
|
|
1320
1503
|
};
|
|
1321
|
-
const
|
|
1504
|
+
const handleCalendarMouseLeave = () => {
|
|
1322
1505
|
hoverDate.value = null;
|
|
1323
|
-
emit('
|
|
1324
|
-
};
|
|
1325
|
-
const handleMonthKeyDown = (event, month) => {
|
|
1326
|
-
if (event.code === 'Space' || event.key === 'Enter') {
|
|
1327
|
-
setCalendarPage(0, month);
|
|
1328
|
-
view.value = 'days';
|
|
1329
|
-
}
|
|
1330
|
-
};
|
|
1331
|
-
const handleYearKeyDown = (event, date) => {
|
|
1332
|
-
if (event.code === 'Space' || event.key === 'Enter') {
|
|
1333
|
-
calendarDate.value = date;
|
|
1334
|
-
view.value = 'months';
|
|
1335
|
-
}
|
|
1506
|
+
emit('date-hover', null);
|
|
1336
1507
|
};
|
|
1337
1508
|
const handleNavigationOnClick = (direction, double = false) => {
|
|
1338
1509
|
if (direction === 'prev') {
|
|
1339
1510
|
if (double) {
|
|
1340
|
-
setCalendarPage(view.value === '
|
|
1511
|
+
setCalendarPage(view.value === 'years' ? -10 : -1);
|
|
1341
1512
|
return;
|
|
1342
1513
|
}
|
|
1343
1514
|
if (view.value !== 'days') {
|
|
@@ -1349,7 +1520,7 @@ const CCalendar = vue.defineComponent({
|
|
|
1349
1520
|
}
|
|
1350
1521
|
if (direction === 'next') {
|
|
1351
1522
|
if (double) {
|
|
1352
|
-
setCalendarPage(view.value === '
|
|
1523
|
+
setCalendarPage(view.value === 'years' ? 10 : 1);
|
|
1353
1524
|
return;
|
|
1354
1525
|
}
|
|
1355
1526
|
if (view.value !== 'days') {
|
|
@@ -1360,118 +1531,181 @@ const CCalendar = vue.defineComponent({
|
|
|
1360
1531
|
return;
|
|
1361
1532
|
}
|
|
1362
1533
|
};
|
|
1363
|
-
const Calendar = (
|
|
1364
|
-
|
|
1365
|
-
if (addMonths !== 0) {
|
|
1366
|
-
date = new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth() + addMonths, 1);
|
|
1367
|
-
}
|
|
1368
|
-
const monthDetails = getMonthDetails(date.getFullYear(), date.getMonth(), props.firstDayOfWeek);
|
|
1534
|
+
const Calendar = (_calendarDate) => {
|
|
1535
|
+
const monthDetails = getMonthDetails(_calendarDate.getFullYear(), _calendarDate.getMonth(), props.firstDayOfWeek);
|
|
1369
1536
|
const listOfMonths = createGroupsInArray(getMonthsNames(props.locale), 4);
|
|
1370
|
-
const listOfYears = createGroupsInArray(getYears(
|
|
1371
|
-
const weekDays = monthDetails[0];
|
|
1537
|
+
const listOfYears = createGroupsInArray(getYears(_calendarDate.getFullYear()), 4);
|
|
1538
|
+
const weekDays = monthDetails[0].days;
|
|
1372
1539
|
return vue.h('table', {}, [
|
|
1373
1540
|
view.value === 'days' &&
|
|
1374
|
-
vue.h('thead', {}, vue.h('tr', {},
|
|
1375
|
-
|
|
1376
|
-
class: 'calendar-header-cell-inner',
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1541
|
+
vue.h('thead', {}, vue.h('tr', {}, [
|
|
1542
|
+
props.showWeekNumber &&
|
|
1543
|
+
vue.h('th', { class: 'calendar-cell' }, vue.h('div', { class: 'calendar-header-cell-inner' }, props.weekNumbersLabel)),
|
|
1544
|
+
weekDays.map(({ date }) => {
|
|
1545
|
+
return vue.h('th', { class: 'calendar-cell' }, vue.h('div', {
|
|
1546
|
+
class: 'calendar-header-cell-inner',
|
|
1547
|
+
}, typeof props.weekdayFormat === 'function'
|
|
1548
|
+
? props.weekdayFormat(date)
|
|
1549
|
+
: typeof props.weekdayFormat === 'string'
|
|
1550
|
+
? date.toLocaleDateString(props.locale, {
|
|
1551
|
+
weekday: props.weekdayFormat,
|
|
1552
|
+
})
|
|
1553
|
+
: date
|
|
1554
|
+
.toLocaleDateString(props.locale, { weekday: 'long' })
|
|
1555
|
+
.slice(0, props.weekdayFormat)));
|
|
1556
|
+
}),
|
|
1557
|
+
])),
|
|
1387
1558
|
vue.h('tbody', {}, [
|
|
1388
1559
|
view.value === 'days' &&
|
|
1389
1560
|
monthDetails.map((week) => {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1561
|
+
const date = convertToDateObject(week.weekNumber === 0
|
|
1562
|
+
? `${_calendarDate.getFullYear()}W53`
|
|
1563
|
+
: `${_calendarDate.getFullYear()}W${week.weekNumber}`, props.selectionType);
|
|
1564
|
+
const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
|
|
1565
|
+
const current = week.days.some((day) => day.month === 'current');
|
|
1566
|
+
return vue.h('tr', {
|
|
1567
|
+
class: [
|
|
1568
|
+
'calendar-row',
|
|
1569
|
+
{
|
|
1570
|
+
disabled: isDisabled,
|
|
1571
|
+
range: props.selectionType === 'week' &&
|
|
1572
|
+
isDateInRange(date, startDate.value, endDate.value),
|
|
1573
|
+
'range-hover': props.selectionType === 'week' && hoverDate.value && selectEndDate.value
|
|
1574
|
+
? isDateInRange(date, startDate.value, hoverDate.value)
|
|
1575
|
+
: isDateInRange(date, hoverDate.value, endDate.value),
|
|
1576
|
+
selected: isDateSelected(date, startDate.value, endDate.value),
|
|
1577
|
+
},
|
|
1578
|
+
],
|
|
1579
|
+
tabindex: props.selectionType === 'week' && current && !isDisabled ? 0 : -1,
|
|
1580
|
+
...(props.selectionType === 'week' &&
|
|
1581
|
+
!isDisabled && {
|
|
1582
|
+
onBlur: () => handleCalendarMouseLeave(),
|
|
1583
|
+
onClick: () => handleCalendarClick(date),
|
|
1584
|
+
onFocus: () => handleCalendarMouseEnter(date),
|
|
1585
|
+
onKeydown: (event) => handleCalendarKeyDown(event, date),
|
|
1586
|
+
onMouseEnter: () => handleCalendarMouseEnter(date),
|
|
1587
|
+
onMouseLeave: () => handleCalendarMouseLeave(),
|
|
1588
|
+
}),
|
|
1589
|
+
}, [
|
|
1590
|
+
props.showWeekNumber &&
|
|
1591
|
+
vue.h('th', { class: 'calendar-cell-week-number' }, week.weekNumber === 0 ? 53 : week.weekNumber),
|
|
1592
|
+
week.days.map(({ date, month }) => {
|
|
1593
|
+
const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
|
|
1594
|
+
return month === 'current' || props.showAdjacementDays
|
|
1595
|
+
? vue.h('td', {
|
|
1596
|
+
class: [
|
|
1597
|
+
'calendar-cell',
|
|
1598
|
+
{
|
|
1599
|
+
...(props.selectionType === 'day' && {
|
|
1600
|
+
clickable: month !== 'current' && props.selectAdjacementDays,
|
|
1601
|
+
disabled: isDisabled,
|
|
1602
|
+
'range-hover': month === 'current' &&
|
|
1603
|
+
(hoverDate.value && selectEndDate.value
|
|
1604
|
+
? isDateInRange(date, startDate.value, hoverDate.value)
|
|
1605
|
+
: isDateInRange(date, hoverDate.value, endDate.value)),
|
|
1606
|
+
range: month === 'current' &&
|
|
1607
|
+
isDateInRange(date, startDate.value, endDate.value),
|
|
1608
|
+
selected: isDateSelected(date, startDate.value, endDate.value),
|
|
1609
|
+
}),
|
|
1610
|
+
[month]: true,
|
|
1611
|
+
today: month === 'current' && isToday(date),
|
|
1612
|
+
},
|
|
1613
|
+
],
|
|
1614
|
+
tabindex: props.selectionType === 'day' &&
|
|
1615
|
+
(month === 'current' || props.selectAdjacementDays) &&
|
|
1616
|
+
!isDisabled
|
|
1617
|
+
? 0
|
|
1618
|
+
: -1,
|
|
1619
|
+
title: date.toLocaleDateString(props.locale),
|
|
1620
|
+
...(props.selectionType === 'day' &&
|
|
1621
|
+
(month === 'current' || props.selectAdjacementDays) && {
|
|
1622
|
+
onBlur: () => handleCalendarMouseLeave(),
|
|
1623
|
+
onClick: () => handleCalendarClick(date),
|
|
1624
|
+
onFocus: () => handleCalendarMouseEnter(date),
|
|
1625
|
+
onKeydown: (event) => handleCalendarKeyDown(event, date),
|
|
1626
|
+
onMouseEnter: () => handleCalendarMouseEnter(date),
|
|
1627
|
+
onMouseLeave: () => handleCalendarMouseLeave(),
|
|
1628
|
+
}),
|
|
1629
|
+
...(month !== 'current' &&
|
|
1630
|
+
!props.selectAdjacementDays && {
|
|
1631
|
+
onMouseEnter: () => handleCalendarMouseLeave(),
|
|
1632
|
+
}),
|
|
1633
|
+
}, vue.h('div', {
|
|
1634
|
+
class: 'calendar-cell-inner',
|
|
1635
|
+
}, typeof props.dayFormat === 'function'
|
|
1636
|
+
? props.dayFormat(date)
|
|
1637
|
+
: date.toLocaleDateString(props.locale, {
|
|
1638
|
+
day: props.dayFormat,
|
|
1639
|
+
})))
|
|
1640
|
+
: vue.h('td');
|
|
1641
|
+
}),
|
|
1642
|
+
]);
|
|
1438
1643
|
}),
|
|
1439
1644
|
view.value === 'months' &&
|
|
1440
1645
|
listOfMonths.map((row, index) => {
|
|
1441
1646
|
return vue.h('tr', {}, row.map((month, idx) => {
|
|
1647
|
+
const monthNumber = index * 3 + idx;
|
|
1648
|
+
const date = new Date(Date.UTC(_calendarDate.getFullYear(), monthNumber, 1));
|
|
1649
|
+
const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
|
|
1442
1650
|
return vue.h('td', {
|
|
1443
|
-
class:
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1651
|
+
class: [
|
|
1652
|
+
'calendar-cell',
|
|
1653
|
+
{
|
|
1654
|
+
disabled: isDisabled,
|
|
1655
|
+
selected: isDateSelected(date, startDate.value, endDate.value),
|
|
1656
|
+
'range-hover': props.selectionType === 'month' &&
|
|
1657
|
+
(hoverDate && selectEndDate
|
|
1658
|
+
? isDateInRange(date, startDate.value, hoverDate.value)
|
|
1659
|
+
: isDateInRange(date, hoverDate.value, endDate.value)),
|
|
1660
|
+
range: isDateInRange(date, startDate.value, endDate.value),
|
|
1661
|
+
},
|
|
1662
|
+
],
|
|
1663
|
+
tabindex: !isDisabled ? 0 : -1,
|
|
1664
|
+
...(!isDisabled && {
|
|
1665
|
+
onBlur: () => handleCalendarMouseLeave(),
|
|
1666
|
+
onClick: () => handleCalendarClick(date),
|
|
1667
|
+
onFocus: () => handleCalendarMouseEnter(date),
|
|
1668
|
+
onKeydown: (event) => handleCalendarKeyDown(event, date),
|
|
1669
|
+
onMouseEnter: () => handleCalendarMouseEnter(date),
|
|
1670
|
+
onMouseLeave: () => handleCalendarMouseLeave(),
|
|
1671
|
+
}),
|
|
1450
1672
|
}, vue.h('div', { class: 'calendar-cell-inner' }, month));
|
|
1451
1673
|
}));
|
|
1452
1674
|
}),
|
|
1453
1675
|
view.value === 'years' &&
|
|
1454
1676
|
listOfYears.map((row) => {
|
|
1455
1677
|
return vue.h('tr', {}, row.map((year) => {
|
|
1678
|
+
const date = new Date(Date.UTC(year, 0, 1));
|
|
1679
|
+
const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
|
|
1456
1680
|
return vue.h('td', {
|
|
1457
|
-
class:
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1681
|
+
class: [
|
|
1682
|
+
'calendar-cell year',
|
|
1683
|
+
{
|
|
1684
|
+
disabled: isDisabled,
|
|
1685
|
+
selected: isDateSelected(date, startDate.value, endDate.value),
|
|
1686
|
+
'range-hover': props.selectionType === 'year' &&
|
|
1687
|
+
(hoverDate && selectEndDate
|
|
1688
|
+
? isDateInRange(date, startDate.value, hoverDate.value)
|
|
1689
|
+
: isDateInRange(date, hoverDate.value, endDate.value)),
|
|
1690
|
+
range: isDateInRange(date, startDate.value, endDate.value),
|
|
1691
|
+
},
|
|
1692
|
+
],
|
|
1693
|
+
tabindex: !isDisabled ? 0 : -1,
|
|
1694
|
+
...(!isDisabled && {
|
|
1695
|
+
onBlur: () => handleCalendarMouseLeave(),
|
|
1696
|
+
onClick: () => handleCalendarClick(date),
|
|
1697
|
+
onFocus: () => handleCalendarMouseEnter(date),
|
|
1698
|
+
onKeydown: (event) => handleCalendarKeyDown(event, date),
|
|
1699
|
+
onMouseEnter: () => handleCalendarMouseEnter(date),
|
|
1700
|
+
onMouseLeave: () => handleCalendarMouseLeave(),
|
|
1701
|
+
}),
|
|
1464
1702
|
}, vue.h('div', { class: 'calendar-cell-inner' }, year));
|
|
1465
1703
|
}));
|
|
1466
1704
|
}),
|
|
1467
1705
|
]),
|
|
1468
1706
|
]);
|
|
1469
1707
|
};
|
|
1470
|
-
const Navigation = (
|
|
1471
|
-
let date = calendarDate.value;
|
|
1472
|
-
if (addMonths !== 0) {
|
|
1473
|
-
date = new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth() + addMonths, 1);
|
|
1474
|
-
}
|
|
1708
|
+
const Navigation = (_calendarDate) => {
|
|
1475
1709
|
return vue.h('div', { class: 'calendar-nav' }, [
|
|
1476
1710
|
props.navigation &&
|
|
1477
1711
|
vue.h('div', {
|
|
@@ -1515,7 +1749,7 @@ const CCalendar = vue.defineComponent({
|
|
|
1515
1749
|
if (props.navigation)
|
|
1516
1750
|
view.value = 'months';
|
|
1517
1751
|
},
|
|
1518
|
-
}, () =>
|
|
1752
|
+
}, () => _calendarDate.toLocaleDateString(props.locale, { month: 'long' })),
|
|
1519
1753
|
vue.h(CButton, {
|
|
1520
1754
|
color: 'transparent',
|
|
1521
1755
|
size: 'sm',
|
|
@@ -1524,7 +1758,7 @@ const CCalendar = vue.defineComponent({
|
|
|
1524
1758
|
view.value = 'years';
|
|
1525
1759
|
},
|
|
1526
1760
|
...(props.navYearFirst && { style: { order: '-1' } }),
|
|
1527
|
-
}, () =>
|
|
1761
|
+
}, () => _calendarDate.toLocaleDateString(props.locale, { year: 'numeric' })),
|
|
1528
1762
|
]),
|
|
1529
1763
|
props.navigation &&
|
|
1530
1764
|
vue.h('div', {
|
|
@@ -1558,8 +1792,23 @@ const CCalendar = vue.defineComponent({
|
|
|
1558
1792
|
]),
|
|
1559
1793
|
]);
|
|
1560
1794
|
};
|
|
1561
|
-
return () => vue.h('div', {
|
|
1562
|
-
|
|
1795
|
+
return () => vue.h('div', {
|
|
1796
|
+
class: [
|
|
1797
|
+
'calendars',
|
|
1798
|
+
{
|
|
1799
|
+
[`select-${props.selectionType}`]: props.selectionType && view.value === 'days',
|
|
1800
|
+
'show-week-numbers': props.showWeekNumber,
|
|
1801
|
+
},
|
|
1802
|
+
],
|
|
1803
|
+
ref: calendarRef,
|
|
1804
|
+
}, [
|
|
1805
|
+
Array.from({ length: props.calendars }, (_, index) => {
|
|
1806
|
+
const _calendarDate = getCalendarDate(calendarDate.value, index, view.value);
|
|
1807
|
+
return vue.h('div', { class: ['calendar', view.value] }, [
|
|
1808
|
+
Navigation(_calendarDate),
|
|
1809
|
+
Calendar(_calendarDate),
|
|
1810
|
+
]);
|
|
1811
|
+
}),
|
|
1563
1812
|
]);
|
|
1564
1813
|
},
|
|
1565
1814
|
});
|
|
@@ -1862,7 +2111,7 @@ const isInViewport = (element) => {
|
|
|
1862
2111
|
|
|
1863
2112
|
const isObjectInArray = (array, item, ignore = []) => array.some((_item) => {
|
|
1864
2113
|
let result = true;
|
|
1865
|
-
for (const key in
|
|
2114
|
+
for (const key in _item) {
|
|
1866
2115
|
if (!ignore.includes(key) && item[key] !== _item[key]) {
|
|
1867
2116
|
result = false;
|
|
1868
2117
|
break;
|
|
@@ -2030,11 +2279,8 @@ const CCarousel = vue.defineComponent({
|
|
|
2030
2279
|
visible.value && cycle();
|
|
2031
2280
|
});
|
|
2032
2281
|
return () => vue.h('div', {
|
|
2033
|
-
class: [
|
|
2034
|
-
|
|
2035
|
-
props.transition === 'crossfade' && 'carousel-fade',
|
|
2036
|
-
props.dark && 'carousel-dark',
|
|
2037
|
-
],
|
|
2282
|
+
class: ['carousel slide', props.transition === 'crossfade' && 'carousel-fade'],
|
|
2283
|
+
...(props.dark && { 'data-coreui-theme': 'dark' }),
|
|
2038
2284
|
onmouseover: () => props.pause && pause(),
|
|
2039
2285
|
onmouseleave: () => cycle(),
|
|
2040
2286
|
ref: carouselRef,
|
|
@@ -2147,2234 +2393,38 @@ const CCarouselItem = vue.defineComponent({
|
|
|
2147
2393
|
orderClassName.value = '';
|
|
2148
2394
|
activeClassName.value = 'active';
|
|
2149
2395
|
}
|
|
2150
|
-
if (!active) {
|
|
2151
|
-
directionClassName.value = '';
|
|
2152
|
-
orderClassName.value = '';
|
|
2153
|
-
activeClassName.value = '';
|
|
2154
|
-
}
|
|
2155
|
-
});
|
|
2156
|
-
});
|
|
2157
|
-
return () => vue.h('div', {
|
|
2158
|
-
class: [
|
|
2159
|
-
'carousel-item',
|
|
2160
|
-
activeClassName.value,
|
|
2161
|
-
directionClassName.value,
|
|
2162
|
-
orderClassName.value,
|
|
2163
|
-
],
|
|
2164
|
-
ref: carouselItemRef,
|
|
2165
|
-
}, slots.default && slots.default());
|
|
2166
|
-
},
|
|
2167
|
-
});
|
|
2168
|
-
|
|
2169
|
-
const CCarouselPlugin = {
|
|
2170
|
-
install: (app) => {
|
|
2171
|
-
app.component(CCarousel.name, CCarousel);
|
|
2172
|
-
app.component(CCarouselCaption.name, CCarouselCaption);
|
|
2173
|
-
app.component(CCarouselItem.name, CCarouselItem);
|
|
2174
|
-
},
|
|
2175
|
-
};
|
|
2176
|
-
|
|
2177
|
-
const CCollapsePlugin = {
|
|
2178
|
-
install: (app) => {
|
|
2179
|
-
app.component(CCollapse.name, CCollapse);
|
|
2180
|
-
},
|
|
2181
|
-
};
|
|
2182
|
-
|
|
2183
|
-
function _typeof(obj) {
|
|
2184
|
-
"@babel/helpers - typeof";
|
|
2185
|
-
|
|
2186
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2187
|
-
return typeof obj;
|
|
2188
|
-
} : function (obj) {
|
|
2189
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2190
|
-
}, _typeof(obj);
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
function toInteger(dirtyNumber) {
|
|
2194
|
-
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
2195
|
-
return NaN;
|
|
2196
|
-
}
|
|
2197
|
-
var number = Number(dirtyNumber);
|
|
2198
|
-
if (isNaN(number)) {
|
|
2199
|
-
return number;
|
|
2200
|
-
}
|
|
2201
|
-
return number < 0 ? Math.ceil(number) : Math.floor(number);
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
function requiredArgs(required, args) {
|
|
2205
|
-
if (args.length < required) {
|
|
2206
|
-
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
/**
|
|
2211
|
-
* @name toDate
|
|
2212
|
-
* @category Common Helpers
|
|
2213
|
-
* @summary Convert the given argument to an instance of Date.
|
|
2214
|
-
*
|
|
2215
|
-
* @description
|
|
2216
|
-
* Convert the given argument to an instance of Date.
|
|
2217
|
-
*
|
|
2218
|
-
* If the argument is an instance of Date, the function returns its clone.
|
|
2219
|
-
*
|
|
2220
|
-
* If the argument is a number, it is treated as a timestamp.
|
|
2221
|
-
*
|
|
2222
|
-
* If the argument is none of the above, the function returns Invalid Date.
|
|
2223
|
-
*
|
|
2224
|
-
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
2225
|
-
*
|
|
2226
|
-
* @param {Date|Number} argument - the value to convert
|
|
2227
|
-
* @returns {Date} the parsed date in the local time zone
|
|
2228
|
-
* @throws {TypeError} 1 argument required
|
|
2229
|
-
*
|
|
2230
|
-
* @example
|
|
2231
|
-
* // Clone the date:
|
|
2232
|
-
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
2233
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
2234
|
-
*
|
|
2235
|
-
* @example
|
|
2236
|
-
* // Convert the timestamp to date:
|
|
2237
|
-
* const result = toDate(1392098430000)
|
|
2238
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
2239
|
-
*/
|
|
2240
|
-
function toDate(argument) {
|
|
2241
|
-
requiredArgs(1, arguments);
|
|
2242
|
-
var argStr = Object.prototype.toString.call(argument);
|
|
2243
|
-
|
|
2244
|
-
// Clone the date
|
|
2245
|
-
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
|
|
2246
|
-
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
2247
|
-
return new Date(argument.getTime());
|
|
2248
|
-
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
2249
|
-
return new Date(argument);
|
|
2250
|
-
} else {
|
|
2251
|
-
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
2252
|
-
// eslint-disable-next-line no-console
|
|
2253
|
-
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
|
|
2254
|
-
// eslint-disable-next-line no-console
|
|
2255
|
-
console.warn(new Error().stack);
|
|
2256
|
-
}
|
|
2257
|
-
return new Date(NaN);
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
/**
|
|
2262
|
-
* @name addMilliseconds
|
|
2263
|
-
* @category Millisecond Helpers
|
|
2264
|
-
* @summary Add the specified number of milliseconds to the given date.
|
|
2265
|
-
*
|
|
2266
|
-
* @description
|
|
2267
|
-
* Add the specified number of milliseconds to the given date.
|
|
2268
|
-
*
|
|
2269
|
-
* @param {Date|Number} date - the date to be changed
|
|
2270
|
-
* @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
2271
|
-
* @returns {Date} the new date with the milliseconds added
|
|
2272
|
-
* @throws {TypeError} 2 arguments required
|
|
2273
|
-
*
|
|
2274
|
-
* @example
|
|
2275
|
-
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
|
2276
|
-
* const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
2277
|
-
* //=> Thu Jul 10 2014 12:45:30.750
|
|
2278
|
-
*/
|
|
2279
|
-
function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
2280
|
-
requiredArgs(2, arguments);
|
|
2281
|
-
var timestamp = toDate(dirtyDate).getTime();
|
|
2282
|
-
var amount = toInteger(dirtyAmount);
|
|
2283
|
-
return new Date(timestamp + amount);
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
|
-
var defaultOptions = {};
|
|
2287
|
-
function getDefaultOptions() {
|
|
2288
|
-
return defaultOptions;
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
/**
|
|
2292
|
-
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
2293
|
-
* They usually appear for dates that denote time before the timezones were introduced
|
|
2294
|
-
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
2295
|
-
* and GMT+01:00:00 after that date)
|
|
2296
|
-
*
|
|
2297
|
-
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
2298
|
-
* which would lead to incorrect calculations.
|
|
2299
|
-
*
|
|
2300
|
-
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
2301
|
-
*/
|
|
2302
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
2303
|
-
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
2304
|
-
utcDate.setUTCFullYear(date.getFullYear());
|
|
2305
|
-
return date.getTime() - utcDate.getTime();
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
/**
|
|
2309
|
-
* @name isDate
|
|
2310
|
-
* @category Common Helpers
|
|
2311
|
-
* @summary Is the given value a date?
|
|
2312
|
-
*
|
|
2313
|
-
* @description
|
|
2314
|
-
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
2315
|
-
*
|
|
2316
|
-
* @param {*} value - the value to check
|
|
2317
|
-
* @returns {boolean} true if the given value is a date
|
|
2318
|
-
* @throws {TypeError} 1 arguments required
|
|
2319
|
-
*
|
|
2320
|
-
* @example
|
|
2321
|
-
* // For a valid date:
|
|
2322
|
-
* const result = isDate(new Date())
|
|
2323
|
-
* //=> true
|
|
2324
|
-
*
|
|
2325
|
-
* @example
|
|
2326
|
-
* // For an invalid date:
|
|
2327
|
-
* const result = isDate(new Date(NaN))
|
|
2328
|
-
* //=> true
|
|
2329
|
-
*
|
|
2330
|
-
* @example
|
|
2331
|
-
* // For some value:
|
|
2332
|
-
* const result = isDate('2014-02-31')
|
|
2333
|
-
* //=> false
|
|
2334
|
-
*
|
|
2335
|
-
* @example
|
|
2336
|
-
* // For an object:
|
|
2337
|
-
* const result = isDate({})
|
|
2338
|
-
* //=> false
|
|
2339
|
-
*/
|
|
2340
|
-
function isDate(value) {
|
|
2341
|
-
requiredArgs(1, arguments);
|
|
2342
|
-
return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
/**
|
|
2346
|
-
* @name isValid
|
|
2347
|
-
* @category Common Helpers
|
|
2348
|
-
* @summary Is the given date valid?
|
|
2349
|
-
*
|
|
2350
|
-
* @description
|
|
2351
|
-
* Returns false if argument is Invalid Date and true otherwise.
|
|
2352
|
-
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
|
2353
|
-
* Invalid Date is a Date, whose time value is NaN.
|
|
2354
|
-
*
|
|
2355
|
-
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
2356
|
-
*
|
|
2357
|
-
* @param {*} date - the date to check
|
|
2358
|
-
* @returns {Boolean} the date is valid
|
|
2359
|
-
* @throws {TypeError} 1 argument required
|
|
2360
|
-
*
|
|
2361
|
-
* @example
|
|
2362
|
-
* // For the valid date:
|
|
2363
|
-
* const result = isValid(new Date(2014, 1, 31))
|
|
2364
|
-
* //=> true
|
|
2365
|
-
*
|
|
2366
|
-
* @example
|
|
2367
|
-
* // For the value, convertable into a date:
|
|
2368
|
-
* const result = isValid(1393804800000)
|
|
2369
|
-
* //=> true
|
|
2370
|
-
*
|
|
2371
|
-
* @example
|
|
2372
|
-
* // For the invalid date:
|
|
2373
|
-
* const result = isValid(new Date(''))
|
|
2374
|
-
* //=> false
|
|
2375
|
-
*/
|
|
2376
|
-
function isValid(dirtyDate) {
|
|
2377
|
-
requiredArgs(1, arguments);
|
|
2378
|
-
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
2379
|
-
return false;
|
|
2380
|
-
}
|
|
2381
|
-
var date = toDate(dirtyDate);
|
|
2382
|
-
return !isNaN(Number(date));
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
/**
|
|
2386
|
-
* @name subMilliseconds
|
|
2387
|
-
* @category Millisecond Helpers
|
|
2388
|
-
* @summary Subtract the specified number of milliseconds from the given date.
|
|
2389
|
-
*
|
|
2390
|
-
* @description
|
|
2391
|
-
* Subtract the specified number of milliseconds from the given date.
|
|
2392
|
-
*
|
|
2393
|
-
* @param {Date|Number} date - the date to be changed
|
|
2394
|
-
* @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
2395
|
-
* @returns {Date} the new date with the milliseconds subtracted
|
|
2396
|
-
* @throws {TypeError} 2 arguments required
|
|
2397
|
-
*
|
|
2398
|
-
* @example
|
|
2399
|
-
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
|
|
2400
|
-
* const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
2401
|
-
* //=> Thu Jul 10 2014 12:45:29.250
|
|
2402
|
-
*/
|
|
2403
|
-
function subMilliseconds(dirtyDate, dirtyAmount) {
|
|
2404
|
-
requiredArgs(2, arguments);
|
|
2405
|
-
var amount = toInteger(dirtyAmount);
|
|
2406
|
-
return addMilliseconds(dirtyDate, -amount);
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
var MILLISECONDS_IN_DAY = 86400000;
|
|
2410
|
-
function getUTCDayOfYear(dirtyDate) {
|
|
2411
|
-
requiredArgs(1, arguments);
|
|
2412
|
-
var date = toDate(dirtyDate);
|
|
2413
|
-
var timestamp = date.getTime();
|
|
2414
|
-
date.setUTCMonth(0, 1);
|
|
2415
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2416
|
-
var startOfYearTimestamp = date.getTime();
|
|
2417
|
-
var difference = timestamp - startOfYearTimestamp;
|
|
2418
|
-
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
function startOfUTCISOWeek(dirtyDate) {
|
|
2422
|
-
requiredArgs(1, arguments);
|
|
2423
|
-
var weekStartsOn = 1;
|
|
2424
|
-
var date = toDate(dirtyDate);
|
|
2425
|
-
var day = date.getUTCDay();
|
|
2426
|
-
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
2427
|
-
date.setUTCDate(date.getUTCDate() - diff);
|
|
2428
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2429
|
-
return date;
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
function getUTCISOWeekYear(dirtyDate) {
|
|
2433
|
-
requiredArgs(1, arguments);
|
|
2434
|
-
var date = toDate(dirtyDate);
|
|
2435
|
-
var year = date.getUTCFullYear();
|
|
2436
|
-
var fourthOfJanuaryOfNextYear = new Date(0);
|
|
2437
|
-
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
|
|
2438
|
-
fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
2439
|
-
var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
|
|
2440
|
-
var fourthOfJanuaryOfThisYear = new Date(0);
|
|
2441
|
-
fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
|
|
2442
|
-
fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
2443
|
-
var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
|
|
2444
|
-
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
2445
|
-
return year + 1;
|
|
2446
|
-
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
2447
|
-
return year;
|
|
2448
|
-
} else {
|
|
2449
|
-
return year - 1;
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
function startOfUTCISOWeekYear(dirtyDate) {
|
|
2454
|
-
requiredArgs(1, arguments);
|
|
2455
|
-
var year = getUTCISOWeekYear(dirtyDate);
|
|
2456
|
-
var fourthOfJanuary = new Date(0);
|
|
2457
|
-
fourthOfJanuary.setUTCFullYear(year, 0, 4);
|
|
2458
|
-
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
|
|
2459
|
-
var date = startOfUTCISOWeek(fourthOfJanuary);
|
|
2460
|
-
return date;
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
|
-
var MILLISECONDS_IN_WEEK$1 = 604800000;
|
|
2464
|
-
function getUTCISOWeek(dirtyDate) {
|
|
2465
|
-
requiredArgs(1, arguments);
|
|
2466
|
-
var date = toDate(dirtyDate);
|
|
2467
|
-
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
|
|
2468
|
-
|
|
2469
|
-
// Round the number of days to the nearest integer
|
|
2470
|
-
// because the number of milliseconds in a week is not constant
|
|
2471
|
-
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
2472
|
-
return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
|
|
2473
|
-
}
|
|
2474
|
-
|
|
2475
|
-
function startOfUTCWeek(dirtyDate, options) {
|
|
2476
|
-
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
2477
|
-
requiredArgs(1, arguments);
|
|
2478
|
-
var defaultOptions = getDefaultOptions();
|
|
2479
|
-
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
|
|
2480
|
-
|
|
2481
|
-
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
2482
|
-
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
2483
|
-
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
2484
|
-
}
|
|
2485
|
-
var date = toDate(dirtyDate);
|
|
2486
|
-
var day = date.getUTCDay();
|
|
2487
|
-
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
2488
|
-
date.setUTCDate(date.getUTCDate() - diff);
|
|
2489
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2490
|
-
return date;
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
|
-
function getUTCWeekYear(dirtyDate, options) {
|
|
2494
|
-
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
2495
|
-
requiredArgs(1, arguments);
|
|
2496
|
-
var date = toDate(dirtyDate);
|
|
2497
|
-
var year = date.getUTCFullYear();
|
|
2498
|
-
var defaultOptions = getDefaultOptions();
|
|
2499
|
-
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
|
|
2500
|
-
|
|
2501
|
-
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
2502
|
-
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
2503
|
-
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
2504
|
-
}
|
|
2505
|
-
var firstWeekOfNextYear = new Date(0);
|
|
2506
|
-
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
|
|
2507
|
-
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
2508
|
-
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
|
|
2509
|
-
var firstWeekOfThisYear = new Date(0);
|
|
2510
|
-
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
2511
|
-
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
2512
|
-
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
|
|
2513
|
-
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
2514
|
-
return year + 1;
|
|
2515
|
-
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
2516
|
-
return year;
|
|
2517
|
-
} else {
|
|
2518
|
-
return year - 1;
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
function startOfUTCWeekYear(dirtyDate, options) {
|
|
2523
|
-
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
2524
|
-
requiredArgs(1, arguments);
|
|
2525
|
-
var defaultOptions = getDefaultOptions();
|
|
2526
|
-
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
|
|
2527
|
-
var year = getUTCWeekYear(dirtyDate, options);
|
|
2528
|
-
var firstWeek = new Date(0);
|
|
2529
|
-
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
2530
|
-
firstWeek.setUTCHours(0, 0, 0, 0);
|
|
2531
|
-
var date = startOfUTCWeek(firstWeek, options);
|
|
2532
|
-
return date;
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
var MILLISECONDS_IN_WEEK = 604800000;
|
|
2536
|
-
function getUTCWeek(dirtyDate, options) {
|
|
2537
|
-
requiredArgs(1, arguments);
|
|
2538
|
-
var date = toDate(dirtyDate);
|
|
2539
|
-
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
|
|
2540
|
-
|
|
2541
|
-
// Round the number of days to the nearest integer
|
|
2542
|
-
// because the number of milliseconds in a week is not constant
|
|
2543
|
-
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
2544
|
-
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
function addLeadingZeros(number, targetLength) {
|
|
2548
|
-
var sign = number < 0 ? '-' : '';
|
|
2549
|
-
var output = Math.abs(number).toString();
|
|
2550
|
-
while (output.length < targetLength) {
|
|
2551
|
-
output = '0' + output;
|
|
2552
|
-
}
|
|
2553
|
-
return sign + output;
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
/*
|
|
2557
|
-
* | | Unit | | Unit |
|
|
2558
|
-
* |-----|--------------------------------|-----|--------------------------------|
|
|
2559
|
-
* | a | AM, PM | A* | |
|
|
2560
|
-
* | d | Day of month | D | |
|
|
2561
|
-
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
2562
|
-
* | m | Minute | M | Month |
|
|
2563
|
-
* | s | Second | S | Fraction of second |
|
|
2564
|
-
* | y | Year (abs) | Y | |
|
|
2565
|
-
*
|
|
2566
|
-
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
2567
|
-
*/
|
|
2568
|
-
var formatters$2 = {
|
|
2569
|
-
// Year
|
|
2570
|
-
y: function y(date, token) {
|
|
2571
|
-
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
2572
|
-
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
2573
|
-
// |----------|-------|----|-------|-------|-------|
|
|
2574
|
-
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
2575
|
-
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
2576
|
-
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
2577
|
-
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
2578
|
-
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
2579
|
-
|
|
2580
|
-
var signedYear = date.getUTCFullYear();
|
|
2581
|
-
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
2582
|
-
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
2583
|
-
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
|
2584
|
-
},
|
|
2585
|
-
// Month
|
|
2586
|
-
M: function M(date, token) {
|
|
2587
|
-
var month = date.getUTCMonth();
|
|
2588
|
-
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
2589
|
-
},
|
|
2590
|
-
// Day of the month
|
|
2591
|
-
d: function d(date, token) {
|
|
2592
|
-
return addLeadingZeros(date.getUTCDate(), token.length);
|
|
2593
|
-
},
|
|
2594
|
-
// AM or PM
|
|
2595
|
-
a: function a(date, token) {
|
|
2596
|
-
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
|
2597
|
-
switch (token) {
|
|
2598
|
-
case 'a':
|
|
2599
|
-
case 'aa':
|
|
2600
|
-
return dayPeriodEnumValue.toUpperCase();
|
|
2601
|
-
case 'aaa':
|
|
2602
|
-
return dayPeriodEnumValue;
|
|
2603
|
-
case 'aaaaa':
|
|
2604
|
-
return dayPeriodEnumValue[0];
|
|
2605
|
-
case 'aaaa':
|
|
2606
|
-
default:
|
|
2607
|
-
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
|
2608
|
-
}
|
|
2609
|
-
},
|
|
2610
|
-
// Hour [1-12]
|
|
2611
|
-
h: function h(date, token) {
|
|
2612
|
-
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
|
2613
|
-
},
|
|
2614
|
-
// Hour [0-23]
|
|
2615
|
-
H: function H(date, token) {
|
|
2616
|
-
return addLeadingZeros(date.getUTCHours(), token.length);
|
|
2617
|
-
},
|
|
2618
|
-
// Minute
|
|
2619
|
-
m: function m(date, token) {
|
|
2620
|
-
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
|
2621
|
-
},
|
|
2622
|
-
// Second
|
|
2623
|
-
s: function s(date, token) {
|
|
2624
|
-
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
|
2625
|
-
},
|
|
2626
|
-
// Fraction of second
|
|
2627
|
-
S: function S(date, token) {
|
|
2628
|
-
var numberOfDigits = token.length;
|
|
2629
|
-
var milliseconds = date.getUTCMilliseconds();
|
|
2630
|
-
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
|
2631
|
-
return addLeadingZeros(fractionalSeconds, token.length);
|
|
2632
|
-
}
|
|
2633
|
-
};
|
|
2634
|
-
var formatters$3 = formatters$2;
|
|
2635
|
-
|
|
2636
|
-
var dayPeriodEnum = {
|
|
2637
|
-
am: 'am',
|
|
2638
|
-
pm: 'pm',
|
|
2639
|
-
midnight: 'midnight',
|
|
2640
|
-
noon: 'noon',
|
|
2641
|
-
morning: 'morning',
|
|
2642
|
-
afternoon: 'afternoon',
|
|
2643
|
-
evening: 'evening',
|
|
2644
|
-
night: 'night'
|
|
2645
|
-
};
|
|
2646
|
-
/*
|
|
2647
|
-
* | | Unit | | Unit |
|
|
2648
|
-
* |-----|--------------------------------|-----|--------------------------------|
|
|
2649
|
-
* | a | AM, PM | A* | Milliseconds in day |
|
|
2650
|
-
* | b | AM, PM, noon, midnight | B | Flexible day period |
|
|
2651
|
-
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
|
|
2652
|
-
* | d | Day of month | D | Day of year |
|
|
2653
|
-
* | e | Local day of week | E | Day of week |
|
|
2654
|
-
* | f | | F* | Day of week in month |
|
|
2655
|
-
* | g* | Modified Julian day | G | Era |
|
|
2656
|
-
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
2657
|
-
* | i! | ISO day of week | I! | ISO week of year |
|
|
2658
|
-
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
|
|
2659
|
-
* | k | Hour [1-24] | K | Hour [0-11] |
|
|
2660
|
-
* | l* | (deprecated) | L | Stand-alone month |
|
|
2661
|
-
* | m | Minute | M | Month |
|
|
2662
|
-
* | n | | N | |
|
|
2663
|
-
* | o! | Ordinal number modifier | O | Timezone (GMT) |
|
|
2664
|
-
* | p! | Long localized time | P! | Long localized date |
|
|
2665
|
-
* | q | Stand-alone quarter | Q | Quarter |
|
|
2666
|
-
* | r* | Related Gregorian year | R! | ISO week-numbering year |
|
|
2667
|
-
* | s | Second | S | Fraction of second |
|
|
2668
|
-
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
|
|
2669
|
-
* | u | Extended year | U* | Cyclic year |
|
|
2670
|
-
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
|
|
2671
|
-
* | w | Local week of year | W* | Week of month |
|
|
2672
|
-
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
|
|
2673
|
-
* | y | Year (abs) | Y | Local week-numbering year |
|
|
2674
|
-
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
|
|
2675
|
-
*
|
|
2676
|
-
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
2677
|
-
*
|
|
2678
|
-
* Letters marked by ! are non-standard, but implemented by date-fns:
|
|
2679
|
-
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
|
|
2680
|
-
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
|
|
2681
|
-
* i.e. 7 for Sunday, 1 for Monday, etc.
|
|
2682
|
-
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
|
|
2683
|
-
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
|
|
2684
|
-
* `R` is supposed to be used in conjunction with `I` and `i`
|
|
2685
|
-
* for universal ISO week-numbering date, whereas
|
|
2686
|
-
* `Y` is supposed to be used in conjunction with `w` and `e`
|
|
2687
|
-
* for week-numbering date specific to the locale.
|
|
2688
|
-
* - `P` is long localized date format
|
|
2689
|
-
* - `p` is long localized time format
|
|
2690
|
-
*/
|
|
2691
|
-
|
|
2692
|
-
var formatters = {
|
|
2693
|
-
// Era
|
|
2694
|
-
G: function G(date, token, localize) {
|
|
2695
|
-
var era = date.getUTCFullYear() > 0 ? 1 : 0;
|
|
2696
|
-
switch (token) {
|
|
2697
|
-
// AD, BC
|
|
2698
|
-
case 'G':
|
|
2699
|
-
case 'GG':
|
|
2700
|
-
case 'GGG':
|
|
2701
|
-
return localize.era(era, {
|
|
2702
|
-
width: 'abbreviated'
|
|
2703
|
-
});
|
|
2704
|
-
// A, B
|
|
2705
|
-
case 'GGGGG':
|
|
2706
|
-
return localize.era(era, {
|
|
2707
|
-
width: 'narrow'
|
|
2708
|
-
});
|
|
2709
|
-
// Anno Domini, Before Christ
|
|
2710
|
-
case 'GGGG':
|
|
2711
|
-
default:
|
|
2712
|
-
return localize.era(era, {
|
|
2713
|
-
width: 'wide'
|
|
2714
|
-
});
|
|
2715
|
-
}
|
|
2716
|
-
},
|
|
2717
|
-
// Year
|
|
2718
|
-
y: function y(date, token, localize) {
|
|
2719
|
-
// Ordinal number
|
|
2720
|
-
if (token === 'yo') {
|
|
2721
|
-
var signedYear = date.getUTCFullYear();
|
|
2722
|
-
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
2723
|
-
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
2724
|
-
return localize.ordinalNumber(year, {
|
|
2725
|
-
unit: 'year'
|
|
2726
|
-
});
|
|
2727
|
-
}
|
|
2728
|
-
return formatters$3.y(date, token);
|
|
2729
|
-
},
|
|
2730
|
-
// Local week-numbering year
|
|
2731
|
-
Y: function Y(date, token, localize, options) {
|
|
2732
|
-
var signedWeekYear = getUTCWeekYear(date, options);
|
|
2733
|
-
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
2734
|
-
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
2735
|
-
|
|
2736
|
-
// Two digit year
|
|
2737
|
-
if (token === 'YY') {
|
|
2738
|
-
var twoDigitYear = weekYear % 100;
|
|
2739
|
-
return addLeadingZeros(twoDigitYear, 2);
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
// Ordinal number
|
|
2743
|
-
if (token === 'Yo') {
|
|
2744
|
-
return localize.ordinalNumber(weekYear, {
|
|
2745
|
-
unit: 'year'
|
|
2746
|
-
});
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
// Padding
|
|
2750
|
-
return addLeadingZeros(weekYear, token.length);
|
|
2751
|
-
},
|
|
2752
|
-
// ISO week-numbering year
|
|
2753
|
-
R: function R(date, token) {
|
|
2754
|
-
var isoWeekYear = getUTCISOWeekYear(date);
|
|
2755
|
-
|
|
2756
|
-
// Padding
|
|
2757
|
-
return addLeadingZeros(isoWeekYear, token.length);
|
|
2758
|
-
},
|
|
2759
|
-
// Extended year. This is a single number designating the year of this calendar system.
|
|
2760
|
-
// The main difference between `y` and `u` localizers are B.C. years:
|
|
2761
|
-
// | Year | `y` | `u` |
|
|
2762
|
-
// |------|-----|-----|
|
|
2763
|
-
// | AC 1 | 1 | 1 |
|
|
2764
|
-
// | BC 1 | 1 | 0 |
|
|
2765
|
-
// | BC 2 | 2 | -1 |
|
|
2766
|
-
// Also `yy` always returns the last two digits of a year,
|
|
2767
|
-
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
2768
|
-
u: function u(date, token) {
|
|
2769
|
-
var year = date.getUTCFullYear();
|
|
2770
|
-
return addLeadingZeros(year, token.length);
|
|
2771
|
-
},
|
|
2772
|
-
// Quarter
|
|
2773
|
-
Q: function Q(date, token, localize) {
|
|
2774
|
-
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
|
2775
|
-
switch (token) {
|
|
2776
|
-
// 1, 2, 3, 4
|
|
2777
|
-
case 'Q':
|
|
2778
|
-
return String(quarter);
|
|
2779
|
-
// 01, 02, 03, 04
|
|
2780
|
-
case 'QQ':
|
|
2781
|
-
return addLeadingZeros(quarter, 2);
|
|
2782
|
-
// 1st, 2nd, 3rd, 4th
|
|
2783
|
-
case 'Qo':
|
|
2784
|
-
return localize.ordinalNumber(quarter, {
|
|
2785
|
-
unit: 'quarter'
|
|
2786
|
-
});
|
|
2787
|
-
// Q1, Q2, Q3, Q4
|
|
2788
|
-
case 'QQQ':
|
|
2789
|
-
return localize.quarter(quarter, {
|
|
2790
|
-
width: 'abbreviated',
|
|
2791
|
-
context: 'formatting'
|
|
2792
|
-
});
|
|
2793
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
2794
|
-
case 'QQQQQ':
|
|
2795
|
-
return localize.quarter(quarter, {
|
|
2796
|
-
width: 'narrow',
|
|
2797
|
-
context: 'formatting'
|
|
2798
|
-
});
|
|
2799
|
-
// 1st quarter, 2nd quarter, ...
|
|
2800
|
-
case 'QQQQ':
|
|
2801
|
-
default:
|
|
2802
|
-
return localize.quarter(quarter, {
|
|
2803
|
-
width: 'wide',
|
|
2804
|
-
context: 'formatting'
|
|
2805
|
-
});
|
|
2806
|
-
}
|
|
2807
|
-
},
|
|
2808
|
-
// Stand-alone quarter
|
|
2809
|
-
q: function q(date, token, localize) {
|
|
2810
|
-
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
|
2811
|
-
switch (token) {
|
|
2812
|
-
// 1, 2, 3, 4
|
|
2813
|
-
case 'q':
|
|
2814
|
-
return String(quarter);
|
|
2815
|
-
// 01, 02, 03, 04
|
|
2816
|
-
case 'qq':
|
|
2817
|
-
return addLeadingZeros(quarter, 2);
|
|
2818
|
-
// 1st, 2nd, 3rd, 4th
|
|
2819
|
-
case 'qo':
|
|
2820
|
-
return localize.ordinalNumber(quarter, {
|
|
2821
|
-
unit: 'quarter'
|
|
2822
|
-
});
|
|
2823
|
-
// Q1, Q2, Q3, Q4
|
|
2824
|
-
case 'qqq':
|
|
2825
|
-
return localize.quarter(quarter, {
|
|
2826
|
-
width: 'abbreviated',
|
|
2827
|
-
context: 'standalone'
|
|
2828
|
-
});
|
|
2829
|
-
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
2830
|
-
case 'qqqqq':
|
|
2831
|
-
return localize.quarter(quarter, {
|
|
2832
|
-
width: 'narrow',
|
|
2833
|
-
context: 'standalone'
|
|
2834
|
-
});
|
|
2835
|
-
// 1st quarter, 2nd quarter, ...
|
|
2836
|
-
case 'qqqq':
|
|
2837
|
-
default:
|
|
2838
|
-
return localize.quarter(quarter, {
|
|
2839
|
-
width: 'wide',
|
|
2840
|
-
context: 'standalone'
|
|
2841
|
-
});
|
|
2842
|
-
}
|
|
2843
|
-
},
|
|
2844
|
-
// Month
|
|
2845
|
-
M: function M(date, token, localize) {
|
|
2846
|
-
var month = date.getUTCMonth();
|
|
2847
|
-
switch (token) {
|
|
2848
|
-
case 'M':
|
|
2849
|
-
case 'MM':
|
|
2850
|
-
return formatters$3.M(date, token);
|
|
2851
|
-
// 1st, 2nd, ..., 12th
|
|
2852
|
-
case 'Mo':
|
|
2853
|
-
return localize.ordinalNumber(month + 1, {
|
|
2854
|
-
unit: 'month'
|
|
2855
|
-
});
|
|
2856
|
-
// Jan, Feb, ..., Dec
|
|
2857
|
-
case 'MMM':
|
|
2858
|
-
return localize.month(month, {
|
|
2859
|
-
width: 'abbreviated',
|
|
2860
|
-
context: 'formatting'
|
|
2861
|
-
});
|
|
2862
|
-
// J, F, ..., D
|
|
2863
|
-
case 'MMMMM':
|
|
2864
|
-
return localize.month(month, {
|
|
2865
|
-
width: 'narrow',
|
|
2866
|
-
context: 'formatting'
|
|
2867
|
-
});
|
|
2868
|
-
// January, February, ..., December
|
|
2869
|
-
case 'MMMM':
|
|
2870
|
-
default:
|
|
2871
|
-
return localize.month(month, {
|
|
2872
|
-
width: 'wide',
|
|
2873
|
-
context: 'formatting'
|
|
2874
|
-
});
|
|
2875
|
-
}
|
|
2876
|
-
},
|
|
2877
|
-
// Stand-alone month
|
|
2878
|
-
L: function L(date, token, localize) {
|
|
2879
|
-
var month = date.getUTCMonth();
|
|
2880
|
-
switch (token) {
|
|
2881
|
-
// 1, 2, ..., 12
|
|
2882
|
-
case 'L':
|
|
2883
|
-
return String(month + 1);
|
|
2884
|
-
// 01, 02, ..., 12
|
|
2885
|
-
case 'LL':
|
|
2886
|
-
return addLeadingZeros(month + 1, 2);
|
|
2887
|
-
// 1st, 2nd, ..., 12th
|
|
2888
|
-
case 'Lo':
|
|
2889
|
-
return localize.ordinalNumber(month + 1, {
|
|
2890
|
-
unit: 'month'
|
|
2891
|
-
});
|
|
2892
|
-
// Jan, Feb, ..., Dec
|
|
2893
|
-
case 'LLL':
|
|
2894
|
-
return localize.month(month, {
|
|
2895
|
-
width: 'abbreviated',
|
|
2896
|
-
context: 'standalone'
|
|
2897
|
-
});
|
|
2898
|
-
// J, F, ..., D
|
|
2899
|
-
case 'LLLLL':
|
|
2900
|
-
return localize.month(month, {
|
|
2901
|
-
width: 'narrow',
|
|
2902
|
-
context: 'standalone'
|
|
2903
|
-
});
|
|
2904
|
-
// January, February, ..., December
|
|
2905
|
-
case 'LLLL':
|
|
2906
|
-
default:
|
|
2907
|
-
return localize.month(month, {
|
|
2908
|
-
width: 'wide',
|
|
2909
|
-
context: 'standalone'
|
|
2910
|
-
});
|
|
2911
|
-
}
|
|
2912
|
-
},
|
|
2913
|
-
// Local week of year
|
|
2914
|
-
w: function w(date, token, localize, options) {
|
|
2915
|
-
var week = getUTCWeek(date, options);
|
|
2916
|
-
if (token === 'wo') {
|
|
2917
|
-
return localize.ordinalNumber(week, {
|
|
2918
|
-
unit: 'week'
|
|
2919
|
-
});
|
|
2920
|
-
}
|
|
2921
|
-
return addLeadingZeros(week, token.length);
|
|
2922
|
-
},
|
|
2923
|
-
// ISO week of year
|
|
2924
|
-
I: function I(date, token, localize) {
|
|
2925
|
-
var isoWeek = getUTCISOWeek(date);
|
|
2926
|
-
if (token === 'Io') {
|
|
2927
|
-
return localize.ordinalNumber(isoWeek, {
|
|
2928
|
-
unit: 'week'
|
|
2929
|
-
});
|
|
2930
|
-
}
|
|
2931
|
-
return addLeadingZeros(isoWeek, token.length);
|
|
2932
|
-
},
|
|
2933
|
-
// Day of the month
|
|
2934
|
-
d: function d(date, token, localize) {
|
|
2935
|
-
if (token === 'do') {
|
|
2936
|
-
return localize.ordinalNumber(date.getUTCDate(), {
|
|
2937
|
-
unit: 'date'
|
|
2938
|
-
});
|
|
2939
|
-
}
|
|
2940
|
-
return formatters$3.d(date, token);
|
|
2941
|
-
},
|
|
2942
|
-
// Day of year
|
|
2943
|
-
D: function D(date, token, localize) {
|
|
2944
|
-
var dayOfYear = getUTCDayOfYear(date);
|
|
2945
|
-
if (token === 'Do') {
|
|
2946
|
-
return localize.ordinalNumber(dayOfYear, {
|
|
2947
|
-
unit: 'dayOfYear'
|
|
2948
|
-
});
|
|
2949
|
-
}
|
|
2950
|
-
return addLeadingZeros(dayOfYear, token.length);
|
|
2951
|
-
},
|
|
2952
|
-
// Day of week
|
|
2953
|
-
E: function E(date, token, localize) {
|
|
2954
|
-
var dayOfWeek = date.getUTCDay();
|
|
2955
|
-
switch (token) {
|
|
2956
|
-
// Tue
|
|
2957
|
-
case 'E':
|
|
2958
|
-
case 'EE':
|
|
2959
|
-
case 'EEE':
|
|
2960
|
-
return localize.day(dayOfWeek, {
|
|
2961
|
-
width: 'abbreviated',
|
|
2962
|
-
context: 'formatting'
|
|
2963
|
-
});
|
|
2964
|
-
// T
|
|
2965
|
-
case 'EEEEE':
|
|
2966
|
-
return localize.day(dayOfWeek, {
|
|
2967
|
-
width: 'narrow',
|
|
2968
|
-
context: 'formatting'
|
|
2969
|
-
});
|
|
2970
|
-
// Tu
|
|
2971
|
-
case 'EEEEEE':
|
|
2972
|
-
return localize.day(dayOfWeek, {
|
|
2973
|
-
width: 'short',
|
|
2974
|
-
context: 'formatting'
|
|
2975
|
-
});
|
|
2976
|
-
// Tuesday
|
|
2977
|
-
case 'EEEE':
|
|
2978
|
-
default:
|
|
2979
|
-
return localize.day(dayOfWeek, {
|
|
2980
|
-
width: 'wide',
|
|
2981
|
-
context: 'formatting'
|
|
2982
|
-
});
|
|
2983
|
-
}
|
|
2984
|
-
},
|
|
2985
|
-
// Local day of week
|
|
2986
|
-
e: function e(date, token, localize, options) {
|
|
2987
|
-
var dayOfWeek = date.getUTCDay();
|
|
2988
|
-
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
2989
|
-
switch (token) {
|
|
2990
|
-
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
2991
|
-
case 'e':
|
|
2992
|
-
return String(localDayOfWeek);
|
|
2993
|
-
// Padded numerical value
|
|
2994
|
-
case 'ee':
|
|
2995
|
-
return addLeadingZeros(localDayOfWeek, 2);
|
|
2996
|
-
// 1st, 2nd, ..., 7th
|
|
2997
|
-
case 'eo':
|
|
2998
|
-
return localize.ordinalNumber(localDayOfWeek, {
|
|
2999
|
-
unit: 'day'
|
|
3000
|
-
});
|
|
3001
|
-
case 'eee':
|
|
3002
|
-
return localize.day(dayOfWeek, {
|
|
3003
|
-
width: 'abbreviated',
|
|
3004
|
-
context: 'formatting'
|
|
3005
|
-
});
|
|
3006
|
-
// T
|
|
3007
|
-
case 'eeeee':
|
|
3008
|
-
return localize.day(dayOfWeek, {
|
|
3009
|
-
width: 'narrow',
|
|
3010
|
-
context: 'formatting'
|
|
3011
|
-
});
|
|
3012
|
-
// Tu
|
|
3013
|
-
case 'eeeeee':
|
|
3014
|
-
return localize.day(dayOfWeek, {
|
|
3015
|
-
width: 'short',
|
|
3016
|
-
context: 'formatting'
|
|
3017
|
-
});
|
|
3018
|
-
// Tuesday
|
|
3019
|
-
case 'eeee':
|
|
3020
|
-
default:
|
|
3021
|
-
return localize.day(dayOfWeek, {
|
|
3022
|
-
width: 'wide',
|
|
3023
|
-
context: 'formatting'
|
|
3024
|
-
});
|
|
3025
|
-
}
|
|
3026
|
-
},
|
|
3027
|
-
// Stand-alone local day of week
|
|
3028
|
-
c: function c(date, token, localize, options) {
|
|
3029
|
-
var dayOfWeek = date.getUTCDay();
|
|
3030
|
-
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
3031
|
-
switch (token) {
|
|
3032
|
-
// Numerical value (same as in `e`)
|
|
3033
|
-
case 'c':
|
|
3034
|
-
return String(localDayOfWeek);
|
|
3035
|
-
// Padded numerical value
|
|
3036
|
-
case 'cc':
|
|
3037
|
-
return addLeadingZeros(localDayOfWeek, token.length);
|
|
3038
|
-
// 1st, 2nd, ..., 7th
|
|
3039
|
-
case 'co':
|
|
3040
|
-
return localize.ordinalNumber(localDayOfWeek, {
|
|
3041
|
-
unit: 'day'
|
|
3042
|
-
});
|
|
3043
|
-
case 'ccc':
|
|
3044
|
-
return localize.day(dayOfWeek, {
|
|
3045
|
-
width: 'abbreviated',
|
|
3046
|
-
context: 'standalone'
|
|
3047
|
-
});
|
|
3048
|
-
// T
|
|
3049
|
-
case 'ccccc':
|
|
3050
|
-
return localize.day(dayOfWeek, {
|
|
3051
|
-
width: 'narrow',
|
|
3052
|
-
context: 'standalone'
|
|
3053
|
-
});
|
|
3054
|
-
// Tu
|
|
3055
|
-
case 'cccccc':
|
|
3056
|
-
return localize.day(dayOfWeek, {
|
|
3057
|
-
width: 'short',
|
|
3058
|
-
context: 'standalone'
|
|
3059
|
-
});
|
|
3060
|
-
// Tuesday
|
|
3061
|
-
case 'cccc':
|
|
3062
|
-
default:
|
|
3063
|
-
return localize.day(dayOfWeek, {
|
|
3064
|
-
width: 'wide',
|
|
3065
|
-
context: 'standalone'
|
|
3066
|
-
});
|
|
3067
|
-
}
|
|
3068
|
-
},
|
|
3069
|
-
// ISO day of week
|
|
3070
|
-
i: function i(date, token, localize) {
|
|
3071
|
-
var dayOfWeek = date.getUTCDay();
|
|
3072
|
-
var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
3073
|
-
switch (token) {
|
|
3074
|
-
// 2
|
|
3075
|
-
case 'i':
|
|
3076
|
-
return String(isoDayOfWeek);
|
|
3077
|
-
// 02
|
|
3078
|
-
case 'ii':
|
|
3079
|
-
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
3080
|
-
// 2nd
|
|
3081
|
-
case 'io':
|
|
3082
|
-
return localize.ordinalNumber(isoDayOfWeek, {
|
|
3083
|
-
unit: 'day'
|
|
3084
|
-
});
|
|
3085
|
-
// Tue
|
|
3086
|
-
case 'iii':
|
|
3087
|
-
return localize.day(dayOfWeek, {
|
|
3088
|
-
width: 'abbreviated',
|
|
3089
|
-
context: 'formatting'
|
|
3090
|
-
});
|
|
3091
|
-
// T
|
|
3092
|
-
case 'iiiii':
|
|
3093
|
-
return localize.day(dayOfWeek, {
|
|
3094
|
-
width: 'narrow',
|
|
3095
|
-
context: 'formatting'
|
|
3096
|
-
});
|
|
3097
|
-
// Tu
|
|
3098
|
-
case 'iiiiii':
|
|
3099
|
-
return localize.day(dayOfWeek, {
|
|
3100
|
-
width: 'short',
|
|
3101
|
-
context: 'formatting'
|
|
3102
|
-
});
|
|
3103
|
-
// Tuesday
|
|
3104
|
-
case 'iiii':
|
|
3105
|
-
default:
|
|
3106
|
-
return localize.day(dayOfWeek, {
|
|
3107
|
-
width: 'wide',
|
|
3108
|
-
context: 'formatting'
|
|
3109
|
-
});
|
|
3110
|
-
}
|
|
3111
|
-
},
|
|
3112
|
-
// AM or PM
|
|
3113
|
-
a: function a(date, token, localize) {
|
|
3114
|
-
var hours = date.getUTCHours();
|
|
3115
|
-
var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
|
|
3116
|
-
switch (token) {
|
|
3117
|
-
case 'a':
|
|
3118
|
-
case 'aa':
|
|
3119
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3120
|
-
width: 'abbreviated',
|
|
3121
|
-
context: 'formatting'
|
|
3122
|
-
});
|
|
3123
|
-
case 'aaa':
|
|
3124
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3125
|
-
width: 'abbreviated',
|
|
3126
|
-
context: 'formatting'
|
|
3127
|
-
}).toLowerCase();
|
|
3128
|
-
case 'aaaaa':
|
|
3129
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3130
|
-
width: 'narrow',
|
|
3131
|
-
context: 'formatting'
|
|
3132
|
-
});
|
|
3133
|
-
case 'aaaa':
|
|
3134
|
-
default:
|
|
3135
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3136
|
-
width: 'wide',
|
|
3137
|
-
context: 'formatting'
|
|
3138
|
-
});
|
|
3139
|
-
}
|
|
3140
|
-
},
|
|
3141
|
-
// AM, PM, midnight, noon
|
|
3142
|
-
b: function b(date, token, localize) {
|
|
3143
|
-
var hours = date.getUTCHours();
|
|
3144
|
-
var dayPeriodEnumValue;
|
|
3145
|
-
if (hours === 12) {
|
|
3146
|
-
dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
3147
|
-
} else if (hours === 0) {
|
|
3148
|
-
dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
3149
|
-
} else {
|
|
3150
|
-
dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
|
|
3151
|
-
}
|
|
3152
|
-
switch (token) {
|
|
3153
|
-
case 'b':
|
|
3154
|
-
case 'bb':
|
|
3155
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3156
|
-
width: 'abbreviated',
|
|
3157
|
-
context: 'formatting'
|
|
3158
|
-
});
|
|
3159
|
-
case 'bbb':
|
|
3160
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3161
|
-
width: 'abbreviated',
|
|
3162
|
-
context: 'formatting'
|
|
3163
|
-
}).toLowerCase();
|
|
3164
|
-
case 'bbbbb':
|
|
3165
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3166
|
-
width: 'narrow',
|
|
3167
|
-
context: 'formatting'
|
|
3168
|
-
});
|
|
3169
|
-
case 'bbbb':
|
|
3170
|
-
default:
|
|
3171
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3172
|
-
width: 'wide',
|
|
3173
|
-
context: 'formatting'
|
|
3174
|
-
});
|
|
3175
|
-
}
|
|
3176
|
-
},
|
|
3177
|
-
// in the morning, in the afternoon, in the evening, at night
|
|
3178
|
-
B: function B(date, token, localize) {
|
|
3179
|
-
var hours = date.getUTCHours();
|
|
3180
|
-
var dayPeriodEnumValue;
|
|
3181
|
-
if (hours >= 17) {
|
|
3182
|
-
dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
3183
|
-
} else if (hours >= 12) {
|
|
3184
|
-
dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
3185
|
-
} else if (hours >= 4) {
|
|
3186
|
-
dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
3187
|
-
} else {
|
|
3188
|
-
dayPeriodEnumValue = dayPeriodEnum.night;
|
|
3189
|
-
}
|
|
3190
|
-
switch (token) {
|
|
3191
|
-
case 'B':
|
|
3192
|
-
case 'BB':
|
|
3193
|
-
case 'BBB':
|
|
3194
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3195
|
-
width: 'abbreviated',
|
|
3196
|
-
context: 'formatting'
|
|
3197
|
-
});
|
|
3198
|
-
case 'BBBBB':
|
|
3199
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3200
|
-
width: 'narrow',
|
|
3201
|
-
context: 'formatting'
|
|
3202
|
-
});
|
|
3203
|
-
case 'BBBB':
|
|
3204
|
-
default:
|
|
3205
|
-
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
3206
|
-
width: 'wide',
|
|
3207
|
-
context: 'formatting'
|
|
3208
|
-
});
|
|
3209
|
-
}
|
|
3210
|
-
},
|
|
3211
|
-
// Hour [1-12]
|
|
3212
|
-
h: function h(date, token, localize) {
|
|
3213
|
-
if (token === 'ho') {
|
|
3214
|
-
var hours = date.getUTCHours() % 12;
|
|
3215
|
-
if (hours === 0) hours = 12;
|
|
3216
|
-
return localize.ordinalNumber(hours, {
|
|
3217
|
-
unit: 'hour'
|
|
3218
|
-
});
|
|
3219
|
-
}
|
|
3220
|
-
return formatters$3.h(date, token);
|
|
3221
|
-
},
|
|
3222
|
-
// Hour [0-23]
|
|
3223
|
-
H: function H(date, token, localize) {
|
|
3224
|
-
if (token === 'Ho') {
|
|
3225
|
-
return localize.ordinalNumber(date.getUTCHours(), {
|
|
3226
|
-
unit: 'hour'
|
|
3227
|
-
});
|
|
3228
|
-
}
|
|
3229
|
-
return formatters$3.H(date, token);
|
|
3230
|
-
},
|
|
3231
|
-
// Hour [0-11]
|
|
3232
|
-
K: function K(date, token, localize) {
|
|
3233
|
-
var hours = date.getUTCHours() % 12;
|
|
3234
|
-
if (token === 'Ko') {
|
|
3235
|
-
return localize.ordinalNumber(hours, {
|
|
3236
|
-
unit: 'hour'
|
|
3237
|
-
});
|
|
3238
|
-
}
|
|
3239
|
-
return addLeadingZeros(hours, token.length);
|
|
3240
|
-
},
|
|
3241
|
-
// Hour [1-24]
|
|
3242
|
-
k: function k(date, token, localize) {
|
|
3243
|
-
var hours = date.getUTCHours();
|
|
3244
|
-
if (hours === 0) hours = 24;
|
|
3245
|
-
if (token === 'ko') {
|
|
3246
|
-
return localize.ordinalNumber(hours, {
|
|
3247
|
-
unit: 'hour'
|
|
3248
|
-
});
|
|
3249
|
-
}
|
|
3250
|
-
return addLeadingZeros(hours, token.length);
|
|
3251
|
-
},
|
|
3252
|
-
// Minute
|
|
3253
|
-
m: function m(date, token, localize) {
|
|
3254
|
-
if (token === 'mo') {
|
|
3255
|
-
return localize.ordinalNumber(date.getUTCMinutes(), {
|
|
3256
|
-
unit: 'minute'
|
|
3257
|
-
});
|
|
3258
|
-
}
|
|
3259
|
-
return formatters$3.m(date, token);
|
|
3260
|
-
},
|
|
3261
|
-
// Second
|
|
3262
|
-
s: function s(date, token, localize) {
|
|
3263
|
-
if (token === 'so') {
|
|
3264
|
-
return localize.ordinalNumber(date.getUTCSeconds(), {
|
|
3265
|
-
unit: 'second'
|
|
3266
|
-
});
|
|
3267
|
-
}
|
|
3268
|
-
return formatters$3.s(date, token);
|
|
3269
|
-
},
|
|
3270
|
-
// Fraction of second
|
|
3271
|
-
S: function S(date, token) {
|
|
3272
|
-
return formatters$3.S(date, token);
|
|
3273
|
-
},
|
|
3274
|
-
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
3275
|
-
X: function X(date, token, _localize, options) {
|
|
3276
|
-
var originalDate = options._originalDate || date;
|
|
3277
|
-
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
3278
|
-
if (timezoneOffset === 0) {
|
|
3279
|
-
return 'Z';
|
|
3280
|
-
}
|
|
3281
|
-
switch (token) {
|
|
3282
|
-
// Hours and optional minutes
|
|
3283
|
-
case 'X':
|
|
3284
|
-
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
3285
|
-
|
|
3286
|
-
// Hours, minutes and optional seconds without `:` delimiter
|
|
3287
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
3288
|
-
// so this token always has the same output as `XX`
|
|
3289
|
-
case 'XXXX':
|
|
3290
|
-
case 'XX':
|
|
3291
|
-
// Hours and minutes without `:` delimiter
|
|
3292
|
-
return formatTimezone(timezoneOffset);
|
|
3293
|
-
|
|
3294
|
-
// Hours, minutes and optional seconds with `:` delimiter
|
|
3295
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
3296
|
-
// so this token always has the same output as `XXX`
|
|
3297
|
-
case 'XXXXX':
|
|
3298
|
-
case 'XXX': // Hours and minutes with `:` delimiter
|
|
3299
|
-
default:
|
|
3300
|
-
return formatTimezone(timezoneOffset, ':');
|
|
3301
|
-
}
|
|
3302
|
-
},
|
|
3303
|
-
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
3304
|
-
x: function x(date, token, _localize, options) {
|
|
3305
|
-
var originalDate = options._originalDate || date;
|
|
3306
|
-
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
3307
|
-
switch (token) {
|
|
3308
|
-
// Hours and optional minutes
|
|
3309
|
-
case 'x':
|
|
3310
|
-
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
3311
|
-
|
|
3312
|
-
// Hours, minutes and optional seconds without `:` delimiter
|
|
3313
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
3314
|
-
// so this token always has the same output as `xx`
|
|
3315
|
-
case 'xxxx':
|
|
3316
|
-
case 'xx':
|
|
3317
|
-
// Hours and minutes without `:` delimiter
|
|
3318
|
-
return formatTimezone(timezoneOffset);
|
|
3319
|
-
|
|
3320
|
-
// Hours, minutes and optional seconds with `:` delimiter
|
|
3321
|
-
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
3322
|
-
// so this token always has the same output as `xxx`
|
|
3323
|
-
case 'xxxxx':
|
|
3324
|
-
case 'xxx': // Hours and minutes with `:` delimiter
|
|
3325
|
-
default:
|
|
3326
|
-
return formatTimezone(timezoneOffset, ':');
|
|
3327
|
-
}
|
|
3328
|
-
},
|
|
3329
|
-
// Timezone (GMT)
|
|
3330
|
-
O: function O(date, token, _localize, options) {
|
|
3331
|
-
var originalDate = options._originalDate || date;
|
|
3332
|
-
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
3333
|
-
switch (token) {
|
|
3334
|
-
// Short
|
|
3335
|
-
case 'O':
|
|
3336
|
-
case 'OO':
|
|
3337
|
-
case 'OOO':
|
|
3338
|
-
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
3339
|
-
// Long
|
|
3340
|
-
case 'OOOO':
|
|
3341
|
-
default:
|
|
3342
|
-
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
3343
|
-
}
|
|
3344
|
-
},
|
|
3345
|
-
// Timezone (specific non-location)
|
|
3346
|
-
z: function z(date, token, _localize, options) {
|
|
3347
|
-
var originalDate = options._originalDate || date;
|
|
3348
|
-
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
3349
|
-
switch (token) {
|
|
3350
|
-
// Short
|
|
3351
|
-
case 'z':
|
|
3352
|
-
case 'zz':
|
|
3353
|
-
case 'zzz':
|
|
3354
|
-
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
3355
|
-
// Long
|
|
3356
|
-
case 'zzzz':
|
|
3357
|
-
default:
|
|
3358
|
-
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
3359
|
-
}
|
|
3360
|
-
},
|
|
3361
|
-
// Seconds timestamp
|
|
3362
|
-
t: function t(date, token, _localize, options) {
|
|
3363
|
-
var originalDate = options._originalDate || date;
|
|
3364
|
-
var timestamp = Math.floor(originalDate.getTime() / 1000);
|
|
3365
|
-
return addLeadingZeros(timestamp, token.length);
|
|
3366
|
-
},
|
|
3367
|
-
// Milliseconds timestamp
|
|
3368
|
-
T: function T(date, token, _localize, options) {
|
|
3369
|
-
var originalDate = options._originalDate || date;
|
|
3370
|
-
var timestamp = originalDate.getTime();
|
|
3371
|
-
return addLeadingZeros(timestamp, token.length);
|
|
3372
|
-
}
|
|
3373
|
-
};
|
|
3374
|
-
function formatTimezoneShort(offset, dirtyDelimiter) {
|
|
3375
|
-
var sign = offset > 0 ? '-' : '+';
|
|
3376
|
-
var absOffset = Math.abs(offset);
|
|
3377
|
-
var hours = Math.floor(absOffset / 60);
|
|
3378
|
-
var minutes = absOffset % 60;
|
|
3379
|
-
if (minutes === 0) {
|
|
3380
|
-
return sign + String(hours);
|
|
3381
|
-
}
|
|
3382
|
-
var delimiter = dirtyDelimiter || '';
|
|
3383
|
-
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
3384
|
-
}
|
|
3385
|
-
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
|
|
3386
|
-
if (offset % 60 === 0) {
|
|
3387
|
-
var sign = offset > 0 ? '-' : '+';
|
|
3388
|
-
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
3389
|
-
}
|
|
3390
|
-
return formatTimezone(offset, dirtyDelimiter);
|
|
3391
|
-
}
|
|
3392
|
-
function formatTimezone(offset, dirtyDelimiter) {
|
|
3393
|
-
var delimiter = dirtyDelimiter || '';
|
|
3394
|
-
var sign = offset > 0 ? '-' : '+';
|
|
3395
|
-
var absOffset = Math.abs(offset);
|
|
3396
|
-
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
|
3397
|
-
var minutes = addLeadingZeros(absOffset % 60, 2);
|
|
3398
|
-
return sign + hours + delimiter + minutes;
|
|
3399
|
-
}
|
|
3400
|
-
var formatters$1 = formatters;
|
|
3401
|
-
|
|
3402
|
-
var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
|
|
3403
|
-
switch (pattern) {
|
|
3404
|
-
case 'P':
|
|
3405
|
-
return formatLong.date({
|
|
3406
|
-
width: 'short'
|
|
3407
|
-
});
|
|
3408
|
-
case 'PP':
|
|
3409
|
-
return formatLong.date({
|
|
3410
|
-
width: 'medium'
|
|
3411
|
-
});
|
|
3412
|
-
case 'PPP':
|
|
3413
|
-
return formatLong.date({
|
|
3414
|
-
width: 'long'
|
|
3415
|
-
});
|
|
3416
|
-
case 'PPPP':
|
|
3417
|
-
default:
|
|
3418
|
-
return formatLong.date({
|
|
3419
|
-
width: 'full'
|
|
3420
|
-
});
|
|
3421
|
-
}
|
|
3422
|
-
};
|
|
3423
|
-
var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
|
|
3424
|
-
switch (pattern) {
|
|
3425
|
-
case 'p':
|
|
3426
|
-
return formatLong.time({
|
|
3427
|
-
width: 'short'
|
|
3428
|
-
});
|
|
3429
|
-
case 'pp':
|
|
3430
|
-
return formatLong.time({
|
|
3431
|
-
width: 'medium'
|
|
3432
|
-
});
|
|
3433
|
-
case 'ppp':
|
|
3434
|
-
return formatLong.time({
|
|
3435
|
-
width: 'long'
|
|
3436
|
-
});
|
|
3437
|
-
case 'pppp':
|
|
3438
|
-
default:
|
|
3439
|
-
return formatLong.time({
|
|
3440
|
-
width: 'full'
|
|
3441
|
-
});
|
|
3442
|
-
}
|
|
3443
|
-
};
|
|
3444
|
-
var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
|
|
3445
|
-
var matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
3446
|
-
var datePattern = matchResult[1];
|
|
3447
|
-
var timePattern = matchResult[2];
|
|
3448
|
-
if (!timePattern) {
|
|
3449
|
-
return dateLongFormatter(pattern, formatLong);
|
|
3450
|
-
}
|
|
3451
|
-
var dateTimeFormat;
|
|
3452
|
-
switch (datePattern) {
|
|
3453
|
-
case 'P':
|
|
3454
|
-
dateTimeFormat = formatLong.dateTime({
|
|
3455
|
-
width: 'short'
|
|
3456
|
-
});
|
|
3457
|
-
break;
|
|
3458
|
-
case 'PP':
|
|
3459
|
-
dateTimeFormat = formatLong.dateTime({
|
|
3460
|
-
width: 'medium'
|
|
3461
|
-
});
|
|
3462
|
-
break;
|
|
3463
|
-
case 'PPP':
|
|
3464
|
-
dateTimeFormat = formatLong.dateTime({
|
|
3465
|
-
width: 'long'
|
|
3466
|
-
});
|
|
3467
|
-
break;
|
|
3468
|
-
case 'PPPP':
|
|
3469
|
-
default:
|
|
3470
|
-
dateTimeFormat = formatLong.dateTime({
|
|
3471
|
-
width: 'full'
|
|
3472
|
-
});
|
|
3473
|
-
break;
|
|
3474
|
-
}
|
|
3475
|
-
return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
|
|
3476
|
-
};
|
|
3477
|
-
var longFormatters = {
|
|
3478
|
-
p: timeLongFormatter,
|
|
3479
|
-
P: dateTimeLongFormatter
|
|
3480
|
-
};
|
|
3481
|
-
var longFormatters$1 = longFormatters;
|
|
3482
|
-
|
|
3483
|
-
var protectedDayOfYearTokens = ['D', 'DD'];
|
|
3484
|
-
var protectedWeekYearTokens = ['YY', 'YYYY'];
|
|
3485
|
-
function isProtectedDayOfYearToken(token) {
|
|
3486
|
-
return protectedDayOfYearTokens.indexOf(token) !== -1;
|
|
3487
|
-
}
|
|
3488
|
-
function isProtectedWeekYearToken(token) {
|
|
3489
|
-
return protectedWeekYearTokens.indexOf(token) !== -1;
|
|
3490
|
-
}
|
|
3491
|
-
function throwProtectedError(token, format, input) {
|
|
3492
|
-
if (token === 'YYYY') {
|
|
3493
|
-
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
3494
|
-
} else if (token === 'YY') {
|
|
3495
|
-
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
3496
|
-
} else if (token === 'D') {
|
|
3497
|
-
throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
3498
|
-
} else if (token === 'DD') {
|
|
3499
|
-
throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
3500
|
-
}
|
|
3501
|
-
}
|
|
3502
|
-
|
|
3503
|
-
var formatDistanceLocale = {
|
|
3504
|
-
lessThanXSeconds: {
|
|
3505
|
-
one: 'less than a second',
|
|
3506
|
-
other: 'less than {{count}} seconds'
|
|
3507
|
-
},
|
|
3508
|
-
xSeconds: {
|
|
3509
|
-
one: '1 second',
|
|
3510
|
-
other: '{{count}} seconds'
|
|
3511
|
-
},
|
|
3512
|
-
halfAMinute: 'half a minute',
|
|
3513
|
-
lessThanXMinutes: {
|
|
3514
|
-
one: 'less than a minute',
|
|
3515
|
-
other: 'less than {{count}} minutes'
|
|
3516
|
-
},
|
|
3517
|
-
xMinutes: {
|
|
3518
|
-
one: '1 minute',
|
|
3519
|
-
other: '{{count}} minutes'
|
|
3520
|
-
},
|
|
3521
|
-
aboutXHours: {
|
|
3522
|
-
one: 'about 1 hour',
|
|
3523
|
-
other: 'about {{count}} hours'
|
|
3524
|
-
},
|
|
3525
|
-
xHours: {
|
|
3526
|
-
one: '1 hour',
|
|
3527
|
-
other: '{{count}} hours'
|
|
3528
|
-
},
|
|
3529
|
-
xDays: {
|
|
3530
|
-
one: '1 day',
|
|
3531
|
-
other: '{{count}} days'
|
|
3532
|
-
},
|
|
3533
|
-
aboutXWeeks: {
|
|
3534
|
-
one: 'about 1 week',
|
|
3535
|
-
other: 'about {{count}} weeks'
|
|
3536
|
-
},
|
|
3537
|
-
xWeeks: {
|
|
3538
|
-
one: '1 week',
|
|
3539
|
-
other: '{{count}} weeks'
|
|
3540
|
-
},
|
|
3541
|
-
aboutXMonths: {
|
|
3542
|
-
one: 'about 1 month',
|
|
3543
|
-
other: 'about {{count}} months'
|
|
3544
|
-
},
|
|
3545
|
-
xMonths: {
|
|
3546
|
-
one: '1 month',
|
|
3547
|
-
other: '{{count}} months'
|
|
3548
|
-
},
|
|
3549
|
-
aboutXYears: {
|
|
3550
|
-
one: 'about 1 year',
|
|
3551
|
-
other: 'about {{count}} years'
|
|
3552
|
-
},
|
|
3553
|
-
xYears: {
|
|
3554
|
-
one: '1 year',
|
|
3555
|
-
other: '{{count}} years'
|
|
3556
|
-
},
|
|
3557
|
-
overXYears: {
|
|
3558
|
-
one: 'over 1 year',
|
|
3559
|
-
other: 'over {{count}} years'
|
|
3560
|
-
},
|
|
3561
|
-
almostXYears: {
|
|
3562
|
-
one: 'almost 1 year',
|
|
3563
|
-
other: 'almost {{count}} years'
|
|
3564
|
-
}
|
|
3565
|
-
};
|
|
3566
|
-
var formatDistance = function formatDistance(token, count, options) {
|
|
3567
|
-
var result;
|
|
3568
|
-
var tokenValue = formatDistanceLocale[token];
|
|
3569
|
-
if (typeof tokenValue === 'string') {
|
|
3570
|
-
result = tokenValue;
|
|
3571
|
-
} else if (count === 1) {
|
|
3572
|
-
result = tokenValue.one;
|
|
3573
|
-
} else {
|
|
3574
|
-
result = tokenValue.other.replace('{{count}}', count.toString());
|
|
3575
|
-
}
|
|
3576
|
-
if (options !== null && options !== void 0 && options.addSuffix) {
|
|
3577
|
-
if (options.comparison && options.comparison > 0) {
|
|
3578
|
-
return 'in ' + result;
|
|
3579
|
-
} else {
|
|
3580
|
-
return result + ' ago';
|
|
3581
|
-
}
|
|
3582
|
-
}
|
|
3583
|
-
return result;
|
|
3584
|
-
};
|
|
3585
|
-
var formatDistance$1 = formatDistance;
|
|
3586
|
-
|
|
3587
|
-
function buildFormatLongFn(args) {
|
|
3588
|
-
return function () {
|
|
3589
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3590
|
-
// TODO: Remove String()
|
|
3591
|
-
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
3592
|
-
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
3593
|
-
return format;
|
|
3594
|
-
};
|
|
3595
|
-
}
|
|
3596
|
-
|
|
3597
|
-
var dateFormats = {
|
|
3598
|
-
full: 'EEEE, MMMM do, y',
|
|
3599
|
-
long: 'MMMM do, y',
|
|
3600
|
-
medium: 'MMM d, y',
|
|
3601
|
-
short: 'MM/dd/yyyy'
|
|
3602
|
-
};
|
|
3603
|
-
var timeFormats = {
|
|
3604
|
-
full: 'h:mm:ss a zzzz',
|
|
3605
|
-
long: 'h:mm:ss a z',
|
|
3606
|
-
medium: 'h:mm:ss a',
|
|
3607
|
-
short: 'h:mm a'
|
|
3608
|
-
};
|
|
3609
|
-
var dateTimeFormats = {
|
|
3610
|
-
full: "{{date}} 'at' {{time}}",
|
|
3611
|
-
long: "{{date}} 'at' {{time}}",
|
|
3612
|
-
medium: '{{date}}, {{time}}',
|
|
3613
|
-
short: '{{date}}, {{time}}'
|
|
3614
|
-
};
|
|
3615
|
-
var formatLong = {
|
|
3616
|
-
date: buildFormatLongFn({
|
|
3617
|
-
formats: dateFormats,
|
|
3618
|
-
defaultWidth: 'full'
|
|
3619
|
-
}),
|
|
3620
|
-
time: buildFormatLongFn({
|
|
3621
|
-
formats: timeFormats,
|
|
3622
|
-
defaultWidth: 'full'
|
|
3623
|
-
}),
|
|
3624
|
-
dateTime: buildFormatLongFn({
|
|
3625
|
-
formats: dateTimeFormats,
|
|
3626
|
-
defaultWidth: 'full'
|
|
3627
|
-
})
|
|
3628
|
-
};
|
|
3629
|
-
var formatLong$1 = formatLong;
|
|
3630
|
-
|
|
3631
|
-
var formatRelativeLocale = {
|
|
3632
|
-
lastWeek: "'last' eeee 'at' p",
|
|
3633
|
-
yesterday: "'yesterday at' p",
|
|
3634
|
-
today: "'today at' p",
|
|
3635
|
-
tomorrow: "'tomorrow at' p",
|
|
3636
|
-
nextWeek: "eeee 'at' p",
|
|
3637
|
-
other: 'P'
|
|
3638
|
-
};
|
|
3639
|
-
var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
|
|
3640
|
-
return formatRelativeLocale[token];
|
|
3641
|
-
};
|
|
3642
|
-
var formatRelative$1 = formatRelative;
|
|
3643
|
-
|
|
3644
|
-
function buildLocalizeFn(args) {
|
|
3645
|
-
return function (dirtyIndex, options) {
|
|
3646
|
-
var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
|
|
3647
|
-
var valuesArray;
|
|
3648
|
-
if (context === 'formatting' && args.formattingValues) {
|
|
3649
|
-
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
3650
|
-
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
|
3651
|
-
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
3652
|
-
} else {
|
|
3653
|
-
var _defaultWidth = args.defaultWidth;
|
|
3654
|
-
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
|
3655
|
-
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
3656
|
-
}
|
|
3657
|
-
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
|
|
3658
|
-
// @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
|
|
3659
|
-
return valuesArray[index];
|
|
3660
|
-
};
|
|
3661
|
-
}
|
|
3662
|
-
|
|
3663
|
-
var eraValues = {
|
|
3664
|
-
narrow: ['B', 'A'],
|
|
3665
|
-
abbreviated: ['BC', 'AD'],
|
|
3666
|
-
wide: ['Before Christ', 'Anno Domini']
|
|
3667
|
-
};
|
|
3668
|
-
var quarterValues = {
|
|
3669
|
-
narrow: ['1', '2', '3', '4'],
|
|
3670
|
-
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
3671
|
-
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
|
|
3672
|
-
};
|
|
2396
|
+
if (!active) {
|
|
2397
|
+
directionClassName.value = '';
|
|
2398
|
+
orderClassName.value = '';
|
|
2399
|
+
activeClassName.value = '';
|
|
2400
|
+
}
|
|
2401
|
+
});
|
|
2402
|
+
});
|
|
2403
|
+
return () => vue.h('div', {
|
|
2404
|
+
class: [
|
|
2405
|
+
'carousel-item',
|
|
2406
|
+
activeClassName.value,
|
|
2407
|
+
directionClassName.value,
|
|
2408
|
+
orderClassName.value,
|
|
2409
|
+
],
|
|
2410
|
+
ref: carouselItemRef,
|
|
2411
|
+
}, slots.default && slots.default());
|
|
2412
|
+
},
|
|
2413
|
+
});
|
|
3673
2414
|
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
3681
|
-
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
3682
|
-
};
|
|
3683
|
-
var dayValues = {
|
|
3684
|
-
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
3685
|
-
short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
3686
|
-
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
3687
|
-
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
3688
|
-
};
|
|
3689
|
-
var dayPeriodValues = {
|
|
3690
|
-
narrow: {
|
|
3691
|
-
am: 'a',
|
|
3692
|
-
pm: 'p',
|
|
3693
|
-
midnight: 'mi',
|
|
3694
|
-
noon: 'n',
|
|
3695
|
-
morning: 'morning',
|
|
3696
|
-
afternoon: 'afternoon',
|
|
3697
|
-
evening: 'evening',
|
|
3698
|
-
night: 'night'
|
|
3699
|
-
},
|
|
3700
|
-
abbreviated: {
|
|
3701
|
-
am: 'AM',
|
|
3702
|
-
pm: 'PM',
|
|
3703
|
-
midnight: 'midnight',
|
|
3704
|
-
noon: 'noon',
|
|
3705
|
-
morning: 'morning',
|
|
3706
|
-
afternoon: 'afternoon',
|
|
3707
|
-
evening: 'evening',
|
|
3708
|
-
night: 'night'
|
|
3709
|
-
},
|
|
3710
|
-
wide: {
|
|
3711
|
-
am: 'a.m.',
|
|
3712
|
-
pm: 'p.m.',
|
|
3713
|
-
midnight: 'midnight',
|
|
3714
|
-
noon: 'noon',
|
|
3715
|
-
morning: 'morning',
|
|
3716
|
-
afternoon: 'afternoon',
|
|
3717
|
-
evening: 'evening',
|
|
3718
|
-
night: 'night'
|
|
3719
|
-
}
|
|
3720
|
-
};
|
|
3721
|
-
var formattingDayPeriodValues = {
|
|
3722
|
-
narrow: {
|
|
3723
|
-
am: 'a',
|
|
3724
|
-
pm: 'p',
|
|
3725
|
-
midnight: 'mi',
|
|
3726
|
-
noon: 'n',
|
|
3727
|
-
morning: 'in the morning',
|
|
3728
|
-
afternoon: 'in the afternoon',
|
|
3729
|
-
evening: 'in the evening',
|
|
3730
|
-
night: 'at night'
|
|
3731
|
-
},
|
|
3732
|
-
abbreviated: {
|
|
3733
|
-
am: 'AM',
|
|
3734
|
-
pm: 'PM',
|
|
3735
|
-
midnight: 'midnight',
|
|
3736
|
-
noon: 'noon',
|
|
3737
|
-
morning: 'in the morning',
|
|
3738
|
-
afternoon: 'in the afternoon',
|
|
3739
|
-
evening: 'in the evening',
|
|
3740
|
-
night: 'at night'
|
|
3741
|
-
},
|
|
3742
|
-
wide: {
|
|
3743
|
-
am: 'a.m.',
|
|
3744
|
-
pm: 'p.m.',
|
|
3745
|
-
midnight: 'midnight',
|
|
3746
|
-
noon: 'noon',
|
|
3747
|
-
morning: 'in the morning',
|
|
3748
|
-
afternoon: 'in the afternoon',
|
|
3749
|
-
evening: 'in the evening',
|
|
3750
|
-
night: 'at night'
|
|
3751
|
-
}
|
|
3752
|
-
};
|
|
3753
|
-
var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
|
|
3754
|
-
var number = Number(dirtyNumber);
|
|
3755
|
-
|
|
3756
|
-
// If ordinal numbers depend on context, for example,
|
|
3757
|
-
// if they are different for different grammatical genders,
|
|
3758
|
-
// use `options.unit`.
|
|
3759
|
-
//
|
|
3760
|
-
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
3761
|
-
// 'day', 'hour', 'minute', 'second'.
|
|
3762
|
-
|
|
3763
|
-
var rem100 = number % 100;
|
|
3764
|
-
if (rem100 > 20 || rem100 < 10) {
|
|
3765
|
-
switch (rem100 % 10) {
|
|
3766
|
-
case 1:
|
|
3767
|
-
return number + 'st';
|
|
3768
|
-
case 2:
|
|
3769
|
-
return number + 'nd';
|
|
3770
|
-
case 3:
|
|
3771
|
-
return number + 'rd';
|
|
3772
|
-
}
|
|
3773
|
-
}
|
|
3774
|
-
return number + 'th';
|
|
3775
|
-
};
|
|
3776
|
-
var localize = {
|
|
3777
|
-
ordinalNumber: ordinalNumber,
|
|
3778
|
-
era: buildLocalizeFn({
|
|
3779
|
-
values: eraValues,
|
|
3780
|
-
defaultWidth: 'wide'
|
|
3781
|
-
}),
|
|
3782
|
-
quarter: buildLocalizeFn({
|
|
3783
|
-
values: quarterValues,
|
|
3784
|
-
defaultWidth: 'wide',
|
|
3785
|
-
argumentCallback: function argumentCallback(quarter) {
|
|
3786
|
-
return quarter - 1;
|
|
3787
|
-
}
|
|
3788
|
-
}),
|
|
3789
|
-
month: buildLocalizeFn({
|
|
3790
|
-
values: monthValues,
|
|
3791
|
-
defaultWidth: 'wide'
|
|
3792
|
-
}),
|
|
3793
|
-
day: buildLocalizeFn({
|
|
3794
|
-
values: dayValues,
|
|
3795
|
-
defaultWidth: 'wide'
|
|
3796
|
-
}),
|
|
3797
|
-
dayPeriod: buildLocalizeFn({
|
|
3798
|
-
values: dayPeriodValues,
|
|
3799
|
-
defaultWidth: 'wide',
|
|
3800
|
-
formattingValues: formattingDayPeriodValues,
|
|
3801
|
-
defaultFormattingWidth: 'wide'
|
|
3802
|
-
})
|
|
2415
|
+
const CCarouselPlugin = {
|
|
2416
|
+
install: (app) => {
|
|
2417
|
+
app.component(CCarousel.name, CCarousel);
|
|
2418
|
+
app.component(CCarouselCaption.name, CCarouselCaption);
|
|
2419
|
+
app.component(CCarouselItem.name, CCarouselItem);
|
|
2420
|
+
},
|
|
3803
2421
|
};
|
|
3804
|
-
var localize$1 = localize;
|
|
3805
|
-
|
|
3806
|
-
function buildMatchFn(args) {
|
|
3807
|
-
return function (string) {
|
|
3808
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3809
|
-
var width = options.width;
|
|
3810
|
-
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
3811
|
-
var matchResult = string.match(matchPattern);
|
|
3812
|
-
if (!matchResult) {
|
|
3813
|
-
return null;
|
|
3814
|
-
}
|
|
3815
|
-
var matchedString = matchResult[0];
|
|
3816
|
-
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
3817
|
-
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
|
|
3818
|
-
return pattern.test(matchedString);
|
|
3819
|
-
}) : findKey(parsePatterns, function (pattern) {
|
|
3820
|
-
return pattern.test(matchedString);
|
|
3821
|
-
});
|
|
3822
|
-
var value;
|
|
3823
|
-
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
3824
|
-
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
3825
|
-
var rest = string.slice(matchedString.length);
|
|
3826
|
-
return {
|
|
3827
|
-
value: value,
|
|
3828
|
-
rest: rest
|
|
3829
|
-
};
|
|
3830
|
-
};
|
|
3831
|
-
}
|
|
3832
|
-
function findKey(object, predicate) {
|
|
3833
|
-
for (var key in object) {
|
|
3834
|
-
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
3835
|
-
return key;
|
|
3836
|
-
}
|
|
3837
|
-
}
|
|
3838
|
-
return undefined;
|
|
3839
|
-
}
|
|
3840
|
-
function findIndex(array, predicate) {
|
|
3841
|
-
for (var key = 0; key < array.length; key++) {
|
|
3842
|
-
if (predicate(array[key])) {
|
|
3843
|
-
return key;
|
|
3844
|
-
}
|
|
3845
|
-
}
|
|
3846
|
-
return undefined;
|
|
3847
|
-
}
|
|
3848
|
-
|
|
3849
|
-
function buildMatchPatternFn(args) {
|
|
3850
|
-
return function (string) {
|
|
3851
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3852
|
-
var matchResult = string.match(args.matchPattern);
|
|
3853
|
-
if (!matchResult) return null;
|
|
3854
|
-
var matchedString = matchResult[0];
|
|
3855
|
-
var parseResult = string.match(args.parsePattern);
|
|
3856
|
-
if (!parseResult) return null;
|
|
3857
|
-
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
3858
|
-
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
3859
|
-
var rest = string.slice(matchedString.length);
|
|
3860
|
-
return {
|
|
3861
|
-
value: value,
|
|
3862
|
-
rest: rest
|
|
3863
|
-
};
|
|
3864
|
-
};
|
|
3865
|
-
}
|
|
3866
2422
|
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
3872
|
-
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
3873
|
-
};
|
|
3874
|
-
var parseEraPatterns = {
|
|
3875
|
-
any: [/^b/i, /^(a|c)/i]
|
|
3876
|
-
};
|
|
3877
|
-
var matchQuarterPatterns = {
|
|
3878
|
-
narrow: /^[1234]/i,
|
|
3879
|
-
abbreviated: /^q[1234]/i,
|
|
3880
|
-
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
3881
|
-
};
|
|
3882
|
-
var parseQuarterPatterns = {
|
|
3883
|
-
any: [/1/i, /2/i, /3/i, /4/i]
|
|
3884
|
-
};
|
|
3885
|
-
var matchMonthPatterns = {
|
|
3886
|
-
narrow: /^[jfmasond]/i,
|
|
3887
|
-
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
3888
|
-
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
3889
|
-
};
|
|
3890
|
-
var parseMonthPatterns = {
|
|
3891
|
-
narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
|
|
3892
|
-
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
|
|
3893
|
-
};
|
|
3894
|
-
var matchDayPatterns = {
|
|
3895
|
-
narrow: /^[smtwf]/i,
|
|
3896
|
-
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
3897
|
-
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
3898
|
-
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
3899
|
-
};
|
|
3900
|
-
var parseDayPatterns = {
|
|
3901
|
-
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
3902
|
-
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
3903
|
-
};
|
|
3904
|
-
var matchDayPeriodPatterns = {
|
|
3905
|
-
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
3906
|
-
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
3907
|
-
};
|
|
3908
|
-
var parseDayPeriodPatterns = {
|
|
3909
|
-
any: {
|
|
3910
|
-
am: /^a/i,
|
|
3911
|
-
pm: /^p/i,
|
|
3912
|
-
midnight: /^mi/i,
|
|
3913
|
-
noon: /^no/i,
|
|
3914
|
-
morning: /morning/i,
|
|
3915
|
-
afternoon: /afternoon/i,
|
|
3916
|
-
evening: /evening/i,
|
|
3917
|
-
night: /night/i
|
|
3918
|
-
}
|
|
3919
|
-
};
|
|
3920
|
-
var match = {
|
|
3921
|
-
ordinalNumber: buildMatchPatternFn({
|
|
3922
|
-
matchPattern: matchOrdinalNumberPattern,
|
|
3923
|
-
parsePattern: parseOrdinalNumberPattern,
|
|
3924
|
-
valueCallback: function valueCallback(value) {
|
|
3925
|
-
return parseInt(value, 10);
|
|
3926
|
-
}
|
|
3927
|
-
}),
|
|
3928
|
-
era: buildMatchFn({
|
|
3929
|
-
matchPatterns: matchEraPatterns,
|
|
3930
|
-
defaultMatchWidth: 'wide',
|
|
3931
|
-
parsePatterns: parseEraPatterns,
|
|
3932
|
-
defaultParseWidth: 'any'
|
|
3933
|
-
}),
|
|
3934
|
-
quarter: buildMatchFn({
|
|
3935
|
-
matchPatterns: matchQuarterPatterns,
|
|
3936
|
-
defaultMatchWidth: 'wide',
|
|
3937
|
-
parsePatterns: parseQuarterPatterns,
|
|
3938
|
-
defaultParseWidth: 'any',
|
|
3939
|
-
valueCallback: function valueCallback(index) {
|
|
3940
|
-
return index + 1;
|
|
3941
|
-
}
|
|
3942
|
-
}),
|
|
3943
|
-
month: buildMatchFn({
|
|
3944
|
-
matchPatterns: matchMonthPatterns,
|
|
3945
|
-
defaultMatchWidth: 'wide',
|
|
3946
|
-
parsePatterns: parseMonthPatterns,
|
|
3947
|
-
defaultParseWidth: 'any'
|
|
3948
|
-
}),
|
|
3949
|
-
day: buildMatchFn({
|
|
3950
|
-
matchPatterns: matchDayPatterns,
|
|
3951
|
-
defaultMatchWidth: 'wide',
|
|
3952
|
-
parsePatterns: parseDayPatterns,
|
|
3953
|
-
defaultParseWidth: 'any'
|
|
3954
|
-
}),
|
|
3955
|
-
dayPeriod: buildMatchFn({
|
|
3956
|
-
matchPatterns: matchDayPeriodPatterns,
|
|
3957
|
-
defaultMatchWidth: 'any',
|
|
3958
|
-
parsePatterns: parseDayPeriodPatterns,
|
|
3959
|
-
defaultParseWidth: 'any'
|
|
3960
|
-
})
|
|
3961
|
-
};
|
|
3962
|
-
var match$1 = match;
|
|
3963
|
-
|
|
3964
|
-
/**
|
|
3965
|
-
* @type {Locale}
|
|
3966
|
-
* @category Locales
|
|
3967
|
-
* @summary English locale (United States).
|
|
3968
|
-
* @language English
|
|
3969
|
-
* @iso-639-2 eng
|
|
3970
|
-
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
|
3971
|
-
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
|
3972
|
-
*/
|
|
3973
|
-
var locale = {
|
|
3974
|
-
code: 'en-US',
|
|
3975
|
-
formatDistance: formatDistance$1,
|
|
3976
|
-
formatLong: formatLong$1,
|
|
3977
|
-
formatRelative: formatRelative$1,
|
|
3978
|
-
localize: localize$1,
|
|
3979
|
-
match: match$1,
|
|
3980
|
-
options: {
|
|
3981
|
-
weekStartsOn: 0 /* Sunday */,
|
|
3982
|
-
firstWeekContainsDate: 1
|
|
3983
|
-
}
|
|
2423
|
+
const CCollapsePlugin = {
|
|
2424
|
+
install: (app) => {
|
|
2425
|
+
app.component(CCollapse.name, CCollapse);
|
|
2426
|
+
},
|
|
3984
2427
|
};
|
|
3985
|
-
var defaultLocale = locale;
|
|
3986
|
-
|
|
3987
|
-
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
|
3988
|
-
// (one of the certain letters followed by `o`)
|
|
3989
|
-
// - (\w)\1* matches any sequences of the same letter
|
|
3990
|
-
// - '' matches two quote characters in a row
|
|
3991
|
-
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
|
|
3992
|
-
// except a single quote symbol, which ends the sequence.
|
|
3993
|
-
// Two quote characters do not end the sequence.
|
|
3994
|
-
// If there is no matching single quote
|
|
3995
|
-
// then the sequence will continue until the end of the string.
|
|
3996
|
-
// - . matches any single character unmatched by previous parts of the RegExps
|
|
3997
|
-
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
3998
|
-
|
|
3999
|
-
// This RegExp catches symbols escaped by quotes, and also
|
|
4000
|
-
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
|
|
4001
|
-
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
4002
|
-
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
4003
|
-
var doubleQuoteRegExp = /''/g;
|
|
4004
|
-
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
4005
|
-
|
|
4006
|
-
/**
|
|
4007
|
-
* @name format
|
|
4008
|
-
* @category Common Helpers
|
|
4009
|
-
* @summary Format the date.
|
|
4010
|
-
*
|
|
4011
|
-
* @description
|
|
4012
|
-
* Return the formatted date string in the given format. The result may vary by locale.
|
|
4013
|
-
*
|
|
4014
|
-
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
4015
|
-
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4016
|
-
*
|
|
4017
|
-
* The characters wrapped between two single quotes characters (') are escaped.
|
|
4018
|
-
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
4019
|
-
* (see the last example)
|
|
4020
|
-
*
|
|
4021
|
-
* Format of the string is based on Unicode Technical Standard #35:
|
|
4022
|
-
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
4023
|
-
* with a few additions (see note 7 below the table).
|
|
4024
|
-
*
|
|
4025
|
-
* Accepted patterns:
|
|
4026
|
-
* | Unit | Pattern | Result examples | Notes |
|
|
4027
|
-
* |---------------------------------|---------|-----------------------------------|-------|
|
|
4028
|
-
* | Era | G..GGG | AD, BC | |
|
|
4029
|
-
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
4030
|
-
* | | GGGGG | A, B | |
|
|
4031
|
-
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
4032
|
-
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
4033
|
-
* | | yy | 44, 01, 00, 17 | 5 |
|
|
4034
|
-
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
4035
|
-
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
4036
|
-
* | | yyyyy | ... | 3,5 |
|
|
4037
|
-
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
4038
|
-
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
4039
|
-
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
4040
|
-
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
4041
|
-
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
4042
|
-
* | | YYYYY | ... | 3,5 |
|
|
4043
|
-
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
4044
|
-
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
4045
|
-
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
4046
|
-
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
4047
|
-
* | | RRRRR | ... | 3,5,7 |
|
|
4048
|
-
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
4049
|
-
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
4050
|
-
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
4051
|
-
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
4052
|
-
* | | uuuuu | ... | 3,5 |
|
|
4053
|
-
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
4054
|
-
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
4055
|
-
* | | QQ | 01, 02, 03, 04 | |
|
|
4056
|
-
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
4057
|
-
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
4058
|
-
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
4059
|
-
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
4060
|
-
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
4061
|
-
* | | qq | 01, 02, 03, 04 | |
|
|
4062
|
-
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
4063
|
-
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
4064
|
-
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
4065
|
-
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
4066
|
-
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
4067
|
-
* | | MM | 01, 02, ..., 12 | |
|
|
4068
|
-
* | | MMM | Jan, Feb, ..., Dec | |
|
|
4069
|
-
* | | MMMM | January, February, ..., December | 2 |
|
|
4070
|
-
* | | MMMMM | J, F, ..., D | |
|
|
4071
|
-
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
4072
|
-
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
4073
|
-
* | | LL | 01, 02, ..., 12 | |
|
|
4074
|
-
* | | LLL | Jan, Feb, ..., Dec | |
|
|
4075
|
-
* | | LLLL | January, February, ..., December | 2 |
|
|
4076
|
-
* | | LLLLL | J, F, ..., D | |
|
|
4077
|
-
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
4078
|
-
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
4079
|
-
* | | ww | 01, 02, ..., 53 | |
|
|
4080
|
-
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
4081
|
-
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
4082
|
-
* | | II | 01, 02, ..., 53 | 7 |
|
|
4083
|
-
* | Day of month | d | 1, 2, ..., 31 | |
|
|
4084
|
-
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
4085
|
-
* | | dd | 01, 02, ..., 31 | |
|
|
4086
|
-
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
4087
|
-
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
4088
|
-
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
4089
|
-
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
4090
|
-
* | | DDDD | ... | 3 |
|
|
4091
|
-
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
4092
|
-
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
4093
|
-
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
4094
|
-
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
4095
|
-
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
4096
|
-
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
4097
|
-
* | | ii | 01, 02, ..., 07 | 7 |
|
|
4098
|
-
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
4099
|
-
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
4100
|
-
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
4101
|
-
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
4102
|
-
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
4103
|
-
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
4104
|
-
* | | ee | 02, 03, ..., 01 | |
|
|
4105
|
-
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
4106
|
-
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
4107
|
-
* | | eeeee | M, T, W, T, F, S, S | |
|
|
4108
|
-
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
4109
|
-
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
4110
|
-
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
4111
|
-
* | | cc | 02, 03, ..., 01 | |
|
|
4112
|
-
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
4113
|
-
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
4114
|
-
* | | ccccc | M, T, W, T, F, S, S | |
|
|
4115
|
-
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
4116
|
-
* | AM, PM | a..aa | AM, PM | |
|
|
4117
|
-
* | | aaa | am, pm | |
|
|
4118
|
-
* | | aaaa | a.m., p.m. | 2 |
|
|
4119
|
-
* | | aaaaa | a, p | |
|
|
4120
|
-
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
4121
|
-
* | | bbb | am, pm, noon, midnight | |
|
|
4122
|
-
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
4123
|
-
* | | bbbbb | a, p, n, mi | |
|
|
4124
|
-
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
4125
|
-
* | | BBBB | at night, in the morning, ... | 2 |
|
|
4126
|
-
* | | BBBBB | at night, in the morning, ... | |
|
|
4127
|
-
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
4128
|
-
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
4129
|
-
* | | hh | 01, 02, ..., 11, 12 | |
|
|
4130
|
-
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
4131
|
-
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
4132
|
-
* | | HH | 00, 01, 02, ..., 23 | |
|
|
4133
|
-
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
4134
|
-
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
4135
|
-
* | | KK | 01, 02, ..., 11, 00 | |
|
|
4136
|
-
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
4137
|
-
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
4138
|
-
* | | kk | 24, 01, 02, ..., 23 | |
|
|
4139
|
-
* | Minute | m | 0, 1, ..., 59 | |
|
|
4140
|
-
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
4141
|
-
* | | mm | 00, 01, ..., 59 | |
|
|
4142
|
-
* | Second | s | 0, 1, ..., 59 | |
|
|
4143
|
-
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
4144
|
-
* | | ss | 00, 01, ..., 59 | |
|
|
4145
|
-
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
4146
|
-
* | | SS | 00, 01, ..., 99 | |
|
|
4147
|
-
* | | SSS | 000, 001, ..., 999 | |
|
|
4148
|
-
* | | SSSS | ... | 3 |
|
|
4149
|
-
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
4150
|
-
* | | XX | -0800, +0530, Z | |
|
|
4151
|
-
* | | XXX | -08:00, +05:30, Z | |
|
|
4152
|
-
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
4153
|
-
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
4154
|
-
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
4155
|
-
* | | xx | -0800, +0530, +0000 | |
|
|
4156
|
-
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
4157
|
-
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
4158
|
-
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
4159
|
-
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
4160
|
-
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
4161
|
-
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
4162
|
-
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
4163
|
-
* | Seconds timestamp | t | 512969520 | 7 |
|
|
4164
|
-
* | | tt | ... | 3,7 |
|
|
4165
|
-
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
4166
|
-
* | | TT | ... | 3,7 |
|
|
4167
|
-
* | Long localized date | P | 04/29/1453 | 7 |
|
|
4168
|
-
* | | PP | Apr 29, 1453 | 7 |
|
|
4169
|
-
* | | PPP | April 29th, 1453 | 7 |
|
|
4170
|
-
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
4171
|
-
* | Long localized time | p | 12:00 AM | 7 |
|
|
4172
|
-
* | | pp | 12:00:00 AM | 7 |
|
|
4173
|
-
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
4174
|
-
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
4175
|
-
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
4176
|
-
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
4177
|
-
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
4178
|
-
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
4179
|
-
* Notes:
|
|
4180
|
-
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
4181
|
-
* are the same as "stand-alone" units, but are different in some languages.
|
|
4182
|
-
* "Formatting" units are declined according to the rules of the language
|
|
4183
|
-
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
4184
|
-
*
|
|
4185
|
-
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
4186
|
-
*
|
|
4187
|
-
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
4188
|
-
*
|
|
4189
|
-
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
4190
|
-
* the single quote characters (see below).
|
|
4191
|
-
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
4192
|
-
* the output will be the same as default pattern for this unit, usually
|
|
4193
|
-
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
4194
|
-
* are marked with "2" in the last column of the table.
|
|
4195
|
-
*
|
|
4196
|
-
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
4197
|
-
*
|
|
4198
|
-
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
4199
|
-
*
|
|
4200
|
-
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
4201
|
-
*
|
|
4202
|
-
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
4203
|
-
*
|
|
4204
|
-
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
4205
|
-
*
|
|
4206
|
-
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
4207
|
-
* The output will be padded with zeros to match the length of the pattern.
|
|
4208
|
-
*
|
|
4209
|
-
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
4210
|
-
*
|
|
4211
|
-
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
4212
|
-
* These tokens represent the shortest form of the quarter.
|
|
4213
|
-
*
|
|
4214
|
-
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
4215
|
-
*
|
|
4216
|
-
* | Year | `y` | `u` |
|
|
4217
|
-
* |------|-----|-----|
|
|
4218
|
-
* | AC 1 | 1 | 1 |
|
|
4219
|
-
* | BC 1 | 1 | 0 |
|
|
4220
|
-
* | BC 2 | 2 | -1 |
|
|
4221
|
-
*
|
|
4222
|
-
* Also `yy` always returns the last two digits of a year,
|
|
4223
|
-
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
4224
|
-
*
|
|
4225
|
-
* | Year | `yy` | `uu` |
|
|
4226
|
-
* |------|------|------|
|
|
4227
|
-
* | 1 | 01 | 01 |
|
|
4228
|
-
* | 14 | 14 | 14 |
|
|
4229
|
-
* | 376 | 76 | 376 |
|
|
4230
|
-
* | 1453 | 53 | 1453 |
|
|
4231
|
-
*
|
|
4232
|
-
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
4233
|
-
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
4234
|
-
* and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
|
|
4235
|
-
* and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
|
|
4236
|
-
*
|
|
4237
|
-
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
4238
|
-
* so right now these tokens fall back to GMT timezones.
|
|
4239
|
-
*
|
|
4240
|
-
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
4241
|
-
* - `i`: ISO day of week
|
|
4242
|
-
* - `I`: ISO week of year
|
|
4243
|
-
* - `R`: ISO week-numbering year
|
|
4244
|
-
* - `t`: seconds timestamp
|
|
4245
|
-
* - `T`: milliseconds timestamp
|
|
4246
|
-
* - `o`: ordinal number modifier
|
|
4247
|
-
* - `P`: long localized date
|
|
4248
|
-
* - `p`: long localized time
|
|
4249
|
-
*
|
|
4250
|
-
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
4251
|
-
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4252
|
-
*
|
|
4253
|
-
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
4254
|
-
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4255
|
-
*
|
|
4256
|
-
* @param {Date|Number} date - the original date
|
|
4257
|
-
* @param {String} format - the string of tokens
|
|
4258
|
-
* @param {Object} [options] - an object with options.
|
|
4259
|
-
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
|
4260
|
-
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
|
4261
|
-
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
|
|
4262
|
-
* @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
|
|
4263
|
-
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4264
|
-
* @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
|
|
4265
|
-
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4266
|
-
* @returns {String} the formatted date string
|
|
4267
|
-
* @throws {TypeError} 2 arguments required
|
|
4268
|
-
* @throws {RangeError} `date` must not be Invalid Date
|
|
4269
|
-
* @throws {RangeError} `options.locale` must contain `localize` property
|
|
4270
|
-
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
|
4271
|
-
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
|
|
4272
|
-
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
|
|
4273
|
-
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4274
|
-
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4275
|
-
* @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4276
|
-
* @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
4277
|
-
* @throws {RangeError} format string contains an unescaped latin alphabet character
|
|
4278
|
-
*
|
|
4279
|
-
* @example
|
|
4280
|
-
* // Represent 11 February 2014 in middle-endian format:
|
|
4281
|
-
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
4282
|
-
* //=> '02/11/2014'
|
|
4283
|
-
*
|
|
4284
|
-
* @example
|
|
4285
|
-
* // Represent 2 July 2014 in Esperanto:
|
|
4286
|
-
* import { eoLocale } from 'date-fns/locale/eo'
|
|
4287
|
-
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
4288
|
-
* locale: eoLocale
|
|
4289
|
-
* })
|
|
4290
|
-
* //=> '2-a de julio 2014'
|
|
4291
|
-
*
|
|
4292
|
-
* @example
|
|
4293
|
-
* // Escape string by single quote characters:
|
|
4294
|
-
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
4295
|
-
* //=> "3 o'clock"
|
|
4296
|
-
*/
|
|
4297
|
-
|
|
4298
|
-
function format(dirtyDate, dirtyFormatStr, options) {
|
|
4299
|
-
var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
|
|
4300
|
-
requiredArgs(2, arguments);
|
|
4301
|
-
var formatStr = String(dirtyFormatStr);
|
|
4302
|
-
var defaultOptions = getDefaultOptions();
|
|
4303
|
-
var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
|
|
4304
|
-
var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
|
|
4305
|
-
|
|
4306
|
-
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
4307
|
-
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
4308
|
-
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
4309
|
-
}
|
|
4310
|
-
var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
4311
|
-
|
|
4312
|
-
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
4313
|
-
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
4314
|
-
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
4315
|
-
}
|
|
4316
|
-
if (!locale.localize) {
|
|
4317
|
-
throw new RangeError('locale must contain localize property');
|
|
4318
|
-
}
|
|
4319
|
-
if (!locale.formatLong) {
|
|
4320
|
-
throw new RangeError('locale must contain formatLong property');
|
|
4321
|
-
}
|
|
4322
|
-
var originalDate = toDate(dirtyDate);
|
|
4323
|
-
if (!isValid(originalDate)) {
|
|
4324
|
-
throw new RangeError('Invalid time value');
|
|
4325
|
-
}
|
|
4326
|
-
|
|
4327
|
-
// Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
|
4328
|
-
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
|
4329
|
-
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
|
|
4330
|
-
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
|
|
4331
|
-
var utcDate = subMilliseconds(originalDate, timezoneOffset);
|
|
4332
|
-
var formatterOptions = {
|
|
4333
|
-
firstWeekContainsDate: firstWeekContainsDate,
|
|
4334
|
-
weekStartsOn: weekStartsOn,
|
|
4335
|
-
locale: locale,
|
|
4336
|
-
_originalDate: originalDate
|
|
4337
|
-
};
|
|
4338
|
-
var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
|
|
4339
|
-
var firstCharacter = substring[0];
|
|
4340
|
-
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
|
4341
|
-
var longFormatter = longFormatters$1[firstCharacter];
|
|
4342
|
-
return longFormatter(substring, locale.formatLong);
|
|
4343
|
-
}
|
|
4344
|
-
return substring;
|
|
4345
|
-
}).join('').match(formattingTokensRegExp).map(function (substring) {
|
|
4346
|
-
// Replace two single quote characters with one single quote character
|
|
4347
|
-
if (substring === "''") {
|
|
4348
|
-
return "'";
|
|
4349
|
-
}
|
|
4350
|
-
var firstCharacter = substring[0];
|
|
4351
|
-
if (firstCharacter === "'") {
|
|
4352
|
-
return cleanEscapedString(substring);
|
|
4353
|
-
}
|
|
4354
|
-
var formatter = formatters$1[firstCharacter];
|
|
4355
|
-
if (formatter) {
|
|
4356
|
-
if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
|
|
4357
|
-
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
|
|
4358
|
-
}
|
|
4359
|
-
if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
|
|
4360
|
-
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
|
|
4361
|
-
}
|
|
4362
|
-
return formatter(utcDate, substring, locale.localize, formatterOptions);
|
|
4363
|
-
}
|
|
4364
|
-
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
4365
|
-
throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
|
|
4366
|
-
}
|
|
4367
|
-
return substring;
|
|
4368
|
-
}).join('');
|
|
4369
|
-
return result;
|
|
4370
|
-
}
|
|
4371
|
-
function cleanEscapedString(input) {
|
|
4372
|
-
var matched = input.match(escapedStringRegExp);
|
|
4373
|
-
if (!matched) {
|
|
4374
|
-
return input;
|
|
4375
|
-
}
|
|
4376
|
-
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
4377
|
-
}
|
|
4378
2428
|
|
|
4379
2429
|
const CFormFeedback = vue.defineComponent({
|
|
4380
2430
|
name: 'CFormFeedback',
|
|
@@ -6529,7 +4579,7 @@ const CPicker = vue.defineComponent({
|
|
|
6529
4579
|
/**
|
|
6530
4580
|
* @slot Location for the footer element.
|
|
6531
4581
|
*/
|
|
6532
|
-
slots.footer && slots.footer(),
|
|
4582
|
+
props.footer && slots.footer && slots.footer(),
|
|
6533
4583
|
]),
|
|
6534
4584
|
]);
|
|
6535
4585
|
}
|
|
@@ -6954,12 +5004,12 @@ const CTimePicker = vue.defineComponent({
|
|
|
6954
5004
|
listOfSeconds: [],
|
|
6955
5005
|
hour12: false,
|
|
6956
5006
|
});
|
|
6957
|
-
const isValid = vue.ref(props.valid
|
|
5007
|
+
const isValid = vue.ref(props.valid ?? (props.invalid === true ? false : undefined));
|
|
6958
5008
|
vue.watch(() => props.time, () => {
|
|
6959
5009
|
date.value = convertTimeToDate(props.time);
|
|
6960
5010
|
});
|
|
6961
5011
|
vue.watch(() => [props.valid, props.invalid], () => {
|
|
6962
|
-
isValid.value = props.valid
|
|
5012
|
+
isValid.value = props.valid ?? (props.invalid === true ? false : undefined);
|
|
6963
5013
|
});
|
|
6964
5014
|
vue.watch(date, () => {
|
|
6965
5015
|
localizedTimePartials.value = getLocalizedTimePartials(props.locale, props.ampm);
|
|
@@ -7242,14 +5292,93 @@ const getLocalDateFromString = (string, locale, time) => {
|
|
|
7242
5292
|
const newDate = partials.groups &&
|
|
7243
5293
|
(time
|
|
7244
5294
|
? new Date(Number(partials.groups['year']), Number(partials.groups['month']) - 1, Number(partials.groups['day']), partials.groups['ampm']
|
|
7245
|
-
? partials.groups['ampm'] === 'PM'
|
|
5295
|
+
? (partials.groups['ampm'] === 'PM'
|
|
7246
5296
|
? Number(partials.groups['hour']) + 12
|
|
7247
|
-
: Number(partials.groups['hour'])
|
|
5297
|
+
: Number(partials.groups['hour']))
|
|
7248
5298
|
: Number(partials.groups['hour']), Number(partials.groups['minute']), Number(partials.groups['second']))
|
|
7249
5299
|
: new Date(Number(partials.groups['year']), Number(partials.groups['month']) - 1, Number(partials.groups['day'])));
|
|
7250
5300
|
return newDate;
|
|
7251
5301
|
};
|
|
7252
5302
|
|
|
5303
|
+
const getStoredTheme = (localStorageItemName) => typeof window !== 'undefined' && localStorage.getItem(localStorageItemName);
|
|
5304
|
+
const setStoredTheme = (localStorageItemName, colorMode) => localStorage.setItem(localStorageItemName, colorMode);
|
|
5305
|
+
const getPreferredColorScheme = (localStorageItemName) => {
|
|
5306
|
+
if (typeof window === 'undefined') {
|
|
5307
|
+
return;
|
|
5308
|
+
}
|
|
5309
|
+
const storedTheme = getStoredTheme(localStorageItemName);
|
|
5310
|
+
if (storedTheme) {
|
|
5311
|
+
return storedTheme;
|
|
5312
|
+
}
|
|
5313
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
5314
|
+
};
|
|
5315
|
+
const setTheme = (colorMode) => {
|
|
5316
|
+
document.documentElement.dataset.coreuiTheme =
|
|
5317
|
+
colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
5318
|
+
? 'dark'
|
|
5319
|
+
: colorMode;
|
|
5320
|
+
const event = new Event('ColorSchemeChange');
|
|
5321
|
+
document.documentElement.dispatchEvent(event);
|
|
5322
|
+
};
|
|
5323
|
+
const useColorModes = (localStorageItemName = 'coreui-vue-color-scheme') => {
|
|
5324
|
+
const colorMode = vue.ref(getPreferredColorScheme(localStorageItemName));
|
|
5325
|
+
vue.watch(colorMode, () => {
|
|
5326
|
+
if (colorMode.value) {
|
|
5327
|
+
setStoredTheme(localStorageItemName, colorMode.value);
|
|
5328
|
+
setTheme(colorMode.value);
|
|
5329
|
+
}
|
|
5330
|
+
});
|
|
5331
|
+
vue.onBeforeMount(() => {
|
|
5332
|
+
if (typeof getStoredTheme(localStorageItemName) === 'string' && colorMode.value) {
|
|
5333
|
+
setTheme(colorMode.value);
|
|
5334
|
+
}
|
|
5335
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
5336
|
+
const storedTheme = getStoredTheme(localStorageItemName);
|
|
5337
|
+
if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode.value) {
|
|
5338
|
+
setTheme(colorMode.value);
|
|
5339
|
+
}
|
|
5340
|
+
});
|
|
5341
|
+
});
|
|
5342
|
+
return {
|
|
5343
|
+
colorMode,
|
|
5344
|
+
isColorModeSet: () => Boolean(getStoredTheme(localStorageItemName)),
|
|
5345
|
+
setColorMode: (mode) => {
|
|
5346
|
+
colorMode.value = mode;
|
|
5347
|
+
},
|
|
5348
|
+
};
|
|
5349
|
+
};
|
|
5350
|
+
|
|
5351
|
+
const useDebouncedCallback = (callback, delay) => {
|
|
5352
|
+
const timeout = vue.ref();
|
|
5353
|
+
const debouncedFn = (...args) => {
|
|
5354
|
+
const handler = () => {
|
|
5355
|
+
clearTimeout(timeout.value);
|
|
5356
|
+
callback(...args);
|
|
5357
|
+
};
|
|
5358
|
+
clearTimeout(timeout.value);
|
|
5359
|
+
timeout.value = setTimeout(handler, delay);
|
|
5360
|
+
};
|
|
5361
|
+
return debouncedFn();
|
|
5362
|
+
};
|
|
5363
|
+
|
|
5364
|
+
const usePopper = () => {
|
|
5365
|
+
const _popper = vue.ref();
|
|
5366
|
+
const initPopper = (reference, popper, options) => {
|
|
5367
|
+
_popper.value = createPopper(reference, popper, options);
|
|
5368
|
+
};
|
|
5369
|
+
const destroyPopper = () => {
|
|
5370
|
+
if (_popper.value) {
|
|
5371
|
+
_popper.value.destroy();
|
|
5372
|
+
}
|
|
5373
|
+
_popper.value = undefined;
|
|
5374
|
+
};
|
|
5375
|
+
return {
|
|
5376
|
+
popper: _popper.value,
|
|
5377
|
+
initPopper,
|
|
5378
|
+
destroyPopper,
|
|
5379
|
+
};
|
|
5380
|
+
};
|
|
5381
|
+
|
|
7253
5382
|
const CDateRangePicker = vue.defineComponent({
|
|
7254
5383
|
name: 'CDateRangePicker',
|
|
7255
5384
|
props: {
|
|
@@ -7454,6 +5583,27 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7454
5583
|
* Toggle the readonly state for the component.
|
|
7455
5584
|
*/
|
|
7456
5585
|
inputReadOnly: Boolean,
|
|
5586
|
+
/**
|
|
5587
|
+
* Custom function to format the selected date into a string according to a custom format.
|
|
5588
|
+
*
|
|
5589
|
+
* @since v5.0.0-alpha.4
|
|
5590
|
+
*/
|
|
5591
|
+
inputDateFormat: Function,
|
|
5592
|
+
/**
|
|
5593
|
+
* Custom function to parse the input value into a valid Date object.
|
|
5594
|
+
*
|
|
5595
|
+
* @since v5.0.0-alpha.4
|
|
5596
|
+
*/
|
|
5597
|
+
inputDateParse: Function,
|
|
5598
|
+
/**
|
|
5599
|
+
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
5600
|
+
*
|
|
5601
|
+
* @since v5.0.0-alpha.4
|
|
5602
|
+
*/
|
|
5603
|
+
inputOnChangeDelay: {
|
|
5604
|
+
type: Number,
|
|
5605
|
+
default: 750,
|
|
5606
|
+
},
|
|
7457
5607
|
/**
|
|
7458
5608
|
* Set component validation state to invalid.
|
|
7459
5609
|
*
|
|
@@ -7531,6 +5681,16 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7531
5681
|
* @since 4.9.0
|
|
7532
5682
|
*/
|
|
7533
5683
|
selectAdjacementDays: Boolean,
|
|
5684
|
+
/**
|
|
5685
|
+
* Specify the type of date selection as day, week, month, or year.
|
|
5686
|
+
*
|
|
5687
|
+
* @since 5.0.0-alpha.1
|
|
5688
|
+
*/
|
|
5689
|
+
selectionType: {
|
|
5690
|
+
type: String,
|
|
5691
|
+
default: 'day',
|
|
5692
|
+
validator: (value) => ['day', 'week', 'month', 'year'].includes(value),
|
|
5693
|
+
},
|
|
7534
5694
|
/**
|
|
7535
5695
|
* Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
|
|
7536
5696
|
*
|
|
@@ -7540,6 +5700,12 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7540
5700
|
type: Boolean,
|
|
7541
5701
|
default: true,
|
|
7542
5702
|
},
|
|
5703
|
+
/**
|
|
5704
|
+
* Set whether to display week numbers in the calendar.
|
|
5705
|
+
*
|
|
5706
|
+
* @since 5.0.0-alpha.1
|
|
5707
|
+
*/
|
|
5708
|
+
showWeekNumber: Boolean,
|
|
7543
5709
|
/**
|
|
7544
5710
|
* Default icon or character character that separates two dates.
|
|
7545
5711
|
*/
|
|
@@ -7652,6 +5818,12 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7652
5818
|
return false;
|
|
7653
5819
|
},
|
|
7654
5820
|
},
|
|
5821
|
+
/**
|
|
5822
|
+
* Label displayed over week numbers in the calendar.
|
|
5823
|
+
*
|
|
5824
|
+
* @since 5.0.0-alpha.1
|
|
5825
|
+
*/
|
|
5826
|
+
weekNumbersLabel: String,
|
|
7655
5827
|
},
|
|
7656
5828
|
emits: [
|
|
7657
5829
|
/**
|
|
@@ -7695,53 +5867,45 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7695
5867
|
const inputEndRef = vue.ref();
|
|
7696
5868
|
const inputStartRef = vue.ref();
|
|
7697
5869
|
const formRef = vue.ref();
|
|
5870
|
+
const calendarDate = vue.ref(props.calendarDate ?? null);
|
|
5871
|
+
const endDate = vue.ref(props.endDate ?? null);
|
|
5872
|
+
const maxDate = vue.ref(props.maxDate ?? null);
|
|
5873
|
+
const minDate = vue.ref(props.minDate ?? null);
|
|
5874
|
+
const startDate = vue.ref(props.startDate ?? null);
|
|
7698
5875
|
const visible = vue.ref(props.visible);
|
|
7699
|
-
const
|
|
7700
|
-
|
|
7701
|
-
: props.startDate
|
|
7702
|
-
? new Date(props.startDate)
|
|
7703
|
-
: props.endDate
|
|
7704
|
-
? new Date(props.endDate)
|
|
7705
|
-
: new Date());
|
|
5876
|
+
const initialStartDate = vue.ref(props.startDate ?? null);
|
|
5877
|
+
const initialEndDate = vue.ref(props.endDate ?? null);
|
|
7706
5878
|
const inputStartHoverValue = vue.ref(null);
|
|
7707
5879
|
const inputEndHoverValue = vue.ref(null);
|
|
7708
|
-
const
|
|
7709
|
-
const endDate = vue.ref(props.endDate ? new Date(props.endDate) : null);
|
|
7710
|
-
const initialStartDate = vue.ref(startDate.value ? new Date(startDate.value) : null);
|
|
7711
|
-
const initialEndDate = vue.ref(endDate.value ? new Date(endDate.value) : null);
|
|
7712
|
-
const maxDate = vue.ref(props.maxDate && new Date(props.maxDate));
|
|
7713
|
-
const minDate = vue.ref(props.minDate && new Date(props.minDate));
|
|
7714
|
-
const selectEndDate = vue.ref(false);
|
|
7715
|
-
const isValid = vue.ref(props.valid || (props.invalid && false));
|
|
5880
|
+
const isValid = vue.ref(props.valid ?? (props.invalid === true ? false : undefined));
|
|
7716
5881
|
const isMobile = vue.ref(false);
|
|
5882
|
+
const selectEndDate = vue.ref(false);
|
|
7717
5883
|
vue.onMounted(() => {
|
|
7718
5884
|
isMobile.value = window.innerWidth < 768;
|
|
7719
5885
|
});
|
|
7720
5886
|
vue.watch(() => [props.valid, props.invalid], () => {
|
|
7721
|
-
isValid.value = props.valid
|
|
5887
|
+
isValid.value = props.valid ?? (props.invalid === true ? false : undefined);
|
|
7722
5888
|
});
|
|
7723
5889
|
vue.watch(() => props.startDate, () => {
|
|
7724
5890
|
if (props.startDate) {
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
startDate.value = date;
|
|
5891
|
+
calendarDate.value = props.startDate;
|
|
5892
|
+
startDate.value = props.startDate;
|
|
7728
5893
|
}
|
|
7729
5894
|
});
|
|
7730
5895
|
vue.watch(() => props.endDate, () => {
|
|
7731
5896
|
if (props.endDate) {
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
endDate.value = date;
|
|
5897
|
+
calendarDate.value = props.endDate;
|
|
5898
|
+
endDate.value = props.endDate;
|
|
7735
5899
|
}
|
|
7736
5900
|
});
|
|
7737
5901
|
vue.watch(() => props.maxDate, () => {
|
|
7738
5902
|
if (props.maxDate) {
|
|
7739
|
-
maxDate.value =
|
|
5903
|
+
maxDate.value = props.maxDate;
|
|
7740
5904
|
}
|
|
7741
5905
|
});
|
|
7742
5906
|
vue.watch(() => props.minDate, () => {
|
|
7743
5907
|
if (props.minDate) {
|
|
7744
|
-
minDate.value =
|
|
5908
|
+
minDate.value = props.minDate;
|
|
7745
5909
|
}
|
|
7746
5910
|
});
|
|
7747
5911
|
vue.watch(inputStartRef, () => {
|
|
@@ -7758,11 +5922,15 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7758
5922
|
}
|
|
7759
5923
|
});
|
|
7760
5924
|
const formatDate = (date) => {
|
|
7761
|
-
|
|
7762
|
-
|
|
5925
|
+
if (props.selectionType !== 'day') {
|
|
5926
|
+
return date;
|
|
5927
|
+
}
|
|
5928
|
+
const _date = new Date(date);
|
|
5929
|
+
return props.inputDateFormat
|
|
5930
|
+
? props.inputDateFormat(_date)
|
|
7763
5931
|
: props.timepicker
|
|
7764
|
-
?
|
|
7765
|
-
:
|
|
5932
|
+
? _date.toLocaleString(props.locale)
|
|
5933
|
+
: _date.toLocaleDateString(props.locale);
|
|
7766
5934
|
};
|
|
7767
5935
|
const setInputValue = (date) => {
|
|
7768
5936
|
if (date) {
|
|
@@ -7770,20 +5938,13 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7770
5938
|
}
|
|
7771
5939
|
return '';
|
|
7772
5940
|
};
|
|
7773
|
-
const
|
|
5941
|
+
const handleDateHover = (date) => {
|
|
7774
5942
|
if (selectEndDate.value) {
|
|
7775
5943
|
inputEndHoverValue.value = date;
|
|
7776
5944
|
return;
|
|
7777
5945
|
}
|
|
7778
5946
|
inputStartHoverValue.value = date;
|
|
7779
5947
|
};
|
|
7780
|
-
const handleCalendarDateChange = (date, difference) => {
|
|
7781
|
-
if (difference) {
|
|
7782
|
-
calendarDate.value = new Date(date.getFullYear(), date.getMonth() - difference, 1);
|
|
7783
|
-
return;
|
|
7784
|
-
}
|
|
7785
|
-
calendarDate.value = date;
|
|
7786
|
-
};
|
|
7787
5948
|
const handleFormValidation = (form) => {
|
|
7788
5949
|
if (!form.classList.contains('was-validated')) {
|
|
7789
5950
|
return;
|
|
@@ -7835,6 +5996,20 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7835
5996
|
emit('update:start-date', null);
|
|
7836
5997
|
emit('update:end-date', null);
|
|
7837
5998
|
};
|
|
5999
|
+
const handleOnChange = (value, input) => {
|
|
6000
|
+
const date = props.inputDateParse
|
|
6001
|
+
? props.inputDateParse(value)
|
|
6002
|
+
: getLocalDateFromString(value, props.locale, props.timepicker);
|
|
6003
|
+
if (date instanceof Date && date.getTime()) {
|
|
6004
|
+
calendarDate.value = date;
|
|
6005
|
+
if (input === 'start') {
|
|
6006
|
+
startDate.value = date;
|
|
6007
|
+
}
|
|
6008
|
+
else {
|
|
6009
|
+
endDate.value = date;
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
};
|
|
7838
6013
|
const InputGroup = () => vue.h('div', {
|
|
7839
6014
|
class: 'date-picker-input-group',
|
|
7840
6015
|
}, [
|
|
@@ -7851,13 +6026,8 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7851
6026
|
onClick: () => {
|
|
7852
6027
|
selectEndDate.value = false;
|
|
7853
6028
|
},
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
if (date instanceof Date && date.getTime()) {
|
|
7857
|
-
calendarDate.value = date;
|
|
7858
|
-
startDate.value = date;
|
|
7859
|
-
}
|
|
7860
|
-
},
|
|
6029
|
+
onChange: (event) => handleOnChange(event.target.value, 'start'),
|
|
6030
|
+
onInput: (event) => useDebouncedCallback(() => handleOnChange(event.target.value, 'start'), props.inputOnChangeDelay),
|
|
7861
6031
|
placeholder: Array.isArray(props.placeholder)
|
|
7862
6032
|
? props.placeholder[0]
|
|
7863
6033
|
: props.placeholder,
|
|
@@ -7883,13 +6053,8 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7883
6053
|
onClick: () => {
|
|
7884
6054
|
selectEndDate.value = true;
|
|
7885
6055
|
},
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
if (date instanceof Date && date.getTime()) {
|
|
7889
|
-
calendarDate.value = date;
|
|
7890
|
-
endDate.value = date;
|
|
7891
|
-
}
|
|
7892
|
-
},
|
|
6056
|
+
onChange: (event) => handleOnChange(event.target.value, 'end'),
|
|
6057
|
+
onInput: (event) => useDebouncedCallback(() => handleOnChange(event.target.value, 'end'), props.inputOnChangeDelay),
|
|
7893
6058
|
placeholder: props.placeholder[1],
|
|
7894
6059
|
readonly: props.inputReadOnly || typeof props.format === 'string',
|
|
7895
6060
|
required: props.required,
|
|
@@ -7999,26 +6164,36 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
7999
6164
|
variant: 'ghost',
|
|
8000
6165
|
}, () => key))),
|
|
8001
6166
|
vue.h('div', { class: 'date-picker-calendars' }, vue.h(CCalendar, {
|
|
8002
|
-
calendarDate:
|
|
8003
|
-
calendars: props.calendars,
|
|
6167
|
+
calendarDate: calendarDate.value,
|
|
6168
|
+
calendars: isMobile.value ? 1 : props.calendars,
|
|
6169
|
+
class: 'date-picker-calendars',
|
|
8004
6170
|
dayFormat: props.dayFormat,
|
|
8005
6171
|
disabledDates: props.disabledDates,
|
|
8006
|
-
|
|
6172
|
+
endDate: endDate.value,
|
|
8007
6173
|
firstDayOfWeek: props.firstDayOfWeek,
|
|
8008
6174
|
locale: props.locale,
|
|
8009
6175
|
maxDate: maxDate.value,
|
|
8010
6176
|
minDate: minDate.value,
|
|
8011
|
-
navYearFirst: props.navYearFirst,
|
|
8012
6177
|
navigation: props.navigation,
|
|
6178
|
+
navYearFirst: props.navYearFirst,
|
|
8013
6179
|
range: props.range,
|
|
8014
|
-
selectEndDate: selectEndDate.value,
|
|
8015
6180
|
selectAdjacementDays: props.selectAdjacementDays,
|
|
6181
|
+
selectEndDate: selectEndDate.value,
|
|
6182
|
+
selectionType: props.selectionType,
|
|
8016
6183
|
showAdjacementDays: props.showAdjacementDays,
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
6184
|
+
showWeekNumber: props.showWeekNumber,
|
|
6185
|
+
startDate: startDate.value,
|
|
6186
|
+
weekdayFormat: props.weekdayFormat,
|
|
6187
|
+
weekNumbersLabel: props.weekNumbersLabel,
|
|
6188
|
+
onDateHover: (date) => handleDateHover(date),
|
|
6189
|
+
onCalendarDateChange: (date) => {
|
|
6190
|
+
calendarDate.value = date;
|
|
6191
|
+
},
|
|
8020
6192
|
onStartDateChange: (date) => handleStartDateChange(date),
|
|
8021
6193
|
onEndDateChange: (date) => handleEndDateChange(date),
|
|
6194
|
+
onSelectEndChange: (value) => {
|
|
6195
|
+
selectEndDate.value = value;
|
|
6196
|
+
},
|
|
8022
6197
|
}, {
|
|
8023
6198
|
/**
|
|
8024
6199
|
* @slot Location for next icon.
|
|
@@ -8053,7 +6228,7 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
8053
6228
|
disabled: startDate.value === null ? true : false,
|
|
8054
6229
|
locale: props.locale,
|
|
8055
6230
|
onChange: (_, __, date) => handleStartDateChange(date),
|
|
8056
|
-
time: startDate.value,
|
|
6231
|
+
time: startDate.value && new Date(startDate.value),
|
|
8057
6232
|
variant: 'select',
|
|
8058
6233
|
}),
|
|
8059
6234
|
vue.h(CTimePicker, {
|
|
@@ -8061,7 +6236,7 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
8061
6236
|
disabled: endDate.value === null ? true : false,
|
|
8062
6237
|
locale: props.locale,
|
|
8063
6238
|
onChange: (_, __, date) => handleEndDateChange(date),
|
|
8064
|
-
time: endDate.value,
|
|
6239
|
+
time: endDate.value && new Date(endDate.value),
|
|
8065
6240
|
variant: 'select',
|
|
8066
6241
|
}),
|
|
8067
6242
|
]
|
|
@@ -8078,7 +6253,9 @@ const CDateRangePicker = vue.defineComponent({
|
|
|
8078
6253
|
onChange: (_, __, date) => index === 0
|
|
8079
6254
|
? handleStartDateChange(date)
|
|
8080
6255
|
: handleEndDateChange(date),
|
|
8081
|
-
time: index === 0
|
|
6256
|
+
time: index === 0
|
|
6257
|
+
? startDate.value && new Date(startDate.value)
|
|
6258
|
+
: endDate.value && new Date(endDate.value),
|
|
8082
6259
|
variant: 'select',
|
|
8083
6260
|
}))),
|
|
8084
6261
|
]),
|
|
@@ -8268,7 +6445,28 @@ const CDatePicker = vue.defineComponent({
|
|
|
8268
6445
|
/**
|
|
8269
6446
|
* Toggle the readonly state for the component.
|
|
8270
6447
|
*/
|
|
8271
|
-
inputReadOnly: Boolean,
|
|
6448
|
+
inputReadOnly: Boolean,
|
|
6449
|
+
/**
|
|
6450
|
+
* Custom function to format the selected date into a string according to a custom format.
|
|
6451
|
+
*
|
|
6452
|
+
* @since v5.0.0-alpha.4
|
|
6453
|
+
*/
|
|
6454
|
+
inputDateFormat: Function,
|
|
6455
|
+
/**
|
|
6456
|
+
* Custom function to parse the input value into a valid Date object.
|
|
6457
|
+
*
|
|
6458
|
+
* @since v5.0.0-alpha.4
|
|
6459
|
+
*/
|
|
6460
|
+
inputDateParse: Function,
|
|
6461
|
+
/**
|
|
6462
|
+
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
6463
|
+
*
|
|
6464
|
+
* @since v5.0.0-alpha.4
|
|
6465
|
+
*/
|
|
6466
|
+
inputOnChangeDelay: {
|
|
6467
|
+
type: Number,
|
|
6468
|
+
default: 750,
|
|
6469
|
+
},
|
|
8272
6470
|
/**
|
|
8273
6471
|
* Sets the default locale for components. If not set, it is inherited from the navigator.language.
|
|
8274
6472
|
*/
|
|
@@ -8314,6 +6512,16 @@ const CDatePicker = vue.defineComponent({
|
|
|
8314
6512
|
* @since 4.9.0
|
|
8315
6513
|
*/
|
|
8316
6514
|
selectAdjacementDays: Boolean,
|
|
6515
|
+
/**
|
|
6516
|
+
* Specify the type of date selection as day, week, month, or year.
|
|
6517
|
+
*
|
|
6518
|
+
* @since 5.0.0-alpha.1
|
|
6519
|
+
*/
|
|
6520
|
+
selectionType: {
|
|
6521
|
+
type: String,
|
|
6522
|
+
default: 'day',
|
|
6523
|
+
validator: (value) => ['day', 'week', 'month', 'year'].includes(value),
|
|
6524
|
+
},
|
|
8317
6525
|
/**
|
|
8318
6526
|
* Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
|
|
8319
6527
|
*
|
|
@@ -8323,6 +6531,12 @@ const CDatePicker = vue.defineComponent({
|
|
|
8323
6531
|
type: Boolean,
|
|
8324
6532
|
default: true,
|
|
8325
6533
|
},
|
|
6534
|
+
/**
|
|
6535
|
+
* Set whether to display week numbers in the calendar.
|
|
6536
|
+
*
|
|
6537
|
+
* @since 5.0.0-alpha.1
|
|
6538
|
+
*/
|
|
6539
|
+
showWeekNumber: Boolean,
|
|
8326
6540
|
/**
|
|
8327
6541
|
* Size the component small or large.
|
|
8328
6542
|
*
|
|
@@ -8360,6 +6574,12 @@ const CDatePicker = vue.defineComponent({
|
|
|
8360
6574
|
return false;
|
|
8361
6575
|
},
|
|
8362
6576
|
},
|
|
6577
|
+
/**
|
|
6578
|
+
* Label displayed over week numbers in the calendar.
|
|
6579
|
+
*
|
|
6580
|
+
* @since 5.0.0-alpha.1
|
|
6581
|
+
*/
|
|
6582
|
+
weekNumbersLabel: String,
|
|
8363
6583
|
},
|
|
8364
6584
|
emits: [
|
|
8365
6585
|
/**
|
|
@@ -8397,72 +6617,30 @@ const CDatePickerPlugin = {
|
|
|
8397
6617
|
},
|
|
8398
6618
|
};
|
|
8399
6619
|
|
|
8400
|
-
const
|
|
8401
|
-
const
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
6620
|
+
const getAlignmentClassNames = (alignment) => {
|
|
6621
|
+
const classNames = [];
|
|
6622
|
+
if (typeof alignment === 'object') {
|
|
6623
|
+
Object.keys(alignment).map((key) => {
|
|
6624
|
+
classNames.push(`dropdown-menu${key === 'xs' ? '' : `-${key}`}-${alignment[key]}`);
|
|
6625
|
+
});
|
|
8405
6626
|
}
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
return storedTheme;
|
|
6627
|
+
if (typeof alignment === 'string') {
|
|
6628
|
+
classNames.push(`dropdown-menu-${alignment}`);
|
|
8409
6629
|
}
|
|
8410
|
-
return
|
|
8411
|
-
};
|
|
8412
|
-
const setTheme = (colorMode) => {
|
|
8413
|
-
document.documentElement.dataset.coreuiTheme =
|
|
8414
|
-
colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
8415
|
-
? 'dark'
|
|
8416
|
-
: colorMode;
|
|
8417
|
-
const event = new Event('ColorSchemeChange');
|
|
8418
|
-
document.documentElement.dispatchEvent(event);
|
|
8419
|
-
};
|
|
8420
|
-
const useColorModes = (localStorageItemName = 'coreui-vue-color-scheme') => {
|
|
8421
|
-
const colorMode = vue.ref(getPreferredColorScheme(localStorageItemName));
|
|
8422
|
-
vue.watch(colorMode, () => {
|
|
8423
|
-
if (colorMode.value) {
|
|
8424
|
-
setStoredTheme(localStorageItemName, colorMode.value);
|
|
8425
|
-
setTheme(colorMode.value);
|
|
8426
|
-
}
|
|
8427
|
-
});
|
|
8428
|
-
vue.onBeforeMount(() => {
|
|
8429
|
-
if (typeof getStoredTheme(localStorageItemName) === 'string' && colorMode.value) {
|
|
8430
|
-
setTheme(colorMode.value);
|
|
8431
|
-
}
|
|
8432
|
-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
8433
|
-
const storedTheme = getStoredTheme(localStorageItemName);
|
|
8434
|
-
if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode.value) {
|
|
8435
|
-
setTheme(colorMode.value);
|
|
8436
|
-
}
|
|
8437
|
-
});
|
|
8438
|
-
});
|
|
8439
|
-
return {
|
|
8440
|
-
colorMode,
|
|
8441
|
-
isColorModeSet: () => Boolean(getStoredTheme(localStorageItemName)),
|
|
8442
|
-
setColorMode: (mode) => {
|
|
8443
|
-
colorMode.value = mode;
|
|
8444
|
-
},
|
|
8445
|
-
};
|
|
6630
|
+
return classNames;
|
|
8446
6631
|
};
|
|
8447
|
-
|
|
8448
|
-
const
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
}
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
};
|
|
8459
|
-
return {
|
|
8460
|
-
popper: _popper.value,
|
|
8461
|
-
initPopper,
|
|
8462
|
-
destroyPopper,
|
|
8463
|
-
};
|
|
6632
|
+
const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
|
|
6633
|
+
const listLength = list.length;
|
|
6634
|
+
let index = list.indexOf(activeElement);
|
|
6635
|
+
if (index === -1) {
|
|
6636
|
+
return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
|
|
6637
|
+
}
|
|
6638
|
+
index += shouldGetNext ? 1 : -1;
|
|
6639
|
+
if (isCycleAllowed) {
|
|
6640
|
+
index = (index + listLength) % listLength;
|
|
6641
|
+
}
|
|
6642
|
+
return list[Math.max(0, Math.min(index, listLength - 1))];
|
|
8464
6643
|
};
|
|
8465
|
-
|
|
8466
6644
|
const getPlacement = (placement, direction, alignment, isRTL) => {
|
|
8467
6645
|
let _placement = placement;
|
|
8468
6646
|
if (direction === 'dropup') {
|
|
@@ -8482,6 +6660,7 @@ const getPlacement = (placement, direction, alignment, isRTL) => {
|
|
|
8482
6660
|
}
|
|
8483
6661
|
return _placement;
|
|
8484
6662
|
};
|
|
6663
|
+
|
|
8485
6664
|
const CDropdown = vue.defineComponent({
|
|
8486
6665
|
name: 'CDropdown',
|
|
8487
6666
|
props: {
|
|
@@ -8637,12 +6816,17 @@ const CDropdown = vue.defineComponent({
|
|
|
8637
6816
|
popper.value && initPopper(dropdownToggleRef.value, dropdownMenuRef.value, popperConfig);
|
|
8638
6817
|
window.addEventListener('mouseup', handleMouseUp);
|
|
8639
6818
|
window.addEventListener('keyup', handleKeyup);
|
|
6819
|
+
dropdownToggleRef.value.addEventListener('keydown', handleKeydown);
|
|
6820
|
+
dropdownMenuRef.value.addEventListener('keydown', handleKeydown);
|
|
8640
6821
|
emit('show');
|
|
8641
6822
|
return;
|
|
8642
6823
|
}
|
|
8643
6824
|
popper.value && destroyPopper();
|
|
8644
6825
|
window.removeEventListener('mouseup', handleMouseUp);
|
|
8645
6826
|
window.removeEventListener('keyup', handleKeyup);
|
|
6827
|
+
dropdownToggleRef.value &&
|
|
6828
|
+
dropdownToggleRef.value.removeEventListener('keydown', handleKeydown);
|
|
6829
|
+
dropdownMenuRef.value && dropdownMenuRef.value.removeEventListener('keydown', handleKeydown);
|
|
8646
6830
|
emit('hide');
|
|
8647
6831
|
});
|
|
8648
6832
|
vue.provide('config', {
|
|
@@ -8654,6 +6838,16 @@ const CDropdown = vue.defineComponent({
|
|
|
8654
6838
|
vue.provide('visible', visible);
|
|
8655
6839
|
vue.provide('dropdownToggleRef', dropdownToggleRef);
|
|
8656
6840
|
vue.provide('dropdownMenuRef', dropdownMenuRef);
|
|
6841
|
+
const handleKeydown = (event) => {
|
|
6842
|
+
if (visible.value &&
|
|
6843
|
+
dropdownMenuRef.value &&
|
|
6844
|
+
(event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
|
|
6845
|
+
event.preventDefault();
|
|
6846
|
+
const target = event.target;
|
|
6847
|
+
const items = Array.from(dropdownMenuRef.value.querySelectorAll('.dropdown-item:not(.disabled):not(:disabled)'));
|
|
6848
|
+
getNextActiveElement(items, target, event.key === 'ArrowDown', true).focus();
|
|
6849
|
+
}
|
|
6850
|
+
};
|
|
8657
6851
|
const handleKeyup = (event) => {
|
|
8658
6852
|
if (props.autoClose === false) {
|
|
8659
6853
|
return;
|
|
@@ -8789,28 +6983,12 @@ const CDropdownMenu = vue.defineComponent({
|
|
|
8789
6983
|
const config = vue.inject('config'); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
8790
6984
|
const visible = vue.inject('visible');
|
|
8791
6985
|
const { alignment, dark, popper } = config;
|
|
8792
|
-
// eslint-disable-next-line @typescript-eslint/ban-types, unicorn/consistent-function-scoping
|
|
8793
|
-
const alignmentClassNames = (alignment) => {
|
|
8794
|
-
const classNames = [];
|
|
8795
|
-
if (typeof alignment === 'object') {
|
|
8796
|
-
Object.keys(alignment).map((key) => {
|
|
8797
|
-
classNames.push(`dropdown-menu${key === 'xs' ? '' : `-${key}`}-${alignment[key]}`);
|
|
8798
|
-
});
|
|
8799
|
-
}
|
|
8800
|
-
if (typeof alignment === 'string') {
|
|
8801
|
-
classNames.push(`dropdown-menu-${alignment}`);
|
|
8802
|
-
}
|
|
8803
|
-
return classNames;
|
|
8804
|
-
};
|
|
8805
6986
|
return () => vue.h(props.component, {
|
|
8806
|
-
class: [
|
|
8807
|
-
'dropdown-menu',
|
|
8808
|
-
{ 'dropdown-menu-dark': dark, show: visible.value },
|
|
8809
|
-
alignmentClassNames(alignment),
|
|
8810
|
-
],
|
|
6987
|
+
class: ['dropdown-menu', { show: visible.value }, getAlignmentClassNames(alignment)],
|
|
8811
6988
|
...((typeof alignment === 'object' || !popper) && {
|
|
8812
6989
|
'data-coreui-popper': 'static',
|
|
8813
6990
|
}),
|
|
6991
|
+
...(dark && { 'data-coreui-theme': 'dark' }),
|
|
8814
6992
|
ref: dropdownMenuRef,
|
|
8815
6993
|
}, props.component === 'ul'
|
|
8816
6994
|
? slots.default && slots.default().map((vnode) => vue.h('li', {}, vnode))
|
|
@@ -8821,10 +6999,6 @@ const CDropdownMenu = vue.defineComponent({
|
|
|
8821
6999
|
const CDropdownToggle = vue.defineComponent({
|
|
8822
7000
|
name: 'CDropdownToggle',
|
|
8823
7001
|
props: {
|
|
8824
|
-
/**
|
|
8825
|
-
* Toggle the active state for the component.
|
|
8826
|
-
*/
|
|
8827
|
-
active: Boolean,
|
|
8828
7002
|
/**
|
|
8829
7003
|
* Sets the color context of the component to one of CoreUI’s themed colors.
|
|
8830
7004
|
*
|
|
@@ -8853,6 +7027,15 @@ const CDropdownToggle = vue.defineComponent({
|
|
|
8853
7027
|
* Toggle the disabled state for the component.
|
|
8854
7028
|
*/
|
|
8855
7029
|
disabled: Boolean,
|
|
7030
|
+
/**
|
|
7031
|
+
* If a dropdown `variant` is set to `nav-item` then render the toggler as a link instead of a button.
|
|
7032
|
+
*
|
|
7033
|
+
* @since v5.0.0-alpha.1
|
|
7034
|
+
*/
|
|
7035
|
+
navLink: {
|
|
7036
|
+
type: Boolean,
|
|
7037
|
+
default: true,
|
|
7038
|
+
},
|
|
8856
7039
|
/**
|
|
8857
7040
|
* @values 'rounded', 'rounded-top', 'rounded-end', 'rounded-bottom', 'rounded-start', 'rounded-circle', 'rounded-pill', 'rounded-0', 'rounded-1', 'rounded-2', 'rounded-3'
|
|
8858
7041
|
*/
|
|
@@ -8899,17 +7082,10 @@ const CDropdownToggle = vue.defineComponent({
|
|
|
8899
7082
|
const dropdownVariant = vue.inject('variant');
|
|
8900
7083
|
const visible = vue.inject('visible');
|
|
8901
7084
|
const setVisible = vue.inject('setVisible');
|
|
8902
|
-
const className = [
|
|
8903
|
-
{
|
|
8904
|
-
'dropdown-toggle': props.caret,
|
|
8905
|
-
'dropdown-toggle-split': props.split,
|
|
8906
|
-
active: props.active,
|
|
8907
|
-
disabled: props.disabled,
|
|
8908
|
-
},
|
|
8909
|
-
];
|
|
8910
7085
|
const triggers = {
|
|
8911
7086
|
...((props.trigger === 'click' || props.trigger.includes('click')) && {
|
|
8912
|
-
onClick: () => {
|
|
7087
|
+
onClick: (event) => {
|
|
7088
|
+
event.preventDefault();
|
|
8913
7089
|
if (props.disabled) {
|
|
8914
7090
|
return;
|
|
8915
7091
|
}
|
|
@@ -8931,6 +7107,19 @@ const CDropdownToggle = vue.defineComponent({
|
|
|
8931
7107
|
},
|
|
8932
7108
|
}),
|
|
8933
7109
|
};
|
|
7110
|
+
const togglerProps = vue.computed(() => {
|
|
7111
|
+
return {
|
|
7112
|
+
class: {
|
|
7113
|
+
'nav-link': dropdownVariant === 'nav-item' && props.navLink,
|
|
7114
|
+
'dropdown-toggle': props.caret,
|
|
7115
|
+
'dropdown-toggle-split': props.split,
|
|
7116
|
+
disabled: props.disabled,
|
|
7117
|
+
show: visible.value,
|
|
7118
|
+
},
|
|
7119
|
+
'aria-expanded': visible.value,
|
|
7120
|
+
...(!props.disabled && { ...triggers }),
|
|
7121
|
+
};
|
|
7122
|
+
});
|
|
8934
7123
|
vue.onMounted(() => {
|
|
8935
7124
|
if (togglerRef.value) {
|
|
8936
7125
|
dropdownToggleRef.value = togglerRef.value.$el;
|
|
@@ -8944,39 +7133,24 @@ const CDropdownToggle = vue.defineComponent({
|
|
|
8944
7133
|
},
|
|
8945
7134
|
...triggers,
|
|
8946
7135
|
}))
|
|
8947
|
-
: dropdownVariant === 'nav-item'
|
|
7136
|
+
: dropdownVariant === 'nav-item' && props.navLink
|
|
8948
7137
|
? vue.h('a', {
|
|
8949
|
-
active: props.active,
|
|
8950
|
-
class: [
|
|
8951
|
-
'nav-link',
|
|
8952
|
-
className,
|
|
8953
|
-
{
|
|
8954
|
-
show: visible.value,
|
|
8955
|
-
},
|
|
8956
|
-
],
|
|
8957
|
-
disabled: props.disabled,
|
|
8958
7138
|
href: '#',
|
|
7139
|
+
...togglerProps.value,
|
|
7140
|
+
role: 'button',
|
|
8959
7141
|
ref: dropdownToggleRef,
|
|
8960
|
-
...triggers,
|
|
8961
7142
|
}, { default: () => slots.default && slots.default() })
|
|
8962
7143
|
: vue.h(CButton, {
|
|
8963
|
-
|
|
8964
|
-
className,
|
|
8965
|
-
{
|
|
8966
|
-
show: visible.value,
|
|
8967
|
-
},
|
|
8968
|
-
],
|
|
8969
|
-
active: props.active,
|
|
7144
|
+
...togglerProps.value,
|
|
8970
7145
|
color: props.color,
|
|
7146
|
+
component: props.component,
|
|
8971
7147
|
disabled: props.disabled,
|
|
8972
|
-
ref: (el) => {
|
|
8973
|
-
togglerRef.value = el;
|
|
8974
|
-
},
|
|
8975
7148
|
shape: props.shape,
|
|
8976
7149
|
size: props.size,
|
|
8977
|
-
...triggers,
|
|
8978
|
-
...(props.component === 'button' && { type: 'button' }),
|
|
8979
7150
|
variant: props.variant,
|
|
7151
|
+
ref: (el) => {
|
|
7152
|
+
togglerRef.value = el;
|
|
7153
|
+
},
|
|
8980
7154
|
}, () => props.split
|
|
8981
7155
|
? vue.h('span', { class: 'visually-hidden' }, 'Toggle Dropdown')
|
|
8982
7156
|
: slots.default && slots.default());
|
|
@@ -9221,7 +7395,7 @@ const CFormCheck = vue.defineComponent({
|
|
|
9221
7395
|
/**
|
|
9222
7396
|
* Use in conjunction with the v-model directive to specify the value that should be assigned to the bound variable when the checkbox is in the `false` state.
|
|
9223
7397
|
*
|
|
9224
|
-
* @since 4.
|
|
7398
|
+
* @since 4.10.0
|
|
9225
7399
|
*/
|
|
9226
7400
|
falseValue: String,
|
|
9227
7401
|
/**
|
|
@@ -9294,7 +7468,7 @@ const CFormCheck = vue.defineComponent({
|
|
|
9294
7468
|
/**
|
|
9295
7469
|
* Use in conjunction with the v-model directive to specify the value that should be assigned to the bound variable when the checkbox is in the `true` state.
|
|
9296
7470
|
*
|
|
9297
|
-
* @since 4.
|
|
7471
|
+
* @since 4.10.0
|
|
9298
7472
|
*/
|
|
9299
7473
|
trueValue: String,
|
|
9300
7474
|
/**
|
|
@@ -9380,7 +7554,7 @@ const CFormCheck = vue.defineComponent({
|
|
|
9380
7554
|
const formControl = () => {
|
|
9381
7555
|
return vue.h('input', {
|
|
9382
7556
|
...attrs,
|
|
9383
|
-
...(props.modelValue
|
|
7557
|
+
...((props.modelValue || props.value) && { checked: isChecked.value }),
|
|
9384
7558
|
class: inputClassName,
|
|
9385
7559
|
id: props.id,
|
|
9386
7560
|
indeterminate: props.indeterminate,
|
|
@@ -10737,6 +8911,15 @@ const CModal = vue.defineComponent({
|
|
|
10737
8911
|
* A string of all className you want applied to the modal content component.
|
|
10738
8912
|
*/
|
|
10739
8913
|
contentClassName: String,
|
|
8914
|
+
/**
|
|
8915
|
+
* Puts the focus on the modal when shown.
|
|
8916
|
+
*
|
|
8917
|
+
* @since v5.0.0-alpha.1
|
|
8918
|
+
*/
|
|
8919
|
+
focus: {
|
|
8920
|
+
type: Boolean,
|
|
8921
|
+
default: true,
|
|
8922
|
+
},
|
|
10740
8923
|
/**
|
|
10741
8924
|
* Set modal to covers the entire user viewport
|
|
10742
8925
|
*
|
|
@@ -10810,6 +8993,7 @@ const CModal = vue.defineComponent({
|
|
|
10810
8993
|
'show',
|
|
10811
8994
|
],
|
|
10812
8995
|
setup(props, { slots, attrs, emit }) {
|
|
8996
|
+
const activeElementRef = vue.ref();
|
|
10813
8997
|
const modalRef = vue.ref();
|
|
10814
8998
|
const modalContentRef = vue.ref();
|
|
10815
8999
|
const visible = vue.ref(props.visible);
|
|
@@ -10817,6 +9001,7 @@ const CModal = vue.defineComponent({
|
|
|
10817
9001
|
visible.value = props.visible;
|
|
10818
9002
|
});
|
|
10819
9003
|
const handleEnter = (el, done) => {
|
|
9004
|
+
activeElementRef.value = document.activeElement;
|
|
10820
9005
|
executeAfterTransition(() => done(), el);
|
|
10821
9006
|
document.body.classList.add('modal-open');
|
|
10822
9007
|
document.body.style.overflow = 'hidden';
|
|
@@ -10828,6 +9013,7 @@ const CModal = vue.defineComponent({
|
|
|
10828
9013
|
emit('show');
|
|
10829
9014
|
};
|
|
10830
9015
|
const handleAfterEnter = () => {
|
|
9016
|
+
props.focus && modalRef.value?.focus();
|
|
10831
9017
|
window.addEventListener('mousedown', handleMouseDown);
|
|
10832
9018
|
window.addEventListener('keyup', handleKeyUp);
|
|
10833
9019
|
};
|
|
@@ -10843,6 +9029,7 @@ const CModal = vue.defineComponent({
|
|
|
10843
9029
|
el.classList.remove('show');
|
|
10844
9030
|
};
|
|
10845
9031
|
const handleAfterLeave = (el) => {
|
|
9032
|
+
activeElementRef.value?.focus();
|
|
10846
9033
|
window.removeEventListener('mousedown', handleMouseDown);
|
|
10847
9034
|
window.removeEventListener('keyup', handleKeyUp);
|
|
10848
9035
|
el.style.display = 'none';
|
|
@@ -10883,6 +9070,7 @@ const CModal = vue.defineComponent({
|
|
|
10883
9070
|
};
|
|
10884
9071
|
vue.provide('handleDismiss', handleDismiss);
|
|
10885
9072
|
const modal = () => vue.h('div', {
|
|
9073
|
+
...attrs,
|
|
10886
9074
|
class: [
|
|
10887
9075
|
'modal',
|
|
10888
9076
|
{
|
|
@@ -10890,6 +9078,7 @@ const CModal = vue.defineComponent({
|
|
|
10890
9078
|
},
|
|
10891
9079
|
attrs.class,
|
|
10892
9080
|
],
|
|
9081
|
+
...(visible.value ? { 'aria-modal': true, role: 'dialog' } : { 'aria-hidden': 'true' }),
|
|
10893
9082
|
ref: modalRef,
|
|
10894
9083
|
}, vue.h('div', {
|
|
10895
9084
|
class: [
|
|
@@ -10902,7 +9091,6 @@ const CModal = vue.defineComponent({
|
|
|
10902
9091
|
[`modal-${props.size}`]: props.size,
|
|
10903
9092
|
},
|
|
10904
9093
|
],
|
|
10905
|
-
role: 'dialog',
|
|
10906
9094
|
}, vue.h('div', { class: ['modal-content', props.contentClassName], ref: modalContentRef }, slots.default && slots.default())));
|
|
10907
9095
|
return () => [
|
|
10908
9096
|
vue.h(vue.Transition, {
|
|
@@ -11114,8 +9302,8 @@ const CVirtualScrollerPlugin = {
|
|
|
11114
9302
|
},
|
|
11115
9303
|
};
|
|
11116
9304
|
|
|
11117
|
-
const createOption = (
|
|
11118
|
-
const value =
|
|
9305
|
+
const createOption = (label, options) => {
|
|
9306
|
+
const value = label.toLowerCase().replace(/\s/g, '-');
|
|
11119
9307
|
let uniqueValue = value;
|
|
11120
9308
|
let i = 1;
|
|
11121
9309
|
while (options.some((option) => String(option.value) === uniqueValue)) {
|
|
@@ -11125,7 +9313,7 @@ const createOption = (text, options) => {
|
|
|
11125
9313
|
return [
|
|
11126
9314
|
{
|
|
11127
9315
|
value: uniqueValue,
|
|
11128
|
-
|
|
9316
|
+
label,
|
|
11129
9317
|
custom: true,
|
|
11130
9318
|
},
|
|
11131
9319
|
];
|
|
@@ -11135,8 +9323,8 @@ const filterOptionsList = (search, _options) => {
|
|
|
11135
9323
|
const optionsList = [];
|
|
11136
9324
|
for (const option of _options) {
|
|
11137
9325
|
const options = option.options &&
|
|
11138
|
-
option.options.filter((option) => option.
|
|
11139
|
-
if ((option.
|
|
9326
|
+
option.options.filter((option) => option.label && option.label.toLowerCase().includes(search.toLowerCase()));
|
|
9327
|
+
if ((option.label && option.label.toLowerCase().includes(search.toLowerCase())) ||
|
|
11140
9328
|
(options && options.length > 0)) {
|
|
11141
9329
|
optionsList.push(Object.assign({}, option, options && options.length > 0 && { options }));
|
|
11142
9330
|
}
|
|
@@ -11280,7 +9468,7 @@ const CMultiSelectOptions = vue.defineComponent({
|
|
|
11280
9468
|
tabindex: 0,
|
|
11281
9469
|
}, props.scopedSlots && props.scopedSlots['options']
|
|
11282
9470
|
? vue.h(props.scopedSlots['options'], { option: option })
|
|
11283
|
-
: option.
|
|
9471
|
+
: option.label)
|
|
11284
9472
|
: [
|
|
11285
9473
|
vue.h('div', { class: 'form-multi-select-optgroup-label' }, props.scopedSlots && props.scopedSlots['options-groups']
|
|
11286
9474
|
? vue.h(props.scopedSlots['options-groups'], { option: option })
|
|
@@ -11359,7 +9547,7 @@ const CMultiSelectSelection = vue.defineComponent({
|
|
|
11359
9547
|
props.selected.map((option) => {
|
|
11360
9548
|
if (props.selectionType === 'tags') {
|
|
11361
9549
|
return vue.h('span', { class: 'form-multi-select-tag' }, [
|
|
11362
|
-
option.
|
|
9550
|
+
option.label,
|
|
11363
9551
|
!option.disabled &&
|
|
11364
9552
|
vue.h('button', {
|
|
11365
9553
|
class: 'form-multi-select-tag-delete',
|
|
@@ -11372,8 +9560,8 @@ const CMultiSelectSelection = vue.defineComponent({
|
|
|
11372
9560
|
}),
|
|
11373
9561
|
props.multiple &&
|
|
11374
9562
|
props.selectionType === 'text' &&
|
|
11375
|
-
props.selected.map((option, index) => vue.h('span', `${option.
|
|
11376
|
-
!props.multiple && !props.search && props.selected.map((option) => option.
|
|
9563
|
+
props.selected.map((option, index) => vue.h('span', `${option.label}${index === props.selected.length - 1 ? '' : ','}\xA0`)),
|
|
9564
|
+
!props.multiple && !props.search && props.selected.map((option) => option.label)[0],
|
|
11377
9565
|
slots.default && slots.default(),
|
|
11378
9566
|
]);
|
|
11379
9567
|
},
|
|
@@ -11652,7 +9840,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11652
9840
|
const flattenedOptions = vue.computed(() => flattenOptionsArray(props.options));
|
|
11653
9841
|
const userOption = vue.computed(() => {
|
|
11654
9842
|
if (props.allowCreateOptions &&
|
|
11655
|
-
filteredOptions.value.some((option) => option.
|
|
9843
|
+
filteredOptions.value.some((option) => option.label && option.label.toLowerCase() === searchValue.value.toLowerCase())) {
|
|
11656
9844
|
return false;
|
|
11657
9845
|
}
|
|
11658
9846
|
return searchRef.value && createOption(String(searchValue.value), flattenedOptions.value);
|
|
@@ -11744,7 +9932,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11744
9932
|
if (!userOption.value) {
|
|
11745
9933
|
selected.value = [
|
|
11746
9934
|
...selected.value,
|
|
11747
|
-
filteredOptions.value.find((option) => String(option.
|
|
9935
|
+
filteredOptions.value.find((option) => String(option.label).toLowerCase() === searchValue.value.toLowerCase()),
|
|
11748
9936
|
];
|
|
11749
9937
|
}
|
|
11750
9938
|
if (userOption.value) {
|
|
@@ -11769,7 +9957,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11769
9957
|
};
|
|
11770
9958
|
const handleOptionClick = (option) => {
|
|
11771
9959
|
if (!props.multiple) {
|
|
11772
|
-
selected.value = [
|
|
9960
|
+
selected.value = [option];
|
|
11773
9961
|
visible.value = false;
|
|
11774
9962
|
if (searchRef.value) {
|
|
11775
9963
|
searchRef.value.value = '';
|
|
@@ -11790,10 +9978,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11790
9978
|
selected.value = selected.value.filter((_option) => _option.value !== option.value);
|
|
11791
9979
|
}
|
|
11792
9980
|
else {
|
|
11793
|
-
selected.value = [
|
|
11794
|
-
...selected.value,
|
|
11795
|
-
{ value: option.value, text: option.text },
|
|
11796
|
-
];
|
|
9981
|
+
selected.value = [...selected.value, option];
|
|
11797
9982
|
}
|
|
11798
9983
|
};
|
|
11799
9984
|
const handleSelectAll = () => {
|
|
@@ -11878,7 +10063,7 @@ const CMultiSelect = vue.defineComponent({
|
|
|
11878
10063
|
}),
|
|
11879
10064
|
...(selected.value.length > 0 &&
|
|
11880
10065
|
!props.multiple && {
|
|
11881
|
-
placeholder: selected.value.map((option) => option.
|
|
10066
|
+
placeholder: selected.value.map((option) => option.label)[0],
|
|
11882
10067
|
}),
|
|
11883
10068
|
...(props.multiple &&
|
|
11884
10069
|
selected.value.length > 0 &&
|
|
@@ -12261,13 +10446,13 @@ const CNavbar = vue.defineComponent({
|
|
|
12261
10446
|
'navbar',
|
|
12262
10447
|
{
|
|
12263
10448
|
[`bg-${props.color}`]: props.color,
|
|
12264
|
-
[`navbar-${props.colorScheme}`]: props.colorScheme,
|
|
12265
10449
|
[typeof props.expand === 'boolean'
|
|
12266
10450
|
? 'navbar-expand'
|
|
12267
10451
|
: `navbar-expand-${props.expand}`]: props.expand,
|
|
12268
10452
|
},
|
|
12269
10453
|
props.placement,
|
|
12270
10454
|
],
|
|
10455
|
+
...(props.colorScheme && { 'data-coreui-theme': props.colorScheme }),
|
|
12271
10456
|
}, props.container
|
|
12272
10457
|
? vue.h('div', { class: [`container${props.container === true ? '' : '-' + props.container}`] }, slots.default && slots.default())
|
|
12273
10458
|
: slots.default && slots.default());
|
|
@@ -12364,6 +10549,10 @@ const COffcanvas = vue.defineComponent({
|
|
|
12364
10549
|
return false;
|
|
12365
10550
|
},
|
|
12366
10551
|
},
|
|
10552
|
+
/**
|
|
10553
|
+
* Sets a darker color scheme.
|
|
10554
|
+
*/
|
|
10555
|
+
dark: Boolean,
|
|
12367
10556
|
/**
|
|
12368
10557
|
* Closes the offcanvas when escape key is pressed.
|
|
12369
10558
|
*/
|
|
@@ -12479,6 +10668,7 @@ const COffcanvas = vue.defineComponent({
|
|
|
12479
10668
|
};
|
|
12480
10669
|
return () => [
|
|
12481
10670
|
vue.h(vue.Transition, {
|
|
10671
|
+
appear: visible.value,
|
|
12482
10672
|
css: false,
|
|
12483
10673
|
onEnter: (el, done) => handleEnter(el, done),
|
|
12484
10674
|
onAfterEnter: () => handleAfterEnter(),
|
|
@@ -12495,6 +10685,7 @@ const COffcanvas = vue.defineComponent({
|
|
|
12495
10685
|
ref: offcanvasRef,
|
|
12496
10686
|
role: 'dialog',
|
|
12497
10687
|
tabindex: -1,
|
|
10688
|
+
...(props.dark && { 'data-coreui-theme': 'dark' }),
|
|
12498
10689
|
}, slots.default && slots.default()), [[vVisible, props.visible]])),
|
|
12499
10690
|
props.backdrop &&
|
|
12500
10691
|
vue.h(CBackdrop, {
|
|
@@ -12771,6 +10962,7 @@ const CProgressBar = vue.defineComponent({
|
|
|
12771
10962
|
},
|
|
12772
10963
|
},
|
|
12773
10964
|
setup(props, { slots }) {
|
|
10965
|
+
const stacked = vue.inject('stacked', false);
|
|
12774
10966
|
return () => vue.h('div', {
|
|
12775
10967
|
class: [
|
|
12776
10968
|
'progress-bar',
|
|
@@ -12780,11 +10972,7 @@ const CProgressBar = vue.defineComponent({
|
|
|
12780
10972
|
['progress-bar-animated']: props.animated,
|
|
12781
10973
|
},
|
|
12782
10974
|
],
|
|
12783
|
-
|
|
12784
|
-
style: `width: ${props.value}%`,
|
|
12785
|
-
'aria-valuenow': props.value,
|
|
12786
|
-
'aria-valuemin': '0',
|
|
12787
|
-
'aria-valuemax': '100',
|
|
10975
|
+
...(!stacked && { style: { width: `${props.value}%` } }),
|
|
12788
10976
|
}, slots.default && slots.default());
|
|
12789
10977
|
},
|
|
12790
10978
|
});
|
|
@@ -12792,21 +10980,55 @@ const CProgressBar = vue.defineComponent({
|
|
|
12792
10980
|
const CProgress = vue.defineComponent({
|
|
12793
10981
|
name: 'CProgress',
|
|
12794
10982
|
props: {
|
|
10983
|
+
/**
|
|
10984
|
+
* Use to animate the stripes right to left via CSS3 animations.
|
|
10985
|
+
*/
|
|
10986
|
+
animated: Boolean,
|
|
10987
|
+
/**
|
|
10988
|
+
* Sets the color context of the component to one of CoreUI’s themed colors.
|
|
10989
|
+
*
|
|
10990
|
+
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
10991
|
+
*/
|
|
10992
|
+
color: Color$1,
|
|
12795
10993
|
/**
|
|
12796
10994
|
* Sets the height of the component. If you set that value the inner `<CProgressBar>` will automatically resize accordingly.
|
|
12797
10995
|
*/
|
|
12798
10996
|
height: Number,
|
|
10997
|
+
/**
|
|
10998
|
+
* A string of all className you want applied to the <CProgressBar/> component.
|
|
10999
|
+
*
|
|
11000
|
+
* @since 5.0.0-alpha.1
|
|
11001
|
+
*/
|
|
11002
|
+
progressBarClassName: String,
|
|
12799
11003
|
/**
|
|
12800
11004
|
* Makes progress bar thinner.
|
|
12801
11005
|
*/
|
|
12802
11006
|
thin: Boolean,
|
|
11007
|
+
/**
|
|
11008
|
+
* The percent to progress the ProgressBar.
|
|
11009
|
+
*/
|
|
11010
|
+
value: {
|
|
11011
|
+
type: Number,
|
|
11012
|
+
default: 0,
|
|
11013
|
+
},
|
|
11014
|
+
/**
|
|
11015
|
+
* Set the progress bar variant to optional striped.
|
|
11016
|
+
*
|
|
11017
|
+
* @values 'striped'
|
|
11018
|
+
*/
|
|
11019
|
+
variant: {
|
|
11020
|
+
type: String,
|
|
11021
|
+
validator: (value) => {
|
|
11022
|
+
return value === 'striped';
|
|
11023
|
+
},
|
|
11024
|
+
},
|
|
12803
11025
|
/**
|
|
12804
11026
|
* Change the default color to white.
|
|
12805
11027
|
*/
|
|
12806
11028
|
white: Boolean,
|
|
12807
|
-
...CProgressBar.props,
|
|
12808
11029
|
},
|
|
12809
11030
|
setup(props, { slots }) {
|
|
11031
|
+
const stacked = vue.inject('stacked', false);
|
|
12810
11032
|
return () => vue.h('div', {
|
|
12811
11033
|
class: [
|
|
12812
11034
|
'progress',
|
|
@@ -12815,15 +11037,49 @@ const CProgress = vue.defineComponent({
|
|
|
12815
11037
|
'progress-white': props.white,
|
|
12816
11038
|
},
|
|
12817
11039
|
],
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
11040
|
+
style: {
|
|
11041
|
+
...(props.height ? { height: `${props.height}px` } : {}),
|
|
11042
|
+
...(stacked ? { width: `${props.value}%` } : {}),
|
|
11043
|
+
},
|
|
11044
|
+
...(props.value !== undefined && {
|
|
11045
|
+
role: 'progressbar',
|
|
11046
|
+
'aria-valuenow': props.value,
|
|
11047
|
+
'aria-valuemin': 0,
|
|
11048
|
+
'aria-valuemax': 100,
|
|
11049
|
+
}),
|
|
11050
|
+
},
|
|
11051
|
+
// @ts-expect-error name is defined in component
|
|
11052
|
+
slots.default && slots.default().some((vnode) => vnode.type.name === 'CProgressBar')
|
|
11053
|
+
? slots.default().map((vnode) => {
|
|
11054
|
+
// @ts-expect-error name is defined in component
|
|
11055
|
+
if (vnode.type.name === 'CProgressBar') {
|
|
11056
|
+
return vue.h(vnode, {
|
|
11057
|
+
...(props.animated && { animated: props.animated }),
|
|
11058
|
+
...(props.color && { color: props.color }),
|
|
11059
|
+
...(props.value && { value: props.value }),
|
|
11060
|
+
...(props.variant && { variant: props.variant }),
|
|
11061
|
+
});
|
|
11062
|
+
}
|
|
11063
|
+
return vnode;
|
|
11064
|
+
})
|
|
11065
|
+
: vue.h(CProgressBar, {
|
|
11066
|
+
...(props.progressBarClassName && { class: props.progressBarClassName }),
|
|
12822
11067
|
animated: props.animated,
|
|
12823
11068
|
color: props.color,
|
|
11069
|
+
value: props.value,
|
|
12824
11070
|
variant: props.variant,
|
|
12825
|
-
}, slots.default && slots.default())
|
|
12826
|
-
|
|
11071
|
+
}, () => slots.default && slots.default()));
|
|
11072
|
+
},
|
|
11073
|
+
});
|
|
11074
|
+
|
|
11075
|
+
const CProgressStacked = vue.defineComponent({
|
|
11076
|
+
name: 'CProgressStacked',
|
|
11077
|
+
props: {},
|
|
11078
|
+
setup(_, { slots }) {
|
|
11079
|
+
vue.provide('stacked', true);
|
|
11080
|
+
return () => vue.h('div', {
|
|
11081
|
+
class: 'progress-stacked',
|
|
11082
|
+
}, slots.default && slots.default());
|
|
12827
11083
|
},
|
|
12828
11084
|
});
|
|
12829
11085
|
|
|
@@ -12831,6 +11087,7 @@ const CProgressPlugin = {
|
|
|
12831
11087
|
install: (app) => {
|
|
12832
11088
|
app.component(CProgress.name, CProgress);
|
|
12833
11089
|
app.component(CProgressBar.name, CProgressBar);
|
|
11090
|
+
app.component(CProgressStacked.name, CProgressStacked);
|
|
12834
11091
|
},
|
|
12835
11092
|
};
|
|
12836
11093
|
|
|
@@ -13198,7 +11455,7 @@ const CSidebar = vue.defineComponent({
|
|
|
13198
11455
|
}, slots.default && slots.default()),
|
|
13199
11456
|
mobile.value &&
|
|
13200
11457
|
vue.h(CBackdrop, {
|
|
13201
|
-
class: 'sidebar-backdrop
|
|
11458
|
+
class: 'sidebar-backdrop',
|
|
13202
11459
|
visible: props.visible,
|
|
13203
11460
|
onClick: () => handleHide(),
|
|
13204
11461
|
}),
|
|
@@ -13412,9 +11669,13 @@ const CSmartPagination = vue.defineComponent({
|
|
|
13412
11669
|
const activePage = vue.ref(props.activePage);
|
|
13413
11670
|
const limit = vue.ref(props.limit);
|
|
13414
11671
|
const pages = vue.ref(props.pages);
|
|
13415
|
-
vue.watch(props, () => {
|
|
11672
|
+
vue.watch(() => props.activePage, () => {
|
|
13416
11673
|
activePage.value = props.activePage;
|
|
11674
|
+
});
|
|
11675
|
+
vue.watch(() => props.limit, () => {
|
|
13417
11676
|
limit.value = props.limit;
|
|
11677
|
+
});
|
|
11678
|
+
vue.watch(() => props.pages, () => {
|
|
13418
11679
|
pages.value = props.pages;
|
|
13419
11680
|
});
|
|
13420
11681
|
const showDots = vue.computed(() => {
|
|
@@ -14178,11 +12439,11 @@ const filterTable = (items, tableFilter, tableFilterState, itemsDataColumns) =>
|
|
|
14178
12439
|
});
|
|
14179
12440
|
return items;
|
|
14180
12441
|
};
|
|
14181
|
-
const getClickedColumnName = (target, columnNames) => {
|
|
12442
|
+
const getClickedColumnName = (target, columnNames, selectable) => {
|
|
14182
12443
|
const closest = target.closest('tr');
|
|
14183
12444
|
const children = closest ? Array.from(closest.children) : [];
|
|
14184
12445
|
const clickedCell = children.filter((child) => child.contains(target))[0];
|
|
14185
|
-
return columnNames[children.indexOf(clickedCell)];
|
|
12446
|
+
return selectable ? columnNames[children.indexOf(clickedCell) - 1] : columnNames[children.indexOf(clickedCell)];
|
|
14186
12447
|
};
|
|
14187
12448
|
const getColumnKey = (column) => typeof column === 'object' ? column.key : column;
|
|
14188
12449
|
const getColumnLabel = (column) => typeof column === 'object'
|
|
@@ -14190,6 +12451,12 @@ const getColumnLabel = (column) => typeof column === 'object'
|
|
|
14190
12451
|
? column.label
|
|
14191
12452
|
: pretifyName(column.key)
|
|
14192
12453
|
: pretifyName(column);
|
|
12454
|
+
const getColumnName = (column) => {
|
|
12455
|
+
if (typeof column === 'object') {
|
|
12456
|
+
return column.key;
|
|
12457
|
+
}
|
|
12458
|
+
return column;
|
|
12459
|
+
};
|
|
14193
12460
|
const getColumnNames = (columns, items) => {
|
|
14194
12461
|
if (columns) {
|
|
14195
12462
|
const _columns = [];
|
|
@@ -14295,13 +12562,32 @@ const getColumnSorterState = (key, sorterState) => {
|
|
|
14295
12562
|
const getColumnValues = (items, key) => {
|
|
14296
12563
|
return items.map((item) => item[key]);
|
|
14297
12564
|
};
|
|
14298
|
-
const getTableDataCellProps = (item, colName) => {
|
|
14299
|
-
const props =
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
}
|
|
12565
|
+
const getTableDataCellProps = (column, item, colName) => {
|
|
12566
|
+
const props = {};
|
|
12567
|
+
if (typeof column === 'object' && column._colProps) {
|
|
12568
|
+
Object.assign(props, column._colProps);
|
|
12569
|
+
}
|
|
12570
|
+
if (item._cellProps && item._cellProps['all']) {
|
|
12571
|
+
Object.assign(props, item._cellProps['all']);
|
|
12572
|
+
}
|
|
12573
|
+
if (item._cellProps && item._cellProps[colName]) {
|
|
12574
|
+
Object.assign(props, item._cellProps[colName]);
|
|
12575
|
+
}
|
|
14303
12576
|
return props;
|
|
14304
12577
|
};
|
|
12578
|
+
const getTableDataCellStyles = (column, item, colName) => {
|
|
12579
|
+
const styles = {};
|
|
12580
|
+
if (typeof column === 'object' && column._colStyle) {
|
|
12581
|
+
Object.assign(styles, column._colStyle);
|
|
12582
|
+
}
|
|
12583
|
+
if (item._cellStyle && item._cellStyle['all']) {
|
|
12584
|
+
Object.assign(styles, item._cellStyle['all']);
|
|
12585
|
+
}
|
|
12586
|
+
if (item._cellStyle && item._cellStyle[colName]) {
|
|
12587
|
+
Object.assign(styles, item._cellStyle[colName]);
|
|
12588
|
+
}
|
|
12589
|
+
return styles;
|
|
12590
|
+
};
|
|
14305
12591
|
const getTableHeaderCellProps = (column) => {
|
|
14306
12592
|
if (typeof column === 'object' && column._props) {
|
|
14307
12593
|
return column._props;
|
|
@@ -14367,6 +12653,11 @@ const CSmartTableBody = vue.defineComponent({
|
|
|
14367
12653
|
default: () => [],
|
|
14368
12654
|
require: true,
|
|
14369
12655
|
},
|
|
12656
|
+
columns: {
|
|
12657
|
+
type: Array,
|
|
12658
|
+
default: () => [],
|
|
12659
|
+
require: true,
|
|
12660
|
+
},
|
|
14370
12661
|
currentItems: {
|
|
14371
12662
|
type: Array,
|
|
14372
12663
|
default: () => [],
|
|
@@ -14383,9 +12674,7 @@ const CSmartTableBody = vue.defineComponent({
|
|
|
14383
12674
|
},
|
|
14384
12675
|
emits: ['rowChecked', 'rowClick'],
|
|
14385
12676
|
setup(props, { emit }) {
|
|
14386
|
-
const colspan = props.selectable
|
|
14387
|
-
? props.columnNames.length + 1
|
|
14388
|
-
: props.columnNames.length;
|
|
12677
|
+
const colspan = props.selectable ? props.columns.length + 1 : props.columns.length;
|
|
14389
12678
|
return () => vue.h(CTableBody, {
|
|
14390
12679
|
...(props.clickableRows && { style: 'cursor:pointer;' }),
|
|
14391
12680
|
}, {
|
|
@@ -14395,7 +12684,7 @@ const CSmartTableBody = vue.defineComponent({
|
|
|
14395
12684
|
...(item._props && { ...item._props }),
|
|
14396
12685
|
...(props.clickableRows && { tabindex: 0 }),
|
|
14397
12686
|
onClick: (event) => {
|
|
14398
|
-
emit('rowClick', item, trIndex + props.firstItemOnActivePageIndex, getClickedColumnName(event.target, props.columnNames), event);
|
|
12687
|
+
emit('rowClick', item, trIndex + props.firstItemOnActivePageIndex, getClickedColumnName(event.target, props.columnNames, props.selectable), event);
|
|
14399
12688
|
},
|
|
14400
12689
|
}, {
|
|
14401
12690
|
default: () => [
|
|
@@ -14411,16 +12700,20 @@ const CSmartTableBody = vue.defineComponent({
|
|
|
14411
12700
|
emit('rowChecked', item, event.target.checked);
|
|
14412
12701
|
},
|
|
14413
12702
|
})),
|
|
14414
|
-
props.
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
vue.h(
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
12703
|
+
props.columns.map((column) => {
|
|
12704
|
+
const colName = getColumnName(column);
|
|
12705
|
+
return props.scopedSlots &&
|
|
12706
|
+
props.scopedSlots[colName] &&
|
|
12707
|
+
typeof props.scopedSlots[colName] === 'function'
|
|
12708
|
+
? vue.h(props.scopedSlots[colName], { item: item })
|
|
12709
|
+
: typeof item[colName] !== 'undefined' &&
|
|
12710
|
+
vue.h(CTableDataCell, {
|
|
12711
|
+
...getTableDataCellProps(column, item, colName),
|
|
12712
|
+
style: getTableDataCellStyles(column, item, colName),
|
|
12713
|
+
}, {
|
|
12714
|
+
default: () => String(item[colName]),
|
|
12715
|
+
});
|
|
12716
|
+
}),
|
|
14424
12717
|
],
|
|
14425
12718
|
}),
|
|
14426
12719
|
props.scopedSlots &&
|
|
@@ -14436,9 +12729,6 @@ const CSmartTableBody = vue.defineComponent({
|
|
|
14436
12729
|
vue.h(CTableRow, {
|
|
14437
12730
|
class: 'p-0',
|
|
14438
12731
|
key: `details${trIndex}`,
|
|
14439
|
-
onClick: (event) => {
|
|
14440
|
-
emit('rowClick', item, trIndex + props.firstItemOnActivePageIndex, getClickedColumnName(event.target, props.columnNames), true);
|
|
14441
|
-
},
|
|
14442
12732
|
}, {
|
|
14443
12733
|
default: () => vue.h(CTableDataCell, {
|
|
14444
12734
|
colspan: props.selectable
|
|
@@ -14532,60 +12822,84 @@ const CSmartTableHead = vue.defineComponent({
|
|
|
14532
12822
|
emit('selectAllChecked');
|
|
14533
12823
|
},
|
|
14534
12824
|
})),
|
|
14535
|
-
columns.value.map((column, index) =>
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
(
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
12825
|
+
columns.value.map((column, index) => {
|
|
12826
|
+
const isSortable = props.columnSorter &&
|
|
12827
|
+
(typeof column === 'object'
|
|
12828
|
+
? column.sorter === undefined
|
|
12829
|
+
? true
|
|
12830
|
+
: column.sorter
|
|
12831
|
+
: true);
|
|
12832
|
+
return vue.h(CTableHeaderCell, {
|
|
12833
|
+
...getTableHeaderCellProps(column),
|
|
12834
|
+
style: getTableHeaderCellStyles(column, props.columnSorter),
|
|
12835
|
+
...isSortable && {
|
|
12836
|
+
tabindex: 0,
|
|
12837
|
+
onClick: () => emit('sortClick', getColumnKey(column), index),
|
|
12838
|
+
onKeydown: (event) => {
|
|
12839
|
+
if (event.key === 'Enter') {
|
|
12840
|
+
emit('sortClick', getColumnKey(column), index);
|
|
12841
|
+
}
|
|
12842
|
+
if (event.key === 'ArrowUp') {
|
|
12843
|
+
event.preventDefault();
|
|
12844
|
+
emit('sortClick', getColumnKey(column), index, 'asc');
|
|
12845
|
+
}
|
|
12846
|
+
if (event.key === 'ArrowDown') {
|
|
12847
|
+
event.preventDefault();
|
|
12848
|
+
emit('sortClick', getColumnKey(column), index, 'desc');
|
|
12849
|
+
}
|
|
12850
|
+
},
|
|
12851
|
+
}
|
|
12852
|
+
}, {
|
|
12853
|
+
default: () => [
|
|
12854
|
+
vue.h('div', {
|
|
12855
|
+
class: 'd-inline',
|
|
12856
|
+
}, getColumnLabel(column)),
|
|
12857
|
+
props.columnSorter &&
|
|
12858
|
+
(typeof column === 'object'
|
|
12859
|
+
? typeof column.sorter === 'undefined'
|
|
12860
|
+
? true
|
|
12861
|
+
: column.sorter
|
|
12862
|
+
: true) &&
|
|
12863
|
+
columnSorterIcon(column),
|
|
12864
|
+
],
|
|
12865
|
+
});
|
|
12866
|
+
}),
|
|
14555
12867
|
],
|
|
14556
12868
|
}),
|
|
14557
12869
|
props.columnFilter &&
|
|
14558
12870
|
vue.h(CTableRow, {}, {
|
|
14559
12871
|
default: () => [
|
|
14560
12872
|
props.selectable && vue.h(CTableHeaderCell),
|
|
14561
|
-
columns.value.map((column) =>
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
?
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
? column.filter
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
props.columnFilterValue
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
12873
|
+
columns.value.map((column) => {
|
|
12874
|
+
return vue.h(CTableHeaderCell, {
|
|
12875
|
+
...getTableHeaderCellProps(column),
|
|
12876
|
+
}, {
|
|
12877
|
+
default: () => (typeof column === 'object'
|
|
12878
|
+
? column.filter === undefined
|
|
12879
|
+
? true
|
|
12880
|
+
: column.filter
|
|
12881
|
+
: true)
|
|
12882
|
+
? typeof column !== 'string' && typeof column.filter === 'function'
|
|
12883
|
+
? column.filter(getColumnValues(props.items, getColumnKey(column)), (value) => {
|
|
12884
|
+
emit('customFilterChange', getColumnKey(column), value);
|
|
12885
|
+
})
|
|
12886
|
+
: vue.h(CFormInput, {
|
|
12887
|
+
size: 'sm',
|
|
12888
|
+
onInput: (event) => {
|
|
12889
|
+
emit('filterInput', getColumnKey(column), event.target.value);
|
|
12890
|
+
},
|
|
12891
|
+
onChange: (event) => {
|
|
12892
|
+
emit('filterChange', getColumnKey(column), event.target.value);
|
|
12893
|
+
},
|
|
12894
|
+
'aria-label': `column name: '${getColumnLabel(column)}' filter input`,
|
|
12895
|
+
...(props.columnFilterValue &&
|
|
12896
|
+
props.columnFilterValue[getColumnKey(column)] && {
|
|
12897
|
+
value: props.columnFilterValue[getColumnKey(column)],
|
|
12898
|
+
}),
|
|
12899
|
+
})
|
|
12900
|
+
: '',
|
|
12901
|
+
});
|
|
12902
|
+
}),
|
|
14589
12903
|
],
|
|
14590
12904
|
}),
|
|
14591
12905
|
],
|
|
@@ -14714,8 +13028,6 @@ const CSmartTable = vue.defineComponent({
|
|
|
14714
13028
|
},
|
|
14715
13029
|
/**
|
|
14716
13030
|
* Adds select element over table, which is used for control items per page in pagination. If you want to customize this element, pass object with optional values:
|
|
14717
|
-
* - label (String) - replaces default label text
|
|
14718
|
-
* - values (Array) - custom array of pagination values
|
|
14719
13031
|
* - external (Boolean) - disables automatic 'itemsPerPage' change (use to change pages externaly by 'pagination-change' event).
|
|
14720
13032
|
*/
|
|
14721
13033
|
itemsPerPageSelect: {
|
|
@@ -14886,7 +13198,6 @@ const CSmartTable = vue.defineComponent({
|
|
|
14886
13198
|
return { ...item, _id: index };
|
|
14887
13199
|
}));
|
|
14888
13200
|
const itemsNumber = vue.ref(props.itemsNumber);
|
|
14889
|
-
// eslint-disable-next-line unicorn/explicit-length-check
|
|
14890
13201
|
const itemsPerPage = vue.ref(props.itemsPerPage || items.value.length);
|
|
14891
13202
|
const selected = vue.ref([]);
|
|
14892
13203
|
const selectedAll = vue.ref();
|
|
@@ -14915,8 +13226,9 @@ const CSmartTable = vue.defineComponent({
|
|
|
14915
13226
|
}
|
|
14916
13227
|
});
|
|
14917
13228
|
if (Array.isArray(props.items)) {
|
|
14918
|
-
items.value = props.items
|
|
14919
|
-
|
|
13229
|
+
items.value = props.items.map((item, index) => {
|
|
13230
|
+
return { ...item, _id: index };
|
|
13231
|
+
});
|
|
14920
13232
|
itemsNumber.value = props.itemsNumber || props.items.length;
|
|
14921
13233
|
}
|
|
14922
13234
|
}, {
|
|
@@ -14966,14 +13278,20 @@ const CSmartTable = vue.defineComponent({
|
|
|
14966
13278
|
activePage.value = 1;
|
|
14967
13279
|
}
|
|
14968
13280
|
});
|
|
14969
|
-
const handleSorterChange = (column, index) => {
|
|
13281
|
+
const handleSorterChange = (column, index, order) => {
|
|
14970
13282
|
if (!isSortable(index, props.columns, props.columnSorter, itemsDataColumns.value, columnNames.value)) {
|
|
14971
13283
|
return;
|
|
14972
13284
|
}
|
|
14973
13285
|
//if column changed or sort was descending change asc to true
|
|
14974
13286
|
const state = sorterState.value;
|
|
13287
|
+
if (order) {
|
|
13288
|
+
state.state = order;
|
|
13289
|
+
}
|
|
14975
13290
|
if (state.column === column) {
|
|
14976
|
-
if (
|
|
13291
|
+
if (order) {
|
|
13292
|
+
state.state = order;
|
|
13293
|
+
}
|
|
13294
|
+
else if (state.state === 0) {
|
|
14977
13295
|
state.state = 'asc';
|
|
14978
13296
|
}
|
|
14979
13297
|
else if (state.state === 'asc') {
|
|
@@ -14990,7 +13308,7 @@ const CSmartTable = vue.defineComponent({
|
|
|
14990
13308
|
}
|
|
14991
13309
|
else {
|
|
14992
13310
|
state.column = column;
|
|
14993
|
-
state.state = 'asc';
|
|
13311
|
+
state.state = order || 'asc';
|
|
14994
13312
|
}
|
|
14995
13313
|
sorterState.value.column = state.column;
|
|
14996
13314
|
sorterState.value.state = state.state;
|
|
@@ -15060,6 +13378,9 @@ const CSmartTable = vue.defineComponent({
|
|
|
15060
13378
|
const filteredColumns = vue.computed(() => filterColumns(items.value, props.columnFilter, columnFilterState.value, itemsDataColumns.value));
|
|
15061
13379
|
const filteredTable = vue.computed(() => filterTable(filteredColumns.value, props.tableFilter, tableFilterState.value, itemsDataColumns.value));
|
|
15062
13380
|
const sortedItems = vue.computed(() => sortItems(props.columnSorter, filteredTable.value, itemsDataColumns.value, sorterState.value));
|
|
13381
|
+
vue.watch(sortedItems, () => {
|
|
13382
|
+
emit('filteredItemsChange', sortedItems.value);
|
|
13383
|
+
});
|
|
15063
13384
|
const numberOfPages = vue.computed(() => itemsPerPage.value ? Math.ceil(sortedItems.value.length / itemsPerPage.value) : 1);
|
|
15064
13385
|
const firstItemOnActivePageIndex = vue.computed(() => activePage.value ? (activePage.value - 1) * itemsPerPage.value : 0);
|
|
15065
13386
|
const currentItems = vue.computed(() => activePage.value
|
|
@@ -15140,7 +13461,7 @@ const CSmartTable = vue.defineComponent({
|
|
|
15140
13461
|
onFilterInput: (key, value) => handleColumnFilterChange(key, value, 'input'),
|
|
15141
13462
|
onFilterChange: (key, value) => handleColumnFilterChange(key, value, 'change'),
|
|
15142
13463
|
onSelectAllChecked: () => handleSelectAllChecked(),
|
|
15143
|
-
onSortClick: (key, index) => handleSorterChange(key, index),
|
|
13464
|
+
onSortClick: (key, index, order) => handleSorterChange(key, index, order),
|
|
15144
13465
|
}, {
|
|
15145
13466
|
// @slot Sorter icon when items are unsorted.
|
|
15146
13467
|
sortingIcon: () => slots.sortingIcon
|
|
@@ -15160,7 +13481,7 @@ const CSmartTable = vue.defineComponent({
|
|
|
15160
13481
|
class: 'icon',
|
|
15161
13482
|
viewBox: '0 0 512 512',
|
|
15162
13483
|
role: 'img',
|
|
15163
|
-
innerHTML:
|
|
13484
|
+
innerHTML: cilArrowTop[1],
|
|
15164
13485
|
}),
|
|
15165
13486
|
// @slot Sorter icon when items are sorted descending.
|
|
15166
13487
|
sortingIconDescending: () => slots.sortingIconDescending
|
|
@@ -15170,12 +13491,13 @@ const CSmartTable = vue.defineComponent({
|
|
|
15170
13491
|
class: 'icon',
|
|
15171
13492
|
viewBox: '0 0 512 512',
|
|
15172
13493
|
role: 'img',
|
|
15173
|
-
innerHTML:
|
|
13494
|
+
innerHTML: cilArrowBottom[1],
|
|
15174
13495
|
}),
|
|
15175
13496
|
}),
|
|
15176
13497
|
vue.h(CSmartTableBody, {
|
|
15177
13498
|
clickableRows: props.clickableRows,
|
|
15178
13499
|
columnNames: columnNames.value,
|
|
13500
|
+
columns: props.columns ?? columnNames.value,
|
|
15179
13501
|
currentItems: currentItems.value,
|
|
15180
13502
|
firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
|
|
15181
13503
|
noItemsLabel: props.noItemsLabel,
|
|
@@ -15803,9 +14125,7 @@ const CWidgetStatsA = vue.defineComponent({
|
|
|
15803
14125
|
*/
|
|
15804
14126
|
setup(props, { slots }) {
|
|
15805
14127
|
return () => vue.h(CCard, {
|
|
15806
|
-
class: [
|
|
15807
|
-
{ [`bg-${props.color}`]: props.color, 'text-high-emphasis-inverse': props.color },
|
|
15808
|
-
],
|
|
14128
|
+
class: [{ [`bg-${props.color}`]: props.color, 'text-white': props.color }],
|
|
15809
14129
|
}, () => [
|
|
15810
14130
|
vue.h(CCardBody, {
|
|
15811
14131
|
class: 'pb-0 d-flex justify-content-between align-items-start',
|
|
@@ -15917,7 +14237,7 @@ const CWidgetStatsB = vue.defineComponent({
|
|
|
15917
14237
|
return () => vue.h(CCard, {
|
|
15918
14238
|
class: [
|
|
15919
14239
|
{
|
|
15920
|
-
'text-
|
|
14240
|
+
'text-white': props.inverse,
|
|
15921
14241
|
},
|
|
15922
14242
|
],
|
|
15923
14243
|
color: props.color,
|
|
@@ -15943,9 +14263,7 @@ const CWidgetStatsB = vue.defineComponent({
|
|
|
15943
14263
|
}),
|
|
15944
14264
|
(props.text || slots.text) &&
|
|
15945
14265
|
vue.h('small', {
|
|
15946
|
-
class: [
|
|
15947
|
-
props.inverse ? 'text-medium-emphasis-inverse' : 'text-medium-emphasis',
|
|
15948
|
-
],
|
|
14266
|
+
class: [props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary'],
|
|
15949
14267
|
}, {
|
|
15950
14268
|
default: () => (slots.text && slots.text()) || props.text,
|
|
15951
14269
|
}),
|
|
@@ -16013,7 +14331,7 @@ const CWidgetStatsC = vue.defineComponent({
|
|
|
16013
14331
|
vue.h('div', {
|
|
16014
14332
|
class: [
|
|
16015
14333
|
'text-end mb-4',
|
|
16016
|
-
props.inverse ? 'text-
|
|
14334
|
+
props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary',
|
|
16017
14335
|
],
|
|
16018
14336
|
}, slots.icon && slots.icon()),
|
|
16019
14337
|
(props.value || slots.value) &&
|
|
@@ -16026,7 +14344,7 @@ const CWidgetStatsC = vue.defineComponent({
|
|
|
16026
14344
|
vue.h('div', {
|
|
16027
14345
|
class: [
|
|
16028
14346
|
'text-uppercase fw-semibold small',
|
|
16029
|
-
props.inverse ? 'text-
|
|
14347
|
+
props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary',
|
|
16030
14348
|
],
|
|
16031
14349
|
}, {
|
|
16032
14350
|
default: () => (slots.title && slots.title()) || props.title,
|
|
@@ -16089,7 +14407,7 @@ const CWidgetStatsD = vue.defineComponent({
|
|
|
16089
14407
|
vue.h(CCol, {}, {
|
|
16090
14408
|
default: () => [
|
|
16091
14409
|
vue.h(CCol, { class: 'fs-5 fw-semibold' }, () => value.value),
|
|
16092
|
-
vue.h(CCol, { class: 'text-uppercase text-
|
|
14410
|
+
vue.h(CCol, { class: 'text-uppercase text-body-secondary small' }, () => value.title),
|
|
16093
14411
|
],
|
|
16094
14412
|
}),
|
|
16095
14413
|
]),
|
|
@@ -16125,7 +14443,7 @@ const CWidgetStatsE = vue.defineComponent({
|
|
|
16125
14443
|
}, () => [
|
|
16126
14444
|
(props.title || slots.title) &&
|
|
16127
14445
|
vue.h('div', {
|
|
16128
|
-
class: 'text-
|
|
14446
|
+
class: 'text-body-secondary small text-uppercase font-weight-bold',
|
|
16129
14447
|
}, {
|
|
16130
14448
|
default: () => (slots.title && slots.title()) || props.title,
|
|
16131
14449
|
}),
|
|
@@ -16201,7 +14519,7 @@ const CWidgetStatsF = vue.defineComponent({
|
|
|
16201
14519
|
}),
|
|
16202
14520
|
(props.title || slots.title) &&
|
|
16203
14521
|
vue.h('div', {
|
|
16204
|
-
class: 'text-
|
|
14522
|
+
class: 'text-body-secondary text-uppercase fw-semibold small',
|
|
16205
14523
|
}, {
|
|
16206
14524
|
default: () => (slots.title && slots.title()) || props.title,
|
|
16207
14525
|
}),
|
|
@@ -16360,6 +14678,7 @@ var Components = /*#__PURE__*/Object.freeze({
|
|
|
16360
14678
|
CProgress: CProgress,
|
|
16361
14679
|
CProgressBar: CProgressBar,
|
|
16362
14680
|
CProgressPlugin: CProgressPlugin,
|
|
14681
|
+
CProgressStacked: CProgressStacked,
|
|
16363
14682
|
CRow: CRow,
|
|
16364
14683
|
CSidebar: CSidebar,
|
|
16365
14684
|
CSidebarBrand: CSidebarBrand,
|
|
@@ -16752,6 +15071,7 @@ exports.CPopoverPlugin = CPopoverPlugin;
|
|
|
16752
15071
|
exports.CProgress = CProgress;
|
|
16753
15072
|
exports.CProgressBar = CProgressBar;
|
|
16754
15073
|
exports.CProgressPlugin = CProgressPlugin;
|
|
15074
|
+
exports.CProgressStacked = CProgressStacked;
|
|
16755
15075
|
exports.CRow = CRow;
|
|
16756
15076
|
exports.CSidebar = CSidebar;
|
|
16757
15077
|
exports.CSidebarBrand = CSidebarBrand;
|
|
@@ -16799,6 +15119,7 @@ exports.CWidgetStatsF = CWidgetStatsF;
|
|
|
16799
15119
|
exports.CWidgetsStatsPlugin = CWidgetsStatsPlugin;
|
|
16800
15120
|
exports.default = CoreuiVue;
|
|
16801
15121
|
exports.useColorModes = useColorModes;
|
|
15122
|
+
exports.useDebouncedCallback = useDebouncedCallback;
|
|
16802
15123
|
exports.usePopper = usePopper;
|
|
16803
15124
|
exports.vcplaceholder = vCPlaceholder;
|
|
16804
15125
|
exports.vcpopover = vCPopover;
|