adminforth 1.5.8 → 1.5.9-next.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.
@@ -0,0 +1,3 @@
1
+ import type { FrontendAPIInterface } from "./types/FrontendAPI";
2
+
3
+ export default window.adminforth as FrontendAPIInterface;
@@ -48,9 +48,10 @@
48
48
 
49
49
  <script setup lang="ts">
50
50
  import { humanifySize } from '@/utils';
51
- import { ref } from 'vue';
51
+ import { ref, type Ref } from 'vue';
52
52
  import { IconFileSolid } from '@iconify-prerendered/vue-flowbite';
53
53
  import { watch } from 'vue';
54
+ import adminforth from '@/adminforth';
54
55
 
55
56
  const props = defineProps<{
56
57
  extensions: string[],
@@ -93,14 +94,14 @@ function doEmit(filesIn: FileList) {
93
94
  const size = file.size;
94
95
 
95
96
  if (!allowedExtensions.includes(`.${extension}`)) {
96
- window.adminforth.alert({
97
+ adminforth.alert({
97
98
  message: `Sorry, the file type .${extension} is not allowed. Please upload a file with one of the following extensions: ${allowedExtensions.join(', ')}`,
98
99
  variant: 'danger',
99
100
  });
100
101
  return;
101
102
  }
102
103
  if (size > maxSizeBytes) {
103
- window.adminforth.alert({
104
+ adminforth.alert({
104
105
  message: `Sorry, the file size ${humanifySize(size)} exceeds the maximum allowed size of ${humanifySize(maxSizeBytes)}.`,
105
106
  variant: 'danger',
106
107
  });
@@ -10,11 +10,12 @@
10
10
 
11
11
  </template>
12
12
 
13
- <script setup>
13
+ <script setup lang="ts">
14
+
14
15
  import { computed, ref, onMounted, nextTick } from 'vue';
15
16
  import { IconFileCopyAltSolid } from '@iconify-prerendered/vue-flowbite';
16
17
  import Tooltip from '@/afcl/Tooltip.vue';
17
-
18
+ import adminforth from '@/adminforth';
18
19
 
19
20
  const visualValue = computed(() => {
20
21
  // if lenght is more then 8, show only first 4 and last 4 characters, ... in the middle
@@ -31,7 +32,7 @@ const id = ref();
31
32
 
32
33
  function copyToCB() {
33
34
  navigator.clipboard.writeText(props.record[props.column.name]);
34
- window.adminforth.alert({
35
+ adminforth.alert({
35
36
  message: 'ID copied to clipboard',
36
37
  variant: 'success',
37
38
  })
@@ -10,11 +10,12 @@
10
10
 
11
11
  </template>
12
12
 
13
- <script setup>
13
+ <script setup lang="ts">
14
+
14
15
  import { computed, ref, onMounted, nextTick } from 'vue';
15
16
  import { IconFileCopyAltSolid } from '@iconify-prerendered/vue-flowbite';
16
17
  import Tooltip from '@/afcl/Tooltip.vue';
17
-
18
+ import adminforth from '@/adminforth';
18
19
 
19
20
  const visualValue = computed(() => {
20
21
  // if lenght is more then 8, show only first 4 and last 4 characters, ... in the middle
@@ -31,7 +32,7 @@ const id = ref();
31
32
 
32
33
  function copyToCB() {
33
34
  navigator.clipboard.writeText(props.record[props.column.name]);
34
- window.adminforth.alert({
35
+ adminforth.alert({
35
36
  message: 'ID copied to clipboard',
36
37
  variant: 'success',
37
38
  })
@@ -57,7 +57,9 @@ const countryName = computed(() => {
57
57
 
58
58
  // border radius for background
59
59
  border-radius: 2px;
60
- box-shadow: inset -0.3px -0.3px 0.3px 0px rgba(0 0 0 / 0.2), inset 0.3px 0.3px 0.3px 0px rgba(255 255 255 / 0.2);
60
+ box-shadow: inset -0.3px -0.3px 0.3px 0px rgba(0 0 0 / 0.2),
61
+ inset 0.3px 0.3px 0.3px 0px rgba(255 255 255 / 0.2),
62
+ 0px 0px 3px #00000030;
61
63
  }
62
64
 
63
65
  </style>
@@ -5,7 +5,7 @@ import router from "./router";
5
5
  import { useCoreStore } from './stores/core';
6
6
  import { useUserStore } from './stores/user';
7
7
  import { Dropdown } from 'flowbite';
8
-
8
+ import adminforth from './adminforth';
9
9
 
10
10
  const LS_LANG_KEY = `afLanguage`;
11
11
 
@@ -31,7 +31,7 @@ export async function callApi({path, method, body=undefined}: {
31
31
  }
32
32
  return await r.json();
33
33
  } catch(e){
34
- window.adminforth.alert({variant:'danger', message:window.i18n?.global?.t('Something went wrong, please try again later'),})
34
+ adminforth.alert({variant:'danger', message: window.i18n?.global?.t('Something went wrong, please try again later'),})
35
35
  console.error(`error in callApi ${path}`,e);
36
36
  }
37
37
  }
@@ -72,7 +72,7 @@
72
72
  </template>
73
73
 
74
74
 
75
- <script setup>
75
+ <script setup lang="ts">
76
76
 
77
77
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
78
78
  import ResourceForm from '@/components/ResourceForm.vue';
@@ -85,6 +85,7 @@ import { useRoute, useRouter } from 'vue-router';
85
85
  import { computed } from 'vue';
86
86
  import { showErrorTost } from '@/composables/useFrontendApi';
87
87
  import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
88
+ import adminforth from '@/adminforth';
88
89
 
89
90
 
90
91
  const isValid = ref(false);
@@ -155,7 +156,7 @@ async function saveRecord() {
155
156
  primaryKey: response.newRecordId
156
157
  }
157
158
  });
158
- window.adminforth.alert({
159
+ adminforth.alert({
159
160
  message: 'Record created successfully',
160
161
  variant: 'success'
161
162
  });
@@ -68,7 +68,7 @@
68
68
  </template>
69
69
 
70
70
 
71
- <script setup>
71
+ <script setup lang="ts">
72
72
 
73
73
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
74
74
  import ResourceForm from '@/components/ResourceForm.vue';
@@ -80,7 +80,7 @@ import { computed, onMounted, ref } from 'vue';
80
80
  import { useRoute, useRouter } from 'vue-router';
81
81
  import { showErrorTost } from '@/composables/useFrontendApi';
82
82
  import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
83
-
83
+ import adminforth from '@/adminforth';
84
84
 
85
85
  const coreStore = useCoreStore();
86
86
 
@@ -158,7 +158,7 @@ async function saveRecord() {
158
158
  if (resp.error) {
159
159
  showErrorTost(resp.error);
160
160
  } else {
161
- window.adminforth.alert({
161
+ adminforth.alert({
162
162
  message: 'Record updated successfully',
163
163
  variant: 'success',
164
164
  timeout: 400000
@@ -106,7 +106,7 @@
106
106
  </template>
107
107
 
108
108
 
109
- <script setup>
109
+ <script setup lang="ts">
110
110
 
111
111
  import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
112
112
 
@@ -119,6 +119,7 @@ import {callAdminForthApi} from '@/utils';
119
119
  import { showSuccesTost, showErrorTost } from '@/composables/useFrontendApi';
120
120
  import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
121
121
  import ShowTable from '@/components/ShowTable.vue';
122
+ import adminforth from "@/adminforth";
122
123
 
123
124
 
124
125
  const route = useRoute();
@@ -177,7 +178,7 @@ const otherColumns = computed(() => {
177
178
  });
178
179
 
179
180
  async function deleteRecord(row) {
180
- const data = await window.adminforth.confirm({
181
+ const data = await adminforth.confirm({
181
182
  message: 'Are you sure you want to delete this item?',
182
183
  yes: 'Delete',
183
184
  no: 'Cancel',
@@ -7,5 +7,5 @@
7
7
  {
8
8
  "path": "./tsconfig.app.json"
9
9
  }
10
- ]
10
+ ],
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.5.8",
3
+ "version": "1.5.9-next.0",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",