@tager/admin-blog 0.3.28 → 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/menu.d.ts +5 -0
- package/dist/constants/paths.d.ts +14 -0
- package/dist/constants/routes.d.ts +5 -0
- package/dist/constants/scopes.d.ts +11 -0
- package/dist/dev.d.ts +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useFetchCategories.d.ts +6 -0
- package/dist/hooks/useFetchCategory.d.ts +8 -0
- package/dist/hooks/useFetchModuleConfig.d.ts +6 -0
- package/dist/hooks/useFetchPosts.d.ts +6 -0
- 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 +73 -76
- package/dist/index.umd.js +73 -76
- package/dist/locales/en.d.ts +75 -0
- package/dist/locales/ru.d.ts +3 -0
- package/dist/main.d.ts +4 -0
- package/dist/router/index.d.ts +4 -0
- package/dist/services/requests.d.ts +58 -0
- 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 +117 -0
- package/dist/utils/common.d.ts +4 -0
- package/dist/views/Categories/CategoryForm/CategoryForm.helpers.d.ts +5 -0
- package/dist/views/Categories/CategoryForm/CategoryForm.vue.d.ts +109 -0
- package/dist/views/Categories/CategoryForm/index.d.ts +1 -0
- package/dist/views/Categories/CategoryList/CategoryList.helpers.d.ts +7 -0
- package/dist/views/Categories/CategoryList/CategoryList.vue.d.ts +59 -0
- package/dist/views/Categories/CategoryList/hooks/index.d.ts +1 -0
- package/dist/views/Categories/CategoryList/hooks/useAdvancedSearch.d.ts +16 -0
- package/dist/views/Categories/CategoryList/index.d.ts +1 -0
- package/dist/views/Posts/PostForm/PostForm.helpers.d.ts +27 -0
- package/dist/views/Posts/PostForm/PostForm.vue.d.ts +9382 -0
- package/dist/views/Posts/PostForm/components/TabList/TabList.types.d.ts +5 -0
- package/dist/views/Posts/PostForm/components/TabList/index.d.ts +2 -0
- package/dist/views/Posts/PostForm/index.d.ts +1 -0
- package/dist/views/Posts/PostList/PostList.helpers.d.ts +6 -0
- package/dist/views/Posts/PostList/PostList.vue.d.ts +69 -0
- package/dist/views/Posts/PostList/hooks/index.d.ts +1 -0
- package/dist/views/Posts/PostList/hooks/useAdvancedSearch.d.ts +22 -0
- package/dist/views/Posts/PostList/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -2783,10 +2783,7 @@
|
|
|
2783
2783
|
.map((post) => {
|
|
2784
2784
|
if (languages.length > 0) {
|
|
2785
2785
|
const foundLanguage = languages.find(({ id }) => id === post.language);
|
|
2786
|
-
return {
|
|
2787
|
-
...post,
|
|
2788
|
-
language: foundLanguage ? foundLanguage.name : post.language,
|
|
2789
|
-
};
|
|
2786
|
+
return Object.assign(Object.assign({}, post), { language: foundLanguage ? foundLanguage.name : post.language });
|
|
2790
2787
|
}
|
|
2791
2788
|
return post;
|
|
2792
2789
|
});
|
|
@@ -2886,14 +2883,13 @@
|
|
|
2886
2883
|
languageFilter.value = initialLanguageFilter.value;
|
|
2887
2884
|
});
|
|
2888
2885
|
/** From date **/
|
|
2889
|
-
const initialFromDateFilter = compositionApi.computed(() => adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.FROM_DATE)
|
|
2886
|
+
const initialFromDateFilter = compositionApi.computed(() => { var _a; return (_a = adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.FROM_DATE)) !== null && _a !== void 0 ? _a : ''; });
|
|
2890
2887
|
const fromDateFilter = compositionApi.ref(initialFromDateFilter.value);
|
|
2891
2888
|
compositionApi.watch(initialFromDateFilter, () => {
|
|
2892
2889
|
fromDateFilter.value = initialFromDateFilter.value;
|
|
2893
2890
|
});
|
|
2894
2891
|
/** To date **/
|
|
2895
|
-
const initialToDateFilter = compositionApi.computed(() => adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.TO_DATE)
|
|
2896
|
-
'');
|
|
2892
|
+
const initialToDateFilter = compositionApi.computed(() => { var _a; return (_a = adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.TO_DATE)) !== null && _a !== void 0 ? _a : ''; });
|
|
2897
2893
|
const toDateFilter = compositionApi.ref(initialToDateFilter.value);
|
|
2898
2894
|
compositionApi.watch(initialToDateFilter, () => {
|
|
2899
2895
|
toDateFilter.value = initialToDateFilter.value;
|
|
@@ -2993,18 +2989,20 @@
|
|
|
2993
2989
|
const { t } = adminUi.useTranslation(context);
|
|
2994
2990
|
const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
|
|
2995
2991
|
const categoryId = compositionApi.computed(() => {
|
|
2992
|
+
var _a;
|
|
2996
2993
|
return Array.isArray(context.root.$route.query.category)
|
|
2997
|
-
? context.root.$route.query.category[0]
|
|
2998
|
-
: context.root.$route.query.category;
|
|
2994
|
+
? (_a = context.root.$route.query.category[0]) !== null && _a !== void 0 ? _a : '' : context.root.$route.query.category;
|
|
2999
2995
|
});
|
|
3000
2996
|
/** Fetch module config **/
|
|
3001
2997
|
const { data: moduleConfig, loading: isModuleConfigLoading, } = useFetchModuleConfig({ context });
|
|
3002
|
-
const languageList = compositionApi.computed(() => moduleConfig.value
|
|
2998
|
+
const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
|
|
3003
2999
|
/** Fetch category list **/
|
|
3004
3000
|
const { data: categoryList, loading: isCategoryListLoading, } = useFetchCategories({ context });
|
|
3005
|
-
const selectedCategory = compositionApi.computed(() =>
|
|
3006
|
-
|
|
3007
|
-
|
|
3001
|
+
const selectedCategory = compositionApi.computed(() => {
|
|
3002
|
+
var _a;
|
|
3003
|
+
return categoryId.value
|
|
3004
|
+
? (_a = categoryList.value.find(({ id }) => String(id) === String(categoryId.value))) !== null && _a !== void 0 ? _a : null : null;
|
|
3005
|
+
});
|
|
3008
3006
|
const pageTitle = compositionApi.computed(() => {
|
|
3009
3007
|
return selectedCategory.value
|
|
3010
3008
|
? `${context.root.$t('blog:postsByCategory')} "${selectedCategory.value.name}"`
|
|
@@ -3019,12 +3017,7 @@
|
|
|
3019
3017
|
const isLangSpecific = compositionApi.computed(() => languageOptionList.value.length > 1);
|
|
3020
3018
|
/** Fetch Post list **/
|
|
3021
3019
|
const { fetchEntityList: fetchPostList, isLoading: isPostLoading, rowData: postList, errorMessage, searchQuery, handleChange, pageNumber, pageCount, pageSize, } = adminUi.useDataTable({
|
|
3022
|
-
fetchEntityList: (params) => getPosts({
|
|
3023
|
-
query: params.searchQuery,
|
|
3024
|
-
pageNumber: params.pageNumber,
|
|
3025
|
-
pageSize: params.pageSize,
|
|
3026
|
-
...filterParams.value,
|
|
3027
|
-
}),
|
|
3020
|
+
fetchEntityList: (params) => getPosts(Object.assign({ query: params.searchQuery, pageNumber: params.pageNumber, pageSize: params.pageSize }, filterParams.value)),
|
|
3028
3021
|
initialValue: [],
|
|
3029
3022
|
context,
|
|
3030
3023
|
resourceName: 'Blog post list',
|
|
@@ -3034,16 +3027,16 @@
|
|
|
3034
3027
|
if (isModuleConfigLoading.value || isCategoryListLoading.value) {
|
|
3035
3028
|
return;
|
|
3036
3029
|
}
|
|
3037
|
-
const newQuery = {
|
|
3038
|
-
...lodash_pick(context.root.$route.query, ['query', 'pageNumber']),
|
|
3039
|
-
...filterParams.value,
|
|
3040
|
-
};
|
|
3030
|
+
const newQuery = Object.assign(Object.assign({}, lodash_pick(context.root.$route.query, ['query', 'pageNumber'])), filterParams.value);
|
|
3041
3031
|
if (!lodash_isequal(context.root.$route.query, newQuery)) {
|
|
3042
3032
|
context.root.$router.replace({ query: newQuery });
|
|
3043
3033
|
fetchPostList();
|
|
3044
3034
|
}
|
|
3045
3035
|
});
|
|
3046
|
-
const displayedPostList = compositionApi.computed(() =>
|
|
3036
|
+
const displayedPostList = compositionApi.computed(() => {
|
|
3037
|
+
var _a, _b;
|
|
3038
|
+
return convertPostList(postList.value, selectedCategory.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []);
|
|
3039
|
+
});
|
|
3047
3040
|
const isRowDataLoading = compositionApi.computed(() => isCategoryListLoading.value ||
|
|
3048
3041
|
isPostLoading.value ||
|
|
3049
3042
|
isModuleConfigLoading.value);
|
|
@@ -3478,6 +3471,7 @@
|
|
|
3478
3471
|
);
|
|
3479
3472
|
|
|
3480
3473
|
function convertPostToFormValues(post, languageOptionList, postOptionList, additionalFieldList) {
|
|
3474
|
+
var _a, _b;
|
|
3481
3475
|
if (!post) {
|
|
3482
3476
|
return {
|
|
3483
3477
|
title: '',
|
|
@@ -3512,8 +3506,8 @@
|
|
|
3512
3506
|
imageMobile: post.imageMobile
|
|
3513
3507
|
? { id: adminServices.createId(), file: post.imageMobile }
|
|
3514
3508
|
: null,
|
|
3515
|
-
pageTitle: post.pageTitle
|
|
3516
|
-
pageDescription: post.pageDescription
|
|
3509
|
+
pageTitle: (_a = post.pageTitle) !== null && _a !== void 0 ? _a : '',
|
|
3510
|
+
pageDescription: (_b = post.pageDescription) !== null && _b !== void 0 ? _b : '',
|
|
3517
3511
|
openGraphImage: post.openGraphImage
|
|
3518
3512
|
? { id: adminServices.createId(), file: post.openGraphImage }
|
|
3519
3513
|
: null,
|
|
@@ -3522,31 +3516,32 @@
|
|
|
3522
3516
|
value: category.id,
|
|
3523
3517
|
label: category.name,
|
|
3524
3518
|
})),
|
|
3525
|
-
language: currentLangOption
|
|
3519
|
+
language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
|
|
3526
3520
|
relatedPosts: selectedPostOptionList,
|
|
3527
3521
|
tags: post.tags.join(','),
|
|
3528
3522
|
additionalFields: additionalFieldList.map((fieldConfig, index) => {
|
|
3529
3523
|
const postAdditionalField = post.additionalFields.find((item) => item.name === fieldConfig.name);
|
|
3530
|
-
return adminDynamicField.universalFieldUtils.createFormField(fieldConfig, postAdditionalField
|
|
3524
|
+
return adminDynamicField.universalFieldUtils.createFormField(fieldConfig, postAdditionalField === null || postAdditionalField === void 0 ? void 0 : postAdditionalField.value);
|
|
3531
3525
|
}),
|
|
3532
3526
|
};
|
|
3533
3527
|
}
|
|
3534
3528
|
function convertFormValuesToCreationPayload(values) {
|
|
3529
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3535
3530
|
return {
|
|
3536
3531
|
title: values.title,
|
|
3537
3532
|
excerpt: values.excerpt,
|
|
3538
3533
|
urlAlias: values.urlAlias,
|
|
3539
3534
|
body: values.body,
|
|
3540
3535
|
date: values.date,
|
|
3541
|
-
coverImage: values.coverImage
|
|
3542
|
-
image: values.image
|
|
3543
|
-
imageMobile: values.imageMobile
|
|
3536
|
+
coverImage: (_b = (_a = values.coverImage) === null || _a === void 0 ? void 0 : _a.file.id) !== null && _b !== void 0 ? _b : null,
|
|
3537
|
+
image: (_d = (_c = values.image) === null || _c === void 0 ? void 0 : _c.file.id) !== null && _d !== void 0 ? _d : null,
|
|
3538
|
+
imageMobile: (_f = (_e = values.imageMobile) === null || _e === void 0 ? void 0 : _e.file.id) !== null && _f !== void 0 ? _f : null,
|
|
3544
3539
|
pageTitle: values.pageTitle,
|
|
3545
3540
|
pageDescription: values.pageDescription,
|
|
3546
|
-
openGraphImage: values.openGraphImage
|
|
3541
|
+
openGraphImage: (_h = (_g = values.openGraphImage) === null || _g === void 0 ? void 0 : _g.file.id) !== null && _h !== void 0 ? _h : null,
|
|
3547
3542
|
status: 'PUBLISHED',
|
|
3548
3543
|
categories: values.categories.map((option) => option.value),
|
|
3549
|
-
language: values.language
|
|
3544
|
+
language: (_k = (_j = values.language) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : null,
|
|
3550
3545
|
relatedPosts: values.relatedPosts.map((relatedPostOption) => relatedPostOption.value),
|
|
3551
3546
|
tags: values.tags.split(',').filter((tag) => tag.trim().length > 0),
|
|
3552
3547
|
additionalFields: values.additionalFields.map((field) => ({
|
|
@@ -3556,10 +3551,7 @@
|
|
|
3556
3551
|
};
|
|
3557
3552
|
}
|
|
3558
3553
|
function convertFormValuesToUpdatePayload(values) {
|
|
3559
|
-
return {
|
|
3560
|
-
...convertFormValuesToCreationPayload(values),
|
|
3561
|
-
urlAlias: values.urlAlias,
|
|
3562
|
-
};
|
|
3554
|
+
return Object.assign(Object.assign({}, convertFormValuesToCreationPayload(values)), { urlAlias: values.urlAlias });
|
|
3563
3555
|
}
|
|
3564
3556
|
function convertCategoryListToOptions(categoryList, languageId) {
|
|
3565
3557
|
return categoryList
|
|
@@ -3574,12 +3566,13 @@
|
|
|
3574
3566
|
name: 'BlogPostForm',
|
|
3575
3567
|
components: { DynamicField: adminDynamicField.DynamicField, ShortCodeConstructor: adminUi.ShortCodeConstructor, FormFooter: adminUi.FormFooter },
|
|
3576
3568
|
setup(props, context) {
|
|
3569
|
+
var _a, _b;
|
|
3577
3570
|
const postId = compositionApi.computed(() => context.root.$route.params.postId);
|
|
3578
3571
|
const isCreation = compositionApi.computed(() => postId.value === 'create');
|
|
3579
3572
|
const urlAliasChanged = compositionApi.ref(false);
|
|
3580
3573
|
/** Fetch module config **/
|
|
3581
3574
|
const { data: moduleConfig, loading: isModuleConfigLoading, } = useFetchModuleConfig({ context });
|
|
3582
|
-
const languageList = compositionApi.computed(() => moduleConfig.value
|
|
3575
|
+
const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
|
|
3583
3576
|
const languageOptionList = compositionApi.computed(() => languageList.value.map(({ id, name }) => ({
|
|
3584
3577
|
value: id,
|
|
3585
3578
|
label: name,
|
|
@@ -3609,17 +3602,18 @@
|
|
|
3609
3602
|
context,
|
|
3610
3603
|
});
|
|
3611
3604
|
const postOptionList = compositionApi.computed(() => postList.value
|
|
3612
|
-
.filter((relatedPost) => relatedPost.id !== post.value
|
|
3605
|
+
.filter((relatedPost) => { var _a; return relatedPost.id !== ((_a = post.value) === null || _a === void 0 ? void 0 : _a.id); })
|
|
3613
3606
|
.map((post) => ({
|
|
3614
3607
|
value: post.id,
|
|
3615
3608
|
label: post.title,
|
|
3616
3609
|
})));
|
|
3617
3610
|
/** Form State **/
|
|
3618
3611
|
const isSubmitting = compositionApi.ref(false);
|
|
3619
|
-
const values = compositionApi.ref(convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, moduleConfig.value
|
|
3612
|
+
const values = compositionApi.ref(convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []));
|
|
3620
3613
|
const errors = compositionApi.ref({});
|
|
3621
3614
|
compositionApi.watch([post, languageOptionList, postOptionList, moduleConfig], () => {
|
|
3622
|
-
|
|
3615
|
+
var _a, _b;
|
|
3616
|
+
values.value = convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []);
|
|
3623
3617
|
});
|
|
3624
3618
|
function submitForm(event) {
|
|
3625
3619
|
isSubmitting.value = true;
|
|
@@ -3630,6 +3624,7 @@
|
|
|
3630
3624
|
: updateBlogPost(postId.value, updateBody);
|
|
3631
3625
|
requestPromise
|
|
3632
3626
|
.then(({ data }) => {
|
|
3627
|
+
var _a, _b;
|
|
3633
3628
|
errors.value = {};
|
|
3634
3629
|
if (event.type === 'create') {
|
|
3635
3630
|
context.root.$router.push(getBlogPostFormUrl({ postId: String(data.id) }));
|
|
@@ -3643,7 +3638,7 @@
|
|
|
3643
3638
|
}
|
|
3644
3639
|
}
|
|
3645
3640
|
if (event.type === 'create_create-another') {
|
|
3646
|
-
values.value = convertPostToFormValues(null, languageOptionList.value, postOptionList.value, moduleConfig.value
|
|
3641
|
+
values.value = convertPostToFormValues(null, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []);
|
|
3647
3642
|
}
|
|
3648
3643
|
context.root.$toast({
|
|
3649
3644
|
variant: 'success',
|
|
@@ -3669,13 +3664,17 @@
|
|
|
3669
3664
|
});
|
|
3670
3665
|
}
|
|
3671
3666
|
/** Category Options */
|
|
3672
|
-
const categoryOptionList = compositionApi.computed(() =>
|
|
3667
|
+
const categoryOptionList = compositionApi.computed(() => {
|
|
3668
|
+
var _a, _b;
|
|
3669
|
+
return convertCategoryListToOptions(categoryList.value, (_b = (_a = values.value.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null);
|
|
3670
|
+
});
|
|
3673
3671
|
compositionApi.watch([categoryOptionList, moduleConfig], () => {
|
|
3672
|
+
var _a;
|
|
3674
3673
|
function isOptionExist(selectedCategoryOption) {
|
|
3675
3674
|
return categoryOptionList.value.some((option) => option.value === selectedCategoryOption.value);
|
|
3676
3675
|
}
|
|
3677
3676
|
if (isCreation.value) {
|
|
3678
|
-
if (moduleConfig
|
|
3677
|
+
if ((_a = moduleConfig === null || moduleConfig === void 0 ? void 0 : moduleConfig.value) === null || _a === void 0 ? void 0 : _a.defaultCategories) {
|
|
3679
3678
|
const defaultIds = moduleConfig.value.defaultCategories.map((item) => item.id);
|
|
3680
3679
|
values.value.categories = categoryOptionList.value.filter((item) => {
|
|
3681
3680
|
return defaultIds.indexOf(item.value) !== -1;
|
|
@@ -3690,11 +3689,13 @@
|
|
|
3690
3689
|
isPostListLoading.value ||
|
|
3691
3690
|
isModuleConfigLoading.value);
|
|
3692
3691
|
function getUploadAdapterOptions() {
|
|
3693
|
-
|
|
3692
|
+
var _a;
|
|
3693
|
+
return { uploadScenario: (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fileScenarios.content };
|
|
3694
3694
|
}
|
|
3695
3695
|
const blogPagePath = compositionApi.computed(() => {
|
|
3696
|
+
var _a, _b;
|
|
3696
3697
|
const origin = process.env.VUE_APP_WEBSITE_URL || window.location.origin;
|
|
3697
|
-
return origin + (post.value
|
|
3698
|
+
return origin + ((_b = (_a = post.value) === null || _a === void 0 ? void 0 : _a.urlTemplate) !== null && _b !== void 0 ? _b : '');
|
|
3698
3699
|
});
|
|
3699
3700
|
const tabList = compositionApi.computed(() => {
|
|
3700
3701
|
const hasErrors = adminUi.createTabErrorFinder(errors.value);
|
|
@@ -4188,10 +4189,7 @@
|
|
|
4188
4189
|
return categoryList.map((category) => {
|
|
4189
4190
|
if (languages.length > 0) {
|
|
4190
4191
|
const foundLanguage = languages.find(({ id }) => category.language === id);
|
|
4191
|
-
return {
|
|
4192
|
-
...category,
|
|
4193
|
-
language: foundLanguage ? foundLanguage.name : category.language,
|
|
4194
|
-
};
|
|
4192
|
+
return Object.assign(Object.assign({}, category), { language: foundLanguage ? foundLanguage.name : category.language });
|
|
4195
4193
|
}
|
|
4196
4194
|
return category;
|
|
4197
4195
|
});
|
|
@@ -4304,31 +4302,24 @@
|
|
|
4304
4302
|
const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
|
|
4305
4303
|
/** Fetch module config **/
|
|
4306
4304
|
const { data: moduleConfig, loading: isModuleConfigLoading, } = useFetchModuleConfig({ context });
|
|
4307
|
-
const languageList = compositionApi.computed(() => moduleConfig.value
|
|
4305
|
+
const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
|
|
4308
4306
|
/** Advanced search **/
|
|
4309
4307
|
const { languageFilter, languageOptionList, filterParams, tags, tagRemovalHandler, } = useAdvancedSearch$1({ context, languageList });
|
|
4310
4308
|
const isLangSpecific = compositionApi.computed(() => languageOptionList.value.length > 1);
|
|
4311
4309
|
/** Fetch category list */
|
|
4312
4310
|
const { fetchEntityList: fetchCategoryList, isLoading: isCategoryListLoading, rowData: categoryList, errorMessage, searchQuery, handleChange, pageNumber, pageCount, pageSize, } = adminUi.useDataTable({
|
|
4313
|
-
fetchEntityList: (params) => getCategories({
|
|
4314
|
-
query: params.searchQuery,
|
|
4315
|
-
pageNumber: params.pageNumber,
|
|
4316
|
-
pageSize: params.pageSize,
|
|
4317
|
-
...filterParams.value,
|
|
4318
|
-
}),
|
|
4311
|
+
fetchEntityList: (params) => getCategories(Object.assign({ query: params.searchQuery, pageNumber: params.pageNumber, pageSize: params.pageSize }, filterParams.value)),
|
|
4319
4312
|
initialValue: [],
|
|
4320
4313
|
context,
|
|
4321
4314
|
resourceName: 'Blog categories',
|
|
4322
4315
|
pageSize: 100,
|
|
4323
4316
|
});
|
|
4324
4317
|
compositionApi.watch(filterParams, () => {
|
|
4318
|
+
var _a;
|
|
4325
4319
|
if (isModuleConfigLoading.value || isCategoryListLoading.value) {
|
|
4326
4320
|
return;
|
|
4327
4321
|
}
|
|
4328
|
-
const newQuery = {
|
|
4329
|
-
...filterParams.value,
|
|
4330
|
-
query: (context.root.$route.query.query ?? ''),
|
|
4331
|
-
};
|
|
4322
|
+
const newQuery = Object.assign(Object.assign({}, filterParams.value), { query: ((_a = context.root.$route.query.query) !== null && _a !== void 0 ? _a : '') });
|
|
4332
4323
|
if (!lodash_isequal(context.root.$route.query, newQuery)) {
|
|
4333
4324
|
context.root.$router.replace({ query: newQuery });
|
|
4334
4325
|
fetchCategoryList();
|
|
@@ -4621,10 +4612,11 @@
|
|
|
4621
4612
|
);
|
|
4622
4613
|
|
|
4623
4614
|
function convertCategoryToFormValues(category, languageOptionList) {
|
|
4624
|
-
|
|
4615
|
+
var _a, _b, _c, _d, _e;
|
|
4616
|
+
const currentLangOption = languageOptionList.find(({ value }) => value === (category === null || category === void 0 ? void 0 : category.language));
|
|
4625
4617
|
if (!category) {
|
|
4626
4618
|
return {
|
|
4627
|
-
language: currentLangOption
|
|
4619
|
+
language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
|
|
4628
4620
|
name: '',
|
|
4629
4621
|
parent: null,
|
|
4630
4622
|
urlAlias: '',
|
|
@@ -4637,32 +4629,33 @@
|
|
|
4637
4629
|
};
|
|
4638
4630
|
}
|
|
4639
4631
|
return {
|
|
4640
|
-
language: currentLangOption
|
|
4632
|
+
language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
|
|
4641
4633
|
name: category.name,
|
|
4642
4634
|
parent: category.parent
|
|
4643
4635
|
? { value: category.parent.id, label: category.parent.name }
|
|
4644
4636
|
: null,
|
|
4645
4637
|
urlAlias: category.urlAlias,
|
|
4646
|
-
pageTitle: category.pageTitle
|
|
4647
|
-
pageDescription: category.pageDescription
|
|
4648
|
-
pageKeywords: category.pageKeywords
|
|
4649
|
-
openGraphTitle: category.openGraphTitle
|
|
4650
|
-
openGraphDescription: category.openGraphDescription
|
|
4638
|
+
pageTitle: (_a = category.pageTitle) !== null && _a !== void 0 ? _a : '',
|
|
4639
|
+
pageDescription: (_b = category.pageDescription) !== null && _b !== void 0 ? _b : '',
|
|
4640
|
+
pageKeywords: (_c = category.pageKeywords) !== null && _c !== void 0 ? _c : '',
|
|
4641
|
+
openGraphTitle: (_d = category.openGraphTitle) !== null && _d !== void 0 ? _d : '',
|
|
4642
|
+
openGraphDescription: (_e = category.openGraphDescription) !== null && _e !== void 0 ? _e : '',
|
|
4651
4643
|
openGraphImage: category.openGraphImage
|
|
4652
4644
|
? { id: adminServices.createId(), file: category.openGraphImage }
|
|
4653
4645
|
: null,
|
|
4654
4646
|
};
|
|
4655
4647
|
}
|
|
4656
4648
|
function convertCategoryFormValuesToPayload(values) {
|
|
4649
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4657
4650
|
return {
|
|
4658
|
-
language: values.language
|
|
4651
|
+
language: (_b = (_a = values.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null,
|
|
4659
4652
|
name: values.name,
|
|
4660
|
-
parent: values.parent
|
|
4653
|
+
parent: (_d = (_c = values.parent) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : null,
|
|
4661
4654
|
urlAlias: values.urlAlias,
|
|
4662
4655
|
isDefault: false,
|
|
4663
4656
|
pageTitle: values.pageTitle,
|
|
4664
4657
|
pageDescription: values.pageDescription,
|
|
4665
|
-
openGraphImage: values.openGraphImage
|
|
4658
|
+
openGraphImage: (_f = (_e = values.openGraphImage) === null || _e === void 0 ? void 0 : _e.file.id) !== null && _f !== void 0 ? _f : null,
|
|
4666
4659
|
};
|
|
4667
4660
|
}
|
|
4668
4661
|
|
|
@@ -4675,10 +4668,10 @@
|
|
|
4675
4668
|
const isCreation = compositionApi.computed(() => categoryId.value === 'create');
|
|
4676
4669
|
/** Fetch module config */
|
|
4677
4670
|
const { data: moduleConfig, loading: isModuleConfigLoading, } = useFetchModuleConfig({ context });
|
|
4678
|
-
const languageList = compositionApi.computed(() => moduleConfig.value
|
|
4671
|
+
const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
|
|
4679
4672
|
const languageOptionList = compositionApi.computed(() => languageList.value.map(({ id, name }) => ({ value: id, label: name })));
|
|
4680
4673
|
const isLangSpecific = compositionApi.computed(() => languageOptionList.value.length > 0);
|
|
4681
|
-
const imageScenario = compositionApi.computed(() => moduleConfig.value
|
|
4674
|
+
const imageScenario = compositionApi.computed(() => { var _a, _b, _c; return (_c = (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fileScenarios) === null || _b === void 0 ? void 0 : _b.openGraph) !== null && _c !== void 0 ? _c : null; });
|
|
4682
4675
|
/** Fetch Categories */
|
|
4683
4676
|
const { data: categories, loading: isCategoriesLoading, } = useFetchCategories({ context });
|
|
4684
4677
|
/** Fetch Category */
|
|
@@ -4736,13 +4729,17 @@
|
|
|
4736
4729
|
});
|
|
4737
4730
|
}
|
|
4738
4731
|
/** Category Options */
|
|
4739
|
-
const categoryOptionList = compositionApi.computed(() =>
|
|
4732
|
+
const categoryOptionList = compositionApi.computed(() => {
|
|
4733
|
+
var _a, _b;
|
|
4734
|
+
return convertCategoryListToOptions(categories.value, (_b = (_a = values.value.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null);
|
|
4735
|
+
});
|
|
4740
4736
|
/** Misc */
|
|
4741
4737
|
const isContentLoading = compositionApi.computed(() => isCategoryLoading.value ||
|
|
4742
4738
|
isModuleConfigLoading.value ||
|
|
4743
4739
|
isCategoriesLoading.value);
|
|
4744
4740
|
const categoryPagePath = compositionApi.computed(() => {
|
|
4745
|
-
|
|
4741
|
+
var _a, _b;
|
|
4742
|
+
return `${adminServices.getWebsiteOrigin()}${(_b = (_a = category.value) === null || _a === void 0 ? void 0 : _a.urlTemplate) !== null && _b !== void 0 ? _b : ''}`;
|
|
4746
4743
|
});
|
|
4747
4744
|
/** SEO **/
|
|
4748
4745
|
function handleSeoFieldGroupChange({ title, description, keywords, image, }) {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
declare const EN: {
|
|
2
|
+
yes: string;
|
|
3
|
+
no: string;
|
|
4
|
+
blog: string;
|
|
5
|
+
posts: string;
|
|
6
|
+
categories: string;
|
|
7
|
+
createPost: string;
|
|
8
|
+
createCategory: string;
|
|
9
|
+
home: string;
|
|
10
|
+
allPosts: string;
|
|
11
|
+
postForm: string;
|
|
12
|
+
allCategories: string;
|
|
13
|
+
categoryForm: string;
|
|
14
|
+
success: string;
|
|
15
|
+
error: string;
|
|
16
|
+
newPost: string;
|
|
17
|
+
edit: string;
|
|
18
|
+
remove: string;
|
|
19
|
+
postsByCategory: string;
|
|
20
|
+
name: string;
|
|
21
|
+
image: string;
|
|
22
|
+
language: string;
|
|
23
|
+
languages: string;
|
|
24
|
+
date: string;
|
|
25
|
+
dateOfPublication: string;
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
From: string;
|
|
29
|
+
To: string;
|
|
30
|
+
category: string;
|
|
31
|
+
actions: string;
|
|
32
|
+
updatePost: string;
|
|
33
|
+
title: string;
|
|
34
|
+
link: string;
|
|
35
|
+
excerpt: string;
|
|
36
|
+
body: string;
|
|
37
|
+
defaultCategory: string;
|
|
38
|
+
coverImage: string;
|
|
39
|
+
innerImage: string;
|
|
40
|
+
innerImageMobile: string;
|
|
41
|
+
tags: string;
|
|
42
|
+
relatedPosts: string;
|
|
43
|
+
blogPostWasSuccessfullyCreated: string;
|
|
44
|
+
blogPostWasSuccessfullyUpdated: string;
|
|
45
|
+
blogPostCreationWasFailed: string;
|
|
46
|
+
blogPostUpdateWasFailed: string;
|
|
47
|
+
common: string;
|
|
48
|
+
images: string;
|
|
49
|
+
relations: string;
|
|
50
|
+
additionalFields: string;
|
|
51
|
+
viewPost: string;
|
|
52
|
+
blogCategories: string;
|
|
53
|
+
newCategory: string;
|
|
54
|
+
moveUp: string;
|
|
55
|
+
moveDown: string;
|
|
56
|
+
createBlogCategory: string;
|
|
57
|
+
updateBlogCategory: string;
|
|
58
|
+
pageTitle: string;
|
|
59
|
+
pageDescription: string;
|
|
60
|
+
openGraphImage: string;
|
|
61
|
+
blogCategoryWasSuccessfullyCreated: string;
|
|
62
|
+
blogCategoryWasSuccessfullyUpdated: string;
|
|
63
|
+
blogCategoryCreationWasFailed: string;
|
|
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;
|
|
74
|
+
};
|
|
75
|
+
export default EN;
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Nullable, ResponseBody } from '@tager/admin-services';
|
|
2
|
+
import { FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
|
|
3
|
+
import { Category, ModuleConfig, PostShort, PostFull, UserModel, CategoryPayload } from '@/typings/model';
|
|
4
|
+
export declare function getUserProfile(): Promise<ResponseBody<UserModel>>;
|
|
5
|
+
/** Blog Posts */
|
|
6
|
+
export declare function getPosts(params?: {
|
|
7
|
+
query?: string;
|
|
8
|
+
pageNumber?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
}): Promise<ResponseBody<PostShort[]>>;
|
|
11
|
+
export declare function getPostsCount(): Promise<ResponseBody<{
|
|
12
|
+
count: number;
|
|
13
|
+
}>>;
|
|
14
|
+
export declare function getPost(postId: number | string): Promise<ResponseBody<PostFull>>;
|
|
15
|
+
export declare function clonePost(postId: number | string): Promise<ResponseBody<PostFull>>;
|
|
16
|
+
export interface PostCreationPayload {
|
|
17
|
+
title: string;
|
|
18
|
+
urlAlias: string;
|
|
19
|
+
excerpt: string;
|
|
20
|
+
body: string;
|
|
21
|
+
date: string;
|
|
22
|
+
coverImage: Nullable<string>;
|
|
23
|
+
image: Nullable<string>;
|
|
24
|
+
imageMobile: Nullable<string>;
|
|
25
|
+
status: string;
|
|
26
|
+
pageTitle: string;
|
|
27
|
+
pageDescription: string;
|
|
28
|
+
openGraphImage: Nullable<string>;
|
|
29
|
+
categories: number[];
|
|
30
|
+
language: Nullable<string>;
|
|
31
|
+
relatedPosts: number[];
|
|
32
|
+
tags: string[];
|
|
33
|
+
additionalFields: FieldShortType<OutgoingValueUnion>[];
|
|
34
|
+
}
|
|
35
|
+
export declare function createBlogPost(payload: PostCreationPayload): Promise<ResponseBody<PostFull>>;
|
|
36
|
+
export declare type PostUpdatePayload = PostCreationPayload & {
|
|
37
|
+
urlAlias: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function updateBlogPost(postId: number | string, payload: PostUpdatePayload): Promise<ResponseBody<PostFull>>;
|
|
40
|
+
export declare function deleteBlogPost(postId: number | string): Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
/** Blog Categories */
|
|
44
|
+
export declare function getCategories(params?: {
|
|
45
|
+
query?: string;
|
|
46
|
+
pageNumber?: number;
|
|
47
|
+
pageSize?: number;
|
|
48
|
+
}): Promise<ResponseBody<Category[]>>;
|
|
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<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
export declare function moveCategory(categoryId: number | string, direction: 'up' | 'down'): Promise<{
|
|
56
|
+
success: boolean;
|
|
57
|
+
}>;
|
|
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];
|