@coreui/vue-pro 4.6.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 (58) hide show
  1. package/dist/components/Types.d.ts +5 -5
  2. package/dist/components/date-picker/CDatePicker.d.ts +2 -1
  3. package/dist/components/date-range-picker/CDateRangePicker.d.ts +31 -1
  4. package/dist/components/form/CFormInput.d.ts +166 -1
  5. package/dist/components/form/CFormSelect.d.ts +1 -1
  6. package/dist/components/grid/CCol.d.ts +3 -3
  7. package/dist/components/grid/CRow.d.ts +1 -1
  8. package/dist/components/index.d.ts +1 -0
  9. package/dist/components/multi-select/CMultiSelect.d.ts +12 -4
  10. package/dist/components/multi-select/CMultiSelectOptions.d.ts +11 -0
  11. package/dist/components/multi-select/CMultiSelectSelection.d.ts +3 -3
  12. package/dist/components/pagination/index.d.ts +1 -2
  13. package/dist/components/picker/CPicker.d.ts +1 -1
  14. package/dist/components/popover/CPopover.d.ts +1 -1
  15. package/dist/components/smart-pagination/CSmartPagination.d.ts +257 -0
  16. package/dist/components/smart-pagination/index.d.ts +6 -0
  17. package/dist/components/smart-table/CSmartTable.d.ts +6 -4
  18. package/dist/components/smart-table/CSmartTableFilter.d.ts +2 -2
  19. package/dist/components/smart-table/CSmartTableHead.d.ts +2 -2
  20. package/dist/components/smart-table/CSmartTableInterface.d.ts +4 -1
  21. package/dist/components/table/CTable.d.ts +1 -1
  22. package/dist/components/table/CTableCaption.d.ts +2 -8
  23. package/dist/components/time-picker/CTimePicker.d.ts +2 -1
  24. package/dist/components/tooltip/CTooltip.d.ts +1 -1
  25. package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
  26. package/dist/index.es.js +877 -682
  27. package/dist/index.es.js.map +1 -1
  28. package/dist/index.js +876 -680
  29. package/dist/index.js.map +1 -1
  30. package/dist/utils/getNextSibling.d.ts +2 -0
  31. package/dist/utils/getPreviousSibling.d.ts +2 -0
  32. package/dist/utils/index.d.ts +4 -0
  33. package/dist/utils/isVisible.d.ts +2 -0
  34. package/dist/utils/time.d.ts +2 -2
  35. package/package.json +1 -1
  36. package/src/components/carousel/CCarousel.ts +1 -9
  37. package/src/components/date-picker/CDatePicker.ts +11 -2
  38. package/src/components/date-range-picker/CDateRangePicker.ts +54 -0
  39. package/src/components/form/CFormInput.ts +2 -0
  40. package/src/components/index.ts +1 -0
  41. package/src/components/loading-button/CLoadingButton.ts +1 -2
  42. package/src/components/multi-select/CMultiSelect.ts +125 -103
  43. package/src/components/multi-select/CMultiSelectOptions.ts +48 -10
  44. package/src/components/multi-select/CMultiSelectSelection.ts +1 -1
  45. package/src/components/pagination/index.ts +1 -3
  46. package/src/components/sidebar/CSidebar.ts +2 -10
  47. package/src/components/{pagination → smart-pagination}/CSmartPagination.ts +1 -2
  48. package/src/components/smart-pagination/index.ts +10 -0
  49. package/src/components/smart-table/CSmartTable.ts +10 -5
  50. package/src/components/smart-table/CSmartTableInterface.ts +4 -0
  51. package/src/components/table/CTableCaption.ts +0 -1
  52. package/src/components/time-picker/CTimePicker.ts +73 -20
  53. package/src/components/time-picker/CTimePickerRollCol.ts +9 -0
  54. package/src/utils/getNextSibling.ts +18 -0
  55. package/src/utils/getPreviousSibling.ts +18 -0
  56. package/src/utils/index.ts +5 -0
  57. package/src/utils/isVisible.ts +11 -0
  58. 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',
@@ -1905,13 +1905,46 @@ const CCardPlugin = {
1905
1905
  },
1906
1906
  };
1907
1907
 
1908
- 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) => {
1909
1941
  const rect = element.getBoundingClientRect();
1910
1942
  return (rect.top >= 0 &&
1911
1943
  rect.left >= 0 &&
1912
1944
  rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
1913
1945
  rect.right <= (window.innerWidth || document.documentElement.clientWidth));
1914
1946
  };
