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,575 +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="growth-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>
|
|
37
|
-
<thead class="sticky top-0 left-0 z-50 bg-violet-100">
|
|
38
|
-
<tr>
|
|
39
|
-
<th v-if="checkable" class="checkable !table-cell">
|
|
40
|
-
<EUITableCheckbox
|
|
41
|
-
:checked="isAllChecked"
|
|
42
|
-
:indeterminate="isIndeterminate"
|
|
43
|
-
:disabled="isAllUncheckable"
|
|
44
|
-
@change="checkAll()"
|
|
45
|
-
/>
|
|
46
|
-
</th>
|
|
47
|
-
<th
|
|
48
|
-
v-for="(header, headerIndex) in headers"
|
|
49
|
-
:key="`item-${headerIndex}`"
|
|
50
|
-
scope="col"
|
|
51
|
-
:class="[
|
|
52
|
-
'px-3 py-1.5 text-gray-600 snap-start snap-always',
|
|
53
|
-
isScrolled && headerIndex === 0 ? stickyClass.head : '',
|
|
54
|
-
{ 'cursor-pointer hover:text-gray-900': header?.sortable },
|
|
55
|
-
]"
|
|
56
|
-
:style="
|
|
57
|
-
header?.width
|
|
58
|
-
? `min-width:${header.width}px;max-width:${header.width}px;`
|
|
59
|
-
: ``
|
|
60
|
-
"
|
|
61
|
-
@click="sortBy(header, $event)"
|
|
62
|
-
>
|
|
63
|
-
<div
|
|
64
|
-
class="flex items-center gap-2 text-xs font-semibold text-current"
|
|
65
|
-
>
|
|
66
|
-
<slot name="header" :header="header" :index="headerIndex">
|
|
67
|
-
<template v-if="!header?.activeYear">{{
|
|
68
|
-
capitalizeText(header?.text ?? header.name ?? "")
|
|
69
|
-
}}</template>
|
|
70
|
-
<div
|
|
71
|
-
v-else
|
|
72
|
-
class="bg-violet-600 text-white rounded-[0.625rem] px-3 py-2 w-full"
|
|
73
|
-
>
|
|
74
|
-
<div class="mb-2">
|
|
75
|
-
{{
|
|
76
|
-
capitalizeText(header?.text ?? header.name ?? "")
|
|
77
|
-
}}
|
|
78
|
-
</div>
|
|
79
|
-
<div
|
|
80
|
-
class="flex items-center justify-start max-w-full gap-4"
|
|
81
|
-
>
|
|
82
|
-
<span
|
|
83
|
-
v-for="(data, idx) in header?.activeYear"
|
|
84
|
-
:key="`year_${idx}`"
|
|
85
|
-
class="min-w-9"
|
|
86
|
-
>{{ data }}</span
|
|
87
|
-
>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
</slot>
|
|
91
|
-
<slot name="headerOptionalItem"></slot>
|
|
92
|
-
<SortArrow
|
|
93
|
-
v-if="header?.sortable && !header?.activeYear"
|
|
94
|
-
:class="[
|
|
95
|
-
'transform duration-100 transition-all',
|
|
96
|
-
currentSort === header.value
|
|
97
|
-
? 'text-violet-700'
|
|
98
|
-
: 'text-gray-900',
|
|
99
|
-
sortClass(header),
|
|
100
|
-
]"
|
|
101
|
-
/>
|
|
102
|
-
</div>
|
|
103
|
-
</th>
|
|
104
|
-
</tr>
|
|
105
|
-
</thead>
|
|
106
|
-
<tbody>
|
|
107
|
-
<template
|
|
108
|
-
v-if="computedItems.length > 0"
|
|
109
|
-
v-for="(row, rowIndex) in computedItems"
|
|
110
|
-
:key="`table-row-${rowIndex}`"
|
|
111
|
-
>
|
|
112
|
-
<tr
|
|
113
|
-
@mouseenter="
|
|
114
|
-
$attrs.mouseenter
|
|
115
|
-
? $emit('mouseenter', row, rowIndex)
|
|
116
|
-
: null
|
|
117
|
-
"
|
|
118
|
-
@mouseleave="
|
|
119
|
-
$attrs.mouseleave
|
|
120
|
-
? $emit('mouseleave', row, rowIndex)
|
|
121
|
-
: null
|
|
122
|
-
"
|
|
123
|
-
>
|
|
124
|
-
<template v-if="checkable">
|
|
125
|
-
<td class="checkable">
|
|
126
|
-
<EUITableCheckbox
|
|
127
|
-
:disabled="!isRowCheckable(row)"
|
|
128
|
-
:checked="isRowChecked(row)"
|
|
129
|
-
@change="($event:boolean) => checkRow(row, rowIndex, $event)"
|
|
130
|
-
/>
|
|
131
|
-
</td>
|
|
132
|
-
</template>
|
|
133
|
-
<td
|
|
134
|
-
v-for="(header, headerIndex) in headers"
|
|
135
|
-
:key="headerIndex"
|
|
136
|
-
:class="[
|
|
137
|
-
isScrolled && headerIndex === 0 ? stickyClass.body : '',
|
|
138
|
-
]"
|
|
139
|
-
>
|
|
140
|
-
<slot
|
|
141
|
-
:name="`item.${header.value}`"
|
|
142
|
-
:row="row"
|
|
143
|
-
:rowIndex="rowIndex"
|
|
144
|
-
>
|
|
145
|
-
{{ getValueByPath(row, header?.value) }}
|
|
146
|
-
</slot>
|
|
147
|
-
</td>
|
|
148
|
-
</tr>
|
|
149
|
-
<template v-if="tableExpanded">
|
|
150
|
-
<slot name="expanded" :row="row" :rowIndex="rowIndex"></slot>
|
|
151
|
-
</template>
|
|
152
|
-
</template>
|
|
153
|
-
<template v-else-if="computedItems.length === 0">
|
|
154
|
-
<tr class="norecords">
|
|
155
|
-
<td
|
|
156
|
-
:colspan="
|
|
157
|
-
checkable === true ? headers.length + 1 : headers.length
|
|
158
|
-
"
|
|
159
|
-
>
|
|
160
|
-
<slot name="no-records">
|
|
161
|
-
<div
|
|
162
|
-
class="flex items-center justify-center text-xl font-medium text-gray-500 h-[calc(100svh-18rem)] max-w-screen-xl"
|
|
163
|
-
>
|
|
164
|
-
No matching records found
|
|
165
|
-
</div>
|
|
166
|
-
</slot>
|
|
167
|
-
</td>
|
|
168
|
-
</tr>
|
|
169
|
-
</template>
|
|
170
|
-
</tbody>
|
|
171
|
-
<tfoot
|
|
172
|
-
v-if="footers.length"
|
|
173
|
-
class="sticky bottom-0 left-0 z-50 bg-[#FEF3C7]"
|
|
174
|
-
>
|
|
175
|
-
<template
|
|
176
|
-
v-if="footers.length > 0"
|
|
177
|
-
v-for="(row, rowIndex) in footers"
|
|
178
|
-
:key="`table-row-${rowIndex}`"
|
|
179
|
-
>
|
|
180
|
-
<tr>
|
|
181
|
-
<th v-if="checkable" class="empty"></th>
|
|
182
|
-
<th
|
|
183
|
-
v-for="(header, headerIndex) in headers"
|
|
184
|
-
:key="headerIndex"
|
|
185
|
-
:class="[
|
|
186
|
-
'px-3 py-1.5 text-gray-900 snap-start snap-always h-14',
|
|
187
|
-
isScrolled && headerIndex === 0 ? stickyClass.foot : '',
|
|
188
|
-
]"
|
|
189
|
-
>
|
|
190
|
-
<slot
|
|
191
|
-
:name="`footer.${header.value}`"
|
|
192
|
-
:row="row"
|
|
193
|
-
:rowIndex="rowIndex"
|
|
194
|
-
>
|
|
195
|
-
{{ getValueByPath(row, header?.value) }}
|
|
196
|
-
</slot>
|
|
197
|
-
</th>
|
|
198
|
-
</tr>
|
|
199
|
-
</template>
|
|
200
|
-
</tfoot>
|
|
201
|
-
</table>
|
|
202
|
-
</div>
|
|
203
|
-
<div
|
|
204
|
-
v-if="paginated && computedItems.length !== 0"
|
|
205
|
-
class="sticky bottom-0 left-0 z-50 flex items-center justify-between px-2 py-2 bg-gray-100"
|
|
206
|
-
>
|
|
207
|
-
<slot name="tableCount">
|
|
208
|
-
<div class="inline-flex items-center gap-x-10">
|
|
209
|
-
<div class="text-sm font-normal text-gray-900">
|
|
210
|
-
1-{{ limit }} of {{ total }}
|
|
211
|
-
</div>
|
|
212
|
-
<div class="inline-flex items-center gap-2">
|
|
213
|
-
<span class="text-sm font-normal text-gray-900"
|
|
214
|
-
>Result per page</span
|
|
215
|
-
>
|
|
216
|
-
<EUIPageLimit
|
|
217
|
-
:page-limit="limit"
|
|
218
|
-
@update-limit="changeLimit($event)"
|
|
219
|
-
@refetch="searchData($event)"
|
|
220
|
-
/>
|
|
221
|
-
</div>
|
|
222
|
-
</div>
|
|
223
|
-
</slot>
|
|
224
|
-
<template v-if="paginated && computedItems.length !== 0">
|
|
225
|
-
<slot name="tablepagination">
|
|
226
|
-
<EUIPagination
|
|
227
|
-
:activePage="newCurrentPage"
|
|
228
|
-
:pageLimit="limit"
|
|
229
|
-
:totalCount="total"
|
|
230
|
-
@change-page="pageChanged($event)"
|
|
231
|
-
/>
|
|
232
|
-
</slot>
|
|
233
|
-
</template>
|
|
234
|
-
</div>
|
|
235
|
-
</div>
|
|
236
|
-
</Transition>
|
|
237
|
-
</div>
|
|
238
|
-
</template>
|
|
239
|
-
|
|
240
|
-
<script setup lang="ts">
|
|
241
|
-
import {
|
|
242
|
-
computed,
|
|
243
|
-
onMounted,
|
|
244
|
-
onUnmounted,
|
|
245
|
-
PropType,
|
|
246
|
-
ref,
|
|
247
|
-
toRefs,
|
|
248
|
-
watch,
|
|
249
|
-
} from "vue";
|
|
250
|
-
import EUIPagination from "./EUIPagination.vue";
|
|
251
|
-
import EUITableCheckbox from "./EUITableCheckbox.vue";
|
|
252
|
-
import SortArrow from "../../assets/svg/SortArrow.vue";
|
|
253
|
-
import EUIPageLimit from "./EUIPageLimit.vue";
|
|
254
|
-
import { capitalizeText } from "../../utils/lodash";
|
|
255
|
-
import EUICircleLoader from "../loader/EUICircleLoader.vue";
|
|
256
|
-
import { indexOf, getValueByPath, defaultFilter } from "../../utils/helpers";
|
|
257
|
-
|
|
258
|
-
interface Header {
|
|
259
|
-
value: string;
|
|
260
|
-
text?: string;
|
|
261
|
-
name?: string;
|
|
262
|
-
width?: number;
|
|
263
|
-
sortable?: boolean;
|
|
264
|
-
activeYear?: string[];
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const props = defineProps({
|
|
268
|
-
checkable: {
|
|
269
|
-
type: Boolean,
|
|
270
|
-
default: false,
|
|
271
|
-
},
|
|
272
|
-
stickyColumn: { type: Boolean, default: true },
|
|
273
|
-
paginated: { type: Boolean, default: false },
|
|
274
|
-
tableExpanded: { type: Boolean, default: false },
|
|
275
|
-
backendPagination: { type: Boolean, default: false },
|
|
276
|
-
checkedRows: { type: Array, default: () => ({}), required: true },
|
|
277
|
-
headers: {
|
|
278
|
-
type: Array as PropType<Header[]>,
|
|
279
|
-
default: () => ({}),
|
|
280
|
-
required: true,
|
|
281
|
-
},
|
|
282
|
-
items: { type: Array, required: true, default: () => ({}) },
|
|
283
|
-
footers: { type: Array, default: () => ({}) },
|
|
284
|
-
defaultSort: { type: String, default: "" },
|
|
285
|
-
defaultSortDirection: { type: String, default: "asc" },
|
|
286
|
-
search: { type: String, default: "" },
|
|
287
|
-
perPage: { type: Number, default: 5 },
|
|
288
|
-
currentPage: { type: Number, default: 0 },
|
|
289
|
-
total: { type: Number, default: 0 },
|
|
290
|
-
customIsChecked: {
|
|
291
|
-
type: Function as PropType<(item: any, obj: any) => boolean>,
|
|
292
|
-
default: () => () => false,
|
|
293
|
-
},
|
|
294
|
-
isRowCheckable: { type: Function, default: () => true },
|
|
295
|
-
tableHeight: {
|
|
296
|
-
type: String,
|
|
297
|
-
required: false,
|
|
298
|
-
default: "",
|
|
299
|
-
},
|
|
300
|
-
tableLoading: { type: Boolean, default: false },
|
|
301
|
-
});
|
|
302
|
-
const {
|
|
303
|
-
defaultSort,
|
|
304
|
-
defaultSortDirection,
|
|
305
|
-
checkedRows,
|
|
306
|
-
currentPage,
|
|
307
|
-
items,
|
|
308
|
-
backendPagination,
|
|
309
|
-
total,
|
|
310
|
-
search,
|
|
311
|
-
headers,
|
|
312
|
-
paginated,
|
|
313
|
-
isRowCheckable,
|
|
314
|
-
} = toRefs(props);
|
|
315
|
-
|
|
316
|
-
const currentSort = ref(defaultSort.value);
|
|
317
|
-
const currentSortDir = ref(defaultSortDirection.value);
|
|
318
|
-
const newCheckedRows = ref([...checkedRows.value]);
|
|
319
|
-
const newCurrentPage = ref(currentPage.value);
|
|
320
|
-
const limit = ref(props.perPage);
|
|
321
|
-
const loading = computed(() => props.tableLoading);
|
|
322
|
-
|
|
323
|
-
// Computed Property
|
|
324
|
-
const filteredItems = computed(() => {
|
|
325
|
-
let filteredItems = items.value.slice();
|
|
326
|
-
if (!backendPagination.value && search.value !== "") {
|
|
327
|
-
if (search.value.trim() === "") return filteredItems;
|
|
328
|
-
const props = headers.value.map((h) => h.value);
|
|
329
|
-
filteredItems = items.value.filter((item) =>
|
|
330
|
-
props.some((prop) =>
|
|
331
|
-
defaultFilter(
|
|
332
|
-
getValueByPath(item, prop),
|
|
333
|
-
search.value.toString().toLowerCase()
|
|
334
|
-
)
|
|
335
|
-
)
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
return filteredItems;
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
const computedItems = computed(() => {
|
|
342
|
-
let items = filteredItems.value;
|
|
343
|
-
// Sort items before slicing for pagination
|
|
344
|
-
items.sort((a: any, b: any) => {
|
|
345
|
-
const modifier = currentSortDir.value === "desc" ? -1 : 1;
|
|
346
|
-
if (a[currentSort.value] < b[currentSort.value]) return -1 * modifier;
|
|
347
|
-
if (a[currentSort.value] > b[currentSort.value]) return 1 * modifier;
|
|
348
|
-
return 0;
|
|
349
|
-
});
|
|
350
|
-
return items;
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
const searchData = (_data: any) => {
|
|
354
|
-
// console.log(_data);
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
const sortClass = computed(() => (header: any) => {
|
|
358
|
-
return currentSortDir.value === "asc" && currentSort.value === header.value
|
|
359
|
-
? "rotate-0"
|
|
360
|
-
: currentSortDir.value === "desc" && currentSort.value === header.value
|
|
361
|
-
? "rotate-180"
|
|
362
|
-
: "";
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
const isIndeterminate = computed(() => {
|
|
366
|
-
const validVisibleData = computedItems.value.filter((row) =>
|
|
367
|
-
isRowCheckable.value(row)
|
|
368
|
-
);
|
|
369
|
-
return (
|
|
370
|
-
newCheckedRows.value.length > 0 &&
|
|
371
|
-
newCheckedRows.value.length < validVisibleData.length
|
|
372
|
-
);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
const isAllChecked = computed(() => {
|
|
376
|
-
return (
|
|
377
|
-
computedItems.value.length > 0 &&
|
|
378
|
-
computedItems.value.every((row) => newCheckedRows.value.includes(row))
|
|
379
|
-
);
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
const isAllUncheckable = computed(() => {
|
|
383
|
-
const validVisibleData = computedItems.value?.filter((row) =>
|
|
384
|
-
isRowCheckable.value!(row)
|
|
385
|
-
);
|
|
386
|
-
return validVisibleData.length === 0;
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
const emit = defineEmits([
|
|
390
|
-
"update:currentPage",
|
|
391
|
-
"changePage",
|
|
392
|
-
"sort",
|
|
393
|
-
"check",
|
|
394
|
-
"check-all",
|
|
395
|
-
"update:checkedRows",
|
|
396
|
-
"update:selectedRows",
|
|
397
|
-
"changeLimit",
|
|
398
|
-
"mouseenter",
|
|
399
|
-
"mouseleave",
|
|
400
|
-
]);
|
|
401
|
-
|
|
402
|
-
const changeLimit = (limitData: number) => {
|
|
403
|
-
limit.value = limitData;
|
|
404
|
-
newCurrentPage.value = 0;
|
|
405
|
-
emit("update:currentPage", newCurrentPage.value);
|
|
406
|
-
emit("changeLimit", limitData);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
const pageChanged = (page: number) => {
|
|
410
|
-
newCurrentPage.value = page > 0 ? page : 0;
|
|
411
|
-
emit("update:currentPage", newCurrentPage.value);
|
|
412
|
-
emit("changePage", page);
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
const sortBy = (header: any, event: any) => {
|
|
416
|
-
if (!header || !header.sortable) return;
|
|
417
|
-
if (header.value === currentSort.value) {
|
|
418
|
-
currentSortDir.value = currentSortDir.value === "asc" ? "desc" : "asc";
|
|
419
|
-
}
|
|
420
|
-
currentSort.value = header.value;
|
|
421
|
-
emit("sort", currentSort.value, currentSortDir.value, event);
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
const isRowChecked = (row: any) => {
|
|
425
|
-
return indexOf(newCheckedRows.value, row) >= 0;
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
const removeCheckedRow = (row: any) => {
|
|
429
|
-
const index = indexOf(newCheckedRows.value, row);
|
|
430
|
-
if (index >= 0) {
|
|
431
|
-
newCheckedRows.value.splice(index, 1);
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
const checkAll = () => {
|
|
436
|
-
if (isAllChecked.value) {
|
|
437
|
-
// Uncheck all rows
|
|
438
|
-
newCheckedRows.value = [];
|
|
439
|
-
} else {
|
|
440
|
-
// Check all rows
|
|
441
|
-
const rowsToCheck = computedItems.value.filter(
|
|
442
|
-
(row) => !newCheckedRows.value.includes(row)
|
|
443
|
-
);
|
|
444
|
-
newCheckedRows.value.push(...rowsToCheck);
|
|
445
|
-
}
|
|
446
|
-
emit("check", newCheckedRows.value);
|
|
447
|
-
emit("check-all", newCheckedRows.value);
|
|
448
|
-
emit("update:checkedRows", newCheckedRows.value);
|
|
449
|
-
emit("update:selectedRows", newCheckedRows.value);
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
const checkRow = (row: any, _rowIndex: number, _event: any) => {
|
|
453
|
-
const isChecked = newCheckedRows.value.includes(row);
|
|
454
|
-
if (_event && isChecked) {
|
|
455
|
-
removeCheckedRow(row);
|
|
456
|
-
} else {
|
|
457
|
-
newCheckedRows.value.push(row);
|
|
458
|
-
}
|
|
459
|
-
emit("check", newCheckedRows.value, row);
|
|
460
|
-
emit("update:checkedRows", newCheckedRows.value);
|
|
461
|
-
emit("update:selectedRows", newCheckedRows.value);
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
// watch
|
|
465
|
-
watch(
|
|
466
|
-
() => currentPage.value,
|
|
467
|
-
(newVal) => {
|
|
468
|
-
newCurrentPage.value = newVal;
|
|
469
|
-
},
|
|
470
|
-
{ immediate: true }
|
|
471
|
-
);
|
|
472
|
-
|
|
473
|
-
watch(
|
|
474
|
-
() => checkedRows.value,
|
|
475
|
-
(rows) => {
|
|
476
|
-
newCheckedRows.value = [...rows];
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
immediate: true,
|
|
480
|
-
}
|
|
481
|
-
);
|
|
482
|
-
|
|
483
|
-
// table scroll to add class
|
|
484
|
-
const stickyClass = computed(() => {
|
|
485
|
-
return props.checkable && props.stickyColumn
|
|
486
|
-
? {
|
|
487
|
-
head: "bg-violet-100 sticky left-[4.5rem] top-0 z-20",
|
|
488
|
-
foot: "bg-[#FEF3C7] sticky left-[4.5rem] top-0 z-20",
|
|
489
|
-
body: "bg-white sticky left-[4.5rem] top-0 z-10",
|
|
490
|
-
}
|
|
491
|
-
: {
|
|
492
|
-
head: "bg-violet-100 sticky left-0 top-0 z-20",
|
|
493
|
-
foot: "bg-[#FEF3C7] sticky left-0 top-0 z-20",
|
|
494
|
-
body: "bg-white sticky left-0 top-0 z-10",
|
|
495
|
-
};
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
const isOverflowing = ref(false);
|
|
499
|
-
const isScrolled = ref(false);
|
|
500
|
-
const tableContainer = ref<HTMLElement | null>(null);
|
|
501
|
-
|
|
502
|
-
const handleScroll = () => {
|
|
503
|
-
const container = tableContainer.value;
|
|
504
|
-
if (container) {
|
|
505
|
-
isScrolled.value = container.scrollLeft > 0;
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
const checkOverflow = () => {
|
|
510
|
-
const container = tableContainer.value;
|
|
511
|
-
if (container) {
|
|
512
|
-
isOverflowing.value = container.scrollWidth > container.clientWidth;
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
onMounted(() => {
|
|
517
|
-
window.addEventListener("resize", checkOverflow);
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
onUnmounted(() => {
|
|
521
|
-
window.removeEventListener("resize", checkOverflow);
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
// Watch for changes in the container's width to check for overflow
|
|
525
|
-
watch(() => tableContainer.value?.clientWidth, checkOverflow);
|
|
526
|
-
</script>
|
|
527
|
-
|
|
528
|
-
<style lang="scss" scoped>
|
|
529
|
-
#growth-table {
|
|
530
|
-
& table {
|
|
531
|
-
// border-spacing: 0 0.5rem;
|
|
532
|
-
@apply min-w-full text-sm font-light text-left table table-auto w-full -mt-2 box-border border-separate border-spacing-y-2 relative;
|
|
533
|
-
thead tr {
|
|
534
|
-
@apply snap-x snap-mandatory;
|
|
535
|
-
th {
|
|
536
|
-
@apply snap-always snap-start last-of-type:rounded-r-xl first-of-type:rounded-l-xl;
|
|
537
|
-
&:first-of-type.checkable {
|
|
538
|
-
min-height: 45px;
|
|
539
|
-
@apply flex items-center justify-center px-4 max-w-[4.5rem] w-[4.5rem] sticky left-0 top-0 z-20 bg-violet-100;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
tbody {
|
|
544
|
-
@apply snap-y snap-mandatory snap-always;
|
|
545
|
-
tr:not(.norecords) {
|
|
546
|
-
@apply text-gray-500 transition-all duration-150 rounded-xl bg-white snap-start ease-in-out snap-x snap-mandatory;
|
|
547
|
-
&:hover {
|
|
548
|
-
@apply shadow-[1px_2px_40px_0px_#03022912] ring-1 ring-gray-100 ring-inset z-30;
|
|
549
|
-
}
|
|
550
|
-
td {
|
|
551
|
-
@apply px-3 py-1.5 text-sm font-normal last-of-type:rounded-r-xl first-of-type:rounded-l-xl transition-transform duration-100 ease-in-out border-solid border border-l-0 border-r-0 border-white first:border-s last:border-e h-14;
|
|
552
|
-
&:first-of-type.checkable {
|
|
553
|
-
@apply w-14 text-center sticky left-0 top-0 z-[11] bg-white;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
&:hover td {
|
|
557
|
-
@apply font-medium text-gray-900 bg-white border-gray-100;
|
|
558
|
-
&:first-of-type.checkable {
|
|
559
|
-
@apply bg-white;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
tfoot tr {
|
|
565
|
-
@apply snap-x snap-mandatory;
|
|
566
|
-
th {
|
|
567
|
-
@apply snap-always snap-start last-of-type:rounded-r-xl first-of-type:rounded-l-xl font-semibold;
|
|
568
|
-
&:first-of-type.empty {
|
|
569
|
-
@apply table-cell min-h-10 px-2 max-w-[45px] w-[45px] sticky left-0 top-0 z-20 bg-[#FEF3C7];
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
</style>
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
<!-- <template>
|
|
2
|
-
<div class="max-w-screen-xl mx-auto">
|
|
3
|
-
<pre class="text-[0.5rem] p-2 border border-gray-300 rounded-lg max-h-72 overflow-y-auto">{{ selectedRows?.map(x => x?._id)}}</pre>
|
|
4
|
-
<GrowthTable
|
|
5
|
-
checkable
|
|
6
|
-
paginated
|
|
7
|
-
:checked-rows.sync="checkedRows"
|
|
8
|
-
backend-pagination
|
|
9
|
-
:per-page="limit"
|
|
10
|
-
:headers="growthTableHeaders"
|
|
11
|
-
:items="growthTableData"
|
|
12
|
-
:footers="growthTableFooter"
|
|
13
|
-
:total="totalCount"
|
|
14
|
-
:default-sort-direction="defaultSortOrder"
|
|
15
|
-
default-sort="introducer_details"
|
|
16
|
-
:current-page="offset"
|
|
17
|
-
@sort="onSort"
|
|
18
|
-
@mouseenter="select"
|
|
19
|
-
@mouseleave="(selectedIndex = null), (selected = null)"
|
|
20
|
-
>
|
|
21
|
-
|
|
22
|
-
<template #[`item.active_allagents`]="{ row, rowIndex }">
|
|
23
|
-
<div class=" bg-violet-100 px-3 rounded-[0.625rem] w-full py-2 h-full flex items-center gap-4 justify-start">
|
|
24
|
-
<span v-for="(data, idx) in row?.active_allagents" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
<template #[`item.active_active_allagents`]="{ row, rowIndex }">
|
|
28
|
-
<div class="flex flex-row items-start gap-4 justify-between bg-violet-50 px-3 rounded-[0.625rem] py-2 h-full">
|
|
29
|
-
<span v-for="(data, idx) in row?.active_active_allagents" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
32
|
-
<template #[`item.active_dormant`]="{ row, rowIndex }">
|
|
33
|
-
<div class="flex flex-row items-start gap-4 justify-between bg-violet-50 px-3 rounded-[0.625rem] py-2 h-full">
|
|
34
|
-
<span v-for="(data, idx) in row?.active_dormant" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
<template #[`item.totalDepositCount`]="{ row, rowIndex }">
|
|
38
|
-
<div class="flex flex-row items-start gap-4 justify-between bg-violet-50 px-3 rounded-[0.625rem] py-2 h-full">
|
|
39
|
-
<span v-for="(data, idx) in row?.totalDepositCount" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
<template #[`item.totalStudentCount`]="{ row, rowIndex }">
|
|
43
|
-
<div class="flex flex-row items-start gap-4 justify-between bg-violet-50 px-3 rounded-[0.625rem] py-2 h-full">
|
|
44
|
-
<span v-for="(data, idx) in row?.totalStudentCount" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
45
|
-
</div>
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<template #[`footer.active_allagents`]="{ row, rowIndex }">
|
|
49
|
-
<div class="flex items-center max-w-full gap-4 justify-start bg-[#FCD34D] px-3 rounded-[0.625rem] py-2 h-full">
|
|
50
|
-
<span v-for="(data, idx) in row?.active_allagents" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
<template #[`footer.active_active_allagents`]="{ row, rowIndex }">
|
|
54
|
-
<div class="flex items-center max-w-full gap-4 justify-start bg-[#FCD34D] px-3 rounded-[0.625rem] py-2 h-full">
|
|
55
|
-
<span v-for="(data, idx) in row?.active_active_allagents" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
56
|
-
</div>
|
|
57
|
-
</template>
|
|
58
|
-
<template #[`footer.active_dormant`]="{ row, rowIndex }">
|
|
59
|
-
<div class="flex items-center max-w-full gap-4 justify-start bg-[#FCD34D] px-3 rounded-[0.625rem] py-2 h-full">
|
|
60
|
-
<span v-for="(data, idx) in row?.active_dormant" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
61
|
-
</div>
|
|
62
|
-
</template>
|
|
63
|
-
<template #[`footer.totalDepositCount`]="{ row, rowIndex }">
|
|
64
|
-
<div class="flex items-center max-w-full gap-4 justify-start bg-[#FCD34D] px-3 rounded-[0.625rem] py-2 h-full">
|
|
65
|
-
<span v-for="(data, idx) in row?.totalDepositCount" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
66
|
-
</div>
|
|
67
|
-
</template>
|
|
68
|
-
<template #[`footer.totalStudentCount`]="{ row, rowIndex }">
|
|
69
|
-
<div class="flex items-center max-w-full gap-4 justify-start bg-[#FCD34D] px-3 rounded-[0.625rem] py-2 h-full">
|
|
70
|
-
<span v-for="(data, idx) in row?.totalStudentCount" :key="`year_${idx}`" class="min-w-8">{{ data.value || '-' }}</span>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
</GrowthTable>
|
|
74
|
-
</div>
|
|
75
|
-
</template>
|
|
76
|
-
|
|
77
|
-
<script setup lang="ts">
|
|
78
|
-
import { computed, ref } from "vue";
|
|
79
|
-
import { growthTableData, growthTableFooter, growthTableHeaders } from "../../data/table";
|
|
80
|
-
import GrowthTable from "./GrowthTable.vue";
|
|
81
|
-
|
|
82
|
-
//TODO: Dashboard Table
|
|
83
|
-
const checkedRows = ref([]);
|
|
84
|
-
const defaultSortOrder = ref("asc");
|
|
85
|
-
const limit = ref(5);
|
|
86
|
-
const offset = ref(1);
|
|
87
|
-
const selectedIndex = ref<{ index: string } | null>(null);
|
|
88
|
-
const selected = ref<{ index: string } | null>(null);
|
|
89
|
-
|
|
90
|
-
const select = (_item: any, index: any) => {
|
|
91
|
-
selectedIndex.value = index;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const onSort = (field: string, order: string) => {
|
|
95
|
-
const modifier = order === "desc" ? -1 : 1;
|
|
96
|
-
growthTableData.sort((a: any, b: any) => {
|
|
97
|
-
if (a[field] < b[field]) return -1 * modifier;
|
|
98
|
-
if (a[field] > b[field]) return 1 * modifier;
|
|
99
|
-
return 0;
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const totalCount = computed(() => {
|
|
104
|
-
return growthTableData.length;
|
|
105
|
-
});
|
|
106
|
-
</script>
|
|
107
|
-
|
|
108
|
-
<style scoped></style> -->
|