@coreui/vue-pro 4.0.2 → 4.1.1
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 +7 -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/smart-table/CSmartTable.d.ts +5 -11
- package/dist/components/smart-table/CSmartTableHead.d.ts +7 -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 +693 -441
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +696 -439
- 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/CFormCheck.ts +9 -19
- package/src/components/form/CFormInput.ts +5 -5
- package/src/components/form/CFormRange.ts +2 -2
- package/src/components/form/CFormSelect.ts +3 -4
- package/src/components/form/CFormSwitch.ts +1 -1
- package/src/components/form/CFormTextarea.ts +1 -7
- package/src/components/form/__tests__/__snapshots__/CFormInput.spec.ts.snap +3 -3
- 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 +8 -3
- 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/smart-table/CSmartTable.ts +38 -36
- package/src/components/smart-table/CSmartTableHead.ts +54 -44
- 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
|
@@ -4,7 +4,7 @@ exports[`Customize COffcanvas component renders correctly 1`] = `
|
|
|
4
4
|
"<transition-stub>
|
|
5
5
|
<div class=\\"offcanvas offcanvas-bottom\\" role=\\"dialog\\">Default slot</div>
|
|
6
6
|
</transition-stub>
|
|
7
|
-
<transition-stub class=\\"
|
|
7
|
+
<transition-stub class=\\"offcanvas-backdrop\\">
|
|
8
8
|
<div class=\\"fade\\"></div>
|
|
9
9
|
</transition-stub>"
|
|
10
10
|
`;
|
|
@@ -13,7 +13,7 @@ exports[`Loads and display COffcanvas component renders correctly 1`] = `
|
|
|
13
13
|
"<transition-stub>
|
|
14
14
|
<div class=\\"offcanvas offcanvas-end\\" role=\\"dialog\\">Default slot</div>
|
|
15
15
|
</transition-stub>
|
|
16
|
-
<transition-stub class=\\"
|
|
16
|
+
<transition-stub class=\\"offcanvas-backdrop\\">
|
|
17
17
|
<div class=\\"fade\\"></div>
|
|
18
18
|
</transition-stub>"
|
|
19
19
|
`;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue'
|
|
2
|
+
|
|
3
|
+
import { Color } from '../props'
|
|
4
|
+
|
|
5
|
+
const BREAKPOINTS = [
|
|
6
|
+
'xxl' as const,
|
|
7
|
+
'xl' as const,
|
|
8
|
+
'lg' as const,
|
|
9
|
+
'md' as const,
|
|
10
|
+
'sm' as const,
|
|
11
|
+
'xs' as const,
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
export const CPlaceholder = defineComponent({
|
|
15
|
+
name: 'CPlaceholder',
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* Set animation type to better convey the perception of something being actively loaded.
|
|
19
|
+
*
|
|
20
|
+
* @values 'glow', 'wave'
|
|
21
|
+
*/
|
|
22
|
+
animation: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: undefined,
|
|
25
|
+
require: false,
|
|
26
|
+
validator: (value: string) => {
|
|
27
|
+
return ['glow', 'wave'].includes(value)
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Sets the color context of the component to one of CoreUI’s themed colors.
|
|
32
|
+
*
|
|
33
|
+
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
34
|
+
*/
|
|
35
|
+
color: Color,
|
|
36
|
+
/**
|
|
37
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
38
|
+
*/
|
|
39
|
+
component: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: 'span',
|
|
42
|
+
required: false,
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Size the component extra small, small, or large.
|
|
46
|
+
*
|
|
47
|
+
* @values 'xs', 'sm', 'lg'
|
|
48
|
+
*/
|
|
49
|
+
size: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: undefined,
|
|
52
|
+
required: false,
|
|
53
|
+
validator: (value: string) => {
|
|
54
|
+
return ['xs', 'sm', 'lg'].includes(value)
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* The number of columns on extra small devices (<576px).
|
|
59
|
+
*/
|
|
60
|
+
xs: {
|
|
61
|
+
type: Number,
|
|
62
|
+
default: undefined,
|
|
63
|
+
require: false,
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* The number of columns on small devices (<768px).
|
|
67
|
+
*/
|
|
68
|
+
sm: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: undefined,
|
|
71
|
+
require: false,
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* The number of columns on medium devices (<992px).
|
|
75
|
+
*/
|
|
76
|
+
md: {
|
|
77
|
+
type: Number,
|
|
78
|
+
default: undefined,
|
|
79
|
+
require: false,
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* The number of columns on large devices (<1200px).
|
|
83
|
+
*/
|
|
84
|
+
lg: {
|
|
85
|
+
type: Number,
|
|
86
|
+
default: undefined,
|
|
87
|
+
require: false,
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* The number of columns on X-Large devices (<1400px).
|
|
91
|
+
*/
|
|
92
|
+
xl: {
|
|
93
|
+
type: Number,
|
|
94
|
+
default: undefined,
|
|
95
|
+
require: false,
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* The number of columns on XX-Large devices (≥1400px).
|
|
99
|
+
*/
|
|
100
|
+
xxl: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: undefined,
|
|
103
|
+
require: false,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
setup(props, { slots }) {
|
|
107
|
+
const repsonsiveClassNames: string[] = []
|
|
108
|
+
|
|
109
|
+
BREAKPOINTS.forEach((bp) => {
|
|
110
|
+
const breakpoint = props[bp]
|
|
111
|
+
|
|
112
|
+
const infix = bp === 'xs' ? '' : `-${bp}`
|
|
113
|
+
|
|
114
|
+
if (typeof breakpoint === 'number') {
|
|
115
|
+
repsonsiveClassNames.push(`col${infix}-${breakpoint}`)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (typeof breakpoint === 'boolean') {
|
|
119
|
+
repsonsiveClassNames.push(`col${infix}`)
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
return () =>
|
|
124
|
+
h(
|
|
125
|
+
props.component,
|
|
126
|
+
{
|
|
127
|
+
class: [
|
|
128
|
+
props.animation ? `placeholder-${props.animation}` : 'placeholder',
|
|
129
|
+
{
|
|
130
|
+
[`bg-${props.color}`]: props.color,
|
|
131
|
+
[`placeholder-${props.size}`]: props.size,
|
|
132
|
+
},
|
|
133
|
+
repsonsiveClassNames,
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
slots.default && slots.default(),
|
|
137
|
+
)
|
|
138
|
+
},
|
|
139
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import { CPlaceholder as Component } from './../../'
|
|
3
|
+
|
|
4
|
+
const ComponentName = 'CPlaceholder'
|
|
5
|
+
const wrapper = shallowMount(Component)
|
|
6
|
+
const customWrapper = shallowMount(Component, {
|
|
7
|
+
props: {
|
|
8
|
+
animation: 'glow',
|
|
9
|
+
color: 'secondary',
|
|
10
|
+
size: 'lg',
|
|
11
|
+
sm: 7,
|
|
12
|
+
},
|
|
13
|
+
attrs: {
|
|
14
|
+
class: 'bazinga',
|
|
15
|
+
},
|
|
16
|
+
slots: {
|
|
17
|
+
default: 'Hello World!',
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
describe(`Loads and display ${ComponentName} component`, () => {
|
|
22
|
+
it('has a name', () => {
|
|
23
|
+
expect(Component.name).toMatch(ComponentName)
|
|
24
|
+
})
|
|
25
|
+
it('renders correctly', () => {
|
|
26
|
+
expect(wrapper.element).toMatchSnapshot()
|
|
27
|
+
})
|
|
28
|
+
it('renders correctly with slot', () => {
|
|
29
|
+
expect(customWrapper.element).toMatchSnapshot()
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe(`Customize ${ComponentName} component`, () => {
|
|
34
|
+
it('has a prope class names', () => {
|
|
35
|
+
expect(customWrapper.find('span').classes('bazinga')).toBe(true)
|
|
36
|
+
expect(customWrapper.find('span').classes('bg-secondary')).toBe(true)
|
|
37
|
+
expect(customWrapper.find('span').classes('col-sm-7')).toBe(true)
|
|
38
|
+
expect(customWrapper.find('span').classes('placeholder-glow')).toBe(true)
|
|
39
|
+
expect(customWrapper.find('span').classes('placeholder-lg')).toBe(true)
|
|
40
|
+
})
|
|
41
|
+
it('default slot contains text', () => {
|
|
42
|
+
expect(customWrapper.text()).toBe('Hello World!')
|
|
43
|
+
})
|
|
44
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Loads and display CPlaceholder component renders correctly 1`] = `
|
|
4
|
+
<span
|
|
5
|
+
class="placeholder"
|
|
6
|
+
/>
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
exports[`Loads and display CPlaceholder component renders correctly with slot 1`] = `
|
|
10
|
+
<span
|
|
11
|
+
class="placeholder-glow bg-secondary placeholder-lg col-sm-7 bazinga"
|
|
12
|
+
>
|
|
13
|
+
Hello World!
|
|
14
|
+
</span>
|
|
15
|
+
`;
|
|
@@ -46,7 +46,6 @@ const CSmartTable = defineComponent({
|
|
|
46
46
|
*/
|
|
47
47
|
cleaner: {
|
|
48
48
|
type: Boolean,
|
|
49
|
-
default: true,
|
|
50
49
|
required: false,
|
|
51
50
|
},
|
|
52
51
|
/**
|
|
@@ -68,7 +67,6 @@ const CSmartTable = defineComponent({
|
|
|
68
67
|
*/
|
|
69
68
|
columnFilter: {
|
|
70
69
|
type: [Boolean, Object] as PropType<boolean | ColumnFilter>,
|
|
71
|
-
default: undefined,
|
|
72
70
|
required: false,
|
|
73
71
|
},
|
|
74
72
|
/**
|
|
@@ -145,7 +143,6 @@ const CSmartTable = defineComponent({
|
|
|
145
143
|
*/
|
|
146
144
|
itemsPerPage: {
|
|
147
145
|
type: Number,
|
|
148
|
-
default: 10,
|
|
149
146
|
required: false,
|
|
150
147
|
},
|
|
151
148
|
/**
|
|
@@ -217,7 +214,8 @@ const CSmartTable = defineComponent({
|
|
|
217
214
|
*/
|
|
218
215
|
selectable: Boolean,
|
|
219
216
|
/**
|
|
220
|
-
* State of the sorter. Name key is column name, direction can be 'asc' or 'desc'. Set .sync modifier to track changes.
|
|
217
|
+
* State of the sorter. Name key is column name, direction can be 'asc' or 'desc'. Set .sync modifier to track changes. eg.:
|
|
218
|
+
* { column: 'status', state: 'asc' }
|
|
221
219
|
*
|
|
222
220
|
* @type SorterValue
|
|
223
221
|
*/
|
|
@@ -257,7 +255,6 @@ const CSmartTable = defineComponent({
|
|
|
257
255
|
*/
|
|
258
256
|
tableFilter: {
|
|
259
257
|
type: [Boolean, Object] as PropType<boolean | TableFilter>,
|
|
260
|
-
default: undefined,
|
|
261
258
|
required: false,
|
|
262
259
|
},
|
|
263
260
|
/**
|
|
@@ -389,6 +386,7 @@ const CSmartTable = defineComponent({
|
|
|
389
386
|
|
|
390
387
|
watch(items, () => {
|
|
391
388
|
const selected = items.value.filter((item) => item._selected === true)
|
|
389
|
+
emit('selectedItemsChange', selected)
|
|
392
390
|
|
|
393
391
|
if (selected.length === items.value.length) {
|
|
394
392
|
selectedAll.value = true
|
|
@@ -403,11 +401,9 @@ const CSmartTable = defineComponent({
|
|
|
403
401
|
if (selected.length !== 0 && selected.length !== items.value.length) {
|
|
404
402
|
selectedAll.value = 'indeterminate'
|
|
405
403
|
}
|
|
406
|
-
|
|
407
|
-
emit('selectedItemsChange', selected)
|
|
408
404
|
})
|
|
409
405
|
|
|
410
|
-
const itemsPerPage = ref<number>(props.itemsPerPage)
|
|
406
|
+
const itemsPerPage = ref<number>(props.itemsPerPage || items.value.length)
|
|
411
407
|
const activePage = ref(props.activePage)
|
|
412
408
|
|
|
413
409
|
const sorterState: SorterValue = reactive(props.sorterValue || {})
|
|
@@ -452,7 +448,11 @@ const CSmartTable = defineComponent({
|
|
|
452
448
|
} else if (state.state === 'asc') {
|
|
453
449
|
state.state = 'desc'
|
|
454
450
|
} else {
|
|
455
|
-
|
|
451
|
+
if (typeof props.columnSorter === 'object' && !props.columnSorter.resetable) {
|
|
452
|
+
state.state = 'asc'
|
|
453
|
+
} else {
|
|
454
|
+
state.state = 0
|
|
455
|
+
}
|
|
456
456
|
}
|
|
457
457
|
} else {
|
|
458
458
|
state.column = column
|
|
@@ -641,14 +641,14 @@ const CSmartTable = defineComponent({
|
|
|
641
641
|
|
|
642
642
|
return () =>
|
|
643
643
|
h('div', {}, [
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
644
|
+
(props.tableFilter || props.cleaner) &&
|
|
645
|
+
h(
|
|
646
|
+
'div',
|
|
647
|
+
{
|
|
648
|
+
class: 'row my-2 mx-0',
|
|
649
|
+
},
|
|
650
|
+
[
|
|
651
|
+
props.tableFilter &&
|
|
652
652
|
h(
|
|
653
653
|
'div',
|
|
654
654
|
{
|
|
@@ -656,35 +656,36 @@ const CSmartTable = defineComponent({
|
|
|
656
656
|
},
|
|
657
657
|
props.tableFilter &&
|
|
658
658
|
h(CSmartTableFilter, {
|
|
659
|
+
filterLabel: props.tableFilterLabel,
|
|
660
|
+
filterPlaceholder: props.tableFilterPlaceholder,
|
|
659
661
|
onFilterInput: (value: string) => tableFilterChange(value, 'input'),
|
|
660
662
|
onFilterChange: (value: string) => tableFilterChange(value, 'change'),
|
|
661
663
|
value: tableFilterState.value,
|
|
662
664
|
}),
|
|
663
665
|
),
|
|
666
|
+
props.cleaner &&
|
|
664
667
|
h(
|
|
665
668
|
'div',
|
|
666
669
|
{
|
|
667
670
|
class: 'col-auto p-0',
|
|
668
671
|
},
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
cleanerIcon
|
|
679
|
-
slots.cleanerIcon
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
),
|
|
672
|
+
h(
|
|
673
|
+
CSmartTableCleaner,
|
|
674
|
+
{
|
|
675
|
+
onClick: () => clean(),
|
|
676
|
+
isFiltered: isFiltered.value,
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
// @slot Cleaner icon.
|
|
680
|
+
cleanerIcon: () =>
|
|
681
|
+
slots.cleanerIcon
|
|
682
|
+
? slots.cleanerIcon()
|
|
683
|
+
: h(CIcon, { width: '18', content: cilFilterX }),
|
|
684
|
+
},
|
|
685
|
+
),
|
|
684
686
|
),
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
), //h
|
|
687
|
+
],
|
|
688
|
+
), //h
|
|
688
689
|
h(
|
|
689
690
|
'div',
|
|
690
691
|
{
|
|
@@ -705,7 +706,8 @@ const CSmartTable = defineComponent({
|
|
|
705
706
|
{
|
|
706
707
|
component: 'head',
|
|
707
708
|
...props.tableHeadProps,
|
|
708
|
-
columnFilter:
|
|
709
|
+
columnFilter: props.columnFilter,
|
|
710
|
+
columnFilterValue: columnFilterState.value,
|
|
709
711
|
columns: props.columns,
|
|
710
712
|
columnSorter: props.columnSorter,
|
|
711
713
|
selectable: props.selectable,
|
|
@@ -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,
|
|
@@ -188,49 +197,50 @@ const CSmartTableHead = defineComponent({
|
|
|
188
197
|
],
|
|
189
198
|
},
|
|
190
199
|
),
|
|
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.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
200
|
+
props.columnFilter &&
|
|
201
|
+
h(
|
|
202
|
+
CTableRow,
|
|
203
|
+
{},
|
|
204
|
+
{
|
|
205
|
+
default: () => [
|
|
206
|
+
props.selectable && h(CTableHeaderCell),
|
|
207
|
+
props.columns.map((column: Column | string) =>
|
|
208
|
+
h(
|
|
209
|
+
CTableHeaderCell,
|
|
210
|
+
{
|
|
211
|
+
...tableHeaderCellProps(column),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
default: () =>
|
|
215
|
+
(typeof column !== 'object'
|
|
216
|
+
? true
|
|
217
|
+
: typeof column.filter === 'undefined'
|
|
218
|
+
? true
|
|
219
|
+
: column.filter) &&
|
|
220
|
+
h(CFormInput, {
|
|
221
|
+
size: 'sm',
|
|
222
|
+
onInput: (event: Event) =>
|
|
223
|
+
handleFilterInput(
|
|
224
|
+
key(column),
|
|
225
|
+
(event.target as HTMLInputElement).value,
|
|
226
|
+
),
|
|
227
|
+
onChange: (event: Event) =>
|
|
228
|
+
handleFilterChange(
|
|
229
|
+
key(column),
|
|
230
|
+
(event.target as HTMLInputElement).value,
|
|
231
|
+
),
|
|
232
|
+
'aria-label': `column name: '${label(column)}' filter input`,
|
|
233
|
+
...(props.columnFilterValue &&
|
|
234
|
+
props.columnFilterValue[key(column)] && {
|
|
235
|
+
value: props.columnFilterValue[key(column)],
|
|
236
|
+
}),
|
|
237
|
+
}),
|
|
238
|
+
},
|
|
239
|
+
),
|
|
229
240
|
),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
),
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
),
|
|
234
244
|
],
|
|
235
245
|
},
|
|
236
246
|
)
|
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
|
},
|