@coreui/vue-pro 4.4.2 → 4.6.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 (27) hide show
  1. package/dist/components/calendar/CCalendar.d.ts +41 -3
  2. package/dist/components/date-picker/CDatePicker.d.ts +41 -3
  3. package/dist/components/date-range-picker/CDateRangePicker.d.ts +160 -3
  4. package/dist/components/multi-select/CMultiSelect copy.d.ts +305 -0
  5. package/dist/components/multi-select/CMultiSelect.d.ts +168 -0
  6. package/dist/components/smart-table/CSmartTable.d.ts +2 -2
  7. package/dist/components/smart-table/CSmartTableHead.d.ts +15 -3
  8. package/dist/components/smart-table/CSmartTableInterface.d.ts +1 -1
  9. package/dist/components/table/CTable.d.ts +170 -8
  10. package/dist/components/table/CTableDataCell.d.ts +14 -0
  11. package/dist/index.es.js +1006 -474
  12. package/dist/index.es.js.map +1 -1
  13. package/dist/index.js +1006 -474
  14. package/dist/index.js.map +1 -1
  15. package/package.json +2 -2
  16. package/src/components/calendar/CCalendar.ts +46 -4
  17. package/src/components/date-picker/CDatePicker.ts +33 -1
  18. package/src/components/date-range-picker/CDateRangePicker.ts +286 -170
  19. package/src/components/form/CFormInput.ts +1 -1
  20. package/src/components/multi-select/CMultiSelect.ts +204 -93
  21. package/src/components/smart-table/CSmartTable.ts +22 -21
  22. package/src/components/smart-table/CSmartTableHead.ts +45 -24
  23. package/src/components/smart-table/CSmartTableInterface.ts +1 -1
  24. package/src/components/smart-table/CSmartTableItemsPerPageSelector.ts +1 -1
  25. package/src/components/table/CTable.ts +243 -9
  26. package/src/components/table/CTableDataCell.ts +9 -1
  27. package/src/components/time-picker/CTimePicker.ts +125 -44
package/dist/index.es.js CHANGED
@@ -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 &&
@@ -8467,7 +8509,7 @@ const CFormInput = defineComponent({
8467
8509
  onInput: (event) => handleInput(event),
8468
8510
  readonly: props.readonly,
8469
8511
  type: props.type,
8470
- ...(props.modelValue && { value: props.modelValue }),
8512
+ ...((props.modelValue || props.modelValue === 0) && { value: props.modelValue })
8471
8513
  }, slots.default && slots.default()),
8472
8514
  ...(slots.feedback && { feedback: () => slots.feedback && slots.feedback() }),
