adminforth 2.33.0 → 2.34.0

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.
@@ -17,7 +17,7 @@
17
17
  <div
18
18
  v-else-if="type === 'input'"
19
19
  role="input"
20
- :class="['animate-pulse bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded', $attrs.class]"
20
+ :class="['animate-pulse bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-default', $attrs.class]"
21
21
  ></div>
22
22
  <div v-else role="status" class="flex items-center justify-center animate-pulse bg-lightSkeletonIconColor rounded-full dark:bg-darkSkeletonBackgroundColor">
23
23
  <span class="sr-only">Loading...</span>
@@ -200,7 +200,7 @@
200
200
  :key="action.id"
201
201
  >
202
202
  <component
203
- v-if="action.customComponent"
203
+ v-if="action"
204
204
  :is="action.customComponent ? getCustomComponent(formatComponent(action.customComponent)) : CallActionWrapper"
205
205
  :meta="formatComponent(action.customComponent).meta"
206
206
  :row="row"
@@ -11,50 +11,32 @@
11
11
  </div>
12
12
  </div>
13
13
 
14
- <div v-for="i in 5" :key="i"
15
- class="flex items-center bg-lightForm dark:bg-darkForm border-b border-gray-100 dark:border-darkFormBorder"
16
- :style="{ height: i === 2 ? '95px' : '75px' }"
17
- >
18
- <div class="w-[208px] flex-shrink-0 px-6 flex items-center gap-1">
14
+ <template v-for="column in visibleColumns" :key="column.name">
15
+ <div
16
+ class="flex items-center bg-lightForm dark:bg-darkForm border-b border-gray-100 dark:border-darkFormBorder"
17
+ :style="{ height: getFieldHeight(column) }"
18
+ >
19
+ <div class="w-[208px] flex-shrink-0 px-6 flex items-center">
19
20
  <Skeleton class="w-24 h-[10px]" />
20
21
  </div>
21
-
22
- <div class="flex-1 px-6">
23
- <div v-if="i === 2">
24
- <Skeleton type="input" class="h-[42px] w-[160px]" />
25
- <Skeleton class="mt-1 h-[12px] w-20" />
26
- </div>
27
- <Skeleton type="input" v-else-if="i === 4 || i === 5" class="h-[42px] w-[160px]" />
28
- <Skeleton v-else type="input" class="h-[42px] w-full" />
29
- </div>
30
- </div>
31
22
 
32
- <div class="flex items-start bg-lightForm dark:bg-darkForm" style="height: 759px;">
33
- <div class="w-[208px] flex-shrink-0 px-6 pt-7">
34
- <Skeleton class="w-24 h-[10px]" />
35
- </div>
36
-
37
- <div class="flex-1 px-6 pt-4 h-full flex flex-col">
38
- <div class="flex flex-wrap items-center gap-3 p-1.5 border border-gray-300 dark:border-gray-600 rounded-t-lg bg-gray-50 dark:bg-gray-800 w-full box-border h-[44px]">
39
- <template v-for="btn in skeletonButtons" :key="btn.id">
40
- <div class=" animate-pulse flex items-center justify-center h-8 px-1 text-gray-300 dark:text-gray-600">
41
- <component :is="btn.icon" class="w-5 h-5" />
42
- </div>
43
- <div v-if="btn.sep" class="w-px h-4 bg-gray-300 dark:bg-gray-600 mx-1"></div>
44
- </template>
23
+ <div class="flex-1 px-6">
24
+ <Skeleton type="input" :class="getSkeletonInputClass(column)" />
25
+
26
+ <div v-if="hasEditingNote(column)" class="mt-1">
27
+ <Skeleton class="h-[12px] w-20" />
28
+ </div>
45
29
  </div>
46
- <div class="flex-1 animate-pulse bg-white dark:bg-gray-950 border-x border-b border-gray-200 dark:border-gray-700 rounded-b-lg w-full shadow-inner"></div>
47
- <div class="h-10"></div>
48
30
  </div>
49
- </div>
31
+
32
+ </template>
50
33
  </div>
51
34
  </div>
52
35
  </template>
53
36
 
54
37
  <script setup lang="ts">
55
- import { markRaw } from 'vue';
56
- import { IconExclamationCircleSolid } from '@iconify-prerendered/vue-flowbite';
57
- import {
38
+ import { computed, markRaw } from 'vue';
39
+ import {
58
40
  IconLinkOutline, IconCodeOutline, IconRectangleListOutline,
59
41
  IconOrderedListOutline, IconLetterBoldOutline, IconLetterUnderlineOutline,
60
42
  IconLetterItalicOutline, IconTextSlashOutline
@@ -62,6 +44,39 @@ import {
62
44
  import { IconH116Solid, IconH216Solid, IconH316Solid } from '@iconify-prerendered/vue-heroicons';
63
45
  import { Skeleton } from '@/afcl';
64
46
 
47
+ interface Props {
48
+ resource?: any;
49
+ page?: string;}
50
+
51
+ const props = withDefaults(defineProps<Props>(), {
52
+ page: 'edit'
53
+ });
54
+
55
+ const visibleColumns = computed(() => {
56
+ if (!props.resource?.columns) return [];
57
+
58
+ return props.resource.columns.filter((col: any) => {
59
+ if (col.virtual) return false;
60
+ if (col.primaryKey) return false;
61
+ if (col.backendOnly) return false;
62
+ if (col.showIn?.[props.page] === false) return false;
63
+ return true;
64
+ });
65
+ });
66
+
67
+
68
+ const hasEditingNote = (column: any) => !!column.editingNote;
69
+
70
+ const getFieldHeight = (column: any) =>
71
+ hasEditingNote(column) ? '95px' : '75px';
72
+
73
+ const getSkeletonInputClass = (column: any) => {
74
+ if (['integer', 'decimal', 'float'].includes(column.type)) {
75
+ return 'h-[42px] w-[160px]';
76
+ }
77
+ return 'h-[42px] w-full';
78
+ };
79
+
65
80
  const skeletonButtons = [
66
81
  { id: 'bold', icon: markRaw(IconLetterBoldOutline), sep: false },
67
82
  { id: 'italic', icon: markRaw(IconLetterItalicOutline), sep: false },
@@ -41,7 +41,7 @@
41
41
  :adminUser="coreStore.adminUser"
42
42
  />
43
43
 
44
- <CreateEditSkeleton v-if="loading"></CreateEditSkeleton>
44
+ <CreateEditSkeleton :resource="coreStore.resource" v-if="loading"></CreateEditSkeleton>
45
45
 
46
46
  <ResourceForm
47
47
  v-else-if="coreStore.resource"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.33.0",
3
+ "version": "2.34.0",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",