@tager/admin-blog 0.3.43 → 1.0.2

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 (83) hide show
  1. package/dist/constants/paths.d.ts +6 -14
  2. package/dist/constants/routes.d.ts +5 -5
  3. package/dist/dev/App.vue.d.ts +5 -0
  4. package/dist/dev/config.d.ts +2 -0
  5. package/dist/dev/env.d.ts +1 -0
  6. package/dist/dev/main.d.ts +3 -0
  7. package/dist/hooks/index.d.ts +4 -4
  8. package/dist/hooks/useFetchCategories.d.ts +3 -6
  9. package/dist/hooks/useFetchCategory.d.ts +7 -8
  10. package/dist/hooks/useFetchModuleConfig.d.ts +3 -6
  11. package/dist/hooks/useFetchPosts.d.ts +3 -6
  12. package/dist/index.mjs +2355 -0
  13. package/dist/locales/apply.d.ts +1 -0
  14. package/dist/locales/en.d.ts +92 -86
  15. package/dist/locales/ru.d.ts +3 -3
  16. package/dist/main.d.ts +3 -4
  17. package/dist/services/requests.d.ts +60 -59
  18. package/dist/style.css +1 -0
  19. package/dist/typings/common.d.ts +1 -1
  20. package/dist/typings/model.d.ts +106 -106
  21. package/dist/utils/common.d.ts +2 -2
  22. package/dist/utils/paths.d.ts +8 -0
  23. package/dist/views/Categories/CategoryForm/CategoryForm.helpers.d.ts +7 -7
  24. package/dist/views/Categories/CategoryForm/CategoryForm.vue.d.ts +53 -116
  25. package/dist/views/Categories/CategoryForm/index.d.ts +1 -1
  26. package/dist/views/Categories/CategoryList/CategoryList.helpers.d.ts +7 -7
  27. package/dist/views/Categories/CategoryList/CategoryList.vue.d.ts +26 -57
  28. package/dist/views/Categories/CategoryList/hooks/index.d.ts +1 -1
  29. package/dist/views/Categories/CategoryList/hooks/useAdvancedSearch.d.ts +19 -16
  30. package/dist/views/Categories/CategoryList/index.d.ts +1 -1
  31. package/dist/views/Posts/PostForm/PostForm.helpers.d.ts +32 -32
  32. package/dist/views/Posts/PostForm/PostForm.vue.d.ts +2768 -9398
  33. package/dist/views/Posts/PostForm/index.d.ts +1 -1
  34. package/dist/views/Posts/PostList/PostList.helpers.d.ts +8 -7
  35. package/dist/views/Posts/PostList/PostList.vue.d.ts +40 -78
  36. package/dist/views/Posts/PostList/hooks/index.d.ts +1 -1
  37. package/dist/views/Posts/PostList/hooks/useAdvancedSearch.d.ts +27 -24
  38. package/dist/views/Posts/PostList/index.d.ts +1 -1
  39. package/package.json +51 -49
  40. package/src/constants/paths.ts +0 -22
  41. package/src/constants/routes.ts +9 -9
  42. package/src/dev/App.vue +56 -0
  43. package/src/dev/config.ts +23 -0
  44. package/src/dev/env.ts +17 -0
  45. package/src/dev/main.ts +49 -0
  46. package/src/hooks/useFetchCategories.ts +2 -7
  47. package/src/hooks/useFetchCategory.ts +3 -6
  48. package/src/hooks/useFetchModuleConfig.ts +2 -7
  49. package/src/hooks/useFetchPosts.ts +4 -6
  50. package/src/locales/apply.ts +9 -0
  51. package/src/locales/en.ts +10 -4
  52. package/src/locales/ru.ts +11 -3
  53. package/src/main.ts +3 -8
  54. package/src/services/requests.ts +1 -0
  55. package/src/utils/paths.ts +23 -0
  56. package/src/views/Categories/CategoryForm/CategoryForm.vue +81 -65
  57. package/src/views/Categories/CategoryList/CategoryList.helpers.ts +1 -1
  58. package/src/views/Categories/CategoryList/CategoryList.vue +86 -58
  59. package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +9 -12
  60. package/src/views/Posts/PostForm/PostForm.vue +265 -225
  61. package/src/views/Posts/PostList/PostList.helpers.ts +27 -2
  62. package/src/views/Posts/PostList/PostList.vue +203 -192
  63. package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +22 -30
  64. package/CHANGELOG.md +0 -13
  65. package/dist/constants/menu.d.ts +0 -5
  66. package/dist/dev.d.ts +0 -1
  67. package/dist/index.esm.js +0 -5294
  68. package/dist/index.umd.js +0 -5321
  69. package/dist/router/index.d.ts +0 -4
  70. package/dist/views/Posts/PostForm/components/TabList/TabList.types.d.ts +0 -5
  71. package/dist/views/Posts/PostForm/components/TabList/index.d.ts +0 -2
  72. package/src/constants/menu.ts +0 -31
  73. package/src/dev.ts +0 -34
  74. package/src/router/index.ts +0 -40
  75. package/src/typings/sfc.d.ts +0 -12
  76. package/src/typings/shims-tsx.d.ts +0 -13
  77. package/src/typings/shims-vue.d.ts +0 -11
  78. package/src/typings/translate.d.ts +0 -10
  79. package/src/views/App.vue +0 -22
  80. package/src/views/Home.vue +0 -31
  81. package/src/views/Posts/PostForm/components/TabList/TabList.types.ts +0 -5
  82. package/src/views/Posts/PostForm/components/TabList/TabList.vue +0 -92
  83. package/src/views/Posts/PostForm/components/TabList/index.ts +0 -2
