@tager/admin-blog 0.3.23 → 0.3.29
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/dist/constants/scopes.d.ts +11 -0
- package/dist/dev.d.ts +0 -2
- package/dist/hooks/index.d.ts +7 -3
- package/dist/hooks/{useBlogCategoryList.d.ts → useFetchCategories.d.ts} +2 -2
- package/dist/hooks/useFetchCategory.d.ts +8 -0
- package/dist/hooks/{useModuleConfig.d.ts → useFetchModuleConfig.d.ts} +2 -2
- package/dist/hooks/{useBlogPostList.d.ts → useFetchPosts.d.ts} +2 -2
- package/dist/hooks/useStore.d.ts +4 -0
- package/dist/hooks/useUserPermission.d.ts +3 -0
- package/dist/hooks/useUserProfile.d.ts +3 -0
- package/dist/index.esm.js +1245 -432
- package/dist/index.umd.js +1253 -438
- package/dist/locales/en.d.ts +10 -1
- package/dist/router/index.d.ts +4 -0
- package/dist/services/requests.d.ts +13 -22
- package/dist/store/index.d.ts +6 -0
- package/dist/store/user.d.ts +14 -0
- package/dist/typings/common.d.ts +1 -0
- package/dist/typings/model.d.ts +45 -1
- package/dist/utils/common.d.ts +4 -0
- package/dist/views/Categories/CategoryForm/CategoryForm.helpers.d.ts +3 -14
- package/dist/views/Categories/CategoryForm/CategoryForm.vue.d.ts +45 -22
- package/dist/views/Categories/CategoryList/CategoryList.helpers.d.ts +2 -2
- package/dist/views/Categories/CategoryList/CategoryList.vue.d.ts +6 -4
- package/dist/views/Categories/CategoryList/hooks/useAdvancedSearch.d.ts +1 -1
- package/dist/views/Posts/PostForm/PostForm.helpers.d.ts +2 -2
- package/dist/views/Posts/PostForm/PostForm.vue.d.ts +2 -0
- package/dist/views/Posts/PostList/PostList.helpers.d.ts +2 -2
- package/dist/views/Posts/PostList/PostList.vue.d.ts +8 -2
- package/dist/views/Posts/PostList/hooks/useAdvancedSearch.d.ts +1 -1
- package/package.json +9 -5
- package/src/constants/scopes.ts +11 -0
- package/src/dev.ts +11 -42
- package/src/hooks/index.ts +7 -3
- package/src/hooks/useFetchCategories.ts +25 -0
- package/src/hooks/useFetchCategory.ts +41 -0
- package/src/hooks/{useModuleConfig.ts → useFetchModuleConfig.ts} +7 -5
- package/src/hooks/useFetchPosts.ts +23 -0
- package/src/hooks/useStore.ts +8 -0
- package/src/hooks/useUserPermission.ts +16 -0
- package/src/hooks/useUserProfile.ts +13 -0
- package/src/locales/en.ts +13 -1
- package/src/locales/ru.ts +14 -2
- package/src/router/index.ts +39 -0
- package/src/services/requests.ts +30 -26
- package/src/store/index.ts +21 -0
- package/src/store/user.ts +109 -0
- package/src/typings/common.ts +1 -0
- package/src/typings/model.ts +54 -1
- package/src/utils/common.ts +23 -0
- package/src/views/App.vue +10 -2
- package/src/views/Categories/CategoryForm/CategoryForm.helpers.ts +26 -35
- package/src/views/Categories/CategoryForm/CategoryForm.vue +180 -113
- package/src/views/Categories/CategoryList/CategoryList.helpers.ts +41 -36
- package/src/views/Categories/CategoryList/CategoryList.vue +42 -25
- package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +1 -1
- package/src/views/Home.vue +1 -1
- package/src/views/Posts/PostForm/PostForm.helpers.ts +7 -6
- package/src/views/Posts/PostForm/PostForm.vue +57 -22
- package/src/views/Posts/PostList/PostList.helpers.ts +13 -15
- package/src/views/Posts/PostList/PostList.vue +96 -34
- package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +6 -5
- package/src/hooks/useBlogCategoryList.ts +0 -23
- package/src/hooks/useBlogPostList.ts +0 -23
package/dist/locales/en.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare const EN: {
|
|
|
31
31
|
actions: string;
|
|
32
32
|
updatePost: string;
|
|
33
33
|
title: string;
|
|
34
|
-
|
|
34
|
+
link: string;
|
|
35
35
|
excerpt: string;
|
|
36
36
|
body: string;
|
|
37
37
|
defaultCategory: string;
|
|
@@ -62,5 +62,14 @@ declare const EN: {
|
|
|
62
62
|
blogCategoryWasSuccessfullyUpdated: string;
|
|
63
63
|
blogCategoryCreationWasFailed: string;
|
|
64
64
|
blogCategoryUpdateWasFailed: string;
|
|
65
|
+
clone: string;
|
|
66
|
+
cloneConfirm: string;
|
|
67
|
+
cloneSuccess: string;
|
|
68
|
+
cloneFailure: string;
|
|
69
|
+
tabs: {
|
|
70
|
+
common: string;
|
|
71
|
+
seo: string;
|
|
72
|
+
};
|
|
73
|
+
parentCategory: string;
|
|
65
74
|
};
|
|
66
75
|
export default EN;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Nullable, ResponseBody } from '@tager/admin-services';
|
|
2
2
|
import { FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
|
|
3
|
-
import { Category, ModuleConfig, PostShort, PostFull } from '
|
|
3
|
+
import { Category, ModuleConfig, PostShort, PostFull, UserModel, CategoryPayload } from '@/typings/model';
|
|
4
|
+
export declare function getUserProfile(): Promise<ResponseBody<UserModel>>;
|
|
4
5
|
/** Blog Posts */
|
|
5
|
-
export declare function
|
|
6
|
+
export declare function getPosts(params?: {
|
|
6
7
|
query?: string;
|
|
7
8
|
pageNumber?: number;
|
|
8
9
|
pageSize?: number;
|
|
9
10
|
}): Promise<ResponseBody<PostShort[]>>;
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function getPostsCount(): Promise<ResponseBody<{
|
|
11
12
|
count: number;
|
|
12
13
|
}>>;
|
|
13
|
-
export declare function
|
|
14
|
+
export declare function getPost(postId: number | string): Promise<ResponseBody<PostFull>>;
|
|
15
|
+
export declare function clonePost(postId: number | string): Promise<ResponseBody<PostFull>>;
|
|
14
16
|
export interface PostCreationPayload {
|
|
15
17
|
title: string;
|
|
16
18
|
urlAlias: string;
|
|
@@ -39,29 +41,18 @@ export declare function deleteBlogPost(postId: number | string): Promise<{
|
|
|
39
41
|
success: boolean;
|
|
40
42
|
}>;
|
|
41
43
|
/** Blog Categories */
|
|
42
|
-
export declare function
|
|
44
|
+
export declare function getCategories(params?: {
|
|
43
45
|
query?: string;
|
|
44
46
|
pageNumber?: number;
|
|
45
47
|
pageSize?: number;
|
|
46
48
|
}): Promise<ResponseBody<Category[]>>;
|
|
47
|
-
export declare function
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
pageTitle: Nullable<string>;
|
|
52
|
-
language: Nullable<string>;
|
|
53
|
-
pageDescription: Nullable<string>;
|
|
54
|
-
openGraphImage: Nullable<string>;
|
|
55
|
-
}
|
|
56
|
-
export declare function createBlogCategory(payload: BlogCategoryCreationPayload): Promise<ResponseBody<Category>>;
|
|
57
|
-
export declare type BlogCategoryUpdatePayload = BlogCategoryCreationPayload & {
|
|
58
|
-
urlAlias: string;
|
|
59
|
-
};
|
|
60
|
-
export declare function updateBlogCategory(categoryId: number | string, payload: BlogCategoryUpdatePayload): Promise<ResponseBody<Category>>;
|
|
61
|
-
export declare function deleteBlogCategory(categoryId: number | string): Promise<{
|
|
49
|
+
export declare function getCategory(categoryId: number | string): Promise<ResponseBody<Category>>;
|
|
50
|
+
export declare function createCategory(payload: CategoryPayload): Promise<ResponseBody<Category>>;
|
|
51
|
+
export declare function updateCategory(categoryId: number | string, payload: CategoryPayload): Promise<ResponseBody<Category>>;
|
|
52
|
+
export declare function deleteCategory(categoryId: number | string): Promise<{
|
|
62
53
|
success: boolean;
|
|
63
54
|
}>;
|
|
64
|
-
export declare function
|
|
55
|
+
export declare function moveCategory(categoryId: number | string, direction: 'up' | 'down'): Promise<{
|
|
65
56
|
success: boolean;
|
|
66
57
|
}>;
|
|
67
|
-
export declare function
|
|
58
|
+
export declare function getModuleConfig(): Promise<ResponseBody<ModuleConfig>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Module } from 'vuex';
|
|
2
|
+
import { FetchStatus } from '@tager/admin-services';
|
|
3
|
+
import { UserModel } from '@/typings/model';
|
|
4
|
+
import { RootState } from '@/store';
|
|
5
|
+
export interface UserModuleStateModel {
|
|
6
|
+
profile: UserModel | null;
|
|
7
|
+
status: FetchStatus;
|
|
8
|
+
}
|
|
9
|
+
export declare const USER_MODULE_NAMESPACE = "user";
|
|
10
|
+
export declare const USER_ACTION_TYPES: {
|
|
11
|
+
readonly FETCH_USER_PROFILE: "fetchUserProfile";
|
|
12
|
+
};
|
|
13
|
+
declare const userModule: Module<UserModuleStateModel, RootState>;
|
|
14
|
+
export default userModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type Values<T> = T[keyof T];
|
package/dist/typings/model.d.ts
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { Nullable, FileType } from '@tager/admin-services';
|
|
2
2
|
import { FieldConfigUnion, FieldShortType, IncomingValueUnion } from '@tager/admin-dynamic-field';
|
|
3
|
-
import { ShortCodeItemType } from '@tager/admin-ui';
|
|
3
|
+
import { OptionType, ShortCodeItemType, SingleFileInputValueType } from '@tager/admin-ui';
|
|
4
|
+
import { Values } from '@/typings/common';
|
|
5
|
+
import { Scope } from '@/constants/scopes';
|
|
6
|
+
export declare type ScopeType = Values<typeof Scope>;
|
|
7
|
+
export interface RoleModel {
|
|
8
|
+
readonly id: number;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly scopes: Array<ScopeType>;
|
|
11
|
+
}
|
|
12
|
+
export interface UserModel {
|
|
13
|
+
readonly id: number;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly email: string;
|
|
16
|
+
readonly roles: Array<RoleModel>;
|
|
17
|
+
}
|
|
4
18
|
export interface SeoInfo {
|
|
5
19
|
readonly pageTitle: Nullable<string>;
|
|
6
20
|
readonly pageDescription: Nullable<string>;
|
|
21
|
+
readonly pageKeywords: Nullable<string>;
|
|
22
|
+
readonly openGraphTitle: Nullable<string>;
|
|
23
|
+
readonly openGraphDescription: Nullable<string>;
|
|
7
24
|
readonly openGraphImage: Nullable<FileType>;
|
|
8
25
|
}
|
|
9
26
|
export interface Category extends SeoInfo {
|
|
@@ -15,6 +32,11 @@ export interface Category extends SeoInfo {
|
|
|
15
32
|
readonly urlTemplate: string;
|
|
16
33
|
readonly urlAlias: string;
|
|
17
34
|
readonly postsCount: string;
|
|
35
|
+
readonly parent: Nullable<{
|
|
36
|
+
id: number;
|
|
37
|
+
name: string;
|
|
38
|
+
}>;
|
|
39
|
+
readonly depth: number;
|
|
18
40
|
}
|
|
19
41
|
export interface PostShort {
|
|
20
42
|
readonly id: number;
|
|
@@ -71,3 +93,25 @@ export interface ModuleConfig {
|
|
|
71
93
|
readonly shortcodes: ShortCodeItemType[];
|
|
72
94
|
readonly fileScenarios: FileScenarios;
|
|
73
95
|
}
|
|
96
|
+
export interface CategoryFormValues {
|
|
97
|
+
language: Nullable<OptionType>;
|
|
98
|
+
name: string;
|
|
99
|
+
parent: Nullable<OptionType<number>>;
|
|
100
|
+
urlAlias: string;
|
|
101
|
+
pageTitle: Nullable<string>;
|
|
102
|
+
pageDescription: Nullable<string>;
|
|
103
|
+
pageKeywords: Nullable<string>;
|
|
104
|
+
openGraphTitle: Nullable<string>;
|
|
105
|
+
openGraphDescription: Nullable<string>;
|
|
106
|
+
openGraphImage: Nullable<SingleFileInputValueType>;
|
|
107
|
+
}
|
|
108
|
+
export interface CategoryPayload {
|
|
109
|
+
language: Nullable<string>;
|
|
110
|
+
name: string;
|
|
111
|
+
parent: Nullable<number>;
|
|
112
|
+
urlAlias: Nullable<string>;
|
|
113
|
+
isDefault: boolean;
|
|
114
|
+
pageTitle: Nullable<string>;
|
|
115
|
+
pageDescription: Nullable<string>;
|
|
116
|
+
openGraphImage: Nullable<string>;
|
|
117
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function namespace(namespace: string, name: string): string;
|
|
2
|
+
export declare function userNamespace(name: string): string;
|
|
3
|
+
export declare function generateNumberArray(length: number): Array<number>;
|
|
4
|
+
export declare function getNameWithDepth(name: string, depth: number): string;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import { Nullable } from '@tager/admin-services';
|
|
2
|
-
import { OptionType
|
|
3
|
-
import { Category } from '
|
|
4
|
-
import { BlogCategoryCreationPayload, BlogCategoryUpdatePayload } from '../../../services/requests';
|
|
5
|
-
export declare type CategoryFormValues = {
|
|
6
|
-
name: string;
|
|
7
|
-
isDefault: boolean;
|
|
8
|
-
pageTitle: string;
|
|
9
|
-
pageDescription: string;
|
|
10
|
-
openGraphImage: Nullable<SingleFileInputValueType>;
|
|
11
|
-
urlAlias: string;
|
|
12
|
-
language: Nullable<OptionType>;
|
|
13
|
-
};
|
|
2
|
+
import { OptionType } from '@tager/admin-ui';
|
|
3
|
+
import { Category, CategoryFormValues, CategoryPayload } from '@/typings/model';
|
|
14
4
|
export declare function convertCategoryToFormValues(category: Nullable<Category>, languageOptionList: OptionType[]): CategoryFormValues;
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function convertCategoryFormValuesToUpdatePayload(values: CategoryFormValues): BlogCategoryUpdatePayload;
|
|
5
|
+
export declare function convertCategoryFormValuesToPayload(values: CategoryFormValues): CategoryPayload;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OptionType, TagerFormSubmitEvent } from '@tager/admin-ui';
|
|
1
|
+
import { OptionType, TagerFormSubmitEvent, SeoChangeEvent, TabType } from '@tager/admin-ui';
|
|
3
2
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
3
|
isCreation: import("@vue/composition-api").ComputedRef<boolean>;
|
|
5
4
|
isContentLoading: import("@vue/composition-api").ComputedRef<boolean>;
|
|
6
5
|
values: import("@vue/composition-api").Ref<{
|
|
6
|
+
language: {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
} | null;
|
|
7
11
|
name: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
parent: {
|
|
13
|
+
value: number;
|
|
14
|
+
label: string;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
} | null;
|
|
17
|
+
urlAlias: string;
|
|
18
|
+
pageTitle: import("@tager/admin-services").Nullable<string>;
|
|
19
|
+
pageDescription: import("@tager/admin-services").Nullable<string>;
|
|
20
|
+
pageKeywords: import("@tager/admin-services").Nullable<string>;
|
|
21
|
+
openGraphTitle: import("@tager/admin-services").Nullable<string>;
|
|
22
|
+
openGraphDescription: import("@tager/admin-services").Nullable<string>;
|
|
11
23
|
openGraphImage: {
|
|
12
24
|
id: string;
|
|
13
25
|
file: {
|
|
@@ -19,12 +31,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
19
31
|
};
|
|
20
32
|
caption?: string | null | undefined;
|
|
21
33
|
} | null;
|
|
22
|
-
urlAlias: string;
|
|
23
|
-
language: {
|
|
24
|
-
value: string;
|
|
25
|
-
label: string;
|
|
26
|
-
disabled?: boolean | undefined;
|
|
27
|
-
} | null;
|
|
28
34
|
}>;
|
|
29
35
|
errors: import("@vue/composition-api").Ref<{
|
|
30
36
|
[x: string]: string;
|
|
@@ -35,7 +41,12 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
35
41
|
categoryListUrl: "/blog/categories";
|
|
36
42
|
submitForm: (event: TagerFormSubmitEvent) => void;
|
|
37
43
|
isSubmitting: import("@vue/composition-api").Ref<boolean>;
|
|
38
|
-
moduleConfig: import("@vue/composition-api").Ref<Nullable<import("../../../typings/model").ModuleConfig>>;
|
|
44
|
+
moduleConfig: import("@vue/composition-api").Ref<import("@tager/admin-services").Nullable<import("../../../typings/model").ModuleConfig>>;
|
|
45
|
+
categoryOptionList: import("@vue/composition-api").ComputedRef<OptionType<number>[]>;
|
|
46
|
+
imageScenario: import("@vue/composition-api").ComputedRef<import("@tager/admin-services").Nullable<string>>;
|
|
47
|
+
handleSeoFieldGroupChange: ({ title, description, keywords, image, }: SeoChangeEvent) => void;
|
|
48
|
+
tabList: import("@vue/composition-api").ComputedRef<TabType[]>;
|
|
49
|
+
selectedTabId: import("@vue/composition-api").Ref<string>;
|
|
39
50
|
}> & {
|
|
40
51
|
[key: string]: unknown;
|
|
41
52
|
}, {}, {}, unknown, {
|
|
@@ -46,10 +57,23 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
46
57
|
isCreation: import("@vue/composition-api").ComputedRef<boolean>;
|
|
47
58
|
isContentLoading: import("@vue/composition-api").ComputedRef<boolean>;
|
|
48
59
|
values: import("@vue/composition-api").Ref<{
|
|
60
|
+
language: {
|
|
61
|
+
value: string;
|
|
62
|
+
label: string;
|
|
63
|
+
disabled?: boolean | undefined;
|
|
64
|
+
} | null;
|
|
49
65
|
name: string;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
66
|
+
parent: {
|
|
67
|
+
value: number;
|
|
68
|
+
label: string;
|
|
69
|
+
disabled?: boolean | undefined;
|
|
70
|
+
} | null;
|
|
71
|
+
urlAlias: string;
|
|
72
|
+
pageTitle: import("@tager/admin-services").Nullable<string>;
|
|
73
|
+
pageDescription: import("@tager/admin-services").Nullable<string>;
|
|
74
|
+
pageKeywords: import("@tager/admin-services").Nullable<string>;
|
|
75
|
+
openGraphTitle: import("@tager/admin-services").Nullable<string>;
|
|
76
|
+
openGraphDescription: import("@tager/admin-services").Nullable<string>;
|
|
53
77
|
openGraphImage: {
|
|
54
78
|
id: string;
|
|
55
79
|
file: {
|
|
@@ -61,12 +85,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
61
85
|
};
|
|
62
86
|
caption?: string | null | undefined;
|
|
63
87
|
} | null;
|
|
64
|
-
urlAlias: string;
|
|
65
|
-
language: {
|
|
66
|
-
value: string;
|
|
67
|
-
label: string;
|
|
68
|
-
disabled?: boolean | undefined;
|
|
69
|
-
} | null;
|
|
70
88
|
}>;
|
|
71
89
|
errors: import("@vue/composition-api").Ref<{
|
|
72
90
|
[x: string]: string;
|
|
@@ -77,7 +95,12 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
77
95
|
categoryListUrl: "/blog/categories";
|
|
78
96
|
submitForm: (event: TagerFormSubmitEvent) => void;
|
|
79
97
|
isSubmitting: import("@vue/composition-api").Ref<boolean>;
|
|
80
|
-
moduleConfig: import("@vue/composition-api").Ref<Nullable<import("../../../typings/model").ModuleConfig>>;
|
|
98
|
+
moduleConfig: import("@vue/composition-api").Ref<import("@tager/admin-services").Nullable<import("../../../typings/model").ModuleConfig>>;
|
|
99
|
+
categoryOptionList: import("@vue/composition-api").ComputedRef<OptionType<number>[]>;
|
|
100
|
+
imageScenario: import("@vue/composition-api").ComputedRef<import("@tager/admin-services").Nullable<string>>;
|
|
101
|
+
handleSeoFieldGroupChange: ({ title, description, keywords, image, }: SeoChangeEvent) => void;
|
|
102
|
+
tabList: import("@vue/composition-api").ComputedRef<TabType[]>;
|
|
103
|
+
selectedTabId: import("@vue/composition-api").Ref<string>;
|
|
81
104
|
}>, {
|
|
82
105
|
[x: string]: any;
|
|
83
106
|
}, {}, {}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TFunction } from 'i18next';
|
|
2
2
|
import { Nullable } from '@tager/admin-services';
|
|
3
3
|
import { ColumnDefinition } from '@tager/admin-ui';
|
|
4
|
-
import { Category, Language, ModuleConfig } from '
|
|
4
|
+
import { Category, Language, ModuleConfig } from '@/typings/model';
|
|
5
5
|
export declare function convertCategoryList(categoryList: Category[], languages: Language[]): Category[];
|
|
6
|
-
export declare function getCategoryTableColumnDefs(moduleConfig: Nullable<ModuleConfig>, t: TFunction): ColumnDefinition<Category>[];
|
|
6
|
+
export declare function getCategoryTableColumnDefs(moduleConfig: Nullable<ModuleConfig>, t: TFunction, canViewAdministrators: boolean): ColumnDefinition<Category>[];
|
|
7
7
|
export declare function getLinkToPostsByCategory(categoryId: number): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Category } from '
|
|
2
|
-
import { getBlogCategoryFormUrl } from '
|
|
1
|
+
import { Category } from '@/typings/model';
|
|
2
|
+
import { getBlogCategoryFormUrl } from '@/constants/paths';
|
|
3
3
|
import { getLinkToPostsByCategory } from './CategoryList.helpers';
|
|
4
4
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
5
5
|
columnDefs: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").ColumnDefinition<Category>[]>;
|
|
@@ -11,7 +11,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
11
11
|
isDeleting: (entityId: string | number) => boolean;
|
|
12
12
|
getBlogCategoryFormUrl: typeof getBlogCategoryFormUrl;
|
|
13
13
|
getLinkToPostsByCategory: typeof getLinkToPostsByCategory;
|
|
14
|
-
|
|
14
|
+
startMoveCategory: (categoryId: number, direction: 'up' | 'down') => void;
|
|
15
15
|
isCategoryMoving: import("@vue/composition-api").Ref<boolean>;
|
|
16
16
|
searchQuery: import("@vue/composition-api").Ref<string>;
|
|
17
17
|
handleChange: (event: import("@tager/admin-ui").TableChangeEvent) => void;
|
|
@@ -22,6 +22,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
22
22
|
languageOptionList: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").OptionType<string>[]>;
|
|
23
23
|
tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
|
|
24
24
|
tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
|
|
25
|
+
canViewAdministrators: import("@vue/composition-api").ComputedRef<boolean>;
|
|
25
26
|
}> & {
|
|
26
27
|
[key: string]: unknown;
|
|
27
28
|
}, {}, {}, unknown, {
|
|
@@ -38,7 +39,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
38
39
|
isDeleting: (entityId: string | number) => boolean;
|
|
39
40
|
getBlogCategoryFormUrl: typeof getBlogCategoryFormUrl;
|
|
40
41
|
getLinkToPostsByCategory: typeof getLinkToPostsByCategory;
|
|
41
|
-
|
|
42
|
+
startMoveCategory: (categoryId: number, direction: 'up' | 'down') => void;
|
|
42
43
|
isCategoryMoving: import("@vue/composition-api").Ref<boolean>;
|
|
43
44
|
searchQuery: import("@vue/composition-api").Ref<string>;
|
|
44
45
|
handleChange: (event: import("@tager/admin-ui").TableChangeEvent) => void;
|
|
@@ -49,6 +50,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
49
50
|
languageOptionList: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").OptionType<string>[]>;
|
|
50
51
|
tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
|
|
51
52
|
tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
|
|
53
|
+
canViewAdministrators: import("@vue/composition-api").ComputedRef<boolean>;
|
|
52
54
|
}>, {
|
|
53
55
|
[x: string]: any;
|
|
54
56
|
}, {}, {}, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComputedRef, Ref, SetupContext } from '@vue/composition-api';
|
|
2
2
|
import { FilterTagType, OptionType } from '@tager/admin-ui';
|
|
3
|
-
import { Language } from '
|
|
3
|
+
import { Language } from '@/typings/model';
|
|
4
4
|
interface Params {
|
|
5
5
|
context: SetupContext;
|
|
6
6
|
languageList: ComputedRef<Language[]>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Nullable } from '@tager/admin-services';
|
|
2
2
|
import { OptionType, SingleFileInputValueType } from '@tager/admin-ui';
|
|
3
3
|
import { FieldConfigUnion, FieldUnion } from '@tager/admin-dynamic-field';
|
|
4
|
-
import { Category, PostFull } from '
|
|
5
|
-
import { PostCreationPayload, PostUpdatePayload } from '
|
|
4
|
+
import { Category, PostFull } from '@/typings/model';
|
|
5
|
+
import { PostCreationPayload, PostUpdatePayload } from '@/services/requests';
|
|
6
6
|
export interface FormValues {
|
|
7
7
|
title: string;
|
|
8
8
|
excerpt: string;
|
|
@@ -4683,6 +4683,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
4683
4683
|
handleTitleChange: (value: string) => void;
|
|
4684
4684
|
handleAliasChange: () => void;
|
|
4685
4685
|
urlAliasTemplate: import("@vue/composition-api").ComputedRef<string>;
|
|
4686
|
+
handleCategoriesChange: (selectedOptions: OptionType<number>[]) => void;
|
|
4686
4687
|
}> & {
|
|
4687
4688
|
[key: string]: unknown;
|
|
4688
4689
|
}, {}, {}, unknown, {
|
|
@@ -9372,6 +9373,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
9372
9373
|
handleTitleChange: (value: string) => void;
|
|
9373
9374
|
handleAliasChange: () => void;
|
|
9374
9375
|
urlAliasTemplate: import("@vue/composition-api").ComputedRef<string>;
|
|
9376
|
+
handleCategoriesChange: (selectedOptions: OptionType<number>[]) => void;
|
|
9375
9377
|
}>, {
|
|
9376
9378
|
[x: string]: any;
|
|
9377
9379
|
}, {}, {}, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TFunction } from 'i18next';
|
|
2
2
|
import { Nullable } from '@tager/admin-services';
|
|
3
3
|
import { ColumnDefinition } from '@tager/admin-ui';
|
|
4
|
-
import { Category, ModuleConfig, Language, PostShort } from '
|
|
4
|
+
import { Category, ModuleConfig, Language, PostShort } from '@/typings/model';
|
|
5
5
|
export declare function convertPostList(postList: PostShort[], selectedCategory: Nullable<Category>, languages: Language[]): PostShort[];
|
|
6
|
-
export declare function getPostTableColumnDefs(moduleConfig: Nullable<ModuleConfig>, t: TFunction): ColumnDefinition<PostShort>[];
|
|
6
|
+
export declare function getPostTableColumnDefs(moduleConfig: Nullable<ModuleConfig>, t: TFunction, canViewAdministrators: boolean): ColumnDefinition<PostShort>[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ColumnDefinition } from '@tager/admin-ui';
|
|
2
|
-
import { Category, PostShort } from '
|
|
3
|
-
import { getBlogPostFormUrl } from '
|
|
2
|
+
import { Category, PostShort } from '@/typings/model';
|
|
3
|
+
import { getBlogPostFormUrl } from '@/constants/paths';
|
|
4
4
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
5
5
|
columnDefs: import("@vue/composition-api").ComputedRef<ColumnDefinition<PostShort>[]>;
|
|
6
6
|
rowData: import("@vue/composition-api").ComputedRef<PostShort[]>;
|
|
@@ -25,6 +25,9 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
25
25
|
toDateFilter: import("@vue/composition-api").Ref<string>;
|
|
26
26
|
tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
|
|
27
27
|
tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
|
|
28
|
+
canViewAdministrators: import("@vue/composition-api").ComputedRef<boolean>;
|
|
29
|
+
handleResourceClone: (entityId: string | number) => void;
|
|
30
|
+
isBusy: (postId: number) => boolean;
|
|
28
31
|
}> & {
|
|
29
32
|
[key: string]: unknown;
|
|
30
33
|
}, {}, {}, unknown, {
|
|
@@ -55,6 +58,9 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
55
58
|
toDateFilter: import("@vue/composition-api").Ref<string>;
|
|
56
59
|
tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
|
|
57
60
|
tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
|
|
61
|
+
canViewAdministrators: import("@vue/composition-api").ComputedRef<boolean>;
|
|
62
|
+
handleResourceClone: (entityId: string | number) => void;
|
|
63
|
+
isBusy: (postId: number) => boolean;
|
|
58
64
|
}>, {
|
|
59
65
|
[x: string]: any;
|
|
60
66
|
}, {}, {}, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComputedRef, Ref, SetupContext } from '@vue/composition-api';
|
|
2
2
|
import { FilterTagType, OptionType } from '@tager/admin-ui';
|
|
3
|
-
import { Category, Language } from '
|
|
3
|
+
import { Category, Language } from '@/typings/model';
|
|
4
4
|
interface Params {
|
|
5
5
|
context: SetupContext;
|
|
6
6
|
categoryList: ComputedRef<Category[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tager/admin-blog",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.29",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -20,16 +20,19 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"lodash.isequal": "^4.5.0",
|
|
23
|
-
"
|
|
23
|
+
"lodash.pick": "^4.4.0",
|
|
24
|
+
"path-to-regexp": "^6.1.0",
|
|
25
|
+
"vuex": "^3.6.2"
|
|
24
26
|
},
|
|
25
27
|
"devDependencies": {
|
|
26
28
|
"@rollup/plugin-commonjs": "^15.0.0",
|
|
27
29
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
28
30
|
"@tager/admin-dynamic-field": "^0.1.18",
|
|
29
31
|
"@tager/admin-layout": "^0.5.3",
|
|
30
|
-
"@tager/admin-services": "^0.2.
|
|
31
|
-
"@tager/admin-ui": "^0.8.
|
|
32
|
+
"@tager/admin-services": "^0.2.26",
|
|
33
|
+
"@tager/admin-ui": "^0.8.85",
|
|
32
34
|
"@types/lodash.isequal": "^4.5.5",
|
|
35
|
+
"@types/lodash.pick": "^4.4.6",
|
|
33
36
|
"@types/node": "12.x",
|
|
34
37
|
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
|
35
38
|
"@typescript-eslint/parser": "^2.26.0",
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
"@vue/cli-plugin-eslint": "~4.5.6",
|
|
38
41
|
"@vue/cli-plugin-router": "~4.5.6",
|
|
39
42
|
"@vue/cli-plugin-typescript": "~4.5.6",
|
|
43
|
+
"@vue/cli-plugin-vuex": "^4.5.14",
|
|
40
44
|
"@vue/cli-service": "~4.5.6",
|
|
41
45
|
"@vue/composition-api": "^1.0.0-beta.14",
|
|
42
46
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
@@ -52,7 +56,7 @@
|
|
|
52
56
|
"rollup-plugin-typescript2": "^0.27.2",
|
|
53
57
|
"rollup-plugin-vue": "^5.1.9",
|
|
54
58
|
"sass-loader": "^10.0.2",
|
|
55
|
-
"typescript": "~3.9.
|
|
59
|
+
"typescript": "~3.9.10",
|
|
56
60
|
"vue": "2.6.x",
|
|
57
61
|
"vue-router": "^3.5.1",
|
|
58
62
|
"vue-template-compiler": "^2.6.11"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const Scope = {
|
|
2
|
+
All: '*',
|
|
3
|
+
OrdersCreate: 'orders.create',
|
|
4
|
+
OrdersView: 'orders.view',
|
|
5
|
+
OrdersDelete: 'orders.delete',
|
|
6
|
+
RbacViewRoles: 'rbac.view-roles',
|
|
7
|
+
RbacEditRoles: 'rbac.edit-roles',
|
|
8
|
+
AdministratorsView: 'administrators.view',
|
|
9
|
+
AdministratorsEdit: 'administrators.edit',
|
|
10
|
+
AdministratorsDelete: 'administrators.delete',
|
|
11
|
+
} as const;
|
package/src/dev.ts
CHANGED
|
@@ -1,67 +1,36 @@
|
|
|
1
1
|
import Vue, { CreateElement } from 'vue';
|
|
2
2
|
import VueCompositionApi, { createApp } from '@vue/composition-api';
|
|
3
|
+
import Vuex from 'vuex';
|
|
3
4
|
|
|
4
5
|
import { configStore, i18n } from '@tager/admin-services';
|
|
5
6
|
import { AdminUiPlugin } from '@tager/admin-ui';
|
|
6
|
-
import {
|
|
7
|
-
AdminLayoutPlugin,
|
|
8
|
-
createRouter,
|
|
9
|
-
CustomRoute,
|
|
10
|
-
CustomRouteConfig,
|
|
11
|
-
} from '@tager/admin-layout';
|
|
7
|
+
import { AdminLayoutPlugin } from '@tager/admin-layout';
|
|
12
8
|
|
|
13
9
|
import '@tager/admin-ui/dist/admin-ui.css';
|
|
14
10
|
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import config from './config/config.json';
|
|
22
|
-
import App from './views/App.vue';
|
|
23
|
-
import Home from './views/Home.vue';
|
|
24
|
-
import EN from './locales/en';
|
|
25
|
-
import RU from './locales/ru';
|
|
11
|
+
import config from '@/config/config.json';
|
|
12
|
+
import App from '@/views/App.vue';
|
|
13
|
+
import EN from '@/locales/en';
|
|
14
|
+
import RU from '@/locales/ru';
|
|
15
|
+
import router from '@/router';
|
|
16
|
+
import store from '@/store';
|
|
26
17
|
|
|
27
18
|
configStore.setConfig(config);
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
path: '/',
|
|
31
|
-
component: Home,
|
|
32
|
-
name: 'Home',
|
|
33
|
-
meta: {
|
|
34
|
-
getBreadcrumbs: (route: CustomRoute) => [
|
|
35
|
-
{ url: '/', text: route.name ?? '' },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const router = createRouter(
|
|
41
|
-
{
|
|
42
|
-
routes: [
|
|
43
|
-
HOME_ROUTE,
|
|
44
|
-
BLOG_POST_LIST_ROUTE,
|
|
45
|
-
BLOG_POST_FORM_ROUTE,
|
|
46
|
-
BLOG_CATEGORY_LIST_ROUTE,
|
|
47
|
-
BLOG_CATEGORY_FORM_ROUTE,
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
{ useTitleSync: false }
|
|
51
|
-
);
|
|
20
|
+
Vue.use(VueCompositionApi);
|
|
52
21
|
|
|
53
22
|
i18n.addTranslations('en', 'blog', EN);
|
|
54
23
|
i18n.addTranslations('ru', 'blog', RU);
|
|
55
24
|
|
|
56
25
|
i18n.init({ debug: false }).then(() => {
|
|
57
|
-
Vue.use(VueCompositionApi);
|
|
58
|
-
|
|
59
26
|
const app = createApp({
|
|
60
27
|
router,
|
|
61
28
|
render: (h: CreateElement) => h(App),
|
|
29
|
+
store,
|
|
62
30
|
});
|
|
63
31
|
|
|
64
32
|
app.use(i18n.getPlugin());
|
|
33
|
+
app.use(Vuex);
|
|
65
34
|
app.use(AdminUiPlugin);
|
|
66
35
|
app.use(AdminLayoutPlugin);
|
|
67
36
|
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { useFetchPosts } from './useFetchPosts';
|
|
2
|
+
export { useFetchCategory } from './useFetchCategory';
|
|
3
|
+
export { useFetchCategories } from './useFetchCategories';
|
|
4
|
+
export { useFetchModuleConfig } from './useFetchModuleConfig';
|
|
5
|
+
export { useStore } from './useStore';
|
|
6
|
+
export { useUserProfile } from './useUserProfile';
|
|
7
|
+
export { useUserPermission } from './useUserPermission';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { onMounted, SetupContext } from '@vue/composition-api';
|
|
2
|
+
|
|
3
|
+
import { ResourceRef, useResource } from '@tager/admin-services';
|
|
4
|
+
|
|
5
|
+
import { Category } from '@/typings/model';
|
|
6
|
+
import { getCategories } from '@/services/requests';
|
|
7
|
+
|
|
8
|
+
export function useFetchCategories({
|
|
9
|
+
context,
|
|
10
|
+
}: {
|
|
11
|
+
context: SetupContext;
|
|
12
|
+
}): ResourceRef<Category[]> {
|
|
13
|
+
const [fetchCategories, resource] = useResource<Category[]>({
|
|
14
|
+
fetchResource: getCategories,
|
|
15
|
+
initialValue: [],
|
|
16
|
+
context,
|
|
17
|
+
resourceName: 'Blog categories',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
fetchCategories();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return resource;
|
|
25
|
+
}
|