@coreui/vue-pro 4.0.4 → 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/index.d.ts +2 -0
- package/dist/components/modal/CModal.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/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 +609 -363
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +612 -361
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- 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 +2 -0
- 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/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/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
|
@@ -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
|
},
|