@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.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/dist/components/calendar/CCalendar.d.ts +58 -32
  3. package/dist/components/calendar/utils.d.ts +11 -4
  4. package/dist/components/close-button/CCloseButton.d.ts +9 -0
  5. package/dist/components/date-picker/CDatePicker.d.ts +89 -0
  6. package/dist/components/date-range-picker/CDateRangePicker.d.ts +89 -0
  7. package/dist/components/dropdown/CDropdown.d.ts +13 -28
  8. package/dist/components/dropdown/CDropdownToggle.d.ts +19 -9
  9. package/dist/components/dropdown/types.d.ts +15 -0
  10. package/dist/components/dropdown/utils.d.ts +6 -0
  11. package/dist/components/form/CFormCheck.d.ts +4 -4
  12. package/dist/components/modal/CModal.d.ts +19 -0
  13. package/dist/components/multi-select/CMultiSelect.d.ts +1 -1
  14. package/dist/components/multi-select/CMultiSelectSelection.d.ts +1 -1
  15. package/dist/components/multi-select/types.d.ts +2 -2
  16. package/dist/components/multi-select/utils.d.ts +2 -2
  17. package/dist/components/offcanvas/COffcanvas.d.ts +9 -0
  18. package/dist/components/progress/CProgress.d.ts +102 -3
  19. package/dist/components/progress/CProgressStacked.d.ts +10 -0
  20. package/dist/components/progress/index.d.ts +2 -1
  21. package/dist/components/smart-table/CSmartTable.d.ts +0 -4
  22. package/dist/components/smart-table/CSmartTableBody.d.ts +12 -1
  23. package/dist/components/smart-table/types.d.ts +2 -2
  24. package/dist/components/smart-table/utils.d.ts +4 -2
  25. package/dist/composables/index.d.ts +2 -1
  26. package/dist/composables/useDebouncedCallback.d.ts +1 -0
  27. package/dist/index.es.js +1035 -2716
  28. package/dist/index.es.js.map +1 -1
  29. package/dist/index.js +1035 -2714
  30. package/dist/index.js.map +1 -1
  31. package/package.json +14 -14
  32. package/src/components/breadcrumb/CBreadcrumb.ts +1 -0
  33. package/src/components/button/CButton.ts +5 -5
  34. package/src/components/calendar/CCalendar.ts +444 -179
  35. package/src/components/calendar/utils.ts +93 -55
  36. package/src/components/carousel/CCarousel.ts +2 -5
  37. package/src/components/close-button/CCloseButton.ts +5 -0
  38. package/src/components/date-picker/CDatePicker.ts +43 -0
  39. package/src/components/date-range-picker/CDateRangePicker.ts +130 -83
  40. package/src/components/date-range-picker/utils.ts +2 -2
  41. package/src/components/dropdown/CDropdown.ts +23 -43
  42. package/src/components/dropdown/CDropdownMenu.ts +4 -19
  43. package/src/components/dropdown/CDropdownToggle.ts +44 -38
  44. package/src/components/dropdown/types.ts +11 -0
  45. package/src/components/dropdown/utils.ts +71 -0
  46. package/src/components/form/CFormCheck.ts +4 -4
  47. package/src/components/modal/CModal.ts +15 -1
  48. package/src/components/multi-select/CMultiSelect.ts +5 -8
  49. package/src/components/multi-select/CMultiSelectOptions.ts +1 -1
  50. package/src/components/multi-select/CMultiSelectSelection.ts +3 -3
  51. package/src/components/multi-select/types.ts +2 -2
  52. package/src/components/multi-select/utils.ts +5 -5
  53. package/src/components/navbar/CNavbar.ts +1 -1
  54. package/src/components/offcanvas/COffcanvas.ts +6 -0
  55. package/src/components/picker/CPicker.ts +1 -1
  56. package/src/components/progress/CProgress.ts +67 -9
  57. package/src/components/progress/CProgressBar.ts +4 -6
  58. package/src/components/progress/CProgressStacked.ts +19 -0
  59. package/src/components/progress/index.ts +3 -1
  60. package/src/components/sidebar/CSidebar.ts +1 -1
  61. package/src/components/smart-pagination/CSmartPagination.ts +20 -5
  62. package/src/components/smart-table/CSmartTable.ts +21 -12
  63. package/src/components/smart-table/CSmartTableBody.ts +30 -31
  64. package/src/components/smart-table/CSmartTableHead.ts +39 -12
  65. package/src/components/smart-table/types.ts +2 -2
  66. package/src/components/smart-table/utils.ts +41 -5
  67. package/src/components/time-picker/CTimePicker.ts +4 -2
  68. package/src/components/tooltip/CTooltip.ts +1 -1
  69. package/src/components/widgets/CWidgetStatsA.ts +1 -3
  70. package/src/components/widgets/CWidgetStatsB.ts +2 -4
  71. package/src/components/widgets/CWidgetStatsC.ts +2 -2
  72. package/src/components/widgets/CWidgetStatsD.ts +1 -1
  73. package/src/components/widgets/CWidgetStatsE.ts +1 -1
  74. package/src/components/widgets/CWidgetStatsF.ts +1 -1
  75. package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsE.spec.ts.snap +1 -1
  76. package/src/composables/index.ts +2 -1
  77. package/src/composables/useDebouncedCallback.ts +16 -0
  78. package/src/utils/isObjectInArray.ts +1 -1
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, onBeforeMount, onMounted, onUpdated, toRefs, cloneVNode, nextTick, computed, vShow, onBeforeUnmount, Teleport } from 'vue';
1
+ import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, onBeforeMount, onMounted, onUpdated, toRefs, cloneVNode, computed, nextTick, vShow, onBeforeUnmount, Teleport } from 'vue';
2
2
 
