edvoyui-component-library-test-flight 0.0.26 → 0.0.27

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.
@@ -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=210493c5&lang.scss";
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edvoyui-component-library-test-flight",
3
3
  "private": false,
4
- "version": "0.0.26",
4
+ "version": "0.0.27",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist/",
@@ -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
- hours: new Date().getHours(),
134
- minutes: new Date().getMinutes()
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( props.modelValue ? props.modelValue : props.timePicker ? time.value : props.range ? [startDate.value, endDate.value] : startDate.value);
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
- @apply min-w-56;
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;
@@ -22,12 +22,12 @@
22
22
  </th>
23
23
  </template>
24
24
  <th
25
- v-for="(header, headerIndex) in headers"
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
- isScrolled && headerIndex === 0 ? stickyClass.head : '',
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 text-xl font-medium text-gray-500 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="$attrs.mouseenter ? $emit('mouseenter', row, rowIndex) : null"
68
- @mouseleave="$attrs.mouseleave ? $emit('mouseleave', row, rowIndex) : null"
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="($event) => checkRow(row, rowIndex, $event)"
91
+ @change.prevent.stop="
92
+ ($event) => checkRow(row, rowIndex, $event)
93
+ "
76
94
  />
77
95
  </td>
78
96
  </template>
79
- <td
97
+ <td
80
98
  v-for="(header, headerIndex) in headers"
81
99
  :key="headerIndex"
82
- :class="[isScrolled && headerIndex === 0 ? stickyClass.body : '']"
100
+ :class="[
101
+ isScrolled && headerIndex === 0 ? stickyClass.body : '',
102
+ ]"
83
103
  >
84
104
  <slot
85
105
  :name="`item.${header.value}`"
@@ -94,17 +114,18 @@
94
114
  <slot name="expanded" :row="row" :rowIndex="rowIndex"></slot>
95
115
  </template>
96
116
  </template>
97
- </tbody>
98
- <tbody v-if="computedItems.length === 0">
99
- <tr class="norecords">
100
- <td :colspan="headers.length">
101
- <div
102
- class="flex items-center justify-center text-xl font-medium text-gray-500 min-h-96"
103
- >
104
- No matching records found
105
- </div>
106
- </td>
107
- </tr>
117
+
118
+ <template v-if="computedItems.length === 0">
119
+ <tr class="norecords">
120
+ <td :colspan="headers.length">
121
+ <div
122
+ class="flex items-center justify-center text-xl font-medium text-gray-500 min-h-96"
123
+ >
124
+ No matching records found
125
+ </div>
126
+ </td>
127
+ </tr>
128
+ </template>
108
129
  </tbody>
109
130
  </table>
110
131
  </div>
@@ -144,12 +165,21 @@
144
165
  </template>
145
166
 
146
167
  <script setup lang="ts">
147
- import { computed, onMounted, onUnmounted, PropType, ref, toRefs, watch } from "vue";
168
+ import {
169
+ computed,
170
+ onMounted,
171
+ onUnmounted,
172
+ PropType,
173
+ ref,
174
+ toRefs,
175
+ watch,
176
+ } from "vue";
148
177
  import EUIPagination from "./EUIPagination.vue";
149
178
  import EUITableCheckbox from "./EUITableCheckbox.vue";
150
179
  import SortArrow from "../../assets/svg/SortArrow.vue";
151
180
  import EUIPageLimit from "./EUIPageLimit.vue";
152
181
  import { capitalizeText } from "../../utils/lodash";
182
+ import EUICircleLoader from "../loader/EUICircleLoader.vue";
153
183
 
