@tager/admin-blog 0.3.42 → 1.0.1

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 (82) 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 +2313 -0
  13. package/dist/locales/apply.d.ts +1 -0
  14. package/dist/locales/en.d.ts +87 -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 +59 -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 +7 -7
  35. package/dist/views/Posts/PostList/PostList.vue.d.ts +38 -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 +2 -5
  50. package/src/locales/apply.ts +9 -0
  51. package/src/locales/en.ts +3 -3
  52. package/src/locales/ru.ts +4 -2
  53. package/src/main.ts +3 -8
  54. package/src/utils/paths.ts +23 -0
  55. package/src/views/Categories/CategoryForm/CategoryForm.vue +81 -65
  56. package/src/views/Categories/CategoryList/CategoryList.helpers.ts +1 -1
  57. package/src/views/Categories/CategoryList/CategoryList.vue +86 -58
  58. package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +9 -12
  59. package/src/views/Posts/PostForm/PostForm.vue +259 -224
  60. package/src/views/Posts/PostList/PostList.helpers.ts +3 -3
  61. package/src/views/Posts/PostList/PostList.vue +168 -168
  62. package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +22 -30
  63. package/CHANGELOG.md +0 -13
  64. package/dist/constants/menu.d.ts +0 -5
  65. package/dist/dev.d.ts +0 -1
  66. package/dist/index.esm.js +0 -5294
  67. package/dist/index.umd.js +0 -5321
  68. package/dist/router/index.d.ts +0 -4
  69. package/dist/views/Posts/PostForm/components/TabList/TabList.types.d.ts +0 -5
  70. package/dist/views/Posts/PostForm/components/TabList/index.d.ts +0 -2
  71. package/src/constants/menu.ts +0 -31
  72. package/src/dev.ts +0 -34
  73. package/src/router/index.ts +0 -40
  74. package/src/typings/sfc.d.ts +0 -12
  75. package/src/typings/shims-tsx.d.ts +0 -13
  76. package/src/typings/shims-vue.d.ts +0 -11
  77. package/src/typings/translate.d.ts +0 -10
  78. package/src/views/App.vue +0 -22
  79. package/src/views/Home.vue +0 -31
  80. package/src/views/Posts/PostForm/components/TabList/TabList.types.ts +0 -5
  81. package/src/views/Posts/PostForm/components/TabList/TabList.vue +0 -92
  82. package/src/views/Posts/PostForm/components/TabList/index.ts +0 -2
