@vc-shell/create-vc-app 1.0.188 → 1.0.190

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 (37) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/index.js +476 -114
  3. package/dist/templates/base/_env +1 -1
  4. package/dist/templates/base/{package.json → _package.json} +6 -7
  5. package/dist/templates/base/_vscode/extensions.json +0 -2
  6. package/dist/templates/base/index.html +1 -1
  7. package/dist/templates/base/src/composables/index.ts +1 -1
  8. package/dist/templates/base/src/locales/en.json +1 -9
  9. package/dist/templates/{variants/dynamic → base}/src/main.ts +3 -6
  10. package/dist/templates/base/src/pages/App.vue +4 -14
  11. package/dist/templates/base/src/router/routes.ts +8 -12
  12. package/dist/templates/base/vite.config.mts +3 -3
  13. package/dist/templates/modules/classic-module/composables/index.ts +2 -2
  14. package/dist/templates/modules/classic-module/composables/{useDetails → use{{ModuleNamePascalCase}}Details}/index.ts +4 -5
  15. package/dist/templates/modules/classic-module/composables/{useList → use{{ModuleNamePascalCase}}List}/index.ts +4 -6
  16. package/dist/templates/modules/classic-module/index.ts +0 -1
  17. package/dist/templates/modules/classic-module/locales/en.json +8 -26
  18. package/dist/templates/modules/classic-module/pages/details.vue +9 -34
  19. package/dist/templates/modules/classic-module/pages/list.vue +16 -111
  20. package/dist/templates/modules/dynamic-module/composables/index.ts +2 -2
  21. package/dist/templates/modules/dynamic-module/composables/{useDetails → use{{ModuleNamePascalCase}}Details}/index.ts +5 -16
  22. package/dist/templates/modules/dynamic-module/composables/{useList → use{{ModuleNamePascalCase}}List}/index.ts +14 -9
  23. package/dist/templates/modules/dynamic-module/index.ts +2 -3
  24. package/dist/templates/modules/dynamic-module/locales/en.json +4 -18
  25. package/dist/templates/modules/dynamic-module/pages/details.ts +5 -24
  26. package/dist/templates/modules/dynamic-module/pages/index.ts +3 -3
  27. package/dist/templates/modules/dynamic-module/pages/list.ts +8 -38
  28. package/package.json +2 -2
  29. package/dist/templates/base/src/bootstrap.ts +0 -15
  30. package/dist/templates/base/src/composables/useLogin/index.ts +0 -17
  31. package/dist/templates/base/src/modules/mocks.ts +0 -50
  32. package/dist/templates/base/src/pages/Dashboard.vue +0 -38
  33. package/dist/templates/modules/classic-module/components/index.ts +0 -1
  34. package/dist/templates/modules/dynamic-module/components/DynamicItemsMobileGridView.vue +0 -39
  35. package/dist/templates/modules/dynamic-module/components/index.ts +0 -3
  36. package/dist/templates/variants/both/src/main.ts +0 -56
  37. package/dist/templates/variants/classic/src/main.ts +0 -53
@@ -1,6 +1,11 @@
1
1
  import { computed, ref, Ref } from "vue";
2
- import { DynamicBladeList, ListBaseBladeScope, useBladeNavigation, useListFactory } from "@vc-shell/framework";
3
- import { loadMockItemsList } from "../../../mocks";
2
+ import {
3
+ DynamicBladeList,
4
+ ListBaseBladeScope,
5
+ useBladeNavigation,
6
+ useListFactory,
7
+ type TOpenBladeArgs,
8
+ } from "@vc-shell/framework";
4
9
 
5
10
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
6
11
  export interface DynamicItemsScope extends ListBaseBladeScope {}
@@ -12,28 +17,28 @@ export default (args: {
12
17
  }) => {
13
18
  const factory = useListFactory({
14
19
  load: async () => {
15
- return await loadMockItemsList();
20
+ return {
21
+ totalCount: 0,
22
+ results: [],
23
+ };
16
24
  },
17
25
  remove: () => {
18
26
  throw new Error("Function not implemented.");
19
- }
27
+ },
20
28
  });
21
29
 
22
30
  const { load, remove, items, pagination, loading, query } = factory();
23
31
  const { openBlade, resolveBladeByName } = useBladeNavigation();
