@vc-shell/create-vc-app 2.0.0-alpha.16 → 2.0.0-alpha.17
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/commands/init.d.ts.map +1 -1
- package/dist/commands/init.test.d.ts +2 -0
- package/dist/commands/init.test.d.ts.map +1 -0
- package/dist/engine/codegen.d.ts.map +1 -1
- package/dist/engine/helpers.d.ts +1 -1
- package/dist/engine/helpers.d.ts.map +1 -1
- package/dist/engine/helpers.test.d.ts +2 -0
- package/dist/engine/helpers.test.d.ts.map +1 -0
- package/dist/engine/template.d.ts.map +1 -1
- package/dist/engine/template.test.d.ts +2 -0
- package/dist/engine/template.test.d.ts.map +1 -0
- package/dist/index.js +169 -165
- package/dist/output.d.ts.map +1 -1
- package/dist/templates/dynamic-module/_package.json.ejs +6 -6
- package/dist/templates/dynamic-module/src/modules/index.ts.ejs +8 -5
- package/dist/templates/dynamic-module/tsconfig.json +1 -1
- package/dist/templates/host-app/_package.json.ejs +7 -9
- package/dist/templates/host-app/src/main.ts.ejs +17 -15
- package/dist/templates/host-app/tsconfig.json +1 -0
- package/dist/templates/module/composables/useDetails.ts.ejs +41 -38
- package/dist/templates/module/index.ts.ejs +11 -8
- package/dist/templates/module/locales/en.json.ejs +33 -22
- package/dist/templates/module/pages/details.vue.ejs +10 -12
- package/dist/templates/module/pages/list.vue.ejs +11 -13
- package/dist/templates/sample-module/index.ts +11 -8
- package/dist/templates/sample-module/pages/details.vue +8 -4
- package/dist/templates/sample-module/pages/list.vue +103 -119
- package/dist/templates/standalone/_package.json.ejs +7 -9
- package/dist/templates/standalone/src/bootstrap.ts.ejs +5 -5
- package/dist/templates/standalone/src/main.ts.ejs +29 -23
- package/dist/templates/standalone/tsconfig.json +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/templates/host-app/src/shims-vue.d.ts +0 -27
- package/dist/templates/host-app/src/vue-i18n.d.ts +0 -10
- package/dist/templates/standalone/src/shims-vue.d.ts +0 -27
- package/dist/templates/standalone/src/vue-i18n.d.ts +0 -10
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@types/node": "^20.10.5",
|
|
23
23
|
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
24
24
|
"@typescript-eslint/parser": "^7.4.0",
|
|
25
|
-
"@vc-shell/api-client-generator": "^2.0.0-alpha.
|
|
26
|
-
"@vc-shell/ts-config": "^2.0.0-alpha.
|
|
25
|
+
"@vc-shell/api-client-generator": "^2.0.0-alpha.17",
|
|
26
|
+
"@vc-shell/ts-config": "^2.0.0-alpha.17",
|
|
27
27
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
28
28
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
29
29
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
@@ -48,18 +48,16 @@
|
|
|
48
48
|
"vite-plugin-checker": "^0.9.1",
|
|
49
49
|
"vite-plugin-mkcert": "^1.17.1",
|
|
50
50
|
"vue-eslint-parser": "^9.3.2",
|
|
51
|
-
"vue-tsc": "^
|
|
51
|
+
"vue-tsc": "^3.2.5"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vc-shell/config-generator": "^2.0.0-alpha.
|
|
55
|
-
"@vc-shell/framework": "^2.0.0-alpha.
|
|
54
|
+
"@vc-shell/config-generator": "^2.0.0-alpha.17",
|
|
55
|
+
"@vc-shell/framework": "^2.0.0-alpha.17",
|
|
56
56
|
"@vueuse/core": "^10.7.1",
|
|
57
57
|
"@vueuse/integrations": "^10.7.1",
|
|
58
|
-
"cross-spawn": "^7.0.3",
|
|
59
|
-
"moment": "^2.30.1",
|
|
60
58
|
"vee-validate": "^4.12.4",
|
|
61
|
-
"vue": "^3.5.
|
|
62
|
-
"vue-router": "^
|
|
59
|
+
"vue": "^3.5.30",
|
|
60
|
+
"vue-router": "^5.0.3"
|
|
63
61
|
},
|
|
64
62
|
"lint-staged": {
|
|
65
63
|
"*.{js,ts,html,css}": "prettier --write '**/*.{ts,vue}'",
|
|
@@ -16,24 +16,26 @@ async function startApp() {
|
|
|
16
16
|
console.log(e);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const { currentLocale, setLocale } = useLanguages();
|
|
20
|
+
|
|
21
|
+
const app = createApp(RouterView);
|
|
22
|
+
|
|
23
|
+
app.use(VirtoShellFramework, {
|
|
24
|
+
router,
|
|
25
|
+
i18n: {
|
|
26
|
+
locale: import.meta.env.APP_I18N_LOCALE,
|
|
27
|
+
fallbackLocale: import.meta.env.APP_I18N_FALLBACK_LOCALE,
|
|
28
|
+
},
|
|
26
29
|
<% if (aiAgent) { %>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
30
|
+
aiAgent: {
|
|
31
|
+
config: {
|
|
32
|
+
url: import.meta.env.APP_AI_AGENT_URL,
|
|
31
33
|
},
|
|
34
|
+
},
|
|
32
35
|
<% } %>
|
|
33
|
-
|
|
34
|
-
.use(router);
|
|
36
|
+
});
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
app.use(router);
|
|
37
39
|
|
|
38
40
|
bootstrap(app);
|
|
39
41
|
|
|
@@ -43,7 +45,7 @@ async function startApp() {
|
|
|
43
45
|
|
|
44
46
|
setLocale(currentLocale.value);
|
|
45
47
|
|
|
46
|
-
app.config.errorHandler = (err) => {
|
|
48
|
+
app.config.errorHandler = (err: unknown) => {
|
|
47
49
|
notification.error((err as Error).toString(), {
|
|
48
50
|
timeout: 5000,
|
|
49
51
|
});
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
3
|
-
|
|
4
|
-
export default function use<%- ModuleNamePascalCase %>Details() {
|
|
5
|
-
const item = ref<Record<string,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { useAsync, useLoading, useModificationTracker } from "@vc-shell/framework";
|
|
3
|
+
|
|
4
|
+
export default function use<%- ModuleNamePascalCase %>Details() {
|
|
5
|
+
const item = ref<Record<string, any>>({});
|
|
6
|
+
const { isModified, resetModificationState } = useModificationTracker(item);
|
|
7
|
+
|
|
8
|
+
const { loading: itemLoading, action: fetchItem } = useAsync(async (id?: string) => {
|
|
9
|
+
// TODO: Replace with real API call
|
|
10
|
+
// const result = await apiClient.getById(id);
|
|
11
|
+
// item.value = result;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const { loading: saveLoading, action: saveAction } = useAsync(async () => {
|
|
15
|
+
// TODO: Replace with real API call
|
|
16
|
+
// if (item.value.id) {
|
|
17
|
+
// await apiClient.update(item.value);
|
|
18
|
+
// } else {
|
|
19
|
+
// await apiClient.create(item.value);
|
|
20
|
+
// }
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const loading = useLoading(itemLoading, saveLoading);
|
|
24
|
+
|
|
25
|
+
async function getItem(id: string) {
|
|
26
|
+
await fetchItem(id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function saveItem() {
|
|
30
|
+
await saveAction();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
item,
|
|
35
|
+
loading,
|
|
36
|
+
getItem,
|
|
37
|
+
saveItem,
|
|
38
|
+
isModified,
|
|
39
|
+
resetModificationState,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as locales from "./locales";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export default
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as blades from "./pages";
|
|
2
|
+
import * as locales from "./locales";
|
|
3
|
+
import { defineAppModule } from "@vc-shell/framework";
|
|
4
|
+
|
|
5
|
+
export default defineAppModule({
|
|
6
|
+
blades,
|
|
7
|
+
locales,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export * from "./pages";
|
|
11
|
+
export * from "./composables";
|
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"<%- ModuleNameScreamingSnake %>": {
|
|
3
|
-
"MENU": {
|
|
4
|
-
"TITLE": "<%- ModuleNameSentenceCase %>"
|
|
5
|
-
},
|
|
6
|
-
"PAGES": {
|
|
7
|
-
"LIST": {
|
|
8
|
-
"TITLE": "<%- ModuleNameSentenceCase %>",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
{
|
|
2
|
+
"<%- ModuleNameScreamingSnake %>": {
|
|
3
|
+
"MENU": {
|
|
4
|
+
"TITLE": "<%- ModuleNameSentenceCase %>"
|
|
5
|
+
},
|
|
6
|
+
"PAGES": {
|
|
7
|
+
"LIST": {
|
|
8
|
+
"TITLE": "<%- ModuleNameSentenceCase %>",
|
|
9
|
+
"COLUMNS": {
|
|
10
|
+
"NAME": "Name",
|
|
11
|
+
"CREATED_DATE": "Created"
|
|
12
|
+
},
|
|
13
|
+
"TOOLBAR": {
|
|
14
|
+
"REFRESH": "Refresh",
|
|
15
|
+
"ADD": "Add"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"DETAILS": {
|
|
19
|
+
"TITLE": "<%- ModuleNameSentenceCase %> Details",
|
|
20
|
+
"TITLE_NEW": "New <%- ModuleNameSentenceCase %>",
|
|
21
|
+
"FIELDS": {
|
|
22
|
+
"NAME": "Name"
|
|
23
|
+
},
|
|
24
|
+
"TOOLBAR": {
|
|
25
|
+
"SAVE": "Save"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"ALERTS": {
|
|
30
|
+
"CLOSE_CONFIRMATION": "You have unsaved changes. Are you sure you want to close?"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<!-- Add your form fields here -->
|
|
11
11
|
<VcInput
|
|
12
12
|
v-model="item.name"
|
|
13
|
-
:label="'
|
|
13
|
+
:label="$t('<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.FIELDS.NAME')"
|
|
14
14
|
required
|
|
15
15
|
/>
|
|
16
16
|
</VcForm>
|
|
@@ -32,29 +32,30 @@ import {
|
|
|
32
32
|
} from "@vc-shell/framework";
|
|
33
33
|
import { ref, computed, onMounted } from "vue";
|
|
34
34
|
import use<%- ModuleNamePascalCase %>Details from "../composables/useDetails";
|
|
35
|
+
import { useI18n } from "vue-i18n";
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
defineBlade({
|
|
37
38
|
url: "/<%- ModuleName %>-details",
|
|
38
39
|
name: "<%- ModuleNamePascalCase %>Details",
|
|
39
40
|
});
|
|
40
41
|
|
|
42
|
+
const { t } = useI18n({ useScope: "global" });
|
|
41
43
|
const { param, closeSelf, callParent, onBeforeClose } = useBlade();
|
|
42
44
|
|
|
43
45
|
const { showConfirmation } = usePopup();
|
|
44
46
|
|
|
45
|
-
const { item, loading, getItem, saveItem } = use<%- ModuleNamePascalCase %>Details();
|
|
46
|
-
const { isModified, resetModificationState } = useModificationTracker(item);
|
|
47
|
+
const { item, loading, getItem, saveItem, isModified, resetModificationState } = use<%- ModuleNamePascalCase %>Details();
|
|
47
48
|
|
|
48
49
|
const title = computed(() => {
|
|
49
50
|
return param.value
|
|
50
|
-
? String(item.value?.name || "<%-
|
|
51
|
-
: "
|
|
51
|
+
? String(item.value?.name || t("<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.TITLE"))
|
|
52
|
+
: t("<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.TITLE_NEW");
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
55
56
|
{
|
|
56
57
|
id: "save",
|
|
57
|
-
title: "
|
|
58
|
+
title: t("<%- ModuleNameScreamingSnake %>.PAGES.DETAILS.TOOLBAR.SAVE"),
|
|
58
59
|
icon: "lucide-save",
|
|
59
60
|
disabled: computed(() => !isModified.value),
|
|
60
61
|
async clickHandler() {
|
|
@@ -73,13 +74,10 @@ onMounted(async () => {
|
|
|
73
74
|
|
|
74
75
|
onBeforeClose(async () => {
|
|
75
76
|
if (isModified.value) {
|
|
76
|
-
return await showConfirmation("
|
|
77
|
+
return !(await showConfirmation(t("<%- ModuleNameScreamingSnake %>.ALERTS.CLOSE_CONFIRMATION")));
|
|
77
78
|
}
|
|
79
|
+
return false;
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
useBeforeUnload(computed(() => isModified.value));
|
|
81
|
-
|
|
82
|
-
defineExpose({
|
|
83
|
-
title,
|
|
84
|
-
});
|
|
85
83
|
</script>
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
@pagination-click="(page: number) => { currentPage = page; getItems(); }"
|
|
17
17
|
>
|
|
18
18
|
<!-- Add your columns here -->
|
|
19
|
-
<VcColumn id="name" :header="'
|
|
20
|
-
<VcColumn id="createdDate" :header="'
|
|
19
|
+
<VcColumn id="name" :header="$t('<%- ModuleNameScreamingSnake %>.PAGES.LIST.COLUMNS.NAME')" sortable />
|
|
20
|
+
<VcColumn id="createdDate" :header="$t('<%- ModuleNameScreamingSnake %>.PAGES.LIST.COLUMNS.CREATED_DATE')" type="datetime" sortable />
|
|
21
21
|
</VcDataTable>
|
|
22
22
|
</VcBlade>
|
|
23
23
|
</template>
|
|
@@ -30,11 +30,11 @@ import {
|
|
|
30
30
|
useBlade,
|
|
31
31
|
type IBladeToolbar,
|
|
32
32
|
} from "@vc-shell/framework";
|
|
33
|
-
import { ref
|
|
33
|
+
import { ref } from "vue";
|
|
34
34
|
import use<%- ModuleNamePascalCase %>List from "../composables/useList";
|
|
35
|
-
import
|
|
35
|
+
import { useI18n } from "vue-i18n";
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
defineBlade({
|
|
38
38
|
url: "/<%- ModuleName %>",
|
|
39
39
|
name: "<%- ModuleNamePascalCase %>List",
|
|
40
40
|
isWorkspace: true,
|
|
@@ -45,7 +45,8 @@ defineOptions({
|
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
const {
|
|
48
|
+
const { t } = useI18n({ useScope: "global" });
|
|
49
|
+
const { openBlade, exposeToChildren } = useBlade();
|
|
49
50
|
|
|
50
51
|
const {
|
|
51
52
|
data,
|
|
@@ -59,13 +60,13 @@ const {
|
|
|
59
60
|
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
60
61
|
{
|
|
61
62
|
id: "refresh",
|
|
62
|
-
title: "
|
|
63
|
+
title: t("<%- ModuleNameScreamingSnake %>.PAGES.LIST.TOOLBAR.REFRESH"),
|
|
63
64
|
icon: "lucide-refresh-cw",
|
|
64
65
|
clickHandler: () => getItems(),
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
68
|
id: "add",
|
|
68
|
-
title: "
|
|
69
|
+
title: t("<%- ModuleNameScreamingSnake %>.PAGES.LIST.TOOLBAR.ADD"),
|
|
69
70
|
icon: "lucide-plus",
|
|
70
71
|
clickHandler: () => openDetails(),
|
|
71
72
|
},
|
|
@@ -73,7 +74,7 @@ const bladeToolbar = ref<IBladeToolbar[]>([
|
|
|
73
74
|
|
|
74
75
|
function openDetails(item?: { id?: string }) {
|
|
75
76
|
openBlade({
|
|
76
|
-
|
|
77
|
+
name: "<%- ModuleNamePascalCase %>Details",
|
|
77
78
|
param: item?.id,
|
|
78
79
|
onClose() {
|
|
79
80
|
getItems();
|
|
@@ -83,8 +84,5 @@ function openDetails(item?: { id?: string }) {
|
|
|
83
84
|
|
|
84
85
|
getItems();
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
title: computed(() => "<%- ModuleNameSentenceCase %>"),
|
|
88
|
-
reload: getItems,
|
|
89
|
-
});
|
|
87
|
+
exposeToChildren({ reload: getItems });
|
|
90
88
|
</script>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as locales from "./locales";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export default
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as blades from "./pages";
|
|
2
|
+
import * as locales from "./locales";
|
|
3
|
+
import { defineAppModule } from "@vc-shell/framework";
|
|
4
|
+
|
|
5
|
+
export default defineAppModule({
|
|
6
|
+
blades,
|
|
7
|
+
locales,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export * from "./pages";
|
|
11
|
+
export * from "./composables";
|
|
@@ -132,9 +132,9 @@ import { Field, useForm } from "vee-validate";
|
|
|
132
132
|
import { useI18n } from "vue-i18n";
|
|
133
133
|
import * as _ from "lodash-es";
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
url: "/sample-details",
|
|
135
|
+
defineBlade({
|
|
137
136
|
name: "SampleDetails",
|
|
137
|
+
url: "/sample-details",
|
|
138
138
|
});
|
|
139
139
|
|
|
140
140
|
const { param, closeSelf, callParent, onBeforeClose } = useBlade();
|
|
@@ -197,11 +197,15 @@ onMounted(async () => {
|
|
|
197
197
|
|
|
198
198
|
onBeforeClose(async () => {
|
|
199
199
|
if (!isDisabled.value && isModified.value) {
|
|
200
|
-
return await showConfirmation(t("SAMPLE_APP.PAGES.ALERTS.CLOSE_CONFIRMATION"));
|
|
200
|
+
return !(await showConfirmation(t("SAMPLE_APP.PAGES.ALERTS.CLOSE_CONFIRMATION")));
|
|
201
201
|
}
|
|
202
|
+
return false;
|
|
202
203
|
});
|
|
203
204
|
|
|
204
|
-
useBeforeUnload(computed(() => !isDisabled.value && isModified.value));
|
|
205
205
|
|
|
206
206
|
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
useBeforeUnload(computed(() => !isDisabled.value && isModified.value));
|
|
207
211
|
</script>
|