@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.js CHANGED
@@ -1163,6 +1163,29 @@ const CCalendar = vue.defineComponent({
1163
1163
  type: Number,
1164
1164
  default: 1,
1165
1165
  },
1166
+ /**
1167
+ * Set the format of day name.
1168
+ *
1169
+ * @default 'numeric'
1170
+ * @since 4.6.0
1171
+ */
1172
+ dayFormat: {
1173
+ type: [Function, String],
1174
+ default: 'numeric',
1175
+ required: false,
1176
+ validator: (value) => {
1177
+ if (typeof value === 'string') {
1178
+ return ['numeric', '2-digit'].includes(value);
1179
+ }
1180
+ if (typeof value === 'function') {
1181
+ return true;
1182
+ }
1183
+ if (typeof value === 'function') {
1184
+ return true;
1185
+ }
1186
+ return false;
1187
+ },
1188
+ },
1166
1189
  /**
1167
1190
  * Specify the list of dates that cannot be selected.
1168
1191
  */
@@ -1215,6 +1238,12 @@ const CCalendar = vue.defineComponent({
1215
1238
  type: Boolean,
1216
1239
  default: true,
1217
1240
  },
1241
+ /**
1242
+ * Reorder year-month navigation, and render year first.
1243
+ *
1244
+ * @since 4.6.0
1245
+ */
1246
+ navYearFirst: Boolean,
1218
1247
  /**
1219
1248
  * Allow range selection.
1220
1249
  */
@@ -1235,7 +1264,7 @@ const CCalendar = vue.defineComponent({
1235
1264
  * @type number | 'long' | 'narrow' | 'short'
1236
1265
  */
1237
1266
  weekdayFormat: {
1238
- type: [Number, String],
1267
+ type: [Function, Number, String],
1239
1268
  default: 2,
1240
1269
  validator: (value) => {
1241
1270
  if (typeof value === 'string') {
@@ -1244,6 +1273,9 @@ const CCalendar = vue.defineComponent({
1244
1273
  if (typeof value === 'number') {
1245
1274
  return true;
1246
1275
  }
1276
+ if (typeof value === 'function') {
1277
+ return true;
1278
+ }
1247
1279
  return false;
1248
1280
  },
1249
1281
  },
@@ -1419,11 +1451,15 @@ const CCalendar = vue.defineComponent({
1419
1451
  vue.h('thead', {}, vue.h('tr', {}, weekDays.map(({ date }) => {
1420
1452
  return vue.h('th', { class: 'calendar-cell' }, vue.h('div', {
1421
1453
  class: 'calendar-header-cell-inner',
1422
- }, props.weekdayFormat === 'string'
1423
- ? date.toLocaleDateString(props.locale, { weekday: props.weekdayFormat })
1424
- : date
1425
- .toLocaleDateString(props.locale, { weekday: 'long' })
1426
- .slice(0, props.weekdayFormat)));
1454
+ }, typeof props.weekdayFormat === 'function'
1455
+ ? props.weekdayFormat(date)
1456
+ : typeof props.weekdayFormat === 'string'
1457
+ ? date.toLocaleDateString(props.locale, {
1458
+ weekday: props.weekdayFormat,
1459
+ })
1460
+ : date
1461
+ .toLocaleDateString(props.locale, { weekday: 'long' })
1462
+ .slice(0, props.weekdayFormat)));
1427
1463
  }))),
1428
1464
  vue.h('tbody', {}, [
1429
1465
  view.value === 'days' &&
@@ -1456,7 +1492,11 @@ const CCalendar = vue.defineComponent({
1456
1492
  }),
1457
1493
  }, vue.h('div', {
1458
1494
  class: 'calendar-cell-inner',
1459
- }, date.toLocaleDateString(props.locale, { day: 'numeric' })));
1495
+ }, typeof props.dayFormat === 'function'
1496
+ ? props.dayFormat(date)
1497
+ : date.toLocaleDateString(props.locale, {
1498
+ day: props.dayFormat,
1499
+ })));
1460
1500
  }));
1461
1501
  }),
1462
1502
  view.value === 'months' &&
@@ -1524,6 +1564,7 @@ const CCalendar = vue.defineComponent({
1524
1564
  ]),
