adminforth 2.27.0-next.4 → 2.27.0-next.41

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 (60) hide show
  1. package/commands/callTsProxy.js +10 -5
  2. package/commands/createApp/templates/api.ts.hbs +12 -2
  3. package/commands/proxy.ts +18 -10
  4. package/dist/commands/proxy.js +14 -10
  5. package/dist/commands/proxy.js.map +1 -1
  6. package/dist/dataConnectors/clickhouse.d.ts +5 -2
  7. package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
  8. package/dist/dataConnectors/clickhouse.js +73 -9
  9. package/dist/dataConnectors/clickhouse.js.map +1 -1
  10. package/dist/modules/configValidator.d.ts.map +1 -1
  11. package/dist/modules/configValidator.js +16 -9
  12. package/dist/modules/configValidator.js.map +1 -1
  13. package/dist/modules/restApi.d.ts.map +1 -1
  14. package/dist/modules/restApi.js +77 -4
  15. package/dist/modules/restApi.js.map +1 -1
  16. package/dist/modules/styles.js +1 -1
  17. package/dist/servers/express.d.ts.map +1 -1
  18. package/dist/servers/express.js +4 -0
  19. package/dist/servers/express.js.map +1 -1
  20. package/dist/spa/package-lock.json +41 -0
  21. package/dist/spa/package.json +3 -0
  22. package/dist/spa/pnpm-lock.yaml +38 -0
  23. package/dist/spa/src/App.vue +77 -76
  24. package/dist/spa/src/afcl/Button.vue +2 -3
  25. package/dist/spa/src/afcl/Dialog.vue +1 -1
  26. package/dist/spa/src/afcl/Input.vue +1 -1
  27. package/dist/spa/src/afcl/Select.vue +8 -2
  28. package/dist/spa/src/afcl/Spinner.vue +1 -1
  29. package/dist/spa/src/components/CallActionWrapper.vue +1 -1
  30. package/dist/spa/src/components/ColumnValueInput.vue +16 -3
  31. package/dist/spa/src/components/ColumnValueInputWrapper.vue +25 -2
  32. package/dist/spa/src/components/CustomRangePicker.vue +16 -14
  33. package/dist/spa/src/components/Filters.vue +95 -63
  34. package/dist/spa/src/components/GroupsTable.vue +9 -6
  35. package/dist/spa/src/components/MenuLink.vue +2 -2
  36. package/dist/spa/src/components/ResourceForm.vue +101 -7
  37. package/dist/spa/src/components/ResourceListTable.vue +13 -7
  38. package/dist/spa/src/components/ShowTable.vue +1 -1
  39. package/dist/spa/src/components/Sidebar.vue +2 -2
  40. package/dist/spa/src/components/ThreeDotsMenu.vue +25 -10
  41. package/dist/spa/src/components/ValueRenderer.vue +1 -0
  42. package/dist/spa/src/spa_types/core.ts +32 -0
  43. package/dist/spa/src/stores/filters.ts +16 -12
  44. package/dist/spa/src/types/Back.ts +26 -3
  45. package/dist/spa/src/types/Common.ts +24 -5
  46. package/dist/spa/src/utils/createEditUtils.ts +65 -0
  47. package/dist/spa/src/utils/index.ts +2 -1
  48. package/dist/spa/src/utils/utils.ts +42 -7
  49. package/dist/spa/src/utils.ts +2 -1
  50. package/dist/spa/src/views/CreateView.vue +22 -49
  51. package/dist/spa/src/views/EditView.vue +21 -39
  52. package/dist/spa/src/views/ListView.vue +22 -32
  53. package/dist/spa/src/views/ShowView.vue +67 -12
  54. package/dist/types/Back.d.ts +26 -14
  55. package/dist/types/Back.d.ts.map +1 -1
  56. package/dist/types/Back.js.map +1 -1
  57. package/dist/types/Common.d.ts +31 -5
  58. package/dist/types/Common.d.ts.map +1 -1
  59. package/dist/types/Common.js.map +1 -1
  60. package/package.json +7 -5