1947
+
1915
1948
  const CCarousel = defineComponent({
1916
1949
  name: 'CCarousel',
1917
1950
  props: {
@@ -2023,7 +2056,7 @@ const CCarousel = defineComponent({
2023
2056
  const nextItemWhenVisible = () => {
2024
2057
  // Don't call next when the page isn't visible
2025
2058
  // or the carousel or its parent isn't visible
2026
- if (!document.hidden && isVisible$1(carouselRef.value)) {
2059
+ if (!document.hidden && isVisible(carouselRef.value)) {
2027
2060
  handleControlClick('next');
2028
2061
  }
2029
2062
  };
@@ -2042,7 +2075,7 @@ const CCarousel = defineComponent({
2042
2075
  }
2043
2076
  };
2044
2077
  const handleScroll = () => {
2045
- if (!document.hidden && isVisible$1(carouselRef.value)) {
2078
+ if (!document.hidden && isVisible(carouselRef.value)) {
2046
2079
  visible.value = true;
2047
2080
  }
2048
2081
  else {
@@ -8332,6 +8365,8 @@ const CFormControlWrapper = defineComponent({
8332
8365
  },
8333
8366
  });
8334
8367
 
8368
+ const File = typeof window !== 'undefined' ? window.File : class File extends Object {
8369
+ };
8335
8370
  const CFormInput = defineComponent({
8336
8371
  name: 'CFormInput',
8337
8372
  props: {
@@ -11934,6 +11969,12 @@ const CTimePickerRollCol = defineComponent({
11934
11969
  }
11935
11970
  init.value = false;
11936
11971
  });
11972
+ const handleKeyDown = (event, value) => {
11973
+ if (event.code === 'Space' || event.key === 'Enter') {
11974
+ event.preventDefault();
11975
+ emit('click', value);
11976
+ }
11977
+ };
11937
11978
  return () => h$1('div', { class: 'time-picker-roll-col', ref: colRef }, props.elements.map((element) => {
11938
11979
  return h$1('div', {
11939
11980
  class: [
@@ -11943,7 +11984,9 @@ const CTimePickerRollCol = defineComponent({
11943
11984
  },
11944
11985
  ],
11945
11986
  onClick: () => emit('click', element.value),
11987
+ onKeydown: (event) => handleKeyDown(event, element.value),
11946
11988
  role: 'button',
11989
+ tabindex: 0,
11947
11990
  }, element.label);
11948
11991
  }));
11949
11992
  },
@@ -11972,10 +12015,10 @@ const getAmPm = (date, locale) => {
11972
12015
  }
11973
12016
  return date.getHours() >= 12 ? 'pm' : 'am';
11974
12017
  };
11975
- 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) => {
11976
12019
  return {
11977
- value: isAmPm(locale) ? i + 1 : i,
11978
- 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),
11979
12022
  };
11980
12023
  });
11981
12024
  const getListOfMinutes = (locale, valueAsString = false) => Array.from({ length: 60 }, (_, i) => {
@@ -12008,7 +12051,11 @@ const getListOfSeconds = (locale, valueAsString = false) => Array.from({ length:
12008
12051
  .split(':')[2],
12009
12052
  };
12010
12053
  });
12011
- 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
+ : '';
12012
12059
  const getSelectedMinutes = (date) => (date ? date.getMinutes() : '');
12013
12060
  const getSelectedSeconds = (date) => (date ? date.getSeconds() : '');
12014
12061
  const isAmPm = (locale) => ['am', 'AM', 'pm', 'PM'].some((el) => new Date().toLocaleString(locale).includes(el));
@@ -12021,6 +12068,24 @@ const CTimePicker = defineComponent({
12021
12068
  name: 'CTimePicker',
12022
12069
  props: {
12023
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
+ },
12024
12089
  /**
12025
12090
  * Toggle visibility or set the content of cancel button.
12026
12091
  */
@@ -12174,6 +12239,15 @@ const CTimePicker = defineComponent({
12174
12239
  type: String,
12175
12240
  default: 'Select time',
12176
12241
  },
12242
+ /**
12243
+ * Show seconds.
12244
+ *
12245
+ * @since 4.7.0
12246
+ */
12247
+ seconds: {
12248
+ type: Boolean,
12249
+ default: true,
12250
+ },
12177
12251
  /**
12178
12252
  * Size the component small or large.
12179
12253
  *
@@ -12224,6 +12298,10 @@ const CTimePicker = defineComponent({
12224
12298
  return ['roll', 'select'].includes(value);
12225
12299
  },
12226
12300
  },
12301
+ /**
12302
+ * Toggle the visibility of the component.
12303
+ */
12304
+ visible: Boolean,
12227
12305
  },
12228
12306
  emits: [
12229
12307
  /**
@@ -12238,8 +12316,15 @@ const CTimePicker = defineComponent({
12238
12316
  * Callback fired when the component requests to be shown.
12239
12317
  */
12240
12318
  'show',
12319
+ /**
12320
+ * Callback fired when the time changed.
12321
+ *
12322
+ * @since 4.7.0
12323
+ */
12324
+ 'update:time',
12241
12325
  ],
12242
12326
  setup(props, { emit, attrs, slots }) {
12327
+ const visible = ref(props.visible);
12243
12328
  const date = ref(convertTimeToDate(props.time));
12244
12329
  const initialDate = ref(null);
12245
12330
  const ampm = ref(date.value ? getAmPm(new Date(date.value), props.locale) : 'am');
@@ -12254,6 +12339,8 @@ const CTimePicker = defineComponent({
12254
12339
  const handleClear = (event) => {
12255
12340
  event.stopPropagation();
12256
12341
  date.value = null;
12342
+ emit('change', null);
12343
+ emit('update:time', null);
12257
12344
  };
12258
12345
  const handleTimeChange = (set, value) => {
12259
12346
  const _date = date.value || new Date('1970-01-01');
@@ -12266,7 +12353,7 @@ const CTimePicker = defineComponent({
12266
12353
  }
12267
12354
  }
12268
12355
  if (set === 'hours') {
12269
- if (isAmPm(props.locale)) {
12356
+ if ((props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm) {
12270
12357
  _date.setHours(convert12hTo24h(ampm.value, parseInt(value)));
12271
12358
  }
12272
12359
  else {
@@ -12280,7 +12367,8 @@ const CTimePicker = defineComponent({
12280
12367
  _date.setSeconds(parseInt(value));
12281
12368
  }
12282
12369
  date.value = new Date(_date);
12283
- 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));
12284
12372
  };
12285
12373
  const InputGroup = () => h$1(CInputGroup, { class: 'picker-input-group', size: props.size }, () => [
12286
12374
  h$1(CFormInput, {
@@ -12293,7 +12381,12 @@ const CTimePicker = defineComponent({
12293
12381
  },
12294
12382
  placeholder: props.placeholder,
12295
12383
  readonly: props.inputReadOnly,
12296
- 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
+ : '',
12297
12390
  }),
12298
12391
  (props.indicator || props.cleaner) &&
12299
12392
  h$1(CInputGroupText, {}, () => [
@@ -12334,14 +12427,15 @@ const CTimePicker = defineComponent({
12334
12427
  onChange: (event) => handleTimeChange('minutes', event.target.value),
12335
12428
  ...(date.value && { value: getSelectedMinutes(date.value) }),
12336
12429
  }),
12337
- ':',
12338
- // @ts-expect-error the getListOfMinutes function returns corect type
12339
- h$1(CFormSelect, {
12340
- disabled: props.disabled,
12341
- options: getListOfSeconds(props.locale, true),
12342
- onChange: (event) => handleTimeChange('seconds', event.target.value),
12343
- ...(date.value && { value: getSelectedSeconds(date.value) }),
12344
- }),
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
+ }),
12345
12439
  isAmPm(props.locale) &&
12346
12440
  h$1(CFormSelect, {
12347
12441
  disabled: props.disabled,
@@ -12355,21 +12449,22 @@ const CTimePicker = defineComponent({
12355
12449
  ];
12356
12450
  const TimePickerRoll = () => [
12357
12451
  h$1(CTimePickerRollCol, {
12358
- elements: getListOfHours(props.locale),
12452
+ elements: getListOfHours(props.locale, props.ampm),
12359
12453
  onClick: (index) => handleTimeChange('hours', index.toString()),
12360
- selected: getSelectedHour(date.value, props.locale),
12454
+ selected: getSelectedHour(date.value, props.locale, props.ampm),
12361
12455
  }),
12362
12456
  h$1(CTimePickerRollCol, {
12363
12457
  elements: getListOfMinutes(props.locale),
12364
12458
  onClick: (index) => handleTimeChange('minutes', index.toString()),
12365
12459
  selected: getSelectedMinutes(date.value),
12366
12460
  }),
12367
- h$1(CTimePickerRollCol, {
12368
- elements: getListOfSeconds(props.locale),
12369
- onClick: (index) => handleTimeChange('seconds', index.toString()),
12370
- selected: getSelectedSeconds(date.value),
12371
- }),
12372
- 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) &&
12373
12468
  h$1(CTimePickerRollCol, {
12374
12469
  elements: [
12375
12470
  { value: 'am', label: 'AM' },
@@ -12408,16 +12503,20 @@ const CTimePicker = defineComponent({
12408
12503
  if (initialDate.value) {
12409
12504
  date.value = new Date(initialDate.value);
12410
12505
  }
12506
+ visible.value = false;
12411
12507
  },
12412
12508
  onHide: () => {
12509
+ visible.value = false;
12413
12510
  emit('hide');
12414
12511
  },
12415
12512
  onShow: () => {
12416
12513
  if (date.value) {
12417
12514
  initialDate.value = new Date(date.value);
12418
12515
  }
12516
+ visible.value = true;
12419
12517
  emit('show');
12420
12518
  },
12519
+ visible: visible.value,
12421
12520
  }, {
12422
12521
  ...(slots.cancelButton && {
12423
12522
  cancelButton: () => slots.cancelButton && slots.cancelButton(),
@@ -12508,6 +12607,15 @@ const CDateRangePicker = defineComponent({
12508
12607
  type: Boolean,
12509
12608
  default: true,
12510
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
+ },
12511
12619
  /**
12512
12620
  * Toggle visibility or set the content of confirm button.
12513
12621
  */
@@ -12809,6 +12917,10 @@ const CDateRangePicker = defineComponent({
12809
12917
  * @since 4.6.0
12810
12918
  */
12811
12919
  valid: Boolean,
12920
+ /**
12921
+ * Toggle the visibility of the component.
12922
+ */
12923
+ visible: Boolean,
12812
12924
  /**
12813
12925
  * Set length or format of day name.
12814
12926
  *
@@ -12854,8 +12966,23 @@ const CDateRangePicker = defineComponent({
12854
12966
  * @property {string} formatedDate - formated date
12855
12967
  */
12856
12968
  'start-date-change',
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',
12857
12983
  ],
12858
12984
  setup(props, { slots, attrs, emit }) {
12985
+ const visible = ref(props.visible);
12859
12986
  const calendarDate = ref(props.calendarDate
12860
12987
  ? new Date(props.calendarDate)
12861
12988
  : props.startDate
@@ -12930,6 +13057,13 @@ const CDateRangePicker = defineComponent({
12930
13057
  selectEndDate.value = true;
12931
13058
  }
12932
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
+ }
12933
13067
  };
12934
13068
  const handleEndDateChange = (date) => {
12935
13069
  endDate.value = date;
@@ -12938,6 +13072,13 @@ const CDateRangePicker = defineComponent({
12938
13072
  selectEndDate.value = false;
12939
13073
  }
12940
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
+ }
12941
13082
  };
12942
13083
  const handleClear = (event) => {
12943
13084
  event.stopPropagation();
@@ -12945,6 +13086,10 @@ const CDateRangePicker = defineComponent({
12945
13086
  endDate.value = null;
12946
13087
  inputStartHoverValue.value = null;
12947
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);
12948
13093
  };
12949
13094
  const InputGroup = () => h$1(CInputGroup, {
12950
13095
  class: 'picker-input-group',
@@ -13050,8 +13195,10 @@ const CDateRangePicker = defineComponent({
13050
13195
  onCancel: () => {
13051
13196
  startDate.value = initialStartDate.value;
13052
13197
  endDate.value = initialEndDate.value;
13198
+ visible.value = false;
13053
13199
  },
13054
13200
  onHide: () => {
13201
+ visible.value = false;
13055
13202
  emit('hide');
13056
13203
  },
13057
13204
  onShow: () => {
@@ -13061,8 +13208,10 @@ const CDateRangePicker = defineComponent({
13061
13208
  if (endDate.value) {
13062
13209
  initialEndDate.value = new Date(endDate.value);
13063
13210
  }
13211
+ visible.value = true;
13064
13212
  emit('show');
13065
13213
  },
13214
+ visible: visible.value,
13066
13215
  }, {
13067
13216
  ...(slots.cancelButton && {
13068
13217
  cancelButton: () => slots.cancelButton && slots.cancelButton(),
@@ -13451,11 +13600,21 @@ const CDatePicker = defineComponent({
13451
13600
  * @property {string} formatedDate - formated date
13452
13601
  */
13453
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',
13454
13610
  ],
13455
13611
  setup(props, { emit }) {
13456
13612
  return () => h$1(CDateRangePicker, {
13457
13613
  calendars: 1,
13458
- onStartDateChange: (date, formatedDate) => emit('date-change', date, formatedDate),
13614
+ onStartDateChange: (date, formatedDate) => {
13615
+ emit('date-change', date, formatedDate);
13616
+ emit('update:date', date);
13617
+ },
13459
13618
  range: false,
13460
13619
  startDate: props.date,
13461
13620
  ...props,
@@ -14286,11 +14445,10 @@ const CLoadingButton = defineComponent({
14286
14445
  }
14287
14446
  };
14288
14447
  return () => h$1(CButton, {
14448
+ ...props,
14289
14449
  class: ['btn-loading', { ['is-loading']: loading.value }],
14290
14450
  ...(props.disabledOnLoading && loading.value && { disabled: true }),
14291
14451
  onClick: () => handleOnClick(),
14292
- // TODO: remove non button props
14293
- ...props,
14294
14452
  }, {
14295
14453
  default: () => [
14296
14454
  h$1(CSpinner, { class: 'btn-loading-spinner', size: 'sm', variant: props.spinnerType }),
@@ -14692,34 +14850,61 @@ const CMultiSelectOptions = defineComponent({
14692
14850
  default: 'no items',
14693
14851
  required: false,
14694
14852
  },
14853
+ selected: {
14854
+ type: Array,
14855
+ default: () => [],
14856
+ required: false,
14857
+ },
14695
14858
  },
14696
14859
  emits: ['optionClick'],
14697
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
+ };
14698
14884
  const handleOptionClick = (option) => {
14699
14885
  emit('optionClick', option);
14700
14886
  };
14701
- const createOptions = (options) => {
14702
- return options.length > 0
14703
- ? options.map((option) => {
14704
- return option.options
14705
- ? h$1('div', { class: 'form-multi-select-options' }, [
14706
- h$1('div', { class: 'form-multi-select-optgroup-label' }, option.label),
14707
- createOptions(option.options),
14708
- ])
14709
- : h$1('div', {
14710
- class: [
14711
- 'form-multi-select-option',
14712
- {
14713
- 'form-multi-select-option-with-checkbox': props.optionsStyle === 'checkbox',
14714
- 'form-multi-selected': option.selected,
14715
- disabled: option.disabled,
14716
- },
14717
- ],
14718
- onClick: () => handleOptionClick(option),
14719
- }, option.text);
14720
- })
14721
- : h$1('div', { class: 'form-multi-select-options-empty' }, props.searchNoResultsLabel);
14722
- };
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);
14723
14908
  return () => h$1('div', {
14724
14909
  class: 'form-multi-select-options',
14725
14910
  ...(props.optionsMaxHeight !== 'auto' && {
@@ -14746,7 +14931,7 @@ const CMultiSelectSelection = defineComponent({
14746
14931
  * Enables search input element.
14747
14932
  */
14748
14933
  search: {
14749
- type: Boolean,
14934
+ type: [Boolean, String],
14750
14935
  required: false,
14751
14936
  default: false,
14752
14937
  },
@@ -14816,6 +15001,11 @@ const CMultiSelectSelection = defineComponent({
14816
15001
  },
14817
15002
  });
14818
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
+ };
14819
15009
  const CMultiSelect = defineComponent({
14820
15010
  name: 'CMultiSelect',
14821
15011
  props: {
@@ -14937,9 +15127,18 @@ const CMultiSelect = defineComponent({
14937
15127
  * Enables search input element.
14938
15128
  */
14939
15129
  search: {
14940
- type: Boolean,
15130
+ type: [Boolean, String],
14941
15131
  default: true,
14942
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
+ },
14943
15142
  },
14944
15143
  /**
14945
15144
  * Sets the label for no results when filtering.
@@ -15041,59 +15240,63 @@ const CMultiSelect = defineComponent({
15041
15240
  * Execute a function when a user changes the selected option. [docs]
15042
15241
  */
15043
15242
  'change',
15243
+ /**
15244
+ * Execute a function when the filter value changed.
15245
+ *
15246
+ * @since 4.7.0
15247
+ */
15248
+ 'filterChange',
15044
15249
  ],
15045
15250
  setup(props, { attrs, emit }) {
15046
- const flattenArray = (options) => {
15047
- return options.reduce((acc, val) => {
15048
- return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
15049
- }, []);
15050
- };
15051
- const getSelectedOptions = (options) => {
15052
- return flattenArray(options).filter((option) => {
15053
- if (option.selected) {
15054
- return option;
15055
- }
15056
- return;
15057
- });
15058
- };
15059
- const updateOptions = (value, _options = options.value) => {
15060
- return props.multiple && _options
15061
- ? _options &&
15062
- _options.map((option) => {
15063
- count.value = count.value++;
15064
- return option.options
15065
- ? { ...option, options: updateOptions(value, option.options) }
15066
- : option.value == value // TODO: find solution
15067
- ? { ...option, selected: !option.selected, order: count.value }
15068
- : { ...option };
15069
- })
15070
- : _options &&
15071
- _options.map((option) => {
15072
- return option.options
15073
- ? { ...option, options: updateOptions(value, option.options) }
15074
- : option.value == value // TODO: find solution
15075
- ? { ...option, selected: true }
15076
- : { ...option, selected: false };
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 }),
15077
15269
  });
15078
- };
15079
- const toggleAllOptions = (options, selected, counter = count.value) => {
15080
- return options.map((option) => {
15081
- !option.selected && counter++;
15082
- count.value = counter;
15083
- if (option.options) {
15084
- return {
15085
- ...option,
15086
- options: toggleAllOptions(option.options, selected, counter),
15087
- };
15088
15270
  }
15089
- return option.disabled
15090
- ? { ...option }
15091
- : selected && !option.selected
15092
- ? { ...option, selected: selected, order: counter }
15093
- : { ...option, selected: selected };
15094
- });
15271
+ return unique;
15272
+ }, []);
15273
+ selected.value = deduplicated;
15095
15274
  };
15096
- 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) => {
15097
15300
  return search.length
15098
15301
  ? _options &&
15099
15302
  _options.reduce((acc, val) => {
@@ -15107,70 +15310,54 @@ const CMultiSelect = defineComponent({
15107
15310
  }, [])
15108
15311
  : options.value;
15109
15312
  };
15110
- const nativeSelectRef = ref();
15111
- provide('nativeSelectRef', nativeSelectRef);
15112
- const searchRef = ref();
15113
- const options = ref(props.options);
15114
- const vOptions = ref(props.options);
15115
- const search = ref('');
15116
- const visible = ref(props.visible);
15117
- const selected = ref(getSelectedOptions(props.options));
15118
- const count = ref(0);
15119
- watch(() => props.options, (newValue, oldValue) => {
15120
- if (JSON.stringify(newValue) !== JSON.stringify(oldValue))
15121
- options.value = newValue;
15122
- });
15123
- watch(options, () => {
15124
- const _selected = options.value && getSelectedOptions(options.value);
15125
- _selected.sort((a, b) => {
15126
- if (typeof a.order === 'undefined') {
15127
- return -1;
15128
- }
15129
- if (b.order && a.order > b.order)
15130
- return 1;
15131
- if (b.order && a.order < b.order)
15132
- return -1;
15133
- return 0;
15134
- });
15135
- selected.value = _selected;
15136
- });
15137
- watch([options, search], () => {
15138
- vOptions.value = filterOptionsList(search.value, options.value);
15139
- });
15140
- watch(selected, () => {
15141
- nativeSelectRef.value &&
15142
- nativeSelectRef.value.dispatchEvent(new Event('change', { bubbles: true }));
15143
- });
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
+ // )
15144
15320
  const handleSearchChange = (event) => {
15145
15321
  const target = event.target;
15146
15322
  search.value = target.value.toLowerCase();
15323
+ emit('filterChange', target.value);
15147
15324
  };
15148
15325
  const handleSearchKeyDown = (event) => {
15149
- if (search.value.length)
15326
+ if (search.value.length) {
15150
15327
  return;
15328
+ }
15151
15329
  if (event.key === 'Backspace' || event.key === 'Delete') {
15152
15330
  const last = selected.value.filter((option) => !option.disabled).pop();
15153
15331
  if (last) {
15154
15332
  selected.value = selected.value.filter((option) => option.value !== last.value);
15155
- options.value = updateOptions(last.value);
15156
15333
  }
15157
15334
  }
15158
15335
  };
15159
15336
  const handleOptionClick = (option) => {
15160
- options.value = updateOptions(option.value);
15161
15337
  if (!props.multiple) {
15338
+ selected.value = [{ value: option.value, text: option.text }];
15162
15339
  visible.value = false;
15163
15340
  search.value = '';
15164
15341
  if (searchRef.value) {
15165
15342
  searchRef.value.value = '';
15166
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
+ ];
15167
15354
  }
15168
15355
  };
15169
15356
  const handleSelectAll = () => {
15170
- options.value = toggleAllOptions(options.value, true);
15357
+ selectOptions(flattenArray(options.value).filter((option) => !option.disabled));
15171
15358
  };
15172
15359
  const handleDeselectAll = () => {
15173
- options.value = toggleAllOptions(options.value, false);
15360
+ selected.value = selected.value.filter((option) => option.disabled);
15174
15361
  };
15175
15362
  return () => [
15176
15363
  h$1(CMultiSelectNativeSelect, {
@@ -15261,13 +15448,20 @@ const CMultiSelect = defineComponent({
15261
15448
  default: () => h$1('div', {}, [
15262
15449
  props.multiple &&
15263
15450
  props.selectAll &&
15264
- h$1('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
15451
+ h$1('button', {
15452
+ class: 'form-multi-select-all',
15453
+ onClick: () => handleSelectAll(),
15454
+ type: 'button',
15455
+ }, props.selectAllLabel),
15265
15456
  h$1(CMultiSelectOptions, {
15266
15457
  onOptionClick: (option) => handleOptionClick(option),
15267
- options: vOptions.value,
15458
+ options: props.search === 'external'
15459
+ ? options.value
15460
+ : filterOptionsList(search.value, options.value),
15268
15461
  optionsMaxHeight: props.optionsMaxHeight,
15269
15462
  optionsStyle: props.optionsStyle,
15270
15463
  searchNoResultsLabel: props.searchNoResultsLabel,
15464
+ selected: selected.value
15271
15465
  }),
15272
15466
  ]),
15273
15467
  }),
@@ -15987,354 +16181,63 @@ const CPaginationItem = defineComponent({
15987
16181
  },
15988
16182
  });
15989
16183
 
15990
- const CSmartPagination = defineComponent({
15991
- 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',
15992
16201
  props: {
15993
16202
  /**
15994
- * Horizontall align
16203
+ * Set animation type to better convey the perception of something being actively loaded.
15995
16204
  *
15996
- * @default 'start'
16205
+ * @values 'glow', 'wave'
15997
16206
  */
15998
- align: {
16207
+ animation: {
15999
16208
  type: String,
16000
- default: 'start',
16209
+ default: undefined,
16001
16210
  require: false,
16002
16211
  validator: (value) => {
16003
- return ['start', 'center', 'end'].includes(value);
16212
+ return ['glow', 'wave'].includes(value);
16004
16213
  },
16005
16214
  },
16006
16215
  /**
16007
- * Current page number
16216
+ * Sets the color context of the component to one of CoreUI’s themed colors.
16008
16217
  *
16009
- * @default 1
16218
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
16010
16219
  */
16011
- activePage: {
16012
- type: Number,
16013
- default: 1,
16014
- require: false,
16015
- },
16220
+ color: Color,
16016
16221
  /**
16017
- * Show/hide arrows
16018
- *
16019
- * @default true
16222
+ * Component used for the root node. Either a string to use a HTML element or a component.
16020
16223
  */
16021
- arrows: {
16022
- type: Boolean,
16023
- default: true,
16024
- require: false,
16224
+ component: {
16225
+ type: String,
16226
+ default: 'span',
16227
+ required: false,
16025
16228
  },
16026
16229
  /**
16027
- * Show/hide dots
16230
+ * Size the component extra small, small, or large.
16028
16231
  *
16029
- * @default true
16232
+ * @values 'xs', 'sm', 'lg'
16030
16233
  */
16031
- dots: {
16032
- type: Boolean,
16033
- default: true,
16034
- require: false,
16035
- },
16036
- /**
16037
- * Show double arrows buttons
16038
- *
16039
- * @default true
16040
- */
16041
- doubleArrows: {
16042
- type: Boolean,
16043
- default: true,
16044
- require: false,
16045
- },
16046
- /**
16047
- * The content of 'firstButton' button
16048
- *
16049
- * @default '&laquo;'
16050
- */
16051
- firstButton: {
16052
- type: String,
16053
- default: '&laquo;',
16054
- require: false,
16055
- },
16056
- /**
16057
- * The content of 'lastButton' button
16058
- *
16059
- * @default '&raquo;'
16060
- */
16061
- lastButton: {
16062
- type: String,
16063
- default: '&raquo;',
16064
- require: false,
16065
- },
16066
- /**
16067
- * Maximum items number
16068
- *
16069
- * @default 5
16070
- */
16071
- limit: {
16072
- type: Number,
16073
- default: 5,
16074
- require: false,
16075
- },
16076
- /**
16077
- * The content of 'nextButton' button
16078
- *
16079
- * @default '&rsaquo;'
16080
- */
16081
- nextButton: {
16082
- type: String,
16083
- default: '&rsaquo;',
16084
- require: false,
16085
- },
16086
- /**
16087
- * Number of pages
16088
- */
16089
- pages: {
16090
- type: Number,
16091
- default: 1000,
16092
- require: true,
16093
- },
16094
- /**
16095
- * The content of 'previousButton' button
16096
- *
16097
- * @default '&lsaquo;'
16098
- */
16099
- previousButton: {
16100
- type: String,
16101
- default: '&lsaquo;',
16102
- require: false,
16103
- },
16104
- /**
16105
- * Size of pagination, valid values: 'sm', 'lg'
16106
- */
16107
- size: {
16108
- type: String,
16109
- default: undefined,
16110
- required: false,
16111
- validator: (value) => {
16112
- return ['sm', 'lg'].includes(value);
16113
- },
16114
- },
16115
- },
16116
- emits: [
16117
- /**
16118
- * On active page change callback.
16119
- */
16120
- 'activePageChange',
16121
- ],
16122
- setup(props, { emit }) {
16123
- const activePage = ref(props.activePage);
16124
- const limit = ref(props.limit);
16125
- const pages = ref(props.pages);
16126
- watch(props, () => {
16127
- activePage.value = props.activePage;
16128
- limit.value = props.limit;
16129
- pages.value = props.pages;
16130
- });
16131
- const showDots = computed(() => {
16132
- return props.dots && limit.value > 4 && limit.value < pages.value;
16133
- });
16134
- const maxPrevItems = computed(() => {
16135
- return Math.floor((limit.value - 1) / 2);
16136
- });
16137
- const maxNextItems = computed(() => {
16138
- return Math.ceil((limit.value - 1) / 2);
16139
- });
16140
- const beforeDots = computed(() => {
16141
- return showDots.value && activePage.value > maxPrevItems.value + 1;
16142
- });
16143
- const afterDots = computed(() => {
16144
- return showDots.value && activePage.value < pages.value - maxNextItems.value;
16145
- });
16146
- const computedLimit = computed(() => {
16147
- return limit.value - (afterDots.value ? 1 : 0) - (beforeDots.value ? 1 : 0);
16148
- });
16149
- const range = computed(() => {
16150
- return activePage.value + maxNextItems.value;
16151
- });
16152
- const lastItem = computed(() => {
16153
- return range.value >= pages.value ? pages.value : range.value - (afterDots.value ? 1 : 0);
16154
- });
16155
- const itemsAmount = computed(() => {
16156
- return pages.value < computedLimit.value ? pages.value : computedLimit.value;
16157
- });
16158
- const items = computed(() => {
16159
- if (activePage.value - maxPrevItems.value <= 1) {
16160
- return Array.from({
16161
- length: itemsAmount.value,
16162
- }, (_v, i) => i + 1);
16163
- }
16164
- else {
16165
- return Array.from({
16166
- length: itemsAmount.value,
16167
- }, (_v, i) => {
16168
- return lastItem.value - i;
16169
- }).reverse();
16170
- }
16171
- });
16172
- const setPage = (number) => {
16173
- if (number !== activePage.value) {
16174
- activePage.value = number;
16175
- emit('activePageChange', number);
16176
- }
16177
- };
16178
- return () => h$1(CPagination, {
16179
- align: props.align,
16180
- 'aria-label': 'pagination',
16181
- size: props.size,
16182
- }, {
16183
- default: () => [
16184
- props.doubleArrows &&
16185
- h$1(CPaginationItem, {
16186
- onClick: () => {
16187
- activePage.value !== 1 && setPage(1);
16188
- },
16189
- 'aria-label': 'Go to first page',
16190
- ...(activePage.value === 1 && {
16191
- 'aria-disabled': true,
16192
- disabled: true,
16193
- }),
16194
- }, {
16195
- default: () => typeof props.firstButton === 'string'
16196
- ? h$1('span', {
16197
- innerHTML: props.firstButton,
16198
- })
16199
- : props.firstButton,
16200
- }),
16201
- props.arrows &&
16202
- h$1(CPaginationItem, {
16203
- onClick: () => {
16204
- activePage.value !== 1 && setPage(activePage.value - 1);
16205
- },
16206
- 'aria-label': 'Go to previous page',
16207
- ...(activePage.value === 1 && {
16208
- 'aria-disabled': true,
16209
- disabled: true,
16210
- }),
16211
- }, {
16212
- default: () => typeof props.previousButton === 'string'
16213
- ? h$1('span', {
16214
- innerHTML: props.previousButton,
16215
- })
16216
- : props.previousButton,
16217
- }),
16218
- beforeDots.value &&
16219
- h$1(CPaginationItem, {
16220
- role: 'separator',
16221
- disabled: true,
16222
- }, {
16223
- default: () => '...',
16224
- }),
16225
- items.value.map((i) => {
16226
- return h$1(CPaginationItem, {
16227
- onClick: () => setPage(i),
16228
- 'aria-label': activePage.value === i ? `Current page ${i}` : `Go to page ${i}`,
16229
- active: activePage.value === i,
16230
- }, {
16231
- default: () => i,
16232
- });
16233
- }),
16234
- afterDots.value &&
16235
- h$1(CPaginationItem, {
16236
- role: 'separator',
16237
- disabled: true,
16238
- }, {
16239
- default: () => '...',
16240
- }),
16241
- props.arrows &&
16242
- h$1(CPaginationItem, {
16243
- onClick: () => {
16244
- activePage.value !== pages.value && setPage(activePage.value + 1);
16245
- },
16246
- 'aria-label': 'Go to next page',
16247
- ...(activePage.value === pages.value && {
16248
- 'aria-disabled': true,
16249
- disabled: true,
16250
- }),
16251
- }, {
16252
- default: () => typeof props.nextButton === 'string'
16253
- ? h$1('span', {
16254
- innerHTML: props.nextButton,
16255
- })
16256
- : props.nextButton,
16257
- }),
16258
- props.doubleArrows &&
16259
- h$1(CPaginationItem, {
16260
- onClick: () => {
16261
- activePage.value !== pages.value && setPage(pages.value);
16262
- },
16263
- 'aria-label': 'Go to last page',
16264
- ...(activePage.value === pages.value && {
16265
- 'aria-disabled': true,
16266
- disabled: true,
16267
- }),
16268
- }, {
16269
- default: () => typeof props.lastButton === 'string'
16270
- ? h$1('span', {
16271
- innerHTML: props.lastButton,
16272
- })
16273
- : props.lastButton,
16274
- }),
16275
- ],
16276
- });
16277
- },
16278
- });
16279
-
16280
- const CPaginationPlugin = {
16281
- install: (app) => {
16282
- app.component(CPagination.name, CPagination);
16283
- app.component(CPaginationItem.name, CPaginationItem);
16284
- app.component(CSmartPagination.name, CSmartPagination);
16285
- },
16286
- };
16287
-
16288
- const BREAKPOINTS$1 = [
16289
- 'xxl',
16290
- 'xl',
16291
- 'lg',
16292
- 'md',
16293
- 'sm',
16294
- 'xs',
16295
- ];
16296
- const CPlaceholder = defineComponent({
16297
- name: 'CPlaceholder',
16298
- props: {
16299
- /**
16300
- * Set animation type to better convey the perception of something being actively loaded.
16301
- *
16302
- * @values 'glow', 'wave'
16303
- */
16304
- animation: {
16305
- type: String,
16306
- default: undefined,
16307
- require: false,
16308
- validator: (value) => {
16309
- return ['glow', 'wave'].includes(value);
16310
- },
16311
- },
16312
- /**
16313
- * Sets the color context of the component to one of CoreUI’s themed colors.
16314
- *
16315
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
16316
- */
16317
- color: Color,
16318
- /**
16319
- * Component used for the root node. Either a string to use a HTML element or a component.
16320
- */
16321
- component: {
16322
- type: String,
16323
- default: 'span',
16324
- required: false,
16325
- },
16326
- /**
16327
- * Size the component extra small, small, or large.
16328
- *
16329
- * @values 'xs', 'sm', 'lg'
16330
- */
16331
- size: {
16332
- type: String,
16333
- default: undefined,
16334
- required: false,
16335
- validator: (value) => {
16336
- return ['xs', 'sm', 'lg'].includes(value);
16337
- },
16234
+ size: {
16235
+ type: String,
16236
+ default: undefined,
16237
+ required: false,
16238
+ validator: (value) => {
16239
+ return ['xs', 'sm', 'lg'].includes(value);
16240
+ },
16338
16241
  },
16339
16242
  /**
16340
16243
  * The number of columns on extra small devices (<576px).
@@ -16674,259 +16577,548 @@ const CPopover = defineComponent({
16674
16577
  },
16675
16578
  });
16676
16579
 
16677
- 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 = {
16678
16819
  install: (app) => {
16679
- 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);
16680
16826
  },
16681
16827
  };
16682
16828
 
16683
- const isOnMobile = (element) => Boolean(getComputedStyle(element).getPropertyValue('--cui-is-mobile'));
16684
- const isVisible = (element) => {
16685
- const rect = element.getBoundingClientRect();
16686
- return (rect.top >= 0 &&
16687
- rect.left >= 0 &&
16688
- rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
16689
- rect.right <= (window.innerWidth || document.documentElement.clientWidth));
16690
- };
16691
- const CSidebar = defineComponent({
16692
- name: 'CSidebar',
16829
+ const CSmartPagination = defineComponent({
16830
+ name: 'CSmartPagination',
16693
16831
  props: {
16694
16832
  /**
16695
- * Sets if the color of text should be colored for a light or dark dark background.
16833
+ * Horizontall align
16696
16834
  *
16697
- * @values 'dark', light'
16835
+ * @default 'start'
16698
16836
  */
16699
- colorScheme: {
16837
+ align: {
16700
16838
  type: String,
16701
- default: undefined,
16839
+ default: 'start',
16840
+ require: false,
16702
16841
  validator: (value) => {
16703
- return ['dark', 'light'].includes(value);
16842
+ return ['start', 'center', 'end'].includes(value);
16704
16843
  },
16705
16844
  },
16706
16845
  /**
16707
- * Make sidebar narrow.
16846
+ * Current page number
16847
+ *
16848
+ * @default 1
16708
16849
  */
16709
- 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: {
16710
16861
  type: Boolean,
16711
- required: false,
16862
+ default: true,
16863
+ require: false,
16712
16864
  },
16713
16865
  /**
16714
- * Set sidebar to overlaid variant.
16866
+ * Show/hide dots
16867
+ *
16868
+ * @default true
16715
16869
  */
16716
- overlaid: {
16870
+ dots: {
16717
16871
  type: Boolean,
16718
- required: false,
16872
+ default: true,
16873
+ require: false,
16719
16874
  },
16720
16875
  /**
16721
- * Components placement, there’s no default placement.
16722
- * @values 'start', 'end'
16876
+ * Show double arrows buttons
16877
+ *
16878
+ * @default true
16723
16879
  */
16724
- placement: {
16725
- type: String,
16726
- default: undefined,
16727
- validator: (value) => {
16728
- return ['start', 'end'].includes(value);
16729
- },
16880
+ doubleArrows: {
16881
+ type: Boolean,
16882
+ default: true,
16883
+ require: false,
16730
16884
  },
16731
16885
  /**
16732
- * Place sidebar in non-static positions.
16886
+ * The content of 'firstButton' button
16887
+ *
16888
+ * @default '&laquo;'
16733
16889
  */
16734
- position: {
16890
+ firstButton: {
16735
16891
  type: String,
16736
- default: undefined,
16737
- validator: (value) => {
16738
- return ['fixed'].includes(value);
16739
- },
16892
+ default: '&laquo;',
16893
+ require: false,
16740
16894
  },
16741
16895
  /**
16742
- * Size the component small, large, or extra large.
16896
+ * The content of 'lastButton' button
16897
+ *
16898
+ * @default '&raquo;'
16743
16899
  */
16744
- size: {
16900
+ lastButton: {
16745
16901
  type: String,
16746
- default: undefined,
16747
- validator: (value) => {
16748
- return ['sm', 'lg', 'xl'].includes(value);
16749
- },
16902
+ default: '&raquo;',
16903
+ require: false,
16750
16904
  },
16751
16905
  /**
16752
- * Expand narrowed sidebar on hover.
16906
+ * Maximum items number
16907
+ *
16908
+ * @default 5
16753
16909
  */
16754
- unfoldable: Boolean,
16910
+ limit: {
16911
+ type: Number,
16912
+ default: 5,
16913
+ require: false,
16914
+ },
16755
16915
  /**
16756
- * Toggle the visibility of sidebar component.
16916
+ * The content of 'nextButton' button
16917
+ *
16918
+ * @default '&rsaquo;'
16757
16919
  */
16758
- visible: Boolean,
16759
- },
16760
- emits: [
16920
+ nextButton: {
16921
+ type: String,
16922
+ default: '&rsaquo;',
16923
+ require: false,
16924
+ },
16761
16925
  /**
16762
- * Callback fired when the component requests to be hidden.
16926
+ * Number of pages
16763
16927
  */
16764
- 'hide',
16928
+ pages: {
16929
+ type: Number,
16930
+ default: 1000,
16931
+ require: true,
16932
+ },
16765
16933
  /**
16766
- * Callback fired when the component requests to be shown.
16934
+ * The content of 'previousButton' button
16935
+ *
16936
+ * @default '&lsaquo;'
16767
16937
  */
16768
- 'show',
16938
+ previousButton: {
16939
+ type: String,
16940
+ default: '&lsaquo;',
16941
+ require: false,
16942
+ },
16769
16943
  /**
16770
- * Event emitted after visibility of component changed.
16944
+ * Size of pagination, valid values: 'sm', 'lg'
16771
16945
  */
16772
- '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',
16773
16960
  ],
16774
- setup(props, { attrs, slots, emit }) {
16775
- const mobile = ref();
16776
- const inViewport = ref();
16777
- const sidebarRef = ref();
16778
- const visible = ref(props.visible);
16779
- watch(inViewport, () => {
16780
- emit('visible-change', inViewport.value);
16781
- 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;
16782
16969
  });
16783
- watch(() => props.visible, () => (visible.value = props.visible));
16784
- watch(mobile, () => {
16785
- if (mobile.value && visible.value)
16786
- 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;
16787
16990
  });
16788
- onMounted(() => {
16789
- mobile.value = isOnMobile(sidebarRef.value);
16790
- inViewport.value = isVisible(sidebarRef.value);
16791
- window.addEventListener('resize', () => handleResize());
16792
- window.addEventListener('mouseup', handleClickOutside);
16793
- window.addEventListener('keyup', handleKeyup);
16794
- sidebarRef.value.addEventListener('mouseup', handleOnClick);
16795
- sidebarRef.value.addEventListener('transitionend', () => {
16796
- inViewport.value = isVisible(sidebarRef.value);
16797
- });
16991
+ const lastItem = computed(() => {
16992
+ return range.value >= pages.value ? pages.value : range.value - (afterDots.value ? 1 : 0);
16798
16993
  });
16799
- onBeforeUnmount(() => {
16800
- window.removeEventListener('resize', () => handleResize());
16801
- window.removeEventListener('mouseup', handleClickOutside);
16802
- window.removeEventListener('keyup', handleKeyup);
16803
- sidebarRef.value.removeEventListener('mouseup', handleOnClick);
16804
- sidebarRef.value.removeEventListener('transitionend', () => {
16805
- inViewport.value = isVisible(sidebarRef.value);
16806
- });
16994
+ const itemsAmount = computed(() => {
16995
+ return pages.value < computedLimit.value ? pages.value : computedLimit.value;
16807
16996
  });
16808
- const handleHide = () => {
16809
- visible.value = false;
16810
- emit('visible-change', false);
16811
- };
16812
- const handleResize = () => {
16813
- mobile.value = isOnMobile(sidebarRef.value);
16814
- inViewport.value = isVisible(sidebarRef.value);
16815
- };
16816
- const handleKeyup = (event) => {
16817
- if (mobile.value && !sidebarRef.value.contains(event.target)) {
16818
- handleHide();
16819
- }
16820
- };
16821
- const handleClickOutside = (event) => {
16822
- if (mobile.value && !sidebarRef.value.contains(event.target)) {
16823
- handleHide();
16824
- }
16825
- };
16826
- const handleOnClick = (event) => {
16827
- const target = event.target;
16828
- target &&
16829
- target.classList.contains('nav-link') &&
16830
- !target.classList.contains('nav-group-toggle') &&
16831
- mobile.value &&
16832
- handleHide();
16833
- };
16834
- return () => [
16835
- h$1('div', {
16836
- class: [
16837
- 'sidebar',
16838
- {
16839
- [`sidebar-${props.colorScheme}`]: props.colorScheme,
16840
- 'sidebar-narrow': props.narrow,
16841
- 'sidebar-overlaid': props.overlaid,
16842
- [`sidebar-${props.placement}`]: props.placement,
16843
- [`sidebar-${props.position}`]: props.position,
16844
- [`sidebar-${props.size}`]: props.size,
16845
- 'sidebar-narrow-unfoldable': props.unfoldable,
16846
- show: visible.value === true && mobile.value,
16847
- hide: visible.value === false && !mobile.value,
16848
- },
16849
- attrs.class,
16850
- ],
16851
- ref: sidebarRef,
16852
- }, slots.default && slots.default()),
16853
- mobile.value &&
16854
- h$1(CBackdrop, {
16855
- class: 'sidebar-backdrop d-none',
16856
- visible: props.visible,
16857
- onClick: () => handleHide(),
16858
- }),
16859
- ];
16860
- },
16861
- });
16862
-
16863
- const CSidebarBrand = defineComponent({
16864
- name: 'CSidebarBrand',
16865
- setup(_, { slots }) {
16866
- return () => h$1('div', { class: 'sidebar-brand' }, slots.default && slots.default());
16867
- },
16868
- });
16869
-
16870
- const CSidebarFooter = defineComponent({
16871
- name: 'CSidebarFooter',
16872
- setup(_, { slots }) {
16873
- return () => h$1('div', { class: 'sidebar-footer' }, slots.default && slots.default());
16874
- },
16875
- });
16876
-
16877
- const CSidebarHeader = defineComponent({
16878
- name: 'CSidebarHeader',
16879
- setup(_, { slots }) {
16880
- return () => h$1('div', { class: 'sidebar-header' }, slots.default && slots.default());
16881
- },
16882
- });
16883
-
16884
- const CSidebarNav = defineComponent({
16885
- name: 'CSidebarNav',
16886
- setup(_, { slots }) {
16887
- const visibleGroup = ref();
16888
- const handleVisibleChange = (visible, index) => {
16889
- if (visible) {
16890
- 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);
16891
17002
  }
16892
17003
  else {
16893
- if (visibleGroup.value === index) {
16894
- visibleGroup.value = 0;
16895
- }
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);
16896
17015
  }
16897
17016
  };
16898
- const isVisible = (index) => Boolean(visibleGroup.value === index);
16899
- return () => h$1('ul', {
16900
- class: 'sidebar-nav',
16901
- }, slots.default &&
16902
- slots.default().map((vnode, index) => {
16903
- // @ts-expect-error name is defined in component
16904
- if (vnode.type.name === 'CNavGroup') {
16905
- return h$1(vnode, {
16906
- onVisibleChange: (visible) => handleVisibleChange(visible, index + 1),
16907
- ...(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,
16908
17071
  });
16909
- }
16910
- return vnode;
16911
- }));
16912
- },
16913
- });
16914
-
16915
- const CSidebarToggler = defineComponent({
16916
- name: 'CSidebarToggler',
16917
- setup(_, { slots }) {
16918
- 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
+ });
16919
17116
  },
16920
17117
  });
16921
17118
 
16922
- const CSidebarPlugin = {
17119
+ const CSmartPaginationPlugin = {
16923
17120
  install: (app) => {
16924
- app.component(CSidebar.name, CSidebar);
16925
- app.component(CSidebarBrand.name, CSidebarBrand);
16926
- app.component(CSidebarFooter.name, CSidebarFooter);
16927
- app.component(CSidebarHeader.name, CSidebarHeader);
16928
- app.component(CSidebarNav.name, CSidebarNav);
16929
- app.component(CSidebarToggler.name, CSidebarToggler);
17121
+ app.component(CSmartPagination.name, CSmartPagination);
16930
17122
  },
16931
17123
  };
16932
17124
 
@@ -16953,7 +17145,6 @@ const CTableBody = defineComponent({
16953
17145
 
16954
17146
  const CTableCaption = defineComponent({
16955
17147
  name: 'CTableCaption',
16956
- props: {},
16957
17148
  setup(_, { slots }) {
16958
17149
  return () => h$1('caption', {}, slots.default && slots.default());
16959
17150
  },
@@ -17969,13 +18160,13 @@ const CIcon = defineComponent({
17969
18160
  },
17970
18161
  });
17971
18162
 
17972
- 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'/>"];
17973
18164
 
17974
- 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'/>"];
17975
18166
 
17976
- 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'/>"];
17977
18168
 
17978
- 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'/>"];
17979
18170
 
17980
18171
  const CSmartTable = defineComponent({
17981
18172
  name: 'CSmartTable',
@@ -18084,6 +18275,7 @@ const CSmartTable = defineComponent({
18084
18275
  */
18085
18276
  itemsPerPage: {
18086
18277
  type: Number,
18278
+ default: 10,
18087
18279
  required: false,
18088
18280
  },
18089
18281
  /**
@@ -18132,7 +18324,7 @@ const CSmartTable = defineComponent({
18132
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.
18133
18325
  */
18134
18326
  pagination: {
18135
- type: Boolean,
18327
+ type: [Boolean, Object],
18136
18328
  required: false,
18137
18329
  },
18138
18330
  /**
@@ -18619,12 +18811,14 @@ const CSmartTable = defineComponent({
18619
18811
  }, [
18620
18812
  h$1('div', {
18621
18813
  class: 'col',
18622
- }, props.pagination && numberOfPages.value > 1
18814
+ }, (props.pagination && numberOfPages.value > 1) || props.paginationProps
18623
18815
  ? h$1(CSmartPagination, {
18624
- ...props.paginationProps,
18625
18816
  pages: numberOfPages.value,
18626
18817
  activePage: activePage.value,
18627
- onActivePageChange: handleActivePageChange,
18818
+ ...props.paginationProps,
18819
+ onActivePageChange: (page) => typeof props.pagination === 'object' && props.pagination.external
18820
+ ? emit('activePageChange', page)
18821
+ : handleActivePageChange(page),
18628
18822
  })
18629
18823
  : ''),
18630
18824
  h$1('div', {
@@ -19753,7 +19947,6 @@ var Components = /*#__PURE__*/Object.freeze({
19753
19947
  CPaginationPlugin: CPaginationPlugin,
19754
19948
  CPagination: CPagination,
19755
19949
  CPaginationItem: CPaginationItem,
19756
- CSmartPagination: CSmartPagination,
19757
19950
  CPicker: CPicker,
19758
19951
  CPickerPlugin: CPickerPlugin,
19759
19952
  CPlaceholderPlugin: CPlaceholderPlugin,
@@ -19770,6 +19963,8 @@ var Components = /*#__PURE__*/Object.freeze({
19770
19963
  CSidebarHeader: CSidebarHeader,
19771
19964
  CSidebarNav: CSidebarNav,
19772
19965
  CSidebarToggler: CSidebarToggler,
19966
+ CSmartPaginationPlugin: CSmartPaginationPlugin,
19967
+ CSmartPagination: CSmartPagination,
19773
19968
  CSmartTablePlugin: CSmartTablePlugin,
19774
19969
  CSmartTable: CSmartTable,
19775
19970
  CSpinnerPlugin: CSpinnerPlugin,
@@ -20034,5 +20229,5 @@ const CoreuiVue = {
20034
20229
  },
20035
20230
  };
20036
20231
 
20037
- 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 };
20038
20233
  //# sourceMappingURL=index.es.js.map