@vc-shell/create-vc-app 1.0.340 → 1.1.0-alpha.2

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 (84) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +30 -30
  3. package/dist/index.js +154 -186
  4. package/dist/templates/base/LICENSE +12 -12
  5. package/dist/templates/base/README.md +54 -54
  6. package/dist/templates/base/_browserslistrc +3 -3
  7. package/dist/templates/base/_commitlintrc.json +3 -3
  8. package/dist/templates/base/_editorconfig +22 -22
  9. package/dist/templates/base/_env +3 -3
  10. package/dist/templates/base/_env.local +1 -1
  11. package/dist/templates/base/_eslintignore +3 -3
  12. package/dist/templates/base/_eslintrc.js +41 -41
  13. package/dist/templates/base/_github/COMMIT_CONVENTION.md +91 -91
  14. package/dist/templates/base/_github/PULL_REQUEST_TEMPLATE.md +8 -8
  15. package/dist/templates/base/_gitignore +71 -71
  16. package/dist/templates/base/_husky/commit-msg +4 -4
  17. package/dist/templates/base/_husky/pre-commit +4 -4
  18. package/dist/templates/base/_package.json +5 -6
  19. package/dist/templates/base/_prettierignore +4 -4
  20. package/dist/templates/base/_prettierrc +4 -4
  21. package/dist/templates/base/_vscode/extensions.json +14 -14
  22. package/dist/templates/base/_vscode/settings.json +14 -14
  23. package/dist/templates/base/_yarn/releases/yarn-4.0.2.cjs +893 -893
  24. package/dist/templates/base/_yarnrc.yml +7 -7
  25. package/dist/templates/base/index.html +26 -26
  26. package/dist/templates/base/postcss.config.cjs +6 -6
  27. package/dist/templates/base/public/assets/app-select.svg +11 -11
  28. package/dist/templates/base/public/assets/logo-white.svg +21 -21
  29. package/dist/templates/base/public/assets/logo.svg +8 -8
  30. package/dist/templates/base/public/img/icons/safari-pinned-tab.svg +32 -32
  31. package/dist/templates/base/scripts/release.ts +18 -18
  32. package/dist/templates/base/src/api_client/README.md +78 -78
  33. package/dist/templates/base/src/composables/index.ts +1 -1
  34. package/dist/templates/base/src/env.d.ts +9 -9
  35. package/dist/templates/base/src/locales/en.json +3 -3
  36. package/dist/templates/base/src/locales/index.ts +2 -2
  37. package/dist/templates/base/src/router/index.ts +10 -10
  38. package/dist/templates/base/src/router/routes.ts +78 -78
  39. package/dist/templates/base/src/shims-vue.d.ts +63 -63
  40. package/dist/templates/base/src/styles/base.scss +38 -38
  41. package/dist/templates/base/src/styles/colors.scss +10 -10
  42. package/dist/templates/base/src/styles/custom.scss +2 -2
  43. package/dist/templates/base/tailwind.config.ts +7 -7
  44. package/dist/templates/base/tsconfig.json +16 -16
  45. package/dist/templates/base/vite.config.mts +5 -5
  46. package/dist/templates/mocks/sample-data/constants.ts +86 -86
  47. package/dist/templates/mocks/sample-data/index.ts +2 -2
  48. package/dist/templates/mocks/sample-data/methods.ts +65 -65
  49. package/dist/templates/modules/classic-module/composables/index.ts +2 -2
  50. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +19 -19
  51. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +23 -23
  52. package/dist/templates/modules/classic-module/index.ts +8 -8
  53. package/dist/templates/modules/classic-module/locales/en.json +28 -28
  54. package/dist/templates/modules/classic-module/locales/index.ts +2 -2
  55. package/dist/templates/modules/classic-module/pages/details.vue +61 -61
  56. package/dist/templates/modules/classic-module/pages/index.ts +2 -2
  57. package/dist/templates/modules/classic-module/pages/list.vue +162 -162
  58. package/dist/templates/modules/dynamic-module/composables/index.ts +2 -2
  59. package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +37 -37
  60. package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +49 -49
  61. package/dist/templates/modules/dynamic-module/index.ts +8 -8
  62. package/dist/templates/modules/dynamic-module/locales/en.json +35 -35
  63. package/dist/templates/modules/dynamic-module/locales/index.ts +2 -2
  64. package/dist/templates/modules/dynamic-module/pages/details.ts +20 -20
  65. package/dist/templates/modules/dynamic-module/pages/index.ts +4 -4
  66. package/dist/templates/modules/dynamic-module/pages/list.ts +35 -35
  67. package/dist/templates/sample/classic-module/composables/index.ts +2 -2
  68. package/dist/templates/sample/classic-module/composables/useDetails/index.ts +41 -41
  69. package/dist/templates/sample/classic-module/composables/useList/index.ts +41 -41
  70. package/dist/templates/sample/classic-module/index.ts +8 -8
  71. package/dist/templates/sample/classic-module/locales/en.json +59 -59
  72. package/dist/templates/sample/classic-module/locales/index.ts +2 -2
  73. package/dist/templates/sample/classic-module/pages/details.vue +257 -257
  74. package/dist/templates/sample/classic-module/pages/index.ts +2 -2
  75. package/dist/templates/sample/dynamic-module/composables/index.ts +2 -2
  76. package/dist/templates/sample/dynamic-module/composables/useDetails/index.ts +46 -46
  77. package/dist/templates/sample/dynamic-module/composables/useList/index.ts +50 -50
  78. package/dist/templates/sample/dynamic-module/index.ts +8 -8
  79. package/dist/templates/sample/dynamic-module/locales/en.json +69 -69
  80. package/dist/templates/sample/dynamic-module/locales/index.ts +2 -2
  81. package/dist/templates/sample/dynamic-module/pages/details.ts +100 -100
  82. package/dist/templates/sample/dynamic-module/pages/index.ts +4 -4
  83. package/dist/templates/sample/dynamic-module/pages/list.ts +81 -81
  84. package/package.json +4 -3
