@coreui/vue-pro 4.3.0-beta.1 → 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 +15 -2
- package/dist/components/carousel/CCarousel.d.ts +1 -1
- package/dist/components/date-picker/CDatePicker.d.ts +10 -2
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +86 -3
- 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/modal/CModal.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
- package/dist/components/time-picker/CTimePicker.d.ts +1 -1
- package/dist/components/toast/CToast.d.ts +7 -1
- package/dist/index.es.js +3583 -577
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3582 -576
- package/dist/index.js.map +1 -1
- package/dist/utils/calendar.d.ts +3 -1
- package/dist/utils/time.d.ts +6 -2
- 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 +132 -62
- package/src/components/collapse/CCollapse.ts +5 -6
- package/src/components/date-picker/CDatePicker.ts +7 -10
- package/src/components/date-range-picker/CDateRangePicker.ts +198 -100
- 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/modal/CModal.ts +14 -6
- package/src/components/nav/CNavGroup.ts +4 -6
- package/src/components/offcanvas/COffcanvas.ts +5 -7
- package/src/components/picker/CPicker.ts +1 -0
- package/src/components/popover/CPopover.ts +5 -5
- package/src/components/tabs/CTabPane.ts +4 -6
- package/src/components/time-picker/CTimePicker.ts +12 -17
- package/src/components/toast/CToast.ts +17 -12
- package/src/components/tooltip/CTooltip.ts +5 -5
- package/src/utils/calendar.ts +86 -9
- package/src/utils/time.ts +29 -3
- package/src/utils/transition.ts +65 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, h } from 'vue'
|
|
2
|
+
import { CFormLabel } from './CFormLabel'
|
|
2
3
|
|
|
3
4
|
const CFormRange = defineComponent({
|
|
4
5
|
name: 'CFormRange',
|
|
@@ -9,7 +10,14 @@ const CFormRange = defineComponent({
|
|
|
9
10
|
disabled: {
|
|
10
11
|
type: Boolean,
|
|
11
12
|
default: undefined,
|
|
12
|
-
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* Add a caption for a component.
|
|
16
|
+
*
|
|
17
|
+
* @since 4.3.0
|
|
18
|
+
*/
|
|
19
|
+
label: {
|
|
20
|
+
type: String,
|
|
13
21
|
},
|
|
14
22
|
/**
|
|
15
23
|
* Specifies the maximum value for the component.
|
|
@@ -17,7 +25,6 @@ const CFormRange = defineComponent({
|
|
|
17
25
|
max: {
|
|
18
26
|
type: Number,
|
|
19
27
|
default: undefined,
|
|
20
|
-
required: false,
|
|
21
28
|
},
|
|
22
29
|
/**
|
|
23
30
|
* Specifies the minimum value for the component.
|
|
@@ -25,7 +32,6 @@ const CFormRange = defineComponent({
|
|
|
25
32
|
min: {
|
|
26
33
|
type: Number,
|
|
27
34
|
default: undefined,
|
|
28
|
-
required: false,
|
|
29
35
|
},
|
|
30
36
|
/**
|
|
31
37
|
* The default name for a value passed using v-model.
|
|
@@ -33,14 +39,12 @@ const CFormRange = defineComponent({
|
|
|
33
39
|
modelValue: {
|
|
34
40
|
type: String,
|
|
35
41
|
value: undefined,
|
|
36
|
-
required: false,
|
|
37
42
|
},
|
|
38
43
|
/**
|
|
39
44
|
* Toggle the readonly state for the component.
|
|
40
45
|
*/
|
|
41
46
|
readonly: {
|
|
42
47
|
type: Boolean,
|
|
43
|
-
required: false,
|
|
44
48
|
},
|
|
45
49
|
/**
|
|
46
50
|
* Specifies the interval between legal numbers in the component.
|
|
@@ -48,7 +52,6 @@ const CFormRange = defineComponent({
|
|
|
48
52
|
steps: {
|
|
49
53
|
type: Number,
|
|
50
54
|
default: undefined,
|
|
51
|
-
required: false,
|
|
52
55
|
},
|
|
53
56
|
/**
|
|
54
57
|
* The `value` attribute of component.
|
|
@@ -58,7 +61,6 @@ const CFormRange = defineComponent({
|
|
|
58
61
|
value: {
|
|
59
62
|
type: Number,
|
|
60
63
|
default: undefined,
|
|
61
|
-
required: false,
|
|
62
64
|
},
|
|
63
65
|
},
|
|
64
66
|
emits: [
|
|
@@ -71,29 +73,41 @@ const CFormRange = defineComponent({
|
|
|
71
73
|
*/
|
|
72
74
|
'update:modelValue',
|
|
73
75
|
],
|
|
74
|
-
setup(props, { emit, slots }) {
|
|
76
|
+
setup(props, { attrs, emit, slots }) {
|
|
75
77
|
const handleChange = (event: InputEvent) => {
|
|
76
78
|
const target = event.target as HTMLInputElement
|
|
77
79
|
emit('change', event)
|
|
78
80
|
emit('update:modelValue', target.value)
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
return () =>
|
|
83
|
+
return () => [
|
|
84
|
+
props.label &&
|
|
85
|
+
h(
|
|
86
|
+
CFormLabel,
|
|
87
|
+
{
|
|
88
|
+
for: attrs.id,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
default: () => (slots.label && slots.label()) || props.label,
|
|
92
|
+
},
|
|
93
|
+
),
|
|
82
94
|
h(
|
|
83
95
|
'input',
|
|
84
96
|
{
|
|
97
|
+
...attrs,
|
|
85
98
|
class: 'form-range',
|
|
86
99
|
disabled: props.disabled,
|
|
87
100
|
max: props.max,
|
|
88
101
|
min: props.min,
|
|
89
102
|
onChange: (event: InputEvent) => handleChange(event),
|
|
90
|
-
steps: props.steps,
|
|
91
103
|
readonly: props.readonly,
|
|
104
|
+
steps: props.steps,
|
|
92
105
|
type: 'range',
|
|
93
106
|
value: props.modelValue,
|
|
94
107
|
},
|
|
95
108
|
slots.default && slots.default(),
|
|
96
|
-
)
|
|
109
|
+
),
|
|
110
|
+
]
|
|
97
111
|
},
|
|
98
112
|
})
|
|
99
113
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, h, PropType } from 'vue'
|
|
2
|
+
import { CFormControlWrapper } from './CFormControlWrapper'
|
|
2
3
|
|
|
3
4
|
type Option = {
|
|
4
5
|
disabled?: boolean
|
|
@@ -10,6 +11,38 @@ type Option = {
|
|
|
10
11
|
const CFormSelect = defineComponent({
|
|
11
12
|
name: 'CFormSelect',
|
|
12
13
|
props: {
|
|
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
|
+
* Provide valuable, actionable valid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
40
|
+
*
|
|
41
|
+
* @since 4.3.0
|
|
42
|
+
*/
|
|
43
|
+
floatingLabel: {
|
|
44
|
+
type: String,
|
|
45
|
+
},
|
|
13
46
|
/**
|
|
14
47
|
* Specifies the number of visible options in a drop-down list.
|
|
15
48
|
*/
|
|
@@ -18,12 +51,23 @@ const CFormSelect = defineComponent({
|
|
|
18
51
|
default: undefined,
|
|
19
52
|
required: false,
|
|
20
53
|
},
|
|
54
|
+
/**
|
|
55
|
+
* The id global attribute defines an identifier (ID) that must be unique in the whole document.
|
|
56
|
+
*/
|
|
57
|
+
id: {
|
|
58
|
+
type: String,
|
|
59
|
+
},
|
|
21
60
|
/**
|
|
22
61
|
* Set component validation state to invalid.
|
|
23
62
|
*/
|
|
24
|
-
invalid:
|
|
25
|
-
|
|
26
|
-
|
|
63
|
+
invalid: Boolean,
|
|
64
|
+
/**
|
|
65
|
+
* Add a caption for a component.
|
|
66
|
+
*
|
|
67
|
+
* @since 4.3.0
|
|
68
|
+
*/
|
|
69
|
+
label: {
|
|
70
|
+
type: String,
|
|
27
71
|
},
|
|
28
72
|
/**
|
|
29
73
|
* The default name for a value passed using v-model.
|
|
@@ -62,12 +106,23 @@ const CFormSelect = defineComponent({
|
|
|
62
106
|
},
|
|
63
107
|
},
|
|
64
108
|
/**
|
|
65
|
-
*
|
|
109
|
+
* Add helper text to the component.
|
|
110
|
+
*
|
|
111
|
+
* @since 4.3.0
|
|
66
112
|
*/
|
|
67
|
-
|
|
68
|
-
type:
|
|
69
|
-
required: false,
|
|
113
|
+
text: {
|
|
114
|
+
type: String,
|
|
70
115
|
},
|
|
116
|
+
/**
|
|
117
|
+
* Display validation feedback in a styled tooltip.
|
|
118
|
+
*
|
|
119
|
+
* @since 4.3.0
|
|
120
|
+
*/
|
|
121
|
+
tooltipFeedback: Boolean,
|
|
122
|
+
/**
|
|
123
|
+
* Set component validation state to valid.
|
|
124
|
+
*/
|
|
125
|
+
valid: Boolean,
|
|
71
126
|
},
|
|
72
127
|
emits: [
|
|
73
128
|
/**
|
|
@@ -79,7 +134,7 @@ const CFormSelect = defineComponent({
|
|
|
79
134
|
*/
|
|
80
135
|
'update:modelValue',
|
|
81
136
|
],
|
|
82
|
-
setup(props, { emit, slots }) {
|
|
137
|
+
setup(props, { attrs, emit, slots }) {
|
|
83
138
|
const handleChange = (event: InputEvent) => {
|
|
84
139
|
const target = event.target as HTMLSelectElement
|
|
85
140
|
const selected = Array.from(target.options)
|
|
@@ -91,41 +146,71 @@ const CFormSelect = defineComponent({
|
|
|
91
146
|
|
|
92
147
|
return () =>
|
|
93
148
|
h(
|
|
94
|
-
|
|
149
|
+
CFormControlWrapper,
|
|
150
|
+
{
|
|
151
|
+
describedby: attrs['aria-describedby'],
|
|
152
|
+
feedback: props.feedback,
|
|
153
|
+
feedbackInvalid: props.feedbackInvalid,
|
|
154
|
+
feedbackValid: props.feedbackValid,
|
|
155
|
+
floatingLabel: props.floatingLabel,
|
|
156
|
+
id: props.id,
|
|
157
|
+
invalid: props.invalid,
|
|
158
|
+
label: props.label,
|
|
159
|
+
text: props.text,
|
|
160
|
+
tooltipFeedback: props.tooltipFeedback,
|
|
161
|
+
valid: props.valid,
|
|
162
|
+
},
|
|
95
163
|
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
164
|
+
default: () =>
|
|
165
|
+
h(
|
|
166
|
+
'select',
|
|
167
|
+
{
|
|
168
|
+
...attrs,
|
|
169
|
+
class: [
|
|
170
|
+
'form-select',
|
|
171
|
+
{
|
|
172
|
+
[`form-select-${props.size}`]: props.size,
|
|
173
|
+
'is-invalid': props.invalid,
|
|
174
|
+
'is-valid': props.valid,
|
|
175
|
+
},
|
|
176
|
+
attrs.class,
|
|
177
|
+
],
|
|
178
|
+
multiple: props.multiple,
|
|
179
|
+
onChange: (event: InputEvent) => handleChange(event),
|
|
180
|
+
size: props.htmlSize,
|
|
181
|
+
...(props.modelValue && !props.multiple && { value: props.modelValue }),
|
|
182
|
+
},
|
|
183
|
+
props.options
|
|
184
|
+
? props.options.map((option: Option | string) => {
|
|
185
|
+
return h(
|
|
186
|
+
'option',
|
|
187
|
+
{
|
|
188
|
+
...(typeof option === 'object' && {
|
|
189
|
+
...(option.disabled && { disabled: option.disabled }),
|
|
190
|
+
...(option.selected && { selected: option.selected }),
|
|
191
|
+
...(option.value && {
|
|
192
|
+
value: option.value,
|
|
193
|
+
...(props.modelValue &&
|
|
194
|
+
props.multiple &&
|
|
195
|
+
props.modelValue.includes(option.value) && { selected: true }),
|
|
196
|
+
}),
|
|
197
|
+
}),
|
|
198
|
+
},
|
|
199
|
+
typeof option === 'string' ? option : option.label,
|
|
200
|
+
)
|
|
201
|
+
})
|
|
202
|
+
: slots.default && slots.default(),
|
|
203
|
+
),
|
|
204
|
+
...(slots.feedback && { feedback: () => slots.feedback && slots.feedback() }),
|
|
205
|
+
...(slots.feedbackInvalid && {
|
|
206
|
+
feedbackInvalid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
207
|
+
}),
|
|
208
|
+
...(slots.feedbackValid && {
|
|
209
|
+
feedbackValid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
210
|
+
}),
|
|
211
|
+
...(slots.label && { label: () => slots.label && slots.label() }),
|
|
212
|
+
...(slots.text && { text: () => slots.text && slots.text() }),
|
|
108
213
|
},
|
|
109
|
-
props.options
|
|
110
|
-
? props.options.map((option: Option | string) => {
|
|
111
|
-
return h(
|
|
112
|
-
'option',
|
|
113
|
-
{
|
|
114
|
-
...(typeof option === 'object' && {
|
|
115
|
-
...(option.disabled && { disabled: option.disabled }),
|
|
116
|
-
...(option.selected && { selected: option.selected }),
|
|
117
|
-
...(option.value && {
|
|
118
|
-
value: option.value,
|
|
119
|
-
...(props.modelValue &&
|
|
120
|
-
props.multiple &&
|
|
121
|
-
props.modelValue.includes(option.value) && { selected: true }),
|
|
122
|
-
}),
|
|
123
|
-
}),
|
|
124
|
-
},
|
|
125
|
-
typeof option === 'string' ? option : option.label,
|
|
126
|
-
)
|
|
127
|
-
})
|
|
128
|
-
: slots.default && slots.default(),
|
|
129
214
|
)
|
|
130
215
|
},
|
|
131
216
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h
|
|
1
|
+
import { defineComponent, h } from 'vue'
|
|
2
2
|
|
|
3
3
|
import { CFormLabel } from './CFormLabel'
|
|
4
4
|
|
|
@@ -11,23 +11,18 @@ const CFormSwitch = defineComponent({
|
|
|
11
11
|
*/
|
|
12
12
|
id: {
|
|
13
13
|
type: String,
|
|
14
|
-
default: undefined,
|
|
15
|
-
required: false,
|
|
16
14
|
},
|
|
17
15
|
/**
|
|
18
16
|
* Set component validation state to invalid.
|
|
19
17
|
*/
|
|
20
18
|
invalid: {
|
|
21
19
|
type: Boolean,
|
|
22
|
-
required: false,
|
|
23
20
|
},
|
|
24
21
|
/**
|
|
25
22
|
* The element represents a caption for a component.
|
|
26
23
|
*/
|
|
27
24
|
label: {
|
|
28
25
|
type: String,
|
|
29
|
-
default: undefined,
|
|
30
|
-
required: false,
|
|
31
26
|
},
|
|
32
27
|
/**
|
|
33
28
|
* The default name for a value passed using v-model.
|
|
@@ -35,7 +30,6 @@ const CFormSwitch = defineComponent({
|
|
|
35
30
|
modelValue: {
|
|
36
31
|
type: [Boolean, String],
|
|
37
32
|
value: undefined,
|
|
38
|
-
required: false,
|
|
39
33
|
},
|
|
40
34
|
/**
|
|
41
35
|
* Size the component large or extra large. Works only with `switch`.
|
|
@@ -44,8 +38,6 @@ const CFormSwitch = defineComponent({
|
|
|
44
38
|
*/
|
|
45
39
|
size: {
|
|
46
40
|
type: String,
|
|
47
|
-
default: undefined,
|
|
48
|
-
required: false,
|
|
49
41
|
validator: (value: string) => {
|
|
50
42
|
return ['lg', 'xl'].includes(value)
|
|
51
43
|
},
|
|
@@ -58,14 +50,12 @@ const CFormSwitch = defineComponent({
|
|
|
58
50
|
type: {
|
|
59
51
|
type: String,
|
|
60
52
|
default: 'checkbox',
|
|
61
|
-
required: false,
|
|
62
53
|
},
|
|
63
54
|
/**
|
|
64
55
|
* Set component validation state to valid.
|
|
65
56
|
*/
|
|
66
57
|
valid: {
|
|
67
58
|
type: Boolean,
|
|
68
|
-
required: false,
|
|
69
59
|
},
|
|
70
60
|
},
|
|
71
61
|
emits: [
|
|
@@ -79,15 +69,6 @@ const CFormSwitch = defineComponent({
|
|
|
79
69
|
'update:modelValue',
|
|
80
70
|
],
|
|
81
71
|
setup(props, { attrs, emit }) {
|
|
82
|
-
const checked = ref(attrs.checked)
|
|
83
|
-
|
|
84
|
-
watch(
|
|
85
|
-
() => props.modelValue,
|
|
86
|
-
() => {
|
|
87
|
-
if (typeof props.modelValue === 'boolean') checked.value = props.modelValue
|
|
88
|
-
},
|
|
89
|
-
)
|
|
90
|
-
|
|
91
72
|
const handleChange = (event: InputEvent) => {
|
|
92
73
|
const target = event.target as HTMLInputElement
|
|
93
74
|
emit('change', event)
|
|
@@ -110,7 +91,7 @@ const CFormSwitch = defineComponent({
|
|
|
110
91
|
[
|
|
111
92
|
h('input', {
|
|
112
93
|
...attrs,
|
|
113
|
-
checked:
|
|
94
|
+
...(props.modelValue && { checked: props.modelValue }),
|
|
114
95
|
class: [
|
|
115
96
|
'form-check-input',
|
|
116
97
|
{
|
|
@@ -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
|
})
|
|
@@ -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)
|