itube-specs 0.0.324 → 0.0.326
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.
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
/>
|
|
22
22
|
{{ name }}
|
|
23
23
|
<SIcon
|
|
24
|
-
v-if="(isActive && !
|
|
24
|
+
v-if="(isActive && !mini && item.resetPath) || withClose"
|
|
25
25
|
class="s-chips__close"
|
|
26
26
|
name="close"
|
|
27
27
|
size="16"
|
|
@@ -34,83 +34,90 @@ import type { IChipsItem } from '../../types';
|
|
|
34
34
|
import { convertString } from '../../runtime';
|
|
35
35
|
|
|
36
36
|
const props = defineProps<{
|
|
37
|
-
item: IChipsItem
|
|
38
|
-
allLink?: boolean
|
|
39
|
-
alphabet?: boolean
|
|
40
|
-
active?: boolean
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}>()
|
|
37
|
+
item: IChipsItem;
|
|
38
|
+
allLink?: boolean;
|
|
39
|
+
alphabet?: boolean;
|
|
40
|
+
active?: boolean;
|
|
41
|
+
withClose?: boolean;
|
|
42
|
+
isLink?: boolean;
|
|
43
|
+
mini?: boolean;
|
|
44
|
+
bright?: boolean;
|
|
45
|
+
notCapitalize?: boolean;
|
|
46
|
+
}>();
|
|
48
47
|
|
|
49
48
|
const emit = defineEmits<{
|
|
50
|
-
(eventName: 'click'): void
|
|
51
|
-
}>()
|
|
49
|
+
(eventName: 'click'): void;
|
|
50
|
+
}>();
|
|
52
51
|
|
|
53
|
-
const route = useRoute()
|
|
52
|
+
const route = useRoute();
|
|
54
53
|
|
|
55
|
-
const { generateLink } = useGenerateLink();
|
|
56
|
-
|
|
57
|
-
const isActive = computed(() => {
|
|
58
|
-
if (props.active || props.item.value === 'reset' && !route.params.slug) {
|
|
59
|
-
return true
|
|
60
|
-
}
|
|
61
|
-
return ((convertString().fromSlug(String(route.params.slug))).toLowerCase() === props.item.title.toLowerCase()) && route.path.includes(props.item.prefix || '');
|
|
62
|
-
})
|
|
63
54
|
const component = computed(() => {
|
|
64
55
|
if (props.isLink) {
|
|
65
|
-
return resolveComponent('NuxtLink')
|
|
56
|
+
return resolveComponent('NuxtLink');
|
|
66
57
|
}
|
|
67
|
-
return 'button'
|
|
68
|
-
})
|
|
58
|
+
return 'button';
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const { generateLink } = useGenerateLink();
|
|
69
62
|
|
|
70
|
-
const
|
|
63
|
+
const targetPath = computed(() => {
|
|
71
64
|
if (props.item.value === 'reset') {
|
|
72
|
-
|
|
73
|
-
return `/${props.item.prefix}`
|
|
65
|
+
return props.item.resetPath ? `/${props.item.resetPath}` : '/';
|
|
74
66
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return `/${props.item.value}
|
|
67
|
+
|
|
68
|
+
if (props.allLink && props.item.value) {
|
|
69
|
+
return `/${props.item.value}`;
|
|
78
70
|
}
|
|
71
|
+
|
|
79
72
|
if (props.item.value && props.item.prefix) {
|
|
80
|
-
|
|
81
|
-
// возврат, при активном состоянии
|
|
82
|
-
return props.alphabet ? `/${props.item.prefix}` : '/';
|
|
83
|
-
}
|
|
84
|
-
if (props.alphabet) {
|
|
85
|
-
return `/${props.item.prefix}/letter/${convertString().toSlug(props.item.title)}`;
|
|
86
|
-
}
|
|
87
|
-
return `/${props.item.prefix}/${convertString().toSlug(String(props.item.value))}`;
|
|
73
|
+
return `${props.item.prefix}/${convertString().toSlug(String(props.item.value))}`;
|
|
88
74
|
}
|
|
89
|
-
return ''
|
|
90
|
-
})
|
|
91
75
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
76
|
+
if (props.item.value === '' && props.item.prefix) {
|
|
77
|
+
return `${props.item.prefix}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return '';
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const isActive = computed(() => {
|
|
84
|
+
if (props.active) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
if (!props.isLink || !targetPath.value) {
|
|
88
|
+
return false;
|
|
100
89
|
}
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
|
|
91
|
+
const current = route.path.replace(/^\/|\/$/g, '');
|
|
92
|
+
const target = targetPath.value.replace(/^\/|\/$/g, '');
|
|
93
|
+
|
|
94
|
+
return current === target;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const href = computed<string | undefined>(() => {
|
|
98
|
+
if (!props.isLink) return undefined;
|
|
99
|
+
|
|
100
|
+
if (isActive.value && props.item.resetPath) {
|
|
101
|
+
return generateLink(props.item.resetPath ? `/${props.item.resetPath}` : '/');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (targetPath.value) {
|
|
105
|
+
return generateLink(targetPath.value);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return undefined;
|
|
109
|
+
});
|
|
103
110
|
|
|
104
111
|
function onButtonClick() {
|
|
105
112
|
if (!props.isLink) {
|
|
106
|
-
emit('click')
|
|
113
|
+
emit('click');
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
const name = computed(() => {
|
|
111
118
|
if (props.item?.title.toLowerCase() === 'post') {
|
|
112
|
-
return '#'
|
|
119
|
+
return '#';
|
|
113
120
|
}
|
|
114
|
-
return props.item.title
|
|
115
|
-
})
|
|
121
|
+
return props.item.title;
|
|
122
|
+
});
|
|
116
123
|
</script>
|
package/package.json
CHANGED
package/runtime/index.ts
CHANGED
|
@@ -39,6 +39,8 @@ export * from './utils/converters/convert-model-card-to-chips';
|
|
|
39
39
|
export * from './utils/converters/group-categories-by-first-letter';
|
|
40
40
|
export * from './utils/converters/group-objects-by-first-letter';
|
|
41
41
|
export * from './utils/converters/convert-snake-keys-to-camel';
|
|
42
|
+
export * from './utils/converters/convert-query-categories';
|
|
43
|
+
export * from './utils/converters/convert-string-array-to-chips';
|
|
42
44
|
export * from './utils/server/abort-controller';
|
|
43
45
|
export * from './utils/server/api-helper';
|
|
44
46
|
export * from './utils/server/parse-api-error';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
2
|
+
/**
|
|
3
|
+
* конвертирует список категорий из фильтра страниц с видео роликами из query в одну строку, все слова с заглавной буквы
|
|
4
|
+
*/
|
|
5
|
+
export function convertQueryCategories(route: RouteLocationNormalizedLoaded) {
|
|
6
|
+
const MAX_CATEGORIES = 3;
|
|
7
|
+
return String(route.query[ 'categories' ])?.split(',').map(item => item.split('_')[ 1 ]).map(item => item?.charAt(0).toUpperCase() + item?.slice(1)).slice(0, MAX_CATEGORIES).join(', ');
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IChipsItem } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export function convertStringArrayToChips(array: string[], prefix: string, resetPath: string): IChipsItem[] {
|
|
4
|
+
return array.map((item) => ({
|
|
5
|
+
title: item,
|
|
6
|
+
value: item,
|
|
7
|
+
prefix: prefix,
|
|
8
|
+
resetPath: resetPath,
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* конвертирует список категорий из фильтра страниц с видео роликами из query в одну строку, все слова с заглавной буквы
|
|
3
|
-
*/
|
|
4
|
-
export function useConvertQueryCategories() {
|
|
5
|
-
const MAX_CATEGORIES = 3;
|
|
6
|
-
return String(useRoute().query[ 'categories' ])?.split(',').map(item => item.split('_')[ 1 ]).map(item => item?.charAt(0).toUpperCase() + item?.slice(1)).slice(0, MAX_CATEGORIES).join(', ');
|
|
7
|
-
}
|