adminforth 1.4.3-next.3 → 1.4.3-next.30

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 (111) hide show
  1. package/commands/bundle.js +29 -0
  2. package/commands/generateModels.js +63 -0
  3. package/commands/utils.js +93 -0
  4. package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
  5. package/dist/dataConnectors/baseConnector.js +7 -2
  6. package/dist/dataConnectors/baseConnector.js.map +1 -1
  7. package/dist/dataConnectors/postgres.js +1 -1
  8. package/dist/dataConnectors/postgres.js.map +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +14 -3
  11. package/dist/index.js.map +1 -1
  12. package/dist/modules/codeInjector.d.ts +4 -2
  13. package/dist/modules/codeInjector.d.ts.map +1 -1
  14. package/dist/modules/codeInjector.js +93 -69
  15. package/dist/modules/codeInjector.js.map +1 -1
  16. package/dist/modules/configValidator.d.ts.map +1 -1
  17. package/dist/modules/configValidator.js +3 -1
  18. package/dist/modules/configValidator.js.map +1 -1
  19. package/dist/modules/restApi.d.ts.map +1 -1
  20. package/dist/modules/restApi.js +58 -25
  21. package/dist/modules/restApi.js.map +1 -1
  22. package/dist/modules/utils.d.ts.map +1 -1
  23. package/dist/modules/utils.js +0 -1
  24. package/dist/modules/utils.js.map +1 -1
  25. package/dist/servers/express.d.ts.map +1 -1
  26. package/dist/servers/express.js +4 -1
  27. package/dist/servers/express.js.map +1 -1
  28. package/dist/spa/package-lock.json +64 -4
  29. package/dist/spa/package.json +1 -0
  30. package/dist/spa/src/App.vue +15 -25
  31. package/dist/spa/src/afcl/Button.vue +27 -0
  32. package/dist/spa/src/afcl/Input.vue +41 -0
  33. package/dist/spa/src/afcl/Link.vue +9 -0
  34. package/dist/spa/src/afcl/Select.vue +206 -0
  35. package/dist/spa/src/afcl/index.ts +6 -0
  36. package/dist/spa/src/components/Filters.vue +11 -5
  37. package/dist/spa/src/components/GroupsTable.vue +23 -23
  38. package/dist/spa/src/components/ResourceListTable.vue +14 -14
  39. package/dist/spa/src/components/ValueRenderer.vue +3 -1
  40. package/dist/spa/src/renderers/CompactField.vue +1 -1
  41. package/dist/spa/src/renderers/CompactUUID.vue +1 -1
  42. package/dist/spa/src/renderers/CountryFlag.vue +3 -4
  43. package/dist/spa/src/renderers/HumanNumber.vue +3 -2
  44. package/dist/spa/src/renderers/RelativeTime.vue +3 -2
  45. package/dist/spa/src/router/index.ts +1 -1
  46. package/dist/spa/src/stores/core.ts +5 -4
  47. package/dist/spa/src/types/Back.ts +47 -13
  48. package/dist/spa/src/views/ListView.vue +1 -0
  49. package/dist/spa/src/views/LoginView.vue +4 -15
  50. package/dist/spa/vite.config.ts +16 -34
  51. package/dist/types/Back.d.ts +26 -6
  52. package/dist/types/Back.d.ts.map +1 -1
  53. package/dist/types/Back.js.map +1 -1
  54. package/package.json +4 -3
  55. package/dist/plugins/audit-log/types.d.ts +0 -35
  56. package/dist/plugins/audit-log/types.d.ts.map +0 -1
  57. package/dist/plugins/audit-log/types.js +0 -2
  58. package/dist/plugins/audit-log/types.js.map +0 -1
  59. package/dist/plugins/chat-gpt/types.d.ts +0 -82
  60. package/dist/plugins/chat-gpt/types.d.ts.map +0 -1
  61. package/dist/plugins/chat-gpt/types.js +0 -2
  62. package/dist/plugins/chat-gpt/types.js.map +0 -1
  63. package/dist/plugins/email-password-reset/types.d.ts +0 -28
  64. package/dist/plugins/email-password-reset/types.d.ts.map +0 -1
  65. package/dist/plugins/email-password-reset/types.js +0 -2
  66. package/dist/plugins/email-password-reset/types.js.map +0 -1
  67. package/dist/plugins/foreign-inline-list/types.d.ts +0 -19
  68. package/dist/plugins/foreign-inline-list/types.d.ts.map +0 -1
  69. package/dist/plugins/foreign-inline-list/types.js +0 -2
  70. package/dist/plugins/foreign-inline-list/types.js.map +0 -1
  71. package/dist/plugins/import-export/types.d.ts +0 -3
  72. package/dist/plugins/import-export/types.d.ts.map +0 -1
  73. package/dist/plugins/import-export/types.js +0 -2
  74. package/dist/plugins/import-export/types.js.map +0 -1
  75. package/dist/plugins/rich-editor/custom/async-queue.d.ts +0 -8
  76. package/dist/plugins/rich-editor/custom/async-queue.d.ts.map +0 -1
  77. package/dist/plugins/rich-editor/custom/async-queue.js +0 -29
  78. package/dist/plugins/rich-editor/custom/async-queue.js.map +0 -1
  79. package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts +0 -8
  80. package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts.map +0 -1
  81. package/dist/plugins/rich-editor/dist/custom/async-queue.js +0 -29
  82. package/dist/plugins/rich-editor/dist/custom/async-queue.js.map +0 -1
  83. package/dist/plugins/rich-editor/types.d.ts +0 -153
  84. package/dist/plugins/rich-editor/types.d.ts.map +0 -1
  85. package/dist/plugins/rich-editor/types.js +0 -16
  86. package/dist/plugins/rich-editor/types.js.map +0 -1
  87. package/dist/plugins/two-factors-auth/types.d.ts +0 -18
  88. package/dist/plugins/two-factors-auth/types.d.ts.map +0 -1
  89. package/dist/plugins/two-factors-auth/types.js +0 -2
  90. package/dist/plugins/two-factors-auth/types.js.map +0 -1
  91. package/dist/plugins/upload/types.d.ts +0 -132
  92. package/dist/plugins/upload/types.d.ts.map +0 -1
  93. package/dist/plugins/upload/types.js +0 -2
  94. package/dist/plugins/upload/types.js.map +0 -1
  95. package/dist/spa/src/components/Dropdown.vue +0 -167
  96. package/dist/spa/src/types/AdminForthConfig.js +0 -150
  97. package/dist/spa/src/types/AdminForthConfig.ts +0 -1816
  98. package/dist/spa/src/types/Commons.ts +0 -702
  99. package/dist/spa/src/types/FrontAndBack.ts +0 -698
  100. package/dist/types/AdminForthConfig.d.ts +0 -1665
  101. package/dist/types/AdminForthConfig.d.ts.map +0 -1
  102. package/dist/types/AdminForthConfig.js +0 -146
  103. package/dist/types/AdminForthConfig.js.map +0 -1
  104. package/dist/types/Commons.d.ts +0 -616
  105. package/dist/types/Commons.d.ts.map +0 -1
  106. package/dist/types/Commons.js +0 -65
  107. package/dist/types/Commons.js.map +0 -1
  108. package/dist/types/FrontAndBack.d.ts +0 -613
  109. package/dist/types/FrontAndBack.d.ts.map +0 -1
  110. package/dist/types/FrontAndBack.js +0 -62
  111. package/dist/types/FrontAndBack.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div v-if="defaultLayout" >
