druxt-menu 0.14.1 → 0.15.1
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 +26 -0
- package/dist/components/DruxtMenu.vue +26 -43
- package/dist/druxt-menu.esm.js +1 -2
- package/dist/druxt-menu.ssr.js +1 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# druxt-menu
|
|
2
2
|
|
|
3
|
+
## 0.15.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [45bc0b9]
|
|
8
|
+
- druxt@0.14.0
|
|
9
|
+
- druxt-blocks@0.14.2
|
|
10
|
+
|
|
11
|
+
## 0.15.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- e7b1533: Refactored DruxtModule fetch hooks
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [77ab204]
|
|
20
|
+
- druxt-blocks@0.14.0
|
|
21
|
+
- druxt@0.13.0
|
|
22
|
+
|
|
23
|
+
## 0.14.3
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 631598d: Removed debug code
|
|
28
|
+
|
|
3
29
|
## 0.14.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -150,49 +150,6 @@ export default {
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
|
|
153
|
-
/**
|
|
154
|
-
* Nuxt.js fetch method.
|
|
155
|
-
*
|
|
156
|
-
* Builds and executes the JSON:API query, loading the menu items into the
|
|
157
|
-
* druxtMenu Vuex store.
|
|
158
|
-
*/
|
|
159
|
-
async fetch() {
|
|
160
|
-
// Build wrapper component object.
|
|
161
|
-
const options = this.getModuleComponents()
|
|
162
|
-
let component = {
|
|
163
|
-
is: (((options.filter(o => o.global) || [])[0] || {}).name || 'DruxtWrapper'),
|
|
164
|
-
options: options.map(o => o.name) || [],
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Get scoped slots.
|
|
168
|
-
component.slots = Object.keys(this.getScopedSlots())
|
|
169
|
-
|
|
170
|
-
// Get wrapper component data to merge with module settings.
|
|
171
|
-
const wrapperData = await this.getWrapperData(component.is)
|
|
172
|
-
component.settings = merge(((this.$druxtMenu || {}).options || {}).menu || {}, wrapperData.druxt || {}, { arrayMerge: (dest, src) => src })
|
|
173
|
-
|
|
174
|
-
const settings = {
|
|
175
|
-
...(component.settings || {}).query,
|
|
176
|
-
max_depth: this.maxDepth || this.depth,
|
|
177
|
-
min_depth: this.minDepth,
|
|
178
|
-
parent: this.parentId,
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (!this.value) {
|
|
182
|
-
await this.getMenu({
|
|
183
|
-
name: this.name,
|
|
184
|
-
settings,
|
|
185
|
-
})
|
|
186
|
-
this.model = this.getMenuItems()
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Build wrapper component propsData.
|
|
190
|
-
component = { ...component, ...this.getModulePropsData(wrapperData.props) }
|
|
191
|
-
|
|
192
|
-
// Set component data.
|
|
193
|
-
this.component = component
|
|
194
|
-
},
|
|
195
|
-
|
|
196
153
|
fetchKey(getCounter) {
|
|
197
154
|
const parts = ['DruxtMenu', this.name, this.parentId].filter((o) => o)
|
|
198
155
|
return [...parts, getCounter(parts.join(':'))].join(':')
|
|
@@ -299,6 +256,17 @@ export default {
|
|
|
299
256
|
*/
|
|
300
257
|
componentOptions: ({ name }) => [[name], ['default']],
|
|
301
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Builds and executes the JSON:API query, loading the menu items into the
|
|
261
|
+
* druxtMenu Vuex store.
|
|
262
|
+
*/
|
|
263
|
+
async fetchData(settings) {
|
|
264
|
+
if (!this.value) {
|
|
265
|
+
await this.getMenu({ name: this.name, settings: settings.query })
|
|
266
|
+
this.model = this.getMenuItems()
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
|
|
302
270
|
/**
|
|
303
271
|
* Provides propsData for the DruxtWrapper.
|
|
304
272
|
*
|
|
@@ -307,6 +275,21 @@ export default {
|
|
|
307
275
|
*/
|
|
308
276
|
propsData: ({ model, parentId }) => ({ items: model, parentId, value: model }),
|
|
309
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Component settings.
|
|
280
|
+
*/
|
|
281
|
+
settings: ({ $druxt, depth, maxDepth, minDepth, parentId }, wrapperSettings) => {
|
|
282
|
+
const settings = merge($druxt.settings.menu || {}, wrapperSettings, { arrayMerge: (dest, src) => src })
|
|
283
|
+
return {
|
|
284
|
+
query: {
|
|
285
|
+
...(settings.query || {}),
|
|
286
|
+
max_depth: maxDepth || depth,
|
|
287
|
+
min_depth: minDepth,
|
|
288
|
+
parent: parentId,
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
|
|
310
293
|
/**
|
|
311
294
|
* Provides the scoped slots object for the Module render function.
|
|
312
295
|
*
|
package/dist/druxt-menu.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { DruxtClient } from 'druxt';
|
|
|
5
5
|
const titleFn = (parts) => parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).replace(/_/g, " ")).join("/");
|
|
6
6
|
async function DruxtMenuStorybook({ stories }) {
|
|
7
7
|
const { addTemplate, options } = this;
|
|
8
|
-
const druxt = new DruxtClient(options.druxt.baseUrl, options.druxt);
|
|
8
|
+
const druxt = new DruxtClient(options.druxt.baseUrl, { ...options.druxt, proxy: { api: false } });
|
|
9
9
|
const resourceType = "menu--menu";
|
|
10
10
|
const query = new DrupalJsonApiParams().addFilter("status", 1).addFields(resourceType, ["description", "drupal_internal__id", "label"]);
|
|
11
11
|
const collections = await druxt.getCollectionAll(resourceType, query);
|
|
@@ -122,7 +122,6 @@ class DruxtMenu {
|
|
|
122
122
|
try {
|
|
123
123
|
collections = await this.druxt.getCollectionAll(menuItemsResource, query);
|
|
124
124
|
} catch (e) {
|
|
125
|
-
console.log("ASDASDOOO");
|
|
126
125
|
return { entities };
|
|
127
126
|
}
|
|
128
127
|
for (const collection of collections) {
|
package/dist/druxt-menu.ssr.js
CHANGED
|
@@ -9,7 +9,7 @@ const druxt = require('druxt');
|
|
|
9
9
|
const titleFn = (parts) => parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).replace(/_/g, " ")).join("/");
|
|
10
10
|
async function DruxtMenuStorybook({ stories }) {
|
|
11
11
|
const { addTemplate, options } = this;
|
|
12
|
-
const druxt$1 = new druxt.DruxtClient(options.druxt.baseUrl, options.druxt);
|
|
12
|
+
const druxt$1 = new druxt.DruxtClient(options.druxt.baseUrl, { ...options.druxt, proxy: { api: false } });
|
|
13
13
|
const resourceType = "menu--menu";
|
|
14
14
|
const query = new drupalJsonapiParams.DrupalJsonApiParams().addFilter("status", 1).addFields(resourceType, ["description", "drupal_internal__id", "label"]);
|
|
15
15
|
const collections = await druxt$1.getCollectionAll(resourceType, query);
|
|
@@ -126,7 +126,6 @@ class DruxtMenu {
|
|
|
126
126
|
try {
|
|
127
127
|
collections = await this.druxt.getCollectionAll(menuItemsResource, query);
|
|
128
128
|
} catch (e) {
|
|
129
|
-
console.log("ASDASDOOO");
|
|
130
129
|
return { entities };
|
|
131
130
|
}
|
|
132
131
|
for (const collection of collections) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "Drupal Menu and Menu item Druxt components, with support for the JSON:API Menu Items module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"deepmerge": "^4.2.2",
|
|
46
46
|
"drupal-jsonapi-params": "^1.1.12",
|
|
47
|
-
"druxt": "^0.
|
|
48
|
-
"druxt-blocks": "^0.
|
|
47
|
+
"druxt": "^0.14.0",
|
|
48
|
+
"druxt-blocks": "^0.14.2"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
51
|
"vue": "^2.6.14",
|