1525
1565
  vue.h('div', {
1526
1566
  class: 'calendar-nav-date',
1567
+ ...(props.navYearFirst && { style: { display: 'flex', justifyContent: 'center' } }),
1527
1568
  }, [
1528
1569
  view.value === 'days' &&
1529
1570
  vue.h(CButton, {
@@ -1541,6 +1582,7 @@ const CCalendar = vue.defineComponent({
1541
1582
  if (props.navigation)
1542
1583
  view.value = 'years';
1543
1584
  },
1585
+ ...(props.navYearFirst && { style: { order: '-1' } }),
1544
1586
  }, () => date.toLocaleDateString(props.locale, { year: 'numeric' })),
1545
1587
  ]),
1546
1588
  props.navigation &&
@@ -12069,6 +12111,34 @@ const CTimePicker = vue.defineComponent({
12069
12111
  return ['ghost', 'outline'].includes(value);
12070
12112
  },
12071
12113
  },
12114
+ /**
12115
+ * Provide valuable, actionable feedback.
12116
+ *
12117
+ * @since 4.6.0
12118
+ */
12119
+ feedback: {
12120
+ type: String,
12121
+ },
12122
+ /**
12123
+ * Provide valuable, actionable feedback.
12124
+ *
12125
+ * @since 4.6.0
12126
+ */
12127
+ feedbackInvalid: {
12128
+ type: String,
12129
+ },
12130
+ /**
12131
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
12132
+ *
12133
+ * @since 4.6.0
12134
+ */
12135
+ feedbackValid: {
12136
+ type: String,
12137
+ },
12138
+ /**
12139
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
12140
+ */
12141
+ id: String,
12072
12142
  /**
12073
12143
  * Toggle visibility or set the content of the input indicator.
12074
12144
  */
@@ -12080,6 +12150,20 @@ const CTimePicker = vue.defineComponent({
12080
12150
  * Toggle the readonly state for the component.
12081
12151
  */
12082
12152
  inputReadOnly: Boolean,
12153
+ /**
12154
+ * Set component validation state to invalid.
12155
+ *
12156
+ * @since 4.6.0
12157
+ */
12158
+ invalid: Boolean,
12159
+ /**
12160
+ * Add a caption for a component.
12161
+ *
12162
+ * @since 4.6.0
12163
+ */
12164
+ label: {
12165
+ type: String,
12166
+ },
12083
12167
  /**
12084
12168
  * Sets the default locale for components. If not set, it is inherited from the navigator.language.
12085
12169
  */
@@ -12106,12 +12190,32 @@ const CTimePicker = vue.defineComponent({
12106
12190
  return ['sm', 'lg'].includes(value);
12107
12191
  },
12108
12192
  },
12193
+ /**
12194
+ * Add helper text to the component.
12195
+ *
12196
+ * @since 4.6.0
12197
+ */
12198
+ text: {
12199
+ type: String,
12200
+ },
12109
12201
  /**
12110
12202
  * Initial selected time.
12111
12203
  */
12112
12204
  time: {
12113
12205
  type: [Date, String],
12114
12206
  },
12207
+ /**
12208
+ * Display validation feedback in a styled tooltip.
12209
+ *
12210
+ * @since 4.6.0
12211
+ */
12212
+ tooltipFeedback: Boolean,
12213
+ /**
12214
+ * Set component validation state to valid.
12215
+ *
12216
+ * @since 4.6.0
12217
+ */
12218
+ valid: Boolean,
12115
12219
  /**
12116
12220
  * Set the time picker variant to a roll or select.
12117
12221
  *
@@ -12139,7 +12243,7 @@ const CTimePicker = vue.defineComponent({
12139
12243
  */
12140
12244
  'show',
12141
12245
  ],
12142
- setup(props, { emit, slots }) {
12246
+ setup(props, { emit, attrs, slots }) {
12143
12247
  const date = vue.ref(convertTimeToDate(props.time));
12144
12248
  const initialDate = vue.ref(null);
12145
12249
  const ampm = vue.ref(date.value ? getAmPm(new Date(date.value), props.locale) : 'am');
@@ -12279,49 +12383,62 @@ const CTimePicker = vue.defineComponent({
12279
12383
  selected: ampm.value,
12280
12384
  }),
12281
12385
  ];
12282
- return () => vue.h(CPicker, {
12283
- cancelButton: props.cancelButton,
12284
- cancelButtonColor: props.cancelButtonColor,
12285
- cancelButtonSize: props.cancelButtonSize,
12286
- cancelButtonVariant: props.cancelButtonVariant,
12287
- class: 'time-picker',
12288
- confirmButton: props.confirmButton,
12289
- confirmButtonColor: props.confirmButtonColor,
12290
- confirmButtonSize: props.confirmButtonSize,
12291
- confirmButtonVariant: props.confirmButtonVariant,
12292
- container: props.container,
12293
- disabled: props.disabled,
12294
- footer: true,
12295
- onCancel: () => {
12296
- if (initialDate.value) {
12297
- date.value = new Date(initialDate.value);
12298
- }
12299
- },
12300
- onHide: () => {
12301
- emit('hide');
12302
- },
12303
- onShow: () => {
12304
- if (date.value) {
12305
- initialDate.value = new Date(date.value);
12306
- }
12307
- emit('show');
12308
- },
12386
+ return () => vue.h(CFormControlWrapper, {
12387
+ describedby: attrs['aria-describedby'],
12388
+ feedback: props.feedback,
12389
+ feedbackInvalid: props.feedbackInvalid,
12390
+ feedbackValid: props.feedbackValid,
12391
+ id: props.id,
12392
+ invalid: props.invalid,
12393
+ label: props.label,
12394
+ text: props.text,
12395
+ tooltipFeedback: props.tooltipFeedback,
12396
+ valid: props.valid,
12309
12397
  }, {
12310
- ...(slots.cancelButton && {
12311
- cancelButton: () => slots.cancelButton && slots.cancelButton(),
12312
- }),
12313
- ...(slots.confirmButton && {
12314
- confirmButton: () => slots.confirmButton && slots.confirmButton(),
12398
+ default: () => vue.h(CPicker, {
12399
+ cancelButton: props.cancelButton,
12400
+ cancelButtonColor: props.cancelButtonColor,
12401
+ cancelButtonSize: props.cancelButtonSize,
12402
+ cancelButtonVariant: props.cancelButtonVariant,
12403
+ class: ['time-picker', { 'is-invalid': props.invalid, 'is-valid': props.valid }],
12404
+ confirmButton: props.confirmButton,
12405
+ confirmButtonColor: props.confirmButtonColor,
12406
+ confirmButtonSize: props.confirmButtonSize,
12407
+ confirmButtonVariant: props.confirmButtonVariant,
12408
+ container: props.container,
12409
+ disabled: props.disabled,
12410
+ footer: true,
12411
+ onCancel: () => {
12412
+ if (initialDate.value) {
12413
+ date.value = new Date(initialDate.value);
12414
+ }
12415
+ },
12416
+ onHide: () => {
12417
+ emit('hide');
12418
+ },
12419
+ onShow: () => {
12420
+ if (date.value) {
12421
+ initialDate.value = new Date(date.value);
12422
+ }
12423
+ emit('show');
12424
+ },
12425
+ }, {
12426
+ ...(slots.cancelButton && {
12427
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
12428
+ }),
12429
+ ...(slots.confirmButton && {
12430
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
12431
+ }),
12432
+ toggler: () => InputGroup(),
12433
+ default: () => vue.h('div', {
12434
+ class: [
12435
+ 'time-picker-body',
12436
+ {
12437
+ ['time-picker-roll']: props.variant === 'roll',
12438
+ },
12439
+ ],
12440
+ }, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
12315
12441
  }),
12316
- toggler: () => InputGroup(),
12317
- default: () => vue.h('div', {
12318
- class: [
12319
- 'time-picker-body',
12320
- {
12321
- ['time-picker-roll']: props.variant === 'roll',
12322
- },
12323
- ],
12324
- }, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
12325
12442
  });
12326
12443
  },
12327
12444
  });
@@ -12434,6 +12551,29 @@ const CDateRangePicker = vue.defineComponent({
12434
12551
  return ['ghost', 'outline'].includes(value);
12435
12552
  },
12436
12553
  },
12554
+ /**
12555
+ * Set the format of day name.
12556
+ *
12557
+ * @default 'numeric'
12558
+ * @since 4.6.0
12559
+ */
12560
+ dayFormat: {
12561
+ type: [Function, String],
12562
+ default: 'numeric',
12563
+ required: false,
12564
+ validator: (value) => {
12565
+ if (typeof value === 'string') {
12566
+ return ['numeric', '2-digit'].includes(value);
12567
+ }
12568
+ if (typeof value === 'function') {
12569
+ return true;
12570
+ }
12571
+ if (typeof value === 'function') {
12572
+ return true;
12573
+ }
12574
+ return false;
12575
+ },
12576
+ },
12437
12577
  /**
12438
12578
  * Toggle the disabled state for the component.
12439
12579
  */
@@ -12451,6 +12591,30 @@ const CDateRangePicker = vue.defineComponent({
12451
12591
  type: [Date, String],
12452
12592
  required: false,
12453
12593
  },
12594
+ /**
12595
+ * Provide valuable, actionable feedback.
12596
+ *
12597
+ * @since 4.6.0
12598
+ */
12599
+ feedback: {
12600
+ type: String,
12601
+ },
12602
+ /**
12603
+ * Provide valuable, actionable feedback.
12604
+ *
12605
+ * @since 4.6.0
12606
+ */
12607
+ feedbackInvalid: {
12608
+ type: String,
12609
+ },
12610
+ /**
12611
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
12612
+ *
12613
+ * @since 4.6.0
12614
+ */
12615
+ feedbackValid: {
12616
+ type: String,
12617
+ },
12454
12618
  /**
12455
12619
  * Sets the day of start week.
12456
12620
  * - 0 - Sunday,
@@ -12493,6 +12657,20 @@ const CDateRangePicker = vue.defineComponent({
12493
12657
  * Toggle the readonly state for the component.
12494
12658
  */
12495
12659
  inputReadOnly: Boolean,
12660
+ /**
12661
+ * Set component validation state to invalid.
12662
+ *
12663
+ * @since 4.6.0
12664
+ */
12665
+ invalid: Boolean,
12666
+ /**
12667
+ * Add a caption for a component.
12668
+ *
12669
+ * @since 4.6.0
12670
+ */
12671
+ label: {
12672
+ type: String,
12673
+ },
12496
12674
  /**
12497
12675
  * Sets the default locale for components. If not set, it is inherited from the navigator.language.
12498
12676
  */
@@ -12519,6 +12697,12 @@ const CDateRangePicker = vue.defineComponent({
12519
12697
  type: Boolean,
12520
12698
  default: true,
12521
12699
  },
12700
+ /**
12701
+ * Reorder year-month navigation, and render year first.
12702
+ *
12703
+ * @since 4.6.0
12704
+ */
12705
+ navYearFirst: Boolean,
12522
12706
  /**
12523
12707
  * Specifies a short hint that is visible in the input.
12524
12708
  */
@@ -12566,6 +12750,14 @@ const CDateRangePicker = vue.defineComponent({
12566
12750
  startDate: {
12567
12751
  type: [Date, String],
12568
12752
  },
12753
+ /**
12754
+ * Add helper text to the component.
12755
+ *
12756
+ * @since 4.6.0
12757
+ */
12758
+ text: {
12759
+ type: String,
12760
+ },
12569
12761
  /**
12570
12762
  * Provide an additional time selection by adding select boxes to choose times.
12571
12763
  */
@@ -12609,13 +12801,25 @@ const CDateRangePicker = vue.defineComponent({
12609
12801
  return ['ghost', 'outline'].includes(value);
12610
12802
  },
12611
12803
  },
12804
+ /**
12805
+ * Display validation feedback in a styled tooltip.
12806
+ *
12807
+ * @since 4.6.0
12808
+ */
12809
+ tooltipFeedback: Boolean,
12810
+ /**
12811
+ * Set component validation state to valid.
12812
+ *
12813
+ * @since 4.6.0
12814
+ */
12815
+ valid: Boolean,
12612
12816
  /**
12613
12817
  * Set length or format of day name.
12614
12818
  *
12615
12819
  * @type number | 'long' | 'narrow' | 'short'
12616
12820
  */
12617
12821
  weekdayFormat: {
12618
- type: [Number, String],
12822
+ type: [Function, Number, String],
12619
12823
  default: 2,
12620
12824
  validator: (value) => {
12621
12825
  if (typeof value === 'string') {
@@ -12624,6 +12828,9 @@ const CDateRangePicker = vue.defineComponent({
12624
12828
  if (typeof value === 'number') {
12625
12829
  return true;
12626
12830
  }
12831
+ if (typeof value === 'function') {
12832
+ return true;
12833
+ }
12627
12834
  return false;
12628
12835
  },
12629
12836
  },
@@ -12652,7 +12859,7 @@ const CDateRangePicker = vue.defineComponent({
12652
12859
  */
12653
12860
  'start-date-change',
12654
12861
  ],
12655
- setup(props, { slots, emit }) {
12862
+ setup(props, { slots, attrs, emit }) {
12656
12863
  const calendarDate = vue.ref(props.calendarDate
12657
12864
  ? new Date(props.calendarDate)
12658
12865
  : props.startDate
@@ -12819,147 +13026,164 @@ const CDateRangePicker = vue.defineComponent({
12819
13026
  : vue.h('span', { class: 'picker-input-group-icon date-picker-cleaner-icon' })),
12820
13027
  ]),
12821
13028
  ]);
12822
- return () => vue.h(CPicker, {
12823
- cancelButton: props.cancelButton,
12824
- cancelButtonColor: props.cancelButtonColor,
12825
- cancelButtonSize: props.cancelButtonSize,
12826
- cancelButtonVariant: props.cancelButtonVariant,
12827
- class: 'date-picker',
12828
- confirmButton: props.confirmButton,
12829
- confirmButtonColor: props.confirmButtonColor,
12830
- confirmButtonSize: props.confirmButtonSize,
12831
- confirmButtonVariant: props.confirmButtonVariant,
12832
- disabled: props.disabled,
12833
- footer: props.footer || props.timepicker,
13029
+ return () => vue.h(CFormControlWrapper, {
13030
+ describedby: attrs['aria-describedby'],
13031
+ feedback: props.feedback,
13032
+ feedbackInvalid: props.feedbackInvalid,
13033
+ feedbackValid: props.feedbackValid,
12834
13034
  id: props.id,
12835
- onCancel: () => {
12836
- startDate.value = initialStartDate.value;
12837
- endDate.value = initialEndDate.value;
12838
- },
12839
- onHide: () => {
12840
- emit('hide');
12841
- },
12842
- onShow: () => {
12843
- if (startDate.value) {
12844
- initialStartDate.value = new Date(startDate.value);
12845
- }
12846
- if (endDate.value) {
12847
- initialEndDate.value = new Date(endDate.value);
12848
- }
12849
- emit('show');
12850
- },
13035
+ invalid: props.invalid,
13036
+ label: props.label,
13037
+ text: props.text,
13038
+ tooltipFeedback: props.tooltipFeedback,
13039
+ valid: props.valid,
12851
13040
  }, {
12852
- ...(slots.cancelButton && {
12853
- cancelButton: () => slots.cancelButton && slots.cancelButton(),
12854
- }),
12855
- ...(slots.confirmButton && {
12856
- confirmButton: () => slots.confirmButton && slots.confirmButton(),
12857
- }),
12858
- toggler: () => InputGroup(),
12859
- footer: () => vue.h(CButton, {
12860
- class: 'me-auto',
12861
- color: props.todayButtonColor,
12862
- size: props.todayButtonSize,
12863
- variant: props.todayButtonVariant,
12864
- onClick: () => {
12865
- const date = new Date();
12866
- startDate.value = date;
12867
- endDate.value = date;
12868
- calendarDate.value = date;
13041
+ default: () => vue.h(CPicker, {
13042
+ cancelButton: props.cancelButton,
13043
+ cancelButtonColor: props.cancelButtonColor,
13044
+ cancelButtonSize: props.cancelButtonSize,
13045
+ cancelButtonVariant: props.cancelButtonVariant,
13046
+ class: ['date-picker', { 'is-invalid': props.invalid, 'is-valid': props.valid }],
13047
+ confirmButton: props.confirmButton,
13048
+ confirmButtonColor: props.confirmButtonColor,
13049
+ confirmButtonSize: props.confirmButtonSize,
13050
+ confirmButtonVariant: props.confirmButtonVariant,
13051
+ disabled: props.disabled,
13052
+ footer: props.footer || props.timepicker,
13053
+ id: props.id,
13054
+ onCancel: () => {
13055
+ startDate.value = initialStartDate.value;
13056
+ endDate.value = initialEndDate.value;
12869
13057
  },
12870
- }, () => props.todayButton),
12871
- default: () => vue.h('div', {
12872
- class: 'date-picker-body',
12873
- }, [
12874
- props.ranges &&
12875
- vue.h('div', { class: 'date-picker-ranges' }, Object.keys(props.ranges).map((key) => vue.h(CButton, {
12876
- color: 'secondary',
12877
- onClick: () => {
12878
- if (props.ranges) {
12879
- startDate.value = props.ranges[key][0];
12880
- endDate.value = props.ranges[key][1];
12881
- }
12882
- },
12883
- variant: 'ghost',
12884
- }, () => key))),
12885
- vue.h('div', { class: 'date-picker-calendars' }, vue.h(CCalendar, {
12886
- calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), 1),
12887
- calendars: props.calendars,
12888
- disabledDates: props.disabledDates,
12889
- ...(endDate.value && { endDate: endDate.value }),
12890
- firstDayOfWeek: props.firstDayOfWeek,
12891
- locale: props.locale,
12892
- maxDate: maxDate.value,
12893
- minDate: minDate.value,
12894
- navigation: props.navigation,
12895
- range: props.range,
12896
- selectEndDate: selectEndDate.value,
12897
- ...(startDate.value && { startDate: startDate.value }),
12898
- onCalendarCellHover: (date) => handleCalendarCellHover(date),
12899
- onCalendarDateChange: (date) => handleCalendarDateChange(date),
12900
- onStartDateChange: (date) => handleStartDateChange(date),
12901
- onEndDateChange: (date) => handleEndDateChange(date),
12902
- }, {
12903
- /**
12904
- * @slot Location for next icon.
12905
- */
12906
- ...(slots.navNextIcon && {
12907
- navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
12908
- }),
12909
- /**
12910
- * @slot Location for next double icon.
12911
- */
12912
- ...(slots.navNextDoubleIcon && {
12913
- navNextDoubleIcon: () => slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
12914
- }),
12915
- /**
12916
- * @slot Location for previous icon.
12917
- */
12918
- ...(slots.navPrevIcon && {
12919
- navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
12920
- }),
12921
- /**
12922
- * @slot Location for double previous icon.
12923
- */
12924
- ...(slots.navPrevDoubleIcon && {
12925
- navPrevDoubleIcon: () => slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
12926
- }),
12927
- })),
12928
- props.timepicker &&
12929
- vue.h('div', { class: 'date-picker-timepickers' }, isMobile.value || (props.range && props.calendars === 1)
12930
- ? [
12931
- vue.h(CTimePicker, {
12932
- container: 'inline',
12933
- disabled: startDate.value === null ? true : false,
12934
- locale: props.locale,
12935
- onChange: (_, __, date) => handleStartDateChange(date),
12936
- time: startDate.value,
12937
- variant: 'select',
12938
- }),
12939
- vue.h(CTimePicker, {
13058
+ onHide: () => {
13059
+ emit('hide');
13060
+ },
13061
+ onShow: () => {
13062
+ if (startDate.value) {
13063
+ initialStartDate.value = new Date(startDate.value);
13064
+ }
13065
+ if (endDate.value) {
13066
+ initialEndDate.value = new Date(endDate.value);
13067
+ }
13068
+ emit('show');
13069
+ },
13070
+ }, {
13071
+ ...(slots.cancelButton && {
13072
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
13073
+ }),
13074
+ ...(slots.confirmButton && {
13075
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
13076
+ }),
13077
+ toggler: () => InputGroup(),
13078
+ footer: () => vue.h(CButton, {
13079
+ class: 'me-auto',
13080
+ color: props.todayButtonColor,
13081
+ size: props.todayButtonSize,
13082
+ variant: props.todayButtonVariant,
13083
+ onClick: () => {
13084
+ const date = new Date();
13085
+ startDate.value = date;
13086
+ endDate.value = date;
13087
+ calendarDate.value = date;
13088
+ },
13089
+ }, () => props.todayButton),
13090
+ default: () => vue.h('div', {
13091
+ class: 'date-picker-body',
13092
+ }, [
13093
+ props.ranges &&
13094
+ vue.h('div', { class: 'date-picker-ranges' }, Object.keys(props.ranges).map((key) => vue.h(CButton, {
13095
+ color: 'secondary',
13096
+ onClick: () => {
13097
+ if (props.ranges) {
13098
+ startDate.value = props.ranges[key][0];
13099
+ endDate.value = props.ranges[key][1];
13100
+ }
13101
+ },
13102
+ variant: 'ghost',
13103
+ }, () => key))),
13104
+ vue.h('div', { class: 'date-picker-calendars' }, vue.h(CCalendar, {
13105
+ calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), 1),
13106
+ calendars: props.calendars,
13107
+ dayFormat: props.dayFormat,
13108
+ disabledDates: props.disabledDates,
13109
+ ...(endDate.value && { endDate: endDate.value }),
13110
+ firstDayOfWeek: props.firstDayOfWeek,
13111
+ locale: props.locale,
13112
+ maxDate: maxDate.value,
13113
+ minDate: minDate.value,
13114
+ navYearFirst: props.navYearFirst,
13115
+ navigation: props.navigation,
13116
+ range: props.range,
13117
+ selectEndDate: selectEndDate.value,
13118
+ ...(startDate.value && { startDate: startDate.value }),
13119
+ onCalendarCellHover: (date) => handleCalendarCellHover(date),
13120
+ onCalendarDateChange: (date) => handleCalendarDateChange(date),
13121
+ onStartDateChange: (date) => handleStartDateChange(date),
13122
+ onEndDateChange: (date) => handleEndDateChange(date),
13123
+ }, {
13124
+ /**
13125
+ * @slot Location for next icon.
13126
+ */
13127
+ ...(slots.navNextIcon && {
13128
+ navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
13129
+ }),
13130
+ /**
13131
+ * @slot Location for next double icon.
13132
+ */
13133
+ ...(slots.navNextDoubleIcon && {
13134
+ navNextDoubleIcon: () => slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
13135
+ }),
13136
+ /**
13137
+ * @slot Location for previous icon.
13138
+ */
13139
+ ...(slots.navPrevIcon && {
13140
+ navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
13141
+ }),
13142
+ /**
13143
+ * @slot Location for double previous icon.
13144
+ */
13145
+ ...(slots.navPrevDoubleIcon && {
13146
+ navPrevDoubleIcon: () => slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
13147
+ }),
13148
+ })),
13149
+ props.timepicker &&
13150
+ vue.h('div', { class: 'date-picker-timepickers' }, isMobile.value || (props.range && props.calendars === 1)
13151
+ ? [
13152
+ vue.h(CTimePicker, {
13153
+ container: 'inline',
13154
+ disabled: startDate.value === null ? true : false,
13155
+ locale: props.locale,
13156
+ onChange: (_, __, date) => handleStartDateChange(date),
13157
+ time: startDate.value,
13158
+ variant: 'select',
13159
+ }),
13160
+ vue.h(CTimePicker, {
13161
+ container: 'inline',
13162
+ disabled: endDate.value === null ? true : false,
13163
+ locale: props.locale,
13164
+ onChange: (_, __, date) => handleEndDateChange(date),
13165
+ time: endDate.value,
13166
+ variant: 'select',
13167
+ }),
13168
+ ]
13169
+ : [...Array(props.calendars)].map((_, index) => vue.h(CTimePicker, {
12940
13170
  container: 'inline',
12941
- disabled: endDate.value === null ? true : false,
13171
+ disabled: index === 0
13172
+ ? startDate.value === null
13173
+ ? true
13174
+ : false
13175
+ : endDate.value === null
13176
+ ? true
13177
+ : false,
12942
13178
  locale: props.locale,
12943
- onChange: (_, __, date) => handleEndDateChange(date),
12944
- time: endDate.value,
13179
+ onChange: (_, __, date) => index === 0
13180
+ ? handleStartDateChange(date)
13181
+ : handleEndDateChange(date),
13182
+ time: index === 0 ? startDate.value : endDate.value,
12945
13183
  variant: 'select',
12946
- }),
12947
- ]
12948
- : [...Array(props.calendars)].map((_, index) => vue.h(CTimePicker, {
12949
- container: 'inline',
12950
- disabled: index === 0
12951
- ? startDate.value === null
12952
- ? true
12953
- : false
12954
- : endDate.value === null
12955
- ? true
12956
- : false,
12957
- locale: props.locale,
12958
- onChange: (_, __, date) => index === 0 ? handleStartDateChange(date) : handleEndDateChange(date),
12959
- time: index === 0 ? startDate.value : endDate.value,
12960
- variant: 'select',
12961
- }))),
12962
- ]),
13184
+ }))),
13185
+ ]),
13186
+ }),
12963
13187
  });
12964
13188
  },
12965
13189
  });
@@ -13065,6 +13289,29 @@ const CDatePicker = vue.defineComponent({
13065
13289
  return ['ghost', 'outline'].includes(value);
13066
13290
  },
13067
13291
  },
13292
+ /**
13293
+ * Set the format of day name.
13294
+ *
13295
+ * @default 'numeric'
13296
+ * @since 4.6.0
13297
+ */
13298
+ dayFormat: {
13299
+ type: [Function, String],
13300
+ default: 'numeric',
13301
+ required: false,
13302
+ validator: (value) => {
13303
+ if (typeof value === 'string') {
13304
+ return ['numeric', '2-digit'].includes(value);
13305
+ }
13306
+ if (typeof value === 'function') {
13307
+ return true;
13308
+ }
13309
+ if (typeof value === 'function') {
13310
+ return true;
13311
+ }
13312
+ return false;
13313
+ },
13314
+ },
13068
13315
  /**
13069
13316
  * Toggle the disabled state for the component.
13070
13317
  */
@@ -13149,6 +13396,12 @@ const CDatePicker = vue.defineComponent({
13149
13396
  type: Boolean,
13150
13397
  default: true,
13151
13398
  },
13399
+ /**
13400
+ * Reorder year-month navigation, and render year first.
13401
+ *
13402
+ * @since 4.6.0
13403
+ */
13404
+ navYearFirst: Boolean,
13152
13405
  /**
13153
13406
  * Specifies a short hint that is visible in the input.
13154
13407
  */
@@ -13178,7 +13431,7 @@ const CDatePicker = vue.defineComponent({
13178
13431
  * @type number | 'long' | 'narrow' | 'short'
13179
13432
  */
13180
13433
  weekdayFormat: {
13181
- type: [Number, String],
13434
+ type: [Function, Number, String],
13182
13435
  default: 2,
13183
13436
  validator: (value) => {
13184
13437
  if (typeof value === 'string') {
@@ -13187,6 +13440,9 @@ const CDatePicker = vue.defineComponent({
13187
13440
  if (typeof value === 'number') {
13188
13441
  return true;
13189
13442
  }
13443
+ if (typeof value === 'function') {
13444
+ return true;
13445
+ }
13190
13446
  return false;
13191
13447
  },
13192
13448
  },
@@ -14585,6 +14841,50 @@ const CMultiSelect = vue.defineComponent({
14585
14841
  required: false,
14586
14842
  default: false,
14587
14843
  },
14844
+ /**
14845
+ * Provide valuable, actionable feedback.
14846
+ *
14847
+ * @since 4.6.0
14848
+ */
14849
+ feedback: {
14850
+ type: String,
14851
+ },
14852
+ /**
14853
+ * Provide valuable, actionable feedback.
14854
+ *
14855
+ * @since 4.6.0
14856
+ */
14857
+ feedbackInvalid: {
14858
+ type: String,
14859
+ },
14860
+ /**
14861
+ * Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
14862
+ *
14863
+ * @since 4.6.0
14864
+ */
14865
+ feedbackValid: {
14866
+ type: String,
14867
+ },
14868
+ /**
14869
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
14870
+ */
14871
+ id: {
14872
+ type: String,
14873
+ },
14874
+ /**
14875
+ * Set component validation state to invalid.
14876
+ *
14877
+ * @since 4.6.0
14878
+ */
14879
+ invalid: Boolean,
14880
+ /**
14881
+ * Add a caption for a component.
14882
+ *
14883
+ * @since 4.6.0
14884
+ */
14885
+ label: {
14886
+ type: String,
14887
+ },
14588
14888
  /**
14589
14889
  * It specifies that multiple options can be selected at once.
14590
14890
  *
@@ -14709,6 +15009,26 @@ const CMultiSelect = vue.defineComponent({
14709
15009
  return ['sm', 'lg'].includes(value);
14710
15010
  },
14711
15011
  },
15012
+ /**
15013
+ * Add helper text to the component.
15014
+ *
15015
+ * @since 4.6.0
15016
+ */
15017
+ text: {
15018
+ type: String,
15019
+ },
15020
+ /**
15021
+ * Display validation feedback in a styled tooltip.
15022
+ *
15023
+ * @since 4.6.0
15024
+ */
15025
+ tooltipFeedback: Boolean,
15026
+ /**
15027
+ * Set component validation state to valid.
15028
+ *
15029
+ * @since 4.6.0
15030
+ */
15031
+ valid: Boolean,
14712
15032
  /**
14713
15033
  * Toggle the visibility of multi select dropdown.
14714
15034
  *
@@ -14726,7 +15046,7 @@ const CMultiSelect = vue.defineComponent({
14726
15046
  */
14727
15047
  'change',
14728
15048
  ],
14729
- setup(props, { emit }) {
15049
+ setup(props, { attrs, emit }) {
14730
15050
  const flattenArray = (options) => {
14731
15051
  return options.reduce((acc, val) => {
14732
15052
  return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
@@ -14842,6 +15162,13 @@ const CMultiSelect = vue.defineComponent({
14842
15162
  };
14843
15163
  const handleOptionClick = (option) => {
14844
15164
  options.value = updateOptions(option.value);
15165
+ if (!props.multiple) {
15166
+ visible.value = false;
15167
+ search.value = '';
15168
+ if (searchRef.value) {
15169
+ searchRef.value.value = '';
15170
+ }
15171
+ }
14845
15172
  };
14846
15173
  const handleSelectAll = () => {
14847
15174
  options.value = toggleAllOptions(options.value, true);
@@ -14858,75 +15185,96 @@ const CMultiSelect = vue.defineComponent({
14858
15185
  : selected.value.map((option) => option.value)[0],
14859
15186
  onChange: () => emit('change', selected.value),
14860
15187
  }),
14861
- vue.h(CPicker, {
14862
- class: [
14863
- 'form-multi-select',
14864
- {
14865
- 'form-multi-select-with-cleaner': props.cleaner,
14866
- disabled: props.disabled,
14867
- [`form-multi-select-${props.size}`]: props.size,
14868
- 'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
14869
- show: visible.value,
14870
- },
14871
- ],
14872
- disabled: props.disabled,
14873
- onShow: () => {
14874
- props.search && searchRef.value && searchRef.value.focus();
14875
- },
15188
+ vue.h(CFormControlWrapper, {
15189
+ describedby: attrs['aria-describedby'],
15190
+ feedback: props.feedback,
15191
+ feedbackInvalid: props.feedbackInvalid,
15192
+ feedbackValid: props.feedbackValid,
15193
+ id: props.id,
15194
+ invalid: props.invalid,
15195
+ label: props.label,
15196
+ text: props.text,
15197
+ tooltipFeedback: props.tooltipFeedback,
15198
+ valid: props.valid,
14876
15199
  }, {
14877
- toggler: () => vue.h('div', {}, [
14878
- vue.h(CMultiSelectSelection, {
14879
- multiple: props.multiple,
14880
- onRemove: (option) => !props.disabled && handleOptionClick(option),
14881
- search: props.search,
14882
- selected: selected.value,
14883
- selectionType: props.selectionType,
14884
- selectionTypeCounterText: props.selectionTypeCounterText,
14885
- }),
14886
- props.multiple &&
14887
- props.cleaner &&
14888
- selected.value.length > 0 &&
14889
- !props.disabled &&
14890
- vue.h('button', {
14891
- type: 'button',
14892
- class: 'form-multi-select-selection-cleaner',
14893
- onClick: () => handleDeselectAll(),
15200
+ default: () => vue.h(CPicker, {
15201
+ class: [
15202
+ 'form-multi-select',
15203
+ {
15204
+ 'form-multi-select-with-cleaner': props.cleaner,
15205
+ disabled: props.disabled,
15206
+ [`form-multi-select-${props.size}`]: props.size,
15207
+ 'form-multi-select-selection-tags': props.multiple && props.selectionType === 'tags',
15208
+ show: visible.value,
15209
+ 'is-invalid': props.invalid,
15210
+ 'is-valid': props.valid,
15211
+ },
15212
+ ],
15213
+ disabled: props.disabled,
15214
+ id: props.id,
15215
+ onHide: () => {
15216
+ visible.value = false;
15217
+ },
15218
+ onShow: () => {
15219
+ props.search && searchRef.value && searchRef.value.focus();
15220
+ visible.value = true;
15221
+ },
15222
+ visible: visible.value,
15223
+ }, {
15224
+ toggler: () => vue.h('div', {}, [
15225
+ vue.h(CMultiSelectSelection, {
15226
+ multiple: props.multiple,
15227
+ onRemove: (option) => !props.disabled && handleOptionClick(option),
15228
+ search: props.search,
15229
+ selected: selected.value,
15230
+ selectionType: props.selectionType,
15231
+ selectionTypeCounterText: props.selectionTypeCounterText,
14894
15232
  }),
14895
- props.search &&
14896
- vue.h('input', {
14897
- type: 'text',
14898
- class: 'form-multi-select-search',
14899
- autocomplete: 'off',
14900
- ...(selected.value.length === 0 && { placeholder: props.placeholder }),
14901
- ...(selected.value.length &&
14902
- props.selectionType === 'counter' && {
14903
- placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
15233
+ props.multiple &&
15234
+ props.cleaner &&
15235
+ selected.value.length > 0 &&
15236
+ !props.disabled &&
15237
+ vue.h('button', {
15238
+ type: 'button',
15239
+ class: 'form-multi-select-selection-cleaner',
15240
+ onClick: () => handleDeselectAll(),
14904
15241
  }),
14905
- ...(selected.value.length &&
14906
- !props.multiple && {
14907
- placeholder: selected.value.map((option) => option.text)[0],
15242
+ props.search &&
15243
+ vue.h('input', {
15244
+ type: 'text',
15245
+ class: 'form-multi-select-search',
15246
+ autocomplete: 'off',
15247
+ ...(selected.value.length === 0 && { placeholder: props.placeholder }),
15248
+ ...(selected.value.length &&
15249
+ props.selectionType === 'counter' && {
15250
+ placeholder: `${selected.value.length} ${props.selectionTypeCounterText}`,
15251
+ }),
15252
+ ...(selected.value.length &&
15253
+ !props.multiple && {
15254
+ placeholder: selected.value.map((option) => option.text)[0],
15255
+ }),
15256
+ disabled: props.disabled,
15257
+ onInput: (event) => handleSearchChange(event),
15258
+ onKeydown: (event) => handleSearchKeyDown(event),
15259
+ ...(props.multiple &&
15260
+ selected.value.length &&
15261
+ props.selectionType !== 'counter' && { size: search.value.length + 2 }),
15262
+ ref: searchRef,
14908
15263
  }),
14909
- disabled: props.disabled,
14910
- onInput: (event) => handleSearchChange(event),
14911
- onKeydown: (event) => handleSearchKeyDown(event),
14912
- ...(props.multiple &&
14913
- selected.value.length &&
14914
- props.selectionType !== 'counter' && { size: search.value.length + 2 }),
14915
- ref: searchRef,
15264
+ ]),
15265
+ default: () => vue.h('div', {}, [
15266
+ props.multiple &&
15267
+ props.selectAll &&
15268
+ vue.h('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
15269
+ vue.h(CMultiSelectOptions, {
15270
+ onOptionClick: (option) => handleOptionClick(option),
15271
+ options: vOptions.value,
15272
+ optionsMaxHeight: props.optionsMaxHeight,
15273
+ optionsStyle: props.optionsStyle,
15274
+ searchNoResultsLabel: props.searchNoResultsLabel,
14916
15275
  }),
14917
- ]),
14918
- default: () => vue.h('div', {}, [
14919
- props.multiple &&
14920
- props.selectAll &&
14921
- vue.h('button', { class: 'form-multi-select-all', onClick: () => handleSelectAll() }, props.selectAllLabel),
14922
- vue.h(CMultiSelectOptions, {
14923
- onOptionClick: (option) => handleOptionClick(option),
14924
- options: vOptions.value,
14925
- optionsMaxHeight: props.optionsMaxHeight,
14926
- optionsStyle: props.optionsStyle,
14927
- searchNoResultsLabel: props.searchNoResultsLabel,
14928
- }),
14929
- ]),
15276
+ ]),
15277
+ }),
14930
15278
  }),
14931
15279
  ];
14932
15280
  },