2
+ <div>
3
3
  <nav
4
- v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
4
+ v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady && defaultLayout"
5
5
  class="fixed h-14 top-0 z-20 w-full border-b shadow-sm bg-lightNavbar shadow-headerShadow dark:bg-darkNavbar dark:border-darkSidebarDevider"
6
6
  >
7
7
  <div class="px-3 lg:px-5 lg:pl-3 flex items-center justify-between h-full w-full" >
@@ -66,9 +66,7 @@
66
66
  </nav>
67
67
 
68
68
  <aside
69
-
70
- v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
71
-
69
+ v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady && defaultLayout"
72
70
  id="logo-lightSidebar" class="fixed border-none top-0 left-0 z-20 w-64 h-screen transition-transform bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder sm:translate-x-0 dark:bg-darkSidebar dark:border-darkSidebarBorder"
73
71
  :class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
74
72
  aria-label="Sidebar"
@@ -162,18 +160,18 @@
162
160
  />
163
161
  </div>
164
162
  </aside>
165
-
166
163
 
167
164
  <div class="sm:ml-64 max-w-[100vw] sm:max-w-[calc(100%-16rem)]"
168
- v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
165
+ v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady && defaultLayout">
169
166
  <div class="p-0 dark:border-gray-700 mt-14">
