@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
package/package.json
CHANGED
|
@@ -1,67 +1,76 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tager/admin-banners",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"main": "dist/index.umd.js",
|
|
6
|
-
"module": "dist/index.esm.js",
|
|
7
|
-
"types": "dist/
|
|
8
|
-
"files": [
|
|
9
|
-
"dist",
|
|
10
|
-
"typings",
|
|
11
|
-
"src"
|
|
12
|
-
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"start": "vue-cli-service serve",
|
|
15
|
-
"lint": "vue-cli-service lint",
|
|
16
|
-
"build": "rollup --config",
|
|
17
|
-
"prepare": "yarn build",
|
|
18
|
-
"tager:update": "
|
|
19
|
-
"yalc:clean": "yalc remove --all"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@tager/admin-
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@vue/
|
|
39
|
-
"@vue/
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"eslint-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"vue": "2.
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"vue": "
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@tager/admin-banners",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "dist/index.umd.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/main.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"typings",
|
|
11
|
+
"src"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "vue-cli-service serve",
|
|
15
|
+
"lint": "vue-cli-service lint",
|
|
16
|
+
"build": "rollup --config",
|
|
17
|
+
"prepare": "yarn build",
|
|
18
|
+
"tager:update": "node scripts/tager-update.js",
|
|
19
|
+
"yalc:clean": "yalc remove --all"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"lodash.isequal": "^4.5.0",
|
|
23
|
+
"lodash.pick": "^4.4.0",
|
|
24
|
+
"path-to-regexp": "^6.1.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@rollup/plugin-commonjs": "^15.0.0",
|
|
28
|
+
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
29
|
+
"@tager/admin-dynamic-field": "^0.1.18",
|
|
30
|
+
"@tager/admin-layout": "^0.5.3",
|
|
31
|
+
"@tager/admin-services": "^0.2.26",
|
|
32
|
+
"@tager/admin-ui": "^0.8.85",
|
|
33
|
+
"@types/lodash.isequal": "^4.5.5",
|
|
34
|
+
"@types/lodash.pick": "^4.4.6",
|
|
35
|
+
"@types/node": "12.x",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
|
37
|
+
"@typescript-eslint/parser": "^2.26.0",
|
|
38
|
+
"@vue/cli-plugin-babel": "~4.5.6",
|
|
39
|
+
"@vue/cli-plugin-eslint": "~4.5.6",
|
|
40
|
+
"@vue/cli-plugin-router": "~4.5.6",
|
|
41
|
+
"@vue/cli-plugin-typescript": "~4.5.6",
|
|
42
|
+
"@vue/cli-service": "~4.5.6",
|
|
43
|
+
"@vue/composition-api": "^1.0.0-beta.14",
|
|
44
|
+
"@vue/eslint-config-prettier": "^6.0.0",
|
|
45
|
+
"@vue/eslint-config-typescript": "^5.1.0",
|
|
46
|
+
"babel-eslint": "^10.1.0",
|
|
47
|
+
"core-js": "^3.6.5",
|
|
48
|
+
"eslint": "^6.7.2",
|
|
49
|
+
"eslint-plugin-import": "^2.22.0",
|
|
50
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
51
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
52
|
+
"prettier": "^2.1.2",
|
|
53
|
+
"rollup": "^2.27.1",
|
|
54
|
+
"rollup-plugin-typescript2": "^0.27.2",
|
|
55
|
+
"rollup-plugin-vue": "^5.1.9",
|
|
56
|
+
"sass-loader": "^10.0.2",
|
|
57
|
+
"typescript": "~3.9.10",
|
|
58
|
+
"vue": "2.6.x",
|
|
59
|
+
"vue-router": "^3.5.1",
|
|
60
|
+
"vue-template-compiler": "^2.6.11"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@tager/admin-dynamic-field": ">=0.1.3",
|
|
64
|
+
"@tager/admin-layout": ">=0.4.2",
|
|
65
|
+
"@tager/admin-services": ">=0.2.12",
|
|
66
|
+
"@tager/admin-ui": ">=0.7.5",
|
|
67
|
+
"@vue/composition-api": ">=1.0.0-beta.14",
|
|
68
|
+
"vue": "2.6.x"
|
|
69
|
+
},
|
|
70
|
+
"resolutions": {
|
|
71
|
+
"prettier": "2.x"
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public"
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/config/config.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"APP_NAME": "OZiTAG_ADMIN_BLOG",
|
|
3
|
-
"TITLE_TEMPLATE": "OZiTAG Admin - Blog",
|
|
4
|
-
"LANGUAGE": "
|
|
5
|
-
"BRAND": {
|
|
6
|
-
"small": {
|
|
7
|
-
"logo": "logo-small.svg"
|
|
8
|
-
},
|
|
9
|
-
"large": {
|
|
10
|
-
"logo": "logo.svg",
|
|
11
|
-
"label": "OZiTAG",
|
|
12
|
-
"label-color": "#DD6900"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"SPLASH_SCREEN": {
|
|
16
|
-
"enabled": false,
|
|
17
|
-
"logo": "logo-white.svg",
|
|
18
|
-
"background": "#1e1e1e"
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"APP_NAME": "OZiTAG_ADMIN_BLOG",
|
|
3
|
+
"TITLE_TEMPLATE": "OZiTAG Admin - Blog",
|
|
4
|
+
"LANGUAGE": "RU",
|
|
5
|
+
"BRAND": {
|
|
6
|
+
"small": {
|
|
7
|
+
"logo": "logo-small.svg"
|
|
8
|
+
},
|
|
9
|
+
"large": {
|
|
10
|
+
"logo": "logo.svg",
|
|
11
|
+
"label": "OZiTAG",
|
|
12
|
+
"label-color": "#DD6900"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"SPLASH_SCREEN": {
|
|
16
|
+
"enabled": false,
|
|
17
|
+
"logo": "logo-white.svg",
|
|
18
|
+
"background": "#1e1e1e"
|
|
19
|
+
}
|
|
20
20
|
}
|
package/src/constants/menu.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import { MenuItemType } from '@tager/admin-layout';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
import { MenuItemType } from '@tager/admin-layout';
|
|
2
|
+
import { TranslateFunction } from '@tager/admin-services';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
getBannersZoneListUrl,
|
|
6
|
+
getBannersBannerListUrl,
|
|
7
|
+
getBannersBannerFormUrl,
|
|
8
|
+
} from './paths';
|
|
9
|
+
|
|
10
|
+
export function getBannersMenuItem(params: {
|
|
11
|
+
t: TranslateFunction;
|
|
12
|
+
}): MenuItemType {
|
|
13
|
+
return {
|
|
14
|
+
id: 'banners',
|
|
15
|
+
text: params.t('banners:banners'),
|
|
16
|
+
icon: 'viewList',
|
|
17
|
+
children: [
|
|
18
|
+
{ text: params.t('banners:zones'), url: getBannersZoneListUrl() },
|
|
19
|
+
{ text: params.t('banners:banners'), url: getBannersBannerListUrl() },
|
|
20
|
+
{
|
|
21
|
+
text: params.t('banners:createBanner'),
|
|
22
|
+
url: getBannersBannerFormUrl({ bannerId: 'create' }),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
package/src/constants/paths.ts
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
import { compile } from 'path-to-regexp';
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getBannerItemListUrl(params: { areaAlias: string }): string {
|
|
23
|
-
return compile(BANNER_ROUTE_PATHS.ITEM_LIST)({
|
|
24
|
-
areaAlias: params.areaAlias,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getBannerItemFormUrl(params: {
|
|
29
|
-
areaAlias: string;
|
|
30
|
-
itemId: string | number;
|
|
31
|
-
}): string {
|
|
32
|
-
return compile(BANNER_ROUTE_PATHS.ITEM_FORM)({
|
|
33
|
-
areaAlias: params.areaAlias,
|
|
34
|
-
itemId: params.itemId,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
1
|
+
import { compile } from 'path-to-regexp';
|
|
2
|
+
|
|
3
|
+
export const BANNERS_ROUTE_PATHS = {
|
|
4
|
+
ZONE_LIST: '/banners/zones',
|
|
5
|
+
BANNER_LIST: '/banners',
|
|
6
|
+
BANNER_FORM: '/banners/:bannerId',
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export function getBannersZoneListUrl() {
|
|
10
|
+
return BANNERS_ROUTE_PATHS.ZONE_LIST;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getBannersBannerListUrl() {
|
|
14
|
+
return BANNERS_ROUTE_PATHS.BANNER_LIST;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getBannersBannerFormUrl(params: { bannerId: number | string }) {
|
|
18
|
+
return compile(BANNERS_ROUTE_PATHS.BANNER_FORM)(params);
|
|
19
|
+
}
|
package/src/constants/routes.ts
CHANGED
|
@@ -1,66 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
getBreadcrumbs: (route) => [
|
|
46
|
-
HOME_BREADCRUMB,
|
|
47
|
-
{ path: route.path, label: route.name },
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const BANNER_ITEM_FORM_ROUTE: CustomRouteConfig = {
|
|
53
|
-
path: BANNER_ROUTE_PATHS.ITEM_FORM,
|
|
54
|
-
component: BannerItemForm,
|
|
55
|
-
name: 'Banner Item Form',
|
|
56
|
-
meta: {
|
|
57
|
-
getBreadcrumbs: (route) => [
|
|
58
|
-
HOME_BREADCRUMB,
|
|
59
|
-
{
|
|
60
|
-
path: getBannerItemListUrl({ areaAlias: route.params.areaAlias }),
|
|
61
|
-
label: BANNER_ITEM_LIST_ROUTE.name,
|
|
62
|
-
},
|
|
63
|
-
{ path: route.path, label: route.name },
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
};
|
|
1
|
+
import { CustomRouteConfig } from '@tager/admin-layout';
|
|
2
|
+
|
|
3
|
+
import ZoneList from '../views/Zones/ZoneList';
|
|
4
|
+
import BannerList from '../views/Banners/BannerList';
|
|
5
|
+
import BannerForm from '../views/Banners/BannerForm';
|
|
6
|
+
|
|
7
|
+
import { BANNERS_ROUTE_PATHS } from './paths';
|
|
8
|
+
|
|
9
|
+
export const BANNERS_ZONE_LIST_ROUTE: CustomRouteConfig = {
|
|
10
|
+
path: BANNERS_ROUTE_PATHS.ZONE_LIST,
|
|
11
|
+
component: ZoneList,
|
|
12
|
+
name: 'Zones',
|
|
13
|
+
meta: {
|
|
14
|
+
getBreadcrumbs: (route, t) => [
|
|
15
|
+
{ url: '/', text: t('banners:home') },
|
|
16
|
+
{ url: BANNERS_ROUTE_PATHS.ZONE_LIST, text: t('banners:zones') },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const BANNERS_BANNER_LIST_ROUTE: CustomRouteConfig = {
|
|
22
|
+
path: BANNERS_ROUTE_PATHS.BANNER_LIST,
|
|
23
|
+
component: BannerList,
|
|
24
|
+
name: 'Banners',
|
|
25
|
+
meta: {
|
|
26
|
+
getBreadcrumbs: (route, t) => [
|
|
27
|
+
{ url: '/', text: t('banners:home') },
|
|
28
|
+
{ url: BANNERS_ROUTE_PATHS.BANNER_LIST, text: t('banners:banners') },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const BANNERS_BANNER_FORM_ROUTE: CustomRouteConfig = {
|
|
34
|
+
path: BANNERS_ROUTE_PATHS.BANNER_FORM,
|
|
35
|
+
component: BannerForm,
|
|
36
|
+
name: 'Banner Form',
|
|
37
|
+
meta: {
|
|
38
|
+
getBreadcrumbs: (route, t) => [
|
|
39
|
+
{ url: '/', text: t('banners:home') },
|
|
40
|
+
{ url: BANNERS_ROUTE_PATHS.BANNER_LIST, text: t('banners:banners') },
|
|
41
|
+
{ url: route.path, text: t('banners:bannerForm') },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
};
|
package/src/dev.ts
CHANGED
|
@@ -1,46 +1,34 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
1
|
+
import Vue, { CreateElement } from 'vue';
|
|
2
|
+
import VueCompositionApi, { createApp } from '@vue/composition-api';
|
|
3
|
+
|
|
2
4
|
import { configStore, i18n } from '@tager/admin-services';
|
|
3
5
|
import { AdminUiPlugin } from '@tager/admin-ui';
|
|
4
|
-
import {
|
|
5
|
-
AdminLayoutPlugin,
|
|
6
|
-
createRouter,
|
|
7
|
-
CustomRoute,
|
|
8
|
-
CustomRouteConfig,
|
|
9
|
-
} from '@tager/admin-layout';
|
|
6
|
+
import { AdminLayoutPlugin } from '@tager/admin-layout';
|
|
10
7
|
|
|
11
8
|
import '@tager/admin-ui/dist/admin-ui.css';
|
|
12
9
|
|
|
13
|
-
import
|
|
14
|
-
BANNER_AREA_FORM_ROUTE,
|
|
15
|
-
BANNER_AREA_LIST_ROUTE,
|
|
16
|
-
BANNER_ITEM_FORM_ROUTE,
|
|
17
|
-
BANNER_ITEM_LIST_ROUTE,
|
|
18
|
-
} from './constants/routes';
|
|
10
|
+
import router from './router';
|
|
19
11
|
import config from './config/config.json';
|
|
20
12
|
import App from './views/App.vue';
|
|
13
|
+
import EN from './locales/en';
|
|
14
|
+
import RU from './locales/ru';
|
|
21
15
|
|
|
22
16
|
configStore.setConfig(config);
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
BANNER_AREA_FORM_ROUTE,
|
|
32
|
-
BANNER_ITEM_LIST_ROUTE,
|
|
33
|
-
BANNER_ITEM_FORM_ROUTE,
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
{ useTitleSync: false }
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
i18n.init().then(() => {
|
|
40
|
-
Vue.use(i18n.getPlugin());
|
|
41
|
-
|
|
42
|
-
new Vue({
|
|
18
|
+
i18n.addTranslations('en', 'banners', EN);
|
|
19
|
+
i18n.addTranslations('ru', 'banners', RU);
|
|
20
|
+
|
|
21
|
+
i18n.init({ debug: false }).then(() => {
|
|
22
|
+
Vue.use(VueCompositionApi);
|
|
23
|
+
|
|
24
|
+
const app = createApp({
|
|
43
25
|
router,
|
|
44
|
-
render: (h) => h(App),
|
|
45
|
-
})
|
|
26
|
+
render: (h: CreateElement) => h(App),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
app.use(i18n.getPlugin());
|
|
30
|
+
app.use(AdminUiPlugin);
|
|
31
|
+
app.use(AdminLayoutPlugin);
|
|
32
|
+
|
|
33
|
+
app.mount('#app');
|
|
46
34
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { onMounted, Ref, SetupContext, watch } from '@vue/composition-api';
|
|
2
|
+
|
|
3
|
+
import { Nullable, ResourceRef, useResource } from '@tager/admin-services';
|
|
4
|
+
|
|
5
|
+
import { getBanner } from '../services/requests';
|
|
6
|
+
import { Banner } from '../typings/banners';
|
|
7
|
+
|
|
8
|
+
export function useFetchBanner({
|
|
9
|
+
context,
|
|
10
|
+
bannerId,
|
|
11
|
+
isCreation,
|
|
12
|
+
}: {
|
|
13
|
+
context: SetupContext;
|
|
14
|
+
bannerId: Ref<string>;
|
|
15
|
+
isCreation: Ref<boolean>;
|
|
16
|
+
}): ResourceRef<Nullable<Banner>> {
|
|
17
|
+
const [fetchBanner, resource] = useResource<Nullable<Banner>>({
|
|
18
|
+
fetchResource: () => getBanner(bannerId.value),
|
|
19
|
+
initialValue: null,
|
|
20
|
+
context,
|
|
21
|
+
resourceName: 'Banner',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
if (isCreation.value) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fetchBanner();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
watch(bannerId, () => {
|
|
33
|
+
if (isCreation.value) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fetchBanner();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return resource;
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { onMounted, SetupContext } from '@vue/composition-api';
|
|
2
|
+
|
|
3
|
+
import { ResourceRef, useResource } from '@tager/admin-services';
|
|
4
|
+
|
|
5
|
+
import { getBanners } from '../services/requests';
|
|
6
|
+
import { Banner } from '../typings/banners';
|
|
7
|
+
|
|
8
|
+
export function useFetchBanners(params: {
|
|
9
|
+
context: SetupContext;
|
|
10
|
+
}): ResourceRef<Banner[]> {
|
|
11
|
+
const [fetchBanners, resource] = useResource<Banner[]>({
|
|
12
|
+
fetchResource: getBanners,
|
|
13
|
+
initialValue: [],
|
|
14
|
+
context: params.context,
|
|
15
|
+
resourceName: 'Banners',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
fetchBanners();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return resource;
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { onMounted, SetupContext } from '@vue/composition-api';
|
|
2
|
+
|
|
3
|
+
import { ResourceRef, useResource } from '@tager/admin-services';
|
|
4
|
+
|
|
5
|
+
import { getZones } from '../services/requests';
|
|
6
|
+
import { Zone } from '../typings/zones';
|
|
7
|
+
|
|
8
|
+
export function useFetchZones(params: {
|
|
9
|
+
context: SetupContext;
|
|
10
|
+
}): ResourceRef<Zone[]> {
|
|
11
|
+
const [fetchZones, resource] = useResource<Zone[]>({
|
|
12
|
+
fetchResource: getZones,
|
|
13
|
+
initialValue: [],
|
|
14
|
+
context: params.context,
|
|
15
|
+
resourceName: 'Banner zones',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
fetchZones();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return resource;
|
|
23
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const EN = {
|
|
2
|
+
home: 'Home',
|
|
3
|
+
zone: 'Banner zone',
|
|
4
|
+
zones: 'Banner zones',
|
|
5
|
+
banners: 'Banners',
|
|
6
|
+
bannerForm: 'Banner Form',
|
|
7
|
+
createBanner: 'Create Banner',
|
|
8
|
+
updateBanner: 'Update Banner',
|
|
9
|
+
link: 'Link',
|
|
10
|
+
image: 'Image',
|
|
11
|
+
openNewTab: 'Open new tab',
|
|
12
|
+
period: 'Period',
|
|
13
|
+
from: 'From',
|
|
14
|
+
to: 'To',
|
|
15
|
+
disabled: 'Disabled',
|
|
16
|
+
comment: 'Comment',
|
|
17
|
+
status: 'Status',
|
|
18
|
+
bannerZoneIsDeleted: 'Banner zone is deleted',
|
|
19
|
+
newTab: 'New Tab',
|
|
20
|
+
yes: 'Yes',
|
|
21
|
+
no: 'No',
|
|
22
|
+
edit: 'Edit',
|
|
23
|
+
remove: 'Remove',
|
|
24
|
+
actions: 'actions',
|
|
25
|
+
date: 'Date',
|
|
26
|
+
|
|
27
|
+
success: 'Success',
|
|
28
|
+
error: 'Error',
|
|
29
|
+
|
|
30
|
+
statuses: {
|
|
31
|
+
waiting: 'Waiting',
|
|
32
|
+
archived: 'Archived',
|
|
33
|
+
active: 'Active',
|
|
34
|
+
disabled: 'Disabled',
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
bannerWasSuccessfullyCreated: 'Banner was successfully created',
|
|
38
|
+
bannerWasSuccessfullyUpdated: 'Banner was successfully updated',
|
|
39
|
+
bannerCreationWasFailed: 'Banner creation was failed',
|
|
40
|
+
bannerUpdateWasFailed: 'Banner update was failed',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default EN;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import EN from './en';
|
|
2
|
+
|
|
3
|
+
const RU: typeof EN = {
|
|
4
|
+
home: 'Главная',
|
|
5
|
+
zone: 'Баннерная зона',
|
|
6
|
+
zones: 'Баннерные зоны',
|
|
7
|
+
banners: 'Баннеры',
|
|
8
|
+
bannerForm: 'Форма баннера',
|
|
9
|
+
createBanner: 'Добавить баннер',
|
|
10
|
+
updateBanner: 'Редактировать баннер',
|
|
11
|
+
link: 'Ссылка',
|
|
12
|
+
image: 'Картинка',
|
|
13
|
+
openNewTab: 'Открывать в новой вкладке',
|
|
14
|
+
period: 'Срок действия',
|
|
15
|
+
from: 'От',
|
|
16
|
+
to: 'До',
|
|
17
|
+
disabled: 'Выключен',
|
|
18
|
+
comment: 'Комментарий',
|
|
19
|
+
status: 'Статус',
|
|
20
|
+
bannerZoneIsDeleted: 'Баннерная зона удалена',
|
|
21
|
+
newTab: 'Новая вкладка',
|
|
22
|
+
yes: 'Да',
|
|
23
|
+
no: 'Нет',
|
|
24
|
+
edit: 'Редактировать',
|
|
25
|
+
remove: 'Удалить',
|
|
26
|
+
actions: 'Действия',
|
|
27
|
+
date: 'Дата',
|
|
28
|
+
|
|
29
|
+
success: 'Успех',
|
|
30
|
+
error: 'Ошибка',
|
|
31
|
+
|
|
32
|
+
statuses: {
|
|
33
|
+
waiting: 'В ожидании',
|
|
34
|
+
archived: 'Архивный',
|
|
35
|
+
active: 'Активный',
|
|
36
|
+
disabled: 'Отключен',
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
bannerWasSuccessfullyCreated: 'Баннер успешно создан',
|
|
40
|
+
bannerWasSuccessfullyUpdated: 'Баннер успешно обновлен',
|
|
41
|
+
bannerCreationWasFailed: 'Не удалось создать баннер',
|
|
42
|
+
bannerUpdateWasFailed: 'Не удалось обновить баннер',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default RU;
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { i18n } from '@tager/admin-services';
|
|
2
|
+
|
|
3
|
+
import EN from './locales/en';
|
|
4
|
+
import RU from './locales/ru';
|
|
5
|
+
|
|
6
|
+
i18n.addTranslations('en', 'blog', EN);
|
|
7
|
+
i18n.addTranslations('ru', 'blog', RU);
|
|
8
|
+
|
|
9
|
+
export * from './constants/routes';
|
|
10
|
+
export * from './constants/menu';
|
|
11
|
+
export * from './constants/paths';
|
|
12
|
+
export * from './services/requests';
|