@tager/admin-blog 0.3.21 → 0.3.25

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.
Files changed (86) hide show
  1. package/dist/index.esm.js +3452 -612
  2. package/dist/index.umd.js +3454 -619
  3. package/package.json +13 -7
  4. package/src/constants/menu.ts +0 -2
  5. package/src/constants/paths.ts +0 -5
  6. package/src/constants/routes.ts +5 -18
  7. package/src/constants/scopes.ts +11 -0
  8. package/src/dev.ts +11 -44
  9. package/src/hooks/index.ts +6 -0
  10. package/src/hooks/useBlogCategoryList.ts +3 -5
  11. package/src/hooks/useBlogPostList.ts +2 -4
  12. package/src/hooks/useModuleConfig.ts +4 -8
  13. package/src/hooks/useStore.ts +8 -0
  14. package/src/hooks/useUserPermission.ts +16 -0
  15. package/src/hooks/useUserProfile.ts +13 -0
  16. package/src/locales/en.ts +17 -5
  17. package/src/locales/ru.ts +17 -4
  18. package/src/router/index.ts +39 -0
  19. package/src/services/requests.ts +33 -43
  20. package/src/store/index.ts +21 -0
  21. package/src/store/user.ts +109 -0
  22. package/src/typings/common.ts +1 -0
  23. package/src/typings/model.ts +62 -38
  24. package/src/utils/common.ts +23 -0
  25. package/src/views/App.vue +10 -4
  26. package/src/views/{BlogCategoryForm/BlogCategoryForm.helpers.ts → Categories/CategoryForm/CategoryForm.helpers.ts} +22 -7
  27. package/src/views/{BlogCategoryForm/BlogCategoryForm.vue → Categories/CategoryForm/CategoryForm.vue} +140 -63
  28. package/src/views/Categories/CategoryForm/index.ts +1 -0
  29. package/src/views/Categories/CategoryList/CategoryList.helpers.ts +91 -0
  30. package/src/views/Categories/CategoryList/CategoryList.vue +269 -0
  31. package/src/views/Categories/CategoryList/hooks/index.ts +1 -0
  32. package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +95 -0
  33. package/src/views/Categories/CategoryList/index.ts +1 -0
  34. package/src/views/Home.vue +2 -9
  35. package/src/views/Posts/PostForm/PostForm.helpers.ts +150 -0
  36. package/src/views/Posts/PostForm/PostForm.vue +550 -0
  37. package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/TabList.types.ts +0 -0
  38. package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/TabList.vue +1 -1
  39. package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/index.ts +0 -0
  40. package/src/views/Posts/PostForm/index.ts +1 -0
  41. package/src/views/{BlogPostList/BlogPostList.helpers.ts → Posts/PostList/PostList.helpers.ts} +10 -18
  42. package/src/views/Posts/PostList/PostList.vue +361 -0
  43. package/src/views/Posts/PostList/hooks/index.ts +1 -0
  44. package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +250 -0
  45. package/src/views/Posts/PostList/index.ts +1 -0
  46. package/dist/constants/menu.d.ts +0 -5
  47. package/dist/constants/paths.d.ts +0 -16
  48. package/dist/constants/routes.d.ts +0 -6
  49. package/dist/dev.d.ts +0 -3
  50. package/dist/hooks/useBlogCategoryList.d.ts +0 -7
  51. package/dist/hooks/useBlogPostList.d.ts +0 -7
  52. package/dist/hooks/useModuleConfig.d.ts +0 -7
  53. package/dist/locales/en.d.ts +0 -63
  54. package/dist/locales/ru.d.ts +0 -3
  55. package/dist/main.d.ts +0 -4
  56. package/dist/services/requests.d.ts +0 -68
  57. package/dist/typings/model.d.ts +0 -74
  58. package/dist/views/BlogCategoryForm/BlogCategoryForm.helpers.d.ts +0 -16
  59. package/dist/views/BlogCategoryForm/BlogCategoryForm.vue.d.ts +0 -86
  60. package/dist/views/BlogCategoryForm/index.d.ts +0 -1
  61. package/dist/views/BlogCategoryList/BlogCategoryList.helpers.d.ts +0 -6
  62. package/dist/views/BlogCategoryList/BlogCategoryList.vue.d.ts +0 -3
  63. package/dist/views/BlogCategoryList/index.d.ts +0 -1
  64. package/dist/views/BlogPostForm/BlogPostForm.helpers.d.ts +0 -27
  65. package/dist/views/BlogPostForm/BlogPostForm.vue.d.ts +0 -9320
  66. package/dist/views/BlogPostForm/components/TabList/TabList.types.d.ts +0 -5
  67. package/dist/views/BlogPostForm/components/TabList/index.d.ts +0 -2
  68. package/dist/views/BlogPostForm/index.d.ts +0 -1
  69. package/dist/views/BlogPostList/BlogPostList.helpers.d.ts +0 -6
  70. package/dist/views/BlogPostList/BlogPostList.vue.d.ts +0 -45
  71. package/dist/views/BlogPostList/index.d.ts +0 -1
  72. package/dist/views/BlogSettings/BlogSettings.helpers.d.ts +0 -6
  73. package/dist/views/BlogSettings/BlogSettings.vue.d.ts +0 -9132
  74. package/dist/views/BlogSettings/index.d.ts +0 -1
  75. package/src/views/BlogCategoryForm/index.ts +0 -1
  76. package/src/views/BlogCategoryList/BlogCategoryList.helpers.ts +0 -82
  77. package/src/views/BlogCategoryList/BlogCategoryList.vue +0 -196
  78. package/src/views/BlogCategoryList/index.ts +0 -1
  79. package/src/views/BlogPostForm/BlogPostForm.helpers.ts +0 -152
  80. package/src/views/BlogPostForm/BlogPostForm.vue +0 -534
  81. package/src/views/BlogPostForm/index.ts +0 -1
  82. package/src/views/BlogPostList/BlogPostList.vue +0 -174
  83. package/src/views/BlogPostList/index.ts +0 -1
  84. package/src/views/BlogSettings/BlogSettings.helpers.ts +0 -25
  85. package/src/views/BlogSettings/BlogSettings.vue +0 -110
  86. package/src/views/BlogSettings/index.ts +0 -1
