@vc-shell/create-vc-app 1.0.174 → 1.0.176
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 +13 -0
- package/dist/index.js +102 -55
- package/dist/templates/base/package.json +5 -5
- package/dist/templates/base/src/modules/mocks.ts +50 -0
- package/dist/templates/base/vite.config.mts +1 -10
- package/dist/templates/modules/classic-module/composables/useDetails/index.ts +20 -0
- package/dist/templates/modules/classic-module/composables/useList/index.ts +25 -0
- package/dist/templates/{variants/dynamic/src/modules → modules}/dynamic-module/composables/useDetails/index.ts +3 -30
- package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/composables/useList/index.ts +2 -39
- package/dist/templates/variants/both/src/main.ts +2 -3
- package/dist/templates/variants/classic/src/main.ts +2 -3
- package/dist/templates/variants/dynamic/src/main.ts +2 -3
- package/package.json +2 -2
- package/dist/templates/variants/both/src/modules/classic-module/composables/useDetails/index.ts +0 -54
- package/dist/templates/variants/both/src/modules/classic-module/composables/useList/index.ts +0 -58
- package/dist/templates/variants/both/src/modules/dynamic-module/composables/useDetails/index.ts +0 -83
- package/dist/templates/variants/classic/src/modules/classic-module/components/index.ts +0 -1
- package/dist/templates/variants/classic/src/modules/classic-module/composables/index.ts +0 -2
- package/dist/templates/variants/classic/src/modules/classic-module/composables/useDetails/index.ts +0 -54
- package/dist/templates/variants/classic/src/modules/classic-module/composables/useList/index.ts +0 -58
- package/dist/templates/variants/classic/src/modules/classic-module/index.ts +0 -9
- package/dist/templates/variants/classic/src/modules/classic-module/locales/en.json +0 -46
- package/dist/templates/variants/classic/src/modules/classic-module/locales/index.ts +0 -2
- package/dist/templates/variants/classic/src/modules/classic-module/pages/details.vue +0 -86
- package/dist/templates/variants/classic/src/modules/classic-module/pages/index.ts +0 -2
- package/dist/templates/variants/classic/src/modules/classic-module/pages/list.vue +0 -270
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/components/DynamicItemsMobileGridView.vue +0 -39
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/components/index.ts +0 -3
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/index.ts +0 -2
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/composables/useList/index.ts +0 -85
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/index.ts +0 -9
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/locales/en.json +0 -49
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/locales/index.ts +0 -2
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/pages/details.ts +0 -39
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/pages/index.ts +0 -4
- package/dist/templates/variants/dynamic/src/modules/dynamic-module/pages/list.ts +0 -65
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/components/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/composables/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/locales/en.json +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/locales/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/pages/details.vue +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/pages/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/classic-module/pages/list.vue +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/components/DynamicItemsMobileGridView.vue +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/components/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/composables/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/locales/en.json +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/locales/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/pages/details.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/pages/index.ts +0 -0
- /package/dist/templates/{variants/both/src/modules → modules}/dynamic-module/pages/list.ts +0 -0
package/dist/templates/variants/both/src/modules/dynamic-module/composables/useDetails/index.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unresolved */
|
|
2
|
-
import { computed, ref, Ref } from "vue";
|
|
3
|
-
import img1 from "/assets/1.jpeg";
|
|
4
|
-
import img2 from "/assets/2.jpg";
|
|
5
|
-
import img3 from "/assets/3.jpg";
|
|
6
|
-
import { DetailsBaseBladeScope, DynamicBladeForm, IBladeToolbar, useDetailsFactory } from "@vc-shell/framework";
|
|
7
|
-
|
|
8
|
-
export interface DynamicItemScope extends DetailsBaseBladeScope {
|
|
9
|
-
toolbarOverrides: {
|
|
10
|
-
refresh: IBladeToolbar;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default (args: {
|
|
15
|
-
props: InstanceType<typeof DynamicBladeForm>["$props"];
|
|
16
|
-
emit: InstanceType<typeof DynamicBladeForm>["$emit"];
|
|
17
|
-
mounted: Ref<boolean>;
|
|
18
|
-
}) => {
|
|
19
|
-
const factory = useDetailsFactory<{ imgSrc: string; name: string; createdDate: Date; id: string }>({
|
|
20
|
-
load: async (payload) => {
|
|
21
|
-
return await new Promise((resolve) => {
|
|
22
|
-
setTimeout(() => {
|
|
23
|
-
const findMockedItem = [
|
|
24
|
-
{
|
|
25
|
-
imgSrc: img1,
|
|
26
|
-
name: "Item 1",
|
|
27
|
-
createdDate: new Date(),
|
|
28
|
-
id: "item-id-1",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
imgSrc: img2,
|
|
32
|
-
name: "Item 2",
|
|
33
|
-
createdDate: new Date(),
|
|
34
|
-
id: "item-id-2",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
imgSrc: img3,
|
|
38
|
-
name: "Item 3",
|
|
39
|
-
createdDate: new Date(),
|
|
40
|
-
id: "item-id-3",
|
|
41
|
-
},
|
|
42
|
-
].find((x) => x.id === payload?.id);
|
|
43
|
-
resolve(findMockedItem);
|
|
44
|
-
}, 1000);
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
saveChanges: () => {
|
|
48
|
-
throw new Error("Function not implemented.");
|
|
49
|
-
},
|
|
50
|
-
remove: () => {
|
|
51
|
-
throw new Error("Function not implemented.");
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const { load, saveChanges, remove, loading, item, validationState } = factory();
|
|
56
|
-
|
|
57
|
-
const scope = ref<DynamicItemScope>({
|
|
58
|
-
toolbarOverrides: {
|
|
59
|
-
refresh: {
|
|
60
|
-
async clickHandler() {
|
|
61
|
-
if (args.props.param) {
|
|
62
|
-
await load({ id: args.props.param });
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const bladeTitle = computed(() => {
|
|
70
|
-
return args.props.param ? item.value?.name : "Dynamic item details";
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
load,
|
|
75
|
-
saveChanges,
|
|
76
|
-
remove,
|
|
77
|
-
loading,
|
|
78
|
-
item,
|
|
79
|
-
validationState,
|
|
80
|
-
bladeTitle,
|
|
81
|
-
scope: computed(() => scope.value),
|
|
82
|
-
};
|
|
83
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/templates/variants/classic/src/modules/classic-module/composables/useDetails/index.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unresolved */
|
|
2
|
-
import { Ref, computed, ref } from "vue";
|
|
3
|
-
import img1 from "/assets/1.jpeg";
|
|
4
|
-
import img2 from "/assets/2.jpg";
|
|
5
|
-
import img3 from "/assets/3.jpg";
|
|
6
|
-
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
7
|
-
|
|
8
|
-
export default () => {
|
|
9
|
-
const item = ref({}) as Ref<{
|
|
10
|
-
imgSrc: string;
|
|
11
|
-
name: string;
|
|
12
|
-
createdDate: Date;
|
|
13
|
-
id: string;
|
|
14
|
-
}>;
|
|
15
|
-
|
|
16
|
-
// Example mocked method for 'fetching' list data
|
|
17
|
-
const { loading: itemLoading, action: getItem } = useAsync<{ id: string }>(async (payload) => {
|
|
18
|
-
item.value = await new Promise((resolve) => {
|
|
19
|
-
setTimeout(() => {
|
|
20
|
-
const findMockedItem = [
|
|
21
|
-
{
|
|
22
|
-
imgSrc: img1,
|
|
23
|
-
name: "Item 1",
|
|
24
|
-
createdDate: new Date(),
|
|
25
|
-
id: "item-id-1",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
imgSrc: img2,
|
|
29
|
-
name: "Item 2",
|
|
30
|
-
createdDate: new Date(),
|
|
31
|
-
id: "item-id-2",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
imgSrc: img3,
|
|
35
|
-
name: "Item 3",
|
|
36
|
-
createdDate: new Date(),
|
|
37
|
-
id: "item-id-3",
|
|
38
|
-
},
|
|
39
|
-
].find((x) => x.id === payload?.id);
|
|
40
|
-
if (findMockedItem) {
|
|
41
|
-
resolve(findMockedItem);
|
|
42
|
-
}
|
|
43
|
-
}, 1000);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const loading = useLoading(itemLoading);
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
item: computed(() => item.value),
|
|
51
|
-
loading: computed(() => loading.value),
|
|
52
|
-
getItem,
|
|
53
|
-
};
|
|
54
|
-
};
|
package/dist/templates/variants/classic/src/modules/classic-module/composables/useList/index.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unresolved */
|
|
2
|
-
import { Ref, computed, ref } from "vue";
|
|
3
|
-
import img1 from "/assets/1.jpeg";
|
|
4
|
-
import img2 from "/assets/2.jpg";
|
|
5
|
-
import img3 from "/assets/3.jpg";
|
|
6
|
-
import { useAsync, useLoading } from "@vc-shell/framework";
|
|
7
|
-
|
|
8
|
-
export default () => {
|
|
9
|
-
const data = ref([]) as Ref<
|
|
10
|
-
{
|
|
11
|
-
imgSrc: string;
|
|
12
|
-
name: string;
|
|
13
|
-
createdDate: Date;
|
|
14
|
-
id: string;
|
|
15
|
-
}[]
|
|
16
|
-
>;
|
|
17
|
-
|
|
18
|
-
// Example mocked method for 'fetching' list data
|
|
19
|
-
const { loading: itemLoading, action: getItems } = useAsync(async (payload) => {
|
|
20
|
-
data.value = await new Promise((resolve) => {
|
|
21
|
-
setTimeout(
|
|
22
|
-
() =>
|
|
23
|
-
resolve([
|
|
24
|
-
{
|
|
25
|
-
imgSrc: img1,
|
|
26
|
-
name: "Item 1",
|
|
27
|
-
createdDate: new Date(),
|
|
28
|
-
id: "item-id-1",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
imgSrc: img2,
|
|
32
|
-
name: "Item 2",
|
|
33
|
-
createdDate: new Date(),
|
|
34
|
-
id: "item-id-2",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
imgSrc: img3,
|
|
38
|
-
name: "Item 3",
|
|
39
|
-
createdDate: new Date(),
|
|
40
|
-
id: "item-id-3",
|
|
41
|
-
},
|
|
42
|
-
]),
|
|
43
|
-
1000,
|
|
44
|
-
);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const loading = useLoading(itemLoading);
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
data: computed(() => data.value),
|
|
52
|
-
loading: computed(() => loading.value),
|
|
53
|
-
totalCount: computed(() => data.value.length),
|
|
54
|
-
pages: computed(() => Math.ceil(data.value.length / 20)),
|
|
55
|
-
currentPage: 0 / Math.max(1, 20) + 1,
|
|
56
|
-
getItems,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
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";
|
|
9
|
-
// export * from "./components";
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
"ALERTS": {
|
|
42
|
-
"CLOSE_CONFIRMATION": "You have unsaved changes\nClose anyway?"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
name: "ClassicModuleDetails",
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
55
|
-
expanded: true,
|
|
56
|
-
closable: true,
|
|
57
|
-
param: undefined,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const emit = defineEmits<Emits>();
|
|
61
|
-
|
|
62
|
-
const { t } = useI18n({ useScope: "global" });
|
|
63
|
-
|
|
64
|
-
const { item, loading, getItem } = useDetails();
|
|
65
|
-
|
|
66
|
-
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
67
|
-
{
|
|
68
|
-
id: "refresh",
|
|
69
|
-
title: computed(() => t("MODULE.PAGES.LIST.TOOLBAR.REFRESH")),
|
|
70
|
-
icon: "fas fa-sync-alt",
|
|
71
|
-
async clickHandler() {
|
|
72
|
-
if (props.param) {
|
|
73
|
-
await getItem({ id: props.param });
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
]);
|
|
78
|
-
|
|
79
|
-
onMounted(async () => {
|
|
80
|
-
if (props.param) {
|
|
81
|
-
await getItem({ id: props.param });
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,270 +0,0 @@
|
|
|
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
|
-
enable-item-actions
|
|
23
|
-
:sort="sort"
|
|
24
|
-
:pages="pages"
|
|
25
|
-
:total-count="totalCount"
|
|
26
|
-
:search-value="searchValue"
|
|
27
|
-
:current-page="currentPage"
|
|
28
|
-
:search-placeholder="$t('MODULE.PAGES.LIST.SEARCH.PLACEHOLDER')"
|
|
29
|
-
:total-label="$t('MODULE.PAGES.LIST.TABLE.TOTALS')"
|
|
30
|
-
:selected-item-id="selectedItemId"
|
|
31
|
-
state-key="module"
|
|
32
|
-
:items="data"
|
|
33
|
-
@item-click="onItemClick"
|
|
34
|
-
@header-click="onHeaderClick"
|
|
35
|
-
>
|
|
36
|
-
<template #mobile-item="itemData">
|
|
37
|
-
<div class="tw-border-b tw-border-solid tw-border-b-[#e3e7ec] tw-py-3 tw-px-4">
|
|
38
|
-
<div class="tw-w-full tw-flex tw-justify-evenly tw-mb-2">
|
|
39
|
-
<VcImage
|
|
40
|
-
class="tw-shrink-0"
|
|
41
|
-
aspect="1x1"
|
|
42
|
-
size="s"
|
|
43
|
-
:bordered="true"
|
|
44
|
-
:src="itemData.item.imgSrc"
|
|
45
|
-
></VcImage>
|
|
46
|
-
<div class="tw-grow tw-basis-0 tw-ml-3">
|
|
47
|
-
<div class="tw-font-bold tw-text-lg">
|
|
48
|
-
{{ itemData.item.name }}
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
<div class="tw-truncate tw-grow-[2] tw-basis-0">
|
|
53
|
-
<VcHint>{{ $t("MODULE.PAGES.LIST.MOBILE.CREATED") }}</VcHint>
|
|
54
|
-
<div class="tw-truncate tw-mt-1">
|
|
55
|
-
{{ itemData.item.createdDate }}
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</template>
|
|
60
|
-
</VcTable>
|
|
61
|
-
</VcBlade>
|
|
62
|
-
</template>
|
|
63
|
-
|
|
64
|
-
<script lang="ts" setup>
|
|
65
|
-
import { computed, inject, reactive, ref, markRaw, onMounted, watch } from "vue";
|
|
66
|
-
import {
|
|
67
|
-
IBladeEvent,
|
|
68
|
-
IBladeToolbar,
|
|
69
|
-
IParentCallArgs,
|
|
70
|
-
IActionBuilderResult,
|
|
71
|
-
ITableColumns,
|
|
72
|
-
useBladeNavigation,
|
|
73
|
-
} from "@vc-shell/framework";
|
|
74
|
-
// eslint-disable-next-line import/no-unresolved
|
|
75
|
-
import emptyImage from "/assets/empty.png";
|
|
76
|
-
import { useI18n } from "vue-i18n";
|
|
77
|
-
import { useList } from "./../composables";
|
|
78
|
-
import Details from "./details.vue";
|
|
79
|
-
|
|
80
|
-
export interface Props {
|
|
81
|
-
expanded?: boolean;
|
|
82
|
-
closable?: boolean;
|
|
83
|
-
param?: string;
|
|
84
|
-
options?: Record<string, unknown>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface Emits {
|
|
88
|
-
(event: "parent:call", args: IParentCallArgs): void;
|
|
89
|
-
(event: "collapse:blade"): void;
|
|
90
|
-
(event: "expand:blade"): void;
|
|
91
|
-
(event: "open:blade", blade: IBladeEvent): void;
|
|
92
|
-
(event: "close:blade"): void;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
defineOptions({
|
|
96
|
-
url: "/classic-module-list",
|
|
97
|
-
name: "ClassicModuleList",
|
|
98
|
-
isWorkspace: true,
|
|
99
|
-
menuItem: {
|
|
100
|
-
title: "MODULE.MENU.TITLE",
|
|
101
|
-
icon: "fas fa-file-alt",
|
|
102
|
-
priority: 1,
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
107
|
-
expanded: true,
|
|
108
|
-
closable: true,
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
defineEmits<Emits>();
|
|
112
|
-
|
|
113
|
-
const { t } = useI18n({ useScope: "global" });
|
|
114
|
-
const { openBlade } = useBladeNavigation();
|
|
115
|
-
const { getItems, data, loading, totalCount, pages, currentPage } = useList();
|
|
116
|
-
|
|
117
|
-
const sort = ref("createdDate:DESC");
|
|
118
|
-
const searchValue = ref();
|
|
119
|
-
const selectedItemId = ref<string>();
|
|
120
|
-
|
|
121
|
-
watch(
|
|
122
|
-
() => props.param,
|
|
123
|
-
(newVal) => {
|
|
124
|
-
if (newVal) {
|
|
125
|
-
selectedItemId.value = newVal;
|
|
126
|
-
|
|
127
|
-
openBlade({
|
|
128
|
-
blade: markRaw(Details),
|
|
129
|
-
param: newVal,
|
|
130
|
-
onOpen() {
|
|
131
|
-
selectedItemId.value = newVal;
|
|
132
|
-
},
|
|
133
|
-
onClose() {
|
|
134
|
-
selectedItemId.value = undefined;
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
{ immediate: true },
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
onMounted(async () => {
|
|
143
|
-
await getItems();
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
const bladeToolbar = ref<IBladeToolbar[]>([
|
|
147
|
-
{
|
|
148
|
-
id: "refresh",
|
|
149
|
-
title: computed(() => t("MODULE.PAGES.LIST.TOOLBAR.REFRESH")),
|
|
150
|
-
icon: "fas fa-sync-alt",
|
|
151
|
-
async clickHandler() {
|
|
152
|
-
await reload();
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
]);
|
|
156
|
-
|
|
157
|
-
const tableColumns = ref<ITableColumns[]>([
|
|
158
|
-
{
|
|
159
|
-
id: "imgSrc",
|
|
160
|
-
title: computed(() => t("MODULE.PAGES.LIST.TABLE.HEADER.PRODUCT_IMAGE")),
|
|
161
|
-
width: 60,
|
|
162
|
-
alwaysVisible: true,
|
|
163
|
-
type: "image",
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: "name",
|
|
167
|
-
field: "name",
|
|
168
|
-
title: computed(() => t("MODULE.PAGES.LIST.TABLE.HEADER.PRODUCT_NAME")),
|
|
169
|
-
alwaysVisible: true,
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
id: "createdDate",
|
|
173
|
-
title: computed(() => t("MODULE.PAGES.LIST.TABLE.HEADER.CREATED_DATE")),
|
|
174
|
-
width: 140,
|
|
175
|
-
type: "date-ago",
|
|
176
|
-
},
|
|
177
|
-
]);
|
|
178
|
-
|
|
179
|
-
const empty = reactive({
|
|
180
|
-
image: emptyImage,
|
|
181
|
-
text: computed(() => t("MODULE.PAGES.LIST.TABLE.EMPTY.TITLE")),
|
|
182
|
-
action: computed(() => t("MODULE.PAGES.LIST.TABLE.EMPTY.ACTION")),
|
|
183
|
-
// clickHandler: () => {},
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
const notfound = reactive({
|
|
187
|
-
image: emptyImage,
|
|
188
|
-
text: computed(() => t("MODULE.PAGES.LIST.TABLE.NOT_FOUND.TITLE")),
|
|
189
|
-
action: computed(() => t("MODULE.PAGES.LIST.TABLE.NOT_FOUND.ACTION")),
|
|
190
|
-
clickHandler: async () => {
|
|
191
|
-
searchValue.value = "";
|
|
192
|
-
},
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
const columns = computed(() => {
|
|
196
|
-
if (props.expanded) {
|
|
197
|
-
return tableColumns.value;
|
|
198
|
-
} else {
|
|
199
|
-
return tableColumns.value.filter((item) => item.alwaysVisible === true);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
const title = computed(() => t("MODULE.PAGES.LIST.TITLE"));
|
|
204
|
-
|
|
205
|
-
const reload = async () => {
|
|
206
|
-
await getItems();
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const onItemClick = (item: { id: string }) => {
|
|
210
|
-
openBlade({
|
|
211
|
-
blade: markRaw(Details),
|
|
212
|
-
param: item.id,
|
|
213
|
-
onOpen() {
|
|
214
|
-
selectedItemId.value = item.id;
|
|
215
|
-
},
|
|
216
|
-
onClose() {
|
|
217
|
-
selectedItemId.value = undefined;
|
|
218
|
-
},
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const onHeaderClick = (item: ITableColumns) => {
|
|
223
|
-
const sortOptions = ["DESC", "ASC", ""];
|
|
224
|
-
|
|
225
|
-
if (item.sortable) {
|
|
226
|
-
if (sort.value.split(":")[0] === item.id) {
|
|
227
|
-
const index = sortOptions.findIndex((x) => {
|
|
228
|
-
const sorting = sort.value.split(":")[1];
|
|
229
|
-
if (sorting) {
|
|
230
|
-
return x === sorting;
|
|
231
|
-
} else {
|
|
232
|
-
return x === "";
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
if (index !== -1) {
|
|
237
|
-
const newSort = sortOptions[(index + 1) % sortOptions.length];
|
|
238
|
-
|
|
239
|
-
if (newSort === "") {
|
|
240
|
-
sort.value = `${item.id}`;
|
|
241
|
-
} else {
|
|
242
|
-
sort.value = `${item.id}:${newSort}`;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
} else {
|
|
246
|
-
sort.value = `${item.id}:${sortOptions[0]}`;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
const actionBuilder = (item: (typeof data.value)[number]): IActionBuilderResult[] => {
|
|
252
|
-
const result: IActionBuilderResult[] = [];
|
|
253
|
-
|
|
254
|
-
result.push({
|
|
255
|
-
icon: "fas fa-trash",
|
|
256
|
-
title: "Delete",
|
|
257
|
-
type: "danger",
|
|
258
|
-
position: "left",
|
|
259
|
-
clickHandler() {
|
|
260
|
-
throw new Error("Function is not implemented.");
|
|
261
|
-
},
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
return result;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
defineExpose({
|
|
268
|
-
title,
|
|
269
|
-
});
|
|
270
|
-
</script>
|
|
@@ -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>
|