druxt-breadcrumb 0.14.1 → 0.15.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.
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
*/
|
|
65
65
|
path: {
|
|
66
66
|
type: String,
|
|
67
|
-
default:
|
|
67
|
+
default: undefined
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
|
|
@@ -106,7 +106,7 @@ export default {
|
|
|
106
106
|
async fetchCrumbs() {
|
|
107
107
|
const path = this.path || this.$route.path
|
|
108
108
|
let route = this.route
|
|
109
|
-
if (
|
|
109
|
+
if (path && path !== route.path) {
|
|
110
110
|
route = await this.getRoute(path)
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -116,7 +116,7 @@ export default {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// If we are at the root and don't want a home crumb, stop here.
|
|
119
|
-
if (path === '/' && !this.home) return
|
|
119
|
+
if ((path === '/' || route.isHomePath) && !this.home) return
|
|
120
120
|
|
|
121
121
|
// Current route crumb.
|
|
122
122
|
const crumbs = []
|
|
@@ -125,12 +125,13 @@ export default {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
// If we are at the root of the site, stop here.
|
|
128
|
-
if (path === '/') {
|
|
128
|
+
if (path === '/' || route.isHomePath) {
|
|
129
129
|
this.model = crumbs
|
|
130
130
|
return
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// Add crumbs for route parents.
|
|
134
|
+
let addHome = true
|
|
134
135
|
const paths = path.split('/').filter(String)
|
|
135
136
|
paths.pop()
|
|
136
137
|
while (paths.length > 0) {
|
|
@@ -147,11 +148,16 @@ export default {
|
|
|
147
148
|
crumbs.push({ to, text: route.label })
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
// If this route is the home path, prevent a duplicate home item.
|
|
152
|
+
if (route.isHomePath) {
|
|
153
|
+
addHome = false
|
|
154
|
+
}
|
|
155
|
+
|
|
150
156
|
paths.pop()
|
|
151
157
|
}
|
|
152
158
|
|
|
153
|
-
// Home
|
|
154
|
-
if (this.home) {
|
|
159
|
+
// Add Home item.
|
|
160
|
+
if (this.home && addHome) {
|
|
155
161
|
crumbs.push({
|
|
156
162
|
to: '/',
|
|
157
163
|
text: 'Home'
|
|
@@ -228,11 +234,13 @@ export default {
|
|
|
228
234
|
*
|
|
229
235
|
* @example @lang js
|
|
230
236
|
* [
|
|
237
|
+
* 'DruxtBreadcrumb[Default][Langcode]',
|
|
231
238
|
* 'DruxtBreadcrumb[Default]',
|
|
232
239
|
* ]
|
|
233
240
|
*
|
|
234
241
|
* @example @lang js
|
|
235
242
|
* [
|
|
243
|
+
* 'DruxtBreadcrumbDefaultEn',
|
|
236
244
|
* 'DruxtBreadcrumbDefault',
|
|
237
245
|
* ]
|
|
238
246
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<DruxtBreadcrumb />
|
|
2
|
+
<DruxtBreadcrumb :langcode="langcode" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script>
|
|
@@ -18,7 +18,7 @@ import { DruxtBlocksBlockMixin } from 'druxt-blocks'
|
|
|
18
18
|
* uuid="59121e44-e21b-4f53-b009-5225cd630145"
|
|
19
19
|
* />
|
|
20
20
|
*
|
|
21
|
-
* @see {@link https://blocks.druxtjs.org/api/components/DruxtBlock
|
|
21
|
+
* @see {@link https://blocks.druxtjs.org/api/components/DruxtBlock|DruxtBlock}
|
|
22
22
|
* @see {@link ../DruxtBreadcrumb|DruxtBreadcrumb}
|
|
23
23
|
*/
|
|
24
24
|
export default {
|
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
/**
|
|
28
28
|
* Vue.js Mixins.
|
|
29
29
|
*
|
|
30
|
-
* @see {@link https://blocks.druxtjs.org/api/mixins/block
|
|
30
|
+
* @see {@link https://blocks.druxtjs.org/api/mixins/block|DruxtBlocksBlockMixin}
|
|
31
31
|
*/
|
|
32
32
|
mixins: [DruxtBlocksBlockMixin],
|
|
33
33
|
}
|
|
@@ -16,9 +16,12 @@ const DruxtBreadcrumbMixin = {
|
|
|
16
16
|
crumbs: {
|
|
17
17
|
type: Array,
|
|
18
18
|
require: true
|
|
19
|
+
},
|
|
20
|
+
langcode: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: void 0
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
};
|
|
22
26
|
|
|
23
|
-
export default
|
|
24
|
-
export { DruxtBreadcrumbMixin };
|
|
27
|
+
export { DruxtBreadcrumbMixin, DruxtBreadcrumbModule as default };
|
|
@@ -20,9 +20,13 @@ const DruxtBreadcrumbMixin = {
|
|
|
20
20
|
crumbs: {
|
|
21
21
|
type: Array,
|
|
22
22
|
require: true
|
|
23
|
+
},
|
|
24
|
+
langcode: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: void 0
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
exports.DruxtBreadcrumbMixin = DruxtBreadcrumbMixin;
|
|
28
|
-
exports
|
|
32
|
+
exports["default"] = DruxtBreadcrumbModule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-breadcrumb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Decoupled Router based Breadcrumb Druxt component.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"breadcrumb",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"druxt": "^0.
|
|
45
|
-
"druxt-blocks": "^0.
|
|
46
|
-
"druxt-router": "^0.
|
|
44
|
+
"druxt": "^0.19.0",
|
|
45
|
+
"druxt-blocks": "^0.16.0",
|
|
46
|
+
"druxt-router": "^0.27.0"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
49
|
"vue": "^2.6.14",
|