@vc-shell/create-vc-app 1.0.341 → 1.1.0-alpha.10
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 +19 -1
- package/README.md +30 -30
- package/dist/index.js +154 -186
- package/dist/templates/base/LICENSE +12 -12
- package/dist/templates/base/README.md +54 -54
- package/dist/templates/base/_browserslistrc +3 -3
- package/dist/templates/base/_commitlintrc.json +3 -3
- package/dist/templates/base/_editorconfig +22 -22
- package/dist/templates/base/_env +3 -3
- package/dist/templates/base/_env.local +1 -1
- package/dist/templates/base/_eslintignore +3 -3
- package/dist/templates/base/_eslintrc.js +41 -41
- package/dist/templates/base/_github/COMMIT_CONVENTION.md +91 -91
- package/dist/templates/base/_github/PULL_REQUEST_TEMPLATE.md +8 -8
- package/dist/templates/base/_gitignore +71 -71
- package/dist/templates/base/_husky/commit-msg +4 -4
- package/dist/templates/base/_husky/pre-commit +4 -4
- package/dist/templates/base/_package.json +5 -6
- package/dist/templates/base/_prettierignore +4 -4
- package/dist/templates/base/_prettierrc +4 -4
- package/dist/templates/base/_vscode/extensions.json +14 -14
- package/dist/templates/base/_vscode/settings.json +14 -14
- package/dist/templates/base/_yarn/releases/yarn-4.0.2.cjs +893 -893
- package/dist/templates/base/_yarnrc.yml +7 -7
- package/dist/templates/base/index.html +26 -26
- package/dist/templates/base/postcss.config.cjs +6 -6
- package/dist/templates/base/public/assets/app-select.svg +11 -11
- package/dist/templates/base/public/assets/logo-white.svg +21 -21
- package/dist/templates/base/public/assets/logo.svg +8 -8
- package/dist/templates/base/public/img/icons/safari-pinned-tab.svg +32 -32
- package/dist/templates/base/scripts/release.ts +18 -18
- package/dist/templates/base/src/api_client/README.md +78 -78
- package/dist/templates/base/src/composables/index.ts +1 -1
- package/dist/templates/base/src/env.d.ts +9 -9
- package/dist/templates/base/src/locales/en.json +3 -3
- package/dist/templates/base/src/locales/index.ts +2 -2
- package/dist/templates/base/src/router/index.ts +10 -10
- package/dist/templates/base/src/router/routes.ts +78 -78
- package/dist/templates/base/src/shims-vue.d.ts +63 -63
- package/dist/templates/base/src/styles/custom.scss +2 -2
- package/dist/templates/base/src/styles/index.scss +2 -4
- package/dist/templates/base/tailwind.config.ts +7 -7
- package/dist/templates/base/tsconfig.json +16 -16
- package/dist/templates/base/vite.config.mts +5 -5
- package/dist/templates/mocks/sample-data/constants.ts +86 -86
- package/dist/templates/mocks/sample-data/index.ts +2 -2
- package/dist/templates/mocks/sample-data/methods.ts +65 -65
- package/dist/templates/modules/classic-module/composables/index.ts +2 -2
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +19 -19
- package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +23 -23
- package/dist/templates/modules/classic-module/index.ts +8 -8
- package/dist/templates/modules/classic-module/locales/en.json +28 -28
- package/dist/templates/modules/classic-module/locales/index.ts +2 -2
- package/dist/templates/modules/classic-module/pages/details.vue +61 -61
- package/dist/templates/modules/classic-module/pages/index.ts +2 -2
- package/dist/templates/modules/classic-module/pages/list.vue +162 -162
- package/dist/templates/modules/dynamic-module/composables/index.ts +2 -2
- package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +37 -37
- package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +49 -49
- package/dist/templates/modules/dynamic-module/index.ts +8 -8
- package/dist/templates/modules/dynamic-module/locales/en.json +35 -35
- package/dist/templates/modules/dynamic-module/locales/index.ts +2 -2
- package/dist/templates/modules/dynamic-module/pages/details.ts +20 -20
- package/dist/templates/modules/dynamic-module/pages/index.ts +4 -4
- package/dist/templates/modules/dynamic-module/pages/list.ts +35 -35
- package/dist/templates/sample/classic-module/composables/index.ts +2 -2
- package/dist/templates/sample/classic-module/composables/useDetails/index.ts +41 -41
- package/dist/templates/sample/classic-module/composables/useList/index.ts +41 -41
- package/dist/templates/sample/classic-module/index.ts +8 -8
- package/dist/templates/sample/classic-module/locales/en.json +59 -59
- package/dist/templates/sample/classic-module/locales/index.ts +2 -2
- package/dist/templates/sample/classic-module/pages/details.vue +257 -257
- package/dist/templates/sample/classic-module/pages/index.ts +2 -2
- package/dist/templates/sample/dynamic-module/composables/index.ts +2 -2
- package/dist/templates/sample/dynamic-module/composables/useDetails/index.ts +46 -46
- package/dist/templates/sample/dynamic-module/composables/useList/index.ts +50 -50
- package/dist/templates/sample/dynamic-module/index.ts +8 -8
- package/dist/templates/sample/dynamic-module/locales/en.json +69 -69
- package/dist/templates/sample/dynamic-module/locales/index.ts +2 -2
- package/dist/templates/sample/dynamic-module/pages/details.ts +100 -100
- package/dist/templates/sample/dynamic-module/pages/index.ts +4 -4
- package/dist/templates/sample/dynamic-module/pages/list.ts +81 -81
- package/package.json +4 -3
- package/dist/templates/base/src/styles/base.scss +0 -38
- package/dist/templates/base/src/styles/colors.scss +0 -10
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { computed, ref, Ref } from "vue";
|
|
2
|
-
import { DetailsBaseBladeScope, IBladeToolbar, useDetailsFactory, DetailsComposableArgs } from "@vc-shell/framework";
|
|
3
|
-
|
|
4
|
-
export interface DynamicItemScope extends DetailsBaseBladeScope {}
|
|
5
|
-
|
|
6
|
-
export default (args: DetailsComposableArgs) => {
|
|
7
|
-
const factory = useDetailsFactory({
|
|
8
|
-
load: async () => {
|
|
9
|
-
return {};
|
|
10
|
-
},
|
|
11
|
-
saveChanges: () => {
|
|
12
|
-
throw new Error("Function not implemented.");
|
|
13
|
-
},
|
|
14
|
-
remove: () => {
|
|
15
|
-
throw new Error("Function not implemented.");
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const { load, saveChanges, remove, loading, item, validationState } = factory();
|
|
20
|
-
|
|
21
|
-
const scope: DynamicItemScope = {};
|
|
22
|
-
|
|
23
|
-
const bladeTitle = computed(() => {
|
|
24
|
-
return "{{ModuleNameSentenceCase}} details";
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
load,
|
|
29
|
-
saveChanges,
|
|
30
|
-
remove,
|
|
31
|
-
loading,
|
|
32
|
-
item,
|
|
33
|
-
validationState,
|
|
34
|
-
bladeTitle,
|
|
35
|
-
scope,
|
|
36
|
-
};
|
|
37
|
-
};
|
|
1
|
+
import { computed, ref, Ref } from "vue";
|
|
2
|
+
import { DetailsBaseBladeScope, IBladeToolbar, useDetailsFactory, DetailsComposableArgs } from "@vc-shell/framework";
|
|
3
|
+
|
|
4
|
+
export interface DynamicItemScope extends DetailsBaseBladeScope {}
|
|
5
|
+
|
|
6
|
+
export default (args: DetailsComposableArgs) => {
|
|
7
|
+
const factory = useDetailsFactory({
|
|
8
|
+
load: async () => {
|
|
9
|
+
return {};
|
|
10
|
+
},
|
|
11
|
+
saveChanges: () => {
|
|
12
|
+
throw new Error("Function not implemented.");
|
|
13
|
+
},
|
|
14
|
+
remove: () => {
|
|
15
|
+
throw new Error("Function not implemented.");
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const { load, saveChanges, remove, loading, item, validationState } = factory();
|
|
20
|
+
|
|
21
|
+
const scope: DynamicItemScope = {};
|
|
22
|
+
|
|
23
|
+
const bladeTitle = computed(() => {
|
|
24
|
+
return "{{ModuleNameSentenceCase}} details";
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
load,
|
|
29
|
+
saveChanges,
|
|
30
|
+
remove,
|
|
31
|
+
loading,
|
|
32
|
+
item,
|
|
33
|
+
validationState,
|
|
34
|
+
bladeTitle,
|
|
35
|
+
scope,
|
|
36
|
+
};
|
|
37
|
+
};
|
package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}List/index.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { computed, ref, Ref } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
ListComposableArgs,
|
|
4
|
-
ListBaseBladeScope,
|
|
5
|
-
useBladeNavigation,
|
|
6
|
-
useListFactory,
|
|
7
|
-
type TOpenBladeArgs,
|
|
8
|
-
} from "@vc-shell/framework";
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
11
|
-
export interface DynamicItemsScope extends ListBaseBladeScope {}
|
|
12
|
-
|
|
13
|
-
export default (args: ListComposableArgs) => {
|
|
14
|
-
const factory = useListFactory({
|
|
15
|
-
load: async () => {
|
|
16
|
-
return {
|
|
17
|
-
totalCount: 0,
|
|
18
|
-
results: [],
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
remove: () => {
|
|
22
|
-
throw new Error("Function not implemented.");
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const { load, remove, items, pagination, loading, query } = factory();
|
|
27
|
-
const { openBlade, resolveBladeByName } = useBladeNavigation();
|
|
28
|
-
|
|
29
|
-
async function openDetailsBlade(data?: TOpenBladeArgs) {
|
|
30
|
-
await openBlade({
|
|
31
|
-
blade: resolveBladeByName("{{ModuleNamePascalCase}}Details"),
|
|
32
|
-
...data,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const scope: DynamicItemsScope = {
|
|
37
|
-
openDetailsBlade,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
items,
|
|
42
|
-
load,
|
|
43
|
-
remove,
|
|
44
|
-
loading,
|
|
45
|
-
pagination,
|
|
46
|
-
query,
|
|
47
|
-
scope,
|
|
48
|
-
};
|
|
49
|
-
};
|
|
1
|
+
import { computed, ref, Ref } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
ListComposableArgs,
|
|
4
|
+
ListBaseBladeScope,
|
|
5
|
+
useBladeNavigation,
|
|
6
|
+
useListFactory,
|
|
7
|
+
type TOpenBladeArgs,
|
|
8
|
+
} from "@vc-shell/framework";
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
11
|
+
export interface DynamicItemsScope extends ListBaseBladeScope {}
|
|
12
|
+
|
|
13
|
+
export default (args: ListComposableArgs) => {
|
|
14
|
+
const factory = useListFactory({
|
|
15
|
+
load: async () => {
|
|
16
|
+
return {
|
|
17
|
+
totalCount: 0,
|
|
18
|
+
results: [],
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
remove: () => {
|
|
22
|
+
throw new Error("Function not implemented.");
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const { load, remove, items, pagination, loading, query } = factory();
|
|
27
|
+
const { openBlade, resolveBladeByName } = useBladeNavigation();
|
|
28
|
+
|
|
29
|
+
async function openDetailsBlade(data?: TOpenBladeArgs) {
|
|
30
|
+
await openBlade({
|
|
31
|
+
blade: resolveBladeByName("{{ModuleNamePascalCase}}Details"),
|
|
32
|
+
...data,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const scope: DynamicItemsScope = {
|
|
37
|
+
openDetailsBlade,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
items,
|
|
42
|
+
load,
|
|
43
|
+
remove,
|
|
44
|
+
loading,
|
|
45
|
+
pagination,
|
|
46
|
+
query,
|
|
47
|
+
scope,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as schema from "./pages";
|
|
2
|
-
import * as locales from "./locales";
|
|
3
|
-
import * as composables from "./composables";
|
|
4
|
-
import { createDynamicAppModule } from "@vc-shell/framework";
|
|
5
|
-
|
|
6
|
-
export default createDynamicAppModule({ schema, locales, composables });
|
|
7
|
-
|
|
8
|
-
export { schema, composables, locales };
|
|
1
|
+
import * as schema from "./pages";
|
|
2
|
+
import * as locales from "./locales";
|
|
3
|
+
import * as composables from "./composables";
|
|
4
|
+
import { createDynamicAppModule } from "@vc-shell/framework";
|
|
5
|
+
|
|
6
|
+
export default createDynamicAppModule({ schema, locales, composables });
|
|
7
|
+
|
|
8
|
+
export { schema, composables, locales };
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"{{ModuleNameUppercaseSnakeCase}}": {
|
|
3
|
-
"MENU": {
|
|
4
|
-
"TITLE": "{{ModuleNameSentenceCase}}"
|
|
5
|
-
},
|
|
6
|
-
"PAGES": {
|
|
7
|
-
"LIST": {
|
|
8
|
-
"TOOLBAR": {
|
|
9
|
-
"REFRESH": "Refresh"
|
|
10
|
-
},
|
|
11
|
-
"SEARCH": {
|
|
12
|
-
"PLACEHOLDER": "Search keywords"
|
|
13
|
-
},
|
|
14
|
-
"TABLE": {
|
|
15
|
-
"TOTALS": "Count:",
|
|
16
|
-
"HEADER": {},
|
|
17
|
-
"EMPTY": {
|
|
18
|
-
"TITLE": "There are no content yet",
|
|
19
|
-
"ACTION": "Add content"
|
|
20
|
-
},
|
|
21
|
-
"NOT_FOUND": {
|
|
22
|
-
"TITLE": "No content found.",
|
|
23
|
-
"ACTION": "Reset search"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"EMPTY": {
|
|
27
|
-
"NO_ITEMS": "There are no items yet"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"ALERTS": {
|
|
31
|
-
"CLOSE_CONFIRMATION": "You have unsaved changes. Close anyway?"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"{{ModuleNameUppercaseSnakeCase}}": {
|
|
3
|
+
"MENU": {
|
|
4
|
+
"TITLE": "{{ModuleNameSentenceCase}}"
|
|
5
|
+
},
|
|
6
|
+
"PAGES": {
|
|
7
|
+
"LIST": {
|
|
8
|
+
"TOOLBAR": {
|
|
9
|
+
"REFRESH": "Refresh"
|
|
10
|
+
},
|
|
11
|
+
"SEARCH": {
|
|
12
|
+
"PLACEHOLDER": "Search keywords"
|
|
13
|
+
},
|
|
14
|
+
"TABLE": {
|
|
15
|
+
"TOTALS": "Count:",
|
|
16
|
+
"HEADER": {},
|
|
17
|
+
"EMPTY": {
|
|
18
|
+
"TITLE": "There are no content yet",
|
|
19
|
+
"ACTION": "Add content"
|
|
20
|
+
},
|
|
21
|
+
"NOT_FOUND": {
|
|
22
|
+
"TITLE": "No content found.",
|
|
23
|
+
"ACTION": "Reset search"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"EMPTY": {
|
|
27
|
+
"NO_ITEMS": "There are no items yet"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"ALERTS": {
|
|
31
|
+
"CLOSE_CONFIRMATION": "You have unsaved changes. Close anyway?"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -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,20 +1,20 @@
|
|
|
1
|
-
import { DynamicDetailsSchema } from "@vc-shell/framework";
|
|
2
|
-
|
|
3
|
-
export const details: DynamicDetailsSchema = {
|
|
4
|
-
settings: {
|
|
5
|
-
url: "/{{ModuleName}}-details",
|
|
6
|
-
id: "{{ModuleNamePascalCase}}Details",
|
|
7
|
-
localizationPrefix: "{{ModuleNameUppercaseSnakeCase}}",
|
|
8
|
-
composable: "use{{ModuleNamePascalCase}}Details",
|
|
9
|
-
component: "DynamicBladeForm",
|
|
10
|
-
},
|
|
11
|
-
content: [
|
|
12
|
-
{
|
|
13
|
-
id: "dynamicItemForm",
|
|
14
|
-
component: "vc-form",
|
|
15
|
-
children: [
|
|
16
|
-
// You can add fields here
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
};
|
|
1
|
+
import { DynamicDetailsSchema } from "@vc-shell/framework";
|
|
2
|
+
|
|
3
|
+
export const details: DynamicDetailsSchema = {
|
|
4
|
+
settings: {
|
|
5
|
+
url: "/{{ModuleName}}-details",
|
|
6
|
+
id: "{{ModuleNamePascalCase}}Details",
|
|
7
|
+
localizationPrefix: "{{ModuleNameUppercaseSnakeCase}}",
|
|
8
|
+
composable: "use{{ModuleNamePascalCase}}Details",
|
|
9
|
+
component: "DynamicBladeForm",
|
|
10
|
+
},
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
id: "dynamicItemForm",
|
|
14
|
+
component: "vc-form",
|
|
15
|
+
children: [
|
|
16
|
+
// You can add fields here
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { grid as {{ModuleNameExports}}List } from "./list";
|
|
2
|
-
import { details as {{ModuleNameExports}}Details } from "./details";
|
|
3
|
-
|
|
4
|
-
export { {{ModuleNameExports}}List, {{ModuleNameExports}}Details };
|
|
1
|
+
import { grid as {{ModuleNameExports}}List } from "./list";
|
|
2
|
+
import { details as {{ModuleNameExports}}Details } from "./details";
|
|
3
|
+
|
|
4
|
+
export { {{ModuleNameExports}}List, {{ModuleNameExports}}Details };
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { DynamicGridSchema } from "@vc-shell/framework";
|
|
2
|
-
|
|
3
|
-
export const grid: DynamicGridSchema = {
|
|
4
|
-
settings: {
|
|
5
|
-
url: "/{{ModuleName}}",
|
|
6
|
-
id: "{{ModuleNamePascalCase}}List",
|
|
7
|
-
titleTemplate: "{{ModuleNameSentenceCase}} list",
|
|
8
|
-
localizationPrefix: "{{ModuleNameUppercaseSnakeCase}}",
|
|
9
|
-
isWorkspace: true,
|
|
10
|
-
composable: "use{{ModuleNamePascalCase}}List",
|
|
11
|
-
component: "DynamicBladeList",
|
|
12
|
-
toolbar: [
|
|
13
|
-
{
|
|
14
|
-
id: "refresh",
|
|
15
|
-
icon: "fas fa-sync-alt",
|
|
16
|
-
title: "Refresh",
|
|
17
|
-
method: "refresh",
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
menuItem: {
|
|
21
|
-
title: "{{ModuleNameUppercaseSnakeCase}}.MENU.TITLE",
|
|
22
|
-
icon: "fas fa-file-alt",
|
|
23
|
-
priority: 1,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
content: [
|
|
27
|
-
{
|
|
28
|
-
id: "itemsGrid",
|
|
29
|
-
component: "vc-table",
|
|
30
|
-
columns: [
|
|
31
|
-
// You can add columns here
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
};
|
|
1
|
+
import { DynamicGridSchema } from "@vc-shell/framework";
|
|
2
|
+
|
|
3
|
+
export const grid: DynamicGridSchema = {
|
|
4
|
+
settings: {
|
|
5
|
+
url: "/{{ModuleName}}",
|
|
6
|
+
id: "{{ModuleNamePascalCase}}List",
|
|
7
|
+
titleTemplate: "{{ModuleNameSentenceCase}} list",
|
|
8
|
+
localizationPrefix: "{{ModuleNameUppercaseSnakeCase}}",
|
|
9
|
+
isWorkspace: true,
|
|
10
|
+
composable: "use{{ModuleNamePascalCase}}List",
|
|
11
|
+
component: "DynamicBladeList",
|
|
12
|
+
toolbar: [
|
|
13
|
+
{
|
|
14
|
+
id: "refresh",
|
|
15
|
+
icon: "fas fa-sync-alt",
|
|
16
|
+
title: "Refresh",
|
|
17
|
+
method: "refresh",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
menuItem: {
|
|
21
|
+
title: "{{ModuleNameUppercaseSnakeCase}}.MENU.TITLE",
|
|
22
|
+
icon: "fas fa-file-alt",
|
|
23
|
+
priority: 1,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
id: "itemsGrid",
|
|
29
|
+
component: "vc-table",
|
|
30
|
+
columns: [
|
|
31
|
+
// You can add columns here
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as useList } from "./useList";
|
|
2
|
-
export { default as useDetails } from "./useDetails";
|
|
1
|
+
export { default as useList } from "./useList";
|
|
2
|
+
export { default as useDetails } from "./useDetails";
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { Ref, computed, ref } from "vue";
|
|
2
|
-
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
3
|
-
import {
|
|
4
|
-
MockedItem,
|
|
5
|
-
addNewMockItem,
|
|
6
|
-
currencyOptions,
|
|
7
|
-
loadMockItem,
|
|
8
|
-
removeMockItem,
|
|
9
|
-
updateMockItem,
|
|
10
|
-
} from "../../sample-data";
|
|
11
|
-
|
|
12
|
-
export default () => {
|
|
13
|
-
const item = ref({}) as Ref<MockedItem>;
|
|
14
|
-
|
|
15
|
-
const { loading: itemLoading, action: getItem } = useAsync<{ id: string }>(async (payload) => {
|
|
16
|
-
item.value = await loadMockItem(payload);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const { loading: saveLoading, action: saveItem } = useAsync<MockedItem, MockedItem | void>(async (payload) => {
|
|
20
|
-
if (payload) {
|
|
21
|
-
return payload.id ? await updateMockItem(payload) : await addNewMockItem(payload);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const { loading: removeLoading, action: removeItem } = useAsync<{ id: string }>(async (payload) => {
|
|
26
|
-
if (payload) {
|
|
27
|
-
return await removeMockItem(payload);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const loading = useLoading(itemLoading, saveLoading, removeLoading);
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
item: computed(() => item.value),
|
|
35
|
-
loading: computed(() => loading.value),
|
|
36
|
-
currencyOptions: computed(() => currencyOptions),
|
|
37
|
-
getItem,
|
|
38
|
-
saveItem,
|
|
39
|
-
removeItem,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
1
|
+
import { Ref, computed, ref } from "vue";
|
|
2
|
+
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
3
|
+
import {
|
|
4
|
+
MockedItem,
|
|
5
|
+
addNewMockItem,
|
|
6
|
+
currencyOptions,
|
|
7
|
+
loadMockItem,
|
|
8
|
+
removeMockItem,
|
|
9
|
+
updateMockItem,
|
|
10
|
+
} from "../../sample-data";
|
|
11
|
+
|
|
12
|
+
export default () => {
|
|
13
|
+
const item = ref({}) as Ref<MockedItem>;
|
|
14
|
+
|
|
15
|
+
const { loading: itemLoading, action: getItem } = useAsync<{ id: string }>(async (payload) => {
|
|
16
|
+
item.value = await loadMockItem(payload);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const { loading: saveLoading, action: saveItem } = useAsync<MockedItem, MockedItem | void>(async (payload) => {
|
|
20
|
+
if (payload) {
|
|
21
|
+
return payload.id ? await updateMockItem(payload) : await addNewMockItem(payload);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const { loading: removeLoading, action: removeItem } = useAsync<{ id: string }>(async (payload) => {
|
|
26
|
+
if (payload) {
|
|
27
|
+
return await removeMockItem(payload);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const loading = useLoading(itemLoading, saveLoading, removeLoading);
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
item: computed(() => item.value),
|
|
35
|
+
loading: computed(() => loading.value),
|
|
36
|
+
currencyOptions: computed(() => currencyOptions),
|
|
37
|
+
getItem,
|
|
38
|
+
saveItem,
|
|
39
|
+
removeItem,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { Ref, computed, ref } from "vue";
|
|
2
|
-
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
3
|
-
import { MockedItem, MockedQuery, loadMockItemsList, removeMockItem } from "../../sample-data";
|
|
4
|
-
|
|
5
|
-
export interface useClassicAppList {
|
|
6
|
-
data: Ref<MockedItem[]>;
|
|
7
|
-
loading: Ref<boolean>;
|
|
8
|
-
totalCount: Ref<number>;
|
|
9
|
-
pages: Ref<number>;
|
|
10
|
-
currentPage: number;
|
|
11
|
-
getItems: (query: MockedQuery) => void;
|
|
12
|
-
removeItems: (args: { ids: string[] }) => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default (): useClassicAppList => {
|
|
16
|
-
const result = ref() as Ref<{ results: MockedItem[]; totalCount: number }>;
|
|
17
|
-
|
|
18
|
-
const { loading: itemLoading, action: getItems } = useAsync<MockedQuery>(async (query) => {
|
|
19
|
-
if (query) result.value = await loadMockItemsList(query);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const { loading: removeLoading, action: removeItems } = useAsync<{ ids: string[] }>(async (args) => {
|
|
23
|
-
if (args) {
|
|
24
|
-
for (const id of args.ids) {
|
|
25
|
-
await removeMockItem({ id });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const loading = useLoading(itemLoading, removeLoading);
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
data: computed(() => result.value?.results),
|
|
34
|
-
loading: computed(() => loading.value),
|
|
35
|
-
totalCount: computed(() => result.value?.totalCount),
|
|
36
|
-
pages: computed(() => Math.ceil(result.value?.totalCount / 20)),
|
|
37
|
-
currentPage: 0 / Math.max(1, 20) + 1,
|
|
38
|
-
getItems,
|
|
39
|
-
removeItems,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
1
|
+
import { Ref, computed, ref } from "vue";
|
|
2
|
+
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
3
|
+
import { MockedItem, MockedQuery, loadMockItemsList, removeMockItem } from "../../sample-data";
|
|
4
|
+
|
|
5
|
+
export interface useClassicAppList {
|
|
6
|
+
data: Ref<MockedItem[]>;
|
|
7
|
+
loading: Ref<boolean>;
|
|
8
|
+
totalCount: Ref<number>;
|
|
9
|
+
pages: Ref<number>;
|
|
10
|
+
currentPage: number;
|
|
11
|
+
getItems: (query: MockedQuery) => void;
|
|
12
|
+
removeItems: (args: { ids: string[] }) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default (): useClassicAppList => {
|
|
16
|
+
const result = ref() as Ref<{ results: MockedItem[]; totalCount: number }>;
|
|
17
|
+
|
|
18
|
+
const { loading: itemLoading, action: getItems } = useAsync<MockedQuery>(async (query) => {
|
|
19
|
+
if (query) result.value = await loadMockItemsList(query);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const { loading: removeLoading, action: removeItems } = useAsync<{ ids: string[] }>(async (args) => {
|
|
23
|
+
if (args) {
|
|
24
|
+
for (const id of args.ids) {
|
|
25
|
+
await removeMockItem({ id });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const loading = useLoading(itemLoading, removeLoading);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
data: computed(() => result.value?.results),
|
|
34
|
+
loading: computed(() => loading.value),
|
|
35
|
+
totalCount: computed(() => result.value?.totalCount),
|
|
36
|
+
pages: computed(() => Math.ceil(result.value?.totalCount / 20)),
|
|
37
|
+
currentPage: 0 / Math.max(1, 20) + 1,
|
|
38
|
+
getItems,
|
|
39
|
+
removeItems,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -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";
|