@coreui/vue-pro 4.5.0 → 4.7.0-alpha.0

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 (60) hide show
  1. package/dist/components/Types.d.ts +5 -5
  2. package/dist/components/calendar/CCalendar.d.ts +41 -3
  3. package/dist/components/date-picker/CDatePicker.d.ts +43 -4
  4. package/dist/components/date-range-picker/CDateRangePicker.d.ts +191 -4
  5. package/dist/components/form/CFormInput.d.ts +166 -1
  6. package/dist/components/form/CFormSelect.d.ts +1 -1
  7. package/dist/components/grid/CCol.d.ts +3 -3
  8. package/dist/components/grid/CRow.d.ts +1 -1
  9. package/dist/components/index.d.ts +1 -0
  10. package/dist/components/multi-select/CMultiSelect.d.ts +143 -4
  11. package/dist/components/multi-select/CMultiSelectOptions.d.ts +11 -0
  12. package/dist/components/multi-select/CMultiSelectSelection.d.ts +3 -3
  13. package/dist/components/pagination/index.d.ts +1 -2
  14. package/dist/components/picker/CPicker.d.ts +1 -1
  15. package/dist/components/popover/CPopover.d.ts +1 -1
  16. package/dist/components/smart-pagination/CSmartPagination.d.ts +257 -0
  17. package/dist/components/smart-pagination/index.d.ts +6 -0
  18. package/dist/components/smart-table/CSmartTable.d.ts +6 -4
  19. package/dist/components/smart-table/CSmartTableFilter.d.ts +2 -2
  20. package/dist/components/smart-table/CSmartTableHead.d.ts +2 -2
  21. package/dist/components/smart-table/CSmartTableInterface.d.ts +4 -1
  22. package/dist/components/table/CTable.d.ts +1 -1
  23. package/dist/components/table/CTableCaption.d.ts +2 -8
  24. package/dist/components/time-picker/CTimePicker.d.ts +2 -1
  25. package/dist/components/tooltip/CTooltip.d.ts +1 -1
  26. package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
  27. package/dist/index.es.js +1560 -1017
  28. package/dist/index.es.js.map +1 -1
  29. package/dist/index.js +1559 -1015
  30. package/dist/index.js.map +1 -1
  31. package/dist/utils/getNextSibling.d.ts +2 -0
  32. package/dist/utils/getPreviousSibling.d.ts +2 -0
  33. package/dist/utils/index.d.ts +4 -0
  34. package/dist/utils/isVisible.d.ts +2 -0
  35. package/dist/utils/time.d.ts +2 -2
  36. package/package.json +2 -2
  37. package/src/components/calendar/CCalendar.ts +46 -4
  38. package/src/components/carousel/CCarousel.ts +1 -9
  39. package/src/components/date-picker/CDatePicker.ts +44 -3
  40. package/src/components/date-range-picker/CDateRangePicker.ts +340 -170
  41. package/src/components/form/CFormInput.ts +2 -0
  42. package/src/components/index.ts +1 -0
  43. package/src/components/loading-button/CLoadingButton.ts +1 -2
  44. package/src/components/multi-select/CMultiSelect.ts +295 -173
  45. package/src/components/multi-select/CMultiSelectOptions.ts +48 -10
  46. package/src/components/multi-select/CMultiSelectSelection.ts +1 -1
  47. package/src/components/pagination/index.ts +1 -3
  48. package/src/components/sidebar/CSidebar.ts +2 -10
  49. package/src/components/{pagination → smart-pagination}/CSmartPagination.ts +1 -2
  50. package/src/components/smart-pagination/index.ts +10 -0
  51. package/src/components/smart-table/CSmartTable.ts +10 -5
  52. package/src/components/smart-table/CSmartTableInterface.ts +4 -0
  53. package/src/components/table/CTableCaption.ts +0 -1
  54. package/src/components/time-picker/CTimePicker.ts +198 -64
  55. package/src/components/time-picker/CTimePickerRollCol.ts +9 -0
  56. package/src/utils/getNextSibling.ts +18 -0
  57. package/src/utils/getPreviousSibling.ts +18 -0
  58. package/src/utils/index.ts +5 -0
  59. package/src/utils/isVisible.ts +11 -0
  60. package/src/utils/time.ts +14 -6
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, reactive, onBeforeMount, onMounted, onUpdated, toRefs, onUnmounted, cloneVNode, nextTick, vShow, computed, Teleport, onBeforeUnmount } from 'vue';
1
+ import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, reactive, onBeforeMount, onMounted, onUpdated, toRefs, onUnmounted, cloneVNode, nextTick, vShow, Teleport, onBeforeUnmount, computed } from 'vue';
2
2
 
3
3
  const CAccordion = defineComponent({
4
4
  name: 'CAccordion',
@@ -1159,6 +1159,29 @@ const CCalendar = defineComponent({
1159
1159
  type: Number,
1160
1160
  default: 1,
1161
1161
  },
1162
+ /**
1163
+ * Set the format of day name.
1164
+ *
1165
+ * @default 'numeric'
1166
+ * @since 4.6.0
1167
+ */
1168
+ dayFormat: {
1169
+ type: [Function, String],
1170
+ default: 'numeric',
1171
+ required: false,
1172
+ validator: (value) => {
1173
+ if (typeof value === 'string') {
1174
+ return ['numeric', '2-digit'].includes(value);
1175
+ }
1176
+ if (typeof value === 'function') {
1177
+ return true;
1178
+ }
1179
+ if (typeof value === 'function') {
1180
+ return true;
1181
+ }
1182
+ return false;
1183
+ },
1184
+ },
1162
1185
  /**
1163
1186
  * Specify the list of dates that cannot be selected.
1164
1187
  */
@@ -1211,6 +1234,12 @@ const CCalendar = defineComponent({
1211
1234
  type: Boolean,
1212
1235
  default: true,
1213
1236
  },
1237
+ /**
1238
+ * Reorder year-month navigation, and render year first.
1239
+ *
1240
+ * @since 4.6.0
1241
+ */
1242
+ navYearFirst: Boolean,
1214
1243
  /**
1215
1244
  * Allow range selection.
1216
1245
  */
@@ -1231,7 +1260,7 @@ const CCalendar = defineComponent({
1231
1260
  * @type number | 'long' | 'narrow' | 'short'
1232
1261
  */
1233
1262
  weekdayFormat: {
1234
- type: [Number, String],
1263
+ type: [Function, Number, String],
1235
1264
  default: 2,
1236
1265
  validator: (value) => {
1237
1266
  if (typeof value === 'string') {
@@ -1240,6 +1269,9 @@ const CCalendar = defineComponent({
1240
1269
  if (typeof value === 'number') {
1241
1270
  return true;
1242
1271
  }
1272
+ if (typeof value === 'function') {
1273
+ return true;
1274
+ }
1243
1275
  return false;
1244
1276
  },
1245
1277
  },
@@ -1415,11 +1447,15 @@ const CCalendar = defineComponent({
1415
1447
  h$1('thead', {}, h$1('tr', {}, weekDays.map(({ date }) => {
1416
1448
  return h$1('th', { class: 'calendar-cell' }, h$1('div', {
1417
1449
  class: 'calendar-header-cell-inner',
1418
- }, props.weekdayFormat === 'string'
1419
- ? date.toLocaleDateString(props.locale, { weekday: props.weekdayFormat })
1420
- : date
1421
- .toLocaleDateString(props.locale, { weekday: 'long' })
1422
- .slice(0, props.weekdayFormat)));
1450
+ }, typeof props.weekdayFormat === 'function'
1451
+ ? props.weekdayFormat(date)
1452
+ : typeof props.weekdayFormat === 'string'
1453
+ ? date.toLocaleDateString(props.locale, {
1454
+ weekday: props.weekdayFormat,
1455
+ })
1456
+ : date
1457
+ .toLocaleDateString(props.locale, { weekday: 'long' })
1458
+ .slice(0, props.weekdayFormat)));
1423
1459
  }))),
1424
1460
  h$1('tbody', {}, [
1425
1461
  view.value === 'days' &&
@@ -1452,7 +1488,11 @@ const CCalendar = defineComponent({
1452
1488
  }),
1453
1489
  }, h$1('div', {
1454
1490
  class: 'calendar-cell-inner',
1455
- }, date.toLocaleDateString(props.locale, { day: 'numeric' })));
1491
+ }, typeof props.dayFormat === 'function'
1492
+ ? props.dayFormat(date)
1493
+ : date.toLocaleDateString(props.locale, {
1494
+ day: props.dayFormat,
1495
+ })));
1456
1496
  }));
1457
1497
  }),
1458
1498
  view.value === 'months' &&
@@ -1520,6 +1560,7 @@ const CCalendar = defineComponent({
1520
1560
  ]),
1521
1561
  h$1('div', {
1522
1562
  class: 'calendar-nav-date',
1563
+ ...(props.navYearFirst && { style: { display: 'flex', justifyContent: 'center' } }),
1523
1564
  }, [
1524
1565
  view.value === 'days' &&
1525
1566
  h$1(CButton, {
@@ -1537,6 +1578,7 @@ const CCalendar = defineComponent({
1537
1578
  if (props.navigation)
1538
1579
  view.value = 'years';
1539
1580
  },
1581
+ ...(props.navYearFirst && { style: { order: '-1' } }),
1540
1582
  }, () => date.toLocaleDateString(props.locale, { year: 'numeric' })),
1541
1583
  ]),
1542
1584
  props.navigation &&
@@ -1863,13 +1905,46 @@ const CCardPlugin = {
1863
1905
  },
1864
1906
  };
1865
1907
 
