@coreui/vue-pro 5.0.0-rc.1 → 5.0.0-rc.2
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/accordion/CAccordion.js +1 -0
- package/dist/cjs/components/accordion/CAccordion.js.map +1 -1
- package/dist/cjs/components/badge/CBadge.js +1 -1
- package/dist/cjs/components/badge/CBadge.js.map +1 -1
- package/dist/cjs/components/calendar/CCalendar.d.ts +6 -6
- package/dist/cjs/components/calendar/CCalendar.js +3 -3
- 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 +13 -13
- package/dist/cjs/components/date-picker/CDatePicker.js +6 -6
- package/dist/cjs/components/date-range-picker/CDateRangePicker.d.ts +13 -13
- package/dist/cjs/components/date-range-picker/CDateRangePicker.js +6 -6
- 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/form/CFormCheck.js +1 -1
- package/dist/cjs/components/form/CFormCheck.js.map +1 -1
- package/dist/cjs/components/form/CFormSwitch.js +1 -0
- package/dist/cjs/components/form/CFormSwitch.js.map +1 -1
- package/dist/cjs/components/form/CFormTextarea.js +1 -0
- package/dist/cjs/components/form/CFormTextarea.js.map +1 -1
- package/dist/cjs/components/modal/CModal.d.ts +2 -2
- package/dist/cjs/components/modal/CModal.js +1 -1
- package/dist/cjs/components/offcanvas/COffcanvas.js +4 -1
- package/dist/cjs/components/offcanvas/COffcanvas.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/progress/CProgress.d.ts +2 -2
- package/dist/cjs/components/progress/CProgress.js +1 -1
- package/dist/cjs/components/time-picker/CTimePicker.js +53 -21
- package/dist/cjs/components/time-picker/CTimePicker.js.map +1 -1
- package/dist/cjs/components/time-picker/utils.d.ts +67 -10
- package/dist/cjs/components/time-picker/utils.js +107 -22
- package/dist/cjs/components/time-picker/utils.js.map +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/accordion/CAccordion.js +2 -1
- package/dist/esm/components/accordion/CAccordion.js.map +1 -1
- package/dist/esm/components/badge/CBadge.js +1 -1
- package/dist/esm/components/badge/CBadge.js.map +1 -1
- package/dist/esm/components/calendar/CCalendar.d.ts +6 -6
- package/dist/esm/components/calendar/CCalendar.js +3 -3
- 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 +13 -13
- package/dist/esm/components/date-picker/CDatePicker.js +6 -6
- package/dist/esm/components/date-range-picker/CDateRangePicker.d.ts +13 -13
- package/dist/esm/components/date-range-picker/CDateRangePicker.js +6 -6
- 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/form/CFormCheck.js +1 -1
- package/dist/esm/components/form/CFormCheck.js.map +1 -1
- package/dist/esm/components/form/CFormSwitch.js +1 -0
- package/dist/esm/components/form/CFormSwitch.js.map +1 -1
- package/dist/esm/components/form/CFormTextarea.js +1 -0
- package/dist/esm/components/form/CFormTextarea.js.map +1 -1
- package/dist/esm/components/modal/CModal.d.ts +2 -2
- package/dist/esm/components/modal/CModal.js +1 -1
- package/dist/esm/components/offcanvas/COffcanvas.js +4 -1
- package/dist/esm/components/offcanvas/COffcanvas.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/progress/CProgress.d.ts +2 -2
- package/dist/esm/components/progress/CProgress.js +1 -1
- package/dist/esm/components/time-picker/CTimePicker.js +53 -21
- package/dist/esm/components/time-picker/CTimePicker.js.map +1 -1
- package/dist/esm/components/time-picker/utils.d.ts +67 -10
- package/dist/esm/components/time-picker/utils.js +107 -23
- package/dist/esm/components/time-picker/utils.js.map +1 -1
- package/dist/esm/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/esm/components/tooltip/CTooltip.js +1 -1
- package/package.json +2 -2
- package/src/components/accordion/CAccordion.ts +7 -1
- package/src/components/badge/CBadge.ts +1 -1
- package/src/components/calendar/CCalendar.ts +3 -3
- package/src/components/conditional-teleport/CConditionalTeleport.ts +1 -1
- package/src/components/date-picker/CDatePicker.ts +6 -6
- package/src/components/date-range-picker/CDateRangePicker.ts +6 -6
- package/src/components/dropdown/CDropdown.ts +2 -2
- package/src/components/dropdown/CDropdownToggle.ts +1 -1
- package/src/components/form/CFormCheck.ts +19 -19
- package/src/components/form/CFormSwitch.ts +1 -0
- package/src/components/form/CFormTextarea.ts +1 -0
- package/src/components/modal/CModal.ts +1 -1
- package/src/components/offcanvas/COffcanvas.ts +4 -1
- package/src/components/popover/CPopover.ts +1 -1
- package/src/components/progress/CProgress.ts +1 -1
- package/src/components/time-picker/CTimePicker.ts +79 -36
- package/src/components/time-picker/utils.ts +128 -64
- package/src/components/tooltip/CTooltip.ts +1 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a 12-hour time format to a 24-hour time format.
|
|
3
|
+
* @param {('am' | 'pm')} abbr The abbreviation indicating AM or PM.
|
|
4
|
+
* @param {number} hour The hour to be converted.
|
|
5
|
+
* @returns {number} The hour in 24-hour format.
|
|
6
|
+
*/
|
|
1
7
|
const convert12hTo24h = (abbr, hour) => {
|
|
2
8
|
if (abbr === 'am' && hour === 12) {
|
|
3
9
|
return 0;
|
|
@@ -10,8 +16,24 @@ const convert12hTo24h = (abbr, hour) => {
|
|
|
10
16
|
}
|
|
11
17
|
return hour + 12;
|
|
12
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Converts a 24-hour time format to a 12-hour format.
|
|
21
|
+
* @param {number} hour The hour to be converted.
|
|
22
|
+
* @returns {number} The hour in 12-hour format.
|
|
23
|
+
*/
|
|
13
24
|
const convert24hTo12h = (hour) => hour % 12 || 12;
|
|
14
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Converts a time input into a Date object.
|
|
27
|
+
* @param {Date | string | null | undefined} time The time input to be converted.
|
|
28
|
+
* @returns {Date | null} The converted Date object or null if the input is falsy.
|
|
29
|
+
*/
|
|
30
|
+
const convertTimeToDate = (time) => time ? (time instanceof Date ? time : new Date(`1970-01-01 ${time}`)) : null;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves the AM/PM part of the specified date according to the given locale.
|
|
33
|
+
* @param {Date} date The date from which to extract the AM/PM part.
|
|
34
|
+
* @param {string} locale The locale to use for formatting.
|
|
35
|
+
* @returns {string} 'am' or 'pm' based on the given date and locale.
|
|
36
|
+
*/
|
|
15
37
|
const getAmPm = (date, locale) => {
|
|
16
38
|
if (date.toLocaleTimeString(locale).includes('AM')) {
|
|
17
39
|
return 'am';
|
|
@@ -21,46 +43,108 @@ const getAmPm = (date, locale) => {
|
|
|
21
43
|
}
|
|
22
44
|
return date.getHours() >= 12 ? 'pm' : 'am';
|
|
23
45
|
};
|
|
24
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Formats an array of time values (hours, minutes, or seconds) according to the specified locale and partial.
|
|
48
|
+
* @param {number[]} values An array of time values to format.
|
|
49
|
+
* @param {string} locale The locale to use for formatting.
|
|
50
|
+
* @param {('hour' | 'minute' | 'second')} partial The type of time value to format.
|
|
51
|
+
* @returns {Array} An array of objects with the original value and its localized label.
|
|
52
|
+
*/
|
|
53
|
+
const formatTimePartials = (values, locale, partial) => {
|
|
25
54
|
const date = new Date();
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
label: ((ampm === 'auto' && hour12) || ampm === true ? i + 1 : i).toLocaleString(locale),
|
|
31
|
-
};
|
|
55
|
+
const formatter = new Intl.DateTimeFormat(locale, {
|
|
56
|
+
hour: 'numeric',
|
|
57
|
+
minute: '2-digit',
|
|
58
|
+
second: '2-digit',
|
|
32
59
|
});
|
|
33
|
-
|
|
34
|
-
|
|
60
|
+
return values.map((value) => {
|
|
61
|
+
if (partial === 'hour') {
|
|
62
|
+
date.setHours(value);
|
|
63
|
+
}
|
|
64
|
+
if (partial === 'minute') {
|
|
65
|
+
date.setMinutes(value);
|
|
66
|
+
}
|
|
67
|
+
if (partial === 'second') {
|
|
68
|
+
date.setSeconds(value);
|
|
69
|
+
}
|
|
35
70
|
return {
|
|
36
|
-
value
|
|
37
|
-
label: date
|
|
38
|
-
.toLocaleTimeString(locale, {
|
|
39
|
-
minute: '2-digit',
|
|
40
|
-
second: '2-digit',
|
|
41
|
-
})
|
|
42
|
-
.split(/[^A-Za-z0-9\u06F0-\u06F90-9]/)[0],
|
|
71
|
+
value,
|
|
72
|
+
label: formatter.formatToParts(date).find((part) => part.type === partial)?.value || '',
|
|
43
73
|
};
|
|
44
74
|
});
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Generates localized time partials (hours, minutes, seconds) based on the given parameters.
|
|
78
|
+
* @param {string} locale The locale to use for generating localized time partials.
|
|
79
|
+
* @param {'auto' | boolean} ampm Determines whether to use 12-hour or 24-hour format. 'auto' decides based on locale.
|
|
80
|
+
* @param {boolean | number[] | Function} hours An array of hours, a boolean, or a function to generate hours.
|
|
81
|
+
* @param {boolean | number[] | Function} minutes An array of minutes, a boolean, or a function to generate minutes.
|
|
82
|
+
* @param {boolean | number[] | Function} seconds An array of seconds, a boolean, or a function to generate seconds.
|
|
83
|
+
* @returns {LocalizedTimePartials} An object containing arrays of localized time partials and a boolean indicating if 12-hour format is used.
|
|
84
|
+
*/
|
|
85
|
+
const getLocalizedTimePartials = (locale, ampm = 'auto', hours = [], minutes = [], seconds = []) => {
|
|
86
|
+
const hour12 = (ampm === 'auto' && isAmPm(locale)) || ampm === true;
|
|
87
|
+
const listOfHours = Array.isArray(hours) && hours.length > 0
|
|
88
|
+
? hours
|
|
89
|
+
: (typeof hours === 'function'
|
|
90
|
+
? Array.from({ length: hour12 ? 12 : 24 }, (_, i) => (hour12 ? i + 1 : i)).filter((hour) => hours(hour))
|
|
91
|
+
: Array.from({ length: hour12 ? 12 : 24 }, (_, i) => (hour12 ? i + 1 : i)));
|
|
92
|
+
const listOfMinutes = Array.isArray(minutes) && minutes.length > 0
|
|
93
|
+
? minutes
|
|
94
|
+
: (typeof minutes === 'function'
|
|
95
|
+
? Array.from({ length: 60 }, (_, i) => i).filter((minute) => minutes(minute))
|
|
96
|
+
: Array.from({ length: 60 }, (_, i) => i));
|
|
97
|
+
const listOfSeconds = Array.isArray(seconds) && seconds.length > 0
|
|
98
|
+
? seconds
|
|
99
|
+
: (typeof seconds === 'function'
|
|
100
|
+
? Array.from({ length: 60 }, (_, i) => i).filter((second) => seconds(second))
|
|
101
|
+
: Array.from({ length: 60 }, (_, i) => i));
|
|
45
102
|
return {
|
|
46
|
-
listOfHours,
|
|
47
|
-
listOfMinutes:
|
|
48
|
-
listOfSeconds:
|
|
103
|
+
listOfHours: formatTimePartials(listOfHours, locale, 'hour'),
|
|
104
|
+
listOfMinutes: formatTimePartials(listOfMinutes, locale, 'minute'),
|
|
105
|
+
listOfSeconds: formatTimePartials(listOfSeconds, locale, 'second'),
|
|
49
106
|
hour12,
|
|
50
107
|
};
|
|
51
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* Gets the selected hour from a date object in either 12-hour or 24-hour format based on locale and preference.
|
|
111
|
+
* @param {Date | null} date The date object from which to extract the hour. If null, the function returns an empty string.
|
|
112
|
+
* @param {string} locale The locale to use when determining whether to return in 12-hour or 24-hour format.
|
|
113
|
+
* @param {'auto' | boolean} ampm Determines the format of the hour returned. 'auto' decides based on locale, true forces 12-hour format, and false forces 24-hour format.
|
|
114
|
+
* @returns {string | number} The hour in the specified format or an empty string if the date is null.
|
|
115
|
+
*/
|
|
52
116
|
const getSelectedHour = (date, locale, ampm = 'auto') => date
|
|
53
|
-
? (ampm === 'auto' && isAmPm(locale)) || ampm === true
|
|
117
|
+
? ((ampm === 'auto' && isAmPm(locale)) || ampm === true
|
|
54
118
|
? convert24hTo12h(date.getHours())
|
|
55
|
-
: date.getHours()
|
|
119
|
+
: date.getHours())
|
|
56
120
|
: '';
|
|
121
|
+
/**
|
|
122
|
+
* Gets the selected minutes from a date object.
|
|
123
|
+
* @param {Date | null} date The date object from which to extract the minutes. If null, the function returns an empty string.
|
|
124
|
+
* @returns {string | number} The minutes from the date or an empty string if the date is null.
|
|
125
|
+
*/
|
|
57
126
|
const getSelectedMinutes = (date) => (date ? date.getMinutes() : '');
|
|
127
|
+
/**
|
|
128
|
+
* Gets the selected seconds from a date object.
|
|
129
|
+
* @param {Date | null} date The date object from which to extract the seconds. If null, the function returns an empty string.
|
|
130
|
+
* @returns {string | number} The seconds from the date or an empty string if the date is null.
|
|
131
|
+
*/
|
|
58
132
|
const getSelectedSeconds = (date) => (date ? date.getSeconds() : '');
|
|
133
|
+
/**
|
|
134
|
+
* Determines if the given locale uses AM/PM format.
|
|
135
|
+
* @param {string} locale The locale to check.
|
|
136
|
+
* @returns {boolean} True if the locale uses AM/PM format, otherwise false.
|
|
137
|
+
*/
|
|
59
138
|
const isAmPm = (locale) => ['am', 'AM', 'pm', 'PM'].some((el) => new Date().toLocaleString(locale).includes(el));
|
|
139
|
+
/**
|
|
140
|
+
* Validates if the given string represents a valid time.
|
|
141
|
+
* @param {string} time The time string to validate.
|
|
142
|
+
* @returns {boolean} True if the string is a valid time, otherwise false.
|
|
143
|
+
*/
|
|
60
144
|
const isValidTime = (time) => {
|
|
61
145
|
const d = new Date(`1970-01-01 ${time}`);
|
|
62
146
|
return d instanceof Date && d.getTime();
|
|
63
147
|
};
|
|
64
148
|
|
|
65
|
-
export { convert12hTo24h, convert24hTo12h, convertTimeToDate, getAmPm, getLocalizedTimePartials, getSelectedHour, getSelectedMinutes, getSelectedSeconds, isAmPm, isValidTime };
|
|
149
|
+
export { convert12hTo24h, convert24hTo12h, convertTimeToDate, formatTimePartials, getAmPm, getLocalizedTimePartials, getSelectedHour, getSelectedMinutes, getSelectedSeconds, isAmPm, isValidTime };
|
|
66
150
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/time-picker/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/time-picker/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;AAKG;MACU,eAAe,GAAG,CAAC,IAAiB,EAAE,IAAY,KAAI;IACjE,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,EAAE;AAChC,QAAA,OAAO,CAAC,CAAA;KACT;AAED,IAAA,IAAI,IAAI,KAAK,IAAI,EAAE;AACjB,QAAA,OAAO,IAAI,CAAA;KACZ;IAED,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,EAAE;AAChC,QAAA,OAAO,EAAE,CAAA;KACV;IAED,OAAO,IAAI,GAAG,EAAE,CAAA;AAClB,EAAC;AAED;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,IAAY,KAAK,IAAI,GAAG,EAAE,IAAI,GAAE;AAEhE;;;;AAIG;AACU,MAAA,iBAAiB,GAAG,CAAC,IAAsC,KACtE,IAAI,IAAI,IAAI,YAAY,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC,CAAA,WAAA,EAAc,IAAI,CAAA,CAAE,CAAC,IAAI,KAAI;AAE9E;;;;;AAKG;MACU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AM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,EAAC;AAExF;;;;AAIG;MACU,kBAAkB,GAAG,CAAC,IAAiB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,EAAC;AAExF;;;;AAIG;AACU,MAAA,MAAM,GAAG,CAAC,MAAc,KACnC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAC;AAEvF;;;;AAIG;AACU,MAAA,WAAW,GAAG,CAAC,IAAY,KAAI;IAC1C,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAc,WAAA,EAAA,IAAI,CAAE,CAAA,CAAC,CAAA;IACxC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;AACzC;;;;"}
|
|
@@ -14,7 +14,7 @@ declare const CTooltip: import("vue").DefineComponent<{
|
|
|
14
14
|
/**
|
|
15
15
|
* 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`.
|
|
16
16
|
*
|
|
17
|
-
* @since v5.0.0-rc.
|
|
17
|
+
* @since v5.0.0-rc.2
|
|
18
18
|
*/
|
|
19
19
|
container: {
|
|
20
20
|
type: PropType<string | HTMLElement | (() => HTMLElement)>;
|
|
@@ -92,7 +92,7 @@ declare const CTooltip: import("vue").DefineComponent<{
|
|
|
92
92
|
/**
|
|
93
93
|
* 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`.
|
|
94
94
|
*
|
|
95
|
-
* @since v5.0.0-rc.
|
|
95
|
+
* @since v5.0.0-rc.2
|
|
96
96
|
*/
|
|
97
97
|
container: {
|
|
98
98
|
type: PropType<string | HTMLElement | (() => HTMLElement)>;
|
|
@@ -21,7 +21,7 @@ const CTooltip = defineComponent({
|
|
|
21
21
|
/**
|
|
22
22
|
* 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`.
|
|
23
23
|
*
|
|
24
|
-
* @since v5.0.0-rc.
|
|
24
|
+
* @since v5.0.0-rc.2
|
|
25
25
|
*/
|
|
26
26
|
container: {
|
|
27
27
|
type: [Object, String],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/vue-pro",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"description": "UI Components Library for Vue.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test:update": "jest --coverage --updateSnapshot"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@coreui/coreui-pro": "^5.0.0-rc.
|
|
44
|
+
"@coreui/coreui-pro": "^5.0.0-rc.2",
|
|
45
45
|
"@popperjs/core": "^2.11.8"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, provide, ref } from 'vue'
|
|
1
|
+
import { defineComponent, h, provide, ref, watch } from 'vue'
|
|
2
2
|
|
|
3
3
|
const CAccordion = defineComponent({
|
|
4
4
|
name: 'CAccordion',
|
|
@@ -21,6 +21,12 @@ const CAccordion = defineComponent({
|
|
|
21
21
|
const setActiveItemKey = (key: string | number) => {
|
|
22
22
|
activeItemKey.value = key
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
watch(
|
|
26
|
+
() => props.activeItemKey,
|
|
27
|
+
(value) => (activeItemKey.value = value),
|
|
28
|
+
)
|
|
29
|
+
|
|
24
30
|
provide('activeItemKey', activeItemKey)
|
|
25
31
|
provide('alwaysOpen', props.alwaysOpen)
|
|
26
32
|
provide('setActiveItemKey', setActiveItemKey)
|
|
@@ -61,7 +61,7 @@ const CBadge = defineComponent({
|
|
|
61
61
|
class: [
|
|
62
62
|
'badge',
|
|
63
63
|
{
|
|
64
|
-
[`bg-${props.color}`]: props.color,
|
|
64
|
+
[`text-bg-${props.color}`]: props.color,
|
|
65
65
|
'position-absolute translate-middle': props.position,
|
|
66
66
|
'top-0': props.position && props.position.includes('top'),
|
|
67
67
|
'top-100': props.position && props.position.includes('bottom'),
|
|
@@ -124,7 +124,7 @@ const CCalendar = defineComponent({
|
|
|
124
124
|
/**
|
|
125
125
|
* Specify the type of date selection as day, week, month, or year.
|
|
126
126
|
*
|
|
127
|
-
* @since 5.0.0-rc.
|
|
127
|
+
* @since 5.0.0-rc.2
|
|
128
128
|
*/
|
|
129
129
|
selectionType: {
|
|
130
130
|
type: String as PropType<'day' | 'week' | 'month' | 'year'>,
|
|
@@ -143,7 +143,7 @@ const CCalendar = defineComponent({
|
|
|
143
143
|
/**
|
|
144
144
|
* Set whether to display week numbers in the calendar.
|
|
145
145
|
*
|
|
146
|
-
* @since 5.0.0-rc.
|
|
146
|
+
* @since 5.0.0-rc.2
|
|
147
147
|
*/
|
|
148
148
|
showWeekNumber: Boolean,
|
|
149
149
|
/**
|
|
@@ -174,7 +174,7 @@ const CCalendar = defineComponent({
|
|
|
174
174
|
/**
|
|
175
175
|
* Label displayed over week numbers in the calendar.
|
|
176
176
|
*
|
|
177
|
-
* @since 5.0.0-rc.
|
|
177
|
+
* @since 5.0.0-rc.2
|
|
178
178
|
*/
|
|
179
179
|
weekNumbersLabel: String,
|
|
180
180
|
},
|
|
@@ -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 v5.0.0-rc.
|
|
19
|
+
* @since v5.0.0-rc.2
|
|
20
20
|
*/
|
|
21
21
|
container: {
|
|
22
22
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|
|
@@ -183,19 +183,19 @@ const CDatePicker = defineComponent({
|
|
|
183
183
|
/**
|
|
184
184
|
* Custom function to format the selected date into a string according to a custom format.
|
|
185
185
|
*
|
|
186
|
-
* @since v5.0.0-rc.
|
|
186
|
+
* @since v5.0.0-rc.2
|
|
187
187
|
*/
|
|
188
188
|
inputDateFormat: Function,
|
|
189
189
|
/**
|
|
190
190
|
* Custom function to parse the input value into a valid Date object.
|
|
191
191
|
*
|
|
192
|
-
* @since v5.0.0-rc.
|
|
192
|
+
* @since v5.0.0-rc.2
|
|
193
193
|
*/
|
|
194
194
|
inputDateParse: Function,
|
|
195
195
|
/**
|
|
196
196
|
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
197
197
|
*
|
|
198
|
-
* @since v5.0.0-rc.
|
|
198
|
+
* @since v5.0.0-rc.2
|
|
199
199
|
*/
|
|
200
200
|
inputOnChangeDelay: {
|
|
201
201
|
type: Number,
|
|
@@ -249,7 +249,7 @@ const CDatePicker = defineComponent({
|
|
|
249
249
|
/**
|
|
250
250
|
* Specify the type of date selection as day, week, month, or year.
|
|
251
251
|
*
|
|
252
|
-
* @since 5.0.0-rc.
|
|
252
|
+
* @since 5.0.0-rc.2
|
|
253
253
|
*/
|
|
254
254
|
selectionType: {
|
|
255
255
|
type: String as PropType<'day' | 'week' | 'month' | 'year'>,
|
|
@@ -268,7 +268,7 @@ const CDatePicker = defineComponent({
|
|
|
268
268
|
/**
|
|
269
269
|
* Set whether to display week numbers in the calendar.
|
|
270
270
|
*
|
|
271
|
-
* @since 5.0.0-rc.
|
|
271
|
+
* @since 5.0.0-rc.2
|
|
272
272
|
*/
|
|
273
273
|
showWeekNumber: Boolean,
|
|
274
274
|
/**
|
|
@@ -311,7 +311,7 @@ const CDatePicker = defineComponent({
|
|
|
311
311
|
/**
|
|
312
312
|
* Label displayed over week numbers in the calendar.
|
|
313
313
|
*
|
|
314
|
-
* @since 5.0.0-rc.
|
|
314
|
+
* @since 5.0.0-rc.2
|
|
315
315
|
*/
|
|
316
316
|
weekNumbersLabel: String,
|
|
317
317
|
},
|
|
@@ -214,19 +214,19 @@ const CDateRangePicker = defineComponent({
|
|
|
214
214
|
/**
|
|
215
215
|
* Custom function to format the selected date into a string according to a custom format.
|
|
216
216
|
*
|
|
217
|
-
* @since v5.0.0-rc.
|
|
217
|
+
* @since v5.0.0-rc.2
|
|
218
218
|
*/
|
|
219
219
|
inputDateFormat: Function,
|
|
220
220
|
/**
|
|
221
221
|
* Custom function to parse the input value into a valid Date object.
|
|
222
222
|
*
|
|
223
|
-
* @since v5.0.0-rc.
|
|
223
|
+
* @since v5.0.0-rc.2
|
|
224
224
|
*/
|
|
225
225
|
inputDateParse: Function,
|
|
226
226
|
/**
|
|
227
227
|
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
228
228
|
*
|
|
229
|
-
* @since v5.0.0-rc.
|
|
229
|
+
* @since v5.0.0-rc.2
|
|
230
230
|
*/
|
|
231
231
|
inputOnChangeDelay: {
|
|
232
232
|
type: Number,
|
|
@@ -316,7 +316,7 @@ const CDateRangePicker = defineComponent({
|
|
|
316
316
|
/**
|
|
317
317
|
* Specify the type of date selection as day, week, month, or year.
|
|
318
318
|
*
|
|
319
|
-
* @since 5.0.0-rc.
|
|
319
|
+
* @since 5.0.0-rc.2
|
|
320
320
|
*/
|
|
321
321
|
selectionType: {
|
|
322
322
|
type: String as PropType<'day' | 'week' | 'month' | 'year'>,
|
|
@@ -335,7 +335,7 @@ const CDateRangePicker = defineComponent({
|
|
|
335
335
|
/**
|
|
336
336
|
* Set whether to display week numbers in the calendar.
|
|
337
337
|
*
|
|
338
|
-
* @since 5.0.0-rc.
|
|
338
|
+
* @since 5.0.0-rc.2
|
|
339
339
|
*/
|
|
340
340
|
showWeekNumber: Boolean,
|
|
341
341
|
/**
|
|
@@ -453,7 +453,7 @@ const CDateRangePicker = defineComponent({
|
|
|
453
453
|
/**
|
|
454
454
|
* Label displayed over week numbers in the calendar.
|
|
455
455
|
*
|
|
456
|
-
* @since 5.0.0-rc.
|
|
456
|
+
* @since 5.0.0-rc.2
|
|
457
457
|
*/
|
|
458
458
|
weekNumbersLabel: String,
|
|
459
459
|
},
|
|
@@ -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 v5.0.0-rc.
|
|
65
|
+
* @since v5.0.0-rc.2
|
|
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 v5.0.0-rc.
|
|
118
|
+
* @since v5.0.0-rc.2
|
|
119
119
|
*/
|
|
120
120
|
teleport: {
|
|
121
121
|
type: Boolean,
|
|
@@ -189,7 +189,7 @@ const CFormCheck = defineComponent({
|
|
|
189
189
|
const formControl = () => {
|
|
190
190
|
return h('input', {
|
|
191
191
|
...attrs,
|
|
192
|
-
...(
|
|
192
|
+
...(props.modelValue && { checked: isChecked.value }),
|
|
193
193
|
class: inputClassName,
|
|
194
194
|
id: props.id,
|
|
195
195
|
indeterminate: props.indeterminate,
|
|
@@ -236,26 +236,26 @@ const CFormCheck = defineComponent({
|
|
|
236
236
|
props.button
|
|
237
237
|
? [formControl(), (slots.label || props.label) && formLabel(), formValidation()]
|
|
238
238
|
: props.label
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
? props.hitArea
|
|
240
|
+
? [
|
|
241
|
+
h(
|
|
242
|
+
CFormLabel,
|
|
243
|
+
{
|
|
244
|
+
customClassName: className,
|
|
245
|
+
...(props.id && { for: props.id }),
|
|
246
|
+
},
|
|
247
|
+
[formControl(), props.label],
|
|
248
|
+
),
|
|
249
|
+
formValidation(),
|
|
250
|
+
]
|
|
251
|
+
: h(
|
|
252
|
+
'div',
|
|
243
253
|
{
|
|
244
|
-
|
|
245
|
-
...(props.id && { for: props.id }),
|
|
254
|
+
class: className,
|
|
246
255
|
},
|
|
247
|
-
[formControl(), props.label],
|
|
248
|
-
)
|
|
249
|
-
|
|
250
|
-
]
|
|
251
|
-
: h(
|
|
252
|
-
'div',
|
|
253
|
-
{
|
|
254
|
-
class: className,
|
|
255
|
-
},
|
|
256
|
-
[formControl(), props.label && formLabel(), formValidation()],
|
|
257
|
-
)
|
|
258
|
-
: formControl()
|
|
256
|
+
[formControl(), props.label && formLabel(), formValidation()],
|
|
257
|
+
)
|
|
258
|
+
: formControl()
|
|
259
259
|
},
|
|
260
260
|
})
|
|
261
261
|
|
|
@@ -7,6 +7,7 @@ import { executeAfterTransition } from '../../utils/transition'
|
|
|
7
7
|
|
|
8
8
|
const COffcanvas = defineComponent({
|
|
9
9
|
name: 'COffcanvas',
|
|
10
|
+
inheritAttrs: false,
|
|
10
11
|
props: {
|
|
11
12
|
/**
|
|
12
13
|
* Apply a backdrop on body while offcanvas is open.
|
|
@@ -94,7 +95,7 @@ const COffcanvas = defineComponent({
|
|
|
94
95
|
*/
|
|
95
96
|
'show',
|
|
96
97
|
],
|
|
97
|
-
setup(props, {
|
|
98
|
+
setup(props, { attrs, emit, slots }) {
|
|
98
99
|
const offcanvasRef = ref()
|
|
99
100
|
const visible = ref(props.visible)
|
|
100
101
|
|
|
@@ -175,6 +176,7 @@ const COffcanvas = defineComponent({
|
|
|
175
176
|
h(
|
|
176
177
|
'div',
|
|
177
178
|
{
|
|
179
|
+
...attrs,
|
|
178
180
|
class: [
|
|
179
181
|
{
|
|
180
182
|
[`offcanvas${
|
|
@@ -182,6 +184,7 @@ const COffcanvas = defineComponent({
|
|
|
182
184
|
}`]: props.responsive,
|
|
183
185
|
[`offcanvas-${props.placement}`]: props.placement,
|
|
184
186
|
},
|
|
187
|
+
attrs.class,
|
|
185
188
|
],
|
|
186
189
|
onKeydown: (event: KeyboardEvent) => handleKeyDown(event),
|
|
187
190
|
ref: offcanvasRef,
|
|
@@ -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 v5.0.0-rc.
|
|
26
|
+
* @since v5.0.0-rc.2
|
|
27
27
|
*/
|
|
28
28
|
container: {
|
|
29
29
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|