@@ -5,80 +5,80 @@
5
5
  class="fixed h-14 top-0 z-30 w-full border-b drop-shadow-sm bg-lightNavbar dark:bg-darkNavbar dark:border-darkSidebarDevider"
6
6
  >
7
7
  <div class="af-header px-3 lg:px-5 lg:pl-3 flex items-center justify-between h-full w-full" >
8
- <div class="flex items-center justify-start rtl:justify-end">
9
- <button @click="sideBarOpen = !sideBarOpen"
10
- type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-lightSidebarItemHover focus:outline-none focus:ring-2 focus:ring-lightSidebarDevider dark:text-darkSidebarIcons dark:hover:bg-darkSidebarHover dark:focus:ring-lightSidebarDevider">
11
- <span class="sr-only">{{ $t('Open sidebar') }}</span>
12
- <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
13
- <path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
8
+ <div class="flex items-center justify-start rtl:justify-end">
9
+ <button @click="sideBarOpen = !sideBarOpen"
10
+ type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-lightSidebarItemHover focus:outline-none focus:ring-2 focus:ring-lightSidebarDevider dark:text-darkSidebarIcons dark:hover:bg-darkSidebarHover dark:focus:ring-lightSidebarDevider">
11
+ <span class="sr-only">{{ $t('Open sidebar') }}</span>
12
+ <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
13
+ <path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
14
+ </svg>
15
+ </button>
16
+ </div>
17
+ <div class="flex items-center">
18
+ <component
19
+ v-if="coreStore?.adminUser"
20
+ v-for="c in coreStore?.config?.globalInjections?.header || []"
21
+ :is="getCustomComponent(c)"
22
+ :meta="c.meta"
23
+ :adminUser="coreStore.adminUser"
24
+ />
25
+
26
+ <div class="flex items-center ms-3 ">
27
+ <Tooltip>
28
+ <IconWifiOff v-if="coreStore.isInternetError" class="blinking-icon w-8 h-8 text-red-500" />
29
+ <template #tooltip>
30
+ {{$t('Internet connection lost')}}
31
+ </template>
32
+ </Tooltip>
33
+ <span
34
+ v-if="!coreStore.config?.singleTheme"
35
+ @click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black dark:text-darkSidebarTextHover dark:hover:text-darkSidebarTextActive" role="menuitem">
36
+ <IconMoonSolid class="w-5 h-5 text-blue-300" v-if="coreStore.theme !== 'dark'" />
37
+ <IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
38
+ </span>
39
+ <div>
40
+ <button
41
+ ref="dropdownUserButton"
42
+ type="button" class="flex text-sm bg- rounded-full focus:ring-4 focus:ring-lightSidebarDevider dark:focus:ring-darkSidebarDevider dark:bg-" aria-expanded="false" data-dropdown-toggle="dropdown-user">
43
+ <span class="sr-only">{{ $t('Open user menu') }}</span>
44
+ <img
45
+ v-if="coreStore.userAvatarUrl"
46
+ class="w-8 h-8 rounded-full object-cover"
47
+ :src="coreStore.userAvatarUrl"
48
+ alt="user photo"
49
+ />
50
+ <svg v-else class="w-8 h-8 text-lightNavbarIcons dark:text-darkNavbarIcons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
51
+ <path fill-rule="evenodd" d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule="evenodd"/>
14
52
  </svg>
