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,611 +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
|
-
<div v-else class="relative max-w-full mx-auto overflow-hidden">
|
|
23
|
-
<div
|
|
24
|
-
:class="[
|
|
25
|
-
'ui-table scrollbar--auto',
|
|
26
|
-
computedItems.length === 0
|
|
27
|
-
? 'overflow-hidden pointer-events-none'
|
|
28
|
-
: 'overflow-scroll',
|
|
29
|
-
tableHeight
|
|
30
|
-
? tableHeight
|
|
31
|
-
: 'h-[calc(100svh-12rem)] max-h-[calc(100svh-12rem)]',
|
|
32
|
-
]"
|
|
33
|
-
ref="tableContainer"
|
|
34
|
-
@scroll="handleScroll"
|
|
35
|
-
>
|
|
36
|
-
<table>
|
|
37
|
-
<thead>
|
|
38
|
-
<tr>
|
|
39
|
-
<th
|
|
40
|
-
v-if="checkable"
|
|
41
|
-
class="checkable"
|
|
42
|
-
style="
|
|
43
|
-
width: 45px;
|
|
44
|
-
max-width: 45px;
|
|
45
|
-
background-color: rgb(243 244 246);
|
|
46
|
-
"
|
|
47
|
-
scope="col"
|
|
48
|
-
>
|
|
49
|
-
<UCheckbox
|
|
50
|
-
:checked="isAllChecked"
|
|
51
|
-
:indeterminate="isIndeterminate"
|
|
52
|
-
:disabled="isAllUncheckable"
|
|
53
|
-
@change="checkAll"
|
|
54
|
-
/>
|
|
55
|
-
</th>
|
|
56
|
-
<th
|
|
57
|
-
v-for="(header, headerIndex) in headers"
|
|
58
|
-
:key="headerIndex"
|
|
59
|
-
scope="col"
|
|
60
|
-
:class="[
|
|
61
|
-
'snap-start snap-always py-2',
|
|
62
|
-
header?.sortable
|
|
63
|
-
? 'cursor-pointer hover:!text-gray-900 pr-8 pl-3'
|
|
64
|
-
: 'px-3 cursor-auto',
|
|
65
|
-
isScrolled && headerIndex === 0 ? stickyClass.head : null,
|
|
66
|
-
{ '!bg-gray-200': currentSort === header.value },
|
|
67
|
-
]"
|
|
68
|
-
:style="
|
|
69
|
-
headers.length > 6
|
|
70
|
-
? headerStyle(header)
|
|
71
|
-
: 'width: 100%;min-width: 250px;background-color: rgb(243 244 246);'
|
|
72
|
-
"
|
|
73
|
-
@click="sortBy(header, $event)"
|
|
74
|
-
>
|
|
75
|
-
<div class="relative z-0 w-full">
|
|
76
|
-
<div
|
|
77
|
-
class="w-full text-sm font-bold text-current font-inter"
|
|
78
|
-
:class="{ truncate: !header?.showHeaderInfoText }"
|
|
79
|
-
>
|
|
80
|
-
<slot name="header" :header="header" :index="headerIndex">
|
|
81
|
-
{{ capitalizeText(header?.text ?? header?.name ?? "") }}
|
|
82
|
-
</slot>
|
|
83
|
-
<slot
|
|
84
|
-
v-if="headerOptional"
|
|
85
|
-
name="headerOptionalItem"
|
|
86
|
-
></slot>
|
|
87
|
-
<EUITooltip
|
|
88
|
-
v-if="header?.showInfoText"
|
|
89
|
-
placement="top"
|
|
90
|
-
class="inline-block ms-0.5"
|
|
91
|
-
>
|
|
92
|
-
<template v-slot:default>
|
|
93
|
-
<InformationCircleIcon
|
|
94
|
-
class="inline-block text-gray-500 size-4"
|
|
95
|
-
/>
|
|
96
|
-
</template>
|
|
97
|
-
<template v-slot:tooltip>
|
|
98
|
-
<div
|
|
99
|
-
class="z-50 max-w-xs break-words whitespace-normal min-w-max"
|
|
100
|
-
>
|
|
101
|
-
{{ header?.showHeaderInfoText }}
|
|
102
|
-
</div>
|
|
103
|
-
</template>
|
|
104
|
-
</EUITooltip>
|
|
105
|
-
</div>
|
|
106
|
-
<div
|
|
107
|
-
v-if="header?.sortable"
|
|
108
|
-
class="absolute -top-0.5 -right-6 size-6 z-10"
|
|
109
|
-
>
|
|
110
|
-
<svg
|
|
111
|
-
width="24"
|
|
112
|
-
height="24"
|
|
113
|
-
viewBox="0 0 24 24"
|
|
114
|
-
fill="none"
|
|
115
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
116
|
-
class="size-6"
|
|
117
|
-
>
|
|
118
|
-
<rect width="24" height="24" fill="none" />
|
|
119
|
-
<path
|
|
120
|
-
d="M8 10C9.06206 8.5381 10.3071 7.2287 11.7021 6.1058C11.8774 5.9647 12.1226 5.9647 12.2979 6.1058C13.6929 7.2287 14.9379 8.5381 16 10"
|
|
121
|
-
:stroke="
|
|
122
|
-
currentSortDir === 'asc' &&
|
|
123
|
-
currentSort === header?.value
|
|
124
|
-
? '#111827'
|
|
125
|
-
: '#9ca3af'
|
|
126
|
-
"
|
|
127
|
-
stroke-opacity="0.8"
|
|
128
|
-
stroke-width="2"
|
|
129
|
-
stroke-linecap="round"
|
|
130
|
-
stroke-linejoin="round"
|
|
131
|
-
/>
|
|
132
|
-
<path
|
|
133
|
-
d="M8 14C9.06206 15.4619 10.3071 16.7713 11.7021 17.8942C11.8774 18.0353 12.1226 18.0353 12.2979 17.8942C13.6929 16.7713 14.9379 15.4619 16 14"
|
|
134
|
-
:stroke="
|
|
135
|
-
currentSortDir === 'desc' &&
|
|
136
|
-
currentSort === header?.value
|
|
137
|
-
? '#111827'
|
|
138
|
-
: '#9ca3af'
|
|
139
|
-
"
|
|
140
|
-
stroke-opacity="0.8"
|
|
141
|
-
stroke-width="2"
|
|
142
|
-
stroke-linecap="round"
|
|
143
|
-
stroke-linejoin="round"
|
|
144
|
-
/>
|
|
145
|
-
</svg>
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
</th>
|
|
149
|
-
</tr>
|
|
150
|
-
</thead>
|
|
151
|
-
<tbody>
|
|
152
|
-
<template
|
|
153
|
-
v-if="computedItems.length > 0"
|
|
154
|
-
v-for="(row, rowIndex) in computedItems"
|
|
155
|
-
:key="`table-row-${rowIndex}`"
|
|
156
|
-
>
|
|
157
|
-
<tr
|
|
158
|
-
:id="`row-${rowIndex}`"
|
|
159
|
-
@mouseenter="
|
|
160
|
-
$attrs.mouseenter
|
|
161
|
-
? $emit('mouseenter', row, rowIndex)
|
|
162
|
-
: null
|
|
163
|
-
"
|
|
164
|
-
@mouseleave="
|
|
165
|
-
$attrs.mouseleave
|
|
166
|
-
? $emit('mouseleave', row, rowIndex)
|
|
167
|
-
: null
|
|
168
|
-
"
|
|
169
|
-
class="group"
|
|
170
|
-
:class="{ 'bg-purple-100': activeRowIndex == rowIndex }"
|
|
171
|
-
>
|
|
172
|
-
<td
|
|
173
|
-
v-if="checkable"
|
|
174
|
-
class="checkable"
|
|
175
|
-
style="width: 45px; max-width: 45px"
|
|
176
|
-
>
|
|
177
|
-
<UCheckbox
|
|
178
|
-
:disabled="!isRowCheckable(row)"
|
|
179
|
-
:checked="isRowChecked(row)"
|
|
180
|
-
@change.prevent.stop="
|
|
181
|
-
($event) => checkRow(row, rowIndex, $event)
|
|
182
|
-
"
|
|
183
|
-
/>
|
|
184
|
-
</td>
|
|
185
|
-
<td
|
|
186
|
-
v-for="(header, headerIndex) in headers"
|
|
187
|
-
:key="headerIndex"
|
|
188
|
-
:style="bodyStyle(header)"
|
|
189
|
-
:class="[
|
|
190
|
-
isScrolled && headerIndex === 0 ? stickyClass.body : null,
|
|
191
|
-
{ '!bg-purple-100': activeRowIndex == rowIndex },
|
|
192
|
-
]"
|
|
193
|
-
>
|
|
194
|
-
<slot
|
|
195
|
-
:name="`item.${header?.value}`"
|
|
196
|
-
:row="row"
|
|
197
|
-
:rowIndex="rowIndex"
|
|
198
|
-
:headerIndex="headerIndex"
|
|
199
|
-
>
|
|
200
|
-
<span
|
|
201
|
-
class="block"
|
|
202
|
-
:class="{ truncate: !header.showInfoText }"
|
|
203
|
-
>
|
|
204
|
-
{{ getValueByPath(row, header?.value) }}
|
|
205
|
-
<EUITooltip
|
|
206
|
-
v-if="header?.showInfoText"
|
|
207
|
-
placement="top"
|
|
208
|
-
class="inline-block ms-0.5"
|
|
209
|
-
>
|
|
210
|
-
<template v-slot:default>
|
|
211
|
-
<InformationCircleIcon
|
|
212
|
-
class="inline-block text-gray-500 size-4"
|
|
213
|
-
/>
|
|
214
|
-
</template>
|
|
215
|
-
<template v-slot:tooltip>
|
|
216
|
-
<div
|
|
217
|
-
class="z-50 max-w-xs break-words whitespace-normal min-w-max"
|
|
218
|
-
>
|
|
219
|
-
{{ header?.showInfoText }}
|
|
220
|
-
</div>
|
|
221
|
-
</template>
|
|
222
|
-
</EUITooltip>
|
|
223
|
-
</span>
|
|
224
|
-
</slot>
|
|
225
|
-
</td>
|
|
226
|
-
</tr>
|
|
227
|
-
<template v-if="tableExpanded">
|
|
228
|
-
<slot
|
|
229
|
-
name="expanded"
|
|
230
|
-
:row="row"
|
|
231
|
-
:rowIndex="rowIndex"
|
|
232
|
-
:headerLength="headers.length"
|
|
233
|
-
></slot>
|
|
234
|
-
</template>
|
|
235
|
-
</template>
|
|
236
|
-
<template v-else-if="computedItems.length === 0">
|
|
237
|
-
<tr class="norecords">
|
|
238
|
-
<td
|
|
239
|
-
:colspan="
|
|
240
|
-
checkable === true ? headers.length + 1 : headers.length
|
|
241
|
-
"
|
|
242
|
-
>
|
|
243
|
-
<slot name="no-records">
|
|
244
|
-
<div
|
|
245
|
-
class="flex items-center justify-center w-[calc(100vw-14rem)]"
|
|
246
|
-
:class="[
|
|
247
|
-
tableHeight
|
|
248
|
-
? tableHeight
|
|
249
|
-
: 'h-[calc(100svh-12rem)] max-h-[calc(100svh-12rem)]',
|
|
250
|
-
]"
|
|
251
|
-
>
|
|
252
|
-
<div class="text-center">
|
|
253
|
-
<div
|
|
254
|
-
class="mx-auto overflow-hidden rounded-md size-56"
|
|
255
|
-
>
|
|
256
|
-
<img
|
|
257
|
-
src="@/assets/images/search-nodata.png"
|
|
258
|
-
alt=""
|
|
259
|
-
class="block object-contain object-center h-auto max-w-full opacity-90"
|
|
260
|
-
/>
|
|
261
|
-
</div>
|
|
262
|
-
<div class="my-2 text-xl font-medium text-gray-500">
|
|
263
|
-
No matching records found
|
|
264
|
-
</div>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
</slot>
|
|
268
|
-
</td>
|
|
269
|
-
</tr>
|
|
270
|
-
</template>
|
|
271
|
-
</tbody>
|
|
272
|
-
</table>
|
|
273
|
-
</div>
|
|
274
|
-
<div
|
|
275
|
-
v-if="stickyFooter"
|
|
276
|
-
class="sticky bottom-0 left-0 z-50 flex items-center justify-between px-2 py-1 bg-white border-t border-gray-300"
|
|
277
|
-
>
|
|
278
|
-
<slot name="tableCount">
|
|
279
|
-
<div class="inline-flex items-center gap-x-2">
|
|
280
|
-
<div class="text-sm font-medium text-gray-900">
|
|
281
|
-
Total {{ total }}
|
|
282
|
-
</div>
|
|
283
|
-
<span class="text-gray-300">|</span>
|
|
284
|
-
<div class="inline-flex items-center">
|
|
285
|
-
<span class="text-sm font-medium text-gray-900">Per page</span>
|
|
286
|
-
<EUIPageLimit
|
|
287
|
-
:page-limit="limit"
|
|
288
|
-
@update-limit="changeLimit($event)"
|
|
289
|
-
@refetch="searchData($event)"
|
|
290
|
-
:iconStyle="true"
|
|
291
|
-
/>
|
|
292
|
-
</div>
|
|
293
|
-
</div>
|
|
294
|
-
</slot>
|
|
295
|
-
<template v-if="paginated && computedItems.length !== 0">
|
|
296
|
-
<slot name="tablepagination">
|
|
297
|
-
<EUIStudentPagination
|
|
298
|
-
:activePage="newCurrentPage"
|
|
299
|
-
:pageLimit="limit"
|
|
300
|
-
:totalCount="total"
|
|
301
|
-
@change-page="pageChanged($event)"
|
|
302
|
-
/>
|
|
303
|
-
</slot>
|
|
304
|
-
</template>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
</Transition>
|
|
308
|
-
</div>
|
|
309
|
-
</template>
|
|
310
|
-
|
|
311
|
-
<script lang="ts" setup>
|
|
312
|
-
import {
|
|
313
|
-
ref,
|
|
314
|
-
computed,
|
|
315
|
-
watch,
|
|
316
|
-
toRefs,
|
|
317
|
-
PropType,
|
|
318
|
-
onMounted,
|
|
319
|
-
onUnmounted,
|
|
320
|
-
} from "vue";
|
|
321
|
-
import { getValueByPath, indexOf, defaultFilter } from "../../utils/helpers";
|
|
322
|
-
import UCheckbox from "./UCheckbox.vue";
|
|
323
|
-
import { capitalizeText } from "../../utils/lodash";
|
|
324
|
-
import EUIStudentPagination from "./EUIStudentPagination.vue";
|
|
325
|
-
import EUICircleLoader from "../loader/EUICircleLoader.vue";
|
|
326
|
-
import EUIPageLimit from "./EUIPageLimit.vue";
|
|
327
|
-
import "./UTable.scss";
|
|
328
|
-
import EUITooltip from "../tooltip/EUITooltip.vue";
|
|
329
|
-
import { InformationCircleIcon } from "@heroicons/vue/24/outline";
|
|
330
|
-
|
|
331
|
-
interface Header {
|
|
332
|
-
value: string;
|
|
333
|
-
text?: string;
|
|
334
|
-
name?: string;
|
|
335
|
-
sortable?: boolean;
|
|
336
|
-
width?: number;
|
|
337
|
-
color?: string;
|
|
338
|
-
showInfoText?: string;
|
|
339
|
-
showHeaderInfoText?: string;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
interface Item {
|
|
343
|
-
[key: string]: any;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
const props = defineProps({
|
|
347
|
-
items: { type: Array as PropType<Item[]>, default: () => [], required: true },
|
|
348
|
-
headers: {
|
|
349
|
-
type: Array as PropType<Header[]>,
|
|
350
|
-
default: () => [],
|
|
351
|
-
required: true,
|
|
352
|
-
},
|
|
353
|
-
stickyFooter: { type: Boolean, default: true },
|
|
354
|
-
paginated: { type: Boolean, default: false },
|
|
355
|
-
tableExpanded: { type: Boolean, default: false },
|
|
356
|
-
search: { type: String, default: "" },
|
|
357
|
-
perPage: { type: Number, default: 5 },
|
|
358
|
-
total: { type: Number, default: 0 },
|
|
359
|
-
currentPage: { type: Number, default: 1 },
|
|
360
|
-
defaultSort: { type: String, default: "" },
|
|
361
|
-
defaultSortDirection: { type: String, default: "asc" },
|
|
362
|
-
headerOptional: { type: Boolean, default: false },
|
|
363
|
-
checkedRows: { type: Array as PropType<Item[]>, default: () => [] },
|
|
364
|
-
checkable: { type: Boolean, default: false },
|
|
365
|
-
isRowCheckable: {
|
|
366
|
-
type: Function as PropType<(row: Item) => boolean>,
|
|
367
|
-
default: () => true,
|
|
368
|
-
},
|
|
369
|
-
stickyColumn: { type: Boolean, default: true },
|
|
370
|
-
tableHeight: {
|
|
371
|
-
type: String,
|
|
372
|
-
required: false,
|
|
373
|
-
default: "",
|
|
374
|
-
},
|
|
375
|
-
tableLoading: { type: Boolean, default: false },
|
|
376
|
-
backendPagination: Boolean,
|
|
377
|
-
activeRowIndex: { type: Number, default: null },
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
const {
|
|
381
|
-
defaultSort,
|
|
382
|
-
defaultSortDirection,
|
|
383
|
-
checkedRows,
|
|
384
|
-
currentPage,
|
|
385
|
-
items,
|
|
386
|
-
backendPagination,
|
|
387
|
-
total,
|
|
388
|
-
search,
|
|
389
|
-
headers,
|
|
390
|
-
paginated,
|
|
391
|
-
isRowCheckable,
|
|
392
|
-
activeRowIndex,
|
|
393
|
-
} = toRefs(props);
|
|
394
|
-
|
|
395
|
-
// Emits used
|
|
396
|
-
const emit = defineEmits([
|
|
397
|
-
"update:currentPage",
|
|
398
|
-
"changePage",
|
|
399
|
-
"sort",
|
|
400
|
-
"check",
|
|
401
|
-
"check-all",
|
|
402
|
-
"update:checkedRows",
|
|
403
|
-
"update:selectedRows",
|
|
404
|
-
"changeLimit",
|
|
405
|
-
"mouseenter",
|
|
406
|
-
"mouseleave",
|
|
407
|
-
]);
|
|
408
|
-
|
|
409
|
-
const currentSort = ref(defaultSort.value);
|
|
410
|
-
const currentSortDir = ref(defaultSortDirection.value);
|
|
411
|
-
const newCheckedRows = ref([...checkedRows.value]);
|
|
412
|
-
const newCurrentPage = ref(currentPage.value);
|
|
413
|
-
const limit = ref(props.perPage);
|
|
414
|
-
const loading = computed(() => props.tableLoading);
|
|
415
|
-
|
|
416
|
-
// Computed Property
|
|
417
|
-
|
|
418
|
-
const filteredItems = computed(() => {
|
|
419
|
-
let filteredItems = items.value.slice();
|
|
420
|
-
if (!backendPagination.value && search.value !== "") {
|
|
421
|
-
if (search.value.trim() === "") return filteredItems;
|
|
422
|
-
const props = headers.value.map((h: any) => h.value);
|
|
423
|
-
filteredItems = items.value.filter((row) =>
|
|
424
|
-
props.some((prop) =>
|
|
425
|
-
defaultFilter(
|
|
426
|
-
getValueByPath(row, prop),
|
|
427
|
-
search.value.toString().toLowerCase()
|
|
428
|
-
)
|
|
429
|
-
)
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
return filteredItems;
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
const computedItems = computed(() => {
|
|
436
|
-
let items = filteredItems.value;
|
|
437
|
-
// Sort items before slicing for pagination
|
|
438
|
-
items.sort((a: any, b: any) => {
|
|
439
|
-
const modifier = currentSortDir.value === "desc" ? -1 : 1;
|
|
440
|
-
if (a[currentSort.value] < b[currentSort.value]) return -1 * modifier;
|
|
441
|
-
if (a[currentSort.value] > b[currentSort.value]) return 1 * modifier;
|
|
442
|
-
return 0;
|
|
443
|
-
});
|
|
444
|
-
return items;
|
|
445
|
-
|
|
446
|
-
// Apply pagination
|
|
447
|
-
// const start = (newCurrentPage.value - 0) * limit.value;
|
|
448
|
-
// const end = start + limit.value;
|
|
449
|
-
// return items.slice(start, end);
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
const headerStyle = (header: Header) => ({
|
|
453
|
-
minWidth: `${header.width || 300}px`,
|
|
454
|
-
maxWidth: `${header.width || 300}px`,
|
|
455
|
-
backgroundColor: header.color || "rgb(243 244 246)",
|
|
456
|
-
// flex: `${header.width || 300} 0 auto`,
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
const bodyStyle = (header: Header) => ({
|
|
460
|
-
width: `${header.width || 300}px`,
|
|
461
|
-
maxWidth: `${header.width || 300}px`,
|
|
462
|
-
// flex: `${header.width || 300} 0 auto`,
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
const searchData = (_data: any) => {
|
|
466
|
-
// console.log(_data);
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
const changeLimit = (limitData: number) => {
|
|
470
|
-
limit.value = limitData;
|
|
471
|
-
newCurrentPage.value = 0;
|
|
472
|
-
emit("update:currentPage", newCurrentPage.value);
|
|
473
|
-
emit("changeLimit", limitData);
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
const pageChanged = (page: number) => {
|
|
477
|
-
newCurrentPage.value = page > 0 ? page : 0;
|
|
478
|
-
emit("update:currentPage", newCurrentPage.value);
|
|
479
|
-
emit("changePage", page);
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
const sortBy = (header: any, event: any) => {
|
|
483
|
-
if (!header || !header.sortable) return;
|
|
484
|
-
if (header.value === currentSort.value) {
|
|
485
|
-
currentSortDir.value = currentSortDir.value === "asc" ? "desc" : "asc";
|
|
486
|
-
}
|
|
487
|
-
currentSort.value = header.value;
|
|
488
|
-
emit("sort", currentSort.value, currentSortDir.value, event);
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
const isAllChecked = computed(() => {
|
|
492
|
-
return (
|
|
493
|
-
computedItems.value.length > 0 &&
|
|
494
|
-
computedItems.value.every((row) => newCheckedRows.value.includes(row))
|
|
495
|
-
);
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
const isAllUncheckable = computed(() => {
|
|
499
|
-
const validVisibleData = computedItems.value?.filter((row) =>
|
|
500
|
-
isRowCheckable.value!(row)
|
|
501
|
-
);
|
|
502
|
-
return validVisibleData.length === 0;
|
|
503
|
-
});
|
|
504
|
-
|
|
505
|
-
const isIndeterminate = computed(() => {
|
|
506
|
-
const validVisibleData = computedItems.value.filter((row) =>
|
|
507
|
-
isRowCheckable.value(row)
|
|
508
|
-
);
|
|
509
|
-
return (
|
|
510
|
-
newCheckedRows.value.length > 0 &&
|
|
511
|
-
newCheckedRows.value.length < validVisibleData.length
|
|
512
|
-
);
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
const isRowChecked = (row: any) => {
|
|
516
|
-
return indexOf(newCheckedRows.value, row) >= 0;
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
const removeCheckedRow = (row: any) => {
|
|
520
|
-
const index = indexOf(newCheckedRows.value, row);
|
|
521
|
-
if (index >= 0) {
|
|
522
|
-
newCheckedRows.value.splice(index, 1);
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
const checkAll = () => {
|
|
527
|
-
if (isAllChecked.value) {
|
|
528
|
-
// Uncheck all rows
|
|
529
|
-
newCheckedRows.value = [];
|
|
530
|
-
} else {
|
|
531
|
-
// Check all rows
|
|
532
|
-
const rowsToCheck = computedItems.value.filter(
|
|
533
|
-
(row) => !newCheckedRows.value.includes(row)
|
|
534
|
-
);
|
|
535
|
-
newCheckedRows.value.push(...rowsToCheck);
|
|
536
|
-
}
|
|
537
|
-
emit("check", newCheckedRows.value);
|
|
538
|
-
emit("check-all", newCheckedRows.value);
|
|
539
|
-
emit("update:checkedRows", newCheckedRows.value);
|
|
540
|
-
emit("update:selectedRows", newCheckedRows.value);
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
const checkRow = (row: any, _rowIndex: number, _event: any) => {
|
|
544
|
-
const isChecked = newCheckedRows.value.includes(row);
|
|
545
|
-
if (_event && isChecked) {
|
|
546
|
-
removeCheckedRow(row);
|
|
547
|
-
} else {
|
|
548
|
-
newCheckedRows.value.push(row);
|
|
549
|
-
}
|
|
550
|
-
emit("check", newCheckedRows.value, row);
|
|
551
|
-
emit("update:checkedRows", newCheckedRows.value);
|
|
552
|
-
emit("update:selectedRows", newCheckedRows.value);
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
// watch
|
|
556
|
-
watch(
|
|
557
|
-
() => currentPage.value,
|
|
558
|
-
(newVal) => {
|
|
559
|
-
newCurrentPage.value = newVal;
|
|
560
|
-
},
|
|
561
|
-
{ immediate: true }
|
|
562
|
-
);
|
|
563
|
-
watch(
|
|
564
|
-
() => checkedRows.value,
|
|
565
|
-
(rows) => {
|
|
566
|
-
newCheckedRows.value = [...rows];
|
|
567
|
-
},
|
|
568
|
-
{ immediate: true }
|
|
569
|
-
);
|
|
570
|
-
|
|
571
|
-
const stickyClass = computed(() => {
|
|
572
|
-
return props.checkable && props.stickyColumn
|
|
573
|
-
? {
|
|
574
|
-
head: "bg-gray-100 sticky left-[45px] top-0 z-20",
|
|
575
|
-
body: "bg-white !sticky left-[45px] top-0 z-10 !overflow-visible after:absolute after:content-[''] after:bg-inherit after:w-2 after:h-[103%] after:inset-y-0 after:-right-2 after:bg-gradient-to-r after:from-gray-200 after:from-0% after:via-gray-50 after:via-60% after:z-10",
|
|
576
|
-
}
|
|
577
|
-
: {
|
|
578
|
-
head: "bg-gray-100 sticky left-0 top-0 z-20",
|
|
579
|
-
body: "bg-white !sticky left-0 top-0 z-10 !overflow-visible after:absolute after:content-[''] after:bg-inherit after:w-2 after:h-[103%] after:inset-y-0 after:-right-2 after:bg-gradient-to-r after:from-gray-200 after:from-0% after:via-gray-50 after:via-60% after:z-0",
|
|
580
|
-
};
|
|
581
|
-
});
|
|
582
|
-
|
|
583
|
-
const isOverflowing = ref(false);
|
|
584
|
-
const isScrolled = ref(false);
|
|
585
|
-
const tableContainer = ref<HTMLElement | null>(null);
|
|
586
|
-
|
|
587
|
-
const handleScroll = () => {
|
|
588
|
-
const container = tableContainer.value;
|
|
589
|
-
if (container) {
|
|
590
|
-
isScrolled.value = container.scrollLeft > 0;
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
const checkOverflow = () => {
|
|
595
|
-
const container = tableContainer.value;
|
|
596
|
-
if (container) {
|
|
597
|
-
isOverflowing.value = container.scrollWidth > container.clientWidth;
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
onMounted(() => {
|
|
602
|
-
window.addEventListener("resize", checkOverflow);
|
|
603
|
-
});
|
|
604
|
-
|
|
605
|
-
onUnmounted(() => {
|
|
606
|
-
window.removeEventListener("resize", checkOverflow);
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
// Watch for changes in the container's width to check for overflow
|
|
610
|
-
watch(() => tableContainer.value?.clientWidth, checkOverflow);
|
|
611
|
-
</script>
|