@vc-shell/create-vc-app 1.0.113 → 1.0.115

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +307 -5
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +100 -90
  5. package/dist/index.js.map +1 -0
  6. package/dist/templates/base/.env +4 -0
  7. package/dist/{template → templates}/base/.eslintrc.js +1 -2
  8. package/dist/templates/base/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
  9. package/dist/templates/base/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +28 -0
  10. package/dist/templates/base/.yarn/releases/yarn-3.6.4.cjs +874 -0
  11. package/dist/{template/base/index.html.ejs → templates/base/index.html} +1 -1
  12. package/dist/{template/base/package.json.ejs → templates/base/package.json} +7 -7
  13. package/dist/templates/base/public/assets/1.jpeg +0 -0
  14. package/dist/templates/base/public/assets/2.jpg +0 -0
  15. package/dist/templates/base/public/assets/3.jpg +0 -0
  16. package/dist/{template/code/commonPages → templates/base}/src/composables/useLogin/index.ts +1 -0
  17. package/dist/{template/base/src/router/index.ts.ejs → templates/base/src/router/index.ts} +4 -18
  18. package/dist/{template → templates}/base/tsconfig.json +1 -1
  19. package/dist/{template/base/vite.config.ts.ejs → templates/base/vite.config.ts} +5 -2
  20. package/dist/templates/variants/both/src/main.ts +45 -0
  21. package/dist/templates/variants/both/src/modules/classic-module/composables/index.ts +2 -0
  22. package/dist/templates/variants/both/src/modules/classic-module/composables/useDetails/index.ts +52 -0
  23. package/dist/templates/variants/both/src/modules/classic-module/composables/useList/index.ts +51 -0
  24. package/dist/{template/code/blade/src/modules/default/locales/en.json.ejs → templates/variants/both/src/modules/classic-module/locales/en.json} +6 -3
  25. package/dist/templates/variants/both/src/modules/classic-module/pages/details.vue +83 -0
  26. package/dist/templates/variants/both/src/modules/classic-module/pages/index.ts +2 -0
  27. package/dist/{template/code/blade/src/modules/default/pages/default-list.vue.ejs → templates/variants/both/src/modules/classic-module/pages/list.vue} +93 -30
  28. package/dist/templates/variants/both/src/modules/dynamic-module/components/DynamicItemsMobileGridView.vue +39 -0
  29. package/dist/templates/variants/both/src/modules/dynamic-module/components/index.ts +3 -0
  30. package/dist/templates/variants/both/src/modules/dynamic-module/composables/index.ts +2 -0
  31. package/dist/templates/variants/both/src/modules/dynamic-module/composables/useDetails/index.ts +92 -0
  32. package/dist/templates/variants/both/src/modules/dynamic-module/composables/useList/index.ts +70 -0
  33. package/dist/templates/variants/both/src/modules/dynamic-module/index.ts +9 -0
  34. package/dist/templates/variants/both/src/modules/dynamic-module/locales/en.json +46 -0
  35. package/dist/templates/variants/both/src/modules/dynamic-module/locales/index.ts +2 -0
  36. package/dist/templates/variants/both/src/modules/dynamic-module/pages/details.ts +40 -0
  37. package/dist/templates/variants/both/src/modules/dynamic-module/pages/index.ts +4 -0
  38. package/dist/templates/variants/both/src/modules/dynamic-module/pages/list.ts +50 -0
  39. package/dist/{template/base/src/pages/App.vue.ejs → templates/variants/both/src/pages/App.vue} +24 -28
  40. package/dist/{template/base/src/main.ts.ejs → templates/variants/classic/src/main.ts} +6 -12
  41. package/dist/templates/variants/classic/src/modules/classic-module/components/index.ts +1 -0
  42. package/dist/templates/variants/classic/src/modules/classic-module/composables/index.ts +2 -0
  43. package/dist/templates/variants/classic/src/modules/classic-module/composables/useDetails/index.ts +52 -0
  44. package/dist/templates/variants/classic/src/modules/classic-module/composables/useList/index.ts +51 -0
  45. package/dist/templates/variants/classic/src/modules/classic-module/index.ts +9 -0
  46. package/dist/templates/variants/classic/src/modules/classic-module/locales/en.json +43 -0
  47. package/dist/templates/variants/classic/src/modules/classic-module/locales/index.ts +2 -0
  48. package/dist/templates/variants/classic/src/modules/classic-module/pages/details.vue +83 -0
  49. package/dist/templates/variants/classic/src/modules/classic-module/pages/index.ts +2 -0
  50. package/dist/templates/variants/classic/src/modules/classic-module/pages/list.vue +260 -0
  51. package/dist/templates/variants/classic/src/pages/App.vue +362 -0
  52. package/dist/templates/variants/dynamic/src/main.ts +42 -0
  53. package/dist/templates/variants/dynamic/src/modules/dynamic-module/components/DynamicItemsMobileGridView.vue +39 -0
  54. package/dist/templates/variants/dynamic/src/modules/dynamic-module/components/index.ts +3 -0
  55. package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/index.ts +2 -0
  56. package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/useDetails/index.ts +92 -0
  57. package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/useList/index.ts +70 -0
  58. package/dist/templates/variants/dynamic/src/modules/dynamic-module/index.ts +9 -0
  59. package/dist/templates/variants/dynamic/src/modules/dynamic-module/locales/en.json +46 -0
  60. package/dist/templates/variants/dynamic/src/modules/dynamic-module/locales/index.ts +2 -0
  61. package/dist/templates/variants/dynamic/src/modules/dynamic-module/pages/details.ts +40 -0
  62. package/dist/templates/variants/dynamic/src/modules/dynamic-module/pages/index.ts +4 -0
  63. package/dist/templates/variants/dynamic/src/modules/dynamic-module/pages/list.ts +50 -0
  64. package/dist/templates/variants/dynamic/src/pages/App.vue +362 -0
  65. package/dist/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +9 -8
  67. package/dist/template/base/.env.ejs +0 -6
  68. package/dist/template/code/blade/src/modules/default/composables/index.ts +0 -1
  69. package/dist/template/code/blade/src/modules/default/composables/useDefault/index.ts +0 -9
  70. package/dist/template/code/blade/src/modules/default/pages/index.ts +0 -1
  71. /package/dist/{template → templates}/base/.browserslistrc +0 -0
  72. /package/dist/{template → templates}/base/.commitlintrc.json +0 -0
  73. /package/dist/{template → templates}/base/.editorconfig +0 -0
  74. /package/dist/{template → templates}/base/.eslintignore +0 -0
  75. /package/dist/{template → templates}/base/.husky/commit-msg +0 -0
  76. /package/dist/{template → templates}/base/.husky/pre-commit +0 -0
  77. /package/dist/{template → templates}/base/.prettierignore +0 -0
  78. /package/dist/{template → templates}/base/.prettierrc +0 -0
  79. /package/dist/{template → templates}/base/.vscode/extensions.json +0 -0
  80. /package/dist/{template → templates}/base/.vscode/settings.json +0 -0
  81. /package/dist/{template → templates}/base/LICENSE +0 -0
  82. /package/dist/{template → templates}/base/README.md +0 -0
  83. /package/dist/{template → templates}/base/postcss.config.js +0 -0
  84. /package/dist/{template → templates}/base/public/assets/app-select.svg +0 -0
  85. /package/dist/{template → templates}/base/public/assets/avatar.jpg +0 -0
  86. /package/dist/{template → templates}/base/public/assets/background.jpg +0 -0
  87. /package/dist/{template → templates}/base/public/assets/empty.png +0 -0
  88. /package/dist/{template → templates}/base/public/assets/logo-white.svg +0 -0
  89. /package/dist/{template → templates}/base/public/assets/logo.svg +0 -0
  90. /package/dist/{template → templates}/base/public/img/icons/apple-touch-icon.png +0 -0
  91. /package/dist/{template → templates}/base/public/img/icons/favicon-16x16.png +0 -0
  92. /package/dist/{template → templates}/base/public/img/icons/favicon-32x32.png +0 -0
  93. /package/dist/{template → templates}/base/public/img/icons/favicon.ico +0 -0
  94. /package/dist/{template → templates}/base/public/img/icons/mstile-150x150.png +0 -0
  95. /package/dist/{template → templates}/base/public/img/icons/pwa-192x192.png +0 -0
  96. /package/dist/{template → templates}/base/public/img/icons/pwa-512x512.png +0 -0
  97. /package/dist/{template → templates}/base/public/img/icons/safari-pinned-tab.svg +0 -0
  98. /package/dist/{template → templates}/base/src/api_client/README.md +0 -0
  99. /package/dist/{template/code/commonPages → templates/base}/src/composables/index.ts +0 -0
  100. /package/dist/{template → templates}/base/src/env.d.ts +0 -0
  101. /package/dist/{template → templates}/base/src/locales/en.json +0 -0
  102. /package/dist/{template → templates}/base/src/locales/index.ts +0 -0
  103. /package/dist/{template/code/dashboard → templates/base}/src/pages/Dashboard.vue +0 -0
  104. /package/dist/{template → templates}/base/src/shims-vue.d.ts +0 -0
  105. /package/dist/{template → templates}/base/src/styles/index.scss +0 -0
  106. /package/dist/{template → templates}/base/src/types/index.ts +0 -0
  107. /package/dist/{template → templates}/base/tailwind.config.js +0 -0
  108. /package/dist/{template/code/blade/src/modules/default → templates/variants/both/src/modules/classic-module}/components/index.ts +0 -0
  109. /package/dist/{template/code/blade/src/modules/default → templates/variants/both/src/modules/classic-module}/index.ts +0 -0
  110. /package/dist/{template/code/blade/src/modules/default → templates/variants/both/src/modules/classic-module}/locales/index.ts +0 -0