@@ -1 +1 @@
1
- export { default } from './PostForm.vue';
1
+ export { default } from './PostForm.vue';
@@ -1,7 +1,7 @@
1
- import { TFunction } from 'i18next';
2
- import { Nullable } from '@tager/admin-services';
3
- import { ColumnDefinition } from '@tager/admin-ui';
4
- import { Category, ModuleConfig, Language, PostShort } from '../../../typings/model';
5
- export declare function convertPostList(postList: PostShort[], selectedCategory: Nullable<Category>, languages: Language[]): PostShort[];
6
- export declare function getStatuses(t: TFunction): Record<string, string>;
7
- export declare function getPostTableColumnDefs(moduleConfig: Nullable<ModuleConfig>, t: TFunction): ColumnDefinition<PostShort>[];
1
+ import { TFunction } from 'i18next';
2
+ import { Nullable } from '@tager/admin-services';
3
+ import { ColumnDefinition } from '@tager/admin-ui';
4
+ import { Category, ModuleConfig, Language, PostShort } from '../../../typings/model';
5
+ export declare function convertPostList(postList: PostShort[], selectedCategory: Nullable<Category>, languages: Language[]): PostShort[];
6
+ export declare function getStatuses(t: TFunction): Record<string, string>;
7
+ export declare function getPostTableColumnDefs(moduleConfig: Nullable<ModuleConfig>, t: TFunction): ColumnDefinition<PostShort>[];
@@ -1,78 +1,38 @@
1
- import { ColumnDefinition, OptionType, formatDateTime } from '@tager/admin-ui';
2
- import { getBlogPostFormUrl } from '../../../constants/paths';
3
- import { Category, PostShort } from '../../../typings/model';
4
- import { getStatuses } from './PostList.helpers';
5
- declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
6
- t: import("i18next").TFunction;
7
- formatDateTime: typeof formatDateTime;
8
- columnDefs: import("@vue/composition-api").ComputedRef<ColumnDefinition<PostShort>[]>;
9
- rowData: import("@vue/composition-api").ComputedRef<PostShort[]>;
10
- handleResourceDelete: (entityId: string | number) => void;
11
- isDeleting: (entityId: string | number) => boolean;
12
- categoryList: import("@vue/composition-api").Ref<Category[]>;
13
- isRowDataLoading: import("@vue/composition-api").ComputedRef<boolean>;
14
- errorMessage: import("@vue/composition-api").Ref<string | null>;
15
- getBlogPostFormUrl: typeof getBlogPostFormUrl;
16
- pageTitle: import("@vue/composition-api").ComputedRef<string>;
17
- searchQuery: import("@vue/composition-api").Ref<string>;
18
- handleChange: (event: import("@tager/admin-ui").TableChangeEvent) => void;
19
- pageNumber: import("@vue/composition-api").Ref<number>;
20
- pageCount: import("@vue/composition-api").ComputedRef<number>;
21
- pageSize: import("@vue/composition-api").Ref<number>;
22
- categoryFilter: import("@vue/composition-api").Ref<OptionType<string>[]>;
23
- categoryOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
24
- isLangSpecific: import("@vue/composition-api").ComputedRef<boolean>;
25
- languageFilter: import("@vue/composition-api").Ref<OptionType<string>[]>;
26
- languageOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
27
- fromDateFilter: import("@vue/composition-api").Ref<string>;
28
- toDateFilter: import("@vue/composition-api").Ref<string>;
29
- statusFilter: import("@vue/composition-api").Ref<OptionType<string>[]>;
30
- statusOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
31
- tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
32
- tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
33
- getStatuses: typeof getStatuses;
34
- handleResourceClone: (entityId: string | number) => void;
35
- isBusy: (postId: number) => boolean;
36
- }> & {
37
- [key: string]: unknown;
38
- }, {}, {}, unknown, {
39
- [x: string]: any;
40
- }> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
41
- [x: string]: any;
42
- }, import("@vue/composition-api").ShallowUnwrapRef<{
43
- t: import("i18next").TFunction;
44
- formatDateTime: typeof formatDateTime;
45
- columnDefs: import("@vue/composition-api").ComputedRef<ColumnDefinition<PostShort>[]>;
46
- rowData: import("@vue/composition-api").ComputedRef<PostShort[]>;
47
- handleResourceDelete: (entityId: string | number) => void;
48
- isDeleting: (entityId: string | number) => boolean;
49
- categoryList: import("@vue/composition-api").Ref<Category[]>;
50
- isRowDataLoading: import("@vue/composition-api").ComputedRef<boolean>;
51
- errorMessage: import("@vue/composition-api").Ref<string | null>;
52
- getBlogPostFormUrl: typeof getBlogPostFormUrl;
53
- pageTitle: import("@vue/composition-api").ComputedRef<string>;
54
- searchQuery: import("@vue/composition-api").Ref<string>;
55
- handleChange: (event: import("@tager/admin-ui").TableChangeEvent) => void;
56
- pageNumber: import("@vue/composition-api").Ref<number>;
57
- pageCount: import("@vue/composition-api").ComputedRef<number>;
58
- pageSize: import("@vue/composition-api").Ref<number>;
59
- categoryFilter: import("@vue/composition-api").Ref<OptionType<string>[]>;
60
- categoryOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
61
- isLangSpecific: import("@vue/composition-api").ComputedRef<boolean>;
62
- languageFilter: import("@vue/composition-api").Ref<OptionType<string>[]>;
63
- languageOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
64
- fromDateFilter: import("@vue/composition-api").Ref<string>;
65
- toDateFilter: import("@vue/composition-api").Ref<string>;
66
- statusFilter: import("@vue/composition-api").Ref<OptionType<string>[]>;
67
- statusOptionList: import("@vue/composition-api").ComputedRef<OptionType<string>[]>;
68
- tags: import("@vue/composition-api").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
69
- tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
70
- getStatuses: typeof getStatuses;
71
- handleResourceClone: (entityId: string | number) => void;
72
- isBusy: (postId: number) => boolean;
73
- }>, {
74
- [x: string]: any;
75
- }, {}, {}, {
76
- [x: string]: any;
77
- }>);
78
- export default _default;
1
+ import { ColumnDefinition, OptionType, formatDateTime } from '@tager/admin-ui';
2
+ import { Nullable } from '@tager/admin-services';
3
+ import { getBlogPostFormUrl } from '../../../utils/paths';
4
+ import { Category, PostShort } from '../../../typings/model';
5
+ import { getStatuses } from './PostList.helpers';
6
+ declare const _default: import("vue").DefineComponent<{}, {
7
+ t: import("i18next").TFunction;
8
+ formatDateTime: typeof formatDateTime;
9
+ columnDefs: import("vue").ComputedRef<ColumnDefinition<PostShort>[]>;
10
+ rowData: import("vue").ComputedRef<PostShort[]>;
11
+ handleResourceDelete: (entityId: string | number) => void;
12
+ isDeleting: (entityId: string | number) => boolean;
13
+ categoryList: import("vue").Ref<Category[]>;
14
+ isRowDataLoading: import("vue").ComputedRef<boolean>;
15
+ errorMessage: import("vue").Ref<Nullable<string>>;
16
+ getBlogPostFormUrl: typeof getBlogPostFormUrl;
17
+ pageTitle: import("vue").ComputedRef<string>;
18
+ searchQuery: import("vue").Ref<string>;
19
+ handleChange: (event: import("@tager/admin-ui/dist/components/DataTable/DataTable.types").TableChangeEvent) => void;
20
+ pageNumber: import("vue").Ref<number>;
21
+ pageCount: import("vue").ComputedRef<number>;
22
+ pageSize: import("vue").Ref<number>;
23
+ categoryFilter: import("vue").Ref<OptionType<string>[]>;
24
+ categoryOptionList: import("vue").ComputedRef<OptionType<string>[]>;
25
+ isLangSpecific: import("vue").ComputedRef<boolean>;
26
+ languageFilter: import("vue").Ref<OptionType<string>[]>;
27
+ languageOptionList: import("vue").ComputedRef<OptionType<string>[]>;
28
+ fromDateFilter: import("vue").Ref<string>;
29
+ toDateFilter: import("vue").Ref<string>;
30
+ statusFilter: import("vue").Ref<OptionType<string>[]>;
31
+ statusOptionList: import("vue").ComputedRef<OptionType<string>[]>;
32
+ tags: import("vue").ComputedRef<import("@tager/admin-ui").FilterTagType[]>;
33
+ tagRemovalHandler: (event: import("@tager/admin-ui").FilterTagType) => void;
34
+ getStatuses: typeof getStatuses;
35
+ handleResourceClone: (entityId: string | number) => void;
36
+ isBusy: (postId: number) => boolean;
37
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
38
+ export default _default;
@@ -1 +1 @@
1
- export { useAdvancedSearch } from './useAdvancedSearch';
1
+ export { useAdvancedSearch } from './useAdvancedSearch';
@@ -1,24 +1,27 @@
1
- import { ComputedRef, Ref, SetupContext } from '@vue/composition-api';
2
- import { FilterTagType, OptionType } from '@tager/admin-ui';
3
- import { Category, Language } from '../../../../typings/model';
4
- interface Params {
5
- context: SetupContext;
6
- categoryList: ComputedRef<Category[]>;
7
- languageList: ComputedRef<Language[]>;
8
- statusOptionList: ComputedRef<OptionType[]>;
9
- }
10
- interface State {
11
- categoryFilter: Ref<OptionType[]>;
12
- categoryOptionList: ComputedRef<OptionType[]>;
13
- languageFilter: Ref<OptionType[]>;
14
- languageOptionList: ComputedRef<OptionType[]>;
15
- fromDateFilter: Ref<string>;
16
- toDateFilter: Ref<string>;
17
- statusFilter: Ref<OptionType[]>;
18
- filterParams: ComputedRef<Record<string, string | string[]>>;
19
- tags: ComputedRef<FilterTagType[]>;
20
- tagRemovalHandler(event: FilterTagType): void;
21
- }
22
- export declare const dateFormat: (date: string) => string;
23
- export declare function useAdvancedSearch({ context, categoryList, languageList, statusOptionList, }: Params): State;
24
- export {};
1
+ import { ComputedRef, Ref } from 'vue';
2
+ import { TFunction } from 'i18next';
3
+ import { RouteLocationNormalizedLoaded } from 'vue-router';
4
+ import { FilterTagType, OptionType } from '@tager/admin-ui';
5
+ import { Category, Language } from '../../../../typings/model';
6
+ interface Params {
7
+ categoryList: Ref<Category[]>;
8
+ languageList: ComputedRef<Language[]>;
9
+ statusOptionList: ComputedRef<OptionType[]>;
10
+ t: TFunction;
11
+ route: RouteLocationNormalizedLoaded;
12
+ }
13
+ interface State {
14
+ categoryFilter: Ref<OptionType[]>;
15
+ categoryOptionList: ComputedRef<OptionType[]>;
16
+ languageFilter: Ref<OptionType[]>;
17
+ languageOptionList: ComputedRef<OptionType[]>;
18
+ fromDateFilter: Ref<string>;
19
+ toDateFilter: Ref<string>;
20
+ statusFilter: Ref<OptionType[]>;
21
+ filterParams: ComputedRef<Record<string, string | string[]>>;
22
+ tags: ComputedRef<FilterTagType[]>;
23
+ tagRemovalHandler(event: FilterTagType): void;
24
+ }
25
+ export declare const dateFormat: (date: string) => string;
26
+ export declare function useAdvancedSearch({ t, route, categoryList, languageList, statusOptionList, }: Params): State;
27
+ export {};
@@ -1 +1 @@
1
- export { default } from './PostList.vue';
1
+ export { default } from './PostList.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tager/admin-blog",
3
- "version": "0.3.42",
3
+ "version": "1.0.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
@@ -10,65 +10,67 @@
10
10
  "typings",
11
11
  "src"
12
12
  ],