@@ -1,11 +1,6 @@
1
- import {
2
- computed,
3
- ComputedRef,
4
- Ref,
5
- ref,
6
- SetupContext,
7
- watch,
8
- } from '@vue/composition-api';
1
+ import { computed, ComputedRef, Ref, ref, watch } from 'vue';
2
+ import { TFunction } from 'i18next';
3
+ import { RouteLocationNormalizedLoaded } from 'vue-router';
9
4
 
10
5
  import {
11
6
  FilterTagType,
@@ -20,10 +15,12 @@ import { Category, Language } from '../../../../typings/model';
20
15
  import { getNameWithDepth } from '../../../../utils/common';
21
16
 
22
17
  interface Params {
23
- context: SetupContext;
24
- categoryList: ComputedRef<Category[]>;
18
+ categoryList: Ref<Category[]>;
25
19
  languageList: ComputedRef<Language[]>;
26
20
  statusOptionList: ComputedRef<OptionType[]>;
21
+
22
+ t: TFunction;
23
+ route: RouteLocationNormalizedLoaded;
27
24
  }
28
25
 
29
26
  interface State {
@@ -36,6 +33,7 @@ interface State {
36
33
  statusFilter: Ref<OptionType[]>;
37
34
  filterParams: ComputedRef<Record<string, string | string[]>>;
38
35
  tags: ComputedRef<FilterTagType[]>;
36
+
39
37
  tagRemovalHandler(event: FilterTagType): void;
40
38
  }
41
39
 
@@ -50,7 +48,8 @@ enum FilterTypes {
50
48
  export const dateFormat = (date: string) => date.split('-').reverse().join('.');
51
49
 
52
50
  export function useAdvancedSearch({
53
- context,
51
+ t,
52
+ route,
54
53
  categoryList,
55
54
  languageList,
56
55
  statusOptionList,
@@ -66,9 +65,10 @@ export function useAdvancedSearch({
66
65
 
67
66
  const initialCategoryFilter = computed<OptionType[]>(() => {
68
67
  const queryValue = getFilterParamAsStringArray(
69
- context.root.$route.query,
68
+ route.query,
70
69
  FilterTypes.CATEGORY
71
70
  );
71
+
72
72
  return categoryOptionList.value.filter(({ value }) =>
73
73
  queryValue.some((selected) => selected === value)
74
74
  );
@@ -88,7 +88,7 @@ export function useAdvancedSearch({
88
88
 
89
89
  const initialLanguageFilter = computed<OptionType[]>(() => {
90
90
  const queryValue = getFilterParamAsStringArray(
91
- context.root.$route.query,
91
+ route.query,
92
92
  FilterTypes.LANGUAGE
93
93
  );
94
94
  return languageOptionList.value.filter(({ value }) =>
@@ -105,11 +105,7 @@ export function useAdvancedSearch({
105
105
  /** From date **/
106
106
 
107
107
  const initialFromDateFilter = computed<string>(
108
- () =>
109
- getFilterParamAsString(
110
- context.root.$route.query,
111
- FilterTypes.FROM_DATE
112
- ) ?? ''
108
+ () => getFilterParamAsString(route.query, FilterTypes.FROM_DATE) ?? ''
113
109
  );
114
110
 
115
111
  const fromDateFilter = ref<string>(initialFromDateFilter.value);
@@ -121,9 +117,7 @@ export function useAdvancedSearch({
121
117
  /** To date **/
122
118
 
123
119
  const initialToDateFilter = computed<string>(
124
- () =>
125
- getFilterParamAsString(context.root.$route.query, FilterTypes.TO_DATE) ??
126
- ''
120
+ () => getFilterParamAsString(route.query, FilterTypes.TO_DATE) ?? ''
127
121
  );
128
122
 
129
123
  const toDateFilter = ref<string>(initialToDateFilter.value);
@@ -148,20 +142,18 @@ export function useAdvancedSearch({
148
142
  }
149
143
 
150
144
  if (fromDateFilter.value && !toDateFilter.value) {
151
- label = `${context.root.$t('blog:from')} ${dateFormat(
152
- fromDateFilter.value
153
- )}`;
145
+ label = `${t('blog:from')} ${dateFormat(fromDateFilter.value)}`;
154
146
  }
155
147
 
156
148
  if (!fromDateFilter.value && toDateFilter.value) {
157
- label = `${context.root.$t('blog:to')} ${dateFormat(toDateFilter.value)}`;
149
+ label = `${t('blog:to')} ${dateFormat(toDateFilter.value)}`;
158
150
  }
159
151
 
160
152
  return {
161
153
  value: '',
162
154
  label,
163
155
  name: FilterTypes.FROM_DATE,
164
- title: context.root.$t('blog:dateOfPublication'),
156
+ title: t('blog:dateOfPublication'),
165
157
  };
166
158
  });
167
159
 
@@ -169,7 +161,7 @@ export function useAdvancedSearch({
169
161
 
170
162
  const initialStatusFilter = computed<OptionType[]>(() => {
171
163
  const queryValue = getFilterParamAsStringArray(
172
- context.root.$route.query,
164
+ route.query,
173
165
  FilterTypes.STATUS
174
166
  );
175
167
  return statusOptionList.value.filter(({ value }) =>
@@ -235,20 +227,20 @@ export function useAdvancedSearch({
235
227
  value,
236
228
  label,
237
229
  name: FilterTypes.CATEGORY,
238
- title: context.root.$t('blog:category'),
230
+ title: t('blog:category'),
239
231
  })),
240
232
  ...languageFilter.value.map(({ value, label }) => ({
241
233
  value,
242
234
  label,
243
235
  name: FilterTypes.LANGUAGE,
244
- title: context.root.$t('blog:language'),
236
+ title: t('blog:language'),
245
237
  })),
246
238
  date.value,
247
239
  ...statusFilter.value.map(({ value, label }) => ({
248
240
  value,
249
241
  label,
250
242
  name: FilterTypes.STATUS,
251
- title: context.root.$t('blog:status'),
243
+ title: t('blog:status'),
252
244
  })),
253
245
  ].filter(isNotNullish)
254
246
  );
package/CHANGELOG.md DELETED
@@ -1,13 +0,0 @@
1
- # [0.0.2] (2020-06-06)
2
-
3
- ### Features
4
-
5
- * **services:** Use VUE_APP_API_ORIGIN env variable as initial api origin value in ApiService
6
-
7
- # [0.0.3] (2020-06-06)
8
-
9
- ### Bug Fixes
10
-
11
- * **services:** Use api origin from ApiService to configure url for file upload
12
-
13
-
@@ -1,5 +0,0 @@
1
- import { MenuItemType } from '@tager/admin-layout';
2
- import { TranslateFunction } from '@tager/admin-services';
3
- export declare function getBlogMenuItem(params: {
4
- t: TranslateFunction;
5
- }): MenuItemType;
package/dist/dev.d.ts DELETED
@@ -1 +0,0 @@
1
- import '@tager/admin-ui/dist/admin-ui.css';