8473
8515
  ...(slots.feedbackInvalid && {
@@ -12065,6 +12107,34 @@ const CTimePicker = defineComponent({
12065
12107
  return ['ghost', 'outline'].includes(value);
12066
12108
  },
12067
12109
  },
12110
+ /**
12111
+ * Provide valuable, actionable feedback.
12112
+ *
12113
+ * @since 4.6.0
12114
+ */
12115
+ feedback: {
12116
+ type: String,
12117
+ },
12118
+ /**
12119
+ * Provide valuable, actionable feedback.
12120
+ *
12121
+ * @since 4.6.0
12122
+ */
12123
+ feedbackInvalid: {
12124
+ type: String,
12125
+ },
12126
+ /**
12127
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
12128
+ *
12129
+ * @since 4.6.0
12130
+ */
12131
+ feedbackValid: {
12132
+ type: String,
12133
+ },
12134
+ /**
12135
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
12136
+ */
12137
+ id: String,
12068
12138
  /**
12069
12139
  * Toggle visibility or set the content of the input indicator.
12070
12140
  */
@@ -12076,6 +12146,20 @@ const CTimePicker = defineComponent({
12076
12146
  * Toggle the readonly state for the component.
12077
12147
  */
12078
12148
  inputReadOnly: Boolean,
12149
+ /**
12150
+ * Set component validation state to invalid.
12151
+ *
12152
+ * @since 4.6.0
12153
+ */
12154
+ invalid: Boolean,
12155
+ /**
12156
+ * Add a caption for a component.
12157
+ *
12158
+ * @since 4.6.0
12159
+ */
12160
+ label: {
12161
+ type: String,
12162
+ },
12079
12163
  /**
12080
12164
  * Sets the default locale for components. If not set, it is inherited from the navigator.language.
12081
12165
  */
@@ -12102,12 +12186,32 @@ const CTimePicker = defineComponent({
12102
12186
  return ['sm', 'lg'].includes(value);
12103
12187
  },
12104
12188
  },
12189
+ /**
12190
+ * Add helper text to the component.
12191
+ *
12192
+ * @since 4.6.0
12193
+ */
12194
+ text: {
12195
+ type: String,
12196
+ },
12105
12197
  /**
12106
12198
  * Initial selected time.
12107
12199
  */
12108
12200
  time: {
12109
12201
  type: [Date, String],
12110
12202
  },
12203
+ /**
12204
+ * Display validation feedback in a styled tooltip.
12205
+ *
12206
+ * @since 4.6.0
12207
+ */
12208
+ tooltipFeedback: Boolean,
12209
+ /**
12210
+ * Set component validation state to valid.
12211
+ *
12212
+ * @since 4.6.0
12213
+ */
12214
+ valid: Boolean,
12111
12215
  /**
12112
12216
  * Set the time picker variant to a roll or select.
12113
12217
  *
@@ -12135,7 +12239,7 @@ const CTimePicker = defineComponent({
12135
12239
  */
12136
12240
  'show',
12137
12241
  ],
12138
- setup(props, { emit, slots }) {
12242
+ setup(props, { emit, attrs, slots }) {
12139
12243
  const date = ref(convertTimeToDate(props.time));
12140
12244
  const initialDate = ref(null);
12141
12245
  const ampm = ref(date.value ? getAmPm(new Date(date.value), props.locale) : 'am');
@@ -12275,49 +12379,62 @@ const CTimePicker = defineComponent({
12275
12379
  selected: ampm.value,
12276
12380
  }),
12277
12381
  ];
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
- },
12382
+ return () => h$1(CFormControlWrapper, {
12383
+ describedby: attrs['aria-describedby'],
12384
+ feedback: props.feedback,
12385
+ feedbackInvalid: props.feedbackInvalid,
12386
+ feedbackValid: props.feedbackValid,
12387
+ id: props.id,
12388
+ invalid: props.invalid,
12389
+ label: props.label,
12390
+ text: props.text,
12391
+ tooltipFeedback: props.tooltipFeedback,
12392
+ valid: props.valid,
12305
12393
  }, {
12306
- ...(slots.cancelButton && {
12307
- cancelButton: () => slots.cancelButton && slots.cancelButton(),
12308
- }),
12309
- ...(slots.confirmButton && {
12310
- confirmButton: () => slots.confirmButton && slots.confirmButton(),
12394
+ default: () => h$1(CPicker, {
12395
+ cancelButton: props.cancelButton,
12396
+ cancelButtonColor: props.cancelButtonColor,
12397
+ cancelButtonSize: props.cancelButtonSize,
12398
+ cancelButtonVariant: props.cancelButtonVariant,
12399
+ class: ['time-picker', { 'is-invalid': props.invalid, 'is-valid': props.valid }],
12400
+ confirmButton: props.confirmButton,
12401
+ confirmButtonColor: props.confirmButtonColor,
12402
+ confirmButtonSize: props.confirmButtonSize,
12403
+ confirmButtonVariant: props.confirmButtonVariant,
12404
+ container: props.container,
12405
+ disabled: props.disabled,
12406
+ footer: true,
12407
+ onCancel: () => {
12408
+ if (initialDate.value) {
12409
+ date.value = new Date(initialDate.value);
12410
+ }
12411
+ },
12412
+ onHide: () => {
12413
+ emit('hide');
12414
+ },
12415
+ onShow: () => {
12416
+ if (date.value) {
12417
+ initialDate.value = new Date(date.value);
12418
+ }
12419
+ emit('show');
12420
+ },
12421
+ }, {
12422
+ ...(slots.cancelButton && {
12423
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
12424
+ }),
12425
+ ...(slots.confirmButton && {
12426
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
12427
+ }),
12428
+ toggler: () => InputGroup(),
12429
+ default: () => h$1('div', {
12430
+ class: [
12431
+ 'time-picker-body',
12432
+ {
12433
+ ['time-picker-roll']: props.variant === 'roll',
12434
+ },
12435
+ ],
12436
+ }, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
12311
12437
  }),
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
12438
  });
12322
12439
  },
12323
12440
  });
@@ -12430,6 +12547,29 @@ const CDateRangePicker = defineComponent({
12430
12547
  return ['ghost', 'outline'].includes(value);
12431
12548
  },
12432
12549
  },
12550
+ /**
12551
+ * Set the format of day name.
12552
+ *
12553
+ * @default 'numeric'
12554
+ * @since 4.6.0
12555
+ */
12556
+ dayFormat: {
12557
+ type: [Function, String],
12558
+ default: 'numeric',
12559
+ required: false,
12560
+ validator: (value) => {
12561
+ if (typeof value === 'string') {
12562
+ return ['numeric', '2-digit'].includes(value);
12563
+ }
12564
+ if (typeof value === 'function') {
12565
+ return true;
12566
+ }
12567
+ if (typeof value === 'function') {
12568
+ return true;
12569
+ }
12570
+ return false;
12571
+ },
12572
+ },
12433
12573
  /**
12434
12574
  * Toggle the disabled state for the component.
12435
12575
  */
@@ -12447,6 +12587,30 @@ const CDateRangePicker = defineComponent({
12447
12587
  type: [Date, String],
12448
12588
  required: false,
12449
12589
  },
12590
+ /**
12591
+ * Provide valuable, actionable feedback.
12592
+ *
12593
+ * @since 4.6.0
12594
+ */
12595
+ feedback: {
12596
+ type: String,
12597
+ },
12598
+ /**
12599
+ * Provide valuable, actionable feedback.
12600
+ *
12601
+ * @since 4.6.0
12602
+ */
12603
+ feedbackInvalid: {
12604
+ type: String,
12605
+ },
12606
+ /**
12607
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
12608
+ *
12609
+ * @since 4.6.0
12610
+ */
12611
+ feedbackValid: {
12612
+ type: String,
12613
+ },
12450
12614
  /**
12451
12615
  * Sets the day of start week.
12452
12616
  * - 0 - Sunday,
@@ -12489,6 +12653,20 @@ const CDateRangePicker = defineComponent({
12489
12653
  * Toggle the readonly state for the component.
12490
12654
  */
12491
12655
  inputReadOnly: Boolean,
12656
+ /**
12657
+ * Set component validation state to invalid.
12658
+ *
12659
+ * @since 4.6.0
12660
+ */
12661
+ invalid: Boolean,
12662
+ /**
12663
+ * Add a caption for a component.
12664
+ *
12665
+ * @since 4.6.0
12666
+ */
12667
+ label: {
12668
+ type: String,
12669
+ },
12492
12670
  /**
12493
12671
  * Sets the default locale for components. If not set, it is inherited from the navigator.language.
12494
12672
  */
@@ -12515,6 +12693,12 @@ const CDateRangePicker = defineComponent({
12515
12693
  type: Boolean,
12516
12694
  default: true,
12517
12695
  },
12696
+ /**
12697
+ * Reorder year-month navigation, and render year first.
12698
+ *
12699
+ * @since 4.6.0
12700
+ */
12701
+ navYearFirst: Boolean,
12518
12702
  /**
12519
12703
  * Specifies a short hint that is visible in the input.
12520
12704
  */
@@ -12562,6 +12746,14 @@ const CDateRangePicker = defineComponent({
12562
12746
  startDate: {
12563
12747
  type: [Date, String],
12564
12748
  },
12749
+ /**
12750
+ * Add helper text to the component.
12751
+ *
12752
+ * @since 4.6.0
12753
+ */
12754
+ text: {
12755
+ type: String,
12756
+ },
12565
12757
  /**
12566
12758
  * Provide an additional time selection by adding select boxes to choose times.
12567
12759
  */
@@ -12605,13 +12797,25 @@ const CDateRangePicker = defineComponent({
12605
12797
  return ['ghost', 'outline'].includes(value);
12606
12798
  },
12607
12799
  },
12800
+ /**
12801
+ * Display validation feedback in a styled tooltip.
12802
+ *
12803
+ * @since 4.6.0
12804
+ */
12805
+ tooltipFeedback: Boolean,
12806
+ /**
12807
+ * Set component validation state to valid.
12808
+ *
12809
+ * @since 4.6.0
12810
+ */
12811
+ valid: Boolean,
12608
12812
  /**
12609
12813
  * Set length or format of day name.
12610
12814
  *
12611
12815
  * @type number | 'long' | 'narrow' | 'short'
12612
12816
  */
12613
12817
  weekdayFormat: {
12614
- type: [Number, String],
12818
+ type: [Function, Number, String],
12615
12819
  default: 2,
12616
12820
  validator: (value) => {
12617
12821
  if (typeof value === 'string') {
@@ -12620,6 +12824,9 @@ const CDateRangePicker = defineComponent({
12620
12824
  if (typeof value === 'number') {
12621
12825
  return true;
12622
12826
  }
12827
+ if (typeof value === 'function') {
12828
+ return true;
12829
+ }
12623
12830
  return false;
12624
12831
  },
12625
12832
  },
@@ -12648,7 +12855,7 @@ const CDateRangePicker = defineComponent({
12648
12855
  */
12649
12856
  'start-date-change',
12650
12857
  ],
12651
- setup(props, { slots, emit }) {
12858
+ setup(props, { slots, attrs, emit }) {
12652
12859
  const calendarDate = ref(props.calendarDate
12653
12860
  ? new Date(props.calendarDate)
12654
12861
  : props.startDate
@@ -12815,148 +13022,165 @@ const CDateRangePicker = defineComponent({
12815
13022
  : h$1('span', { class: 'picker-input-group-icon date-picker-cleaner-icon' })),
12816
13023
  ]),
12817
13024
  ]);
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,
13025
+ return () => h$1(CFormControlWrapper, {
13026
+ describedby: attrs['aria-describedby'],
13027
+ feedback: props.feedback,
13028
+ feedbackInvalid: props.feedbackInvalid,
13029
+ feedbackValid: props.feedbackValid,
12830
13030
  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
- },
13031
+ invalid: props.invalid,
13032
+ label: props.label,
13033
+ text: props.text,
13034
+ tooltipFeedback: props.tooltipFeedback,
13035
+ valid: props.valid,
12847
13036
  }, {
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;
13037
+ default: () => h$1(CPicker, {
13038
+ cancelButton: props.cancelButton,
13039
+ cancelButtonColor: props.cancelButtonColor,
13040
+ cancelButtonSize: props.cancelButtonSize,
13041
+ cancelButtonVariant: props.cancelButtonVariant,
13042
+ class: ['date-picker', { 'is-invalid': props.invalid, 'is-valid': props.valid }],
13043
+ confirmButton: props.confirmButton,
13044
+ confirmButtonColor: props.confirmButtonColor,
13045
+ confirmButtonSize: props.confirmButtonSize,
13046
+ confirmButtonVariant: props.confirmButtonVariant,
13047
+ disabled: props.disabled,
13048
+ footer: props.footer || props.timepicker,
13049
+ id: props.id,
13050
+ onCancel: () => {
13051
+ startDate.value = initialStartDate.value;
13052
+ endDate.value = initialEndDate.value;
12865
13053
  },
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, {
13054
+ onHide: () => {
13055
+ emit('hide');
13056
+ },
13057
+ onShow: () => {
13058
+ if (startDate.value) {
13059
+ initialStartDate.value = new Date(startDate.value);
13060
+ }
13061
+ if (endDate.value) {
13062
+ initialEndDate.value = new Date(endDate.value);
13063
+ }
13064
+ emit('show');
13065
+ },
13066
+ }, {
13067
+ ...(slots.cancelButton && {
13068
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
13069
+ }),
13070
+ ...(slots.confirmButton && {
13071
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
13072
+ }),
13073
+ toggler: () => InputGroup(),
13074
+ footer: () => h$1(CButton, {
13075
+ class: 'me-auto',
13076
+ color: props.todayButtonColor,
13077
+ size: props.todayButtonSize,
13078
+ variant: props.todayButtonVariant,
13079
+ onClick: () => {
13080
+ const date = new Date();
13081
+ startDate.value = date;
13082
+ endDate.value = date;
13083
+ calendarDate.value = date;
13084
+ },
13085
+ }, () => props.todayButton),
13086
+ default: () => h$1('div', {
13087
+ class: 'date-picker-body',
13088
+ }, [
13089
+ props.ranges &&
13090
+ h$1('div', { class: 'date-picker-ranges' }, Object.keys(props.ranges).map((key) => h$1(CButton, {
13091
+ color: 'secondary',
13092
+ onClick: () => {
13093
+ if (props.ranges) {
13094
+ startDate.value = props.ranges[key][0];
13095
+ endDate.value = props.ranges[key][1];
13096
+ }
13097
+ },
13098
+ variant: 'ghost',
13099
+ }, () => key))),
13100
+ h$1('div', { class: 'date-picker-calendars' }, h$1(CCalendar, {
13101
+ calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), 1),
13102
+ calendars: props.calendars,
13103
+ dayFormat: props.dayFormat,
13104
+ disabledDates: props.disabledDates,
13105
+ ...(endDate.value && { endDate: endDate.value }),
13106
+ firstDayOfWeek: props.firstDayOfWeek,
13107
+ locale: props.locale,
13108
+ maxDate: maxDate.value,
13109
+ minDate: minDate.value,
13110
+ navYearFirst: props.navYearFirst,
13111
+ navigation: props.navigation,
13112
+ range: props.range,
13113
+ selectEndDate: selectEndDate.value,
13114
+ ...(startDate.value && { startDate: startDate.value }),
13115
+ onCalendarCellHover: (date) => handleCalendarCellHover(date),
13116
+ onCalendarDateChange: (date) => handleCalendarDateChange(date),
13117
+ onStartDateChange: (date) => handleStartDateChange(date),
13118
+ onEndDateChange: (date) => handleEndDateChange(date),
13119
+ }, {
13120
+ /**
13121
+ * @slot Location for next icon.
13122
+ */
13123
+ ...(slots.navNextIcon && {
13124
+ navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
13125
+ }),
13126
+ /**
13127
+ * @slot Location for next double icon.
13128
+ */
13129
+ ...(slots.navNextDoubleIcon && {
13130
+ navNextDoubleIcon: () => slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
13131
+ }),
13132
+ /**
13133
+ * @slot Location for previous icon.
13134
+ */
13135
+ ...(slots.navPrevIcon && {
13136
+ navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
13137
+ }),
13138
+ /**
13139
+ * @slot Location for double previous icon.
13140
+ */
13141
+ ...(slots.navPrevDoubleIcon && {
13142
+ navPrevDoubleIcon: () => slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
13143
+ }),
13144
+ })),
13145
+ props.timepicker &&
13146
+ h$1('div', { class: 'date-picker-timepickers' }, isMobile.value || (props.range && props.calendars === 1)
13147
+ ? [
13148
+ h$1(CTimePicker, {
13149
+ container: 'inline',
13150
+ disabled: startDate.value === null ? true : false,
13151
+ locale: props.locale,
13152
+ onChange: (_, __, date) => handleStartDateChange(date),
13153
+ time: startDate.value,
13154
+ variant: 'select',
13155
+ }),
13156
+ h$1(CTimePicker, {
13157
+ container: 'inline',
13158
+ disabled: endDate.value === null ? true : false,
13159
+ locale: props.locale,
13160
+ onChange: (_, __, date) => handleEndDateChange(date),
13161
+ time: endDate.value,
13162
+ variant: 'select',
13163
+ }),
13164
+ ]
13165
+ : [...Array(props.calendars)].map((_, index) => h$1(CTimePicker, {
12936
13166
  container: 'inline',
12937
- disabled: endDate.value === null ? true : false,
13167
+ disabled: index === 0
13168
+ ? startDate.value === null
13169
+ ? true
13170
+ : false
13171
+ : endDate.value === null
13172
+ ? true
13173
+ : false,
12938
13174
  locale: props.locale,
12939
- onChange: (_, __, date) => handleEndDateChange(date),
12940
- time: endDate.value,
13175
+ onChange: (_, __, date) => index === 0
13176
+ ? handleStartDateChange(date)
13177
+ : handleEndDateChange(date),
13178
+ time: index === 0 ? startDate.value : endDate.value,
12941
13179
  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
- ]),
12959
- });
13180
+ }))),
13181
+ ]),
13182
+ }),
13183
+ });
12960
13184
  },
12961
13185
  });
12962
13186
 
@@ -13061,6 +13285,29 @@ const CDatePicker = defineComponent({
13061
13285
  return ['ghost', 'outline'].includes(value);
13062
13286
  },
13063
13287
  },
13288
+ /**
13289
+ * Set the format of day name.
13290
+ *
13291
+ * @default 'numeric'
13292
+ * @since 4.6.0
13293
+ */
13294
+ dayFormat: {
13295
+ type: [Function, String],
13296
+ default: 'numeric',
13297
+ required: false,
13298
+ validator: (value) => {
13299
+ if (typeof value === 'string') {
13300
+ return ['numeric', '2-digit'].includes(value);
13301
+ }
13302
+ if (typeof value === 'function') {
13303
+ return true;
13304
+ }
13305
+ if (typeof value === 'function') {
13306
+ return true;
13307
+ }
13308
+ return false;
13309
+ },
13310
+ },
13064
13311
  /**
13065
13312
  * Toggle the disabled state for the component.
13066
13313
  */
@@ -13145,6 +13392,12 @@ const CDatePicker = defineComponent({
13145
13392
  type: Boolean,
13146
13393
  default: true,
13147
13394
  },
13395
+ /**
13396
+ * Reorder year-month navigation, and render year first.
13397
+ *
13398
+ * @since 4.6.0
13399
+ */
13400
+ navYearFirst: Boolean,
13148
13401
  /**
13149
13402
  * Specifies a short hint that is visible in the input.
13150
13403
  */
@@ -13174,7 +13427,7 @@ const CDatePicker = defineComponent({
13174
13427
  * @type number | 'long' | 'narrow' | 'short'
13175
13428
  */
13176
13429
  weekdayFormat: {
13177
- type: [Number, String],
13430
+ type: [Function, Number, String],
13178
13431
  default: 2,
13179
13432
  validator: (value) => {
13180
13433
  if (typeof value === 'string') {
@@ -13183,6 +13436,9 @@ const CDatePicker = defineComponent({
13183
13436
  if (typeof value === 'number') {
13184
13437
  return true;
13185
13438
  }
13439
+ if (typeof value === 'function') {
13440
+ return true;
13441
+ }
13186
13442
  return false;
13187
13443
  },
13188
13444
  },
@@ -14573,6 +14829,58 @@ const CMultiSelect = defineComponent({
14573
14829
  required: false,
14574
14830
  default: true,
14575
14831
  },
14832
+ /**
14833
+ * Toggle the disabled state for the component.
14834
+ */
14835
+ disabled: {
14836
+ type: Boolean,
14837
+ required: false,
14838
+ default: false,
14839
+ },
14840
+ /**
14841
+ * Provide valuable, actionable feedback.
14842
+ *
14843
+ * @since 4.6.0
14844
+ */
14845
+ feedback: {
14846
+ type: String,
14847
+ },
14848
+ /**
14849
+ * Provide valuable, actionable feedback.
14850
+ *
14851
+ * @since 4.6.0
14852
+ */
14853
+ feedbackInvalid: {
14854
+ type: String,
14855
+ },
14856
+ /**
14857
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
14858
+ *
14859
+ * @since 4.6.0
14860
+ */
14861
+ feedbackValid: {
14862
+ type: String,
14863
+ },
14864
+ /**
14865
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
14866
+ */
14867
+ id: {
14868
+ type: String,
14869
+ },
14870
+ /**
14871
+ * Set component validation state to invalid.
14872
+ *
14873
+ * @since 4.6.0
14874
+ */
14875
+ invalid: Boolean,
14876
+ /**
14877
+ * Add a caption for a component.
14878
+ *
14879
+ * @since 4.6.0
14880
+ */
14881
+ label: {
14882
+ type: String,
14883
+ },
14576
14884
  /**
14577
14885
  * It specifies that multiple options can be selected at once.
14578
14886
  *
@@ -14685,6 +14993,38 @@ const CMultiSelect = defineComponent({
14685
14993
  default: 'item(s) selected',
14686
14994
  required: false,
14687
14995
  },
14996
+ /**
14997
+ * Size the component small or large.
14998
+ *
14999
+ * @values 'sm', 'lg'
15000
+ */
15001
+ size: {
15002
+ type: String,
15003
+ required: false,
15004
+ validator: (value) => {
15005
+ return ['sm', 'lg'].includes(value);
15006
+ },
15007
+ },
15008
+ /**
15009
+ * Add helper text to the component.
15010
+ *
15011
+ * @since 4.6.0
15012
+ */
15013
+ text: {
15014
+ type: String,
15015
+ },
15016
+ /**
15017
+ * Display validation feedback in a styled tooltip.
15018
+ *
15019
+ * @since 4.6.0
15020
+ */
15021
+ tooltipFeedback: Boolean,
15022
+ /**
15023
+ * Set component validation state to valid.
15024
+ *
15025
+ * @since 4.6.0
15026
+ */
15027
+ valid: Boolean,
14688
15028
  /**
14689
15029
  * Toggle the visibility of multi select dropdown.
14690
15030
  *
@@ -14702,7 +15042,7 @@ const CMultiSelect = defineComponent({
14702
15042
  */
14703
15043
  'change',
14704
15044
  ],
14705
- setup(props, { emit }) {
15045
+ setup(props, { attrs, emit }) {
14706
15046
  const flattenArray = (options) => {
14707
15047
  return options.reduce((acc, val) => {
14708
15048
  return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
@@ -14767,7 +15107,6 @@ const CMultiSelect = defineComponent({
14767
15107
  }, [])
14768
15108
  : options.value;
14769
15109
  };
14770
- const multiSelectRef = ref();
14771
15110
  const nativeSelectRef = ref();
14772
15111
  provide('nativeSelectRef', nativeSelectRef);
14773
15112
  const searchRef = ref();
@@ -14777,8 +15116,9 @@ const CMultiSelect = defineComponent({
14777
15116
  const visible = ref(props.visible);
14778
15117
  const selected = ref(getSelectedOptions(props.options));
14779
15118
  const count = ref(0);
14780
- watch(() => props.options, () => {
14781
- options.value = props.options;
15119
+ watch(() => props.options, (newValue, oldValue) => {
15120
+ if (JSON.stringify(newValue) !== JSON.stringify(oldValue))
15121
+ options.value = newValue;
14782
15122
  });
14783
15123
  watch(options, () => {
14784
15124
  const _selected = options.value && getSelectedOptions(options.value);
@@ -14801,24 +15141,6 @@ const CMultiSelect = defineComponent({
14801
15141
  nativeSelectRef.value &&
14802
15142
  nativeSelectRef.value.dispatchEvent(new Event('change', { bubbles: true }));
14803
15143
  });
14804
- onMounted(() => {
14805
- window.addEventListener('click', handleClickOutside);
14806
- window.addEventListener('keyup', handleKeyup);
14807
- });
14808
- onUnmounted(() => {
14809
- window.removeEventListener('click', handleClickOutside);
14810
- window.removeEventListener('keyup', handleKeyup);
14811
- });
14812
- const handleKeyup = (event) => {
14813
- if (multiSelectRef.value && !multiSelectRef.value.contains(event.target)) {
14814
- visible.value = false;
14815
- }
14816
- };
14817
- const handleClickOutside = (event) => {
14818
- if (multiSelectRef.value && !multiSelectRef.value.contains(event.target)) {
14819
- visible.value = false;
14820
- }
14821
- };
14822
15144
  const handleSearchChange = (event) => {
14823
15145
  const target = event.target;
14824
15146
  search.value = target.value.toLowerCase();
@@ -14836,6 +15158,13 @@ const CMultiSelect = defineComponent({
14836
15158
  };
14837
15159
  const handleOptionClick = (option) => {
14838
15160
  options.value = updateOptions(option.value);
15161
+ if (!props.multiple) {
15162
+ visible.value = false;
15163
+ search.value = '';
15164
+ if (searchRef.value) {
15165
+ searchRef.value.value = '';
15166
+ }
15167
+ }
14839
15168
  };
14840
15169
  const handleSelectAll = () => {
14841
15170
  options.value = toggleAllOptions(options.value, true);
@@ -14852,68 +15181,97 @@ const CMultiSelect = defineComponent({
14852
15181
  : selected.value.map((option) => option.value)[0],
14853
15182
  onChange: () => emit('change', selected.value),
14854
15183
  }),
14855
- h$1('div', {
14856
- class: [
14857
- 'form-multi-select',
14858
- {
14859
- show: visible.value,
14860
- 'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
15184
+ h$1(CFormControlWrapper, {
15185
+ describedby: attrs['aria-describedby'],
15186
+ feedback: props.feedback,
15187
+ feedbackInvalid: props.feedbackInvalid,
15188
+ feedbackValid: props.feedbackValid,
15189
+ id: props.id,
15190
+ invalid: props.invalid,
15191
+ label: props.label,
15192
+ text: props.text,
15193
+ tooltipFeedback: props.tooltipFeedback,
15194
+ valid: props.valid,
15195
+ }, {
15196
+ default: () => h$1(CPicker, {
15197
+ class: [
15198
+ 'form-multi-select',
15199
+ {
15200
+ 'form-multi-select-with-cleaner': props.cleaner,
15201
+ disabled: props.disabled,
15202
+ [`form-multi-select-${props.size}`]: props.size,
15203
+ 'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
15204
+ show: visible.value,
15205
+ 'is-invalid': props.invalid,
15206
+ 'is-valid': props.valid,
15207
+ },
15208
+ ],
15209
+ disabled: props.disabled,
15210
+ id: props.id,
15211
+ onHide: () => {
15212
+ visible.value = false;
14861
15213
  },
14862
- ],
14863
- onClick: () => {
14864
- visible.value = true;
14865
- props.search && searchRef.value && searchRef.value.focus();
14866
- },
14867
- ref: multiSelectRef,
14868
- }, [
14869
- h$1(CMultiSelectSelection, {
14870
- multiple: props.multiple,
14871
- onRemove: (option) => handleOptionClick(option),
14872
- search: props.search,
14873
- selected: selected.value,
14874
- selectionType: props.selectionType,
14875
- selectionTypeCounterText: props.selectionTypeCounterText,
14876
- }),
14877
- props.multiple &&
14878
- props.cleaner &&
14879
- selected.value.length > 0 &&
14880
- h$1('button', {
14881
- type: 'button',
14882
- class: 'form-multi-select-selection-cleaner',
14883
- onClick: () => handleDeselectAll(),
14884
- }),
14885
- props.search &&
14886
- h$1('input', {
14887
- type: 'text',
14888
- class: 'form-multi-select-search',
14889
- autocomplete: 'off',
14890
- ...(selected.value.length === 0 && { placeholder: props.placeholder }),
14891
- ...(selected.value.length &&
14892
- props.selectionType === 'counter' && {
14893
- placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
15214
+ onShow: () => {
15215
+ props.search && searchRef.value && searchRef.value.focus();
15216
+ visible.value = true;
15217
+ },
15218
+ visible: visible.value,
15219
+ }, {
15220
+ toggler: () => h$1('div', {}, [
15221
+ h$1(CMultiSelectSelection, {
15222
+ multiple: props.multiple,
15223
+ onRemove: (option) => !props.disabled && handleOptionClick(option),
15224
+ search: props.search,
15225
+ selected: selected.value,
15226
+ selectionType: props.selectionType,
15227
+ selectionTypeCounterText: props.selectionTypeCounterText,
14894
15228
  }),
14895
- ...(selected.value.length &&
14896
- !props.multiple && { placeholder: selected.value.map((option) => option.text)[0] }),
14897
- onInput: (event) => handleSearchChange(event),
14898
- onKeydown: (event) => handleSearchKeyDown(event),
14899
- ...(props.multiple &&
14900
- selected.value.length &&
14901
- props.selectionType !== 'counter' && { size: search.value.length + 2 }),
14902
- ref: searchRef,
14903
- }),
14904
- h$1('div', { class: 'form-multi-select-dropdown' }, [
14905
- props.multiple &&
14906
- props.selectAll &&
14907
- h$1('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
14908
- h$1(CMultiSelectOptions, {
14909
- onOptionClick: (option) => handleOptionClick(option),
14910
- options: vOptions.value,
14911
- optionsMaxHeight: props.optionsMaxHeight,
14912
- optionsStyle: props.optionsStyle,
14913
- searchNoResultsLabel: props.searchNoResultsLabel,
14914
- }),
14915
- ]),
14916
- ]),
15229
+ props.multiple &&
15230
+ props.cleaner &&
15231
+ selected.value.length > 0 &&
15232
+ !props.disabled &&
15233
+ h$1('button', {
15234
+ type: 'button',
15235
+ class: 'form-multi-select-selection-cleaner',
15236
+ onClick: () => handleDeselectAll(),
15237
+ }),
15238
+ props.search &&
15239
+ h$1('input', {
15240
+ type: 'text',
15241
+ class: 'form-multi-select-search',
15242
+ autocomplete: 'off',
15243
+ ...(selected.value.length === 0 && { placeholder: props.placeholder }),
15244
+ ...(selected.value.length &&
15245
+ props.selectionType === 'counter' && {
15246
+ placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
15247
+ }),
15248
+ ...(selected.value.length &&
15249
+ !props.multiple && {
15250
+ placeholder: selected.value.map((option) => option.text)[0],
15251
+ }),
15252
+ disabled: props.disabled,
15253
+ onInput: (event) => handleSearchChange(event),
15254
+ onKeydown: (event) => handleSearchKeyDown(event),
15255
+ ...(props.multiple &&
15256
+ selected.value.length &&
15257
+ props.selectionType !== 'counter' && { size: search.value.length + 2 }),
15258
+ ref: searchRef,
15259
+ }),
15260
+ ]),
15261
+ default: () => h$1('div', {}, [
15262
+ props.multiple &&
15263
+ props.selectAll &&
15264
+ h$1('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
15265
+ h$1(CMultiSelectOptions, {
15266
+ onOptionClick: (option) => handleOptionClick(option),
15267
+ options: vOptions.value,
15268
+ optionsMaxHeight: props.optionsMaxHeight,
15269
+ optionsStyle: props.optionsStyle,
15270
+ searchNoResultsLabel: props.searchNoResultsLabel,
15271
+ }),
15272
+ ]),
15273
+ }),
15274
+ }),
14917
15275
  ];
14918
15276
  },
14919
15277
  });
@@ -16572,53 +16930,56 @@ const CSidebarPlugin = {
16572
16930
  },
16573
16931
  };
16574
16932
 
16575
- const CTable = defineComponent({
16576
- name: 'CTable',
16933
+ const CTableBody = defineComponent({
16934
+ name: 'CTableBody',
16577
16935
  props: {
16578
16936
  /**
16579
- * Set the vertical aligment.
16580
- *
16581
- * @values 'bottom', 'middle', 'top'
16582
- */
16583
- align: {
16584
- type: String,
16585
- default: undefined,
16586
- required: false,
16587
- validator: (value) => {
16588
- return ['bottom', 'middle', 'top'].includes(value);
16589
- },
16590
- },
16591
- /**
16592
- * Sets the border color of the component to one of CoreUI’s themed colors.
16937
+ * Sets the color context of the component to one of CoreUI’s themed colors.
16593
16938
  *
16594
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
16595
- */
16596
- borderColor: Color,
16597
- /**
16598
- * Add borders on all sides of the table and cells.
16939
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
16599
16940
  */
16600
- bordered: {
16601
- type: Boolean,
16602
- required: false,
16603
- },
16941
+ color: Color,
16942
+ },
16943
+ setup(props, { slots }) {
16944
+ return () => h$1('tbody', {
16945
+ class: [
16946
+ {
16947
+ [`table-${props.color}`]: props.color,
16948
+ },
16949
+ ],
16950
+ }, slots.default && slots.default());
16951
+ },
16952
+ });
16953
+
16954
+ const CTableCaption = defineComponent({
16955
+ name: 'CTableCaption',
16956
+ props: {},
16957
+ setup(_, { slots }) {
16958
+ return () => h$1('caption', {}, slots.default && slots.default());
16959
+ },
16960
+ });
16961
+
16962
+ const CTableDataCell = defineComponent({
16963
+ name: 'CTableDataCell',
16964
+ props: {
16604
16965
  /**
16605
- * Remove borders on all sides of the table and cells.
16966
+ * Highlight a table row or cell.
16606
16967
  */
16607
- borderless: {
16968
+ active: {
16608
16969
  type: Boolean,
16609
16970
  required: false,
16610
16971
  },
16611
16972
  /**
16612
- * Put the `<caption>` on the top of the table.
16973
+ * Set the vertical aligment.
16613
16974
  *
16614
- * @values 'top'
16975
+ * @values 'bottom', 'middle', 'top'
16615
16976
  */
16616
- caption: {
16977
+ align: {
16617
16978
  type: String,
16618
16979
  default: undefined,
16619
16980
  required: false,
16620
16981
  validator: (value) => {
16621
- return value === 'top';
16982
+ return ['bottom', 'middle', 'top'].includes(value);
16622
16983
  },
16623
16984
  },
16624
16985
  /**
@@ -16628,88 +16989,50 @@ const CTable = defineComponent({
16628
16989
  */
16629
16990
  color: Color,
16630
16991
  /**
16631
- * Enable a hover state on table rows within a `<CTableBody>`.
16992
+ * @ignore
16632
16993
  */
16633
- hover: {
16634
- type: Boolean,
16994
+ scope: {
16995
+ type: String,
16635
16996
  required: false,
16636
16997
  },
16998
+ },
16999
+ setup(props, { slots }) {
17000
+ return () => h$1(props.scope ? 'th' : 'td', {
17001
+ class: [
17002
+ {
17003
+ [`align-${props.align}`]: props.align,
17004
+ 'table-active': props.active,
17005
+ [`table-${props.color}`]: props.color,
17006
+ },
17007
+ ],
17008
+ ...(props.scope && { scope: props.scope }),
17009
+ }, slots.default && slots.default());
17010
+ },
17011
+ });
17012
+
17013
+ const CTableFoot = defineComponent({
17014
+ name: 'CTableFoot',
17015
+ props: {
16637
17016
  /**
16638
- * Make any table responsive across all viewports or pick a maximum breakpoint with which to have a responsive table up to.
17017
+ * Sets the color context of the component to one of CoreUI’s themed colors.
16639
17018
  *
16640
- * @values boolean, 'sm', 'md', 'lg', 'xl', 'xxl'
17019
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
16641
17020
  */
16642
- responsive: {
16643
- type: [Boolean, String],
16644
- default: undefined,
16645
- required: false,
16646
- validator: (value) => {
16647
- if (typeof value == 'string') {
16648
- return ['sm', 'md', 'lg', 'xl', 'xxl'].includes(value);
16649
- }
16650
- if (typeof value == 'boolean') {
16651
- return true;
16652
- }
16653
- return false;
16654
- },
16655
- },
16656
- /**
16657
- * Make table more compact by cutting all cell `padding` in half.
16658
- */
16659
- small: {
16660
- type: Boolean,
16661
- required: false,
16662
- },
16663
- /**
16664
- * Add zebra-striping to any table row within the `<CTableBody>`.
16665
- */
16666
- striped: {
16667
- type: Boolean,
16668
- required: false,
16669
- },
16670
- /**
16671
- * Add zebra-striping to any table column.
16672
- *
16673
- * @since 4.4.0
16674
- */
16675
- stripedColumns: {
16676
- type: Boolean,
16677
- required: false,
16678
- },
17021
+ color: Color,
16679
17022
  },
16680
- setup(props, { slots, attrs }) {
16681
- const table = () => h$1('table', {
17023
+ setup(props, { slots }) {
17024
+ return () => h$1('tfoot', {
16682
17025
  class: [
16683
- 'table',
16684
17026
  {
16685
- [`align-${props.align}`]: props.align,
16686
- [`caption-${props.caption}`]: props.caption,
16687
- [`border-${props.borderColor}`]: props.borderColor,
16688
- 'table-bordered': props.bordered,
16689
- 'table-borderless': props.borderless,
16690
17027
  [`table-${props.color}`]: props.color,
16691
- 'table-hover': props.hover,
16692
- 'table-sm': props.small,
16693
- 'table-striped': props.striped,
16694
- 'table-striped-columns': props.stripedColumns,
16695
17028
  },
16696
- attrs.class,
16697
17029
  ],
16698
17030
  }, slots.default && slots.default());
16699
- return () => [
16700
- props.responsive
16701
- ? h$1('div', {
16702
- class: typeof props.responsive === 'boolean'
16703
- ? 'table-responsive'
16704
- : `table-responsive-${props.responsive}`,
16705
- }, table())
16706
- : table(),
16707
- ];
16708
17031
  },
16709
17032
  });
16710
17033
 
16711
- const CTableBody = defineComponent({
16712
- name: 'CTableBody',
17034
+ const CTableHead = defineComponent({
17035
+ name: 'CTableHead',
16713
17036
  props: {
16714
17037
  /**
16715
17038
  * Sets the color context of the component to one of CoreUI’s themed colors.
@@ -16719,7 +17042,7 @@ const CTableBody = defineComponent({
16719
17042
  color: Color,
16720
17043
  },
16721
17044
  setup(props, { slots }) {
16722
- return () => h$1('tbody', {
17045
+ return () => h$1('thead', {
16723
17046
  class: [
16724
17047
  {
16725
17048
  [`table-${props.color}`]: props.color,
@@ -16729,19 +17052,32 @@ const CTableBody = defineComponent({
16729
17052
  },
16730
17053
  });
16731
17054
 
16732
- const CTableCaption = defineComponent({
16733
- name: 'CTableCaption',
16734
- props: {},
16735
- setup(_, { slots }) {
16736
- return () => h$1('caption', {}, slots.default && slots.default());
17055
+ const CTableHeaderCell = defineComponent({
17056
+ name: 'CTableHeaderCell',
17057
+ props: {
17058
+ /**
17059
+ * Sets the color context of the component to one of CoreUI’s themed colors.
17060
+ *
17061
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
17062
+ */
17063
+ color: Color,
17064
+ },
17065
+ setup(props, { slots }) {
17066
+ return () => h$1('th', {
17067
+ class: [
17068
+ {
17069
+ [`table-${props.color}`]: props.color,
17070
+ },
17071
+ ],
17072
+ }, slots.default && slots.default());
16737
17073
  },
16738
17074
  });
16739
17075
 
16740
- const CTableDataCell = defineComponent({
16741
- name: 'CTableDataCell',
17076
+ const CTableRow = defineComponent({
17077
+ name: 'CTableRow',
16742
17078
  props: {
16743
17079
  /**
16744
- * Highlight a table row or cell.
17080
+ * Highlight a table row or cell..
16745
17081
  */
16746
17082
  active: {
16747
17083
  type: Boolean,
@@ -16768,7 +17104,7 @@ const CTableDataCell = defineComponent({
16768
17104
  color: Color,
16769
17105
  },
16770
17106
  setup(props, { slots }) {
16771
- return () => h$1('td', {
17107
+ return () => h$1('tr', {
16772
17108
  class: [
16773
17109
  {
16774
17110
  [`align-${props.align}`]: props.align,
@@ -16780,109 +17116,290 @@ const CTableDataCell = defineComponent({
16780
17116
  },
16781
17117
  });
16782
17118
 
16783
- const CTableFoot = defineComponent({
16784
- name: 'CTableFoot',
17119
+ const pretifyName = (name) => {
17120
+ return name
17121
+ .replace(/[-_.]/g, ' ')
17122
+ .replace(/ +/g, ' ')
17123
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
17124
+ .split(' ')
17125
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
17126
+ .join(' ');
17127
+ };
17128
+ const label = (column) => typeof column === 'object'
17129
+ ? column.label !== undefined
17130
+ ? column.label
17131
+ : pretifyName(column.key)
17132
+ : pretifyName(column);
17133
+ const CTable = defineComponent({
17134
+ name: 'CTable',
16785
17135
  props: {
16786
17136
  /**
16787
- * Sets the color context of the component to one of CoreUI’s themed colors.
17137
+ * Set the vertical aligment.
16788
17138
  *
16789
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
17139
+ * @values 'bottom', 'middle', 'top'
16790
17140
  */
16791
- color: Color,
16792
- },
16793
- setup(props, { slots }) {
16794
- return () => h$1('tfoot', {
16795
- class: [
16796
- {
16797
- [`table-${props.color}`]: props.color,
16798
- },
16799
- ],
16800
- }, slots.default && slots.default());
16801
- },
16802
- });
16803
-
16804
- const CTableHead = defineComponent({
16805
- name: 'CTableHead',
16806
- props: {
17141
+ align: {
17142
+ type: String,
17143
+ default: undefined,
17144
+ required: false,
17145
+ validator: (value) => {
17146
+ return ['bottom', 'middle', 'top'].includes(value);
17147
+ },
17148
+ },
16807
17149
  /**
16808
- * Sets the color context of the component to one of CoreUI’s themed colors.
17150
+ * Sets the border color of the component to one of CoreUI’s themed colors.
16809
17151
  *
16810
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
17152
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
16811
17153
  */
16812
- color: Color,
16813
- },
16814
- setup(props, { slots }) {
16815
- return () => h$1('thead', {
16816
- class: [
16817
- {
16818
- [`table-${props.color}`]: props.color,
16819
- },
16820
- ],
16821
- }, slots.default && slots.default());
16822
- },
16823
- });
16824
-
16825
- const CTableHeaderCell = defineComponent({
16826
- name: 'CTableHeaderCell',
16827
- props: {
17154
+ borderColor: Color,
17155
+ /**
17156
+ * Add borders on all sides of the table and cells.
17157
+ */
17158
+ bordered: {
17159
+ type: Boolean,
17160
+ required: false,
17161
+ },
17162
+ /**
17163
+ * Remove borders on all sides of the table and cells.
17164
+ */
17165
+ borderless: {
17166
+ type: Boolean,
17167
+ required: false,
17168
+ },
17169
+ /**
17170
+ * Put the `<caption>` on the top of the table.
17171
+ *
17172
+ * @values 'top' | string
17173
+ */
17174
+ caption: {
17175
+ type: String,
17176
+ default: undefined,
17177
+ required: false,
17178
+ },
17179
+ /**
17180
+ * Set the text of the table caption and the caption on the top of the table.
17181
+ *
17182
+ * @since 4.5.0
17183
+ */
17184
+ captionTop: {
17185
+ type: String,
17186
+ default: undefined,
17187
+ required: false,
17188
+ },
17189
+ /**
17190
+ * Prop for table columns configuration. If prop is not defined, table will display columns based on the first item keys, omitting keys that begins with underscore (e.g. '_props')
17191
+ *
17192
+ * In columns prop each array item represents one column. Item might be specified in two ways:
17193
+ * String: each item define column name equal to item value.
17194
+ * Object: item is object with following keys available as column configuration:
17195
+ * - key (required)(String) - define column name equal to item key.
17196
+ * - label (String) - define visible label of column. If not defined, label will be generated automatically based on column name, by converting kebab-case and snake_case to individual words and capitalization of each word.
17197
+ * - _props (Object) - adds classes to all cels in column, ex. _props: { scope: 'col', className: 'custom-class' },
17198
+ * - _style (Object) - adds styles to the column header (useful for defining widths)
17199
+ *
17200
+ * @since 4.5.0
17201
+ */
17202
+ columns: {
17203
+ type: Array,
17204
+ required: false,
17205
+ },
16828
17206
  /**
16829
17207
  * Sets the color context of the component to one of CoreUI’s themed colors.
16830
17208
  *
16831
17209
  * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
16832
17210
  */
16833
17211
  color: Color,
16834
- },
16835
- setup(props, { slots }) {
16836
- return () => h$1('th', {
16837
- class: [
16838
- {
16839
- [`table-${props.color}`]: props.color,
16840
- },
16841
- ],
16842
- }, slots.default && slots.default());
16843
- },
16844
- });
16845
-
16846
- const CTableRow = defineComponent({
16847
- name: 'CTableRow',
16848
- props: {
16849
17212
  /**
16850
- * Highlight a table row or cell..
17213
+ * Array of objects or strings, where each element represents one cell in the table footer.
17214
+ *
17215
+ * Example items:
17216
+ * ['FooterCell', 'FooterCell', 'FooterCell']
17217
+ * or
17218
+ * [{ label: 'FooterCell', _props: { color: 'success' }, ...]
17219
+ *
17220
+ * @since 4.5.0
16851
17221
  */
16852
- active: {
17222
+ footer: {
17223
+ type: Array,
17224
+ default: () => [],
17225
+ required: false,
17226
+ },
17227
+ /**
17228
+ * Enable a hover state on table rows within a `<CTableBody>`.
17229
+ */
17230
+ hover: {
16853
17231
  type: Boolean,
16854
17232
  required: false,
16855
17233
  },
16856
17234
  /**
16857
- * Set the vertical aligment.
17235
+ * Array of objects, where each object represents one item - row in table. Additionally, you can add style classes to each row by passing them by '_props' key and to single cell by '_cellProps'.
16858
17236
  *
16859
- * @values 'bottom', 'middle', 'top'
17237
+ * Example item:
17238
+ * { name: 'John' , age: 12, _props: { color: 'success' }, _cellProps: { age: { className: 'fw-bold'}}}
17239
+ *
17240
+ * @since 4.5.0
16860
17241
  */
16861
- align: {
16862
- type: String,
17242
+ items: {
17243
+ type: Array,
17244
+ default: () => [],
17245
+ required: false,
17246
+ },
17247
+ responsive: {
17248
+ type: [Boolean, String],
16863
17249
  default: undefined,
16864
17250
  required: false,
16865
17251
  validator: (value) => {
16866
- return ['bottom', 'middle', 'top'].includes(value);
17252
+ if (typeof value == 'string') {
17253
+ return ['sm', 'md', 'lg', 'xl', 'xxl'].includes(value);
17254
+ }
17255
+ if (typeof value == 'boolean') {
17256
+ return true;
17257
+ }
17258
+ return false;
16867
17259
  },
16868
17260
  },
16869
17261
  /**
16870
- * Sets the color context of the component to one of CoreUI’s themed colors.
17262
+ * Make table more compact by cutting all cell `padding` in half.
17263
+ */
17264
+ small: {
17265
+ type: Boolean,
17266
+ required: false,
17267
+ },
17268
+ /**
17269
+ * Add zebra-striping to any table row within the `<CTableBody>`.
17270
+ */
17271
+ striped: {
17272
+ type: Boolean,
17273
+ required: false,
17274
+ },
17275
+ /**
17276
+ * Add zebra-striping to any table column.
16871
17277
  *
16872
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
17278
+ * @since 4.4.0
16873
17279
  */
16874
- color: Color,
17280
+ stripedColumns: {
17281
+ type: Boolean,
17282
+ required: false,
17283
+ },
17284
+ /**
17285
+ * Properties that will be passed to the table footer component.
17286
+ *
17287
+ * Properties to [CTableFoot](#ctablefoot) component.
17288
+ * @since 4.5.0
17289
+ */
17290
+ tableFootProps: {
17291
+ type: Object,
17292
+ default: undefined,
17293
+ required: false,
17294
+ },
17295
+ /**
17296
+ * Properties that will be passed to the table head component.
17297
+ *
17298
+ * Properties to [CTableHead](#ctablehead) component.
17299
+ * @since 4.5.0
17300
+ */
17301
+ tableHeadProps: {
17302
+ type: Object,
17303
+ default: undefined,
17304
+ required: false,
17305
+ },
16875
17306
  },
16876
- setup(props, { slots }) {
16877
- return () => h$1('tr', {
17307
+ setup(props, { slots, attrs }) {
17308
+ const rawColumnNames = computed(() => props.columns
17309
+ ? props.columns.map((column) => {
17310
+ if (typeof column === 'object')
17311
+ return column.key;
17312
+ else
17313
+ return column;
17314
+ })
17315
+ : Object.keys(props.items[0] || {}).filter((el) => el.charAt(0) !== '_'));
17316
+ const table = () => h$1('table', {
16878
17317
  class: [
17318
+ 'table',
16879
17319
  {
16880
17320
  [`align-${props.align}`]: props.align,
16881
- 'table-active': props.active,
17321
+ [`caption-top`]: props.captionTop || props.caption === 'top',
17322
+ [`border-${props.borderColor}`]: props.borderColor,
17323
+ 'table-bordered': props.bordered,
17324
+ 'table-borderless': props.borderless,
16882
17325
  [`table-${props.color}`]: props.color,
17326
+ 'table-hover': props.hover,
17327
+ 'table-sm': props.small,
17328
+ 'table-striped': props.striped,
17329
+ 'table-striped-columns': props.stripedColumns,
16883
17330
  },
17331
+ attrs.class,
16884
17332
  ],
16885
- }, slots.default && slots.default());
17333
+ }, {
17334
+ default: () => [
17335
+ ((props.caption && props.caption !== 'top') || props.captionTop) &&
17336
+ h$1(CTableCaption, {}, {
17337
+ default: () => props.caption || props.captionTop,
17338
+ }),
17339
+ props.columns &&
17340
+ h$1(CTableHead, {
17341
+ ...props.tableHeadProps,
17342
+ }, {
17343
+ default: () => h$1(CTableRow, {}, {
17344
+ default: () => [
17345
+ props.columns &&
17346
+ props.columns.map((column) => h$1(CTableHeaderCell, {
17347
+ ...(typeof column === 'object' &&
17348
+ column._props && { ...column._props }),
17349
+ ...(typeof column === 'object' &&
17350
+ column._style && { style: { ...column._style } }),
17351
+ }, {
17352
+ default: () => label(column),
17353
+ })),
17354
+ ],
17355
+ }),
17356
+ }),
17357
+ props.items &&
17358
+ h$1(CTableBody, {}, {
17359
+ default: () => [
17360
+ props.items.map((item) => h$1(CTableRow, {
17361
+ ...(item._props && { ...item._props }),
17362
+ }, {
17363
+ default: () => [
17364
+ rawColumnNames.value.map((colName) => item[colName] &&
17365
+ h$1(CTableDataCell, {
17366
+ ...(item._cellProps &&
17367
+ item._cellProps['all'] && { ...item._cellProps['all'] }),
17368
+ ...(item._cellProps &&
17369
+ item._cellProps[colName] && { ...item._cellProps[colName] }),
17370
+ }, {
17371
+ default: () => item[colName],
17372
+ })),
17373
+ ],
17374
+ })),
17375
+ ],
17376
+ }),
17377
+ slots.default && slots.default(),
17378
+ props.footer &&
17379
+ h$1(CTableFoot, {
17380
+ ...props.tableFootProps,
17381
+ }, {
17382
+ default: () => h$1(CTableRow, {}, {
17383
+ default: () => [
17384
+ props.footer.map((item) => h$1(CTableDataCell, {
17385
+ ...(typeof item === 'object' && item._props && { ...item._props }),
17386
+ }, {
17387
+ default: () => (typeof item === 'object' ? item.label : item),
17388
+ })),
17389
+ ],
17390
+ }),
17391
+ }),
17392
+ ],
17393
+ });
17394
+ return () => [
17395
+ props.responsive
17396
+ ? h$1('div', {
17397
+ class: typeof props.responsive === 'boolean'
17398
+ ? 'table-responsive'
17399
+ : `table-responsive-${props.responsive}`,
17400
+ }, table())
17401
+ : table(),
17402
+ ];
16886
17403
  },
16887
17404
  });
16888
17405
 
@@ -17048,6 +17565,11 @@ const CSmartTableHead = defineComponent({
17048
17565
  default: () => [],
17049
17566
  required: false,
17050
17567
  },
17568
+ items: {
17569
+ type: Array,
17570
+ default: () => [],
17571
+ required: false,
17572
+ },
17051
17573
  selectable: Boolean,
17052
17574
  selectAll: [Boolean, String],
17053
17575
  sorterState: {
@@ -17056,7 +17578,7 @@ const CSmartTableHead = defineComponent({
17056
17578
  require: false,
17057
17579
  },
17058
17580
  },
17059
- emits: ['filterInput', 'filterChange', 'selectAllChecked', 'sortClick'],
17581
+ emits: ['customFilterChange', 'filterInput', 'filterChange', 'selectAllChecked', 'sortClick'],
17060
17582
  setup(props, { slots, emit }) {
17061
17583
  const handleSortClick = (key, index) => {
17062
17584
  emit('sortClick', key, index);
@@ -17103,6 +17625,9 @@ const CSmartTableHead = defineComponent({
17103
17625
  }
17104
17626
  return 0;
17105
17627
  };
17628
+ const getValues = (items, key) => {
17629
+ return items.map((a) => a[key]);
17630
+ };
17106
17631
  const columnSorterIcon = (column) => {
17107
17632
  if (getColumnSorterState(key(column)) === 0) {
17108
17633
  return h$1('span', { class: 'opacity-25 float-end me-1' }, slots.sortingIcon && slots.sortingIcon());
@@ -17115,6 +17640,9 @@ const CSmartTableHead = defineComponent({
17115
17640
  }
17116
17641
  return;
17117
17642
  };
17643
+ const handleOnCustomFilterChange = (key, value) => {
17644
+ emit('customFilterChange', key, value);
17645
+ };
17118
17646
  const handleFilterInput = (key, value) => {
17119
17647
  emit('filterInput', key, value);
17120
17648
  };
@@ -17165,17 +17693,20 @@ const CSmartTableHead = defineComponent({
17165
17693
  ? true
17166
17694
  : typeof column.filter === 'undefined'
17167
17695
  ? true
17168
- : column.filter) &&
17169
- h$1(CFormInput, {
17170
- size: 'sm',
17171
- onInput: (event) => handleFilterInput(key(column), event.target.value),
17172
- onChange: (event) => handleFilterChange(key(column), event.target.value),
17173
- 'aria-label': `column name: '${label(column)}' filter input`,
17174
- ...(props.columnFilterValue &&
17175
- props.columnFilterValue[key(column)] && {
17176
- value: props.columnFilterValue[key(column)],
17177
- }),
17178
- }),
17696
+ : column.filter)
17697
+ ? typeof column !== 'string' && typeof column.filter === 'function'
17698
+ ? column.filter(getValues(props.items, key(column)), (value) => handleOnCustomFilterChange(key(column), value))
17699
+ : h$1(CFormInput, {
17700
+ size: 'sm',
17701
+ onInput: (event) => handleFilterInput(key(column), event.target.value),
17702
+ onChange: (event) => handleFilterChange(key(column), event.target.value),
17703
+ 'aria-label': `column name: '${label(column)}' filter input`,
17704
+ ...(props.columnFilterValue &&
17705
+ props.columnFilterValue[key(column)] && {
17706
+ value: props.columnFilterValue[key(column)],
17707
+ }),
17708
+ })
17709
+ : '',
17179
17710
  })),
17180
17711
  ],
17181
17712
  }),
@@ -17296,7 +17827,7 @@ const CSmartTableItemsPerPageSelector = defineComponent({
17296
17827
  h$1('div', {
17297
17828
  class: 'col-auto',
17298
17829
  }, h$1(CFormSelect, {
17299
- defaultValue: props.itemsPerPage,
17830
+ value: props.itemsPerPage,
17300
17831
  onChange: handleChange,
17301
17832
  }, {
17302
17833
  default: () => props.itemsPerPageOptions &&
@@ -17788,6 +18319,7 @@ const CSmartTable = defineComponent({
17788
18319
  }
17789
18320
  });
17790
18321
  // functions
18322
+ const isLazy = (columnFilter) => columnFilter && typeof columnFilter === 'object' && columnFilter.lazy === true;
17791
18323
  const isSortable = (i) => {
17792
18324
  const isDataColumn = itemsDataColumns.value.includes(rawColumnNames.value[i]);
17793
18325
  let column;
@@ -17859,10 +18391,8 @@ const CSmartTable = defineComponent({
17859
18391
  });
17860
18392
  };
17861
18393
  const columnFilterChange = (colName, value, type) => {
17862
- const isLazy = props.columnFilter &&
17863
- typeof props.columnFilter === 'object' &&
17864
- props.columnFilter.lazy === true;
17865
- if ((isLazy && type === 'input') || (!isLazy && type === 'change')) {
18394
+ const _isLazy = isLazy(props.columnFilter);
18395
+ if ((_isLazy && type === 'input') || (!_isLazy && type === 'change')) {
17866
18396
  return;
17867
18397
  }
17868
18398
  activePage.value = 1;
@@ -17870,10 +18400,8 @@ const CSmartTable = defineComponent({
17870
18400
  emit('columnFilterChange', columnFilterState.value);
17871
18401
  };
17872
18402
  const tableFilterChange = (value, type) => {
17873
- const isLazy = props.columnFilter &&
17874
- typeof props.columnFilter === 'object' &&
17875
- props.columnFilter.lazy === true;
17876
- if ((isLazy && type === 'input') || (!isLazy && type === 'change')) {
18403
+ const _isLazy = isLazy(props.columnFilter);
18404
+ if ((_isLazy && type === 'input') || (!_isLazy && type === 'change')) {
17877
18405
  return;
17878
18406
  }
17879
18407
  activePage.value = 1;
@@ -17898,7 +18426,7 @@ const CSmartTable = defineComponent({
17898
18426
  : genCols.value); //! || el
17899
18427
  const itemsDataColumns = computed(() => rawColumnNames.value.filter((name) => genCols.value.includes(name)));
17900
18428
  // variables
17901
- const columnFiltered = () => {
18429
+ const filteredColumns = computed(() => {
17902
18430
  let _items = items.value;
17903
18431
  if (props.columnFilter &&
17904
18432
  typeof props.columnFilter === 'object' &&
@@ -17906,6 +18434,10 @@ const CSmartTable = defineComponent({
17906
18434
  return _items;
17907
18435
  }
17908
18436
  Object.entries(columnFilterState.value).forEach(([key, value]) => {
18437
+ if (value instanceof Function) {
18438
+ _items = _items.filter((item) => value(item[key]));
18439
+ return;
18440
+ }
17909
18441
  const columnFilter = String(value).toLowerCase();
17910
18442
  if (columnFilter && itemsDataColumns.value.includes(key)) {
17911
18443
  _items = _items.filter((item) => {
@@ -17914,9 +18446,9 @@ const CSmartTable = defineComponent({
17914
18446
  }
17915
18447
  });
17916
18448
  return _items;
17917
- };
17918
- const tableFiltered = computed(() => {
17919
- let items = columnFiltered();
18449
+ });
18450
+ const filteredTable = computed(() => {
18451
+ let items = filteredColumns.value;
17920
18452
  if (!tableFilterState.value ||
17921
18453
  (props.tableFilter && typeof props.tableFilter === 'object' && props.tableFilter.external)) {
17922
18454
  return items;
@@ -17936,12 +18468,12 @@ const CSmartTable = defineComponent({
17936
18468
  (props.columnSorter &&
17937
18469
  typeof props.columnSorter === 'object' &&
17938
18470
  props.columnSorter.external)) {
17939
- return tableFiltered.value;
18471
+ return filteredTable.value;
17940
18472
  }
17941
18473
  //if values in column are to be sorted by numeric value they all have to be type number
17942
18474
  // const flip = sorterState.asc ? 1 : -1
17943
18475
  const flip = sorterState.state === 'asc' ? 1 : sorterState.state === 'desc' ? -1 : 0;
17944
- const sorted = tableFiltered.value.slice().sort((item, item2) => {
18476
+ const sorted = filteredTable.value.slice().sort((item, item2) => {
17945
18477
  const value = item[col];
17946
18478
  const value2 = item2[col];
17947
18479
  const a = typeof value === 'number' ? value : String(value).toLowerCase();
@@ -18004,9 +18536,11 @@ const CSmartTable = defineComponent({
18004
18536
  columnFilterValue: columnFilterState.value,
18005
18537
  columns: props.columns ? props.columns : rawColumnNames.value,
18006
18538
  columnSorter: props.columnSorter,
18539
+ items: items.value,
18007
18540
  selectable: props.selectable,
18008
18541
  selectAll: selectedAll.value,
18009
18542
  sorterState: sorterState,
18543
+ onCustomFilterChange: (key, value) => columnFilterChange(key, value),
18010
18544
  onFilterInput: (key, value) => columnFilterChange(key, value, 'input'),
18011
18545
  onFilterChange: (key, value) => columnFilterChange(key, value, 'change'),
18012
18546
  onSelectAllChecked: () => handleSelectAllChecked(),
@@ -18066,8 +18600,6 @@ const CSmartTable = defineComponent({
18066
18600
  columns: props.columns ? props.columns : rawColumnNames.value,
18067
18601
  selectable: props.selectable,
18068
18602
  selectAll: selectedAll.value,
18069
- onFilterInput: (key, value) => columnFilterChange(key, value, 'input'),
18070
- onFilterChange: (key, value) => columnFilterChange(key, value, 'change'),
18071
18603
  onSelectAllChecked: () => handleSelectAllChecked(),
18072
18604
  }),
18073
18605
  ],