@coreui/vue-pro 4.5.0 → 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.
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 &&
@@ -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,147 +13022,164 @@ 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
- ]),
13180
+ }))),
13181
+ ]),
13182
+ }),
12959
13183
  });
12960
13184
  },
12961
13185
  });
@@ -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
  },
@@ -14581,6 +14837,50 @@ const CMultiSelect = defineComponent({
14581
14837
  required: false,
14582
14838
  default: false,
14583
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
+ },
14584
14884
  /**
14585
14885
  * It specifies that multiple options can be selected at once.
14586
14886
  *
@@ -14705,6 +15005,26 @@ const CMultiSelect = defineComponent({
14705
15005
  return ['sm', 'lg'].includes(value);
14706
15006
  },
14707
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,
14708
15028
  /**
14709
15029
  * Toggle the visibility of multi select dropdown.
14710
15030
  *
@@ -14722,7 +15042,7 @@ const CMultiSelect = defineComponent({
14722
15042
  */
14723
15043
  'change',
14724
15044
  ],
14725
- setup(props, { emit }) {
15045
+ setup(props, { attrs, emit }) {
14726
15046
  const flattenArray = (options) => {
14727
15047
  return options.reduce((acc, val) => {
14728
15048
  return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
@@ -14838,6 +15158,13 @@ const CMultiSelect = defineComponent({
14838
15158
  };
14839
15159
  const handleOptionClick = (option) => {
14840
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
+ }
14841
15168
  };
14842
15169
  const handleSelectAll = () => {
14843
15170
  options.value = toggleAllOptions(options.value, true);
@@ -14854,75 +15181,96 @@ const CMultiSelect = defineComponent({
14854
15181
  : selected.value.map((option) => option.value)[0],
14855
15182
  onChange: () => emit('change', selected.value),
14856
15183
  }),
14857
- h$1(CPicker, {
14858
- class: [
14859
- 'form-multi-select',
14860
- {
14861
- 'form-multi-select-with-cleaner': props.cleaner,
14862
- disabled: props.disabled,
14863
- [`form-multi-select-${props.size}`]: props.size,
14864
- 'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
14865
- show: visible.value,
14866
- },
14867
- ],
14868
- disabled: props.disabled,
14869
- onShow: () => {
14870
- props.search && searchRef.value && searchRef.value.focus();
14871
- },
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,
14872
15195
  }, {
14873
- toggler: () => h$1('div', {}, [
14874
- h$1(CMultiSelectSelection, {
14875
- multiple: props.multiple,
14876
- onRemove: (option) => !props.disabled && handleOptionClick(option),
14877
- search: props.search,
14878
- selected: selected.value,
14879
- selectionType: props.selectionType,
14880
- selectionTypeCounterText: props.selectionTypeCounterText,
14881
- }),
14882
- props.multiple &&
14883
- props.cleaner &&
14884
- selected.value.length > 0 &&
14885
- !props.disabled &&
14886
- h$1('button', {
14887
- type: 'button',
14888
- class: 'form-multi-select-selection-cleaner',
14889
- onClick: () => handleDeselectAll(),
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;
15213
+ },
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,
14890
15228
  }),
14891
- props.search &&
14892
- h$1('input', {
14893
- type: 'text',
14894
- class: 'form-multi-select-search',
14895
- autocomplete: 'off',
14896
- ...(selected.value.length === 0 && { placeholder: props.placeholder }),
14897
- ...(selected.value.length &&
14898
- props.selectionType === 'counter' && {
14899
- placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
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(),
14900
15237
  }),
14901
- ...(selected.value.length &&
14902
- !props.multiple && {
14903
- placeholder: selected.value.map((option) => option.text)[0],
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,
14904
15259
  }),
14905
- disabled: props.disabled,
14906
- onInput: (event) => handleSearchChange(event),
14907
- onKeydown: (event) => handleSearchKeyDown(event),
14908
- ...(props.multiple &&
14909
- selected.value.length &&
14910
- props.selectionType !== 'counter' && { size: search.value.length + 2 }),
14911
- ref: searchRef,
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,
14912
15271
  }),
14913
- ]),
14914
- default: () => h$1('div', {}, [
14915
- props.multiple &&
14916
- props.selectAll &&
14917
- h$1('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
14918
- h$1(CMultiSelectOptions, {
14919
- onOptionClick: (option) => handleOptionClick(option),
14920
- options: vOptions.value,
14921
- optionsMaxHeight: props.optionsMaxHeight,
14922
- optionsStyle: props.optionsStyle,
14923
- searchNoResultsLabel: props.searchNoResultsLabel,
14924
- }),
14925
- ]),
15272
+ ]),
15273
+ }),
14926
15274
  }),
14927
15275
  ];
14928
15276
  },