adminforth 1.11.5-next.1 → 1.11.5-next.2

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.
@@ -63,7 +63,8 @@
63
63
  <SkeleteLoader
64
64
  v-if="!rows"
65
65
  :columns="resource?.columns.filter(c => c.showIn.list).length + 2"
66
- :rows="3"
66
+ :rows="rowHeights.length || 3"
67
+ :row-heights="rowHeights"
67
68
  />
68
69
  <tr v-else-if="rows.length === 0" class="bg-lightListTable dark:bg-darkListTable dark:border-darkListTableBorder">
69
70
  <td :colspan="resource?.columns.length + 2">
@@ -80,6 +81,7 @@
80
81
 
81
82
  <tr @click="onClick($event,row)"
82
83
  v-else v-for="(row, rowI) in rows" :key="`row_${row._primaryKeyValue}`"
84
+ ref="rowRefs"
83
85
  class="bg-lightListTable dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover"
84
86
 
85
87
  :class="{'border-b': rowI !== rows.length - 1, 'cursor-pointer': row._clickUrl !== null}"
@@ -269,7 +271,7 @@
269
271
  <script setup lang="ts">
270
272
 
271
273
 
272
- import { computed, onMounted, ref, watch, type Ref } from 'vue';
274
+ import { computed, onMounted, ref, watch, useTemplateRef, type Ref } from 'vue';
273
275
  import { callAdminForthApi } from '@/utils';
274
276
  import { useI18n } from 'vue-i18n';
275
277
  import ValueRenderer from '@/components/ValueRenderer.vue';
@@ -347,6 +349,13 @@ watch(() => props.page, (newPage) => {
347
349
  page.value = newPage;
348
350
  });
349
351
 
352
+ const rowRefs = useTemplateRef('rowRefs');
353
+ const rowHeights = ref([]);
354
+ watch(() => props.rows, (newRows) => {
355
+ // rows are set to null when new records are loading
356
+ rowHeights.value = newRows ? [] : rowRefs.value.map((el) => el.offsetHeight);
357
+ });
358
+
350
359
  function addToCheckedValues(id) {
351
360
  if (checkboxesInternal.value.includes(id)) {
352
361
  checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== id);
@@ -1,6 +1,10 @@
1
1
  <template>
2
- <tr v-for="c in new Array(props.rows)" class="bg-lightListTable border-b dark:bg-darkListTable dark:border-darkListBorder">
3
- <td v-for="r in new Array(props.columns)" class="items-center px-6 py-8 cursor-default" >
2
+ <tr
3
+ v-for="(r, ri) in new Array(props.rows)"
4
+ class="bg-lightListTable border-b dark:bg-darkListTable dark:border-darkListBorder"
5
+ :style="[props.rowHeights[ri] !== undefined ? `height: ${props.rowHeights[ri]}px` : '' ]"
6
+ >
7
+ <td v-for="c in new Array(props.columns)" class="items-center px-6 py-8 cursor-default" >
4
8
  <div role="status" class="max-w-sm animate-pulse">
5
9
  <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
6
10
  </div>
@@ -10,9 +14,12 @@
10
14
 
11
15
  <script setup lang="ts">
12
16
 
13
- const props = defineProps<{
17
+ const props = withDefaults(defineProps<{
14
18
  columns: number;
15
19
  rows: number;
16
- }>();
20
+ rowHeights?: number[];
21
+ }>(), {
22
+ rowHeights: [],
23
+ });
17
24
 
18
25
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.11.5-next.1",
3
+ "version": "1.11.5-next.2",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",