edvoyui-component-library-test-flight 0.0.26 → 0.0.28
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 +20 -20
- package/dist/library-vue-ts.es.js +4984 -4965
- package/dist/library-vue-ts.umd.js +21 -21
- package/dist/table/EUIDashboardTable.vue.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/datepicker/EUIDatepicker.vue +10 -8
- package/src/components/table/EUIDashboardTable.vue +72 -38
- package/src/components/table/EUITable.vue +20 -5
|
@@ -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=448c7bbf&lang.scss";
|
|
3
3
|
declare const _default: any;
|
|
4
4
|
export default _default;
|
|
5
5
|
//# sourceMappingURL=EUIDashboardTable.vue.d.ts.map
|
package/package.json
CHANGED
|
@@ -126,15 +126,17 @@ const props = defineProps({
|
|
|
126
126
|
});
|
|
127
127
|
const emit = defineEmits(["update:modelValue"]);
|
|
128
128
|
const { modelValue, isUtc, clearIcon } = toRefs(props);
|
|
129
|
-
const startDate = ref(new Date());
|
|
130
|
-
const endDate = ref(new Date(new Date().setDate(startDate.value.getDate() + 7)));
|
|
129
|
+
// const startDate = ref(new Date());
|
|
130
|
+
// const endDate = ref(new Date(new Date().setDate(startDate.value.getDate() + 7)));
|
|
131
131
|
|
|
132
|
-
const time = ref({
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
132
|
+
// const time = ref({
|
|
133
|
+
// hours: new Date().getHours(),
|
|
134
|
+
// minutes: new Date().getMinutes()
|
|
135
|
+
// });
|
|
136
|
+
|
|
137
|
+
// const datepicker = ref( props.modelValue ? props.modelValue : props.timePicker ? time.value : props.range ? [startDate.value, endDate.value] : startDate.value);
|
|
136
138
|
|
|
137
|
-
const datepicker = ref(
|
|
139
|
+
const datepicker = ref(props.modelValue)
|
|
138
140
|
|
|
139
141
|
watch(
|
|
140
142
|
datepicker,
|
|
@@ -171,7 +173,7 @@ const clearIconRight = computed(() => (props.iconType === 'endIcon' ? '40px' : '
|
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
.eui-datepicker {
|
|
174
|
-
|
|
176
|
+
@apply min-w-56;
|
|
175
177
|
.dp__main {
|
|
176
178
|
.dp__input {
|
|
177
179
|
@apply pb-2 pt-6 border-0 transition-colors duration-100 ease-in-out text-sm font-medium leading-6 placeholder:text-gray-400 placeholder:font-normal;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="relative w-full mx-auto overflow-hidden">
|
|
4
4
|
<div
|
|
5
5
|
id="dashboard-table"
|
|
6
|
-
class="overflow-auto
|
|
6
|
+
:class="['overflow-auto scrollbar--thin overscroll-none', tableHeight ? tableHeight : 'h-[calc(100svh-13rem)] max-h-[calc(100svh-13rem)]']"
|
|
7
7
|
ref="tableContainer"
|
|
8
8
|
@scroll="handleScroll"
|
|
9
9
|
>
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
</th>
|
|
23
23
|
</template>
|
|
24
24
|
<th
|
|
25
|
-
|
|
25
|
+
v-for="(header, headerIndex) in headers"
|
|
26
26
|
:key="`item-${headerIndex}`"
|
|
27
27
|
scope="col"
|
|
28
28
|
:class="[
|
|
29
29
|
'px-3 py-2 text-gray-600 snap-start snap-always',
|
|
30
|
-
|
|
30
|
+
isScrolled && headerIndex === 0 ? stickyClass.head : '',
|
|
31
31
|
{ 'cursor-pointer hover:text-gray-900': header?.sortable },
|
|
32
32
|
]"
|
|
33
33
|
:style="
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
class="flex items-center gap-2 text-sm font-normal text-current"
|
|
42
42
|
>
|
|
43
43
|
<slot name="header" :header="header">
|
|
44
|
-
{{ capitalizeText(header?.text ?? header.name ??
|
|
44
|
+
{{ capitalizeText(header?.text ?? header.name ?? "") }}
|
|
45
45
|
</slot>
|
|
46
46
|
<slot name="headerOptionalItem"></slot>
|
|
47
47
|
<SortArrow
|
|
@@ -59,27 +59,47 @@
|
|
|
59
59
|
</tr>
|
|
60
60
|
</thead>
|
|
61
61
|
<tbody>
|
|
62
|
+
<template v-if="loading">
|
|
63
|
+
<tr class="norecords">
|
|
64
|
+
<td :colspan="headers.length">
|
|
65
|
+
<div
|
|
66
|
+
class="flex items-center justify-center min-h-96"
|
|
67
|
+
>
|
|
68
|
+
<EUICircleLoader />
|
|
69
|
+
</div>
|
|
70
|
+
</td>
|
|
71
|
+
</tr>
|
|
72
|
+
</template>
|
|
62
73
|
<template
|
|
74
|
+
v-else-if="computedItems.length > 0"
|
|
63
75
|
v-for="(row, rowIndex) in computedItems"
|
|
64
76
|
:key="`table-row-${rowIndex}`"
|
|
65
77
|
>
|
|
66
78
|
<tr
|
|
67
|
-
@mouseenter="
|
|
68
|
-
|
|
79
|
+
@mouseenter="
|
|
80
|
+
$attrs.mouseenter ? $emit('mouseenter', row, rowIndex) : null
|
|
81
|
+
"
|
|
82
|
+
@mouseleave="
|
|
83
|
+
$attrs.mouseleave ? $emit('mouseleave', row, rowIndex) : null
|
|
84
|
+
"
|
|
69
85
|
>
|
|
70
86
|
<template v-if="checkable">
|
|
71
87
|
<td class="checkable">
|
|
72
88
|
<EUITableCheckbox
|
|
73
89
|
:disabled="!isRowCheckable(row)"
|
|
74
90
|
:checked="isRowChecked(row)"
|
|
75
|
-
@change.prevent.stop="
|
|
91
|
+
@change.prevent.stop="
|
|
92
|
+
($event) => checkRow(row, rowIndex, $event)
|
|
93
|
+
"
|
|
76
94
|
/>
|
|
77
95
|
</td>
|
|
78
96
|
</template>
|
|
79
|
-
|
|
97
|
+
<td
|
|
80
98
|
v-for="(header, headerIndex) in headers"
|
|
81
99
|
:key="headerIndex"
|
|
82
|
-
:class="[
|
|
100
|
+
:class="[
|
|
101
|
+
isScrolled && headerIndex === 0 ? stickyClass.body : '',
|
|
102
|
+
]"
|
|
83
103
|
>
|
|
84
104
|
<slot
|
|
85
105
|
:name="`item.${header.value}`"
|
|
@@ -94,17 +114,17 @@
|
|
|
94
114
|
<slot name="expanded" :row="row" :rowIndex="rowIndex"></slot>
|
|
95
115
|
</template>
|
|
96
116
|
</template>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</
|
|
106
|
-
</
|
|
107
|
-
</
|
|
117
|
+
<template v-else-if="computedItems.length === 0">
|
|
118
|
+
<tr class="norecords">
|
|
119
|
+
<td :colspan="checkable === true ? headers.length + 1 : headers.length">
|
|
120
|
+
<div
|
|
121
|
+
class="flex items-center justify-center text-xl font-medium text-gray-500 min-h-96"
|
|
122
|
+
>
|
|
123
|
+
No matching records found
|
|
124
|
+
</div>
|
|
125
|
+
</td>
|
|
126
|
+
</tr>
|
|
127
|
+
</template>
|
|
108
128
|
</tbody>
|
|
109
129
|
</table>
|
|
110
130
|
</div>
|
|
@@ -144,12 +164,21 @@
|
|
|
144
164
|
</template>
|
|
145
165
|
|
|
146
166
|
<script setup lang="ts">
|
|
147
|
-
import {
|
|
167
|
+
import {
|
|
168
|
+
computed,
|
|
169
|
+
onMounted,
|
|
170
|
+
onUnmounted,
|
|
171
|
+
PropType,
|
|
172
|
+
ref,
|
|
173
|
+
toRefs,
|
|
174
|
+
watch,
|
|
175
|
+
} from "vue";
|
|
148
176
|
import EUIPagination from "./EUIPagination.vue";
|
|
149
177
|
import EUITableCheckbox from "./EUITableCheckbox.vue";
|
|
150
178
|
import SortArrow from "../../assets/svg/SortArrow.vue";
|
|
151
179
|
import EUIPageLimit from "./EUIPageLimit.vue";
|
|
152
180
|
import { capitalizeText } from "../../utils/lodash";
|
|
181
|
+
import EUICircleLoader from "../loader/EUICircleLoader.vue";
|
|
153
182
|
|
|
154
183
|
interface Header {
|
|
155
184
|
value: string;
|
|
@@ -169,7 +198,11 @@ const props = defineProps({
|
|
|
169
198
|
tableExpanded: { type: Boolean, default: false },
|
|
170
199
|
backendPagination: { type: Boolean, default: false },
|
|
171
200
|
checkedRows: { type: Array, default: () => ({}), required: true },
|
|
172
|
-
headers: {
|
|
201
|
+
headers: {
|
|
202
|
+
type: Array as PropType<Header[]>,
|
|
203
|
+
default: () => ({}),
|
|
204
|
+
required: true,
|
|
205
|
+
},
|
|
173
206
|
items: { type: Array, required: true, default: () => ({}) },
|
|
174
207
|
defaultSort: { type: String, default: "" },
|
|
175
208
|
defaultSortDirection: { type: String, default: "asc" },
|
|
@@ -182,6 +215,12 @@ const props = defineProps({
|
|
|
182
215
|
default: () => () => false,
|
|
183
216
|
},
|
|
184
217
|
isRowCheckable: { type: Function, default: () => true },
|
|
218
|
+
tableHeight: {
|
|
219
|
+
type: String,
|
|
220
|
+
required: false,
|
|
221
|
+
default: ""
|
|
222
|
+
},
|
|
223
|
+
tableLoading: { type: Boolean, default: false },
|
|
185
224
|
});
|
|
186
225
|
const {
|
|
187
226
|
defaultSort,
|
|
@@ -203,8 +242,8 @@ const currentSortDir = ref(defaultSortDirection.value);
|
|
|
203
242
|
const newCheckedRows = ref([...checkedRows.value]);
|
|
204
243
|
const newCurrentPage = ref(currentPage.value);
|
|
205
244
|
const lastCheckedRowIndex = ref();
|
|
206
|
-
|
|
207
245
|
const limit = ref(props.perPage);
|
|
246
|
+
const loading = computed(() => props.tableLoading);
|
|
208
247
|
|
|
209
248
|
// Computed Property
|
|
210
249
|
const filteredItems = computed(() => {
|
|
@@ -227,18 +266,13 @@ const filteredItems = computed(() => {
|
|
|
227
266
|
const computedItems = computed(() => {
|
|
228
267
|
let items = filteredItems.value;
|
|
229
268
|
// Sort items before slicing for pagination
|
|
230
|
-
items.sort((a:any, b:any) => {
|
|
269
|
+
items.sort((a: any, b: any) => {
|
|
231
270
|
const modifier = currentSortDir.value === "desc" ? -1 : 1;
|
|
232
271
|
if (a[currentSort.value] < b[currentSort.value]) return -1 * modifier;
|
|
233
272
|
if (a[currentSort.value] > b[currentSort.value]) return 1 * modifier;
|
|
234
273
|
return 0;
|
|
235
274
|
});
|
|
236
|
-
return items
|
|
237
|
-
|
|
238
|
-
// Apply pagination
|
|
239
|
-
// const start = (newCurrentPage.value - 0) * limit.value;
|
|
240
|
-
// const end = start + limit.value;
|
|
241
|
-
// return items.slice(start, end);
|
|
275
|
+
return items;
|
|
242
276
|
});
|
|
243
277
|
|
|
244
278
|
const searchData = (data: number) => {
|
|
@@ -281,7 +315,7 @@ const isAllUncheckable = computed(() => {
|
|
|
281
315
|
});
|
|
282
316
|
|
|
283
317
|
// methods
|
|
284
|
-
const defaultFilter = (value:any, search:any) => {
|
|
318
|
+
const defaultFilter = (value: any, search: any) => {
|
|
285
319
|
return value.toString().toLowerCase().includes(search);
|
|
286
320
|
};
|
|
287
321
|
|
|
@@ -289,7 +323,7 @@ const indexOf = (
|
|
|
289
323
|
array: any[],
|
|
290
324
|
obj: any,
|
|
291
325
|
fn: (item: any, obj: any) => boolean
|
|
292
|
-
): number =>
|
|
326
|
+
): number => {
|
|
293
327
|
if (!array) return -1;
|
|
294
328
|
if (!fn || typeof fn !== "function") return array?.indexOf(obj);
|
|
295
329
|
for (let i = 0; i < array.length; i++) {
|
|
@@ -318,7 +352,7 @@ const emit = defineEmits([
|
|
|
318
352
|
"update:checkedRows",
|
|
319
353
|
"changeLimit",
|
|
320
354
|
"mouseenter",
|
|
321
|
-
"mouseleave"
|
|
355
|
+
"mouseleave",
|
|
322
356
|
]);
|
|
323
357
|
|
|
324
358
|
const changeLimit = (limitData: number) => {
|
|
@@ -354,20 +388,20 @@ const checkAll = () => {
|
|
|
354
388
|
emit("update:checkedRows", newCheckedRows.value);
|
|
355
389
|
};
|
|
356
390
|
|
|
357
|
-
const removeCheckedRow = (row:any) => {
|
|
391
|
+
const removeCheckedRow = (row: any) => {
|
|
358
392
|
const index = indexOf(newCheckedRows.value, row, customIsChecked.value);
|
|
359
393
|
if (index >= 0) {
|
|
360
394
|
newCheckedRows.value.splice(index, 1);
|
|
361
395
|
}
|
|
362
396
|
};
|
|
363
397
|
|
|
364
|
-
const isRowChecked = (row:any) => {
|
|
398
|
+
const isRowChecked = (row: any) => {
|
|
365
399
|
return indexOf(newCheckedRows.value, row, customIsChecked.value) >= 0;
|
|
366
400
|
};
|
|
367
401
|
|
|
368
402
|
const checkRow = (row: any, rowIndex: number, event: Event) => {
|
|
369
403
|
if (!isRowCheckable.value(row)) return;
|
|
370
|
-
if(event) {
|
|
404
|
+
if (event) {
|
|
371
405
|
lastCheckedRowIndex.value = rowIndex;
|
|
372
406
|
if (!isRowChecked(row)) {
|
|
373
407
|
newCheckedRows.value.push(row);
|
|
@@ -457,8 +491,8 @@ watch(() => tableContainer.value?.clientWidth, checkOverflow);
|
|
|
457
491
|
}
|
|
458
492
|
}
|
|
459
493
|
tbody {
|
|
460
|
-
|
|
461
|
-
tr:not(.norecords)
|
|
494
|
+
@apply snap-y snap-mandatory snap-always;
|
|
495
|
+
tr:not(.norecords) {
|
|
462
496
|
@apply text-gray-500 transition-all duration-150 rounded-xl bg-white snap-start ease-in-out snap-x snap-mandatory;
|
|
463
497
|
&:hover {
|
|
464
498
|
@apply shadow-[1px_2px_40px_0px_#03022912] ring-1 ring-gray-100 ring-inset z-30;
|
|
@@ -88,7 +88,20 @@
|
|
|
88
88
|
</tr>
|
|
89
89
|
</thead>
|
|
90
90
|
<tbody>
|
|
91
|
+
<template v-if="loading">
|
|
92
|
+
<tr class="norecords">
|
|
93
|
+
<td :colspan="headers.length">
|
|
94
|
+
<div
|
|
95
|
+
class="flex items-center justify-center min-h-96"
|
|
96
|
+
>
|
|
97
|
+
<EUICircleLoader />
|
|
98
|
+
</div>
|
|
99
|
+
</td>
|
|
100
|
+
</tr>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
91
103
|
<template
|
|
104
|
+
v-else-if="computedItems.length > 0"
|
|
92
105
|
v-for="(row, rowIndex) in computedItems"
|
|
93
106
|
:key="`table-row-${rowIndex}`"
|
|
94
107
|
>
|
|
@@ -123,9 +136,8 @@
|
|
|
123
136
|
<slot name="expanded" :row="row" :rowIndex="rowIndex"></slot>
|
|
124
137
|
</template>
|
|
125
138
|
</template>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<tr class="norecords">
|
|
139
|
+
<template v-else-if="computedItems.length === 0">
|
|
140
|
+
<tr class="norecords">
|
|
129
141
|
<td :colspan="checkable === true ? headers.length + 1 : headers.length">
|
|
130
142
|
<div
|
|
131
143
|
class="flex items-center justify-center text-xl font-medium text-gray-500 min-h-96"
|
|
@@ -134,7 +146,9 @@
|
|
|
134
146
|
</div>
|
|
135
147
|
</td>
|
|
136
148
|
</tr>
|
|
149
|
+
</template>
|
|
137
150
|
</tbody>
|
|
151
|
+
|
|
138
152
|
</table>
|
|
139
153
|
</div>
|
|
140
154
|
<div
|
|
@@ -179,6 +193,7 @@ import EUITableCheckbox from "./EUITableCheckbox.vue";
|
|
|
179
193
|
import EUIPageLimit from "./EUIPageLimit.vue";
|
|
180
194
|
import EUIStudentPagination from "./EUIStudentPagination.vue";
|
|
181
195
|
import { capitalizeText } from "../../utils/lodash";
|
|
196
|
+
import EUICircleLoader from "../loader/EUICircleLoader.vue";
|
|
182
197
|
|
|
183
198
|
interface Header {
|
|
184
199
|
value: string;
|
|
@@ -216,6 +231,7 @@ const props = defineProps({
|
|
|
216
231
|
required: false,
|
|
217
232
|
default: ""
|
|
218
233
|
},
|
|
234
|
+
tableLoading: { type: Boolean, default: false },
|
|
219
235
|
});
|
|
220
236
|
|
|
221
237
|
const {
|
|
@@ -233,14 +249,13 @@ const {
|
|
|
233
249
|
customIsChecked,
|
|
234
250
|
} = toRefs(props);
|
|
235
251
|
|
|
236
|
-
|
|
237
|
-
|
|
238
252
|
const currentSort = ref(defaultSort.value);
|
|
239
253
|
const currentSortDir = ref(defaultSortDirection.value);
|
|
240
254
|
const newCheckedRows = ref([...checkedRows.value]);
|
|
241
255
|
const newCurrentPage = ref(currentPage.value);
|
|
242
256
|
const lastCheckedRowIndex = ref();
|
|
243
257
|
const limit = ref(props.perPage);
|
|
258
|
+
const loading = computed(() => props.tableLoading);
|
|
244
259
|
|
|
245
260
|
// Computed Property
|
|
246
261
|
const filteredItems = computed(() => {
|