@vc-shell/create-vc-app 2.0.0-alpha.3 → 2.0.0-alpha.31
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 +2816 -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 +172 -170
- 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/dynamic-module/vite.config.mts.ejs +1 -1
- package/dist/templates/host-app/_github/COMMIT_CONVENTION.md +1 -1
- package/dist/templates/host-app/_package.json.ejs +7 -10
- package/dist/templates/host-app/src/main.ts.ejs +17 -15
- package/dist/templates/host-app/src/router/routes.ts.ejs +0 -9
- package/dist/templates/host-app/tsconfig.json +1 -0
- package/dist/templates/host-app/vite.config.mts.ejs +3 -6
- 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 +83 -111
- package/dist/templates/module/pages/list.vue.ejs +88 -117
- package/dist/templates/sample-module/index.ts +11 -8
- package/dist/templates/sample-module/pages/details.vue +20 -47
- package/dist/templates/sample-module/pages/list.vue +107 -154
- package/dist/templates/standalone/_github/COMMIT_CONVENTION.md +1 -1
- package/dist/templates/standalone/_package.json.ejs +15 -18
- package/dist/templates/standalone/eslint.config.mjs +31 -0
- package/dist/templates/standalone/src/bootstrap.ts.ejs +5 -5
- package/dist/templates/standalone/src/main.ts.ejs +29 -23
- package/dist/templates/standalone/src/router/routes.ts.ejs +0 -9
- 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 +5 -5
- package/LICENSE +0 -12
- package/dist/templates/host-app/public/assets/1.jpeg +0 -0
- package/dist/templates/host-app/public/assets/2.jpg +0 -0
- package/dist/templates/host-app/public/assets/3.jpg +0 -0
- package/dist/templates/host-app/public/assets/app-select.svg +0 -11
- package/dist/templates/host-app/public/assets/avatar.jpg +0 -0
- package/dist/templates/host-app/public/assets/empty.png +0 -0
- 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/_eslintignore +0 -3
- package/dist/templates/standalone/_eslintrc.js +0 -41
- package/dist/templates/standalone/public/assets/1.jpeg +0 -0
- package/dist/templates/standalone/public/assets/2.jpg +0 -0
- package/dist/templates/standalone/public/assets/3.jpg +0 -0
- package/dist/templates/standalone/public/assets/app-select.svg +0 -11
- package/dist/templates/standalone/public/assets/avatar.jpg +0 -0
- package/dist/templates/standalone/public/assets/empty.png +0 -0
- package/dist/templates/standalone/src/shims-vue.d.ts +0 -27
- package/dist/templates/standalone/src/vue-i18n.d.ts +0 -10
|
@@ -1,117 +1,88 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<VcBlade
|
|
3
|
-
:title="$t('<%- ModuleNameScreamingSnake %>.PAGES.LIST.TITLE')"
|
|
4
|
-
:toolbar-items="bladeToolbar"
|
|
5
|
-
:loading="loading"
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
title: "Refresh",
|
|
90
|
-
icon: "lucide-refresh-cw",
|
|
91
|
-
clickHandler: () => getItems(),
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
id: "add",
|
|
95
|
-
title: "Add",
|
|
96
|
-
icon: "lucide-plus",
|
|
97
|
-
clickHandler: () => openDetails(),
|
|
98
|
-
},
|
|
99
|
-
]);
|
|
100
|
-
|
|
101
|
-
function openDetails(item?: { id?: string }) {
|
|
102
|
-
openBlade({
|
|
103
|
-
blade: markRaw(Details),
|
|
104
|
-
param: item?.id,
|
|
105
|
-
onClose() {
|
|
106
|
-
getItems();
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
getItems();
|
|
112
|
-
|
|
113
|
-
defineExpose({
|
|
114
|
-
title: computed(() => "<%- ModuleNameSentenceCase %>"),
|
|
115
|
-
reload: getItems,
|
|
116
|
-
});
|
|
117
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<VcBlade
|
|
3
|
+
:title="$t('<%- ModuleNameScreamingSnake %>.PAGES.LIST.TITLE')"
|
|
4
|
+
:toolbar-items="bladeToolbar"
|
|
5
|
+
:loading="loading"
|
|
6
|
+
width="50%"
|
|
7
|
+
>
|
|
8
|
+
<VcDataTable
|
|
9
|
+
:items="data"
|
|
10
|
+
:total-count="totalCount"
|
|
11
|
+
:current-page="currentPage"
|
|
12
|
+
:search-value="searchQuery"
|
|
13
|
+
:state-key="'<%- ModuleNameScreamingSnake %>'"
|
|
14
|
+
@search:change="(val: string) => { searchQuery = val; getItems(); }"
|
|
15
|
+
@item-click="openDetails"
|
|
16
|
+
@pagination-click="(page: number) => { currentPage = page; getItems(); }"
|
|
17
|
+
>
|
|
18
|
+
<!-- Add your columns here -->
|
|
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
|
+
</VcDataTable>
|
|
22
|
+
</VcBlade>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import {
|
|
27
|
+
VcBlade,
|
|
28
|
+
VcDataTable,
|
|
29
|
+
VcColumn,
|
|
30
|
+
useBlade,
|
|
31
|
+
type IBladeToolbar,
|
|
32
|
+
} from "@vc-shell/framework";
|
|
33
|
+
import { ref } from "vue";
|
|
34
|
+
import use<%- ModuleNamePascalCase %>List from "../composables/useList";
|
|
35
|
+
import { useI18n } from "vue-i18n";
|
|
36
|
+
|
|
37
|
+
defineBlade({
|
|
38
|
+
url: "/<%- ModuleName %>",
|
|
39
|
+
name: "<%- ModuleNamePascalCase %>List",
|
|
40
|
+
isWorkspace: true,
|
|
41
|
+
menuItem: {
|
|
42
|
+
title: "<%- ModuleNameScreamingSnake %>.MENU.TITLE",
|
|
43
|
+
icon: "lucide-box",
|
|
44
|
+
priority: 10,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const { t } = useI18n({ useScope: "global" });
|
|
49
|
+
const { openBlade, exposeToChildren } = useBlade();
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
data,
|
|
53
|
+
loading,
|
|
54
|
+
totalCount,
|
|
55
|
+
currentPage,
|
|
56
|
+
searchQuery,
|
|
57
|
+
getItems,
|
|
58
|
+
} = use<%- ModuleNamePascalCase %>List();
|
|
59
|
+
|
|
60
|
+
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
61
|
+
{
|
|
62
|
+
id: "refresh",
|
|
63
|
+
title: t("<%- ModuleNameScreamingSnake %>.PAGES.LIST.TOOLBAR.REFRESH"),
|
|
64
|
+
icon: "lucide-refresh-cw",
|
|
65
|
+
clickHandler: () => getItems(),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "add",
|
|
69
|
+
title: t("<%- ModuleNameScreamingSnake %>.PAGES.LIST.TOOLBAR.ADD"),
|
|
70
|
+
icon: "lucide-plus",
|
|
71
|
+
clickHandler: () => openDetails(),
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
74
|
+
|
|
75
|
+
function openDetails(item?: { id?: string }) {
|
|
76
|
+
openBlade({
|
|
77
|
+
name: "<%- ModuleNamePascalCase %>Details",
|
|
78
|
+
param: item?.id,
|
|
79
|
+
onClose() {
|
|
80
|
+
getItems();
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getItems();
|
|
86
|
+
|
|
87
|
+
exposeToChildren({ reload: getItems });
|
|
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";
|
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
<VcBlade
|
|
3
3
|
:loading="loading"
|
|
4
4
|
:title="title"
|
|
5
|
-
:expanded="expanded"
|
|
6
|
-
:closable="closable"
|
|
7
5
|
width="70%"
|
|
8
6
|
:toolbar-items="bladeToolbar"
|
|
9
|
-
@close="$emit('close:blade')"
|
|
10
|
-
@expand="$emit('expand:blade')"
|
|
11
|
-
@collapse="$emit('collapse:blade')"
|
|
12
7
|
>
|
|
13
8
|
<VcContainer class="tw-p-2">
|
|
14
9
|
<VcForm class="tw-space-y-4">
|
|
@@ -130,42 +125,22 @@
|
|
|
130
125
|
</template>
|
|
131
126
|
|
|
132
127
|
<script lang="ts" setup>
|
|
133
|
-
import { IBladeToolbar,
|
|
128
|
+
import { IBladeToolbar, useBlade, useBeforeUnload, usePopup } from "@vc-shell/framework";
|
|
134
129
|
import { useDetails } from "./../composables";
|
|
135
130
|
import { computed, onMounted, ref } from "vue";
|
|
136
131
|
import { Field, useForm } from "vee-validate";
|
|
137
132
|
import { useI18n } from "vue-i18n";
|
|
138
133
|
import * as _ from "lodash-es";
|
|
139
134
|
|
|
140
|
-
|
|
141
|
-
expanded?: boolean;
|
|
142
|
-
closable?: boolean;
|
|
143
|
-
param?: string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export interface Emits {
|
|
147
|
-
(event: "parent:call", args: IParentCallArgs): void;
|
|
148
|
-
(event: "collapse:blade"): void;
|
|
149
|
-
(event: "expand:blade"): void;
|
|
150
|
-
(event: "close:blade"): void;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
defineOptions({
|
|
154
|
-
url: "/sample-details",
|
|
135
|
+
defineBlade({
|
|
155
136
|
name: "SampleDetails",
|
|
137
|
+
url: "/sample-details",
|
|
156
138
|
});
|
|
157
139
|
|
|
158
|
-
const
|
|
159
|
-
expanded: true,
|
|
160
|
-
closable: true,
|
|
161
|
-
param: undefined,
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
const emit = defineEmits<Emits>();
|
|
140
|
+
const { param, closeSelf, callParent, onBeforeClose } = useBlade();
|
|
165
141
|
|
|
166
142
|
const { loading, getItem, saveItem, removeItem, item, currencyOptions, isModified } = useDetails();
|
|
167
143
|
const { showConfirmation } = usePopup();
|
|
168
|
-
const { onBeforeClose } = useBladeNavigation();
|
|
169
144
|
const { t } = useI18n({ useScope: "global" });
|
|
170
145
|
|
|
171
146
|
const { meta } = useForm({
|
|
@@ -177,7 +152,7 @@ const isDisabled = computed(() => {
|
|
|
177
152
|
});
|
|
178
153
|
|
|
179
154
|
const title = computed(() => {
|
|
180
|
-
return
|
|
155
|
+
return param.value
|
|
181
156
|
? item.value?.name
|
|
182
157
|
? item.value?.name + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS")
|
|
183
158
|
: t("SAMPLE_APP.PAGES.DETAILS.TITLE.LOADING")
|
|
@@ -192,10 +167,8 @@ const bladeToolbar = ref<IBladeToolbar[]>([
|
|
|
192
167
|
async clickHandler() {
|
|
193
168
|
await saveItem(item.value);
|
|
194
169
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
emit("close:blade");
|
|
170
|
+
callParent("reload");
|
|
171
|
+
closeSelf();
|
|
199
172
|
},
|
|
200
173
|
disabled: computed(() => !(isModified.value && !isDisabled.value)),
|
|
201
174
|
},
|
|
@@ -205,13 +178,11 @@ const bladeToolbar = ref<IBladeToolbar[]>([
|
|
|
205
178
|
title: "Delete",
|
|
206
179
|
async clickHandler() {
|
|
207
180
|
if (await showConfirmation(t(`SAMPLE_APP.PAGES.ALERTS.DELETE`))) {
|
|
208
|
-
if (
|
|
209
|
-
await removeItem({ id:
|
|
210
|
-
|
|
211
|
-
method: "reload",
|
|
212
|
-
});
|
|
181
|
+
if (param.value) {
|
|
182
|
+
await removeItem({ id: param.value });
|
|
183
|
+
callParent("reload");
|
|
213
184
|
|
|
214
|
-
|
|
185
|
+
closeSelf();
|
|
215
186
|
}
|
|
216
187
|
}
|
|
217
188
|
},
|
|
@@ -219,20 +190,22 @@ const bladeToolbar = ref<IBladeToolbar[]>([
|
|
|
219
190
|
]);
|
|
220
191
|
|
|
221
192
|
onMounted(async () => {
|
|
222
|
-
if (
|
|
223
|
-
await getItem({ id:
|
|
193
|
+
if (param.value) {
|
|
194
|
+
await getItem({ id: param.value });
|
|
224
195
|
}
|
|
225
196
|
});
|
|
226
197
|
|
|
227
198
|
onBeforeClose(async () => {
|
|
228
199
|
if (!isDisabled.value && isModified.value) {
|
|
229
|
-
return await showConfirmation(t("SAMPLE_APP.PAGES.ALERTS.CLOSE_CONFIRMATION"));
|
|
200
|
+
return !(await showConfirmation(t("SAMPLE_APP.PAGES.ALERTS.CLOSE_CONFIRMATION")));
|
|
230
201
|
}
|
|
202
|
+
return false;
|
|
231
203
|
});
|
|
232
204
|
|
|
233
|
-
useBeforeUnload(computed(() => !isDisabled.value && isModified.value));
|
|
234
205
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
useBeforeUnload(computed(() => !isDisabled.value && isModified.value));
|
|
238
211
|
</script>
|