15
- </button>
16
- </div>
17
- <div class="flex items-center">
18
- <component
19
- v-if="coreStore?.adminUser"
20
- v-for="c in coreStore?.config?.globalInjections?.header || []"
21
- :is="getCustomComponent(c)"
22
- :meta="c.meta"
23
- :adminUser="coreStore.adminUser"
24
- />
25
-
26
- <div class="flex items-center ms-3 ">
27
- <Tooltip>
28
- <IconWifiOff v-if="coreStore.isInternetError" class="blinking-icon w-8 h-8 text-red-500" />
29
- <template #tooltip>
30
- {{$t('Internet connection lost')}}
31
- </template>
32
- </Tooltip>
33
- <span
34
- v-if="!coreStore.config?.singleTheme"
35
- @click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black dark:text-darkSidebarTextHover dark:hover:text-darkSidebarTextActive" role="menuitem">
36
- <IconMoonSolid class="w-5 h-5 text-blue-300" v-if="coreStore.theme !== 'dark'" />
37
- <IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
38
- </span>
39
- <div>
40
- <button
41
- ref="dropdownUserButton"
42
- type="button" class="flex text-sm bg- rounded-full focus:ring-4 focus:ring-lightSidebarDevider dark:focus:ring-darkSidebarDevider dark:bg-" aria-expanded="false" data-dropdown-toggle="dropdown-user">
43
- <span class="sr-only">{{ $t('Open user menu') }}</span>
44
- <img
45
- v-if="coreStore.userAvatarUrl"
46
- class="w-8 h-8 rounded-full object-cover"
47
- :src="coreStore.userAvatarUrl"
48
- alt="user photo"
49
- />
50
- <svg v-else class="w-8 h-8 text-lightNavbarIcons dark:text-darkNavbarIcons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
51
- <path fill-rule="evenodd" d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule="evenodd"/>
52
- </svg>
53
- </button>
54
- </div>
55
- <div class="z-50 hidden my-4 text-base list-none bg-lightUserMenuBackground divide-y divide-lightUserMenuBorder text-lightUserMenuText rounded shadow dark:shadow-black dark:bg-darkUserMenuBackground dark:divide-darkUserMenuBorder text-darkUserMenuText dark:shadow-black" id="dropdown-user">
56
- <div class="px-4 py-3" role="none">
57
- <p class="text-sm text-gray-900 dark:text-darkNavbarText" role="none" v-if="coreStore.userFullname">
58
- {{ coreStore.userFullname }}
59
- </p>
60
- <p class="text-sm font-medium text-gray-900 truncate dark:text-darkSidebarText" role="none">
61
- {{ coreStore.username }}
62
- </p>
63
- </div>
64
-
65
- <ul class="py-1" role="none">
66
- <li v-for="c in userMenuComponents" class="bg-lightUserMenuItemBackground hover:bg-lightUserMenuItemBackgroundHover text-lightUserMenuItemText hover:text-lightUserMenuItemText dark:bg-darkUserMenuItemBackground dark:hover:bg-darkUserMenuItemBackgroundHover dark:text-darkUserMenuItemText dark:hover:darkUserMenuItemTextHover" >
67
- <component
68
- :is="getCustomComponent(c)"
69
- :meta="c.meta"
70
- :adminUser="coreStore.adminUser"
71
- />
72
- </li>
73
- <li v-if="coreStore?.config?.settingPages && coreStore.config.settingPages.length > 0">
74
- <UserMenuSettingsButton />
75
- </li>
76
- <li>
77
- <button @click="logout" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm bg-lightUserMenuItemBackground hover:bg-lightUserMenuItemBackgroundHover text-lightUserMenuItemText hover:text-lightUserMenuItemText dark:bg-darkUserMenuItemBackground dark:hover:bg-darkUserMenuItemBackgroundHover dark:text-darkUserMenuItemText dark:hover:darkUserMenuItemTextHover w-full" role="menuitem">{{ $t('Sign out') }}</button>
78
- </li>
79
- </ul>
53
+ </button>
54
+ </div>
55
+ <div class="z-50 hidden my-4 text-base list-none bg-lightUserMenuBackground divide-y divide-lightUserMenuBorder text-lightUserMenuText rounded shadow dark:shadow-black dark:bg-darkUserMenuBackground dark:divide-darkUserMenuBorder text-darkUserMenuText dark:shadow-black" id="dropdown-user">
56
+ <div class="px-4 py-3" role="none">
57
+ <p class="text-sm text-gray-900 dark:text-darkNavbarText" role="none" v-if="coreStore.userFullname">
58
+ {{ coreStore.userFullname }}
59
+ </p>
60
+ <p class="text-sm font-medium text-gray-900 truncate dark:text-darkSidebarText" role="none">
61
+ {{ coreStore.username }}
62
+ </p>
80
63
  </div>
