adminforth 1.0.66 → 1.0.67

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.
@@ -258,6 +258,11 @@ class CodeInjector {
258
258
  const routerVuePath = path.join(CodeInjector.SPA_TMP_PATH, 'src', 'router', 'index.ts');
259
259
  let routerVueContent = yield fs.promises.readFile(routerVuePath, 'utf-8');
260
260
  routerVueContent = routerVueContent.replace('/* IMPORTANT:ADMINFORTH ROUTES IMPORTS */', routerComponents);
261
+ // inject title to index.html
262
+ const indexHtmlPath = path.join(CodeInjector.SPA_TMP_PATH, 'index.html');
263
+ let indexHtmlContent = yield fs.promises.readFile(indexHtmlPath, 'utf-8');
264
+ indexHtmlContent = indexHtmlContent.replace('/* IMPORTANT:ADMINFORTH TITLE */', `${this.adminforth.config.title || 'AdminForth'}`);
265
+ yield fs.promises.writeFile(indexHtmlPath, indexHtmlContent);
261
266
  /* generate custom routes */
262
267
  const homepageMenuItem = this.adminforth.config.menu.find((mi) => mi.homepage);
263
268
  let childrenHomePageMenuItem = this.adminforth.config.menu.find((mi) => { var _a; return mi.children && ((_a = mi.children) === null || _a === void 0 ? void 0 : _a.find((mi) => mi.homepage)); });
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8">
5
5
  <link rel="icon" href="/favicon.ico">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Vite App</title>
7
+ <title>/* IMPORTANT:ADMINFORTH TITLE */</title>
8
8
  <!--
9
9
  <script>
10
10
  // On page load or when changing themes, best to add inline in `head` to avoid FOUC
@@ -5,7 +5,8 @@
5
5
  <div class="px-3 py-3 lg:px-5 lg:pl-3">
6
6
  <div class="flex items-center justify-between">
7
7
  <div class="flex items-center justify-start rtl:justify-end">
8
- <button data-drawer-target="logo-sidebar" data-drawer-toggle="logo-sidebar" aria-controls="logo-sidebar" type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-nav-menu-bg-hover focus:outline-none focus:ring-2 focus:ring-nav-menu-devider dark:text-nav-menu-icons dark:hover:bg-nav-menu-bg-hover dark:focus:ring-nav-menu-devider">
8
+ <button @click="sideBarOpen = !sideBarOpen"
9
+ type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-nav-menu-bg-hover focus:outline-none focus:ring-2 focus:ring-nav-menu-devider dark:text-nav-menu-icons dark:hover:bg-nav-menu-bg-hover dark:focus:ring-nav-menu-devider">
9
10
  <span class="sr-only">Open sidebar</span>
10
11
  <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
11
12
  <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>
@@ -58,7 +59,10 @@
58
59
 
59
60
  v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
60
61
 
61
- id="logo-sidebar" class="fixed border-none top-0 left-0 z-40 w-64 h-screen transition-transform -translate-x-full bg-nav-menu-bg border-r border- sm:translate-x-0 dark:bg-gray-800 dark:border-gray-700" aria-label="Sidebar">
62
+ id="logo-sidebar" class="fixed border-none top-0 left-0 z-50 w-64 h-screen transition-transform bg-nav-menu-bg border-r border- sm:translate-x-0 dark:bg-gray-800 dark:border-gray-700"
63
+ :class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
64
+ aria-label="Sidebar"
65
+ >
62
66
  <div class="h-full px-3 pb-4 overflow-y-auto bg-nav-menu-bg dark:bg-gray-800">
63
67
 
64
68
  <div class="flex ms-2 md:me-24 m-4 ">
@@ -101,7 +105,8 @@
101
105
  </ul>
102
106
  </div>
103
107
  </aside>
104
-
108
+
109
+
105
110
  <div class="p-4 sm:ml-64 dark:bg-gray-800" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
106
111
  <div class="p-0 dark:border-gray-700 mt-14">
107
112
  <RouterView/>
@@ -119,6 +124,11 @@
119
124
  </div>
120
125
  <AcceptModal />
121
126
 
127
+ <div v-if="sideBarOpen"
128
+ @click="sideBarOpen = false"
129
+
130
+ drawer-backdrop="" class="bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"></div>
131
+
122
132
  </template>
123
133
 
124
134
  <style scoped>
@@ -144,7 +154,7 @@ const coreStore = useCoreStore();
144
154
  createHead()
145
155
 
146
156
 
147
-
157
+ const sideBarOpen = ref(false);
148
158
 
149
159
 
150
160
 
@@ -198,16 +208,16 @@ onMounted(async () => {
198
208
  await coreStore.fetchMenuAndResource();
199
209
  loginRedirectCheckIsReady.value = true;
200
210
  title.value = coreStore.config?.title || 'AdminForth';
201
- useHead({
202
- title: title.value,
203
- link: [
204
- {
205
- rel: 'icon',
206
- href: coreStore.config.favicon || '/favicon.ico',
207
- },
208
- ],
211
+ // useHead({
212
+ // title: title.value,
213
+ // link: [
214
+ // {
215
+ // rel: 'icon',
216
+ // href: coreStore.config.favicon || '/favicon.ico',
217
+ // },
218
+ // ],
209
219
 
210
- })
220
+ // })
211
221
  coreStore.menu.forEach((item, i) => {
212
222
  if (item.open) {
213
223
  opened.value.push(i);
@@ -296,6 +296,12 @@ class CodeInjector {
296
296
  let routerVueContent = await fs.promises.readFile(routerVuePath, 'utf-8');
297
297
  routerVueContent = routerVueContent.replace('/* IMPORTANT:ADMINFORTH ROUTES IMPORTS */', routerComponents);
298
298
 
299
+ // inject title to index.html
300
+ const indexHtmlPath = path.join(CodeInjector.SPA_TMP_PATH, 'index.html');
301
+ let indexHtmlContent = await fs.promises.readFile(indexHtmlPath, 'utf-8');
302
+ indexHtmlContent = indexHtmlContent.replace('/* IMPORTANT:ADMINFORTH TITLE */', `${this.adminforth.config.title || 'AdminForth'}`);
303
+ await fs.promises.writeFile(indexHtmlPath, indexHtmlContent);
304
+
299
305
 
300
306
 
301
307
  /* generate custom routes */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/spa/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8">
5
5
  <link rel="icon" href="/favicon.ico">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Vite App</title>
7
+ <title>/* IMPORTANT:ADMINFORTH TITLE */</title>
8
8
  <!--
9
9
  <script>
10
10
  // On page load or when changing themes, best to add inline in `head` to avoid FOUC
package/spa/src/App.vue CHANGED
@@ -5,7 +5,8 @@
5
5
  <div class="px-3 py-3 lg:px-5 lg:pl-3">
6
6
  <div class="flex items-center justify-between">
7
7
  <div class="flex items-center justify-start rtl:justify-end">
8
- <button data-drawer-target="logo-sidebar" data-drawer-toggle="logo-sidebar" aria-controls="logo-sidebar" type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-nav-menu-bg-hover focus:outline-none focus:ring-2 focus:ring-nav-menu-devider dark:text-nav-menu-icons dark:hover:bg-nav-menu-bg-hover dark:focus:ring-nav-menu-devider">
8
+ <button @click="sideBarOpen = !sideBarOpen"
9
+ type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-nav-menu-bg-hover focus:outline-none focus:ring-2 focus:ring-nav-menu-devider dark:text-nav-menu-icons dark:hover:bg-nav-menu-bg-hover dark:focus:ring-nav-menu-devider">
9
10
  <span class="sr-only">Open sidebar</span>
10
11
  <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
11
12
  <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>
@@ -58,7 +59,10 @@
58
59
 
59
60
  v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
60
61
 
61
- id="logo-sidebar" class="fixed border-none top-0 left-0 z-40 w-64 h-screen transition-transform -translate-x-full bg-nav-menu-bg border-r border- sm:translate-x-0 dark:bg-gray-800 dark:border-gray-700" aria-label="Sidebar">
62
+ id="logo-sidebar" class="fixed border-none top-0 left-0 z-50 w-64 h-screen transition-transform bg-nav-menu-bg border-r border- sm:translate-x-0 dark:bg-gray-800 dark:border-gray-700"
63
+ :class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
64
+ aria-label="Sidebar"
65
+ >
62
66
  <div class="h-full px-3 pb-4 overflow-y-auto bg-nav-menu-bg dark:bg-gray-800">
63
67
 
64
68
  <div class="flex ms-2 md:me-24 m-4 ">
@@ -101,7 +105,8 @@
101
105
  </ul>
102
106
  </div>
103
107
  </aside>
104
-
108
+
109
+
105
110
  <div class="p-4 sm:ml-64 dark:bg-gray-800" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
106
111
  <div class="p-0 dark:border-gray-700 mt-14">
107
112
  <RouterView/>
@@ -119,6 +124,11 @@
119
124
  </div>
120
125
  <AcceptModal />
121
126
 
127
+ <div v-if="sideBarOpen"
128
+ @click="sideBarOpen = false"
129
+
130
+ drawer-backdrop="" class="bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"></div>
131
+
122
132
  </template>
123
133
 
124
134
  <style scoped>
@@ -144,7 +154,7 @@ const coreStore = useCoreStore();
144
154
  createHead()
145
155
 
146
156
 
147
-
157
+ const sideBarOpen = ref(false);
148
158
 
149
159
 
150
160
 
@@ -198,16 +208,16 @@ onMounted(async () => {
198
208
  await coreStore.fetchMenuAndResource();
199
209
  loginRedirectCheckIsReady.value = true;
200
210
  title.value = coreStore.config?.title || 'AdminForth';
201
- useHead({
202
- title: title.value,
203
- link: [
204
- {
205
- rel: 'icon',
206
- href: coreStore.config.favicon || '/favicon.ico',
207
- },
208
- ],
211
+ // useHead({
212
+ // title: title.value,
213
+ // link: [
214
+ // {
215
+ // rel: 'icon',
216
+ // href: coreStore.config.favicon || '/favicon.ico',
217
+ // },
218
+ // ],
209
219
 
210
- })
220
+ // })
211
221
  coreStore.menu.forEach((item, i) => {
212
222
  if (item.open) {
213
223
  opened.value.push(i);