@coreui/vue-pro 4.2.0 → 4.3.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/components/calendar/CCalendar.d.ts +198 -0
- package/dist/components/calendar/index.d.ts +6 -0
- package/dist/components/carousel/CCarousel.d.ts +1 -1
- package/dist/components/date-picker/CDatePicker.d.ts +414 -0
- package/dist/components/date-picker/index.d.ts +6 -0
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +563 -0
- package/dist/components/date-range-picker/index.d.ts +6 -0
- package/dist/components/form/CFormCheck.d.ts +88 -39
- package/dist/components/form/CFormControlValidation.d.ts +98 -0
- package/dist/components/form/CFormControlWrapper.d.ts +6 -0
- package/dist/components/form/CFormFeedback.d.ts +2 -2
- package/dist/components/form/CFormInput.d.ts +125 -25
- package/dist/components/form/CFormRange.d.ts +18 -16
- package/dist/components/form/CFormSelect.d.ts +125 -16
- package/dist/components/form/CFormSwitch.d.ts +0 -23
- package/dist/components/form/CFormTextarea.d.ts +125 -24
- package/dist/components/index.d.ts +5 -0
- package/dist/components/modal/CModal.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelect.d.ts +2 -2
- package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
- package/dist/components/picker/CPicker.d.ts +11 -0
- package/dist/components/picker/index.d.ts +6 -0
- package/dist/components/popover/CPopover.d.ts +1 -1
- package/dist/components/sidebar/CSidebar.d.ts +1 -1
- package/dist/components/smart-table/CSmartTable.d.ts +35 -99
- package/dist/components/smart-table/CSmartTableInterface.d.ts +3 -3
- package/dist/components/time-picker/CTimePicker.d.ts +10 -0
- package/dist/components/time-picker/CTimePickerRollCol.d.ts +27 -0
- package/dist/components/time-picker/index.d.ts +6 -0
- package/dist/components/toast/CToast.d.ts +8 -2
- package/dist/index.es.js +6249 -1276
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +6256 -1273
- package/dist/index.js.map +1 -1
- package/dist/utils/calendar.d.ts +23 -0
- package/dist/utils/time.d.ts +21 -0
- package/dist/utils/transition.d.ts +3 -0
- package/package.json +11 -10
- package/src/components/backdrop/CBackdrop.ts +8 -6
- package/src/components/button/CButton.ts +2 -2
- package/src/components/calendar/CCalendar.ts +616 -0
- package/src/components/calendar/index.ts +10 -0
- package/src/components/collapse/CCollapse.ts +5 -6
- package/src/components/date-picker/CDatePicker.ts +240 -0
- package/src/components/date-picker/index.ts +10 -0
- package/src/components/date-range-picker/CDateRangePicker.ts +733 -0
- package/src/components/date-range-picker/index.ts +10 -0
- package/src/components/dropdown/CDropdownMenu.ts +4 -2
- package/src/components/dropdown/CDropdownToggle.ts +24 -9
- package/src/components/form/CFormCheck.ts +119 -94
- package/src/components/form/CFormControlValidation.ts +97 -0
- package/src/components/form/CFormControlWrapper.ts +106 -0
- package/src/components/form/CFormInput.ts +113 -29
- package/src/components/form/CFormRange.ts +25 -11
- package/src/components/form/CFormSelect.ts +126 -41
- package/src/components/form/CFormSwitch.ts +2 -21
- package/src/components/form/CFormTextarea.ts +105 -25
- package/src/components/index.ts +5 -0
- package/src/components/modal/CModal.ts +14 -6
- package/src/components/nav/CNavGroup.ts +4 -6
- package/src/components/offcanvas/COffcanvas.ts +5 -7
- package/src/components/pagination/CSmartPagination.ts +4 -4
- package/src/components/picker/CPicker.ts +221 -0
- package/src/components/picker/index.ts +10 -0
- package/src/components/popover/CPopover.ts +5 -5
- package/src/components/smart-table/CSmartTable.ts +17 -49
- package/src/components/smart-table/CSmartTableInterface.ts +5 -3
- package/src/components/tabs/CTabPane.ts +4 -6
- package/src/components/time-picker/CTimePicker.ts +405 -0
- package/src/components/time-picker/CTimePickerRollCol.ts +58 -0
- package/src/components/time-picker/index.ts +10 -0
- package/src/components/toast/CToast.ts +17 -12
- package/src/components/tooltip/CTooltip.ts +5 -5
- package/src/utils/calendar.ts +270 -0
- package/src/utils/time.ts +84 -0
- package/src/utils/transition.ts +65 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, h } from 'vue'
|
|
2
|
+
import { CFormControlWrapper } from './CFormControlWrapper'
|
|
2
3
|
|
|
3
4
|
const CFormTextarea = defineComponent({
|
|
4
5
|
name: 'CFormTextarea',
|
|
@@ -8,14 +9,56 @@ const CFormTextarea = defineComponent({
|
|
|
8
9
|
*/
|
|
9
10
|
disabled: {
|
|
10
11
|
type: Boolean,
|
|
11
|
-
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* Provide valuable, actionable feedback.
|
|
15
|
+
*
|
|
16
|
+
* @since 4.3.0
|
|
17
|
+
*/
|
|
18
|
+
feedback: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Provide valuable, actionable feedback.
|
|
23
|
+
*
|
|
24
|
+
* @since 4.3.0
|
|
25
|
+
*/
|
|
26
|
+
feedbackInvalid: {
|
|
27
|
+
type: String,
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
31
|
+
*
|
|
32
|
+
* @since 4.3.0
|
|
33
|
+
*/
|
|
34
|
+
feedbackValid: {
|
|
35
|
+
type: String,
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Provide valuable, actionable valid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
39
|
+
*
|
|
40
|
+
* @since 4.3.0
|
|
41
|
+
*/
|
|
42
|
+
floatingLabel: {
|
|
43
|
+
type: String,
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* The id global attribute defines an identifier (ID) that must be unique in the whole document.
|
|
47
|
+
*/
|
|
48
|
+
id: {
|
|
49
|
+
type: String,
|
|
12
50
|
},
|
|
13
51
|
/**
|
|
14
52
|
* Set component validation state to invalid.
|
|
15
53
|
*/
|
|
16
|
-
invalid:
|
|
17
|
-
|
|
18
|
-
|
|
54
|
+
invalid: Boolean,
|
|
55
|
+
/**
|
|
56
|
+
* Add a caption for a component.
|
|
57
|
+
*
|
|
58
|
+
* @since 4.3.0
|
|
59
|
+
*/
|
|
60
|
+
label: {
|
|
61
|
+
type: String,
|
|
19
62
|
},
|
|
20
63
|
/**
|
|
21
64
|
* The default name for a value passed using v-model.
|
|
@@ -23,29 +66,37 @@ const CFormTextarea = defineComponent({
|
|
|
23
66
|
modelValue: {
|
|
24
67
|
type: String,
|
|
25
68
|
default: undefined,
|
|
26
|
-
require: false,
|
|
27
69
|
},
|
|
28
70
|
/**
|
|
29
71
|
* Render the component styled as plain text. Removes the default form field styling and preserve the correct margin and padding. Recommend to use only along side `readonly`.
|
|
30
72
|
*/
|
|
31
73
|
plainText: {
|
|
32
74
|
type: Boolean,
|
|
33
|
-
required: false,
|
|
34
75
|
},
|
|
35
76
|
/**
|
|
36
77
|
* Toggle the readonly state for the component.
|
|
37
78
|
*/
|
|
38
79
|
readonly: {
|
|
39
80
|
type: Boolean,
|
|
40
|
-
required: false,
|
|
41
81
|
},
|
|
42
82
|
/**
|
|
43
|
-
*
|
|
83
|
+
* Add helper text to the component.
|
|
84
|
+
*
|
|
85
|
+
* @since 4.3.0
|
|
44
86
|
*/
|
|
45
|
-
|
|
46
|
-
type:
|
|
47
|
-
required: false,
|
|
87
|
+
text: {
|
|
88
|
+
type: String,
|
|
48
89
|
},
|
|
90
|
+
/**
|
|
91
|
+
* Display validation feedback in a styled tooltip.
|
|
92
|
+
*
|
|
93
|
+
* @since 4.3.0
|
|
94
|
+
*/
|
|
95
|
+
tooltipFeedback: Boolean,
|
|
96
|
+
/**
|
|
97
|
+
* Set component validation state to valid.
|
|
98
|
+
*/
|
|
99
|
+
valid: Boolean,
|
|
49
100
|
},
|
|
50
101
|
emits: [
|
|
51
102
|
/**
|
|
@@ -61,7 +112,7 @@ const CFormTextarea = defineComponent({
|
|
|
61
112
|
*/
|
|
62
113
|
'update:modelValue',
|
|
63
114
|
],
|
|
64
|
-
setup(props, { emit, slots }) {
|
|
115
|
+
setup(props, { attrs, emit, slots }) {
|
|
65
116
|
const handleInput = (event: InputEvent) => {
|
|
66
117
|
const target = event.target as HTMLInputElement
|
|
67
118
|
emit('input', event)
|
|
@@ -70,21 +121,50 @@ const CFormTextarea = defineComponent({
|
|
|
70
121
|
|
|
71
122
|
return () =>
|
|
72
123
|
h(
|
|
73
|
-
|
|
124
|
+
CFormControlWrapper,
|
|
125
|
+
{
|
|
126
|
+
describedby: attrs['aria-describedby'],
|
|
127
|
+
feedback: props.feedback,
|
|
128
|
+
feedbackInvalid: props.feedbackInvalid,
|
|
129
|
+
feedbackValid: props.feedbackValid,
|
|
130
|
+
floatingLabel: props.floatingLabel,
|
|
131
|
+
id: props.id,
|
|
132
|
+
invalid: props.invalid,
|
|
133
|
+
label: props.label,
|
|
134
|
+
text: props.text,
|
|
135
|
+
tooltipFeedback: props.tooltipFeedback,
|
|
136
|
+
valid: props.valid,
|
|
137
|
+
},
|
|
74
138
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
139
|
+
default: () =>
|
|
140
|
+
h(
|
|
141
|
+
'textarea',
|
|
142
|
+
{
|
|
143
|
+
...attrs,
|
|
144
|
+
disabled: props.disabled,
|
|
145
|
+
readonly: props.readonly,
|
|
146
|
+
class: [
|
|
147
|
+
props.plainText ? 'form-control-plaintext' : 'form-control',
|
|
148
|
+
{
|
|
149
|
+
'is-invalid': props.invalid,
|
|
150
|
+
'is-valid': props.valid,
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
onInput: (event: InputEvent) => handleInput(event),
|
|
154
|
+
...(props.modelValue && { value: props.modelValue }),
|
|
155
|
+
},
|
|
156
|
+
slots.default && slots.default(),
|
|
157
|
+
),
|
|
158
|
+
...(slots.feedback && { feedback: () => slots.feedback && slots.feedback() }),
|
|
159
|
+
...(slots.feedbackInvalid && {
|
|
160
|
+
feedbackInvalid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
161
|
+
}),
|
|
162
|
+
...(slots.feedbackValid && {
|
|
163
|
+
feedbackValid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
164
|
+
}),
|
|
165
|
+
...(slots.label && { label: () => slots.label && slots.label() }),
|
|
166
|
+
...(slots.text && { text: () => slots.text && slots.text() }),
|
|
86
167
|
},
|
|
87
|
-
slots.default && slots.default(),
|
|
88
168
|
)
|
|
89
169
|
},
|
|
90
170
|
})
|
package/src/components/index.ts
CHANGED
|
@@ -6,11 +6,14 @@ export * from './badge'
|
|
|
6
6
|
export * from './breadcrumb'
|
|
7
7
|
export * from './button'
|
|
8
8
|
export * from './button-group'
|
|
9
|
+
export * from './calendar'
|
|
9
10
|
export * from './callout'
|
|
10
11
|
export * from './card'
|
|
11
12
|
export * from './carousel'
|
|
12
13
|
export * from './close-button'
|
|
13
14
|
export * from './collapse'
|
|
15
|
+
export * from './date-picker'
|
|
16
|
+
export * from './date-range-picker'
|
|
14
17
|
export * from './dropdown'
|
|
15
18
|
export * from './element-cover'
|
|
16
19
|
export * from './footer'
|
|
@@ -27,6 +30,7 @@ export * from './nav'
|
|
|
27
30
|
export * from './navbar'
|
|
28
31
|
export * from './offcanvas'
|
|
29
32
|
export * from './pagination'
|
|
33
|
+
export * from './picker'
|
|
30
34
|
export * from './placeholder'
|
|
31
35
|
export * from './progress'
|
|
32
36
|
export * from './popover'
|
|
@@ -35,6 +39,7 @@ export * from './smart-table'
|
|
|
35
39
|
export * from './spinner'
|
|
36
40
|
export * from './table'
|
|
37
41
|
export * from './tabs'
|
|
42
|
+
export * from './time-picker'
|
|
38
43
|
export * from './toast'
|
|
39
44
|
export * from './tooltip'
|
|
40
45
|
export * from './widgets'
|
|
@@ -12,8 +12,11 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { CBackdrop } from './../backdrop/CBackdrop'
|
|
14
14
|
|
|
15
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
16
|
+
|
|
15
17
|
const CModal = defineComponent({
|
|
16
18
|
name: 'CModal',
|
|
19
|
+
inheritAttrs: false,
|
|
17
20
|
props: {
|
|
18
21
|
/**
|
|
19
22
|
* Align the modal in the center or top of the screen.
|
|
@@ -140,9 +143,7 @@ const CModal = defineComponent({
|
|
|
140
143
|
)
|
|
141
144
|
|
|
142
145
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
143
|
-
|
|
144
|
-
done()
|
|
145
|
-
})
|
|
146
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
146
147
|
document.body.classList.add('modal-open')
|
|
147
148
|
el.style.display = 'block'
|
|
148
149
|
setTimeout(() => {
|
|
@@ -150,17 +151,22 @@ const CModal = defineComponent({
|
|
|
150
151
|
}, 1)
|
|
151
152
|
emit('show')
|
|
152
153
|
}
|
|
154
|
+
|
|
153
155
|
const handleAfterEnter = () => {
|
|
154
156
|
window.addEventListener('mousedown', handleMouseDown)
|
|
155
157
|
window.addEventListener('keyup', handleKeyUp)
|
|
156
158
|
}
|
|
159
|
+
|
|
157
160
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
158
|
-
|
|
159
|
-
done()
|
|
160
|
-
})
|
|
161
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
161
162
|
document.body.classList.remove('modal-open')
|
|
163
|
+
if (document.body.className === '') {
|
|
164
|
+
document.body.removeAttribute('class')
|
|
165
|
+
}
|
|
166
|
+
|
|
162
167
|
el.classList.remove('show')
|
|
163
168
|
}
|
|
169
|
+
|
|
164
170
|
const handleAfterLeave = (el: RendererElement) => {
|
|
165
171
|
window.removeEventListener('mousedown', handleMouseDown)
|
|
166
172
|
window.removeEventListener('keyup', handleKeyUp)
|
|
@@ -177,6 +183,7 @@ const CModal = defineComponent({
|
|
|
177
183
|
if (props.backdrop !== 'static' && event.key === 'Escape' && props.keyboard) {
|
|
178
184
|
handleDismiss()
|
|
179
185
|
}
|
|
186
|
+
|
|
180
187
|
if (props.backdrop === 'static') {
|
|
181
188
|
modalRef.value.classList.add('modal-static')
|
|
182
189
|
emit('close-prevented')
|
|
@@ -196,6 +203,7 @@ const CModal = defineComponent({
|
|
|
196
203
|
if (props.backdrop !== 'static') {
|
|
197
204
|
handleDismiss()
|
|
198
205
|
}
|
|
206
|
+
|
|
199
207
|
if (props.backdrop === 'static') {
|
|
200
208
|
modalRef.value.classList.add('modal-static')
|
|
201
209
|
setTimeout(() => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, onMounted, ref, RendererElement, Transition, watch } from 'vue'
|
|
2
2
|
|
|
3
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
4
|
+
|
|
3
5
|
const CNavGroup = defineComponent({
|
|
4
6
|
name: 'CNavGroup',
|
|
5
7
|
props: {
|
|
@@ -62,9 +64,7 @@ const CNavGroup = defineComponent({
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
65
|
-
|
|
66
|
-
done()
|
|
67
|
-
})
|
|
67
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
68
68
|
el.style.height = `${el.scrollHeight}px`
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -77,9 +77,7 @@ const CNavGroup = defineComponent({
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
80
|
-
|
|
81
|
-
done()
|
|
82
|
-
})
|
|
80
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
83
81
|
setTimeout(() => {
|
|
84
82
|
el.style.height = '0px'
|
|
85
83
|
}, 1)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { defineComponent, h, ref, RendererElement, Transition, watch, withDirectives } from 'vue'
|
|
2
|
+
|
|
2
3
|
import { CBackdrop } from '../backdrop'
|
|
4
|
+
|
|
3
5
|
import { vVisible } from '../../directives/v-c-visible'
|
|
6
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
4
7
|
|
|
5
8
|
const COffcanvas = defineComponent({
|
|
6
9
|
name: 'COffcanvas',
|
|
@@ -88,9 +91,7 @@ const COffcanvas = defineComponent({
|
|
|
88
91
|
|
|
89
92
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
90
93
|
emit('show')
|
|
91
|
-
|
|
92
|
-
done()
|
|
93
|
-
})
|
|
94
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
94
95
|
setTimeout(() => {
|
|
95
96
|
el.style.visibility = 'visible'
|
|
96
97
|
el.classList.add('show')
|
|
@@ -98,13 +99,10 @@ const COffcanvas = defineComponent({
|
|
|
98
99
|
}
|
|
99
100
|
const handleAfterEnter = () => {
|
|
100
101
|
window.addEventListener('mousedown', handleMouseDown)
|
|
101
|
-
// window.addEventListener('click', handleClickOutside)
|
|
102
102
|
window.addEventListener('keyup', handleKeyUp)
|
|
103
103
|
}
|
|
104
104
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
105
|
-
|
|
106
|
-
done()
|
|
107
|
-
})
|
|
105
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
108
106
|
window.removeEventListener('mousedown', handleMouseDown)
|
|
109
107
|
window.removeEventListener('keyup', handleKeyUp)
|
|
110
108
|
el.classList.remove('show')
|
|
@@ -225,7 +225,7 @@ const CSmartPagination = defineComponent({
|
|
|
225
225
|
CPaginationItem,
|
|
226
226
|
{
|
|
227
227
|
onClick: () => {
|
|
228
|
-
setPage(1)
|
|
228
|
+
activePage.value !== 1 && setPage(1)
|
|
229
229
|
},
|
|
230
230
|
'aria-label': 'Go to first page',
|
|
231
231
|
...(activePage.value === 1 && {
|
|
@@ -247,7 +247,7 @@ const CSmartPagination = defineComponent({
|
|
|
247
247
|
CPaginationItem,
|
|
248
248
|
{
|
|
249
249
|
onClick: () => {
|
|
250
|
-
setPage(activePage.value - 1)
|
|
250
|
+
activePage.value !== 1 && setPage(activePage.value - 1)
|
|
251
251
|
},
|
|
252
252
|
'aria-label': 'Go to previous page',
|
|
253
253
|
...(activePage.value === 1 && {
|
|
@@ -304,7 +304,7 @@ const CSmartPagination = defineComponent({
|
|
|
304
304
|
CPaginationItem,
|
|
305
305
|
{
|
|
306
306
|
onClick: () => {
|
|
307
|
-
setPage(activePage.value + 1)
|
|
307
|
+
activePage.value !== pages.value && setPage(activePage.value + 1)
|
|
308
308
|
},
|
|
309
309
|
'aria-label': 'Go to next page',
|
|
310
310
|
...(activePage.value === pages.value && {
|
|
@@ -326,7 +326,7 @@ const CSmartPagination = defineComponent({
|
|
|
326
326
|
CPaginationItem,
|
|
327
327
|
{
|
|
328
328
|
onClick: () => {
|
|
329
|
-
setPage(pages.value)
|
|
329
|
+
activePage.value !== pages.value && setPage(pages.value)
|
|
330
330
|
},
|
|
331
331
|
'aria-label': 'Go to last page',
|
|
332
332
|
...(activePage.value === pages.value && {
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { defineComponent, h, PropType, ref, watch } from 'vue'
|
|
2
|
+
|
|
3
|
+
import { CButton } from '../button/'
|
|
4
|
+
import { CDropdown, CDropdownMenu, CDropdownToggle } from '../dropdown/'
|
|
5
|
+
|
|
6
|
+
import { Color } from '../props'
|
|
7
|
+
|
|
8
|
+
const CPicker = defineComponent({
|
|
9
|
+
name: 'CPicker',
|
|
10
|
+
props: {
|
|
11
|
+
...CDropdown.props,
|
|
12
|
+
/**
|
|
13
|
+
* Toggle visibility or set the content of cancel button.
|
|
14
|
+
*/
|
|
15
|
+
cancelButton: {
|
|
16
|
+
type: [Boolean, String],
|
|
17
|
+
default: 'Cancel',
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Sets the color context of the cancel button to one of CoreUI’s themed colors.
|
|
21
|
+
*
|
|
22
|
+
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
23
|
+
*/
|
|
24
|
+
cancelButtonColor: {
|
|
25
|
+
...Color,
|
|
26
|
+
default: 'primary',
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Size the cancel button small or large.
|
|
30
|
+
*
|
|
31
|
+
* @values 'sm', 'lg'
|
|
32
|
+
*/
|
|
33
|
+
cancelButtonSize: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'sm',
|
|
36
|
+
validator: (value: string) => {
|
|
37
|
+
return ['sm', 'lg'].includes(value)
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Set the cancel button variant to an outlined button or a ghost button.
|
|
42
|
+
*
|
|
43
|
+
* @values 'ghost', 'outline'
|
|
44
|
+
*/
|
|
45
|
+
cancelButtonVariant: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'ghost',
|
|
48
|
+
validator: (value: string) => {
|
|
49
|
+
return ['ghost', 'outline'].includes(value)
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Toggle visibility or set the content of confirm button.
|
|
54
|
+
*/
|
|
55
|
+
confirmButton: {
|
|
56
|
+
type: [Boolean, String],
|
|
57
|
+
default: 'OK',
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Sets the color context of the confirm button to one of CoreUI’s themed colors.
|
|
61
|
+
*
|
|
62
|
+
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
63
|
+
*/
|
|
64
|
+
confirmButtonColor: {
|
|
65
|
+
...Color,
|
|
66
|
+
default: 'primary',
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Size the confirm button small or large.
|
|
70
|
+
*
|
|
71
|
+
* @values 'sm', 'lg'
|
|
72
|
+
*/
|
|
73
|
+
confirmButtonSize: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'sm',
|
|
76
|
+
validator: (value: string) => {
|
|
77
|
+
return ['sm', 'lg'].includes(value)
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Set the confirm button variant to an outlined button or a ghost button.
|
|
82
|
+
*
|
|
83
|
+
* @values 'ghost', 'outline'
|
|
84
|
+
*/
|
|
85
|
+
confirmButtonVariant: {
|
|
86
|
+
type: String,
|
|
87
|
+
validator: (value: string) => {
|
|
88
|
+
return ['ghost', 'outline'].includes(value)
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Set container type for the component.
|
|
93
|
+
*/
|
|
94
|
+
container: {
|
|
95
|
+
type: String as PropType<'dropdown' | 'inline'>,
|
|
96
|
+
default: 'dropdown',
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Toggle the disabled state for the component.
|
|
100
|
+
*/
|
|
101
|
+
disabled: Boolean,
|
|
102
|
+
/**
|
|
103
|
+
* Toggle visibility of footer element or set the content of footer.
|
|
104
|
+
*/
|
|
105
|
+
footer: Boolean,
|
|
106
|
+
/**
|
|
107
|
+
* Toggle the visibility of the component.
|
|
108
|
+
*/
|
|
109
|
+
visible: Boolean,
|
|
110
|
+
},
|
|
111
|
+
emits: [
|
|
112
|
+
/**
|
|
113
|
+
* Callback fired when the cancel button has been clicked.
|
|
114
|
+
*/
|
|
115
|
+
'cancel',
|
|
116
|
+
/**
|
|
117
|
+
* Callback fired when the confirm button has been clicked.
|
|
118
|
+
*/
|
|
119
|
+
'confirm',
|
|
120
|
+
/**
|
|
121
|
+
* Callback fired when the component requests to be hidden.
|
|
122
|
+
*/
|
|
123
|
+
'hide',
|
|
124
|
+
/**
|
|
125
|
+
* Callback fired when the component requests to be shown.
|
|
126
|
+
*/
|
|
127
|
+
'show',
|
|
128
|
+
],
|
|
129
|
+
setup(props, { emit, slots }) {
|
|
130
|
+
const visible = ref(props.visible)
|
|
131
|
+
|
|
132
|
+
watch(
|
|
133
|
+
() => props.visible,
|
|
134
|
+
() => {
|
|
135
|
+
visible.value = props.visible
|
|
136
|
+
},
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
const handleConfirm = () => {
|
|
140
|
+
emit('confirm')
|
|
141
|
+
visible.value = false
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const Footer = () =>
|
|
145
|
+
h('div', { class: 'picker-footer' }, [
|
|
146
|
+
slots.footer && slots.footer(),
|
|
147
|
+
props.cancelButton &&
|
|
148
|
+
h(
|
|
149
|
+
CButton,
|
|
150
|
+
{
|
|
151
|
+
color: props.cancelButtonColor,
|
|
152
|
+
onClick: () => emit('cancel'),
|
|
153
|
+
size: props.cancelButtonSize,
|
|
154
|
+
variant: props.cancelButtonVariant,
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* @slot Location for the cancel button content.
|
|
158
|
+
*/
|
|
159
|
+
() => (slots.cancelButton ? slots.cancelButton() : props.cancelButton),
|
|
160
|
+
),
|
|
161
|
+
props.confirmButton &&
|
|
162
|
+
h(
|
|
163
|
+
CButton,
|
|
164
|
+
{
|
|
165
|
+
color: props.confirmButtonColor,
|
|
166
|
+
onClick: handleConfirm,
|
|
167
|
+
size: props.confirmButtonSize,
|
|
168
|
+
variant: props.confirmButtonVariant,
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* @slot Location for the confirm button content.
|
|
172
|
+
*/
|
|
173
|
+
() => (slots.confirmButton ? slots.confirmButton() : props.confirmButton),
|
|
174
|
+
),
|
|
175
|
+
])
|
|
176
|
+
|
|
177
|
+
switch (props.container) {
|
|
178
|
+
case 'inline':
|
|
179
|
+
return () => h('div', { class: 'picker' }, slots.default && slots.default())
|
|
180
|
+
default:
|
|
181
|
+
return () =>
|
|
182
|
+
h(
|
|
183
|
+
CDropdown,
|
|
184
|
+
{
|
|
185
|
+
autoClose: 'outside',
|
|
186
|
+
class: 'picker',
|
|
187
|
+
onHide: () => {
|
|
188
|
+
visible.value = false
|
|
189
|
+
emit('hide')
|
|
190
|
+
},
|
|
191
|
+
onShow: () => {
|
|
192
|
+
visible.value = true
|
|
193
|
+
emit('show')
|
|
194
|
+
},
|
|
195
|
+
variant: 'dropdown',
|
|
196
|
+
visible: visible.value,
|
|
197
|
+
},
|
|
198
|
+
() => [
|
|
199
|
+
h(
|
|
200
|
+
CDropdownToggle,
|
|
201
|
+
{
|
|
202
|
+
custom: true,
|
|
203
|
+
disabled: visible.value || props.disabled,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
/**
|
|
207
|
+
* @slot Location for the toggler element.
|
|
208
|
+
*/
|
|
209
|
+
default: () => slots.toggler && slots.toggler(),
|
|
210
|
+
},
|
|
211
|
+
),
|
|
212
|
+
h(CDropdownMenu, {}, () => [
|
|
213
|
+
slots.default && slots.default(),
|
|
214
|
+
props.footer && Footer(),
|
|
215
|
+
]),
|
|
216
|
+
],
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
})
|
|
221
|
+
export { CPicker }
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { defineComponent, h, PropType, ref, RendererElement, Teleport, Transition } from 'vue'
|
|
2
2
|
import { createPopper, Placement } from '@popperjs/core'
|
|
3
3
|
|
|
4
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
5
|
+
|
|
4
6
|
const CPopover = defineComponent({
|
|
5
7
|
name: 'CPopover',
|
|
6
8
|
props: {
|
|
@@ -83,18 +85,16 @@ const CPopover = defineComponent({
|
|
|
83
85
|
emit('show')
|
|
84
86
|
initPopper()
|
|
85
87
|
el.classList.add('show')
|
|
86
|
-
|
|
87
|
-
done()
|
|
88
|
-
})
|
|
88
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
92
92
|
emit('hide')
|
|
93
93
|
el.classList.remove('show')
|
|
94
|
-
|
|
94
|
+
executeAfterTransition(() => {
|
|
95
95
|
done()
|
|
96
96
|
destroyPopper()
|
|
97
|
-
})
|
|
97
|
+
}, el as HTMLElement)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
const handleToggle = (event: Event) => {
|