64
+
65
+ <ul class="py-1" role="none">
66
+ <li v-for="c in userMenuComponents" class="bg-lightUserMenuItemBackground hover:bg-lightUserMenuItemBackgroundHover text-lightUserMenuItemText hover:text-lightUserMenuItemText dark:bg-darkUserMenuItemBackground dark:hover:bg-darkUserMenuItemBackgroundHover dark:text-darkUserMenuItemText dark:hover:darkUserMenuItemTextHover" >
67
+ <component
68
+ :is="getCustomComponent(c)"
69
+ :meta="c.meta"
70
+ :adminUser="coreStore.adminUser"
71
+ />
72
+ </li>
73
+ <li v-if="coreStore?.config?.settingPages && coreStore.config.settingPages.length > 0">
74
+ <UserMenuSettingsButton />
75
+ </li>
76
+ <li>
77
+ <button @click="logout" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm bg-lightUserMenuItemBackground hover:bg-lightUserMenuItemBackgroundHover text-lightUserMenuItemText hover:text-lightUserMenuItemText dark:bg-darkUserMenuItemBackground dark:hover:bg-darkUserMenuItemBackgroundHover dark:text-darkUserMenuItemText dark:hover:darkUserMenuItemTextHover w-full" role="menuitem">{{ $t('Sign out') }}</button>
78
+ </li>
79
+ </ul>
81
80
  </div>
81
+ </div>
82
82
  </div>
83
83
  </div>
84
84
  </nav>
@@ -92,12 +92,14 @@
92
92
  @sidebarStateChange="handleSidebarStateChange"
93
93
  />
94
94
 
95
- <div class="af-content-wrapper transition-all duration-300 ease-in-out max-w-[100vw]"
95
+ <div
96
+ v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady && defaultLayout"
97
+ class="af-content-wrapper transition-all duration-300 ease-in-out max-w-[100vw]"
96
98
  :style="{
97
99
  marginLeft: headerOnlyLayout ? 0 : isSidebarIconOnly ? '4.5rem' : expandedWidth,
98
100
  maxWidth: headerOnlyLayout ? '100%' : isSidebarIconOnly ? 'calc(100% - 4.5rem)' : `calc(100% - ${expandedWidth})`
99
101
  }"
100
- v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady && defaultLayout">
102
+ >
101
103
  <div class="p-0 dark:border-gray-700 mt-14">
102
104
  <RouterView/>
103
105
  </div>
@@ -109,8 +111,7 @@
109
111
 
110
112
  <div v-else class="flex items-center justify-center h-screen">
111
113
  <div class="text-3xl text-gray-400 animate-bounce">
112
- <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>
113
- <span class="sr-only">{{ $t('Loading...') }}</span>
114
+ <Spinner class="w-8 h-8" />
114
115
  </div>
115
116
  </div>
116
117
  <AcceptModal />
@@ -198,7 +199,7 @@ import {useToastStore} from '@/stores/toast';
198
199
  import { initFrontedAPI } from '@/adminforth';
199
200
  import { useAdminforth } from '@/adminforth';
200
201
  import UserMenuSettingsButton from './components/UserMenuSettingsButton.vue';
201
- import { Tooltip } from '@/afcl'
202
+ import { Tooltip, Spinner } from '@/afcl'
202
203
 
203
204
  const coreStore = useCoreStore();
204
205
  const toastStore = useToastStore();
@@ -10,14 +10,13 @@
10
10
  'text-lightSecondaryContrast/70 bg-lightSecondary border-lightSecondaryContrast/30 dark:bg-darkSecondary hover:bg-lightSecondary/60 hover:border-lightSecondaryContrast/60 focus:ring-lightSecondary dark:focus:ring-darkSecondary/40 dark:text-darkSecondaryContrast dark:border-darkSecondaryContrast/40 dark:hover:bg-darkSecondary/60 dark:hover:border-darkSecondary/60': props.mode === 'secondary',
