@tager/admin-blog 0.3.41 → 0.3.42
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/index.esm.js +234 -84
- package/dist/index.umd.js +233 -83
- package/dist/locales/en.d.ts +6 -0
- package/dist/services/requests.d.ts +2 -0
- package/dist/typings/model.d.ts +2 -0
- package/dist/views/Posts/PostForm/PostForm.helpers.d.ts +2 -0
- package/dist/views/Posts/PostForm/PostForm.vue.d.ts +6 -2
- package/dist/views/Posts/PostList/PostList.vue.d.ts +8 -1
- package/package.json +3 -3
- package/src/locales/en.ts +7 -0
- package/src/locales/ru.ts +7 -0
- package/src/services/requests.ts +2 -0
- package/src/typings/model.ts +2 -0
- package/src/views/Posts/PostForm/PostForm.helpers.ts +15 -7
- package/src/views/Posts/PostForm/PostForm.vue +177 -137
- package/src/views/Posts/PostList/PostList.helpers.ts +6 -7
- package/src/views/Posts/PostList/PostList.vue +107 -74
package/dist/locales/en.d.ts
CHANGED
|
@@ -76,5 +76,11 @@ declare const EN: {
|
|
|
76
76
|
statusPublished: string;
|
|
77
77
|
statusDraft: string;
|
|
78
78
|
statusArchived: string;
|
|
79
|
+
scheduleArchive: string;
|
|
80
|
+
schedulePublish: string;
|
|
81
|
+
archiveAt: string;
|
|
82
|
+
publishAt: string;
|
|
83
|
+
archiveAtLabel: string;
|
|
84
|
+
publishAtLabel: string;
|
|
79
85
|
};
|
|
80
86
|
export default EN;
|
|
@@ -30,6 +30,8 @@ export interface PostCreationPayload {
|
|
|
30
30
|
relatedPosts: number[];
|
|
31
31
|
tags: string[];
|
|
32
32
|
additionalFields: FieldShortType<OutgoingValueUnion>[];
|
|
33
|
+
archiveAt: Nullable<string>;
|
|
34
|
+
publishAt: Nullable<string>;
|
|
33
35
|
}
|
|
34
36
|
export declare function createBlogPost(payload: PostCreationPayload): Promise<ResponseBody<PostFull>>;
|
|
35
37
|
export declare type PostUpdatePayload = PostCreationPayload & {
|
package/dist/typings/model.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export interface PostFull extends SeoInfo {
|
|
|
53
53
|
readonly relatedPosts: Pick<PostShort, 'id' | 'title'>[];
|
|
54
54
|
readonly tags: string[];
|
|
55
55
|
readonly additionalFields: FieldShortType<IncomingValueUnion>[];
|
|
56
|
+
readonly archiveAt: Nullable<string>;
|
|
57
|
+
readonly publishAt: Nullable<string>;
|
|
56
58
|
}
|
|
57
59
|
export interface Language {
|
|
58
60
|
readonly id: string;
|
|
@@ -23,6 +23,8 @@ export interface FormValues {
|
|
|
23
23
|
tags: string;
|
|
24
24
|
additionalFields: FieldUnion[];
|
|
25
25
|
status: OptionType;
|
|
26
|
+
statusDateEnabled: boolean;
|
|
27
|
+
statusDate: Nullable<string>;
|
|
26
28
|
}
|
|
27
29
|
export declare function convertPostToFormValues(post: Nullable<PostFull>, languageOptionList: OptionType[], postOptionList: OptionType<number>[], additionalFieldList: FieldConfigUnion[], statusOptions: OptionType[]): FormValues;
|
|
28
30
|
export declare function convertFormValuesToCreationPayload(values: FormValues): PostCreationPayload;
|
|
@@ -4662,6 +4662,8 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
4662
4662
|
label: string;
|
|
4663
4663
|
disabled?: boolean | undefined;
|
|
4664
4664
|
};
|
|
4665
|
+
statusDateEnabled: boolean;
|
|
4666
|
+
statusDate: Nullable<string>;
|
|
4665
4667
|
}>;
|
|
4666
4668
|
errors: import("@vue/composition-api").Ref<{
|
|
4667
4669
|
[x: string]: string;
|
|
@@ -4684,7 +4686,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
4684
4686
|
href: string;
|
|
4685
4687
|
target?: string | undefined;
|
|
4686
4688
|
}[]>;
|
|
4687
|
-
handleSeoFieldGroupChange: ({ title, description, image
|
|
4689
|
+
handleSeoFieldGroupChange: ({ title, description, image }: SeoChangeEvent) => void;
|
|
4688
4690
|
handleTitleChange: (value: string) => void;
|
|
4689
4691
|
handleAliasChange: () => void;
|
|
4690
4692
|
urlAliasTemplate: import("@vue/composition-api").ComputedRef<string>;
|
|
@@ -9358,6 +9360,8 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
9358
9360
|
label: string;
|
|
9359
9361
|
disabled?: boolean | undefined;
|
|
9360
9362
|
};
|
|
9363
|
+
statusDateEnabled: boolean;
|
|
9364
|
+
statusDate: Nullable<string>;
|
|
9361
9365
|
}>;
|
|
9362
9366
|
errors: import("@vue/composition-api").Ref<{
|
|
9363
9367
|
[x: string]: string;
|
|
@@ -9380,7 +9384,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
9380
9384
|
href: string;
|
|
9381
9385
|
target?: string | undefined;
|
|
9382
9386
|
}[]>;
|
|
9383
|
-
handleSeoFieldGroupChange: ({ title, description, image
|
|
9387
|
+
handleSeoFieldGroupChange: ({ title, description, image }: SeoChangeEvent) => void;
|
|
9384
9388
|
handleTitleChange: (value: string) => void;
|
|
9385
9389
|
handleAliasChange: () => void;
|
|
9386
9390
|
urlAliasTemplate: import("@vue/composition-api").ComputedRef<string>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ColumnDefinition, OptionType } from '@tager/admin-ui';
|
|
1
|
+
import { ColumnDefinition, OptionType, formatDateTime } from '@tager/admin-ui';
|
|
2
2
|
import { getBlogPostFormUrl } from '../../../constants/paths';
|
|
3
3
|
import { Category, PostShort } from '../../../typings/model';
|
|
4
|
+
import { getStatuses } from './PostList.helpers';
|
|
4
5
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
6
|
+
t: import("i18next").TFunction;
|
|
7
|
+
formatDateTime: typeof formatDateTime;
|
|
5
8
|
columnDefs: import("@vue/composition-api").ComputedRef<ColumnDefinition<PostShort>[]>;
|
|
6
9
|
rowData: import("@vue/composition-api").ComputedRef<PostShort[]>;
|
|
7
10
|
handleResourceDelete: (entityId: string | number) => void;
|
|
@@ -27,6 +30,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
27
30
|
statusOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
|
|
28
31
|
tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
|
|
29
32
|
tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
|
|
33
|
+
getStatuses: typeof getStatuses;
|
|
30
34
|
handleResourceClone: (entityId: string | number) => void;
|
|
31
35
|
isBusy: (postId: number) => boolean;
|
|
32
36
|
}> & {
|
|
@@ -36,6 +40,8 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
36
40
|
}> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
37
41
|
[x: string]: any;
|
|
38
42
|
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
43
|
+
t: import("i18next").TFunction;
|
|
44
|
+
formatDateTime: typeof formatDateTime;
|
|
39
45
|
columnDefs: import("@vue/composition-api").ComputedRef<ColumnDefinition<PostShort>[]>;
|
|
40
46
|
rowData: import("@vue/composition-api").ComputedRef<PostShort[]>;
|
|
41
47
|
handleResourceDelete: (entityId: string | number) => void;
|
|
@@ -61,6 +67,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
61
67
|
statusOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
|
|
62
68
|
tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
|
|
63
69
|
tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
|
|
70
|
+
getStatuses: typeof getStatuses;
|
|
64
71
|
handleResourceClone: (entityId: string | number) => void;
|
|
65
72
|
isBusy: (postId: number) => boolean;
|
|
66
73
|
}>, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tager/admin-blog",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.42",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@rollup/plugin-commonjs": "^15.0.0",
|
|
28
28
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
29
29
|
"@tager/admin-dynamic-field": "^0.1.18",
|
|
30
|
-
"@tager/admin-layout": "^0.5.
|
|
30
|
+
"@tager/admin-layout": "^0.5.4",
|
|
31
31
|
"@tager/admin-services": "^0.2.26",
|
|
32
|
-
"@tager/admin-ui": "^0.8.
|
|
32
|
+
"@tager/admin-ui": "^0.8.96",
|
|
33
33
|
"@types/lodash.isequal": "^4.5.5",
|
|
34
34
|
"@types/lodash.pick": "^4.4.6",
|
|
35
35
|
"@types/node": "12.x",
|
package/src/locales/en.ts
CHANGED
|
@@ -80,6 +80,13 @@ const EN = {
|
|
|
80
80
|
statusPublished: 'Published',
|
|
81
81
|
statusDraft: 'Draft',
|
|
82
82
|
statusArchived: 'Archived',
|
|
83
|
+
|
|
84
|
+
scheduleArchive: 'Schedule archive',
|
|
85
|
+
schedulePublish: 'Schedule publish',
|
|
86
|
+
archiveAt: 'Archive at',
|
|
87
|
+
publishAt: 'Publish at',
|
|
88
|
+
archiveAtLabel: 'Archive at',
|
|
89
|
+
publishAtLabel: 'Publish at',
|
|
83
90
|
};
|
|
84
91
|
|
|
85
92
|
export default EN;
|
package/src/locales/ru.ts
CHANGED
|
@@ -82,6 +82,13 @@ const RU: typeof EN = {
|
|
|
82
82
|
statusPublished: 'Опубликован',
|
|
83
83
|
statusDraft: 'Черновик',
|
|
84
84
|
statusArchived: 'В архиве',
|
|
85
|
+
|
|
86
|
+
scheduleArchive: 'Запланировать перенос в архив',
|
|
87
|
+
schedulePublish: 'Запланировать публикацию',
|
|
88
|
+
archiveAt: 'Перенести в архив в',
|
|
89
|
+
publishAt: 'Опубликовать в',
|
|
90
|
+
archiveAtLabel: 'Перенос в архив',
|
|
91
|
+
publishAtLabel: 'Публикация',
|
|
85
92
|
};
|
|
86
93
|
|
|
87
94
|
export default RU;
|
package/src/services/requests.ts
CHANGED
package/src/typings/model.ts
CHANGED
|
@@ -62,6 +62,8 @@ export interface PostFull extends SeoInfo {
|
|
|
62
62
|
readonly relatedPosts: Pick<PostShort, 'id' | 'title'>[];
|
|
63
63
|
readonly tags: string[];
|
|
64
64
|
readonly additionalFields: FieldShortType<IncomingValueUnion>[];
|
|
65
|
+
readonly archiveAt: Nullable<string>;
|
|
66
|
+
readonly publishAt: Nullable<string>;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
export interface Language {
|
|
@@ -5,12 +5,12 @@ import { OptionType, SingleFileInputValueType } from '@tager/admin-ui';
|
|
|
5
5
|
import {
|
|
6
6
|
FieldConfigUnion,
|
|
7
7
|
FieldUnion,
|
|
8
|
-
universalFieldUtils
|
|
8
|
+
universalFieldUtils
|
|
9
9
|
} from '@tager/admin-dynamic-field';
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
PostCreationPayload,
|
|
13
|
-
PostUpdatePayload
|
|
13
|
+
PostUpdatePayload
|
|
14
14
|
} from '../../../services/requests';
|
|
15
15
|
import { getNameWithDepth } from '../../../utils/common';
|
|
16
16
|
import { Category, PostFull } from '../../../typings/model';
|
|
@@ -18,7 +18,7 @@ import { Category, PostFull } from '../../../typings/model';
|
|
|
18
18
|
export const getStatusOptions = (t: TFunction): OptionType[] => [
|
|
19
19
|
{ label: t('blog:statusPublished'), value: 'PUBLISHED' },
|
|
20
20
|
{ label: t('blog:statusDraft'), value: 'DRAFT' },
|
|
21
|
-
{ label: t('blog:statusArchived'), value: 'ARCHIVED' }
|
|
21
|
+
{ label: t('blog:statusArchived'), value: 'ARCHIVED' }
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
export interface FormValues {
|
|
@@ -39,6 +39,8 @@ export interface FormValues {
|
|
|
39
39
|
tags: string;
|
|
40
40
|
additionalFields: FieldUnion[];
|
|
41
41
|
status: OptionType;
|
|
42
|
+
statusDateEnabled: boolean;
|
|
43
|
+
statusDate: Nullable<string>;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export function convertPostToFormValues(
|
|
@@ -69,6 +71,8 @@ export function convertPostToFormValues(
|
|
|
69
71
|
universalFieldUtils.createFormField(fieldConfig, null)
|
|
70
72
|
),
|
|
71
73
|
status: statusOptions[0],
|
|
74
|
+
statusDateEnabled: false,
|
|
75
|
+
statusDate: null
|
|
72
76
|
};
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -104,7 +108,7 @@ export function convertPostToFormValues(
|
|
|
104
108
|
urlAlias: post.urlAlias,
|
|
105
109
|
categories: post.categories.map((category) => ({
|
|
106
110
|
value: category.id,
|
|
107
|
-
label: category.name
|
|
111
|
+
label: category.name
|
|
108
112
|
})),
|
|
109
113
|
language: currentLangOption ?? null,
|
|
110
114
|
relatedPosts: selectedPostOptionList,
|
|
@@ -119,6 +123,8 @@ export function convertPostToFormValues(
|
|
|
119
123
|
);
|
|
120
124
|
}),
|
|
121
125
|
status: foundStatus,
|
|
126
|
+
statusDateEnabled: post.status === 'PUBLISHED' ? !!post.archiveAt : (post.status === 'DRAFT' ? !!post.publishAt : false),
|
|
127
|
+
statusDate: post.status === 'PUBLISHED' && post.archiveAt ? post.archiveAt.substr(0, 10) : (post.status === 'DRAFT' && post.publishAt ? post.publishAt.substr(0, 10) : null)
|
|
122
128
|
};
|
|
123
129
|
}
|
|
124
130
|
|
|
@@ -145,9 +151,11 @@ export function convertFormValuesToCreationPayload(
|
|
|
145
151
|
tags: values.tags.split(',').filter((tag) => tag.trim().length > 0),
|
|
146
152
|
additionalFields: values.additionalFields.map((field) => ({
|
|
147
153
|
name: field.config.name,
|
|
148
|
-
value: universalFieldUtils.getOutgoingValue(field)
|
|
154
|
+
value: universalFieldUtils.getOutgoingValue(field)
|
|
149
155
|
})),
|
|
150
156
|
status: values.status.value,
|
|
157
|
+
archiveAt: values.status.value === 'PUBLISHED' && values.statusDateEnabled && values.statusDate ? values.statusDate : null,
|
|
158
|
+
publishAt: values.status.value === 'DRAFT' && values.statusDateEnabled && values.statusDate ? values.statusDate : null
|
|
151
159
|
};
|
|
152
160
|
}
|
|
153
161
|
|
|
@@ -156,7 +164,7 @@ export function convertFormValuesToUpdatePayload(
|
|
|
156
164
|
): PostUpdatePayload {
|
|
157
165
|
return {
|
|
158
166
|
...convertFormValuesToCreationPayload(values),
|
|
159
|
-
urlAlias: values.urlAlias
|
|
167
|
+
urlAlias: values.urlAlias
|
|
160
168
|
};
|
|
161
169
|
}
|
|
162
170
|
|
|
@@ -168,6 +176,6 @@ export function convertCategoryListToOptions(
|
|
|
168
176
|
.filter(({ language }) => (languageId ? language === languageId : true))
|
|
169
177
|
.map(({ id, name, depth }) => ({
|
|
170
178
|
value: id,
|
|
171
|
-
label: getNameWithDepth(name, depth)
|
|
179
|
+
label: getNameWithDepth(name, depth)
|
|
172
180
|
}));
|
|
173
181
|
}
|