@artisan-cloud/plugin-framework-admin 0.0.1-alpha
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.
- package/index.ts +16 -0
- package/layer/app/components/powerx/PXAdminLayout.vue +30 -0
- package/layer/app/components/powerx/PXNav.vue +15 -0
- package/layer/app/middleware/auth-guard.global.ts +3 -0
- package/layer/app/middleware/tenant-context.global.ts +3 -0
- package/layer/app/pages/_p/[pluginId]/admin/index.vue +5 -0
- package/layer/app/plugins/permissions.ts +8 -0
- package/layer/nuxt.config.ts +37 -0
- package/module.ts +14 -0
- package/package.json +21 -0
package/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PowerXAdminConfigOptions {
|
|
2
|
+
pluginId: string
|
|
3
|
+
starterPages?: boolean
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function definePowerXAdminConfig(options: PowerXAdminConfigOptions) {
|
|
7
|
+
return {
|
|
8
|
+
extends: ['@artisan-cloud/plugin-framework-admin/layer'],
|
|
9
|
+
appConfig: {
|
|
10
|
+
powerx: {
|
|
11
|
+
pluginId: options.pluginId,
|
|
12
|
+
starterPages: options.starterPages ?? true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="px-admin-layout">
|
|
3
|
+
<header class="px-admin-layout__header">
|
|
4
|
+
<slot name="toolbar">
|
|
5
|
+
<h1>PowerX Admin</h1>
|
|
6
|
+
</slot>
|
|
7
|
+
</header>
|
|
8
|
+
<main class="px-admin-layout__body">
|
|
9
|
+
<slot />
|
|
10
|
+
</main>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style scoped>
|
|
15
|
+
.px-admin-layout {
|
|
16
|
+
min-height: 100vh;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.px-admin-layout__header {
|
|
22
|
+
padding: 1rem 2rem;
|
|
23
|
+
border-bottom: 1px solid #eee;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.px-admin-layout__body {
|
|
27
|
+
flex: 1;
|
|
28
|
+
padding: 2rem;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import type { NuxtConfig } from 'nuxt/schema'
|
|
4
|
+
|
|
5
|
+
const layerDir = dirname(fileURLToPath(import.meta.url))
|
|
6
|
+
const appDir = resolve(layerDir, 'app')
|
|
7
|
+
|
|
8
|
+
const config: NuxtConfig = {
|
|
9
|
+
imports: {
|
|
10
|
+
dirs: [
|
|
11
|
+
resolve(appDir, 'composables'),
|
|
12
|
+
resolve(appDir, 'composables/api')
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
hooks: {
|
|
16
|
+
'components:dirs'(dirs) {
|
|
17
|
+
dirs.push({
|
|
18
|
+
path: resolve(appDir, 'components'),
|
|
19
|
+
pathPrefix: false
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
'pages:extend'(pages, nuxt) {
|
|
23
|
+
const starterEnabled = (nuxt?.options?.appConfig?.powerx?.starterPages ?? true) as boolean
|
|
24
|
+
if (starterEnabled) {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
for (const page of [...pages]) {
|
|
28
|
+
if (typeof page.file === 'string' &&
|
|
29
|
+
(page.file.includes('app/pages/intro.vue') || page.file.includes('app/pages/templates/'))) {
|
|
30
|
+
pages.splice(pages.indexOf(page), 1)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default config
|
package/module.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineNuxtModule } from 'nuxt/kit'
|
|
2
|
+
|
|
3
|
+
export interface ModuleOptions {
|
|
4
|
+
pluginId: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default defineNuxtModule<ModuleOptions>({
|
|
8
|
+
meta: {
|
|
9
|
+
name: '@artisan-cloud/plugin-framework-admin'
|
|
10
|
+
},
|
|
11
|
+
setup() {
|
|
12
|
+
// 占位:后续可在此扩展 nuxt runtime 功能
|
|
13
|
+
}
|
|
14
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@artisan-cloud/plugin-framework-admin",
|
|
3
|
+
"version": "0.0.1-alpha",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.ts",
|
|
7
|
+
"./layer": "./layer/nuxt.config.ts",
|
|
8
|
+
"./layer/*": "./layer/*"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.ts",
|
|
12
|
+
"module.ts",
|
|
13
|
+
"layer"
|
|
14
|
+
],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"nuxt": "^4.2.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"nuxt": "^4.2.0"
|
|
20
|
+
}
|
|
21
|
+
}
|