154
184
  interface Header {
155
185
  value: string;
@@ -169,7 +199,11 @@ const props = defineProps({
169
199
  tableExpanded: { type: Boolean, default: false },
170
200
  backendPagination: { type: Boolean, default: false },
171
201
  checkedRows: { type: Array, default: () => ({}), required: true },
172
- headers: { type: Array as PropType<Header[]>, default: () => ({}), required: true },
202
+ headers: {
203
+ type: Array as PropType<Header[]>,
204
+ default: () => ({}),
205
+ required: true,
206
+ },
173
207
  items: { type: Array, required: true, default: () => ({}) },
174
208
  defaultSort: { type: String, default: "" },
175
209
  defaultSortDirection: { type: String, default: "asc" },
@@ -182,6 +216,7 @@ const props = defineProps({
182
216
  default: () => () => false,
183
217
  },
184
218
  isRowCheckable: { type: Function, default: () => true },
219
+ tableLoading: { type: Boolean, default: true },
185
220
  });
186
221
  const {
187
222
  defaultSort,
@@ -206,6 +241,8 @@ const lastCheckedRowIndex = ref();
206
241
 
207
242
  const limit = ref(props.perPage);
208
243
 
244
+ const loading = computed(() => props.tableLoading);
245
+
209
246
  // Computed Property
210
247
  const filteredItems = computed(() => {
211
248
  let filteredItems = items.value.slice();
@@ -227,18 +264,13 @@ const filteredItems = computed(() => {
227
264
  const computedItems = computed(() => {
228
265
  let items = filteredItems.value;
229
266
  // Sort items before slicing for pagination
230
- items.sort((a:any, b:any) => {
267
+ items.sort((a: any, b: any) => {
231
268
  const modifier = currentSortDir.value === "desc" ? -1 : 1;
232
269
  if (a[currentSort.value] < b[currentSort.value]) return -1 * modifier;
233
270
  if (a[currentSort.value] > b[currentSort.value]) return 1 * modifier;
234
271
  return 0;
235
272
  });
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);
273
+ return items;
242
274
  });
243
275
 
244
276
  const searchData = (data: number) => {
@@ -281,7 +313,7 @@ const isAllUncheckable = computed(() => {
281
313
  });
282
314
 
283
315
  // methods
284
- const defaultFilter = (value:any, search:any) => {
316
+ const defaultFilter = (value: any, search: any) => {
285
317
  return value.toString().toLowerCase().includes(search);
286
318
  };
287
319
 
@@ -289,7 +321,7 @@ const indexOf = (
289
321
  array: any[],
290
322
  obj: any,
291
323
  fn: (item: any, obj: any) => boolean
292
- ): number => {
324
+ ): number => {
293
325
  if (!array) return -1;
294
326
  if (!fn || typeof fn !== "function") return array?.indexOf(obj);
295
327
  for (let i = 0; i < array.length; i++) {
@@ -318,7 +350,7 @@ const emit = defineEmits([
318
350
  "update:checkedRows",
319
351
  "changeLimit",
320
352
  "mouseenter",
321
- "mouseleave"
353
+ "mouseleave",
322
354
  ]);
323
355
 
324
356
  const changeLimit = (limitData: number) => {
@@ -354,20 +386,20 @@ const checkAll = () => {
354
386
  emit("update:checkedRows", newCheckedRows.value);
355
387
  };
356
388
 
357
- const removeCheckedRow = (row:any) => {
389
+ const removeCheckedRow = (row: any) => {
358
390
  const index = indexOf(newCheckedRows.value, row, customIsChecked.value);
359
391
  if (index >= 0) {
360
392
  newCheckedRows.value.splice(index, 1);
361
393
  }
362
394
  };
363
395
 
364
- const isRowChecked = (row:any) => {
396
+ const isRowChecked = (row: any) => {
365
397
  return indexOf(newCheckedRows.value, row, customIsChecked.value) >= 0;
366
398
  };
367
399
 
368
400
  const checkRow = (row: any, rowIndex: number, event: Event) => {
369
401
  if (!isRowCheckable.value(row)) return;
370
- if(event) {
402
+ if (event) {
371
403
  lastCheckedRowIndex.value = rowIndex;
372
404
  if (!isRowChecked(row)) {
373
405
  newCheckedRows.value.push(row);
@@ -457,8 +489,8 @@ watch(() => tableContainer.value?.clientWidth, checkOverflow);
457
489
  }
458
490
  }
459
491
  tbody {
460
- @apply snap-y snap-mandatory snap-always;
461
- tr:not(.norecords) {
492
+ @apply snap-y snap-mandatory snap-always;
493
+ tr:not(.norecords) {
462
494
  @apply text-gray-500 transition-all duration-150 rounded-xl bg-white snap-start ease-in-out snap-x snap-mandatory;
463
495
  &:hover {
464
496
  @apply shadow-[1px_2px_40px_0px_#03022912] ring-1 ring-gray-100 ring-inset z-30;