@coreui/vue-pro 4.1.0 → 4.1.4
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 +16 -7
- 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/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/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 +96 -22
- 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 +89 -24
- package/dist/components/popover/CPopover.d.ts +50 -16
- 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 +31 -25
- 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 +43 -24
- 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 +88 -24
- 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 +45 -17
- 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 +42 -14
- package/dist/index.es.js +118 -71
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +117 -70
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/form/CFormSelect.ts +19 -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/modal/CModal.ts +68 -40
- package/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap +1 -2
- package/src/components/offcanvas/COffcanvas.ts +11 -4
- package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.ts.snap +2 -8
- package/src/components/smart-table/CSmartTable.ts +25 -20
- package/src/components/smart-table/CSmartTableBody.ts +0 -5
- package/src/components/smart-table/CSmartTableHead.ts +14 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/vue-pro",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4",
|
|
4
4
|
"description": "UI Components Library for Vue.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"version_short": "4.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@popperjs/core": "^2.11.
|
|
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.5.
|
|
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.1.0",
|
|
53
|
+
"@coreui/coreui-pro": "^4.1.0",
|
|
54
54
|
"vue": "^3.2.21"
|
|
55
55
|
},
|
|
56
56
|
"standard": {
|
|
@@ -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 () =>
|
|
@@ -97,17 +101,26 @@ const CFormSelect = defineComponent({
|
|
|
97
101
|
'is-valid': props.valid,
|
|
98
102
|
},
|
|
99
103
|
],
|
|
104
|
+
multiple: props.multiple,
|
|
100
105
|
onChange: (event: InputEvent) => handleChange(event),
|
|
101
106
|
size: props.htmlSize,
|
|
107
|
+
...(props.modelValue && !props.multiple && { value: props.modelValue }),
|
|
102
108
|
},
|
|
103
109
|
props.options
|
|
104
110
|
? props.options.map((option: Option | string) => {
|
|
105
111
|
return h(
|
|
106
112
|
'option',
|
|
107
113
|
{
|
|
108
|
-
...(typeof option === 'object' &&
|
|
109
|
-
option.disabled && { disabled: option.disabled }),
|
|
110
|
-
|
|
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
|
+
}),
|
|
111
124
|
},
|
|
112
125
|
typeof option === 'string' ? option : option.label,
|
|
113
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>"`;
|
|
@@ -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`] = `
|
|
@@ -97,19 +97,20 @@ const COffcanvas = defineComponent({
|
|
|
97
97
|
}, 1)
|
|
98
98
|
}
|
|
99
99
|
const handleAfterEnter = () => {
|
|
100
|
-
window.addEventListener('
|
|
100
|
+
window.addEventListener('mousedown', handleMouseDown)
|
|
101
|
+
// window.addEventListener('click', handleClickOutside)
|
|
101
102
|
window.addEventListener('keyup', handleKeyUp)
|
|
102
103
|
}
|
|
103
104
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
104
105
|
el.addEventListener('transitionend', () => {
|
|
105
106
|
done()
|
|
106
107
|
})
|
|
108
|
+
window.removeEventListener('mousedown', handleMouseDown)
|
|
109
|
+
window.removeEventListener('keyup', handleKeyUp)
|
|
107
110
|
el.classList.remove('show')
|
|
108
111
|
}
|
|
109
112
|
const handleAfterLeave = (el: RendererElement) => {
|
|
110
113
|
el.style.visibility = 'hidden'
|
|
111
|
-
window.removeEventListener('click', handleClickOutside)
|
|
112
|
-
window.removeEventListener('keyup', handleKeyUp)
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
const handleDismiss = () => {
|
|
@@ -124,7 +125,12 @@ const COffcanvas = defineComponent({
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
|
-
|
|
128
|
+
|
|
129
|
+
const handleMouseDown = (event: Event) => {
|
|
130
|
+
window.addEventListener('mouseup', () => handleMouseUp(event), { once: true })
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const handleMouseUp = (event: Event) => {
|
|
128
134
|
if (offcanvasRef.value && !offcanvasRef.value.contains(event.target as HTMLElement)) {
|
|
129
135
|
props.backdrop && handleDismiss()
|
|
130
136
|
}
|
|
@@ -134,6 +140,7 @@ const COffcanvas = defineComponent({
|
|
|
134
140
|
h(
|
|
135
141
|
Transition,
|
|
136
142
|
{
|
|
143
|
+
css: false,
|
|
137
144
|
onEnter: (el, done) => handleEnter(el, done),
|
|
138
145
|
onAfterEnter: () => handleAfterEnter(),
|
|
139
146
|
onLeave: (el, done) => handleLeave(el, done),
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Customize CSidebar component renders correctly 1`] = `
|
|
4
|
-
"<div class=\\"sidebar sidebar-narrow sidebar-overlaid sidebar-fixed sidebar-xl sidebar-narrow-unfoldable\\">Default slot</div>
|
|
5
|
-
<!---->"
|
|
6
|
-
`;
|
|
3
|
+
exports[`Customize CSidebar component renders correctly 1`] = `"<div class=\\"sidebar sidebar-narrow sidebar-overlaid sidebar-fixed sidebar-xl sidebar-narrow-unfoldable\\">Default slot</div>"`;
|
|
7
4
|
|
|
8
|
-
exports[`Loads and display CSidebar component renders correctly 1`] = `
|
|
9
|
-
"<div class=\\"sidebar hide\\">Default slot</div>
|
|
10
|
-
<!---->"
|
|
11
|
-
`;
|
|
5
|
+
exports[`Loads and display CSidebar component renders correctly 1`] = `"<div class=\\"sidebar hide\\">Default slot</div>"`;
|
|
@@ -67,7 +67,6 @@ const CSmartTable = defineComponent({
|
|
|
67
67
|
*/
|
|
68
68
|
columnFilter: {
|
|
69
69
|
type: [Boolean, Object] as PropType<boolean | ColumnFilter>,
|
|
70
|
-
default: undefined,
|
|
71
70
|
required: false,
|
|
72
71
|
},
|
|
73
72
|
/**
|
|
@@ -95,7 +94,6 @@ const CSmartTable = defineComponent({
|
|
|
95
94
|
*/
|
|
96
95
|
columns: {
|
|
97
96
|
type: Array as PropType<Column[] | string[]>,
|
|
98
|
-
default: () => [],
|
|
99
97
|
required: false,
|
|
100
98
|
},
|
|
101
99
|
/**
|
|
@@ -144,7 +142,6 @@ const CSmartTable = defineComponent({
|
|
|
144
142
|
*/
|
|
145
143
|
itemsPerPage: {
|
|
146
144
|
type: Number,
|
|
147
|
-
default: 10,
|
|
148
145
|
required: false,
|
|
149
146
|
},
|
|
150
147
|
/**
|
|
@@ -216,7 +213,8 @@ const CSmartTable = defineComponent({
|
|
|
216
213
|
*/
|
|
217
214
|
selectable: Boolean,
|
|
218
215
|
/**
|
|
219
|
-
* State of the sorter. Name key is column name, direction can be 'asc' or 'desc'. Set .sync modifier to track changes.
|
|
216
|
+
* State of the sorter. Name key is column name, direction can be 'asc' or 'desc'. Set .sync modifier to track changes. eg.:
|
|
217
|
+
* { column: 'status', state: 'asc' }
|
|
220
218
|
*
|
|
221
219
|
* @type SorterValue
|
|
222
220
|
*/
|
|
@@ -404,7 +402,7 @@ const CSmartTable = defineComponent({
|
|
|
404
402
|
}
|
|
405
403
|
})
|
|
406
404
|
|
|
407
|
-
const itemsPerPage = ref<number>(props.itemsPerPage)
|
|
405
|
+
const itemsPerPage = ref<number>(props.itemsPerPage || items.value.length)
|
|
408
406
|
const activePage = ref(props.activePage)
|
|
409
407
|
|
|
410
408
|
const sorterState: SorterValue = reactive(props.sorterValue || {})
|
|
@@ -423,7 +421,7 @@ const CSmartTable = defineComponent({
|
|
|
423
421
|
// functions
|
|
424
422
|
|
|
425
423
|
const isSortable = (i: number): boolean | undefined => {
|
|
426
|
-
const isDataColumn = itemsDataColumns.value.includes(rawColumnNames[i])
|
|
424
|
+
const isDataColumn = itemsDataColumns.value.includes(rawColumnNames.value[i])
|
|
427
425
|
let column
|
|
428
426
|
if (props.columns) column = props.columns[i]
|
|
429
427
|
return (
|
|
@@ -539,16 +537,22 @@ const CSmartTable = defineComponent({
|
|
|
539
537
|
|
|
540
538
|
// computed
|
|
541
539
|
|
|
542
|
-
const genCols =
|
|
540
|
+
const genCols = computed(() =>
|
|
541
|
+
Object.keys(items.value[0] || {}).filter((el) => el.charAt(0) !== '_'),
|
|
542
|
+
)
|
|
543
543
|
|
|
544
|
-
const rawColumnNames =
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
544
|
+
const rawColumnNames = computed(() =>
|
|
545
|
+
props.columns
|
|
546
|
+
? props.columns.map((column: Column | string) => {
|
|
547
|
+
if (typeof column === 'object') return column.key
|
|
548
|
+
else return column
|
|
549
|
+
})
|
|
550
|
+
: genCols.value,
|
|
551
|
+
) //! || el
|
|
550
552
|
|
|
551
|
-
const itemsDataColumns = computed(() =>
|
|
553
|
+
const itemsDataColumns = computed(() =>
|
|
554
|
+
rawColumnNames.value.filter((name) => genCols.value.includes(name)),
|
|
555
|
+
)
|
|
552
556
|
|
|
553
557
|
// variables
|
|
554
558
|
|
|
@@ -657,6 +661,8 @@ const CSmartTable = defineComponent({
|
|
|
657
661
|
},
|
|
658
662
|
props.tableFilter &&
|
|
659
663
|
h(CSmartTableFilter, {
|
|
664
|
+
filterLabel: props.tableFilterLabel,
|
|
665
|
+
filterPlaceholder: props.tableFilterPlaceholder,
|
|
660
666
|
onFilterInput: (value: string) => tableFilterChange(value, 'input'),
|
|
661
667
|
onFilterChange: (value: string) => tableFilterChange(value, 'change'),
|
|
662
668
|
value: tableFilterState.value,
|
|
@@ -705,8 +711,9 @@ const CSmartTable = defineComponent({
|
|
|
705
711
|
{
|
|
706
712
|
component: 'head',
|
|
707
713
|
...props.tableHeadProps,
|
|
708
|
-
columnFilter:
|
|
709
|
-
|
|
714
|
+
columnFilter: props.columnFilter,
|
|
715
|
+
columnFilterValue: columnFilterState.value,
|
|
716
|
+
columns: props.columns ? props.columns : rawColumnNames.value,
|
|
710
717
|
columnSorter: props.columnSorter,
|
|
711
718
|
selectable: props.selectable,
|
|
712
719
|
selectAll: selectedAll.value,
|
|
@@ -760,7 +767,6 @@ const CSmartTable = defineComponent({
|
|
|
760
767
|
currentItems: currentItems.value,
|
|
761
768
|
firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
|
|
762
769
|
noItemsLabel: props.noItemsLabel,
|
|
763
|
-
columns: props.columns,
|
|
764
770
|
scopedSlots: slots,
|
|
765
771
|
selectable: props.selectable,
|
|
766
772
|
onRowChecked: (id: number, value: boolean) => handleRowChecked(id, value),
|
|
@@ -770,7 +776,7 @@ const CSmartTable = defineComponent({
|
|
|
770
776
|
columnName: string,
|
|
771
777
|
event: MouseEvent | boolean,
|
|
772
778
|
) => handleRowClick(item, index, columnName, event),
|
|
773
|
-
rawColumnNames: rawColumnNames,
|
|
779
|
+
rawColumnNames: rawColumnNames.value,
|
|
774
780
|
clickableRows: props.clickableRows,
|
|
775
781
|
...props.tableBodyProps,
|
|
776
782
|
}),
|
|
@@ -780,7 +786,7 @@ const CSmartTable = defineComponent({
|
|
|
780
786
|
...props.tableFootProps,
|
|
781
787
|
columnFilter: false,
|
|
782
788
|
columnSorter: false,
|
|
783
|
-
columns: props.columns,
|
|
789
|
+
columns: props.columns ? props.columns : rawColumnNames.value,
|
|
784
790
|
selectable: props.selectable,
|
|
785
791
|
selectAll: selectedAll.value,
|
|
786
792
|
onFilterInput: (key: string, value: string) =>
|
|
@@ -820,7 +826,6 @@ const CSmartTable = defineComponent({
|
|
|
820
826
|
pages: numberOfPages.value,
|
|
821
827
|
activePage: activePage.value,
|
|
822
828
|
onActivePageChange: handleActivePageChange,
|
|
823
|
-
limit: itemsPerPage.value,
|
|
824
829
|
})
|
|
825
830
|
: '',
|
|
826
831
|
),
|
|
@@ -5,7 +5,13 @@ import { CTableRow } from '../table/CTableRow'
|
|
|
5
5
|
|
|
6
6
|
import { CFormCheck, CFormInput } from '../form/'
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
Column,
|
|
10
|
+
ColumnFilter,
|
|
11
|
+
ColumnFilterValue,
|
|
12
|
+
Sorter,
|
|
13
|
+
SorterValue,
|
|
14
|
+
} from './CSmartTableInterface'
|
|
9
15
|
|
|
10
16
|
const CSmartTableHead = defineComponent({
|
|
11
17
|
name: 'CSmartTableHead',
|
|
@@ -17,9 +23,12 @@ const CSmartTableHead = defineComponent({
|
|
|
17
23
|
},
|
|
18
24
|
columnFilter: {
|
|
19
25
|
type: [Boolean, Object] as PropType<boolean | ColumnFilter>,
|
|
20
|
-
default: undefined,
|
|
21
26
|
require: false,
|
|
22
27
|
},
|
|
28
|
+
columnFilterValue: {
|
|
29
|
+
type: Object as PropType<ColumnFilterValue>,
|
|
30
|
+
required: false,
|
|
31
|
+
},
|
|
23
32
|
columnSorter: {
|
|
24
33
|
type: [Boolean, Object] as PropType<boolean | Sorter>,
|
|
25
34
|
default: undefined,
|
|
@@ -221,9 +230,9 @@ const CSmartTableHead = defineComponent({
|
|
|
221
230
|
(event.target as HTMLInputElement).value,
|
|
222
231
|
),
|
|
223
232
|
'aria-label': `column name: '${label(column)}' filter input`,
|
|
224
|
-
...(props.
|
|
225
|
-
props.
|
|
226
|
-
value: props.
|
|
233
|
+
...(props.columnFilterValue &&
|
|
234
|
+
props.columnFilterValue[key(column)] && {
|
|
235
|
+
value: props.columnFilterValue[key(column)],
|
|
227
236
|
}),
|
|
228
237
|
}),
|
|
229
238
|
},
|