druxt-menu
Advanced tools
Comparing version 0.5.0 to 0.6.0
import { resolve } from 'path'; | ||
import { mapGetters, mapState, mapActions } from 'vuex'; | ||
import { DruxtComponentMixin } from 'druxt'; | ||
import { DruxtBlocksBlockMixin } from 'druxt-blocks'; | ||
@@ -57,9 +58,9 @@ import { DruxtRouter } from 'druxt-router'; | ||
/** | ||
* The `<druxt-menu />` Vue.js component. | ||
* The `<DruxtMenu />` Vue.js component. | ||
* | ||
* - Fetchs the menu items via the Druxt.js Router. | ||
* - Fetchs the menu items via the DruxtJS Router. | ||
* - Renders the data via the DruxtMenuItem component. | ||
* | ||
* @example @lang vue | ||
* <druxt-menu name="main" /> | ||
* <DruxtMenu name="main" /> | ||
*/ | ||
@@ -69,2 +70,15 @@ var script = { | ||
mixins: [DruxtComponentMixin], | ||
druxt: function (ref) { | ||
var vm = ref.vm; | ||
return ({ | ||
componentOptions: [[vm.name]], | ||
propsData: { | ||
items: vm.items | ||
} | ||
}); | ||
}, | ||
/** | ||
@@ -77,13 +91,2 @@ * Vue.js Properties. | ||
/** | ||
* Component or element to render the Menu. | ||
* | ||
* @type {string} | ||
* @default ul | ||
*/ | ||
component: { | ||
type: String, | ||
default: 'ul' | ||
}, | ||
/** | ||
* The maximum depth of the menu. | ||
@@ -178,3 +181,7 @@ * | ||
fetch: async function fetch() { | ||
await this.fetch(); | ||
await this.getMenu(this.name); | ||
this.items = this.getMenuItems(); | ||
// Fetch theme component. | ||
await DruxtComponentMixin.fetch.call(this); | ||
}, | ||
@@ -228,21 +235,3 @@ | ||
created: function created() { | ||
// Workaround for Vuepress docs. | ||
if (!this.$fetch) { | ||
this.fetch(); | ||
} | ||
}, | ||
methods: Object.assign({}, {fetch: async function fetch() { | ||
await this.getMenu(this.name); | ||
this.items = this.getMenuItems(); | ||
}, | ||
/** | ||
* Recursively gets required menu items from the Vuex store. | ||
* | ||
* @param {object} [entity] - Current menu item entity. | ||
* @param {integer} [position] - Current position in the menu tree, | ||
*/ | ||
getMenuItems: function getMenuItems(entity, position) { | ||
methods: Object.assign({}, {getMenuItems: function getMenuItems(entity, position) { | ||
var this$1 = this; | ||
@@ -368,3 +357,3 @@ if ( entity === void 0 ) entity = null; | ||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.items)?_c(_vm.component,{tag:"component"},_vm._l((_vm.items),function(item){return _c('druxt-menu-item',{key:item.entity.id,attrs:{"item":item}})}),1):_vm._e()}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (!_vm.$fetchState.pending)?_c(_vm.wrapper.component,_vm._b({tag:"component"},'component',_vm.wrapper.propsData,false),[_c(_vm.component.is,_vm._b({tag:"component",scopedSlots:_vm._u([{key:"default",fn:function($attrs){return _vm._l((_vm.items),function(item){return _c('DruxtMenuItem',_vm._b({key:item.entity.id,attrs:{"item":item}},'DruxtMenuItem',$attrs,false))})}}],null,false,549238761)},'component',_vm.component.propsData,false))],1):_vm._e()}; | ||
var __vue_staticRenderFns__ = []; | ||
@@ -402,5 +391,5 @@ | ||
/** | ||
* The `<druxt-menu-item />` Vue.js component. | ||
* The `<DruxtMenuItem />` Vue.js component. | ||
* | ||
* _This component is intended to be rendered by the `<druxt-menu />` component._ | ||
* _This component is intended to be rendered by the `<DruxtMenu />` component._ | ||
* | ||
@@ -590,3 +579,3 @@ * - Renders a menu item. | ||
* | ||
* _This component is intended to be rendered by the `<druxt-block />` component._ | ||
* _This component is intended to be rendered by the `<DruxtBlock />` component._ | ||
* | ||
@@ -596,3 +585,3 @@ * - Renders a Menu block component. | ||
* @example @lang vue | ||
* <druxt-block | ||
* <DruxtBlock | ||
* uuid="d4efd803-94af-4742-bc94-ea4360085b74" | ||
@@ -632,3 +621,3 @@ * /> | ||
/* template */ | ||
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('druxt-menu',{attrs:{"name":_vm.name}})}; | ||
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('DruxtMenu',{attrs:{"name":_vm.name}})}; | ||
var __vue_staticRenderFns__$1 = []; | ||
@@ -635,0 +624,0 @@ |
@@ -1,1 +0,1 @@ | ||
var VueDrupalEntity=function(t,e,n,i,r,s){"use strict";function u(t,e,n,i,r,s,u,o,a,d){"boolean"!=typeof u&&(a=o,o=u,u=!1);var p,c="function"==typeof n?n.options:n;if(t&&t.render&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),i&&(c._scopeId=i),s?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,a(t)),t&&t._registeredComponents&&t._registeredComponents.add(s)},c._ssrRegister=p):e&&(p=u?function(t){e.call(this,d(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,o(t))}),p)if(c.functional){var l=c.render;c.render=function(t,e){return p.call(e),l(t,e)}}else{var m=c.beforeCreate;c.beforeCreate=m?[].concat(m,p):[p]}return n}var o=u({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.items?n(t.component,{tag:"component"},t._l(t.items,(function(t){return n("druxt-menu-item",{key:t.entity.id,attrs:{item:t}})})),1):t._e()},staticRenderFns:[]},undefined,{name:"DruxtMenu",props:{component:{type:String,default:"ul"},depth:{type:Number,default:0},itemClass:{type:String,default:""},itemComponent:{type:String,default:"li"},name:{type:String,default:"main"},parentClass:{type:String,default:""},parentComponent:{type:String,default:"li"},parentWrapperClass:{type:String,default:""},parentWrapperComponent:{type:String,default:"ul"}},fetch:async function(){await this.fetch()},data:function(){return{items:[]}},computed:Object.assign({},{trail:function(){var t=[],e=this.$route.path.substring(1).split("/");for(var n in e){var i=[n>0?t[n-1]:"",e[n]].join("/");t.push(i)}return t}},n.mapGetters({getEntitiesByFilter:"druxtMenu/getEntitiesByFilter"}),n.mapState({entities:function(t){return t.druxtMenu.entities}})),watch:{entities:function(){this.$forceUpdate()}},created:function(){this.$fetch||this.fetch()},methods:Object.assign({},{fetch:async function(){await this.getMenu(this.name),this.items=this.getMenuItems()},getMenuItems:function(t,e){var n=this;void 0===t&&(t=null),void 0===e&&(e=0);var i=[];if(e+=1,!this.depth||e<=this.depth){var r=null;t&&(r=t.id,void 0!==t.attributes.bundle&&(r=[t.attributes.bundle,t.id].join(":")));var s=this.getEntitiesByFilter((function(t){return n.entities[t].attributes.menu_name===n.name&&n.entities[t].attributes.parent===r}));for(var u in s){var o=s[u];i.push({entity:o,children:this.getMenuItems(o,e)})}}return e-=1,i}},n.mapActions({getMenu:"druxtMenu/get"}))},undefined,false,undefined,!1,void 0,void 0,void 0),a=u({},undefined,{name:"DruxtMenuItem",props:{item:{type:Object,required:!0}},computed:{active:function(){return this.menu.trail.includes(this.item.entity.attributes.url)},classes:function(){var t=[this.menu[this.template+"Class"]];return this.active&&t.push("active-trail"),t.join(" ")},template:function(){return this.item.children.length?"parent":"item"},to:function(){var t=this.item.entity.attributes.link.uri.split(":"),e=t[0];return{path:t[1],type:e}},menu:function(){for(var t=!1,e=this.$parent;e&&!t;)"DruxtMenu"===e.$options.name&&(t=e),e.$options.extends&&"DruxtMenu"===e.$options.extends.name&&(t=e),e=!!e.$parent&&e.$parent;return t}},methods:{templates:function(t){var e=this;return Object.assign({},{item:function(n){var i=n.item.entity;return t(e.menu.itemComponent,{class:e.classes},[t("nuxt-link",{props:{to:e.to}},i.attributes.title)])},parent:function(n){var i=n.item,r=i.entity,s=i.children,u=[];for(var o in s)u.push(t("druxt-menu-item",{props:{item:s[o]}}));return t(e.menu.parentComponent,{class:e.classes},[t("druxt-menu-item",{props:{item:{children:[],entity:r}}}),t(e.menu.parentWrapperComponent,{class:e.menu.parenWrapperClass},u)])}},this.menu.$scopedSlots)}},render:function(t){return!!this.menu&&this.templates(t)[this.template](this)}},undefined,undefined,undefined,!1,void 0,void 0,void 0),d=u({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("druxt-menu",{attrs:{name:t.name}})},staticRenderFns:[]},undefined,{name:"DruxtBlockSystemMenuBlock",mixins:[i.DruxtBlocksBlockMixin],computed:{name:function(){return this.settings.id.split(":")[1]}}},undefined,false,undefined,!1,void 0,void 0,void 0),p=Object.freeze({__proto__:null,DruxtMenuComponent:o,DruxtMenuItemComponent:a,DruxtBlockSystemMenuBlock:d}),c=function(t,e){if(void 0===e&&(e={}),!t)throw new Error("The 'baseURL' parameter is required.");this.options=Object.assign({},{endpoint:"/jsonapi",menu:{jsonApiMenuItems:!1}},e),this.druxtRouter=new r.DruxtRouter(t,e)};c.prototype.get=async function(t){return this.options.menu.jsonApiMenuItems?this.getJsonApiMenuItems(t):this.getMenuLinkContent(t)},c.prototype.getMenuLinkContent=async function(t){var e="menu_link_content--menu_link_content",n=(new s.DrupalJsonApiParams).addFilter("enabled","1").addFilter("menu_name",t).addFields(e,["bundle","description","link","menu_name","parent","title","weight"]);return{entities:await this.druxtRouter.getResources(e,n,{all:!0})}},c.prototype.getJsonApiMenuItems=async function(t){var e="menu_items--"+t;await this.druxtRouter.getIndex(),this.druxtRouter.index[e]={href:this.options.endpoint+"/menu_items/"+t};var n=(new s.DrupalJsonApiParams).addFilter("enabled","1").addFilter("menu_name",t);return{entities:(await this.druxtRouter.getResources(e,n,{all:!0})).map((function(e){return{id:e.id,attributes:{description:e.attributes.description,link:{uri:"internal:"+e.attributes.url},menu_name:t,parent:e.attributes.parent.length?e.attributes.parent:null,title:e.attributes.title,weight:e.attributes.weight},resource:e}}))}};return t.DruxtBlockSystemMenuBlock=d,t.DruxtMenu=c,t.DruxtMenuComponent=o,t.DruxtMenuComponents=p,t.DruxtMenuItemComponent=a,t.DruxtMenuStore=function(t){var e=t.store;if(void 0===e)throw new TypeError("Vuex store not found.");var n="druxtMenu",i={namespaced:!0,state:function(){return{entities:{}}},mutations:{addEntities:function(t,e){for(var n in e){var i=e[n];t.entities[i.id]=i}}},actions:{get:async function(t,e){(0,t.commit)("addEntities",(await this.$druxtMenu.get(e)).entities)}},getters:{getEntitiesByFilter:function(t){return function(e){var n=Object.keys(t.entities).filter((function(t){return e(t)}));return n.length?Object.assign.apply(Object,n.map((function(e){var n;return(n={})[e]=t.entities[e],n}))):{}}}}};e.registerModule(n,i,{preserveState:Boolean(e.state.druxtMenu)})},t.default=function(t){if(void 0===this.options||!this.options.druxt)throw new TypeError("Druxt settings missing.");var n=this.options.druxt;this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-menu.js",options:n}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/store.js"),fileName:"store/druxt-menu.js",options:n})},t}({},path,vuex,druxtBlocks,druxtRouter,drupalJsonapiParams); | ||
var VueDrupalEntity=function(t,e,n,i,r,s,u){"use strict";function o(t,e,n,i,r,s,u,o,a,p){"boolean"!=typeof u&&(a=o,o=u,u=!1);var d,m="function"==typeof n?n.options:n;if(t&&t.render&&(m.render=t.render,m.staticRenderFns=t.staticRenderFns,m._compiled=!0,r&&(m.functional=!0)),i&&(m._scopeId=i),s?(d=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,a(t)),t&&t._registeredComponents&&t._registeredComponents.add(s)},m._ssrRegister=d):e&&(d=u?function(t){e.call(this,p(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,o(t))}),d)if(m.functional){var c=m.render;m.render=function(t,e){return d.call(e),c(t,e)}}else{var l=m.beforeCreate;m.beforeCreate=l?[].concat(l,d):[d]}return n}var a=o({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.$fetchState.pending?t._e():n(t.wrapper.component,t._b({tag:"component"},"component",t.wrapper.propsData,!1),[n(t.component.is,t._b({tag:"component",scopedSlots:t._u([{key:"default",fn:function(e){return t._l(t.items,(function(i){return n("DruxtMenuItem",t._b({key:i.entity.id,attrs:{item:i}},"DruxtMenuItem",e,!1))}))}}],null,!1,549238761)},"component",t.component.propsData,!1))],1)},staticRenderFns:[]},undefined,{name:"DruxtMenu",mixins:[i.DruxtComponentMixin],druxt:function(t){var e=t.vm;return{componentOptions:[[e.name]],propsData:{items:e.items}}},props:{depth:{type:Number,default:0},itemClass:{type:String,default:""},itemComponent:{type:String,default:"li"},name:{type:String,default:"main"},parentClass:{type:String,default:""},parentComponent:{type:String,default:"li"},parentWrapperClass:{type:String,default:""},parentWrapperComponent:{type:String,default:"ul"}},fetch:async function(){await this.getMenu(this.name),this.items=this.getMenuItems(),await i.DruxtComponentMixin.fetch.call(this)},data:function(){return{items:[]}},computed:Object.assign({},{trail:function(){var t=[],e=this.$route.path.substring(1).split("/");for(var n in e){var i=[n>0?t[n-1]:"",e[n]].join("/");t.push(i)}return t}},n.mapGetters({getEntitiesByFilter:"druxtMenu/getEntitiesByFilter"}),n.mapState({entities:function(t){return t.druxtMenu.entities}})),watch:{entities:function(){this.$forceUpdate()}},methods:Object.assign({},{getMenuItems:function(t,e){var n=this;void 0===t&&(t=null),void 0===e&&(e=0);var i=[];if(e+=1,!this.depth||e<=this.depth){var r=null;t&&(r=t.id,void 0!==t.attributes.bundle&&(r=[t.attributes.bundle,t.id].join(":")));var s=this.getEntitiesByFilter((function(t){return n.entities[t].attributes.menu_name===n.name&&n.entities[t].attributes.parent===r}));for(var u in s){var o=s[u];i.push({entity:o,children:this.getMenuItems(o,e)})}}return e-=1,i}},n.mapActions({getMenu:"druxtMenu/get"}))},undefined,false,undefined,!1,void 0,void 0,void 0),p=o({},undefined,{name:"DruxtMenuItem",props:{item:{type:Object,required:!0}},computed:{active:function(){return this.menu.trail.includes(this.item.entity.attributes.url)},classes:function(){var t=[this.menu[this.template+"Class"]];return this.active&&t.push("active-trail"),t.join(" ")},template:function(){return this.item.children.length?"parent":"item"},to:function(){var t=this.item.entity.attributes.link.uri.split(":"),e=t[0];return{path:t[1],type:e}},menu:function(){for(var t=!1,e=this.$parent;e&&!t;)"DruxtMenu"===e.$options.name&&(t=e),e.$options.extends&&"DruxtMenu"===e.$options.extends.name&&(t=e),e=!!e.$parent&&e.$parent;return t}},methods:{templates:function(t){var e=this;return Object.assign({},{item:function(n){var i=n.item.entity;return t(e.menu.itemComponent,{class:e.classes},[t("nuxt-link",{props:{to:e.to}},i.attributes.title)])},parent:function(n){var i=n.item,r=i.entity,s=i.children,u=[];for(var o in s)u.push(t("druxt-menu-item",{props:{item:s[o]}}));return t(e.menu.parentComponent,{class:e.classes},[t("druxt-menu-item",{props:{item:{children:[],entity:r}}}),t(e.menu.parentWrapperComponent,{class:e.menu.parenWrapperClass},u)])}},this.menu.$scopedSlots)}},render:function(t){return!!this.menu&&this.templates(t)[this.template](this)}},undefined,undefined,undefined,!1,void 0,void 0,void 0),d=o({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("DruxtMenu",{attrs:{name:t.name}})},staticRenderFns:[]},undefined,{name:"DruxtBlockSystemMenuBlock",mixins:[r.DruxtBlocksBlockMixin],computed:{name:function(){return this.settings.id.split(":")[1]}}},undefined,false,undefined,!1,void 0,void 0,void 0),m=Object.freeze({__proto__:null,DruxtMenuComponent:a,DruxtMenuItemComponent:p,DruxtBlockSystemMenuBlock:d}),c=function(t,e){if(void 0===e&&(e={}),!t)throw new Error("The 'baseURL' parameter is required.");this.options=Object.assign({},{endpoint:"/jsonapi",menu:{jsonApiMenuItems:!1}},e),this.druxtRouter=new s.DruxtRouter(t,e)};c.prototype.get=async function(t){return this.options.menu.jsonApiMenuItems?this.getJsonApiMenuItems(t):this.getMenuLinkContent(t)},c.prototype.getMenuLinkContent=async function(t){var e="menu_link_content--menu_link_content",n=(new u.DrupalJsonApiParams).addFilter("enabled","1").addFilter("menu_name",t).addFields(e,["bundle","description","link","menu_name","parent","title","weight"]);return{entities:await this.druxtRouter.getResources(e,n,{all:!0})}},c.prototype.getJsonApiMenuItems=async function(t){var e="menu_items--"+t;await this.druxtRouter.getIndex(),this.druxtRouter.index[e]={href:this.options.endpoint+"/menu_items/"+t};var n=(new u.DrupalJsonApiParams).addFilter("enabled","1").addFilter("menu_name",t);return{entities:(await this.druxtRouter.getResources(e,n,{all:!0})).map((function(e){return{id:e.id,attributes:{description:e.attributes.description,link:{uri:"internal:"+e.attributes.url},menu_name:t,parent:e.attributes.parent.length?e.attributes.parent:null,title:e.attributes.title,weight:e.attributes.weight},resource:e}}))}};return t.DruxtBlockSystemMenuBlock=d,t.DruxtMenu=c,t.DruxtMenuComponent=a,t.DruxtMenuComponents=m,t.DruxtMenuItemComponent=p,t.DruxtMenuStore=function(t){var e=t.store;if(void 0===e)throw new TypeError("Vuex store not found.");var n="druxtMenu",i={namespaced:!0,state:function(){return{entities:{}}},mutations:{addEntities:function(t,e){for(var n in e){var i=e[n];t.entities[i.id]=i}}},actions:{get:async function(t,e){(0,t.commit)("addEntities",(await this.$druxtMenu.get(e)).entities)}},getters:{getEntitiesByFilter:function(t){return function(e){var n=Object.keys(t.entities).filter((function(t){return e(t)}));return n.length?Object.assign.apply(Object,n.map((function(e){var n;return(n={})[e]=t.entities[e],n}))):{}}}}};e.registerModule(n,i,{preserveState:Boolean(e.state.druxtMenu)})},t.default=function(t){if(void 0===this.options||!this.options.druxt)throw new TypeError("Druxt settings missing.");var n=this.options.druxt;this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-menu.js",options:n}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/store.js"),fileName:"store/druxt-menu.js",options:n})},t}({},path,vuex,druxt,druxtBlocks,druxtRouter,drupalJsonapiParams); |
@@ -1,2 +0,2 @@ | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var path=require('path'),vuex=require('vuex'),druxtBlocks=require('druxt-blocks'),druxtRouter=require('druxt-router'),drupalJsonapiParams=require('drupal-jsonapi-params');/** | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var path=require('path'),vuex=require('vuex'),druxt=require('druxt'),druxtBlocks=require('druxt-blocks'),druxtRouter=require('druxt-router'),drupalJsonapiParams=require('drupal-jsonapi-params');/** | ||
* The Nuxt.js module function. | ||
@@ -49,9 +49,9 @@ * | ||
/** | ||
* The `<druxt-menu />` Vue.js component. | ||
* The `<DruxtMenu />` Vue.js component. | ||
* | ||
* - Fetchs the menu items via the Druxt.js Router. | ||
* - Fetchs the menu items via the DruxtJS Router. | ||
* - Renders the data via the DruxtMenuItem component. | ||
* | ||
* @example @lang vue | ||
* <druxt-menu name="main" /> | ||
* <DruxtMenu name="main" /> | ||
*/ | ||
@@ -61,2 +61,15 @@ var script = { | ||
mixins: [druxt.DruxtComponentMixin], | ||
druxt: function (ref) { | ||
var vm = ref.vm; | ||
return ({ | ||
componentOptions: [[vm.name]], | ||
propsData: { | ||
items: vm.items | ||
} | ||
}); | ||
}, | ||
/** | ||
@@ -69,13 +82,2 @@ * Vue.js Properties. | ||
/** | ||
* Component or element to render the Menu. | ||
* | ||
* @type {string} | ||
* @default ul | ||
*/ | ||
component: { | ||
type: String, | ||
default: 'ul' | ||
}, | ||
/** | ||
* The maximum depth of the menu. | ||
@@ -170,3 +172,7 @@ * | ||
fetch: async function fetch() { | ||
await this.fetch(); | ||
await this.getMenu(this.name); | ||
this.items = this.getMenuItems(); | ||
// Fetch theme component. | ||
await druxt.DruxtComponentMixin.fetch.call(this); | ||
}, | ||
@@ -220,21 +226,3 @@ | ||
created: function created() { | ||
// Workaround for Vuepress docs. | ||
if (!this.$fetch) { | ||
this.fetch(); | ||
} | ||
}, | ||
methods: Object.assign({}, {fetch: async function fetch() { | ||
await this.getMenu(this.name); | ||
this.items = this.getMenuItems(); | ||
}, | ||
/** | ||
* Recursively gets required menu items from the Vuex store. | ||
* | ||
* @param {object} [entity] - Current menu item entity. | ||
* @param {integer} [position] - Current position in the menu tree, | ||
*/ | ||
getMenuItems: function getMenuItems(entity, position) { | ||
methods: Object.assign({}, {getMenuItems: function getMenuItems(entity, position) { | ||
var this$1 = this; | ||
@@ -356,3 +344,3 @@ if ( entity === void 0 ) entity = null; | ||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.items)?_c(_vm.component,{tag:"component"},_vm._l((_vm.items),function(item){return _c('druxt-menu-item',{key:item.entity.id,attrs:{"item":item}})}),1):_vm._e()}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (!_vm.$fetchState.pending)?_c(_vm.wrapper.component,_vm._b({tag:"component"},'component',_vm.wrapper.propsData,false),[_c(_vm.component.is,_vm._b({tag:"component",scopedSlots:_vm._u([{key:"default",fn:function($attrs){return _vm._l((_vm.items),function(item){return _c('DruxtMenuItem',_vm._b({key:item.entity.id,attrs:{"item":item}},'DruxtMenuItem',$attrs,false))})}}],null,false,549238761)},'component',_vm.component.propsData,false))],1):_vm._e()}; | ||
var __vue_staticRenderFns__ = []; | ||
@@ -365,3 +353,3 @@ | ||
/* module identifier */ | ||
var __vue_module_identifier__ = "data-v-f82b05f6"; | ||
var __vue_module_identifier__ = "data-v-6617bda9"; | ||
/* functional template */ | ||
@@ -389,5 +377,5 @@ var __vue_is_functional_template__ = false; | ||
);/** | ||
* The `<druxt-menu-item />` Vue.js component. | ||
* The `<DruxtMenuItem />` Vue.js component. | ||
* | ||
* _This component is intended to be rendered by the `<druxt-menu />` component._ | ||
* _This component is intended to be rendered by the `<DruxtMenu />` component._ | ||
* | ||
@@ -546,3 +534,3 @@ * - Renders a menu item. | ||
/* module identifier */ | ||
var __vue_module_identifier__$1 = "data-v-41b6b40a"; | ||
var __vue_module_identifier__$1 = "data-v-50969123"; | ||
/* functional template */ | ||
@@ -574,3 +562,3 @@ var __vue_is_functional_template__$1 = undefined; | ||
* | ||
* _This component is intended to be rendered by the `<druxt-block />` component._ | ||
* _This component is intended to be rendered by the `<DruxtBlock />` component._ | ||
* | ||
@@ -580,3 +568,3 @@ * - Renders a Menu block component. | ||
* @example @lang vue | ||
* <druxt-block | ||
* <DruxtBlock | ||
* uuid="d4efd803-94af-4742-bc94-ea4360085b74" | ||
@@ -614,3 +602,3 @@ * /> | ||
/* template */ | ||
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('druxt-menu',{attrs:{"name":_vm.name}})}; | ||
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('DruxtMenu',{attrs:{"name":_vm.name}})}; | ||
var __vue_staticRenderFns__$1 = []; | ||
@@ -623,3 +611,3 @@ | ||
/* module identifier */ | ||
var __vue_module_identifier__$2 = "data-v-4ce8825e"; | ||
var __vue_module_identifier__$2 = "data-v-2289bd9e"; | ||
/* functional template */ | ||
@@ -626,0 +614,0 @@ var __vue_is_functional_template__$2 = false; |
{ | ||
"name": "druxt-menu", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Provides a Menu Vue component to be used within a Druxt (DRUpal nuXT) project.", | ||
@@ -47,5 +47,6 @@ "repository": { | ||
"dependencies": { | ||
"codecov": "^3.7.2", | ||
"drupal-jsonapi-params": "^1.1.10", | ||
"druxt-blocks": "^0.5.0", | ||
"codecov": "^3.8.1", | ||
"drupal-jsonapi-params": "^1.1.12", | ||
"druxt": "^0.3.3", | ||
"druxt-blocks": "^0.7.3", | ||
"druxt-router": "^0.16.0", | ||
@@ -55,12 +56,12 @@ "vuex": "^3.5.1" | ||
"devDependencies": { | ||
"@babel/plugin-transform-runtime": "^7.11.5", | ||
"@babel/preset-env": "^7.11.5", | ||
"@babel/plugin-transform-runtime": "^7.12.1", | ||
"@babel/preset-env": "^7.12.1", | ||
"@rollup/plugin-alias": "^2.2.0", | ||
"@rollup/plugin-buble": "^0.20.0", | ||
"@rollup/plugin-replace": "^2.3.3", | ||
"@vue/test-utils": "^1.0.5", | ||
"@rollup/plugin-replace": "^2.3.4", | ||
"@vue/test-utils": "^1.1.1", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-eslint": "^10.1.0", | ||
"cross-env": "^6.0.3", | ||
"druxt-docgen": "^0.2.7", | ||
"druxt-docgen": "^0.2.8", | ||
"eslint": "^6.7.2", | ||
@@ -73,9 +74,9 @@ "eslint-plugin-vue": "^6.2.2", | ||
"minimist": "^1.2.0", | ||
"nodemon": "^2.0.4", | ||
"nodemon": "^2.0.6", | ||
"rollup": "^1.26.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-terser": "^7.0.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-vue": "^5.1.9", | ||
"vue": "^2.6.12", | ||
"vue-jest": "^3.0.6", | ||
"vue-jest": "^3.0.7", | ||
"vue-template-compiler": "^2.6.12" | ||
@@ -82,0 +83,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# \<druxt-menu /> | ||
# DruxtJS Menu | ||
@@ -7,8 +7,9 @@ [![CircleCI](https://circleci.com/gh/druxt/druxt-menu.svg?style=svg)](https://circleci.com/gh/druxt/druxt-menu) | ||
Provides a Menu Vue component to be used within a Druxt (DRUpal nuXT) project. | ||
> The DruxtJS Menu module provides a Menu Vue component to be used within a Druxt (DRUpal nuXT) project. | ||
## Links | ||
- Druxt.js: https://druxtjs.org | ||
- DruxtJS: https://druxtjs.org | ||
- Documentation: https://menu.druxtjs.org/ | ||
- Community Discord server: https://discord.druxtjs.org | ||
@@ -32,3 +33,3 @@ ## Install | ||
druxt: { | ||
baseUrl: 'https://example.com' | ||
baseUrl: 'https://demo-api.druxtjs.org' | ||
} | ||
@@ -44,7 +45,7 @@ } | ||
| Option | Type | Required | Default | Description | | ||
| --- | --- | --- | --- | --- | | ||
| `axios` | `object` | No | `{}` | [Axios instance settings](https://github.com/axios/axios#axioscreateconfig). | | ||
| `baseUrl` | `string` | Yes | `null` | Base URL for the Drupal installation. | | ||
| `endpoint` | `string` | No | `/jsonapi` | JSON:API Endpoint of the Drupal installation. | | ||
| Option | Type | Required | Default | Description | | ||
| ---------- | -------- | -------- | ---------- | ---------------------------------------------------------------------------- | | ||
| `axios` | `object` | No | `{}` | [Axios instance settings](https://github.com/axios/axios#axioscreateconfig). | | ||
| `baseUrl` | `string` | Yes | `null` | Base URL for the Drupal installation. | | ||
| `endpoint` | `string` | No | `/jsonapi` | JSON:API Endpoint of the Drupal installation. | | ||
@@ -55,4 +56,4 @@ ### Druxt Menu options | ||
| Option | Type | Required | Default | Description | | ||
| --- | --- | --- | --- | --- | | ||
| `menu.jsonApiMenuItems` | `boolean` | No | `false` | Use the Drupal [JSON:API Menu Items](https://www.drupal.org/project/jsonapi_menu_items) module resource. | | ||
| Option | Type | Required | Default | Description | | ||
| ----------------------- | --------- | -------- | ------- | -------------------------------------------------------------------------------------------------------- | | ||
| `menu.jsonApiMenuItems` | `boolean` | No | `false` | Use the Drupal [JSON:API Menu Items](https://www.drupal.org/project/jsonapi_menu_items) module resource. | |
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
Network access
Supply chain riskThis module accesses the network.
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
58366
56
6
1551
2
+ Addeddruxt@^0.3.3
+ Addeddruxt@0.3.4(transitive)
+ Addeddruxt-blocks@0.7.5(transitive)
+ Addeddruxt-entity@0.7.2(transitive)
- Removedaxios@0.19.2(transitive)
- Removeddruxt-blocks@0.5.0(transitive)
- Removeddruxt-entity@0.6.3(transitive)
- Removedfollow-redirects@1.5.10(transitive)
Updatedcodecov@^3.8.1
Updateddruxt-blocks@^0.7.3