1866
- const isVisible$1 = (element) => {
1908
+ const getNextSibling = (elem, selector) => {
1909
+ // Get the next sibling element
1910
+ let sibling = elem.nextElementSibling;
1911
+ // If there's no selector, return the first sibling
1912
+ if (!selector)
1913
+ return sibling;
1914
+ // If the sibling matches our selector, use it
1915
+ // If not, jump to the next sibling and continue the loop
1916
+ while (sibling) {
1917
+ if (sibling.matches(selector))
1918
+ return sibling;
1919
+ sibling = sibling.nextElementSibling;
1920
+ }
1921
+ return;
1922
+ };
1923
+
1924
+ const getPreviousSibling = (elem, selector) => {
1925
+ // Get the next sibling element
1926
+ let sibling = elem.previousElementSibling;
1927
+ // If there's no selector, return the first sibling
1928
+ if (!selector)
1929
+ return sibling;
1930
+ // If the sibling matches our selector, use it
1931
+ // If not, jump to the next sibling and continue the loop
1932
+ while (sibling) {
1933
+ if (sibling.matches(selector))
1934
+ return sibling;
1935
+ sibling = sibling.previousElementSibling;
1936
+ }
1937
+ return;
1938
+ };
1939
+
1940
+ const isVisible = (element) => {
1867
1941
  const rect = element.getBoundingClientRect();
1868
1942
  return (rect.top >= 0 &&
1869
1943
  rect.left >= 0 &&
1870
1944
  rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
1871
1945
  rect.right <= (window.innerWidth || document.documentElement.clientWidth));
1872
1946
  };
1947
+
1873
1948
  const CCarousel = defineComponent({
1874
1949
  name: 'CCarousel',
1875
1950
  props: {
@@ -1981,7 +2056,7 @@ const CCarousel = defineComponent({
1981
2056
  const nextItemWhenVisible = () => {
1982
2057
  // Don't call next when the page isn't visible
1983
2058
  // or the carousel or its parent isn't visible
1984
- if (!document.hidden && isVisible$1(carouselRef.value)) {
2059
+ if (!document.hidden && isVisible(carouselRef.value)) {
1985
2060
  handleControlClick('next');
1986
2061
  }
1987
2062
  };
@@ -2000,7 +2075,7 @@ const CCarousel = defineComponent({
2000
2075
  }
2001
2076
  };
2002
2077
  const handleScroll = () => {
2003
- if (!document.hidden && isVisible$1(carouselRef.value)) {
2078
+ if (!document.hidden && isVisible(carouselRef.value)) {
2004
2079
  visible.value = true;
2005
2080
  }
2006
2081
  else {
@@ -8290,6 +8365,8 @@ const CFormControlWrapper = defineComponent({
8290
8365
  },
8291
8366
  });
8292
8367
 
8368
+ const File = typeof window !== 'undefined' ? window.File : class File extends Object {
8369
+ };
8293
8370
  const CFormInput = defineComponent({
8294
8371
  name: 'CFormInput',
8295
8372
  props: {
@@ -11892,6 +11969,12 @@ const CTimePickerRollCol = defineComponent({
11892
11969
  }
11893
11970
  init.value = false;
11894
11971
  });
11972
+ const handleKeyDown = (event, value) => {
11973
+ if (event.code === 'Space' || event.key === 'Enter') {
11974
+ event.preventDefault();
11975
+ emit('click', value);
11976
+ }
11977
+ };
11895
11978
  return () => h$1('div', { class: 'time-picker-roll-col', ref: colRef }, props.elements.map((element) => {
11896
11979
  return h$1('div', {
11897
11980
  class: [
@@ -11901,7 +11984,9 @@ const CTimePickerRollCol = defineComponent({
11901
11984
  },
11902
11985
  ],
11903
11986
  onClick: () => emit('click', element.value),
11987
+ onKeydown: (event) => handleKeyDown(event, element.value),
11904
11988
  role: 'button',
11989
+ tabindex: 0,
11905
11990
  }, element.label);
11906
11991
  }));
11907
11992
  },
@@ -11930,10 +12015,10 @@ const getAmPm = (date, locale) => {
11930
12015
  }
11931
12016
  return date.getHours() >= 12 ? 'pm' : 'am';
11932
12017
  };
11933
- const getListOfHours = (locale) => Array.from({ length: isAmPm(locale) ? 12 : 24 }, (_, i) => {
12018
+ const getListOfHours = (locale, ampm = 'auto') => Array.from({ length: (ampm === 'auto' && isAmPm(locale)) || ampm ? 12 : 24 }, (_, i) => {
11934
12019
  return {
11935
- value: isAmPm(locale) ? i + 1 : i,
11936
- label: (isAmPm(locale) ? i + 1 : i).toLocaleString(locale),
12020
+ value: (ampm === 'auto' && isAmPm(locale)) || ampm ? i + 1 : i,
12021
+ label: ((ampm === 'auto' && isAmPm(locale)) || ampm ? i + 1 : i).toLocaleString(locale),
11937
12022
  };
11938
12023
  });
11939
12024
  const getListOfMinutes = (locale, valueAsString = false) => Array.from({ length: 60 }, (_, i) => {
@@ -11966,7 +12051,11 @@ const getListOfSeconds = (locale, valueAsString = false) => Array.from({ length:
11966
12051
  .split(':')[2],
11967
12052
  };
11968
12053
  });
11969
- const getSelectedHour = (date, locale) => date ? (isAmPm(locale) ? convert24hTo12h(date.getHours()) : date.getHours()) : '';
12054
+ const getSelectedHour = (date, locale, ampm = 'auto') => date
12055
+ ? (ampm === 'auto' && isAmPm(locale)) || ampm
12056
+ ? convert24hTo12h(date.getHours())
12057
+ : date.getHours()
12058
+ : '';
11970
12059
  const getSelectedMinutes = (date) => (date ? date.getMinutes() : '');
11971
12060
  const getSelectedSeconds = (date) => (date ? date.getSeconds() : '');
11972
12061
  const isAmPm = (locale) => ['am', 'AM', 'pm', 'PM'].some((el) => new Date().toLocaleString(locale).includes(el));
@@ -11979,6 +12068,24 @@ const CTimePicker = defineComponent({
11979
12068
  name: 'CTimePicker',
11980
12069
  props: {
11981
12070
  ...CPicker.props,
12071
+ /**
12072
+ * Set if the component should use the 12/24 hour format. If `true` forces the interface to a 12-hour format. If `false` forces the interface into a 24-hour format. If `auto` the current locale will determine the 12 or 24-hour interface by default locales.
12073
+ *
12074
+ * @since 4.7.0
12075
+ */
12076
+ ampm: {
12077
+ type: [Boolean, String],
12078
+ default: 'auto',
12079
+ validator: (value) => {
12080
+ if (typeof value == 'string') {
12081
+ return ['auto'].includes(value);
12082
+ }
12083
+ if (typeof value == 'boolean') {
12084
+ return true;
12085
+ }
12086
+ return false;
12087
+ },
12088
+ },
11982
12089
  /**
11983
12090
  * Toggle visibility or set the content of cancel button.
11984
12091
  */
@@ -12065,6 +12172,34 @@ const CTimePicker = defineComponent({
12065
12172
  return ['ghost', 'outline'].includes(value);
12066
12173
  },
12067
12174
  },
12175
+ /**
12176
+ * Provide valuable, actionable feedback.
12177
+ *
12178
+ * @since 4.6.0
12179
+ */
12180
+ feedback: {
12181
+ type: String,
12182
+ },
12183
+ /**
12184
+ * Provide valuable, actionable feedback.
12185
+ *
12186
+ * @since 4.6.0
12187
+ */
12188
+ feedbackInvalid: {
12189
+ type: String,
12190
+ },
12191
+ /**
12192
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
12193
+ *
12194
+ * @since 4.6.0
12195
+ */
12196
+ feedbackValid: {
12197
+ type: String,
12198
+ },
12199
+ /**
12200
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
12201
+ */
12202
+ id: String,
12068
12203
  /**
12069
12204
  * Toggle visibility or set the content of the input indicator.
12070
12205
  */
@@ -12076,6 +12211,20 @@ const CTimePicker = defineComponent({
12076
12211
  * Toggle the readonly state for the component.
12077
12212
  */
12078
12213
  inputReadOnly: Boolean,
12214
+ /**
12215
+ * Set component validation state to invalid.
12216
+ *
12217
+ * @since 4.6.0
12218
+ */
12219
+ invalid: Boolean,
12220
+ /**
12221
+ * Add a caption for a component.
12222
+ *
12223
+ * @since 4.6.0
12224
+ */
12225
+ label: {
12226
+ type: String,
12227
+ },
12079
12228
  /**
12080
12229
  * Sets the default locale for components. If not set, it is inherited from the navigator.language.
12081
12230
  */
@@ -12090,6 +12239,15 @@ const CTimePicker = defineComponent({
12090
12239
  type: String,
12091
12240
  default: 'Select time',
12092
12241
  },
12242
+ /**
12243
+ * Show seconds.
12244
+ *
12245
+ * @since 4.7.0
12246
+ */
12247
+ seconds: {
12248
+ type: Boolean,
12249
+ default: true,
12250
+ },
12093
12251
  /**
12094
12252
  * Size the component small or large.
12095
12253
  *
@@ -12102,12 +12260,32 @@ const CTimePicker = defineComponent({
12102
12260
  return ['sm', 'lg'].includes(value);
12103
12261
  },
12104
12262
  },
12263
+ /**
12264
+ * Add helper text to the component.
12265
+ *
12266
+ * @since 4.6.0
12267
+ */
12268
+ text: {
12269
+ type: String,
12270
+ },
12105
12271
  /**
12106
12272
  * Initial selected time.
12107
12273
  */
12108
12274
  time: {
12109
12275
  type: [Date, String],
12110
12276
  },
12277
+ /**
12278
+ * Display validation feedback in a styled tooltip.
12279
+ *
12280
+ * @since 4.6.0
12281
+ */
12282
+ tooltipFeedback: Boolean,
12283
+ /**
12284
+ * Set component validation state to valid.
12285
+ *
12286
+ * @since 4.6.0
12287
+ */
12288
+ valid: Boolean,
12111
12289
  /**
12112
12290
  * Set the time picker variant to a roll or select.
12113
12291
  *
@@ -12120,6 +12298,10 @@ const CTimePicker = defineComponent({
12120
12298
  return ['roll', 'select'].includes(value);
12121
12299
  },
12122
12300
  },
12301
+ /**
12302
+ * Toggle the visibility of the component.
12303
+ */
12304
+ visible: Boolean,
12123
12305
  },
12124
12306
  emits: [
12125
12307
  /**
@@ -12134,8 +12316,15 @@ const CTimePicker = defineComponent({
12134
12316
  * Callback fired when the component requests to be shown.
12135
12317
  */
12136
12318
  'show',
12319
+ /**
12320
+ * Callback fired when the time changed.
12321
+ *
12322
+ * @since 4.7.0
12323
+ */
12324
+ 'update:time',
12137
12325
  ],
12138
- setup(props, { emit, slots }) {
12326
+ setup(props, { emit, attrs, slots }) {
12327
+ const visible = ref(props.visible);
12139
12328
  const date = ref(convertTimeToDate(props.time));
12140
12329
  const initialDate = ref(null);
12141
12330
  const ampm = ref(date.value ? getAmPm(new Date(date.value), props.locale) : 'am');
@@ -12150,6 +12339,8 @@ const CTimePicker = defineComponent({
12150
12339
  const handleClear = (event) => {
12151
12340
  event.stopPropagation();
12152
12341
  date.value = null;
12342
+ emit('change', null);
12343
+ emit('update:time', null);
12153
12344
  };
12154
12345
  const handleTimeChange = (set, value) => {
12155
12346
  const _date = date.value || new Date('1970-01-01');
@@ -12162,7 +12353,7 @@ const CTimePicker = defineComponent({
12162
12353
  }
12163
12354
  }
12164
12355
  if (set === 'hours') {
12165
- if (isAmPm(props.locale)) {
12356
+ if ((props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm) {
12166
12357
  _date.setHours(convert12hTo24h(ampm.value, parseInt(value)));
12167
12358
  }
12168
12359
  else {
@@ -12176,7 +12367,8 @@ const CTimePicker = defineComponent({
12176
12367
  _date.setSeconds(parseInt(value));
12177
12368
  }
12178
12369
  date.value = new Date(_date);
12179
- emit('change', _date.toTimeString(), _date.toLocaleTimeString(), _date);
12370
+ emit('change', _date.toTimeString(), _date.toLocaleTimeString(props.locale), _date);
12371
+ emit('update:time', _date.toLocaleTimeString(props.locale));
12180
12372
  };
12181
12373
  const InputGroup = () => h$1(CInputGroup, { class: 'picker-input-group', size: props.size }, () => [
12182
12374
  h$1(CFormInput, {
@@ -12189,7 +12381,12 @@ const CTimePicker = defineComponent({
12189
12381
  },
12190
12382
  placeholder: props.placeholder,
12191
12383
  readonly: props.inputReadOnly,
12192
- value: date.value ? date.value.toLocaleTimeString(props.locale) : '',
12384
+ value: date.value
12385
+ ? date.value.toLocaleTimeString(props.locale, {
12386
+ hour12: (props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm ? true : false,
12387
+ ...(!props.seconds && { timeStyle: 'short' }),
12388
+ })
12389
+ : '',
12193
12390
  }),
12194
12391
  (props.indicator || props.cleaner) &&
12195
12392
  h$1(CInputGroupText, {}, () => [
@@ -12230,14 +12427,15 @@ const CTimePicker = defineComponent({
12230
12427
  onChange: (event) => handleTimeChange('minutes', event.target.value),
12231
12428
  ...(date.value && { value: getSelectedMinutes(date.value) }),
12232
12429
  }),
12233
- ':',
12234
- // @ts-expect-error the getListOfMinutes function returns corect type
12235
- h$1(CFormSelect, {
12236
- disabled: props.disabled,
12237
- options: getListOfSeconds(props.locale, true),
12238
- onChange: (event) => handleTimeChange('seconds', event.target.value),
12239
- ...(date.value && { value: getSelectedSeconds(date.value) }),
12240
- }),
12430
+ props.seconds && ':',
12431
+ props.seconds &&
12432
+ // @ts-expect-error the getListOfMinutes function returns corect type
12433
+ h$1(CFormSelect, {
12434
+ disabled: props.disabled,
12435
+ options: getListOfSeconds(props.locale, true),
12436
+ onChange: (event) => handleTimeChange('seconds', event.target.value),
12437
+ ...(date.value && { value: getSelectedSeconds(date.value) }),
12438
+ }),
12241
12439
  isAmPm(props.locale) &&
12242
12440
  h$1(CFormSelect, {
12243
12441
  disabled: props.disabled,
@@ -12251,21 +12449,22 @@ const CTimePicker = defineComponent({
12251
12449
  ];
12252
12450
  const TimePickerRoll = () => [
12253
12451
  h$1(CTimePickerRollCol, {
12254
- elements: getListOfHours(props.locale),
12452
+ elements: getListOfHours(props.locale, props.ampm),
12255
12453
  onClick: (index) => handleTimeChange('hours', index.toString()),
12256
- selected: getSelectedHour(date.value, props.locale),
12454
+ selected: getSelectedHour(date.value, props.locale, props.ampm),
12257
12455
  }),
12258
12456
  h$1(CTimePickerRollCol, {
12259
12457
  elements: getListOfMinutes(props.locale),
12260
12458
  onClick: (index) => handleTimeChange('minutes', index.toString()),
12261
12459
  selected: getSelectedMinutes(date.value),
12262
12460
  }),
12263
- h$1(CTimePickerRollCol, {
12264
- elements: getListOfSeconds(props.locale),
12265
- onClick: (index) => handleTimeChange('seconds', index.toString()),
12266
- selected: getSelectedSeconds(date.value),
12267
- }),
12268
- isAmPm(props.locale) &&
12461
+ props.seconds &&
12462
+ h$1(CTimePickerRollCol, {
12463
+ elements: getListOfSeconds(props.locale),
12464
+ onClick: (index) => handleTimeChange('seconds', index.toString()),
12465
+ selected: getSelectedSeconds(date.value),
12466
+ }),
12467
+ ((props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm) &&
12269
12468
  h$1(CTimePickerRollCol, {
12270
12469
  elements: [
12271
12470
  { value: 'am', label: 'AM' },
@@ -12275,49 +12474,66 @@ const CTimePicker = defineComponent({
12275
12474
  selected: ampm.value,
12276
12475
  }),
12277
12476
  ];
12278
- return () => h$1(CPicker, {
12279
- cancelButton: props.cancelButton,
12280
- cancelButtonColor: props.cancelButtonColor,
12281
- cancelButtonSize: props.cancelButtonSize,
12282
- cancelButtonVariant: props.cancelButtonVariant,
12283
- class: 'time-picker',
12284
- confirmButton: props.confirmButton,
12285
- confirmButtonColor: props.confirmButtonColor,
12286
- confirmButtonSize: props.confirmButtonSize,
12287
- confirmButtonVariant: props.confirmButtonVariant,
12288
- container: props.container,
12289
- disabled: props.disabled,
12290
- footer: true,
12291
- onCancel: () => {
12292
- if (initialDate.value) {
12293
- date.value = new Date(initialDate.value);
12294
- }
12295
- },
12296
- onHide: () => {
12297
- emit('hide');
12298
- },
12299
- onShow: () => {
12300
- if (date.value) {
12301
- initialDate.value = new Date(date.value);
12302
- }
12303
- emit('show');
12304
- },
12477
+ return () => h$1(CFormControlWrapper, {
12478
+ describedby: attrs['aria-describedby'],
12479
+ feedback: props.feedback,
12480
+ feedbackInvalid: props.feedbackInvalid,
12481
+ feedbackValid: props.feedbackValid,
12482
+ id: props.id,
12483
+ invalid: props.invalid,
12484
+ label: props.label,
12485
+ text: props.text,
12486
+ tooltipFeedback: props.tooltipFeedback,
12487
+ valid: props.valid,
12305
12488
  }, {
12306
- ...(slots.cancelButton && {
12307
- cancelButton: () => slots.cancelButton && slots.cancelButton(),
12308
- }),
12309
- ...(slots.confirmButton && {
12310
- confirmButton: () => slots.confirmButton && slots.confirmButton(),
12489
+ default: () => h$1(CPicker, {
12490
+ cancelButton: props.cancelButton,
12491
+ cancelButtonColor: props.cancelButtonColor,
12492
+ cancelButtonSize: props.cancelButtonSize,
12493
+ cancelButtonVariant: props.cancelButtonVariant,
12494
+ class: ['time-picker', { 'is-invalid': props.invalid, 'is-valid': props.valid }],
12495
+ confirmButton: props.confirmButton,
12496
+ confirmButtonColor: props.confirmButtonColor,
12497
+ confirmButtonSize: props.confirmButtonSize,
12498
+ confirmButtonVariant: props.confirmButtonVariant,
12499
+ container: props.container,
12500
+ disabled: props.disabled,
12501
+ footer: true,
12502
+ onCancel: () => {
12503
+ if (initialDate.value) {
12504
+ date.value = new Date(initialDate.value);
12505
+ }
12506
+ visible.value = false;
12507
+ },
12508
+ onHide: () => {
12509
+ visible.value = false;
12510
+ emit('hide');
12511
+ },
12512
+ onShow: () => {
12513
+ if (date.value) {
12514
+ initialDate.value = new Date(date.value);
12515
+ }
12516
+ visible.value = true;
12517
+ emit('show');
12518
+ },
12519
+ visible: visible.value,
12520
+ }, {
12521
+ ...(slots.cancelButton && {
12522
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
12523
+ }),
12524
+ ...(slots.confirmButton && {
12525
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
12526
+ }),
12527
+ toggler: () => InputGroup(),
12528
+ default: () => h$1('div', {
12529
+ class: [
12530
+ 'time-picker-body',
12531
+ {
12532
+ ['time-picker-roll']: props.variant === 'roll',
12533
+ },
12534
+ ],
12535
+ }, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
12311
12536
  }),
12312
- toggler: () => InputGroup(),
12313
- default: () => h$1('div', {
12314
- class: [
12315
- 'time-picker-body',
12316
- {
12317
- ['time-picker-roll']: props.variant === 'roll',
12318
- },
12319
- ],
12320
- }, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
12321
12537
  });
12322
12538
  },
12323
12539
  });
@@ -12391,6 +12607,15 @@ const CDateRangePicker = defineComponent({
12391
12607
  type: Boolean,
12392
12608
  default: true,
12393
12609
  },
12610
+ /**
12611
+ * If true the dropdown will be immediately closed after submitting the full date.
12612
+ *
12613
+ * @since 4.7.0
12614
+ */
12615
+ closeOnSelect: {
12616
+ type: Boolean,
12617
+ default: true,
12618
+ },
12394
12619
  /**
12395
12620
  * Toggle visibility or set the content of confirm button.
12396
12621
  */
@@ -12430,6 +12655,29 @@ const CDateRangePicker = defineComponent({
12430
12655
  return ['ghost', 'outline'].includes(value);
12431
12656
  },
12432
12657
  },
12658
+ /**
12659
+ * Set the format of day name.
12660
+ *
12661
+ * @default 'numeric'
12662
+ * @since 4.6.0
12663
+ */
12664
+ dayFormat: {
12665
+ type: [Function, String],
12666
+ default: 'numeric',
12667
+ required: false,
12668
+ validator: (value) => {
12669
+ if (typeof value === 'string') {
12670
+ return ['numeric', '2-digit'].includes(value);
12671
+ }
12672
+ if (typeof value === 'function') {
12673
+ return true;
12674
+ }
12675
+ if (typeof value === 'function') {
12676
+ return true;
12677
+ }
12678
+ return false;
12679
+ },
12680
+ },
12433
12681
  /**
12434
12682
  * Toggle the disabled state for the component.
12435
12683
  */
@@ -12447,6 +12695,30 @@ const CDateRangePicker = defineComponent({
12447
12695
  type: [Date, String],
12448
12696
  required: false,
12449
12697
  },
12698
+ /**
12699
+ * Provide valuable, actionable feedback.
12700
+ *
12701
+ * @since 4.6.0
12702
+ */
12703
+ feedback: {
12704
+ type: String,
12705
+ },
12706
+ /**
12707
+ * Provide valuable, actionable feedback.
12708
+ *
12709
+ * @since 4.6.0
12710
+ */
12711
+ feedbackInvalid: {
12712
+ type: String,
12713
+ },
12714
+ /**
12715
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
12716
+ *
12717
+ * @since 4.6.0
12718
+ */
12719
+ feedbackValid: {
12720
+ type: String,
12721
+ },
12450
12722
  /**
12451
12723
  * Sets the day of start week.
12452
12724
  * - 0 - Sunday,
@@ -12489,6 +12761,20 @@ const CDateRangePicker = defineComponent({
12489
12761
  * Toggle the readonly state for the component.
12490
12762
  */
12491
12763
  inputReadOnly: Boolean,
12764
+ /**
12765
+ * Set component validation state to invalid.
12766
+ *
12767
+ * @since 4.6.0
12768
+ */
12769
+ invalid: Boolean,
12770
+ /**
12771
+ * Add a caption for a component.
12772
+ *
12773
+ * @since 4.6.0
12774
+ */
12775
+ label: {
12776
+ type: String,
12777
+ },
12492
12778
  /**
12493
12779
  * Sets the default locale for components. If not set, it is inherited from the navigator.language.
12494
12780
  */
@@ -12515,6 +12801,12 @@ const CDateRangePicker = defineComponent({
12515
12801
  type: Boolean,
12516
12802
  default: true,
12517
12803
  },
12804
+ /**
12805
+ * Reorder year-month navigation, and render year first.
12806
+ *
12807
+ * @since 4.6.0
12808
+ */
12809
+ navYearFirst: Boolean,
12518
12810
  /**
12519
12811
  * Specifies a short hint that is visible in the input.
12520
12812
  */
@@ -12562,6 +12854,14 @@ const CDateRangePicker = defineComponent({
12562
12854
  startDate: {
12563
12855
  type: [Date, String],
12564
12856
  },
12857
+ /**
12858
+ * Add helper text to the component.
12859
+ *
12860
+ * @since 4.6.0
12861
+ */
12862
+ text: {
12863
+ type: String,
12864
+ },
12565
12865
  /**
12566
12866
  * Provide an additional time selection by adding select boxes to choose times.
12567
12867
  */
@@ -12605,13 +12905,29 @@ const CDateRangePicker = defineComponent({
12605
12905
  return ['ghost', 'outline'].includes(value);
12606
12906
  },
12607
12907
  },
12908
+ /**
12909
+ * Display validation feedback in a styled tooltip.
12910
+ *
12911
+ * @since 4.6.0
12912
+ */
12913
+ tooltipFeedback: Boolean,
12914
+ /**
12915
+ * Set component validation state to valid.
12916
+ *
12917
+ * @since 4.6.0
12918
+ */
12919
+ valid: Boolean,
12920
+ /**
12921
+ * Toggle the visibility of the component.
12922
+ */
12923
+ visible: Boolean,
12608
12924
  /**
12609
12925
  * Set length or format of day name.
12610
12926
  *
12611
12927
  * @type number | 'long' | 'narrow' | 'short'
12612
12928
  */
12613
12929
  weekdayFormat: {
12614
- type: [Number, String],
12930
+ type: [Function, Number, String],
12615
12931
  default: 2,
12616
12932
  validator: (value) => {
12617
12933
  if (typeof value === 'string') {
@@ -12620,6 +12936,9 @@ const CDateRangePicker = defineComponent({
12620
12936
  if (typeof value === 'number') {
12621
12937
  return true;
12622
12938
  }
12939
+ if (typeof value === 'function') {
12940
+ return true;
12941
+ }
12623
12942
  return false;
12624
12943
  },
12625
12944
  },
@@ -12647,12 +12966,27 @@ const CDateRangePicker = defineComponent({
12647
12966
  * @property {string} formatedDate - formated date
12648
12967
  */
12649
12968
  'start-date-change',
12650
- ],
12651
- setup(props, { slots, emit }) {
12652
- const calendarDate = ref(props.calendarDate
12653
- ? new Date(props.calendarDate)
12654
- : props.startDate
12655
- ? new Date(props.startDate)
12969
+ /**
12970
+ * Callback fired when the start date changed.
12971
+ *
12972
+ * @property {Date | null} date - date object
12973
+ * @since 4.7.0
12974
+ */
12975
+ 'update:start-date',
12976
+ /**
12977
+ * Callback fired when the end date changed.
12978
+ *
12979
+ * @property {Date | null} date - date object
12980
+ * @since 4.7.0
12981
+ */
12982
+ 'update:end-date',
12983
+ ],
12984
+ setup(props, { slots, attrs, emit }) {
12985
+ const visible = ref(props.visible);
12986
+ const calendarDate = ref(props.calendarDate
12987
+ ? new Date(props.calendarDate)
12988
+ : props.startDate
12989
+ ? new Date(props.startDate)
12656
12990
  : props.endDate
12657
12991
  ? new Date(props.endDate)
12658
12992
  : new Date());
@@ -12723,6 +13057,13 @@ const CDateRangePicker = defineComponent({
12723
13057
  selectEndDate.value = true;
12724
13058
  }
12725
13059
  emit('start-date-change', date, date ? formatDate(date) : undefined);
13060
+ emit('update:start-date', date);
13061
+ if (props.timepicker || props.footer) {
13062
+ return;
13063
+ }
13064
+ if (props.closeOnSelect && !props.range) {
13065
+ visible.value = false;
13066
+ }
12726
13067
  };
12727
13068
  const handleEndDateChange = (date) => {
12728
13069
  endDate.value = date;
@@ -12731,6 +13072,13 @@ const CDateRangePicker = defineComponent({
12731
13072
  selectEndDate.value = false;
12732
13073
  }
12733
13074
  emit('end-date-change', date, date ? formatDate(date) : undefined);
13075
+ emit('update:end-date', date);
13076
+ if (props.timepicker || props.footer) {
13077
+ return;
13078
+ }
13079
+ if (props.closeOnSelect && startDate.value !== null) {
13080
+ visible.value = false;
13081
+ }
12734
13082
  };
12735
13083
  const handleClear = (event) => {
12736
13084
  event.stopPropagation();
@@ -12738,6 +13086,10 @@ const CDateRangePicker = defineComponent({
12738
13086
  endDate.value = null;
12739
13087
  inputStartHoverValue.value = null;
12740
13088
  inputEndHoverValue.value = null;
13089
+ emit('start-date-change', null);
13090
+ emit('end-date-change', null);
13091
+ emit('update:start-date', null);
13092
+ emit('update:end-date', null);
12741
13093
  };
12742
13094
  const InputGroup = () => h$1(CInputGroup, {
12743
13095
  class: 'picker-input-group',
@@ -12815,147 +13167,168 @@ const CDateRangePicker = defineComponent({
12815
13167
  : h$1('span', { class: 'picker-input-group-icon date-picker-cleaner-icon' })),
12816
13168
  ]),
12817
13169
  ]);
12818
- return () => h$1(CPicker, {
12819
- cancelButton: props.cancelButton,
12820
- cancelButtonColor: props.cancelButtonColor,
12821
- cancelButtonSize: props.cancelButtonSize,
12822
- cancelButtonVariant: props.cancelButtonVariant,
12823
- class: 'date-picker',
12824
- confirmButton: props.confirmButton,
12825
- confirmButtonColor: props.confirmButtonColor,
12826
- confirmButtonSize: props.confirmButtonSize,
12827
- confirmButtonVariant: props.confirmButtonVariant,
12828
- disabled: props.disabled,
12829
- footer: props.footer || props.timepicker,
13170
+ return () => h$1(CFormControlWrapper, {
13171
+ describedby: attrs['aria-describedby'],
13172
+ feedback: props.feedback,
13173
+ feedbackInvalid: props.feedbackInvalid,
13174
+ feedbackValid: props.feedbackValid,
12830
13175
  id: props.id,
12831
- onCancel: () => {
12832
- startDate.value = initialStartDate.value;
12833
- endDate.value = initialEndDate.value;
12834
- },
12835
- onHide: () => {
12836
- emit('hide');
12837
- },
12838
- onShow: () => {
12839
- if (startDate.value) {
12840
- initialStartDate.value = new Date(startDate.value);
12841
- }
12842
- if (endDate.value) {
12843
- initialEndDate.value = new Date(endDate.value);
12844
- }
12845
- emit('show');
12846
- },
13176
+ invalid: props.invalid,
13177
+ label: props.label,
13178
+ text: props.text,
13179
+ tooltipFeedback: props.tooltipFeedback,
13180
+ valid: props.valid,
12847
13181
  }, {
12848
- ...(slots.cancelButton && {
12849
- cancelButton: () => slots.cancelButton && slots.cancelButton(),
12850
- }),
12851
- ...(slots.confirmButton && {
12852
- confirmButton: () => slots.confirmButton && slots.confirmButton(),
12853
- }),
12854
- toggler: () => InputGroup(),
12855
- footer: () => h$1(CButton, {
12856
- class: 'me-auto',
12857
- color: props.todayButtonColor,
12858
- size: props.todayButtonSize,
12859
- variant: props.todayButtonVariant,
12860
- onClick: () => {
12861
- const date = new Date();
12862
- startDate.value = date;
12863
- endDate.value = date;
12864
- calendarDate.value = date;
13182
+ default: () => h$1(CPicker, {
13183
+ cancelButton: props.cancelButton,
13184
+ cancelButtonColor: props.cancelButtonColor,
13185
+ cancelButtonSize: props.cancelButtonSize,
13186
+ cancelButtonVariant: props.cancelButtonVariant,
13187
+ class: ['date-picker', { 'is-invalid': props.invalid, 'is-valid': props.valid }],
13188
+ confirmButton: props.confirmButton,
13189
+ confirmButtonColor: props.confirmButtonColor,
13190
+ confirmButtonSize: props.confirmButtonSize,
13191
+ confirmButtonVariant: props.confirmButtonVariant,
13192
+ disabled: props.disabled,
13193
+ footer: props.footer || props.timepicker,
13194
+ id: props.id,
13195
+ onCancel: () => {
13196
+ startDate.value = initialStartDate.value;
13197
+ endDate.value = initialEndDate.value;
13198
+ visible.value = false;
12865
13199
  },
12866
- }, () => props.todayButton),
12867
- default: () => h$1('div', {
12868
- class: 'date-picker-body',
12869
- }, [
12870
- props.ranges &&
12871
- h$1('div', { class: 'date-picker-ranges' }, Object.keys(props.ranges).map((key) => h$1(CButton, {
12872
- color: 'secondary',
12873
- onClick: () => {
12874
- if (props.ranges) {
12875
- startDate.value = props.ranges[key][0];
12876
- endDate.value = props.ranges[key][1];
12877
- }
12878
- },
12879
- variant: 'ghost',
12880
- }, () => key))),
12881
- h$1('div', { class: 'date-picker-calendars' }, h$1(CCalendar, {
12882
- calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), 1),
12883
- calendars: props.calendars,
12884
- disabledDates: props.disabledDates,
12885
- ...(endDate.value && { endDate: endDate.value }),
12886
- firstDayOfWeek: props.firstDayOfWeek,
12887
- locale: props.locale,
12888
- maxDate: maxDate.value,
12889
- minDate: minDate.value,
12890
- navigation: props.navigation,
12891
- range: props.range,
12892
- selectEndDate: selectEndDate.value,
12893
- ...(startDate.value && { startDate: startDate.value }),
12894
- onCalendarCellHover: (date) => handleCalendarCellHover(date),
12895
- onCalendarDateChange: (date) => handleCalendarDateChange(date),
12896
- onStartDateChange: (date) => handleStartDateChange(date),
12897
- onEndDateChange: (date) => handleEndDateChange(date),
12898
- }, {
12899
- /**
12900
- * @slot Location for next icon.
12901
- */
12902
- ...(slots.navNextIcon && {
12903
- navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
12904
- }),
12905
- /**
12906
- * @slot Location for next double icon.
12907
- */
12908
- ...(slots.navNextDoubleIcon && {
12909
- navNextDoubleIcon: () => slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
12910
- }),
12911
- /**
12912
- * @slot Location for previous icon.
12913
- */
12914
- ...(slots.navPrevIcon && {
12915
- navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
12916
- }),
12917
- /**
12918
- * @slot Location for double previous icon.
12919
- */
12920
- ...(slots.navPrevDoubleIcon && {
12921
- navPrevDoubleIcon: () => slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
12922
- }),
12923
- })),
12924
- props.timepicker &&
12925
- h$1('div', { class: 'date-picker-timepickers' }, isMobile.value || (props.range && props.calendars === 1)
12926
- ? [
12927
- h$1(CTimePicker, {
12928
- container: 'inline',
12929
- disabled: startDate.value === null ? true : false,
12930
- locale: props.locale,
12931
- onChange: (_, __, date) => handleStartDateChange(date),
12932
- time: startDate.value,
12933
- variant: 'select',
12934
- }),
12935
- h$1(CTimePicker, {
13200
+ onHide: () => {
13201
+ visible.value = false;
13202
+ emit('hide');
13203
+ },
13204
+ onShow: () => {
13205
+ if (startDate.value) {
13206
+ initialStartDate.value = new Date(startDate.value);
13207
+ }
13208
+ if (endDate.value) {
13209
+ initialEndDate.value = new Date(endDate.value);
13210
+ }
13211
+ visible.value = true;
13212
+ emit('show');
13213
+ },
13214
+ visible: visible.value,
13215
+ }, {
13216
+ ...(slots.cancelButton && {
13217
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
13218
+ }),
13219
+ ...(slots.confirmButton && {
13220
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
13221
+ }),
13222
+ toggler: () => InputGroup(),
13223
+ footer: () => h$1(CButton, {
13224
+ class: 'me-auto',
13225
+ color: props.todayButtonColor,
13226
+ size: props.todayButtonSize,
13227
+ variant: props.todayButtonVariant,
13228
+ onClick: () => {
13229
+ const date = new Date();
13230
+ startDate.value = date;
13231
+ endDate.value = date;
13232
+ calendarDate.value = date;
13233
+ },
13234
+ }, () => props.todayButton),
13235
+ default: () => h$1('div', {
13236
+ class: 'date-picker-body',
13237
+ }, [
13238
+ props.ranges &&
13239
+ h$1('div', { class: 'date-picker-ranges' }, Object.keys(props.ranges).map((key) => h$1(CButton, {
13240
+ color: 'secondary',
13241
+ onClick: () => {
13242
+ if (props.ranges) {
13243
+ startDate.value = props.ranges[key][0];
13244
+ endDate.value = props.ranges[key][1];
13245
+ }
13246
+ },
13247
+ variant: 'ghost',
13248
+ }, () => key))),
13249
+ h$1('div', { class: 'date-picker-calendars' }, h$1(CCalendar, {
13250
+ calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), 1),
13251
+ calendars: props.calendars,
13252
+ dayFormat: props.dayFormat,
13253
+ disabledDates: props.disabledDates,
13254
+ ...(endDate.value && { endDate: endDate.value }),
13255
+ firstDayOfWeek: props.firstDayOfWeek,
13256
+ locale: props.locale,
13257
+ maxDate: maxDate.value,
13258
+ minDate: minDate.value,
13259
+ navYearFirst: props.navYearFirst,
13260
+ navigation: props.navigation,
13261
+ range: props.range,
13262
+ selectEndDate: selectEndDate.value,
13263
+ ...(startDate.value && { startDate: startDate.value }),
13264
+ onCalendarCellHover: (date) => handleCalendarCellHover(date),
13265
+ onCalendarDateChange: (date) => handleCalendarDateChange(date),
13266
+ onStartDateChange: (date) => handleStartDateChange(date),
13267
+ onEndDateChange: (date) => handleEndDateChange(date),
13268
+ }, {
13269
+ /**
13270
+ * @slot Location for next icon.
13271
+ */
13272
+ ...(slots.navNextIcon && {
13273
+ navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
13274
+ }),
13275
+ /**
13276
+ * @slot Location for next double icon.
13277
+ */
13278
+ ...(slots.navNextDoubleIcon && {
13279
+ navNextDoubleIcon: () => slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
13280
+ }),
13281
+ /**
13282
+ * @slot Location for previous icon.
13283
+ */
13284
+ ...(slots.navPrevIcon && {
13285
+ navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
13286
+ }),
13287
+ /**
13288
+ * @slot Location for double previous icon.
13289
+ */
13290
+ ...(slots.navPrevDoubleIcon && {
13291
+ navPrevDoubleIcon: () => slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
13292
+ }),
13293
+ })),
13294
+ props.timepicker &&
13295
+ h$1('div', { class: 'date-picker-timepickers' }, isMobile.value || (props.range && props.calendars === 1)
13296
+ ? [
13297
+ h$1(CTimePicker, {
13298
+ container: 'inline',
13299
+ disabled: startDate.value === null ? true : false,
13300
+ locale: props.locale,
13301
+ onChange: (_, __, date) => handleStartDateChange(date),
13302
+ time: startDate.value,
13303
+ variant: 'select',
13304
+ }),
13305
+ h$1(CTimePicker, {
13306
+ container: 'inline',
13307
+ disabled: endDate.value === null ? true : false,
13308
+ locale: props.locale,
13309
+ onChange: (_, __, date) => handleEndDateChange(date),
13310
+ time: endDate.value,
13311
+ variant: 'select',
13312
+ }),
13313
+ ]
13314
+ : [...Array(props.calendars)].map((_, index) => h$1(CTimePicker, {
12936
13315
  container: 'inline',
12937
- disabled: endDate.value === null ? true : false,
13316
+ disabled: index === 0
13317
+ ? startDate.value === null
13318
+ ? true
13319
+ : false
13320
+ : endDate.value === null
13321
+ ? true
13322
+ : false,
12938
13323
  locale: props.locale,
12939
- onChange: (_, __, date) => handleEndDateChange(date),
12940
- time: endDate.value,
13324
+ onChange: (_, __, date) => index === 0
13325
+ ? handleStartDateChange(date)
13326
+ : handleEndDateChange(date),
13327
+ time: index === 0 ? startDate.value : endDate.value,
12941
13328
  variant: 'select',
12942
- }),
12943
- ]
12944
- : [...Array(props.calendars)].map((_, index) => h$1(CTimePicker, {
12945
- container: 'inline',
12946
- disabled: index === 0
12947
- ? startDate.value === null
12948
- ? true
12949
- : false
12950
- : endDate.value === null
12951
- ? true
12952
- : false,
12953
- locale: props.locale,
12954
- onChange: (_, __, date) => index === 0 ? handleStartDateChange(date) : handleEndDateChange(date),
12955
- time: index === 0 ? startDate.value : endDate.value,
12956
- variant: 'select',
12957
- }))),
12958
- ]),
13329
+ }))),
13330
+ ]),
13331
+ }),
12959
13332
  });
12960
13333
  },
12961
13334
  });
@@ -13061,6 +13434,29 @@ const CDatePicker = defineComponent({
13061
13434
  return ['ghost', 'outline'].includes(value);
13062
13435
  },
13063
13436
  },
13437
+ /**
13438
+ * Set the format of day name.
13439
+ *
13440
+ * @default 'numeric'
13441
+ * @since 4.6.0
13442
+ */
13443
+ dayFormat: {
13444
+ type: [Function, String],
13445
+ default: 'numeric',
13446
+ required: false,
13447
+ validator: (value) => {
13448
+ if (typeof value === 'string') {
13449
+ return ['numeric', '2-digit'].includes(value);
13450
+ }
13451
+ if (typeof value === 'function') {
13452
+ return true;
13453
+ }
13454
+ if (typeof value === 'function') {
13455
+ return true;
13456
+ }
13457
+ return false;
13458
+ },
13459
+ },
13064
13460
  /**
13065
13461
  * Toggle the disabled state for the component.
13066
13462
  */
@@ -13145,6 +13541,12 @@ const CDatePicker = defineComponent({
13145
13541
  type: Boolean,
13146
13542
  default: true,
13147
13543
  },
13544
+ /**
13545
+ * Reorder year-month navigation, and render year first.
13546
+ *
13547
+ * @since 4.6.0
13548
+ */
13549
+ navYearFirst: Boolean,
13148
13550
  /**
13149
13551
  * Specifies a short hint that is visible in the input.
13150
13552
  */
@@ -13174,7 +13576,7 @@ const CDatePicker = defineComponent({
13174
13576
  * @type number | 'long' | 'narrow' | 'short'
13175
13577
  */
13176
13578
  weekdayFormat: {
13177
- type: [Number, String],
13579
+ type: [Function, Number, String],
13178
13580
  default: 2,
13179
13581
  validator: (value) => {
13180
13582
  if (typeof value === 'string') {
@@ -13183,6 +13585,9 @@ const CDatePicker = defineComponent({
13183
13585
  if (typeof value === 'number') {
13184
13586
  return true;
13185
13587
  }
13588
+ if (typeof value === 'function') {
13589
+ return true;
13590
+ }
13186
13591
  return false;
13187
13592
  },
13188
13593
  },
@@ -13195,11 +13600,21 @@ const CDatePicker = defineComponent({
13195
13600
  * @property {string} formatedDate - formated date
13196
13601
  */
13197
13602
  'date-change',
13603
+ /**
13604
+ * Callback fired when the date changed.
13605
+ *
13606
+ * @property {Date | null} date - date object
13607
+ * @since 4.7.0
13608
+ */
13609
+ 'update:date',
13198
13610
  ],
13199
13611
  setup(props, { emit }) {
13200
13612
  return () => h$1(CDateRangePicker, {
13201
13613
  calendars: 1,
13202
- onStartDateChange: (date, formatedDate) => emit('date-change', date, formatedDate),
13614
+ onStartDateChange: (date, formatedDate) => {
13615
+ emit('date-change', date, formatedDate);
13616
+ emit('update:date', date);
13617
+ },
13203
13618
  range: false,
13204
13619
  startDate: props.date,
13205
13620
  ...props,
@@ -14030,11 +14445,10 @@ const CLoadingButton = defineComponent({
14030
14445
  }
14031
14446
  };
14032
14447
  return () => h$1(CButton, {
14448
+ ...props,
14033
14449
  class: ['btn-loading', { ['is-loading']: loading.value }],
14034
14450
  ...(props.disabledOnLoading && loading.value && { disabled: true }),
14035
14451
  onClick: () => handleOnClick(),
14036
- // TODO: remove non button props
14037
- ...props,
14038
14452
  }, {
14039
14453
  default: () => [
14040
14454
  h$1(CSpinner, { class: 'btn-loading-spinner', size: 'sm', variant: props.spinnerType }),
@@ -14436,34 +14850,61 @@ const CMultiSelectOptions = defineComponent({
14436
14850
  default: 'no items',
14437
14851
  required: false,
14438
14852
  },
14853
+ selected: {
14854
+ type: Array,
14855
+ default: () => [],
14856
+ required: false,
14857
+ },
14439
14858
  },
14440
14859
  emits: ['optionClick'],
14441
14860
  setup(props, { emit }) {
14861
+ const handleKeyDown = (event, option) => {
14862
+ if (event.code === 'Space' || event.key === 'Enter') {
14863
+ event.preventDefault();
14864
+ handleOptionClick && handleOptionClick(option);
14865
+ return;
14866
+ }
14867
+ if (event.key === 'Down' || event.key === 'ArrowDown') {
14868
+ event.preventDefault();
14869
+ const target = event.target;
14870
+ const next = getNextSibling(target, '.form-multi-select-option');
14871
+ if (next) {
14872
+ next.focus(); // eslint-disable-line prettier/prettier
14873
+ }
14874
+ }
14875
+ if (event.key === 'Up' || event.key === 'ArrowUp') {
14876
+ event.preventDefault();
14877
+ const target = event.target;
14878
+ const prev = getPreviousSibling(target, '.form-multi-select-option');
14879
+ if (prev) {
14880
+ prev.focus(); // eslint-disable-line prettier/prettier
14881
+ }
14882
+ }
14883
+ };
14442
14884
  const handleOptionClick = (option) => {
14443
14885
  emit('optionClick', option);
14444
14886
  };
14445
- const createOptions = (options) => {
14446
- return options.length > 0
14447
- ? options.map((option) => {
14448
- return option.options
14449
- ? h$1('div', { class: 'form-multi-select-options' }, [
14450
- h$1('div', { class: 'form-multi-select-optgroup-label' }, option.label),
14451
- createOptions(option.options),
14452
- ])
14453
- : h$1('div', {
14454
- class: [
14455
- 'form-multi-select-option',
14456
- {
14457
- 'form-multi-select-option-with-checkbox': props.optionsStyle === 'checkbox',
14458
- 'form-multi-selected': option.selected,
14459
- disabled: option.disabled,
14460
- },
14461
- ],
14462
- onClick: () => handleOptionClick(option),
14463
- }, option.text);
14464
- })
14465
- : h$1('div', { class: 'form-multi-select-options-empty' }, props.searchNoResultsLabel);
14466
- };
14887
+ // TODO: find solution how to remove any
14888
+ const createOptions = (options) => options.length > 0
14889
+ ? options.map((option) => option.options
14890
+ ? [
14891
+ h$1('div', { class: 'form-multi-select-optgroup-label' }, option.label),
14892
+ createOptions(option.options),
14893
+ ]
14894
+ : h$1('div', {
14895
+ class: [
14896
+ 'form-multi-select-option',
14897
+ {
14898
+ 'form-multi-select-option-with-checkbox': props.optionsStyle === 'checkbox',
14899
+ 'form-multi-selected': props.selected.some((_option) => _option.value === option.value),
14900
+ disabled: option.disabled,
14901
+ },
14902
+ ],
14903
+ onClick: () => handleOptionClick(option),
14904
+ onKeydown: (event) => handleKeyDown(event, option),
14905
+ tabindex: 0,
14906
+ }, option.text))
14907
+ : h$1('div', { class: 'form-multi-select-options-empty' }, props.searchNoResultsLabel);
14467
14908
  return () => h$1('div', {
14468
14909
  class: 'form-multi-select-options',
14469
14910
  ...(props.optionsMaxHeight !== 'auto' && {
@@ -14490,7 +14931,7 @@ const CMultiSelectSelection = defineComponent({
14490
14931
  * Enables search input element.
14491
14932
  */
14492
14933
  search: {
14493
- type: Boolean,
14934
+ type: [Boolean, String],
14494
14935
  required: false,
14495
14936
  default: false,
14496
14937
  },
@@ -14560,6 +15001,11 @@ const CMultiSelectSelection = defineComponent({
14560
15001
  },
14561
15002
  });
14562
15003
 
15004
+ const flattenArray = (options) => {
15005
+ return options.reduce((acc, val) => {
15006
+ return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
15007
+ }, []);
15008
+ };
14563
15009
  const CMultiSelect = defineComponent({
14564
15010
  name: 'CMultiSelect',
14565
15011
  props: {
@@ -14581,6 +15027,50 @@ const CMultiSelect = defineComponent({
14581
15027
  required: false,
14582
15028
  default: false,
14583
15029
  },
15030
+ /**
15031
+ * Provide valuable, actionable feedback.
15032
+ *
15033
+ * @since 4.6.0
15034
+ */
15035
+ feedback: {
15036
+ type: String,
15037
+ },
15038
+ /**
15039
+ * Provide valuable, actionable feedback.
15040
+ *
15041
+ * @since 4.6.0
15042
+ */
15043
+ feedbackInvalid: {
15044
+ type: String,
15045
+ },
15046
+ /**
15047
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
15048
+ *
15049
+ * @since 4.6.0
15050
+ */
15051
+ feedbackValid: {
15052
+ type: String,
15053
+ },
15054
+ /**
15055
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
15056
+ */
15057
+ id: {
15058
+ type: String,
15059
+ },
15060
+ /**
15061
+ * Set component validation state to invalid.
15062
+ *
15063
+ * @since 4.6.0
15064
+ */
15065
+ invalid: Boolean,
15066
+ /**
15067
+ * Add a caption for a component.
15068
+ *
15069
+ * @since 4.6.0
15070
+ */
15071
+ label: {
15072
+ type: String,
15073
+ },
14584
15074
  /**
14585
15075
  * It specifies that multiple options can be selected at once.
14586
15076
  *
@@ -14637,9 +15127,18 @@ const CMultiSelect = defineComponent({
14637
15127
  * Enables search input element.
14638
15128
  */
14639
15129
  search: {
14640
- type: Boolean,
15130
+ type: [Boolean, String],
14641
15131
  default: true,
14642
15132
  required: false,
15133
+ validator: (value) => {
15134
+ if (typeof value == 'string') {
15135
+ return ['external'].includes(value);
15136
+ }
15137
+ if (typeof value == 'boolean') {
15138
+ return true;
15139
+ }
15140
+ return false;
15141
+ },
14643
15142
  },
14644
15143
  /**
14645
15144
  * Sets the label for no results when filtering.
@@ -14705,6 +15204,26 @@ const CMultiSelect = defineComponent({
14705
15204
  return ['sm', 'lg'].includes(value);
14706
15205
  },
14707
15206
  },
15207
+ /**
15208
+ * Add helper text to the component.
15209
+ *
15210
+ * @since 4.6.0
15211
+ */
15212
+ text: {
15213
+ type: String,
15214
+ },
15215
+ /**
15216
+ * Display validation feedback in a styled tooltip.
15217
+ *
15218
+ * @since 4.6.0
15219
+ */
15220
+ tooltipFeedback: Boolean,
15221
+ /**
15222
+ * Set component validation state to valid.
15223
+ *
15224
+ * @since 4.6.0
15225
+ */
15226
+ valid: Boolean,
14708
15227
  /**
14709
15228
  * Toggle the visibility of multi select dropdown.
14710
15229
  *
@@ -14721,59 +15240,63 @@ const CMultiSelect = defineComponent({
14721
15240
  * Execute a function when a user changes the selected option. [docs]
14722
15241
  */
14723
15242
  'change',
15243
+ /**
15244
+ * Execute a function when the filter value changed.
15245
+ *
15246
+ * @since 4.7.0
15247
+ */
15248
+ 'filterChange',
14724
15249
  ],
14725
- setup(props, { emit }) {
14726
- const flattenArray = (options) => {
14727
- return options.reduce((acc, val) => {
14728
- return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
14729
- }, []);
14730
- };
14731
- const getSelectedOptions = (options) => {
14732
- return flattenArray(options).filter((option) => {
14733
- if (option.selected) {
14734
- return option;
14735
- }
14736
- return;
14737
- });
14738
- };
14739
- const updateOptions = (value, _options = options.value) => {
14740
- return props.multiple && _options
14741
- ? _options &&
14742
- _options.map((option) => {
14743
- count.value = count.value++;
14744
- return option.options
14745
- ? { ...option, options: updateOptions(value, option.options) }
14746
- : option.value == value // TODO: find solution
14747
- ? { ...option, selected: !option.selected, order: count.value }
14748
- : { ...option };
14749
- })
14750
- : _options &&
14751
- _options.map((option) => {
14752
- return option.options
14753
- ? { ...option, options: updateOptions(value, option.options) }
14754
- : option.value == value // TODO: find solution
14755
- ? { ...option, selected: true }
14756
- : { ...option, selected: false };
15250
+ setup(props, { attrs, emit }) {
15251
+ const nativeSelectRef = ref();
15252
+ provide('nativeSelectRef', nativeSelectRef);
15253
+ const searchRef = ref();
15254
+ const options = ref(props.options);
15255
+ const search = ref('');
15256
+ const selected = ref([]);
15257
+ const visible = ref(props.visible);
15258
+ const selectOptions = (options, deselected) => {
15259
+ let _selected = [...selected.value, ...options];
15260
+ if (deselected) {
15261
+ _selected = _selected.filter((selectedOption) => !deselected.some((deselectedOption) => deselectedOption.value === selectedOption.value));
15262
+ }
15263
+ const deduplicated = _selected.reduce((unique, option) => {
15264
+ if (!unique.some((obj) => obj.value === option.value)) {
15265
+ unique.push({
15266
+ value: option.value,
15267
+ text: option.text,
15268
+ ...(option.disabled && { disabled: option.disabled }),
14757
15269
  });
14758
- };
14759
- const toggleAllOptions = (options, selected, counter = count.value) => {
14760
- return options.map((option) => {
14761
- !option.selected && counter++;
14762
- count.value = counter;
14763
- if (option.options) {
14764
- return {
14765
- ...option,
14766
- options: toggleAllOptions(option.options, selected, counter),
14767
- };
14768
15270
  }
14769
- return option.disabled
14770
- ? { ...option }
14771
- : selected && !option.selected
14772
- ? { ...option, selected: selected, order: counter }
14773
- : { ...option, selected: selected };
14774
- });
15271
+ return unique;
15272
+ }, []);
15273
+ selected.value = deduplicated;
14775
15274
  };
14776
- const filterOptionsList = (search, _options = vOptions.value) => {
15275
+ watch(() => props.options, (newValue, oldValue) => {
15276
+ if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
15277
+ options.value = newValue;
15278
+ const _selected = newValue &&
15279
+ flattenArray(newValue).filter((option) => {
15280
+ if (option.selected) {
15281
+ return option;
15282
+ }
15283
+ return;
15284
+ });
15285
+ const deselected = newValue &&
15286
+ flattenArray(newValue).filter((option) => {
15287
+ if (option.selected === false) {
15288
+ return option;
15289
+ }
15290
+ return;
15291
+ });
15292
+ _selected && selectOptions(_selected, deselected);
15293
+ }
15294
+ });
15295
+ watch(selected, () => {
15296
+ nativeSelectRef.value &&
15297
+ nativeSelectRef.value.dispatchEvent(new Event('change', { bubbles: true }));
15298
+ });
15299
+ const filterOptionsList = (search, _options) => {
14777
15300
  return search.length
14778
15301
  ? _options &&
14779
15302
  _options.reduce((acc, val) => {
@@ -14787,63 +15310,54 @@ const CMultiSelect = defineComponent({
14787
15310
  }, [])
14788
15311
  : options.value;
14789
15312
  };
14790
- const nativeSelectRef = ref();
14791
- provide('nativeSelectRef', nativeSelectRef);
14792
- const searchRef = ref();
14793
- const options = ref(props.options);
14794
- const vOptions = ref(props.options);
14795
- const search = ref('');
14796
- const visible = ref(props.visible);
14797
- const selected = ref(getSelectedOptions(props.options));
14798
- const count = ref(0);
14799
- watch(() => props.options, (newValue, oldValue) => {
14800
- if (JSON.stringify(newValue) !== JSON.stringify(oldValue))
14801
- options.value = newValue;
14802
- });
14803
- watch(options, () => {
14804
- const _selected = options.value && getSelectedOptions(options.value);
14805
- _selected.sort((a, b) => {
14806
- if (typeof a.order === 'undefined') {
14807
- return -1;
14808
- }
14809
- if (b.order && a.order > b.order)
14810
- return 1;
14811
- if (b.order && a.order < b.order)
14812
- return -1;
14813
- return 0;
14814
- });
14815
- selected.value = _selected;
14816
- });
14817
- watch([options, search], () => {
14818
- vOptions.value = filterOptionsList(search.value, options.value);
14819
- });
14820
- watch(selected, () => {
14821
- nativeSelectRef.value &&
14822
- nativeSelectRef.value.dispatchEvent(new Event('change', { bubbles: true }));
14823
- });
15313
+ // watch(
15314
+ // () => props.options,
15315
+ // (newValue, oldValue) => {
15316
+ // console.log(props.options)
15317
+ // if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) options.value = newValue
15318
+ // },
15319
+ // )
14824
15320
  const handleSearchChange = (event) => {
14825
15321
  const target = event.target;
14826
15322
  search.value = target.value.toLowerCase();
15323
+ emit('filterChange', target.value);
14827
15324
  };
14828
15325
  const handleSearchKeyDown = (event) => {
14829
- if (search.value.length)
15326
+ if (search.value.length) {
14830
15327
  return;
15328
+ }
14831
15329
  if (event.key === 'Backspace' || event.key === 'Delete') {
14832
15330
  const last = selected.value.filter((option) => !option.disabled).pop();
14833
15331
  if (last) {
14834
15332
  selected.value = selected.value.filter((option) => option.value !== last.value);
14835
- options.value = updateOptions(last.value);
14836
15333
  }
14837
15334
  }
14838
15335
  };
14839
15336
  const handleOptionClick = (option) => {
14840
- options.value = updateOptions(option.value);
15337
+ if (!props.multiple) {
15338
+ selected.value = [{ value: option.value, text: option.text }];
15339
+ visible.value = false;
15340
+ search.value = '';
15341
+ if (searchRef.value) {
15342
+ searchRef.value.value = '';
15343
+ }
15344
+ return;
15345
+ }
15346
+ if (selected.value.some((_option) => _option.value === option.value)) {
15347
+ selected.value = selected.value.filter((_option) => _option.value !== option.value);
15348
+ }
15349
+ else {
15350
+ selected.value = [
15351
+ ...selected.value,
15352
+ { value: option.value, text: option.text },
15353
+ ];
15354
+ }
14841
15355
  };
14842
15356
  const handleSelectAll = () => {
14843
- options.value = toggleAllOptions(options.value, true);
15357
+ selectOptions(flattenArray(options.value).filter((option) => !option.disabled));
14844
15358
  };
14845
15359
  const handleDeselectAll = () => {
14846
- options.value = toggleAllOptions(options.value, false);
15360
+ selected.value = selected.value.filter((option) => option.disabled);
14847
15361
  };
14848
15362
  return () => [
14849
15363
  h$1(CMultiSelectNativeSelect, {
@@ -14854,75 +15368,103 @@ const CMultiSelect = defineComponent({
14854
15368
  : selected.value.map((option) => option.value)[0],
14855
15369
  onChange: () => emit('change', selected.value),
14856
15370
  }),
14857
- h$1(CPicker, {
14858
- class: [
14859
- 'form-multi-select',
14860
- {
14861
- 'form-multi-select-with-cleaner': props.cleaner,
14862
- disabled: props.disabled,
14863
- [`form-multi-select-${props.size}`]: props.size,
14864
- 'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
14865
- show: visible.value,
14866
- },
14867
- ],
14868
- disabled: props.disabled,
14869
- onShow: () => {
14870
- props.search && searchRef.value && searchRef.value.focus();
14871
- },
15371
+ h$1(CFormControlWrapper, {
15372
+ describedby: attrs['aria-describedby'],
15373
+ feedback: props.feedback,
15374
+ feedbackInvalid: props.feedbackInvalid,
15375
+ feedbackValid: props.feedbackValid,
15376
+ id: props.id,
15377
+ invalid: props.invalid,
15378
+ label: props.label,
15379
+ text: props.text,
15380
+ tooltipFeedback: props.tooltipFeedback,
15381
+ valid: props.valid,
14872
15382
  }, {
14873
- toggler: () => h$1('div', {}, [
14874
- h$1(CMultiSelectSelection, {
14875
- multiple: props.multiple,
14876
- onRemove: (option) => !props.disabled && handleOptionClick(option),
14877
- search: props.search,
14878
- selected: selected.value,
14879
- selectionType: props.selectionType,
14880
- selectionTypeCounterText: props.selectionTypeCounterText,
14881
- }),
14882
- props.multiple &&
14883
- props.cleaner &&
14884
- selected.value.length > 0 &&
14885
- !props.disabled &&
14886
- h$1('button', {
14887
- type: 'button',
14888
- class: 'form-multi-select-selection-cleaner',
14889
- onClick: () => handleDeselectAll(),
15383
+ default: () => h$1(CPicker, {
15384
+ class: [
15385
+ 'form-multi-select',
15386
+ {
15387
+ 'form-multi-select-with-cleaner': props.cleaner,
15388
+ disabled: props.disabled,
15389
+ [`form-multi-select-${props.size}`]: props.size,
15390
+ 'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
15391
+ show: visible.value,
15392
+ 'is-invalid': props.invalid,
15393
+ 'is-valid': props.valid,
15394
+ },
15395
+ ],
15396
+ disabled: props.disabled,
15397
+ id: props.id,
15398
+ onHide: () => {
15399
+ visible.value = false;
15400
+ },
15401
+ onShow: () => {
15402
+ props.search && searchRef.value && searchRef.value.focus();
15403
+ visible.value = true;
15404
+ },
15405
+ visible: visible.value,
15406
+ }, {
15407
+ toggler: () => h$1('div', {}, [
15408
+ h$1(CMultiSelectSelection, {
15409
+ multiple: props.multiple,
15410
+ onRemove: (option) => !props.disabled && handleOptionClick(option),
15411
+ search: props.search,
15412
+ selected: selected.value,
15413
+ selectionType: props.selectionType,
15414
+ selectionTypeCounterText: props.selectionTypeCounterText,
14890
15415
  }),
14891
- props.search &&
14892
- h$1('input', {
14893
- type: 'text',
14894
- class: 'form-multi-select-search',
14895
- autocomplete: 'off',
14896
- ...(selected.value.length === 0 && { placeholder: props.placeholder }),
14897
- ...(selected.value.length &&
14898
- props.selectionType === 'counter' && {
14899
- placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
15416
+ props.multiple &&
15417
+ props.cleaner &&
15418
+ selected.value.length > 0 &&
15419
+ !props.disabled &&
15420
+ h$1('button', {
15421
+ type: 'button',
15422
+ class: 'form-multi-select-selection-cleaner',
15423
+ onClick: () => handleDeselectAll(),
14900
15424
  }),
14901
- ...(selected.value.length &&
14902
- !props.multiple && {
14903
- placeholder: selected.value.map((option) => option.text)[0],
15425
+ props.search &&
15426
+ h$1('input', {
15427
+ type: 'text',
15428
+ class: 'form-multi-select-search',
15429
+ autocomplete: 'off',
15430
+ ...(selected.value.length === 0 && { placeholder: props.placeholder }),
15431
+ ...(selected.value.length &&
15432
+ props.selectionType === 'counter' && {
15433
+ placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
15434
+ }),
15435
+ ...(selected.value.length &&
15436
+ !props.multiple && {
15437
+ placeholder: selected.value.map((option) => option.text)[0],
15438
+ }),
15439
+ disabled: props.disabled,
15440
+ onInput: (event) => handleSearchChange(event),
15441
+ onKeydown: (event) => handleSearchKeyDown(event),
15442
+ ...(props.multiple &&
15443
+ selected.value.length &&
15444
+ props.selectionType !== 'counter' && { size: search.value.length + 2 }),
15445
+ ref: searchRef,
14904
15446
  }),
14905
- disabled: props.disabled,
14906
- onInput: (event) => handleSearchChange(event),
14907
- onKeydown: (event) => handleSearchKeyDown(event),
14908
- ...(props.multiple &&
14909
- selected.value.length &&
14910
- props.selectionType !== 'counter' && { size: search.value.length + 2 }),
14911
- ref: searchRef,
15447
+ ]),
15448
+ default: () => h$1('div', {}, [
15449
+ props.multiple &&
15450
+ props.selectAll &&
15451
+ h$1('button', {
15452
+ class: 'form-multi-select-all',
15453
+ onClick: () => handleSelectAll(),
15454
+ type: 'button',
15455
+ }, props.selectAllLabel),
15456
+ h$1(CMultiSelectOptions, {
15457
+ onOptionClick: (option) => handleOptionClick(option),
15458
+ options: props.search === 'external'
15459
+ ? options.value
15460
+ : filterOptionsList(search.value, options.value),
15461
+ optionsMaxHeight: props.optionsMaxHeight,
15462
+ optionsStyle: props.optionsStyle,
15463
+ searchNoResultsLabel: props.searchNoResultsLabel,
15464
+ selected: selected.value
14912
15465
  }),
14913
- ]),
14914
- default: () => h$1('div', {}, [
14915
- props.multiple &&
14916
- props.selectAll &&
14917
- h$1('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
14918
- h$1(CMultiSelectOptions, {
14919
- onOptionClick: (option) => handleOptionClick(option),
14920
- options: vOptions.value,
14921
- optionsMaxHeight: props.optionsMaxHeight,
14922
- optionsStyle: props.optionsStyle,
14923
- searchNoResultsLabel: props.searchNoResultsLabel,
14924
- }),
14925
- ]),
15466
+ ]),
15467
+ }),
14926
15468
  }),
14927
15469
  ];
14928
15470
  },
@@ -15639,470 +16181,179 @@ const CPaginationItem = defineComponent({
15639
16181
  },
15640
16182
  });
15641
16183
 
15642
- const CSmartPagination = defineComponent({
15643
- name: 'CSmartPagination',
16184
+ const CPaginationPlugin = {
16185
+ install: (app) => {
16186
+ app.component(CPagination.name, CPagination);
16187
+ app.component(CPaginationItem.name, CPaginationItem);
16188
+ },
16189
+ };
16190
+
16191
+ const BREAKPOINTS$1 = [
16192
+ 'xxl',
16193
+ 'xl',
16194
+ 'lg',
16195
+ 'md',
16196
+ 'sm',
16197
+ 'xs',
16198
+ ];
16199
+ const CPlaceholder = defineComponent({
16200
+ name: 'CPlaceholder',
15644
16201
  props: {
15645
16202
  /**
15646
- * Horizontall align
16203
+ * Set animation type to better convey the perception of something being actively loaded.
15647
16204
  *
15648
- * @default 'start'
16205
+ * @values 'glow', 'wave'
15649
16206
  */
15650
- align: {
16207
+ animation: {
15651
16208
  type: String,
15652
- default: 'start',
16209
+ default: undefined,
15653
16210
  require: false,
15654
16211
  validator: (value) => {
15655
- return ['start', 'center', 'end'].includes(value);
16212
+ return ['glow', 'wave'].includes(value);
15656
16213
  },
15657
16214
  },
15658
16215
  /**
15659
- * Current page number
16216
+ * Sets the color context of the component to one of CoreUI’s themed colors.
15660
16217
  *
15661
- * @default 1
16218
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
15662
16219
  */
15663
- activePage: {
15664
- type: Number,
15665
- default: 1,
15666
- require: false,
16220
+ color: Color,
16221
+ /**
16222
+ * Component used for the root node. Either a string to use a HTML element or a component.
16223
+ */
16224
+ component: {
16225
+ type: String,
16226
+ default: 'span',
16227
+ required: false,
15667
16228
  },
15668
16229
  /**
15669
- * Show/hide arrows
16230
+ * Size the component extra small, small, or large.
15670
16231
  *
15671
- * @default true
16232
+ * @values 'xs', 'sm', 'lg'
15672
16233
  */
15673
- arrows: {
15674
- type: Boolean,
15675
- default: true,
15676
- require: false,
16234
+ size: {
16235
+ type: String,
16236
+ default: undefined,
16237
+ required: false,
16238
+ validator: (value) => {
16239
+ return ['xs', 'sm', 'lg'].includes(value);
16240
+ },
15677
16241
  },
15678
16242
  /**
15679
- * Show/hide dots
15680
- *
15681
- * @default true
16243
+ * The number of columns on extra small devices (<576px).
15682
16244
  */
15683
- dots: {
15684
- type: Boolean,
15685
- default: true,
16245
+ xs: {
16246
+ type: Number,
16247
+ default: undefined,
15686
16248
  require: false,
15687
16249
  },
15688
16250
  /**
15689
- * Show double arrows buttons
15690
- *
15691
- * @default true
16251
+ * The number of columns on small devices (<768px).
15692
16252
  */
15693
- doubleArrows: {
15694
- type: Boolean,
15695
- default: true,
16253
+ sm: {
16254
+ type: Number,
16255
+ default: undefined,
15696
16256
  require: false,
15697
16257
  },
15698
16258
  /**
15699
- * The content of 'firstButton' button
15700
- *
15701
- * @default '&laquo;'
16259
+ * The number of columns on medium devices (<992px).
15702
16260
  */
15703
- firstButton: {
15704
- type: String,
15705
- default: '&laquo;',
16261
+ md: {
16262
+ type: Number,
16263
+ default: undefined,
15706
16264
  require: false,
15707
16265
  },
15708
16266
  /**
15709
- * The content of 'lastButton' button
15710
- *
15711
- * @default '&raquo;'
16267
+ * The number of columns on large devices (<1200px).
15712
16268
  */
15713
- lastButton: {
15714
- type: String,
15715
- default: '&raquo;',
16269
+ lg: {
16270
+ type: Number,
16271
+ default: undefined,
15716
16272
  require: false,
15717
16273
  },
15718
16274
  /**
15719
- * Maximum items number
15720
- *
15721
- * @default 5
16275
+ * The number of columns on X-Large devices (<1400px).
15722
16276
  */
15723
- limit: {
16277
+ xl: {
15724
16278
  type: Number,
15725
- default: 5,
16279
+ default: undefined,
15726
16280
  require: false,
15727
16281
  },
15728
16282
  /**
15729
- * The content of 'nextButton' button
15730
- *
15731
- * @default '&rsaquo;'
16283
+ * The number of columns on XX-Large devices (≥1400px).
15732
16284
  */
15733
- nextButton: {
15734
- type: String,
15735
- default: '&rsaquo;',
16285
+ xxl: {
16286
+ type: Number,
16287
+ default: undefined,
15736
16288
  require: false,
15737
16289
  },
16290
+ },
16291
+ setup(props, { slots }) {
16292
+ const repsonsiveClassNames = [];
16293
+ BREAKPOINTS$1.forEach((bp) => {
16294
+ const breakpoint = props[bp];
16295
+ const infix = bp === 'xs' ? '' : `-${bp}`;
16296
+ if (typeof breakpoint === 'number') {
16297
+ repsonsiveClassNames.push(`col${infix}-${breakpoint}`);
16298
+ }
16299
+ if (typeof breakpoint === 'boolean') {
16300
+ repsonsiveClassNames.push(`col${infix}`);
16301
+ }
16302
+ });
16303
+ return () => h$1(props.component, {
16304
+ class: [
16305
+ props.animation ? `placeholder-${props.animation}` : 'placeholder',
16306
+ {
16307
+ [`bg-${props.color}`]: props.color,
16308
+ [`placeholder-${props.size}`]: props.size,
16309
+ },
16310
+ repsonsiveClassNames,
16311
+ ],
16312
+ }, slots.default && slots.default());
16313
+ },
16314
+ });
16315
+
16316
+ const CPlaceholderPlugin = {
16317
+ install: (app) => {
16318
+ app.component(CPlaceholder.name, CPlaceholder);
16319
+ },
16320
+ };
16321
+
16322
+ const CProgressBar = defineComponent({
16323
+ name: 'CProgressBar',
16324
+ props: {
15738
16325
  /**
15739
- * Number of pages
16326
+ * Use to animate the stripes right to left via CSS3 animations.
15740
16327
  */
15741
- pages: {
15742
- type: Number,
15743
- default: 1000,
15744
- require: true,
16328
+ animated: {
16329
+ type: Boolean,
16330
+ required: false,
15745
16331
  },
15746
16332
  /**
15747
- * The content of 'previousButton' button
16333
+ * Sets the color context of the component to one of CoreUI’s themed colors.
15748
16334
  *
15749
- * @default '&lsaquo;'
16335
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
15750
16336
  */
15751
- previousButton: {
15752
- type: String,
15753
- default: '&lsaquo;',
15754
- require: false,
16337
+ color: Color,
16338
+ /**
16339
+ * The percent to progress the ProgressBar.
16340
+ */
16341
+ value: {
16342
+ type: Number,
16343
+ required: false,
16344
+ default: 0,
15755
16345
  },
15756
16346
  /**
15757
- * Size of pagination, valid values: 'sm', 'lg'
16347
+ * Set the progress bar variant to optional striped.
16348
+ *
16349
+ * @values 'striped'
15758
16350
  */
15759
- size: {
16351
+ variant: {
15760
16352
  type: String,
15761
16353
  default: undefined,
15762
- required: false,
16354
+ require: false,
15763
16355
  validator: (value) => {
15764
- return ['sm', 'lg'].includes(value);
15765
- },
15766
- },
15767
- },
15768
- emits: [
15769
- /**
15770
- * On active page change callback.
15771
- */
15772
- 'activePageChange',
15773
- ],
15774
- setup(props, { emit }) {
15775
- const activePage = ref(props.activePage);
15776
- const limit = ref(props.limit);
15777
- const pages = ref(props.pages);
15778
- watch(props, () => {
15779
- activePage.value = props.activePage;
15780
- limit.value = props.limit;
15781
- pages.value = props.pages;
15782
- });
15783
- const showDots = computed(() => {
15784
- return props.dots && limit.value > 4 && limit.value < pages.value;
15785
- });
15786
- const maxPrevItems = computed(() => {
15787
- return Math.floor((limit.value - 1) / 2);
15788
- });
15789
- const maxNextItems = computed(() => {
15790
- return Math.ceil((limit.value - 1) / 2);
15791
- });
15792
- const beforeDots = computed(() => {
15793
- return showDots.value && activePage.value > maxPrevItems.value + 1;
15794
- });
15795
- const afterDots = computed(() => {
15796
- return showDots.value && activePage.value < pages.value - maxNextItems.value;
15797
- });
15798
- const computedLimit = computed(() => {
15799
- return limit.value - (afterDots.value ? 1 : 0) - (beforeDots.value ? 1 : 0);
15800
- });
15801
- const range = computed(() => {
15802
- return activePage.value + maxNextItems.value;
15803
- });
15804
- const lastItem = computed(() => {
15805
- return range.value >= pages.value ? pages.value : range.value - (afterDots.value ? 1 : 0);
15806
- });
15807
- const itemsAmount = computed(() => {
15808
- return pages.value < computedLimit.value ? pages.value : computedLimit.value;
15809
- });
15810
- const items = computed(() => {
15811
- if (activePage.value - maxPrevItems.value <= 1) {
15812
- return Array.from({
15813
- length: itemsAmount.value,
15814
- }, (_v, i) => i + 1);
15815
- }
15816
- else {
15817
- return Array.from({
15818
- length: itemsAmount.value,
15819
- }, (_v, i) => {
15820
- return lastItem.value - i;
15821
- }).reverse();
15822
- }
15823
- });
15824
- const setPage = (number) => {
15825
- if (number !== activePage.value) {
15826
- activePage.value = number;
15827
- emit('activePageChange', number);
15828
- }
15829
- };
15830
- return () => h$1(CPagination, {
15831
- align: props.align,
15832
- 'aria-label': 'pagination',
15833
- size: props.size,
15834
- }, {
15835
- default: () => [
15836
- props.doubleArrows &&
15837
- h$1(CPaginationItem, {
15838
- onClick: () => {
15839
- activePage.value !== 1 && setPage(1);
15840
- },
15841
- 'aria-label': 'Go to first page',
15842
- ...(activePage.value === 1 && {
15843
- 'aria-disabled': true,
15844
- disabled: true,
15845
- }),
15846
- }, {
15847
- default: () => typeof props.firstButton === 'string'
15848
- ? h$1('span', {
15849
- innerHTML: props.firstButton,
15850
- })
15851
- : props.firstButton,
15852
- }),
15853
- props.arrows &&
15854
- h$1(CPaginationItem, {
15855
- onClick: () => {
15856
- activePage.value !== 1 && setPage(activePage.value - 1);
15857
- },
15858
- 'aria-label': 'Go to previous page',
15859
- ...(activePage.value === 1 && {
15860
- 'aria-disabled': true,
15861
- disabled: true,
15862
- }),
15863
- }, {
15864
- default: () => typeof props.previousButton === 'string'
15865
- ? h$1('span', {
15866
- innerHTML: props.previousButton,
15867
- })
15868
- : props.previousButton,
15869
- }),
15870
- beforeDots.value &&
15871
- h$1(CPaginationItem, {
15872
- role: 'separator',
15873
- disabled: true,
15874
- }, {
15875
- default: () => '...',
15876
- }),
15877
- items.value.map((i) => {
15878
- return h$1(CPaginationItem, {
15879
- onClick: () => setPage(i),
15880
- 'aria-label': activePage.value === i ? `Current page ${i}` : `Go to page ${i}`,
15881
- active: activePage.value === i,
15882
- }, {
15883
- default: () => i,
15884
- });
15885
- }),
15886
- afterDots.value &&
15887
- h$1(CPaginationItem, {
15888
- role: 'separator',
15889
- disabled: true,
15890
- }, {
15891
- default: () => '...',
15892
- }),
15893
- props.arrows &&
15894
- h$1(CPaginationItem, {
15895
- onClick: () => {
15896
- activePage.value !== pages.value && setPage(activePage.value + 1);
15897
- },
15898
- 'aria-label': 'Go to next page',
15899
- ...(activePage.value === pages.value && {
15900
- 'aria-disabled': true,
15901
- disabled: true,
15902
- }),
15903
- }, {
15904
- default: () => typeof props.nextButton === 'string'
15905
- ? h$1('span', {
15906
- innerHTML: props.nextButton,
15907
- })
15908
- : props.nextButton,
15909
- }),
15910
- props.doubleArrows &&
15911
- h$1(CPaginationItem, {
15912
- onClick: () => {
15913
- activePage.value !== pages.value && setPage(pages.value);
15914
- },
15915
- 'aria-label': 'Go to last page',
15916
- ...(activePage.value === pages.value && {
15917
- 'aria-disabled': true,
15918
- disabled: true,
15919
- }),
15920
- }, {
15921
- default: () => typeof props.lastButton === 'string'
15922
- ? h$1('span', {
15923
- innerHTML: props.lastButton,
15924
- })
15925
- : props.lastButton,
15926
- }),
15927
- ],
15928
- });
15929
- },
15930
- });
15931
-
15932
- const CPaginationPlugin = {
15933
- install: (app) => {
15934
- app.component(CPagination.name, CPagination);
15935
- app.component(CPaginationItem.name, CPaginationItem);
15936
- app.component(CSmartPagination.name, CSmartPagination);
15937
- },
15938
- };
15939
-
15940
- const BREAKPOINTS$1 = [
15941
- 'xxl',
15942
- 'xl',
15943
- 'lg',
15944
- 'md',
15945
- 'sm',
15946
- 'xs',
15947
- ];
15948
- const CPlaceholder = defineComponent({
15949
- name: 'CPlaceholder',
15950
- props: {
15951
- /**
15952
- * Set animation type to better convey the perception of something being actively loaded.
15953
- *
15954
- * @values 'glow', 'wave'
15955
- */
15956
- animation: {
15957
- type: String,
15958
- default: undefined,
15959
- require: false,
15960
- validator: (value) => {
15961
- return ['glow', 'wave'].includes(value);
15962
- },
15963
- },
15964
- /**
15965
- * Sets the color context of the component to one of CoreUI’s themed colors.
15966
- *
15967
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
15968
- */
15969
- color: Color,
15970
- /**
15971
- * Component used for the root node. Either a string to use a HTML element or a component.
15972
- */
15973
- component: {
15974
- type: String,
15975
- default: 'span',
15976
- required: false,
15977
- },
15978
- /**
15979
- * Size the component extra small, small, or large.
15980
- *
15981
- * @values 'xs', 'sm', 'lg'
15982
- */
15983
- size: {
15984
- type: String,
15985
- default: undefined,
15986
- required: false,
15987
- validator: (value) => {
15988
- return ['xs', 'sm', 'lg'].includes(value);
15989
- },
15990
- },
15991
- /**
15992
- * The number of columns on extra small devices (<576px).
15993
- */
15994
- xs: {
15995
- type: Number,
15996
- default: undefined,
15997
- require: false,
15998
- },
15999
- /**
16000
- * The number of columns on small devices (<768px).
16001
- */
16002
- sm: {
16003
- type: Number,
16004
- default: undefined,
16005
- require: false,
16006
- },
16007
- /**
16008
- * The number of columns on medium devices (<992px).
16009
- */
16010
- md: {
16011
- type: Number,
16012
- default: undefined,
16013
- require: false,
16014
- },
16015
- /**
16016
- * The number of columns on large devices (<1200px).
16017
- */
16018
- lg: {
16019
- type: Number,
16020
- default: undefined,
16021
- require: false,
16022
- },
16023
- /**
16024
- * The number of columns on X-Large devices (<1400px).
16025
- */
16026
- xl: {
16027
- type: Number,
16028
- default: undefined,
16029
- require: false,
16030
- },
16031
- /**
16032
- * The number of columns on XX-Large devices (≥1400px).
16033
- */
16034
- xxl: {
16035
- type: Number,
16036
- default: undefined,
16037
- require: false,
16038
- },
16039
- },
16040
- setup(props, { slots }) {
16041
- const repsonsiveClassNames = [];
16042
- BREAKPOINTS$1.forEach((bp) => {
16043
- const breakpoint = props[bp];
16044
- const infix = bp === 'xs' ? '' : `-${bp}`;
16045
- if (typeof breakpoint === 'number') {
16046
- repsonsiveClassNames.push(`col${infix}-${breakpoint}`);
16047
- }
16048
- if (typeof breakpoint === 'boolean') {
16049
- repsonsiveClassNames.push(`col${infix}`);
16050
- }
16051
- });
16052
- return () => h$1(props.component, {
16053
- class: [
16054
- props.animation ? `placeholder-${props.animation}` : 'placeholder',
16055
- {
16056
- [`bg-${props.color}`]: props.color,
16057
- [`placeholder-${props.size}`]: props.size,
16058
- },
16059
- repsonsiveClassNames,
16060
- ],
16061
- }, slots.default && slots.default());
16062
- },
16063
- });
16064
-
16065
- const CPlaceholderPlugin = {
16066
- install: (app) => {
16067
- app.component(CPlaceholder.name, CPlaceholder);
16068
- },
16069
- };
16070
-
16071
- const CProgressBar = defineComponent({
16072
- name: 'CProgressBar',
16073
- props: {
16074
- /**
16075
- * Use to animate the stripes right to left via CSS3 animations.
16076
- */
16077
- animated: {
16078
- type: Boolean,
16079
- required: false,
16080
- },
16081
- /**
16082
- * Sets the color context of the component to one of CoreUI’s themed colors.
16083
- *
16084
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
16085
- */
16086
- color: Color,
16087
- /**
16088
- * The percent to progress the ProgressBar.
16089
- */
16090
- value: {
16091
- type: Number,
16092
- required: false,
16093
- default: 0,
16094
- },
16095
- /**
16096
- * Set the progress bar variant to optional striped.
16097
- *
16098
- * @values 'striped'
16099
- */
16100
- variant: {
16101
- type: String,
16102
- default: undefined,
16103
- require: false,
16104
- validator: (value) => {
16105
- return value === 'striped';
16356
+ return value === 'striped';
16106
16357
  },
16107
16358
  },
16108
16359
  },
@@ -16326,259 +16577,548 @@ const CPopover = defineComponent({
16326
16577
  },
16327
16578
  });
16328
16579
 
16329
- const CPopoverPlugin = {
16580
+ const CPopoverPlugin = {
16581
+ install: (app) => {
16582
+ app.component(CPopover.name, CPopover);
16583
+ },
16584
+ };
16585
+
16586
+ const isOnMobile = (element) => Boolean(getComputedStyle(element).getPropertyValue('--cui-is-mobile'));
16587
+ const CSidebar = defineComponent({
16588
+ name: 'CSidebar',
16589
+ props: {
16590
+ /**
16591
+ * Sets if the color of text should be colored for a light or dark dark background.
16592
+ *
16593
+ * @values 'dark', light'
16594
+ */
16595
+ colorScheme: {
16596
+ type: String,
16597
+ default: undefined,
16598
+ validator: (value) => {
16599
+ return ['dark', 'light'].includes(value);
16600
+ },
16601
+ },
16602
+ /**
16603
+ * Make sidebar narrow.
16604
+ */
16605
+ narrow: {
16606
+ type: Boolean,
16607
+ required: false,
16608
+ },
16609
+ /**
16610
+ * Set sidebar to overlaid variant.
16611
+ */
16612
+ overlaid: {
16613
+ type: Boolean,
16614
+ required: false,
16615
+ },
16616
+ /**
16617
+ * Components placement, there’s no default placement.
16618
+ * @values 'start', 'end'
16619
+ */
16620
+ placement: {
16621
+ type: String,
16622
+ default: undefined,
16623
+ validator: (value) => {
16624
+ return ['start', 'end'].includes(value);
16625
+ },
16626
+ },
16627
+ /**
16628
+ * Place sidebar in non-static positions.
16629
+ */
16630
+ position: {
16631
+ type: String,
16632
+ default: undefined,
16633
+ validator: (value) => {
16634
+ return ['fixed'].includes(value);
16635
+ },
16636
+ },
16637
+ /**
16638
+ * Size the component small, large, or extra large.
16639
+ */
16640
+ size: {
16641
+ type: String,
16642
+ default: undefined,
16643
+ validator: (value) => {
16644
+ return ['sm', 'lg', 'xl'].includes(value);
16645
+ },
16646
+ },
16647
+ /**
16648
+ * Expand narrowed sidebar on hover.
16649
+ */
16650
+ unfoldable: Boolean,
16651
+ /**
16652
+ * Toggle the visibility of sidebar component.
16653
+ */
16654
+ visible: Boolean,
16655
+ },
16656
+ emits: [
16657
+ /**
16658
+ * Callback fired when the component requests to be hidden.
16659
+ */
16660
+ 'hide',
16661
+ /**
16662
+ * Callback fired when the component requests to be shown.
16663
+ */
16664
+ 'show',
16665
+ /**
16666
+ * Event emitted after visibility of component changed.
16667
+ */
16668
+ 'visible-change',
16669
+ ],
16670
+ setup(props, { attrs, slots, emit }) {
16671
+ const mobile = ref();
16672
+ const inViewport = ref();
16673
+ const sidebarRef = ref();
16674
+ const visible = ref(props.visible);
16675
+ watch(inViewport, () => {
16676
+ emit('visible-change', inViewport.value);
16677
+ inViewport.value ? emit('show') : emit('hide');
16678
+ });
16679
+ watch(() => props.visible, () => (visible.value = props.visible));
16680
+ watch(mobile, () => {
16681
+ if (mobile.value && visible.value)
16682
+ visible.value = false;
16683
+ });
16684
+ onMounted(() => {
16685
+ mobile.value = isOnMobile(sidebarRef.value);
16686
+ inViewport.value = isVisible(sidebarRef.value);
16687
+ window.addEventListener('resize', () => handleResize());
16688
+ window.addEventListener('mouseup', handleClickOutside);
16689
+ window.addEventListener('keyup', handleKeyup);
16690
+ sidebarRef.value.addEventListener('mouseup', handleOnClick);
16691
+ sidebarRef.value.addEventListener('transitionend', () => {
16692
+ inViewport.value = isVisible(sidebarRef.value);
16693
+ });
16694
+ });
16695
+ onBeforeUnmount(() => {
16696
+ window.removeEventListener('resize', () => handleResize());
16697
+ window.removeEventListener('mouseup', handleClickOutside);
16698
+ window.removeEventListener('keyup', handleKeyup);
16699
+ sidebarRef.value.removeEventListener('mouseup', handleOnClick);
16700
+ sidebarRef.value.removeEventListener('transitionend', () => {
16701
+ inViewport.value = isVisible(sidebarRef.value);
16702
+ });
16703
+ });
16704
+ const handleHide = () => {
16705
+ visible.value = false;
16706
+ emit('visible-change', false);
16707
+ };
16708
+ const handleResize = () => {
16709
+ mobile.value = isOnMobile(sidebarRef.value);
16710
+ inViewport.value = isVisible(sidebarRef.value);
16711
+ };
16712
+ const handleKeyup = (event) => {
16713
+ if (mobile.value && !sidebarRef.value.contains(event.target)) {
16714
+ handleHide();
16715
+ }
16716
+ };
16717
+ const handleClickOutside = (event) => {
16718
+ if (mobile.value && !sidebarRef.value.contains(event.target)) {
16719
+ handleHide();
16720
+ }
16721
+ };
16722
+ const handleOnClick = (event) => {
16723
+ const target = event.target;
16724
+ target &&
16725
+ target.classList.contains('nav-link') &&
16726
+ !target.classList.contains('nav-group-toggle') &&
16727
+ mobile.value &&
16728
+ handleHide();
16729
+ };
16730
+ return () => [
16731
+ h$1('div', {
16732
+ class: [
16733
+ 'sidebar',
16734
+ {
16735
+ [`sidebar-${props.colorScheme}`]: props.colorScheme,
16736
+ 'sidebar-narrow': props.narrow,
16737
+ 'sidebar-overlaid': props.overlaid,
16738
+ [`sidebar-${props.placement}`]: props.placement,
16739
+ [`sidebar-${props.position}`]: props.position,
16740
+ [`sidebar-${props.size}`]: props.size,
16741
+ 'sidebar-narrow-unfoldable': props.unfoldable,
16742
+ show: visible.value === true && mobile.value,
16743
+ hide: visible.value === false && !mobile.value,
16744
+ },
16745
+ attrs.class,
16746
+ ],
16747
+ ref: sidebarRef,
16748
+ }, slots.default && slots.default()),
16749
+ mobile.value &&
16750
+ h$1(CBackdrop, {
16751
+ class: 'sidebar-backdrop d-none',
16752
+ visible: props.visible,
16753
+ onClick: () => handleHide(),
16754
+ }),
16755
+ ];
16756
+ },
16757
+ });
16758
+
16759
+ const CSidebarBrand = defineComponent({
16760
+ name: 'CSidebarBrand',
16761
+ setup(_, { slots }) {
16762
+ return () => h$1('div', { class: 'sidebar-brand' }, slots.default && slots.default());
16763
+ },
16764
+ });
16765
+
16766
+ const CSidebarFooter = defineComponent({
16767
+ name: 'CSidebarFooter',
16768
+ setup(_, { slots }) {
16769
+ return () => h$1('div', { class: 'sidebar-footer' }, slots.default && slots.default());
16770
+ },
16771
+ });
16772
+
16773
+ const CSidebarHeader = defineComponent({
16774
+ name: 'CSidebarHeader',
16775
+ setup(_, { slots }) {
16776
+ return () => h$1('div', { class: 'sidebar-header' }, slots.default && slots.default());
16777
+ },
16778
+ });
16779
+
16780
+ const CSidebarNav = defineComponent({
16781
+ name: 'CSidebarNav',
16782
+ setup(_, { slots }) {
16783
+ const visibleGroup = ref();
16784
+ const handleVisibleChange = (visible, index) => {
16785
+ if (visible) {
16786
+ visibleGroup.value = index;
16787
+ }
16788
+ else {
16789
+ if (visibleGroup.value === index) {
16790
+ visibleGroup.value = 0;
16791
+ }
16792
+ }
16793
+ };
16794
+ const isVisible = (index) => Boolean(visibleGroup.value === index);
16795
+ return () => h$1('ul', {
16796
+ class: 'sidebar-nav',
16797
+ }, slots.default &&
16798
+ slots.default().map((vnode, index) => {
16799
+ // @ts-expect-error name is defined in component
16800
+ if (vnode.type.name === 'CNavGroup') {
16801
+ return h$1(vnode, {
16802
+ onVisibleChange: (visible) => handleVisibleChange(visible, index + 1),
16803
+ ...(visibleGroup.value && { visible: isVisible(index + 1) }),
16804
+ });
16805
+ }
16806
+ return vnode;
16807
+ }));
16808
+ },
16809
+ });
16810
+
16811
+ const CSidebarToggler = defineComponent({
16812
+ name: 'CSidebarToggler',
16813
+ setup(_, { slots }) {
16814
+ return () => h$1('button', { class: 'sidebar-toggler' }, slots.default && slots.default());
16815
+ },
16816
+ });
16817
+
16818
+ const CSidebarPlugin = {
16330
16819
  install: (app) => {
16331
- app.component(CPopover.name, CPopover);
16820
+ app.component(CSidebar.name, CSidebar);
16821
+ app.component(CSidebarBrand.name, CSidebarBrand);
16822
+ app.component(CSidebarFooter.name, CSidebarFooter);
16823
+ app.component(CSidebarHeader.name, CSidebarHeader);
16824
+ app.component(CSidebarNav.name, CSidebarNav);
16825
+ app.component(CSidebarToggler.name, CSidebarToggler);
16332
16826
  },
16333
16827
  };
16334
16828
 
16335
- const isOnMobile = (element) => Boolean(getComputedStyle(element).getPropertyValue('--cui-is-mobile'));
16336
- const isVisible = (element) => {
16337
- const rect = element.getBoundingClientRect();
16338
- return (rect.top >= 0 &&
16339
- rect.left >= 0 &&
16340
- rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
16341
- rect.right <= (window.innerWidth || document.documentElement.clientWidth));
16342
- };
16343
- const CSidebar = defineComponent({
16344
- name: 'CSidebar',
16829
+ const CSmartPagination = defineComponent({
16830
+ name: 'CSmartPagination',
16345
16831
  props: {
16346
16832
  /**
16347
- * Sets if the color of text should be colored for a light or dark dark background.
16833
+ * Horizontall align
16348
16834
  *
16349
- * @values 'dark', light'
16835
+ * @default 'start'
16350
16836
  */
16351
- colorScheme: {
16837
+ align: {
16352
16838
  type: String,
16353
- default: undefined,
16839
+ default: 'start',
16840
+ require: false,
16354
16841
  validator: (value) => {
16355
- return ['dark', 'light'].includes(value);
16842
+ return ['start', 'center', 'end'].includes(value);
16356
16843
  },
16357
16844
  },
16358
16845
  /**
16359
- * Make sidebar narrow.
16846
+ * Current page number
16847
+ *
16848
+ * @default 1
16360
16849
  */
16361
- narrow: {
16850
+ activePage: {
16851
+ type: Number,
16852
+ default: 1,
16853
+ require: false,
16854
+ },
16855
+ /**
16856
+ * Show/hide arrows
16857
+ *
16858
+ * @default true
16859
+ */
16860
+ arrows: {
16362
16861
  type: Boolean,
16363
- required: false,
16862
+ default: true,
16863
+ require: false,
16364
16864
  },
16365
16865
  /**
16366
- * Set sidebar to overlaid variant.
16866
+ * Show/hide dots
16867
+ *
16868
+ * @default true
16367
16869
  */
16368
- overlaid: {
16870
+ dots: {
16369
16871
  type: Boolean,
16370
- required: false,
16872
+ default: true,
16873
+ require: false,
16371
16874
  },
16372
16875
  /**
16373
- * Components placement, there’s no default placement.
16374
- * @values 'start', 'end'
16876
+ * Show double arrows buttons
16877
+ *
16878
+ * @default true
16375
16879
  */
16376
- placement: {
16377
- type: String,
16378
- default: undefined,
16379
- validator: (value) => {
16380
- return ['start', 'end'].includes(value);
16381
- },
16880
+ doubleArrows: {
16881
+ type: Boolean,
16882
+ default: true,
16883
+ require: false,
16382
16884
  },
16383
16885
  /**
16384
- * Place sidebar in non-static positions.
16886
+ * The content of 'firstButton' button
16887
+ *
16888
+ * @default '&laquo;'
16385
16889
  */
16386
- position: {
16890
+ firstButton: {
16387
16891
  type: String,
16388
- default: undefined,
16389
- validator: (value) => {
16390
- return ['fixed'].includes(value);
16391
- },
16892
+ default: '&laquo;',
16893
+ require: false,
16392
16894
  },
16393
16895
  /**
16394
- * Size the component small, large, or extra large.
16896
+ * The content of 'lastButton' button
16897
+ *
16898
+ * @default '&raquo;'
16395
16899
  */
16396
- size: {
16900
+ lastButton: {
16397
16901
  type: String,
16398
- default: undefined,
16399
- validator: (value) => {
16400
- return ['sm', 'lg', 'xl'].includes(value);
16401
- },
16902
+ default: '&raquo;',
16903
+ require: false,
16402
16904
  },
16403
16905
  /**
16404
- * Expand narrowed sidebar on hover.
16906
+ * Maximum items number
16907
+ *
16908
+ * @default 5
16405
16909
  */
16406
- unfoldable: Boolean,
16910
+ limit: {
16911
+ type: Number,
16912
+ default: 5,
16913
+ require: false,
16914
+ },
16407
16915
  /**
16408
- * Toggle the visibility of sidebar component.
16916
+ * The content of 'nextButton' button
16917
+ *
16918
+ * @default '&rsaquo;'
16409
16919
  */
16410
- visible: Boolean,
16411
- },
16412
- emits: [
16920
+ nextButton: {
16921
+ type: String,
16922
+ default: '&rsaquo;',
16923
+ require: false,
16924
+ },
16413
16925
  /**
16414
- * Callback fired when the component requests to be hidden.
16926
+ * Number of pages
16415
16927
  */
16416
- 'hide',
16928
+ pages: {
16929
+ type: Number,
16930
+ default: 1000,
16931
+ require: true,
16932
+ },
16417
16933
  /**
16418
- * Callback fired when the component requests to be shown.
16934
+ * The content of 'previousButton' button
16935
+ *
16936
+ * @default '&lsaquo;'
16419
16937
  */
16420
- 'show',
16938
+ previousButton: {
16939
+ type: String,
16940
+ default: '&lsaquo;',
16941
+ require: false,
16942
+ },
16421
16943
  /**
16422
- * Event emitted after visibility of component changed.
16944
+ * Size of pagination, valid values: 'sm', 'lg'
16423
16945
  */
16424
- 'visible-change',
16946
+ size: {
16947
+ type: String,
16948
+ default: undefined,
16949
+ required: false,
16950
+ validator: (value) => {
16951
+ return ['sm', 'lg'].includes(value);
16952
+ },
16953
+ },
16954
+ },
16955
+ emits: [
16956
+ /**
16957
+ * On active page change callback.
16958
+ */
16959
+ 'activePageChange',
16425
16960
  ],
16426
- setup(props, { attrs, slots, emit }) {
16427
- const mobile = ref();
16428
- const inViewport = ref();
16429
- const sidebarRef = ref();
16430
- const visible = ref(props.visible);
16431
- watch(inViewport, () => {
16432
- emit('visible-change', inViewport.value);
16433
- inViewport.value ? emit('show') : emit('hide');
16961
+ setup(props, { emit }) {
16962
+ const activePage = ref(props.activePage);
16963
+ const limit = ref(props.limit);
16964
+ const pages = ref(props.pages);
16965
+ watch(props, () => {
16966
+ activePage.value = props.activePage;
16967
+ limit.value = props.limit;
16968
+ pages.value = props.pages;
16434
16969
  });
16435
- watch(() => props.visible, () => (visible.value = props.visible));
16436
- watch(mobile, () => {
16437
- if (mobile.value && visible.value)
16438
- visible.value = false;
16970
+ const showDots = computed(() => {
16971
+ return props.dots && limit.value > 4 && limit.value < pages.value;
16972
+ });
16973
+ const maxPrevItems = computed(() => {
16974
+ return Math.floor((limit.value - 1) / 2);
16975
+ });
16976
+ const maxNextItems = computed(() => {
16977
+ return Math.ceil((limit.value - 1) / 2);
16978
+ });
16979
+ const beforeDots = computed(() => {
16980
+ return showDots.value && activePage.value > maxPrevItems.value + 1;
16981
+ });
16982
+ const afterDots = computed(() => {
16983
+ return showDots.value && activePage.value < pages.value - maxNextItems.value;
16984
+ });
16985
+ const computedLimit = computed(() => {
16986
+ return limit.value - (afterDots.value ? 1 : 0) - (beforeDots.value ? 1 : 0);
16987
+ });
16988
+ const range = computed(() => {
16989
+ return activePage.value + maxNextItems.value;
16439
16990
  });
16440
- onMounted(() => {
16441
- mobile.value = isOnMobile(sidebarRef.value);
16442
- inViewport.value = isVisible(sidebarRef.value);
16443
- window.addEventListener('resize', () => handleResize());
16444
- window.addEventListener('mouseup', handleClickOutside);
16445
- window.addEventListener('keyup', handleKeyup);
16446
- sidebarRef.value.addEventListener('mouseup', handleOnClick);
16447
- sidebarRef.value.addEventListener('transitionend', () => {
16448
- inViewport.value = isVisible(sidebarRef.value);
16449
- });
16991
+ const lastItem = computed(() => {
16992
+ return range.value >= pages.value ? pages.value : range.value - (afterDots.value ? 1 : 0);
16450
16993
  });
16451
- onBeforeUnmount(() => {
16452
- window.removeEventListener('resize', () => handleResize());
16453
- window.removeEventListener('mouseup', handleClickOutside);
16454
- window.removeEventListener('keyup', handleKeyup);
16455
- sidebarRef.value.removeEventListener('mouseup', handleOnClick);
16456
- sidebarRef.value.removeEventListener('transitionend', () => {
16457
- inViewport.value = isVisible(sidebarRef.value);
16458
- });
16994
+ const itemsAmount = computed(() => {
16995
+ return pages.value < computedLimit.value ? pages.value : computedLimit.value;
16459
16996
  });
16460
- const handleHide = () => {
16461
- visible.value = false;
16462
- emit('visible-change', false);
16463
- };
16464
- const handleResize = () => {
16465
- mobile.value = isOnMobile(sidebarRef.value);
16466
- inViewport.value = isVisible(sidebarRef.value);
16467
- };
16468
- const handleKeyup = (event) => {
16469
- if (mobile.value && !sidebarRef.value.contains(event.target)) {
16470
- handleHide();
16471
- }
16472
- };
16473
- const handleClickOutside = (event) => {
16474
- if (mobile.value && !sidebarRef.value.contains(event.target)) {
16475
- handleHide();
16476
- }
16477
- };
16478
- const handleOnClick = (event) => {
16479
- const target = event.target;
16480
- target &&
16481
- target.classList.contains('nav-link') &&
16482
- !target.classList.contains('nav-group-toggle') &&
16483
- mobile.value &&
16484
- handleHide();
16485
- };
16486
- return () => [
16487
- h$1('div', {
16488
- class: [
16489
- 'sidebar',
16490
- {
16491
- [`sidebar-${props.colorScheme}`]: props.colorScheme,
16492
- 'sidebar-narrow': props.narrow,
16493
- 'sidebar-overlaid': props.overlaid,
16494
- [`sidebar-${props.placement}`]: props.placement,
16495
- [`sidebar-${props.position}`]: props.position,
16496
- [`sidebar-${props.size}`]: props.size,
16497
- 'sidebar-narrow-unfoldable': props.unfoldable,
16498
- show: visible.value === true && mobile.value,
16499
- hide: visible.value === false && !mobile.value,
16500
- },
16501
- attrs.class,
16502
- ],
16503
- ref: sidebarRef,
16504
- }, slots.default && slots.default()),
16505
- mobile.value &&
16506
- h$1(CBackdrop, {
16507
- class: 'sidebar-backdrop d-none',
16508
- visible: props.visible,
16509
- onClick: () => handleHide(),
16510
- }),
16511
- ];
16512
- },
16513
- });
16514
-
16515
- const CSidebarBrand = defineComponent({
16516
- name: 'CSidebarBrand',
16517
- setup(_, { slots }) {
16518
- return () => h$1('div', { class: 'sidebar-brand' }, slots.default && slots.default());
16519
- },
16520
- });
16521
-
16522
- const CSidebarFooter = defineComponent({
16523
- name: 'CSidebarFooter',
16524
- setup(_, { slots }) {
16525
- return () => h$1('div', { class: 'sidebar-footer' }, slots.default && slots.default());
16526
- },
16527
- });
16528
-
16529
- const CSidebarHeader = defineComponent({
16530
- name: 'CSidebarHeader',
16531
- setup(_, { slots }) {
16532
- return () => h$1('div', { class: 'sidebar-header' }, slots.default && slots.default());
16533
- },
16534
- });
16535
-
16536
- const CSidebarNav = defineComponent({
16537
- name: 'CSidebarNav',
16538
- setup(_, { slots }) {
16539
- const visibleGroup = ref();
16540
- const handleVisibleChange = (visible, index) => {
16541
- if (visible) {
16542
- visibleGroup.value = index;
16997
+ const items = computed(() => {
16998
+ if (activePage.value - maxPrevItems.value <= 1) {
16999
+ return Array.from({
17000
+ length: itemsAmount.value,
17001
+ }, (_v, i) => i + 1);
16543
17002
  }
16544
17003
  else {
16545
- if (visibleGroup.value === index) {
16546
- visibleGroup.value = 0;
16547
- }
17004
+ return Array.from({
17005
+ length: itemsAmount.value,
17006
+ }, (_v, i) => {
17007
+ return lastItem.value - i;
17008
+ }).reverse();
17009
+ }
17010
+ });
17011
+ const setPage = (number) => {
17012
+ if (number !== activePage.value) {
17013
+ activePage.value = number;
17014
+ emit('activePageChange', number);
16548
17015
  }
16549
17016
  };
16550
- const isVisible = (index) => Boolean(visibleGroup.value === index);
16551
- return () => h$1('ul', {
16552
- class: 'sidebar-nav',
16553
- }, slots.default &&
16554
- slots.default().map((vnode, index) => {
16555
- // @ts-expect-error name is defined in component
16556
- if (vnode.type.name === 'CNavGroup') {
16557
- return h$1(vnode, {
16558
- onVisibleChange: (visible) => handleVisibleChange(visible, index + 1),
16559
- ...(visibleGroup.value && { visible: isVisible(index + 1) }),
17017
+ return () => h$1(CPagination, {
17018
+ align: props.align,
17019
+ 'aria-label': 'pagination',
17020
+ size: props.size,
17021
+ }, {
17022
+ default: () => [
17023
+ props.doubleArrows &&
17024
+ h$1(CPaginationItem, {
17025
+ onClick: () => {
17026
+ activePage.value !== 1 && setPage(1);
17027
+ },
17028
+ 'aria-label': 'Go to first page',
17029
+ ...(activePage.value === 1 && {
17030
+ 'aria-disabled': true,
17031
+ disabled: true,
17032
+ }),
17033
+ }, {
17034
+ default: () => typeof props.firstButton === 'string'
17035
+ ? h$1('span', {
17036
+ innerHTML: props.firstButton,
17037
+ })
17038
+ : props.firstButton,
17039
+ }),
17040
+ props.arrows &&
17041
+ h$1(CPaginationItem, {
17042
+ onClick: () => {
17043
+ activePage.value !== 1 && setPage(activePage.value - 1);
17044
+ },
17045
+ 'aria-label': 'Go to previous page',
17046
+ ...(activePage.value === 1 && {
17047
+ 'aria-disabled': true,
17048
+ disabled: true,
17049
+ }),
17050
+ }, {
17051
+ default: () => typeof props.previousButton === 'string'
17052
+ ? h$1('span', {
17053
+ innerHTML: props.previousButton,
17054
+ })
17055
+ : props.previousButton,
17056
+ }),
17057
+ beforeDots.value &&
17058
+ h$1(CPaginationItem, {
17059
+ role: 'separator',
17060
+ disabled: true,
17061
+ }, {
17062
+ default: () => '...',
17063
+ }),
17064
+ items.value.map((i) => {
17065
+ return h$1(CPaginationItem, {
17066
+ onClick: () => setPage(i),
17067
+ 'aria-label': activePage.value === i ? `Current page ${i}` : `Go to page ${i}`,
17068
+ active: activePage.value === i,
17069
+ }, {
17070
+ default: () => i,
16560
17071
  });
16561
- }
16562
- return vnode;
16563
- }));
16564
- },
16565
- });
16566
-
16567
- const CSidebarToggler = defineComponent({
16568
- name: 'CSidebarToggler',
16569
- setup(_, { slots }) {
16570
- return () => h$1('button', { class: 'sidebar-toggler' }, slots.default && slots.default());
17072
+ }),
17073
+ afterDots.value &&
17074
+ h$1(CPaginationItem, {
17075
+ role: 'separator',
17076
+ disabled: true,
17077
+ }, {
17078
+ default: () => '...',
17079
+ }),
17080
+ props.arrows &&
17081
+ h$1(CPaginationItem, {
17082
+ onClick: () => {
17083
+ activePage.value !== pages.value && setPage(activePage.value + 1);
17084
+ },
17085
+ 'aria-label': 'Go to next page',
17086
+ ...(activePage.value === pages.value && {
17087
+ 'aria-disabled': true,
17088
+ disabled: true,
17089
+ }),
17090
+ }, {
17091
+ default: () => typeof props.nextButton === 'string'
17092
+ ? h$1('span', {
17093
+ innerHTML: props.nextButton,
17094
+ })
17095
+ : props.nextButton,
17096
+ }),
17097
+ props.doubleArrows &&
17098
+ h$1(CPaginationItem, {
17099
+ onClick: () => {
17100
+ activePage.value !== pages.value && setPage(pages.value);
17101
+ },
17102
+ 'aria-label': 'Go to last page',
17103
+ ...(activePage.value === pages.value && {
17104
+ 'aria-disabled': true,
17105
+ disabled: true,
17106
+ }),
17107
+ }, {
17108
+ default: () => typeof props.lastButton === 'string'
17109
+ ? h$1('span', {
17110
+ innerHTML: props.lastButton,
17111
+ })
17112
+ : props.lastButton,
17113
+ }),
17114
+ ],
17115
+ });
16571
17116
  },
16572
17117
  });
16573
17118
 
16574
- const CSidebarPlugin = {
17119
+ const CSmartPaginationPlugin = {
16575
17120
  install: (app) => {
16576
- app.component(CSidebar.name, CSidebar);
16577
- app.component(CSidebarBrand.name, CSidebarBrand);
16578
- app.component(CSidebarFooter.name, CSidebarFooter);
16579
- app.component(CSidebarHeader.name, CSidebarHeader);
16580
- app.component(CSidebarNav.name, CSidebarNav);
16581
- app.component(CSidebarToggler.name, CSidebarToggler);
17121
+ app.component(CSmartPagination.name, CSmartPagination);
16582
17122
  },
16583
17123
  };
16584
17124
 
@@ -16605,7 +17145,6 @@ const CTableBody = defineComponent({
16605
17145
 
16606
17146
  const CTableCaption = defineComponent({
16607
17147
  name: 'CTableCaption',
16608
- props: {},
16609
17148
  setup(_, { slots }) {
16610
17149
  return () => h$1('caption', {}, slots.default && slots.default());
16611
17150
  },
@@ -17621,13 +18160,13 @@ const CIcon = defineComponent({
17621
18160
  },
17622
18161
  });
17623
18162
 
17624
- const cilArrowBottom = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='367.997 338.75 271.999 434.747 271.999 17.503 239.999 17.503 239.999 434.745 144.003 338.75 121.376 361.377 256 496 390.624 361.377 367.997 338.75' class='ci-primary'/>"];
18163
+ var cilArrowBottom = ["512 512", "<polygon fill='var(--ci-primary-color, currentColor)' points='367.997 338.75 271.999 434.747 271.999 17.503 239.999 17.503 239.999 434.745 144.003 338.75 121.376 361.377 256 496 390.624 361.377 367.997 338.75' class='ci-primary'/>"];
17625
18164
 
17626
- const cilArrowTop = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='390.624 150.625 256 16 121.376 150.625 144.004 173.252 240.001 77.254 240.001 495.236 272.001 495.236 272.001 77.257 367.996 173.252 390.624 150.625' class='ci-primary'/>"];
18165
+ var cilArrowTop = ["512 512", "<polygon fill='var(--ci-primary-color, currentColor)' points='390.624 150.625 256 16 121.376 150.625 144.004 173.252 240.001 77.254 240.001 495.236 272.001 495.236 272.001 77.257 367.996 173.252 390.624 150.625' class='ci-primary'/>"];
17627
18166
 
17628
- const cilFilterX = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='40 16 40 53.828 109.024 136 150.815 136 76.896 48 459.51 48 304 242.388 304 401.373 241.373 464 240 464 240 368 208 368 208 496 254.627 496 336 414.627 336 253.612 496 53.612 496 16 40 16' class='ci-primary'/><polygon fill='var(--ci-primary-color, currentColor)' points='166.403 248.225 226.864 187.763 204.237 165.135 143.775 225.597 83.313 165.135 60.687 187.763 121.148 248.225 60.687 308.687 83.313 331.314 143.775 270.852 204.237 331.314 226.864 308.687 166.403 248.225' class='ci-primary'/>"];
18167
+ var cilFilterX = ["512 512", "<polygon fill='var(--ci-primary-color, currentColor)' points='40 16 40 53.828 109.024 136 150.815 136 76.896 48 459.51 48 304 242.388 304 401.373 241.373 464 240 464 240 368 208 368 208 496 254.627 496 336 414.627 336 253.612 496 53.612 496 16 40 16' class='ci-primary'/><polygon fill='var(--ci-primary-color, currentColor)' points='166.403 248.225 226.864 187.763 204.237 165.135 143.775 225.597 83.313 165.135 60.687 187.763 121.148 248.225 60.687 308.687 83.313 331.314 143.775 270.852 204.237 331.314 226.864 308.687 166.403 248.225' class='ci-primary'/>"];
17629
18168
 
17630
- const cilSwapVertical = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='384 433.373 384 160 352 160 352 434.51 282.177 364.687 259.55 387.313 367.432 495.196 475.313 387.313 452.687 364.687 384 433.373' class='ci-primary'/><polygon fill='var(--ci-primary-color, currentColor)' points='159.432 17.372 51.55 125.255 74.177 147.882 144 78.059 144 352 176 352 176 79.195 244.687 147.882 267.313 125.255 159.432 17.372' class='ci-primary'/>"];
18169
+ var cilSwapVertical = ["512 512", "<polygon fill='var(--ci-primary-color, currentColor)' points='384 433.373 384 160 352 160 352 434.51 282.177 364.687 259.55 387.313 367.432 495.196 475.313 387.313 452.687 364.687 384 433.373' class='ci-primary'/><polygon fill='var(--ci-primary-color, currentColor)' points='159.432 17.372 51.55 125.255 74.177 147.882 144 78.059 144 352 176 352 176 79.195 244.687 147.882 267.313 125.255 159.432 17.372' class='ci-primary'/>"];
17631
18170
 
17632
18171
  const CSmartTable = defineComponent({
17633
18172
  name: 'CSmartTable',
@@ -17736,6 +18275,7 @@ const CSmartTable = defineComponent({
17736
18275
  */
17737
18276
  itemsPerPage: {
17738
18277
  type: Number,
18278
+ default: 10,
17739
18279
  required: false,
17740
18280
  },
17741
18281
  /**
@@ -17784,7 +18324,7 @@ const CSmartTable = defineComponent({
17784
18324
  * Enables default pagination. Set to true for default setup or pass an object with additional CPagination props. Default pagination will always have the computed number of pages that cannot be changed. The number of pages is generated based on the number of passed items and 'itemsPerPage' prop. If this restriction is an obstacle, you can make external CPagination instead.
17785
18325
  */
17786
18326
  pagination: {
17787
- type: Boolean,
18327
+ type: [Boolean, Object],
17788
18328
  required: false,
17789
18329
  },
17790
18330
  /**
@@ -18271,12 +18811,14 @@ const CSmartTable = defineComponent({
18271
18811
  }, [
18272
18812
  h$1('div', {
18273
18813
  class: 'col',
18274
- }, props.pagination && numberOfPages.value > 1
18814
+ }, (props.pagination && numberOfPages.value > 1) || props.paginationProps
18275
18815
  ? h$1(CSmartPagination, {
18276
- ...props.paginationProps,
18277
18816
  pages: numberOfPages.value,
18278
18817
  activePage: activePage.value,
18279
- onActivePageChange: handleActivePageChange,
18818
+ ...props.paginationProps,
18819
+ onActivePageChange: (page) => typeof props.pagination === 'object' && props.pagination.external
18820
+ ? emit('activePageChange', page)
18821
+ : handleActivePageChange(page),
18280
18822
  })
18281
18823
  : ''),
18282
18824
  h$1('div', {
@@ -19405,7 +19947,6 @@ var Components = /*#__PURE__*/Object.freeze({
19405
19947
  CPaginationPlugin: CPaginationPlugin,
19406
19948
  CPagination: CPagination,
19407
19949
  CPaginationItem: CPaginationItem,
19408
- CSmartPagination: CSmartPagination,
19409
19950
  CPicker: CPicker,
19410
19951
  CPickerPlugin: CPickerPlugin,
19411
19952
  CPlaceholderPlugin: CPlaceholderPlugin,
@@ -19422,6 +19963,8 @@ var Components = /*#__PURE__*/Object.freeze({
19422
19963
  CSidebarHeader: CSidebarHeader,
19423
19964
  CSidebarNav: CSidebarNav,
19424
19965
  CSidebarToggler: CSidebarToggler,
19966
+ CSmartPaginationPlugin: CSmartPaginationPlugin,
19967
+ CSmartPagination: CSmartPagination,
19425
19968
  CSmartTablePlugin: CSmartTablePlugin,
19426
19969
  CSmartTable: CSmartTable,
19427
19970
  CSpinnerPlugin: CSpinnerPlugin,
@@ -19686,5 +20229,5 @@ const CoreuiVue = {
19686
20229
  },
19687
20230
  };
19688
20231
 
19689
- 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, 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, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, vcplaceholder, vcpopover, vctooltip };
20232
+ 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, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, vcplaceholder, vcpopover, vctooltip };
19690
20233
  //# sourceMappingURL=index.es.js.map