170
167
  <RouterView/>
171
168
  </div>
172
169
  </div>
173
170
 
174
- <div v-else-if="routerIsReady && loginRedirectCheckIsReady">
171
+ <div v-else-if="routerIsReady && loginRedirectCheckIsReady && publicConfigLoaded">
175
172
  <RouterView/>
176
173
  </div>
174
+
177
175
  <div v-else class="flex items-center justify-center h-screen">
178
176
  <div class="text-3xl text-gray-400 animate-bounce">
179
177
  <svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
@@ -196,23 +194,8 @@
196
194
 
197
195
  drawer-backdrop="" class="bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-5"></div>
198
196
 
199
-
200
- </div>
201
- <div v-else>
202
- <div v-if="routerIsReady && loginRedirectCheckIsReady">
203
- <RouterView/>
204
- </div>
205
- <AcceptModal />
206
- <div v-if="toastStore.toasts.length>0" class="fixed bottom-5 right-5 flex gap-1 flex-col-reverse">
207
- <transition-group
208
- name="fade"
209
- tag="div"
210
- class="flex flex-col-reverse gap-1"
211
- >
212
- <Toast :toast="t" @close="toastStore.removeToast(t)" v-for="(t,i) in toastStore.toasts" :key="`t-${t.id}`" ></Toast>
213
- </transition-group>
214
- </div>
215
197
  </div>
198
+
216
199
  </template>
217
200
 
218
201
  <style lang="scss" scoped>
@@ -236,7 +219,7 @@
236
219
  </style>
237
220
 
238
221
  <script setup lang="ts">
239
- import { computed, onMounted, ref, watch, onBeforeMount } from 'vue';
222
+ import { computed, onMounted, ref, watch, onBeforeMount, nextTick } from 'vue';
240
223
  import { RouterView } from 'vue-router';
241
224
  import { Dropdown } from 'flowbite'
242
225
  import './index.scss'
@@ -272,6 +255,7 @@ const router = useRouter();
272
255
  const title = ref('');
273
256
  //create a ref to store the opened menu items with ts type;
274
257
  const opened = ref<string[]>([]);
258
+ const publicConfigLoaded = ref(false);
275
259
 
276
260
 
277
261
  const routerIsReady = ref(false);
@@ -362,9 +346,15 @@ watch([loggedIn, routerIsReady, loginRedirectCheckIsReady], ([l,r,lr]) => {
362
346
  }
363
347
  })
364
348
 
349
+ async function loadPublicConfig() {
350
+ await coreStore.getPublicConfig();
351
+ publicConfigLoaded.value = true;
352
+ }
353
+
365
354
  // initialize components based on data attribute selectors