3
3
  const CAccordion = defineComponent({
4
4
  name: 'CAccordion',
@@ -263,6 +263,10 @@ const CAccordionPlugin = {
263
263
  const CCloseButton = defineComponent({
264
264
  name: 'CCloseButton',
265
265
  props: {
266
+ /**
267
+ * Invert the default color.
268
+ */
269
+ dark: Boolean,
266
270
  /**
267
271
  * Toggle the disabled state for the component.
268
272
  */
@@ -297,6 +301,7 @@ const CCloseButton = defineComponent({
297
301
  ],
298
302
  'aria-label': 'Close',
299
303
  disabled: props.disabled,
304
+ ...(props.dark && { 'data-coreui-theme': 'dark' }),
300
305
  onClick: handleClick,
301
306
  });
302
307
  },
@@ -711,6 +716,7 @@ const CBreadcrumbItem = defineComponent({
711
716
 
712
717
  const CBreadcrumb = defineComponent({
713
718
  name: 'CBreadcrumb',
719
+ inheritAttrs: false,
714
720
  setup(_, { slots, attrs }) {
715
721
  return () => h$1('nav', {
716
722
  'aria-label': 'breadcrumb',
@@ -802,13 +808,14 @@ const CButton = defineComponent({
802
808
  'click',
803
809
  ],
804
810
  setup(props, { emit, slots }) {
811
+ const component = props.href ? 'a' : props.component;
805
812
  const handleClick = (event) => {
806
813
  if (props.disabled) {
807
814
  return;
808
815
  }
809
816
  emit('click', event);
810
817
  };
811
- return () => h$1(props.component, {
818
+ return () => h$1(component, {
812
819
  class: [
813
820
  'btn',
814
821
  props.variant ? `btn-${props.variant}-${props.color}` : `btn-${props.color}`,
@@ -819,10 +826,9 @@ const CButton = defineComponent({
819
826
  },
820
827
  props.shape,
821
828
  ],
822
- disabled: props.disabled && props.component !== 'a',
823
- ...(props.component === 'a' && props.disabled && { 'aria-disabled': true, tabIndex: -1 }),
824
- ...(props.component === 'a' && props.href && { href: props.href }),
825
- ...(props.component === 'button' && { type: props.type }),
829
+ ...(component === 'a' && props.disabled && { 'aria-disabled': true, tabIndex: -1 }),
830
+ ...(component === 'a' && props.href && { href: props.href }),
831
+ ...(component === 'button' && { type: props.type, disabled: props.disabled }),
826
832
  onClick: handleClick,
827
833
  }, slots.default && slots.default());
828
834
  },
@@ -877,12 +883,61 @@ const CButtonGroupPlugin = {
877
883
  },
878
884
  };
879
885
 
886
+ const convertIsoWeekToDate = (isoWeek) => {
887
+ const [year, week] = isoWeek.split(/w/i);
888
+ // Get date for 4th of January for year
889
+ const date = new Date(Number(year), 0, 4);
890
+ // Get previous Monday, add 7 days for each week after first
891
+ date.setDate(date.getDate() - (date.getDay() || 7) + 1 + (Number(week) - 1) * 7);
892
+ return date;
893
+ };
894
+ const convertToDateObject = (date, selectionType) => {
895
+ // TODO: clean-up ?
896
+ // if (date === null) {
897
+ // return null
898
+ // }
899
+ if (date instanceof Date) {
900
+ return date;
901
+ }
902
+ if (selectionType === 'week') {
903
+ return convertIsoWeekToDate(date);
904
+ }
905
+ return new Date(Date.parse(date));
906
+ };
880
907
  const createGroupsInArray = (arr, numberOfGroups) => {
881
908
  const perGroup = Math.ceil(arr.length / numberOfGroups);
882
- return new Array(numberOfGroups)
909
+ return Array.from({ length: numberOfGroups })
883
910
  .fill('')
884
911
  .map((_, i) => arr.slice(i * perGroup, (i + 1) * perGroup));
885
912
  };
913
+ const getCalendarDate = (calendarDate, order, view) => {
914
+ if (order !== 0 && view === 'days') {
915
+ return new Date(Date.UTC(calendarDate.getFullYear(), calendarDate.getMonth() + order, 1));
916
+ }
917
+ if (order !== 0 && view === 'months') {
918
+ return new Date(Date.UTC(calendarDate.getFullYear() + order, calendarDate.getMonth(), 1));
919
+ }
920
+ if (order !== 0 && view === 'years') {
921
+ return new Date(Date.UTC(calendarDate.getFullYear() + (12 * order), calendarDate.getMonth(), 1));
922
+ }
923
+ return calendarDate;
924
+ };
925
+ const getDateBySelectionType = (date, selectionType) => {
926
+ if (date === null) {
927
+ return null;
928
+ }
929
+ if (selectionType === 'week') {
930
+ return `${date.getFullYear()}W${getWeekNumber(date)}`;
931
+ }
932
+ if (selectionType === 'month') {
933
+ const monthNumber = `0${date.getMonth() + 1}`.slice(-2);
934
+ return `${date.getFullYear()}-${monthNumber}`;
935
+ }
936
+ if (selectionType === 'year') {
937
+ return `${date.getFullYear()}`;
938
+ }
939
+ return date;
940
+ };
886
941
  const getMonthsNames = (locale) => {
887
942
  const months = [];
888
943
  const d = new Date();
@@ -942,6 +997,11 @@ const getTrailingDays = (year, month, leadingDays, monthDays) => {
942
997
  }
943
998
  return dates;
944
999
  };
1000
+ const getWeekNumber = (date) => {
1001
+ const week1 = new Date(date.getFullYear(), 0, 4);
1002
+ return (1 +
1003
+ Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7));
1004
+ };
945
1005
  const getMonthDetails = (year, month, firstDayOfWeek) => {
946
1006
  const daysPrevMonth = getLeadingDays(year, month, firstDayOfWeek);
947
1007
  const daysThisMonth = getMonthDays(year, month);
@@ -950,9 +1010,14 @@ const getMonthDetails = (year, month, firstDayOfWeek) => {
950
1010
  const weeks = [];
951
1011
  days.forEach((day, index) => {
952
1012
  if (index % 7 === 0 || weeks.length === 0) {
953
- weeks.push([]);
1013
+ weeks.push({
1014
+ days: [],
1015
+ });
954
1016
  }
955
- weeks[weeks.length - 1].push(day);
1017
+ if ((index + 1) % 7 === 0) {
1018
+ weeks[weeks.length - 1].weekNumber = getWeekNumber(day.date);
1019
+ }
1020
+ weeks[weeks.length - 1].days.push(day);
956
1021
  });
957
1022
  return weeks;
958
1023
  };
@@ -975,15 +1040,11 @@ const isDateDisabled = (date, min, max, dates) => {
975
1040
  let disabled;
976
1041
  if (dates) {
977
1042
  dates.forEach((_date) => {
978
- if (Array.isArray(_date)) {
979
- if (isDateInRange(date, _date[0], _date[1])) {
980
- disabled = true;
981
- }
1043
+ if (Array.isArray(_date) && isDateInRange(date, _date[0], _date[1])) {
1044
+ disabled = true;
982
1045
  }
983
- if (_date instanceof Date) {
984
- if (isSameDateAs(date, _date)) {
985
- disabled = true;
986
- }
1046
+ if (_date instanceof Date && isSameDateAs(date, _date)) {
1047
+ disabled = true;
987
1048
  }
988
1049
  });
989
1050
  }
@@ -1001,15 +1062,6 @@ const isDateInRange = (date, start, end) => {
1001
1062
  const isDateSelected = (date, start, end) => {
1002
1063
  return (start && isSameDateAs(start, date)) || (end && isSameDateAs(end, date));
1003
1064
  };
1004
- const isEndDate = (date, start, end) => {
1005
- return start && end && isSameDateAs(end, date) && start < end;
1006
- };
1007
- const isLastDayOfMonth = (date) => {
1008
- const test = new Date(date.getTime());
1009
- const month = test.getMonth();
1010
- test.setDate(test.getDate() + 1);
1011
- return test.getMonth() !== month;
1012
- };
1013
1065
  const isSameDateAs = (date, date2) => {
1014
1066
  if (date instanceof Date && date2 instanceof Date) {
1015
1067
  return (date.getDate() === date2.getDate() &&
@@ -1021,9 +1073,6 @@ const isSameDateAs = (date, date2) => {
1021
1073
  }
1022
1074
  return false;
1023
1075
  };
1024
- const isStartDate = (date, start, end) => {
1025
- return start && end && isSameDateAs(start, date) && start < end;
1026
- };
1027
1076
  const isToday = (date) => {
1028
1077
  const today = new Date();
1029
1078
  return (date.getDate() === today.getDate() &&
@@ -1037,9 +1086,7 @@ const CCalendar = defineComponent({
1037
1086
  /**
1038
1087
  * Default date of the component
1039
1088
  */
1040
- calendarDate: {
1041
- type: [Date, String],
1042
- },
1089
+ calendarDate: null,
1043
1090
  /**
1044
1091
  * The number of calendars that render on desktop devices.
1045
1092
  */
@@ -1079,9 +1126,7 @@ const CCalendar = defineComponent({
1079
1126
  /**
1080
1127
  * Initial selected to date (range).
1081
1128
  */
1082
- endDate: {
1083
- type: [Date, String],
1084
- },
1129
+ endDate: null,
1085
1130
  /**
1086
1131
  * Sets the day of start week.
1087
1132
  * - 0 - Sunday,
@@ -1106,15 +1151,11 @@ const CCalendar = defineComponent({
1106
1151
  /**
1107
1152
  * Max selectable date.
1108
1153
  */
1109
- maxDate: {
1110
- type: [Date, String],
1111
- },
1154
+ maxDate: null,
1112
1155
  /**
1113
1156
  * Min selectable date.
1114
1157
  */
1115
- minDate: {
1116
- type: [Date, String],
1117
- },
1158
+ minDate: null,
1118
1159
  /**
1119
1160
  * Show arrows navigation.
1120
1161
  */
@@ -1142,6 +1183,16 @@ const CCalendar = defineComponent({
1142
1183
  * @since 4.9.0
1143
1184
  */
1144
1185
  selectAdjacementDays: Boolean,
1186
+ /**
1187
+ * Specify the type of date selection as day, week, month, or year.
1188
+ *
1189
+ * @since 5.0.0-alpha.1
1190
+ */
1191
+ selectionType: {
1192
+ type: String,
1193
+ default: 'day',
1194
+ validator: (value) => ['day', 'week', 'month', 'year'].includes(value),
1195
+ },
1145
1196
  /**
1146
1197
  * Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
1147
1198
  *
@@ -1151,12 +1202,16 @@ const CCalendar = defineComponent({
1151
1202
  type: Boolean,
1152
1203
  default: true,
1153
1204
  },
1205
+ /**
1206
+ * Set whether to display week numbers in the calendar.
1207
+ *
1208
+ * @since 5.0.0-alpha.1
1209
+ */
1210
+ showWeekNumber: Boolean,
1154
1211
  /**
1155
1212
  * Initial selected date.
1156
1213
  */
1157
- startDate: {
1158
- type: [Date, String],
1159
- },
1214
+ startDate: null,
1160
1215
  /**
1161
1216
  * Set length or format of day name.
1162
1217
  *
@@ -1178,6 +1233,12 @@ const CCalendar = defineComponent({
1178
1233
  return false;
1179
1234
  },
1180
1235
  },
1236
+ /**
1237
+ * Label displayed over week numbers in the calendar.
1238
+ *
1239
+ * @since 5.0.0-alpha.1
1240
+ */
1241
+ weekNumbersLabel: String,
1181
1242
  },
1182
1243
  emits: [
1183
1244
  /**
@@ -1185,7 +1246,7 @@ const CCalendar = defineComponent({
1185
1246
  *
1186
1247
  * @property {Date | null} date
1187
1248
  */
1188
- 'calendar-cell-hover',
1249
+ 'date-hover',
1189
1250
  /**
1190
1251
  * Callback fired when the calendar date changed.
1191
1252
  *
@@ -1206,53 +1267,70 @@ const CCalendar = defineComponent({
1206
1267
  'end-date-change',
1207
1268
  ],
1208
1269
  setup(props, { slots, emit }) {
1270
+ const calendarRef = ref();
1209
1271
  const calendarDate = ref(props.calendarDate
1210
- ? new Date(props.calendarDate)
1272
+ ? convertToDateObject(props.calendarDate, props.selectionType)
1211
1273
  : props.startDate
1212
- ? new Date(props.startDate)
1274
+ ? convertToDateObject(props.startDate, props.selectionType)
1213
1275
  : new Date());
1214
- const startDate = ref(props.startDate ? new Date(props.startDate) : null);
1215
- const endDate = ref(props.endDate ? new Date(props.endDate) : null);
1276
+ const startDate = ref(props.startDate ? convertToDateObject(props.startDate, props.selectionType) : null);
1277
+ const endDate = ref(props.endDate ? convertToDateObject(props.endDate, props.selectionType) : null);
1216
1278
  const hoverDate = ref(null);
1217
- const maxDate = ref(props.maxDate ? new Date(props.maxDate) : null);
1218
- const minDate = ref(props.minDate ? new Date(props.minDate) : null);
1279
+ const maxDate = ref(props.maxDate ? convertToDateObject(props.maxDate, props.selectionType) : null);
1280
+ const minDate = ref(props.minDate ? convertToDateObject(props.minDate, props.selectionType) : null);
1219
1281
  const selectEndDate = ref(props.selectEndDate);
1220
1282
  const view = ref('days');
1283
+ watch(() => props.selectionType, () => {
1284
+ if (props.selectionType === 'day' || props.selectionType === 'week') {
1285
+ view.value = 'days';
1286
+ return;
1287
+ }
1288
+ if (props.selectionType === 'month') {
1289
+ view.value = 'months';
1290
+ return;
1291
+ }
1292
+ if (props.selectionType === 'year') {
1293
+ view.value = 'years';
1294
+ return;
1295
+ }
1296
+ }, { immediate: true });
1221
1297
  watch(() => props.calendarDate, () => {
1222
1298
  if (props.calendarDate) {
1223
1299
  calendarDate.value = new Date(props.calendarDate);
1224
1300
  }
1225
1301
  });
1226
1302
  watch(() => props.startDate, () => {
1227
- const date = props.startDate ? new Date(props.startDate) : null;
1303
+ const date = props.startDate
1304
+ ? convertToDateObject(props.startDate, props.selectionType)
1305
+ : null;
1228
1306
  if (!isSameDateAs(date, startDate.value)) {
1229
1307
  startDate.value = date;
1230
1308
  }
1231
1309
  });
1232
1310
  watch(() => props.endDate, () => {
1233
- const date = props.endDate ? new Date(props.endDate) : null;
1311
+ const date = props.endDate ? convertToDateObject(props.endDate, props.selectionType) : null;
1234
1312
  if (!isSameDateAs(date, endDate.value)) {
1235
1313
  endDate.value = date;
1236
1314
  }
1237
1315
  });
1238
1316
  watch(() => props.maxDate, () => {
1239
1317
  if (props.maxDate) {
1240
- maxDate.value = new Date(props.maxDate);
1318
+ maxDate.value = convertToDateObject(props.maxDate, props.selectionType);
1241
1319
  }
1242
1320
  });
1243
1321
  watch(() => props.minDate, () => {
1244
1322
  if (props.minDate) {
1245
- minDate.value = new Date(props.minDate);
1323
+ minDate.value = convertToDateObject(props.minDate, props.selectionType);
1246
1324
  }
1247
1325
  });
1248
1326
  watch(() => props.selectEndDate, () => {
1249
1327
  selectEndDate.value = props.selectEndDate;
1250
1328
  });
1251
1329
  watch(startDate, () => {
1252
- emit('start-date-change', startDate.value);
1330
+ emit('start-date-change', getDateBySelectionType(startDate.value, props.selectionType));
1253
1331
  });
1254
1332
  watch(endDate, () => {
1255
- emit('end-date-change', endDate.value);
1333
+ emit('end-date-change', getDateBySelectionType(endDate.value, props.selectionType));
1256
1334
  });
1257
1335
  const setCalendarPage = (years, months = 0, setMonth) => {
1258
1336
  const year = calendarDate.value.getFullYear();
@@ -1264,10 +1342,26 @@ const CCalendar = defineComponent({
1264
1342
  calendarDate.value = d;
1265
1343
  emit('calendar-date-change', d);
1266
1344
  };
1267
- const handleCellOnClick = (date) => {
1345
+ const handleCalendarClick = (date, index) => {
1268
1346
  if (isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)) {
1269
1347
  return;
1270
1348
  }
1349
+ const _date = new Date(date);
1350
+ if (view.value === 'days') {
1351
+ calendarDate.value = index ? new Date(_date.setMonth(_date.getMonth() - index)) : _date;
1352
+ }
1353
+ if (view.value === 'months' && props.selectionType !== 'month') {
1354
+ calendarDate.value = index ? new Date(_date.setMonth(_date.getMonth() - index)) : _date;
1355
+ view.value = 'days';
1356
+ return;
1357
+ }
1358
+ if (view.value === 'years' && props.selectionType !== 'year') {
1359
+ calendarDate.value = index
1360
+ ? new Date(_date.setFullYear(_date.getFullYear() - index))
1361
+ : _date;
1362
+ view.value = 'months';
1363
+ return;
1364
+ }
1271
1365
  if (props.range) {
1272
1366
  if (selectEndDate.value) {
1273
1367
  selectEndDate.value = false;
@@ -1300,40 +1394,117 @@ const CCalendar = defineComponent({
1300
1394
  }
1301
1395
  startDate.value = date;
1302
1396
  };
1303
- const handleCellKeyDown = (event, date) => {
1397
+ const handleCalendarKeyDown = (event, date, index) => {
1304
1398
  if (event.code === 'Space' || event.key === 'Enter') {
1305
1399
  event.preventDefault();
1306
- handleCellOnClick && handleCellOnClick(date);
1307
- return;
1400
+ handleCalendarClick(date, index);
1401
+ }
1402
+ if (event.key === 'ArrowRight' ||
1403
+ event.key === 'ArrowLeft' ||
1404
+ event.key === 'ArrowUp' ||
1405
+ event.key === 'ArrowDown') {
1406
+ event.preventDefault();
1407
+ if (maxDate.value &&
1408
+ date >= convertToDateObject(maxDate.value, props.selectionType) &&
1409
+ (event.key === 'ArrowRight' || event.key === 'ArrowDown')) {
1410
+ return;
1411
+ }
1412
+ if (minDate.value &&
1413
+ date <= convertToDateObject(minDate.value, props.selectionType) &&
1414
+ (event.key === 'ArrowLeft' || event.key === 'ArrowUp')) {
1415
+ return;
1416
+ }
1417
+ let element = event.target;
1418
+ if (props.selectionType === 'week' && element.tabIndex === -1) {
1419
+ element = element.closest('tr[tabindex="0"]');
1420
+ }
1421
+ const list = calendarRef.value
1422
+ ? Array.from(calendarRef.value.querySelectorAll(props.selectionType === 'week' ? 'tr[tabindex="0"]' : 'td.current'))
1423
+ : [];
1424
+ // const list: HTMLElement[] = [].concat(
1425
+ // ...Element.prototype.querySelectorAll.call(
1426
+ // calendarRef.value,
1427
+ // props.selectionType === 'week' ? 'tr[tabindex="0"]' : 'td.current',
1428
+ // ),
1429
+ // )
1430
+ const index = list.indexOf(element);
1431
+ const first = index === 0;
1432
+ const last = index === list.length - 1;
1433
+ const toBoundary = {
1434
+ start: index,
1435
+ end: list.length - (index + 1),
1436
+ };
1437
+ const gap = {
1438
+ ArrowRight: 1,
1439
+ ArrowLeft: -1,
1440
+ ArrowUp: props.selectionType === 'week' && view.value === 'days'
1441
+ ? -1
1442
+ : view.value === 'days'
1443
+ ? -7
1444
+ : -3,
1445
+ ArrowDown: props.selectionType === 'week' && view.value === 'days'
1446
+ ? 1
1447
+ : view.value === 'days'
1448
+ ? 7
1449
+ : 3,
1450
+ };
1451
+ if ((event.key === 'ArrowRight' && last) ||
1452
+ (event.key === 'ArrowDown' && toBoundary['end'] < gap['ArrowDown']) ||
1453
+ (event.key === 'ArrowLeft' && first) ||
1454
+ (event.key === 'ArrowUp' && toBoundary['start'] < Math.abs(gap['ArrowUp']))) {
1455
+ if (view.value === 'days') {
1456
+ setCalendarPage(0, event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1);
1457
+ }
1458
+ if (view.value === 'months') {
1459
+ setCalendarPage(event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1);
1460
+ }
1461
+ if (view.value === 'years') {
1462
+ setCalendarPage(event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 10 : -10);
1463
+ }
1464
+ setTimeout(() => {
1465
+ const _list = element.parentNode?.parentNode ? Array.from(element.parentNode.parentNode.querySelectorAll('td[tabindex="0"], tr[tabindex="0"]')) : [];
1466
+ if (_list.length && event.key === 'ArrowRight') {
1467
+ _list[0].focus();
1468
+ }
1469
+ if (_list.length && event.key === 'ArrowLeft') {
1470
+ _list[_list.length - 1].focus();
1471
+ }
1472
+ if (_list.length && event.key === 'ArrowDown') {
1473
+ _list[gap['ArrowDown'] - (list.length - index)].focus();
1474
+ }
1475
+ if (_list.length && event.key === 'ArrowUp') {
1476
+ _list[_list.length - (Math.abs(gap['ArrowUp']) + 1 - (index + 1))].focus();
1477
+ }
1478
+ }, 1);
1479
+ return;
1480
+ }
1481
+ if (list[index + gap[event.key]].tabIndex === 0) {
1482
+ list[index + gap[event.key]].focus();
1483
+ return;
1484
+ }
1485
+ for (let i = index; i < list.length; event.key === 'ArrowRight' || event.key === 'ArrowDown' ? i++ : i--) {
1486
+ if (list[i + gap[event.key]].tabIndex === 0) {
1487
+ list[i + gap[event.key]].focus();
1488
+ break;
1489
+ }
1490
+ }
1308
1491
  }
1309
1492
  };
1310
- const handleCellMouseEnter = (date) => {
1493
+ const handleCalendarMouseEnter = (date) => {
1311
1494
  if (isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)) {
1312
1495
  return;
1313
1496
  }
1314
1497
  hoverDate.value = date;
1315
- emit('calendar-cell-hover', date);
1498
+ emit('date-hover', getDateBySelectionType(date, props.selectionType));
1316
1499
  };
1317
- const handleCellMouseLeave = () => {
1500
+ const handleCalendarMouseLeave = () => {
1318
1501
  hoverDate.value = null;
1319
- emit('calendar-cell-hover', null);
1320
- };
1321
- const handleMonthKeyDown = (event, month) => {
1322
- if (event.code === 'Space' || event.key === 'Enter') {
1323
- setCalendarPage(0, month);
1324
- view.value = 'days';
1325
- }
1326
- };
1327
- const handleYearKeyDown = (event, date) => {
1328
- if (event.code === 'Space' || event.key === 'Enter') {
1329
- calendarDate.value = date;
1330
- view.value = 'months';
1331
- }
1502
+ emit('date-hover', null);
1332
1503
  };
1333
1504
  const handleNavigationOnClick = (direction, double = false) => {
1334
1505
  if (direction === 'prev') {
1335
1506
  if (double) {
1336
- setCalendarPage(view.value === 'days' ? -1 : -10);
1507
+ setCalendarPage(view.value === 'years' ? -10 : -1);
1337
1508
  return;
1338
1509
  }
1339
1510
  if (view.value !== 'days') {
@@ -1345,7 +1516,7 @@ const CCalendar = defineComponent({
1345
1516
  }
1346
1517
  if (direction === 'next') {
1347
1518
  if (double) {
1348
- setCalendarPage(view.value === 'days' ? 1 : 10);
1519
+ setCalendarPage(view.value === 'years' ? 10 : 1);
1349
1520
  return;
1350
1521
  }
1351
1522
  if (view.value !== 'days') {
@@ -1356,118 +1527,181 @@ const CCalendar = defineComponent({
1356
1527
  return;
1357
1528
  }
1358
1529
  };
1359
- const Calendar = (addMonths) => {
1360
- let date = calendarDate.value;
1361
- if (addMonths !== 0) {
1362
- date = new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth() + addMonths, 1);
1363
- }
1364
- const monthDetails = getMonthDetails(date.getFullYear(), date.getMonth(), props.firstDayOfWeek);
1530
+ const Calendar = (_calendarDate) => {
1531
+ const monthDetails = getMonthDetails(_calendarDate.getFullYear(), _calendarDate.getMonth(), props.firstDayOfWeek);
1365
1532
  const listOfMonths = createGroupsInArray(getMonthsNames(props.locale), 4);
1366
- const listOfYears = createGroupsInArray(getYears(date.getFullYear()), 4);
1367
- const weekDays = monthDetails[0];
1533
+ const listOfYears = createGroupsInArray(getYears(_calendarDate.getFullYear()), 4);
1534
+ const weekDays = monthDetails[0].days;
1368
1535
  return h$1('table', {}, [
1369
1536
  view.value === 'days' &&
1370
- h$1('thead', {}, h$1('tr', {}, weekDays.map(({ date }) => {
1371
- return h$1('th', { class: 'calendar-cell' }, h$1('div', {
1372
- class: 'calendar-header-cell-inner',
1373
- }, typeof props.weekdayFormat === 'function'
1374
- ? props.weekdayFormat(date)
1375
- : typeof props.weekdayFormat === 'string'
1376
- ? date.toLocaleDateString(props.locale, {
1377
- weekday: props.weekdayFormat,
1378
- })
1379
- : date
1380
- .toLocaleDateString(props.locale, { weekday: 'long' })
1381
- .slice(0, props.weekdayFormat)));
1382
- }))),
1537
+ h$1('thead', {}, h$1('tr', {}, [
1538
+ props.showWeekNumber &&
1539
+ h$1('th', { class: 'calendar-cell' }, h$1('div', { class: 'calendar-header-cell-inner' }, props.weekNumbersLabel)),
1540
+ weekDays.map(({ date }) => {
1541
+ return h$1('th', { class: 'calendar-cell' }, h$1('div', {
1542
+ class: 'calendar-header-cell-inner',
1543
+ }, typeof props.weekdayFormat === 'function'
1544
+ ? props.weekdayFormat(date)
1545
+ : typeof props.weekdayFormat === 'string'
1546
+ ? date.toLocaleDateString(props.locale, {
1547
+ weekday: props.weekdayFormat,
1548
+ })
1549
+ : date
1550
+ .toLocaleDateString(props.locale, { weekday: 'long' })
1551
+ .slice(0, props.weekdayFormat)));
1552
+ }),
1553
+ ])),
1383
1554
  h$1('tbody', {}, [
1384
1555
  view.value === 'days' &&
1385
1556
  monthDetails.map((week) => {
1386
- return h$1('tr', {}, week.map(({ date, month }) => {
1387
- return month === 'current' || props.showAdjacementDays
1388
- ? h$1('td', {
1389
- class: [
1390
- 'calendar-cell',
1391
- {
1392
- today: isToday(date),
1393
- disabled: isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates),
1394
- [month]: true,
1395
- clickable: month !== 'current' && props.selectAdjacementDays,
1396
- last: isLastDayOfMonth(date),
1397
- range: month === 'current' &&
1398
- isDateInRange(date, startDate.value, endDate.value),
1399
- 'range-hover': month === 'current' &&
1400
- (hoverDate.value && selectEndDate.value
1401
- ? isDateInRange(date, startDate.value, hoverDate.value)
1402
- : isDateInRange(date, hoverDate.value, endDate.value)),
1403
- selected: isDateSelected(date, startDate.value, endDate.value),
1404
- start: isStartDate(date, startDate.value, endDate.value),
1405
- end: isEndDate(date, startDate.value, endDate.value),
1406
- },
1407
- ],
1408
- tabindex: (month === 'current' || props.selectAdjacementDays) &&
1409
- !isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)
1410
- ? 0
1411
- : -1,
1412
- title: date.toLocaleDateString(props.locale),
1413
- ...((month === 'current' || props.selectAdjacementDays) && {
1414
- onBlur: () => handleCellMouseLeave(),
1415
- onClick: () => handleCellOnClick(date),
1416
- onFocus: () => handleCellMouseEnter(date),
1417
- onKeydown: (event) => handleCellKeyDown(event, date),
1418
- onmouseenter: () => handleCellMouseEnter(date),
1419
- onmouseleave: () => handleCellMouseLeave(),
1420
- }),
1421
- ...(month !== 'current' &&
1422
- !props.selectAdjacementDays && {
1423
- onMouseEnter: () => handleCellMouseLeave(),
1424
- }),
1425
- }, h$1('div', {
1426
- class: 'calendar-cell-inner',
1427
- }, typeof props.dayFormat === 'function'
1428
- ? props.dayFormat(date)
1429
- : date.toLocaleDateString(props.locale, {
1430
- day: props.dayFormat,
1431
- })))
1432
- : h$1('td');
1433
- }));
1557
+ const date = convertToDateObject(week.weekNumber === 0
1558
+ ? `${_calendarDate.getFullYear()}W53`
1559
+ : `${_calendarDate.getFullYear()}W${week.weekNumber}`, props.selectionType);
1560
+ const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
1561
+ const current = week.days.some((day) => day.month === 'current');
1562
+ return h$1('tr', {
1563
+ class: [
1564
+ 'calendar-row',
1565
+ {
1566
+ disabled: isDisabled,
1567
+ range: props.selectionType === 'week' &&
1568
+ isDateInRange(date, startDate.value, endDate.value),
1569
+ 'range-hover': props.selectionType === 'week' && hoverDate.value && selectEndDate.value
1570
+ ? isDateInRange(date, startDate.value, hoverDate.value)
1571
+ : isDateInRange(date, hoverDate.value, endDate.value),
1572
+ selected: isDateSelected(date, startDate.value, endDate.value),
1573
+ },
1574
+ ],
1575
+ tabindex: props.selectionType === 'week' && current && !isDisabled ? 0 : -1,
1576
+ ...(props.selectionType === 'week' &&
1577
+ !isDisabled && {
1578
+ onBlur: () => handleCalendarMouseLeave(),
1579
+ onClick: () => handleCalendarClick(date),
1580
+ onFocus: () => handleCalendarMouseEnter(date),
1581
+ onKeydown: (event) => handleCalendarKeyDown(event, date),
1582
+ onMouseEnter: () => handleCalendarMouseEnter(date),
1583
+ onMouseLeave: () => handleCalendarMouseLeave(),
1584
+ }),
1585
+ }, [
1586
+ props.showWeekNumber &&
1587
+ h$1('th', { class: 'calendar-cell-week-number' }, week.weekNumber === 0 ? 53 : week.weekNumber),
1588
+ week.days.map(({ date, month }) => {
1589
+ const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
1590
+ return month === 'current' || props.showAdjacementDays
1591
+ ? h$1('td', {
1592
+ class: [
1593
+ 'calendar-cell',
1594
+ {
1595
+ ...(props.selectionType === 'day' && {
1596
+ clickable: month !== 'current' && props.selectAdjacementDays,
1597
+ disabled: isDisabled,
1598
+ 'range-hover': month === 'current' &&
1599
+ (hoverDate.value && selectEndDate.value
1600
+ ? isDateInRange(date, startDate.value, hoverDate.value)
1601
+ : isDateInRange(date, hoverDate.value, endDate.value)),
1602
+ range: month === 'current' &&
1603
+ isDateInRange(date, startDate.value, endDate.value),
1604
+ selected: isDateSelected(date, startDate.value, endDate.value),
1605
+ }),
1606
+ [month]: true,
1607
+ today: month === 'current' && isToday(date),
1608
+ },
1609
+ ],
1610
+ tabindex: props.selectionType === 'day' &&
1611
+ (month === 'current' || props.selectAdjacementDays) &&
1612
+ !isDisabled
1613
+ ? 0
1614
+ : -1,
1615
+ title: date.toLocaleDateString(props.locale),
1616
+ ...(props.selectionType === 'day' &&
1617
+ (month === 'current' || props.selectAdjacementDays) && {
1618
+ onBlur: () => handleCalendarMouseLeave(),
1619
+ onClick: () => handleCalendarClick(date),
1620
+ onFocus: () => handleCalendarMouseEnter(date),
1621
+ onKeydown: (event) => handleCalendarKeyDown(event, date),
1622
+ onMouseEnter: () => handleCalendarMouseEnter(date),
1623
+ onMouseLeave: () => handleCalendarMouseLeave(),
1624
+ }),
1625
+ ...(month !== 'current' &&
1626
+ !props.selectAdjacementDays && {
1627
+ onMouseEnter: () => handleCalendarMouseLeave(),
1628
+ }),
1629
+ }, h$1('div', {
1630
+ class: 'calendar-cell-inner',
1631
+ }, typeof props.dayFormat === 'function'
1632
+ ? props.dayFormat(date)
1633
+ : date.toLocaleDateString(props.locale, {
1634
+ day: props.dayFormat,
1635
+ })))
1636
+ : h$1('td');
1637
+ }),
1638
+ ]);
1434
1639
  }),
1435
1640
  view.value === 'months' &&
1436
1641
  listOfMonths.map((row, index) => {
1437
1642
  return h$1('tr', {}, row.map((month, idx) => {
1643
+ const monthNumber = index * 3 + idx;
1644
+ const date = new Date(Date.UTC(_calendarDate.getFullYear(), monthNumber, 1));
1645
+ const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
1438
1646
  return h$1('td', {
1439
- class: 'calendar-cell month',
1440
- onClick: () => {
1441
- setCalendarPage(0, 0, index * 3 + idx - addMonths);
1442
- view.value = 'days';
1443
- },
1444
- onKeydown: (event) => handleMonthKeyDown(event, index * 3 + idx - addMonths),
1445
- tabindex: 0,
1647
+ class: [
1648
+ 'calendar-cell',
1649
+ {
1650
+ disabled: isDisabled,
1651
+ selected: isDateSelected(date, startDate.value, endDate.value),
1652
+ 'range-hover': props.selectionType === 'month' &&
1653
+ (hoverDate && selectEndDate
1654
+ ? isDateInRange(date, startDate.value, hoverDate.value)
1655
+ : isDateInRange(date, hoverDate.value, endDate.value)),
1656
+ range: isDateInRange(date, startDate.value, endDate.value),
1657
+ },
1658
+ ],
1659
+ tabindex: !isDisabled ? 0 : -1,
1660
+ ...(!isDisabled && {
1661
+ onBlur: () => handleCalendarMouseLeave(),
1662
+ onClick: () => handleCalendarClick(date),
1663
+ onFocus: () => handleCalendarMouseEnter(date),
1664
+ onKeydown: (event) => handleCalendarKeyDown(event, date),
1665
+ onMouseEnter: () => handleCalendarMouseEnter(date),
1666
+ onMouseLeave: () => handleCalendarMouseLeave(),
1667
+ }),
1446
1668
  }, h$1('div', { class: 'calendar-cell-inner' }, month));
1447
1669
  }));
1448
1670
  }),
1449
1671
  view.value === 'years' &&
1450
1672
  listOfYears.map((row) => {
1451
1673
  return h$1('tr', {}, row.map((year) => {
1674
+ const date = new Date(Date.UTC(year, 0, 1));
1675
+ const isDisabled = isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates);
1452
1676
  return h$1('td', {
1453
- class: 'calendar-cell year',
1454
- onClick: () => {
1455
- calendarDate.value = new Date(year, date.getMonth() - addMonths, date.getDate());
1456
- view.value = 'months';
1457
- },
1458
- onKeydown: (event) => handleYearKeyDown(event, new Date(year, date.getMonth() - addMonths, date.getDate())),
1459
- tabindex: 0,
1677
+ class: [
1678
+ 'calendar-cell year',
1679
+ {
1680
+ disabled: isDisabled,
1681
+ selected: isDateSelected(date, startDate.value, endDate.value),
1682
+ 'range-hover': props.selectionType === 'year' &&
1683
+ (hoverDate && selectEndDate
1684
+ ? isDateInRange(date, startDate.value, hoverDate.value)
1685
+ : isDateInRange(date, hoverDate.value, endDate.value)),
1686
+ range: isDateInRange(date, startDate.value, endDate.value),
1687
+ },
1688
+ ],
1689
+ tabindex: !isDisabled ? 0 : -1,
1690
+ ...(!isDisabled && {
1691
+ onBlur: () => handleCalendarMouseLeave(),
1692
+ onClick: () => handleCalendarClick(date),
1693
+ onFocus: () => handleCalendarMouseEnter(date),
1694
+ onKeydown: (event) => handleCalendarKeyDown(event, date),
1695
+ onMouseEnter: () => handleCalendarMouseEnter(date),
1696
+ onMouseLeave: () => handleCalendarMouseLeave(),
1697
+ }),
1460
1698
  }, h$1('div', { class: 'calendar-cell-inner' }, year));
1461
1699
  }));
1462
1700
  }),
1463
1701
  ]),
1464
1702
  ]);
1465
1703
  };
1466
- const Navigation = (addMonths) => {
1467
- let date = calendarDate.value;
1468
- if (addMonths !== 0) {
1469
- date = new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth() + addMonths, 1);
1470
- }
1704
+ const Navigation = (_calendarDate) => {
1471
1705
  return h$1('div', { class: 'calendar-nav' }, [
1472
1706
  props.navigation &&
1473
1707
  h$1('div', {
@@ -1511,7 +1745,7 @@ const CCalendar = defineComponent({
1511
1745
  if (props.navigation)
1512
1746
  view.value = 'months';
1513
1747
  },
1514
- }, () => date.toLocaleDateString(props.locale, { month: 'long' })),
1748
+ }, () => _calendarDate.toLocaleDateString(props.locale, { month: 'long' })),
1515
1749
  h$1(CButton, {
1516
1750
  color: 'transparent',
1517
1751
  size: 'sm',
@@ -1520,7 +1754,7 @@ const CCalendar = defineComponent({
1520
1754
  view.value = 'years';
1521
1755
  },
1522
1756
  ...(props.navYearFirst && { style: { order: '-1' } }),
1523
- }, () => date.toLocaleDateString(props.locale, { year: 'numeric' })),
1757
+ }, () => _calendarDate.toLocaleDateString(props.locale, { year: 'numeric' })),
1524
1758
  ]),
1525
1759
  props.navigation &&
1526
1760
  h$1('div', {
@@ -1554,8 +1788,23 @@ const CCalendar = defineComponent({
1554
1788
  ]),
1555
1789
  ]);
1556
1790
  };
1557
- return () => h$1('div', { class: 'calendars' }, [
1558
- Array.from({ length: props.calendars }, (_, index) => h$1('div', { class: ['calendar', view.value] }, [Navigation(index), Calendar(index)])),
1791
+ return () => h$1('div', {
1792
+ class: [
1793
+ 'calendars',
1794
+ {
1795
+ [`select-${props.selectionType}`]: props.selectionType && view.value === 'days',
1796
+ 'show-week-numbers': props.showWeekNumber,
1797
+ },
1798
+ ],
1799
+ ref: calendarRef,
1800
+ }, [
1801
+ Array.from({ length: props.calendars }, (_, index) => {
1802
+ const _calendarDate = getCalendarDate(calendarDate.value, index, view.value);
1803
+ return h$1('div', { class: ['calendar', view.value] }, [
1804
+ Navigation(_calendarDate),
1805
+ Calendar(_calendarDate),
1806
+ ]);
1807
+ }),
1559
1808
  ]);
1560
1809
  },
1561
1810
  });
@@ -1858,7 +2107,7 @@ const isInViewport = (element) => {
1858
2107
 
1859
2108
  const isObjectInArray = (array, item, ignore = []) => array.some((_item) => {
1860
2109
  let result = true;
1861
- for (const key in item) {
2110
+ for (const key in _item) {
1862
2111
  if (!ignore.includes(key) && item[key] !== _item[key]) {
1863
2112
  result = false;
1864
2113
  break;
@@ -2026,11 +2275,8 @@ const CCarousel = defineComponent({
2026
2275
  visible.value && cycle();
2027
2276
  });
2028
2277
  return () => h$1('div', {
2029
- class: [
2030
- 'carousel slide',
2031
- props.transition === 'crossfade' && 'carousel-fade',
2032
- props.dark && 'carousel-dark',
2033
- ],
2278
+ class: ['carousel slide', props.transition === 'crossfade' && 'carousel-fade'],
2279
+ ...(props.dark && { 'data-coreui-theme': 'dark' }),
2034
2280
  onmouseover: () => props.pause && pause(),
2035
2281
  onmouseleave: () => cycle(),
2036
2282
  ref: carouselRef,
@@ -2143,2234 +2389,38 @@ const CCarouselItem = defineComponent({
2143
2389
  orderClassName.value = '';
2144
2390
  activeClassName.value = 'active';
2145
2391
  }
2146
- if (!active) {
2147
- directionClassName.value = '';
2148
- orderClassName.value = '';
2149
- activeClassName.value = '';
2150
- }
2151
- });
2152
- });
2153
- return () => h$1('div', {
2154
- class: [
2155
- 'carousel-item',
2156
- activeClassName.value,
2157
- directionClassName.value,
2158
- orderClassName.value,
2159
- ],
2160
- ref: carouselItemRef,
2161
- }, slots.default && slots.default());
2162
- },
2163
- });
2164
-
2165
- const CCarouselPlugin = {
2166
- install: (app) => {
2167
- app.component(CCarousel.name, CCarousel);
2168
- app.component(CCarouselCaption.name, CCarouselCaption);
2169
- app.component(CCarouselItem.name, CCarouselItem);
2170
- },
2171
- };
2172
-
2173
- const CCollapsePlugin = {
2174
- install: (app) => {
2175
- app.component(CCollapse.name, CCollapse);
2176
- },
2177
- };
2178
-
2179
- function _typeof(obj) {
2180
- "@babel/helpers - typeof";
2181
-
2182
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2183
- return typeof obj;
2184
- } : function (obj) {
2185
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2186
- }, _typeof(obj);
2187
- }
2188
-
2189
- function toInteger(dirtyNumber) {
2190
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
2191
- return NaN;
2192
- }
2193
- var number = Number(dirtyNumber);
2194
- if (isNaN(number)) {
2195
- return number;
2196
- }
2197
- return number < 0 ? Math.ceil(number) : Math.floor(number);
2198
- }
2199
-
2200
- function requiredArgs(required, args) {
2201
- if (args.length < required) {
2202
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
2203
- }
2204
- }
2205
-
2206
- /**
2207
- * @name toDate
2208
- * @category Common Helpers
2209
- * @summary Convert the given argument to an instance of Date.
2210
- *
2211
- * @description
2212
- * Convert the given argument to an instance of Date.
2213
- *
2214
- * If the argument is an instance of Date, the function returns its clone.
2215
- *
2216
- * If the argument is a number, it is treated as a timestamp.
2217
- *
2218
- * If the argument is none of the above, the function returns Invalid Date.
2219
- *
2220
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
2221
- *
2222
- * @param {Date|Number} argument - the value to convert
2223
- * @returns {Date} the parsed date in the local time zone
2224
- * @throws {TypeError} 1 argument required
2225
- *
2226
- * @example
2227
- * // Clone the date:
2228
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
2229
- * //=> Tue Feb 11 2014 11:30:30
2230
- *
2231
- * @example
2232
- * // Convert the timestamp to date:
2233
- * const result = toDate(1392098430000)
2234
- * //=> Tue Feb 11 2014 11:30:30
2235
- */
2236
- function toDate(argument) {
2237
- requiredArgs(1, arguments);
2238
- var argStr = Object.prototype.toString.call(argument);
2239
-
2240
- // Clone the date
2241
- if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
2242
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
2243
- return new Date(argument.getTime());
2244
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
2245
- return new Date(argument);
2246
- } else {
2247
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
2248
- // eslint-disable-next-line no-console
2249
- 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");
2250
- // eslint-disable-next-line no-console
2251
- console.warn(new Error().stack);
2252
- }
2253
- return new Date(NaN);
2254
- }
2255
- }
2256
-
2257
- /**
2258
- * @name addMilliseconds
2259
- * @category Millisecond Helpers
2260
- * @summary Add the specified number of milliseconds to the given date.
2261
- *
2262
- * @description
2263
- * Add the specified number of milliseconds to the given date.
2264
- *
2265
- * @param {Date|Number} date - the date to be changed
2266
- * @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`.
2267
- * @returns {Date} the new date with the milliseconds added
2268
- * @throws {TypeError} 2 arguments required
2269
- *
2270
- * @example
2271
- * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
2272
- * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
2273
- * //=> Thu Jul 10 2014 12:45:30.750
2274
- */
2275
- function addMilliseconds(dirtyDate, dirtyAmount) {
2276
- requiredArgs(2, arguments);
2277
- var timestamp = toDate(dirtyDate).getTime();
2278
- var amount = toInteger(dirtyAmount);
2279
- return new Date(timestamp + amount);
2280
- }
2281
-
2282
- var defaultOptions = {};
2283
- function getDefaultOptions() {
2284
- return defaultOptions;
2285
- }
2286
-
2287
- /**
2288
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
2289
- * They usually appear for dates that denote time before the timezones were introduced
2290
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
2291
- * and GMT+01:00:00 after that date)
2292
- *
2293
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
2294
- * which would lead to incorrect calculations.
2295
- *
2296
- * This function returns the timezone offset in milliseconds that takes seconds in account.
2297
- */
2298
- function getTimezoneOffsetInMilliseconds(date) {
2299
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
2300
- utcDate.setUTCFullYear(date.getFullYear());
2301
- return date.getTime() - utcDate.getTime();
2302
- }
2303
-
2304
- /**
2305
- * @name isDate
2306
- * @category Common Helpers
2307
- * @summary Is the given value a date?
2308
- *
2309
- * @description
2310
- * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
2311
- *
2312
- * @param {*} value - the value to check
2313
- * @returns {boolean} true if the given value is a date
2314
- * @throws {TypeError} 1 arguments required
2315
- *
2316
- * @example
2317
- * // For a valid date:
2318
- * const result = isDate(new Date())
2319
- * //=> true
2320
- *
2321
- * @example
2322
- * // For an invalid date:
2323
- * const result = isDate(new Date(NaN))
2324
- * //=> true
2325
- *
2326
- * @example
2327
- * // For some value:
2328
- * const result = isDate('2014-02-31')
2329
- * //=> false
2330
- *
2331
- * @example
2332
- * // For an object:
2333
- * const result = isDate({})
2334
- * //=> false
2335
- */
2336
- function isDate(value) {
2337
- requiredArgs(1, arguments);
2338
- return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
2339
- }
2340
-
2341
- /**
2342
- * @name isValid
2343
- * @category Common Helpers
2344
- * @summary Is the given date valid?
2345
- *
2346
- * @description
2347
- * Returns false if argument is Invalid Date and true otherwise.
2348
- * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
2349
- * Invalid Date is a Date, whose time value is NaN.
2350
- *
2351
- * Time value of Date: http://es5.github.io/#x15.9.1.1
2352
- *
2353
- * @param {*} date - the date to check
2354
- * @returns {Boolean} the date is valid
2355
- * @throws {TypeError} 1 argument required
2356
- *
2357
- * @example
2358
- * // For the valid date:
2359
- * const result = isValid(new Date(2014, 1, 31))
2360
- * //=> true
2361
- *
2362
- * @example
2363
- * // For the value, convertable into a date:
2364
- * const result = isValid(1393804800000)
2365
- * //=> true
2366
- *
2367
- * @example
2368
- * // For the invalid date:
2369
- * const result = isValid(new Date(''))
2370
- * //=> false
2371
- */
2372
- function isValid(dirtyDate) {
2373
- requiredArgs(1, arguments);
2374
- if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
2375
- return false;
2376
- }
2377
- var date = toDate(dirtyDate);
2378
- return !isNaN(Number(date));
2379
- }
2380
-
2381
- /**
2382
- * @name subMilliseconds
2383
- * @category Millisecond Helpers
2384
- * @summary Subtract the specified number of milliseconds from the given date.
2385
- *
2386
- * @description
2387
- * Subtract the specified number of milliseconds from the given date.
2388
- *
2389
- * @param {Date|Number} date - the date to be changed
2390
- * @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`.
2391
- * @returns {Date} the new date with the milliseconds subtracted
2392
- * @throws {TypeError} 2 arguments required
2393
- *
2394
- * @example
2395
- * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
2396
- * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
2397
- * //=> Thu Jul 10 2014 12:45:29.250
2398
- */
2399
- function subMilliseconds(dirtyDate, dirtyAmount) {
2400
- requiredArgs(2, arguments);
2401
- var amount = toInteger(dirtyAmount);
2402
- return addMilliseconds(dirtyDate, -amount);
2403
- }
2404
-
2405
- var MILLISECONDS_IN_DAY = 86400000;
2406
- function getUTCDayOfYear(dirtyDate) {
2407
- requiredArgs(1, arguments);
2408
- var date = toDate(dirtyDate);
2409
- var timestamp = date.getTime();
2410
- date.setUTCMonth(0, 1);
2411
- date.setUTCHours(0, 0, 0, 0);
2412
- var startOfYearTimestamp = date.getTime();
2413
- var difference = timestamp - startOfYearTimestamp;
2414
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
2415
- }
2416
-
2417
- function startOfUTCISOWeek(dirtyDate) {
2418
- requiredArgs(1, arguments);
2419
- var weekStartsOn = 1;
2420
- var date = toDate(dirtyDate);
2421
- var day = date.getUTCDay();
2422
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
2423
- date.setUTCDate(date.getUTCDate() - diff);
2424
- date.setUTCHours(0, 0, 0, 0);
2425
- return date;
2426
- }
2427
-
2428
- function getUTCISOWeekYear(dirtyDate) {
2429
- requiredArgs(1, arguments);
2430
- var date = toDate(dirtyDate);
2431
- var year = date.getUTCFullYear();
2432
- var fourthOfJanuaryOfNextYear = new Date(0);
2433
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
2434
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
2435
- var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
2436
- var fourthOfJanuaryOfThisYear = new Date(0);
2437
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
2438
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
2439
- var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
2440
- if (date.getTime() >= startOfNextYear.getTime()) {
2441
- return year + 1;
2442
- } else if (date.getTime() >= startOfThisYear.getTime()) {
2443
- return year;
2444
- } else {
2445
- return year - 1;
2446
- }
2447
- }
2448
-
2449
- function startOfUTCISOWeekYear(dirtyDate) {
2450
- requiredArgs(1, arguments);
2451
- var year = getUTCISOWeekYear(dirtyDate);
2452
- var fourthOfJanuary = new Date(0);
2453
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
2454
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
2455
- var date = startOfUTCISOWeek(fourthOfJanuary);
2456
- return date;
2457
- }
2458
-
2459
- var MILLISECONDS_IN_WEEK$1 = 604800000;
2460
- function getUTCISOWeek(dirtyDate) {
2461
- requiredArgs(1, arguments);
2462
- var date = toDate(dirtyDate);
2463
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
2464
-
2465
- // Round the number of days to the nearest integer
2466
- // because the number of milliseconds in a week is not constant
2467
- // (e.g. it's different in the week of the daylight saving time clock shift)
2468
- return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
2469
- }
2470
-
2471
- function startOfUTCWeek(dirtyDate, options) {
2472
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
2473
- requiredArgs(1, arguments);
2474
- var defaultOptions = getDefaultOptions();
2475
- 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);
2476
-
2477
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2478
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2479
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2480
- }
2481
- var date = toDate(dirtyDate);
2482
- var day = date.getUTCDay();
2483
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
2484
- date.setUTCDate(date.getUTCDate() - diff);
2485
- date.setUTCHours(0, 0, 0, 0);
2486
- return date;
2487
- }
2488
-
2489
- function getUTCWeekYear(dirtyDate, options) {
2490
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
2491
- requiredArgs(1, arguments);
2492
- var date = toDate(dirtyDate);
2493
- var year = date.getUTCFullYear();
2494
- var defaultOptions = getDefaultOptions();
2495
- 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);
2496
-
2497
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2498
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2499
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2500
- }
2501
- var firstWeekOfNextYear = new Date(0);
2502
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
2503
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
2504
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
2505
- var firstWeekOfThisYear = new Date(0);
2506
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
2507
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
2508
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
2509
- if (date.getTime() >= startOfNextYear.getTime()) {
2510
- return year + 1;
2511
- } else if (date.getTime() >= startOfThisYear.getTime()) {
2512
- return year;
2513
- } else {
2514
- return year - 1;
2515
- }
2516
- }
2517
-
2518
- function startOfUTCWeekYear(dirtyDate, options) {
2519
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
2520
- requiredArgs(1, arguments);
2521
- var defaultOptions = getDefaultOptions();
2522
- 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);
2523
- var year = getUTCWeekYear(dirtyDate, options);
2524
- var firstWeek = new Date(0);
2525
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
2526
- firstWeek.setUTCHours(0, 0, 0, 0);
2527
- var date = startOfUTCWeek(firstWeek, options);
2528
- return date;
2529
- }
2530
-
2531
- var MILLISECONDS_IN_WEEK = 604800000;
2532
- function getUTCWeek(dirtyDate, options) {
2533
- requiredArgs(1, arguments);
2534
- var date = toDate(dirtyDate);
2535
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
2536
-
2537
- // Round the number of days to the nearest integer
2538
- // because the number of milliseconds in a week is not constant
2539
- // (e.g. it's different in the week of the daylight saving time clock shift)
2540
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
2541
- }
2542
-
2543
- function addLeadingZeros(number, targetLength) {
2544
- var sign = number < 0 ? '-' : '';
2545
- var output = Math.abs(number).toString();
2546
- while (output.length < targetLength) {
2547
- output = '0' + output;
2548
- }
2549
- return sign + output;
2550
- }
2551
-
2552
- /*
2553
- * | | Unit | | Unit |
2554
- * |-----|--------------------------------|-----|--------------------------------|
2555
- * | a | AM, PM | A* | |
2556
- * | d | Day of month | D | |
2557
- * | h | Hour [1-12] | H | Hour [0-23] |
2558
- * | m | Minute | M | Month |
2559
- * | s | Second | S | Fraction of second |
2560
- * | y | Year (abs) | Y | |
2561
- *
2562
- * Letters marked by * are not implemented but reserved by Unicode standard.
2563
- */
2564
- var formatters$2 = {
2565
- // Year
2566
- y: function y(date, token) {
2567
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
2568
- // | Year | y | yy | yyy | yyyy | yyyyy |
2569
- // |----------|-------|----|-------|-------|-------|
2570
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
2571
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
2572
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
2573
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
2574
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
2575
-
2576
- var signedYear = date.getUTCFullYear();
2577
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
2578
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
2579
- return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
2580
- },
2581
- // Month
2582
- M: function M(date, token) {
2583
- var month = date.getUTCMonth();
2584
- return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
2585
- },
2586
- // Day of the month
2587
- d: function d(date, token) {
2588
- return addLeadingZeros(date.getUTCDate(), token.length);
2589
- },
2590
- // AM or PM
2591
- a: function a(date, token) {
2592
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
2593
- switch (token) {
2594
- case 'a':
2595
- case 'aa':
2596
- return dayPeriodEnumValue.toUpperCase();
2597
- case 'aaa':
2598
- return dayPeriodEnumValue;
2599
- case 'aaaaa':
2600
- return dayPeriodEnumValue[0];
2601
- case 'aaaa':
2602
- default:
2603
- return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
2604
- }
2605
- },
2606
- // Hour [1-12]
2607
- h: function h(date, token) {
2608
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
2609
- },
2610
- // Hour [0-23]
2611
- H: function H(date, token) {
2612
- return addLeadingZeros(date.getUTCHours(), token.length);
2613
- },
2614
- // Minute
2615
- m: function m(date, token) {
2616
- return addLeadingZeros(date.getUTCMinutes(), token.length);
2617
- },
2618
- // Second
2619
- s: function s(date, token) {
2620
- return addLeadingZeros(date.getUTCSeconds(), token.length);
2621
- },
2622
- // Fraction of second
2623
- S: function S(date, token) {
2624
- var numberOfDigits = token.length;
2625
- var milliseconds = date.getUTCMilliseconds();
2626
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
2627
- return addLeadingZeros(fractionalSeconds, token.length);
2628
- }
2629
- };
2630
- var formatters$3 = formatters$2;
2631
-
2632
- var dayPeriodEnum = {
2633
- am: 'am',
2634
- pm: 'pm',
2635
- midnight: 'midnight',
2636
- noon: 'noon',
2637
- morning: 'morning',
2638
- afternoon: 'afternoon',
2639
- evening: 'evening',
2640
- night: 'night'
2641
- };
2642
- /*
2643
- * | | Unit | | Unit |
2644
- * |-----|--------------------------------|-----|--------------------------------|
2645
- * | a | AM, PM | A* | Milliseconds in day |
2646
- * | b | AM, PM, noon, midnight | B | Flexible day period |
2647
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
2648
- * | d | Day of month | D | Day of year |
2649
- * | e | Local day of week | E | Day of week |
2650
- * | f | | F* | Day of week in month |
2651
- * | g* | Modified Julian day | G | Era |
2652
- * | h | Hour [1-12] | H | Hour [0-23] |
2653
- * | i! | ISO day of week | I! | ISO week of year |
2654
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
2655
- * | k | Hour [1-24] | K | Hour [0-11] |
2656
- * | l* | (deprecated) | L | Stand-alone month |
2657
- * | m | Minute | M | Month |
2658
- * | n | | N | |
2659
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
2660
- * | p! | Long localized time | P! | Long localized date |
2661
- * | q | Stand-alone quarter | Q | Quarter |
2662
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
2663
- * | s | Second | S | Fraction of second |
2664
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
2665
- * | u | Extended year | U* | Cyclic year |
2666
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
2667
- * | w | Local week of year | W* | Week of month |
2668
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
2669
- * | y | Year (abs) | Y | Local week-numbering year |
2670
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
2671
- *
2672
- * Letters marked by * are not implemented but reserved by Unicode standard.
2673
- *
2674
- * Letters marked by ! are non-standard, but implemented by date-fns:
2675
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
2676
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
2677
- * i.e. 7 for Sunday, 1 for Monday, etc.
2678
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
2679
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
2680
- * `R` is supposed to be used in conjunction with `I` and `i`
2681
- * for universal ISO week-numbering date, whereas
2682
- * `Y` is supposed to be used in conjunction with `w` and `e`
2683
- * for week-numbering date specific to the locale.
2684
- * - `P` is long localized date format
2685
- * - `p` is long localized time format
2686
- */
2687
-
2688
- var formatters = {
2689
- // Era
2690
- G: function G(date, token, localize) {
2691
- var era = date.getUTCFullYear() > 0 ? 1 : 0;
2692
- switch (token) {
2693
- // AD, BC
2694
- case 'G':
2695
- case 'GG':
2696
- case 'GGG':
2697
- return localize.era(era, {
2698
- width: 'abbreviated'
2699
- });
2700
- // A, B
2701
- case 'GGGGG':
2702
- return localize.era(era, {
2703
- width: 'narrow'
2704
- });
2705
- // Anno Domini, Before Christ
2706
- case 'GGGG':
2707
- default:
2708
- return localize.era(era, {
2709
- width: 'wide'
2710
- });
2711
- }
2712
- },
2713
- // Year
2714
- y: function y(date, token, localize) {
2715
- // Ordinal number
2716
- if (token === 'yo') {
2717
- var signedYear = date.getUTCFullYear();
2718
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
2719
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
2720
- return localize.ordinalNumber(year, {
2721
- unit: 'year'
2722
- });
2723
- }
2724
- return formatters$3.y(date, token);
2725
- },
2726
- // Local week-numbering year
2727
- Y: function Y(date, token, localize, options) {
2728
- var signedWeekYear = getUTCWeekYear(date, options);
2729
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
2730
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
2731
-
2732
- // Two digit year
2733
- if (token === 'YY') {
2734
- var twoDigitYear = weekYear % 100;
2735
- return addLeadingZeros(twoDigitYear, 2);
2736
- }
2737
-
2738
- // Ordinal number
2739
- if (token === 'Yo') {
2740
- return localize.ordinalNumber(weekYear, {
2741
- unit: 'year'
2742
- });
2743
- }
2744
-
2745
- // Padding
2746
- return addLeadingZeros(weekYear, token.length);
2747
- },
2748
- // ISO week-numbering year
2749
- R: function R(date, token) {
2750
- var isoWeekYear = getUTCISOWeekYear(date);
2751
-
2752
- // Padding
2753
- return addLeadingZeros(isoWeekYear, token.length);
2754
- },
2755
- // Extended year. This is a single number designating the year of this calendar system.
2756
- // The main difference between `y` and `u` localizers are B.C. years:
2757
- // | Year | `y` | `u` |
2758
- // |------|-----|-----|
2759
- // | AC 1 | 1 | 1 |
2760
- // | BC 1 | 1 | 0 |
2761
- // | BC 2 | 2 | -1 |
2762
- // Also `yy` always returns the last two digits of a year,
2763
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
2764
- u: function u(date, token) {
2765
- var year = date.getUTCFullYear();
2766
- return addLeadingZeros(year, token.length);
2767
- },
2768
- // Quarter
2769
- Q: function Q(date, token, localize) {
2770
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
2771
- switch (token) {
2772
- // 1, 2, 3, 4
2773
- case 'Q':
2774
- return String(quarter);
2775
- // 01, 02, 03, 04
2776
- case 'QQ':
2777
- return addLeadingZeros(quarter, 2);
2778
- // 1st, 2nd, 3rd, 4th
2779
- case 'Qo':
2780
- return localize.ordinalNumber(quarter, {
2781
- unit: 'quarter'
2782
- });
2783
- // Q1, Q2, Q3, Q4
2784
- case 'QQQ':
2785
- return localize.quarter(quarter, {
2786
- width: 'abbreviated',
2787
- context: 'formatting'
2788
- });
2789
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2790
- case 'QQQQQ':
2791
- return localize.quarter(quarter, {
2792
- width: 'narrow',
2793
- context: 'formatting'
2794
- });
2795
- // 1st quarter, 2nd quarter, ...
2796
- case 'QQQQ':
2797
- default:
2798
- return localize.quarter(quarter, {
2799
- width: 'wide',
2800
- context: 'formatting'
2801
- });
2802
- }
2803
- },
2804
- // Stand-alone quarter
2805
- q: function q(date, token, localize) {
2806
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
2807
- switch (token) {
2808
- // 1, 2, 3, 4
2809
- case 'q':
2810
- return String(quarter);
2811
- // 01, 02, 03, 04
2812
- case 'qq':
2813
- return addLeadingZeros(quarter, 2);
2814
- // 1st, 2nd, 3rd, 4th
2815
- case 'qo':
2816
- return localize.ordinalNumber(quarter, {
2817
- unit: 'quarter'
2818
- });
2819
- // Q1, Q2, Q3, Q4
2820
- case 'qqq':
2821
- return localize.quarter(quarter, {
2822
- width: 'abbreviated',
2823
- context: 'standalone'
2824
- });
2825
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2826
- case 'qqqqq':
2827
- return localize.quarter(quarter, {
2828
- width: 'narrow',
2829
- context: 'standalone'
2830
- });
2831
- // 1st quarter, 2nd quarter, ...
2832
- case 'qqqq':
2833
- default:
2834
- return localize.quarter(quarter, {
2835
- width: 'wide',
2836
- context: 'standalone'
2837
- });
2838
- }
2839
- },
2840
- // Month
2841
- M: function M(date, token, localize) {
2842
- var month = date.getUTCMonth();
2843
- switch (token) {
2844
- case 'M':
2845
- case 'MM':
2846
- return formatters$3.M(date, token);
2847
- // 1st, 2nd, ..., 12th
2848
- case 'Mo':
2849
- return localize.ordinalNumber(month + 1, {
2850
- unit: 'month'
2851
- });
2852
- // Jan, Feb, ..., Dec
2853
- case 'MMM':
2854
- return localize.month(month, {
2855
- width: 'abbreviated',
2856
- context: 'formatting'
2857
- });
2858
- // J, F, ..., D
2859
- case 'MMMMM':
2860
- return localize.month(month, {
2861
- width: 'narrow',
2862
- context: 'formatting'
2863
- });
2864
- // January, February, ..., December
2865
- case 'MMMM':
2866
- default:
2867
- return localize.month(month, {
2868
- width: 'wide',
2869
- context: 'formatting'
2870
- });
2871
- }
2872
- },
2873
- // Stand-alone month
2874
- L: function L(date, token, localize) {
2875
- var month = date.getUTCMonth();
2876
- switch (token) {
2877
- // 1, 2, ..., 12
2878
- case 'L':
2879
- return String(month + 1);
2880
- // 01, 02, ..., 12
2881
- case 'LL':
2882
- return addLeadingZeros(month + 1, 2);
2883
- // 1st, 2nd, ..., 12th
2884
- case 'Lo':
2885
- return localize.ordinalNumber(month + 1, {
2886
- unit: 'month'
2887
- });
2888
- // Jan, Feb, ..., Dec
2889
- case 'LLL':
2890
- return localize.month(month, {
2891
- width: 'abbreviated',
2892
- context: 'standalone'
2893
- });
2894
- // J, F, ..., D
2895
- case 'LLLLL':
2896
- return localize.month(month, {
2897
- width: 'narrow',
2898
- context: 'standalone'
2899
- });
2900
- // January, February, ..., December
2901
- case 'LLLL':
2902
- default:
2903
- return localize.month(month, {
2904
- width: 'wide',
2905
- context: 'standalone'
2906
- });
2907
- }
2908
- },
2909
- // Local week of year
2910
- w: function w(date, token, localize, options) {
2911
- var week = getUTCWeek(date, options);
2912
- if (token === 'wo') {
2913
- return localize.ordinalNumber(week, {
2914
- unit: 'week'
2915
- });
2916
- }
2917
- return addLeadingZeros(week, token.length);
2918
- },
2919
- // ISO week of year
2920
- I: function I(date, token, localize) {
2921
- var isoWeek = getUTCISOWeek(date);
2922
- if (token === 'Io') {
2923
- return localize.ordinalNumber(isoWeek, {
2924
- unit: 'week'
2925
- });
2926
- }
2927
- return addLeadingZeros(isoWeek, token.length);
2928
- },
2929
- // Day of the month
2930
- d: function d(date, token, localize) {
2931
- if (token === 'do') {
2932
- return localize.ordinalNumber(date.getUTCDate(), {
2933
- unit: 'date'
2934
- });
2935
- }
2936
- return formatters$3.d(date, token);
2937
- },
2938
- // Day of year
2939
- D: function D(date, token, localize) {
2940
- var dayOfYear = getUTCDayOfYear(date);
2941
- if (token === 'Do') {
2942
- return localize.ordinalNumber(dayOfYear, {
2943
- unit: 'dayOfYear'
2944
- });
2945
- }
2946
- return addLeadingZeros(dayOfYear, token.length);
2947
- },
2948
- // Day of week
2949
- E: function E(date, token, localize) {
2950
- var dayOfWeek = date.getUTCDay();
2951
- switch (token) {
2952
- // Tue
2953
- case 'E':
2954
- case 'EE':
2955
- case 'EEE':
2956
- return localize.day(dayOfWeek, {
2957
- width: 'abbreviated',
2958
- context: 'formatting'
2959
- });
2960
- // T
2961
- case 'EEEEE':
2962
- return localize.day(dayOfWeek, {
2963
- width: 'narrow',
2964
- context: 'formatting'
2965
- });
2966
- // Tu
2967
- case 'EEEEEE':
2968
- return localize.day(dayOfWeek, {
2969
- width: 'short',
2970
- context: 'formatting'
2971
- });
2972
- // Tuesday
2973
- case 'EEEE':
2974
- default:
2975
- return localize.day(dayOfWeek, {
2976
- width: 'wide',
2977
- context: 'formatting'
2978
- });
2979
- }
2980
- },
2981
- // Local day of week
2982
- e: function e(date, token, localize, options) {
2983
- var dayOfWeek = date.getUTCDay();
2984
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2985
- switch (token) {
2986
- // Numerical value (Nth day of week with current locale or weekStartsOn)
2987
- case 'e':
2988
- return String(localDayOfWeek);
2989
- // Padded numerical value
2990
- case 'ee':
2991
- return addLeadingZeros(localDayOfWeek, 2);
2992
- // 1st, 2nd, ..., 7th
2993
- case 'eo':
2994
- return localize.ordinalNumber(localDayOfWeek, {
2995
- unit: 'day'
2996
- });
2997
- case 'eee':
2998
- return localize.day(dayOfWeek, {
2999
- width: 'abbreviated',
3000
- context: 'formatting'
3001
- });
3002
- // T
3003
- case 'eeeee':
3004
- return localize.day(dayOfWeek, {
3005
- width: 'narrow',
3006
- context: 'formatting'
3007
- });
3008
- // Tu
3009
- case 'eeeeee':
3010
- return localize.day(dayOfWeek, {
3011
- width: 'short',
3012
- context: 'formatting'
3013
- });
3014
- // Tuesday
3015
- case 'eeee':
3016
- default:
3017
- return localize.day(dayOfWeek, {
3018
- width: 'wide',
3019
- context: 'formatting'
3020
- });
3021
- }
3022
- },
3023
- // Stand-alone local day of week
3024
- c: function c(date, token, localize, options) {
3025
- var dayOfWeek = date.getUTCDay();
3026
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
3027
- switch (token) {
3028
- // Numerical value (same as in `e`)
3029
- case 'c':
3030
- return String(localDayOfWeek);
3031
- // Padded numerical value
3032
- case 'cc':
3033
- return addLeadingZeros(localDayOfWeek, token.length);
3034
- // 1st, 2nd, ..., 7th
3035
- case 'co':
3036
- return localize.ordinalNumber(localDayOfWeek, {
3037
- unit: 'day'
3038
- });
3039
- case 'ccc':
3040
- return localize.day(dayOfWeek, {
3041
- width: 'abbreviated',
3042
- context: 'standalone'
3043
- });
3044
- // T
3045
- case 'ccccc':
3046
- return localize.day(dayOfWeek, {
3047
- width: 'narrow',
3048
- context: 'standalone'
3049
- });
3050
- // Tu
3051
- case 'cccccc':
3052
- return localize.day(dayOfWeek, {
3053
- width: 'short',
3054
- context: 'standalone'
3055
- });
3056
- // Tuesday
3057
- case 'cccc':
3058
- default:
3059
- return localize.day(dayOfWeek, {
3060
- width: 'wide',
3061
- context: 'standalone'
3062
- });
3063
- }
3064
- },
3065
- // ISO day of week
3066
- i: function i(date, token, localize) {
3067
- var dayOfWeek = date.getUTCDay();
3068
- var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
3069
- switch (token) {
3070
- // 2
3071
- case 'i':
3072
- return String(isoDayOfWeek);
3073
- // 02
3074
- case 'ii':
3075
- return addLeadingZeros(isoDayOfWeek, token.length);
3076
- // 2nd
3077
- case 'io':
3078
- return localize.ordinalNumber(isoDayOfWeek, {
3079
- unit: 'day'
3080
- });
3081
- // Tue
3082
- case 'iii':
3083
- return localize.day(dayOfWeek, {
3084
- width: 'abbreviated',
3085
- context: 'formatting'
3086
- });
3087
- // T
3088
- case 'iiiii':
3089
- return localize.day(dayOfWeek, {
3090
- width: 'narrow',
3091
- context: 'formatting'
3092
- });
3093
- // Tu
3094
- case 'iiiiii':
3095
- return localize.day(dayOfWeek, {
3096
- width: 'short',
3097
- context: 'formatting'
3098
- });
3099
- // Tuesday
3100
- case 'iiii':
3101
- default:
3102
- return localize.day(dayOfWeek, {
3103
- width: 'wide',
3104
- context: 'formatting'
3105
- });
3106
- }
3107
- },
3108
- // AM or PM
3109
- a: function a(date, token, localize) {
3110
- var hours = date.getUTCHours();
3111
- var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
3112
- switch (token) {
3113
- case 'a':
3114
- case 'aa':
3115
- return localize.dayPeriod(dayPeriodEnumValue, {
3116
- width: 'abbreviated',
3117
- context: 'formatting'
3118
- });
3119
- case 'aaa':
3120
- return localize.dayPeriod(dayPeriodEnumValue, {
3121
- width: 'abbreviated',
3122
- context: 'formatting'
3123
- }).toLowerCase();
3124
- case 'aaaaa':
3125
- return localize.dayPeriod(dayPeriodEnumValue, {
3126
- width: 'narrow',
3127
- context: 'formatting'
3128
- });
3129
- case 'aaaa':
3130
- default:
3131
- return localize.dayPeriod(dayPeriodEnumValue, {
3132
- width: 'wide',
3133
- context: 'formatting'
3134
- });
3135
- }
3136
- },
3137
- // AM, PM, midnight, noon
3138
- b: function b(date, token, localize) {
3139
- var hours = date.getUTCHours();
3140
- var dayPeriodEnumValue;
3141
- if (hours === 12) {
3142
- dayPeriodEnumValue = dayPeriodEnum.noon;
3143
- } else if (hours === 0) {
3144
- dayPeriodEnumValue = dayPeriodEnum.midnight;
3145
- } else {
3146
- dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
3147
- }
3148
- switch (token) {
3149
- case 'b':
3150
- case 'bb':
3151
- return localize.dayPeriod(dayPeriodEnumValue, {
3152
- width: 'abbreviated',
3153
- context: 'formatting'
3154
- });
3155
- case 'bbb':
3156
- return localize.dayPeriod(dayPeriodEnumValue, {
3157
- width: 'abbreviated',
3158
- context: 'formatting'
3159
- }).toLowerCase();
3160
- case 'bbbbb':
3161
- return localize.dayPeriod(dayPeriodEnumValue, {
3162
- width: 'narrow',
3163
- context: 'formatting'
3164
- });
3165
- case 'bbbb':
3166
- default:
3167
- return localize.dayPeriod(dayPeriodEnumValue, {
3168
- width: 'wide',
3169
- context: 'formatting'
3170
- });
3171
- }
3172
- },
3173
- // in the morning, in the afternoon, in the evening, at night
3174
- B: function B(date, token, localize) {
3175
- var hours = date.getUTCHours();
3176
- var dayPeriodEnumValue;
3177
- if (hours >= 17) {
3178
- dayPeriodEnumValue = dayPeriodEnum.evening;
3179
- } else if (hours >= 12) {
3180
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
3181
- } else if (hours >= 4) {
3182
- dayPeriodEnumValue = dayPeriodEnum.morning;
3183
- } else {
3184
- dayPeriodEnumValue = dayPeriodEnum.night;
3185
- }
3186
- switch (token) {
3187
- case 'B':
3188
- case 'BB':
3189
- case 'BBB':
3190
- return localize.dayPeriod(dayPeriodEnumValue, {
3191
- width: 'abbreviated',
3192
- context: 'formatting'
3193
- });
3194
- case 'BBBBB':
3195
- return localize.dayPeriod(dayPeriodEnumValue, {
3196
- width: 'narrow',
3197
- context: 'formatting'
3198
- });
3199
- case 'BBBB':
3200
- default:
3201
- return localize.dayPeriod(dayPeriodEnumValue, {
3202
- width: 'wide',
3203
- context: 'formatting'
3204
- });
3205
- }
3206
- },
3207
- // Hour [1-12]
3208
- h: function h(date, token, localize) {
3209
- if (token === 'ho') {
3210
- var hours = date.getUTCHours() % 12;
3211
- if (hours === 0) hours = 12;
3212
- return localize.ordinalNumber(hours, {
3213
- unit: 'hour'
3214
- });
3215
- }
3216
- return formatters$3.h(date, token);
3217
- },
3218
- // Hour [0-23]
3219
- H: function H(date, token, localize) {
3220
- if (token === 'Ho') {
3221
- return localize.ordinalNumber(date.getUTCHours(), {
3222
- unit: 'hour'
3223
- });
3224
- }
3225
- return formatters$3.H(date, token);
3226
- },
3227
- // Hour [0-11]
3228
- K: function K(date, token, localize) {
3229
- var hours = date.getUTCHours() % 12;
3230
- if (token === 'Ko') {
3231
- return localize.ordinalNumber(hours, {
3232
- unit: 'hour'
3233
- });
3234
- }
3235
- return addLeadingZeros(hours, token.length);
3236
- },
3237
- // Hour [1-24]
3238
- k: function k(date, token, localize) {
3239
- var hours = date.getUTCHours();
3240
- if (hours === 0) hours = 24;
3241
- if (token === 'ko') {
3242
- return localize.ordinalNumber(hours, {
3243
- unit: 'hour'
3244
- });
3245
- }
3246
- return addLeadingZeros(hours, token.length);
3247
- },
3248
- // Minute
3249
- m: function m(date, token, localize) {
3250
- if (token === 'mo') {
3251
- return localize.ordinalNumber(date.getUTCMinutes(), {
3252
- unit: 'minute'
3253
- });
3254
- }
3255
- return formatters$3.m(date, token);
3256
- },
3257
- // Second
3258
- s: function s(date, token, localize) {
3259
- if (token === 'so') {
3260
- return localize.ordinalNumber(date.getUTCSeconds(), {
3261
- unit: 'second'
3262
- });
3263
- }
3264
- return formatters$3.s(date, token);
3265
- },
3266
- // Fraction of second
3267
- S: function S(date, token) {
3268
- return formatters$3.S(date, token);
3269
- },
3270
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
3271
- X: function X(date, token, _localize, options) {
3272
- var originalDate = options._originalDate || date;
3273
- var timezoneOffset = originalDate.getTimezoneOffset();
3274
- if (timezoneOffset === 0) {
3275
- return 'Z';
3276
- }
3277
- switch (token) {
3278
- // Hours and optional minutes
3279
- case 'X':
3280
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
3281
-
3282
- // Hours, minutes and optional seconds without `:` delimiter
3283
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3284
- // so this token always has the same output as `XX`
3285
- case 'XXXX':
3286
- case 'XX':
3287
- // Hours and minutes without `:` delimiter
3288
- return formatTimezone(timezoneOffset);
3289
-
3290
- // Hours, minutes and optional seconds with `:` delimiter
3291
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3292
- // so this token always has the same output as `XXX`
3293
- case 'XXXXX':
3294
- case 'XXX': // Hours and minutes with `:` delimiter
3295
- default:
3296
- return formatTimezone(timezoneOffset, ':');
3297
- }
3298
- },
3299
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
3300
- x: function x(date, token, _localize, options) {
3301
- var originalDate = options._originalDate || date;
3302
- var timezoneOffset = originalDate.getTimezoneOffset();
3303
- switch (token) {
3304
- // Hours and optional minutes
3305
- case 'x':
3306
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
3307
-
3308
- // Hours, minutes and optional seconds without `:` delimiter
3309
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3310
- // so this token always has the same output as `xx`
3311
- case 'xxxx':
3312
- case 'xx':
3313
- // Hours and minutes without `:` delimiter
3314
- return formatTimezone(timezoneOffset);
3315
-
3316
- // Hours, minutes and optional seconds with `:` delimiter
3317
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3318
- // so this token always has the same output as `xxx`
3319
- case 'xxxxx':
3320
- case 'xxx': // Hours and minutes with `:` delimiter
3321
- default:
3322
- return formatTimezone(timezoneOffset, ':');
3323
- }
3324
- },
3325
- // Timezone (GMT)
3326
- O: function O(date, token, _localize, options) {
3327
- var originalDate = options._originalDate || date;
3328
- var timezoneOffset = originalDate.getTimezoneOffset();
3329
- switch (token) {
3330
- // Short
3331
- case 'O':
3332
- case 'OO':
3333
- case 'OOO':
3334
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
3335
- // Long
3336
- case 'OOOO':
3337
- default:
3338
- return 'GMT' + formatTimezone(timezoneOffset, ':');
3339
- }
3340
- },
3341
- // Timezone (specific non-location)
3342
- z: function z(date, token, _localize, options) {
3343
- var originalDate = options._originalDate || date;
3344
- var timezoneOffset = originalDate.getTimezoneOffset();
3345
- switch (token) {
3346
- // Short
3347
- case 'z':
3348
- case 'zz':
3349
- case 'zzz':
3350
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
3351
- // Long
3352
- case 'zzzz':
3353
- default:
3354
- return 'GMT' + formatTimezone(timezoneOffset, ':');
3355
- }
3356
- },
3357
- // Seconds timestamp
3358
- t: function t(date, token, _localize, options) {
3359
- var originalDate = options._originalDate || date;
3360
- var timestamp = Math.floor(originalDate.getTime() / 1000);
3361
- return addLeadingZeros(timestamp, token.length);
3362
- },
3363
- // Milliseconds timestamp
3364
- T: function T(date, token, _localize, options) {
3365
- var originalDate = options._originalDate || date;
3366
- var timestamp = originalDate.getTime();
3367
- return addLeadingZeros(timestamp, token.length);
3368
- }
3369
- };
3370
- function formatTimezoneShort(offset, dirtyDelimiter) {
3371
- var sign = offset > 0 ? '-' : '+';
3372
- var absOffset = Math.abs(offset);
3373
- var hours = Math.floor(absOffset / 60);
3374
- var minutes = absOffset % 60;
3375
- if (minutes === 0) {
3376
- return sign + String(hours);
3377
- }
3378
- var delimiter = dirtyDelimiter || '';
3379
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
3380
- }
3381
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
3382
- if (offset % 60 === 0) {
3383
- var sign = offset > 0 ? '-' : '+';
3384
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
3385
- }
3386
- return formatTimezone(offset, dirtyDelimiter);
3387
- }
3388
- function formatTimezone(offset, dirtyDelimiter) {
3389
- var delimiter = dirtyDelimiter || '';
3390
- var sign = offset > 0 ? '-' : '+';
3391
- var absOffset = Math.abs(offset);
3392
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
3393
- var minutes = addLeadingZeros(absOffset % 60, 2);
3394
- return sign + hours + delimiter + minutes;
3395
- }
3396
- var formatters$1 = formatters;
3397
-
3398
- var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
3399
- switch (pattern) {
3400
- case 'P':
3401
- return formatLong.date({
3402
- width: 'short'
3403
- });
3404
- case 'PP':
3405
- return formatLong.date({
3406
- width: 'medium'
3407
- });
3408
- case 'PPP':
3409
- return formatLong.date({
3410
- width: 'long'
3411
- });
3412
- case 'PPPP':
3413
- default:
3414
- return formatLong.date({
3415
- width: 'full'
3416
- });
3417
- }
3418
- };
3419
- var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
3420
- switch (pattern) {
3421
- case 'p':
3422
- return formatLong.time({
3423
- width: 'short'
3424
- });
3425
- case 'pp':
3426
- return formatLong.time({
3427
- width: 'medium'
3428
- });
3429
- case 'ppp':
3430
- return formatLong.time({
3431
- width: 'long'
3432
- });
3433
- case 'pppp':
3434
- default:
3435
- return formatLong.time({
3436
- width: 'full'
3437
- });
3438
- }
3439
- };
3440
- var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
3441
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
3442
- var datePattern = matchResult[1];
3443
- var timePattern = matchResult[2];
3444
- if (!timePattern) {
3445
- return dateLongFormatter(pattern, formatLong);
3446
- }
3447
- var dateTimeFormat;
3448
- switch (datePattern) {
3449
- case 'P':
3450
- dateTimeFormat = formatLong.dateTime({
3451
- width: 'short'
3452
- });
3453
- break;
3454
- case 'PP':
3455
- dateTimeFormat = formatLong.dateTime({
3456
- width: 'medium'
3457
- });
3458
- break;
3459
- case 'PPP':
3460
- dateTimeFormat = formatLong.dateTime({
3461
- width: 'long'
3462
- });
3463
- break;
3464
- case 'PPPP':
3465
- default:
3466
- dateTimeFormat = formatLong.dateTime({
3467
- width: 'full'
3468
- });
3469
- break;
3470
- }
3471
- return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
3472
- };
3473
- var longFormatters = {
3474
- p: timeLongFormatter,
3475
- P: dateTimeLongFormatter
3476
- };
3477
- var longFormatters$1 = longFormatters;
3478
-
3479
- var protectedDayOfYearTokens = ['D', 'DD'];
3480
- var protectedWeekYearTokens = ['YY', 'YYYY'];
3481
- function isProtectedDayOfYearToken(token) {
3482
- return protectedDayOfYearTokens.indexOf(token) !== -1;
3483
- }
3484
- function isProtectedWeekYearToken(token) {
3485
- return protectedWeekYearTokens.indexOf(token) !== -1;
3486
- }
3487
- function throwProtectedError(token, format, input) {
3488
- if (token === 'YYYY') {
3489
- 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"));
3490
- } else if (token === 'YY') {
3491
- 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"));
3492
- } else if (token === 'D') {
3493
- 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"));
3494
- } else if (token === 'DD') {
3495
- 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"));
3496
- }
3497
- }
3498
-
3499
- var formatDistanceLocale = {
3500
- lessThanXSeconds: {
3501
- one: 'less than a second',
3502
- other: 'less than {{count}} seconds'
3503
- },
3504
- xSeconds: {
3505
- one: '1 second',
3506
- other: '{{count}} seconds'
3507
- },
3508
- halfAMinute: 'half a minute',
3509
- lessThanXMinutes: {
3510
- one: 'less than a minute',
3511
- other: 'less than {{count}} minutes'
3512
- },
3513
- xMinutes: {
3514
- one: '1 minute',
3515
- other: '{{count}} minutes'
3516
- },
3517
- aboutXHours: {
3518
- one: 'about 1 hour',
3519
- other: 'about {{count}} hours'
3520
- },
3521
- xHours: {
3522
- one: '1 hour',
3523
- other: '{{count}} hours'
3524
- },
3525
- xDays: {
3526
- one: '1 day',
3527
- other: '{{count}} days'
3528
- },
3529
- aboutXWeeks: {
3530
- one: 'about 1 week',
3531
- other: 'about {{count}} weeks'
3532
- },
3533
- xWeeks: {
3534
- one: '1 week',
3535
- other: '{{count}} weeks'
3536
- },
3537
- aboutXMonths: {
3538
- one: 'about 1 month',
3539
- other: 'about {{count}} months'
3540
- },
3541
- xMonths: {
3542
- one: '1 month',
3543
- other: '{{count}} months'
3544
- },
3545
- aboutXYears: {
3546
- one: 'about 1 year',
3547
- other: 'about {{count}} years'
3548
- },
3549
- xYears: {
3550
- one: '1 year',
3551
- other: '{{count}} years'
3552
- },
3553
- overXYears: {
3554
- one: 'over 1 year',
3555
- other: 'over {{count}} years'
3556
- },
3557
- almostXYears: {
3558
- one: 'almost 1 year',
3559
- other: 'almost {{count}} years'
3560
- }
3561
- };
3562
- var formatDistance = function formatDistance(token, count, options) {
3563
- var result;
3564
- var tokenValue = formatDistanceLocale[token];
3565
- if (typeof tokenValue === 'string') {
3566
- result = tokenValue;
3567
- } else if (count === 1) {
3568
- result = tokenValue.one;
3569
- } else {
3570
- result = tokenValue.other.replace('{{count}}', count.toString());
3571
- }
3572
- if (options !== null && options !== void 0 && options.addSuffix) {
3573
- if (options.comparison && options.comparison > 0) {
3574
- return 'in ' + result;
3575
- } else {
3576
- return result + ' ago';
3577
- }
3578
- }
3579
- return result;
3580
- };
3581
- var formatDistance$1 = formatDistance;
3582
-
3583
- function buildFormatLongFn(args) {
3584
- return function () {
3585
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3586
- // TODO: Remove String()
3587
- var width = options.width ? String(options.width) : args.defaultWidth;
3588
- var format = args.formats[width] || args.formats[args.defaultWidth];
3589
- return format;
3590
- };
3591
- }
3592
-
3593
- var dateFormats = {
3594
- full: 'EEEE, MMMM do, y',
3595
- long: 'MMMM do, y',
3596
- medium: 'MMM d, y',
3597
- short: 'MM/dd/yyyy'
3598
- };
3599
- var timeFormats = {
3600
- full: 'h:mm:ss a zzzz',
3601
- long: 'h:mm:ss a z',
3602
- medium: 'h:mm:ss a',
3603
- short: 'h:mm a'
3604
- };
3605
- var dateTimeFormats = {
3606
- full: "{{date}} 'at' {{time}}",
3607
- long: "{{date}} 'at' {{time}}",
3608
- medium: '{{date}}, {{time}}',
3609
- short: '{{date}}, {{time}}'
3610
- };
3611
- var formatLong = {
3612
- date: buildFormatLongFn({
3613
- formats: dateFormats,
3614
- defaultWidth: 'full'
3615
- }),
3616
- time: buildFormatLongFn({
3617
- formats: timeFormats,
3618
- defaultWidth: 'full'
3619
- }),
3620
- dateTime: buildFormatLongFn({
3621
- formats: dateTimeFormats,
3622
- defaultWidth: 'full'
3623
- })
3624
- };
3625
- var formatLong$1 = formatLong;
3626
-
3627
- var formatRelativeLocale = {
3628
- lastWeek: "'last' eeee 'at' p",
3629
- yesterday: "'yesterday at' p",
3630
- today: "'today at' p",
3631
- tomorrow: "'tomorrow at' p",
3632
- nextWeek: "eeee 'at' p",
3633
- other: 'P'
3634
- };
3635
- var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
3636
- return formatRelativeLocale[token];
3637
- };
3638
- var formatRelative$1 = formatRelative;
3639
-
3640
- function buildLocalizeFn(args) {
3641
- return function (dirtyIndex, options) {
3642
- var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
3643
- var valuesArray;
3644
- if (context === 'formatting' && args.formattingValues) {
3645
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
3646
- var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
3647
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
3648
- } else {
3649
- var _defaultWidth = args.defaultWidth;
3650
- var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
3651
- valuesArray = args.values[_width] || args.values[_defaultWidth];
3652
- }
3653
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
3654
- // @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!
3655
- return valuesArray[index];
3656
- };
3657
- }
3658
-
3659
- var eraValues = {
3660
- narrow: ['B', 'A'],
3661
- abbreviated: ['BC', 'AD'],
3662
- wide: ['Before Christ', 'Anno Domini']
3663
- };
3664
- var quarterValues = {
3665
- narrow: ['1', '2', '3', '4'],
3666
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
3667
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
3668
- };
2392
+ if (!active) {
2393
+ directionClassName.value = '';
2394
+ orderClassName.value = '';
2395
+ activeClassName.value = '';
2396
+ }
2397
+ });
2398
+ });
2399
+ return () => h$1('div', {
2400
+ class: [
2401
+ 'carousel-item',
2402
+ activeClassName.value,
2403
+ directionClassName.value,
2404
+ orderClassName.value,
2405
+ ],
2406
+ ref: carouselItemRef,
2407
+ }, slots.default && slots.default());
2408
+ },
2409
+ });
3669
2410
 
3670
- // Note: in English, the names of days of the week and months are capitalized.
3671
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
3672
- // Generally, formatted dates should look like they are in the middle of a sentence,
3673
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
3674
- var monthValues = {
3675
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
3676
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
3677
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
3678
- };
3679
- var dayValues = {
3680
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
3681
- short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
3682
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
3683
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
3684
- };
3685
- var dayPeriodValues = {
3686
- narrow: {
3687
- am: 'a',
3688
- pm: 'p',
3689
- midnight: 'mi',
3690
- noon: 'n',
3691
- morning: 'morning',
3692
- afternoon: 'afternoon',
3693
- evening: 'evening',
3694
- night: 'night'
3695
- },
3696
- abbreviated: {
3697
- am: 'AM',
3698
- pm: 'PM',
3699
- midnight: 'midnight',
3700
- noon: 'noon',
3701
- morning: 'morning',
3702
- afternoon: 'afternoon',
3703
- evening: 'evening',
3704
- night: 'night'
3705
- },
3706
- wide: {
3707
- am: 'a.m.',
3708
- pm: 'p.m.',
3709
- midnight: 'midnight',
3710
- noon: 'noon',
3711
- morning: 'morning',
3712
- afternoon: 'afternoon',
3713
- evening: 'evening',
3714
- night: 'night'
3715
- }
3716
- };
3717
- var formattingDayPeriodValues = {
3718
- narrow: {
3719
- am: 'a',
3720
- pm: 'p',
3721
- midnight: 'mi',
3722
- noon: 'n',
3723
- morning: 'in the morning',
3724
- afternoon: 'in the afternoon',
3725
- evening: 'in the evening',
3726
- night: 'at night'
3727
- },
3728
- abbreviated: {
3729
- am: 'AM',
3730
- pm: 'PM',
3731
- midnight: 'midnight',
3732
- noon: 'noon',
3733
- morning: 'in the morning',
3734
- afternoon: 'in the afternoon',
3735
- evening: 'in the evening',
3736
- night: 'at night'
3737
- },
3738
- wide: {
3739
- am: 'a.m.',
3740
- pm: 'p.m.',
3741
- midnight: 'midnight',
3742
- noon: 'noon',
3743
- morning: 'in the morning',
3744
- afternoon: 'in the afternoon',
3745
- evening: 'in the evening',
3746
- night: 'at night'
3747
- }
3748
- };
3749
- var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
3750
- var number = Number(dirtyNumber);
3751
-
3752
- // If ordinal numbers depend on context, for example,
3753
- // if they are different for different grammatical genders,
3754
- // use `options.unit`.
3755
- //
3756
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
3757
- // 'day', 'hour', 'minute', 'second'.
3758
-
3759
- var rem100 = number % 100;
3760
- if (rem100 > 20 || rem100 < 10) {
3761
- switch (rem100 % 10) {
3762
- case 1:
3763
- return number + 'st';
3764
- case 2:
3765
- return number + 'nd';
3766
- case 3:
3767
- return number + 'rd';
3768
- }
3769
- }
3770
- return number + 'th';
3771
- };
3772
- var localize = {
3773
- ordinalNumber: ordinalNumber,
3774
- era: buildLocalizeFn({
3775
- values: eraValues,
3776
- defaultWidth: 'wide'
3777
- }),
3778
- quarter: buildLocalizeFn({
3779
- values: quarterValues,
3780
- defaultWidth: 'wide',
3781
- argumentCallback: function argumentCallback(quarter) {
3782
- return quarter - 1;
3783
- }
3784
- }),
3785
- month: buildLocalizeFn({
3786
- values: monthValues,
3787
- defaultWidth: 'wide'
3788
- }),
3789
- day: buildLocalizeFn({
3790
- values: dayValues,
3791
- defaultWidth: 'wide'
3792
- }),
3793
- dayPeriod: buildLocalizeFn({
3794
- values: dayPeriodValues,
3795
- defaultWidth: 'wide',
3796
- formattingValues: formattingDayPeriodValues,
3797
- defaultFormattingWidth: 'wide'
3798
- })
2411
+ const CCarouselPlugin = {
2412
+ install: (app) => {
2413
+ app.component(CCarousel.name, CCarousel);
2414
+ app.component(CCarouselCaption.name, CCarouselCaption);
2415
+ app.component(CCarouselItem.name, CCarouselItem);
2416
+ },
3799
2417
  };
3800
- var localize$1 = localize;
3801
-
3802
- function buildMatchFn(args) {
3803
- return function (string) {
3804
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3805
- var width = options.width;
3806
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
3807
- var matchResult = string.match(matchPattern);
3808
- if (!matchResult) {
3809
- return null;
3810
- }
3811
- var matchedString = matchResult[0];
3812
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
3813
- var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
3814
- return pattern.test(matchedString);
3815
- }) : findKey(parsePatterns, function (pattern) {
3816
- return pattern.test(matchedString);
3817
- });
3818
- var value;
3819
- value = args.valueCallback ? args.valueCallback(key) : key;
3820
- value = options.valueCallback ? options.valueCallback(value) : value;
3821
- var rest = string.slice(matchedString.length);
3822
- return {
3823
- value: value,
3824
- rest: rest
3825
- };
3826
- };
3827
- }
3828
- function findKey(object, predicate) {
3829
- for (var key in object) {
3830
- if (object.hasOwnProperty(key) && predicate(object[key])) {
3831
- return key;
3832
- }
3833
- }
3834
- return undefined;
3835
- }
3836
- function findIndex(array, predicate) {
3837
- for (var key = 0; key < array.length; key++) {
3838
- if (predicate(array[key])) {
3839
- return key;
3840
- }
3841
- }
3842
- return undefined;
3843
- }
3844
-
3845
- function buildMatchPatternFn(args) {
3846
- return function (string) {
3847
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3848
- var matchResult = string.match(args.matchPattern);
3849
- if (!matchResult) return null;
3850
- var matchedString = matchResult[0];
3851
- var parseResult = string.match(args.parsePattern);
3852
- if (!parseResult) return null;
3853
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
3854
- value = options.valueCallback ? options.valueCallback(value) : value;
3855
- var rest = string.slice(matchedString.length);
3856
- return {
3857
- value: value,
3858
- rest: rest
3859
- };
3860
- };
3861
- }
3862
2418
 
3863
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
3864
- var parseOrdinalNumberPattern = /\d+/i;
3865
- var matchEraPatterns = {
3866
- narrow: /^(b|a)/i,
3867
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
3868
- wide: /^(before christ|before common era|anno domini|common era)/i
3869
- };
3870
- var parseEraPatterns = {
3871
- any: [/^b/i, /^(a|c)/i]
3872
- };
3873
- var matchQuarterPatterns = {
3874
- narrow: /^[1234]/i,
3875
- abbreviated: /^q[1234]/i,
3876
- wide: /^[1234](th|st|nd|rd)? quarter/i
3877
- };
3878
- var parseQuarterPatterns = {
3879
- any: [/1/i, /2/i, /3/i, /4/i]
3880
- };
3881
- var matchMonthPatterns = {
3882
- narrow: /^[jfmasond]/i,
3883
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
3884
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
3885
- };
3886
- var parseMonthPatterns = {
3887
- 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],
3888
- 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]
3889
- };
3890
- var matchDayPatterns = {
3891
- narrow: /^[smtwf]/i,
3892
- short: /^(su|mo|tu|we|th|fr|sa)/i,
3893
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
3894
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
3895
- };
3896
- var parseDayPatterns = {
3897
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
3898
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
3899
- };
3900
- var matchDayPeriodPatterns = {
3901
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
3902
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
3903
- };
3904
- var parseDayPeriodPatterns = {
3905
- any: {
3906
- am: /^a/i,
3907
- pm: /^p/i,
3908
- midnight: /^mi/i,
3909
- noon: /^no/i,
3910
- morning: /morning/i,
3911
- afternoon: /afternoon/i,
3912
- evening: /evening/i,
3913
- night: /night/i
3914
- }
3915
- };
3916
- var match = {
3917
- ordinalNumber: buildMatchPatternFn({
3918
- matchPattern: matchOrdinalNumberPattern,
3919
- parsePattern: parseOrdinalNumberPattern,
3920
- valueCallback: function valueCallback(value) {
3921
- return parseInt(value, 10);
3922
- }
3923
- }),
3924
- era: buildMatchFn({
3925
- matchPatterns: matchEraPatterns,
3926
- defaultMatchWidth: 'wide',
3927
- parsePatterns: parseEraPatterns,
3928
- defaultParseWidth: 'any'
3929
- }),
3930
- quarter: buildMatchFn({
3931
- matchPatterns: matchQuarterPatterns,
3932
- defaultMatchWidth: 'wide',
3933
- parsePatterns: parseQuarterPatterns,
3934
- defaultParseWidth: 'any',
3935
- valueCallback: function valueCallback(index) {
3936
- return index + 1;
3937
- }
3938
- }),
3939
- month: buildMatchFn({
3940
- matchPatterns: matchMonthPatterns,
3941
- defaultMatchWidth: 'wide',
3942
- parsePatterns: parseMonthPatterns,
3943
- defaultParseWidth: 'any'
3944
- }),
3945
- day: buildMatchFn({
3946
- matchPatterns: matchDayPatterns,
3947
- defaultMatchWidth: 'wide',
3948
- parsePatterns: parseDayPatterns,
3949
- defaultParseWidth: 'any'
3950
- }),
3951
- dayPeriod: buildMatchFn({
3952
- matchPatterns: matchDayPeriodPatterns,
3953
- defaultMatchWidth: 'any',
3954
- parsePatterns: parseDayPeriodPatterns,
3955
- defaultParseWidth: 'any'
3956
- })
3957
- };
3958
- var match$1 = match;
3959
-
3960
- /**
3961
- * @type {Locale}
3962
- * @category Locales
3963
- * @summary English locale (United States).
3964
- * @language English
3965
- * @iso-639-2 eng
3966
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
3967
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
3968
- */
3969
- var locale = {
3970
- code: 'en-US',
3971
- formatDistance: formatDistance$1,
3972
- formatLong: formatLong$1,
3973
- formatRelative: formatRelative$1,
3974
- localize: localize$1,
3975
- match: match$1,
3976
- options: {
3977
- weekStartsOn: 0 /* Sunday */,
3978
- firstWeekContainsDate: 1
3979
- }
2419
+ const CCollapsePlugin = {
2420
+ install: (app) => {
2421
+ app.component(CCollapse.name, CCollapse);
2422
+ },
3980
2423
  };
3981
- var defaultLocale = locale;
3982
-
3983
- // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
3984
- // (one of the certain letters followed by `o`)
3985
- // - (\w)\1* matches any sequences of the same letter
3986
- // - '' matches two quote characters in a row
3987
- // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
3988
- // except a single quote symbol, which ends the sequence.
3989
- // Two quote characters do not end the sequence.
3990
- // If there is no matching single quote
3991
- // then the sequence will continue until the end of the string.
3992
- // - . matches any single character unmatched by previous parts of the RegExps
3993
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
3994
-
3995
- // This RegExp catches symbols escaped by quotes, and also
3996
- // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
3997
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
3998
- var escapedStringRegExp = /^'([^]*?)'?$/;
3999
- var doubleQuoteRegExp = /''/g;
4000
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
4001
-
4002
- /**
4003
- * @name format
4004
- * @category Common Helpers
4005
- * @summary Format the date.
4006
- *
4007
- * @description
4008
- * Return the formatted date string in the given format. The result may vary by locale.
4009
- *
4010
- * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
4011
- * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
4012
- *
4013
- * The characters wrapped between two single quotes characters (') are escaped.
4014
- * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
4015
- * (see the last example)
4016
- *
4017
- * Format of the string is based on Unicode Technical Standard #35:
4018
- * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
4019
- * with a few additions (see note 7 below the table).
4020
- *
4021
- * Accepted patterns:
4022
- * | Unit | Pattern | Result examples | Notes |
4023
- * |---------------------------------|---------|-----------------------------------|-------|
4024
- * | Era | G..GGG | AD, BC | |
4025
- * | | GGGG | Anno Domini, Before Christ | 2 |
4026
- * | | GGGGG | A, B | |
4027
- * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
4028
- * | | yo | 44th, 1st, 0th, 17th | 5,7 |
4029
- * | | yy | 44, 01, 00, 17 | 5 |
4030
- * | | yyy | 044, 001, 1900, 2017 | 5 |
4031
- * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
4032
- * | | yyyyy | ... | 3,5 |
4033
- * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
4034
- * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
4035
- * | | YY | 44, 01, 00, 17 | 5,8 |
4036
- * | | YYY | 044, 001, 1900, 2017 | 5 |
4037
- * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
4038
- * | | YYYYY | ... | 3,5 |
4039
- * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
4040
- * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
4041
- * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
4042
- * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
4043
- * | | RRRRR | ... | 3,5,7 |
4044
- * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
4045
- * | | uu | -43, 01, 1900, 2017 | 5 |
4046
- * | | uuu | -043, 001, 1900, 2017 | 5 |
4047
- * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
4048
- * | | uuuuu | ... | 3,5 |
4049
- * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
4050
- * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
4051
- * | | QQ | 01, 02, 03, 04 | |
4052
- * | | QQQ | Q1, Q2, Q3, Q4 | |
4053
- * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
4054
- * | | QQQQQ | 1, 2, 3, 4 | 4 |
4055
- * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
4056
- * | | qo | 1st, 2nd, 3rd, 4th | 7 |
4057
- * | | qq | 01, 02, 03, 04 | |
4058
- * | | qqq | Q1, Q2, Q3, Q4 | |
4059
- * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
4060
- * | | qqqqq | 1, 2, 3, 4 | 4 |
4061
- * | Month (formatting) | M | 1, 2, ..., 12 | |
4062
- * | | Mo | 1st, 2nd, ..., 12th | 7 |
4063
- * | | MM | 01, 02, ..., 12 | |
4064
- * | | MMM | Jan, Feb, ..., Dec | |
4065
- * | | MMMM | January, February, ..., December | 2 |
4066
- * | | MMMMM | J, F, ..., D | |
4067
- * | Month (stand-alone) | L | 1, 2, ..., 12 | |
4068
- * | | Lo | 1st, 2nd, ..., 12th | 7 |
4069
- * | | LL | 01, 02, ..., 12 | |
4070
- * | | LLL | Jan, Feb, ..., Dec | |
4071
- * | | LLLL | January, February, ..., December | 2 |
4072
- * | | LLLLL | J, F, ..., D | |
4073
- * | Local week of year | w | 1, 2, ..., 53 | |
4074
- * | | wo | 1st, 2nd, ..., 53th | 7 |
4075
- * | | ww | 01, 02, ..., 53 | |
4076
- * | ISO week of year | I | 1, 2, ..., 53 | 7 |
4077
- * | | Io | 1st, 2nd, ..., 53th | 7 |
4078
- * | | II | 01, 02, ..., 53 | 7 |
4079
- * | Day of month | d | 1, 2, ..., 31 | |
4080
- * | | do | 1st, 2nd, ..., 31st | 7 |
4081
- * | | dd | 01, 02, ..., 31 | |
4082
- * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
4083
- * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
4084
- * | | DD | 01, 02, ..., 365, 366 | 9 |
4085
- * | | DDD | 001, 002, ..., 365, 366 | |
4086
- * | | DDDD | ... | 3 |
4087
- * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
4088
- * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
4089
- * | | EEEEE | M, T, W, T, F, S, S | |
4090
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
4091
- * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
4092
- * | | io | 1st, 2nd, ..., 7th | 7 |
4093
- * | | ii | 01, 02, ..., 07 | 7 |
4094
- * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
4095
- * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
4096
- * | | iiiii | M, T, W, T, F, S, S | 7 |
4097
- * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
4098
- * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
4099
- * | | eo | 2nd, 3rd, ..., 1st | 7 |
4100
- * | | ee | 02, 03, ..., 01 | |
4101
- * | | eee | Mon, Tue, Wed, ..., Sun | |
4102
- * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
4103
- * | | eeeee | M, T, W, T, F, S, S | |
4104
- * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
4105
- * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
4106
- * | | co | 2nd, 3rd, ..., 1st | 7 |
4107
- * | | cc | 02, 03, ..., 01 | |
4108
- * | | ccc | Mon, Tue, Wed, ..., Sun | |
4109
- * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
4110
- * | | ccccc | M, T, W, T, F, S, S | |
4111
- * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
4112
- * | AM, PM | a..aa | AM, PM | |
4113
- * | | aaa | am, pm | |
4114
- * | | aaaa | a.m., p.m. | 2 |
4115
- * | | aaaaa | a, p | |
4116
- * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
4117
- * | | bbb | am, pm, noon, midnight | |
4118
- * | | bbbb | a.m., p.m., noon, midnight | 2 |
4119
- * | | bbbbb | a, p, n, mi | |
4120
- * | Flexible day period | B..BBB | at night, in the morning, ... | |
4121
- * | | BBBB | at night, in the morning, ... | 2 |
4122
- * | | BBBBB | at night, in the morning, ... | |
4123
- * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
4124
- * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
4125
- * | | hh | 01, 02, ..., 11, 12 | |
4126
- * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
4127
- * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
4128
- * | | HH | 00, 01, 02, ..., 23 | |
4129
- * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
4130
- * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
4131
- * | | KK | 01, 02, ..., 11, 00 | |
4132
- * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
4133
- * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
4134
- * | | kk | 24, 01, 02, ..., 23 | |
4135
- * | Minute | m | 0, 1, ..., 59 | |
4136
- * | | mo | 0th, 1st, ..., 59th | 7 |
4137
- * | | mm | 00, 01, ..., 59 | |
4138
- * | Second | s | 0, 1, ..., 59 | |
4139
- * | | so | 0th, 1st, ..., 59th | 7 |
4140
- * | | ss | 00, 01, ..., 59 | |
4141
- * | Fraction of second | S | 0, 1, ..., 9 | |
4142
- * | | SS | 00, 01, ..., 99 | |
4143
- * | | SSS | 000, 001, ..., 999 | |
4144
- * | | SSSS | ... | 3 |
4145
- * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
4146
- * | | XX | -0800, +0530, Z | |
4147
- * | | XXX | -08:00, +05:30, Z | |
4148
- * | | XXXX | -0800, +0530, Z, +123456 | 2 |
4149
- * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
4150
- * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
4151
- * | | xx | -0800, +0530, +0000 | |
4152
- * | | xxx | -08:00, +05:30, +00:00 | 2 |
4153
- * | | xxxx | -0800, +0530, +0000, +123456 | |
4154
- * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
4155
- * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
4156
- * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
4157
- * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
4158
- * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
4159
- * | Seconds timestamp | t | 512969520 | 7 |
4160
- * | | tt | ... | 3,7 |
4161
- * | Milliseconds timestamp | T | 512969520900 | 7 |
4162
- * | | TT | ... | 3,7 |
4163
- * | Long localized date | P | 04/29/1453 | 7 |
4164
- * | | PP | Apr 29, 1453 | 7 |
4165
- * | | PPP | April 29th, 1453 | 7 |
4166
- * | | PPPP | Friday, April 29th, 1453 | 2,7 |
4167
- * | Long localized time | p | 12:00 AM | 7 |
4168
- * | | pp | 12:00:00 AM | 7 |
4169
- * | | ppp | 12:00:00 AM GMT+2 | 7 |
4170
- * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
4171
- * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
4172
- * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
4173
- * | | PPPppp | April 29th, 1453 at ... | 7 |
4174
- * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
4175
- * Notes:
4176
- * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
4177
- * are the same as "stand-alone" units, but are different in some languages.
4178
- * "Formatting" units are declined according to the rules of the language
4179
- * in the context of a date. "Stand-alone" units are always nominative singular:
4180
- *
4181
- * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
4182
- *
4183
- * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
4184
- *
4185
- * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
4186
- * the single quote characters (see below).
4187
- * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
4188
- * the output will be the same as default pattern for this unit, usually
4189
- * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
4190
- * are marked with "2" in the last column of the table.
4191
- *
4192
- * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
4193
- *
4194
- * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
4195
- *
4196
- * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
4197
- *
4198
- * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
4199
- *
4200
- * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
4201
- *
4202
- * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
4203
- * The output will be padded with zeros to match the length of the pattern.
4204
- *
4205
- * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
4206
- *
4207
- * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
4208
- * These tokens represent the shortest form of the quarter.
4209
- *
4210
- * 5. The main difference between `y` and `u` patterns are B.C. years:
4211
- *
4212
- * | Year | `y` | `u` |
4213
- * |------|-----|-----|
4214
- * | AC 1 | 1 | 1 |
4215
- * | BC 1 | 1 | 0 |
4216
- * | BC 2 | 2 | -1 |
4217
- *
4218
- * Also `yy` always returns the last two digits of a year,
4219
- * while `uu` pads single digit years to 2 characters and returns other years unchanged:
4220
- *
4221
- * | Year | `yy` | `uu` |
4222
- * |------|------|------|
4223
- * | 1 | 01 | 01 |
4224
- * | 14 | 14 | 14 |
4225
- * | 376 | 76 | 376 |
4226
- * | 1453 | 53 | 1453 |
4227
- *
4228
- * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
4229
- * except local week-numbering years are dependent on `options.weekStartsOn`
4230
- * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
4231
- * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
4232
- *
4233
- * 6. Specific non-location timezones are currently unavailable in `date-fns`,
4234
- * so right now these tokens fall back to GMT timezones.
4235
- *
4236
- * 7. These patterns are not in the Unicode Technical Standard #35:
4237
- * - `i`: ISO day of week
4238
- * - `I`: ISO week of year
4239
- * - `R`: ISO week-numbering year
4240
- * - `t`: seconds timestamp
4241
- * - `T`: milliseconds timestamp
4242
- * - `o`: ordinal number modifier
4243
- * - `P`: long localized date
4244
- * - `p`: long localized time
4245
- *
4246
- * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
4247
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
4248
- *
4249
- * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
4250
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
4251
- *
4252
- * @param {Date|Number} date - the original date
4253
- * @param {String} format - the string of tokens
4254
- * @param {Object} [options] - an object with options.
4255
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
4256
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
4257
- * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
4258
- * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
4259
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
4260
- * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
4261
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
4262
- * @returns {String} the formatted date string
4263
- * @throws {TypeError} 2 arguments required
4264
- * @throws {RangeError} `date` must not be Invalid Date
4265
- * @throws {RangeError} `options.locale` must contain `localize` property
4266
- * @throws {RangeError} `options.locale` must contain `formatLong` property
4267
- * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
4268
- * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
4269
- * @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
4270
- * @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
4271
- * @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
4272
- * @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
4273
- * @throws {RangeError} format string contains an unescaped latin alphabet character
4274
- *
4275
- * @example
4276
- * // Represent 11 February 2014 in middle-endian format:
4277
- * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
4278
- * //=> '02/11/2014'
4279
- *
4280
- * @example
4281
- * // Represent 2 July 2014 in Esperanto:
4282
- * import { eoLocale } from 'date-fns/locale/eo'
4283
- * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
4284
- * locale: eoLocale
4285
- * })
4286
- * //=> '2-a de julio 2014'
4287
- *
4288
- * @example
4289
- * // Escape string by single quote characters:
4290
- * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
4291
- * //=> "3 o'clock"
4292
- */
4293
-
4294
- function format(dirtyDate, dirtyFormatStr, options) {
4295
- 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;
4296
- requiredArgs(2, arguments);
4297
- var formatStr = String(dirtyFormatStr);
4298
- var defaultOptions = getDefaultOptions();
4299
- 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;
4300
- 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);
4301
-
4302
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
4303
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
4304
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
4305
- }
4306
- 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);
4307
-
4308
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
4309
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
4310
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
4311
- }
4312
- if (!locale.localize) {
4313
- throw new RangeError('locale must contain localize property');
4314
- }
4315
- if (!locale.formatLong) {
4316
- throw new RangeError('locale must contain formatLong property');
4317
- }
4318
- var originalDate = toDate(dirtyDate);
4319
- if (!isValid(originalDate)) {
4320
- throw new RangeError('Invalid time value');
4321
- }
4322
-
4323
- // Convert the date in system timezone to the same date in UTC+00:00 timezone.
4324
- // This ensures that when UTC functions will be implemented, locales will be compatible with them.
4325
- // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
4326
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
4327
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
4328
- var formatterOptions = {
4329
- firstWeekContainsDate: firstWeekContainsDate,
4330
- weekStartsOn: weekStartsOn,
4331
- locale: locale,
4332
- _originalDate: originalDate
4333
- };
4334
- var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
4335
- var firstCharacter = substring[0];
4336
- if (firstCharacter === 'p' || firstCharacter === 'P') {
4337
- var longFormatter = longFormatters$1[firstCharacter];
4338
- return longFormatter(substring, locale.formatLong);
4339
- }
4340
- return substring;
4341
- }).join('').match(formattingTokensRegExp).map(function (substring) {
4342
- // Replace two single quote characters with one single quote character
4343
- if (substring === "''") {
4344
- return "'";
4345
- }
4346
- var firstCharacter = substring[0];
4347
- if (firstCharacter === "'") {
4348
- return cleanEscapedString(substring);
4349
- }
4350
- var formatter = formatters$1[firstCharacter];
4351
- if (formatter) {
4352
- if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
4353
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
4354
- }
4355
- if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
4356
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
4357
- }
4358
- return formatter(utcDate, substring, locale.localize, formatterOptions);
4359
- }
4360
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
4361
- throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
4362
- }
4363
- return substring;
4364
- }).join('');
4365
- return result;
4366
- }
4367
- function cleanEscapedString(input) {
4368
- var matched = input.match(escapedStringRegExp);
4369
- if (!matched) {
4370
- return input;
4371
- }
4372
- return matched[1].replace(doubleQuoteRegExp, "'");
4373
- }
4374
2424
 
