@coreui/vue-pro 5.0.0-rc.3 → 5.1.0-alpha.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/badge/CBadge.d.ts +2 -2
- package/dist/cjs/components/badge/CBadge.js +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/card/CCard.d.ts +2 -2
- package/dist/cjs/components/card/CCard.js +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 +12 -12
- package/dist/cjs/components/date-picker/CDatePicker.js +6 -6
- package/dist/cjs/components/date-range-picker/CDateRangePicker.d.ts +12 -12
- 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/index.d.ts +1 -0
- package/dist/cjs/components/index.js +26 -22
- package/dist/cjs/components/index.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/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/rating/CRating.d.ts +132 -0
- package/dist/cjs/components/rating/CRating.js +240 -0
- package/dist/cjs/components/rating/CRating.js.map +1 -0
- package/dist/cjs/components/rating/index.d.ts +6 -0
- package/dist/cjs/components/rating/index.js +13 -0
- package/dist/cjs/components/rating/index.js.map +1 -0
- package/dist/cjs/components/smart-table/CSmartTableBody.js +2 -1
- package/dist/cjs/components/smart-table/CSmartTableBody.js.map +1 -1
- package/dist/cjs/components/time-picker/CTimePicker.js +3 -3
- package/dist/cjs/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/cjs/components/tooltip/CTooltip.js +1 -1
- package/dist/cjs/index.js +32 -28
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/badge/CBadge.d.ts +2 -2
- package/dist/esm/components/badge/CBadge.js +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/card/CCard.d.ts +2 -2
- package/dist/esm/components/card/CCard.js +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 +12 -12
- package/dist/esm/components/date-picker/CDatePicker.js +6 -6
- package/dist/esm/components/date-range-picker/CDateRangePicker.d.ts +12 -12
- 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/index.d.ts +1 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.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/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/rating/CRating.d.ts +132 -0
- package/dist/esm/components/rating/CRating.js +238 -0
- package/dist/esm/components/rating/CRating.js.map +1 -0
- package/dist/esm/components/rating/index.d.ts +6 -0
- package/dist/esm/components/rating/index.js +10 -0
- package/dist/esm/components/rating/index.js.map +1 -0
- package/dist/esm/components/smart-table/CSmartTableBody.js +3 -2
- package/dist/esm/components/smart-table/CSmartTableBody.js.map +1 -1
- package/dist/esm/components/time-picker/CTimePicker.js +3 -3
- package/dist/esm/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/esm/components/tooltip/CTooltip.js +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/badge/CBadge.ts +1 -1
- package/src/components/calendar/CCalendar.ts +3 -3
- package/src/components/card/CCard.ts +1 -1
- 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/index.ts +1 -0
- package/src/components/modal/CModal.ts +1 -1
- package/src/components/popover/CPopover.ts +1 -1
- package/src/components/progress/CProgress.ts +1 -1
- package/src/components/rating/CRating.ts +288 -0
- package/src/components/rating/index.ts +10 -0
- package/src/components/smart-table/CSmartTableBody.ts +3 -1
- package/src/components/time-picker/CTimePicker.ts +3 -3
- package/src/components/tooltip/CTooltip.ts +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -142,6 +142,8 @@ export { CProgressBar } from './components/progress/CProgressBar.js';
|
|
|
142
142
|
export { CProgressStacked } from './components/progress/CProgressStacked.js';
|
|
143
143
|
export { CPopoverPlugin } from './components/popover/index.js';
|
|
144
144
|
export { CPopover } from './components/popover/CPopover.js';
|
|
145
|
+
export { CRating } from './components/rating/CRating.js';
|
|
146
|
+
export { CRatingPlugin } from './components/rating/index.js';
|
|
145
147
|
export { CSidebarPlugin } from './components/sidebar/index.js';
|
|
146
148
|
export { CSidebar } from './components/sidebar/CSidebar.js';
|
|
147
149
|
export { CSidebarBrand } from './components/sidebar/CSidebarBrand.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":["Components","Directives"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":["Components","Directives"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,SAAS,GAAG;AAChB,IAAA,OAAO,EAAE,CAAC,GAAQ,KAAU;AAC1B,QAAA,KAAK,MAAM,GAAG,IAAIA,KAAU,EAAE;YAC5B,GAAG,CAAC,SAAS,CAAC,GAAG,EAAGA,KAAqC,CAAC,GAAG,CAAC,CAAC,CAAA;SAChE;AAED,QAAA,KAAK,MAAM,GAAG,IAAIC,OAAU,EAAE;AAC5B,YAAA,GAAG,CAAC,SAAS,CACVA,OAAqC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAClDA,OAAqC,CAAC,GAAG,CAAC,CAC5C,CAAA;SACF;KACF;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/vue-pro",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0-alpha.0",
|
|
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.
|
|
44
|
+
"@coreui/coreui-pro": "^5.1.0-alpha.0",
|
|
45
45
|
"@popperjs/core": "^2.11.8"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"cross-env": "^7.0.3",
|
|
55
55
|
"jest": "^29.7.0",
|
|
56
56
|
"jest-environment-jsdom": "^29.7.0",
|
|
57
|
-
"rollup": "^4.13.
|
|
57
|
+
"rollup": "^4.13.2",
|
|
58
58
|
"rollup-plugin-vue": "^6.0.0",
|
|
59
59
|
"ts-jest": "^29.1.2",
|
|
60
60
|
"typescript": "^5.4.3",
|
|
@@ -50,7 +50,7 @@ const CBadge = defineComponent({
|
|
|
50
50
|
* Sets the component's color scheme to one of CoreUI's themed colors, ensuring the text color contrast adheres to the WCAG 4.5:1 contrast ratio standard for accessibility.
|
|
51
51
|
*
|
|
52
52
|
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
53
|
-
* @since 5.0.0
|
|
53
|
+
* @since 5.0.0
|
|
54
54
|
*/
|
|
55
55
|
textBgColor: Color,
|
|
56
56
|
/**
|
|
@@ -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
|
|
127
|
+
* @since 5.0.0
|
|
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
|
|
146
|
+
* @since 5.0.0
|
|
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
|
|
177
|
+
* @since 5.0.0
|
|
178
178
|
*/
|
|
179
179
|
weekNumbersLabel: String,
|
|
180
180
|
},
|
|
@@ -15,7 +15,7 @@ const CCard = defineComponent({
|
|
|
15
15
|
* Sets the component's color scheme to one of CoreUI's themed colors, ensuring the text color contrast adheres to the WCAG 4.5:1 contrast ratio standard for accessibility.
|
|
16
16
|
*
|
|
17
17
|
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
18
|
-
* @since 5.0.0
|
|
18
|
+
* @since 5.0.0
|
|
19
19
|
*/
|
|
20
20
|
textBgColor: Color,
|
|
21
21
|
/**
|
|
@@ -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
|
|
19
|
+
* @since v5.0.0
|
|
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
|
|
186
|
+
* @since v5.0.0
|
|
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
|
|
192
|
+
* @since v5.0.0
|
|
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
|
|
198
|
+
* @since v5.0.0
|
|
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
|
|
252
|
+
* @since 5.0.0
|
|
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
|
|
271
|
+
* @since 5.0.0
|
|
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
|
|
314
|
+
* @since 5.0.0
|
|
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
|
|
217
|
+
* @since v5.0.0
|
|
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
|
|
223
|
+
* @since v5.0.0
|
|
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
|
|
229
|
+
* @since v5.0.0
|
|
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
|
|
319
|
+
* @since 5.0.0
|
|
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
|
|
338
|
+
* @since 5.0.0
|
|
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
|
|
456
|
+
* @since 5.0.0
|
|
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
|
|
65
|
+
* @since v5.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 v5.0.0
|
|
118
|
+
* @since v5.0.0
|
|
119
119
|
*/
|
|
120
120
|
teleport: {
|
|
121
121
|
type: Boolean,
|
package/src/components/index.ts
CHANGED
|
@@ -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
|
|
26
|
+
* @since v5.0.0
|
|
27
27
|
*/
|
|
28
28
|
container: {
|
|
29
29
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { PropType, defineComponent, h, ref, watch, withDirectives } from 'vue'
|
|
2
|
+
import vCTooltip from '../../directives/v-c-tooltip'
|
|
3
|
+
|
|
4
|
+
const CRating = defineComponent({
|
|
5
|
+
name: 'CRating',
|
|
6
|
+
props: {
|
|
7
|
+
/**
|
|
8
|
+
* Enables the clearing upon clicking the selected item again.
|
|
9
|
+
*/
|
|
10
|
+
allowClear: Boolean,
|
|
11
|
+
/**
|
|
12
|
+
* Toggle the disabled state for the component.
|
|
13
|
+
*/
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
/**
|
|
16
|
+
* If enabled, only the currently selected icon will be visibly highlighted.
|
|
17
|
+
*/
|
|
18
|
+
highlightOnlySelected: Boolean,
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the total number of stars to be displayed in the star rating component. This property determines the scale of the rating, such as out of 5 stars, 10 stars, etc.
|
|
21
|
+
*/
|
|
22
|
+
itemCount: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 5,
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* The default name for a value passed using v-model.
|
|
28
|
+
*/
|
|
29
|
+
modelValue: Number,
|
|
30
|
+
/**
|
|
31
|
+
* The name attribute of the radio input elements.
|
|
32
|
+
*/
|
|
33
|
+
name: String,
|
|
34
|
+
/**
|
|
35
|
+
* Minimum increment value change allowed.
|
|
36
|
+
*/
|
|
37
|
+
precision: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: 1,
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Toggle the readonly state for the component.
|
|
43
|
+
*/
|
|
44
|
+
readOnly: Boolean,
|
|
45
|
+
/**
|
|
46
|
+
* Size the component small, large, or custom if you define custom icons with custom height.
|
|
47
|
+
*
|
|
48
|
+
* @values 'sm', 'lg', 'custom'
|
|
49
|
+
*/
|
|
50
|
+
size: {
|
|
51
|
+
type: String,
|
|
52
|
+
validator: (value: string) => {
|
|
53
|
+
return ['sm', 'lg', 'custom'].includes(value)
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Enable tooltips with default values or set specific labels for each icon.
|
|
58
|
+
*/
|
|
59
|
+
tooltips: {
|
|
60
|
+
type: [Boolean, Array] as PropType<boolean | string[]>,
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* The `value` attribute of component.
|
|
64
|
+
* */
|
|
65
|
+
value: Number,
|
|
66
|
+
},
|
|
67
|
+
emits: [
|
|
68
|
+
/**
|
|
69
|
+
* Execute a function when a user changes the selected element.
|
|
70
|
+
*
|
|
71
|
+
* @property {number | null} value
|
|
72
|
+
*/
|
|
73
|
+
'change',
|
|
74
|
+
/**
|
|
75
|
+
* Execute a function when a user hover the element.
|
|
76
|
+
*
|
|
77
|
+
* @property {number | null} value
|
|
78
|
+
*/
|
|
79
|
+
'hover',
|
|
80
|
+
/**
|
|
81
|
+
* Emit the new value whenever there’s a change event.
|
|
82
|
+
*/
|
|
83
|
+
'update:modelValue',
|
|
84
|
+
],
|
|
85
|
+
setup(props, { slots, emit }) {
|
|
86
|
+
const cleared = ref(false)
|
|
87
|
+
const currentValue = ref((props.modelValue || props.value) ?? null)
|
|
88
|
+
const hoverValue = ref<number | null>(null)
|
|
89
|
+
const tooltipValue = ref<number | null>(null)
|
|
90
|
+
const name = props.name || `name${Math.floor(Math.random() * 1_000_000)}`
|
|
91
|
+
const uid = `id${Math.floor(Math.random() * 1_000_000)}`
|
|
92
|
+
|
|
93
|
+
watch(
|
|
94
|
+
() => props.value,
|
|
95
|
+
() => {
|
|
96
|
+
if (props.value !== undefined) {
|
|
97
|
+
currentValue.value = props.value
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
watch(
|
|
103
|
+
() => props.modelValue,
|
|
104
|
+
() => {
|
|
105
|
+
if (props.modelValue !== undefined) {
|
|
106
|
+
currentValue.value = props.modelValue
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
const handleMouseEnter = (value: number) => {
|
|
112
|
+
if (props.disabled || props.readOnly) {
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
emit('hover', value)
|
|
117
|
+
hoverValue.value = value
|
|
118
|
+
tooltipValue.value = value
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const handleMouseLeave = () => {
|
|
122
|
+
if (props.disabled || props.readOnly) {
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
emit('hover', null)
|
|
127
|
+
hoverValue.value = null
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const handleOnChange = (value: number) => {
|
|
131
|
+
if (props.disabled || props.readOnly) {
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (cleared.value) {
|
|
136
|
+
cleared.value = false
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
currentValue.value = value
|
|
141
|
+
emit('change', value)
|
|
142
|
+
emit('update:modelValue', value)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const handleOnClick = (value: number) => {
|
|
146
|
+
if (props.disabled || props.readOnly) {
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (props.allowClear && value === currentValue.value) {
|
|
151
|
+
emit('change', value)
|
|
152
|
+
cleared.value = true
|
|
153
|
+
currentValue.value = null
|
|
154
|
+
hoverValue.value = null
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return () =>
|
|
159
|
+
h(
|
|
160
|
+
'div',
|
|
161
|
+
{
|
|
162
|
+
class: [
|
|
163
|
+
'rating',
|
|
164
|
+
{
|
|
165
|
+
[`rating-${props.size}`]: props.size,
|
|
166
|
+
disabled: props.disabled,
|
|
167
|
+
readonly: props.readOnly,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
role: 'radiogroup',
|
|
171
|
+
},
|
|
172
|
+
[
|
|
173
|
+
Array.from({ length: props.itemCount }, (_, index) => {
|
|
174
|
+
const numberOfRadios = 1 / props.precision
|
|
175
|
+
return withDirectives(
|
|
176
|
+
h(
|
|
177
|
+
'div',
|
|
178
|
+
{
|
|
179
|
+
class: 'rating-item',
|
|
180
|
+
},
|
|
181
|
+
[
|
|
182
|
+
Array.from({ length: numberOfRadios }, (_, _index) => {
|
|
183
|
+
const isNotLastItem = _index + 1 < numberOfRadios
|
|
184
|
+
const value =
|
|
185
|
+
numberOfRadios === 1
|
|
186
|
+
? index + 1
|
|
187
|
+
: index + (_index + 1) * (1 * props.precision)
|
|
188
|
+
const id = `${uid}${value}`
|
|
189
|
+
|
|
190
|
+
const isItemChecked = () => value === currentValue.value
|
|
191
|
+
|
|
192
|
+
const isItemActive = () => {
|
|
193
|
+
if (
|
|
194
|
+
props.highlightOnlySelected
|
|
195
|
+
? hoverValue.value === value
|
|
196
|
+
: hoverValue.value && hoverValue.value >= value
|
|
197
|
+
) {
|
|
198
|
+
return true
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (
|
|
202
|
+
hoverValue.value === null &&
|
|
203
|
+
(props.highlightOnlySelected
|
|
204
|
+
? isItemChecked()
|
|
205
|
+
: currentValue.value && currentValue.value >= value)
|
|
206
|
+
) {
|
|
207
|
+
return true
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return false
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return [
|
|
214
|
+
h(
|
|
215
|
+
'label',
|
|
216
|
+
{
|
|
217
|
+
class: [
|
|
218
|
+
'rating-item-label',
|
|
219
|
+
{
|
|
220
|
+
active: isItemActive(),
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
for: id,
|
|
224
|
+
onClick: () => handleOnClick(value),
|
|
225
|
+
onMouseenter: () => handleMouseEnter(value),
|
|
226
|
+
onMouseleave: () => handleMouseLeave(),
|
|
227
|
+
...(isNotLastItem && {
|
|
228
|
+
style: {
|
|
229
|
+
zIndex: 1 / props.precision - _index,
|
|
230
|
+
position: 'absolute',
|
|
231
|
+
width: `${props.precision * (_index + 1) * 100}%`,
|
|
232
|
+
overflow: 'hidden',
|
|
233
|
+
opacity: 0,
|
|
234
|
+
},
|
|
235
|
+
}),
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
default: () => [
|
|
239
|
+
slots.icon
|
|
240
|
+
? h(
|
|
241
|
+
'div',
|
|
242
|
+
{ class: 'rating-item-custom-icon' },
|
|
243
|
+
slots.icon({ value: index + 1 }),
|
|
244
|
+
)
|
|
245
|
+
: h('div', { class: 'rating-item-icon' }),
|
|
246
|
+
slots.activeIcon &&
|
|
247
|
+
h(
|
|
248
|
+
'div',
|
|
249
|
+
{ class: 'rating-item-custom-icon-active' },
|
|
250
|
+
slots.activeIcon({ value: index + 1 }),
|
|
251
|
+
),
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
),
|
|
255
|
+
h('input', {
|
|
256
|
+
checked: isItemChecked(),
|
|
257
|
+
class: 'rating-item-input',
|
|
258
|
+
disabled: props.disabled || props.readOnly,
|
|
259
|
+
id: id,
|
|
260
|
+
name: name,
|
|
261
|
+
onBlur: () => handleMouseLeave(),
|
|
262
|
+
onChange: () => handleOnChange(value),
|
|
263
|
+
onFocus: () => handleMouseEnter(value),
|
|
264
|
+
type: 'radio',
|
|
265
|
+
value: value,
|
|
266
|
+
}),
|
|
267
|
+
]
|
|
268
|
+
}),
|
|
269
|
+
],
|
|
270
|
+
),
|
|
271
|
+
props.tooltips
|
|
272
|
+
? [
|
|
273
|
+
[
|
|
274
|
+
vCTooltip,
|
|
275
|
+
{
|
|
276
|
+
content: Array.isArray(props.tooltips) ? props.tooltips[index] : index + 1,
|
|
277
|
+
placement: 'top',
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
]
|
|
281
|
+
: [],
|
|
282
|
+
)
|
|
283
|
+
}),
|
|
284
|
+
],
|
|
285
|
+
)
|
|
286
|
+
},
|
|
287
|
+
})
|
|
288
|
+
export { CRating }
|
|
@@ -9,6 +9,7 @@ import { ITEM_INTERNAL_KEYS } from './consts'
|
|
|
9
9
|
import {
|
|
10
10
|
getClickedColumnName,
|
|
11
11
|
getColumnName,
|
|
12
|
+
getColumns,
|
|
12
13
|
getTableDataCellProps,
|
|
13
14
|
getTableDataCellStyles,
|
|
14
15
|
} from './utils'
|
|
@@ -45,6 +46,7 @@ const CSmartTableBody = defineComponent({
|
|
|
45
46
|
emits: ['rowChecked', 'rowClick'],
|
|
46
47
|
setup(props, { emit }) {
|
|
47
48
|
const colspan: number = props.selectable ? props.columns.length + 1 : props.columns.length
|
|
49
|
+
const columns = getColumns(props.columns)
|
|
48
50
|
return () =>
|
|
49
51
|
h(
|
|
50
52
|
CTableBody,
|
|
@@ -88,7 +90,7 @@ const CSmartTableBody = defineComponent({
|
|
|
88
90
|
},
|
|
89
91
|
}),
|
|
90
92
|
),
|
|
91
|
-
|
|
93
|
+
columns.map((column) => {
|
|
92
94
|
const colName = getColumnName(column)
|
|
93
95
|
return props.scopedSlots &&
|
|
94
96
|
props.scopedSlots[colName] &&
|
|
@@ -151,7 +151,7 @@ const CTimePicker = defineComponent({
|
|
|
151
151
|
/**
|
|
152
152
|
* Specify a list of available hours using an array, or customize the filtering of hours through a function.
|
|
153
153
|
*
|
|
154
|
-
* @since 5.0.0
|
|
154
|
+
* @since 5.0.0
|
|
155
155
|
*/
|
|
156
156
|
hours: {
|
|
157
157
|
type: [Array, Function] as PropType<number[] | ((hour: number) => number[])>,
|
|
@@ -170,7 +170,7 @@ const CTimePicker = defineComponent({
|
|
|
170
170
|
/**
|
|
171
171
|
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
172
172
|
*
|
|
173
|
-
* @since v5.0.0
|
|
173
|
+
* @since v5.0.0
|
|
174
174
|
*/
|
|
175
175
|
inputOnChangeDelay: {
|
|
176
176
|
type: Number,
|
|
@@ -205,7 +205,7 @@ const CTimePicker = defineComponent({
|
|
|
205
205
|
/**
|
|
206
206
|
* Toggle the display of minutes, specify a list of available minutes using an array, or customize the filtering of minutes through a function.
|
|
207
207
|
*
|
|
208
|
-
* @since 5.0.0
|
|
208
|
+
* @since 5.0.0
|
|
209
209
|
*/
|
|
210
210
|
minutes: {
|
|
211
211
|
type: [Array, Boolean, Function] as PropType<
|
|
@@ -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 v5.0.0
|
|
26
|
+
* @since v5.0.0
|
|
27
27
|
*/
|
|
28
28
|
container: {
|
|
29
29
|
type: [Object, String] as PropType<HTMLElement | (() => HTMLElement) | string>,
|