366
355
  onMounted(async () => {
367
356
  loadMenu(); // run this in async mode
357
+ loadPublicConfig(); // and this
368
358
  // before init flowbite we have to wait router initialized because it affects dom(our v-ifs) and fetch menu
369
359
  await initRouter()
370
360
  handleCustomLayout()
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <button
3
+ v-bind="$attrs"
4
+ type="submit"
5
+ class="flex items-center justify-center gap-1 text-lightPrimaryContrast bg-lightPrimary dark:bg-darkPrimary hover:brightness-110
6
+ focus:ring-4 focus:outline-none focus:ring-lightPrimary focus:ring-opacity-50 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-darkPrimary dark:focus:ring-opacity-50"
7
+ :class="{
8
+ 'cursor-default': props.disabled,
9
+ 'opacity-50': props.disabled,
10
+ 'pointer-events-none': props.disabled,
11
+ }"
12
+ >
13
+ <svg v-if="props.loader"
14
+ aria-hidden="true" class="w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-lightPrimary dark:fill-darkPrimary"
15
+ viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
16
+ <slot></slot>
17
+ </button>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+
22
+ const props = defineProps({
23
+ loader: Boolean,
24
+ disabled: Boolean,
25
+ });
26
+
27
+ </script>
@@ -0,0 +1,41 @@
1
+ <template>
2
+
3
+ <div class="flex z-0">
4
+ <span
5
+ v-if="$slots.prefix"
6
+ class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-s-0 border-gray-300 rounded-e-md dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600">
7
+ <slot name="prefix"></slot>
8
+ </span>
9
+
10
+ <!-- translate needed for bumping ring above prefix without z-index -->
11
+ <input
12
+ v-bind="$attrs"
13
+ :type="type"
14
+ @input="$emit('update:modelValue', $event.target.value)"
15
+ :value="modelValue"
16
+ aria-describedby="helper-text-explanation"
17
+ class="inline-flex bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-0 focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary
18
+ blue-500 focus:border-blue-500 block w-20 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white translate-y-0"
19
+ :class="{'rounded-l-md': !$slots.prefix, 'rounded-r-md': !$slots.suffix}"
20
+ >
21
+
22
+
23
+ <span
24
+ v-if="$slots.suffix"
25
+ class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-s-0 border-gray-300 rounded-e-md dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 ">
26
+ <slot name="suffix"></slot>
27
+ </span>
28
+
29
+ </div>
30
+ </template>
31
+
32
+ <script setup lang="ts">
33
+
34
+ const props = defineProps({
35
+ type: String,
36
+ modelValue: String,
37
+ })
38
+
39
+
40
+ </script>
41
+
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <router-link
3
+ v-bind="$attrs"
4
+ class="text-lightPrimary underline dark:text-darkPrimary hover:no-underline hover:brightness-110
5
+ cursor-pointer"
6
+ >
7
+ <slot></slot>
8
+ </router-link>
9
+ </template>
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <div class="relative inline-block afcl-select">
3
+ <div class="relative">
4
+ <input
5
+ type="text"
6
+ v-model="search"
7
+ @click="inputClick"
8
+ @input="inputInput"
9
+ class="block w-full pl-3 pr-10 py-2.5 border border-gray-300 rounded-md leading-5 bg-gray-50 placeholder-gray-500 sm:text-sm transition duration-150 ease-in-out dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary"
10
+ :placeholder="
11
+ selectedItems.length && !multiple ? '' : (showDropdown ? 'Search' : placeholder || 'Select...')
12
+ "
13
+ />
14
+
15
+ <div v-if="!multiple && selectedItems.length" class="absolute pointer-events-none inset-y-0 left-2 flex items-center pr-2 px-1">
16
+ <slot
17
+ name="selected-item"
18
+ :option="selectedItems[0]"
19
+ ></slot>
20
+ <span v-if="!$slots['selected-item']" class="text-lightPrimary dark:text-white font-medium ">
21
+ {{ selectedItems[0]?.label }}
22
+ </span>
23
+ </div>
24
+
25
+ <div class="absolute inset-y-0 right-2 flex items-center pointer-events-none">
26
+ <!-- triangle icon -->
27
+ <IconCaretDownSolid class="h-5 w-5 text-lightPrimary dark:text-gray-400 opacity-50 transition duration-150 ease-in"
28
+ :class="{ 'transform rotate-180': showDropdown }"
29
+ />
30
+ </div>
31
+ </div>
32
+ <div v-if="showDropdown" class="absolute z-10 mt-1 w-full bg-white shadow-lg dark:shadow-black dark:bg-gray-700 dark:border-gray-600 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm max-h-96">
33
+ <div
34
+ v-for="item in filteredItems"
35
+ :key="item.value"
36
+ class="px-4 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-400"
37
+ :class="{ 'bg-lightPrimaryOpacity dark:bg-darkPrimaryOpacity': selectedItems.includes(item) }"
38
+ @click="toogleItem(item)"
39
+ >
40
+ <slot name="item" :option="item"></slot>
41
+ <label v-if="!$slots.item" :for="item.value">{{ item.label }}</label>
42
+ </div>
43
+ <div v-if="!filteredItems.length" class="px-4 py-2 cursor-pointer text-gray-400 dark:text-gray-300">
44
+ No results found
45
+ </div>
46
+ </div>
47
+
48
+ <div v-if="multiple && selectedItems.length"
49
+ class="inset-y-0 left-2 flex items-center pr-2 flex-wrap gap-y-2 py-2"
50
+ >
51
+ <template v-for="item in selectedItems" :key="`afcl-select-${item.value}`">
52
+ <slot name="selected-item" :item="item"></slot>
53
+ <div v-if="!$slots['selected-item']"
54
+ class="bg-lightPrimaryOpacity text-lightPrimary text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-darkPrimaryOpacity dark:text-darkPrimary">
55
+ <span>{{ item.label }}</span>
56
+ <button
57
+ type="button"
58
+ @click="toogleItem(item)"
59
+ class="z-index-100 flex-shrink-0 ml-1 h-4 w-4 -mr-1 rounded-full inline-flex items-center justify-center text-gray-400 hover:text-gray-500 focus:outline-none focus:text-gray-500 focus:bg-gray-100"
60
+ >
61
+ <span class="sr-only">Remove item</span>
62
+ <svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
63
+ <path
64
+ stroke-linecap="round"
65
+ stroke-linejoin="round"
66
+ stroke-width="1.5"
67
+ d="M1 1l6 6m0-6L1 7"
68
+ />
69
+ </svg>
70
+ </button>
71
+ </div>
72
+ </template>
73
+ </div>
74
+ </div>
75
+ </template>
76
+
77
+ <script setup lang="ts">
78
+ import { ref, computed, onMounted, onUnmounted, watch, type Ref } from 'vue';
79
+ import { IconCaretDownSolid } from '@iconify-prerendered/vue-flowbite';
80
+
81
+
82
+ const props = defineProps({
83
+ options: Array,
84
+ modelValue: {
85
+ default: undefined,
86
+ },
87
+ multiple: {
88
+ type: Boolean,
89
+ default: false,
90
+ },
91
+ placeholder: {
92
+ type: String,
93
+ default: '',
94
+ },
95
+ });
96
+
97
+ const emit = defineEmits(['update:modelValue']);
98
+
99
+ const search = ref('');
100
+ const showDropdown = ref(false);
101
+
102
+ const selectedItems: Ref<any[]> = ref([]);
103
+
104
+ function inputInput() {
105
+ if (!props.multiple && selectedItems.value.length) {
106
+ selectedItems.value = [];
107
+ emit('update:modelValue', null);
108
+ }
109
+ }
110
+
111
+ function updateFromProps() {
112
+ if (props.modelValue !== undefined) {
113
+ if (!props.multiple) {
114
+ const el = props.options.find(item => item.value === props.modelValue);
115
+ if (el) {
116
+ selectedItems.value = [el];
117
+ } else {
118
+ selectedItems.value = [];
119
+ }
120
+ } else {
121
+ selectedItems.value = props.options.filter(item => props.modelValue.includes(item.value));
122
+ }
123
+ }
124
+ }
125
+
126
+ function inputClick() {
127
+ if (!showDropdown.value) {
128
+ showDropdown.value = true;
129
+ } else {
130
+ if (!search.value) {
131
+ showDropdown.value = false;
132
+ }
133
+ }
134
+ }
135
+
136
+ onMounted(() => {
137
+ updateFromProps();
138
+
139
+ watch(() => props.modelValue, (value) => {
140
+ updateFromProps();
141
+ });
142
+
143
+ watch(() => props.options, () => {
144
+ updateFromProps();
145
+ });
146
+
147
+ addClickListener();
148
+
149
+ });
150
+
151
+ const filteredItems = computed(() => {
152
+ return props.options.filter(item =>
153
+ item.label.toLowerCase().includes(search.value.toLowerCase())
154
+ );
155
+ });
156
+
157
+ const handleClickOutside = (event) => {
158
+ if (!event.target.closest('.afcl-select')) {
159
+ showDropdown.value = false;
160
+ }
161
+ };
162
+
163
+ const addClickListener = () => {
164
+ document.addEventListener('click', handleClickOutside);
165
+ };
166
+
167
+ const removeClickListener = () => {
168
+ document.removeEventListener('click', handleClickOutside);
169
+ };
170
+
171
+ const toogleItem = (item) => {
172
+ if (selectedItems.value.includes(item)) {
173
+ selectedItems.value = selectedItems.value.filter(i => i !== item);
174
+ } else {
175
+ if (!props.multiple) {
176
+ selectedItems.value = [item];
177
+ } else {
178
+ selectedItems.value = [...selectedItems.value, item];
179
+ }
180
+ }
181
+ if (!props.multiple) {
182
+ showDropdown.value = false;
183
+ }
184
+ if (!props.multiple && search.value) {
185
+ search.value = '';
186
+ }
187
+
188
+ const list = selectedItems.value.map(item => item.value);
189
+ const updValue = list.length ? list : null;
190
+ let emitValue;
191
+ if (!props.multiple) {
192
+ emitValue = updValue ? updValue[0] : null;
193
+ } else {
194
+ emitValue = updValue;
195
+ }
196
+ emit('update:modelValue', emitValue);
197
+
198
+ };
199
+
200
+
201
+ onUnmounted(() => {
202
+ removeClickListener();
203
+ });
204
+
205
+
206
+ </script>
@@ -0,0 +1,6 @@
1
+
2
+
3
+ export { default as Select } from './Select.vue';
4
+ export { default as Link } from './Link.vue';
5
+ export { default as Button } from './Button.vue';
6
+ export { default as Input } from './Input.vue';
@@ -11,7 +11,7 @@
11
11
  <h5 id="drawer-navigation-label" class="text-base font-semibold text-gray-500 uppercase dark:text-gray-400">
12
12
  Filters
13
13
 
14
- <button type="button" @click="$emit('hide')" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute end-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" >
14
+ <button type="button" @click="$emit('hide')" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute end-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" >
15
15
  <svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
16
16
  <span class="sr-only">Close menu</span>
17
17
  </button>
@@ -22,23 +22,28 @@
22
22
  <li v-for="c in columnsWithFilter" :key="c">
23
23
  <p class="dark:text-gray-400">{{ c.label }}</p>
24
24
 
25
- <Dropdown
25
+ <Select
26
26
  v-if="c.foreignResource"
27
+ multiple
28
+ class="w-full"
27
29
  :options="columnOptions[c.name] || []"
28
30
  @update:modelValue="setFilterItem({ column: c, operator: 'in', value: $event || undefined })"
29
31
  :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === 'in')?.value || []"