11
11
  }"
12
12
  >
13
- <svg v-if="props.loader"
14
- aria-hidden="true" class="w-4 h-4 text-lightButtonsText animate-spin dark:text-darkButtonsText fill-lightButtonsBackground 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>
13
+ <Spinner v-if="props.loader" class="w-4 h-4 text-lightButtonsText dark:text-darkButtonsText fill-lightButtonsBackground dark:fill-darkPrimary" />
16
14
  <slot></slot>
17
15
  </button>
18
16
  </template>
19
17
 
20
18
  <script setup lang="ts">
19
+ import { Spinner } from '@/afcl';
21
20
 
22
21
  const props = withDefaults(defineProps<{
23
22
  loader?: boolean;
@@ -206,7 +206,7 @@ function open() {
206
206
  }
207
207
 
208
208
  function close() {
209
- modalRef.value.hide();
209
+ modalRef.value.close();
210
210
  }
211
211
 
212
212
  defineExpose({
@@ -44,7 +44,7 @@ const isIos = coreStore.isIos;
44
44
  const props = defineProps<{
45
45
  type: string,
46
46
  fullWidth?: boolean,
47
- modelValue: string,
47
+ modelValue: string | number | null,
48
48
  suffix?: string,
49
49
  prefix?: string,
50
50
  readonly?: boolean,
@@ -119,7 +119,7 @@ import { ref, computed, onMounted, onUnmounted, watch, nextTick,type PropType, t
119
119
  import { IconCaretDownSolid } from '@iconify-prerendered/vue-flowbite';
120
120
  import { useElementSize } from '@vueuse/core'
121
121
 
122
- type ISingleSelectModelValue = string | number;
122
+ type ISingleSelectModelValue = string | number | boolean;
123
123
 
124
124
  const props = defineProps({
125
125
  options: Array,
@@ -159,6 +159,10 @@ const props = defineProps({
159
159
  type: String,
160
160
  default: '',
161
161
  },
162
+ disableTogleOfSelectedItem: {
163
+ type: Boolean,
164
+ default: false,
165
+ }
162
166
  });
163
167
 
164
168
  const emit = defineEmits(['update:modelValue', 'scroll-near-end', 'search']);
@@ -283,6 +287,7 @@ onMounted(() => {
283
287
  // Add scroll listeners if teleportToBody is true
284
288
  if (props.teleportToBody) {
285
289
  window.addEventListener('scroll', handleScroll, true);
290
+ window.addEventListener('resize', handleScroll);
286
291
  }
287
292
  });
288
293
 
@@ -314,7 +319,7 @@ const removeClickListener = () => {
314
319
  };
315
320
 
316
321
  const toogleItem = (item: any) => {
317
- if (selectedItems.value.includes(item)) {
322
+ if (selectedItems.value.includes(item) && !props.disableTogleOfSelectedItem) {
318
323
  selectedItems.value = selectedItems.value.filter(i => i.value !== item.value);
319
324
  } else {
320
325
  if (!props.multiple) {
@@ -345,6 +350,7 @@ onUnmounted(() => {
345
350
  // Remove scroll listeners if teleportToBody is true
346
351
  if (props.teleportToBody) {
347
352
  window.removeEventListener('scroll', handleScroll, true);
353
+ window.removeEventListener('resize', handleScroll);
348
354
  }
349
355
  if (searchDebounceHandle) {
350
356
  clearTimeout(searchDebounceHandle);
@@ -4,6 +4,6 @@
4
4
  <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"/>
5
5
  <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"/>
6
6
  </svg>
7
- <span class="sr-only">Loading...</span>
7
+ <span class="sr-only">{{ $t('Loading...') }}</span>
8
8
  </div>
9
9
  </template>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div @click="onClick" class="flex items-center justify-center">
2
+ <div @click="onClick" class="flex items-center cursor-pointer">
3
3
  <slot />
4
4
  </div>
5
5
  </template>
@@ -20,7 +20,7 @@
20
20
  ref="input"
21
21
  :key="`select-${column.name}-${source}-${column.foreignResource?.name || column.foreignResource?.table || ''}`"
22
22
  class="w-full min-w-24"
23
- :options="columnOptions[column.name] || []"
23
+ :options="formatSelectOptions(columnOptions[column.name] || [], column)"
24
24
  :searchDisabled="!column.foreignResource.searchableFields"
25
25
  @scroll-near-end="loadMoreOptions && loadMoreOptions(column.name)"
26
26
  @search="(searchTerm) => {
@@ -33,6 +33,7 @@
33
33
  :modelValue="value"
34
34
  :readonly="(column.editReadonly && source === 'edit') || readonly"
35
35
  @update:modelValue="$emit('update:modelValue', $event)"
36
+ disableTogleOfSelectedItem
36
37
  >
37
38
  <template #extra-item v-if="columnLoadingState && columnLoadingState[column.name]?.loading">
38
39
  <div class="text-center text-gray-400 dark:text-gray-300 py-2 flex items-center justify-center gap-2">
@@ -45,11 +46,12 @@
45
46
  v-else-if="column.enum"
46
47
  ref="input"
47
48
  class="w-full min-w-24"
48
- :options="column.enum"
49
+ :options="formatSelectOptions(column.enum, column)"
49
50
  teleportToBody
50
51
  :modelValue="value"
51
52
  :readonly="(column.editReadonly && source === 'edit') || readonly"
52
53
  @update:modelValue="$emit('update:modelValue', $event)"
54
+ disableTogleOfSelectedItem
53
55
  />
54
56
  <Select
55
57
  v-else-if="(type || column.type) === 'boolean'"
@@ -60,6 +62,7 @@
60
62
  :modelValue="value"
61
63
  :readonly="(column.editReadonly && source === 'edit') || readonly"
62
64
  @update:modelValue="$emit('update:modelValue', $event)"
65
+ disableTogleOfSelectedItem
63
66
  />
64
67
  <Input
65
68
  v-else-if="['integer'].includes(type || column.type)"
@@ -188,7 +191,7 @@
188
191
  type?: string,
189
192
  value: any,
190
193
  currentValues: any,
191
- mode: string,
194
+ mode: 'create' | 'edit',
192
195
  columnOptions: any,
193
196
  unmasked: any,
194
197
  deletable?: boolean,
@@ -218,6 +221,16 @@ const input = ref<HTMLInputElement | null>(null);
218
221
  return options;
219
222
  };
220
223
 
224
+ const formatSelectOptions = (options: any, column: any) => {
225
+ const optionsToReturn = options;
226
+ if (!column.required[props.mode] && !column.isArray?.enabled) {
227
+ if (!optionsToReturn.some((option: any) => option.value === null)) {
228
+ optionsToReturn.push({ label: t('Unset'), value: null });
229
+ }
230
+ }
231
+ return optionsToReturn;
232
+ };
233
+
221
234
  function onFocusHandler(event:FocusEvent, column:any, source:string, ) {
222
235
  const focusedInput = event.target as HTMLInputElement;
223
236
  if(!focusedInput) return;
@@ -53,23 +53,46 @@
53
53
  @update:inValidity="$emit('update:inValidity', { name: column.name, value: $event })"
54
54
  @update:emptiness="$emit('update:emptiness', { name: column.name, value: $event })"
55
55
  />
56
+ <div v-if="columnsWithErrors && columnsWithErrors[column.name] && validatingMode && !isValidating" class="af-invalid-field-message mt-1 text-xs text-lightInputErrorColor dark:text-darkInputErrorColor">{{ columnsWithErrors[column.name] }}</div>
57
+ <Spinner v-if="shouldWeShowSpinner" class="w-4 mt-1"/>
58
+ <div v-if="column.editingNote && column.editingNote[mode]" class="mt-1 text-xs text-lightFormFieldTextColor dark:text-darkFormFieldTextColor">{{ column.editingNote[mode] }}</div>
56
59
  </template>
57
60
 
58
61
  <script setup lang="ts">
59
62
  import { IconPlusOutline } from '@iconify-prerendered/vue-flowbite';
60
63
  import ColumnValueInput from "./ColumnValueInput.vue";
61
- import { ref, nextTick } from 'vue';
64
+ import { ref, watch, nextTick } from 'vue';
65
+ import { Spinner } from '@/afcl';
62
66
 
63
67
  const props = defineProps<{
64
68
  source: 'create' | 'edit',
65
69
  column: any,
66
70
  currentValues: any,
67
- mode: string,
71
+ mode: 'create' | 'edit',
68
72
  columnOptions: any,
69
73
  unmasked: any,
70
74
  setCurrentValue: Function,
71
75
  readonly?: boolean,
76
+ columnsWithErrors: Record<string, string>,
77
+ isValidating: boolean,
78
+ validatingMode: boolean,
72
79
  }>();
80
+
81
+ const shouldWeShowSpinner = ref(false);
82
+
83
+
84
+ watch(() => props.currentValues[props.column.name], async (newVal) => {
85
+ await nextTick();
86
+ if (props.isValidating) {
87
+ shouldWeShowSpinner.value = true;
88
+ }
89
+ });
90
+
91
+ watch(() => [props.isValidating], () => {
92
+ if (!props.isValidating) {
93
+ shouldWeShowSpinner.value = false;
94
+ }
95
+ });
73
96
 
74
97
  const emit = defineEmits(['update:unmasked', 'update:inValidity', 'update:emptiness', 'focus-last-input']);
75
98
 
@@ -35,16 +35,12 @@ import {computed, onMounted, ref, watch} from "vue";
35
35
  import debounce from 'debounce'
36
36
  import RangePicker from './RangePicker.vue';
37
37
 
38
- const props = defineProps({
39
- valueStart: {
40
- default: '',
41
- },
42
- valueEnd: {
43
- default: '',
44
- },
45
- min: {},
46
- max: {},
47
- });
38
+ const props = defineProps<{
39
+ valueStart: number | null,
40
+ valueEnd: number | null,
41
+ min: number,
42
+ max: number,
43
+ }>()
48
44
 
49
45
  const emit = defineEmits(['update:valueStart', 'update:valueEnd']);
50
46
 
@@ -52,8 +48,8 @@ const minFormatted = computed(() => Math.floor(<number>props.min));
52
48
  const maxFormatted = computed(() => Math.ceil(<number>props.max));
53
49
 
54
50
 
55
- const start = ref<string | number>(props.valueStart);
56
- const end = ref<string | number>(props.valueEnd);
51
+ const start = ref<number | null>(props.valueStart);
52
+ const end = ref<number | null>(props.valueEnd);
57
53
 
58
54
  const sliderValue = ref<[number, number]>([minFormatted.value, maxFormatted.value]);
59
55
 
@@ -71,8 +67,8 @@ watch([start, end], () => {
71
67
 
72
68
  const updateFromSlider =
73
69
  debounce((value: [number, number]) => {
74
- start.value = value[0] === minFormatted.value ? '': value[0];
75
- end.value = value[1] === maxFormatted.value ? '': value[1];
70
+ start.value = value[0] === minFormatted.value ? null : value[0];
71
+ end.value = value[1] === maxFormatted.value ? null : value[1];
76
72
  }, 500);
77
73
 
78
74
  onMounted(() => {
@@ -89,11 +85,17 @@ onMounted(() => {
89
85
  })
90
86
 
91
87
  function updateStartFromProps() {
88
+ if (props.valueStart == start.value) {
89
+ return;
90
+ }
92
91
  start.value = props.valueStart;
93
92
  setSliderValues(start.value, end.value)
94
93
  }
95
94
 
96
95
  function updateEndFromProps() {
96
+ if (props.valueEnd == end.value) {
97
+ return;
98
+ }
97
99
  end.value = props.valueEnd;
98
100
  setSliderValues(start.value, end.value)
99
101
  }