adminforth 1.1.52 → 1.1.53

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.
Files changed (33) hide show
  1. package/dist/modules/styles.js +2 -2
  2. package/dist/plugins/AccessControl/index.js +66 -0
  3. package/dist/plugins/AccessControl/types.js +1 -0
  4. package/dist/spa/index.html +2 -2
  5. package/dist/spa/package-lock.json +189 -1
  6. package/dist/spa/package.json +6 -1
  7. package/dist/spa/spa/public/favicon.png +0 -0
  8. package/dist/spa/spa/src/components/ResourceListTable.vue +12 -9
  9. package/dist/spa/src/App.vue +76 -57
  10. package/dist/spa/src/components/AcceptModal.vue +1 -1
  11. package/dist/spa/src/components/CustomDatePicker.vue +3 -3
  12. package/dist/spa/src/components/CustomDateRangePicker.vue +3 -3
  13. package/dist/spa/src/components/CustomRangePicker.vue +148 -0
  14. package/dist/spa/src/components/Dropdown.vue +13 -4
  15. package/dist/spa/src/components/Filters.vue +55 -22
  16. package/dist/spa/src/components/MenuLink.vue +2 -2
  17. package/dist/spa/src/components/ResourceForm.vue +157 -99
  18. package/dist/spa/src/components/ValueRenderer.vue +11 -1
  19. package/dist/spa/src/router/index.ts +3 -2
  20. package/dist/spa/src/stores/core.ts +22 -33
  21. package/dist/spa/src/utils.ts +5 -3
  22. package/dist/spa/src/views/CreateView.vue +15 -7
  23. package/dist/spa/src/views/EditView.vue +36 -8
  24. package/dist/spa/src/views/ListView.vue +35 -23
  25. package/dist/spa/src/views/LoginView.vue +1 -1
  26. package/dist/spa/src/views/ResourceParent.vue +1 -1
  27. package/dist/spa/src/views/ShowView.vue +20 -9
  28. package/dist/spa/tailwind.config.js +5 -2
  29. package/modules/styles.ts +2 -2
  30. package/package.json +1 -1
  31. package/spa/src/components/ResourceListTable.vue +12 -9
  32. package/dist/spa/spa/src/views/HomeView.vue +0 -8
  33. package/dist/spa/src/views/HomeView.vue +0 -8
@@ -65,7 +65,7 @@
65
65
  </BreadcrumbsWithButtons>
66
66
 
67
67
  <!-- table -->
68
- <div class="relative overflow-x-auto shadow-md sm:rounded-lg dark:shadow-2xl">
68
+ <div class="relative overflow-x-auto shadow-list-table-shadow dark:shadow-black dark:s">
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-gray-700 bg-gray-50 dark:bg-gray-700 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">
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-white border-b dark:bg-gray-800 dark:border-gray-700">
130
+ <tr v-if="!rows" class="bg-list-view-table-bg 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-white border-b dark:bg-gray-800 dark:border-gray-700">
174
+ <tr v-else-if="rows.length === 0" class="bg-list-view-table-bg 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-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600">
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">
189
189
  <td class="w-4 p-4">
190
190
  <div class="flex items center">
191
191
  <input
@@ -198,7 +198,12 @@
198
198
  </div>
199
199
  </td>
200
200
  <td v-for="c in columnsListed" class="px-6 py-4">
201
- <ValueRenderer :column="c" :row="row"/>
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
+ />
202
207
  </td>
203
208
  <td class="flex items-center px-6 py-4">
204
209
 
@@ -310,29 +315,28 @@
310
315
  </template>
311
316
 
312
317
  <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 {initFlowbite} from 'flowbite'
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';
320
325
 
321
326
  import ValueRenderer from '@/components/ValueRenderer.vue';
327
+ import { getCustomComponent } from '@/utils';
322
328
 
323
329
  import {
324
- IconChevronDoubleLeftOutline,
325
- IconChevronDoubleRightOutline,
326
- IconInboxFullSolid,
327
- IconInboxOutline,
328
- IconPlusOutline
330
+ IconInboxOutline,
331
+ IconPlusOutline
329
332
  } from '@iconify-prerendered/vue-flowbite';
330
333
 
331
334
  import {
332
- IconEyeSolid,
333
- IconTrashBinSolid,
334
- IconPenSolid,
335
- IconFilterOutline, IconBanOutline
335
+ IconBanOutline,
336
+ IconEyeSolid,
337
+ IconFilterOutline,
338
+ IconPenSolid,
339
+ IconTrashBinSolid
336
340
  } from '@iconify-prerendered/vue-flowbite';
337
341
 
338
342
  import Filters from '@/components/Filters.vue';
@@ -357,7 +361,6 @@ const totalRows = ref(0);
357
361
  const allCheckedActions = ref([]);
358
362
  const allowedActions = ref({});
359
363
 
360
-
361
364
  const DEFAULT_PAGE_SIZE = 10;
362
365
 
363
366
  const columnsListed = computed(() => coreStore.resourceColumns?.filter(c => c.showIn.includes('list')));
