@vc-shell/create-vc-app 1.1.0-alpha.8 → 1.1.0
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 +22 -0
- package/dist/index.js +1 -1
- package/dist/templates/base/_package.json +12 -13
- package/dist/templates/base/src/main.ts +7 -3
- package/dist/templates/base/src/pages/App.vue +1 -1
- package/dist/templates/base/src/styles/custom.scss +116 -2
- package/dist/templates/base/src/styles/index.scss +3 -4
- package/dist/templates/base/tsconfig.json +16 -16
- package/dist/templates/base/vite.config.mts +5 -5
- package/dist/templates/modules/classic-module/pages/list.vue +162 -162
- package/dist/templates/modules/dynamic-module/pages/list.ts +35 -35
- package/dist/templates/sample/classic-module/pages/details.vue +257 -257
- package/dist/templates/sample/classic-module/pages/list.vue +4 -5
- package/dist/templates/sample/dynamic-module/pages/details.ts +100 -100
- package/dist/templates/sample/dynamic-module/pages/list.ts +80 -81
- package/dist/templates/sample/overrides/main.ts +0 -3
- package/package.json +5 -6
- package/dist/templates/base/src/styles/base.scss +0 -38
- package/dist/templates/base/src/styles/colors.scss +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# [1.1.0](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.0-alpha.2...v1.1.0) (2025-04-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* first release ([6685f10](https://github.com/VirtoCommerce/vc-shell/commit/6685f10f98982038206a55b637dc14628a341088))
|
|
7
|
+
* redesign alpha4 wip ([ac48f52](https://github.com/VirtoCommerce/vc-shell/commit/ac48f526f61e85518a238e1e6b49047ff3fcc786))
|
|
8
|
+
* redesign alpha5 ([ac430b8](https://github.com/VirtoCommerce/vc-shell/commit/ac430b80f684d3b920c35778a83c33ec387b2484))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# [1.1.0-alpha.11](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.0-alpha.2...v1.1.0-alpha.11) (2025-04-29)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* first release ([6685f10](https://github.com/VirtoCommerce/vc-shell/commit/6685f10f98982038206a55b637dc14628a341088))
|
|
18
|
+
* redesign alpha4 wip ([ac48f52](https://github.com/VirtoCommerce/vc-shell/commit/ac48f526f61e85518a238e1e6b49047ff3fcc786))
|
|
19
|
+
* redesign alpha5 ([ac430b8](https://github.com/VirtoCommerce/vc-shell/commit/ac430b80f684d3b920c35778a83c33ec387b2484))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
1
23
|
## [v1.1.0-alpha.2](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.340...vv1.1.0-alpha.2) (2025-02-25)
|
|
2
24
|
|
|
3
25
|
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import i from "node:path";
|
|
|
6
6
|
import s from "node:fs";
|
|
7
7
|
import { fileURLToPath as Re } from "node:url";
|
|
8
8
|
import { cwd as je, argv as Ae, exit as we } from "node:process";
|
|
9
|
-
const ke = "1.1.0
|
|
9
|
+
const ke = "1.1.0", Oe = {
|
|
10
10
|
version: ke
|
|
11
11
|
};
|
|
12
12
|
var Ne = typeof global == "object" && global && global.Object === Object && global, Me = typeof self == "object" && self && self.Object === Object && self, Te = Ne || Me || Function("return this")(), p = Te.Symbol, H = Object.prototype, Ue = H.hasOwnProperty, Ee = H.toString, y = p ? p.toStringTag : void 0;
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"@types/node": "^20.10.5",
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
|
25
25
|
"@typescript-eslint/parser": "^6.16.0",
|
|
26
|
-
"@vc-shell/api-client-generator": "^1.1.0
|
|
27
|
-
"@vc-shell/release-config": "^1.1.0
|
|
28
|
-
"@vc-shell/ts-config": "^1.1.0
|
|
29
|
-
"@vitejs/plugin-vue": "5.
|
|
26
|
+
"@vc-shell/api-client-generator": "^1.1.0",
|
|
27
|
+
"@vc-shell/release-config": "^1.1.0",
|
|
28
|
+
"@vc-shell/ts-config": "^1.1.0",
|
|
29
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
30
30
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
31
31
|
"@vue/eslint-config-typescript": "^12.0.0",
|
|
32
32
|
"autoprefixer": "^10.4.16",
|
|
@@ -42,26 +42,25 @@
|
|
|
42
42
|
"lodash-es": "^4.17.21",
|
|
43
43
|
"postcss": "^8.4.32",
|
|
44
44
|
"prettier": "^3.1.1",
|
|
45
|
-
"sass": "^1.
|
|
45
|
+
"sass": "^1.87.0",
|
|
46
46
|
"tailwindcss": "^3.4.0",
|
|
47
47
|
"tsx": "^4.7.1",
|
|
48
|
-
"typescript": "
|
|
49
|
-
"vite": "
|
|
50
|
-
"vite-plugin-checker": "^0.
|
|
48
|
+
"typescript": "^5.8.3",
|
|
49
|
+
"vite": "^6.3.3",
|
|
50
|
+
"vite-plugin-checker": "^0.9.1",
|
|
51
51
|
"vite-plugin-mkcert": "^1.17.1",
|
|
52
52
|
"vue-eslint-parser": "^9.3.2",
|
|
53
|
-
"vue-tsc": "^
|
|
53
|
+
"vue-tsc": "^2.2.10"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@vc-shell/
|
|
58
|
-
"@vc-shell/framework": "^1.1.0-alpha.8",
|
|
56
|
+
"@vc-shell/config-generator": "^1.1.0",
|
|
57
|
+
"@vc-shell/framework": "^1.1.0",
|
|
59
58
|
"@vueuse/core": "^10.7.1",
|
|
60
59
|
"@vueuse/integrations": "^10.7.1",
|
|
61
60
|
"cross-spawn": "^7.0.3",
|
|
62
61
|
"moment": "^2.30.1",
|
|
63
62
|
"vee-validate": "^4.12.4",
|
|
64
|
-
"vue": "^3.
|
|
63
|
+
"vue": "^3.5.13",
|
|
65
64
|
"vue-router": "^4.2.5"
|
|
66
65
|
},
|
|
67
66
|
"lint-staged": {
|
|
@@ -6,13 +6,17 @@ import { RouterView } from "vue-router";
|
|
|
6
6
|
import {{ModuleNamePascalCase}} from "./modules/{{ModuleName}}";
|
|
7
7
|
|
|
8
8
|
// Load required CSS
|
|
9
|
-
import "@fortawesome/fontawesome-free/css/all.min.css";
|
|
10
|
-
import "roboto-fontface/css/roboto/roboto-fontface.css";
|
|
11
9
|
import "@vc-shell/framework/dist/index.css";
|
|
12
10
|
|
|
13
11
|
async function startApp() {
|
|
14
12
|
const { loadUser } = useUser();
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
await loadUser();
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.log(e);
|
|
19
|
+
}
|
|
16
20
|
|
|
17
21
|
const { currentLocale, setLocale } = useLanguages();
|
|
18
22
|
|
|
@@ -1,2 +1,116 @@
|
|
|
1
|
-
/* Custom styles.
|
|
2
|
-
*/
|
|
1
|
+
/* Custom styles.
|
|
2
|
+
*/
|
|
3
|
+
|
|
4
|
+
/* Apply color scheme example
|
|
5
|
+
You also need to register color theme in startApp() using the 'register(['my-theme'])' method of the useTheme composable. */
|
|
6
|
+
/* html.my-theme {
|
|
7
|
+
// Primary
|
|
8
|
+
--primary-50: #1F2D3A;
|
|
9
|
+
--primary-100: #2B3D4A;
|
|
10
|
+
--primary-200: #3A4E5D;
|
|
11
|
+
--primary-300: #4A5F70;
|
|
12
|
+
--primary-400: #5B6F82;
|
|
13
|
+
--primary-500: #6C7F94;
|
|
14
|
+
--primary-600: #7A8F9E;
|
|
15
|
+
--primary-700: #8A9FA8;
|
|
16
|
+
--primary-800: #9AAEB2;
|
|
17
|
+
--primary-900: #AABFC0;
|
|
18
|
+
--primary-950: #BCCDD0;
|
|
19
|
+
|
|
20
|
+
// Secondary
|
|
21
|
+
--secondary-50: #1F2D3A;
|
|
22
|
+
--secondary-100: #2B3D4A;
|
|
23
|
+
--secondary-200: #3A4E5D;
|
|
24
|
+
--secondary-300: #4A5F70;
|
|
25
|
+
--secondary-400: #5B6F82;
|
|
26
|
+
--secondary-500: #6C7F94;
|
|
27
|
+
--secondary-600: #7A8F9E;
|
|
28
|
+
--secondary-700: #8A9FA8;
|
|
29
|
+
--secondary-800: #9AAEB2;
|
|
30
|
+
--secondary-900: #AABFC0;
|
|
31
|
+
--secondary-950: #BCCDD0;
|
|
32
|
+
|
|
33
|
+
// Accent
|
|
34
|
+
--accent-50: #1F2D3A;
|
|
35
|
+
--accent-100: #2B3D4A;
|
|
36
|
+
--accent-200: #3A4E5D;
|
|
37
|
+
--accent-300: #4A5F70;
|
|
38
|
+
--accent-400: #5B6F82;
|
|
39
|
+
--accent-500: #6C7F94;
|
|
40
|
+
--accent-600: #7A8F9E;
|
|
41
|
+
--accent-700: #8A9FA8;
|
|
42
|
+
--accent-800: #9AAEB2;
|
|
43
|
+
--accent-900: #AABFC0;
|
|
44
|
+
--accent-950: #BCCDD0;
|
|
45
|
+
|
|
46
|
+
// Neutrals
|
|
47
|
+
--neutrals-50: #2E2E2E;
|
|
48
|
+
--neutrals-100: #3D3D3D;
|
|
49
|
+
--neutrals-200: #4D4D4D;
|
|
50
|
+
--neutrals-300: #6D6D6D;
|
|
51
|
+
--neutrals-400: #8A8A8A;
|
|
52
|
+
--neutrals-500: #B3B3B3;
|
|
53
|
+
--neutrals-600: #D4D4D4;
|
|
54
|
+
--neutrals-700: #E4E4E4;
|
|
55
|
+
--neutrals-800: #F4F4F4;
|
|
56
|
+
--neutrals-900: #FAFAFA;
|
|
57
|
+
--neutrals-950: #FFFFFF;
|
|
58
|
+
|
|
59
|
+
// Additional
|
|
60
|
+
--additional-50: #2E2E2E;
|
|
61
|
+
--additional-950: #FFFFFF;
|
|
62
|
+
|
|
63
|
+
// States
|
|
64
|
+
|
|
65
|
+
// Warning
|
|
66
|
+
--warning-50: #3A2D00;
|
|
67
|
+
--warning-100: #5A4D00;
|
|
68
|
+
--warning-200: #7A6D00;
|
|
69
|
+
--warning-300: #9A8D00;
|
|
70
|
+
--warning-400: #B9AB00;
|
|
71
|
+
--warning-500: #D8C600;
|
|
72
|
+
--warning-600: #D8D100;
|
|
73
|
+
--warning-700: #B8A800;
|
|
74
|
+
--warning-800: #9A8B00;
|
|
75
|
+
--warning-900: #7A6E00;
|
|
76
|
+
--warning-950: #5A5000;
|
|
77
|
+
|
|
78
|
+
// Danger
|
|
79
|
+
--danger-50: #3F0D0D;
|
|
80
|
+
--danger-100: #5E1E1E;
|
|
81
|
+
--danger-200: #7E2F2F;
|
|
82
|
+
--danger-300: #9E3F3F;
|
|
83
|
+
--danger-400: #BF4F4F;
|
|
84
|
+
--danger-500: #DF5F5F;
|
|
85
|
+
--danger-600: #DF4D4D;
|
|
86
|
+
--danger-700: #BF3D3D;
|
|
87
|
+
--danger-800: #9E2D2D;
|
|
88
|
+
--danger-900: #7E1D1D;
|
|
89
|
+
--danger-950: #5E0D0D;
|
|
90
|
+
|
|
91
|
+
// Success
|
|
92
|
+
--success-50: #1D3A1D;
|
|
93
|
+
--success-100: #2D5A2D;
|
|
94
|
+
--success-200: #3A7A3A;
|
|
95
|
+
--success-300: #4A9A4A;
|
|
96
|
+
--success-400: #5AB05A;
|
|
97
|
+
--success-500: #6AC56A;
|
|
98
|
+
--success-600: #5A9A5A;
|
|
99
|
+
--success-700: #4A7F4A;
|
|
100
|
+
--success-800: #3A664A;
|
|
101
|
+
--success-900: #1D4C1D;
|
|
102
|
+
--success-950: #0A3A0A;
|
|
103
|
+
|
|
104
|
+
// Info
|
|
105
|
+
--info-50: #1F2D3A;
|
|
106
|
+
--info-100: #2B3D4A;
|
|
107
|
+
--info-200: #3A4E5D;
|
|
108
|
+
--info-300: #4A5F70;
|
|
109
|
+
--info-400: #5B6F82;
|
|
110
|
+
--info-500: #6C7F94;
|
|
111
|
+
--info-600: #7A8F9E;
|
|
112
|
+
--info-700: #8A9FA8;
|
|
113
|
+
--info-800: #9AAEB2;
|
|
114
|
+
--info-900: #AABFC0;
|
|
115
|
+
--info-950: #BCCDD0;
|
|
116
|
+
} */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@vc-shell/ts-config/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"types": [
|
|
8
|
-
"vite/client",
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"./src/**/*.ts",
|
|
13
|
-
"./src/**/*.vue",
|
|
14
|
-
"./src/**/*.json"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vc-shell/ts-config/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"types": [
|
|
8
|
+
"vite/client",
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"./src/**/*.ts",
|
|
13
|
+
"./src/**/*.vue",
|
|
14
|
+
"./src/**/*.json"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getApplicationConfiguration } from "@vc-shell/config-generator";
|
|
2
|
-
|
|
3
|
-
export default getApplicationConfiguration({
|
|
4
|
-
// Add you extra Vite configuration here
|
|
5
|
-
});
|
|
1
|
+
import { getApplicationConfiguration } from "@vc-shell/config-generator";
|
|
2
|
+
|
|
3
|
+
export default getApplicationConfiguration({
|
|
4
|
+
// Add you extra Vite configuration here
|
|
5
|
+
});
|
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<VcBlade
|
|
3
|
-
:title="$t('{{ModuleNameUppercaseSnakeCase}}.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
|
-
class="tw-grow tw-basis-0"
|
|
16
|
-
multiselect
|
|
17
|
-
:loading="loading"
|
|
18
|
-
:columns="columns"
|
|
19
|
-
:sort="sort"
|
|
20
|
-
:pages="pages"
|
|
21
|
-
:total-count="totalCount"
|
|
22
|
-
:search-value="searchValue"
|
|
23
|
-
:current-page="currentPage"
|
|
24
|
-
:search-placeholder="$t('{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.SEARCH.PLACEHOLDER')"
|
|
25
|
-
:total-label="$t('{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.TABLE.TOTALS')"
|
|
26
|
-
:selected-item-id="selectedItemId"
|
|
27
|
-
state-key="{{ModuleNameUppercaseSnakeCase}}"
|
|
28
|
-
:items="data"
|
|
29
|
-
@item-click="onItemClick"
|
|
30
|
-
@header-click="onHeaderClick"
|
|
31
|
-
>
|
|
32
|
-
</VcTable>
|
|
33
|
-
</VcBlade>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script lang="ts" setup>
|
|
37
|
-
import { computed, ref, markRaw, onMounted, watch } from "vue";
|
|
38
|
-
import { IBladeEvent, IBladeToolbar, IParentCallArgs, ITableColumns, useBladeNavigation } from "@vc-shell/framework";
|
|
39
|
-
import { useI18n } from "vue-i18n";
|
|
40
|
-
import { use{{ModuleNamePascalCase}}List } from "./../composables";
|
|
41
|
-
import Details from "./details.vue";
|
|
42
|
-
|
|
43
|
-
export interface Props {
|
|
44
|
-
expanded?: boolean;
|
|
45
|
-
closable?: boolean;
|
|
46
|
-
param?: string;
|
|
47
|
-
options?: Record<string, unknown>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface Emits {
|
|
51
|
-
(event: "parent:call", args: IParentCallArgs): void;
|
|
52
|
-
(event: "collapse:blade"): void;
|
|
53
|
-
(event: "expand:blade"): void;
|
|
54
|
-
(event: "open:blade", blade: IBladeEvent): void;
|
|
55
|
-
(event: "close:blade"): void;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
defineOptions({
|
|
59
|
-
url: "/{{ModuleName}}",
|
|
60
|
-
name: "{{ModuleNamePascalCase}}List",
|
|
61
|
-
isWorkspace: true,
|
|
62
|
-
menuItem: {
|
|
63
|
-
title: "{{ModuleNameUppercaseSnakeCase}}.MENU.TITLE",
|
|
64
|
-
icon: "
|
|
65
|
-
priority: 1,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
70
|
-
expanded: true,
|
|
71
|
-
closable: true,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
defineEmits<Emits>();
|
|
75
|
-
|
|
76
|
-
const { t } = useI18n({ useScope: "global" });
|
|
77
|
-
const { openBlade } = useBladeNavigation();
|
|
78
|
-
const { getItems, data, loading, totalCount, pages, currentPage } = use{{ModuleNamePascalCase}}List();
|
|
79
|
-
|
|
80
|
-
const sort = ref("createdDate:DESC");
|
|
81
|
-
const searchValue = ref();
|
|
82
|
-
const selectedItemId = ref<string>();
|
|
83
|
-
|
|
84
|
-
watch(
|
|
85
|
-
() => props.param,
|
|
86
|
-
(newVal) => {
|
|
87
|
-
selectedItemId.value = newVal;
|
|
88
|
-
},
|
|
89
|
-
{ immediate: true },
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
onMounted(async () => {
|
|
93
|
-
await getItems();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
97
|
-
{
|
|
98
|
-
id: "refresh",
|
|
99
|
-
title: computed(() => t("{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.TOOLBAR.REFRESH")),
|
|
100
|
-
icon: "
|
|
101
|
-
async clickHandler() {
|
|
102
|
-
await reload();
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
]);
|
|
106
|
-
|
|
107
|
-
const columns = ref<ITableColumns[]>([
|
|
108
|
-
// You can add columns here
|
|
109
|
-
]);
|
|
110
|
-
|
|
111
|
-
const title = computed(() => t("{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.TITLE"));
|
|
112
|
-
|
|
113
|
-
const reload = async () => {
|
|
114
|
-
await getItems();
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const onItemClick = (item: { id: string }) => {
|
|
118
|
-
openBlade({
|
|
119
|
-
blade: markRaw(Details),
|
|
120
|
-
param: item.id,
|
|
121
|
-
onOpen() {
|
|
122
|
-
selectedItemId.value = item.id;
|
|
123
|
-
},
|
|
124
|
-
onClose() {
|
|
125
|
-
selectedItemId.value = undefined;
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const onHeaderClick = (item: ITableColumns) => {
|
|
131
|
-
const sortOptions = ["DESC", "ASC", ""];
|
|
132
|
-
|
|
133
|
-
if (item.sortable) {
|
|
134
|
-
if (sort.value.split(":")[0] === item.id) {
|
|
135
|
-
const index = sortOptions.findIndex((x) => {
|
|
136
|
-
const sorting = sort.value.split(":")[1];
|
|
137
|
-
if (sorting) {
|
|
138
|
-
return x === sorting;
|
|
139
|
-
} else {
|
|
140
|
-
return x === "";
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
if (index !== -1) {
|
|
145
|
-
const newSort = sortOptions[(index + 1) % sortOptions.length];
|
|
146
|
-
|
|
147
|
-
if (newSort === "") {
|
|
148
|
-
sort.value = `${item.id}`;
|
|
149
|
-
} else {
|
|
150
|
-
sort.value = `${item.id}:${newSort}`;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
sort.value = `${item.id}:${sortOptions[0]}`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
defineExpose({
|
|
160
|
-
title,
|
|
161
|
-
});
|
|
162
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<VcBlade
|
|
3
|
+
:title="$t('{{ModuleNameUppercaseSnakeCase}}.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
|
+
class="tw-grow tw-basis-0"
|
|
16
|
+
multiselect
|
|
17
|
+
:loading="loading"
|
|
18
|
+
:columns="columns"
|
|
19
|
+
:sort="sort"
|
|
20
|
+
:pages="pages"
|
|
21
|
+
:total-count="totalCount"
|
|
22
|
+
:search-value="searchValue"
|
|
23
|
+
:current-page="currentPage"
|
|
24
|
+
:search-placeholder="$t('{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.SEARCH.PLACEHOLDER')"
|
|
25
|
+
:total-label="$t('{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.TABLE.TOTALS')"
|
|
26
|
+
:selected-item-id="selectedItemId"
|
|
27
|
+
state-key="{{ModuleNameUppercaseSnakeCase}}"
|
|
28
|
+
:items="data"
|
|
29
|
+
@item-click="onItemClick"
|
|
30
|
+
@header-click="onHeaderClick"
|
|
31
|
+
>
|
|
32
|
+
</VcTable>
|
|
33
|
+
</VcBlade>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import { computed, ref, markRaw, onMounted, watch } from "vue";
|
|
38
|
+
import { IBladeEvent, IBladeToolbar, IParentCallArgs, ITableColumns, useBladeNavigation } from "@vc-shell/framework";
|
|
39
|
+
import { useI18n } from "vue-i18n";
|
|
40
|
+
import { use{{ModuleNamePascalCase}}List } from "./../composables";
|
|
41
|
+
import Details from "./details.vue";
|
|
42
|
+
|
|
43
|
+
export interface Props {
|
|
44
|
+
expanded?: boolean;
|
|
45
|
+
closable?: boolean;
|
|
46
|
+
param?: string;
|
|
47
|
+
options?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Emits {
|
|
51
|
+
(event: "parent:call", args: IParentCallArgs): void;
|
|
52
|
+
(event: "collapse:blade"): void;
|
|
53
|
+
(event: "expand:blade"): void;
|
|
54
|
+
(event: "open:blade", blade: IBladeEvent): void;
|
|
55
|
+
(event: "close:blade"): void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
defineOptions({
|
|
59
|
+
url: "/{{ModuleName}}",
|
|
60
|
+
name: "{{ModuleNamePascalCase}}List",
|
|
61
|
+
isWorkspace: true,
|
|
62
|
+
menuItem: {
|
|
63
|
+
title: "{{ModuleNameUppercaseSnakeCase}}.MENU.TITLE",
|
|
64
|
+
icon: "lucide-file",
|
|
65
|
+
priority: 1,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
70
|
+
expanded: true,
|
|
71
|
+
closable: true,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
defineEmits<Emits>();
|
|
75
|
+
|
|
76
|
+
const { t } = useI18n({ useScope: "global" });
|
|
77
|
+
const { openBlade } = useBladeNavigation();
|
|
78
|
+
const { getItems, data, loading, totalCount, pages, currentPage } = use{{ModuleNamePascalCase}}List();
|
|
79
|
+
|
|
80
|
+
const sort = ref("createdDate:DESC");
|
|
81
|
+
const searchValue = ref();
|
|
82
|
+
const selectedItemId = ref<string>();
|
|
83
|
+
|
|
84
|
+
watch(
|
|
85
|
+
() => props.param,
|
|
86
|
+
(newVal) => {
|
|
87
|
+
selectedItemId.value = newVal;
|
|
88
|
+
},
|
|
89
|
+
{ immediate: true },
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
onMounted(async () => {
|
|
93
|
+
await getItems();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
97
|
+
{
|
|
98
|
+
id: "refresh",
|
|
99
|
+
title: computed(() => t("{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.TOOLBAR.REFRESH")),
|
|
100
|
+
icon: "material-refresh",
|
|
101
|
+
async clickHandler() {
|
|
102
|
+
await reload();
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
]);
|
|
106
|
+
|
|
107
|
+
const columns = ref<ITableColumns[]>([
|
|
108
|
+
// You can add columns here
|
|
109
|
+
]);
|
|
110
|
+
|
|
111
|
+
const title = computed(() => t("{{ModuleNameUppercaseSnakeCase}}.PAGES.LIST.TITLE"));
|
|
112
|
+
|
|
113
|
+
const reload = async () => {
|
|
114
|
+
await getItems();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const onItemClick = (item: { id: string }) => {
|
|
118
|
+
openBlade({
|
|
119
|
+
blade: markRaw(Details),
|
|
120
|
+
param: item.id,
|
|
121
|
+
onOpen() {
|
|
122
|
+
selectedItemId.value = item.id;
|
|
123
|
+
},
|
|
124
|
+
onClose() {
|
|
125
|
+
selectedItemId.value = undefined;
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const onHeaderClick = (item: ITableColumns) => {
|
|
131
|
+
const sortOptions = ["DESC", "ASC", ""];
|
|
132
|
+
|
|
133
|
+
if (item.sortable) {
|
|
134
|
+
if (sort.value.split(":")[0] === item.id) {
|
|
135
|
+
const index = sortOptions.findIndex((x) => {
|
|
136
|
+
const sorting = sort.value.split(":")[1];
|
|
137
|
+
if (sorting) {
|
|
138
|
+
return x === sorting;
|
|
139
|
+
} else {
|
|
140
|
+
return x === "";
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if (index !== -1) {
|
|
145
|
+
const newSort = sortOptions[(index + 1) % sortOptions.length];
|
|
146
|
+
|
|
147
|
+
if (newSort === "") {
|
|
148
|
+
sort.value = `${item.id}`;
|
|
149
|
+
} else {
|
|
150
|
+
sort.value = `${item.id}:${newSort}`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
sort.value = `${item.id}:${sortOptions[0]}`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
defineExpose({
|
|
160
|
+
title,
|
|
161
|
+
});
|
|
162
|
+
</script>
|