@coreui/vue-pro 4.0.1 → 4.1.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/carousel/CCarousel.d.ts +2 -2
- package/dist/components/collapse/CCollapse.d.ts +10 -0
- package/dist/components/element-cover/index.d.ts +6 -0
- package/dist/components/form/CFormCheck.d.ts +22 -2
- package/dist/components/form/CFormInput.d.ts +17 -2
- package/dist/components/form/CFormRange.d.ts +15 -2
- package/dist/components/form/CFormSelect.d.ts +36 -2
- package/dist/components/form/CFormSwitch.d.ts +15 -2
- package/dist/components/form/CFormTextarea.d.ts +18 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/modal/CModal.d.ts +2 -2
- package/dist/components/multi-select/CMultiSelect.d.ts +2 -2
- package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +2 -2
- package/dist/components/placeholder/CPlaceholder.d.ts +124 -0
- package/dist/components/placeholder/index.d.ts +6 -0
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/smart-table/CSmartTable.d.ts +0 -3
- package/dist/components/table/CTable.d.ts +2 -2
- package/dist/components/widgets/CWidgetStatsB.d.ts +2 -2
- package/dist/components/widgets/CWidgetStatsF.d.ts +2 -2
- 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 +902 -445
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +905 -443
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/src/components/accordion/__tests__/__snapshots__/CAccordionBody.spec.ts.snap +1 -1
- package/src/components/button/CButton.ts +2 -2
- package/src/components/card/CCardImage.ts +2 -3
- 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/CFormCheck.ts +34 -2
- package/src/components/form/CFormInput.ts +40 -5
- package/src/components/form/CFormLabel.ts +1 -2
- package/src/components/form/CFormRange.ts +32 -3
- package/src/components/form/CFormSelect.ts +63 -4
- package/src/components/form/CFormSwitch.ts +46 -4
- package/src/components/form/CFormTextarea.ts +31 -2
- package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.ts.snap +2 -2
- package/src/components/form/__tests__/__snapshots__/CFormInput.spec.ts.snap +3 -3
- package/src/components/form/__tests__/__snapshots__/CFormRange.spec.ts.snap +1 -1
- package/src/components/form/__tests__/__snapshots__/CFormSwitch.spec.ts.snap +2 -2
- package/src/components/form/__tests__/__snapshots__/CFormTextarea.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/offcanvas/COffcanvas.ts +19 -16
- 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/pagination/CSmartPagination.ts +1 -1
- 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/smart-table/CSmartTable.ts +56 -41
- package/src/components/smart-table/CSmartTableHead.ts +43 -42
- package/src/components/toast/CToastClose.ts +2 -2
- package/src/components/toast/__tests__/CToastClose.spec.ts +2 -2
- package/src/components/toast/__tests__/__snapshots__/CToastClose.spec.ts.snap +1 -1
- 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
|
@@ -188,49 +188,50 @@ const CSmartTableHead = defineComponent({
|
|
|
188
188
|
],
|
|
189
189
|
},
|
|
190
190
|
),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
props.columnFilter
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
191
|
+
props.columnFilter &&
|
|
192
|
+
h(
|
|
193
|
+
CTableRow,
|
|
194
|
+
{},
|
|
195
|
+
{
|
|
196
|
+
default: () => [
|
|
197
|
+
props.selectable && h(CTableHeaderCell),
|
|
198
|
+
props.columns.map((column: Column | string) =>
|
|
199
|
+
h(
|
|
200
|
+
CTableHeaderCell,
|
|
201
|
+
{
|
|
202
|
+
...tableHeaderCellProps(column),
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
default: () =>
|
|
206
|
+
(typeof column !== 'object'
|
|
207
|
+
? true
|
|
208
|
+
: typeof column.filter === 'undefined'
|
|
209
|
+
? true
|
|
210
|
+
: column.filter) &&
|
|
211
|
+
h(CFormInput, {
|
|
212
|
+
size: 'sm',
|
|
213
|
+
onInput: (event: Event) =>
|
|
214
|
+
handleFilterInput(
|
|
215
|
+
key(column),
|
|
216
|
+
(event.target as HTMLInputElement).value,
|
|
217
|
+
),
|
|
218
|
+
onChange: (event: Event) =>
|
|
219
|
+
handleFilterChange(
|
|
220
|
+
key(column),
|
|
221
|
+
(event.target as HTMLInputElement).value,
|
|
222
|
+
),
|
|
223
|
+
'aria-label': `column name: '${label(column)}' filter input`,
|
|
224
|
+
...(props.columnFilter &&
|
|
225
|
+
props.columnFilter[key(column)] && {
|
|
226
|
+
value: props.columnFilter[key(column)],
|
|
227
|
+
}),
|
|
228
|
+
}),
|
|
229
|
+
},
|
|
230
|
+
),
|
|
229
231
|
),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
),
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
),
|
|
234
235
|
],
|
|
235
236
|
},
|
|
236
237
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, inject
|
|
1
|
+
import { defineComponent, h, inject } from 'vue'
|
|
2
2
|
import { CCloseButton } from '../close-button/CCloseButton'
|
|
3
3
|
|
|
4
4
|
const CToastClose = defineComponent({
|
|
@@ -30,7 +30,7 @@ const CToastClose = defineComponent({
|
|
|
30
30
|
return () =>
|
|
31
31
|
props.component
|
|
32
32
|
? h(
|
|
33
|
-
|
|
33
|
+
props.component,
|
|
34
34
|
{
|
|
35
35
|
onClick: () => {
|
|
36
36
|
handleClose()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils'
|
|
2
|
-
import { CToastClose as Component } from '../../../index'
|
|
2
|
+
import { CButton, CToastClose as Component } from '../../../index'
|
|
3
3
|
|
|
4
4
|
const ComponentName = 'CToastClose'
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ const defaultWrapper = mount(Component, {
|
|
|
21
21
|
|
|
22
22
|
const customWrapper = mount(Component, {
|
|
23
23
|
propsData: {
|
|
24
|
-
component:
|
|
24
|
+
component: CButton,
|
|
25
25
|
},
|
|
26
26
|
slots: {
|
|
27
27
|
default: 'Default slot',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Customize CToastClose component renders correctly 1`] = `"<
|
|
3
|
+
exports[`Customize CToastClose component renders correctly 1`] = `"<button class=\\"btn btn-undefined\\">Default slot</button>"`;
|
|
4
4
|
|
|
5
5
|
exports[`Loads and display CToastClose component renders correctly 1`] = `"<button class=\\"btn btn-close\\" aria-label=\\"Close\\"></button>"`;
|
package/src/directives/index.ts
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DirectiveBinding } from 'vue'
|
|
2
|
+
|
|
3
|
+
const BREAKPOINTS = [
|
|
4
|
+
'xxl' as const,
|
|
5
|
+
'xl' as const,
|
|
6
|
+
'lg' as const,
|
|
7
|
+
'md' as const,
|
|
8
|
+
'sm' as const,
|
|
9
|
+
'xs' as const,
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'c-placeholder',
|
|
14
|
+
mounted(el: HTMLElement, binding: DirectiveBinding): void {
|
|
15
|
+
const value = binding.value
|
|
16
|
+
el.classList.add(value.animation ? `placeholder-${value.animation}` : 'placeholder')
|
|
17
|
+
|
|
18
|
+
BREAKPOINTS.forEach((bp) => {
|
|
19
|
+
const breakpoint = value[bp]
|
|
20
|
+
|
|
21
|
+
const infix = bp === 'xs' ? '' : `-${bp}`
|
|
22
|
+
|
|
23
|
+
if (typeof breakpoint === 'number') {
|
|
24
|
+
el.classList.add(`col${infix}-${breakpoint}`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (typeof breakpoint === 'boolean') {
|
|
28
|
+
el.classList.add(`col${infix}`)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ObjectDirective } from '@vue/runtime-core'
|
|
2
|
+
|
|
3
|
+
interface VShowElement extends HTMLElement {
|
|
4
|
+
// _vod = vue original display
|
|
5
|
+
_vod: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const vVisible: ObjectDirective<VShowElement> = {
|
|
9
|
+
beforeMount(el, { value }, { transition }) {
|
|
10
|
+
el._vod = el.style.display === 'none' ? '' : el.style.display
|
|
11
|
+
if (transition && value) {
|
|
12
|
+
transition.beforeEnter(el)
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
mounted(el, { value }, { transition }) {
|
|
16
|
+
if (transition && value) {
|
|
17
|
+
transition.enter(el)
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
updated(el, { value, oldValue }, { transition }) {
|
|
21
|
+
if (!value === !oldValue) return
|
|
22
|
+
if (transition) {
|
|
23
|
+
if (value) {
|
|
24
|
+
transition.beforeEnter(el)
|
|
25
|
+
transition.enter(el)
|
|
26
|
+
} else {
|
|
27
|
+
transition.leave(el, () => {
|
|
28
|
+
// setDisplay(el, false)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//@ts-nocheck
|
|
2
2
|
import { App } from 'vue'
|
|
3
3
|
import * as Components from './components'
|
|
4
|
-
import { vcpopover, vctooltip } from './directives'
|
|
4
|
+
import { vcplaceholder, vcpopover, vctooltip } from './directives'
|
|
5
5
|
|
|
6
6
|
const removeKeysFromObject = (object, keys) => {
|
|
7
7
|
return Object.entries(object).reduce((obj, [key, value]) => {
|
|
@@ -30,6 +30,7 @@ const CoreuiVue = {
|
|
|
30
30
|
// app.directive(directive, Directives[directive])
|
|
31
31
|
// }
|
|
32
32
|
|
|
33
|
+
app.directive('c-placeholder', vcplaceholder)
|
|
33
34
|
app.directive('c-popover', vcpopover)
|
|
34
35
|
app.directive('c-tooltip', vctooltip)
|
|
35
36
|
},
|