13
+ "exports": {
14
+ "./css": "./dist/style.css",
15
+ ".": "./dist/index.mjs"
16
+ },
13
17
  "scripts": {
18
+ "build:js": "vite build",
19
+ "build:package": "concurrently --success first \"yarn build:js\" \"yarn emit-declarations\"",
20
+ "emit-declarations": "vue-tsc --project tsconfig.json --emitDeclarationOnly",
14
21
  "start": "vue-cli-service serve",
15
- "lint": "vue-cli-service lint",
16
- "build": "rollup --config",
17
- "prepare": "yarn build",
18
- "tager:update": "node scripts/tager-update.js",
19
- "yalc:clean": "yalc remove --all"
22
+ "prepare": "yarn build:package",
23
+ "tager:update": "yarn upgrade --latest --scope @tager"
20
24
  },
21
25
  "dependencies": {
26
+ "filesize": "^9.0.11",
22
27
  "lodash.isequal": "^4.5.0",
28
+ "lodash.kebabcase": "^4.1.1",
23
29
  "lodash.pick": "^4.4.0",
24
30
  "path-to-regexp": "^6.1.0"
25
31
  },
26
32
  "devDependencies": {
27
- "@rollup/plugin-commonjs": "^15.0.0",
28
- "@rollup/plugin-node-resolve": "^9.0.0",
29
- "@tager/admin-dynamic-field": "^0.1.18",
30
- "@tager/admin-layout": "^0.5.4",
31
- "@tager/admin-services": "^0.2.26",
32
- "@tager/admin-ui": "^0.8.96",
33
- "@types/lodash.isequal": "^4.5.5",
34
- "@types/lodash.pick": "^4.4.6",
35
- "@types/node": "12.x",
36
- "@typescript-eslint/eslint-plugin": "^2.26.0",
37
- "@typescript-eslint/parser": "^2.26.0",
38
- "@vue/cli-plugin-babel": "~4.5.6",
39
- "@vue/cli-plugin-eslint": "~4.5.6",
40
- "@vue/cli-plugin-router": "~4.5.6",
41
- "@vue/cli-plugin-typescript": "~4.5.6",
42
- "@vue/cli-service": "~4.5.6",
43
- "@vue/composition-api": "^1.0.0-beta.14",
44
- "@vue/eslint-config-prettier": "^6.0.0",
45
- "@vue/eslint-config-typescript": "^5.1.0",
46
- "babel-eslint": "^10.1.0",
47
- "core-js": "^3.6.5",
48
- "eslint": "^6.7.2",
49
- "eslint-plugin-import": "^2.22.0",
50
- "eslint-plugin-prettier": "^3.1.4",
51
- "eslint-plugin-vue": "^6.2.2",
52
- "prettier": "^2.1.2",
53
- "rollup": "^2.27.1",
54
- "rollup-plugin-typescript2": "^0.27.2",
55
- "rollup-plugin-vue": "^5.1.9",
56
- "sass-loader": "^10.0.2",
57
- "typescript": "~3.9.10",
58
- "vue": "2.6.x",
59
- "vue-router": "^3.5.1",
60
- "vue-template-compiler": "^2.6.11"
33
+ "@babel/core": "^7.17.9",
34
+ "@babel/eslint-parser": "^7.17.0",
35
+ "@rushstack/eslint-patch": "^1.1.2",
36
+ "@tager/admin-dynamic-field": "^1.0.0",
37
+ "@tager/admin-layout": "^1.0.0",
38
+ "@tager/admin-services": "^1.0.0",
39
+ "@tager/admin-ui": "^1.0.1",
40
+ "@types/filesize": "^5.0.0",
41
+ "@types/lodash.isequal": "^4.5.6",
42
+ "@types/lodash.pick": "^4.4.7",
43
+ "@types/node": "16.x",
44
+ "@typescript-eslint/eslint-plugin": "^5.21.0",
45
+ "@typescript-eslint/parser": "^5.21.0",
46
+ "@vitejs/plugin-vue": "^2.3.1",
47
+ "@vue/cli-plugin-babel": "^5.0.4",
48
+ "@vue/cli-plugin-typescript": "^5.0.4",
49
+ "@vue/cli-service": "~5.0.0",
50
+ "@vue/eslint-config-prettier": "^7.0.0",
51
+ "@vue/eslint-config-typescript": "^10.0.0",
52
+ "concurrently": "^7.1.0",
53
+ "core-js": "^3.22.3",
54
+ "eslint": "^8.14.0",
55
+ "eslint-config-prettier": "^8.5.0",
56
+ "eslint-plugin-import": "^2.26.0",
57
+ "eslint-plugin-prettier": "^4.0.0",
58
+ "eslint-plugin-vue": "^8.7.1",
59
+ "pinia": "^2.0.21",
60
+ "sass": "^1.51.0",
61
+ "sass-loader": "^12.6.0",
62
+ "typescript": "^4.6.3",
63
+ "vite": "^2.9.6",
64
+ "vue": "^3.2.31",
65
+ "vue-router": "^4.0.14",
66
+ "vue-tsc": "^0.34.10"
61
67
  },