30
32
  />
31
- <Dropdown
33
+ <Select
34
+ multiple
35
+ class="w-full"
32
36
  v-else-if="c.type === 'boolean'"
33
37
  :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }, { label: 'Unset', value: undefined }]"
34
38
  @update:modelValue="setFilterItem({ column: c, operator: 'in', value: $event || undefined })"
35
39
  :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === 'in')?.value || []"
36
40
  />
37
41
 
38
- <Dropdown
42
+ <Select
43
+ multiple
44
+ class="w-full"
39
45
  v-else-if="c.enum"
40
46
  :options="c.enum"
41
- :allowCustom="c.allowCustom"
42
47
  @update:modelValue="setFilterItem({ column: c, operator: 'in', value: $event || undefined })"
43
48
  :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === 'in')?.value || []"
44
49
  />
@@ -123,6 +128,7 @@ import { useRouter } from 'vue-router';
123
128
  import { computedAsync } from '@vueuse/core'
124
129
  import CustomRangePicker from "@/components/CustomRangePicker.vue";
125
130
  import { useFiltersStore } from '@/stores/filters';
131
+ import Select from '@/afcl/Select.vue';
126
132
 
127
133
  const filtersStore = useFiltersStore();
128
134
 
@@ -55,28 +55,28 @@
55
55
  />