@@ -376,6 +379,7 @@ async function selectAll(value) {
376
379
 
377
380
  const pageSize = computed(() => coreStore.resourceById[route.params.resourceId]?.pageSize || DEFAULT_PAGE_SIZE);
378
381
  const totalPages = computed(() => Math.ceil(totalRows.value / pageSize.value));
382
+ let listComponentsPerColumn = {};
379
383
  const allFromThisPageChecked = computed(() => {
380
384
  if (!rows.value) return false;
381
385
  return rows.value.every((r) => checkboxes.value.includes(r.id));
@@ -419,6 +423,7 @@ async function getList() {
419
423
  path: '/get_resource_data',
420
424
  method: 'POST',
421
425
  body: {
426
+ source: 'list',
422
427
  resourceId: route.params.resourceId,
423
428
  limit: pageSize.value,
424
429
  offset: (page.value - 1) * pageSize.value,
@@ -426,7 +431,14 @@ async function getList() {
426
431
  sort: sort.value,
427
432
  }
428
433
  });
429
- fetchStatus.value.pending = false;
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;
430
442
  rows.value = data.data?.map(row => {
431
443
  row._primaryKeyValue = row[coreStore.resourceColumns.find(c => c.primaryKey).name];
432
444
  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">
14
+ <div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black" >
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>
2
+ <div :key="`${$route?.params.resourceId}---${$route?.params.primaryKey}`">
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-md sm:rounded-lg"
30
+ class="relative overflow-x-auto shadow-resourse-form-shadow "
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-gray-50 dark:bg-gray-700 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">
34
34
  <tr>
35
35
  <th scope="col" class="px-6 py-3">
36
36
  Field
@@ -42,13 +42,17 @@
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="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 border-b dark:border-gray-700"
45
+ class="bg-form-view-bg odd:dark:bg-gray-900 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
- <ValueRenderer :column="column" :row="coreStore.record" />
51
+ <component
52
+ :is="showComponentsPerColumn[column.name] || ValueRenderer"
53
+ :column="column"
54
+ :row="coreStore.record"
55
+ />
52
56
  </td>
53
57
  </tr>
54
58
 
@@ -63,18 +67,19 @@
63
67
 
64
68
  <script setup>
65
69
 
66
- import { ref, computed, onMounted } from 'vue';
67
- import { useRoute } from 'vue-router';
68
- import { callAdminForthApi } from '@/utils';
69
70
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
70
- import { IconPenSolid, IconTrashBinSolid } from '@iconify-prerendered/vue-flowbite';
71
- import { useCoreStore } from '@/stores/core';
72
71
  import ValueRenderer from '@/components/ValueRenderer.vue';
72
+ import { useCoreStore } from '@/stores/core';
73
+ import { getCustomComponent } from '@/utils';
74
+ import { IconPenSolid, IconTrashBinSolid } from '@iconify-prerendered/vue-flowbite';
75
+ import { onMounted, ref } from 'vue';
76
+ import { useRoute } from 'vue-router';
73
77
 
74
78
 
75
79
  const item = ref(null);
76
80
  const route = useRoute();
77
81
  const loading = ref(false);
82
+ let showComponentsPerColumn = {};
78
83
 
79
84
  const coreStore = useCoreStore();
80
85
 
@@ -87,6 +92,12 @@ onMounted(async () => {
87
92
  resourceId: route.params.resourceId,
88
93
  primaryKey: route.params.primaryKey,
89
94
  });
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
+ }, {});
90
101
  loading.value = false;
91
102
  });
92
103
 
@@ -1,9 +1,12 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  export default {
3
- content: ["./src/**/*.{vue, js}", "./node_modules/flowbite/**/*.js"],
3
+ content: ["./src/**/*.{vue, js}","./src/*.{vue, js}", "./index.html", "./node_modules/flowbite/**/*.js"],
4
4
  theme: {
5
- extend: {},
5
+ extend: {
6
+ /* IMPORTANT:ADMINFORTH TAILWIND STYLES */
7
+ }
6
8
  },
9
+
7
10
  darkMode: 'class',
8
11
  plugins: [
9
12
  require('flowbite/plugin'),
package/modules/styles.ts CHANGED
@@ -38,7 +38,7 @@ export const styles = () => ({
38
38
 
39
39
  lightForm: "#FFFFFF", // show view background
40
40
  lightFormBorder: "#F5F5F5", // show view rows border
41
- lightFormHeading: "#EDEDED", // show view heading
41
+ lightFormHeading: "rgb(249 250 251)", // show view heading
42
42
 
43
43
 
44
44
  // colors for dark theme
@@ -79,7 +79,7 @@ export const styles = () => ({
79
79
 
80
80
  darkForm: "#111111",
81
81
  darkFormBorder: "#222222",
82
- darkFormHeading: "#333333"
82
+ darkFormHeading: "#334155"
83
83
 
84
84
  },
85
85
  boxShadow: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.1.52",
3
+ "version": "1.1.53",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -300,15 +300,18 @@ function addToCheckedValues(id) {
300
300
  const columnsListed = computed(() => props.resource?.columns?.filter(c => c.showIn.includes('list')));
301
301
 
302
302
  async function selectAll(value) {
303
- props.rows.forEach((r) => {
304
- if (!checkboxesInternal.value.includes(r.id)) {
305
- checkboxesInternal.value.push(r.id)
306
- } else {
307
- checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== r.id)
308
- }
309
- });
310
- checkboxesInternal.value = [ ...checkboxesInternal.value ]
311
- // checkboxes.value = rows.value.map((v) => v.id);
303
+ if (!allFromThisPageChecked.value) {
304
+ props.rows.forEach((r) => {
305
+ if (!checkboxesInternal.value.includes(r.id)) {
306
+ checkboxesInternal.value.push(r.id)
307
+ }
308
+ });
309
+ }
310
+ else {
311
+ props.rows.forEach((r) => {
312
+ checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== r.id);
313
+ });
314
+ }
312
315
  }
313
316
 
314
317
  const totalPages = computed(() => Math.ceil(props.totalRows / props.pageSize));
@@ -1,8 +0,0 @@
1
- <script setup lang="ts">
2
- </script>
3
-
4
- <template>
5
- <main>
6
- 123
7
- </main>
8
- </template>
@@ -1,8 +0,0 @@
1
- <script setup lang="ts">
2
- </script>
3
-
4
- <template>
5
- <main>
6
- 123
7
- </main>
8
- </template>