druxt-breadcrumb
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -37,3 +37,3 @@ import { resolve } from 'path'; | ||
mapState({ | ||
route: function (state) { return state.druxtRouter.route; }, | ||
route: function (state) { return state.druxtRouter.route.data; }, | ||
routes: function (state) { return state.druxtRouter.routes; } | ||
@@ -70,5 +70,13 @@ })), | ||
this$1.getRoute(to).then(function (res) { | ||
this$1.getRoute(to).then(function (ref) { | ||
var data = ref.data; | ||
var error = ref.error; | ||
this$1.loading--; | ||
this$1.items[to] = { to: to, text: res.label }; | ||
delete this$1.items[to]; | ||
if (data.label) { | ||
this$1.items[to] = { to: to, text: data.label }; | ||
} | ||
this$1.$forceUpdate(); | ||
@@ -75,0 +83,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
var VueDrupalEntity=function(t,e,r){"use strict";var n={name:"DruxtBreadcrumb",props:{component:{type:String,default:function(){return"div"}}},created:function(){this.getItems()},data:function(){return{loading:0,items:{}}},computed:Object.assign({},{crumbs:function(){var t=this;return this.loading?[]:Object.keys(this.items).sort((function(t,e){return t.length-e.length})).map((function(e){return t.items[e]}))}},r.mapState({route:function(t){return t.druxtRouter.route},routes:function(t){return t.druxtRouter.routes}})),methods:Object.assign({},{getItems:function(){var t=this;if(this.items={},this.items["/"]={to:"/",text:"Home"},"/"!==this.$route.path){this.items[this.$route.path]={text:this.route.label};var e=this.$route.path.split("/").filter(String);e.pop();for(var r=function(){t.loading++;var r="/"+e.join("/");t.items[r]={},t.getRoute(r).then((function(e){t.loading--,t.items[r]={to:r,text:e.label},t.$forceUpdate()})),e.pop()};e.length>0;)r()}}},r.mapActions({getRoute:"druxtRouter/getRoute"})),watch:{$route:"getItems"},render:function(t){if(0!==this.crumbs.length)return t(this.component,{props:{items:this.crumbs}})}};return t.DruxtBreadcrumb=n,t.default=function(t){void 0===t&&(t={}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-breadcrumb.js",moduleOptions:t})},t}({},path,vuex); | ||
var VueDrupalEntity=function(t,e,r){"use strict";var n={name:"DruxtBreadcrumb",props:{component:{type:String,default:function(){return"div"}}},created:function(){this.getItems()},data:function(){return{loading:0,items:{}}},computed:Object.assign({},{crumbs:function(){var t=this;return this.loading?[]:Object.keys(this.items).sort((function(t,e){return t.length-e.length})).map((function(e){return t.items[e]}))}},r.mapState({route:function(t){return t.druxtRouter.route.data},routes:function(t){return t.druxtRouter.routes}})),methods:Object.assign({},{getItems:function(){var t=this;if(this.items={},this.items["/"]={to:"/",text:"Home"},"/"!==this.$route.path){this.items[this.$route.path]={text:this.route.label};var e=this.$route.path.split("/").filter(String);e.pop();for(var r=function(){t.loading++;var r="/"+e.join("/");t.items[r]={},t.getRoute(r).then((function(e){var n=e.data;e.error;t.loading--,delete t.items[r],n.label&&(t.items[r]={to:r,text:n.label}),t.$forceUpdate()})),e.pop()};e.length>0;)r()}}},r.mapActions({getRoute:"druxtRouter/getRoute"})),watch:{$route:"getItems"},render:function(t){if(0!==this.crumbs.length)return t(this.component,{props:{items:this.crumbs}})}};return t.DruxtBreadcrumb=n,t.default=function(t){void 0===t&&(t={}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-breadcrumb.js",moduleOptions:t})},t}({},path,vuex); |
@@ -34,3 +34,3 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var path=require('path'),vuex=require('vuex');var component = { | ||
vuex.mapState({ | ||
route: function (state) { return state.druxtRouter.route; }, | ||
route: function (state) { return state.druxtRouter.route.data; }, | ||
routes: function (state) { return state.druxtRouter.routes; } | ||
@@ -67,5 +67,13 @@ })), | ||
this$1.getRoute(to).then(function (res) { | ||
this$1.getRoute(to).then(function (ref) { | ||
var data = ref.data; | ||
var error = ref.error; | ||
this$1.loading--; | ||
this$1.items[to] = { to: to, text: res.label }; | ||
delete this$1.items[to]; | ||
if (data.label) { | ||
this$1.items[to] = { to: to, text: data.label }; | ||
} | ||
this$1.$forceUpdate(); | ||
@@ -72,0 +80,0 @@ }); |
{ | ||
"name": "druxt-breadcrumb", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Provides a Breadcrumb Vue component to be used within a Druxt (DRUpal nuXT) project.", | ||
@@ -48,2 +48,5 @@ "repository": { | ||
}, | ||
"peerDependencies": { | ||
"druxt-router": "^0.8.0" | ||
}, | ||
"devDependencies": { | ||
@@ -59,3 +62,3 @@ "@babel/plugin-transform-runtime": "^7.9.0", | ||
"cross-env": "^6.0.3", | ||
"druxt-router": "^0.7.0", | ||
"druxt-router": "^0.8.0", | ||
"eslint": "^6.7.2", | ||
@@ -62,0 +65,0 @@ "eslint-plugin-vue": "^6.2.2", |
@@ -11,3 +11,3 @@ # \<druxt-breadcrumb /> | ||
`$ npm install druxt-router` | ||
`$ npm install druxt-breadcrumb` | ||
@@ -14,0 +14,0 @@ ## Usage |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10172
192
3