62
68
  "peerDependencies": {
63
- "@tager/admin-dynamic-field": ">=0.1.3",
64
- "@tager/admin-layout": ">=0.4.2",
65
- "@tager/admin-services": ">=0.2.12",
66
- "@tager/admin-ui": ">=0.7.5",
67
- "@vue/composition-api": ">=1.0.0-beta.14",
68
- "vue": "2.6.x"
69
- },
70
- "resolutions": {
71
- "prettier": "2.x"
69
+ "@tager/admin-layout": "^1.0.0",
70
+ "@tager/admin-services": "^1.0.0",
71
+ "@tager/admin-ui": "^1.0.1",
72
+ "vue": "^3.2.31",
73
+ "vue-router": "^4.0.14"
72
74
  },
73
75
  "publishConfig": {
74
76
  "access": "public"
@@ -1,28 +1,6 @@
1
- import { compile } from 'path-to-regexp';
2
-
3
1
  export const BLOG_ROUTE_PATHS = {
4
2
  POST_LIST: '/blog/posts',
5
3
  POST_FORM: '/blog/posts/:postId',
6
4
  CATEGORY_LIST: '/blog/categories',
7
5
  CATEGORY_FORM: '/blog/categories/:categoryId',
8
6
  } as const;
9
-
10
- export function getBlogPostListUrl() {
11
- return BLOG_ROUTE_PATHS.POST_LIST;
12
- }
13
-
14
- export function getBlogPostFormUrl(params: { postId: number | string }) {
15
- return compile(BLOG_ROUTE_PATHS.POST_FORM)({ postId: params.postId });
16
- }
17
-
18
- export function getBlogCategoryListUrl() {
19
- return BLOG_ROUTE_PATHS.CATEGORY_LIST;
20
- }
21
-
22
- export function getBlogCategoryFormUrl(params: {
23
- categoryId: number | string;
24
- }) {
25
- return compile(BLOG_ROUTE_PATHS.CATEGORY_FORM)({
26
- categoryId: params.categoryId,
27
- });
28
- }
@@ -1,4 +1,4 @@
1
- import { CustomRoute, CustomRouteConfig } from '@tager/admin-layout';
1
+ import { type RouteRecordRaw } from 'vue-router';
2
2
 
3
3
  import BlogPostList from '../views/Posts/PostList';
4
4
  import BlogPostForm from '../views/Posts/PostForm';
@@ -7,24 +7,24 @@ import BlogCategoryForm from '../views/Categories/CategoryForm';
7
7
 
8
8
  import { BLOG_ROUTE_PATHS } from './paths';
9
9
 
10
- export const BLOG_POST_LIST_ROUTE: CustomRouteConfig = {
10
+ export const BLOG_POST_LIST_ROUTE: RouteRecordRaw = {
11
11
  path: BLOG_ROUTE_PATHS.POST_LIST,
12
12
  component: BlogPostList,
13
13
  name: 'All posts',
14
14
  meta: {
15
- getBreadcrumbs: (route, t) => [
15
+ getBreadcrumbs: (route, { t }) => [
16
16
  { url: '/', text: t('blog:home') },
17
17
  { url: BLOG_ROUTE_PATHS.POST_LIST, text: t('blog:allPosts') },
18
18
  ],
19
19
  },
20
20
  };
21
21
 
22
- export const BLOG_POST_FORM_ROUTE: CustomRouteConfig = {
22
+ export const BLOG_POST_FORM_ROUTE: RouteRecordRaw = {
23
23
  path: BLOG_ROUTE_PATHS.POST_FORM,
24
24
  component: BlogPostForm,
25
25
  name: 'Post Form',
26
26
  meta: {
27
- getBreadcrumbs: (route: CustomRoute, t) => [
27
+ getBreadcrumbs: (route, { t }) => [
28
28
  { url: '/', text: t('blog:home') },
29
29
  { url: BLOG_ROUTE_PATHS.POST_LIST, text: t('blog:allPosts') },
30
30
  { url: route.path, text: t('blog:postForm') },
@@ -32,24 +32,24 @@ export const BLOG_POST_FORM_ROUTE: CustomRouteConfig = {
32
32
  },
33
33
  };
34
34
 
35
- export const BLOG_CATEGORY_LIST_ROUTE: CustomRouteConfig = {
35
+ export const BLOG_CATEGORY_LIST_ROUTE: RouteRecordRaw = {
36
36
  path: BLOG_ROUTE_PATHS.CATEGORY_LIST,
37
37
  component: BlogCategoryList,
38
38
  name: 'All categories',
39
39
  meta: {
40
- getBreadcrumbs: (route, t) => [
40
+ getBreadcrumbs: (route, { t }) => [
41
41
  { url: '/', text: t('blog:home') },
42
42
  { url: BLOG_ROUTE_PATHS.CATEGORY_LIST, text: t('blog:allCategories') },
43
43
  ],
44
44
  },
45
45
  };
46
46
 
47
- export const BLOG_CATEGORY_FORM_ROUTE: CustomRouteConfig = {
47
+ export const BLOG_CATEGORY_FORM_ROUTE: RouteRecordRaw = {
48
48
  path: BLOG_ROUTE_PATHS.CATEGORY_FORM,
49
49
  component: BlogCategoryForm,
50
50
  name: 'Category Form',
51
51
  meta: {
52
- getBreadcrumbs: (route: CustomRoute, t) => [
52
+ getBreadcrumbs: (route, { t }) => [
53
53
  { url: '/', text: t('blog:home') },
54
54
  { url: BLOG_ROUTE_PATHS.CATEGORY_LIST, text: t('blog:allCategories') },
55
55
  { url: route.path, text: t('blog:categoryForm') },
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <PageLayout :sidebar-menu-list="sidebarMenuList">
3
+ <router-view />
4
+ </PageLayout>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ import { defineComponent } from 'vue';
9
+
10
+ import { MenuItemType, PageLayout } from '@tager/admin-layout';
11
+ import { ViewListIcon } from '@tager/admin-ui';
12
+ import { useI18n } from '@tager/admin-services';
13
+
14
+ import {
15
+ getBlogCategoryFormUrl,
16
+ getBlogCategoryListUrl,
17
+ getBlogPostFormUrl,
18
+ getBlogPostListUrl,
19
+ } from '../utils/paths';
20
+
21
+ export default defineComponent({
22
+ name: 'App',
23
+ components: {
24
+ PageLayout,
25
+ },
26
+ setup() {
27
+ const i18n = useI18n();
28
+
29
+ const sidebarMenuList: Array<MenuItemType> = [
30
+ {
31
+ id: 'blog',
32
+ text: i18n.t('blog:blog'),
33
+ icon: ViewListIcon,
34
+ children: [
35
+ {
36
+ text: i18n.t('blog:createPost'),
37
+ url: getBlogPostFormUrl({ postId: 'create' }),
38
+ },
39
+ { text: i18n.t('blog:posts'), url: getBlogPostListUrl() },
40
+ {
41
+ text: i18n.t('blog:createCategory'),
42
+ url: getBlogCategoryFormUrl({ categoryId: 'create' }),
43
+ },
44
+ { text: i18n.t('blog:categories'), url: getBlogCategoryListUrl() },
45
+ ],
46
+ },
47
+ ];
48
+
49
+ return {
50
+ sidebarMenuList,
51
+ };
52
+ },
53
+ });
54
+ </script>
55
+
56
+ <style scoped lang="scss"></style>
@@ -0,0 +1,23 @@
1
+ import type { AppConfigType } from '@tager/admin-services';
2
+
3
+ export const OZITAG_CONFIG: AppConfigType = {
4
+ APP_NAME: 'OZiTAG_ADMIN',
5
+ TITLE_TEMPLATE: 'OZiTAG Admin - {{title}}',
6
+ LANGUAGE: 'EN',
7
+ BRAND: {
8
+ small: {
9
+ logo: 'logo-small.svg',
10
+ },
11
+ large: {
12
+ logo: 'logo.svg',
13
+ label: 'OZiTAG',
14
+ 'label-color': '#DD6900',
15
+ },
16
+ subtitle: '',
17
+ },
18
+ SPLASH_SCREEN: {
19
+ enabled: true,
20
+ logo: 'logo-white.svg',
21
+ background: '#1e1e1e',
22
+ },
23
+ };
package/src/dev/env.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { initializeEnvironment } from '@tager/admin-services';
2
+
3
+ export function populateEnvironment() {
4
+ initializeEnvironment({
5
+ publicPath: process.env.VUE_APP_PUBLIC_PATH,
6
+ appEnv: process.env.VUE_APP_ENV,
7
+ apiUrl: process.env.VUE_APP_API_URL,
8
+ accessToken: process.env.VUE_APP_ACCESS_TOKEN,
9
+ websiteUrl: process.env.VUE_APP_WEBSITE_URL,
10
+ websiteButtonUrl: process.env.VUE_APP_WEBSITE_BUTTON_URL,
11
+ sentryDsn: process.env.VUE_APP_SENTRY_DSN,
12
+ sentryEnv: process.env.VUE_APP_SENTRY_ENVIRONMENT,
13
+ baseUrl: process.env.BASE_URL,
14
+ nodeEnv: process.env.NODE_ENV,
15
+ version: process.env.VUE_APP_VERSION,
16
+ });
17
+ }
@@ -0,0 +1,49 @@
1
+ import { createApp } from 'vue';
2
+ import { createPinia } from 'pinia';
3
+
4
+ import { configStore, i18n, i18nPlugin } from '@tager/admin-services';
5
+ import { createRouter } from '@tager/admin-layout';
6
+ import '@tager/admin-ui/css';
7
+ import '@tager/admin-layout/css';
8
+ import '@tager/admin-dynamic-field/css';
9
+
10
+ import { applyTranslations } from '../locales/apply';
11
+ import {
12
+ BLOG_POST_LIST_ROUTE,
13
+ BLOG_CATEGORY_FORM_ROUTE,
14
+ BLOG_CATEGORY_LIST_ROUTE,
15
+ BLOG_POST_FORM_ROUTE,
16
+ } from '../constants/routes';
17
+
18
+ import { OZITAG_CONFIG } from './config';
19
+ import App from './App.vue';
20
+ import { populateEnvironment } from './env';
21
+
22
+ populateEnvironment();
23
+
24
+ configStore.setConfig(OZITAG_CONFIG);
25
+
26
+ const router = createRouter(
27
+ {
28
+ routes: [
29
+ BLOG_POST_LIST_ROUTE,
30
+ BLOG_CATEGORY_FORM_ROUTE,
31
+ BLOG_CATEGORY_LIST_ROUTE,
32
+ BLOG_POST_FORM_ROUTE,
33
+ ],
34
+ },
35
+ { useTitleSync: false }
36
+ );
37
+
38
+ const app = createApp(App);
39
+ const pinia = createPinia();
40
+
41
+ app.use(router);
42
+ app.use(i18nPlugin);
43
+ app.use(pinia);
44
+
45
+ applyTranslations();
46
+
47
+ i18n.init({ debug: true, lng: 'ru' }).then(() => {
48
+ app.mount('#app');
49
+ });
@@ -1,19 +1,14 @@
1
- import { onMounted, SetupContext } from '@vue/composition-api';
1
+ import { onMounted } from 'vue';
2
2
 
3
3
  import { ResourceRef, useResource } from '@tager/admin-services';
4
4
 
5
5
  import { Category } from '../typings/model';
6
6
  import { getCategories } from '../services/requests';
7
7
 
8
- export function useFetchCategories({
9
- context,
10
- }: {
11
- context: SetupContext;
12
- }): ResourceRef<Category[]> {
8
+ export function useFetchCategories(): ResourceRef<Category[]> {
13
9
  const [fetchCategories, resource] = useResource<Category[]>({
14
10
  fetchResource: getCategories,
15
11
  initialValue: [],
16
- context,
17
12
  resourceName: 'Blog categories',
18
13
  });
19
14
 
@@ -1,4 +1,4 @@
1
- import { onMounted, Ref, SetupContext, watch } from '@vue/composition-api';
1
+ import { onMounted, Ref, watch } from 'vue';
2
2
 
3
3
  import { Nullable, ResourceRef, useResource } from '@tager/admin-services';
4
4
 
@@ -6,23 +6,20 @@ import { Category } from '../typings/model';
6
6
  import { getCategory } from '../services/requests';
7
7
 
8
8
  export function useFetchCategory({
9
- context,
10
9
  categoryId,
11
10
  isCreation,
12
11
  }: {
13
- context: SetupContext;
14
12
  categoryId: Ref<string>;
15
13
  isCreation: Ref<boolean>;
16
14
  }): ResourceRef<Nullable<Category>> {
17
15
  const [fetchCategory, resource] = useResource<Nullable<Category>>({
18
16
  fetchResource: () => getCategory(categoryId.value),
19
17
  initialValue: null,
20
- context,
21
18
  resourceName: 'Blog category',
22
19
  });
23
20
 
24
21
  onMounted(() => {
25
- if (isCreation.value) {
22
+ if (isCreation.value || !categoryId.value) {
26
23
  return;
27
24
  }
28
25
 
@@ -30,7 +27,7 @@ export function useFetchCategory({
30
27
  });
31
28
 
32
29
  watch(categoryId, () => {
33
- if (isCreation.value) {
30
+ if (isCreation.value || !categoryId.value) {
34
31
  return;
35
32
  }
36
33