@tager/admin-banners 0.3.6 → 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.
- package/dist/constants/paths.d.ts +5 -10
- package/dist/constants/routes.d.ts +4 -4
- package/dist/dev/App.vue.d.ts +5 -0
- package/dist/dev/config.d.ts +2 -0
- package/dist/dev/env.d.ts +1 -0
- package/dist/dev/main.d.ts +3 -0
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/useFetchBanner.d.ts +7 -8
- package/dist/hooks/useFetchBanners.d.ts +3 -6
- package/dist/hooks/useFetchZoneFields.d.ts +7 -0
- package/dist/hooks/useFetchZones.d.ts +3 -6
- package/dist/index.mjs +1008 -0
- package/dist/locales/apply.d.ts +1 -0
- package/dist/locales/en.d.ts +41 -41
- package/dist/locales/ru.d.ts +2 -3
- package/dist/main.d.ts +3 -4
- package/dist/services/requests.d.ts +25 -24
- package/dist/style.css +1 -0
- package/dist/typings/banners.d.ts +47 -43
- package/dist/typings/common.d.ts +1 -1
- package/dist/typings/model.d.ts +104 -104
- package/dist/typings/zones.d.ts +9 -5
- package/dist/utils/common.d.ts +2 -2
- package/dist/utils/paths.d.ts +5 -0
- package/dist/views/Banners/BannerForm/BannerForm.helpers.d.ts +5 -5
- package/dist/views/Banners/BannerForm/BannerForm.vue.d.ts +2694 -83
- package/dist/views/Banners/BannerForm/index.d.ts +1 -1
- package/dist/views/Banners/BannerList/BannerList.helpers.d.ts +6 -6
- package/dist/views/Banners/BannerList/BannerList.vue.d.ts +25 -55
- package/dist/views/Banners/BannerList/hooks/index.d.ts +1 -1
- package/dist/views/Banners/BannerList/hooks/useAdvancedSearch.d.ts +22 -21
- package/dist/views/Banners/BannerList/index.d.ts +1 -1
- package/dist/views/Zones/ZoneList/ZoneList.helpers.d.ts +5 -5
- package/dist/views/Zones/ZoneList/ZoneList.vue.d.ts +11 -28
- package/dist/views/Zones/ZoneList/index.d.ts +1 -1
- package/package.json +51 -49
- package/src/constants/paths.ts +1 -15
- package/src/constants/routes.ts +7 -7
- package/src/dev/App.vue +46 -0
- package/src/dev/config.ts +23 -0
- package/src/dev/env.ts +17 -0
- package/src/dev/main.ts +47 -0
- package/src/hooks/useFetchBanner.ts +3 -6
- package/src/hooks/useFetchBanners.ts +2 -5
- package/src/hooks/useFetchZoneFields.ts +39 -0
- package/src/hooks/useFetchZones.ts +2 -5
- package/src/locales/apply.ts +9 -0
- package/src/locales/en.ts +1 -1
- package/src/locales/ru.ts +40 -42
- package/src/main.ts +3 -8
- package/src/services/requests.ts +7 -1
- package/src/typings/banners.ts +10 -1
- package/src/typings/zones.ts +6 -0
- package/src/utils/paths.ts +15 -0
- package/src/views/Banners/BannerForm/BannerForm.helpers.ts +7 -1
- package/src/views/Banners/BannerForm/BannerForm.vue +183 -137
- package/src/views/Banners/BannerList/BannerList.vue +64 -61
- package/src/views/Banners/BannerList/hooks/useAdvancedSearch.ts +36 -16
- package/src/views/Zones/ZoneList/ZoneList.helpers.ts +1 -1
- package/src/views/Zones/ZoneList/ZoneList.vue +18 -19
- package/CHANGELOG.md +0 -13
- package/dist/constants/menu.d.ts +0 -5
- package/dist/dev.d.ts +0 -1
- package/dist/index.esm.js +0 -3660
- package/dist/index.umd.js +0 -3679
- package/dist/router/index.d.ts +0 -4
- package/src/constants/menu.ts +0 -26
- package/src/dev.ts +0 -34
- package/src/router/index.ts +0 -38
- package/src/typings/sfc.d.ts +0 -12
- package/src/typings/shims-tsx.d.ts +0 -13
- package/src/typings/shims-vue.d.ts +0 -11
- package/src/views/App.vue +0 -22
- package/src/views/Home.vue +0 -37
|
@@ -1,12 +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, SetupContext, watch } from 'vue';
|
|
9
2
|
import { TFunction } from 'i18next';
|
|
3
|
+
import { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
10
4
|
|
|
11
5
|
import {
|
|
12
6
|
FilterTagType,
|
|
@@ -15,15 +9,16 @@ import {
|
|
|
15
9
|
getFilterParams,
|
|
16
10
|
OptionType,
|
|
17
11
|
} from '@tager/admin-ui';
|
|
12
|
+
import { isNotNullish } from '@tager/admin-services';
|
|
18
13
|
|
|
19
14
|
import { Zone } from '../../../../typings/zones';
|
|
20
15
|
import { Status } from '../../../../typings/banners';
|
|
21
16
|
import { getStatus } from '../BannerList.helpers';
|
|
22
17
|
|
|
23
18
|
interface Params {
|
|
24
|
-
context: SetupContext;
|
|
25
19
|
t: TFunction;
|
|
26
|
-
zoneList:
|
|
20
|
+
zoneList: Ref<Zone[]>;
|
|
21
|
+
route: RouteLocationNormalizedLoaded;
|
|
27
22
|
}
|
|
28
23
|
|
|
29
24
|
interface State {
|
|
@@ -34,6 +29,7 @@ interface State {
|
|
|
34
29
|
statusesOptionList: ComputedRef<OptionType[]>;
|
|
35
30
|
filterParams: ComputedRef<Record<string, string | string[]>>;
|
|
36
31
|
tags: ComputedRef<FilterTagType[]>;
|
|
32
|
+
|
|
37
33
|
tagRemovalHandler(event: FilterTagType): void;
|
|
38
34
|
}
|
|
39
35
|
|
|
@@ -43,7 +39,7 @@ enum FilterTypes {
|
|
|
43
39
|
Status = 'status',
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
export function useAdvancedSearch({
|
|
42
|
+
export function useAdvancedSearch({ t, zoneList, route }: Params): State {
|
|
47
43
|
/** Zone **/
|
|
48
44
|
|
|
49
45
|
const zonesOptionList = computed<OptionType[]>(() =>
|
|
@@ -55,7 +51,7 @@ export function useAdvancedSearch({ context, t, zoneList }: Params): State {
|
|
|
55
51
|
|
|
56
52
|
const initialZoneFilter = computed<OptionType[]>(() => {
|
|
57
53
|
const queryValue = getFilterParamAsStringArray(
|
|
58
|
-
|
|
54
|
+
route.query,
|
|
59
55
|
FilterTypes.Zone
|
|
60
56
|
);
|
|
61
57
|
return zonesOptionList.value.filter(({ value }) =>
|
|
@@ -72,8 +68,7 @@ export function useAdvancedSearch({ context, t, zoneList }: Params): State {
|
|
|
72
68
|
/** Date **/
|
|
73
69
|
|
|
74
70
|
const initialDateFilter = computed<string>(
|
|
75
|
-
() =>
|
|
76
|
-
getFilterParamAsString(context.root.$route.query, FilterTypes.Date) ?? ''
|
|
71
|
+
() => getFilterParamAsString(route.query, FilterTypes.Date) ?? ''
|
|
77
72
|
);
|
|
78
73
|
|
|
79
74
|
const dateFilter = ref<string>(initialDateFilter.value);
|
|
@@ -93,7 +88,7 @@ export function useAdvancedSearch({ context, t, zoneList }: Params): State {
|
|
|
93
88
|
|
|
94
89
|
const initialStatusFilter = computed<OptionType[]>(() => {
|
|
95
90
|
const queryValue = getFilterParamAsStringArray(
|
|
96
|
-
|
|
91
|
+
route.query,
|
|
97
92
|
FilterTypes.Status
|
|
98
93
|
);
|
|
99
94
|
return statusesOptionList.value.filter(({ value }) =>
|
|
@@ -137,7 +132,32 @@ export function useAdvancedSearch({ context, t, zoneList }: Params): State {
|
|
|
137
132
|
|
|
138
133
|
/** Tags **/
|
|
139
134
|
|
|
140
|
-
const tags = computed<FilterTagType[]>(() =>
|
|
135
|
+
const tags = computed<FilterTagType[]>(() =>
|
|
136
|
+
[
|
|
137
|
+
...zoneFilter.value.map(({ value, label }) => ({
|
|
138
|
+
value,
|
|
139
|
+
label,
|
|
140
|
+
name: FilterTypes.Zone,
|
|
141
|
+
title: t('banners:zone'),
|
|
142
|
+
})),
|
|
143
|
+
|
|
144
|
+
...statusFilter.value.map(({ value, label }) => ({
|
|
145
|
+
value,
|
|
146
|
+
label,
|
|
147
|
+
name: FilterTypes.Status,
|
|
148
|
+
title: t('banners:status'),
|
|
149
|
+
})),
|
|
150
|
+
|
|
151
|
+
dateFilter.value
|
|
152
|
+
? {
|
|
153
|
+
value: dateFilter.value,
|
|
154
|
+
label: dateFilter.value,
|
|
155
|
+
name: FilterTypes.Date,
|
|
156
|
+
title: t('banners:date'),
|
|
157
|
+
}
|
|
158
|
+
: null,
|
|
159
|
+
].filter(isNotNullish)
|
|
160
|
+
);
|
|
141
161
|
|
|
142
162
|
return {
|
|
143
163
|
zoneFilter,
|
|
@@ -3,7 +3,7 @@ import { TFunction } from 'i18next';
|
|
|
3
3
|
import { ColumnDefinition } from '@tager/admin-ui';
|
|
4
4
|
|
|
5
5
|
import { Zone } from '../../../typings/zones';
|
|
6
|
-
import { getBannersBannerListUrl } from '../../../
|
|
6
|
+
import { getBannersBannerListUrl } from '../../../utils/paths';
|
|
7
7
|
|
|
8
8
|
export function getColumnDefs(t: TFunction): ColumnDefinition<Zone>[] {
|
|
9
9
|
return [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<template
|
|
4
|
-
<
|
|
2
|
+
<Page :title="$i18n.t('banners:zones')">
|
|
3
|
+
<template #content>
|
|
4
|
+
<DataTable
|
|
5
5
|
:column-defs="columnDefs"
|
|
6
6
|
:row-data="rowData"
|
|
7
7
|
:loading="isRowDataLoading"
|
|
@@ -11,29 +11,26 @@
|
|
|
11
11
|
:use-pagination="false"
|
|
12
12
|
@change="handleChange"
|
|
13
13
|
>
|
|
14
|
-
<template
|
|
15
|
-
<
|
|
14
|
+
<template #cell(banners-count)="{ row }">
|
|
15
|
+
<CountButton
|
|
16
16
|
:href="getLinkToBannersByZone(row.id)"
|
|
17
17
|
variant="outline-secondary"
|
|
18
18
|
:count="row.bannersCount"
|
|
19
19
|
>
|
|
20
|
-
{{ $t('banners:banners') }}
|
|
21
|
-
</
|
|
20
|
+
{{ $i18n.t('banners:banners') }}
|
|
21
|
+
</CountButton>
|
|
22
22
|
</template>
|
|
23
|
-
</
|
|
23
|
+
</DataTable>
|
|
24
24
|
</template>
|
|
25
|
-
</
|
|
25
|
+
</Page>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script lang="ts">
|
|
29
|
-
import {
|
|
30
|
-
computed,
|
|
31
|
-
defineComponent,
|
|
32
|
-
onMounted,
|
|
33
|
-
SetupContext,
|
|
34
|
-
} from '@vue/composition-api';
|
|
29
|
+
import { computed, defineComponent, onMounted, SetupContext } from 'vue';
|
|
35
30
|
|
|
36
|
-
import { useDataTable } from '@tager/admin-ui';
|
|
31
|
+
import { CountButton, useDataTable, DataTable } from '@tager/admin-ui';
|
|
32
|
+
import { Page } from '@tager/admin-layout';
|
|
33
|
+
import { useI18n } from '@tager/admin-services';
|
|
37
34
|
|
|
38
35
|
import { Zone } from '../../../typings/zones';
|
|
39
36
|
import { getZones } from '../../../services/requests';
|
|
@@ -42,7 +39,10 @@ import { getColumnDefs, getLinkToBannersByZone } from './ZoneList.helpers';
|
|
|
42
39
|
|
|
43
40
|
export default defineComponent({
|
|
44
41
|
name: 'ZoneList',
|
|
45
|
-
|
|
42
|
+
components: { CountButton, Page, DataTable },
|
|
43
|
+
setup() {
|
|
44
|
+
const i18n = useI18n();
|
|
45
|
+
|
|
46
46
|
const {
|
|
47
47
|
fetchEntityList: fetchZones,
|
|
48
48
|
isLoading: isZonesLoading,
|
|
@@ -52,7 +52,6 @@ export default defineComponent({
|
|
|
52
52
|
} = useDataTable<Zone>({
|
|
53
53
|
fetchEntityList: getZones,
|
|
54
54
|
initialValue: [],
|
|
55
|
-
context,
|
|
56
55
|
resourceName: 'Banner Zones',
|
|
57
56
|
});
|
|
58
57
|
|
|
@@ -60,7 +59,7 @@ export default defineComponent({
|
|
|
60
59
|
fetchZones();
|
|
61
60
|
});
|
|
62
61
|
|
|
63
|
-
const columnDefs = computed(() => getColumnDefs(
|
|
62
|
+
const columnDefs = computed(() => getColumnDefs(i18n.t));
|
|
64
63
|
|
|
65
64
|
return {
|
|
66
65
|
columnDefs,
|
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
|
-
|
package/dist/constants/menu.d.ts
DELETED
package/dist/dev.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@tager/admin-ui/dist/admin-ui.css';
|