56
56
  </template>
57
57
  <template v-else>
58
- <Dropdown
59
- single
60
- v-if="column.foreignResource"
61
- :options="columnOptions[column.name] || []"
62
- :placeholder = "columnOptions[column.name]?.length ?'Select...': 'There are no options available'"
63
- :modelValue="currentValues[column.name]"
64
- @update:modelValue="setCurrentValue(column.name, $event)"
65
- ></Dropdown>
66
- <Dropdown
67
- single
68
- v-else-if="column.enum"
69
- :options="column.enum"
70
- :modelValue="currentValues[column.name]"
71
- @update:modelValue="setCurrentValue(column.name, $event)"
72
- />
73
- <Dropdown
74
- single
75
- v-else-if="column.type === 'boolean'"
76
- :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }, { label: 'Unset', value: null }]"
77
- :modelValue="currentValues[column.name]"
78
- @update:modelValue="setCurrentValue(column.name, $event)"
79
- />
58
+ <Select
59
+ class="w-full"
60
+ v-if="column.foreignResource"
61
+ :options="columnOptions[column.name] || []"
62
+ :placeholder = "columnOptions[column.name]?.length ?'Select...': 'There are no options available'"
63
+ :modelValue="currentValues[column.name]"
64
+ @update:modelValue="setCurrentValue(column.name, $event)"
65
+ ></Select>
66
+ <Select
67
+ class="w-full"
68
+ v-else-if="column.enum"
69
+ :options="column.enum"
70
+ :modelValue="currentValues[column.name]"
71
+ @update:modelValue="setCurrentValue(column.name, $event)"
72
+ ></Select>
73
+ <Select
74
+ class="w-full"
75
+ v-else-if="column.type === 'boolean'"
76
+ :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }, { label: 'Unset', value: null }]"
77
+ :modelValue="currentValues[column.name]"
78
+ @update:modelValue="setCurrentValue(column.name, $event)"
79
+ ></Select>
80
80
  <input
