edvoyui-component-library-test-flight 0.0.163 → 0.0.165
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/dist/library-vue-ts.cjs.js +28 -28
- package/dist/library-vue-ts.css +1 -1
- package/dist/library-vue-ts.es.js +2076 -2031
- package/dist/library-vue-ts.umd.js +29 -29
- package/dist/table/EUIDashboardTable.vue.d.ts +1 -1
- package/dist/table/EUITable.vue.d.ts +1 -1
- package/dist/table/GrowthTable.vue.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/HelloWorld.vue +1 -1
- package/src/components/table/ColumnResizeTable.vue +51 -46
- package/src/components/table/EUIDashboardTable.vue +206 -188
- package/src/components/table/EUITable.vue +46 -30
- package/src/components/table/GrowthTable.vue +21 -17
- package/src/components/table/UTable.vue +79 -52
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUIDashboardTable.vue?vue&type=script&setup=true&lang.ts";
|
|
2
|
-
import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUIDashboardTable.vue?vue&type=style&index=0&scoped=
|
|
2
|
+
import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUIDashboardTable.vue?vue&type=style&index=0&scoped=96e61185&lang.scss";
|
|
3
3
|
declare const _default: any;
|
|
4
4
|
export default _default;
|
|
5
5
|
//# sourceMappingURL=EUIDashboardTable.vue.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUITable.vue?vue&type=script&setup=true&lang.ts";
|
|
2
|
-
import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUITable.vue?vue&type=style&index=0&scoped=
|
|
2
|
+
import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUITable.vue?vue&type=style&index=0&scoped=8982a42f&lang.scss";
|
|
3
3
|
declare const _default: any;
|
|
4
4
|
export default _default;
|
|
5
5
|
//# sourceMappingURL=EUITable.vue.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "/Volumes/work/repos/edvoy-ui-v2/src/components/table/GrowthTable.vue?vue&type=script&setup=true&lang.ts";
|
|
2
|
-
import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/GrowthTable.vue?vue&type=style&index=0&scoped=
|
|
2
|
+
import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/GrowthTable.vue?vue&type=style&index=0&scoped=53514ae1&lang.scss";
|
|
3
3
|
declare const _default: any;
|
|
4
4
|
export default _default;
|
|
5
5
|
//# sourceMappingURL=GrowthTable.vue.d.ts.map
|
package/package.json
CHANGED
|
@@ -1653,7 +1653,7 @@ const selectedRows = ref([]);
|
|
|
1653
1653
|
const checkedRows = ref([]);
|
|
1654
1654
|
const defaultSortOrder = ref("asc");
|
|
1655
1655
|
const limit = ref(5);
|
|
1656
|
-
const offset = ref(
|
|
1656
|
+
const offset = ref(0);
|
|
1657
1657
|
const selectedIndex = ref(null);
|
|
1658
1658
|
const selected: { index: string } = { index: "" };
|
|
1659
1659
|
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<Transition name="fade" mode="out-in">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
<template v-if="loading">
|
|
5
|
+
<slot name="loader" :loading="loading" :height="tableHeight">
|
|
6
|
+
<div
|
|
7
|
+
:class="[
|
|
8
|
+
'overflow-hidden relative z-0 isolate bg-white backdrop-blur transition-colors duration-150 ease-in-out rounded-xl border border-gray-50',
|
|
9
|
+
tableHeight
|
|
10
|
+
? tableHeight
|
|
11
|
+
: 'h-[calc(100svh-9rem)] max-h-[calc(100svh-9rem)]',
|
|
12
|
+
]"
|
|
13
|
+
>
|
|
14
|
+
<div
|
|
15
|
+
class="absolute flex items-center z-[calc(infinity)] w-full h-auto pointer-events-none inset-0"
|
|
16
|
+
>
|
|
17
|
+
<EUICircleLoader />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</slot>
|
|
21
|
+
</template>
|
|
19
22
|
|
|
20
23
|
<div v-else class="relative max-w-full mx-auto">
|
|
21
24
|
<article
|
|
@@ -77,7 +80,7 @@
|
|
|
77
80
|
<div
|
|
78
81
|
class="w-full text-sm font-bold text-current truncate font-inter"
|
|
79
82
|
>
|
|
80
|
-
<slot name="header" :header="header">
|
|
83
|
+
<slot name="header" :header="header" :index="headerIndex">
|
|
81
84
|
{{ capitalizeText(header?.text ?? header?.name ?? "") }}
|
|
82
85
|
</slot>
|
|
83
86
|
<slot
|
|
@@ -201,28 +204,30 @@
|
|
|
201
204
|
checkable === true ? headers.length + 1 : headers.length
|
|
202
205
|
"
|
|
203
206
|
>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
207
|
+
<slot name="no-records">
|
|
208
|
+
<div
|
|
209
|
+
class="flex items-center justify-center w-[calc(100vw-14rem)]"
|
|
210
|
+
:class="[
|
|
211
|
+
tableHeight
|
|
212
|
+
? tableHeight
|
|
213
|
+
: 'h-[calc(100svh-12rem)] max-h-[calc(100svh-12rem)]',
|
|
214
|
+
]"
|
|
215
|
+
>
|
|
216
|
+
<div class="text-center">
|
|
217
|
+
<div
|
|
218
|
+
class="mx-auto overflow-hidden rounded-md size-56"
|
|
219
|
+
>
|
|
220
|
+
<img
|
|
221
|
+
src="@/assets/images/search-nodata.png"
|
|
222
|
+
alt=""
|
|
223
|
+
class="block object-contain object-center h-auto max-w-full opacity-90"
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
<div class="my-2 text-xl font-medium text-gray-500">
|
|
227
|
+
No matching records found
|
|
228
|
+
</div>
|
|
223
229
|
</div>
|
|
224
230
|
</div>
|
|
225
|
-
</div>
|
|
226
231
|
</slot>
|
|
227
232
|
</td>
|
|
228
233
|
</tr>
|
|
@@ -424,7 +429,7 @@ const searchData = (_data: any) => {
|
|
|
424
429
|
|
|
425
430
|
const changeLimit = (limitData: number) => {
|
|
426
431
|
limit.value = limitData;
|
|
427
|
-
newCurrentPage.value =
|
|
432
|
+
newCurrentPage.value = 0;
|
|
428
433
|
emit("update:currentPage", newCurrentPage.value);
|
|
429
434
|
emit("changeLimit", limitData);
|
|
430
435
|
};
|
|
@@ -573,7 +578,7 @@ const tableColumnResize = () => {
|
|
|
573
578
|
|
|
574
579
|
let startX: number, startWidth: number;
|
|
575
580
|
|
|
576
|
-
const mouseDownHandler = function (e:any) {
|
|
581
|
+
const mouseDownHandler = function (e: any) {
|
|
577
582
|
startX = e.pageX;
|
|
578
583
|
startWidth = parseInt(
|
|
579
584
|
document.defaultView?.getComputedStyle(th)?.width || "0px",
|
|
@@ -587,7 +592,7 @@ const tableColumnResize = () => {
|
|
|
587
592
|
e.preventDefault();
|
|
588
593
|
};
|
|
589
594
|
|
|
590
|
-
const onMouseMove = function (e:any) {
|
|
595
|
+
const onMouseMove = function (e: any) {
|
|
591
596
|
if (isResizing) {
|
|
592
597
|
const newWidth = startWidth + (e.pageX - startX);
|
|
593
598
|
if (newWidth > 100) {
|
|
@@ -682,9 +687,9 @@ watch(() => tableContainer.value?.clientWidth, checkOverflow);
|
|
|
682
687
|
}
|
|
683
688
|
|
|
684
689
|
& > tr {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
690
|
+
transition-property: filter, background, opacity;
|
|
691
|
+
transition-duration: 0.2s;
|
|
692
|
+
transition-timing-function: ease-out;
|
|
688
693
|
}
|
|
689
694
|
}
|
|
690
695
|
|
|
@@ -710,10 +715,10 @@ watch(() => tableContainer.value?.clientWidth, checkOverflow);
|
|
|
710
715
|
*/
|
|
711
716
|
|
|
712
717
|
// TODO: Hover Row highlight
|
|
713
|
-
& tbody:hover tr:not(:hover) td:not(:nth-child(-n+2)) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
718
|
+
& tbody:hover tr:not(:hover) td:not(:nth-child(-n + 2)) {
|
|
719
|
+
filter: blur(4px) saturate(0.2);
|
|
720
|
+
pointer-events: none;
|
|
721
|
+
opacity: 0.6;
|
|
717
722
|
}
|
|
718
723
|
}
|
|
719
724
|
}
|
|
@@ -1,172 +1,189 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<Transition name="fade" mode="out-in">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
<template v-if="loading">
|
|
5
|
+
<slot name="loader" :loading="loading" :height="tableHeight">
|
|
6
|
+
<div
|
|
7
|
+
:class="[
|
|
8
|
+
'overflow-hidden relative z-0 isolate bg-white backdrop-blur transition-colors duration-150 ease-in-out rounded-xl border border-gray-50',
|
|
9
|
+
tableHeight
|
|
10
|
+
? tableHeight
|
|
11
|
+
: 'h-[calc(100svh-9rem)] max-h-[calc(100svh-9rem)]',
|
|
12
|
+
]"
|
|
13
|
+
>
|
|
14
|
+
<div
|
|
15
|
+
class="absolute flex items-center z-[calc(infinity)] w-full h-auto pointer-events-none inset-0"
|
|
16
|
+
>
|
|
17
|
+
<EUICircleLoader />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</slot>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<div v-else class="relative w-full mx-auto overflow-hidden">
|
|
13
24
|
<div
|
|
14
|
-
|
|
25
|
+
id="dashboard-table"
|
|
26
|
+
:class="[
|
|
27
|
+
'scrollbar--thin overscroll-auto',
|
|
28
|
+
computedItems.length === 0 ? 'overflow-hidden' : 'overflow-auto',
|
|
29
|
+
tableHeight
|
|
30
|
+
? tableHeight
|
|
31
|
+
: 'h-[calc(100svh-13rem)] max-h-[calc(100svh-13rem)]',
|
|
32
|
+
]"
|
|
33
|
+
ref="tableContainer"
|
|
34
|
+
@scroll="handleScroll"
|
|
15
35
|
>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<div v-else class="relative w-full mx-auto overflow-hidden">
|
|
20
|
-
<div
|
|
21
|
-
id="dashboard-table"
|
|
22
|
-
:class="['scrollbar--thin overscroll-auto',
|
|
23
|
-
computedItems.length === 0 ? 'overflow-hidden' : 'overflow-auto', tableHeight ? tableHeight : 'h-[calc(100svh-13rem)] max-h-[calc(100svh-13rem)]']"
|
|
24
|
-
ref="tableContainer"
|
|
25
|
-
@scroll="handleScroll"
|
|
26
|
-
>
|
|
27
|
-
<table class="eui-table">
|
|
28
|
-
<thead class="sticky top-0 left-0 z-50 bg-gray-100">
|
|
29
|
-
<tr>
|
|
30
|
-
<template v-if="checkable">
|
|
31
|
-
<th class="checkable">
|
|
32
|
-
<EUITableCheckbox
|
|
33
|
-
:checked="isAllChecked"
|
|
34
|
-
:indeterminate="isIndeterminate"
|
|
35
|
-
:disabled="isAllUncheckable"
|
|
36
|
-
class="flex justify-center mt-0"
|
|
37
|
-
@change="checkAll()"
|
|
38
|
-
/>
|
|
39
|
-
</th>
|
|
40
|
-
</template>
|
|
41
|
-
<th
|
|
42
|
-
v-for="(header, headerIndex) in headers"
|
|
43
|
-
:key="`item-${headerIndex}`"
|
|
44
|
-
scope="col"
|
|
45
|
-
:class="[
|
|
46
|
-
'px-3 py-2 text-gray-600 snap-start snap-always',
|
|
47
|
-
isScrolled && headerIndex === 0 ? stickyClass.head : '',
|
|
48
|
-
{ 'cursor-pointer hover:text-gray-900': header?.sortable },
|
|
49
|
-
]"
|
|
50
|
-
:style="
|
|
51
|
-
header?.width
|
|
52
|
-
? `min-width:${header.width}px;max-width:${header.width}px;`
|
|
53
|
-
: ``
|
|
54
|
-
"
|
|
55
|
-
@click="sortBy(header, $event)"
|
|
56
|
-
>
|
|
57
|
-
<div
|
|
58
|
-
class="flex items-center gap-2 text-sm font-normal text-current"
|
|
59
|
-
>
|
|
60
|
-
<slot name="header" :header="header">
|
|
61
|
-
{{ capitalizeText(header?.text ?? header.name ?? "") }}
|
|
62
|
-
</slot>
|
|
63
|
-
<slot name="headerOptionalItem"></slot>
|
|
64
|
-
<SortArrow
|
|
65
|
-
v-if="header?.sortable"
|
|
66
|
-
:class="[
|
|
67
|
-
'transform duration-100 transition-all',
|
|
68
|
-
currentSort === header.value
|
|
69
|
-
? 'text-violet-700'
|
|
70
|
-
: 'text-gray-900',
|
|
71
|
-
sortClass(header),
|
|
72
|
-
]"
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
</th>
|
|
76
|
-
</tr>
|
|
77
|
-
</thead>
|
|
78
|
-
<tbody>
|
|
79
|
-
|
|
80
|
-
<template
|
|
81
|
-
v-if="computedItems.length > 0"
|
|
82
|
-
v-for="(row, rowIndex) in computedItems"
|
|
83
|
-
:key="`table-row-${rowIndex}`"
|
|
84
|
-
>
|
|
85
|
-
<tr
|
|
86
|
-
@mouseenter="
|
|
87
|
-
$attrs.mouseenter ? $emit('mouseenter', row, rowIndex) : null
|
|
88
|
-
"
|
|
89
|
-
@mouseleave="
|
|
90
|
-
$attrs.mouseleave ? $emit('mouseleave', row, rowIndex) : null
|
|
91
|
-
"
|
|
92
|
-
>
|
|
36
|
+
<table class="eui-table">
|
|
37
|
+
<thead class="sticky top-0 left-0 z-50 bg-gray-100">
|
|
38
|
+
<tr>
|
|
93
39
|
<template v-if="checkable">
|
|
94
|
-
<
|
|
40
|
+
<th class="checkable">
|
|
95
41
|
<EUITableCheckbox
|
|
96
|
-
:
|
|
97
|
-
:
|
|
98
|
-
|
|
42
|
+
:checked="isAllChecked"
|
|
43
|
+
:indeterminate="isIndeterminate"
|
|
44
|
+
:disabled="isAllUncheckable"
|
|
45
|
+
class="flex justify-center mt-0"
|
|
46
|
+
@change="checkAll()"
|
|
99
47
|
/>
|
|
100
|
-
</
|
|
48
|
+
</th>
|
|
101
49
|
</template>
|
|
102
|
-
<
|
|
50
|
+
<th
|
|
103
51
|
v-for="(header, headerIndex) in headers"
|
|
104
|
-
:key="headerIndex"
|
|
52
|
+
:key="`item-${headerIndex}`"
|
|
53
|
+
scope="col"
|
|
105
54
|
:class="[
|
|
106
|
-
|
|
55
|
+
'px-3 py-2 text-gray-600 snap-start snap-always',
|
|
56
|
+
isScrolled && headerIndex === 0 ? stickyClass.head : '',
|
|
57
|
+
{ 'cursor-pointer hover:text-gray-900': header?.sortable },
|
|
107
58
|
]"
|
|
59
|
+
:style="
|
|
60
|
+
header?.width
|
|
61
|
+
? `min-width:${header.width}px;max-width:${header.width}px;`
|
|
62
|
+
: ``
|
|
63
|
+
"
|
|
64
|
+
@click="sortBy(header, $event)"
|
|
108
65
|
>
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
:row="row"
|
|
112
|
-
:rowIndex="rowIndex"
|
|
66
|
+
<div
|
|
67
|
+
class="flex items-center gap-2 text-sm font-normal text-current"
|
|
113
68
|
>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</td>
|
|
117
|
-
</tr>
|
|
118
|
-
<template v-if="tableExpanded">
|
|
119
|
-
<slot name="expanded" :row="row" :rowIndex="rowIndex"></slot>
|
|
120
|
-
</template>
|
|
121
|
-
</template>
|
|
122
|
-
<template v-else-if="computedItems.length === 0">
|
|
123
|
-
<tr class="norecords">
|
|
124
|
-
<td :colspan="checkable === true ? headers.length + 1 : headers.length">
|
|
125
|
-
<slot name="no-records">
|
|
126
|
-
<div
|
|
127
|
-
class="flex items-center justify-center text-xl font-medium text-gray-500 h-[calc(100svh-18rem)] max-w-screen-xl"
|
|
128
|
-
>
|
|
129
|
-
No matching records found
|
|
130
|
-
</div>
|
|
69
|
+
<slot name="header" :header="header" :index="headerIndex">
|
|
70
|
+
{{ capitalizeText(header?.text ?? header.name ?? "") }}
|
|
131
71
|
</slot>
|
|
132
|
-
|
|
72
|
+
<slot name="headerOptionalItem"></slot>
|
|
73
|
+
<SortArrow
|
|
74
|
+
v-if="header?.sortable"
|
|
75
|
+
:class="[
|
|
76
|
+
'transform duration-100 transition-all',
|
|
77
|
+
currentSort === header.value
|
|
78
|
+
? 'text-violet-700'
|
|
79
|
+
: 'text-gray-900',
|
|
80
|
+
sortClass(header),
|
|
81
|
+
]"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</th>
|
|
133
85
|
</tr>
|
|
134
|
-
</
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
>
|
|
141
|
-
<slot name="tableCount">
|
|
142
|
-
<div class="inline-flex items-center gap-x-10">
|
|
143
|
-
<div class="text-sm font-normal text-gray-900">
|
|
144
|
-
{{ newCurrentPage }} - {{ limit }} of {{ total }}
|
|
145
|
-
</div>
|
|
146
|
-
<div class="inline-flex items-center gap-2">
|
|
147
|
-
<span class="text-sm font-normal text-gray-900"
|
|
148
|
-
>Result per page</span
|
|
86
|
+
</thead>
|
|
87
|
+
<tbody>
|
|
88
|
+
<template
|
|
89
|
+
v-if="computedItems.length > 0"
|
|
90
|
+
v-for="(row, rowIndex) in computedItems"
|
|
91
|
+
:key="`table-row-${rowIndex}`"
|
|
149
92
|
>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
93
|
+
<tr
|
|
94
|
+
@mouseenter="
|
|
95
|
+
$attrs.mouseenter
|
|
96
|
+
? $emit('mouseenter', row, rowIndex)
|
|
97
|
+
: null
|
|
98
|
+
"
|
|
99
|
+
@mouseleave="
|
|
100
|
+
$attrs.mouseleave
|
|
101
|
+
? $emit('mouseleave', row, rowIndex)
|
|
102
|
+
: null
|
|
103
|
+
"
|
|
104
|
+
>
|
|
105
|
+
<template v-if="checkable">
|
|
106
|
+
<td class="checkable">
|
|
107
|
+
<EUITableCheckbox
|
|
108
|
+
:disabled="!isRowCheckable(row)"
|
|
109
|
+
:checked="isRowChecked(row)"
|
|
110
|
+
@change="($event:boolean) => checkRow(row, rowIndex, $event)"
|
|
111
|
+
/>
|
|
112
|
+
</td>
|
|
113
|
+
</template>
|
|
114
|
+
<td
|
|
115
|
+
v-for="(header, headerIndex) in headers"
|
|
116
|
+
:key="headerIndex"
|
|
117
|
+
:class="[
|
|
118
|
+
isScrolled && headerIndex === 0 ? stickyClass.body : '',
|
|
119
|
+
]"
|
|
120
|
+
>
|
|
121
|
+
<slot
|
|
122
|
+
:name="`item.${header.value}`"
|
|
123
|
+
:row="row"
|
|
124
|
+
:rowIndex="rowIndex"
|
|
125
|
+
>
|
|
126
|
+
{{ getValueByPath(row, header?.value) }}
|
|
127
|
+
</slot>
|
|
128
|
+
</td>
|
|
129
|
+
</tr>
|
|
130
|
+
<template v-if="tableExpanded">
|
|
131
|
+
<slot name="expanded" :row="row" :rowIndex="rowIndex"></slot>
|
|
132
|
+
</template>
|
|
133
|
+
</template>
|
|
134
|
+
<template v-else-if="computedItems.length === 0">
|
|
135
|
+
<tr class="norecords">
|
|
136
|
+
<td
|
|
137
|
+
:colspan="
|
|
138
|
+
checkable === true ? headers.length + 1 : headers.length
|
|
139
|
+
"
|
|
140
|
+
>
|
|
141
|
+
<slot name="no-records">
|
|
142
|
+
<div
|
|
143
|
+
class="flex items-center justify-center text-xl font-medium text-gray-500 h-[calc(100svh-18rem)] max-w-screen-xl"
|
|
144
|
+
>
|
|
145
|
+
No matching records found
|
|
146
|
+
</div>
|
|
147
|
+
</slot>
|
|
148
|
+
</td>
|
|
149
|
+
</tr>
|
|
150
|
+
</template>
|
|
151
|
+
</tbody>
|
|
152
|
+
</table>
|
|
153
|
+
</div>
|
|
154
|
+
<div
|
|
155
|
+
class="sticky bottom-0 left-0 z-50 flex items-center justify-between px-2 py-2 bg-gray-100"
|
|
156
|
+
>
|
|
157
|
+
<slot name="tableCount">
|
|
158
|
+
<div class="inline-flex items-center gap-x-10">
|
|
159
|
+
<div class="text-sm font-normal text-gray-900">
|
|
160
|
+
{{ newCurrentPage * limit + 1 }} -
|
|
161
|
+
{{ (newCurrentPage + 1) * limit }} of {{ total }}
|
|
162
|
+
</div>
|
|
163
|
+
<div class="inline-flex items-center gap-2">
|
|
164
|
+
<span class="text-sm font-normal text-gray-900"
|
|
165
|
+
>Result per page</span
|
|
166
|
+
>
|
|
167
|
+
<EUIPageLimit
|
|
168
|
+
:page-limit="limit"
|
|
169
|
+
@update-limit="changeLimit($event)"
|
|
170
|
+
@refetch="searchData($event)"
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
155
173
|
</div>
|
|
156
|
-
</div>
|
|
157
|
-
</slot>
|
|
158
|
-
<template v-if="paginated && computedItems.length !== 0">
|
|
159
|
-
<slot name="tablepagination">
|
|
160
|
-
<EUIPagination
|
|
161
|
-
:activePage="newCurrentPage"
|
|
162
|
-
:pageLimit="limit"
|
|
163
|
-
:totalCount="total"
|
|
164
|
-
@change-page="pageChanged($event)"
|
|
165
|
-
/>
|
|
166
174
|
</slot>
|
|
167
|
-
|
|
175
|
+
<template v-if="paginated && computedItems.length !== 0">
|
|
176
|
+
<slot name="tablepagination">
|
|
177
|
+
<EUIPagination
|
|
178
|
+
:activePage="newCurrentPage"
|
|
179
|
+
:pageLimit="limit"
|
|
180
|
+
:totalCount="total"
|
|
181
|
+
@change-page="pageChanged($event)"
|
|
182
|
+
/>
|
|
183
|
+
</slot>
|
|
184
|
+
</template>
|
|
185
|
+
</div>
|
|
168
186
|
</div>
|
|
169
|
-
</div>
|
|
170
187
|
</Transition>
|
|
171
188
|
</div>
|
|
172
189
|
</template>
|
|
@@ -227,7 +244,7 @@ const props = defineProps({
|
|
|
227
244
|
tableHeight: {
|
|
228
245
|
type: String,
|
|
229
246
|
required: false,
|
|
230
|
-
default: ""
|
|
247
|
+
default: "",
|
|
231
248
|
},
|
|
232
249
|
tableLoading: { type: Boolean, default: false },
|
|
233
250
|
});
|
|
@@ -248,6 +265,7 @@ const {
|
|
|
248
265
|
const currentSort = ref(defaultSort.value);
|
|
249
266
|
const currentSortDir = ref(defaultSortDirection.value);
|
|
250
267
|
const newCheckedRows = ref([...checkedRows.value]);
|
|
268
|
+
|
|
251
269
|
const newCurrentPage = ref(currentPage.value);
|
|
252
270
|
const limit = ref(props.perPage);
|
|
253
271
|
const loading = computed(() => props.tableLoading);
|
|
@@ -282,7 +300,7 @@ const computedItems = computed(() => {
|
|
|
282
300
|
return items;
|
|
283
301
|
});
|
|
284
302
|
|
|
285
|
-
const searchData = (_data:any) => {
|
|
303
|
+
const searchData = (_data: any) => {
|
|
286
304
|
// console.log(_data);
|
|
287
305
|
};
|
|
288
306
|
|
|
@@ -305,10 +323,10 @@ const isIndeterminate = computed(() => {
|
|
|
305
323
|
});
|
|
306
324
|
|
|
307
325
|
const isAllChecked = computed(() => {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
326
|
+
return (
|
|
327
|
+
computedItems.value.length > 0 &&
|
|
328
|
+
computedItems.value.every((row) => newCheckedRows.value.includes(row))
|
|
329
|
+
);
|
|
312
330
|
});
|
|
313
331
|
|
|
314
332
|
const isAllUncheckable = computed(() => {
|
|
@@ -333,7 +351,7 @@ const emit = defineEmits([
|
|
|
333
351
|
|
|
334
352
|
const changeLimit = (limitData: number) => {
|
|
335
353
|
limit.value = limitData;
|
|
336
|
-
newCurrentPage.value =
|
|
354
|
+
newCurrentPage.value = 0;
|
|
337
355
|
emit("update:currentPage", newCurrentPage.value);
|
|
338
356
|
emit("changeLimit", limitData);
|
|
339
357
|
};
|
|
@@ -353,44 +371,44 @@ const sortBy = (header: any, event: any) => {
|
|
|
353
371
|
emit("sort", currentSort.value, currentSortDir.value, event);
|
|
354
372
|
};
|
|
355
373
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
374
|
+
const isRowChecked = (row: any) => {
|
|
375
|
+
return indexOf(newCheckedRows.value, row) >= 0;
|
|
376
|
+
};
|
|
359
377
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
378
|
+
const removeCheckedRow = (row: any) => {
|
|
379
|
+
const index = indexOf(newCheckedRows.value, row);
|
|
380
|
+
if (index >= 0) {
|
|
381
|
+
newCheckedRows.value.splice(index, 1);
|
|
382
|
+
}
|
|
383
|
+
};
|
|
366
384
|
|
|
367
385
|
const checkAll = () => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
386
|
+
if (isAllChecked.value) {
|
|
387
|
+
// Uncheck all rows
|
|
388
|
+
newCheckedRows.value = [];
|
|
389
|
+
} else {
|
|
390
|
+
// Check all rows
|
|
391
|
+
const rowsToCheck = computedItems.value.filter(
|
|
392
|
+
(row) => !newCheckedRows.value.includes(row)
|
|
393
|
+
);
|
|
394
|
+
newCheckedRows.value.push(...rowsToCheck);
|
|
395
|
+
}
|
|
396
|
+
emit("check", newCheckedRows.value);
|
|
397
|
+
emit("check-all", newCheckedRows.value);
|
|
398
|
+
emit("update:checkedRows", newCheckedRows.value);
|
|
399
|
+
emit("update:selectedRows", newCheckedRows.value);
|
|
382
400
|
};
|
|
383
401
|
|
|
384
|
-
const checkRow = (row: any, _rowIndex: number, _event:any) => {
|
|
402
|
+
const checkRow = (row: any, _rowIndex: number, _event: any) => {
|
|
385
403
|
const isChecked = newCheckedRows.value.includes(row);
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
404
|
+
if (_event && isChecked) {
|
|
405
|
+
removeCheckedRow(row);
|
|
406
|
+
} else {
|
|
407
|
+
newCheckedRows.value.push(row);
|
|
408
|
+
}
|
|
409
|
+
emit("check", newCheckedRows.value, row);
|
|
410
|
+
emit("update:checkedRows", newCheckedRows.value);
|
|
411
|
+
emit("update:selectedRows", newCheckedRows.value);
|
|
394
412
|
};
|
|
395
413
|
|
|
396
414
|
// watch
|