mediacube-ui 0.1.402 → 0.1.404
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.404](https://github.com/MediaCubeCo/mcui/compare/v0.1.403...v0.1.404) (2025-08-12)
|
|
6
|
+
|
|
7
|
+
### [0.1.403](https://github.com/MediaCubeCo/mcui/compare/v0.1.402...v0.1.403) (2025-08-11)
|
|
8
|
+
|
|
5
9
|
### [0.1.402](https://github.com/MediaCubeCo/mcui/compare/v0.1.401...v0.1.402) (2025-07-30)
|
|
6
10
|
|
|
7
11
|
### [0.1.401](https://github.com/MediaCubeCo/mcui/compare/v0.1.400...v0.1.401) (2025-07-29)
|
package/package.json
CHANGED
|
@@ -54,6 +54,7 @@ export default {
|
|
|
54
54
|
methods: {
|
|
55
55
|
setObserver() {
|
|
56
56
|
this.el = document.getElementById(this.id)
|
|
57
|
+
if (!this.el) return
|
|
57
58
|
// создаем IntersectionObserver - смотрит за тем когда элемент попадает во viewport
|
|
58
59
|
this.observer = new IntersectionObserver(
|
|
59
60
|
([entry]) => {
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
:href="menuItem.href"
|
|
56
56
|
:to="menuItem.to"
|
|
57
57
|
:icon="menuItem.icon"
|
|
58
|
+
:is-active="menuItem.active()"
|
|
58
59
|
:icon-color="menuItem.iconColor"
|
|
59
60
|
:title="menuItem.name"
|
|
60
61
|
:compact="compact"
|
|
@@ -115,11 +116,13 @@ export default {
|
|
|
115
116
|
icon: [String] - icon,
|
|
116
117
|
to: [String] - route path (used like link if this route haven't nested menu if they isn't they work like button who open nested menu),
|
|
117
118
|
info: [String] - info badge text
|
|
119
|
+
route_name?: [String] - extra field if route should be active even if it has extra params applied (route_name === 'page-index-format')
|
|
118
120
|
menu: [
|
|
119
121
|
{
|
|
120
122
|
name: [String] - menu item title,
|
|
121
123
|
to: [String] - route path,
|
|
122
|
-
info: [String] - info badge text
|
|
124
|
+
info: [String] - info badge text,
|
|
125
|
+
route_name?: [String]
|
|
123
126
|
},
|
|
124
127
|
...
|
|
125
128
|
]
|
|
@@ -199,16 +202,16 @@ export default {
|
|
|
199
202
|
this.loading = true
|
|
200
203
|
if (oldRoute.path !== newRoute.path) {
|
|
201
204
|
const route = this.preparedMainMenu.find(
|
|
202
|
-
r =>
|
|
205
|
+
r =>
|
|
206
|
+
this.checkRoute(r, newRoute) ||
|
|
207
|
+
r.menu?.find(childRoute => this.checkRoute(childRoute, newRoute)),
|
|
203
208
|
)
|
|
204
209
|
route?.menu && !this.compact && (route.open = true)
|
|
205
210
|
}
|
|
206
211
|
this.$nextTick(() => {
|
|
207
212
|
this.preparedMainMenu.forEach(mi => {
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
mi.menu && mi.menu.some(mim => mim.to?.match(newRoute.path) || newRoute.path?.match(mim.to))
|
|
211
|
-
if (!(exact_route || route_menu_match_new_route)) mi.open = false
|
|
213
|
+
const route_menu_match_new_route = mi.menu?.some(mim => this.checkRoute(mim, newRoute))
|
|
214
|
+
if (!(this.checkRoute(mi, newRoute) || route_menu_match_new_route)) mi.open = false
|
|
212
215
|
})
|
|
213
216
|
this.loading = false
|
|
214
217
|
})
|
|
@@ -218,6 +221,12 @@ export default {
|
|
|
218
221
|
this.setMainMenu()
|
|
219
222
|
},
|
|
220
223
|
methods: {
|
|
224
|
+
// If we have route_name, than we should check originalRoute.name to prevent cases with different params at same route
|
|
225
|
+
checkRoute(route, originalRoute) {
|
|
226
|
+
return !!(route?.route_name
|
|
227
|
+
? originalRoute.name.match(route.route_name)
|
|
228
|
+
: originalRoute.path.match(route.to))
|
|
229
|
+
},
|
|
221
230
|
getMenuItemHeadClasses(menuMainItem) {
|
|
222
231
|
return {
|
|
223
232
|
open: menuMainItem.open,
|
|
@@ -239,16 +248,17 @@ export default {
|
|
|
239
248
|
this.loading = true
|
|
240
249
|
this.preparedMainMenu = this.menuMain.map(i => {
|
|
241
250
|
const active = () => {
|
|
242
|
-
return (
|
|
243
|
-
(i.menu && i.menu.some(r => this.$route?.fullPath?.match(r.to))) ||
|
|
244
|
-
!!this.$route?.fullPath?.match(i.to)
|
|
245
|
-
)
|
|
251
|
+
return i?.menu?.some(r => this.checkRoute(r, this.$route)) || this.checkRoute(i, this.$route)
|
|
246
252
|
}
|
|
247
253
|
return {
|
|
248
254
|
id: _XEUtils.uniqueId(),
|
|
249
255
|
...i,
|
|
256
|
+
menu: i.menu?.map(item => ({
|
|
257
|
+
...item,
|
|
258
|
+
active: () => this.checkRoute(item, this.$route),
|
|
259
|
+
})),
|
|
250
260
|
active,
|
|
251
|
-
indicator: () => i.menu
|
|
261
|
+
indicator: () => i.menu?.some(r => !!this.counts?.[r.count_key]),
|
|
252
262
|
open: !this.compact && active(),
|
|
253
263
|
}
|
|
254
264
|
})
|