@coreui/vue-pro 5.3.0 → 5.4.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/README.md +1 -1
- package/dist/cjs/components/calendar/CCalendar.d.ts +76 -0
- package/dist/cjs/components/calendar/CCalendar.js +57 -5
- package/dist/cjs/components/calendar/CCalendar.js.map +1 -1
- package/dist/cjs/components/calendar/utils.js +1 -3
- package/dist/cjs/components/calendar/utils.js.map +1 -1
- package/dist/cjs/components/conditional-teleport/CConditionalTeleport.d.ts +2 -2
- package/dist/cjs/components/conditional-teleport/CConditionalTeleport.js +1 -1
- package/dist/cjs/components/date-picker/CDatePicker.d.ts +82 -6
- package/dist/cjs/components/date-picker/CDatePicker.js +39 -3
- package/dist/cjs/components/date-picker/CDatePicker.js.map +1 -1
- package/dist/cjs/components/date-range-picker/CDateRangePicker.d.ts +82 -6
- package/dist/cjs/components/date-range-picker/CDateRangePicker.js +43 -3
- package/dist/cjs/components/date-range-picker/CDateRangePicker.js.map +1 -1
- package/dist/cjs/components/dropdown/CDropdown.d.ts +4 -4
- package/dist/cjs/components/dropdown/CDropdown.js +2 -2
- package/dist/cjs/components/dropdown/CDropdownToggle.d.ts +2 -2
- package/dist/cjs/components/dropdown/CDropdownToggle.js +1 -1
- package/dist/cjs/components/header/CHeader.d.ts +17 -1
- package/dist/cjs/components/header/CHeader.js +8 -1
- package/dist/cjs/components/header/CHeader.js.map +1 -1
- package/dist/cjs/components/modal/CModal.d.ts +43 -5
- package/dist/cjs/components/modal/CModal.js +41 -17
- package/dist/cjs/components/modal/CModal.js.map +1 -1
- package/dist/cjs/components/popover/CPopover.d.ts +2 -2
- package/dist/cjs/components/popover/CPopover.js +1 -1
- package/dist/cjs/components/time-picker/CTimePicker.js +1 -1
- package/dist/cjs/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/cjs/components/tooltip/CTooltip.js +1 -1
- package/dist/esm/components/calendar/CCalendar.d.ts +76 -0
- package/dist/esm/components/calendar/CCalendar.js +58 -6
- package/dist/esm/components/calendar/CCalendar.js.map +1 -1
- package/dist/esm/components/calendar/utils.js +1 -3
- package/dist/esm/components/calendar/utils.js.map +1 -1
- package/dist/esm/components/conditional-teleport/CConditionalTeleport.d.ts +2 -2
- package/dist/esm/components/conditional-teleport/CConditionalTeleport.js +1 -1
- package/dist/esm/components/date-picker/CDatePicker.d.ts +82 -6
- package/dist/esm/components/date-picker/CDatePicker.js +39 -3
- package/dist/esm/components/date-picker/CDatePicker.js.map +1 -1
- package/dist/esm/components/date-range-picker/CDateRangePicker.d.ts +82 -6
- package/dist/esm/components/date-range-picker/CDateRangePicker.js +43 -3
- package/dist/esm/components/date-range-picker/CDateRangePicker.js.map +1 -1
- package/dist/esm/components/dropdown/CDropdown.d.ts +4 -4
- package/dist/esm/components/dropdown/CDropdown.js +2 -2
- package/dist/esm/components/dropdown/CDropdownToggle.d.ts +2 -2
- package/dist/esm/components/dropdown/CDropdownToggle.js +1 -1
- package/dist/esm/components/header/CHeader.d.ts +17 -1
- package/dist/esm/components/header/CHeader.js +8 -1
- package/dist/esm/components/header/CHeader.js.map +1 -1
- package/dist/esm/components/modal/CModal.d.ts +43 -5
- package/dist/esm/components/modal/CModal.js +41 -17
- package/dist/esm/components/modal/CModal.js.map +1 -1
- package/dist/esm/components/popover/CPopover.d.ts +2 -2
- package/dist/esm/components/popover/CPopover.js +1 -1
- package/dist/esm/components/time-picker/CTimePicker.js +1 -1
- package/dist/esm/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/esm/components/tooltip/CTooltip.js +1 -1
- package/package.json +5 -5
- package/src/components/calendar/CCalendar.ts +57 -5
- package/src/components/calendar/utils.ts +1 -4
- package/src/components/conditional-teleport/CConditionalTeleport.ts +1 -1
- package/src/components/date-picker/CDatePicker.ts +39 -3
- package/src/components/date-range-picker/CDateRangePicker.ts +43 -3
- package/src/components/dropdown/CDropdown.ts +2 -2
- package/src/components/dropdown/CDropdownToggle.ts +1 -1
- package/src/components/header/CHeader.ts +8 -1
- package/src/components/header/__tests__/CHeader.spec.ts +19 -0
- package/src/components/modal/CModal.ts +49 -19
- package/src/components/popover/CPopover.ts +1 -1
- package/src/components/time-picker/CTimePicker.ts +1 -1
- package/src/components/tooltip/CTooltip.ts +1 -1
|
@@ -21,6 +21,42 @@ import {
|
|
|
21
21
|
const CCalendar = defineComponent({
|
|
22
22
|
name: 'CCalendar',
|
|
23
23
|
props: {
|
|
24
|
+
/**
|
|
25
|
+
* A string that provides an accessible label for the button that navigates to the next month in the calendar. This label is read by screen readers to describe the action associated with the button.
|
|
26
|
+
*
|
|
27
|
+
* @since 5.4.0
|
|
28
|
+
*/
|
|
29
|
+
ariaNavNextMonthLabel: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'Next month',
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* A string that provides an accessible label for the button that navigates to the next year in the calendar. This label is intended for screen readers to help users understand the button's functionality.
|
|
35
|
+
*
|
|
36
|
+
* @since 5.4.0
|
|
37
|
+
*/
|
|
38
|
+
ariaNavNextYearLabel: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'Next year',
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* A string that provides an accessible label for the button that navigates to the previous month in the calendar. Screen readers will use this label to explain the purpose of the button.
|
|
44
|
+
*
|
|
45
|
+
* @since 5.4.0
|
|
46
|
+
*/
|
|
47
|
+
ariaNavPrevMonthLabel: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'Previous month',
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* A string that provides an accessible label for the button that navigates to the previous year in the calendar. This label helps screen reader users understand the button's function.
|
|
53
|
+
*
|
|
54
|
+
* @since 5.4.0
|
|
55
|
+
*/
|
|
56
|
+
ariaNavPrevYearLabel: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'Previous year',
|
|
59
|
+
},
|
|
24
60
|
/**
|
|
25
61
|
* Default date of the component
|
|
26
62
|
*/
|
|
@@ -599,7 +635,10 @@ const CCalendar = defineComponent({
|
|
|
599
635
|
weekDays.map(({ date }: { date: Date }) => {
|
|
600
636
|
return h(
|
|
601
637
|
'th',
|
|
602
|
-
{
|
|
638
|
+
{
|
|
639
|
+
class: 'calendar-cell',
|
|
640
|
+
abbr: date.toLocaleDateString(props.locale, { weekday: 'long' }),
|
|
641
|
+
},
|
|
603
642
|
h(
|
|
604
643
|
'div',
|
|
605
644
|
{
|
|
@@ -634,6 +673,7 @@ const CCalendar = defineComponent({
|
|
|
634
673
|
maxDate.value,
|
|
635
674
|
props.disabledDates,
|
|
636
675
|
)
|
|
676
|
+
const isSelected = isDateSelected(date, startDate.value, endDate.value)
|
|
637
677
|
const current = week.days.some((day) => day.month === 'current')
|
|
638
678
|
return h(
|
|
639
679
|
'tr',
|
|
@@ -649,10 +689,11 @@ const CCalendar = defineComponent({
|
|
|
649
689
|
props.selectionType === 'week' && hoverDate.value && selectEndDate.value
|
|
650
690
|
? isDateInRange(date, startDate.value, hoverDate.value)
|
|
651
691
|
: isDateInRange(date, hoverDate.value, endDate.value),
|
|
652
|
-
selected:
|
|
692
|
+
selected: isSelected,
|
|
653
693
|
},
|
|
654
694
|
],
|
|
655
695
|
tabindex: props.selectionType === 'week' && current && !isDisabled ? 0 : -1,
|
|
696
|
+
...(isSelected && { 'aria-selected': true }),
|
|
656
697
|
...(props.selectionType === 'week' &&
|
|
657
698
|
!isDisabled && {
|
|
658
699
|
onBlur: () => handleCalendarMouseLeave(),
|
|
@@ -677,6 +718,7 @@ const CCalendar = defineComponent({
|
|
|
677
718
|
maxDate.value,
|
|
678
719
|
props.disabledDates,
|
|
679
720
|
)
|
|
721
|
+
const isSelected = isDateSelected(date, startDate.value, endDate.value)
|
|
680
722
|
return month === 'current' || props.showAdjacementDays
|
|
681
723
|
? h(
|
|
682
724
|
'td',
|
|
@@ -695,7 +737,7 @@ const CCalendar = defineComponent({
|
|
|
695
737
|
range:
|
|
696
738
|
month === 'current' &&
|
|
697
739
|
isDateInRange(date, startDate.value, endDate.value),
|
|
698
|
-
selected:
|
|
740
|
+
selected: isSelected,
|
|
699
741
|
}),
|
|
700
742
|
[month]: true,
|
|
701
743
|
today: month === 'current' && isToday(date),
|
|
@@ -708,6 +750,7 @@ const CCalendar = defineComponent({
|
|
|
708
750
|
? 0
|
|
709
751
|
: -1,
|
|
710
752
|
title: date.toLocaleDateString(props.locale),
|
|
753
|
+
...(isSelected && { 'aria-selected': true }),
|
|
711
754
|
...(props.selectionType === 'day' &&
|
|
712
755
|
(month === 'current' || props.selectAdjacementDays) && {
|
|
713
756
|
onBlur: () => handleCalendarMouseLeave(),
|
|
@@ -754,6 +797,7 @@ const CCalendar = defineComponent({
|
|
|
754
797
|
maxDate.value,
|
|
755
798
|
props.disabledDates,
|
|
756
799
|
)
|
|
800
|
+
const isSelected = isDateSelected(date, startDate.value, endDate.value)
|
|
757
801
|
return h(
|
|
758
802
|
'td',
|
|
759
803
|
{
|
|
@@ -761,7 +805,7 @@ const CCalendar = defineComponent({
|
|
|
761
805
|
'calendar-cell',
|
|
762
806
|
{
|
|
763
807
|
disabled: isDisabled,
|
|
764
|
-
selected:
|
|
808
|
+
selected: isSelected,
|
|
765
809
|
'range-hover':
|
|
766
810
|
props.selectionType === 'month' &&
|
|
767
811
|
(hoverDate.value && selectEndDate
|
|
@@ -771,6 +815,7 @@ const CCalendar = defineComponent({
|
|
|
771
815
|
},
|
|
772
816
|
],
|
|
773
817
|
tabindex: isDisabled ? -1 : 0,
|
|
818
|
+
...(isSelected && { 'aria-selected': true }),
|
|
774
819
|
...(!isDisabled && {
|
|
775
820
|
onBlur: () => handleCalendarMouseLeave(),
|
|
776
821
|
onClick: () => handleCalendarClick(date),
|
|
@@ -798,6 +843,7 @@ const CCalendar = defineComponent({
|
|
|
798
843
|
maxDate.value,
|
|
799
844
|
props.disabledDates,
|
|
800
845
|
)
|
|
846
|
+
const isSelected = isDateSelected(date, startDate.value, endDate.value)
|
|
801
847
|
return h(
|
|
802
848
|
'td',
|
|
803
849
|
{
|
|
@@ -805,7 +851,7 @@ const CCalendar = defineComponent({
|
|
|
805
851
|
'calendar-cell year',
|
|
806
852
|
{
|
|
807
853
|
disabled: isDisabled,
|
|
808
|
-
selected:
|
|
854
|
+
selected: isSelected,
|
|
809
855
|
'range-hover':
|
|
810
856
|
props.selectionType === 'year' &&
|
|
811
857
|
(hoverDate.value && selectEndDate
|
|
@@ -815,6 +861,7 @@ const CCalendar = defineComponent({
|
|
|
815
861
|
},
|
|
816
862
|
],
|
|
817
863
|
tabindex: isDisabled ? -1 : 0,
|
|
864
|
+
...(isSelected && { 'aria-selected': true }),
|
|
818
865
|
...(!isDisabled && {
|
|
819
866
|
onBlur: () => handleCalendarMouseLeave(),
|
|
820
867
|
onClick: () => handleCalendarClick(date),
|
|
@@ -847,6 +894,7 @@ const CCalendar = defineComponent({
|
|
|
847
894
|
{
|
|
848
895
|
color: 'transparent',
|
|
849
896
|
size: 'sm',
|
|
897
|
+
'aria-label': props.ariaNavPrevYearLabel,
|
|
850
898
|
onClick: () => handleNavigationOnClick('prev', true),
|
|
851
899
|
},
|
|
852
900
|
{
|
|
@@ -865,6 +913,7 @@ const CCalendar = defineComponent({
|
|
|
865
913
|
{
|
|
866
914
|
color: 'transparent',
|
|
867
915
|
size: 'sm',
|
|
916
|
+
'aria-label': props.ariaNavPrevMonthLabel,
|
|
868
917
|
onClick: () => handleNavigationOnClick('prev'),
|
|
869
918
|
},
|
|
870
919
|
{
|
|
@@ -883,6 +932,7 @@ const CCalendar = defineComponent({
|
|
|
883
932
|
'div',
|
|
884
933
|
{
|
|
885
934
|
class: 'calendar-nav-date',
|
|
935
|
+
'aria-live': 'polite',
|
|
886
936
|
...(props.navYearFirst && { style: { display: 'flex', justifyContent: 'center' } }),
|
|
887
937
|
},
|
|
888
938
|
[
|
|
@@ -925,6 +975,7 @@ const CCalendar = defineComponent({
|
|
|
925
975
|
{
|
|
926
976
|
color: 'transparent',
|
|
927
977
|
size: 'sm',
|
|
978
|
+
'aria-label': props.ariaNavNextMonthLabel,
|
|
928
979
|
onClick: () => handleNavigationOnClick('next'),
|
|
929
980
|
},
|
|
930
981
|
{
|
|
@@ -942,6 +993,7 @@ const CCalendar = defineComponent({
|
|
|
942
993
|
{
|
|
943
994
|
color: 'transparent',
|
|
944
995
|
size: 'sm',
|
|
996
|
+
'aria-label': props.ariaNavNextYearLabel,
|
|
945
997
|
onClick: () => handleNavigationOnClick('next', true),
|
|
946
998
|
},
|
|
947
999
|
{
|
|
@@ -19,10 +19,7 @@ export const convertToDateObject = (
|
|
|
19
19
|
return convertIsoWeekToDate(date as string)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
const userTimezoneOffset = _date.getTimezoneOffset() * 60_000
|
|
24
|
-
|
|
25
|
-
return new Date(_date.getTime() + userTimezoneOffset)
|
|
22
|
+
return new Date(Date.parse(date))
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
export const convertToLocalDate = (d: Date, locale: string, options = {}) =>
|
|
@@ -16,7 +16,7 @@ const CConditionalTeleport = defineComponent({
|
|
|
16
16
|
/**
|
|
17
17
|
* An HTML element or function that returns a single element, with `document.body` as the default.
|
|
18
18
|
*
|
|
19
|
-
* @since
|
|
19
|
+
* @since 5.0.0
|
|
20
20
|
*/
|
|
21
21
|
container: {
|
|
22
22
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|
|
@@ -7,6 +7,42 @@ import { Color } from '../props'
|
|
|
7
7
|
const CDatePicker = defineComponent({
|
|
8
8
|
name: 'CDatePicker',
|
|
9
9
|
props: {
|
|
10
|
+
/**
|
|
11
|
+
* A string that provides an accessible label for the button that navigates to the next month in the calendar. This label is read by screen readers to describe the action associated with the button.
|
|
12
|
+
*
|
|
13
|
+
* @since 5.4.0
|
|
14
|
+
*/
|
|
15
|
+
ariaNavNextMonthLabel: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: 'Next month',
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* A string that provides an accessible label for the button that navigates to the next year in the calendar. This label is intended for screen readers to help users understand the button's functionality.
|
|
21
|
+
*
|
|
22
|
+
* @since 5.4.0
|
|
23
|
+
*/
|
|
24
|
+
ariaNavNextYearLabel: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: 'Next year',
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* A string that provides an accessible label for the button that navigates to the previous month in the calendar. Screen readers will use this label to explain the purpose of the button.
|
|
30
|
+
*
|
|
31
|
+
* @since 5.4.0
|
|
32
|
+
*/
|
|
33
|
+
ariaNavPrevMonthLabel: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'Previous month',
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* A string that provides an accessible label for the button that navigates to the previous year in the calendar. This label helps screen reader users understand the button's function.
|
|
39
|
+
*
|
|
40
|
+
* @since 5.4.0
|
|
41
|
+
*/
|
|
42
|
+
ariaNavPrevYearLabel: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'Previous year',
|
|
45
|
+
},
|
|
10
46
|
/**
|
|
11
47
|
* Default date of the component
|
|
12
48
|
*/
|
|
@@ -183,19 +219,19 @@ const CDatePicker = defineComponent({
|
|
|
183
219
|
/**
|
|
184
220
|
* Custom function to format the selected date into a string according to a custom format.
|
|
185
221
|
*
|
|
186
|
-
* @since
|
|
222
|
+
* @since 5.0.0
|
|
187
223
|
*/
|
|
188
224
|
inputDateFormat: Function,
|
|
189
225
|
/**
|
|
190
226
|
* Custom function to parse the input value into a valid Date object.
|
|
191
227
|
*
|
|
192
|
-
* @since
|
|
228
|
+
* @since 5.0.0
|
|
193
229
|
*/
|
|
194
230
|
inputDateParse: Function,
|
|
195
231
|
/**
|
|
196
232
|
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
197
233
|
*
|
|
198
|
-
* @since
|
|
234
|
+
* @since 5.0.0
|
|
199
235
|
*/
|
|
200
236
|
inputOnChangeDelay: {
|
|
201
237
|
type: Number,
|
|
@@ -14,6 +14,42 @@ import { Color } from '../props'
|
|
|
14
14
|
const CDateRangePicker = defineComponent({
|
|
15
15
|
name: 'CDateRangePicker',
|
|
16
16
|
props: {
|
|
17
|
+
/**
|
|
18
|
+
* A string that provides an accessible label for the button that navigates to the next month in the calendar. This label is read by screen readers to describe the action associated with the button.
|
|
19
|
+
*
|
|
20
|
+
* @since 5.4.0
|
|
21
|
+
*/
|
|
22
|
+
ariaNavNextMonthLabel: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'Next month',
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* A string that provides an accessible label for the button that navigates to the next year in the calendar. This label is intended for screen readers to help users understand the button's functionality.
|
|
28
|
+
*
|
|
29
|
+
* @since 5.4.0
|
|
30
|
+
*/
|
|
31
|
+
ariaNavNextYearLabel: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'Next year',
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* A string that provides an accessible label for the button that navigates to the previous month in the calendar. Screen readers will use this label to explain the purpose of the button.
|
|
37
|
+
*
|
|
38
|
+
* @since 5.4.0
|
|
39
|
+
*/
|
|
40
|
+
ariaNavPrevMonthLabel: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'Previous month',
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* A string that provides an accessible label for the button that navigates to the previous year in the calendar. This label helps screen reader users understand the button's function.
|
|
46
|
+
*
|
|
47
|
+
* @since 5.4.0
|
|
48
|
+
*/
|
|
49
|
+
ariaNavPrevYearLabel: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'Previous year',
|
|
52
|
+
},
|
|
17
53
|
/**
|
|
18
54
|
* The number of calendars that render on desktop devices.
|
|
19
55
|
*/
|
|
@@ -216,19 +252,19 @@ const CDateRangePicker = defineComponent({
|
|
|
216
252
|
/**
|
|
217
253
|
* Custom function to format the selected date into a string according to a custom format.
|
|
218
254
|
*
|
|
219
|
-
* @since
|
|
255
|
+
* @since 5.0.0
|
|
220
256
|
*/
|
|
221
257
|
inputDateFormat: Function,
|
|
222
258
|
/**
|
|
223
259
|
* Custom function to parse the input value into a valid Date object.
|
|
224
260
|
*
|
|
225
|
-
* @since
|
|
261
|
+
* @since 5.0.0
|
|
226
262
|
*/
|
|
227
263
|
inputDateParse: Function,
|
|
228
264
|
/**
|
|
229
265
|
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
230
266
|
*
|
|
231
|
-
* @since
|
|
267
|
+
* @since 5.0.0
|
|
232
268
|
*/
|
|
233
269
|
inputOnChangeDelay: {
|
|
234
270
|
type: Number,
|
|
@@ -924,6 +960,10 @@ const CDateRangePicker = defineComponent({
|
|
|
924
960
|
h(
|
|
925
961
|
CCalendar,
|
|
926
962
|
{
|
|
963
|
+
ariaNavNextMonthLabel: props.ariaNavNextMonthLabel,
|
|
964
|
+
ariaNavNextYearLabel: props.ariaNavNextYearLabel,
|
|
965
|
+
ariaNavPrevMonthLabel: props.ariaNavPrevMonthLabel,
|
|
966
|
+
ariaNavPrevYearLabel: props.ariaNavPrevYearLabel,
|
|
927
967
|
calendarDate: calendarDate.value,
|
|
928
968
|
calendars: isMobile.value ? 1 : props.calendars,
|
|
929
969
|
class: 'date-picker-calendars',
|
|
@@ -62,7 +62,7 @@ const CDropdown = defineComponent({
|
|
|
62
62
|
/**
|
|
63
63
|
* Appends the vue dropdown menu to a specific element. You can pass an HTML element or function that returns a single element. By default `document.body`.
|
|
64
64
|
*
|
|
65
|
-
* @since
|
|
65
|
+
* @since 5.0.0
|
|
66
66
|
*/
|
|
67
67
|
container: {
|
|
68
68
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|
|
@@ -115,7 +115,7 @@ const CDropdown = defineComponent({
|
|
|
115
115
|
/**
|
|
116
116
|
* Generates dropdown menu using Teleport.
|
|
117
117
|
*
|
|
118
|
-
* @since
|
|
118
|
+
* @since 5.0.0
|
|
119
119
|
*/
|
|
120
120
|
teleport: {
|
|
121
121
|
type: Boolean,
|
|
@@ -3,6 +3,13 @@ import { defineComponent, h } from 'vue'
|
|
|
3
3
|
const CHeader = defineComponent({
|
|
4
4
|
name: 'CHeader',
|
|
5
5
|
props: {
|
|
6
|
+
/**
|
|
7
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
8
|
+
*/
|
|
9
|
+
as: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'div',
|
|
12
|
+
},
|
|
6
13
|
/**
|
|
7
14
|
* Defines optional container wrapping children elements.
|
|
8
15
|
*
|
|
@@ -31,7 +38,7 @@ const CHeader = defineComponent({
|
|
|
31
38
|
setup(props, { slots }) {
|
|
32
39
|
return () =>
|
|
33
40
|
h(
|
|
34
|
-
|
|
41
|
+
props.as,
|
|
35
42
|
{ class: ['header', { [`header-${props.position}`]: props.position }] },
|
|
36
43
|
props.container
|
|
37
44
|
? h(
|
|
@@ -20,6 +20,15 @@ const customWrapper = mount(Component, {
|
|
|
20
20
|
},
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
+
const customWrapperTwo = mount(Component, {
|
|
24
|
+
propsData: {
|
|
25
|
+
as: 'header',
|
|
26
|
+
},
|
|
27
|
+
slots: {
|
|
28
|
+
default: 'Default slot',
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
23
32
|
describe(`Loads and display ${ComponentName} component`, () => {
|
|
24
33
|
it('has a name', () => {
|
|
25
34
|
expect(Component.name).toMatch(ComponentName)
|
|
@@ -44,3 +53,13 @@ describe(`Customize ${ComponentName} component`, () => {
|
|
|
44
53
|
expect(customWrapper.find('.container-lg').classes('container-lg')).toBe(true)
|
|
45
54
|
})
|
|
46
55
|
})
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
describe(`Customize (number two) ${ComponentName} component`, () => {
|
|
59
|
+
it('renders correctly', () => {
|
|
60
|
+
expect(customWrapperTwo.html()).toMatchSnapshot()
|
|
61
|
+
})
|
|
62
|
+
it('tag name is custom', () => {
|
|
63
|
+
expect(customWrapperTwo.element.tagName).toBe('HEADER')
|
|
64
|
+
})
|
|
65
|
+
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineComponent,
|
|
3
3
|
h,
|
|
4
|
+
PropType,
|
|
4
5
|
provide,
|
|
5
6
|
ref,
|
|
6
7
|
RendererElement,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
} from 'vue'
|
|
12
13
|
|
|
13
14
|
import { CBackdrop } from '../backdrop/CBackdrop'
|
|
15
|
+
import { CConditionalTeleport } from '../conditional-teleport'
|
|
14
16
|
|
|
15
17
|
import { executeAfterTransition } from '../../utils/transition'
|
|
16
18
|
|
|
@@ -47,6 +49,15 @@ const CModal = defineComponent({
|
|
|
47
49
|
return false
|
|
48
50
|
},
|
|
49
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* Appends the vue popover to a specific element. You can pass an HTML element or function that returns a single element. By default `document.body`.
|
|
54
|
+
*
|
|
55
|
+
* @since 5.3.0
|
|
56
|
+
*/
|
|
57
|
+
container: {
|
|
58
|
+
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|
|
59
|
+
default: 'body',
|
|
60
|
+
},
|
|
50
61
|
/**
|
|
51
62
|
* A string of all className you want applied to the modal content component.
|
|
52
63
|
*/
|
|
@@ -54,7 +65,7 @@ const CModal = defineComponent({
|
|
|
54
65
|
/**
|
|
55
66
|
* Puts the focus on the modal when shown.
|
|
56
67
|
*
|
|
57
|
-
* @since
|
|
68
|
+
* @since 5.0.0
|
|
58
69
|
*/
|
|
59
70
|
focus: {
|
|
60
71
|
type: Boolean,
|
|
@@ -99,6 +110,15 @@ const CModal = defineComponent({
|
|
|
99
110
|
return ['sm', 'lg', 'xl'].includes(value)
|
|
100
111
|
},
|
|
101
112
|
},
|
|
113
|
+
/**
|
|
114
|
+
* Generates modal using Teleport.
|
|
115
|
+
*
|
|
116
|
+
* @since 5.3.0
|
|
117
|
+
*/
|
|
118
|
+
teleport: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
102
122
|
/**
|
|
103
123
|
* Remove animation to create modal that simply appear rather than fade in to view.
|
|
104
124
|
*/
|
|
@@ -264,27 +284,37 @@ const CModal = defineComponent({
|
|
|
264
284
|
),
|
|
265
285
|
)
|
|
266
286
|
|
|
267
|
-
return () =>
|
|
287
|
+
return () =>
|
|
268
288
|
h(
|
|
269
|
-
|
|
289
|
+
CConditionalTeleport,
|
|
270
290
|
{
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
onAfterEnter: () => handleAfterEnter(),
|
|
274
|
-
onLeave: (el, done) => handleLeave(el, done),
|
|
275
|
-
onAfterLeave: (el) => handleAfterLeave(el),
|
|
291
|
+
container: props.container,
|
|
292
|
+
teleport: props.teleport,
|
|
276
293
|
},
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
294
|
+
{
|
|
295
|
+
default: () => [
|
|
296
|
+
h(
|
|
297
|
+
Transition,
|
|
298
|
+
{
|
|
299
|
+
css: false,
|
|
300
|
+
onEnter: (el, done) => handleEnter(el, done),
|
|
301
|
+
onAfterEnter: () => handleAfterEnter(),
|
|
302
|
+
onLeave: (el, done) => handleLeave(el, done),
|
|
303
|
+
onAfterLeave: (el) => handleAfterLeave(el),
|
|
304
|
+
},
|
|
305
|
+
() =>
|
|
306
|
+
props.unmountOnClose
|
|
307
|
+
? visible.value && modal()
|
|
308
|
+
: withDirectives(modal(), [[vShow, visible.value]]),
|
|
309
|
+
),
|
|
310
|
+
props.backdrop &&
|
|
311
|
+
h(CBackdrop, {
|
|
312
|
+
class: 'modal-backdrop',
|
|
313
|
+
visible: visible.value,
|
|
314
|
+
}),
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
)
|
|
288
318
|
},
|
|
289
319
|
})
|
|
290
320
|
|
|
@@ -23,7 +23,7 @@ const CPopover = defineComponent({
|
|
|
23
23
|
/**
|
|
24
24
|
* Appends the vue popover to a specific element. You can pass an HTML element or function that returns a single element. By default `document.body`.
|
|
25
25
|
*
|
|
26
|
-
* @since
|
|
26
|
+
* @since 5.0.0
|
|
27
27
|
*/
|
|
28
28
|
container: {
|
|
29
29
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|
|
@@ -23,7 +23,7 @@ const CTooltip = defineComponent({
|
|
|
23
23
|
/**
|
|
24
24
|
* Appends the vue tooltip to a specific element. You can pass an HTML element or function that returns a single element. By default `document.body`.
|
|
25
25
|
*
|
|
26
|
-
* @since
|
|
26
|
+
* @since 5.0.0
|
|
27
27
|
*/
|
|
28
28
|
container: {
|
|
29
29
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|