adminforth 2.13.0-next.26 → 2.13.0-next.27

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.
@@ -182,8 +182,6 @@ initFrontedAPI()
182
182
 
183
183
  createHead()
184
184
  const sideBarOpen = ref(false);
185
- const defaultLayout = ref(true);
186
- const headerOnlyLayout = ref(false);
187
185
  const route = useRoute();
188
186
  const router = useRouter();
189
187
  const publicConfigLoaded = ref(false);
@@ -197,6 +195,14 @@ const isSidebarIconOnly = ref(localStorage.getItem('afIconOnlySidebar') === 'tru
197
195
 
198
196
  const loggedIn = computed(() => !!coreStore?.adminUser);
199
197
 
198
+ const defaultLayout = computed(() => {
199
+ return route.meta?.sidebarAndHeader !== 'none';
200
+ });
201
+
202
+ const headerOnlyLayout = computed(() => {
203
+ return route.meta?.sidebarAndHeader === 'headerOnly';
204
+ });
205
+
200
206
  const expandedWidth = computed(() => coreStore.config?.iconOnlySidebar?.expandedSidebarWidth || '16.5rem');
201
207
 
202
208
  const theme = ref('light');
@@ -308,19 +314,6 @@ async function loadMenu() {
308
314
  loginRedirectCheckIsReady.value = true;
309
315
  }
310
316
 
311
- function handleCustomLayout() {
312
- if (route.meta?.sidebarAndHeader === 'none') {
313
- defaultLayout.value = false;
314
- } else if (route.meta?.sidebarAndHeader === 'preferIconOnly') {
315
- defaultLayout.value = true;
316
- isSidebarIconOnly.value = true;
317
- } else if (route.meta?.sidebarAndHeader === 'headerOnly') {
318
- headerOnlyLayout.value = true;
319
- } else {
320
- defaultLayout.value = true;
321
- }
322
- }
323
-
324
317
  function humanizeSnake(str: string): string {
325
318
  if (!str) {
326
319
  return '';
@@ -345,10 +338,11 @@ watch(title, (title) => {
345
338
  document.title = title;
346
339
  })
347
340
 
348
- watch([route, () => coreStore.resourceById, () => coreStore.config], async () => {
349
- handleCustomLayout()
350
- await new Promise((resolve) => setTimeout(resolve, 0));
351
-
341
+ watch(route, () => {
342
+ // Handle preferIconOnly layout
343
+ if (route.meta?.sidebarAndHeader === 'preferIconOnly') {
344
+ isSidebarIconOnly.value = true;
345
+ }
352
346
  });
353
347
 
354
348
 
@@ -376,7 +370,6 @@ onMounted(async () => {
376
370
  loadPublicConfig(); // and this
377
371
  // before init flowbite we have to wait router initialized because it affects dom(our v-ifs) and fetch menu
378
372
  await initRouter();
379
- handleCustomLayout();
380
373
 
381
374
  adminforth.menu.refreshMenuBadges = async () => {
382
375
  await coreStore.fetchMenuBadges();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.13.0-next.26",
3
+ "version": "2.13.0-next.27",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",