81
81
  v-else-if="['integer'].includes(column.type)"
82
82
  type="number"
@@ -153,7 +153,7 @@
153
153
  <script setup>
154
154
  import { IconExclamationCircleSolid, IconEyeSlashSolid, IconEyeSolid } from '@iconify-prerendered/vue-flowbite';
155
155
  import CustomDatePicker from "@/components/CustomDatePicker.vue";
156
- import Dropdown from '@/components/Dropdown.vue';
156
+ import Select from '@/afcl/Select.vue';
157
157
  import AfTooltip from "./AfTooltip.vue";
158
158
  import { getCustomComponent } from '@/utils';
159
159
 
@@ -160,9 +160,9 @@
160
160
  </template>
161
161
  </AfTooltip>
162
162
 
163
- <template v-if="coreStore.resourceOptions?.pageInjections?.list?.customActionIcons">
163
+ <template v-if="customActionsInjection">
164
164
  <component
165
- v-for="c in coreStore.resourceOptions?.pageInjections?.list?.customActionIcons"
165
+ v-for="c in customActionsInjection"
166
166
  :is="getCustomComponent(c)"
167
167
  :meta="c.meta"
168
168
  :resource="coreStore.resource"
@@ -244,7 +244,7 @@
244
244
  </div>
245
245
  </template>
246
246
 
247
- <script setup>
247
+ <script setup lang="ts">
248
248
 
249
249
 
250
250
  import { computed, onMounted, ref, watch } from 'vue';
@@ -270,17 +270,17 @@ import AfTooltip from './AfTooltip.vue';
270
270
 
271
271
  const coreStore = useCoreStore();
272
272
 
273
-
274
- const props = defineProps([
275
- 'page',
276
- 'resource',
277
- 'rows',
278
- 'totalRows',
279
- 'pageSize',
280
- 'checkboxes',
281
- 'sort',
282
- 'noRoundings'
283
- ])
273
+ const props = defineProps<{
274
+ page: number,
275
+ resource: any,
276
+ rows: any[],
277
+ totalRows: number,
278
+ pageSize: number,
279
+ checkboxes: any[],
280
+ sort: any[],
281
+ noRoundings: boolean,
282
+ customActionsInjection: any[],
283
+ }>();
284
284
 
285
285
  // emits, update page
