adminforth 1.0.55 → 1.0.57

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,6 +1,22 @@
1
1
  import { ref, computed } from 'vue'
2
2
  import { defineStore } from 'pinia'
3
3
  import { callAdminForthApi } from '@/utils';
4
+ import router from '@/router';
5
+
6
+ async function findHomepage(menu) {
7
+ for (const item of menu) {
8
+ if (item.homepage) {
9
+ return item;
10
+ }
11
+ if (item.children) {
12
+ const res = findHomepage(item.children);
13
+ if (res) {
14
+ return res;
15
+ }
16
+ }
17
+ }
18
+ return null;
19
+ }
4
20
 
5
21
  export const useCoreStore = defineStore('core', () => {
6
22
  const resourceById = ref([]);
@@ -24,40 +40,35 @@ export const useCoreStore = defineStore('core', () => {
24
40
  }, {});
25
41
  config.value = resp.config;
26
42
  user.value = resp.user;
27
- console.log('🌍 AdminForth v', resp.version);
28
43
 
29
44
  // find homepage:true in menu recuresively
30
-
45
+ if (import.meta.env.DEV){
46
+ return
47
+ } else {
48
+ const homepage = await findHomepage(menu.value);
49
+ if (homepage) {
50
+ if (homepage.resourceId) {
51
+ // redirect to homepage
52
+ router.push({ name: 'resource-list', params: { resourceId: homepage.resourceId } });
53
+ } else {
54
+ // redirect to path
55
+ router.push(homepage.path);
56
+ }
57
+ }
58
+ }
31
59
  }
32
60
 
33
61
  async function fetchRecord({ resourceId, primaryKey }) {
34
62
  record.value = null;
35
-
36
- if (!resourceColumns.value) {
37
- throw new Error('Columns not fetched yet');
38
- }
39
63
 
40
- const respData = await callAdminForthApi({
41
- path: '/get_resource_data',
64
+ record.value = await callAdminForthApi({
65
+ path: '/get_record',
42
66
  method: 'POST',
43
67
  body: {
44
- source: 'show',
45
68
  resourceId: resourceId,
46
- filters: [
47
- {
48
- field: resourceColumns.value.find((col) => col.primaryKey).name,
49
- operator: 'eq',
50
- value: primaryKey
51
- }
52
- ],
53
- sort: [],
54
- limit: 1,
55
- offset: 0
69
+ primaryKey: primaryKey,
56
70
  }
57
71
  });
58
-
59
- console.log('📦 record', respData);
60
- record.value = respData.data[0];
61
72
  }
62
73
 
63
74
  async function fetchColumns({ resourceId }) {
@@ -29,11 +29,9 @@ export async function callAdminForthApi({ path, method, body=undefined }) {
29
29
  }
30
30
  }
31
31
 
32
- export function getCustomComponent(filePath: string) {
33
- const name = filePath.replace(/@/g, '').replace(/\./g, '').replace(/\//g, '');
34
- console.log('resolving name', name);
35
- return resolveComponent(name);
36
- }
32
+
33
+
34
+
37
35
 
38
36
  export function getIcon(icon: string) {
39
37
  // icon format is "feather:icon-name". We need to get IconName in pascal case
@@ -31,7 +31,6 @@
31
31
  @update:record="onUpdateRecord"
32
32
  @update:isValid="isValid = $event"
33
33
  :validating="validating"
34
- :customComponentsPerColumn="createComponentsPerColumn"
35
34
  >
36
35
  </ResourceForm>
37
36
 
@@ -41,14 +40,14 @@
41
40
 
42
41
  <script setup>
43
42
 
44
- import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
45
- import ResourceForm from '@/components/ResourceForm.vue';
46
- import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
43
+ import { ref, computed, onMounted } from 'vue';
44
+ import { useRoute, useRouter } from 'vue-router';
47
45
  import { useCoreStore } from '@/stores/core';
48
- import { callAdminForthApi, getCustomComponent } from '@/utils';
46
+ import { callAdminForthApi } from '@/utils';
47
+ import ResourceForm from '@/components/ResourceForm.vue';
48
+ import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
49
49
  import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
50
- import { onMounted, ref } from 'vue';
51
- import { useRoute, useRouter } from 'vue-router';
50
+ import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
52
51
 
53
52
  const isValid = ref(false);
54
53
  const validating = ref(false);
@@ -60,7 +59,6 @@ const route = useRoute();
60
59
  const router = useRouter();
61
60
 
62
61
  const record = ref({});
63
- let createComponentsPerColumn = {};
64
62
 
65
63
  const coreStore = useCoreStore();
66
64
 
@@ -71,15 +69,9 @@ async function onUpdateRecord(newRecord) {
71
69
 
72
70
  onMounted(async () => {
73
71
  loading.value = true;
74
- await coreStore.fetchColumns({
72
+ coreStore.fetchColumns({
75
73
  resourceId: route.params.resourceId
76
74
  });
77
- createComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
78
- if (column.component?.create) {
79
- acc[column.name] = getCustomComponent(column.component.create);
80
- }
81
- return acc;
82
- }, {});
83
75
  loading.value = false;
84
76
  });
85
77
 
@@ -23,12 +23,11 @@
23
23
 
24
24
  <ResourceForm
25
25
  v-else
26
- :record="editableRecord"
26
+ :record="coreStore.record"
27
27
  :resourceColumns="coreStore.resourceColumns"
28
28
  @update:record="onUpdateRecord"
29
29
  @update:isValid="isValid = $event"
30
30
  :validating="validating"
31
- :customComponentsPerColumn="editComponentsPerColumn"
32
31
  >
33
32
  </ResourceForm>
34
33
  </div>
@@ -37,14 +36,14 @@
37
36
 
38
37
  <script setup>
39
38
 
40
- import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
41
- import ResourceForm from '@/components/ResourceForm.vue';
42
- import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
39
+ import { ref, computed, onMounted } from 'vue';
40
+ import { useRoute, useRouter } from 'vue-router';
43
41
  import { useCoreStore } from '@/stores/core';
44
- import { callAdminForthApi, getCustomComponent } from '@/utils';
42
+ import ResourceForm from '@/components/ResourceForm.vue';
43
+ import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
45
44
  import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
46
- import { computed, onMounted, ref } from 'vue';
47
- import { useRoute, useRouter } from 'vue-router';
45
+ import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
46
+ import { callAdminForthApi } from '@/utils';
48
47
 
49
48
  const coreStore = useCoreStore();
50
49
 
@@ -59,24 +58,11 @@ const loading = ref(false);
59
58
  const saving = ref(false);
60
59
 
61
60
  const record = ref({});
62
- let editComponentsPerColumn = {};
63
61
 
64
62
  async function onUpdateRecord(newRecord) {
65
63
  record.value = newRecord;
66
64
  }
67
65
 
68
- const editableRecord = computed(() => {
69
- const newRecord = { ...coreStore.record };
70
- if (!coreStore.resourceColumns) {
71
- return {};
72
- }
73
- coreStore.resourceColumns.forEach(column => {
74
- if (column.foreignResource) {
75
- newRecord[column.name] = newRecord[column.name]?.pk
76
- }
77
- });
78
- return newRecord;
79
- })
80
66
 
81
67
  onMounted(async () => {
82
68
  loading.value = true;
@@ -89,12 +75,6 @@ onMounted(async () => {
89
75
  primaryKey: route.params.primaryKey,
90
76
  });
91
77
 
92
- editComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
93
- if (column.component?.edit) {
94
- acc[column.name] = getCustomComponent(column.component.edit);
95
- }
96
- return acc;
97
- }, {});
98
78
  loading.value = false;
99
79
  });
100
80
 
@@ -107,21 +87,13 @@ async function saveRecord() {
107
87
  }
108
88
 
109
89
  saving.value = true;
110
-
111
- const updates = {};
112
- for (const key in record.value) {
113
- if (record.value[key] !== coreStore.record[key]) {
114
- updates[key] = record.value[key];
115
- }
116
- }
117
-
118
90
  await callAdminForthApi({
119
91
  method: 'POST',
120
92
  path: `/update_record`,
121
93
  body: {
122
94
  resourceId: route.params.resourceId,
123
95
  recordId: route.params.primaryKey,
124
- record: updates,
96
+ record: record.value,
125
97
  },
126
98
  });
127
99
  saving.value = false;
@@ -0,0 +1,8 @@
1
+ <script setup lang="ts">
2
+ </script>
3
+
4
+ <template>
5
+ <main>
6
+ 123
7
+ </main>
8
+ </template>
@@ -65,7 +65,7 @@
65
65
  </BreadcrumbsWithButtons>
66
66
 
67
67
  <!-- table -->
68
- <div class="relative overflow-x-auto shadow-list-table-shadow dark:shadow-black dark:s">
68
+ <div class="relative overflow-x-auto shadow-md sm:rounded-lg dark:shadow-2xl">
69
69
 
70
70
 
71
71
  <!-- skelet loader -->
@@ -90,7 +90,7 @@
90
90
  </div>
91
91
 
92
92
  <table v-else class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
93
- <thead class="text-xs text-view-table-heading-text bg-list-view-table-heading dark:bg-gray-700 dark:text-gray-400">
93
+ <thead class="text-xs text-gray-700 bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
94
94
  <tr>
95
95
  <th scope="col" class="p-4">
96
96
  <div v-if="rows && rows.length" class="flex items-center">
@@ -127,7 +127,7 @@
127
127
  </tr>
128
128
  </thead>
129
129
  <tbody>
130
- <tr v-if="!rows" class="bg-list-view-table-bg border-b dark:bg-gray-800 dark:border-gray-700">
130
+ <tr v-if="!rows" class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
131
131
  <td :colspan="coreStore.resourceColumns.length + 2">
132
132
 
133
133
  <div role="status"
@@ -171,7 +171,7 @@
171
171
  </div>
172
172
  </td>
173
173
  </tr>
174
- <tr v-else-if="rows.length === 0" class="bg-list-view-table-bg border-b dark:bg-gray-800 dark:border-gray-700">
174
+ <tr v-else-if="rows.length === 0" class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
175
175
  <td :colspan="coreStore.resourceColumns.length + 2">
176
176
 
177
177
  <div id="toast-simple"
@@ -185,7 +185,7 @@
185
185
  </tr>
186
186
 
187
187
  <tr v-else v-for="(row, rowI) in rows" :key="row.id"
188
- class="bg-list-view-table-bg border-b dark:bg-gray-800 border-list-view-border-color dark:border-gray-700 hover:bg-list-view-table-row-hover dark:hover:bg-gray-600">
188
+ class="bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600">
189
189
  <td class="w-4 p-4">
190
190
  <div class="flex items center">
191
191
  <input
@@ -198,12 +198,7 @@
198
198
  </div>
199
199
  </td>
200
200
  <td v-for="c in columnsListed" class="px-6 py-4">
201
- <!-- if c.name in listComponentsPerColumn, render it. If not, render ValueRenderer -->
202
- <component
203
- :is="listComponentsPerColumn[c.name] || ValueRenderer"
204
- :column="c"
205
- :row="row"
206
- />
201
+ <ValueRenderer :column="c" :row="row"/>
207
202
  </td>
208
203
  <td class="flex items-center px-6 py-4">
209
204
 
@@ -315,28 +310,29 @@
315
310
  </template>
316
311
 
317
312
  <script setup>
313
+ import {ref, onMounted, watch, computed} from 'vue';
314
+ import {callAdminForthApi, getIcon} from '@/utils';
315
+ import {useRoute} from 'vue-router';
316
+ import {useCoreStore} from '@/stores/core';
317
+ import {useModalStore} from '@/stores/modal';
318
318
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
319
- import { useCoreStore } from '@/stores/core';
320
- import { useModalStore } from '@/stores/modal';
321
- import { callAdminForthApi, getIcon } from '@/utils';
322
- import { initFlowbite } from 'flowbite';
323
- import { computed, onMounted, ref, watch } from 'vue';
324
- import { useRoute } from 'vue-router';
319
+ import {initFlowbite} from 'flowbite'
325
320
 
326
321
  import ValueRenderer from '@/components/ValueRenderer.vue';
327
- import { getCustomComponent } from '@/utils';
328
322
 
329
323
  import {
330
- IconInboxOutline,
331
- IconPlusOutline
324
+ IconChevronDoubleLeftOutline,
325
+ IconChevronDoubleRightOutline,
326
+ IconInboxFullSolid,
327
+ IconInboxOutline,
328
+ IconPlusOutline
332
329
  } from '@iconify-prerendered/vue-flowbite';
333
330
 
334
331
  import {
335
- IconBanOutline,
336
- IconEyeSolid,
337
- IconFilterOutline,
338
- IconPenSolid,
339
- IconTrashBinSolid
332
+ IconEyeSolid,
333
+ IconTrashBinSolid,
334
+ IconPenSolid,
335
+ IconFilterOutline, IconBanOutline
340
336
  } from '@iconify-prerendered/vue-flowbite';
341
337
 
342
338
  import Filters from '@/components/Filters.vue';
@@ -361,6 +357,7 @@ const totalRows = ref(0);
361
357
  const allCheckedActions = ref([]);
362
358
  const allowedActions = ref({});
363
359
 
360
+
364
361
  const DEFAULT_PAGE_SIZE = 10;
365
362
 
366
363
  const columnsListed = computed(() => coreStore.resourceColumns?.filter(c => c.showIn.includes('list')));
@@ -379,7 +376,6 @@ async function selectAll(value) {
379
376
 
380
377
  const pageSize = computed(() => coreStore.resourceById[route.params.resourceId]?.pageSize || DEFAULT_PAGE_SIZE);
381
378
  const totalPages = computed(() => Math.ceil(totalRows.value / pageSize.value));
382
- let listComponentsPerColumn = {};
383
379
  const allFromThisPageChecked = computed(() => {
384
380
  if (!rows.value) return false;
385
381
  return rows.value.every((r) => checkboxes.value.includes(r.id));
@@ -423,7 +419,6 @@ async function getList() {
423
419
  path: '/get_resource_data',
424
420
  method: 'POST',
425
421
  body: {
426
- source: 'list',
427
422
  resourceId: route.params.resourceId,
428
423
  limit: pageSize.value,
429
424
  offset: (page.value - 1) * pageSize.value,
@@ -431,14 +426,7 @@ async function getList() {
431
426
  sort: sort.value,
432
427
  }
433
428
  });
434
- listComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
435
- if (column.component?.list) {
436
- acc[column.name] = getCustomComponent(column.component.list);
437
- }
438
- return acc;
439
- }, {});
440
-
441
- fetchStatus.value.pending = false;
429
+ fetchStatus.value.pending = false;
442
430
  rows.value = data.data?.map(row => {
443
431
  row._primaryKeyValue = row[coreStore.resourceColumns.find(c => c.primaryKey).name];
444
432
  return row;
@@ -11,7 +11,7 @@
11
11
  <div id="authentication-modal" tabindex="-1" class=" overflow-y-auto overflow-x-hidden z-50 min-w-[400px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
12
12
  <div class="relative p-4 w-full max-w-md max-h-full">
13
13
  <!-- Modal content -->
14
- <div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black" >
14
+ <div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
15
15
  <!-- Modal header -->
16
16
  <div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600">
17
17
  <h3 class="text-xl font-semibold text-gray-900 dark:text-white">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :key="`${$route?.params.resourceId}---${$route?.params.primaryKey}`">
2
+ <div>
3
3
  <RouterView/>
4
4
  </div>
5
5
  </template>
@@ -27,10 +27,10 @@
27
27
  </div>
28
28
  <div
29
29
  v-else
30
- class="relative overflow-x-auto shadow-resourse-form-shadow "
30
+ class="relative overflow-x-auto shadow-md sm:rounded-lg"
31
31
  >
32
32
  <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
33
- <thead class="text-xs text-gray-700 uppercase bg-form-view-heading dark:bg-gray-700 dark:text-gray-400">
33
+ <thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
34
34
  <tr>
35
35
  <th scope="col" class="px-6 py-3">
36
36
  Field
@@ -42,17 +42,13 @@
42
42
  </thead>
43
43
  <tbody>
44
44
  <tr v-for="column in coreStore.resourceColumns?.filter(c => c.showIn.includes('show'))" :key="column.name"
45
- class="bg-form-view-bg odd:dark:bg-gray-900 even:dark:bg-gray-800 border-b dark:border-gray-700"
45
+ class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700"
46
46
  >
47
47
  <td class="px-6 py-4 whitespace-nowrap">
48
48
  {{ column.label }}
49
49
  </td>
50
50
  <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap">
51
- <component
52
- :is="showComponentsPerColumn[column.name] || ValueRenderer"
53
- :column="column"
54
- :row="coreStore.record"
55
- />
51
+ <ValueRenderer :column="column" :row="coreStore.record" />
56
52
  </td>
57
53
  </tr>
58
54
 
@@ -67,19 +63,18 @@
67
63
 
68
64
  <script setup>
69
65
 
66
+ import { ref, computed, onMounted } from 'vue';
67
+ import { useRoute } from 'vue-router';
68
+ import { callAdminForthApi } from '@/utils';
70
69
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
71
- import ValueRenderer from '@/components/ValueRenderer.vue';
72
- import { useCoreStore } from '@/stores/core';
73
- import { getCustomComponent } from '@/utils';
74
70
  import { IconPenSolid, IconTrashBinSolid } from '@iconify-prerendered/vue-flowbite';
75
- import { onMounted, ref } from 'vue';
76
- import { useRoute } from 'vue-router';
71
+ import { useCoreStore } from '@/stores/core';
72
+ import ValueRenderer from '@/components/ValueRenderer.vue';
77
73
 
78
74
 
79
75
  const item = ref(null);
80
76
  const route = useRoute();
81
77
  const loading = ref(false);
82
- let showComponentsPerColumn = {};
83
78
 
84
79
  const coreStore = useCoreStore();
85
80
 
@@ -92,12 +87,6 @@ onMounted(async () => {
92
87
  resourceId: route.params.resourceId,
93
88
  primaryKey: route.params.primaryKey,
94
89
  });
95
- showComponentsPerColumn = coreStore.resourceColumns.reduce((acc, column) => {
96
- if (column.component?.show) {
97
- acc[column.name] = getCustomComponent(column.component.show);
98
- }
99
- return acc;
100
- }, {});
101
90
  loading.value = false;
102
91
  });
103
92
 
@@ -1,12 +1,9 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  export default {
3
- content: ["./src/**/*.{vue, js}","./src/*.{vue, js}", "./index.html", "./node_modules/flowbite/**/*.js"],
3
+ content: ["./src/**/*.{vue, js}", "./node_modules/flowbite/**/*.js"],
4
4
  theme: {
5
- extend: {
6
- /* IMPORTANT:ADMINFORTH TAILWIND STYLES */
7
- }
5
+ extend: {},
8
6
  },
9
-
10
7
  darkMode: 'class',
11
8
  plugins: [
12
9
  require('flowbite/plugin'),
@@ -100,7 +100,7 @@ class CodeInjector {
100
100
  routes += `{
101
101
  path: '${item.path}',
102
102
  name: '${item.path}',
103
- component: import('${item.component}'),
103
+ component: () => import('${item.component}'),
104
104
  },\n`
105
105
  }
106
106
  if (item.children) {
@@ -175,26 +175,27 @@ class CodeInjector {
175
175
 
176
176
  // for each custom component generate import statement
177
177
  const customComponentsDir = this.adminforth.config.customization?.customComponentsDir;
178
- let customComponentsImports = '';
179
- if (customComponentsDir) {
180
- // if file - return, if dir - go recursively
181
- const customComponents = await fs.promises.readdir(customComponentsDir);
182
- for (const filePath of customComponents) {
183
- if (!filePath.endsWith('.vue')) {
184
- continue;
178
+
179
+ const customResourceComponents = [];
180
+ this.adminforth.config.resources.forEach((resource) => {
181
+ resource.columns.forEach((field) => {
182
+ if (field.component) {
183
+ Object.values(field.component).forEach((filePath) => {
184
+ if (!customResourceComponents.includes(filePath)) {
185
+ customResourceComponents.push(filePath);
185
186
  }
186
- fs.stat(`${customComponentsDir}/${filePath}`, (err, data) => {
187
- if (err) {
188
- console.log(err);
189
- return;
190
- }
191
- if (data.isFile()) {
192
- const componentName = getComponentNameFromPath(filePath);
193
- customComponentsImports += `import ${componentName} from '@/custom/${filePath}';\n`;
194
- }
195
- })
187
+ });
196
188
  }
197
- }
189
+ });
190
+ });
191
+
192
+ let customComponentsImports = '';
193
+ customResourceComponents.forEach((filePath) => {
194
+ const componentName = getComponentNameFromPath(filePath);
195
+ customComponentsImports += `import ${componentName} from '${filePath}';\n`;
196
+ });
197
+
198
+
198
199
 
199
200
  // Generate Vue.component statements for each icon
200
201
  const iconComponents = uniqueIcons.map((icon) => {
@@ -207,24 +208,10 @@ class CodeInjector {
207
208
 
208
209
  // Generate Vue.component statements for each custom component
209
210
  let customComponentsComponents = '';
210
- if (customComponentsDir) {
211
- const customComponents = await fs.promises.readdir(customComponentsDir);
212
- for (const filePath of customComponents) {
213
- if (!filePath.endsWith('.vue')) {
214
- continue;
215
- }
216
- fs.stat(`${customComponentsDir}/${filePath}`, (err, data) => {
217
- if (err) {
218
- console.log('Custom components importing error: ', err);
219
- return;
220
- }
221
- if (data.isFile()) {
222
- const componentName = getComponentNameFromPath(filePath);
223
- customComponentsComponents += `app.component('${componentName}', ${componentName});\n`;
224
- }
225
- })
226
- }
227
- }
211
+ customResourceComponents.forEach((filePath) => {
212
+ const componentName = getComponentNameFromPath(filePath);
213
+ customComponentsComponents += `app.component('${componentName}', ${componentName});\n`;
214
+ })
228
215
 
229
216
 
230
217
  let imports = iconImports + '\n';
@@ -257,7 +244,7 @@ class CodeInjector {
257
244
 
258
245
 
259
246
 
260
- /* generate custom rotes */
247
+ /* generate custom routes */
261
248
  const homepageMenuItem = this.adminforth.config.menu.find((mi)=>mi.homepage);
262
249
  let childrenHomePageMenuItem = this.adminforth.config.menu.find((mi)=>mi.children && mi.children?.find((mi)=>mi.homepage));
263
250
  let childrenHomepage = childrenHomePageMenuItem?.children?.find((mi)=>mi.homepage)
@@ -266,10 +253,6 @@ class CodeInjector {
266
253
  homePagePath=this.adminforth.config.menu.filter((mi)=>mi.path)[0]?.path || `/resource/${this.adminforth.config.menu.filter((mi)=>mi.children)[0]?.resourceId}` ;
267
254
  }
268
255
 
269
-
270
-
271
-
272
-
273
256
  routes += `{
274
257
  path: '/',
275
258
  name: 'home',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,20 +1,9 @@
1
1
  import { createRouter, createWebHistory } from 'vue-router'
2
2
  import ResourceParent from '@/views/ResourceParent.vue'
3
- import ListView from '@/views/ListView.vue'
4
- import ShowView from '@/views/ShowView.vue'
5
- import EditView from '@/views/EditView.vue'
6
- import CreateView from '@/views/CreateView.vue'
7
3
 
8
4
  const router = createRouter({
9
5
  history: createWebHistory(import.meta.env.BASE_URL),
10
6
  routes: [
11
- {
12
- path: '/',
13
- name: 'home',
14
- //redirect to login
15
- /* IMPORTANT:ADMINFORTH REDIRECT */
16
-
17
- },
18
7
  {
19
8
  path: '/login',
20
9
  name: 'login',
@@ -27,22 +16,22 @@ const router = createRouter({
27
16
  children: [
28
17
  {
29
18
  path: '',
30
- component: ListView,
19
+ component: () => import('@/views/ListView.vue'),
31
20
  name: 'resource-list'
32
21
  },
33
22
  {
34
23
  path: 'show/:primaryKey',
35
- component: ShowView,
24
+ component: () => import('@/views/ShowView.vue'),
36
25
  name: 'resource-show'
37
26
  },
38
27
  {
39
28
  path: 'edit/:primaryKey',
40
- component: EditView,
29
+ component: () => import('@/views/EditView.vue'),
41
30
  name: 'resource-edit'
42
31
  },
43
32
  {
44
33
  path: 'create',
45
- component: CreateView,
34
+ component: () => import('@/views/CreateView.vue'),
46
35
  name: 'resource-create'
47
36
  },
48
37
  ]