adminforth 1.4.3-next.38 → 1.4.3-next.39

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.
@@ -68,6 +68,7 @@
68
68
  </nav>
69
69
 
70
70
  <aside
71
+ ref="sidebarAside"
71
72
  v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady && defaultLayout"
72
73
  id="logo-lightSidebar" class="fixed border-none top-0 left-0 z-30 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
74
  :class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
@@ -118,10 +119,10 @@
118
119
  </ul>
119
120
  </li>
120
121
  <li v-else>
121
- <MenuLink :item="item" @click="hideSidebar"/>
122
- </li>
123
- </template>
124
- </ul>
122
+ <MenuLink :item="item" @click="hideSidebar"/>
123
+ </li>
124
+ </template>
125
+ </ul>
125
126
 
126
127
 
127
128
  <div id="dropdown-cta" class="p-4 mt-6 rounded-lg bg-lightAnnouncementBG dark:bg-darkAnnouncementBG
@@ -262,6 +263,7 @@ const opened = ref<string[]>([]);
262
263
  const publicConfigLoaded = ref(false);
263
264
  const dropdownUserButton = ref(null);
264
265
 
266
+ const sidebarAside = ref(null);
265
267
 
266
268
  const routerIsReady = ref(false);
267
269
  const loginRedirectCheckIsReady = ref(false);
@@ -326,14 +328,15 @@ function humanizeSnake(str: string): string {
326
328
  watch([route, () => coreStore.resourceById], async () => {
327
329
  handleCustomLayout()
328
330
  await new Promise((resolve) => setTimeout(resolve, 0));
329
- const resourceTitle = coreStore.resourceById[route.params?.resourceId as string]?.label || humanizeSnake(Object.values(route.params)[0] as string);
331
+ const firstParam = Object.values(route.params)[0];
332
+ const resourceTitle = coreStore.resourceById[route.params?.resourceId as string]?.label || (firstParam ? humanizeSnake(firstParam as string) : null);
330
333
  title.value = `${coreStore.config?.title || coreStore.config?.brandName || 'Adminforth'} | ${ resourceTitle || route.meta.title || ' '}`;
331
334
  useHead({
332
335
  title: title.value,
333
336
  })
334
337
  });
335
338
 
336
- watch (()=>coreStore.menu, () => {
339
+ watch(()=>coreStore.menu, () => {
337
340
  coreStore.menu.forEach((item, i) => {
338
341
  if (item.open) {
339
342
  opened.value.push(i);
@@ -358,6 +361,12 @@ async function loadPublicConfig() {
358
361
  publicConfigLoaded.value = true;
359
362
  }
360
363
 
364
+ watch(sidebarAside, (sidebarAside) => {
365
+ if (sidebarAside) {
366
+ coreStore.fetchMenuBadges();
367
+ }
368
+ })
369
+
361
370
  // initialize components based on data attribute selectors
362
371
  onMounted(async () => {
363
372
  loadMenu(); // run this in async mode
@@ -365,7 +374,6 @@ onMounted(async () => {
365
374
  // before init flowbite we have to wait router initialized because it affects dom(our v-ifs) and fetch menu
366
375
  await initRouter();
367
376
  handleCustomLayout();
368
- await coreStore.fetchMenuBadges();
369
377
 
370
378
  window.adminforth.menu.refreshMenuBadges = async () => {
371
379
  await coreStore.fetchMenuBadges();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.4.3-next.38",
3
+ "version": "1.4.3-next.39",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",