@vc-shell/create-vc-app 1.0.127 → 1.0.129
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/CHANGELOG.md +18 -0
- package/dist/index.js +134 -169
- package/dist/templates/base/_env +1 -3
- package/dist/templates/base/package.json +28 -27
- package/dist/templates/base/src/pages/App.vue +116 -0
- package/dist/templates/base/src/router/index.ts +5 -113
- package/dist/templates/base/src/router/routes.ts +67 -0
- package/dist/templates/base/tailwind.config.ts +7 -0
- package/dist/templates/base/{vite.config.ts → vite.config.mts} +7 -7
- package/dist/templates/variants/both/src/main.ts +7 -6
- package/dist/templates/variants/both/src/modules/classic-module/pages/details.vue +1 -0
- package/dist/templates/variants/both/src/modules/classic-module/pages/list.vue +7 -0
- package/dist/templates/variants/both/src/modules/dynamic-module/composables/useList/index.ts +2 -2
- package/dist/templates/variants/both/src/modules/dynamic-module/pages/list.ts +5 -0
- package/dist/templates/variants/classic/src/main.ts +7 -6
- package/dist/templates/variants/classic/src/modules/classic-module/pages/list.vue +7 -0
- package/dist/templates/variants/dynamic/src/main.ts +7 -6
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/useList/index.ts +2 -2
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/pages/list.ts +5 -0
- package/package.json +7 -5
- package/dist/index.js.map +0 -1
- package/dist/templates/base/tailwind.config.js +0 -7
- package/dist/templates/variants/both/src/pages/App.vue +0 -369
- package/dist/templates/variants/classic/src/pages/App.vue +0 -362
- package/dist/templates/variants/dynamic/src/pages/App.vue +0 -362
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/templates/base/{postcss.config.js → postcss.config.cjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [1.0.129](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.128...v1.0.129) (2023-12-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **sample:** update dependencies in package.json ([5c3e4a0](https://github.com/VirtoCommerce/vc-shell/commit/5c3e4a0ada021acc60480f1f57a0f599fa11a2db))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **create-vc-app:** build as es6 module ([0452713](https://github.com/VirtoCommerce/vc-shell/commit/04527133e1e6351f1d5f6440b50e57b2b6fa1966))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [1.0.128](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.127...v1.0.128) (2023-12-14)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## [1.0.127](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.126...v1.0.127) (2023-12-13)
|
|
2
20
|
|
|
3
21
|
|
package/dist/index.js
CHANGED
|
@@ -1,182 +1,147 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
import k from "prompts";
|
|
3
|
+
import N from "mri";
|
|
4
|
+
import o from "chalk";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
import r from "node:fs";
|
|
7
|
+
import { fileURLToPath as $ } from "node:url";
|
|
8
|
+
import { cwd as x, argv as C, exit as F } from "node:process";
|
|
9
|
+
const P = {
|
|
10
|
+
_gitignore: ".gitignore",
|
|
11
|
+
"_yarnrc.yml": ".yarnrc.yml",
|
|
12
|
+
_browserslistrc: ".browserslistrc",
|
|
13
|
+
"_commitlintrc.json": ".commitlintrc.json",
|
|
14
|
+
_editorconfig: ".editorconfig",
|
|
15
|
+
_env: ".env",
|
|
16
|
+
_eslintignore: ".eslintignore",
|
|
17
|
+
_prettierignore: ".prettierignore",
|
|
18
|
+
_prettierrc: ".prettierrc",
|
|
19
|
+
"_eslintrc.js": ".eslintrc.js",
|
|
20
|
+
_github: "github",
|
|
21
|
+
_husky: ".husky",
|
|
22
|
+
_vscode: ".vscode",
|
|
23
|
+
_yarn: ".yarn"
|
|
23
24
|
};
|
|
24
|
-
function
|
|
25
|
-
|
|
25
|
+
function h(t) {
|
|
26
|
+
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t);
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
.trim()
|
|
30
|
-
.toLowerCase()
|
|
31
|
-
.replace(/\s+/g, "-")
|
|
32
|
-
.replace(/^[._]/, "")
|
|
33
|
-
.replace(/[^a-z0-9-~]+/g, "-");
|
|
28
|
+
function d(t) {
|
|
29
|
+
return t.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9-~]+/g, "-");
|
|
34
30
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
31
|
+
function z(t) {
|
|
32
|
+
r.existsSync(t);
|
|
39
33
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
function D(t) {
|
|
35
|
+
const a = r.readdirSync(t);
|
|
36
|
+
return a.length === 0 || a.length === 1 && a[0] === ".git";
|
|
43
37
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
if (stat.isDirectory()) {
|
|
47
|
-
copyDir(src, dest);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
fs.copyFileSync(src, dest);
|
|
51
|
-
}
|
|
38
|
+
function _(t, a) {
|
|
39
|
+
r.statSync(t).isDirectory() ? E(t, a) : r.copyFileSync(t, a);
|
|
52
40
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
41
|
+
function E(t, a) {
|
|
42
|
+
r.mkdirSync(a, { recursive: !0 });
|
|
43
|
+
for (const n of r.readdirSync(t)) {
|
|
44
|
+
const m = i.resolve(t, n), c = i.resolve(a, n);
|
|
45
|
+
_(m, c);
|
|
46
|
+
}
|
|
60
47
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
dynamic: "variants/dynamic",
|
|
48
|
+
const O = [
|
|
49
|
+
{
|
|
50
|
+
name: "classic",
|
|
51
|
+
display: "Classic modules boilerplate"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "dynamic",
|
|
55
|
+
display: "Dynamic modules boilerplate"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "both",
|
|
59
|
+
display: "Classic modules + Dynamic modules boilerplate"
|
|
60
|
+
}
|
|
61
|
+
], R = {
|
|
62
|
+
both: "variants/both",
|
|
63
|
+
classic: "variants/classic",
|
|
64
|
+
dynamic: "variants/dynamic"
|
|
79
65
|
};
|
|
80
|
-
async function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
title: variant.display,
|
|
126
|
-
value: variant.name,
|
|
127
|
-
};
|
|
128
|
-
}),
|
|
129
|
-
},
|
|
130
|
-
], {
|
|
131
|
-
onCancel: () => {
|
|
132
|
-
throw new Error(chalk.red("✖") + " Creation cancelled");
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
catch (e) {
|
|
137
|
-
console.log(e.message);
|
|
138
|
-
process.exit(1);
|
|
139
|
-
}
|
|
140
|
-
const { packageName, variant } = config;
|
|
141
|
-
const root = path.join(cwd, dir);
|
|
142
|
-
if (fs.existsSync(root)) {
|
|
143
|
-
emptyDir(root);
|
|
144
|
-
}
|
|
145
|
-
else if (!fs.existsSync(root)) {
|
|
146
|
-
fs.mkdirSync(root);
|
|
147
|
-
}
|
|
148
|
-
console.log(`\nScaffolding app in ${root}...`);
|
|
149
|
-
const templateRoot = path.resolve(fileURLToPath(import.meta.url), "..", "templates");
|
|
150
|
-
const write = (file, templateName, content) => {
|
|
151
|
-
const targetPath = path.join(root, renameFiles[file] ?? file);
|
|
152
|
-
if (content) {
|
|
153
|
-
fs.writeFileSync(targetPath, content);
|
|
66
|
+
async function V() {
|
|
67
|
+
const t = x();
|
|
68
|
+
let n = N(C.slice(2))._[0];
|
|
69
|
+
const m = n || "vc-app", c = () => n === "." ? i.basename(i.resolve()) : n;
|
|
70
|
+
let f;
|
|
71
|
+
try {
|
|
72
|
+
f = await k(
|
|
73
|
+
[
|
|
74
|
+
{
|
|
75
|
+
name: "appName",
|
|
76
|
+
type: n ? null : "text",
|
|
77
|
+
message: o.reset("Project name:"),
|
|
78
|
+
initial: m,
|
|
79
|
+
onState: (e) => n = d(String(e.value).trim()) || m,
|
|
80
|
+
format: (e) => d(String(e).trim())
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: () => !r.existsSync(n) || D(n) ? null : "confirm",
|
|
84
|
+
name: "overwrite",
|
|
85
|
+
message: () => (n === "." ? "Current directory" : `Target directory "${n}"`) + " is not empty. Remove existing files and continue?"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: (e, { overwrite: l }) => {
|
|
89
|
+
if (l === !1)
|
|
90
|
+
throw new Error(o.red("✖") + " Operation cancelled");
|
|
91
|
+
return null;
|
|
92
|
+
},
|
|
93
|
+
name: "overwriteChecker"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "packageName",
|
|
97
|
+
type: () => h(c()) ? null : "text",
|
|
98
|
+
message: o.reset("Package name:"),
|
|
99
|
+
initial: () => d(c()),
|
|
100
|
+
validate: (e) => h(e) || "Invalid package.json name"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: "select",
|
|
104
|
+
name: "variant",
|
|
105
|
+
message: o.reset("Select module variant:"),
|
|
106
|
+
choices: O.map((e) => ({
|
|
107
|
+
title: e.display,
|
|
108
|
+
value: e.name
|
|
109
|
+
}))
|
|
154
110
|
}
|
|
155
|
-
|
|
156
|
-
|
|
111
|
+
],
|
|
112
|
+
{
|
|
113
|
+
onCancel: () => {
|
|
114
|
+
throw new Error(o.red("✖") + " Creation cancelled");
|
|
157
115
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.log(e.message), F(1);
|
|
120
|
+
}
|
|
121
|
+
const { packageName: b, variant: j } = f, s = i.join(t, n);
|
|
122
|
+
r.existsSync(s) ? z(s) : r.existsSync(s) || r.mkdirSync(s), console.log(`
|
|
123
|
+
Scaffolding app in ${s}...`);
|
|
124
|
+
const y = i.resolve($(import.meta.url), "..", "templates"), u = (e, l, p) => {
|
|
125
|
+
const g = i.join(s, P[e] ?? e);
|
|
126
|
+
p ? r.writeFileSync(g, p) : _(i.join(y, l, e), g);
|
|
127
|
+
}, v = (e) => {
|
|
128
|
+
const l = i.resolve(y, e), p = r.readdirSync(l);
|
|
129
|
+
for (const g of p.filter((w) => w !== "package.json"))
|
|
130
|
+
u(g, e);
|
|
131
|
+
};
|
|
132
|
+
v("base"), v(R[j]);
|
|
133
|
+
const S = JSON.parse(r.readFileSync(i.join(y, "./base/package.json"), "utf-8"));
|
|
134
|
+
if (S.name = b || c(), u("package.json", "", JSON.stringify(S, null, 2) + `
|
|
135
|
+
`), console.log(`
|
|
136
|
+
Done. You can now run application:
|
|
137
|
+
`), s !== t) {
|
|
138
|
+
const e = i.relative(t, s);
|
|
139
|
+
console.log(
|
|
140
|
+
` ${o.bold(o.green(`cd ${e.includes(" ") ? `"${e}"` : e}`))}`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
console.log(` ${o.bold(o.green("yarn"))}`), console.log(` ${o.bold(o.green("yarn serve"))}`);
|
|
178
144
|
}
|
|
179
|
-
|
|
180
|
-
|
|
145
|
+
V().catch((t) => {
|
|
146
|
+
console.error(t);
|
|
181
147
|
});
|
|
182
|
-
//# sourceMappingURL=index.js.map
|
package/dist/templates/base/_env
CHANGED
|
@@ -17,51 +17,52 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@commitlint/cli": "^17.6.3",
|
|
19
19
|
"@commitlint/config-conventional": "^17.6.3",
|
|
20
|
-
"@
|
|
20
|
+
"@laynezh/vite-plugin-lib-assets": "^0.5.6",
|
|
21
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
21
22
|
"@types/lodash-es": "^4.17.7",
|
|
22
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
23
|
-
"@typescript-eslint/parser": "^
|
|
24
|
-
"@vc-shell/api-client-generator": "^1.0.
|
|
25
|
-
"@vc-shell/
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@vue/eslint-config-
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
24
|
+
"@typescript-eslint/parser": "^6.13.2",
|
|
25
|
+
"@vc-shell/api-client-generator": "^1.0.129",
|
|
26
|
+
"@vc-shell/release-config": "^1.0.128",
|
|
27
|
+
"@vc-shell/ts-config": "^1.0.129",
|
|
28
|
+
"@vitejs/plugin-vue": "^4.5.1",
|
|
29
|
+
"@vue/eslint-config-prettier": "^8.0.0",
|
|
30
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
29
31
|
"autoprefixer": "^10.4.14",
|
|
30
|
-
"buffer-esm": "^1.2.0",
|
|
31
32
|
"conventional-changelog-cli": "^2.2.2",
|
|
32
33
|
"cross-env": "^7.0.3",
|
|
33
34
|
"eslint": "^8.41.0",
|
|
34
|
-
"eslint-import-resolver-typescript": "^3.
|
|
35
|
-
"eslint-plugin-import": "^2.
|
|
36
|
-
"eslint-plugin-prettier": "^
|
|
37
|
-
"eslint-plugin-vue": "^9.
|
|
35
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
36
|
+
"eslint-plugin-import": "^2.29.0",
|
|
37
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
38
|
+
"eslint-plugin-vue": "^9.19.2",
|
|
38
39
|
"husky": "^8.0.3",
|
|
39
40
|
"lint-staged": "^13.2.2",
|
|
40
41
|
"lodash-es": "^4.17.21",
|
|
41
|
-
"postcss": "^8.4.
|
|
42
|
-
"prettier": "^
|
|
42
|
+
"postcss": "^8.4.32",
|
|
43
|
+
"prettier": "^3.1.0",
|
|
43
44
|
"querystring-es3": "^0.2.1",
|
|
44
|
-
"sass": "^1.
|
|
45
|
+
"sass": "^1.69.5",
|
|
45
46
|
"tailwindcss": "^3.3.2",
|
|
46
47
|
"tsx": "^3.13.0",
|
|
47
|
-
"typescript": "
|
|
48
|
-
"vite": "
|
|
48
|
+
"typescript": "5.3.3",
|
|
49
|
+
"vite": "4.5.0",
|
|
49
50
|
"vite-plugin-checker": "^0.6.0",
|
|
50
51
|
"vite-plugin-mkcert": "^1.15.0",
|
|
51
|
-
"vite-plugin-pwa": "^0.
|
|
52
|
-
"vue-eslint-parser": "^9.3.
|
|
53
|
-
"vue-tsc": "^1.8.
|
|
52
|
+
"vite-plugin-pwa": "^0.17.3",
|
|
53
|
+
"vue-eslint-parser": "^9.3.2",
|
|
54
|
+
"vue-tsc": "^1.8.25"
|
|
54
55
|
},
|
|
55
56
|
"dependencies": {
|
|
56
57
|
"@fortawesome/fontawesome-free": "^5.15.3",
|
|
57
|
-
"@vc-shell/config-generator": "^1.0.
|
|
58
|
-
"@vc-shell/framework": "^1.0.
|
|
59
|
-
"@vueuse/core": "^10.
|
|
60
|
-
"@vueuse/integrations": "^10.
|
|
58
|
+
"@vc-shell/config-generator": "^1.0.129",
|
|
59
|
+
"@vc-shell/framework": "^1.0.129",
|
|
60
|
+
"@vueuse/core": "^10.7.0",
|
|
61
|
+
"@vueuse/integrations": "^10.7.0",
|
|
61
62
|
"moment": "^2.29.4",
|
|
62
63
|
"roboto-fontface": "^0.10.0",
|
|
63
|
-
"vee-validate": "^4.
|
|
64
|
-
"vue": "
|
|
64
|
+
"vee-validate": "^4.11.8",
|
|
65
|
+
"vue": "3.3.13",
|
|
65
66
|
"vue-router": "^4.2.5"
|
|
66
67
|
},
|
|
67
68
|
"lint-staged": {
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VcApp
|
|
3
|
+
:is-ready="isReady"
|
|
4
|
+
:logo="uiSettings.logo"
|
|
5
|
+
:title="uiSettings.title"
|
|
6
|
+
:version="version"
|
|
7
|
+
>
|
|
8
|
+
</VcApp>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts" setup>
|
|
12
|
+
import { useSettings, useUser } from "@vc-shell/framework";
|
|
13
|
+
import { onMounted, ref, watch } from "vue";
|
|
14
|
+
// eslint-disable-next-line import/no-unresolved
|
|
15
|
+
import logoImage from "/assets/logo.svg";
|
|
16
|
+
|
|
17
|
+
const { uiSettings, applySettings } = useSettings();
|
|
18
|
+
const isReady = ref(false);
|
|
19
|
+
const version = import.meta.env.PACKAGE_VERSION;
|
|
20
|
+
|
|
21
|
+
const { isAuthenticated } = useUser();
|
|
22
|
+
|
|
23
|
+
onMounted(async () => {
|
|
24
|
+
try {
|
|
25
|
+
if (isAuthenticated.value) {
|
|
26
|
+
await customizationHandler();
|
|
27
|
+
|
|
28
|
+
isReady.value = true;
|
|
29
|
+
}
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.log(e);
|
|
32
|
+
throw e;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
console.debug(`Initializing App`);
|
|
37
|
+
|
|
38
|
+
async function customizationHandler() {
|
|
39
|
+
applySettings({
|
|
40
|
+
title: uiSettings.value?.title || undefined,
|
|
41
|
+
logo: uiSettings.value?.logo || logoImage,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss">
|
|
47
|
+
:root {
|
|
48
|
+
--background-color: #f5f6f9;
|
|
49
|
+
--top-bar-color: #161d25;
|
|
50
|
+
--basic-black-color: #333333;
|
|
51
|
+
--tooltips-color: #a5a5a5;
|
|
52
|
+
|
|
53
|
+
--primary-color: #43b0e6;
|
|
54
|
+
--primary-color-hover: #319ed4;
|
|
55
|
+
--primary-color-disabled: #a9ddf6;
|
|
56
|
+
|
|
57
|
+
--special-color: #f89406;
|
|
58
|
+
--special-color-hover: #eb8b03;
|
|
59
|
+
--special-color-disabled: #fed498;
|
|
60
|
+
|
|
61
|
+
/* Layout variables */
|
|
62
|
+
--app-bar-background-color: var(--top-bar-color);
|
|
63
|
+
--app-bar-toolbar-icon-background-hover: #2e3d4e;
|
|
64
|
+
--app-bar-toolbar-item-width: 50px;
|
|
65
|
+
--app-bar-toolbar-icon-color: #7e8e9d;
|
|
66
|
+
--app-bar-account-info-role-color: #838d9a;
|
|
67
|
+
|
|
68
|
+
--background-color: #f2f2f2;
|
|
69
|
+
--top-bar-color: #ffffff;
|
|
70
|
+
--app-background: linear-gradient(180deg, #e4f5fb 5.06%, #e8f3f2 100%), linear-gradient(0deg, #e8f2f3, #e8f2f3),
|
|
71
|
+
#eef2f8;
|
|
72
|
+
--app-bar-background-color: #ffffff;
|
|
73
|
+
--app-bar-divider-color: #ffffff;
|
|
74
|
+
--app-bar-toolbar-item-width: 50px;
|
|
75
|
+
--app-bar-toolbar-icon-color: #7e8e9d;
|
|
76
|
+
--app-bar-toolbar-icon-color-hover: #465769;
|
|
77
|
+
--app-bar-toolbar-icon-background-hover: #ffffff;
|
|
78
|
+
--app-bar-account-info-name-color: #161d25;
|
|
79
|
+
--app-bar-account-info-role-color: #7e8e9d;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
html,
|
|
83
|
+
body,
|
|
84
|
+
#app {
|
|
85
|
+
@apply tw-font-roboto tw-h-full tw-w-full tw-m-0 tw-fixed tw-overflow-hidden tw-overscroll-y-none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
body {
|
|
89
|
+
@apply tw-text-base;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
h1,
|
|
93
|
+
h2,
|
|
94
|
+
h3,
|
|
95
|
+
h4,
|
|
96
|
+
h5,
|
|
97
|
+
h6,
|
|
98
|
+
button,
|
|
99
|
+
input,
|
|
100
|
+
select,
|
|
101
|
+
textarea {
|
|
102
|
+
@apply tw-font-roboto;
|
|
103
|
+
}
|
|
104
|
+
::-webkit-input-placeholder {
|
|
105
|
+
@apply tw-font-roboto;
|
|
106
|
+
}
|
|
107
|
+
:-moz-placeholder {
|
|
108
|
+
@apply tw-font-roboto;
|
|
109
|
+
}
|
|
110
|
+
::-moz-placeholder {
|
|
111
|
+
@apply tw-font-roboto;
|
|
112
|
+
}
|
|
113
|
+
:-ms-input-placeholder {
|
|
114
|
+
@apply tw-font-roboto;
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -1,118 +1,10 @@
|
|
|
1
|
-
import { createRouter, createWebHashHistory
|
|
2
|
-
import { inject } from "vue";
|
|
3
|
-
import { useLogin } from "../composables";
|
|
4
|
-
import {
|
|
5
|
-
usePermissions,
|
|
6
|
-
useUser,
|
|
7
|
-
BladePageComponent,
|
|
8
|
-
notification,
|
|
9
|
-
useBladeNavigation,
|
|
10
|
-
Login,
|
|
11
|
-
ResetPassword,
|
|
12
|
-
Invite,
|
|
13
|
-
} from "@vc-shell/framework";
|
|
1
|
+
import { createRouter, createWebHashHistory } from "vue-router";
|
|
14
2
|
|
|
15
|
-
|
|
16
|
-
* Pages
|
|
17
|
-
*/
|
|
18
|
-
import Dashboard from "../pages/Dashboard.vue";
|
|
19
|
-
// eslint-disable-next-line import/no-unresolved
|
|
20
|
-
import App from "./../pages/App.vue";
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line import/no-unresolved
|
|
23
|
-
import whiteLogoImage from "/assets/logo-white.svg";
|
|
24
|
-
// eslint-disable-next-line import/no-unresolved
|
|
25
|
-
import bgImage from "/assets/background.jpg";
|
|
26
|
-
|
|
27
|
-
const routes: RouteRecordRaw[] = [
|
|
28
|
-
{
|
|
29
|
-
path: "/",
|
|
30
|
-
component: App,
|
|
31
|
-
name: "App",
|
|
32
|
-
meta: {
|
|
33
|
-
root: true,
|
|
34
|
-
},
|
|
35
|
-
children: [
|
|
36
|
-
{
|
|
37
|
-
name: "Dashboard",
|
|
38
|
-
path: "",
|
|
39
|
-
alias: "/",
|
|
40
|
-
component: Dashboard,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
path: "/login",
|
|
46
|
-
name: "Login",
|
|
47
|
-
component: Login,
|
|
48
|
-
props: () => ({
|
|
49
|
-
composable: useLogin,
|
|
50
|
-
logo: whiteLogoImage,
|
|
51
|
-
background: bgImage,
|
|
52
|
-
title: "application",
|
|
53
|
-
}),
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: "invite",
|
|
57
|
-
path: "/invite",
|
|
58
|
-
component: Invite,
|
|
59
|
-
props: (route) => ({
|
|
60
|
-
userId: route.query.userId,
|
|
61
|
-
token: route.query.token,
|
|
62
|
-
userName: route.query.userName,
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: "resetpassword",
|
|
67
|
-
path: "/resetpassword",
|
|
68
|
-
component: ResetPassword,
|
|
69
|
-
props: (route) => ({
|
|
70
|
-
userId: route.query.userId,
|
|
71
|
-
token: route.query.token,
|
|
72
|
-
userName: route.query.userName,
|
|
73
|
-
}),
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
path: "/:pathMatch(.*)*",
|
|
77
|
-
component: App,
|
|
78
|
-
beforeEnter: (to) => {
|
|
79
|
-
const { resolveUnknownRoutes } = useBladeNavigation();
|
|
80
|
-
|
|
81
|
-
return resolveUnknownRoutes(to);
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
];
|
|
3
|
+
import { routes } from "./routes";
|
|
85
4
|
|
|
86
5
|
export const router = createRouter({
|
|
87
|
-
history: createWebHashHistory(import.meta.env.APP_BASE_PATH
|
|
88
|
-
routes,
|
|
6
|
+
history: createWebHashHistory(import.meta.env.APP_BASE_PATH),
|
|
7
|
+
routes: [],
|
|
89
8
|
});
|
|
90
9
|
|
|
91
|
-
|
|
92
|
-
const { hasAccess } = usePermissions();
|
|
93
|
-
const { resolveBlades } = useBladeNavigation();
|
|
94
|
-
const { isAuthenticated } = useUser();
|
|
95
|
-
const pages = inject<BladePageComponent[]>("pages");
|
|
96
|
-
|
|
97
|
-
if (to.name !== "Login" && to.name !== "ResetPassword" && to.name !== "Invite") {
|
|
98
|
-
try {
|
|
99
|
-
const component = pages.find((blade) => blade?.url === to.path);
|
|
100
|
-
|
|
101
|
-
const _hasAccess = hasAccess(component?.permissions);
|
|
102
|
-
|
|
103
|
-
if (!(await isAuthenticated()) && to.name !== "Login") {
|
|
104
|
-
return { name: "Login" };
|
|
105
|
-
} else if (_hasAccess && to.name !== "Login") {
|
|
106
|
-
const resolvedBladeUrl = resolveBlades(to);
|
|
107
|
-
return resolvedBladeUrl ? resolvedBladeUrl : true;
|
|
108
|
-
} else if (!_hasAccess) {
|
|
109
|
-
notification.error("Access restricted", {
|
|
110
|
-
timeout: 3000,
|
|
111
|
-
});
|
|
112
|
-
return from.path;
|
|
113
|
-
}
|
|
114
|
-
} catch (e) {
|
|
115
|
-
return { name: "Login" };
|
|
116
|
-
}
|
|
117
|
-
} else return true;
|
|
118
|
-
});
|
|
10
|
+
routes.forEach((route) => router.addRoute(route));
|