@tager/admin-banners 0.3.7 → 1.0.0
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 -8
- package/dist/hooks/useFetchZones.d.ts +3 -6
- package/dist/index.mjs +993 -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 -25
- package/dist/style.css +1 -0
- package/dist/typings/banners.d.ts +47 -47
- package/dist/typings/common.d.ts +1 -1
- package/dist/typings/model.d.ts +104 -104
- package/dist/typings/zones.d.ts +9 -9
- 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 -9251
- 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 +23 -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 +1 -10
- 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/utils/paths.ts +15 -0
- package/src/views/Banners/BannerForm/BannerForm.vue +97 -80
- package/src/views/Banners/BannerList/BannerList.vue +60 -47
- package/src/views/Banners/BannerList/hooks/useAdvancedSearch.ts +14 -14
- 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 -3709
- package/dist/index.umd.js +0 -3728
- 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,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
:title="$t('banners:banners')"
|
|
2
|
+
<Page
|
|
3
|
+
:title="$i18n.t('banners:banners')"
|
|
4
4
|
:header-buttons="[
|
|
5
5
|
{
|
|
6
|
-
text: $t('banners:createBanner'),
|
|
6
|
+
text: $i18n.t('banners:createBanner'),
|
|
7
7
|
href: getBannersBannerFormUrl({ bannerId: 'create' }),
|
|
8
8
|
},
|
|
9
9
|
]"
|
|
10
10
|
>
|
|
11
|
-
<template
|
|
12
|
-
<
|
|
11
|
+
<template #content>
|
|
12
|
+
<DataTable
|
|
13
13
|
:column-defs="columnDefs"
|
|
14
14
|
:row-data="rowData"
|
|
15
15
|
:loading="isRowDataLoading"
|
|
@@ -26,82 +26,85 @@
|
|
|
26
26
|
}"
|
|
27
27
|
@change="handleChange"
|
|
28
28
|
>
|
|
29
|
-
<template
|
|
30
|
-
<
|
|
29
|
+
<template #filters>
|
|
30
|
+
<AdvancedSearch :tags="tags" @click:tag="tagRemovalHandler">
|
|
31
31
|
<div class="filters">
|
|
32
|
-
<
|
|
33
|
-
v-model="zoneFilter"
|
|
32
|
+
<FormFieldMultiSelect
|
|
33
|
+
v-model:selected-options="zoneFilter"
|
|
34
34
|
:options="zonesOptionList"
|
|
35
35
|
name="zoneFilter"
|
|
36
36
|
:searchable="true"
|
|
37
|
-
:label="$t('banners:zone')"
|
|
37
|
+
:label="$i18n.t('banners:zone')"
|
|
38
38
|
class="filter"
|
|
39
39
|
/>
|
|
40
40
|
|
|
41
|
-
<
|
|
42
|
-
v-model="dateFilter"
|
|
43
|
-
:label="$t('banners:date')"
|
|
41
|
+
<FormField
|
|
42
|
+
v-model:value="dateFilter"
|
|
43
|
+
:label="$i18n.t('banners:date')"
|
|
44
44
|
name="dateFilter"
|
|
45
45
|
type="date"
|
|
46
46
|
class="filter"
|
|
47
47
|
/>
|
|
48
48
|
|
|
49
|
-
<
|
|
50
|
-
v-model="statusFilter"
|
|
49
|
+
<FormFieldMultiSelect
|
|
50
|
+
v-model:selected-options="statusFilter"
|
|
51
51
|
:options="statusesOptionList"
|
|
52
52
|
name="statusFilter"
|
|
53
53
|
:searchable="true"
|
|
54
|
-
:label="$t('banners:status')"
|
|
54
|
+
:label="$i18n.t('banners:status')"
|
|
55
55
|
class="filter"
|
|
56
56
|
/>
|
|
57
57
|
</div>
|
|
58
|
-
</
|
|
58
|
+
</AdvancedSearch>
|
|
59
59
|
</template>
|
|
60
60
|
|
|
61
|
-
<template
|
|
62
|
-
<
|
|
61
|
+
<template #cell(actions)="{ row }">
|
|
62
|
+
<BaseButton
|
|
63
63
|
variant="icon"
|
|
64
|
-
:title="$t('banners:edit')"
|
|
64
|
+
:title="$i18n.t('banners:edit')"
|
|
65
65
|
:disabled="isBusy(row.id)"
|
|
66
66
|
:href="getBannersBannerFormUrl({ bannerId: row.id })"
|
|
67
67
|
>
|
|
68
|
-
<
|
|
69
|
-
</
|
|
68
|
+
<EditIcon />
|
|
69
|
+
</BaseButton>
|
|
70
70
|
|
|
71
|
-
<
|
|
71
|
+
<BaseButton
|
|
72
72
|
variant="icon"
|
|
73
|
-
:title="$t('banners:remove')"
|
|
73
|
+
:title="$i18n.t('banners:remove')"
|
|
74
74
|
:disabled="isBusy(row.id)"
|
|
75
75
|
@click="handleResourceDelete(row.id)"
|
|
76
76
|
>
|
|
77
|
-
<
|
|
78
|
-
</
|
|
77
|
+
<DeleteIcon />
|
|
78
|
+
</BaseButton>
|
|
79
79
|
</template>
|
|
80
|
-
</
|
|
80
|
+
</DataTable>
|
|
81
81
|
</template>
|
|
82
|
-
</
|
|
82
|
+
</Page>
|
|
83
83
|
</template>
|
|
84
84
|
|
|
85
85
|
<script lang="ts">
|
|
86
|
-
import {
|
|
87
|
-
computed,
|
|
88
|
-
defineComponent,
|
|
89
|
-
SetupContext,
|
|
90
|
-
watch,
|
|
91
|
-
} from '@vue/composition-api';
|
|
86
|
+
import { computed, defineComponent, SetupContext, watch } from 'vue';
|
|
92
87
|
import isEqual from 'lodash.isequal';
|
|
93
88
|
import pick from 'lodash.pick';
|
|
89
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
94
90
|
|
|
95
91
|
import {
|
|
96
92
|
ColumnDefinition,
|
|
97
93
|
useDataTable,
|
|
98
|
-
|
|
94
|
+
DataTable,
|
|
95
|
+
AdvancedSearch,
|
|
96
|
+
FormFieldMultiSelect,
|
|
97
|
+
FormField,
|
|
98
|
+
BaseButton,
|
|
99
|
+
EditIcon,
|
|
100
|
+
DeleteIcon,
|
|
99
101
|
} from '@tager/admin-ui';
|
|
100
|
-
import { useResourceDelete } from '@tager/admin-services';
|
|
102
|
+
import { useI18n, useResourceDelete } from '@tager/admin-services';
|
|
103
|
+
import { Page } from '@tager/admin-layout';
|
|
101
104
|
|
|
102
105
|
import { deleteBanner, getBanners } from '../../../services/requests';
|
|
103
106
|
import { Banner } from '../../../typings/banners';
|
|
104
|
-
import { getBannersBannerFormUrl } from '../../../
|
|
107
|
+
import { getBannersBannerFormUrl } from '../../../utils/paths';
|
|
105
108
|
import { useFetchZones } from '../../../hooks';
|
|
106
109
|
|
|
107
110
|
import { getColumnDefs } from './BannerList.helpers';
|
|
@@ -109,11 +112,22 @@ import { useAdvancedSearch } from './hooks';
|
|
|
109
112
|
|
|
110
113
|
export default defineComponent({
|
|
111
114
|
name: 'BannerList',
|
|
115
|
+
components: {
|
|
116
|
+
DeleteIcon,
|
|
117
|
+
EditIcon,
|
|
118
|
+
BaseButton,
|
|
119
|
+
FormField,
|
|
120
|
+
FormFieldMultiSelect,
|
|
121
|
+
AdvancedSearch,
|
|
122
|
+
Page,
|
|
123
|
+
DataTable,
|
|
124
|
+
},
|
|
112
125
|
setup(props, context: SetupContext) {
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
const route = useRoute();
|
|
127
|
+
const router = useRouter();
|
|
128
|
+
const { t } = useI18n();
|
|
129
|
+
|
|
130
|
+
const { loading: isZonesLoading, data: zoneList } = useFetchZones();
|
|
117
131
|
|
|
118
132
|
const {
|
|
119
133
|
zoneFilter,
|
|
@@ -128,6 +142,7 @@ export default defineComponent({
|
|
|
128
142
|
context,
|
|
129
143
|
t,
|
|
130
144
|
zoneList,
|
|
145
|
+
route,
|
|
131
146
|
});
|
|
132
147
|
|
|
133
148
|
const {
|
|
@@ -149,7 +164,6 @@ export default defineComponent({
|
|
|
149
164
|
...filterParams.value,
|
|
150
165
|
}),
|
|
151
166
|
initialValue: [],
|
|
152
|
-
context,
|
|
153
167
|
resourceName: 'Banners',
|
|
154
168
|
});
|
|
155
169
|
|
|
@@ -159,12 +173,12 @@ export default defineComponent({
|
|
|
159
173
|
}
|
|
160
174
|
|
|
161
175
|
const newQuery = {
|
|
162
|
-
...pick(
|
|
176
|
+
...pick(route.query, ['query', 'pageNumber']),
|
|
163
177
|
...filterParams.value,
|
|
164
178
|
};
|
|
165
179
|
|
|
166
|
-
if (!isEqual(
|
|
167
|
-
|
|
180
|
+
if (!isEqual(route.query, newQuery)) {
|
|
181
|
+
router.replace({ query: newQuery });
|
|
168
182
|
fetchBanners();
|
|
169
183
|
}
|
|
170
184
|
});
|
|
@@ -173,7 +187,6 @@ export default defineComponent({
|
|
|
173
187
|
deleteResource: deleteBanner,
|
|
174
188
|
resourceName: 'Banner',
|
|
175
189
|
onSuccess: fetchBanners,
|
|
176
|
-
context,
|
|
177
190
|
});
|
|
178
191
|
|
|
179
192
|
const isBusy = (bannerId: number): boolean => {
|
|
@@ -181,7 +194,7 @@ export default defineComponent({
|
|
|
181
194
|
};
|
|
182
195
|
|
|
183
196
|
const columnDefs = computed<ColumnDefinition<Banner>[]>(() =>
|
|
184
|
-
getColumnDefs(zoneList.value,
|
|
197
|
+
getColumnDefs(zoneList.value, t)
|
|
185
198
|
);
|
|
186
199
|
|
|
187
200
|
const isRowDataLoading = computed<boolean>(
|
|
@@ -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,
|
|
@@ -23,7 +17,8 @@ import { getStatus } from '../BannerList.helpers';
|
|
|
23
17
|
interface Params {
|
|
24
18
|
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,12 @@ enum FilterTypes {
|
|
|
43
39
|
Status = 'status',
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
export function useAdvancedSearch({
|
|
42
|
+
export function useAdvancedSearch({
|
|
43
|
+
context,
|
|
44
|
+
t,
|
|
45
|
+
zoneList,
|
|
46
|
+
route,
|
|
47
|
+
}: Params): State {
|
|
47
48
|
/** Zone **/
|
|
48
49
|
|
|
49
50
|
const zonesOptionList = computed<OptionType[]>(() =>
|
|
@@ -55,7 +56,7 @@ export function useAdvancedSearch({ context, t, zoneList }: Params): State {
|
|
|
55
56
|
|
|
56
57
|
const initialZoneFilter = computed<OptionType[]>(() => {
|
|
57
58
|
const queryValue = getFilterParamAsStringArray(
|
|
58
|
-
|
|
59
|
+
route.query,
|
|
59
60
|
FilterTypes.Zone
|
|
60
61
|
);
|
|
61
62
|
return zonesOptionList.value.filter(({ value }) =>
|
|
@@ -72,8 +73,7 @@ export function useAdvancedSearch({ context, t, zoneList }: Params): State {
|
|
|
72
73
|
/** Date **/
|
|
73
74
|
|
|
74
75
|
const initialDateFilter = computed<string>(
|
|
75
|
-
() =>
|
|
76
|
-
getFilterParamAsString(context.root.$route.query, FilterTypes.Date) ?? ''
|
|
76
|
+
() => getFilterParamAsString(route.query, FilterTypes.Date) ?? ''
|
|
77
77
|
);
|
|
78
78
|
|
|
79
79
|
const dateFilter = ref<string>(initialDateFilter.value);
|
|
@@ -93,7 +93,7 @@ export function useAdvancedSearch({ context, t, zoneList }: Params): State {
|
|
|
93
93
|
|
|
94
94
|
const initialStatusFilter = computed<OptionType[]>(() => {
|
|
95
95
|
const queryValue = getFilterParamAsStringArray(
|
|
96
|
-
|
|
96
|
+
route.query,
|
|
97
97
|
FilterTypes.Status
|
|
98
98
|
);
|
|
99
99
|
return statusesOptionList.value.filter(({ value }) =>
|
|
@@ -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';
|