@symbo.ls/router 2.12.113 → 2.12.115
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/index.js +16 -8
- package/location.js +1 -5
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
1
|
import * as utils from '@domql/utils'
|
|
4
2
|
const { setCookie, merge } = utils.default || utils
|
|
5
3
|
|
|
@@ -11,7 +9,9 @@ export const getLocationPath = (
|
|
|
11
9
|
) => {
|
|
12
10
|
const routeArray = route.split('/')
|
|
13
11
|
const activeRoute = routeArray[index + 1]
|
|
14
|
-
if (activeRoute)
|
|
12
|
+
if (activeRoute) {
|
|
13
|
+
return `/${activeRoute}`
|
|
14
|
+
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const getLastLocationPath = (
|
|
@@ -20,10 +20,12 @@ export const getLastLocationPath = (
|
|
|
20
20
|
) => {
|
|
21
21
|
const routeArray = route.split('/')
|
|
22
22
|
const activeRoute = routeArray[routeArray.length - level - 1]
|
|
23
|
-
if (activeRoute)
|
|
23
|
+
if (activeRoute) {
|
|
24
|
+
return `/${activeRoute}`
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export let lastPathname
|
|
28
|
+
export let lastPathname = null
|
|
27
29
|
export let lastLevel = 0
|
|
28
30
|
|
|
29
31
|
const defaultOptions = {
|
|
@@ -49,7 +51,9 @@ const defaultOptions = {
|
|
|
49
51
|
scrollToOptions: { behavior: 'smooth' }
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
// eslint-disable-next-line func-style, complexity, default-param-last
|
|
52
55
|
export function router (path = '/', el, state = {}, passedOptions = {}) {
|
|
56
|
+
// eslint-disable-next-line no-invalid-this
|
|
53
57
|
const element = el || (this && this.getRoot())
|
|
54
58
|
const options = merge(passedOptions, defaultOptions)
|
|
55
59
|
lastLevel = options.level
|
|
@@ -100,7 +104,7 @@ export function router (path = '/', el, state = {}, passedOptions = {}) {
|
|
|
100
104
|
)
|
|
101
105
|
}
|
|
102
106
|
|
|
103
|
-
const isModal =
|
|
107
|
+
const isModal = Boolean(element.call('isModalRoute', pathname))
|
|
104
108
|
|
|
105
109
|
if (pathChanged || !hashChanged) {
|
|
106
110
|
// const rootRouteHasChanged = rootRoute !== element.state.rootRoute
|
|
@@ -140,7 +144,9 @@ export function router (path = '/', el, state = {}, passedOptions = {}) {
|
|
|
140
144
|
}
|
|
141
145
|
)
|
|
142
146
|
}
|
|
143
|
-
if (element.content)
|
|
147
|
+
if (element.content) {
|
|
148
|
+
element.content.__ref.__componentKey = route
|
|
149
|
+
}
|
|
144
150
|
}
|
|
145
151
|
}
|
|
146
152
|
|
|
@@ -178,5 +184,7 @@ export function router (path = '/', el, state = {}, passedOptions = {}) {
|
|
|
178
184
|
}
|
|
179
185
|
}
|
|
180
186
|
|
|
181
|
-
if (route !== '/*')
|
|
187
|
+
if (route !== '/*') {
|
|
188
|
+
setCookie('route', route)
|
|
189
|
+
}
|
|
182
190
|
}
|
package/location.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/router",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.115",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
"@domql/utils": "latest",
|
|
13
13
|
"@symbo.ls/auth-redirect": "latest"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "f777ffc758150302112fa1fd4b7b852a15bc939e",
|
|
16
16
|
"source": "index.js"
|
|
17
17
|
}
|