@coreui/vue-pro 4.3.0-beta.0 → 4.3.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 +113 -5
- package/dist/components/accordion/index.d.ts +1 -2
- package/dist/components/calendar/CCalendar.d.ts +15 -2
- package/dist/components/carousel/CCarousel.d.ts +1 -1
- package/dist/components/date-picker/CDatePicker.d.ts +24 -2
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +102 -3
- package/dist/components/form/CFormCheck.d.ts +88 -39
- package/dist/components/form/CFormControlValidation.d.ts +98 -0
- package/dist/components/form/CFormControlWrapper.d.ts +6 -0
- package/dist/components/form/CFormFeedback.d.ts +2 -2
- package/dist/components/form/CFormInput.d.ts +133 -27
- package/dist/components/form/CFormRange.d.ts +18 -16
- package/dist/components/form/CFormSelect.d.ts +125 -16
- package/dist/components/form/CFormSwitch.d.ts +0 -23
- package/dist/components/form/CFormTextarea.d.ts +125 -24
- package/dist/components/modal/CModal.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
- package/dist/components/smart-table/CSmartTable.d.ts +34 -98
- package/dist/components/smart-table/CSmartTableInterface.d.ts +3 -3
- package/dist/components/time-picker/CTimePicker.d.ts +1 -1
- package/dist/components/toast/CToast.d.ts +7 -1
- package/dist/components/widgets/CWidgetStatsB.d.ts +3 -8
- package/dist/components/widgets/CWidgetStatsC.d.ts +3 -8
- package/dist/directives/v-c-popover.d.ts +1 -1
- package/dist/directives/v-c-tooltip.d.ts +1 -1
- package/dist/index.es.js +5523 -644
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +5522 -644
- package/dist/index.js.map +1 -1
- package/dist/utils/calendar.d.ts +4 -2
- package/dist/utils/time.d.ts +6 -2
- package/dist/utils/transition.d.ts +3 -0
- package/package.json +12 -11
- package/src/components/accordion/index.ts +0 -3
- package/src/components/backdrop/CBackdrop.ts +8 -6
- package/src/components/button/CButton.ts +2 -2
- package/src/components/calendar/CCalendar.ts +132 -62
- package/src/components/close-button/CCloseButton.ts +1 -0
- package/src/components/close-button/__tests__/__snapshots__/CCloseButton.spec.ts.snap +2 -2
- package/src/components/collapse/CCollapse.ts +5 -6
- package/src/components/date-picker/CDatePicker.ts +14 -10
- package/src/components/date-range-picker/CDateRangePicker.ts +209 -100
- package/src/components/form/CFormCheck.ts +118 -95
- package/src/components/form/CFormControlValidation.ts +97 -0
- package/src/components/form/CFormControlWrapper.ts +106 -0
- package/src/components/form/CFormInput.ts +115 -30
- package/src/components/form/CFormRange.ts +25 -11
- package/src/components/form/CFormSelect.ts +127 -41
- package/src/components/form/CFormSwitch.ts +2 -21
- package/src/components/form/CFormTextarea.ts +113 -25
- package/src/components/form/__tests__/CFormInput.spec.ts +11 -11
- package/src/components/form/__tests__/CFormRange.spec.ts +9 -9
- package/src/components/form/__tests__/CFormSelect.spec.ts +4 -4
- package/src/components/form/__tests__/CFormTextarea.spec.ts +4 -4
- package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.ts.snap +8 -2
- package/src/components/form/__tests__/__snapshots__/CFormRange.spec.ts.snap +1 -1
- package/src/components/modal/CModal.ts +14 -6
- package/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap +1 -2
- package/src/components/modal/__tests__/__snapshots__/CModalHeader.spec.ts.snap +2 -2
- package/src/components/nav/CNavGroup.ts +4 -6
- package/src/components/offcanvas/COffcanvas.ts +5 -7
- package/src/components/pagination/CSmartPagination.ts +4 -4
- package/src/components/picker/CPicker.ts +1 -0
- package/src/components/popover/CPopover.ts +5 -5
- package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.ts.snap +2 -8
- package/src/components/smart-table/CSmartTable.ts +17 -49
- package/src/components/smart-table/CSmartTableInterface.ts +5 -3
- package/src/components/tabs/CTabPane.ts +4 -6
- package/src/components/time-picker/CTimePicker.ts +12 -17
- package/src/components/toast/CToast.ts +17 -12
- package/src/components/toast/__tests__/__snapshots__/CToastClose.spec.ts.snap +1 -1
- package/src/components/toast/__tests__/__snapshots__/CToastHeader.spec.ts.snap +1 -1
- package/src/components/tooltip/CTooltip.ts +5 -5
- package/src/directives/v-c-popover.ts +1 -1
- package/src/directives/v-c-tooltip.ts +1 -1
- package/src/utils/calendar.ts +86 -9
- package/src/utils/time.ts +29 -3
- package/src/utils/transition.ts +65 -0
|
@@ -32,7 +32,7 @@ describe(`Loads and display ${ComponentName} component`, () => {
|
|
|
32
32
|
})
|
|
33
33
|
it('contain slots and classes', () => {
|
|
34
34
|
expect(defaultWrapper.text()).toContain('Default slot')
|
|
35
|
-
expect(defaultWrapper.classes('form-control')).toBe(true)
|
|
35
|
+
expect(defaultWrapper.find('textarea').classes('form-control')).toBe(true)
|
|
36
36
|
})
|
|
37
37
|
})
|
|
38
38
|
|
|
@@ -42,8 +42,8 @@ describe(`Customize ${ComponentName} component`, () => {
|
|
|
42
42
|
})
|
|
43
43
|
it('contain slots and classes', () => {
|
|
44
44
|
expect(customWrapper.text()).toContain('Default slot')
|
|
45
|
-
expect(customWrapper.classes('form-control-plaintext')).toBe(true)
|
|
46
|
-
expect(customWrapper.classes('is-invalid')).toBe(true)
|
|
47
|
-
expect(customWrapper.classes('is-valid')).toBe(true)
|
|
45
|
+
expect(customWrapper.find('textarea').classes('form-control-plaintext')).toBe(true)
|
|
46
|
+
expect(customWrapper.find('textarea').classes('is-invalid')).toBe(true)
|
|
47
|
+
expect(customWrapper.find('textarea').classes('is-valid')).toBe(true)
|
|
48
48
|
})
|
|
49
49
|
})
|
|
@@ -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\\" disabled=\\"false\\" 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\\" disabled=\\"false\\" 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 CFormRange component renders correctly 1`] = `"<input class=\\"form-range\\" disabled=\\"\\" max=\\"400\\" min=\\"50\\"
|
|
3
|
+
exports[`Customize CFormRange component renders correctly 1`] = `"<input class=\\"form-range\\" disabled=\\"\\" max=\\"400\\" min=\\"50\\" readonly=\\"\\" steps=\\"10\\" type=\\"range\\">"`;
|
|
4
4
|
|
|
5
5
|
exports[`Loads and display CFormRange component renders correctly 1`] = `"<input class=\\"form-range\\" type=\\"range\\">"`;
|
|
@@ -12,8 +12,11 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { CBackdrop } from './../backdrop/CBackdrop'
|
|
14
14
|
|
|
15
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
16
|
+
|
|
15
17
|
const CModal = defineComponent({
|
|
16
18
|
name: 'CModal',
|
|
19
|
+
inheritAttrs: false,
|
|
17
20
|
props: {
|
|
18
21
|
/**
|
|
19
22
|
* Align the modal in the center or top of the screen.
|
|
@@ -140,9 +143,7 @@ const CModal = defineComponent({
|
|
|
140
143
|
)
|
|
141
144
|
|
|
142
145
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
143
|
-
|
|
144
|
-
done()
|
|
145
|
-
})
|
|
146
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
146
147
|
document.body.classList.add('modal-open')
|
|
147
148
|
el.style.display = 'block'
|
|
148
149
|
setTimeout(() => {
|
|
@@ -150,17 +151,22 @@ const CModal = defineComponent({
|
|
|
150
151
|
}, 1)
|
|
151
152
|
emit('show')
|
|
152
153
|
}
|
|
154
|
+
|
|
153
155
|
const handleAfterEnter = () => {
|
|
154
156
|
window.addEventListener('mousedown', handleMouseDown)
|
|
155
157
|
window.addEventListener('keyup', handleKeyUp)
|
|
156
158
|
}
|
|
159
|
+
|
|
157
160
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
158
|
-
|
|
159
|
-
done()
|
|
160
|
-
})
|
|
161
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
161
162
|
document.body.classList.remove('modal-open')
|
|
163
|
+
if (document.body.className === '') {
|
|
164
|
+
document.body.removeAttribute('class')
|
|
165
|
+
}
|
|
166
|
+
|
|
162
167
|
el.classList.remove('show')
|
|
163
168
|
}
|
|
169
|
+
|
|
164
170
|
const handleAfterLeave = (el: RendererElement) => {
|
|
165
171
|
window.removeEventListener('mousedown', handleMouseDown)
|
|
166
172
|
window.removeEventListener('keyup', handleKeyUp)
|
|
@@ -177,6 +183,7 @@ const CModal = defineComponent({
|
|
|
177
183
|
if (props.backdrop !== 'static' && event.key === 'Escape' && props.keyboard) {
|
|
178
184
|
handleDismiss()
|
|
179
185
|
}
|
|
186
|
+
|
|
180
187
|
if (props.backdrop === 'static') {
|
|
181
188
|
modalRef.value.classList.add('modal-static')
|
|
182
189
|
emit('close-prevented')
|
|
@@ -196,6 +203,7 @@ const CModal = defineComponent({
|
|
|
196
203
|
if (props.backdrop !== 'static') {
|
|
197
204
|
handleDismiss()
|
|
198
205
|
}
|
|
206
|
+
|
|
199
207
|
if (props.backdrop === 'static') {
|
|
200
208
|
modalRef.value.classList.add('modal-static')
|
|
201
209
|
setTimeout(() => {
|
|
@@ -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`] = `
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Customize CModalHeader component renders correctly 1`] = `"<span class=\\"modal-header\\">Default slot<button class=\\"btn btn-close\\" aria-label=\\"Close\\"></button></span>"`;
|
|
3
|
+
exports[`Customize CModalHeader component renders correctly 1`] = `"<span class=\\"modal-header\\">Default slot<button type=\\"button\\" class=\\"btn btn-close\\" aria-label=\\"Close\\"></button></span>"`;
|
|
4
4
|
|
|
5
|
-
exports[`Loads and display CModalHeader component renders correctly 1`] = `"<span class=\\"modal-header\\">Default slot<button class=\\"btn btn-close\\" aria-label=\\"Close\\"></button></span>"`;
|
|
5
|
+
exports[`Loads and display CModalHeader component renders correctly 1`] = `"<span class=\\"modal-header\\">Default slot<button type=\\"button\\" class=\\"btn btn-close\\" aria-label=\\"Close\\"></button></span>"`;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, onMounted, ref, RendererElement, Transition, watch } from 'vue'
|
|
2
2
|
|
|
3
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
4
|
+
|
|
3
5
|
const CNavGroup = defineComponent({
|
|
4
6
|
name: 'CNavGroup',
|
|
5
7
|
props: {
|
|
@@ -62,9 +64,7 @@ const CNavGroup = defineComponent({
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
65
|
-
|
|
66
|
-
done()
|
|
67
|
-
})
|
|
67
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
68
68
|
el.style.height = `${el.scrollHeight}px`
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -77,9 +77,7 @@ const CNavGroup = defineComponent({
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
80
|
-
|
|
81
|
-
done()
|
|
82
|
-
})
|
|
80
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
83
81
|
setTimeout(() => {
|
|
84
82
|
el.style.height = '0px'
|
|
85
83
|
}, 1)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { defineComponent, h, ref, RendererElement, Transition, watch, withDirectives } from 'vue'
|
|
2
|
+
|
|
2
3
|
import { CBackdrop } from '../backdrop'
|
|
4
|
+
|
|
3
5
|
import { vVisible } from '../../directives/v-c-visible'
|
|
6
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
4
7
|
|
|
5
8
|
const COffcanvas = defineComponent({
|
|
6
9
|
name: 'COffcanvas',
|
|
@@ -88,9 +91,7 @@ const COffcanvas = defineComponent({
|
|
|
88
91
|
|
|
89
92
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
90
93
|
emit('show')
|
|
91
|
-
|
|
92
|
-
done()
|
|
93
|
-
})
|
|
94
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
94
95
|
setTimeout(() => {
|
|
95
96
|
el.style.visibility = 'visible'
|
|
96
97
|
el.classList.add('show')
|
|
@@ -98,13 +99,10 @@ const COffcanvas = defineComponent({
|
|
|
98
99
|
}
|
|
99
100
|
const handleAfterEnter = () => {
|
|
100
101
|
window.addEventListener('mousedown', handleMouseDown)
|
|
101
|
-
// window.addEventListener('click', handleClickOutside)
|
|
102
102
|
window.addEventListener('keyup', handleKeyUp)
|
|
103
103
|
}
|
|
104
104
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
105
|
-
|
|
106
|
-
done()
|
|
107
|
-
})
|
|
105
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
108
106
|
window.removeEventListener('mousedown', handleMouseDown)
|
|
109
107
|
window.removeEventListener('keyup', handleKeyUp)
|
|
110
108
|
el.classList.remove('show')
|
|
@@ -225,7 +225,7 @@ const CSmartPagination = defineComponent({
|
|
|
225
225
|
CPaginationItem,
|
|
226
226
|
{
|
|
227
227
|
onClick: () => {
|
|
228
|
-
setPage(1)
|
|
228
|
+
activePage.value !== 1 && setPage(1)
|
|
229
229
|
},
|
|
230
230
|
'aria-label': 'Go to first page',
|
|
231
231
|
...(activePage.value === 1 && {
|
|
@@ -247,7 +247,7 @@ const CSmartPagination = defineComponent({
|
|
|
247
247
|
CPaginationItem,
|
|
248
248
|
{
|
|
249
249
|
onClick: () => {
|
|
250
|
-
setPage(activePage.value - 1)
|
|
250
|
+
activePage.value !== 1 && setPage(activePage.value - 1)
|
|
251
251
|
},
|
|
252
252
|
'aria-label': 'Go to previous page',
|
|
253
253
|
...(activePage.value === 1 && {
|
|
@@ -304,7 +304,7 @@ const CSmartPagination = defineComponent({
|
|
|
304
304
|
CPaginationItem,
|
|
305
305
|
{
|
|
306
306
|
onClick: () => {
|
|
307
|
-
setPage(activePage.value + 1)
|
|
307
|
+
activePage.value !== pages.value && setPage(activePage.value + 1)
|
|
308
308
|
},
|
|
309
309
|
'aria-label': 'Go to next page',
|
|
310
310
|
...(activePage.value === pages.value && {
|
|
@@ -326,7 +326,7 @@ const CSmartPagination = defineComponent({
|
|
|
326
326
|
CPaginationItem,
|
|
327
327
|
{
|
|
328
328
|
onClick: () => {
|
|
329
|
-
setPage(pages.value)
|
|
329
|
+
activePage.value !== pages.value && setPage(pages.value)
|
|
330
330
|
},
|
|
331
331
|
'aria-label': 'Go to last page',
|
|
332
332
|
...(activePage.value === pages.value && {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { defineComponent, h, PropType, ref, RendererElement, Teleport, Transition } from 'vue'
|
|
2
2
|
import { createPopper, Placement } from '@popperjs/core'
|
|
3
3
|
|
|
4
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
5
|
+
|
|
4
6
|
const CPopover = defineComponent({
|
|
5
7
|
name: 'CPopover',
|
|
6
8
|
props: {
|
|
@@ -83,18 +85,16 @@ const CPopover = defineComponent({
|
|
|
83
85
|
emit('show')
|
|
84
86
|
initPopper()
|
|
85
87
|
el.classList.add('show')
|
|
86
|
-
|
|
87
|
-
done()
|
|
88
|
-
})
|
|
88
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
92
92
|
emit('hide')
|
|
93
93
|
el.classList.remove('show')
|
|
94
|
-
|
|
94
|
+
executeAfterTransition(() => {
|
|
95
95
|
done()
|
|
96
96
|
destroyPopper()
|
|
97
|
-
})
|
|
97
|
+
}, el as HTMLElement)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
const handleToggle = (event: Event) => {
|
|
@@ -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>"`;
|
|
@@ -31,8 +31,6 @@ const CSmartTable = defineComponent({
|
|
|
31
31
|
props: {
|
|
32
32
|
/**
|
|
33
33
|
* Sets active page. If 'pagination' prop is enabled, activePage is set only initially.
|
|
34
|
-
*
|
|
35
|
-
* @default 1
|
|
36
34
|
*/
|
|
37
35
|
activePage: {
|
|
38
36
|
type: Number,
|
|
@@ -41,7 +39,7 @@ const CSmartTable = defineComponent({
|
|
|
41
39
|
},
|
|
42
40
|
/**
|
|
43
41
|
* When set, displays table cleaner above table, next to the table filter (or in place of table filter if `tableFilter` prop is not set)
|
|
44
|
-
* Cleaner resets `tableFilterValue`, `columnFilterValue`, `sorterValue`. If clean is possible it is clickable (`tabIndex="0"` `role="button"`, `color="danger"`), otherwise it is not clickable and transparent. Cleaner can be customized through the `
|
|
42
|
+
* Cleaner resets `tableFilterValue`, `columnFilterValue`, `sorterValue`. If clean is possible it is clickable (`tabIndex="0"` `role="button"`, `color="danger"`), otherwise it is not clickable and transparent. Cleaner can be customized through the `cleanerIcon` slot.
|
|
45
43
|
*
|
|
46
44
|
*/
|
|
47
45
|
cleaner: {
|
|
@@ -50,8 +48,6 @@ const CSmartTable = defineComponent({
|
|
|
50
48
|
},
|
|
51
49
|
/**
|
|
52
50
|
* Style table items as clickable.
|
|
53
|
-
*
|
|
54
|
-
* @type boolean
|
|
55
51
|
*/
|
|
56
52
|
clickableRows: {
|
|
57
53
|
type: Boolean,
|
|
@@ -62,8 +58,6 @@ const CSmartTable = defineComponent({
|
|
|
62
58
|
* Column filter can be customized, by passing prop as object with additional options as keys. Available options:
|
|
63
59
|
* - external (Boolean) - Disables automatic filtering inside component.
|
|
64
60
|
* - lazy (Boolean) - Set to true to trigger filter updates only on change event.
|
|
65
|
-
*
|
|
66
|
-
* @type boolean | ColumnFilter
|
|
67
61
|
*/
|
|
68
62
|
columnFilter: {
|
|
69
63
|
type: [Boolean, Object] as PropType<boolean | ColumnFilter>,
|
|
@@ -72,7 +66,6 @@ const CSmartTable = defineComponent({
|
|
|
72
66
|
/**
|
|
73
67
|
* Value of table filter. To set pass object where keys are column names and values are filter strings e.g.:
|
|
74
68
|
* { user: 'John', age: 12 }
|
|
75
|
-
* You can track state of this prop by setting .sync modifier.
|
|
76
69
|
*/
|
|
77
70
|
columnFilterValue: {
|
|
78
71
|
type: Object as PropType<ColumnFilterValue>,
|
|
@@ -80,17 +73,17 @@ const CSmartTable = defineComponent({
|
|
|
80
73
|
required: false,
|
|
81
74
|
},
|
|
82
75
|
/**
|
|
83
|
-
* Prop for table columns configuration. If prop is not defined, table will display columns based on the first item keys, omitting keys that begins with underscore (e.g. '
|
|
76
|
+
* Prop for table columns configuration. If prop is not defined, table will display columns based on the first item keys, omitting keys that begins with underscore (e.g. '_props')
|
|
84
77
|
*
|
|
85
78
|
* In columns prop each array item represents one column. Item might be specified in two ways:
|
|
86
79
|
* String: each item define column name equal to item value.
|
|
87
80
|
* Object: item is object with following keys available as column configuration:
|
|
88
81
|
* - key (required)(String) - define column name equal to item key.
|
|
82
|
+
* - filter (Boolean) - removes filter from column when set to false.
|
|
89
83
|
* - label (String) - define visible label of column. If not defined, label will be generated automatically based on column name, by converting kebab-case and snake_case to individual words and capitalization of each word.
|
|
90
|
-
* - _classes (String/Array/Object) - adds classes to all cels in column
|
|
91
|
-
* - _style (String/Array/Object) - adds styles to the column header (useful for defining widths)
|
|
92
84
|
* - sorter (Boolean) - disables sorting of the column when set to false
|
|
93
|
-
* -
|
|
85
|
+
* - [_props](https://coreui.io/vue/docs/components/table.html#ctableheadercell) (String/Array/Object) - add props to `CTableHeaderCell`.
|
|
86
|
+
* - _style (String/Array/Object) - adds styles to the column header (useful for defining widths)
|
|
94
87
|
*/
|
|
95
88
|
columns: {
|
|
96
89
|
type: Array as PropType<Column[] | string[]>,
|
|
@@ -102,8 +95,6 @@ const CSmartTable = defineComponent({
|
|
|
102
95
|
* Sorter can be customized, by passing prop as object with additional options as keys. Available options:
|
|
103
96
|
* - external (Boolean) - Disables automatic sorting inside component.
|
|
104
97
|
* - resetable (Boolean) - If set to true clicking on sorter have three states: ascending, descending and null. That means that third click on sorter will reset sorting, and restore table to original order.
|
|
105
|
-
*
|
|
106
|
-
* @type boolean | Sorter
|
|
107
98
|
*/
|
|
108
99
|
columnSorter: {
|
|
109
100
|
type: [Boolean, Object] as PropType<boolean | Sorter>,
|
|
@@ -119,8 +110,6 @@ const CSmartTable = defineComponent({
|
|
|
119
110
|
},
|
|
120
111
|
/**
|
|
121
112
|
* Set to false to remove table header.
|
|
122
|
-
*
|
|
123
|
-
* @default true
|
|
124
113
|
*/
|
|
125
114
|
header: {
|
|
126
115
|
type: Boolean,
|
|
@@ -128,7 +117,11 @@ const CSmartTable = defineComponent({
|
|
|
128
117
|
default: true,
|
|
129
118
|
},
|
|
130
119
|
/**
|
|
131
|
-
* Array of objects, where each object represents one item - row in table. Additionally, you can
|
|
120
|
+
* Array of objects, where each object represents one item - row in table. Additionally, you can customize each row by passing them by [_props](http://coreui.io/vue/docs/components/table.html#ctablerow) key and single cell by [_cellProps](http://coreui.io/vue/docs/components/table.html#ctabledatacell).
|
|
121
|
+
*
|
|
122
|
+
* Examples:
|
|
123
|
+
* - `_props: { color: 'primary', align: 'middle'}`
|
|
124
|
+
* - `_cellProps: { all: { class: 'fw-semibold'}, 'name': { color: 'info' }}`
|
|
132
125
|
*/
|
|
133
126
|
items: {
|
|
134
127
|
type: Array as PropType<Item[]>,
|
|
@@ -137,8 +130,6 @@ const CSmartTable = defineComponent({
|
|
|
137
130
|
},
|
|
138
131
|
/**
|
|
139
132
|
* Number of items per site, when pagination is enabled.
|
|
140
|
-
*
|
|
141
|
-
* @default 10
|
|
142
133
|
*/
|
|
143
134
|
itemsPerPage: {
|
|
144
135
|
type: Number,
|
|
@@ -146,8 +137,6 @@ const CSmartTable = defineComponent({
|
|
|
146
137
|
},
|
|
147
138
|
/**
|
|
148
139
|
* Label for items per page selector.
|
|
149
|
-
*
|
|
150
|
-
* @default 'Items per page:'
|
|
151
140
|
*/
|
|
152
141
|
itemsPerPageLabel: {
|
|
153
142
|
type: String,
|
|
@@ -156,8 +145,6 @@ const CSmartTable = defineComponent({
|
|
|
156
145
|
},
|
|
157
146
|
/**
|
|
158
147
|
* Items per page selector options.
|
|
159
|
-
*
|
|
160
|
-
* @default [5, 10, 20, 50]
|
|
161
148
|
*/
|
|
162
149
|
itemsPerPageOptions: {
|
|
163
150
|
type: Array as PropType<number[]>,
|
|
@@ -184,7 +171,6 @@ const CSmartTable = defineComponent({
|
|
|
184
171
|
},
|
|
185
172
|
/**
|
|
186
173
|
* ReactNode or string for passing custom noItemsLabel texts.
|
|
187
|
-
* @default 'No items found'
|
|
188
174
|
*/
|
|
189
175
|
noItemsLabel: {
|
|
190
176
|
type: String,
|
|
@@ -199,9 +185,7 @@ const CSmartTable = defineComponent({
|
|
|
199
185
|
required: false,
|
|
200
186
|
},
|
|
201
187
|
/**
|
|
202
|
-
* Properties to
|
|
203
|
-
*
|
|
204
|
-
* @link https://coreui.io/vue/docs/4.0/components/smart-pagination#csmartpagination
|
|
188
|
+
* Properties to [CSmartPagination](https://coreui.io/vue/docs/components/smart-pagination#csmartpagination) component.
|
|
205
189
|
*/
|
|
206
190
|
paginationProps: {
|
|
207
191
|
type: Object,
|
|
@@ -213,10 +197,8 @@ const CSmartTable = defineComponent({
|
|
|
213
197
|
*/
|
|
214
198
|
selectable: Boolean,
|
|
215
199
|
/**
|
|
216
|
-
* State of the sorter. Name key is column name, direction can be 'asc' or 'desc'.
|
|
200
|
+
* State of the sorter. Name key is column name, direction can be 'asc' or 'desc'. eg.:
|
|
217
201
|
* { column: 'status', state: 'asc' }
|
|
218
|
-
*
|
|
219
|
-
* @type SorterValue
|
|
220
202
|
*/
|
|
221
203
|
sorterValue: {
|
|
222
204
|
type: Object as PropType<SorterValue>,
|
|
@@ -224,9 +206,7 @@ const CSmartTable = defineComponent({
|
|
|
224
206
|
required: false,
|
|
225
207
|
},
|
|
226
208
|
/**
|
|
227
|
-
* Properties to
|
|
228
|
-
*
|
|
229
|
-
* @link https://coreui.io/vue/docs/4.0/components/table/#ctablebody
|
|
209
|
+
* Properties to [CTableBody](https://coreui.io/vue/docs/components/table/#ctablebody) component.
|
|
230
210
|
*/
|
|
231
211
|
tableBodyProps: {
|
|
232
212
|
type: Object,
|
|
@@ -234,9 +214,7 @@ const CSmartTable = defineComponent({
|
|
|
234
214
|
required: false,
|
|
235
215
|
},
|
|
236
216
|
/**
|
|
237
|
-
* Properties to
|
|
238
|
-
*
|
|
239
|
-
* @link https://coreui.io/vue/docs/4.0/components/table/#ctablefoot
|
|
217
|
+
* Properties to [CTableFoot](https://coreui.io/vue/docs/components/table/#ctablefoot) component.
|
|
240
218
|
*/
|
|
241
219
|
tableFootProps: {
|
|
242
220
|
type: Object,
|
|
@@ -247,8 +225,6 @@ const CSmartTable = defineComponent({
|
|
|
247
225
|
* When set, displays table filter above table, allowing filtering by specific column.
|
|
248
226
|
*
|
|
249
227
|
* Column filter can be customized, by passing prop as object with additional options as keys. Available options:
|
|
250
|
-
* - placeholder (String) - Sets custom table filter placeholder.
|
|
251
|
-
* - label (String) - Sets custom table filter label.
|
|
252
228
|
* - external (Boolean) - Disables automatic filtering inside component.
|
|
253
229
|
* - lazy (Boolean) - Set to true to trigger filter updates only on change event.
|
|
254
230
|
*/
|
|
@@ -266,8 +242,6 @@ const CSmartTable = defineComponent({
|
|
|
266
242
|
},
|
|
267
243
|
/**
|
|
268
244
|
* Specifies a short hint that is visible in the search input.
|
|
269
|
-
*
|
|
270
|
-
* @default 'type string...'
|
|
271
245
|
*/
|
|
272
246
|
tableFilterPlaceholder: {
|
|
273
247
|
type: String,
|
|
@@ -275,9 +249,7 @@ const CSmartTable = defineComponent({
|
|
|
275
249
|
required: false,
|
|
276
250
|
},
|
|
277
251
|
/**
|
|
278
|
-
* Value of table filter.
|
|
279
|
-
*
|
|
280
|
-
* @default 'Filter:'
|
|
252
|
+
* Value of table filter.
|
|
281
253
|
*/
|
|
282
254
|
tableFilterValue: {
|
|
283
255
|
type: String,
|
|
@@ -285,9 +257,7 @@ const CSmartTable = defineComponent({
|
|
|
285
257
|
required: false,
|
|
286
258
|
},
|
|
287
259
|
/**
|
|
288
|
-
* Properties to
|
|
289
|
-
*
|
|
290
|
-
* @link https://coreui.io/vue/docs/4.0/components/table/#ctablehead
|
|
260
|
+
* Properties to [CTableHead](https://coreui.io/vue/docs/components/table/#ctablehead) component.
|
|
291
261
|
*/
|
|
292
262
|
tableHeadProps: {
|
|
293
263
|
type: Object,
|
|
@@ -295,9 +265,7 @@ const CSmartTable = defineComponent({
|
|
|
295
265
|
required: false,
|
|
296
266
|
},
|
|
297
267
|
/**
|
|
298
|
-
* Properties to
|
|
299
|
-
*
|
|
300
|
-
* @link https://coreui.io/vue/docs/4.0/components/table/#ctable
|
|
268
|
+
* Properties to [CTable](https://coreui.io/vue/docs/components/table/#ctable) component.
|
|
301
269
|
*/
|
|
302
270
|
tableProps: {
|
|
303
271
|
type: Object,
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
/* eslint-disable no-unused-vars */
|
|
5
5
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
6
6
|
export interface Column {
|
|
7
|
-
|
|
7
|
+
filter?: boolean
|
|
8
8
|
key: string
|
|
9
9
|
label?: string
|
|
10
|
-
|
|
10
|
+
sorter?: boolean
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
12
|
_style?: any
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -53,9 +53,11 @@ export interface SorterValue {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface TableFilter {
|
|
56
|
-
lazy?: boolean
|
|
57
56
|
external?: boolean
|
|
57
|
+
lazy?: boolean
|
|
58
|
+
// TODO: depracated, remove in v5
|
|
58
59
|
label?: string
|
|
60
|
+
// TODO: depracated, remove in v5
|
|
59
61
|
placeholder?: string
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, ref, RendererElement, Transition, vShow, withDirectives } from 'vue'
|
|
2
2
|
|
|
3
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
4
|
+
|
|
3
5
|
const CTabPane = defineComponent({
|
|
4
6
|
name: 'CTabPane',
|
|
5
7
|
props: {
|
|
@@ -30,20 +32,16 @@ const CTabPane = defineComponent({
|
|
|
30
32
|
firstRender.value = false
|
|
31
33
|
emit('show')
|
|
32
34
|
setTimeout(() => {
|
|
35
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
33
36
|
el.classList.add('show')
|
|
34
37
|
}, 1)
|
|
35
|
-
el.addEventListener('transitionend', () => {
|
|
36
|
-
done()
|
|
37
|
-
})
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
41
41
|
firstRender.value = false
|
|
42
42
|
emit('hide')
|
|
43
43
|
el.classList.remove('show')
|
|
44
|
-
|
|
45
|
-
done()
|
|
46
|
-
})
|
|
44
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
return () =>
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
convertTimeToDate,
|
|
10
10
|
getAmPm,
|
|
11
11
|
getListOfHours,
|
|
12
|
-
|
|
12
|
+
getListOfMinutes,
|
|
13
|
+
getListOfSeconds,
|
|
13
14
|
getSelectedHour,
|
|
14
15
|
getSelectedMinutes,
|
|
15
16
|
getSelectedSeconds,
|
|
@@ -288,27 +289,21 @@ const CTimePicker = defineComponent({
|
|
|
288
289
|
...(date.value && { value: getSelectedHour(date.value, props.locale) }),
|
|
289
290
|
}),
|
|
290
291
|
':',
|
|
292
|
+
// @ts-expect-error the getListOfMinutes function returns corect type
|
|
291
293
|
h(CFormSelect, {
|
|
292
294
|
disabled: props.disabled,
|
|
293
|
-
options:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
label: i.toLocaleString(props.locale).padStart(2, (0).toLocaleString(props.locale)),
|
|
297
|
-
}
|
|
298
|
-
}),
|
|
299
|
-
onChange: (event) => handleTimeChange('minutes', event.target.value),
|
|
295
|
+
options: getListOfMinutes(props.locale, true),
|
|
296
|
+
onChange: (event: Event) =>
|
|
297
|
+
handleTimeChange('minutes', (event.target as HTMLSelectElement).value),
|
|
300
298
|
...(date.value && { value: getSelectedMinutes(date.value) }),
|
|
301
299
|
}),
|
|
302
300
|
':',
|
|
301
|
+
// @ts-expect-error the getListOfMinutes function returns corect type
|
|
303
302
|
h(CFormSelect, {
|
|
304
303
|
disabled: props.disabled,
|
|
305
|
-
options:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
label: i.toLocaleString(props.locale).padStart(2, (0).toLocaleString(props.locale)),
|
|
309
|
-
}
|
|
310
|
-
}),
|
|
311
|
-
onChange: (event) => handleTimeChange('seconds', event.target.value),
|
|
304
|
+
options: getListOfSeconds(props.locale, true),
|
|
305
|
+
onChange: (event: Event) =>
|
|
306
|
+
handleTimeChange('seconds', (event.target as HTMLSelectElement).value),
|
|
312
307
|
...(date.value && { value: getSelectedSeconds(date.value) }),
|
|
313
308
|
}),
|
|
314
309
|
isAmPm(props.locale) &&
|
|
@@ -330,12 +325,12 @@ const CTimePicker = defineComponent({
|
|
|
330
325
|
selected: getSelectedHour(date.value, props.locale),
|
|
331
326
|
}),
|
|
332
327
|
h(CTimePickerRollCol, {
|
|
333
|
-
elements:
|
|
328
|
+
elements: getListOfMinutes(props.locale),
|
|
334
329
|
onClick: (index: number) => handleTimeChange('minutes', index.toString()),
|
|
335
330
|
selected: getSelectedMinutes(date.value),
|
|
336
331
|
}),
|
|
337
332
|
h(CTimePickerRollCol, {
|
|
338
|
-
elements:
|
|
333
|
+
elements: getListOfSeconds(props.locale),
|
|
339
334
|
onClick: (index: number) => handleTimeChange('seconds', index.toString()),
|
|
340
335
|
selected: getSelectedSeconds(date.value),
|
|
341
336
|
}),
|