@coreui/vue-pro 4.0.4 → 4.1.3
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/accordion/CAccordion.d.ts +18 -10
- package/dist/components/accordion/CAccordionBody.d.ts +1 -1
- package/dist/components/accordion/CAccordionButton.d.ts +1 -1
- package/dist/components/accordion/CAccordionCollapse.d.ts +9 -5
- package/dist/components/accordion/CAccordionHeader.d.ts +1 -1
- package/dist/components/accordion/CAccordionItem.d.ts +10 -5
- package/dist/components/alert/CAlert.d.ts +38 -12
- package/dist/components/alert/CAlertHeading.d.ts +10 -5
- package/dist/components/alert/CAlertLink.d.ts +1 -1
- package/dist/components/avatar/CAvatar.d.ts +59 -15
- package/dist/components/backdrop/CBackdrop.d.ts +10 -5
- package/dist/components/badge/CBadge.d.ts +59 -16
- package/dist/components/breadcrumb/CBreadcrumb.d.ts +1 -1
- package/dist/components/breadcrumb/CBreadcrumbItem.d.ts +17 -8
- package/dist/components/button/CButton.d.ts +73 -20
- package/dist/components/button-group/CButtonGroup.d.ts +20 -8
- package/dist/components/button-group/CButtonToolbar.d.ts +1 -1
- package/dist/components/callout/CCallout.d.ts +11 -5
- package/dist/components/card/CCard.d.ts +20 -7
- package/dist/components/card/CCardBody.d.ts +1 -1
- package/dist/components/card/CCardFooter.d.ts +1 -1
- package/dist/components/card/CCardGroup.d.ts +1 -1
- package/dist/components/card/CCardHeader.d.ts +10 -5
- package/dist/components/card/CCardImage.d.ts +21 -8
- package/dist/components/card/CCardImageOverlay.d.ts +1 -1
- package/dist/components/card/CCardLink.d.ts +10 -5
- package/dist/components/card/CCardSubtitle.d.ts +10 -5
- package/dist/components/card/CCardText.d.ts +10 -5
- package/dist/components/card/CCardTitle.d.ts +10 -5
- package/dist/components/carousel/CCarousel.d.ts +58 -19
- package/dist/components/carousel/CCarouselCaption.d.ts +1 -1
- package/dist/components/carousel/CCarouselItem.d.ts +25 -9
- package/dist/components/close-button/CCloseButton.d.ts +16 -7
- package/dist/components/collapse/CCollapse.d.ts +24 -5
- package/dist/components/dropdown/CDropdown.d.ts +82 -22
- package/dist/components/dropdown/CDropdownDivider.d.ts +1 -1
- package/dist/components/dropdown/CDropdownHeader.d.ts +10 -5
- package/dist/components/dropdown/CDropdownItem.d.ts +32 -12
- package/dist/components/dropdown/CDropdownMenu.d.ts +12 -5
- package/dist/components/dropdown/CDropdownToggle.d.ts +78 -22
- package/dist/components/element-cover/CElementCover.d.ts +22 -7
- package/dist/components/element-cover/index.d.ts +6 -0
- package/dist/components/footer/CFooter.d.ts +13 -5
- package/dist/components/form/CForm.d.ts +9 -5
- package/dist/components/form/CFormCheck.d.ts +66 -23
- package/dist/components/form/CFormControl.d.ts +61 -20
- package/dist/components/form/CFormFeedback.d.ts +22 -11
- package/dist/components/form/CFormFloating.d.ts +1 -1
- package/dist/components/form/CFormInput.d.ts +66 -20
- package/dist/components/form/CFormLabel.d.ts +10 -5
- package/dist/components/form/CFormRange.d.ts +59 -18
- package/dist/components/form/CFormSelect.d.ts +66 -18
- package/dist/components/form/CFormSwitch.d.ts +61 -18
- package/dist/components/form/CFormText.d.ts +10 -5
- package/dist/components/form/CFormTextarea.d.ts +45 -16
- package/dist/components/form/CInputGroup.d.ts +13 -5
- package/dist/components/form/CInputGroupText.d.ts +10 -5
- package/dist/components/grid/CCol.d.ts +62 -15
- package/dist/components/grid/CContainer.d.ts +44 -15
- package/dist/components/grid/CRow.d.ts +57 -15
- package/dist/components/header/CHeader.d.ts +24 -7
- package/dist/components/header/CHeaderBrand.d.ts +10 -5
- package/dist/components/header/CHeaderDivider.d.ts +1 -1
- package/dist/components/header/CHeaderNav.d.ts +10 -5
- package/dist/components/header/CHeaderText.d.ts +1 -1
- package/dist/components/header/CHeaderToggler.d.ts +1 -1
- package/dist/components/image/CImage.d.ts +34 -12
- package/dist/components/index.d.ts +2 -0
- package/dist/components/link/CLink.d.ts +32 -12
- package/dist/components/list-group/CListGroup.d.ts +28 -10
- package/dist/components/list-group/CListGroupItem.d.ts +33 -12
- package/dist/components/modal/CModal.d.ts +97 -23
- package/dist/components/modal/CModalBody.d.ts +1 -1
- package/dist/components/modal/CModalFooter.d.ts +1 -1
- package/dist/components/modal/CModalHeader.d.ts +10 -5
- package/dist/components/modal/CModalTitle.d.ts +10 -5
- package/dist/components/multi-select/CMultiSelect.d.ts +131 -30
- package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +26 -11
- package/dist/components/multi-select/CMultiSelectOptions.d.ts +40 -11
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +47 -13
- package/dist/components/nav/CNav.d.ts +32 -10
- package/dist/components/nav/CNavGroup.d.ts +10 -7
- package/dist/components/nav/CNavGroupItems.d.ts +1 -1
- package/dist/components/nav/CNavLink.d.ts +32 -12
- package/dist/components/nav/CNavTitle.d.ts +1 -1
- package/dist/components/navbar/CNavbar.d.ts +63 -16
- package/dist/components/navbar/CNavbarBrand.d.ts +19 -8
- package/dist/components/navbar/CNavbarNav.d.ts +10 -5
- package/dist/components/navbar/CNavbarText.d.ts +1 -1
- package/dist/components/navbar/CNavbarToggler.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +44 -14
- package/dist/components/offcanvas/COffcanvasBody.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasHeader.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasTitle.d.ts +10 -5
- package/dist/components/pagination/CPagination.d.ts +24 -7
- package/dist/components/pagination/CPaginationItem.d.ts +32 -12
- package/dist/components/pagination/CSmartPagination.d.ts +120 -28
- package/dist/components/placeholder/CPlaceholder.d.ts +189 -0
- package/dist/components/placeholder/index.d.ts +6 -0
- package/dist/components/popover/CPopover.d.ts +51 -17
- package/dist/components/progress/CProgressBar.d.ts +37 -12
- package/dist/components/sidebar/CSidebar.d.ts +59 -20
- package/dist/components/sidebar/CSidebarBrand.d.ts +1 -1
- package/dist/components/sidebar/CSidebarFooter.d.ts +1 -1
- package/dist/components/sidebar/CSidebarHeader.d.ts +1 -1
- package/dist/components/sidebar/CSidebarNav.d.ts +1 -1
- package/dist/components/sidebar/CSidebarToggler.d.ts +1 -1
- package/dist/components/smart-table/CSmartTable.d.ts +280 -68
- package/dist/components/smart-table/CSmartTableBody.d.ts +37 -20
- package/dist/components/smart-table/CSmartTableCleaner.d.ts +7 -5
- package/dist/components/smart-table/CSmartTableFilter.d.ts +17 -9
- package/dist/components/smart-table/CSmartTableHead.d.ts +42 -23
- package/dist/components/smart-table/CSmartTableItemsPerPageSelector.d.ts +17 -10
- package/dist/components/spinner/CSpinner.d.ts +51 -14
- package/dist/components/table/CTable.d.ts +89 -25
- package/dist/components/table/CTableBody.d.ts +11 -5
- package/dist/components/table/CTableCaption.d.ts +2 -4
- package/dist/components/table/CTableDataCell.d.ts +29 -10
- package/dist/components/table/CTableFoot.d.ts +11 -5
- package/dist/components/table/CTableHead.d.ts +11 -5
- package/dist/components/table/CTableHeaderCell.d.ts +11 -5
- package/dist/components/table/CTableRow.d.ts +29 -10
- package/dist/components/tabs/CTabContent.d.ts +1 -1
- package/dist/components/tabs/CTabPane.d.ts +10 -5
- package/dist/components/toast/CToast.d.ts +59 -18
- package/dist/components/toast/CToastBody.d.ts +1 -1
- package/dist/components/toast/CToastHeader.d.ts +9 -5
- package/dist/components/toast/CToaster.d.ts +13 -5
- package/dist/components/tooltip/CTooltip.d.ts +42 -14
- package/dist/components/widgets/CWidgetStatsA.d.ts +23 -10
- package/dist/components/widgets/CWidgetStatsB.d.ts +46 -18
- package/dist/components/widgets/CWidgetStatsC.d.ts +37 -15
- package/dist/components/widgets/CWidgetStatsD.d.ts +19 -8
- package/dist/components/widgets/CWidgetStatsE.d.ts +18 -8
- package/dist/components/widgets/CWidgetStatsF.d.ts +43 -15
- package/dist/directives/index.d.ts +3 -2
- package/dist/directives/v-c-placeholder.d.ts +6 -0
- package/dist/directives/v-c-visible.d.ts +6 -0
- package/dist/index.es.js +724 -425
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +727 -423
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/components/accordion/__tests__/__snapshots__/CAccordionBody.spec.ts.snap +1 -1
- package/src/components/button/CButton.ts +1 -0
- package/src/components/collapse/CCollapse.ts +49 -21
- package/src/components/collapse/__test__/__snapshots__/CCollapse.spec.ts.snap +1 -1
- package/src/components/element-cover/index.ts +10 -0
- package/src/components/form/CFormInput.ts +6 -6
- package/src/components/form/CFormSelect.ts +21 -6
- package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.ts.snap +8 -2
- package/src/components/form/__tests__/__snapshots__/CFormSelect.spec.ts.snap +1 -1
- package/src/components/grid/CCol.ts +8 -8
- package/src/components/grid/CContainer.ts +3 -3
- package/src/components/grid/CRow.ts +6 -6
- package/src/components/index.ts +2 -0
- package/src/components/modal/CModal.ts +68 -40
- package/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap +1 -2
- package/src/components/offcanvas/COffcanvas.ts +30 -20
- package/src/components/offcanvas/__tests__/COffcanvas.spec.ts +1 -1
- package/src/components/offcanvas/__tests__/__snapshots__/COffcanvas.spec.ts.snap +2 -2
- package/src/components/placeholder/CPlaceholder.ts +139 -0
- package/src/components/placeholder/__tests__/CPlaceholder.spec.ts +44 -0
- package/src/components/placeholder/__tests__/__snapshots__/CPlaceholder.spec.ts.snap +15 -0
- package/src/components/placeholder/index.ts +10 -0
- package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.ts.snap +2 -8
- package/src/components/smart-table/CSmartTable.ts +26 -20
- package/src/components/smart-table/CSmartTableHead.ts +14 -5
- package/src/directives/index.ts +3 -2
- package/src/directives/v-c-placeholder.ts +32 -0
- package/src/directives/v-c-visible.ts +33 -0
- package/src/index.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/vue-pro",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "UI Components Library for Vue.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
"watch": "rollup -c -w"
|
|
36
36
|
},
|
|
37
37
|
"config": {
|
|
38
|
-
"version_short": "4.
|
|
38
|
+
"version_short": "4.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@popperjs/core": "^2.
|
|
41
|
+
"@popperjs/core": "^2.11.2",
|
|
42
42
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
43
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
43
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
44
44
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
45
45
|
"@vue/test-utils": "^2.0.0-0",
|
|
46
|
-
"rollup": "^2.
|
|
46
|
+
"rollup": "^2.66.0",
|
|
47
47
|
"rollup-plugin-vue": "^6.0.0",
|
|
48
|
-
"typescript": "^4.
|
|
49
|
-
"vue": "^3.2.
|
|
48
|
+
"typescript": "^4.5.5",
|
|
49
|
+
"vue": "^3.2.24",
|
|
50
50
|
"vue-types": "^4.1.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@coreui/coreui": "^4.0
|
|
53
|
+
"@coreui/coreui-pro": "^4.1.0",
|
|
54
54
|
"vue": "^3.2.21"
|
|
55
55
|
},
|
|
56
56
|
"standard": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Loads and display CAccordionBody component renders correctly 1`] = `
|
|
4
4
|
"<transition-stub class=\\"accordion-collapse\\">
|
|
5
|
-
<div class=\\"collapse\\"
|
|
5
|
+
<div class=\\"collapse\\">
|
|
6
6
|
<div class=\\"accordion-body\\">Default slot</div>
|
|
7
7
|
</div>
|
|
8
8
|
</transition-stub>"
|
|
@@ -91,6 +91,7 @@ export const CButton = defineComponent({
|
|
|
91
91
|
],
|
|
92
92
|
disabled: props.disabled && props.component !== 'a',
|
|
93
93
|
...(props.component === 'a' && props.disabled && { 'aria-disabled': true, tabIndex: -1 }),
|
|
94
|
+
...(props.component === 'a' && props.href && { href: props.href }),
|
|
94
95
|
},
|
|
95
96
|
slots.default && slots.default(),
|
|
96
97
|
)
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { defineComponent, h, Transition,
|
|
1
|
+
import { defineComponent, h, Transition, ref, RendererElement, withDirectives } from 'vue'
|
|
2
|
+
import { vVisible } from '../../directives/v-c-visible'
|
|
2
3
|
|
|
3
4
|
const CCollapse = defineComponent({
|
|
4
5
|
name: 'CCollapse',
|
|
5
6
|
props: {
|
|
7
|
+
/**
|
|
8
|
+
* Set horizontal collapsing to transition the width instead of height.
|
|
9
|
+
*/
|
|
10
|
+
horizontal: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
required: false,
|
|
13
|
+
},
|
|
6
14
|
/**
|
|
7
15
|
* Toggle the visibility of component.
|
|
8
16
|
*/
|
|
@@ -22,46 +30,68 @@ const CCollapse = defineComponent({
|
|
|
22
30
|
'show',
|
|
23
31
|
],
|
|
24
32
|
setup(props, { slots, emit }) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
const collapsing = ref(false)
|
|
34
|
+
const show = ref(props.visible)
|
|
35
|
+
|
|
36
|
+
const handleBeforeEnter = () => {
|
|
37
|
+
collapsing.value = true
|
|
28
38
|
}
|
|
39
|
+
|
|
29
40
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
30
41
|
emit('show')
|
|
31
42
|
el.addEventListener('transitionend', () => {
|
|
32
|
-
el.classList.add('collapse', 'show')
|
|
33
43
|
done()
|
|
34
44
|
})
|
|
35
|
-
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
if (props.horizontal) {
|
|
47
|
+
el.style.width = `${el.scrollWidth}px`
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
el.style.height = `${el.scrollHeight}px`
|
|
51
|
+
}, 1)
|
|
36
52
|
}
|
|
53
|
+
|
|
37
54
|
const handleAfterEnter = (el: RendererElement) => {
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
show.value = true
|
|
56
|
+
collapsing.value = false
|
|
57
|
+
props.horizontal ? el.style.removeProperty('width') : el.style.removeProperty('height')
|
|
40
58
|
}
|
|
59
|
+
|
|
41
60
|
const handleBeforeLeave = (el: RendererElement) => {
|
|
42
|
-
|
|
61
|
+
collapsing.value = true
|
|
62
|
+
show.value = false
|
|
63
|
+
if (props.horizontal) {
|
|
64
|
+
el.style.width = `${el.scrollWidth}px`
|
|
65
|
+
return
|
|
66
|
+
}
|
|
43
67
|
el.style.height = `${el.scrollHeight}px`
|
|
44
68
|
}
|
|
69
|
+
|
|
45
70
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
46
71
|
emit('hide')
|
|
47
|
-
el.classList.remove('collapse', 'show')
|
|
48
|
-
el.classList.add('collapsing')
|
|
49
72
|
el.addEventListener('transitionend', () => {
|
|
50
73
|
done()
|
|
51
74
|
})
|
|
52
|
-
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
if (props.horizontal) {
|
|
77
|
+
el.style.width = '0px'
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
el.style.height = '0px'
|
|
81
|
+
}, 1)
|
|
53
82
|
}
|
|
83
|
+
|
|
54
84
|
const handleAfterLeave = (el: RendererElement) => {
|
|
55
|
-
|
|
56
|
-
el.
|
|
85
|
+
collapsing.value = false
|
|
86
|
+
props.horizontal ? el.style.removeProperty('width') : el.style.removeProperty('height')
|
|
57
87
|
}
|
|
58
88
|
|
|
59
89
|
return () =>
|
|
60
90
|
h(
|
|
61
91
|
Transition,
|
|
62
92
|
{
|
|
63
|
-
|
|
64
|
-
onBeforeEnter: (
|
|
93
|
+
css: false,
|
|
94
|
+
onBeforeEnter: () => handleBeforeEnter(),
|
|
65
95
|
onEnter: (el, done) => handleEnter(el, done),
|
|
66
96
|
onAfterEnter: (el) => handleAfterEnter(el),
|
|
67
97
|
onBeforeLeave: (el) => handleBeforeLeave(el),
|
|
@@ -74,15 +104,13 @@ const CCollapse = defineComponent({
|
|
|
74
104
|
'div',
|
|
75
105
|
{
|
|
76
106
|
class: [
|
|
77
|
-
'collapse',
|
|
78
|
-
{
|
|
79
|
-
show: props.visible,
|
|
80
|
-
},
|
|
107
|
+
collapsing.value ? 'collapsing' : 'collapse',
|
|
108
|
+
{ 'collapse-horizontal': props.horizontal, show: show.value },
|
|
81
109
|
],
|
|
82
110
|
},
|
|
83
111
|
slots.default && slots.default(),
|
|
84
112
|
),
|
|
85
|
-
[[
|
|
113
|
+
[[vVisible, props.visible]],
|
|
86
114
|
),
|
|
87
115
|
)
|
|
88
116
|
},
|
|
@@ -85,11 +85,11 @@ const CFormInput = defineComponent({
|
|
|
85
85
|
'update:modelValue',
|
|
86
86
|
],
|
|
87
87
|
setup(props, { emit, slots }) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
const handleChange = (event: InputEvent) => {
|
|
89
|
+
const target = event.target as HTMLInputElement
|
|
90
|
+
emit('change', event)
|
|
91
|
+
emit('update:modelValue', target.value)
|
|
92
|
+
}
|
|
93
93
|
const handleInput = (event: InputEvent) => {
|
|
94
94
|
const target = event.target as HTMLInputElement
|
|
95
95
|
emit('input', event)
|
|
@@ -110,7 +110,7 @@ const CFormInput = defineComponent({
|
|
|
110
110
|
},
|
|
111
111
|
],
|
|
112
112
|
disabled: props.disabled,
|
|
113
|
-
|
|
113
|
+
onChange: (event: InputEvent) => handleChange(event),
|
|
114
114
|
onInput: (event: InputEvent) => handleInput(event),
|
|
115
115
|
readonly: props.readonly,
|
|
116
116
|
type: props.type,
|
|
@@ -3,6 +3,7 @@ import { defineComponent, h, PropType } from 'vue'
|
|
|
3
3
|
type Option = {
|
|
4
4
|
disabled?: boolean
|
|
5
5
|
label?: string
|
|
6
|
+
selected?: boolean
|
|
6
7
|
value?: string
|
|
7
8
|
}
|
|
8
9
|
|
|
@@ -28,10 +29,14 @@ const CFormSelect = defineComponent({
|
|
|
28
29
|
* The default name for a value passed using v-model.
|
|
29
30
|
*/
|
|
30
31
|
modelValue: {
|
|
31
|
-
type: String,
|
|
32
|
+
type: [String, Array] as PropType<string | string[]>,
|
|
32
33
|
default: undefined,
|
|
33
34
|
require: false,
|
|
34
35
|
},
|
|
36
|
+
multiple: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: false,
|
|
39
|
+
},
|
|
35
40
|
/**
|
|
36
41
|
* Options list of the select component. Available keys: `label`, `value`, `disabled`.
|
|
37
42
|
* Examples:
|
|
@@ -80,9 +85,8 @@ const CFormSelect = defineComponent({
|
|
|
80
85
|
const selected = Array.from(target.options)
|
|
81
86
|
.filter((option) => option.selected)
|
|
82
87
|
.map((option) => option.value)
|
|
83
|
-
const value = target.multiple ? selected : selected[0]
|
|
84
88
|
emit('change', event)
|
|
85
|
-
emit('update:modelValue',
|
|
89
|
+
emit('update:modelValue', target.multiple ? selected : selected[0])
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
return () =>
|
|
@@ -93,19 +97,30 @@ const CFormSelect = defineComponent({
|
|
|
93
97
|
'form-select',
|
|
94
98
|
{
|
|
95
99
|
[`form-select-${props.size}`]: props.size,
|
|
100
|
+
'is-invalid': props.invalid,
|
|
101
|
+
'is-valid': props.valid,
|
|
96
102
|
},
|
|
97
103
|
],
|
|
104
|
+
multiple: props.multiple,
|
|
98
105
|
onChange: (event: InputEvent) => handleChange(event),
|
|
99
106
|
size: props.htmlSize,
|
|
107
|
+
...(props.modelValue && !props.multiple && { value: props.modelValue }),
|
|
100
108
|
},
|
|
101
109
|
props.options
|
|
102
110
|
? props.options.map((option: Option | string) => {
|
|
103
111
|
return h(
|
|
104
112
|
'option',
|
|
105
113
|
{
|
|
106
|
-
...(typeof option === 'object' &&
|
|
107
|
-
option.disabled && { disabled: option.disabled }),
|
|
108
|
-
|
|
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
|
+
}),
|
|
109
124
|
},
|
|
110
125
|
typeof option === 'string' ? option : option.label,
|
|
111
126
|
)
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Customize with label - CFormCheck component renders correctly 1`] = `
|
|
3
|
+
exports[`Customize with label - CFormCheck component renders correctly 1`] = `
|
|
4
|
+
"<input class=\\"btn-check is-invalid is-valid\\" id=\\"uniqueid\\" type=\\"checkbox\\">
|
|
5
|
+
<label class=\\"btn btn-outline-warning btn-lg rounded-circle\\" for=\\"uniqueid\\">some label</label>"
|
|
6
|
+
`;
|
|
4
7
|
|
|
5
|
-
exports[`Customize with label in slot - CFormCheck component renders correctly 1`] = `
|
|
8
|
+
exports[`Customize with label in slot - CFormCheck component renders correctly 1`] = `
|
|
9
|
+
"<input class=\\"btn-check is-invalid is-valid\\" id=\\"uniqueid\\" type=\\"checkbox\\">
|
|
10
|
+
<label class=\\"btn btn-outline-warning btn-lg rounded-circle\\" for=\\"uniqueid\\">some label</label>"
|
|
11
|
+
`;
|
|
6
12
|
|
|
7
13
|
exports[`Loads and display CFormCheck component renders correctly 1`] = `"<input class=\\"form-check-input\\" type=\\"checkbox\\">"`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Customize CFormSelect component renders correctly 1`] = `"<select class=\\"form-select form-select-lg\\" size=\\"200\\">Default slot</select>"`;
|
|
3
|
+
exports[`Customize CFormSelect component renders correctly 1`] = `"<select class=\\"form-select form-select-lg is-invalid is-valid\\" size=\\"200\\">Default slot</select>"`;
|
|
4
4
|
|
|
5
5
|
exports[`Loads and display CFormSelect component renders correctly 1`] = `"<select class=\\"form-select\\">Default slot</select>"`;
|
|
@@ -84,7 +84,7 @@ const CCol = defineComponent({
|
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
86
|
setup(props, { slots }) {
|
|
87
|
-
const
|
|
87
|
+
const repsonsiveClassNames: string[] = []
|
|
88
88
|
|
|
89
89
|
BREAKPOINTS.forEach((bp) => {
|
|
90
90
|
const breakpoint = props[bp]
|
|
@@ -93,29 +93,29 @@ const CCol = defineComponent({
|
|
|
93
93
|
|
|
94
94
|
if (breakpoint) {
|
|
95
95
|
if (typeof breakpoint === 'number' || typeof breakpoint === 'string') {
|
|
96
|
-
|
|
96
|
+
repsonsiveClassNames.push(`col${infix}-${breakpoint}`)
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
if (typeof breakpoint === 'boolean') {
|
|
100
|
-
|
|
100
|
+
repsonsiveClassNames.push(`col${infix}`)
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
if (breakpoint && typeof breakpoint === 'object') {
|
|
105
105
|
if (typeof breakpoint.span === 'number' || typeof breakpoint.span === 'string') {
|
|
106
|
-
|
|
106
|
+
repsonsiveClassNames.push(`col${infix}-${breakpoint.span}`)
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (typeof breakpoint.span === 'boolean') {
|
|
110
|
-
|
|
110
|
+
repsonsiveClassNames.push(`col${infix}`)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
if (typeof breakpoint.order === 'number' || typeof breakpoint.order === 'string') {
|
|
114
|
-
|
|
114
|
+
repsonsiveClassNames.push(`order${infix}-${breakpoint.order}`)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (typeof breakpoint.offset === 'number') {
|
|
118
|
-
|
|
118
|
+
repsonsiveClassNames.push(`offset${infix}-${breakpoint.offset}`)
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
})
|
|
@@ -124,7 +124,7 @@ const CCol = defineComponent({
|
|
|
124
124
|
h(
|
|
125
125
|
'div',
|
|
126
126
|
{
|
|
127
|
-
class: [
|
|
127
|
+
class: [repsonsiveClassNames.length ? repsonsiveClassNames : 'col'],
|
|
128
128
|
},
|
|
129
129
|
slots.default && slots.default(),
|
|
130
130
|
)
|
|
@@ -56,18 +56,18 @@ const CContainer = defineComponent({
|
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
setup(props, { slots }) {
|
|
59
|
-
const
|
|
59
|
+
const repsonsiveClassNames: string[] = []
|
|
60
60
|
|
|
61
61
|
BREAKPOINTS.forEach((bp) => {
|
|
62
62
|
const breakpoint = props[bp]
|
|
63
63
|
|
|
64
|
-
breakpoint &&
|
|
64
|
+
breakpoint && repsonsiveClassNames.push(`container-${bp}`)
|
|
65
65
|
})
|
|
66
66
|
return () =>
|
|
67
67
|
h(
|
|
68
68
|
'div',
|
|
69
69
|
{
|
|
70
|
-
class: [
|
|
70
|
+
class: [repsonsiveClassNames.length ? repsonsiveClassNames : 'container'],
|
|
71
71
|
},
|
|
72
72
|
slots.default && slots.default(),
|
|
73
73
|
)
|
|
@@ -81,7 +81,7 @@ const CRow = defineComponent({
|
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
83
|
setup(props, { slots }) {
|
|
84
|
-
const
|
|
84
|
+
const repsonsiveClassNames: string[] = []
|
|
85
85
|
|
|
86
86
|
BREAKPOINTS.forEach((bp) => {
|
|
87
87
|
const breakpoint = props[bp]
|
|
@@ -89,16 +89,16 @@ const CRow = defineComponent({
|
|
|
89
89
|
|
|
90
90
|
if (typeof breakpoint === 'object') {
|
|
91
91
|
if (breakpoint.cols) {
|
|
92
|
-
|
|
92
|
+
repsonsiveClassNames.push(`row-cols${infix}-${breakpoint.cols}`)
|
|
93
93
|
}
|
|
94
94
|
if (typeof breakpoint.gutter === 'number') {
|
|
95
|
-
|
|
95
|
+
repsonsiveClassNames.push(`g${infix}-${breakpoint.gutter}`)
|
|
96
96
|
}
|
|
97
97
|
if (typeof breakpoint.gutterX === 'number') {
|
|
98
|
-
|
|
98
|
+
repsonsiveClassNames.push(`gx${infix}-${breakpoint.gutterX}`)
|
|
99
99
|
}
|
|
100
100
|
if (typeof breakpoint.gutterY === 'number') {
|
|
101
|
-
|
|
101
|
+
repsonsiveClassNames.push(`gy${infix}-${breakpoint.gutterY}`)
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
})
|
|
@@ -107,7 +107,7 @@ const CRow = defineComponent({
|
|
|
107
107
|
h(
|
|
108
108
|
'div',
|
|
109
109
|
{
|
|
110
|
-
class: ['row',
|
|
110
|
+
class: ['row', repsonsiveClassNames],
|
|
111
111
|
},
|
|
112
112
|
slots.default && slots.default(),
|
|
113
113
|
)
|
package/src/components/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './carousel'
|
|
|
12
12
|
export * from './close-button'
|
|
13
13
|
export * from './collapse'
|
|
14
14
|
export * from './dropdown'
|
|
15
|
+
export * from './element-cover'
|
|
15
16
|
export * from './footer'
|
|
16
17
|
export * from './form'
|
|
17
18
|
export * from './grid'
|
|
@@ -26,6 +27,7 @@ export * from './nav'
|
|
|
26
27
|
export * from './navbar'
|
|
27
28
|
export * from './offcanvas'
|
|
28
29
|
export * from './pagination'
|
|
30
|
+
export * from './placeholder'
|
|
29
31
|
export * from './progress'
|
|
30
32
|
export * from './popover'
|
|
31
33
|
export * from './sidebar'
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
provide,
|
|
5
|
+
ref,
|
|
6
|
+
RendererElement,
|
|
7
|
+
Transition,
|
|
8
|
+
vShow,
|
|
9
|
+
watch,
|
|
10
|
+
withDirectives,
|
|
11
|
+
} from 'vue'
|
|
2
12
|
|
|
3
13
|
import { CBackdrop } from './../backdrop/CBackdrop'
|
|
4
14
|
|
|
@@ -90,6 +100,14 @@ const CModal = defineComponent({
|
|
|
90
100
|
default: true,
|
|
91
101
|
required: false,
|
|
92
102
|
},
|
|
103
|
+
/**
|
|
104
|
+
* By default the component is unmounted after close animation, if you want to keep the component mounted set this property to false.
|
|
105
|
+
*/
|
|
106
|
+
unmountOnClose: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: true,
|
|
109
|
+
required: false,
|
|
110
|
+
},
|
|
93
111
|
/**
|
|
94
112
|
* Toggle the visibility of alert component.
|
|
95
113
|
*/
|
|
@@ -133,7 +151,7 @@ const CModal = defineComponent({
|
|
|
133
151
|
emit('show')
|
|
134
152
|
}
|
|
135
153
|
const handleAfterEnter = () => {
|
|
136
|
-
window.addEventListener('
|
|
154
|
+
window.addEventListener('mousedown', handleMouseDown)
|
|
137
155
|
window.addEventListener('keyup', handleKeyUp)
|
|
138
156
|
}
|
|
139
157
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
@@ -144,7 +162,7 @@ const CModal = defineComponent({
|
|
|
144
162
|
el.classList.remove('show')
|
|
145
163
|
}
|
|
146
164
|
const handleAfterLeave = (el: RendererElement) => {
|
|
147
|
-
window.removeEventListener('
|
|
165
|
+
window.removeEventListener('mousedown', handleMouseDown)
|
|
148
166
|
window.removeEventListener('keyup', handleKeyUp)
|
|
149
167
|
el.style.display = 'none'
|
|
150
168
|
}
|
|
@@ -168,7 +186,12 @@ const CModal = defineComponent({
|
|
|
168
186
|
}
|
|
169
187
|
}
|
|
170
188
|
}
|
|
171
|
-
|
|
189
|
+
|
|
190
|
+
const handleMouseDown = (event: Event) => {
|
|
191
|
+
window.addEventListener('mouseup', () => handleMouseUp(event), { once: true })
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const handleMouseUp = (event: Event) => {
|
|
172
195
|
if (modalContentRef.value && !modalContentRef.value.contains(event.target as HTMLElement)) {
|
|
173
196
|
if (props.backdrop !== 'static') {
|
|
174
197
|
handleDismiss()
|
|
@@ -184,52 +207,57 @@ const CModal = defineComponent({
|
|
|
184
207
|
|
|
185
208
|
provide('handleDismiss', handleDismiss)
|
|
186
209
|
|
|
210
|
+
const modal = () =>
|
|
211
|
+
h(
|
|
212
|
+
'div',
|
|
213
|
+
{
|
|
214
|
+
class: [
|
|
215
|
+
'modal',
|
|
216
|
+
{
|
|
217
|
+
['fade']: props.transition,
|
|
218
|
+
},
|
|
219
|
+
attrs.class,
|
|
220
|
+
],
|
|
221
|
+
ref: modalRef,
|
|
222
|
+
},
|
|
223
|
+
h(
|
|
224
|
+
'div',
|
|
225
|
+
{
|
|
226
|
+
class: [
|
|
227
|
+
'modal-dialog',
|
|
228
|
+
{
|
|
229
|
+
'modal-dialog-centered': props.alignment === 'center',
|
|
230
|
+
[`modal-fullscreen-${props.fullscreen}-down`]:
|
|
231
|
+
props.fullscreen && typeof props.fullscreen === 'string',
|
|
232
|
+
'modal-fullscreen': props.fullscreen && typeof props.fullscreen === 'boolean',
|
|
233
|
+
['modal-dialog-scrollable']: props.scrollable,
|
|
234
|
+
[`modal-${props.size}`]: props.size,
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
role: 'dialog',
|
|
238
|
+
},
|
|
239
|
+
h(
|
|
240
|
+
'div',
|
|
241
|
+
{ class: ['modal-content', props.contentClassName], ref: modalContentRef },
|
|
242
|
+
slots.default && slots.default(),
|
|
243
|
+
),
|
|
244
|
+
),
|
|
245
|
+
)
|
|
246
|
+
|
|
187
247
|
return () => [
|
|
188
248
|
h(
|
|
189
249
|
Transition,
|
|
190
250
|
{
|
|
251
|
+
css: false,
|
|
191
252
|
onEnter: (el, done) => handleEnter(el, done),
|
|
192
253
|
onAfterEnter: () => handleAfterEnter(),
|
|
193
254
|
onLeave: (el, done) => handleLeave(el, done),
|
|
194
255
|
onAfterLeave: (el) => handleAfterLeave(el),
|
|
195
256
|
},
|
|
196
257
|
() =>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
{
|
|
201
|
-
class: [
|
|
202
|
-
'modal',
|
|
203
|
-
{
|
|
204
|
-
['fade']: props.transition,
|
|
205
|
-
},
|
|
206
|
-
attrs.class,
|
|
207
|
-
],
|
|
208
|
-
ref: modalRef,
|
|
209
|
-
},
|
|
210
|
-
h(
|
|
211
|
-
'div',
|
|
212
|
-
{
|
|
213
|
-
class: [
|
|
214
|
-
'modal-dialog',
|
|
215
|
-
{
|
|
216
|
-
'modal-dialog-centered': props.alignment === 'center',
|
|
217
|
-
[`modal-fullscreen-${props.fullscreen}-down`]:
|
|
218
|
-
props.fullscreen && typeof props.fullscreen === 'string',
|
|
219
|
-
'modal-fullscreen': props.fullscreen && typeof props.fullscreen === 'boolean',
|
|
220
|
-
['modal-dialog-scrollable']: props.scrollable,
|
|
221
|
-
[`modal-${props.size}`]: props.size,
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
role: 'dialog',
|
|
225
|
-
},
|
|
226
|
-
h(
|
|
227
|
-
'div',
|
|
228
|
-
{ class: ['modal-content', props.contentClassName], ref: modalContentRef },
|
|
229
|
-
slots.default && slots.default(),
|
|
230
|
-
),
|
|
231
|
-
),
|
|
232
|
-
),
|
|
258
|
+
props.unmountOnClose
|
|
259
|
+
? visible.value && modal()
|
|
260
|
+
: withDirectives(modal(), [[vShow, visible.value]]),
|
|
233
261
|
),
|
|
234
262
|
props.backdrop &&
|
|
235
263
|
h(CBackdrop, {
|
|
@@ -7,8 +7,7 @@ exports[`Customize CModal component renders correctly 1`] = `
|
|
|
7
7
|
<div class=\\"modal-content bazinga\\">Default slot</div>
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
|
-
</transition-stub>
|
|
11
|
-
<!---->"
|
|
10
|
+
</transition-stub>"
|
|
12
11
|
`;
|
|
13
12
|
|
|
14
13
|
exports[`Loads and display CModal component renders correctly 1`] = `
|