edvoyui-component-library-test-flight 0.0.168 → 0.0.170
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/package.json +10 -3
- package/src/App.vue +0 -16
- package/src/assets/svg/CheckTick.vue +0 -21
- package/src/assets/svg/ChevronBigDown.vue +0 -22
- package/src/assets/svg/ChevronDownSolid.vue +0 -19
- package/src/assets/svg/ChevronDownStroke.vue +0 -22
- package/src/assets/svg/ChevronDownStrokeSolid.vue +0 -19
- package/src/assets/svg/SearchBigZoomIn.vue +0 -21
- package/src/assets/svg/SortArrow.vue +0 -24
- package/src/assets/svg/Student.vue +0 -30
- package/src/assets/svg/partner.vue +0 -33
- package/src/assets/svg/people.vue +0 -25
- package/src/components/HelloWorld.vue +0 -1974
- package/src/components/accordion/EUIAccordion.vue +0 -152
- package/src/components/alerts/EUIAlerts.vue +0 -194
- package/src/components/avatar/EUIAvatar.vue +0 -96
- package/src/components/breadcrumb/EUIBreadcrumb.vue +0 -59
- package/src/components/button/EUIButton.vue +0 -154
- package/src/components/button/EUIButtonGroup.vue +0 -287
- package/src/components/button/buttonAnimateTab.vue +0 -74
- package/src/components/checkbox/EUICheckbox.vue +0 -110
- package/src/components/datepicker/EUIDatepicker.vue +0 -295
- package/src/components/delete.vue +0 -262
- package/src/components/dragModal/EUIDrag.vue +0 -179
- package/src/components/dropdown/EUIMultiDropdown.vue +0 -174
- package/src/components/errorMessage/EUIErrorMessage.vue +0 -25
- package/src/components/input/EUIInput.vue +0 -223
- package/src/components/input/EUINumberInput.vue +0 -250
- package/src/components/loader/EUICircleLoader.vue +0 -31
- package/src/components/loader/EUICubeLoader.vue +0 -237
- package/src/components/loader/EUILoader.vue +0 -17
- package/src/components/loader/EUISquareLoader.vue +0 -47
- package/src/components/modal/EUIModal.vue +0 -224
- package/src/components/pillSelect/EUIPillSelect.vue +0 -149
- package/src/components/popover/EUIPopover.vue +0 -297
- package/src/components/radio/EUIRadio.vue +0 -75
- package/src/components/searchInput/EUISearch.vue +0 -223
- package/src/components/searchTagSelect/EUISearchTagSelect.vue +0 -642
- package/src/components/searchTagSelect/SearchInput.vue +0 -167
- package/src/components/searchexpand/EUISearchExpand.vue +0 -148
- package/src/components/searchexpand/EUISearchToggle.vue +0 -86
- package/src/components/select/EUISelect.vue +0 -1092
- package/src/components/selectSearch/EUISelectSearch.vue +0 -23
- package/src/components/slideover/EUISlideover.vue +0 -207
- package/src/components/stepperTimeline/EUIStepperHorizontal.vue +0 -242
- package/src/components/stepperTimeline/EUIStepperTimeline.vue +0 -16
- package/src/components/stepperTimeline/EUIStepperVertical.vue +0 -112
- package/src/components/table/ColumnResizeTable.vue +0 -740
- package/src/components/table/EUIDashboardTable.vue +0 -514
- package/src/components/table/EUIPageLimit.vue +0 -66
- package/src/components/table/EUIPagination.vue +0 -175
- package/src/components/table/EUIStudentPagination.vue +0 -172
- package/src/components/table/EUITable.vue +0 -559
- package/src/components/table/EUITableCheckbox.vue +0 -98
- package/src/components/table/GrowthTable.vue +0 -575
- package/src/components/table/GrowthTableView.vue +0 -108
- package/src/components/table/ResizeTableview.vue +0 -198
- package/src/components/table/UCheckbox.vue +0 -169
- package/src/components/table/UTable.vue +0 -611
- package/src/components/table/UTableview.vue +0 -189
- package/src/components/tabs/EUITabOutline.vue +0 -263
- package/src/components/tabs/EUITabs.vue +0 -226
- package/src/components/tag/EUITag.vue +0 -88
- package/src/components/telephone/EUITelephone.vue +0 -299
- package/src/components/textArea/EUITextArea.vue +0 -155
- package/src/components/timeLine/EUITimeLine.vue +0 -148
- package/src/components/toggle/EUIToggle.vue +0 -101
- package/src/components/tooltip/EUITooltip.vue +0 -111
- package/src/components/uidemo/select-com.vue +0 -120
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<Transition name="fade" mode="out-in">
|
|
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">
|
|
24
|
-
<div
|
|
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"
|
|
35
|
-
>
|
|
36
|
-
<table class="eui-table">
|
|
37
|
-
<thead class="sticky top-0 left-0 z-50 bg-gray-100">
|
|
38
|
-
<tr>
|
|
39
|
-
<template v-if="checkable">
|
|
40
|
-
<th class="checkable">
|
|
41
|
-
<EUITableCheckbox
|
|
42
|
-
:checked="isAllChecked"
|
|
43
|
-
:indeterminate="isIndeterminate"
|
|
44
|
-
:disabled="isAllUncheckable"
|
|
45
|
-
class="flex justify-center mt-0"
|
|
46
|
-
@change="checkAll()"
|
|
47
|
-
/>
|
|
48
|
-
</th>
|
|
49
|
-
</template>
|
|
50
|
-
<th
|
|
51
|
-
v-for="(header, headerIndex) in headers"
|
|
52
|
-
:key="`item-${headerIndex}`"
|
|
53
|
-
scope="col"
|
|
54
|
-
:class="[
|
|
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 },
|
|
58
|
-
]"
|
|
59
|
-
:style="
|
|
60
|
-
header?.width
|
|
61
|
-
? `min-width:${header.width}px;max-width:${header.width}px;`
|
|
62
|
-
: ``
|
|
63
|
-
"
|
|
64
|
-
@click="sortBy(header, $event)"
|
|
65
|
-
>
|
|
66
|
-
<div
|
|
67
|
-
class="flex items-center gap-2 text-sm font-normal text-current"
|
|
68
|
-
>
|
|
69
|
-
<slot name="header" :header="header" :index="headerIndex">
|
|
70
|
-
{{ capitalizeText(header?.text ?? header.name ?? "") }}
|
|
71
|
-
</slot>
|
|
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>
|
|
85
|
-
</tr>
|
|
86
|
-
</thead>
|
|
87
|
-
<tbody>
|
|
88
|
-
<template
|
|
89
|
-
v-if="computedItems.length > 0"
|
|
90
|
-
v-for="(row, rowIndex) in computedItems"
|
|
91
|
-
:key="`table-row-${rowIndex}`"
|
|
92
|
-
>
|
|
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>
|
|
173
|
-
</div>
|
|
174
|
-
</slot>
|
|
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>
|
|
186
|
-
</div>
|
|
187
|
-
</Transition>
|
|
188
|
-
</div>
|
|
189
|
-
</template>
|
|
190
|
-
|
|
191
|
-
<script setup lang="ts">
|
|
192
|
-
import {
|
|
193
|
-
computed,
|
|
194
|
-
onMounted,
|
|
195
|
-
onUnmounted,
|
|
196
|
-
PropType,
|
|
197
|
-
ref,
|
|
198
|
-
toRefs,
|
|
199
|
-
watch,
|
|
200
|
-
} from "vue";
|
|
201
|
-
import EUIPagination from "./EUIPagination.vue";
|
|
202
|
-
import EUITableCheckbox from "./EUITableCheckbox.vue";
|
|
203
|
-
import SortArrow from "../../assets/svg/SortArrow.vue";
|
|
204
|
-
import EUIPageLimit from "./EUIPageLimit.vue";
|
|
205
|
-
import { capitalizeText } from "../../utils/lodash";
|
|
206
|
-
import EUICircleLoader from "../loader/EUICircleLoader.vue";
|
|
207
|
-
import { indexOf, getValueByPath, defaultFilter } from "../../utils/helpers";
|
|
208
|
-
|
|
209
|
-
interface Header {
|
|
210
|
-
value: string;
|
|
211
|
-
text?: string;
|
|
212
|
-
name?: string;
|
|
213
|
-
width?: number;
|
|
214
|
-
sortable?: boolean;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const props = defineProps({
|
|
218
|
-
checkable: {
|
|
219
|
-
type: Boolean,
|
|
220
|
-
default: false,
|
|
221
|
-
},
|
|
222
|
-
stickyColumn: { type: Boolean, default: true },
|
|
223
|
-
paginated: { type: Boolean, default: false },
|
|
224
|
-
tableExpanded: { type: Boolean, default: false },
|
|
225
|
-
backendPagination: { type: Boolean, default: false },
|
|
226
|
-
checkedRows: { type: Array, default: () => ({}), required: true },
|
|
227
|
-
headers: {
|
|
228
|
-
type: Array as PropType<Header[]>,
|
|
229
|
-
default: () => ({}),
|
|
230
|
-
required: true,
|
|
231
|
-
},
|
|
232
|
-
items: { type: Array, required: true, default: () => ({}) },
|
|
233
|
-
defaultSort: { type: String, default: "" },
|
|
234
|
-
defaultSortDirection: { type: String, default: "asc" },
|
|
235
|
-
search: { type: String, default: "" },
|
|
236
|
-
perPage: { type: Number, default: 5 },
|
|
237
|
-
currentPage: { type: Number, default: 0 },
|
|
238
|
-
total: { type: Number, default: 0 },
|
|
239
|
-
customIsChecked: {
|
|
240
|
-
type: Function as PropType<(item: any, obj: any) => boolean>,
|
|
241
|
-
default: () => () => false,
|
|
242
|
-
},
|
|
243
|
-
isRowCheckable: { type: Function, default: () => true },
|
|
244
|
-
tableHeight: {
|
|
245
|
-
type: String,
|
|
246
|
-
required: false,
|
|
247
|
-
default: "",
|
|
248
|
-
},
|
|
249
|
-
tableLoading: { type: Boolean, default: false },
|
|
250
|
-
});
|
|
251
|
-
const {
|
|
252
|
-
defaultSort,
|
|
253
|
-
defaultSortDirection,
|
|
254
|
-
checkedRows,
|
|
255
|
-
currentPage,
|
|
256
|
-
items,
|
|
257
|
-
backendPagination,
|
|
258
|
-
total,
|
|
259
|
-
search,
|
|
260
|
-
headers,
|
|
261
|
-
paginated,
|
|
262
|
-
isRowCheckable,
|
|
263
|
-
} = toRefs(props);
|
|
264
|
-
|
|
265
|
-
const currentSort = ref(defaultSort.value);
|
|
266
|
-
const currentSortDir = ref(defaultSortDirection.value);
|
|
267
|
-
const newCheckedRows = ref([...checkedRows.value]);
|
|
268
|
-
|
|
269
|
-
const newCurrentPage = ref(currentPage.value);
|
|
270
|
-
const limit = ref(props.perPage);
|
|
271
|
-
const loading = computed(() => props.tableLoading);
|
|
272
|
-
|
|
273
|
-
// Computed Property
|
|
274
|
-
const filteredItems = computed(() => {
|
|
275
|
-
let filteredItems = items.value.slice();
|
|
276
|
-
if (!backendPagination.value && search.value !== "") {
|
|
277
|
-
if (search.value.trim() === "") return filteredItems;
|
|
278
|
-
const props = headers.value.map((h) => h.value);
|
|
279
|
-
filteredItems = items.value.filter((item) =>
|
|
280
|
-
props.some((prop) =>
|
|
281
|
-
defaultFilter(
|
|
282
|
-
getValueByPath(item, prop),
|
|
283
|
-
search.value.toString().toLowerCase()
|
|
284
|
-
)
|
|
285
|
-
)
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
return filteredItems;
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
const computedItems = computed(() => {
|
|
292
|
-
let items = filteredItems.value;
|
|
293
|
-
// Sort items before slicing for pagination
|
|
294
|
-
items.sort((a: any, b: any) => {
|
|
295
|
-
const modifier = currentSortDir.value === "desc" ? -1 : 1;
|
|
296
|
-
if (a[currentSort.value] < b[currentSort.value]) return -1 * modifier;
|
|
297
|
-
if (a[currentSort.value] > b[currentSort.value]) return 1 * modifier;
|
|
298
|
-
return 0;
|
|
299
|
-
});
|
|
300
|
-
return items;
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
const searchData = (_data: any) => {
|
|
304
|
-
// console.log(_data);
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
const sortClass = computed(() => (header: any) => {
|
|
308
|
-
return currentSortDir.value === "asc" && currentSort.value === header.value
|
|
309
|
-
? "rotate-0"
|
|
310
|
-
: currentSortDir.value === "desc" && currentSort.value === header.value
|
|
311
|
-
? "rotate-180"
|
|
312
|
-
: "";
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
const isIndeterminate = computed(() => {
|
|
316
|
-
const validVisibleData = computedItems.value.filter((row) =>
|
|
317
|
-
isRowCheckable.value(row)
|
|
318
|
-
);
|
|
319
|
-
return (
|
|
320
|
-
newCheckedRows.value.length > 0 &&
|
|
321
|
-
newCheckedRows.value.length < validVisibleData.length
|
|
322
|
-
);
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
const isAllChecked = computed(() => {
|
|
326
|
-
return (
|
|
327
|
-
computedItems.value.length > 0 &&
|
|
328
|
-
computedItems.value.every((row) => newCheckedRows.value.includes(row))
|
|
329
|
-
);
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
const isAllUncheckable = computed(() => {
|
|
333
|
-
const validVisibleData = computedItems.value?.filter((row) =>
|
|
334
|
-
isRowCheckable.value!(row)
|
|
335
|
-
);
|
|
336
|
-
return validVisibleData.length === 0;
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
const emit = defineEmits([
|
|
340
|
-
"update:currentPage",
|
|
341
|
-
"changePage",
|
|
342
|
-
"sort",
|
|
343
|
-
"check",
|
|
344
|
-
"check-all",
|
|
345
|
-
"update:checkedRows",
|
|
346
|
-
"update:selectedRows",
|
|
347
|
-
"changeLimit",
|
|
348
|
-
"mouseenter",
|
|
349
|
-
"mouseleave",
|
|
350
|
-
]);
|
|
351
|
-
|
|
352
|
-
const changeLimit = (limitData: number) => {
|
|
353
|
-
limit.value = limitData;
|
|
354
|
-
newCurrentPage.value = 0;
|
|
355
|
-
emit("update:currentPage", newCurrentPage.value);
|
|
356
|
-
emit("changeLimit", limitData);
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
const pageChanged = (page: number) => {
|
|
360
|
-
newCurrentPage.value = page > 0 ? page : 0;
|
|
361
|
-
emit("update:currentPage", newCurrentPage.value);
|
|
362
|
-
emit("changePage", page);
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
const sortBy = (header: any, event: any) => {
|
|
366
|
-
if (!header || !header.sortable) return;
|
|
367
|
-
if (header.value === currentSort.value) {
|
|
368
|
-
currentSortDir.value = currentSortDir.value === "asc" ? "desc" : "asc";
|
|
369
|
-
}
|
|
370
|
-
currentSort.value = header.value;
|
|
371
|
-
emit("sort", currentSort.value, currentSortDir.value, event);
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
const isRowChecked = (row: any) => {
|
|
375
|
-
return indexOf(newCheckedRows.value, row) >= 0;
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
const removeCheckedRow = (row: any) => {
|
|
379
|
-
const index = indexOf(newCheckedRows.value, row);
|
|
380
|
-
if (index >= 0) {
|
|
381
|
-
newCheckedRows.value.splice(index, 1);
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
const checkAll = () => {
|
|
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);
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
const checkRow = (row: any, _rowIndex: number, _event: any) => {
|
|
403
|
-
const isChecked = newCheckedRows.value.includes(row);
|
|
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);
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
// watch
|
|
415
|
-
watch(
|
|
416
|
-
() => currentPage.value,
|
|
417
|
-
(newVal) => {
|
|
418
|
-
newCurrentPage.value = newVal;
|
|
419
|
-
},
|
|
420
|
-
{ immediate: true }
|
|
421
|
-
);
|
|
422
|
-
|
|
423
|
-
watch(
|
|
424
|
-
() => checkedRows.value,
|
|
425
|
-
(rows) => {
|
|
426
|
-
newCheckedRows.value = [...rows];
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
immediate: true,
|
|
430
|
-
}
|
|
431
|
-
);
|
|
432
|
-
|
|
433
|
-
// table scroll to add class
|
|
434
|
-
const stickyClass = computed(() => {
|
|
435
|
-
return props.checkable && props.stickyColumn
|
|
436
|
-
? {
|
|
437
|
-
head: "bg-gray-100 sticky left-[4.5rem] top-0 z-20",
|
|
438
|
-
body: "bg-white sticky left-[4.5rem] top-0 z-10",
|
|
439
|
-
}
|
|
440
|
-
: {
|
|
441
|
-
head: "bg-gray-100 sticky left-0 top-0 z-20",
|
|
442
|
-
body: "bg-white sticky left-0 top-0 z-10",
|
|
443
|
-
};
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
const isOverflowing = ref(false);
|
|
447
|
-
const isScrolled = ref(false);
|
|
448
|
-
const tableContainer = ref<HTMLElement | null>(null);
|
|
449
|
-
|
|
450
|
-
const handleScroll = () => {
|
|
451
|
-
const container = tableContainer.value;
|
|
452
|
-
if (container) {
|
|
453
|
-
isScrolled.value = container.scrollLeft > 0;
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
const checkOverflow = () => {
|
|
458
|
-
const container = tableContainer.value;
|
|
459
|
-
if (container) {
|
|
460
|
-
isOverflowing.value = container.scrollWidth > container.clientWidth;
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
onMounted(() => {
|
|
465
|
-
window.addEventListener("resize", checkOverflow);
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
onUnmounted(() => {
|
|
469
|
-
window.removeEventListener("resize", checkOverflow);
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
// Watch for changes in the container's width to check for overflow
|
|
473
|
-
watch(() => tableContainer.value?.clientWidth, checkOverflow);
|
|
474
|
-
</script>
|
|
475
|
-
|
|
476
|
-
<style lang="scss" scoped>
|
|
477
|
-
#dashboard-table {
|
|
478
|
-
& .eui-table {
|
|
479
|
-
border-spacing: 0 0.5rem;
|
|
480
|
-
@apply min-w-full text-sm font-light text-left table table-auto w-full -mt-2 box-border border-separate relative;
|
|
481
|
-
thead tr {
|
|
482
|
-
@apply snap-x snap-mandatory;
|
|
483
|
-
th {
|
|
484
|
-
@apply snap-always snap-start;
|
|
485
|
-
&:first-of-type.checkable {
|
|
486
|
-
height: 45px;
|
|
487
|
-
@apply flex items-center justify-center px-4 max-w-[4.5rem] w-[4.5rem] sticky left-0 top-0 z-20 bg-gray-100;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
tbody {
|
|
492
|
-
@apply snap-y snap-mandatory snap-always;
|
|
493
|
-
tr:not(.norecords) {
|
|
494
|
-
@apply text-gray-500 transition-all duration-300 rounded-xl bg-white snap-start ease-in-out snap-x snap-mandatory will-change-transform;
|
|
495
|
-
&:hover {
|
|
496
|
-
@apply shadow-[1px_2px_40px_0px_#03022912] ring-1 ring-gray-100 ring-inset z-30;
|
|
497
|
-
}
|
|
498
|
-
td {
|
|
499
|
-
@apply px-4 py-4 text-sm font-normal last-of-type:rounded-r-xl first-of-type:rounded-l-xl transition-colors duration-100 ease-in-out border-solid border border-l-0 border-r-0 border-white first:border-s last:border-e will-change-contents;
|
|
500
|
-
&:first-of-type.checkable {
|
|
501
|
-
@apply w-14 text-center sticky left-0 top-0 z-[11] bg-white;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
&:hover td {
|
|
505
|
-
@apply font-medium text-gray-900 bg-white border-gray-100;
|
|
506
|
-
&:first-of-type.checkable {
|
|
507
|
-
@apply bg-white;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
</style>
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<EUIPopover
|
|
4
|
-
trigger="click"
|
|
5
|
-
placement="top"
|
|
6
|
-
className="max-w-40 min-w-40"
|
|
7
|
-
customButton="px-3 py-2 text-sm font-medium text-gray-900 bg-white rounded-md group hover:text-opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 gap-x-1"
|
|
8
|
-
>
|
|
9
|
-
<template #referenceButton="{ open }">
|
|
10
|
-
<span class="whitespace-nowrap">{{ pageLimit }}</span>
|
|
11
|
-
<component :is="iconStyle ? ChevronDownSolid : ChevronDownStroke"
|
|
12
|
-
:class="open ? 'text-gray-900 rotate-180' : 'text-gray-500'"
|
|
13
|
-
class="transition duration-100 ease-in-out transform rotate-0 size-6 group-hover:text-opacity-80"
|
|
14
|
-
aria-hidden="true"
|
|
15
|
-
/>
|
|
16
|
-
</template>
|
|
17
|
-
<!-- Popper Content Here... -->
|
|
18
|
-
<div
|
|
19
|
-
class="overflow-hidden bg-white rounded-lg shadow-lg ring-1 ring-black ring-opacity-5"
|
|
20
|
-
>
|
|
21
|
-
<ul>
|
|
22
|
-
<li
|
|
23
|
-
v-for="item in pageList"
|
|
24
|
-
:key="item"
|
|
25
|
-
class="block w-full px-4 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50"
|
|
26
|
-
:class="[
|
|
27
|
-
item === pageLimit
|
|
28
|
-
? 'bg-purple-100 text-purple-600'
|
|
29
|
-
: 'text-gray-700'
|
|
30
|
-
]"
|
|
31
|
-
role="button"
|
|
32
|
-
aria-roledescription="button"
|
|
33
|
-
@click="changePageLimit(item)"
|
|
34
|
-
>
|
|
35
|
-
{{ item }} per page
|
|
36
|
-
</li>
|
|
37
|
-
</ul>
|
|
38
|
-
</div>
|
|
39
|
-
</EUIPopover>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<script lang="ts" setup>
|
|
44
|
-
import { PropType, ref, toRefs } from 'vue';
|
|
45
|
-
import ChevronDownSolid from '../../assets/svg/ChevronDownSolid.vue';
|
|
46
|
-
import ChevronDownStroke from '../../assets/svg/ChevronDownStroke.vue';
|
|
47
|
-
import EUIPopover from '../popover/EUIPopover.vue';
|
|
48
|
-
|
|
49
|
-
const props = defineProps({
|
|
50
|
-
pageLimit: {
|
|
51
|
-
type: Number as PropType<number>,
|
|
52
|
-
default: 5
|
|
53
|
-
},
|
|
54
|
-
iconStyle: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: false,
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
const { pageLimit } = toRefs(props)
|
|
60
|
-
const emit = defineEmits(['updateLimit', 'refetch'])
|
|
61
|
-
const pageList = ref([5, 10, 20, 30, 40, 50, 100])
|
|
62
|
-
const changePageLimit = (data: any) => {
|
|
63
|
-
emit('updateLimit', data)
|
|
64
|
-
emit('refetch')
|
|
65
|
-
}
|
|
66
|
-
</script>
|