4375
2425
  const CFormFeedback = defineComponent({
4376
2426
  name: 'CFormFeedback',
@@ -6525,7 +4575,7 @@ const CPicker = defineComponent({
6525
4575
  /**
6526
4576
  * @slot Location for the footer element.
6527
4577
  */
6528
- slots.footer && slots.footer(),
4578
+ props.footer && slots.footer && slots.footer(),
6529
4579
  ]),
6530
4580
  ]);
6531
4581
  }
@@ -6950,12 +5000,12 @@ const CTimePicker = defineComponent({
6950
5000
  listOfSeconds: [],
6951
5001
  hour12: false,
6952
5002
  });
6953
- const isValid = ref(props.valid || (props.invalid && false));
5003
+ const isValid = ref(props.valid ?? (props.invalid === true ? false : undefined));
6954
5004
  watch(() => props.time, () => {
6955
5005
  date.value = convertTimeToDate(props.time);
6956
5006
  });
6957
5007
  watch(() => [props.valid, props.invalid], () => {
6958
- isValid.value = props.valid || (props.invalid && false);
5008
+ isValid.value = props.valid ?? (props.invalid === true ? false : undefined);
6959
5009
  });
6960
5010
  watch(date, () => {
6961
5011
  localizedTimePartials.value = getLocalizedTimePartials(props.locale, props.ampm);
@@ -7238,14 +5288,93 @@ const getLocalDateFromString = (string, locale, time) => {
7238
5288
  const newDate = partials.groups &&
7239
5289
  (time
7240
5290
  ? new Date(Number(partials.groups['year']), Number(partials.groups['month']) - 1, Number(partials.groups['day']), partials.groups['ampm']
7241
- ? partials.groups['ampm'] === 'PM'
5291
+ ? (partials.groups['ampm'] === 'PM'
7242
5292
  ? Number(partials.groups['hour']) + 12
7243
- : Number(partials.groups['hour'])
5293
+ : Number(partials.groups['hour']))
7244
5294
  : Number(partials.groups['hour']), Number(partials.groups['minute']), Number(partials.groups['second']))
7245
5295
  : new Date(Number(partials.groups['year']), Number(partials.groups['month']) - 1, Number(partials.groups['day'])));
7246
5296
  return newDate;
7247
5297
  };
7248
5298
 
5299
+ const getStoredTheme = (localStorageItemName) => typeof window !== 'undefined' && localStorage.getItem(localStorageItemName);
5300
+ const setStoredTheme = (localStorageItemName, colorMode) => localStorage.setItem(localStorageItemName, colorMode);
5301
+ const getPreferredColorScheme = (localStorageItemName) => {
5302
+ if (typeof window === 'undefined') {
5303
+ return;
5304
+ }
5305
+ const storedTheme = getStoredTheme(localStorageItemName);
5306
+ if (storedTheme) {
5307
+ return storedTheme;
5308
+ }
5309
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
5310
+ };
5311
+ const setTheme = (colorMode) => {
5312
+ document.documentElement.dataset.coreuiTheme =
5313
+ colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
5314
+ ? 'dark'
5315
+ : colorMode;
5316
+ const event = new Event('ColorSchemeChange');
5317
+ document.documentElement.dispatchEvent(event);
5318
+ };
5319
+ const useColorModes = (localStorageItemName = 'coreui-vue-color-scheme') => {
5320
+ const colorMode = ref(getPreferredColorScheme(localStorageItemName));
5321
+ watch(colorMode, () => {
5322
+ if (colorMode.value) {
5323
+ setStoredTheme(localStorageItemName, colorMode.value);
5324
+ setTheme(colorMode.value);
5325
+ }
5326
+ });
5327
+ onBeforeMount(() => {
5328
+ if (typeof getStoredTheme(localStorageItemName) === 'string' && colorMode.value) {
5329
+ setTheme(colorMode.value);
5330
+ }
5331
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
5332
+ const storedTheme = getStoredTheme(localStorageItemName);
5333
+ if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode.value) {
5334
+ setTheme(colorMode.value);
5335
+ }
5336
+ });
5337
+ });
5338
+ return {
5339
+ colorMode,
5340
+ isColorModeSet: () => Boolean(getStoredTheme(localStorageItemName)),
5341
+ setColorMode: (mode) => {
5342
+ colorMode.value = mode;
5343
+ },
5344
+ };
5345
+ };
5346
+
5347
+ const useDebouncedCallback = (callback, delay) => {
5348
+ const timeout = ref();
5349
+ const debouncedFn = (...args) => {
5350
+ const handler = () => {
5351
+ clearTimeout(timeout.value);
5352
+ callback(...args);
5353
+ };
5354
+ clearTimeout(timeout.value);
5355
+ timeout.value = setTimeout(handler, delay);
5356
+ };
5357
+ return debouncedFn();
5358
+ };
5359
+
5360
+ const usePopper = () => {
5361
+ const _popper = ref();
5362
+ const initPopper = (reference, popper, options) => {
5363
+ _popper.value = createPopper(reference, popper, options);
5364
+ };
5365
+ const destroyPopper = () => {
5366
+ if (_popper.value) {
5367
+ _popper.value.destroy();
5368
+ }
5369
+ _popper.value = undefined;
5370
+ };
5371
+ return {
5372
+ popper: _popper.value,
5373
+ initPopper,
5374
+ destroyPopper,
5375
+ };
5376
+ };
5377
+
7249
5378
  const CDateRangePicker = defineComponent({
7250
5379
  name: 'CDateRangePicker',
7251
5380
  props: {
@@ -7450,6 +5579,27 @@ const CDateRangePicker = defineComponent({
7450
5579
  * Toggle the readonly state for the component.
7451
5580
  */
7452
5581
  inputReadOnly: Boolean,
5582
+ /**
5583
+ * Custom function to format the selected date into a string according to a custom format.
5584
+ *
5585
+ * @since v5.0.0-alpha.4
5586
+ */
5587
+ inputDateFormat: Function,
5588
+ /**
5589
+ * Custom function to parse the input value into a valid Date object.
5590
+ *
5591
+ * @since v5.0.0-alpha.4
5592
+ */
5593
+ inputDateParse: Function,
5594
+ /**
5595
+ * Defines the delay (in milliseconds) for the input field's onChange event.
5596
+ *
5597
+ * @since v5.0.0-alpha.4
5598
+ */
5599
+ inputOnChangeDelay: {
5600
+ type: Number,
5601
+ default: 750,
5602
+ },
7453
5603
  /**
7454
5604
  * Set component validation state to invalid.
7455
5605
  *
@@ -7527,6 +5677,16 @@ const CDateRangePicker = defineComponent({
7527
5677
  * @since 4.9.0
7528
5678
  */
7529
5679
  selectAdjacementDays: Boolean,
5680
+ /**
5681
+ * Specify the type of date selection as day, week, month, or year.
5682
+ *
5683
+ * @since 5.0.0-alpha.1
5684
+ */
5685
+ selectionType: {
5686
+ type: String,
5687
+ default: 'day',
5688
+ validator: (value) => ['day', 'week', 'month', 'year'].includes(value),
5689
+ },
7530
5690
  /**
7531
5691
  * Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
7532
5692
  *
@@ -7536,6 +5696,12 @@ const CDateRangePicker = defineComponent({
7536
5696
  type: Boolean,
7537
5697
  default: true,
7538
5698
  },
5699
+ /**
5700
+ * Set whether to display week numbers in the calendar.
5701
+ *
5702
+ * @since 5.0.0-alpha.1
5703
+ */
5704
+ showWeekNumber: Boolean,
7539
5705
  /**
7540
5706
  * Default icon or character character that separates two dates.
7541
5707
  */
@@ -7648,6 +5814,12 @@ const CDateRangePicker = defineComponent({
7648
5814
  return false;
7649
5815
  },
7650
5816
  },
5817
+ /**
5818
+ * Label displayed over week numbers in the calendar.
5819
+ *
5820
+ * @since 5.0.0-alpha.1
5821
+ */
5822
+ weekNumbersLabel: String,
7651
5823
  },
7652
5824
  emits: [
7653
5825
  /**
@@ -7691,53 +5863,45 @@ const CDateRangePicker = defineComponent({
7691
5863
  const inputEndRef = ref();
7692
5864
  const inputStartRef = ref();
7693
5865
  const formRef = ref();
5866
+ const calendarDate = ref(props.calendarDate ?? null);
5867
+ const endDate = ref(props.endDate ?? null);
5868
+ const maxDate = ref(props.maxDate ?? null);
5869
+ const minDate = ref(props.minDate ?? null);
5870
+ const startDate = ref(props.startDate ?? null);
7694
5871
  const visible = ref(props.visible);
7695
- const calendarDate = ref(props.calendarDate
7696
- ? new Date(props.calendarDate)
7697
- : props.startDate
7698
- ? new Date(props.startDate)
7699
- : props.endDate
7700
- ? new Date(props.endDate)
7701
- : new Date());
5872
+ const initialStartDate = ref(props.startDate ?? null);
5873
+ const initialEndDate = ref(props.endDate ?? null);
7702
5874
  const inputStartHoverValue = ref(null);
7703
5875
  const inputEndHoverValue = ref(null);
7704
- const startDate = ref(props.startDate ? new Date(props.startDate) : null);
7705
- const endDate = ref(props.endDate ? new Date(props.endDate) : null);
7706
- const initialStartDate = ref(startDate.value ? new Date(startDate.value) : null);
7707
- const initialEndDate = ref(endDate.value ? new Date(endDate.value) : null);
7708
- const maxDate = ref(props.maxDate && new Date(props.maxDate));
7709
- const minDate = ref(props.minDate && new Date(props.minDate));
7710
- const selectEndDate = ref(false);
7711
- const isValid = ref(props.valid || (props.invalid && false));
5876
+ const isValid = ref(props.valid ?? (props.invalid === true ? false : undefined));
7712
5877
  const isMobile = ref(false);
5878
+ const selectEndDate = ref(false);
7713
5879
  onMounted(() => {
7714
5880
  isMobile.value = window.innerWidth < 768;
7715
5881
  });
7716
5882
  watch(() => [props.valid, props.invalid], () => {
7717
- isValid.value = props.valid || (props.invalid && false);
5883
+ isValid.value = props.valid ?? (props.invalid === true ? false : undefined);
7718
5884
  });
7719
5885
  watch(() => props.startDate, () => {
7720
5886
  if (props.startDate) {
7721
- const date = new Date(props.startDate);
7722
- calendarDate.value = date;
7723
- startDate.value = date;
5887
+ calendarDate.value = props.startDate;
5888
+ startDate.value = props.startDate;
7724
5889
  }
7725
5890
  });
7726
5891
  watch(() => props.endDate, () => {
7727
5892
  if (props.endDate) {
7728
- const date = new Date(props.endDate);
7729
- calendarDate.value = date;
7730
- endDate.value = date;
5893
+ calendarDate.value = props.endDate;
5894
+ endDate.value = props.endDate;
7731
5895
  }
7732
5896
  });
7733
5897
  watch(() => props.maxDate, () => {
7734
5898
  if (props.maxDate) {
7735
- maxDate.value = new Date(props.maxDate);
5899
+ maxDate.value = props.maxDate;
7736
5900
  }
7737
5901
  });
7738
5902
  watch(() => props.minDate, () => {
7739
5903
  if (props.minDate) {
7740
- minDate.value = new Date(props.minDate);
5904
+ minDate.value = props.minDate;
7741
5905
  }
7742
5906
  });
7743
5907
  watch(inputStartRef, () => {
@@ -7754,11 +5918,15 @@ const CDateRangePicker = defineComponent({
7754
5918
  }
7755
5919
  });
7756
5920
  const formatDate = (date) => {
7757
- return props.format
7758
- ? format(date, props.format)
5921
+ if (props.selectionType !== 'day') {
5922
+ return date;
5923
+ }
5924
+ const _date = new Date(date);
5925
+ return props.inputDateFormat
5926
+ ? props.inputDateFormat(_date)
7759
5927
  : props.timepicker
7760
- ? date.toLocaleString(props.locale)
7761
- : date.toLocaleDateString(props.locale);
5928
+ ? _date.toLocaleString(props.locale)
5929
+ : _date.toLocaleDateString(props.locale);
7762
5930
  };
7763
5931
  const setInputValue = (date) => {
7764
5932
  if (date) {
@@ -7766,20 +5934,13 @@ const CDateRangePicker = defineComponent({
7766
5934
  }
7767
5935
  return '';
7768
5936
  };
7769
- const handleCalendarCellHover = (date) => {
5937
+ const handleDateHover = (date) => {
7770
5938
  if (selectEndDate.value) {
7771
5939
  inputEndHoverValue.value = date;
7772
5940
  return;
7773
5941
  }
7774
5942
  inputStartHoverValue.value = date;
7775
5943
  };
7776
- const handleCalendarDateChange = (date, difference) => {
7777
- if (difference) {
7778
- calendarDate.value = new Date(date.getFullYear(), date.getMonth() - difference, 1);
7779
- return;
7780
- }
7781
- calendarDate.value = date;
7782
- };
7783
5944
  const handleFormValidation = (form) => {
7784
5945
  if (!form.classList.contains('was-validated')) {
7785
5946
  return;
@@ -7831,6 +5992,20 @@ const CDateRangePicker = defineComponent({
7831
5992
  emit('update:start-date', null);
7832
5993
  emit('update:end-date', null);
7833
5994
  };
5995
+ const handleOnChange = (value, input) => {
5996
+ const date = props.inputDateParse
5997
+ ? props.inputDateParse(value)
5998
+ : getLocalDateFromString(value, props.locale, props.timepicker);
5999
+ if (date instanceof Date && date.getTime()) {
6000
+ calendarDate.value = date;
6001
+ if (input === 'start') {
6002
+ startDate.value = date;
6003
+ }
6004
+ else {
6005
+ endDate.value = date;
6006
+ }
6007
+ }
6008
+ };
7834
6009
  const InputGroup = () => h$1('div', {
7835
6010
  class: 'date-picker-input-group',
7836
6011
  }, [
@@ -7847,13 +6022,8 @@ const CDateRangePicker = defineComponent({
7847
6022
  onClick: () => {
7848
6023
  selectEndDate.value = false;
7849
6024
  },
7850
- onInput: (event) => {
7851
- const date = getLocalDateFromString(event.target.value, props.locale, props.timepicker);
7852
- if (date instanceof Date && date.getTime()) {
7853
- calendarDate.value = date;
7854
- startDate.value = date;
7855
- }
7856
- },
6025
+ onChange: (event) => handleOnChange(event.target.value, 'start'),
6026
+ onInput: (event) => useDebouncedCallback(() => handleOnChange(event.target.value, 'start'), props.inputOnChangeDelay),
7857
6027
  placeholder: Array.isArray(props.placeholder)
7858
6028
  ? props.placeholder[0]
7859
6029
  : props.placeholder,
@@ -7879,13 +6049,8 @@ const CDateRangePicker = defineComponent({
7879
6049
  onClick: () => {
7880
6050
  selectEndDate.value = true;
7881
6051
  },
7882
- onInput: (event) => {
7883
- const date = getLocalDateFromString(event.target.value, props.locale, props.timepicker);
7884
- if (date instanceof Date && date.getTime()) {
7885
- calendarDate.value = date;
7886
- endDate.value = date;
7887
- }
7888
- },
6052
+ onChange: (event) => handleOnChange(event.target.value, 'end'),
6053
+ onInput: (event) => useDebouncedCallback(() => handleOnChange(event.target.value, 'end'), props.inputOnChangeDelay),
7889
6054
  placeholder: props.placeholder[1],
7890
6055
  readonly: props.inputReadOnly || typeof props.format === 'string',
7891
6056
  required: props.required,
@@ -7995,26 +6160,36 @@ const CDateRangePicker = defineComponent({
7995
6160
  variant: 'ghost',
7996
6161
  }, () => key))),
7997
6162
  h$1('div', { class: 'date-picker-calendars' }, h$1(CCalendar, {
7998
- calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), 1),
7999
- calendars: props.calendars,
6163
+ calendarDate: calendarDate.value,
6164
+ calendars: isMobile.value ? 1 : props.calendars,
6165
+ class: 'date-picker-calendars',
8000
6166
  dayFormat: props.dayFormat,
8001
6167
  disabledDates: props.disabledDates,
8002
- ...(endDate.value && { endDate: endDate.value }),
6168
+ endDate: endDate.value,
8003
6169
  firstDayOfWeek: props.firstDayOfWeek,
8004
6170
  locale: props.locale,
8005
6171
  maxDate: maxDate.value,
8006
6172
  minDate: minDate.value,
8007
- navYearFirst: props.navYearFirst,
8008
6173
  navigation: props.navigation,
6174
+ navYearFirst: props.navYearFirst,
8009
6175
  range: props.range,
8010
- selectEndDate: selectEndDate.value,
8011
6176
  selectAdjacementDays: props.selectAdjacementDays,
6177
+ selectEndDate: selectEndDate.value,
6178
+ selectionType: props.selectionType,
8012
6179
  showAdjacementDays: props.showAdjacementDays,
8013
- ...(startDate.value && { startDate: startDate.value }),
8014
- onCalendarCellHover: (date) => handleCalendarCellHover(date),
8015
- onCalendarDateChange: (date) => handleCalendarDateChange(date),
6180
+ showWeekNumber: props.showWeekNumber,
6181
+ startDate: startDate.value,
6182
+ weekdayFormat: props.weekdayFormat,
6183
+ weekNumbersLabel: props.weekNumbersLabel,
6184
+ onDateHover: (date) => handleDateHover(date),
6185
+ onCalendarDateChange: (date) => {
6186
+ calendarDate.value = date;
6187
+ },
8016
6188
  onStartDateChange: (date) => handleStartDateChange(date),
8017
6189
  onEndDateChange: (date) => handleEndDateChange(date),
6190
+ onSelectEndChange: (value) => {
6191
+ selectEndDate.value = value;
6192
+ },
8018
6193
  }, {
8019
6194
  /**
8020
6195
  * @slot Location for next icon.
@@ -8049,7 +6224,7 @@ const CDateRangePicker = defineComponent({
8049
6224
  disabled: startDate.value === null ? true : false,
8050
6225
  locale: props.locale,
8051
6226
  onChange: (_, __, date) => handleStartDateChange(date),
8052
- time: startDate.value,
6227
+ time: startDate.value && new Date(startDate.value),
8053
6228
  variant: 'select',
8054
6229
  }),
8055
6230
  h$1(CTimePicker, {
@@ -8057,7 +6232,7 @@ const CDateRangePicker = defineComponent({
8057
6232
  disabled: endDate.value === null ? true : false,
8058
6233
  locale: props.locale,
8059
6234
  onChange: (_, __, date) => handleEndDateChange(date),
8060
- time: endDate.value,
6235
+ time: endDate.value && new Date(endDate.value),
8061
6236
  variant: 'select',
8062
6237
  }),
8063
6238
  ]
@@ -8074,7 +6249,9 @@ const CDateRangePicker = defineComponent({
8074
6249
  onChange: (_, __, date) => index === 0
8075
6250
  ? handleStartDateChange(date)
8076
6251
  : handleEndDateChange(date),
8077
- time: index === 0 ? startDate.value : endDate.value,
6252
+ time: index === 0
6253
+ ? startDate.value && new Date(startDate.value)
6254
+ : endDate.value && new Date(endDate.value),
8078
6255
  variant: 'select',
8079
6256
  }))),
8080
6257
  ]),
@@ -8264,7 +6441,28 @@ const CDatePicker = defineComponent({
8264
6441
  /**
8265
6442
  * Toggle the readonly state for the component.
8266
6443
  */
8267
- inputReadOnly: Boolean,
6444
+ inputReadOnly: Boolean,
6445
+ /**
6446
+ * Custom function to format the selected date into a string according to a custom format.
6447
+ *
6448
+ * @since v5.0.0-alpha.4
6449
+ */
6450
+ inputDateFormat: Function,
6451
+ /**
6452
+ * Custom function to parse the input value into a valid Date object.
6453
+ *
6454
+ * @since v5.0.0-alpha.4
6455
+ */
6456
+ inputDateParse: Function,
6457
+ /**
6458
+ * Defines the delay (in milliseconds) for the input field's onChange event.
6459
+ *
6460
+ * @since v5.0.0-alpha.4
6461
+ */
6462
+ inputOnChangeDelay: {
6463
+ type: Number,
6464
+ default: 750,
6465
+ },
8268
6466
  /**
8269
6467
  * Sets the default locale for components. If not set, it is inherited from the navigator.language.
8270
6468
  */
@@ -8310,6 +6508,16 @@ const CDatePicker = defineComponent({
8310
6508
  * @since 4.9.0
8311
6509
  */
8312
6510
  selectAdjacementDays: Boolean,
6511
+ /**
6512
+ * Specify the type of date selection as day, week, month, or year.
6513
+ *
6514
+ * @since 5.0.0-alpha.1
6515
+ */
6516
+ selectionType: {
6517
+ type: String,
6518
+ default: 'day',
6519
+ validator: (value) => ['day', 'week', 'month', 'year'].includes(value),
6520
+ },
8313
6521
  /**
8314
6522
  * Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
8315
6523
  *
@@ -8319,6 +6527,12 @@ const CDatePicker = defineComponent({
8319
6527
  type: Boolean,
8320
6528
  default: true,
8321
6529
  },
6530
+ /**
6531
+ * Set whether to display week numbers in the calendar.
6532
+ *
6533
+ * @since 5.0.0-alpha.1
6534
+ */
6535
+ showWeekNumber: Boolean,
8322
6536
  /**
8323
6537
  * Size the component small or large.
8324
6538
  *
@@ -8356,6 +6570,12 @@ const CDatePicker = defineComponent({
8356
6570
  return false;
8357
6571
  },
8358
6572
  },
6573
+ /**
6574
+ * Label displayed over week numbers in the calendar.
6575
+ *
6576
+ * @since 5.0.0-alpha.1
6577
+ */
6578
+ weekNumbersLabel: String,
8359
6579
  },
8360
6580
  emits: [
8361
6581
  /**
@@ -8393,72 +6613,30 @@ const CDatePickerPlugin = {
8393
6613
  },
8394
6614
  };
8395
6615
 
8396
- const getStoredTheme = (localStorageItemName) => typeof window !== 'undefined' && localStorage.getItem(localStorageItemName);
8397
- const setStoredTheme = (localStorageItemName, colorMode) => localStorage.setItem(localStorageItemName, colorMode);
8398
- const getPreferredColorScheme = (localStorageItemName) => {
8399
- if (typeof window === 'undefined') {
8400
- return;
6616
+ const getAlignmentClassNames = (alignment) => {
6617
+ const classNames = [];
6618
+ if (typeof alignment === 'object') {
6619
+ Object.keys(alignment).map((key) => {
6620
+ classNames.push(`dropdown-menu${key === 'xs' ? '' : `-${key}`}-${alignment[key]}`);
6621
+ });
8401
6622
  }
8402
- const storedTheme = getStoredTheme(localStorageItemName);
8403
- if (storedTheme) {
8404
- return storedTheme;
6623
+ if (typeof alignment === 'string') {
6624
+ classNames.push(`dropdown-menu-${alignment}`);
8405
6625
  }
8406
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
8407
- };
8408
- const setTheme = (colorMode) => {
8409
- document.documentElement.dataset.coreuiTheme =
8410
- colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
8411
- ? 'dark'
8412
- : colorMode;
8413
- const event = new Event('ColorSchemeChange');
8414
- document.documentElement.dispatchEvent(event);
8415
- };
8416
- const useColorModes = (localStorageItemName = 'coreui-vue-color-scheme') => {
8417
- const colorMode = ref(getPreferredColorScheme(localStorageItemName));
8418
- watch(colorMode, () => {
8419
- if (colorMode.value) {
8420
- setStoredTheme(localStorageItemName, colorMode.value);
8421
- setTheme(colorMode.value);
8422
- }
8423
- });
8424
- onBeforeMount(() => {
8425
- if (typeof getStoredTheme(localStorageItemName) === 'string' && colorMode.value) {
8426
- setTheme(colorMode.value);
8427
- }
8428
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
8429
- const storedTheme = getStoredTheme(localStorageItemName);
8430
- if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode.value) {
8431
- setTheme(colorMode.value);
8432
- }
8433
- });
8434
- });
8435
- return {
8436
- colorMode,
8437
- isColorModeSet: () => Boolean(getStoredTheme(localStorageItemName)),
8438
- setColorMode: (mode) => {
8439
- colorMode.value = mode;
8440
- },
8441
- };
6626
+ return classNames;
8442
6627
  };
8443
-
8444
- const usePopper = () => {
8445
- const _popper = ref();
8446
- const initPopper = (reference, popper, options) => {
8447
- _popper.value = createPopper(reference, popper, options);
8448
- };
8449
- const destroyPopper = () => {
8450
- if (_popper.value) {
8451
- _popper.value.destroy();
8452
- }
8453
- _popper.value = undefined;
8454
- };
8455
- return {
8456
- popper: _popper.value,
8457
- initPopper,
8458
- destroyPopper,
8459
- };
6628
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
6629
+ const listLength = list.length;
6630
+ let index = list.indexOf(activeElement);
6631
+ if (index === -1) {
6632
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
6633
+ }
6634
+ index += shouldGetNext ? 1 : -1;
6635
+ if (isCycleAllowed) {
6636
+ index = (index + listLength) % listLength;
6637
+ }
6638
+ return list[Math.max(0, Math.min(index, listLength - 1))];
8460
6639
  };
8461
-
8462
6640
  const getPlacement = (placement, direction, alignment, isRTL) => {
8463
6641
  let _placement = placement;
8464
6642
  if (direction === 'dropup') {
@@ -8478,6 +6656,7 @@ const getPlacement = (placement, direction, alignment, isRTL) => {
8478
6656
  }
8479
6657
  return _placement;
8480
6658
  };
6659
+
8481
6660
  const CDropdown = defineComponent({
8482
6661
  name: 'CDropdown',
8483
6662
  props: {
@@ -8633,12 +6812,17 @@ const CDropdown = defineComponent({
8633
6812
  popper.value && initPopper(dropdownToggleRef.value, dropdownMenuRef.value, popperConfig);
8634
6813
  window.addEventListener('mouseup', handleMouseUp);
8635
6814
  window.addEventListener('keyup', handleKeyup);
6815
+ dropdownToggleRef.value.addEventListener('keydown', handleKeydown);
6816
+ dropdownMenuRef.value.addEventListener('keydown', handleKeydown);
8636
6817
  emit('show');
8637
6818
  return;
8638
6819
  }
8639
6820
  popper.value && destroyPopper();
8640
6821
  window.removeEventListener('mouseup', handleMouseUp);
8641
6822
  window.removeEventListener('keyup', handleKeyup);
6823
+ dropdownToggleRef.value &&
6824
+ dropdownToggleRef.value.removeEventListener('keydown', handleKeydown);
6825
+ dropdownMenuRef.value && dropdownMenuRef.value.removeEventListener('keydown', handleKeydown);
8642
6826
  emit('hide');
8643
6827
  });
8644
6828
  provide('config', {
@@ -8650,6 +6834,16 @@ const CDropdown = defineComponent({
8650
6834
  provide('visible', visible);
8651
6835
  provide('dropdownToggleRef', dropdownToggleRef);
8652
6836
  provide('dropdownMenuRef', dropdownMenuRef);
6837
+ const handleKeydown = (event) => {
6838
+ if (visible.value &&
6839
+ dropdownMenuRef.value &&
6840
+ (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
6841
+ event.preventDefault();
6842
+ const target = event.target;
6843
+ const items = Array.from(dropdownMenuRef.value.querySelectorAll('.dropdown-item:not(.disabled):not(:disabled)'));
6844
+ getNextActiveElement(items, target, event.key === 'ArrowDown', true).focus();
6845
+ }
6846
+ };
8653
6847
  const handleKeyup = (event) => {
8654
6848
  if (props.autoClose === false) {
8655
6849
  return;
@@ -8785,28 +6979,12 @@ const CDropdownMenu = defineComponent({
8785
6979
  const config = inject('config'); // eslint-disable-line @typescript-eslint/no-explicit-any
8786
6980
  const visible = inject('visible');
8787
6981
  const { alignment, dark, popper } = config;
8788
- // eslint-disable-next-line @typescript-eslint/ban-types, unicorn/consistent-function-scoping
8789
- const alignmentClassNames = (alignment) => {
8790
- const classNames = [];
8791
- if (typeof alignment === 'object') {
8792
- Object.keys(alignment).map((key) => {
8793
- classNames.push(`dropdown-menu${key === 'xs' ? '' : `-${key}`}-${alignment[key]}`);
8794
- });
8795
- }
8796
- if (typeof alignment === 'string') {
8797
- classNames.push(`dropdown-menu-${alignment}`);
8798
- }
8799
- return classNames;
8800
- };
8801
6982
  return () => h$1(props.component, {
8802
- class: [
8803
- 'dropdown-menu',
8804
- { 'dropdown-menu-dark': dark, show: visible.value },
8805
- alignmentClassNames(alignment),
8806
- ],
6983
+ class: ['dropdown-menu', { show: visible.value }, getAlignmentClassNames(alignment)],
8807
6984
  ...((typeof alignment === 'object' || !popper) && {
8808
6985
  'data-coreui-popper': 'static',
8809
6986
  }),
6987
+ ...(dark && { 'data-coreui-theme': 'dark' }),
8810
6988
  ref: dropdownMenuRef,
8811
6989
  }, props.component === 'ul'
8812
6990
  ? slots.default && slots.default().map((vnode) => h$1('li', {}, vnode))
@@ -8817,10 +6995,6 @@ const CDropdownMenu = defineComponent({
8817
6995
  const CDropdownToggle = defineComponent({
8818
6996
  name: 'CDropdownToggle',
8819
6997
  props: {
8820
- /**
8821
- * Toggle the active state for the component.
8822
- */
8823
- active: Boolean,
8824
6998
  /**
8825
6999
  * Sets the color context of the component to one of CoreUI’s themed colors.
8826
7000
  *
@@ -8849,6 +7023,15 @@ const CDropdownToggle = defineComponent({
8849
7023
  * Toggle the disabled state for the component.
8850
7024
  */
8851
7025
  disabled: Boolean,
7026
+ /**
7027
+ * If a dropdown `variant` is set to `nav-item` then render the toggler as a link instead of a button.
7028
+ *
7029
+ * @since v5.0.0-alpha.1
7030
+ */
7031
+ navLink: {
7032
+ type: Boolean,
7033
+ default: true,
7034
+ },
8852
7035
  /**
8853
7036
  * @values 'rounded', 'rounded-top', 'rounded-end', 'rounded-bottom', 'rounded-start', 'rounded-circle', 'rounded-pill', 'rounded-0', 'rounded-1', 'rounded-2', 'rounded-3'
8854
7037
  */
@@ -8895,17 +7078,10 @@ const CDropdownToggle = defineComponent({
8895
7078
  const dropdownVariant = inject('variant');
8896
7079
  const visible = inject('visible');
8897
7080
  const setVisible = inject('setVisible');
8898
- const className = [
8899
- {
8900
- 'dropdown-toggle': props.caret,
8901
- 'dropdown-toggle-split': props.split,
8902
- active: props.active,
8903
- disabled: props.disabled,
8904
- },
8905
- ];
8906
7081
  const triggers = {
8907
7082
  ...((props.trigger === 'click' || props.trigger.includes('click')) && {
8908
- onClick: () => {
7083
+ onClick: (event) => {
7084
+ event.preventDefault();
8909
7085
  if (props.disabled) {
8910
7086
  return;
8911
7087
  }
@@ -8927,6 +7103,19 @@ const CDropdownToggle = defineComponent({
8927
7103
  },
8928
7104
  }),
8929
7105
  };
7106
+ const togglerProps = computed(() => {
7107
+ return {
7108
+ class: {
7109
+ 'nav-link': dropdownVariant === 'nav-item' && props.navLink,
7110
+ 'dropdown-toggle': props.caret,
7111
+ 'dropdown-toggle-split': props.split,
7112
+ disabled: props.disabled,
7113
+ show: visible.value,
7114
+ },
7115
+ 'aria-expanded': visible.value,
7116
+ ...(!props.disabled && { ...triggers }),
7117
+ };
7118
+ });
8930
7119
  onMounted(() => {
8931
7120
  if (togglerRef.value) {
8932
7121
  dropdownToggleRef.value = togglerRef.value.$el;
@@ -8940,39 +7129,24 @@ const CDropdownToggle = defineComponent({
8940
7129
  },
8941
7130
  ...triggers,
8942
7131
  }))
8943
- : dropdownVariant === 'nav-item'
7132
+ : dropdownVariant === 'nav-item' && props.navLink
8944
7133
  ? h$1('a', {
8945
- active: props.active,
8946
- class: [
8947
- 'nav-link',
8948
- className,
8949
- {
8950
- show: visible.value,
8951
- },
8952
- ],
8953
- disabled: props.disabled,
8954
7134
  href: '#',
7135
+ ...togglerProps.value,
7136
+ role: 'button',
8955
7137
  ref: dropdownToggleRef,
8956
- ...triggers,
8957
7138
  }, { default: () => slots.default && slots.default() })
8958
7139
  : h$1(CButton, {
8959
- class: [
8960
- className,
8961
- {
8962
- show: visible.value,
8963
- },
8964
- ],
8965
- active: props.active,
7140
+ ...togglerProps.value,
8966
7141
  color: props.color,
7142
+ component: props.component,
8967
7143
  disabled: props.disabled,
8968
- ref: (el) => {
8969
- togglerRef.value = el;
8970
- },
8971
7144
  shape: props.shape,
8972
7145
  size: props.size,
8973
- ...triggers,
8974
- ...(props.component === 'button' && { type: 'button' }),
8975
7146
  variant: props.variant,
7147
+ ref: (el) => {
7148
+ togglerRef.value = el;
7149
+ },
8976
7150
  }, () => props.split
8977
7151
  ? h$1('span', { class: 'visually-hidden' }, 'Toggle Dropdown')
8978
7152
  : slots.default && slots.default());
@@ -9217,7 +7391,7 @@ const CFormCheck = defineComponent({
9217
7391
  /**
9218
7392
  * 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.
9219
7393
  *
9220
- * @since 4.9.0
7394
+ * @since 4.10.0
9221
7395
  */
9222
7396
  falseValue: String,
9223
7397
  /**
@@ -9290,7 +7464,7 @@ const CFormCheck = defineComponent({
9290
7464
  /**
9291
7465
  * 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.
9292
7466
  *
9293
- * @since 4.9.0
7467
+ * @since 4.10.0
9294
7468
  */
9295
7469
  trueValue: String,
9296
7470
  /**
@@ -9376,7 +7550,7 @@ const CFormCheck = defineComponent({
9376
7550
  const formControl = () => {
9377
7551
  return h$1('input', {
9378
7552
  ...attrs,
9379
- ...(props.modelValue && props.value && { checked: isChecked.value }),
7553
+ ...((props.modelValue || props.value) && { checked: isChecked.value }),
9380
7554
  class: inputClassName,
9381
7555
  id: props.id,
9382
7556
  indeterminate: props.indeterminate,
@@ -10733,6 +8907,15 @@ const CModal = defineComponent({
10733
8907
  * A string of all className you want applied to the modal content component.
10734
8908
  */
10735
8909
  contentClassName: String,
8910
+ /**
8911
+ * Puts the focus on the modal when shown.
8912
+ *
8913
+ * @since v5.0.0-alpha.1
8914
+ */
8915
+ focus: {
8916
+ type: Boolean,
8917
+ default: true,
8918
+ },
10736
8919
  /**
10737
8920
  * Set modal to covers the entire user viewport
10738
8921
  *
@@ -10806,6 +8989,7 @@ const CModal = defineComponent({
10806
8989
  'show',
10807
8990
  ],
10808
8991
  setup(props, { slots, attrs, emit }) {
8992
+ const activeElementRef = ref();
10809
8993
  const modalRef = ref();
10810
8994
  const modalContentRef = ref();
10811
8995
  const visible = ref(props.visible);
@@ -10813,6 +8997,7 @@ const CModal = defineComponent({
10813
8997
  visible.value = props.visible;
10814
8998
  });
10815
8999
  const handleEnter = (el, done) => {
9000
+ activeElementRef.value = document.activeElement;
10816
9001
  executeAfterTransition(() => done(), el);
10817
9002
  document.body.classList.add('modal-open');
10818
9003
  document.body.style.overflow = 'hidden';
@@ -10824,6 +9009,7 @@ const CModal = defineComponent({
10824
9009
  emit('show');
10825
9010
  };
10826
9011
  const handleAfterEnter = () => {
9012
+ props.focus && modalRef.value?.focus();
10827
9013
  window.addEventListener('mousedown', handleMouseDown);
10828
9014
  window.addEventListener('keyup', handleKeyUp);
10829
9015
  };
@@ -10839,6 +9025,7 @@ const CModal = defineComponent({
10839
9025
  el.classList.remove('show');
10840
9026
  };
10841
9027
  const handleAfterLeave = (el) => {
9028
+ activeElementRef.value?.focus();
10842
9029
  window.removeEventListener('mousedown', handleMouseDown);
10843
9030
  window.removeEventListener('keyup', handleKeyUp);
10844
9031
  el.style.display = 'none';
@@ -10879,6 +9066,7 @@ const CModal = defineComponent({
10879
9066
  };
10880
9067
  provide('handleDismiss', handleDismiss);
10881
9068
  const modal = () => h$1('div', {
9069
+ ...attrs,
10882
9070
  class: [
10883
9071
  'modal',
10884
9072
  {
@@ -10886,6 +9074,7 @@ const CModal = defineComponent({
10886
9074
  },
10887
9075
  attrs.class,
10888
9076
  ],
9077
+ ...(visible.value ? { 'aria-modal': true, role: 'dialog' } : { 'aria-hidden': 'true' }),
10889
9078
  ref: modalRef,
10890
9079
  }, h$1('div', {
10891
9080
  class: [
@@ -10898,7 +9087,6 @@ const CModal = defineComponent({
10898
9087
  [`modal-${props.size}`]: props.size,
10899
9088
  },
10900
9089
  ],
10901
- role: 'dialog',
10902
9090
  }, h$1('div', { class: ['modal-content', props.contentClassName], ref: modalContentRef }, slots.default && slots.default())));
10903
9091
  return () => [
10904
9092
  h$1(Transition, {
@@ -11110,8 +9298,8 @@ const CVirtualScrollerPlugin = {
11110
9298
  },
11111
9299
  };
11112
9300
 
11113
- const createOption = (text, options) => {
11114
- const value = text.toLowerCase().replace(/\s/g, '-');
9301
+ const createOption = (label, options) => {
9302
+ const value = label.toLowerCase().replace(/\s/g, '-');
11115
9303
  let uniqueValue = value;
11116
9304
  let i = 1;
11117
9305
  while (options.some((option) => String(option.value) === uniqueValue)) {
@@ -11121,7 +9309,7 @@ const createOption = (text, options) => {
11121
9309
  return [
11122
9310
  {
11123
9311
  value: uniqueValue,
11124
- text,
9312
+ label,
11125
9313
  custom: true,
11126
9314
  },
11127
9315
  ];
@@ -11131,8 +9319,8 @@ const filterOptionsList = (search, _options) => {
11131
9319
  const optionsList = [];
11132
9320
  for (const option of _options) {
11133
9321
  const options = option.options &&
11134
- option.options.filter((option) => option.text && option.text.toLowerCase().includes(search.toLowerCase()));
11135
- if ((option.text && option.text.toLowerCase().includes(search.toLowerCase())) ||
9322
+ option.options.filter((option) => option.label && option.label.toLowerCase().includes(search.toLowerCase()));
9323
+ if ((option.label && option.label.toLowerCase().includes(search.toLowerCase())) ||
11136
9324
  (options && options.length > 0)) {
11137
9325
  optionsList.push(Object.assign({}, option, options && options.length > 0 && { options }));
11138
9326
  }
@@ -11276,7 +9464,7 @@ const CMultiSelectOptions = defineComponent({
11276
9464
  tabindex: 0,
11277
9465
  }, props.scopedSlots && props.scopedSlots['options']
11278
9466
  ? h$1(props.scopedSlots['options'], { option: option })
11279
- : option.text)
9467
+ : option.label)
11280
9468
  : [
11281
9469
  h$1('div', { class: 'form-multi-select-optgroup-label' }, props.scopedSlots && props.scopedSlots['options-groups']
11282
9470
  ? h$1(props.scopedSlots['options-groups'], { option: option })
@@ -11355,7 +9543,7 @@ const CMultiSelectSelection = defineComponent({
11355
9543
  props.selected.map((option) => {
11356
9544
  if (props.selectionType === 'tags') {
11357
9545
  return h$1('span', { class: 'form-multi-select-tag' }, [
11358
- option.text,
9546
+ option.label,
11359
9547
  !option.disabled &&
11360
9548
  h$1('button', {
11361
9549
  class: 'form-multi-select-tag-delete',
@@ -11368,8 +9556,8 @@ const CMultiSelectSelection = defineComponent({
11368
9556
  }),
11369
9557
  props.multiple &&
11370
9558
  props.selectionType === 'text' &&
11371
- props.selected.map((option, index) => h$1('span', `${option.text}${index === props.selected.length - 1 ? '' : ','}\xA0`)),
11372
- !props.multiple && !props.search && props.selected.map((option) => option.text)[0],
9559
+ props.selected.map((option, index) => h$1('span', `${option.label}${index === props.selected.length - 1 ? '' : ','}\xA0`)),
9560
+ !props.multiple && !props.search && props.selected.map((option) => option.label)[0],
11373
9561
  slots.default && slots.default(),
11374
9562
  ]);
11375
9563
  },
@@ -11648,7 +9836,7 @@ const CMultiSelect = defineComponent({
11648
9836
  const flattenedOptions = computed(() => flattenOptionsArray(props.options));
11649
9837
  const userOption = computed(() => {
11650
9838
  if (props.allowCreateOptions &&
11651
- filteredOptions.value.some((option) => option.text && option.text.toLowerCase() === searchValue.value.toLowerCase())) {
9839
+ filteredOptions.value.some((option) => option.label && option.label.toLowerCase() === searchValue.value.toLowerCase())) {
11652
9840
  return false;
11653
9841
  }
11654
9842
  return searchRef.value && createOption(String(searchValue.value), flattenedOptions.value);
@@ -11740,7 +9928,7 @@ const CMultiSelect = defineComponent({
11740
9928
  if (!userOption.value) {
11741
9929
  selected.value = [
11742
9930
  ...selected.value,
11743
- filteredOptions.value.find((option) => String(option.text).toLowerCase() === searchValue.value.toLowerCase()),
9931
+ filteredOptions.value.find((option) => String(option.label).toLowerCase() === searchValue.value.toLowerCase()),
11744
9932
  ];
11745
9933
  }
11746
9934
  if (userOption.value) {
@@ -11765,7 +9953,7 @@ const CMultiSelect = defineComponent({
11765
9953
  };
11766
9954
  const handleOptionClick = (option) => {
11767
9955
  if (!props.multiple) {
11768
- selected.value = [{ value: option.value, text: option.text }];
9956
+ selected.value = [option];
11769
9957
  visible.value = false;
11770
9958
  if (searchRef.value) {
11771
9959
  searchRef.value.value = '';
@@ -11786,10 +9974,7 @@ const CMultiSelect = defineComponent({
11786
9974
  selected.value = selected.value.filter((_option) => _option.value !== option.value);
11787
9975
  }
11788
9976
  else {
11789
- selected.value = [
11790
- ...selected.value,
11791
- { value: option.value, text: option.text },
11792
- ];
9977
+ selected.value = [...selected.value, option];
11793
9978
  }
11794
9979
  };
11795
9980
  const handleSelectAll = () => {
@@ -11874,7 +10059,7 @@ const CMultiSelect = defineComponent({
11874
10059
  }),
11875
10060
  ...(selected.value.length > 0 &&
11876
10061
  !props.multiple && {
11877
- placeholder: selected.value.map((option) => option.text)[0],
10062
+ placeholder: selected.value.map((option) => option.label)[0],
11878
10063
  }),
11879
10064
  ...(props.multiple &&
11880
10065
  selected.value.length > 0 &&
@@ -12257,13 +10442,13 @@ const CNavbar = defineComponent({
12257
10442
  'navbar',
12258
10443
  {
12259
10444
  [`bg-${props.color}`]: props.color,
12260
- [`navbar-${props.colorScheme}`]: props.colorScheme,
12261
10445
  [typeof props.expand === 'boolean'
12262
10446
  ? 'navbar-expand'
12263
10447
  : `navbar-expand-${props.expand}`]: props.expand,
12264
10448
  },
12265
10449
  props.placement,
12266
10450
  ],
10451
+ ...(props.colorScheme && { 'data-coreui-theme': props.colorScheme }),
12267
10452
  }, props.container
12268
10453
  ? h$1('div', { class: [`container${props.container === true ? '' : '-' + props.container}`] }, slots.default && slots.default())
12269
10454
  : slots.default && slots.default());
@@ -12360,6 +10545,10 @@ const COffcanvas = defineComponent({
12360
10545
  return false;
12361
10546
  },
12362
10547
  },
10548
+ /**
10549
+ * Sets a darker color scheme.
10550
+ */
10551
+ dark: Boolean,
12363
10552
  /**
12364
10553
  * Closes the offcanvas when escape key is pressed.
12365
10554
  */
@@ -12475,6 +10664,7 @@ const COffcanvas = defineComponent({
12475
10664
  };
12476
10665
  return () => [
12477
10666
  h$1(Transition, {
10667
+ appear: visible.value,
12478
10668
  css: false,
12479
10669
  onEnter: (el, done) => handleEnter(el, done),
12480
10670
  onAfterEnter: () => handleAfterEnter(),
@@ -12491,6 +10681,7 @@ const COffcanvas = defineComponent({
12491
10681
  ref: offcanvasRef,
12492
10682
  role: 'dialog',
12493
10683
  tabindex: -1,
10684
+ ...(props.dark && { 'data-coreui-theme': 'dark' }),
12494
10685
  }, slots.default && slots.default()), [[vVisible, props.visible]])),
12495
10686
  props.backdrop &&
12496
10687
  h$1(CBackdrop, {
@@ -12767,6 +10958,7 @@ const CProgressBar = defineComponent({
12767
10958
  },
12768
10959
  },
12769
10960
  setup(props, { slots }) {
10961
+ const stacked = inject('stacked', false);
12770
10962
  return () => h$1('div', {
12771
10963
  class: [
12772
10964
  'progress-bar',
@@ -12776,11 +10968,7 @@ const CProgressBar = defineComponent({
12776
10968
  ['progress-bar-animated']: props.animated,
12777
10969
  },
12778
10970
  ],
12779
- role: 'progressbar',
12780
- style: `width: ${props.value}%`,
12781
- 'aria-valuenow': props.value,
12782
- 'aria-valuemin': '0',
12783
- 'aria-valuemax': '100',
10971
+ ...(!stacked && { style: { width: `${props.value}%` } }),
12784
10972
  }, slots.default && slots.default());
12785
10973
  },
12786
10974
  });
@@ -12788,21 +10976,55 @@ const CProgressBar = defineComponent({
12788
10976
  const CProgress = defineComponent({
12789
10977
  name: 'CProgress',
12790
10978
  props: {
10979
+ /**
10980
+ * Use to animate the stripes right to left via CSS3 animations.
10981
+ */
10982
+ animated: Boolean,
10983
+ /**
10984
+ * Sets the color context of the component to one of CoreUI’s themed colors.
10985
+ *
10986
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
10987
+ */
10988
+ color: Color$1,
12791
10989
  /**
12792
10990
  * Sets the height of the component. If you set that value the inner `<CProgressBar>` will automatically resize accordingly.
12793
10991
  */
12794
10992
  height: Number,
10993
+ /**
10994
+ * A string of all className you want applied to the <CProgressBar/> component.
10995
+ *
10996
+ * @since 5.0.0-alpha.1
10997
+ */
10998
+ progressBarClassName: String,
12795
10999
  /**
12796
11000
  * Makes progress bar thinner.
12797
11001
  */
12798
11002
  thin: Boolean,
11003
+ /**
11004
+ * The percent to progress the ProgressBar.
11005
+ */
11006
+ value: {
11007
+ type: Number,
11008
+ default: 0,
11009
+ },
11010
+ /**
11011
+ * Set the progress bar variant to optional striped.
11012
+ *
11013
+ * @values 'striped'
11014
+ */
11015
+ variant: {
11016
+ type: String,
11017
+ validator: (value) => {
11018
+ return value === 'striped';
11019
+ },
11020
+ },
12799
11021
  /**
12800
11022
  * Change the default color to white.
12801
11023
  */
12802
11024
  white: Boolean,
12803
- ...CProgressBar.props,
12804
11025
  },
12805
11026
  setup(props, { slots }) {
11027
+ const stacked = inject('stacked', false);
12806
11028
  return () => h$1('div', {
12807
11029
  class: [
12808
11030
  'progress',
@@ -12811,15 +11033,49 @@ const CProgress = defineComponent({
12811
11033
  'progress-white': props.white,
12812
11034
  },
12813
11035
  ],
12814
- ...(props.height, { style: `height: ${props.height}px` }),
12815
- }, props.value
12816
- ? h$1(CProgressBar, {
12817
- value: props.value,
11036
+ style: {
11037
+ ...(props.height ? { height: `${props.height}px` } : {}),
11038
+ ...(stacked ? { width: `${props.value}%` } : {}),
11039
+ },
11040
+ ...(props.value !== undefined && {
11041
+ role: 'progressbar',
11042
+ 'aria-valuenow': props.value,
11043
+ 'aria-valuemin': 0,
11044
+ 'aria-valuemax': 100,
11045
+ }),
11046
+ },
11047
+ // @ts-expect-error name is defined in component
11048
+ slots.default && slots.default().some((vnode) => vnode.type.name === 'CProgressBar')
11049
+ ? slots.default().map((vnode) => {
11050
+ // @ts-expect-error name is defined in component
11051
+ if (vnode.type.name === 'CProgressBar') {
11052
+ return h$1(vnode, {
11053
+ ...(props.animated && { animated: props.animated }),
11054
+ ...(props.color && { color: props.color }),
11055
+ ...(props.value && { value: props.value }),
11056
+ ...(props.variant && { variant: props.variant }),
11057
+ });
11058
+ }
11059
+ return vnode;
11060
+ })
11061
+ : h$1(CProgressBar, {
11062
+ ...(props.progressBarClassName && { class: props.progressBarClassName }),
12818
11063
  animated: props.animated,
12819
11064
  color: props.color,
11065
+ value: props.value,
12820
11066
  variant: props.variant,
12821
- }, slots.default && slots.default())
12822
- : slots.default && slots.default());
11067
+ }, () => slots.default && slots.default()));
11068
+ },
11069
+ });
11070
+
11071
+ const CProgressStacked = defineComponent({
11072
+ name: 'CProgressStacked',
11073
+ props: {},
11074
+ setup(_, { slots }) {
11075
+ provide('stacked', true);
11076
+ return () => h$1('div', {
11077
+ class: 'progress-stacked',
11078
+ }, slots.default && slots.default());
12823
11079
  },
12824
11080
  });
12825
11081
 
@@ -12827,6 +11083,7 @@ const CProgressPlugin = {
12827
11083
  install: (app) => {
12828
11084
  app.component(CProgress.name, CProgress);
12829
11085
  app.component(CProgressBar.name, CProgressBar);
11086
+ app.component(CProgressStacked.name, CProgressStacked);
12830
11087
  },
12831
11088
  };
12832
11089
 
@@ -13194,7 +11451,7 @@ const CSidebar = defineComponent({
13194
11451
  }, slots.default && slots.default()),
13195
11452
  mobile.value &&
13196
11453
  h$1(CBackdrop, {
13197
- class: 'sidebar-backdrop d-none',
11454
+ class: 'sidebar-backdrop',
13198
11455
  visible: props.visible,
13199
11456
  onClick: () => handleHide(),
13200
11457
  }),
@@ -13408,9 +11665,13 @@ const CSmartPagination = defineComponent({
13408
11665
  const activePage = ref(props.activePage);
13409
11666
  const limit = ref(props.limit);
13410
11667
  const pages = ref(props.pages);
13411
- watch(props, () => {
11668
+ watch(() => props.activePage, () => {
13412
11669
  activePage.value = props.activePage;
11670
+ });
11671
+ watch(() => props.limit, () => {
13413
11672
  limit.value = props.limit;
11673
+ });
11674
+ watch(() => props.pages, () => {
13414
11675
  pages.value = props.pages;
13415
11676
  });
13416
11677
  const showDots = computed(() => {
@@ -14174,11 +12435,11 @@ const filterTable = (items, tableFilter, tableFilterState, itemsDataColumns) =>
14174
12435
  });
14175
12436
  return items;
14176
12437
  };
14177
- const getClickedColumnName = (target, columnNames) => {
12438
+ const getClickedColumnName = (target, columnNames, selectable) => {
14178
12439
  const closest = target.closest('tr');
14179
12440
  const children = closest ? Array.from(closest.children) : [];
14180
12441
  const clickedCell = children.filter((child) => child.contains(target))[0];
14181
- return columnNames[children.indexOf(clickedCell)];
12442
+ return selectable ? columnNames[children.indexOf(clickedCell) - 1] : columnNames[children.indexOf(clickedCell)];
14182
12443
  };
14183
12444
  const getColumnKey = (column) => typeof column === 'object' ? column.key : column;
14184
12445
  const getColumnLabel = (column) => typeof column === 'object'
@@ -14186,6 +12447,12 @@ const getColumnLabel = (column) => typeof column === 'object'
14186
12447
  ? column.label
14187
12448
  : pretifyName(column.key)
14188
12449
  : pretifyName(column);
12450
+ const getColumnName = (column) => {
12451
+ if (typeof column === 'object') {
12452
+ return column.key;
12453
+ }
12454
+ return column;
12455
+ };
14189
12456
  const getColumnNames = (columns, items) => {
14190
12457
  if (columns) {
14191
12458
  const _columns = [];
@@ -14291,13 +12558,32 @@ const getColumnSorterState = (key, sorterState) => {
14291
12558
  const getColumnValues = (items, key) => {
14292
12559
  return items.map((item) => item[key]);
14293
12560
  };
14294
- const getTableDataCellProps = (item, colName) => {
14295
- const props = item._cellProps && {
14296
- ...(item._cellProps['all'] && { ...item._cellProps['all'] }),
14297
- ...(item._cellProps[colName] && { ...item._cellProps[colName] }),
14298
- };
12561
+ const getTableDataCellProps = (column, item, colName) => {
12562
+ const props = {};
12563
+ if (typeof column === 'object' && column._colProps) {
12564
+ Object.assign(props, column._colProps);
12565
+ }
12566
+ if (item._cellProps && item._cellProps['all']) {
12567
+ Object.assign(props, item._cellProps['all']);
12568
+ }
12569
+ if (item._cellProps && item._cellProps[colName]) {
12570
+ Object.assign(props, item._cellProps[colName]);
12571
+ }
14299
12572
  return props;
14300
12573
  };
12574
+ const getTableDataCellStyles = (column, item, colName) => {
12575
+ const styles = {};
12576
+ if (typeof column === 'object' && column._colStyle) {
12577
+ Object.assign(styles, column._colStyle);
12578
+ }
12579
+ if (item._cellStyle && item._cellStyle['all']) {
12580
+ Object.assign(styles, item._cellStyle['all']);
12581
+ }
12582
+ if (item._cellStyle && item._cellStyle[colName]) {
12583
+ Object.assign(styles, item._cellStyle[colName]);
12584
+ }
12585
+ return styles;
12586
+ };
14301
12587
  const getTableHeaderCellProps = (column) => {
14302
12588
  if (typeof column === 'object' && column._props) {
14303
12589
  return column._props;
@@ -14363,6 +12649,11 @@ const CSmartTableBody = defineComponent({
14363
12649
  default: () => [],
14364
12650
  require: true,
14365
12651
  },
12652
+ columns: {
12653
+ type: Array,
12654
+ default: () => [],
12655
+ require: true,
12656
+ },
14366
12657
  currentItems: {
14367
12658
  type: Array,
14368
12659
  default: () => [],
@@ -14379,9 +12670,7 @@ const CSmartTableBody = defineComponent({
14379
12670
  },
14380
12671
  emits: ['rowChecked', 'rowClick'],
14381
12672
  setup(props, { emit }) {
14382
- const colspan = props.selectable
14383
- ? props.columnNames.length + 1
14384
- : props.columnNames.length;
12673
+ const colspan = props.selectable ? props.columns.length + 1 : props.columns.length;
14385
12674
  return () => h$1(CTableBody, {
14386
12675
  ...(props.clickableRows && { style: 'cursor:pointer;' }),
14387
12676
  }, {
@@ -14391,7 +12680,7 @@ const CSmartTableBody = defineComponent({
14391
12680
  ...(item._props && { ...item._props }),
14392
12681
  ...(props.clickableRows && { tabindex: 0 }),
14393
12682
  onClick: (event) => {
14394
- emit('rowClick', item, trIndex + props.firstItemOnActivePageIndex, getClickedColumnName(event.target, props.columnNames), event);
12683
+ emit('rowClick', item, trIndex + props.firstItemOnActivePageIndex, getClickedColumnName(event.target, props.columnNames, props.selectable), event);
14395
12684
  },
14396
12685
  }, {
14397
12686
  default: () => [
@@ -14407,16 +12696,20 @@ const CSmartTableBody = defineComponent({
14407
12696
  emit('rowChecked', item, event.target.checked);
14408
12697
  },
14409
12698
  })),
14410
- props.columnNames.map((colName) => props.scopedSlots &&
14411
- props.scopedSlots[colName] &&
14412
- typeof props.scopedSlots[colName] === 'function'
14413
- ? h$1(props.scopedSlots[colName], { item: item })
14414
- : typeof item[colName] !== 'undefined' &&
14415
- h$1(CTableDataCell, {
14416
- ...getTableDataCellProps(item, colName),
14417
- }, {
14418
- default: () => String(item[colName]),
14419
- })),
12699
+ props.columns.map((column) => {
12700
+ const colName = getColumnName(column);
12701
+ return props.scopedSlots &&
12702
+ props.scopedSlots[colName] &&
12703
+ typeof props.scopedSlots[colName] === 'function'
12704
+ ? h$1(props.scopedSlots[colName], { item: item })
12705
+ : typeof item[colName] !== 'undefined' &&
12706
+ h$1(CTableDataCell, {
12707
+ ...getTableDataCellProps(column, item, colName),
12708
+ style: getTableDataCellStyles(column, item, colName),
12709
+ }, {
12710
+ default: () => String(item[colName]),
12711
+ });
12712
+ }),
14420
12713
  ],
14421
12714
  }),
14422
12715
  props.scopedSlots &&
@@ -14432,9 +12725,6 @@ const CSmartTableBody = defineComponent({
14432
12725
  h$1(CTableRow, {
14433
12726
  class: 'p-0',
14434
12727
  key: `details${trIndex}`,
14435
- onClick: (event) => {
14436
- emit('rowClick', item, trIndex + props.firstItemOnActivePageIndex, getClickedColumnName(event.target, props.columnNames), true);
14437
- },
14438
12728
  }, {
14439
12729
  default: () => h$1(CTableDataCell, {
14440
12730
  colspan: props.selectable
@@ -14528,60 +12818,84 @@ const CSmartTableHead = defineComponent({
14528
12818
  emit('selectAllChecked');
14529
12819
  },
14530
12820
  })),
14531
- columns.value.map((column, index) => h$1(CTableHeaderCell, {
14532
- ...getTableHeaderCellProps(column),
14533
- onClick: () => {
14534
- emit('sortClick', getColumnKey(column), index);
14535
- },
14536
- style: getTableHeaderCellStyles(column, props.columnSorter),
14537
- }, {
14538
- default: () => [
14539
- h$1('div', {
14540
- class: 'd-inline',
14541
- }, getColumnLabel(column)),
14542
- props.columnSorter &&
14543
- (typeof column === 'object'
14544
- ? typeof column.sorter === 'undefined'
14545
- ? true
14546
- : column.sorter
14547
- : true) &&
14548
- columnSorterIcon(column),
14549
- ],
14550
- })),
12821
+ columns.value.map((column, index) => {
12822
+ const isSortable = props.columnSorter &&
12823
+ (typeof column === 'object'
12824
+ ? column.sorter === undefined
12825
+ ? true
12826
+ : column.sorter
12827
+ : true);
12828
+ return h$1(CTableHeaderCell, {
12829
+ ...getTableHeaderCellProps(column),
12830
+ style: getTableHeaderCellStyles(column, props.columnSorter),
12831
+ ...isSortable && {
12832
+ tabindex: 0,
12833
+ onClick: () => emit('sortClick', getColumnKey(column), index),
12834
+ onKeydown: (event) => {
12835
+ if (event.key === 'Enter') {
12836
+ emit('sortClick', getColumnKey(column), index);
12837
+ }
12838
+ if (event.key === 'ArrowUp') {
12839
+ event.preventDefault();
12840
+ emit('sortClick', getColumnKey(column), index, 'asc');
12841
+ }
12842
+ if (event.key === 'ArrowDown') {
12843
+ event.preventDefault();
12844
+ emit('sortClick', getColumnKey(column), index, 'desc');
12845
+ }
12846
+ },
12847
+ }
12848
+ }, {
12849
+ default: () => [
12850
+ h$1('div', {
12851
+ class: 'd-inline',
12852
+ }, getColumnLabel(column)),
12853
+ props.columnSorter &&
12854
+ (typeof column === 'object'
12855
+ ? typeof column.sorter === 'undefined'
12856
+ ? true
12857
+ : column.sorter
12858
+ : true) &&
12859
+ columnSorterIcon(column),
12860
+ ],
12861
+ });
12862
+ }),
14551
12863
  ],
14552
12864
  }),
14553
12865
  props.columnFilter &&
14554
12866
  h$1(CTableRow, {}, {
14555
12867
  default: () => [
14556
12868
  props.selectable && h$1(CTableHeaderCell),
14557
- columns.value.map((column) => h$1(CTableHeaderCell, {
14558
- ...getTableHeaderCellProps(column),
14559
- }, {
14560
- default: () => (typeof column === 'object'
14561
- ? column.filter === undefined
14562
- ? true
14563
- : column.filter
14564
- : true)
14565
- ? typeof column !== 'string' && typeof column.filter === 'function'
14566
- ? column.filter(getColumnValues(props.items, getColumnKey(column)), (value) => {
14567
- emit('customFilterChange', getColumnKey(column), value);
14568
- })
14569
- : h$1(CFormInput, {
14570
- size: 'sm',
14571
- onInput: (event) => {
14572
- emit('filterInput', getColumnKey(column), event.target.value);
14573
- },
14574
- onChange: (event) => {
14575
- emit('filterChange', event.target.value);
14576
- },
14577
- 'aria-label': `column name: '${getColumnLabel(column)}' filter input`,
14578
- ...(props.columnFilterValue &&
14579
- props.columnFilterValue[getColumnKey(column)] && {
14580
- value: props.columnFilterValue[getColumnKey(column)],
14581
- }),
14582
- })
14583
- : '',
14584
- })),
12869
+ columns.value.map((column) => {
12870
+ return h$1(CTableHeaderCell, {
12871
+ ...getTableHeaderCellProps(column),
12872
+ }, {
12873
+ default: () => (typeof column === 'object'
12874
+ ? column.filter === undefined
12875
+ ? true
12876
+ : column.filter
12877
+ : true)
12878
+ ? typeof column !== 'string' && typeof column.filter === 'function'
12879
+ ? column.filter(getColumnValues(props.items, getColumnKey(column)), (value) => {
12880
+ emit('customFilterChange', getColumnKey(column), value);
12881
+ })
12882
+ : h$1(CFormInput, {
12883
+ size: 'sm',
12884
+ onInput: (event) => {
12885
+ emit('filterInput', getColumnKey(column), event.target.value);
12886
+ },
12887
+ onChange: (event) => {
12888
+ emit('filterChange', getColumnKey(column), event.target.value);
12889
+ },
12890
+ 'aria-label': `column name: '${getColumnLabel(column)}' filter input`,
12891
+ ...(props.columnFilterValue &&
12892
+ props.columnFilterValue[getColumnKey(column)] && {
12893
+ value: props.columnFilterValue[getColumnKey(column)],
12894
+ }),
12895
+ })
12896
+ : '',
12897
+ });
12898
+ }),
14585
12899
  ],
14586
12900
  }),
14587
12901
  ],
@@ -14710,8 +13024,6 @@ const CSmartTable = defineComponent({
14710
13024
  },
14711
13025
  /**
14712
13026
  * 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:
14713
- * - label (String) - replaces default label text
14714
- * - values (Array) - custom array of pagination values
14715
13027
  * - external (Boolean) - disables automatic 'itemsPerPage' change (use to change pages externaly by 'pagination-change' event).
14716
13028
  */
14717
13029
  itemsPerPageSelect: {
@@ -14882,7 +13194,6 @@ const CSmartTable = defineComponent({
14882
13194
  return { ...item, _id: index };
14883
13195
  }));
14884
13196
  const itemsNumber = ref(props.itemsNumber);
14885
- // eslint-disable-next-line unicorn/explicit-length-check
14886
13197
  const itemsPerPage = ref(props.itemsPerPage || items.value.length);
14887
13198
  const selected = ref([]);
14888
13199
  const selectedAll = ref();
@@ -14911,8 +13222,9 @@ const CSmartTable = defineComponent({
14911
13222
  }
14912
13223
  });
14913
13224
  if (Array.isArray(props.items)) {
14914
- items.value = props.items;
14915
- // eslint-disable-next-line unicorn/explicit-length-check
13225
+ items.value = props.items.map((item, index) => {
13226
+ return { ...item, _id: index };
13227
+ });
14916
13228
  itemsNumber.value = props.itemsNumber || props.items.length;
14917
13229
  }
14918
13230
  }, {
@@ -14962,14 +13274,20 @@ const CSmartTable = defineComponent({
14962
13274
  activePage.value = 1;
14963
13275
  }
14964
13276
  });
14965
- const handleSorterChange = (column, index) => {
13277
+ const handleSorterChange = (column, index, order) => {
14966
13278
  if (!isSortable(index, props.columns, props.columnSorter, itemsDataColumns.value, columnNames.value)) {
14967
13279
  return;
14968
13280
  }
14969
13281
  //if column changed or sort was descending change asc to true
14970
13282
  const state = sorterState.value;
13283
+ if (order) {
13284
+ state.state = order;
13285
+ }
14971
13286
  if (state.column === column) {
14972
- if (state.state === 0) {
13287
+ if (order) {
13288
+ state.state = order;
13289
+ }
13290
+ else if (state.state === 0) {
14973
13291
  state.state = 'asc';
14974
13292
  }
14975
13293
  else if (state.state === 'asc') {
@@ -14986,7 +13304,7 @@ const CSmartTable = defineComponent({
14986
13304
  }
14987
13305
  else {
14988
13306
  state.column = column;
14989
- state.state = 'asc';
13307
+ state.state = order || 'asc';
14990
13308
  }
14991
13309
  sorterState.value.column = state.column;
14992
13310
  sorterState.value.state = state.state;
@@ -15056,6 +13374,9 @@ const CSmartTable = defineComponent({
15056
13374
  const filteredColumns = computed(() => filterColumns(items.value, props.columnFilter, columnFilterState.value, itemsDataColumns.value));
15057
13375
  const filteredTable = computed(() => filterTable(filteredColumns.value, props.tableFilter, tableFilterState.value, itemsDataColumns.value));
15058
13376
  const sortedItems = computed(() => sortItems(props.columnSorter, filteredTable.value, itemsDataColumns.value, sorterState.value));
13377
+ watch(sortedItems, () => {
13378
+ emit('filteredItemsChange', sortedItems.value);
13379
+ });
15059
13380
  const numberOfPages = computed(() => itemsPerPage.value ? Math.ceil(sortedItems.value.length / itemsPerPage.value) : 1);
15060
13381
  const firstItemOnActivePageIndex = computed(() => activePage.value ? (activePage.value - 1) * itemsPerPage.value : 0);
15061
13382
  const currentItems = computed(() => activePage.value
@@ -15136,7 +13457,7 @@ const CSmartTable = defineComponent({
15136
13457
  onFilterInput: (key, value) => handleColumnFilterChange(key, value, 'input'),
15137
13458
  onFilterChange: (key, value) => handleColumnFilterChange(key, value, 'change'),
15138
13459
  onSelectAllChecked: () => handleSelectAllChecked(),
15139
- onSortClick: (key, index) => handleSorterChange(key, index),
13460
+ onSortClick: (key, index, order) => handleSorterChange(key, index, order),
15140
13461
  }, {
15141
13462
  // @slot Sorter icon when items are unsorted.
15142
13463
  sortingIcon: () => slots.sortingIcon
@@ -15156,7 +13477,7 @@ const CSmartTable = defineComponent({
15156
13477
  class: 'icon',
15157
13478
  viewBox: '0 0 512 512',
15158
13479
  role: 'img',
15159
- innerHTML: cilArrowBottom[1],
13480
+ innerHTML: cilArrowTop[1],
15160
13481
  }),
15161
13482
  // @slot Sorter icon when items are sorted descending.
15162
13483
  sortingIconDescending: () => slots.sortingIconDescending
@@ -15166,12 +13487,13 @@ const CSmartTable = defineComponent({
15166
13487
  class: 'icon',
15167
13488
  viewBox: '0 0 512 512',
15168
13489
  role: 'img',
15169
- innerHTML: cilArrowTop[1],
13490
+ innerHTML: cilArrowBottom[1],
15170
13491
  }),
15171
13492
  }),
15172
13493
  h$1(CSmartTableBody, {
15173
13494
  clickableRows: props.clickableRows,
15174
13495
  columnNames: columnNames.value,
13496
+ columns: props.columns ?? columnNames.value,
15175
13497
  currentItems: currentItems.value,
15176
13498
  firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
15177
13499
  noItemsLabel: props.noItemsLabel,
@@ -15799,9 +14121,7 @@ const CWidgetStatsA = defineComponent({
15799
14121
  */
15800
14122
  setup(props, { slots }) {
15801
14123
  return () => h$1(CCard, {
15802
- class: [
15803
- { [`bg-${props.color}`]: props.color, 'text-high-emphasis-inverse': props.color },
15804
- ],
14124
+ class: [{ [`bg-${props.color}`]: props.color, 'text-white': props.color }],
15805
14125
  }, () => [
15806
14126
  h$1(CCardBody, {
15807
14127
  class: 'pb-0 d-flex justify-content-between align-items-start',
@@ -15913,7 +14233,7 @@ const CWidgetStatsB = defineComponent({
15913
14233
  return () => h$1(CCard, {
15914
14234
  class: [
15915
14235
  {
15916
- 'text-high-emphasis-inverse': props.inverse,
14236
+ 'text-white': props.inverse,
15917
14237
  },
15918
14238
  ],
15919
14239
  color: props.color,
@@ -15939,9 +14259,7 @@ const CWidgetStatsB = defineComponent({
15939
14259
  }),
15940
14260
  (props.text || slots.text) &&
15941
14261
  h$1('small', {
15942
- class: [
15943
- props.inverse ? 'text-medium-emphasis-inverse' : 'text-medium-emphasis',
15944
- ],
14262
+ class: [props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary'],
15945
14263
  }, {
15946
14264
  default: () => (slots.text && slots.text()) || props.text,
15947
14265
  }),
@@ -16009,7 +14327,7 @@ const CWidgetStatsC = defineComponent({
16009
14327
  h$1('div', {
16010
14328
  class: [
16011
14329
  'text-end mb-4',
16012
- props.inverse ? 'text-medium-emphasis-inverse' : 'text-medium-emphasis',
14330
+ props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary',
16013
14331
  ],
16014
14332
  }, slots.icon && slots.icon()),
16015
14333
  (props.value || slots.value) &&
@@ -16022,7 +14340,7 @@ const CWidgetStatsC = defineComponent({
16022
14340
  h$1('div', {
16023
14341
  class: [
16024
14342
  'text-uppercase fw-semibold small',
16025
- props.inverse ? 'text-medium-emphasis-inverse' : 'text-medium-emphasis',
14343
+ props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary',
16026
14344
  ],
16027
14345
  }, {
16028
14346
  default: () => (slots.title && slots.title()) || props.title,
@@ -16085,7 +14403,7 @@ const CWidgetStatsD = defineComponent({
16085
14403
  h$1(CCol, {}, {
16086
14404
  default: () => [
16087
14405
  h$1(CCol, { class: 'fs-5 fw-semibold' }, () => value.value),
16088
- h$1(CCol, { class: 'text-uppercase text-medium-emphasis small' }, () => value.title),
14406
+ h$1(CCol, { class: 'text-uppercase text-body-secondary small' }, () => value.title),
16089
14407
  ],
16090
14408
  }),
16091
14409
  ]),
@@ -16121,7 +14439,7 @@ const CWidgetStatsE = defineComponent({
16121
14439
  }, () => [
16122
14440
  (props.title || slots.title) &&
16123
14441
  h$1('div', {
16124
- class: 'text-muted small text-uppercase font-weight-bold',
14442
+ class: 'text-body-secondary small text-uppercase font-weight-bold',
16125
14443
  }, {
16126
14444
  default: () => (slots.title && slots.title()) || props.title,
16127
14445
  }),
@@ -16197,7 +14515,7 @@ const CWidgetStatsF = defineComponent({
16197
14515
  }),
16198
14516
  (props.title || slots.title) &&
16199
14517
  h$1('div', {
16200
- class: 'text-medium-emphasis text-uppercase fw-semibold small',
14518
+ class: 'text-body-secondary text-uppercase fw-semibold small',
16201
14519
  }, {
16202
14520
  default: () => (slots.title && slots.title()) || props.title,
16203
14521
  }),
@@ -16356,6 +14674,7 @@ var Components = /*#__PURE__*/Object.freeze({
16356
14674
  CProgress: CProgress,
16357
14675
  CProgressBar: CProgressBar,
16358
14676
  CProgressPlugin: CProgressPlugin,
14677
+ CProgressStacked: CProgressStacked,
16359
14678
  CRow: CRow,
16360
14679
  CSidebar: CSidebar,
16361
14680
  CSidebarBrand: CSidebarBrand,
@@ -16614,5 +14933,5 @@ const CoreuiVue = {
16614
14933
  },
16615
14934
  };
16616
14935
 
16617
- export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, CAccordionPlugin, CAlert, CAlertHeading, CAlertLink, CAlertPlugin, CAvatar, CAvatarPlugin, CBackdrop, CBackdropPlugin, CBadge, CBadgePlugin, CBreadcrumb, CBreadcrumbItem, CBreadcrumbPlugin, CButton, CButtonGroup, CButtonGroupPlugin, CButtonPlugin, CButtonToolbar, CCLinkPlugin, CCalendar, CCalendarPlugin, CCallout, CCalloutPlugin, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardPlugin, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCarouselPlugin, CCloseButton, CCloseButtonPlugin, CCol, CCollapse, CCollapsePlugin, CContainer, CDatePicker, CDatePickerPlugin, CDateRangePicker, CDateRangePickerPlugin, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownMenu, CDropdownPlugin, CDropdownToggle, CElementCover, CElementCoverPlugin, CFooter, CFooterPlugin, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormPlugin, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CGridPlugin, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderPlugin, CHeaderText, CHeaderToggler, CImage, CImagePlugin, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CListGroupPlugin, CLoadingButton, CLoadingButtonPlugin, CModal, CModalBody, CModalFooter, CModalHeader, CModalPlugin, CModalTitle, CMultiSelect, CMultiSelectPlugin, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavPlugin, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarPlugin, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasPlugin, COffcanvasTitle, CPagination, CPaginationItem, CPaginationPlugin, CPicker, CPickerPlugin, CPlaceholder, CPlaceholderPlugin, CPopover, CPopoverPlugin, CProgress, CProgressBar, CProgressPlugin, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarPlugin, CSidebarToggler, CSmartPagination, CSmartPaginationPlugin, CSmartTable, CSmartTablePlugin, CSpinner, CSpinnerPlugin, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTablePlugin, CTableRow, CTabsPlugin, CTimePicker, CTimePickerPlugin, CToast, CToastBody, CToastClose, CToastHeader, CToastPlugin, CToaster, CTooltip, CTooltipPlugin, CVirtualScroller, CVirtualScrollerPlugin, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, useColorModes, usePopper, vCPlaceholder as vcplaceholder, vCPopover as vcpopover, vCTooltip as vctooltip };
14936
+ export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, CAccordionPlugin, CAlert, CAlertHeading, CAlertLink, CAlertPlugin, CAvatar, CAvatarPlugin, CBackdrop, CBackdropPlugin, CBadge, CBadgePlugin, CBreadcrumb, CBreadcrumbItem, CBreadcrumbPlugin, CButton, CButtonGroup, CButtonGroupPlugin, CButtonPlugin, CButtonToolbar, CCLinkPlugin, CCalendar, CCalendarPlugin, CCallout, CCalloutPlugin, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardPlugin, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCarouselPlugin, CCloseButton, CCloseButtonPlugin, CCol, CCollapse, CCollapsePlugin, CContainer, CDatePicker, CDatePickerPlugin, CDateRangePicker, CDateRangePickerPlugin, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownMenu, CDropdownPlugin, CDropdownToggle, CElementCover, CElementCoverPlugin, CFooter, CFooterPlugin, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormPlugin, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CGridPlugin, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderPlugin, CHeaderText, CHeaderToggler, CImage, CImagePlugin, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CListGroupPlugin, CLoadingButton, CLoadingButtonPlugin, CModal, CModalBody, CModalFooter, CModalHeader, CModalPlugin, CModalTitle, CMultiSelect, CMultiSelectPlugin, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavPlugin, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarPlugin, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasPlugin, COffcanvasTitle, CPagination, CPaginationItem, CPaginationPlugin, CPicker, CPickerPlugin, CPlaceholder, CPlaceholderPlugin, CPopover, CPopoverPlugin, CProgress, CProgressBar, CProgressPlugin, CProgressStacked, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarPlugin, CSidebarToggler, CSmartPagination, CSmartPaginationPlugin, CSmartTable, CSmartTablePlugin, CSpinner, CSpinnerPlugin, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTablePlugin, CTableRow, CTabsPlugin, CTimePicker, CTimePickerPlugin, CToast, CToastBody, CToastClose, CToastHeader, CToastPlugin, CToaster, CTooltip, CTooltipPlugin, CVirtualScroller, CVirtualScrollerPlugin, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, useColorModes, useDebouncedCallback, usePopper, vCPlaceholder as vcplaceholder, vCPopover as vcpopover, vCTooltip as vctooltip };
16618
14937
  //# sourceMappingURL=index.es.js.map