24
32
 
25
- async function openDetailsBlade(data?: Omit<Parameters<typeof openBlade>["0"], "blade">) {
33
+ async function openDetailsBlade(data?: TOpenBladeArgs) {
26
34
  await openBlade({
27
- blade: resolveBladeByName("DynamicItem"),
35
+ blade: resolveBladeByName("{{ModuleNamePascalCase}}Details"),
28
36
  ...data,
29
37
  });
30
38
  }
31
39
 
32
40
  const scope = ref<DynamicItemsScope>({
33
41
  openDetailsBlade,
34
- deleteItem: () => {
35
- alert("Delete item");
36
- },
37
42
  });
38
43
 
39
44
  return {
@@ -1,9 +1,8 @@
1
1
  import * as schema from "./pages";
2
2
  import * as locales from "./locales";
3
3
  import * as composables from "./composables";
4
- import * as components from "./components";
5
4
  import { createDynamicAppModule } from "@vc-shell/framework";
6
5
 
7
- export default createDynamicAppModule({ schema, locales, composables, moduleComponents: components });
6
+ export default createDynamicAppModule({ schema, locales, composables });
8
7
 
9
- export { schema, composables, locales, components };
8
+ export { schema, composables, locales };
@@ -1,26 +1,19 @@
1
1
  {
2
- "DYNAMICMODULE": {
2
+ "{{ModuleNameUppercaseSnakeCase}}": {
3
3
  "MENU": {
4
- "TITLE": "Dynamic Module"
4
+ "TITLE": "{{ModuleNameSentenceCase}}"
5
5
  },
6
6
  "PAGES": {
7
7
  "LIST": {
8
- "TITLE": "Module blade",
9
8
  "TOOLBAR": {
10
- "REFRESH": "Refresh",
11
- "ADD": "Add",
12
- "DELETE": "Delete selected"
9
+ "REFRESH": "Refresh"
13
10
  },
14
11
  "SEARCH": {
15
12
  "PLACEHOLDER": "Search keywords"
16
13
  },
17
14
  "TABLE": {
18
15
  "TOTALS": "Count:",
19
- "HEADER": {
20
- "PRODUCT_IMAGE": "Pic",
21
- "PRODUCT_NAME": "Name",
22
- "CREATED_DATE": "Created"
23
- },
16
+ "HEADER": {},
24
17
  "EMPTY": {
25
18
  "TITLE": "There are no content yet",
26
19
  "ACTION": "Add content"
@@ -28,15 +21,8 @@
28
21
  "NOT_FOUND": {
29
22
  "TITLE": "No content found.",
30
23
  "ACTION": "Reset search"
31
- },
32
- "ACTIONS": {
33
- "UNPUBLISH": "Unpublish",
34
- "PUBLISH": "Publish"
35
24
  }
36
25
  },
37
- "MOBILE": {
38
- "CREATED": "Created"
39
- },
40
26
  "EMPTY": {
41
27
  "NO_ITEMS": "There are no items yet"
42
28
  }
@@ -2,37 +2,18 @@ import { DynamicDetailsSchema } from "@vc-shell/framework";
2
2
 
3
3
  export const details: DynamicDetailsSchema = {
4
4
  settings: {
5
- url: "/dynamic-module-details",
6
- id: "DynamicItem",
7
- localizationPrefix: "DynamicModule",
8
- composable: "useDetails",
5
+ url: "/{{ModuleName}}-details",
6
+ id: "{{ModuleNamePascalCase}}Details",
7
+ localizationPrefix: "{{ModuleNameUppercaseSnakeCase}}",
8
+ composable: "use{{ModuleNamePascalCase}}Details",
9
9
  component: "DynamicBladeForm",
10
- toolbar: [
11
- {
12
- id: "refresh",
13
- icon: "fas fa-sync-alt",
14
- title: "Refresh",
15
- method: "refresh",
16
- },
17
- ],
18
10
  },
19
11
  content: [
20
12
  {
21
13
  id: "dynamicItemForm",
22
14
  component: "vc-form",
23
15
  children: [
24
- {
25
- id: "itemName",
26
- component: "vc-input",
27
- label: "Name",
28
- property: "name",
29
- },
30
- {
31
- id: "itemCreatedDate",
32
- component: "vc-input",
33
- label: "Created date",
34
- property: "createdDate",
35
- },
16
+ // You can add fields here
36
17
  ],
37
18
  },
38
19
  ],
@@ -1,4 +1,4 @@
1
- import { grid as itemsList } from "./list";
2
- import { details as itemDetails } from "./details";
1
+ import { grid as {{ModuleNameExports}}List } from "./list";
2
+ import { details as {{ModuleNameExports}}Details } from "./details";
3
3
 
4
- export { itemsList, itemDetails };
4
+ export { {{ModuleNameExports}}List, {{ModuleNameExports}}Details };
@@ -2,12 +2,12 @@ import { DynamicGridSchema } from "@vc-shell/framework";
2
2
 
3
3
  export const grid: DynamicGridSchema = {
4
4
  settings: {
5
- url: "/dynamic-module-list",
6
- id: "DynamicItems",
7
- titleTemplate: "Dynamic module blade",
8
- localizationPrefix: "DynamicModule",
5
+ url: "/{{ModuleName}}",
6
+ id: "{{ModuleNamePascalCase}}List",
7
+ titleTemplate: "{{ModuleNameSentenceCase}} list",
8
+ localizationPrefix: "{{ModuleNameUppercaseSnakeCase}}",
9
9
  isWorkspace: true,
10
- composable: "useList",
10
+ composable: "use{{ModuleNamePascalCase}}List",
11
11
  component: "DynamicBladeList",
12
12
  toolbar: [
13
13
  {
@@ -18,47 +18,17 @@ export const grid: DynamicGridSchema = {
18
18
  },
19
19
  ],
20
20
  menuItem: {
21
- title: 'DYNAMICMODULE.MENU.TITLE',
21
+ title: "{{ModuleNameUppercaseSnakeCase}}.MENU.TITLE",
22
22
  icon: "fas fa-file-alt",
23
23
  priority: 1,
24
- }
24
+ },
25
25
  },
26
26
  content: [
27
27
  {
28
28
  id: "itemsGrid",
29
29
  component: "vc-table",
30
- actions: [
31
- {
32
- id: "deleteAction",
33
- icon: "fas fa-trash",
34
- title: "Delete",
35
- type: "danger",
36
- position: "left",
37
- method: "deleteItem",
38
- },
39
- ],
40
- mobileTemplate: {
41
- component: "DynamicItemsMobileGridView",
42
- },
43
- multiselect: true,
44
30
  columns: [
45
- {
46
- id: "imgSrc",
47
- title: "Pic",
48
- type: "image",
49
- alwaysVisible: true,
50
- },
51
- {
52
- id: "name",
53
- title: "Name",
54
- alwaysVisible: true,
55
- },
56
- {
57
- id: "createdDate",
58
- title: "Created date",
59
- sortable: true,
60
- type: "date-ago",
61
- },
31
+ // You can add columns here
62
32
  ],
63
33
  },
64
34
  ],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vc-shell/create-vc-app",
3
3
  "description": "Application scaffolding",
4
- "version": "1.0.188",
4
+ "version": "1.0.190",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.js",
7
7
  "files": [
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/prompts": "^2.4.4",
16
- "@vc-shell/ts-config": "^1.0.188",
16
+ "@vc-shell/ts-config": "^1.0.190",
17
17
  "copyfiles": "^2.4.1",
18
18
  "cross-env": "^7.0.3",
19
19
  "shx": "^0.3.4",
@@ -1,15 +0,0 @@
1
- import { useMenuService } from "@vc-shell/framework";
2
- import { App } from "vue";
3
-
4
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
- export function bootstrap(app: App) {
6
- const { addMenuItem } = useMenuService();
7
-
8
- // Add Dashboard to main menu item
9
- addMenuItem({
10
- title: "SHELL.MENU.DASHBOARD",
11
- icon: "fas fa-home",
12
- priority: 0,
13
- url: "/",
14
- });
15
- }
@@ -1,17 +0,0 @@
1
- interface IUseLogin {
2
- forgotPassword: (args: { loginOrEmail: string }) => void;
3
- }
4
-
5
- export default (): IUseLogin => {
6
- /**
7
- * @description Forgot password functionality
8
- */
9
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- async function forgotPassword(args: { loginOrEmail: string }) {
11
- console.log("Forgot password click");
12
- }
13
-
14
- return {
15
- forgotPassword,
16
- };
17
- };
@@ -1,50 +0,0 @@
1
- /* eslint-disable import/no-unresolved */
2
- import img1 from "/assets/1.jpeg";
3
- import img2 from "/assets/2.jpg";
4
- import img3 from "/assets/3.jpg";
5
-
6
- export interface MockedItem {
7
- imgSrc: string;
8
- name: string;
9
- createdDate: Date;
10
- id: string;
11
- }
12
-
13
- const mockedItems: MockedItem[] = [
14
- {
15
- imgSrc: img1,
16
- name: "Item 1",
17
- createdDate: new Date(),
18
- id: "item-id-1",
19
- },
20
- {
21
- imgSrc: img2,
22
- name: "Item 2",
23
- createdDate: new Date(),
24
- id: "item-id-2",
25
- },
26
- {
27
- imgSrc: img3,
28
- name: "Item 3",
29
- createdDate: new Date(),
30
- id: "item-id-3",
31
- },
32
- ];
33
-
34
- export function loadMockItemsList() {
35
- return new Promise((resolve: (value: MockedItem[]) => void) => {
36
- setTimeout(() => resolve(mockedItems), 1000);
37
- }).then((res) => {
38
- return { results: res, totalCount: res.length };
39
- });
40
- }
41
-
42
- export function loadMockItem(args?: { id: string }) {
43
- return new Promise((resolve: (value: MockedItem) => void) => {
44
- setTimeout(() => {
45
- const findMockedItem = mockedItems.find((x) => x.id === args?.id);
46
-
47
- if (findMockedItem) resolve(findMockedItem);
48
- }, 1000);
49
- });
50
- }
@@ -1,38 +0,0 @@
1
- <template>
2
- <VcContainer class="dashboard tw-w-full tw-h-full tw-box-border">
3
- <div
4
- v-if="$isDesktop.value"
5
- class="dashboard-header"
6
- >
7
- {{ $t("SHELL.DASHBOARD.TITLE") }}
8
- </div>
9
- </VcContainer>
10
- </template>
11
-
12
- <script lang="ts" setup>
13
- import { notification, useErrorHandler } from "@vc-shell/framework";
14
- import { watch } from "vue";
15
-
16
- const { error, reset } = useErrorHandler(true);
17
-
18
- watch(error, (newVal) => {
19
- if (newVal) {
20
- notification.error(newVal, {
21
- timeout: 5000,
22
- onOpen() {
23
- reset();
24
- },
25
- });
26
- }
27
- });
28
- </script>
29
-
30
- <style lang="scss">
31
- .dashboard {
32
- --card-header-background: transparent;
33
-
34
- &-header {
35
- @apply tw-text-[25px] tw-text-[#333333] tw-my-3 tw-px-2;
36
- }
37
- }
38
- </style>
@@ -1,39 +0,0 @@
1
- <template>
2
- <div class="tw-border-b tw-border-solid tw-border-b-[#e3e7ec] tw-py-3 tw-px-4">
3
- <div class="tw-w-full tw-flex tw-justify-evenly tw-mb-2">
4
- <VcImage
5
- class="tw-shrink-0"
6
- aspect="1x1"
7
- size="s"
8
- :bordered="true"
9
- :src="context.item.imgSrc"
10
- ></VcImage>
11
- <div class="tw-grow tw-basis-0 tw-ml-3">
12
- <div class="tw-font-bold tw-text-lg">
13
- {{ context.item.name }}
14
- </div>
15
- </div>
16
- </div>
17
- <div class="tw-truncate tw-grow-[2] tw-basis-0">
18
- <VcHint>{{ $t("DYNAMICMODULE.PAGES.LIST.MOBILE.CREATED") }}</VcHint>
19
- <div class="tw-truncate tw-mt-1">
20
- {{ context.item.createdDate }}
21
- </div>
22
- </div>
23
- </div>
24
- </template>
25
-
26
- <script setup lang="ts">
27
- export interface Props {
28
- context: {
29
- item: {
30
- imgSrc: string;
31
- name: string;
32
- createdDate: Date;
33
- id: string;
34
- };
35
- };
36
- }
37
-
38
- defineProps<Props>();
39
- </script>
@@ -1,3 +0,0 @@
1
- import DynamicItemsMobileGridView from "./DynamicItemsMobileGridView.vue";
2
-
3
- export { DynamicItemsMobileGridView };
@@ -1,56 +0,0 @@
1
- import VirtoShellFramework, { notification, useUser, useLanguages } from "@vc-shell/framework";
2
- import { createApp } from "vue";
3
- import { router } from "./router";
4
- import * as locales from "./locales";
5
- import { RouterView } from "vue-router";
6
- import ClassicModule from "./modules/classic-module";
7
- import DynamicModule from "./modules/dynamic-module";
8
- import { bootstrap } from "./bootstrap";
9
-
10
- // Load required CSS
11
- import "./styles/index.scss";
12
- import "@fortawesome/fontawesome-free/css/all.min.css";
13
- import "roboto-fontface/css/roboto/roboto-fontface.css";
14
- import "@vc-shell/framework/dist/index.css";
15
-
16
- async function startApp() {
17
- const { loadUser } = useUser();
18
- await loadUser();
19
-
20
- const { currentLocale, setLocale } = useLanguages();
21
-
22
- const app = createApp(RouterView)
23
- .use(VirtoShellFramework, {
24
- router,
25
- platformUrl: import.meta.env.APP_PLATFORM_URL,
26
- i18n: {
27
- locale: import.meta.env.APP_I18N_LOCALE,
28
- fallbackLocale: import.meta.env.APP_I18N_FALLBACK_LOCALE,
29
- },
30
- })
31
- // Classic module based on composables, pages and components
32
- .use(ClassicModule, { router })
33
- // Dynamic module based on page schemas
34
- .use(DynamicModule, { router })
35
- .use(router);
36
-
37
- bootstrap(app);
38
-
39
- Object.entries(locales).forEach(([key, message]) => {
40
- app.config.globalProperties.$mergeLocaleMessage(key, message);
41
- });
42
-
43
- setLocale(currentLocale.value);
44
-
45
- app.config.errorHandler = (err) => {
46
- notification.error((err as Error).toString(), {
47
- timeout: 5000,
48
- });
49
- };
50
-
51
- await router.isReady();
52
-
53
- app.mount("#app");
54
- }
55
-
56
- startApp();
@@ -1,53 +0,0 @@
1
- import VirtoShellFramework, { notification, useUser, useLanguages } from "@vc-shell/framework";
2
- import { createApp } from "vue";
3
- import { router } from "./router";
4
- import * as locales from "./locales";
5
- import { RouterView } from "vue-router";
6
- import ClassicModule from "./modules/classic-module";
7
- import { bootstrap } from "./bootstrap";
8
-
9
- // Load required CSS
10
- import "./styles/index.scss";
11
- import "@fortawesome/fontawesome-free/css/all.min.css";
12
- import "roboto-fontface/css/roboto/roboto-fontface.css";
13
- import "@vc-shell/framework/dist/index.css";
14
-
15
- async function startApp() {
16
- const { loadUser } = useUser();
17
- await loadUser();
18
-
19
- const { currentLocale, setLocale } = useLanguages();
20
-
21
- const app = createApp(RouterView)
22
- .use(VirtoShellFramework, {
23
- router,
24
- platformUrl: import.meta.env.APP_PLATFORM_URL,
25
- i18n: {
26
- locale: import.meta.env.APP_I18N_LOCALE,
27
- fallbackLocale: import.meta.env.APP_I18N_FALLBACK_LOCALE,
28
- },
29
- })
30
- // Classic module based on composables, pages and components
31
- .use(ClassicModule, { router })
32
- .use(router);
33
-
34
- bootstrap(app);
35
-
36
- Object.entries(locales).forEach(([key, message]) => {
37
- app.config.globalProperties.$mergeLocaleMessage(key, message);
38
- });
39
-
40
- setLocale(currentLocale.value);
41
-
42
- app.config.errorHandler = (err) => {
43
- notification.error((err as Error).toString(), {
44
- timeout: 5000,
45
- });
46
- };
47
-
48
- await router.isReady();
49
-
50
- app.mount("#app");
51
- }
52
-
53
- startApp();