@@ -0,0 +1,43 @@
1
+ {
2
+ "MODULE": {
3
+ "MENU": {
4
+ "TITLE": "Classic Module"
5
+ },
6
+ "PAGES": {
7
+ "LIST": {
8
+ "TITLE": "Module blade",
9
+ "TOOLBAR": {
10
+ "REFRESH": "Refresh",
11
+ "ADD": "Add",
12
+ "DELETE": "Delete selected"
13
+ },
14
+ "SEARCH": {
15
+ "PLACEHOLDER": "Search keywords"
16
+ },
17
+ "TABLE": {
18
+ "TOTALS": "Count:",
19
+ "HEADER": {
20
+ "PRODUCT_IMAGE": "Pic",
21
+ "PRODUCT_NAME": "Name",
22
+ "CREATED_DATE": "Created"
23
+ },
24
+ "EMPTY": {
25
+ "TITLE": "There are no content yet",
26
+ "ACTION": "Add content"
27
+ },
28
+ "NOT_FOUND": {
29
+ "TITLE": "No content found.",
30
+ "ACTION": "Reset search"
31
+ },
32
+ "ACTIONS": {
33
+ "UNPUBLISH": "Unpublish",
34
+ "PUBLISH": "Publish"
35
+ }
36
+ },
37
+ "MOBILE": {
38
+ "CREATED": "Created"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,2 @@
1
+ import * as en from "./en.json";
2
+ export { en };
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <VcBlade
3
+ v-loading="loading"
4
+ :title="item.name"
5
+ :expanded="expanded"
6
+ :closable="closable"
7
+ width="70%"
8
+ :toolbar-items="bladeToolbar"
9
+ @close="$emit('close:blade')"
10
+ @expand="$emit('expand:blade')"
11
+ @collapse="$emit('collapse:blade')"
12
+ >
13
+ <VcContainer class="tw-p-2">
14
+ <VcForm>
15
+ <VcInput
16
+ :model-value="item.name"
17
+ label="Name"
18
+ class="tw-mb-4"
19
+ ></VcInput>
20
+ <VcInput
21
+ :model-value="item.createdDate"
22
+ label="Date"
23
+ type="datetime-local"
24
+ ></VcInput>
25
+ </VcForm>
26
+ </VcContainer>
27
+ </VcBlade>
28
+ </template>
29
+
30
+ <script lang="ts" setup>
31
+ import { IBladeToolbar, IParentCallArgs } from "@vc-shell/framework";
32
+ import { useDetails } from "./../composables";
33
+ import { computed, onMounted, ref } from "vue";
34
+ import { useI18n } from "vue-i18n";
35
+
36
+ export interface Props {
37
+ expanded?: boolean;
38
+ closable?: boolean;
39
+ param?: string;
40
+ }
41
+
42
+ export interface Emits {
43
+ (event: "parent:call", args: IParentCallArgs): void;
44
+ (event: "collapse:blade"): void;
45
+ (event: "expand:blade"): void;
46
+ (event: "close:blade"): void;
47
+ }
48
+
49
+ defineOptions({
50
+ url: "/classic-module-details",
51
+ });
52
+
53
+ const props = withDefaults(defineProps<Props>(), {
54
+ expanded: true,
55
+ closable: true,
56
+ param: undefined,
57
+ });
58
+
59
+ const emit = defineEmits<Emits>();
60
+
61
+ const { t } = useI18n({ useScope: "global" });
62
+
63
+ const { item, loading, getItem } = useDetails();
64
+
65
+ const bladeToolbar = ref<IBladeToolbar[]>([
66
+ {
67
+ id: "refresh",
68
+ title: computed(() => t("MODULE.PAGES.LIST.TOOLBAR.REFRESH")),
69
+ icon: "fas fa-sync-alt",
70
+ async clickHandler() {
71
+ await getItem({ id: props.param });
72
+ },
73
+ },
74
+ ]);
75
+
76
+ onMounted(async () => {
77
+ if (props.param) {
78
+ await getItem({ id: props.param });
79
+ }
80
+ });
81
+ </script>
82
+
83
+ <style lang="scss" scoped></style>
@@ -0,0 +1,2 @@
1
+ export { default as List } from "./list.vue";
2
+ export {default as Details } from './details.vue'
@@ -0,0 +1,260 @@
1
+ <template>
2
+ <VcBlade
3
+ :title="$t('MODULE.PAGES.LIST.TITLE')"
4
+ width="50%"
5
+ :expanded="expanded"
6
+ :closable="closable"
7
+ :toolbar-items="bladeToolbar"
8
+ @close="$emit('close:blade')"
9
+ @expand="$emit('expand:blade')"
10
+ @collapse="$emit('collapse:blade')"
11
+ >
12
+ <!-- Blade contents -->
13
+ <VcTable
14
+ :expanded="expanded"
15
+ :empty="empty"
16
+ :notfound="notfound"
17
+ class="tw-grow tw-basis-0"
18
+ :multiselect="true"
19
+ :loading="loading"
20
+ :columns="columns"
21
+ :item-action-builder="actionBuilder"
22
+ :sort="sort"
23
+ :pages="pages"
24
+ :total-count="totalCount"
25
+ :search-value="searchValue"
26
+ :current-page="currentPage"
27
+ :search-placeholder="$t('MODULE.PAGES.LIST.SEARCH.PLACEHOLDER')"
28
+ :total-label="$t('MODULE.PAGES.LIST.TABLE.TOTALS')"
29
+ :selected-item-id="selectedItemId"
30
+ state-key="module"
31
+ :items="data"
32
+ @item-click="onItemClick"
33
+ @header-click="onHeaderClick"
34
+ >
35
+ <template #mobile-item="itemData">
36
+ <div class="tw-border-b tw-border-solid tw-border-b-[#e3e7ec] tw-py-3 tw-px-4">
37
+ <div class="tw-w-full tw-flex tw-justify-evenly tw-mb-2">
38
+ <VcImage
39
+ class="tw-shrink-0"
40
+ aspect="1x1"
41
+ size="s"
42
+ :bordered="true"
43
+ :src="itemData.item.imgSrc"
44
+ ></VcImage>
45
+ <div class="tw-grow tw-basis-0 tw-ml-3">
46
+ <div class="tw-font-bold tw-text-lg">
47
+ {{ itemData.item.name }}
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <div class="tw-truncate tw-grow-[2] tw-basis-0">
52
+ <VcHint>{{ $t("MODULE.PAGES.LIST.MOBILE.CREATED") }}</VcHint>
53
+ <div class="tw-truncate tw-mt-1">
54
+ {{ itemData.item.createdDate }}
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </template>
59
+ </VcTable>
60
+ </VcBlade>
61
+ </template>
62
+
63
+ <script lang="ts" setup>
64
+ import { computed, inject, reactive, ref, markRaw, onMounted, watch } from "vue";
65
+ import {
66
+ IBladeEvent,
67
+ IBladeToolbar,
68
+ IParentCallArgs,
69
+ IActionBuilderResult,
70
+ ITableColumns,
71
+ useBladeNavigation,
72
+ } from "@vc-shell/framework";
73
+ // eslint-disable-next-line import/no-unresolved
74
+ import emptyImage from "/assets/empty.png";
75
+ import { useI18n } from "vue-i18n";
76
+ import { useList } from "./../composables";
77
+ import Details from "./details.vue";
78
+
79
+ export interface Props {
80
+ expanded?: boolean;
81
+ closable?: boolean;
82
+ param?: string;
83
+ options?: Record<string, unknown>;
84
+ }
85
+
86
+ export interface Emits {
87
+ (event: "parent:call", args: IParentCallArgs): void;
88
+ (event: "collapse:blade"): void;
89
+ (event: "expand:blade"): void;
90
+ (event: "open:blade", blade: IBladeEvent);
91
+ (event: "close:blade"): void;
92
+ }
93
+
94
+ defineOptions({
95
+ url: "/classic-module-list",
96
+ });
97
+
98
+ const props = withDefaults(defineProps<Props>(), {
99
+ expanded: true,
100
+ closable: true,
101
+ });
102
+
103
+ defineEmits<Emits>();
104
+
105
+ const { t } = useI18n({ useScope: "global" });
106
+ const { openBlade } = useBladeNavigation();
107
+ const { getItems, data, loading, totalCount, pages, currentPage } = useList();
108
+
109
+ const sort = ref("createdDate:DESC");
110
+ const searchValue = ref();
111
+ const selectedItemId = ref<string>();
112
+
113
+ watch(
114
+ () => props.param,
115
+ (newVal) => {
116
+ if (newVal) {
117
+ selectedItemId.value = newVal;
118
+
119
+ openBlade({
120
+ blade: markRaw(Details),
121
+ param: newVal,
122
+ onOpen() {
123
+ selectedItemId.value = newVal;
124
+ },
125
+ onClose() {
126
+ selectedItemId.value = undefined;
127
+ },
128
+ });
129
+ }
130
+ },
131
+ { immediate: true }
132
+ );
133
+
134
+ onMounted(async () => {
135
+ await getItems();
136
+ });
137
+
138
+ const bladeToolbar = ref<IBladeToolbar[]>([
139
+ {
140
+ id: "refresh",
141
+ title: computed(() => t("MODULE.PAGES.LIST.TOOLBAR.REFRESH")),
142
+ icon: "fas fa-sync-alt",
143
+ async clickHandler() {
144
+ await reload();
145
+ },
146
+ },
147
+ ]);
148
+
149
+ const tableColumns = ref<ITableColumns[]>([
150
+ {
151
+ id: "imgSrc",
152
+ title: computed(() => t("MODULE.PAGES.LIST.TABLE.HEADER.PRODUCT_IMAGE")),
153
+ width: 60,
154
+ alwaysVisible: true,
155
+ type: "image",
156
+ },
157
+ {
158
+ id: "name",
159
+ field: "name",
160
+ title: computed(() => t("MODULE.PAGES.LIST.TABLE.HEADER.PRODUCT_NAME")),
161
+ alwaysVisible: true,
162
+ },
163
+ {
164
+ id: "createdDate",
165
+ title: computed(() => t("MODULE.PAGES.LIST.TABLE.HEADER.CREATED_DATE")),
166
+ width: 140,
167
+ type: "date-ago",
168
+ },
169
+ ]);
170
+
171
+ const empty = reactive({
172
+ image: emptyImage,
173
+ text: computed(() => t("MODULE.PAGES.LIST.TABLE.EMPTY.TITLE")),
174
+ action: computed(() => t("MODULE.PAGES.LIST.TABLE.EMPTY.ACTION")),
175
+ // clickHandler: () => {},
176
+ });
177
+
178
+ const notfound = reactive({
179
+ image: emptyImage,
180
+ text: computed(() => t("MODULE.PAGES.LIST.TABLE.NOT_FOUND.TITLE")),
181
+ action: computed(() => t("MODULE.PAGES.LIST.TABLE.NOT_FOUND.ACTION")),
182
+ clickHandler: async () => {
183
+ searchValue.value = "";
184
+ },
185
+ });
186
+
187
+ const columns = computed(() => {
188
+ if (props.expanded) {
189
+ return tableColumns.value;
190
+ } else {
191
+ return tableColumns.value.filter((item) => item.alwaysVisible === true);
192
+ }
193
+ });
194
+
195
+ const title = computed(() => t("MODULE.PAGES.LIST.TITLE"));
196
+
197
+ const reload = async () => {
198
+ await getItems();
199
+ };
200
+
201
+ const onItemClick = (item: { id: string }) => {
202
+ openBlade({
203
+ blade: markRaw(Details),
204
+ param: item.id,
205
+ onOpen() {
206
+ selectedItemId.value = item.id;
207
+ },
208
+ onClose() {
209
+ selectedItemId.value = undefined;
210
+ },
211
+ });
212
+ };
213
+
214
+ const onHeaderClick = (item: ITableColumns) => {
215
+ const sortOptions = ["DESC", "ASC", ""];
216
+
217
+ if (item.sortable) {
218
+ if (sort.value.split(":")[0] === item.id) {
219
+ const index = sortOptions.findIndex((x) => {
220
+ const sorting = sort.value.split(":")[1];
221
+ if (sorting) {
222
+ return x === sorting;
223
+ } else {
224
+ return x === "";
225
+ }
226
+ });
227
+
228
+ if (index !== -1) {
229
+ const newSort = sortOptions[(index + 1) % sortOptions.length];
230
+
231
+ if (newSort === "") {
232
+ sort.value = `${item.id}`;
233
+ } else {
234
+ sort.value = `${item.id}:${newSort}`;
235
+ }
236
+ }
237
+ } else {
238
+ sort.value = `${item.id}:${sortOptions[0]}`;
239
+ }
240
+ }
241
+ };
242
+
243
+ const actionBuilder = (item: { status: string }): IActionBuilderResult[] => {
244
+ const result = [];
245
+
246
+ result.push({
247
+ icon: "fas fa-trash",
248
+ title: "Delete",
249
+ variant: "danger",
250
+ leftActions: true,
251
+ // clickHandler() {},
252
+ });
253
+
254
+ return result;
255
+ };
256
+
257
+ defineExpose({
258
+ title,
259
+ });
260
+ </script>