@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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import { CDateRangePicker } from './CDateRangePicker'
|
|
3
|
+
|
|
4
|
+
const CDateRangePickerPlugin = {
|
|
5
|
+
install: (app: App): void => {
|
|
6
|
+
app.component(CDateRangePicker.name, CDateRangePicker)
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { CDateRangePickerPlugin, CDateRangePicker }
|
|
@@ -37,14 +37,16 @@ const CDropdownMenu = defineComponent({
|
|
|
37
37
|
return classNames
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const handleKeyup = (event:
|
|
40
|
+
const handleKeyup = (event: KeyboardEvent) => {
|
|
41
41
|
if (autoClose === false) {
|
|
42
42
|
return
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
if (event.key === 'Escape') {
|
|
45
46
|
hideMenu()
|
|
46
47
|
}
|
|
47
48
|
}
|
|
49
|
+
|
|
48
50
|
const handleMouseUp = (event: Event) => {
|
|
49
51
|
if (dropdownToggleRef.value?.contains(event.target as HTMLElement)) {
|
|
50
52
|
return
|
|
@@ -112,15 +112,30 @@ const CDropdownToggle = defineComponent({
|
|
|
112
112
|
]
|
|
113
113
|
|
|
114
114
|
const triggers = {
|
|
115
|
-
...((props.trigger === 'click' || props.trigger.includes('click')) &&
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
...((props.trigger === 'click' || props.trigger.includes('click')) && {
|
|
116
|
+
onClick: () => {
|
|
117
|
+
if (props.disabled) {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
toggleMenu()
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
...((props.trigger === 'focus' || props.trigger.includes('focus')) && {
|
|
125
|
+
onfocus: () => {
|
|
126
|
+
if (props.disabled) {
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
toggleMenu(true)
|
|
131
|
+
},
|
|
132
|
+
onblur: () => {
|
|
133
|
+
if (props.disabled) {
|
|
134
|
+
return
|
|
135
|
+
}
|
|
136
|
+
toggleMenu(false)
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
124
139
|
}
|
|
125
140
|
|
|
126
141
|
onMounted(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h } from 'vue'
|
|
2
|
-
import { shape } from 'vue-types'
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { CButton } from '../button'
|
|
4
|
+
import { CFormControlValidation } from './CFormControlValidation'
|
|
5
5
|
import { CFormLabel } from './CFormLabel'
|
|
6
6
|
|
|
7
7
|
const CFormCheck = defineComponent({
|
|
@@ -10,52 +10,51 @@ const CFormCheck = defineComponent({
|
|
|
10
10
|
props: {
|
|
11
11
|
/**
|
|
12
12
|
* Create button-like checkboxes and radio buttons.
|
|
13
|
+
*
|
|
14
|
+
* @see http://coreui.io/vue/docs/components/button.html
|
|
13
15
|
*/
|
|
14
|
-
button:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
16
|
+
button: {
|
|
17
|
+
type: Object,
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Provide valuable, actionable feedback.
|
|
21
|
+
*
|
|
22
|
+
* @since 4.3.0
|
|
23
|
+
*/
|
|
24
|
+
feedback: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Provide valuable, actionable feedback.
|
|
29
|
+
*
|
|
30
|
+
* @since 4.3.0
|
|
31
|
+
*/
|
|
32
|
+
feedbackInvalid: {
|
|
33
|
+
type: String,
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
37
|
+
*
|
|
38
|
+
* @since 4.3.0
|
|
39
|
+
*/
|
|
40
|
+
feedbackValid: {
|
|
41
|
+
type: String,
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Sets hit area to the full area of the component.
|
|
45
|
+
*/
|
|
46
|
+
hitArea: {
|
|
47
|
+
type: String,
|
|
48
|
+
validator: (value: string): boolean => {
|
|
49
|
+
// The value must match one of these strings
|
|
50
|
+
return ['full'].includes(value)
|
|
50
51
|
},
|
|
51
|
-
}
|
|
52
|
+
},
|
|
52
53
|
/**
|
|
53
54
|
* The id global attribute defines an identifier (ID) that must be unique in the whole document.
|
|
54
55
|
*/
|
|
55
56
|
id: {
|
|
56
57
|
type: String,
|
|
57
|
-
default: undefined,
|
|
58
|
-
required: false,
|
|
59
58
|
},
|
|
60
59
|
/**
|
|
61
60
|
* Input Checkbox indeterminate Property
|
|
@@ -66,22 +65,16 @@ const CFormCheck = defineComponent({
|
|
|
66
65
|
*/
|
|
67
66
|
inline: {
|
|
68
67
|
type: Boolean,
|
|
69
|
-
required: false,
|
|
70
68
|
},
|
|
71
69
|
/**
|
|
72
70
|
* Set component validation state to invalid.
|
|
73
71
|
*/
|
|
74
|
-
invalid:
|
|
75
|
-
type: Boolean,
|
|
76
|
-
required: false,
|
|
77
|
-
},
|
|
72
|
+
invalid: Boolean,
|
|
78
73
|
/**
|
|
79
74
|
* The element represents a caption for a component.
|
|
80
75
|
*/
|
|
81
76
|
label: {
|
|
82
77
|
type: String,
|
|
83
|
-
default: undefined,
|
|
84
|
-
required: false,
|
|
85
78
|
},
|
|
86
79
|
/**
|
|
87
80
|
* The default name for a value passed using v-model.
|
|
@@ -89,8 +82,13 @@ const CFormCheck = defineComponent({
|
|
|
89
82
|
modelValue: {
|
|
90
83
|
type: [Boolean, String],
|
|
91
84
|
value: undefined,
|
|
92
|
-
required: false,
|
|
93
85
|
},
|
|
86
|
+
/**
|
|
87
|
+
* Display validation feedback in a styled tooltip.
|
|
88
|
+
*
|
|
89
|
+
* @since 4.3.0
|
|
90
|
+
*/
|
|
91
|
+
tooltipFeedback: Boolean,
|
|
94
92
|
/**
|
|
95
93
|
* Specifies the type of component.
|
|
96
94
|
*
|
|
@@ -99,14 +97,12 @@ const CFormCheck = defineComponent({
|
|
|
99
97
|
type: {
|
|
100
98
|
type: String,
|
|
101
99
|
default: 'checkbox',
|
|
102
|
-
required: false,
|
|
103
100
|
},
|
|
104
101
|
/**
|
|
105
102
|
* Set component validation state to valid.
|
|
106
103
|
*/
|
|
107
104
|
valid: {
|
|
108
105
|
type: Boolean,
|
|
109
|
-
required: false,
|
|
110
106
|
},
|
|
111
107
|
},
|
|
112
108
|
emits: [
|
|
@@ -126,66 +122,95 @@ const CFormCheck = defineComponent({
|
|
|
126
122
|
emit('update:modelValue', target.checked)
|
|
127
123
|
}
|
|
128
124
|
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
const className = [
|
|
126
|
+
'form-check',
|
|
127
|
+
{
|
|
128
|
+
'form-check-inline': props.inline,
|
|
129
|
+
'is-invalid': props.invalid,
|
|
130
|
+
'is-valid': props.valid,
|
|
131
|
+
},
|
|
132
|
+
attrs.class,
|
|
133
|
+
]
|
|
134
|
+
|
|
135
|
+
const inputClassName = props.button
|
|
136
|
+
? 'btn-check'
|
|
137
|
+
: [
|
|
138
|
+
'form-check-input',
|
|
135
139
|
{
|
|
136
140
|
'is-invalid': props.invalid,
|
|
137
141
|
'is-valid': props.valid,
|
|
142
|
+
'me-2': props.hitArea,
|
|
138
143
|
},
|
|
139
|
-
]
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
const formControl = () => {
|
|
147
|
+
return h('input', {
|
|
148
|
+
...attrs,
|
|
149
|
+
...(props.modelValue && { checked: props.modelValue }),
|
|
150
|
+
class: inputClassName,
|
|
140
151
|
id: props.id,
|
|
141
152
|
indeterminate: props.indeterminate,
|
|
142
153
|
onChange: (event: InputEvent) => handleChange(event),
|
|
143
154
|
type: props.type,
|
|
144
155
|
})
|
|
145
156
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
157
|
+
|
|
158
|
+
const formLabel = () =>
|
|
159
|
+
props.button
|
|
160
|
+
? h(
|
|
161
|
+
CButton,
|
|
162
|
+
{
|
|
163
|
+
component: 'label',
|
|
164
|
+
...props.button,
|
|
165
|
+
...(props.id && { for: props.id }),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
default: () => (slots.label && slots.label()) || props.label,
|
|
169
|
+
},
|
|
170
|
+
)
|
|
171
|
+
: h(
|
|
172
|
+
CFormLabel,
|
|
173
|
+
{ class: 'form-check-label', ...(props.id && { for: props.id }) },
|
|
174
|
+
{
|
|
175
|
+
default: () => (slots.label && slots.label()) || props.label,
|
|
176
|
+
},
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
const formValidation = () => {
|
|
180
|
+
return h(CFormControlValidation, {
|
|
181
|
+
describedby: attrs['aria-describedby'] as string,
|
|
182
|
+
feedback: props.feedback,
|
|
183
|
+
feedbackInvalid: props.feedbackInvalid,
|
|
184
|
+
feedbackValid: props.feedbackValid,
|
|
185
|
+
invalid: props.invalid,
|
|
186
|
+
tooltipFeedback: props.tooltipFeedback,
|
|
187
|
+
valid: props.valid,
|
|
188
|
+
})
|
|
168
189
|
}
|
|
169
190
|
|
|
170
191
|
return () =>
|
|
171
192
|
props.button
|
|
172
|
-
? [formControl(), (slots.label || props.label) && formLabel()]
|
|
193
|
+
? [formControl(), (slots.label || props.label) && formLabel(), formValidation()]
|
|
173
194
|
: props.label
|
|
174
|
-
?
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
'form-check',
|
|
195
|
+
? props.hitArea
|
|
196
|
+
? [
|
|
197
|
+
h(
|
|
198
|
+
CFormLabel,
|
|
179
199
|
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
'is-valid': props.valid,
|
|
200
|
+
customClassName: className,
|
|
201
|
+
...(props.id && { for: props.id }),
|
|
183
202
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
203
|
+
[formControl(), props.label],
|
|
204
|
+
),
|
|
205
|
+
formValidation(),
|
|
206
|
+
]
|
|
207
|
+
: h(
|
|
208
|
+
'div',
|
|
209
|
+
{
|
|
210
|
+
class: className,
|
|
211
|
+
},
|
|
212
|
+
[formControl(), props.label && formLabel(), formValidation()],
|
|
213
|
+
)
|
|
189
214
|
: formControl()
|
|
190
215
|
},
|
|
191
216
|
})
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue'
|
|
2
|
+
import { CFormFeedback } from './CFormFeedback'
|
|
3
|
+
|
|
4
|
+
const CFormControlValidation = defineComponent({
|
|
5
|
+
name: 'CFormControlValidation',
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
props: {
|
|
8
|
+
/**
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
describedby: {
|
|
12
|
+
type: String,
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* Provide valuable, actionable feedback.
|
|
16
|
+
*
|
|
17
|
+
* @since 4.3.0
|
|
18
|
+
*/
|
|
19
|
+
feedback: {
|
|
20
|
+
type: String,
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Provide valuable, actionable feedback.
|
|
24
|
+
*
|
|
25
|
+
* @since 4.3.0
|
|
26
|
+
*/
|
|
27
|
+
feedbackInvalid: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
32
|
+
*
|
|
33
|
+
* @since 4.3.0
|
|
34
|
+
*/
|
|
35
|
+
feedbackValid: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Set component validation state to invalid.
|
|
40
|
+
*/
|
|
41
|
+
invalid: Boolean,
|
|
42
|
+
/**
|
|
43
|
+
* Display validation feedback in a styled tooltip.
|
|
44
|
+
*
|
|
45
|
+
* @since 4.3.0
|
|
46
|
+
*/
|
|
47
|
+
tooltipFeedback: Boolean,
|
|
48
|
+
/**
|
|
49
|
+
* Set component validation state to valid.
|
|
50
|
+
*/
|
|
51
|
+
valid: Boolean,
|
|
52
|
+
},
|
|
53
|
+
setup(props, { slots }) {
|
|
54
|
+
return () => [
|
|
55
|
+
props.feedback &&
|
|
56
|
+
(props.valid || props.invalid) &&
|
|
57
|
+
h(
|
|
58
|
+
CFormFeedback,
|
|
59
|
+
{
|
|
60
|
+
...(props.invalid && { id: props.describedby }),
|
|
61
|
+
invalid: props.invalid,
|
|
62
|
+
tooltip: props.tooltipFeedback,
|
|
63
|
+
valid: props.valid,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
default: () => (slots.feedback && slots.feedback()) || props.feedback,
|
|
67
|
+
},
|
|
68
|
+
),
|
|
69
|
+
(props.feedbackInvalid || slots.feedbackInvalid) &&
|
|
70
|
+
h(
|
|
71
|
+
CFormFeedback,
|
|
72
|
+
{
|
|
73
|
+
id: props.describedby,
|
|
74
|
+
invalid: true,
|
|
75
|
+
tooltip: props.tooltipFeedback,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
default: () =>
|
|
79
|
+
(slots.feedbackInvalid && slots.feedbackInvalid()) || props.feedbackInvalid,
|
|
80
|
+
},
|
|
81
|
+
),
|
|
82
|
+
(props.feedbackValid || slots.feedbackValid) &&
|
|
83
|
+
h(
|
|
84
|
+
CFormFeedback,
|
|
85
|
+
{
|
|
86
|
+
tooltip: props.tooltipFeedback,
|
|
87
|
+
valid: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
default: () => (slots.feedbackValid && slots.feedbackValid()) || props.feedbackValid,
|
|
91
|
+
},
|
|
92
|
+
),
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
export { CFormControlValidation }
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue'
|
|
2
|
+
import { CFormControlValidation } from './CFormControlValidation'
|
|
3
|
+
import { CFormFloating } from './CFormFloating'
|
|
4
|
+
import { CFormLabel } from './CFormLabel'
|
|
5
|
+
import { CFormText } from './CFormText'
|
|
6
|
+
|
|
7
|
+
const CFormControlWrapper = defineComponent({
|
|
8
|
+
name: 'CFormControlWrapper',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
...CFormControlValidation.props,
|
|
12
|
+
/**
|
|
13
|
+
* Provide valuable, actionable valid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
14
|
+
*
|
|
15
|
+
* @since 4.3.0
|
|
16
|
+
*/
|
|
17
|
+
floatingLabel: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
id: {
|
|
24
|
+
type: String,
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Add a caption for a component.
|
|
28
|
+
*
|
|
29
|
+
* @since 4.3.0
|
|
30
|
+
*/
|
|
31
|
+
label: {
|
|
32
|
+
type: String,
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Add helper text to the component.
|
|
36
|
+
*
|
|
37
|
+
* @since 4.3.0
|
|
38
|
+
*/
|
|
39
|
+
text: {
|
|
40
|
+
type: String,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
setup(props, { slots }) {
|
|
44
|
+
return () =>
|
|
45
|
+
props.floatingLabel
|
|
46
|
+
? h(CFormFloating, [
|
|
47
|
+
slots.default && slots.default(),
|
|
48
|
+
h(
|
|
49
|
+
CFormLabel,
|
|
50
|
+
{
|
|
51
|
+
for: props.id,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
default: () => (slots.label && slots.label()) || props.label || props.floatingLabel,
|
|
55
|
+
},
|
|
56
|
+
),
|
|
57
|
+
])
|
|
58
|
+
: [
|
|
59
|
+
(props.label || slots.label) &&
|
|
60
|
+
h(
|
|
61
|
+
CFormLabel,
|
|
62
|
+
{
|
|
63
|
+
for: props.id,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
default: () => (slots.label && slots.label()) || props.label,
|
|
67
|
+
},
|
|
68
|
+
),
|
|
69
|
+
slots.default && slots.default(),
|
|
70
|
+
(props.text || slots.text) &&
|
|
71
|
+
h(
|
|
72
|
+
CFormText,
|
|
73
|
+
{
|
|
74
|
+
id: props.describedby,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
default: () => (slots.text && slots.text()) || props.text,
|
|
78
|
+
},
|
|
79
|
+
),
|
|
80
|
+
h(
|
|
81
|
+
CFormControlValidation,
|
|
82
|
+
{
|
|
83
|
+
describedby: props.describedby,
|
|
84
|
+
feedback: props.feedback,
|
|
85
|
+
feedbackInvalid: props.feedbackInvalid,
|
|
86
|
+
feedbackValid: props.feedbackValid,
|
|
87
|
+
floatingLabel: props.floatingLabel,
|
|
88
|
+
invalid: props.invalid,
|
|
89
|
+
tooltipFeedback: props.tooltipFeedback,
|
|
90
|
+
valid: props.valid,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
...(slots.feedback && { feedback: () => slots.feedback && slots.feedback() }),
|
|
94
|
+
...(slots.feedbackInvalid && {
|
|
95
|
+
feedbackInvalid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
96
|
+
}),
|
|
97
|
+
...(slots.feedbackValid && {
|
|
98
|
+
feedbackValid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
99
|
+
}),
|
|
100
|
+
},
|
|
101
|
+
),
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
export { CFormControlWrapper }
|