@@ -1,65 +1,65 @@
1
- import { type MockedItem, type MockedQuery, mockedItems } from ".";
2
-
3
- export function loadMockItemsList(query: MockedQuery) {
4
- return new Promise((resolve: (value: MockedItem[]) => void) => {
5
- setTimeout(() => resolve(mockedItems), 1000);
6
- }).then((res) => {
7
- res = res.filter((x) => {
8
- if (query.keyword) {
9
- return x.name.toLowerCase().includes(query.keyword.toLowerCase());
10
- }
11
- return true;
12
- });
13
-
14
- return { results: res, totalCount: res.length };
15
- });
16
- }
17
-
18
- export async function loadMockItem(args?: { id: string }) {
19
- return new Promise((resolve: (value: MockedItem) => void) => {
20
- setTimeout(() => {
21
- const findMockedItem = mockedItems.find((x) => x.id === args?.id);
22
-
23
- if (findMockedItem) resolve({ ...findMockedItem });
24
- }, 1000);
25
- });
26
- }
27
-
28
- export async function removeMockItem(args: { id: string }) {
29
- new Promise((resolve: (value: boolean) => void) => {
30
- setTimeout(() => {
31
- const index = mockedItems.findIndex((x) => x.id === args.id);
32
-
33
- if (index > -1) {
34
- mockedItems.splice(index, 1);
35
- resolve(true);
36
- } else {
37
- resolve(false);
38
- }
39
- }, 1000);
40
- });
41
- }
42
-
43
- export async function addNewMockItem(args: MockedItem) {
44
- return new Promise((resolve: (value: MockedItem) => void) => {
45
- setTimeout(() => {
46
- mockedItems.push(args);
47
- resolve(args);
48
- }, 1000);
49
- });
50
- }
51
-
52
- export async function updateMockItem(args: MockedItem) {
53
- return new Promise((resolve: (value: MockedItem) => void) => {
54
- setTimeout(() => {
55
- const index = mockedItems.findIndex((x) => x.id === args.id);
56
-
57
- if (index > -1) {
58
- mockedItems[index] = args;
59
- resolve(args);
60
- } else {
61
- resolve(args);
62
- }
63
- }, 1000);
64
- });
65
- }
1
+ import { type MockedItem, type MockedQuery, mockedItems } from ".";
2
+
3
+ export function loadMockItemsList(query: MockedQuery) {
4
+ return new Promise((resolve: (value: MockedItem[]) => void) => {
5
+ setTimeout(() => resolve(mockedItems), 1000);
6
+ }).then((res) => {
7
+ res = res.filter((x) => {
8
+ if (query.keyword) {
9
+ return x.name.toLowerCase().includes(query.keyword.toLowerCase());
10
+ }
11
+ return true;
12
+ });
13
+
14
+ return { results: res, totalCount: res.length };
15
+ });
16
+ }
17
+
18
+ export async function loadMockItem(args?: { id: string }) {
19
+ return new Promise((resolve: (value: MockedItem) => void) => {
20
+ setTimeout(() => {
21
+ const findMockedItem = mockedItems.find((x) => x.id === args?.id);
22
+
23
+ if (findMockedItem) resolve({ ...findMockedItem });
24
+ }, 1000);
25
+ });
26
+ }
27
+
28
+ export async function removeMockItem(args: { id: string }) {
29
+ new Promise((resolve: (value: boolean) => void) => {
30
+ setTimeout(() => {
31
+ const index = mockedItems.findIndex((x) => x.id === args.id);
32
+
33
+ if (index > -1) {
34
+ mockedItems.splice(index, 1);
35
+ resolve(true);
36
+ } else {
37
+ resolve(false);
38
+ }
39
+ }, 1000);
40
+ });
41
+ }
42
+
43
+ export async function addNewMockItem(args: MockedItem) {
44
+ return new Promise((resolve: (value: MockedItem) => void) => {
45
+ setTimeout(() => {
46
+ mockedItems.push(args);
47
+ resolve(args);
48
+ }, 1000);
49
+ });
50
+ }
51
+
52
+ export async function updateMockItem(args: MockedItem) {
53
+ return new Promise((resolve: (value: MockedItem) => void) => {
54
+ setTimeout(() => {
55
+ const index = mockedItems.findIndex((x) => x.id === args.id);
56
+
57
+ if (index > -1) {
58
+ mockedItems[index] = args;
59
+ resolve(args);
60
+ } else {
61
+ resolve(args);
62
+ }
63
+ }, 1000);
64
+ });
65
+ }
@@ -1,2 +1,2 @@
1
- export { default as use{{ModuleNamePascalCase}}List } from "./use{{ModuleNamePascalCase}}List";
2
- export { default as use{{ModuleNamePascalCase}}Details } from "./use{{ModuleNamePascalCase}}Details";
1
+ export { default as use{{ModuleNamePascalCase}}List } from "./use{{ModuleNamePascalCase}}List";
2
+ export { default as use{{ModuleNamePascalCase}}Details } from "./use{{ModuleNamePascalCase}}Details";
@@ -1,19 +1,19 @@
1
- import { computed, ref } from "vue";
2
- import { useAsync, useLoading } from "@vc-shell/framework";
3
-
4
- export default () => {
5
- const item = ref({});
6
-
7
- // Implement your own load function
8
- const { loading: itemLoading, action: getItem } = useAsync<{ id: string }>(async (payload) => {
9
- item.value = {};
10
- });
11
-
12
- const loading = useLoading(itemLoading);
13
-
14
- return {
15
- item: computed(() => item.value),
16
- loading: computed(() => loading.value),
17
- getItem,
18
- };
19
- };
1
+ import { computed, ref } from "vue";
2
+ import { useAsync, useLoading } from "@vc-shell/framework";
3
+
4
+ export default () => {
5
+ const item = ref({});
6
+
7
+ // Implement your own load function
8
+ const { loading: itemLoading, action: getItem } = useAsync<{ id: string }>(async (payload) => {
9
+ item.value = {};
10
+ });
11
+
12
+ const loading = useLoading(itemLoading);
13
+
14
+ return {
15
+ item: computed(() => item.value),
16
+ loading: computed(() => loading.value),
17
+ getItem,
18
+ };
19
+ };
@@ -1,23 +1,23 @@
1
- import { computed, ref } from "vue";
2
- import { useAsync, useLoading } from "@vc-shell/framework";
3
-
4
- export default () => {
5
- const data = ref([]);
6
- const dataRes = ref();
7
-
8
- // Implement your own load function
9
- const { loading: itemLoading, action: getItems } = useAsync(async (payload) => {
10
- data.value = [];
11
- });
12
-
13
- const loading = useLoading(itemLoading);
14
-
15
- return {
16
- data: computed(() => data.value),
17
- loading: computed(() => loading.value),
18
- totalCount: computed(() => dataRes.value?.totalCount),
19
- pages: computed(() => Math.ceil(dataRes.value?.totalCount / 20)),
20
- currentPage: 0 / Math.max(1, 20) + 1,
21
- getItems,
22
- };
23
- };
1
+ import { computed, ref } from "vue";
2
+ import { useAsync, useLoading } from "@vc-shell/framework";
3
+
4
+ export default () => {
5
+ const data = ref([]);
6
+ const dataRes = ref();
7
+
8
+ // Implement your own load function
9
+ const { loading: itemLoading, action: getItems } = useAsync(async (payload) => {
10
+ data.value = [];
11
+ });
12
+
13
+ const loading = useLoading(itemLoading);
14
+
15
+ return {
16
+ data: computed(() => data.value),
17
+ loading: computed(() => loading.value),
18
+ totalCount: computed(() => dataRes.value?.totalCount),
19
+ pages: computed(() => Math.ceil(dataRes.value?.totalCount / 20)),
20
+ currentPage: 0 / Math.max(1, 20) + 1,
21
+ getItems,
22
+ };
23
+ };
@@ -1,8 +1,8 @@
1
- import * as pages from "./pages";
2
- import * as locales from "./locales";
3
- import { createAppModule } from "@vc-shell/framework";
4
-
5
- export default createAppModule(pages, locales);
6
-
7
- export * from "./pages";
8
- export * from "./composables";
1
+ import * as pages from "./pages";
2
+ import * as locales from "./locales";
3
+ import { createAppModule } from "@vc-shell/framework";
4
+
5
+ export default createAppModule(pages, locales);
6
+
7
+ export * from "./pages";
8
+ export * from "./composables";
@@ -1,28 +1,28 @@
1
- {
2
- "{{ModuleNameUppercaseSnakeCase}}": {
3
- "MENU": {
4
- "TITLE": "{{ModuleNameSentenceCase}}"
5
- },
6
- "PAGES": {
7
- "LIST": {
8
- "TITLE": "{{ModuleNameSentenceCase}} list",
9
- "TOOLBAR": {
10
- "REFRESH": "Refresh"
11
- },
12
- "SEARCH": {
13
- "PLACEHOLDER": "Search keywords"
14
- },
15
- "TABLE": {
16
- "TOTALS": "Count:",
17
- "HEADER": {}
18
- }
19
- },
20
- "DETAILS": {
21
- "TITLE": "{{ModuleNameSentenceCase}} details"
22
- },
23
- "ALERTS": {
24
- "CLOSE_CONFIRMATION": "You have unsaved changes. Close anyway?"
25
- }
26
- }
27
- }
28
- }
1
+ {
2
+ "{{ModuleNameUppercaseSnakeCase}}": {
3
+ "MENU": {
4
+ "TITLE": "{{ModuleNameSentenceCase}}"
5
+ },
6
+ "PAGES": {
7
+ "LIST": {
8
+ "TITLE": "{{ModuleNameSentenceCase}} list",
9
+ "TOOLBAR": {
10
+ "REFRESH": "Refresh"
11
+ },
12
+ "SEARCH": {
13
+ "PLACEHOLDER": "Search keywords"
14
+ },
15
+ "TABLE": {
16
+ "TOTALS": "Count:",
17
+ "HEADER": {}
18
+ }
19
+ },
20
+ "DETAILS": {
21
+ "TITLE": "{{ModuleNameSentenceCase}} details"
22
+ },
23
+ "ALERTS": {
24
+ "CLOSE_CONFIRMATION": "You have unsaved changes. Close anyway?"
25
+ }
26
+ }
27
+ }
28
+ }
@@ -1,2 +1,2 @@
1
- import * as en from "./en.json";
2
- export { en };
1
+ import * as en from "./en.json";
2
+ export { en };
@@ -1,61 +1,61 @@
1
- <template>
2
- <VcBlade
3
- v-loading="loading"
4
- :title="$t('{{ModuleNameUppercaseSnakeCase}}.PAGES.DETAILS.TITLE')"
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
- <!-- You can add form fields here -->
16
- </VcForm>
17
- </VcContainer>
18
- </VcBlade>
19
- </template>
20
-
21
- <script lang="ts" setup>
22
- import { IBladeToolbar, IParentCallArgs } from "@vc-shell/framework";
23
- import { use{{ModuleNamePascalCase}}Details } from "./../composables";
24
- import { onMounted, ref } from "vue";
25
-
26
- export interface Props {
27
- expanded?: boolean;
28
- closable?: boolean;
29
- param?: string;
30
- }
31
-
32
- export interface Emits {
33
- (event: "parent:call", args: IParentCallArgs): void;
34
- (event: "collapse:blade"): void;
35
- (event: "expand:blade"): void;
36
- (event: "close:blade"): void;
37
- }
38
-
39
- defineOptions({
40
- url: "/{{ModuleName}}-details",
41
- name: "{{ModuleNamePascalCase}}Details",
42
- });
43
-
44
- const props = withDefaults(defineProps<Props>(), {
45
- expanded: true,
46
- closable: true,
47
- param: undefined,
48
- });
49
-
50
- defineEmits<Emits>();
51
-
52
- const { loading, getItem } = use{{ModuleNamePascalCase}}Details();
53
-
54
- const bladeToolbar = ref<IBladeToolbar[]>([]);
55
-
56
- onMounted(async () => {
57
- if (props.param) {
58
- await getItem({ id: props.param });
59
- }
60
- });
61
- </script>
1
+ <template>
2
+ <VcBlade
3
+ v-loading="loading"
4
+ :title="$t('{{ModuleNameUppercaseSnakeCase}}.PAGES.DETAILS.TITLE')"
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
+ <!-- You can add form fields here -->
16
+ </VcForm>
17
+ </VcContainer>
18
+ </VcBlade>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import { IBladeToolbar, IParentCallArgs } from "@vc-shell/framework";
23
+ import { use{{ModuleNamePascalCase}}Details } from "./../composables";
24
+ import { onMounted, ref } from "vue";
25
+
26
+ export interface Props {
27
+ expanded?: boolean;
28
+ closable?: boolean;
29
+ param?: string;
30
+ }
31
+
32
+ export interface Emits {
33
+ (event: "parent:call", args: IParentCallArgs): void;
34
+ (event: "collapse:blade"): void;
35
+ (event: "expand:blade"): void;
36
+ (event: "close:blade"): void;
37
+ }
38
+
39
+ defineOptions({
40
+ url: "/{{ModuleName}}-details",
41
+ name: "{{ModuleNamePascalCase}}Details",
42
+ });
43
+
44
+ const props = withDefaults(defineProps<Props>(), {
45
+ expanded: true,
46
+ closable: true,
47
+ param: undefined,
48
+ });
49
+
50
+ defineEmits<Emits>();
51
+
52
+ const { loading, getItem } = use{{ModuleNamePascalCase}}Details();
53
+
54
+ const bladeToolbar = ref<IBladeToolbar[]>([]);
55
+
56
+ onMounted(async () => {
57
+ if (props.param) {
58
+ await getItem({ id: props.param });
59
+ }
60
+ });
61
+ </script>
@@ -1,2 +1,2 @@
1
- export { default as List } from "./list.vue";
2
- export {default as Details } from './details.vue'
1
+ export { default as List } from "./list.vue";
2
+ export {default as Details } from './details.vue'