@tager/admin-banners 0.1.5 → 0.3.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 +13 -13
- package/dist/constants/menu.d.ts +4 -1
- package/dist/constants/paths.d.ts +8 -15
- package/dist/constants/routes.d.ts +3 -4
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useFetchBanner.d.ts +8 -0
- package/dist/hooks/useFetchBanners.d.ts +6 -0
- package/dist/hooks/useFetchZones.d.ts +6 -0
- package/dist/index.esm.js +3200 -875
- package/dist/index.umd.js +3213 -886
- package/dist/locales/en.d.ts +39 -0
- package/dist/locales/ru.d.ts +3 -0
- package/dist/{index.d.ts → main.d.ts} +1 -0
- package/dist/router/index.d.ts +4 -0
- package/dist/services/requests.d.ts +19 -35
- package/dist/typings/banners.d.ts +40 -0
- package/dist/typings/common.d.ts +1 -0
- package/dist/typings/model.d.ts +103 -15
- package/dist/typings/zones.d.ts +5 -0
- package/dist/utils/common.d.ts +2 -0
- package/dist/views/Banners/BannerForm/BannerForm.helpers.d.ts +5 -0
- package/dist/views/Banners/BannerForm/BannerForm.vue.d.ts +81 -0
- package/dist/views/Banners/BannerForm/index.d.ts +1 -0
- package/dist/views/Banners/BannerList/BannerList.helpers.d.ts +5 -0
- package/dist/views/Banners/BannerList/BannerList.vue.d.ts +55 -0
- package/dist/views/Banners/BannerList/hooks/index.d.ts +1 -0
- package/dist/views/Banners/BannerList/hooks/useAdvancedSearch.d.ts +21 -0
- package/dist/views/Banners/BannerList/index.d.ts +1 -0
- package/dist/views/Zones/ZoneList/ZoneList.helpers.d.ts +5 -0
- package/dist/views/Zones/ZoneList/ZoneList.vue.d.ts +28 -0
- package/dist/views/Zones/ZoneList/index.d.ts +1 -0
- package/package.json +76 -67
- package/src/config/config.json +19 -19
- package/src/constants/menu.ts +26 -12
- package/src/constants/paths.ts +19 -36
- package/src/constants/routes.ts +44 -66
- package/src/dev.ts +22 -34
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFetchBanner.ts +41 -0
- package/src/hooks/useFetchBanners.ts +23 -0
- package/src/hooks/useFetchZones.ts +23 -0
- package/src/locales/en.ts +43 -0
- package/src/locales/ru.ts +45 -0
- package/src/main.ts +12 -0
- package/src/router/index.ts +38 -0
- package/src/services/requests.ts +52 -107
- package/src/typings/banners.ts +44 -0
- package/src/typings/common.ts +1 -0
- package/src/typings/model.ts +121 -18
- package/src/typings/sfc.d.ts +12 -12
- package/src/typings/shims-tsx.d.ts +13 -13
- package/src/typings/shims-vue.d.ts +11 -10
- package/src/typings/translate.d.ts +10 -0
- package/src/typings/zones.ts +5 -0
- package/src/utils/common.ts +13 -0
- package/src/views/App.vue +22 -22
- package/src/views/Banners/BannerForm/BannerForm.helpers.ts +38 -0
- package/src/views/Banners/BannerForm/BannerForm.vue +236 -0
- package/src/views/Banners/BannerForm/index.ts +1 -0
- package/src/views/Banners/BannerList/BannerList.helpers.ts +93 -0
- package/src/views/Banners/BannerList/BannerList.vue +233 -0
- package/src/views/Banners/BannerList/hooks/index.ts +1 -0
- package/src/views/Banners/BannerList/hooks/useAdvancedSearch.ts +152 -0
- package/src/views/Banners/BannerList/index.ts +1 -0
- package/src/views/Home.vue +37 -0
- package/src/views/Zones/ZoneList/ZoneList.helpers.ts +34 -0
- package/src/views/Zones/ZoneList/ZoneList.vue +75 -0
- package/src/views/Zones/ZoneList/index.ts +1 -0
- package/dist/views/BannerAreaForm.vue.d.ts +0 -22
- package/dist/views/BannerAreaList.vue.d.ts +0 -17
- package/dist/views/BannerItemForm.vue.d.ts +0 -27
- package/dist/views/BannerItemList.vue.d.ts +0 -22
- package/src/index.ts +0 -3
- package/src/locales/en.js +0 -3
- package/src/locales/ru.js +0 -3
- package/src/views/BannerAreaForm.vue +0 -173
- package/src/views/BannerAreaList.vue +0 -176
- package/src/views/BannerItemForm.vue +0 -230
- package/src/views/BannerItemList.vue +0 -221
- package/typings/index.d.ts +0 -15
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRouter,
|
|
3
|
+
CustomRoute,
|
|
4
|
+
CustomRouteConfig,
|
|
5
|
+
} from '@tager/admin-layout';
|
|
6
|
+
|
|
7
|
+
import Home from '@/views/Home.vue';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
BANNERS_ZONE_LIST_ROUTE,
|
|
11
|
+
BANNERS_BANNER_LIST_ROUTE,
|
|
12
|
+
BANNERS_BANNER_FORM_ROUTE,
|
|
13
|
+
} from '../constants/routes';
|
|
14
|
+
|
|
15
|
+
export const HOME_ROUTE: CustomRouteConfig = {
|
|
16
|
+
path: '/',
|
|
17
|
+
component: Home,
|
|
18
|
+
name: 'Home',
|
|
19
|
+
meta: {
|
|
20
|
+
getBreadcrumbs: (route: CustomRoute) => [
|
|
21
|
+
{ url: '/', text: route.name ?? '' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const router = createRouter(
|
|
27
|
+
{
|
|
28
|
+
routes: [
|
|
29
|
+
HOME_ROUTE,
|
|
30
|
+
BANNERS_ZONE_LIST_ROUTE,
|
|
31
|
+
BANNERS_BANNER_LIST_ROUTE,
|
|
32
|
+
BANNERS_BANNER_FORM_ROUTE,
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{ useTitleSync: false }
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export default router;
|
package/src/services/requests.ts
CHANGED
|
@@ -1,107 +1,52 @@
|
|
|
1
|
-
import { request,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
): Promise<ResponseBody<
|
|
13
|
-
return request.get({ path:
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
): Promise<ResponseBody<Array<BannerItem>>> {
|
|
54
|
-
return request.get({ path: `/market-boards/${areaId}/items` });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function getBannerItemById(
|
|
58
|
-
bannerItemId: number | string
|
|
59
|
-
): Promise<ResponseBody<BannerItem>> {
|
|
60
|
-
return request.get({ path: `/market-boards/items/${bannerItemId}` });
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type BannerItemCreatePayload = {
|
|
64
|
-
title: string;
|
|
65
|
-
text: string;
|
|
66
|
-
buttonLink: Nullable<string>;
|
|
67
|
-
buttonLabel: string;
|
|
68
|
-
buttonIsNewTab: boolean;
|
|
69
|
-
image: Nullable<number>;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export function createBannerItem(
|
|
73
|
-
areaId: number | string,
|
|
74
|
-
payload: BannerItemCreatePayload
|
|
75
|
-
): Promise<ResponseBody<BannerItem>> {
|
|
76
|
-
return request.post({
|
|
77
|
-
path: `/market-boards/${areaId}/items`,
|
|
78
|
-
body: payload,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export type BannerItemUpdatePayload = BannerItemCreatePayload;
|
|
83
|
-
|
|
84
|
-
export function updateBannerItem(
|
|
85
|
-
bannerItemId: number | string,
|
|
86
|
-
payload: BannerItemUpdatePayload
|
|
87
|
-
): Promise<ResponseBody<BannerItem>> {
|
|
88
|
-
return request.put({
|
|
89
|
-
path: `/market-boards/items/${bannerItemId}`,
|
|
90
|
-
body: payload,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export function deleteBannerItem(
|
|
95
|
-
bannerItemId: number | string
|
|
96
|
-
): Promise<{ success: boolean }> {
|
|
97
|
-
return request.delete({ path: `/market-boards/items/${bannerItemId}` });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function moveBannerItem(
|
|
101
|
-
bannerItemId: number | string,
|
|
102
|
-
direction: 'up' | 'down'
|
|
103
|
-
): Promise<{ success: boolean }> {
|
|
104
|
-
return request.post({
|
|
105
|
-
path: `/market-boards/items/${bannerItemId}/${direction}`,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
1
|
+
import { request, ResponseBody } from '@tager/admin-services';
|
|
2
|
+
|
|
3
|
+
import { Zone } from '../typings/zones';
|
|
4
|
+
import { Banner, BannerPayload } from '../typings/banners';
|
|
5
|
+
|
|
6
|
+
/** Zones **/
|
|
7
|
+
|
|
8
|
+
export function getZones(params?: {
|
|
9
|
+
query?: string;
|
|
10
|
+
pageNumber?: number;
|
|
11
|
+
pageSize?: number;
|
|
12
|
+
}): Promise<ResponseBody<Zone[]>> {
|
|
13
|
+
return request.get({ path: '/admin/adv/zones', params });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Banners **/
|
|
17
|
+
|
|
18
|
+
export function getBanners(params?: {
|
|
19
|
+
query?: string;
|
|
20
|
+
pageNumber?: number;
|
|
21
|
+
pageSize?: number;
|
|
22
|
+
}): Promise<ResponseBody<Banner[]>> {
|
|
23
|
+
return request.get({ path: '/admin/adv', params });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getBanner(
|
|
27
|
+
bannerId: number | string
|
|
28
|
+
): Promise<ResponseBody<Banner>> {
|
|
29
|
+
return request.get({ path: `/admin/adv/${bannerId}` });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createBanner(
|
|
33
|
+
payload: BannerPayload
|
|
34
|
+
): Promise<ResponseBody<Banner>> {
|
|
35
|
+
return request.post({ path: '/admin/adv', body: payload });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function updateBanner(
|
|
39
|
+
bannerId: number | string,
|
|
40
|
+
payload: BannerPayload
|
|
41
|
+
): Promise<ResponseBody<Banner>> {
|
|
42
|
+
return request.put({
|
|
43
|
+
path: `/admin/adv/${bannerId}`,
|
|
44
|
+
body: payload,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function deleteBanner(
|
|
49
|
+
bannerId: number | string
|
|
50
|
+
): Promise<{ success: boolean }> {
|
|
51
|
+
return request.delete({ path: `/admin/banners/${bannerId}` });
|
|
52
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FileType, Nullable } from '@tager/admin-services';
|
|
2
|
+
import { OptionType, SingleFileInputValueType } from '@tager/admin-ui';
|
|
3
|
+
|
|
4
|
+
export enum Status {
|
|
5
|
+
Waiting = 'WAITING',
|
|
6
|
+
Archived = 'ARCHIVED',
|
|
7
|
+
Active = 'ACTIVE',
|
|
8
|
+
Disabled = 'DISABLED',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Banner {
|
|
12
|
+
id: number;
|
|
13
|
+
status: Status;
|
|
14
|
+
link: Nullable<string>;
|
|
15
|
+
image: Nullable<FileType>;
|
|
16
|
+
bannerZone: Nullable<string>;
|
|
17
|
+
openNewTab: boolean;
|
|
18
|
+
dateStart: Nullable<string>;
|
|
19
|
+
dateEnd: Nullable<string>;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
comment: Nullable<string>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface BannerFormValues {
|
|
25
|
+
link: Nullable<string>;
|
|
26
|
+
image: Nullable<SingleFileInputValueType>;
|
|
27
|
+
bannerZone: Nullable<OptionType>;
|
|
28
|
+
openNewTab: boolean;
|
|
29
|
+
dateStart: string;
|
|
30
|
+
dateEnd: string;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
comment: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface BannerPayload {
|
|
36
|
+
link: Nullable<string>;
|
|
37
|
+
image: Nullable<string>;
|
|
38
|
+
bannerZone: string;
|
|
39
|
+
openNewTab: boolean;
|
|
40
|
+
dateStart: string;
|
|
41
|
+
dateEnd: string;
|
|
42
|
+
disabled: boolean;
|
|
43
|
+
comment: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Values<T> = T[keyof T];
|
package/src/typings/model.ts
CHANGED
|
@@ -1,18 +1,121 @@
|
|
|
1
|
-
import { Nullable, FileType } from '@tager/admin-services';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { Nullable, FileType } from '@tager/admin-services';
|
|
2
|
+
import {
|
|
3
|
+
FieldConfigUnion,
|
|
4
|
+
FieldShortType,
|
|
5
|
+
IncomingValueUnion,
|
|
6
|
+
} from '@tager/admin-dynamic-field';
|
|
7
|
+
import {
|
|
8
|
+
OptionType,
|
|
9
|
+
ShortCodeItemType,
|
|
10
|
+
SingleFileInputValueType,
|
|
11
|
+
} from '@tager/admin-ui';
|
|
12
|
+
|
|
13
|
+
export interface SeoInfo {
|
|
14
|
+
readonly pageTitle: Nullable<string>;
|
|
15
|
+
readonly pageDescription: Nullable<string>;
|
|
16
|
+
readonly pageKeywords: Nullable<string>;
|
|
17
|
+
readonly openGraphTitle: Nullable<string>;
|
|
18
|
+
readonly openGraphDescription: Nullable<string>;
|
|
19
|
+
readonly openGraphImage: Nullable<FileType>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Category extends SeoInfo {
|
|
23
|
+
readonly id: number;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly isDefault: boolean;
|
|
26
|
+
readonly language: string;
|
|
27
|
+
readonly url: string;
|
|
28
|
+
readonly urlTemplate: string;
|
|
29
|
+
readonly urlAlias: string;
|
|
30
|
+
readonly postsCount: string;
|
|
31
|
+
readonly parent: Nullable<{ id: Nullable<number>; name: string }>;
|
|
32
|
+
readonly depth: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PostShort {
|
|
36
|
+
readonly id: number;
|
|
37
|
+
readonly title: string;
|
|
38
|
+
readonly url: string;
|
|
39
|
+
readonly excerpt: string;
|
|
40
|
+
readonly status: string;
|
|
41
|
+
readonly language: string;
|
|
42
|
+
readonly categories: Category[];
|
|
43
|
+
readonly datetime: string;
|
|
44
|
+
readonly image: Nullable<FileType>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface PostFull extends SeoInfo {
|
|
48
|
+
readonly id: number;
|
|
49
|
+
readonly language: string;
|
|
50
|
+
readonly title: string;
|
|
51
|
+
readonly url: string;
|
|
52
|
+
readonly urlTemplate: string;
|
|
53
|
+
readonly urlAlias: string;
|
|
54
|
+
readonly datetime: string|null;
|
|
55
|
+
readonly status: string;
|
|
56
|
+
readonly excerpt: string;
|
|
57
|
+
readonly image: Nullable<FileType>;
|
|
58
|
+
readonly imageMobile: Nullable<FileType>;
|
|
59
|
+
readonly categories: Category[];
|
|
60
|
+
readonly body: string;
|
|
61
|
+
readonly coverImage: Nullable<FileType>;
|
|
62
|
+
readonly relatedPosts: Pick<PostShort, 'id' | 'title'>[];
|
|
63
|
+
readonly tags: string[];
|
|
64
|
+
readonly additionalFields: FieldShortType<IncomingValueUnion>[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface Language {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly name: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface DefaultCategory {
|
|
73
|
+
readonly id: number;
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly language: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface FileScenarios {
|
|
79
|
+
readonly cover: Nullable<string>;
|
|
80
|
+
readonly image: Nullable<string>;
|
|
81
|
+
readonly imageMobile: Nullable<string>;
|
|
82
|
+
readonly content: Nullable<string>;
|
|
83
|
+
readonly openGraph: Nullable<string>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ModuleConfig {
|
|
87
|
+
readonly urlPostTemplate: Nullable<string>;
|
|
88
|
+
readonly urlCategoryTemplate: Nullable<string>;
|
|
89
|
+
readonly languages: Language[];
|
|
90
|
+
readonly defaultCategories: DefaultCategory[];
|
|
91
|
+
readonly fields: FieldConfigUnion[];
|
|
92
|
+
readonly shortcodes: ShortCodeItemType[];
|
|
93
|
+
readonly fileScenarios: FileScenarios;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface CategoryFormValues {
|
|
97
|
+
language: Nullable<OptionType>;
|
|
98
|
+
name: string;
|
|
99
|
+
parent: OptionType<Nullable<number>>;
|
|
100
|
+
urlAlias: string;
|
|
101
|
+
isDefault: boolean;
|
|
102
|
+
|
|
103
|
+
pageTitle: Nullable<string>;
|
|
104
|
+
pageDescription: Nullable<string>;
|
|
105
|
+
pageKeywords: Nullable<string>;
|
|
106
|
+
openGraphTitle: Nullable<string>;
|
|
107
|
+
openGraphDescription: Nullable<string>;
|
|
108
|
+
openGraphImage: Nullable<SingleFileInputValueType>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface CategoryPayload {
|
|
112
|
+
language: Nullable<string>;
|
|
113
|
+
name: string;
|
|
114
|
+
parent: Nullable<number>;
|
|
115
|
+
urlAlias: Nullable<string>;
|
|
116
|
+
isDefault: boolean;
|
|
117
|
+
|
|
118
|
+
pageTitle: Nullable<string>;
|
|
119
|
+
pageDescription: Nullable<string>;
|
|
120
|
+
openGraphImage: Nullable<string>;
|
|
121
|
+
}
|
package/src/typings/sfc.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/** Reference: https://stackoverflow.com/a/53999913 */
|
|
2
|
-
// 1. Make sure to import 'vue' before declaring augmented types
|
|
3
|
-
import Vue from 'vue';
|
|
4
|
-
|
|
5
|
-
// 2. Specify a file with the types you want to augment
|
|
6
|
-
// Vue has the constructor type in types/vue.d.ts
|
|
7
|
-
declare module 'vue/types/vue' {
|
|
8
|
-
// 3. Declare augmentation for Vue
|
|
9
|
-
interface Vue {
|
|
10
|
-
$style: { [key: string]: string };
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
/** Reference: https://stackoverflow.com/a/53999913 */
|
|
2
|
+
// 1. Make sure to import 'vue' before declaring augmented types
|
|
3
|
+
import Vue from 'vue';
|
|
4
|
+
|
|
5
|
+
// 2. Specify a file with the types you want to augment
|
|
6
|
+
// Vue has the constructor type in types/vue.d.ts
|
|
7
|
+
declare module 'vue/types/vue' {
|
|
8
|
+
// 3. Declare augmentation for Vue
|
|
9
|
+
interface Vue {
|
|
10
|
+
$style: { [key: string]: string };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Vue, { VNode } from 'vue';
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
namespace JSX {
|
|
5
|
-
// tslint:disable no-empty-interface
|
|
6
|
-
interface Element extends VNode {}
|
|
7
|
-
// tslint:disable no-empty-interface
|
|
8
|
-
interface ElementClass extends Vue {}
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
[elem: string]: any;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import Vue, { VNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace JSX {
|
|
5
|
+
// tslint:disable no-empty-interface
|
|
6
|
+
interface Element extends VNode {}
|
|
7
|
+
// tslint:disable no-empty-interface
|
|
8
|
+
interface ElementClass extends Vue {}
|
|
9
|
+
interface IntrinsicElements {
|
|
10
|
+
[elem: string]: any;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
declare module '*.vue' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
declare module '*.vue' {
|
|
2
|
+
// eslint-disable-next-line import/order
|
|
3
|
+
import Vue from 'vue';
|
|
4
|
+
export default Vue;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module '*.svg' {
|
|
8
|
+
import Vue, { VueConstructor } from 'vue';
|
|
9
|
+
const content: VueConstructor<Vue>;
|
|
10
|
+
export default content;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function generateNumberArray(length: number): Array<number> {
|
|
2
|
+
return Array.from({ length }, (_, index) => index);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function getNameWithDepth(name: string, depth: number): string {
|
|
6
|
+
return (
|
|
7
|
+
generateNumberArray(depth)
|
|
8
|
+
.map(() => '—')
|
|
9
|
+
.join(' ') +
|
|
10
|
+
' ' +
|
|
11
|
+
name
|
|
12
|
+
);
|
|
13
|
+
}
|
package/src/views/App.vue
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<page-layout :sidebar-menu-list="sidebarMenuList">
|
|
3
|
-
<router-view />
|
|
4
|
-
</page-layout>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
export default
|
|
13
|
-
name: 'App',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<page-layout :sidebar-menu-list="sidebarMenuList">
|
|
3
|
+
<router-view />
|
|
4
|
+
</page-layout>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { defineComponent, SetupContext } from '@vue/composition-api';
|
|
9
|
+
|
|
10
|
+
import { getBannersMenuItem } from '../constants/menu';
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
name: 'App',
|
|
14
|
+
setup(props, context: SetupContext) {
|
|
15
|
+
const menu = getBannersMenuItem({ t: context.root.$t });
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
sidebarMenuList: [menu],
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { OptionType } from '@tager/admin-ui';
|
|
2
|
+
import { createId, Nullable } from '@tager/admin-services';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Banner,
|
|
6
|
+
BannerFormValues,
|
|
7
|
+
BannerPayload,
|
|
8
|
+
} from '../../../typings/banners';
|
|
9
|
+
|
|
10
|
+
export function convertBannerToFormValues(
|
|
11
|
+
banner: Nullable<Banner>,
|
|
12
|
+
zonesOptionList: OptionType[]
|
|
13
|
+
): BannerFormValues {
|
|
14
|
+
const foundZone = zonesOptionList.find(
|
|
15
|
+
({ value }) => value === banner?.bannerZone
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
link: banner?.link ?? '',
|
|
20
|
+
image: banner?.image ? { id: createId(), file: banner.image } : null,
|
|
21
|
+
bannerZone: foundZone ?? null,
|
|
22
|
+
openNewTab: banner?.openNewTab ?? false,
|
|
23
|
+
dateStart: banner?.dateStart ?? '',
|
|
24
|
+
dateEnd: banner?.dateEnd ?? '',
|
|
25
|
+
disabled: banner?.disabled ?? false,
|
|
26
|
+
comment: banner?.comment ?? '',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function convertBannerFormValuesToPayload(
|
|
31
|
+
values: BannerFormValues
|
|
32
|
+
): BannerPayload {
|
|
33
|
+
return {
|
|
34
|
+
...values,
|
|
35
|
+
image: values.image?.file.id ?? null,
|
|
36
|
+
bannerZone: values.bannerZone?.value ?? '',
|
|
37
|
+
};
|
|
38
|
+
}
|