@@ -1,25 +0,0 @@
1
- import { FieldUnion, universalFieldUtils } from '@tager/admin-dynamic-field';
2
-
3
- import { SettingItemType } from '../../typings/model';
4
- import { SettingsUpdatePayload } from '../../services/requests';
5
-
6
- export type SettingsFormValues = Array<FieldUnion>;
7
-
8
- export function convertBlogSettingsToFormValues(
9
- settingItemList: Array<SettingItemType>
10
- ): SettingsFormValues {
11
- return settingItemList.map((settingItem) =>
12
- universalFieldUtils.createFormField(settingItem.field, settingItem.value)
13
- );
14
- }
15
-
16
- export function convertSettingValuesToRequestPayload(
17
- values: SettingsFormValues
18
- ): SettingsUpdatePayload {
19
- return {
20
- values: values.map((field) => ({
21
- name: field.config.name,
22
- value: universalFieldUtils.getOutgoingValue(field),
23
- })),
24
- };
25
- }
@@ -1,110 +0,0 @@
1
- <template>
2
- <page
3
- :title="$t('blog:blogSettings')"
4
- :is-content-loading="isContentLoading"
5
- :footer="{
6
- backHref: '/',
7
- onSubmit: submitForm,
8
- isSubmitting: isSubmitting,
9
- }"
10
- >
11
- <template v-slot:content>
12
- <form novalidate @submit.prevent="submitForm">
13
- <DynamicField
14
- v-for="field of values"
15
- :key="field.config.name"
16
- :field="field"
17
- />
18
- </form>
19
- </template>
20
- </page>
21
- </template>
22
-
23
- <script lang="ts">
24
- import { defineComponent, onMounted, ref, watch } from '@vue/composition-api';
25
-
26
- import { convertRequestErrorToMap, useResource } from '@tager/admin-services';
27
- import { DynamicField } from '@tager/admin-dynamic-field';
28
-
29
- import { SettingItemType } from '../../typings/model';
30
- import {
31
- getBlogSettingList,
32
- updateBlogSettingList,
33
- } from '../../services/requests';
34
- import { getBlogPostListUrl } from '../../constants/paths';
35
-
36
- import {
37
- convertBlogSettingsToFormValues,
38
- SettingsFormValues,
39
- convertSettingValuesToRequestPayload,
40
- } from './BlogSettings.helpers';
41
-
42
- export default defineComponent({
43
- name: 'BlogSettings',
44
- components: { DynamicField },
45
- setup(props, context) {
46
- const [fetchSettingList, { data: settingList, loading }] = useResource<
47
- Array<SettingItemType>
48
- >({
49
- fetchResource: getBlogSettingList,
50
- initialValue: [],
51
- context,
52
- resourceName: 'Settings',
53
- });
54
-
55
- onMounted(() => {
56
- fetchSettingList();
57
- });
58
-
59
- const isSubmitting = ref<boolean>(false);
60
- const values = ref<SettingsFormValues>(
61
- convertBlogSettingsToFormValues(settingList.value)
62
- );
63
-
64
- watch(settingList, () => {
65
- values.value = convertBlogSettingsToFormValues(settingList.value);
66
- });
67
-
68
- const errors = ref<Record<string, string>>({});
69
-
70
- function submitForm({ shouldExit }: { shouldExit: boolean }) {
71
- isSubmitting.value = true;
72
-
73
- const body = convertSettingValuesToRequestPayload(values.value);
74
-
75
- updateBlogSettingList(body)
76
- .then(() => {
77
- errors.value = {};
78
-
79
- if (shouldExit) {
80
- context.root.$router.push(getBlogPostListUrl());
81
- }
82
-
83
- context.root.$toast({
84
- variant: 'success',
85
- title: context.root.$t('blog:success'),
86
- body: context.root.$t(
87
- 'blog:blogSettingsHaveBeenSuccessfullyUpdated'
88
- ),
89
- });
90
- })
91
- .catch((error) => {
92
- console.error(error);
93
- errors.value = convertRequestErrorToMap(error);
94
- context.root.$toast({
95
- variant: 'danger',
96
- title: context.root.$t('blog:error'),
97
- body: context.root.$t('blog:blogSettingsUpdateHasBeenFailed'),
98
- });
99
- })
100
- .finally(() => {
101
- isSubmitting.value = false;
102
- });
103
- }
104
-
105
- return { isContentLoading: loading, submitForm, isSubmitting, values };
106
- },
107
- });
108
- </script>
109
-
110
- <style scoped lang="scss"></style>
@@ -1 +0,0 @@
1
- export { default } from './BlogSettings.vue';