286
286
  const emits = defineEmits([
@@ -29,9 +29,11 @@
29
29
  <span v-else-if="column.type === 'richtext'">
30
30
  <div v-html="protectAgainstXSS(record[column.name])" class="allow-lists"></div>
31
31
  </span>
32
+ <span v-else-if="column.type === 'decimal'">
33
+ {{ checkEmptyValues(record[column.name] && parseFloat(record[column.name]), route.meta.type) }}
34
+ </span>
32
35
  <span v-else-if="column.type === 'json'">
33
36
  <JsonViewer :value="record[column.name]" :expandDepth="column.extra?.jsonCollapsedLevel" copyable sort :theme="coreStore.theme" />
34
-
35
37
  </span>
36
38
  <span v-else>
37
39
  {{ checkEmptyValues(record[column.name],route.meta.type) }}
@@ -25,7 +25,7 @@ const visualValue = computed(() => {
25
25
  return val;
26
26
  });
27
27
 
28
- const props = defineProps(['column', 'record', 'meta']);
28
+ const props = defineProps(['column', 'record', 'meta', 'resource', 'adminUser']);
29
29
 
30
30
  const id = ref();
31
31
 
@@ -25,7 +25,7 @@ const visualValue = computed(() => {
25
25
  return val;
26
26
  });
27
27
 
28
- const props = defineProps(['column', 'record', 'meta']);
28
+ const props = defineProps(['column', 'record', 'meta', 'resource', 'adminUser']);
29
29
 
30
30
  const id = ref();
31
31
 
@@ -51,14 +51,13 @@ const countryName = computed(() => {
51
51
  <style scoped lang="scss">
52
52
 
53
53
  .flag-icon {
54
- width: 2rem;
55
- height: 1.5rem;
54
+ width: 1.8rem;
55
+ height: 1.35rem;
56
56
  flex-shrink: 0;
57
57
 
58
58
  // border radius for background
59
59
  border-radius: 2px;
60
- // add some silkiness to the flag
61
- box-shadow: inset -1px -1px 0.5px 0px rgba(0 0 0 / 0.2), inset 1px 1px 0.5px 0px rgba(255 255 255 / 0.2);
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);
62
61
  }
63
62
 
64
63
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <AfTooltip class="flex items-center" >
2
+ <AfTooltip>
3
3
  {{ formattedValue }}
4
4
  <template #tooltip v-if="formattedValue">
5
5
  {{ formattedTooltipValue }}
@@ -11,7 +11,8 @@
11
11
  import { computed, ref, onMounted, nextTick } from 'vue';
12
12
  import AfTooltip from '@/components/AfTooltip.vue';
13
13
 
14
- const props = defineProps(['column', 'record']);
14
+ const props = defineProps(['column', 'record', 'meta', 'resource', 'adminUser']);
15
+
15
16
  const id = ref();
16
17
  const userLocale = ref(navigator.language || 'en-US');
17
18
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <AfTooltip class="flex items-center">
2
+ <AfTooltip>
3
3
  {{ relativeTime }}
4
4
  <template #tooltip v-if="relativeTime">
5
5
  {{ fullTime }}
@@ -14,11 +14,12 @@ import en from 'javascript-time-ago/locale/en';
14
14
  import TimeAgo from 'javascript-time-ago';
15
15
  import dayjs from 'dayjs';
16
16
 
17
+
17
18
  const id = ref();
18
19
 
19
20
  TimeAgo.addLocale(en);
20
21
 
21
- const props = defineProps(['column', 'record']);
22
+ const props = defineProps(['column', 'record', 'meta', 'resource', 'adminUser']);
22
23
 
23
24
  const userLocale = ref(navigator.language || 'en-US');
24
25
  const timeAgoFormatter = new TimeAgo(userLocale.value);
@@ -10,7 +10,7 @@ const router = createRouter({
10
10
  path: '/login',
11
11
  name: 'login',
12
12
  component: () => import('@/views/LoginView.vue'),
13
- meta: { title: 'login' },
13
+ meta: { title: 'login', customLayout: true },
14
14
  beforeEnter: async (to, from, next) => {
15
15
  if(localStorage.getItem('isAuthorized') === 'true'){
16
16
  next({name: 'home'})