@vuecs/navigation 1.1.1 → 2.0.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.
- package/README.md +54 -142
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/item/index.d.ts +2 -0
- package/dist/components/item/index.d.ts.map +1 -0
- package/dist/components/item/module.d.ts +16 -0
- package/dist/components/item/module.d.ts.map +1 -0
- package/dist/components/items/index.d.ts +2 -0
- package/dist/components/items/index.d.ts.map +1 -0
- package/dist/components/items/module.d.ts +27 -0
- package/dist/components/items/module.d.ts.map +1 -0
- package/dist/helpers/component/build.d.ts +3 -0
- package/dist/helpers/component/build.d.ts.map +1 -0
- package/dist/helpers/component/index.d.ts +3 -0
- package/dist/helpers/component/index.d.ts.map +1 -0
- package/dist/helpers/component/types.d.ts +17 -0
- package/dist/helpers/component/types.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/level.d.ts +11 -0
- package/dist/helpers/level.d.ts.map +1 -0
- package/dist/helpers/match.d.ts +7 -0
- package/dist/helpers/match.d.ts.map +1 -0
- package/dist/helpers/normalize.d.ts +8 -0
- package/dist/helpers/normalize.d.ts.map +1 -0
- package/dist/helpers/reset.d.ts +3 -0
- package/dist/helpers/reset.d.ts.map +1 -0
- package/dist/helpers/trace.d.ts +3 -0
- package/dist/helpers/trace.d.ts.map +1 -0
- package/dist/helpers/url.d.ts.map +1 -0
- package/dist/index.cjs +453 -456
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +87 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +452 -452
- package/dist/index.mjs.map +1 -1
- package/dist/manager/index.d.ts +4 -0
- package/dist/manager/index.d.ts.map +1 -0
- package/dist/manager/module.d.ts +19 -0
- package/dist/manager/module.d.ts.map +1 -0
- package/dist/manager/singleton.d.ts +5 -0
- package/dist/manager/singleton.d.ts.map +1 -0
- package/dist/manager/types.d.ts +8 -0
- package/dist/manager/types.d.ts.map +1 -0
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +10 -6
- package/dist/components/item.d.ts +0 -26
- package/dist/components/item.d.ts.map +0 -1
- package/dist/components/items.d.ts +0 -27
- package/dist/components/items.d.ts.map +0 -1
- package/dist/core/build.d.ts +0 -4
- package/dist/core/build.d.ts.map +0 -1
- package/dist/core/check.d.ts +0 -3
- package/dist/core/check.d.ts.map +0 -1
- package/dist/core/expansion.d.ts +0 -6
- package/dist/core/expansion.d.ts.map +0 -1
- package/dist/core/flatten.d.ts +0 -3
- package/dist/core/flatten.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -12
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/match.d.ts +0 -3
- package/dist/core/match.d.ts.map +0 -1
- package/dist/core/reduce.d.ts +0 -8
- package/dist/core/reduce.d.ts.map +0 -1
- package/dist/core/refresh.d.ts +0 -3
- package/dist/core/refresh.d.ts.map +0 -1
- package/dist/core/replace.d.ts +0 -6
- package/dist/core/replace.d.ts.map +0 -1
- package/dist/core/reset.d.ts +0 -3
- package/dist/core/reset.d.ts.map +0 -1
- package/dist/core/select.d.ts +0 -4
- package/dist/core/select.d.ts.map +0 -1
- package/dist/core/tier.d.ts +0 -7
- package/dist/core/tier.d.ts.map +0 -1
- package/dist/core/toggle.d.ts +0 -4
- package/dist/core/toggle.d.ts.map +0 -1
- package/dist/module.d.ts +0 -3
- package/dist/module.d.ts.map +0 -1
- package/dist/provider/index.d.ts +0 -3
- package/dist/provider/index.d.ts.map +0 -1
- package/dist/provider/module.d.ts +0 -5
- package/dist/provider/module.d.ts.map +0 -1
- package/dist/provider/type.d.ts +0 -8
- package/dist/provider/type.d.ts.map +0 -1
- package/dist/store/index.d.ts +0 -3
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/module.d.ts +0 -7
- package/dist/store/module.d.ts.map +0 -1
- package/dist/store/type.d.ts +0 -16
- package/dist/store/type.d.ts.map +0 -1
- package/dist/type.d.ts +0 -27
- package/dist/type.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/url.d.ts.map +0 -1
- /package/dist/{utils → helpers}/url.d.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -3,438 +3,489 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@vuecs/core');
|
|
6
|
-
var
|
|
6
|
+
var eventEmitter = require('@posva/event-emitter');
|
|
7
7
|
var link = require('@vuecs/link');
|
|
8
|
+
var vue = require('vue');
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
function buildComponentOptions() {
|
|
11
|
+
const manager = core.createComponentOptionsManager({
|
|
12
|
+
name: 'navigation'
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
groupClass: core.mergeOption('class', manager.get('groupClass'), 'vc-nav-items'),
|
|
16
|
+
groupTag: manager.get('groupTag') || 'ul',
|
|
17
|
+
itemClass: core.mergeOption('class', manager.get('itemClass'), 'vc-nav-item'),
|
|
18
|
+
itemTag: manager.get('itemTag') || 'li',
|
|
19
|
+
subGroupTitleClass: core.mergeOption('class', manager.get('subGroupTitleClass'), 'vc-nav-sub-level-title'),
|
|
20
|
+
subGroupItemsClass: core.mergeOption('class', manager.get('subGroupTitleClass'), 'vc-nav-sub-level-items'),
|
|
21
|
+
separatorTag: manager.get('separatorTag') || 'div',
|
|
22
|
+
separatorClass: core.mergeOption('class', manager.get('iconClass'), 'vc-nav-separator'),
|
|
23
|
+
iconClass: core.mergeOption('class', manager.get('iconClass'), 'vc-nav-icon'),
|
|
24
|
+
linkClass: core.mergeOption('class', manager.get('linkClass'), 'vc-nav-link'),
|
|
25
|
+
linkRootClass: core.mergeOption('class', manager.get('linkRootClass'), 'vc-nav-link-root'),
|
|
26
|
+
linkTextTag: manager.get('linkTextTag') || 'span',
|
|
27
|
+
linkTextClass: core.mergeOption('class', manager.get('linkTextClass'), 'vc-nav-link-text')
|
|
28
|
+
};
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
function findItemMatchesIF(items, options, parent) {
|
|
32
|
+
const output = [];
|
|
33
|
+
for(let i = 0; i < items.length; i++){
|
|
34
|
+
const item = items[i];
|
|
35
|
+
let { score } = parent;
|
|
36
|
+
if (options.path) {
|
|
37
|
+
if (item.activeMatch) {
|
|
38
|
+
if (item.activeMatch === options.path) {
|
|
39
|
+
score += 3;
|
|
40
|
+
} else if (options.path.startsWith(item.activeMatch)) {
|
|
41
|
+
score += 2;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (item.url && item.url !== '/') {
|
|
45
|
+
if (item.url === options.path) {
|
|
46
|
+
score += 3;
|
|
47
|
+
} else if (options.path.startsWith(item.url)) {
|
|
48
|
+
score += 2;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (item.default) {
|
|
53
|
+
score += 1;
|
|
54
|
+
}
|
|
55
|
+
if (item.children) {
|
|
56
|
+
const childMatches = findItemMatchesIF(item.children, options, {
|
|
57
|
+
score
|
|
58
|
+
});
|
|
59
|
+
output.push(...childMatches);
|
|
60
|
+
}
|
|
61
|
+
output.push({
|
|
62
|
+
data: item,
|
|
63
|
+
score
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return output.sort((a, b)=>b.score - a.score);
|
|
67
|
+
}
|
|
68
|
+
function findBestItemMatches(items, options = {}) {
|
|
69
|
+
const result = findItemMatchesIF(items, options, {
|
|
70
|
+
score: 0
|
|
71
|
+
});
|
|
72
|
+
const [first] = result;
|
|
73
|
+
if (!first) {
|
|
74
|
+
return [];
|
|
31
75
|
}
|
|
32
|
-
|
|
33
|
-
return !!instance;
|
|
76
|
+
return result.filter((match)=>match.score === first.score).map((match)=>match.data);
|
|
34
77
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* Copyright (c) 2024.
|
|
81
|
+
* Author Peter Placzek (tada5hi)
|
|
82
|
+
* For the full copyright and license information,
|
|
83
|
+
* view the LICENSE file that was distributed with this source code.
|
|
84
|
+
*/ function normalizeItemIF(item, defaults, trace) {
|
|
85
|
+
const output = {
|
|
86
|
+
...item,
|
|
87
|
+
level: defaults.level,
|
|
88
|
+
children: [],
|
|
89
|
+
trace: [
|
|
90
|
+
...trace,
|
|
91
|
+
item.name
|
|
92
|
+
]
|
|
39
93
|
};
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
vue.provide(StoreSymbol, store);
|
|
45
|
-
return;
|
|
94
|
+
if (!item.children) {
|
|
95
|
+
return output;
|
|
46
96
|
}
|
|
47
|
-
|
|
48
|
-
|
|
97
|
+
for(let i = 0; i < item.children.length; i++){
|
|
98
|
+
output.children.push(normalizeItemIF(item.children[i], defaults, output.trace));
|
|
49
99
|
}
|
|
50
|
-
|
|
100
|
+
return output;
|
|
51
101
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return instance;
|
|
102
|
+
function normalizeItem(item, defaults) {
|
|
103
|
+
return normalizeItemIF(item, defaults, []);
|
|
104
|
+
}
|
|
105
|
+
function normalizeItems(items, options) {
|
|
106
|
+
return items.map((item)=>normalizeItem(item, options));
|
|
58
107
|
}
|
|
59
108
|
|
|
60
|
-
|
|
61
|
-
|
|
109
|
+
/*
|
|
110
|
+
* Copyright (c) 2024.
|
|
111
|
+
* Author Peter Placzek (tada5hi)
|
|
112
|
+
* For the full copyright and license information,
|
|
113
|
+
* view the LICENSE file that was distributed with this source code.
|
|
114
|
+
*/ function isTraceEqual(a, b) {
|
|
115
|
+
if (a.length !== b.length) {
|
|
62
116
|
return false;
|
|
63
117
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (one.name && two.name && one.name === two.name) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
if (one.url && two.url && one.url === two.url) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
if (one.children && two.children && one.children.length === two.children.length) {
|
|
74
|
-
for(let i = 0; i < one.children.length; i++){
|
|
75
|
-
if (!isNavigationItemMatch(one.children[i], two.children[i])) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
118
|
+
for(let i = 0; i < a.length; i++){
|
|
119
|
+
if (a[i] !== b[i]) {
|
|
120
|
+
return false;
|
|
78
121
|
}
|
|
79
|
-
return true;
|
|
80
122
|
}
|
|
81
|
-
return
|
|
123
|
+
return true;
|
|
82
124
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
for(let i = 0; i < items.length; i++){
|
|
88
|
-
const isMatch = isNavigationItemMatch(items[i], item);
|
|
89
|
-
let isChildMatch = false;
|
|
90
|
-
const { children } = items[i];
|
|
91
|
-
if (typeof children !== 'undefined') {
|
|
92
|
-
const { items: childItems, match: childMatch } = setNavigationExpansion(children, item, isMatch);
|
|
93
|
-
items[i].children = childItems;
|
|
94
|
-
isChildMatch = childMatch;
|
|
95
|
-
}
|
|
96
|
-
if (isMatch) {
|
|
97
|
-
items[i].active = true;
|
|
98
|
-
}
|
|
99
|
-
if (isMatch || isChildMatch) {
|
|
100
|
-
items[i].display = true;
|
|
101
|
-
items[i].displayChildren = true;
|
|
102
|
-
}
|
|
103
|
-
if (parentMatch) {
|
|
104
|
-
items[i].display = true;
|
|
105
|
-
}
|
|
106
|
-
if (!matchInIteration) {
|
|
107
|
-
matchInIteration = isMatch || isChildMatch;
|
|
125
|
+
function isTracePartOf(item, parent) {
|
|
126
|
+
for(let i = 0; i < item.length; i++){
|
|
127
|
+
if (parent[i] !== item[i]) {
|
|
128
|
+
return false;
|
|
108
129
|
}
|
|
109
130
|
}
|
|
110
|
-
|
|
111
|
-
for(let i = 0; i < items.length; i++){
|
|
112
|
-
items[i].display = true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
items,
|
|
117
|
-
match: matchInIteration
|
|
118
|
-
};
|
|
131
|
+
return true;
|
|
119
132
|
}
|
|
120
133
|
|
|
121
|
-
function
|
|
134
|
+
function resetItemsByTraceIF(items, trace) {
|
|
122
135
|
for(let i = 0; i < items.length; i++){
|
|
123
|
-
items[i]
|
|
124
|
-
items[i].
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
|
|
136
|
+
const item = items[i];
|
|
137
|
+
const isEqual = isTraceEqual(items[i].trace, trace);
|
|
138
|
+
item.active = isEqual;
|
|
139
|
+
item.display = true;
|
|
140
|
+
if (isEqual) {
|
|
141
|
+
item.displayChildren = true;
|
|
142
|
+
} else {
|
|
143
|
+
item.displayChildren = isTracePartOf(item.trace, trace);
|
|
129
144
|
}
|
|
145
|
+
item.children = resetItemsByTraceIF(item.children, trace);
|
|
130
146
|
}
|
|
131
147
|
return items;
|
|
132
148
|
}
|
|
149
|
+
function resetItemsByTrace(items, trace) {
|
|
150
|
+
return resetItemsByTraceIF(items, trace);
|
|
151
|
+
}
|
|
133
152
|
|
|
134
|
-
function
|
|
135
|
-
|
|
136
|
-
return items.filter(filterFn);
|
|
153
|
+
function findItemsWithLevel(items, tier) {
|
|
154
|
+
return items.filter((item)=>item.level === tier);
|
|
137
155
|
}
|
|
138
|
-
function
|
|
139
|
-
const data =
|
|
156
|
+
function findItemWithLevel(tier, items) {
|
|
157
|
+
const data = findItemsWithLevel(items, tier);
|
|
140
158
|
if (data.length >= 1) {
|
|
141
159
|
return data[0];
|
|
142
160
|
}
|
|
143
161
|
return undefined;
|
|
144
162
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
147
|
-
component.tier = tier;
|
|
148
|
-
return component;
|
|
149
|
-
};
|
|
150
|
-
if (vue.isRef(items)) {
|
|
151
|
-
return items.value.map(mapFn);
|
|
152
|
-
}
|
|
153
|
-
return items.map(mapFn);
|
|
154
|
-
}
|
|
155
|
-
function removeTierFromNavigationItems(items, tier) {
|
|
156
|
-
const filterFn = (items)=>typeof items.tier === 'undefined' || items.tier !== tier;
|
|
157
|
-
if (vue.isRef(items)) {
|
|
158
|
-
return items.value.filter(filterFn);
|
|
159
|
-
}
|
|
160
|
-
return items.filter(filterFn);
|
|
163
|
+
function removeItemsWithLevel(tier, items) {
|
|
164
|
+
return items.filter((item)=>item.level !== tier);
|
|
161
165
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
item
|
|
166
|
+
function replaceLevelItem(tier, input, next) {
|
|
167
|
+
const output = removeItemsWithLevel(tier, input);
|
|
168
|
+
if (next) {
|
|
169
|
+
next.level = tier;
|
|
170
|
+
return [
|
|
171
|
+
...output,
|
|
172
|
+
next
|
|
170
173
|
];
|
|
171
|
-
} else {
|
|
172
|
-
store.itemsActive.value = items;
|
|
173
174
|
}
|
|
175
|
+
return output;
|
|
174
176
|
}
|
|
175
|
-
function
|
|
176
|
-
const componentsExisting =
|
|
177
|
-
|
|
177
|
+
function replaceLevelItems(tier, src, next) {
|
|
178
|
+
const componentsExisting = removeItemsWithLevel(tier, src);
|
|
179
|
+
return [
|
|
178
180
|
...componentsExisting,
|
|
179
|
-
...
|
|
181
|
+
...next
|
|
180
182
|
];
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
const component = findNavigationItemForTier(store.itemsActive.value, tier);
|
|
186
|
-
if (component) {
|
|
187
|
-
const { items } = setNavigationExpansion(components, component);
|
|
188
|
-
replaceNavigationTierItems(store, tier, items);
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
replaceNavigationTierItems(store, tier, components);
|
|
185
|
+
function isAbsoluteURL(str) {
|
|
186
|
+
return str.substring(0, 7) === 'http://' || str.substring(0, 8) === 'https://';
|
|
192
187
|
}
|
|
193
188
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
189
|
+
class NavigationManager extends eventEmitter.EventEmitter {
|
|
190
|
+
getItems(tier) {
|
|
191
|
+
if (typeof tier === 'undefined') {
|
|
192
|
+
return this.items;
|
|
193
|
+
}
|
|
194
|
+
return this.items.filter((item)=>item.level === tier);
|
|
195
|
+
}
|
|
196
|
+
async build(options) {
|
|
197
|
+
if (this.built) {
|
|
198
|
+
return this.items;
|
|
199
|
+
}
|
|
200
|
+
this.built = true;
|
|
201
|
+
this.items = [];
|
|
202
|
+
this.itemsActive = [];
|
|
203
|
+
let parent;
|
|
204
|
+
let level = 0;
|
|
205
|
+
while(true){
|
|
206
|
+
const raw = await this.itemsFn({
|
|
207
|
+
level,
|
|
208
|
+
parent
|
|
209
|
+
});
|
|
210
|
+
if (!raw || raw.length === 0) {
|
|
202
211
|
break;
|
|
203
212
|
}
|
|
204
|
-
|
|
205
|
-
|
|
213
|
+
const items = normalizeItems(raw, {
|
|
214
|
+
level
|
|
215
|
+
});
|
|
216
|
+
const matches = findBestItemMatches(items, {
|
|
217
|
+
path: options.path
|
|
218
|
+
});
|
|
219
|
+
const [match] = matches;
|
|
220
|
+
if (!match) {
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
this.itemsActive.push(match);
|
|
224
|
+
await this.buildLevel(level);
|
|
225
|
+
parent = match;
|
|
226
|
+
level++;
|
|
206
227
|
}
|
|
228
|
+
this.emit('updated', this.items);
|
|
229
|
+
return this.items;
|
|
207
230
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
if (children && children.length > 0) {
|
|
223
|
-
output.push(...flattenNestedNavigationItems([
|
|
224
|
-
...children
|
|
225
|
-
]));
|
|
231
|
+
async select(level, itemNew) {
|
|
232
|
+
const itemOld = findItemWithLevel(level, this.itemsActive);
|
|
233
|
+
if (itemOld && isTraceEqual(itemOld.trace, itemNew.trace)) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
this.itemsActive = this.itemsActive.filter((el)=>el.level < level);
|
|
237
|
+
this.itemsActive.push(itemNew);
|
|
238
|
+
const startLevel = level;
|
|
239
|
+
while(true){
|
|
240
|
+
const built = await this.buildLevel(level, startLevel === level);
|
|
241
|
+
if (!built) {
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
level++;
|
|
226
245
|
}
|
|
227
246
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
247
|
+
async toggle(level, item) {
|
|
248
|
+
let isMatch;
|
|
249
|
+
if (item.displayChildren) {
|
|
250
|
+
isMatch = true;
|
|
251
|
+
} else {
|
|
252
|
+
const itemOld = findItemWithLevel(level, this.itemsActive);
|
|
253
|
+
isMatch = !!itemOld && isTraceEqual(item.trace, itemOld.trace);
|
|
254
|
+
}
|
|
255
|
+
if (isMatch) {
|
|
256
|
+
this.itemsActive = removeItemsWithLevel(level, this.itemsActive);
|
|
257
|
+
} else {
|
|
258
|
+
this.itemsActive = replaceLevelItem(level, this.itemsActive, item);
|
|
259
|
+
}
|
|
260
|
+
await this.buildLevel(level, true);
|
|
261
|
+
}
|
|
262
|
+
async buildLevel(level, cached) {
|
|
263
|
+
let items;
|
|
264
|
+
if (cached) {
|
|
265
|
+
items = findItemsWithLevel(this.items, level);
|
|
266
|
+
} else {
|
|
267
|
+
const parent = findItemWithLevel(level - 1, this.itemsActive);
|
|
268
|
+
const raw = await this.itemsFn({
|
|
269
|
+
level,
|
|
270
|
+
parent
|
|
271
|
+
});
|
|
272
|
+
items = raw && raw.length > 0 ? normalizeItems(raw, {
|
|
273
|
+
level
|
|
274
|
+
}) : [];
|
|
275
|
+
}
|
|
276
|
+
if (!items || items.length === 0) {
|
|
277
|
+
this.items = this.items.filter((item)=>item.level < level);
|
|
278
|
+
this.emit('tierUpdated', level, []);
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
let trace = [];
|
|
282
|
+
const item = findItemWithLevel(level, this.itemsActive);
|
|
283
|
+
if (item) {
|
|
284
|
+
trace = item.trace;
|
|
285
|
+
}
|
|
286
|
+
resetItemsByTrace(items, trace);
|
|
287
|
+
this.items = replaceLevelItems(level, this.items, items);
|
|
288
|
+
this.emit('tierUpdated', level, items);
|
|
289
|
+
return true;
|
|
235
290
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
291
|
+
constructor(options){
|
|
292
|
+
super();
|
|
293
|
+
let itemsFn;
|
|
294
|
+
if (typeof options.items === 'function') {
|
|
295
|
+
itemsFn = options.items;
|
|
296
|
+
} else {
|
|
297
|
+
itemsFn = async ({ level })=>{
|
|
298
|
+
if (level > 0) {
|
|
299
|
+
return [];
|
|
300
|
+
}
|
|
301
|
+
return options.items;
|
|
302
|
+
};
|
|
244
303
|
}
|
|
245
|
-
|
|
304
|
+
this.itemsFn = itemsFn;
|
|
305
|
+
this.items = [];
|
|
306
|
+
this.itemsActive = [];
|
|
307
|
+
this.built = false;
|
|
246
308
|
}
|
|
247
309
|
}
|
|
248
310
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
replaceNavigationTierItemActive(store, tier, component);
|
|
311
|
+
const sym = Symbol.for('VCNavigationManager');
|
|
312
|
+
function injectNavigationManager(app) {
|
|
313
|
+
const instance = core.inject(sym, app);
|
|
314
|
+
if (!instance) {
|
|
315
|
+
throw new Error('A navigation provider has not been provided.');
|
|
255
316
|
}
|
|
256
|
-
|
|
317
|
+
return instance;
|
|
257
318
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return str.substring(0, 7) === 'http://' || str.substring(0, 8) === 'https://';
|
|
319
|
+
function provideNavigationManager(manager, app) {
|
|
320
|
+
core.provide(sym, manager, app);
|
|
261
321
|
}
|
|
262
322
|
|
|
263
|
-
var SlotName
|
|
264
|
-
(function(SlotName) {
|
|
323
|
+
var SlotName = /*#__PURE__*/ function(SlotName) {
|
|
265
324
|
SlotName["ITEM"] = "item";
|
|
266
325
|
SlotName["SEPARATOR"] = "separator";
|
|
267
326
|
SlotName["LINK"] = "link";
|
|
268
327
|
SlotName["SUB"] = "sub";
|
|
269
328
|
SlotName["SUB_TITLE"] = "sub-title";
|
|
270
329
|
SlotName["SUB_ITEMS"] = "sub-items";
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
330
|
+
return SlotName;
|
|
331
|
+
}({});
|
|
332
|
+
var ElementType = /*#__PURE__*/ function(ElementType) {
|
|
274
333
|
ElementType["LINK"] = "link";
|
|
275
334
|
ElementType["SEPARATOR"] = "separator";
|
|
276
|
-
|
|
335
|
+
return ElementType;
|
|
336
|
+
}({});
|
|
277
337
|
|
|
278
338
|
const VCNavItem = vue.defineComponent({
|
|
279
339
|
props: {
|
|
280
|
-
|
|
281
|
-
type: Number,
|
|
282
|
-
default: 0
|
|
283
|
-
},
|
|
284
|
-
component: {
|
|
340
|
+
data: {
|
|
285
341
|
type: Object,
|
|
286
342
|
required: true
|
|
287
343
|
}
|
|
288
344
|
},
|
|
289
345
|
setup (props, { slots }) {
|
|
290
|
-
const
|
|
291
|
-
const
|
|
292
|
-
const
|
|
293
|
-
|
|
346
|
+
const itemsNode = vue.resolveComponent('VCNavItems');
|
|
347
|
+
const options = buildComponentOptions();
|
|
348
|
+
const manager = injectNavigationManager();
|
|
349
|
+
const data = vue.toRef(props, 'data');
|
|
350
|
+
const select = async (value)=>{
|
|
351
|
+
await manager.select(data.value.level, value);
|
|
352
|
+
};
|
|
353
|
+
const toggle = async (value)=>{
|
|
354
|
+
await manager.toggle(data.value.level, value);
|
|
294
355
|
};
|
|
295
|
-
const toggleComponentExpansion = async (value)=>toggleNavigation(store, props.tier, value);
|
|
296
356
|
return ()=>{
|
|
297
357
|
const buildItem = ()=>{
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
358
|
+
// type: separator
|
|
359
|
+
if (data.value.type === ElementType.SEPARATOR) {
|
|
360
|
+
const hasSlot = core.hasNormalizedSlot(SlotName.SEPARATOR, slots);
|
|
361
|
+
if (hasSlot) {
|
|
362
|
+
return core.normalizeSlot(SlotName.SEPARATOR, {
|
|
363
|
+
data: data.value
|
|
364
|
+
}, slots);
|
|
365
|
+
}
|
|
366
|
+
return vue.h(options.separatorTag, {
|
|
367
|
+
class: options.separatorClass
|
|
368
|
+
}, data.value.name);
|
|
369
|
+
}
|
|
370
|
+
// type: group
|
|
371
|
+
if (!data.value.children || data.value.children.length === 0) {
|
|
372
|
+
const hasSlot = core.hasNormalizedSlot(SlotName.LINK, slots);
|
|
373
|
+
if (hasSlot) {
|
|
374
|
+
return core.normalizeSlot(SlotName.LINK, {
|
|
375
|
+
data: data.value,
|
|
376
|
+
select,
|
|
377
|
+
isActive: data.value.active
|
|
378
|
+
}, slots);
|
|
379
|
+
}
|
|
380
|
+
const linkProps = {
|
|
381
|
+
active: data.value.active,
|
|
382
|
+
disabled: false,
|
|
383
|
+
prefetch: true
|
|
384
|
+
};
|
|
385
|
+
if (data.value.url) {
|
|
386
|
+
if (isAbsoluteURL(data.value.url) || data.value.url.startsWith('#')) {
|
|
387
|
+
linkProps.href = data.value.url;
|
|
388
|
+
if (data.value.urlTarget) {
|
|
389
|
+
linkProps.target = data.value.urlTarget;
|
|
311
390
|
}
|
|
312
|
-
|
|
391
|
+
} else {
|
|
392
|
+
linkProps.to = data.value.url;
|
|
313
393
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
active: component.value.active,
|
|
327
|
-
disabled: false,
|
|
328
|
-
prefetch: true
|
|
329
|
-
};
|
|
330
|
-
if (component.value.url) {
|
|
331
|
-
if (isAbsoluteURL(component.value.url) || component.value.url.startsWith('#')) {
|
|
332
|
-
linkProps.href = component.value.url;
|
|
333
|
-
if (component.value.urlTarget) {
|
|
334
|
-
linkProps.target = component.value.urlTarget;
|
|
335
|
-
}
|
|
336
|
-
} else {
|
|
337
|
-
linkProps.to = component.value.url;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
item = vue.h(link.VCLink, {
|
|
341
|
-
class: [
|
|
342
|
-
'nav-link',
|
|
343
|
-
{
|
|
344
|
-
'root-link': component.value.root
|
|
345
|
-
}
|
|
346
|
-
],
|
|
347
|
-
...linkProps,
|
|
348
|
-
onClicked () {
|
|
349
|
-
if (!component.value.url) {
|
|
350
|
-
return selectComponent.call(null, component.value);
|
|
351
|
-
}
|
|
352
|
-
return undefined;
|
|
353
|
-
},
|
|
354
|
-
onClick () {
|
|
355
|
-
return selectComponent.call(null, component.value);
|
|
356
|
-
}
|
|
357
|
-
}, {
|
|
358
|
-
default: ()=>[
|
|
359
|
-
...component.value.icon ? [
|
|
360
|
-
vue.h('i', {
|
|
361
|
-
class: component.value.icon
|
|
362
|
-
})
|
|
363
|
-
] : [],
|
|
364
|
-
vue.h('span', {
|
|
365
|
-
class: 'nav-link-text'
|
|
366
|
-
}, [
|
|
367
|
-
component.value.name
|
|
368
|
-
])
|
|
369
|
-
]
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
} else if (core.hasNormalizedSlot(SlotName.SUB, slots)) {
|
|
373
|
-
item = core.normalizeSlot(SlotName.SUB, {
|
|
374
|
-
component: component.value,
|
|
375
|
-
selectComponent,
|
|
376
|
-
toggleComponentExpansion
|
|
377
|
-
}, slots);
|
|
378
|
-
} else {
|
|
379
|
-
let title;
|
|
380
|
-
if (core.hasNormalizedSlot(SlotName.SUB_TITLE, slots)) {
|
|
381
|
-
title = core.normalizeSlot(SlotName.SUB_TITLE, {
|
|
382
|
-
component: component.value,
|
|
383
|
-
selectComponent,
|
|
384
|
-
toggleComponentExpansion
|
|
385
|
-
});
|
|
386
|
-
} else {
|
|
387
|
-
title = vue.h('div', {
|
|
388
|
-
class: 'nav-sub-title',
|
|
389
|
-
onClick ($event) {
|
|
390
|
-
$event.preventDefault();
|
|
391
|
-
return toggleComponentExpansion.call(null, component.value);
|
|
392
|
-
}
|
|
393
|
-
}, [
|
|
394
|
-
[
|
|
395
|
-
...component.value.icon ? [
|
|
396
|
-
vue.h('i', {
|
|
397
|
-
class: component.value.icon
|
|
398
|
-
})
|
|
399
|
-
] : [],
|
|
400
|
-
vue.h('span', {
|
|
401
|
-
class: 'nav-link-text'
|
|
402
|
-
}, [
|
|
403
|
-
component.value.name
|
|
404
|
-
])
|
|
405
|
-
]
|
|
406
|
-
]);
|
|
407
|
-
}
|
|
408
|
-
let items;
|
|
409
|
-
if (core.hasNormalizedSlot(SlotName.SUB_ITEMS, slots)) {
|
|
410
|
-
items = core.normalizeSlot(SlotName.SUB_ITEMS, {
|
|
411
|
-
component: component.value,
|
|
412
|
-
selectComponent,
|
|
413
|
-
toggleComponentExpansion
|
|
414
|
-
});
|
|
415
|
-
} else if (component.value.displayChildren) {
|
|
416
|
-
const navigationComponents = vue.resolveComponent('VCNavItems');
|
|
417
|
-
items = vue.h(navigationComponents, {
|
|
418
|
-
class: 'list-unstyled nav-sub-items',
|
|
419
|
-
tier: props.tier,
|
|
420
|
-
entities: component.value.children
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
item = [
|
|
424
|
-
title,
|
|
425
|
-
items
|
|
426
|
-
];
|
|
394
|
+
}
|
|
395
|
+
return vue.h(link.VCLink, {
|
|
396
|
+
class: [
|
|
397
|
+
options.linkClass,
|
|
398
|
+
data.value.url && data.value.url === '/' ? [
|
|
399
|
+
options.linkRootClass
|
|
400
|
+
] : []
|
|
401
|
+
],
|
|
402
|
+
...linkProps,
|
|
403
|
+
onClicked () {
|
|
404
|
+
if (!data.value.url) {
|
|
405
|
+
return select.call(null, data.value);
|
|
427
406
|
}
|
|
428
|
-
|
|
407
|
+
return undefined;
|
|
408
|
+
},
|
|
409
|
+
onClick () {
|
|
410
|
+
return select.call(null, data.value);
|
|
411
|
+
}
|
|
412
|
+
}, {
|
|
413
|
+
default: ()=>[
|
|
414
|
+
...data.value.icon ? [
|
|
415
|
+
vue.h('i', {
|
|
416
|
+
class: data.value.icon
|
|
417
|
+
})
|
|
418
|
+
] : [],
|
|
419
|
+
vue.h(options.linkTextTag, {
|
|
420
|
+
class: options.linkTextClass
|
|
421
|
+
}, [
|
|
422
|
+
data.value.name
|
|
423
|
+
])
|
|
424
|
+
]
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
if (core.hasNormalizedSlot(SlotName.SUB, slots)) {
|
|
428
|
+
return core.normalizeSlot(SlotName.SUB, {
|
|
429
|
+
data: data.value,
|
|
430
|
+
select,
|
|
431
|
+
toggle
|
|
432
|
+
}, slots);
|
|
433
|
+
}
|
|
434
|
+
let title;
|
|
435
|
+
if (core.hasNormalizedSlot(SlotName.SUB_TITLE, slots)) {
|
|
436
|
+
title = core.normalizeSlot(SlotName.SUB_TITLE, {
|
|
437
|
+
data: data.value,
|
|
438
|
+
select,
|
|
439
|
+
toggle
|
|
440
|
+
});
|
|
441
|
+
} else {
|
|
442
|
+
title = vue.h('div', {
|
|
443
|
+
class: options.subGroupTitleClass,
|
|
444
|
+
onClick ($event) {
|
|
445
|
+
$event.preventDefault();
|
|
446
|
+
return toggle(data.value);
|
|
429
447
|
}
|
|
448
|
+
}, [
|
|
449
|
+
[
|
|
450
|
+
...data.value.icon ? [
|
|
451
|
+
vue.h('i', {
|
|
452
|
+
class: data.value.icon
|
|
453
|
+
})
|
|
454
|
+
] : [],
|
|
455
|
+
vue.h(options.linkTextTag, {
|
|
456
|
+
class: options.linkTextClass
|
|
457
|
+
}, [
|
|
458
|
+
data.value.name
|
|
459
|
+
])
|
|
460
|
+
]
|
|
461
|
+
]);
|
|
430
462
|
}
|
|
431
|
-
|
|
463
|
+
if (!data.value.displayChildren) {
|
|
464
|
+
return title;
|
|
465
|
+
}
|
|
466
|
+
let vNodes;
|
|
467
|
+
if (core.hasNormalizedSlot(SlotName.SUB_ITEMS, slots)) {
|
|
468
|
+
vNodes = core.normalizeSlot(SlotName.SUB_ITEMS, {
|
|
469
|
+
data: data.value,
|
|
470
|
+
select,
|
|
471
|
+
toggle
|
|
472
|
+
});
|
|
473
|
+
} else {
|
|
474
|
+
vNodes = vue.h(itemsNode, {
|
|
475
|
+
level: data.value.level,
|
|
476
|
+
data: data.value.children
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
return [
|
|
480
|
+
title,
|
|
481
|
+
vNodes
|
|
482
|
+
];
|
|
432
483
|
};
|
|
433
|
-
return vue.h(
|
|
484
|
+
return vue.h(options.itemTag, {
|
|
434
485
|
class: [
|
|
435
|
-
|
|
486
|
+
options.itemClass,
|
|
436
487
|
{
|
|
437
|
-
active:
|
|
488
|
+
active: data.value.active || data.value.displayChildren
|
|
438
489
|
}
|
|
439
490
|
]
|
|
440
491
|
}, [
|
|
@@ -446,127 +497,76 @@ const VCNavItem = vue.defineComponent({
|
|
|
446
497
|
|
|
447
498
|
const VCNavItems = vue.defineComponent({
|
|
448
499
|
props: {
|
|
449
|
-
|
|
500
|
+
level: {
|
|
450
501
|
type: Number,
|
|
451
502
|
default: 0
|
|
452
503
|
},
|
|
453
|
-
|
|
504
|
+
data: {
|
|
454
505
|
type: Array,
|
|
455
506
|
default: undefined
|
|
456
507
|
}
|
|
457
508
|
},
|
|
458
509
|
setup (props, { slots }) {
|
|
459
|
-
const
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
};
|
|
472
|
-
const buildChildren = ()=>{
|
|
473
|
-
const entities = [];
|
|
474
|
-
if (items.value) {
|
|
475
|
-
for(let i = 0; i < items.value.length; i++){
|
|
476
|
-
if (items.value[i].display) {
|
|
477
|
-
entities.push(vue.h('li', {
|
|
478
|
-
key: i
|
|
479
|
-
}, [
|
|
480
|
-
buildChild({
|
|
481
|
-
tier: props.tier,
|
|
482
|
-
component: items.value[i]
|
|
483
|
-
})
|
|
484
|
-
]));
|
|
485
|
-
}
|
|
510
|
+
const options = buildComponentOptions();
|
|
511
|
+
const manager = injectNavigationManager();
|
|
512
|
+
const managerItems = vue.ref([]);
|
|
513
|
+
if (!props.data) {
|
|
514
|
+
managerItems.value = manager.getItems(props.level);
|
|
515
|
+
}
|
|
516
|
+
const counter = vue.ref(0);
|
|
517
|
+
let removeListener;
|
|
518
|
+
vue.onMounted(()=>{
|
|
519
|
+
removeListener = manager.on('tierUpdated', (tier, items)=>{
|
|
520
|
+
if (tier !== props.level) {
|
|
521
|
+
return;
|
|
486
522
|
}
|
|
523
|
+
managerItems.value = items;
|
|
524
|
+
counter.value++;
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
vue.onUnmounted(()=>{
|
|
528
|
+
if (typeof removeListener === 'function') {
|
|
529
|
+
removeListener();
|
|
530
|
+
removeListener = undefined;
|
|
487
531
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}, [
|
|
493
|
-
buildChildren()
|
|
494
|
-
]);
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
async function buildNavigation(context = {}) {
|
|
499
|
-
const store = injectStore();
|
|
500
|
-
const navigationProvider = useNavigationProvider();
|
|
501
|
-
let itemsActive = [];
|
|
502
|
-
if (typeof context.itemsActive !== 'undefined') {
|
|
503
|
-
itemsActive = context.itemsActive;
|
|
504
|
-
} else if (context.route) {
|
|
505
|
-
if (typeof navigationProvider.getItemsActiveByRoute !== 'undefined') {
|
|
506
|
-
itemsActive = await navigationProvider.getItemsActiveByRoute(context.route);
|
|
507
|
-
} else if (typeof navigationProvider.getItemsActiveByURL !== 'undefined') {
|
|
508
|
-
itemsActive = await navigationProvider.getItemsActiveByURL(context.route.fullPath);
|
|
509
|
-
}
|
|
510
|
-
} else if (context.url && typeof navigationProvider.getItemsActiveByURL !== 'undefined') {
|
|
511
|
-
itemsActive = await navigationProvider.getItemsActiveByURL(context.url);
|
|
512
|
-
}
|
|
513
|
-
if (itemsActive.length > 0) {
|
|
514
|
-
for(let i = 0; i < itemsActive.length; i++){
|
|
515
|
-
if (typeof itemsActive[i].tier === 'undefined') {
|
|
516
|
-
itemsActive[i].tier = i;
|
|
532
|
+
});
|
|
533
|
+
const items = vue.computed(()=>{
|
|
534
|
+
if (typeof props.data !== 'undefined') {
|
|
535
|
+
return props.data;
|
|
517
536
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
url = context.route.fullPath;
|
|
526
|
-
}
|
|
527
|
-
// eslint-disable-next-line no-constant-condition
|
|
528
|
-
while(true){
|
|
529
|
-
let items = await navigationProvider.getItems(tierIndex, itemsActive);
|
|
530
|
-
if (!items || items.length === 0) {
|
|
531
|
-
break;
|
|
532
|
-
}
|
|
533
|
-
// ensure tier property
|
|
534
|
-
items = setTierForNavigationItems(items, tierIndex);
|
|
535
|
-
let currentItem = findNavigationItemForTier(itemsActive, tierIndex);
|
|
536
|
-
if (!currentItem) {
|
|
537
|
-
if (url) {
|
|
538
|
-
const urlMatches = items.filter((item)=>isNavigationItemMatch(item, {
|
|
539
|
-
url
|
|
540
|
-
}));
|
|
541
|
-
if (urlMatches.length > 0) {
|
|
542
|
-
[currentItem] = urlMatches;
|
|
537
|
+
return managerItems.value;
|
|
538
|
+
});
|
|
539
|
+
return ()=>{
|
|
540
|
+
const vNodes = [];
|
|
541
|
+
for(let i = 0; i < items.value.length; i++){
|
|
542
|
+
if (!items.value[i].display && !items.value[i].displayChildren) {
|
|
543
|
+
continue;
|
|
543
544
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
545
|
+
let vNode;
|
|
546
|
+
if (core.hasNormalizedSlot(SlotName.ITEM, slots)) {
|
|
547
|
+
vNode = core.normalizeSlot(SlotName.ITEM, {
|
|
548
|
+
data: items.value[i]
|
|
549
|
+
}, slots);
|
|
549
550
|
} else {
|
|
550
|
-
|
|
551
|
+
vNode = vue.h(VCNavItem, {
|
|
552
|
+
key: `${i}:${counter.value}`,
|
|
553
|
+
data: items.value[i]
|
|
554
|
+
});
|
|
551
555
|
}
|
|
556
|
+
vNodes.push(vNode);
|
|
552
557
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
continue;
|
|
558
|
-
}
|
|
559
|
-
replaceNavigationTierItemActive(store, tierIndex, currentItem);
|
|
560
|
-
await buildNavigationForTier(store, tierIndex, itemsActive);
|
|
561
|
-
tierIndex++;
|
|
558
|
+
return vue.h(options.groupTag, {
|
|
559
|
+
class: props.data ? options.subGroupItemsClass : options.groupClass
|
|
560
|
+
}, vNodes);
|
|
561
|
+
};
|
|
562
562
|
}
|
|
563
|
-
}
|
|
563
|
+
});
|
|
564
564
|
|
|
565
565
|
function install(instance, options) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
|
|
566
|
+
const manager = new NavigationManager({
|
|
567
|
+
items: options.items
|
|
568
|
+
});
|
|
569
|
+
provideNavigationManager(manager, instance);
|
|
570
570
|
const storeManager = core.installStoreManager(instance);
|
|
571
571
|
if (options.storeManager) {
|
|
572
572
|
core.applyStoreManagerOptions(storeManager, options.storeManager);
|
|
@@ -582,15 +582,12 @@ var index = {
|
|
|
582
582
|
install
|
|
583
583
|
};
|
|
584
584
|
|
|
585
|
+
exports.NavigationManager = NavigationManager;
|
|
585
586
|
exports.VCNavItem = VCNavItem;
|
|
586
587
|
exports.VCNavItems = VCNavItems;
|
|
587
|
-
exports.buildNavigation = buildNavigation;
|
|
588
|
-
exports.buildNavigationForTier = buildNavigationForTier;
|
|
589
|
-
exports.createNavigationProvider = createNavigationProvider;
|
|
590
588
|
exports.default = index;
|
|
591
|
-
exports.
|
|
589
|
+
exports.injectNavigationManager = injectNavigationManager;
|
|
592
590
|
exports.install = install;
|
|
593
|
-
exports.
|
|
594
|
-
exports.useNavigationProvider = useNavigationProvider;
|
|
591
|
+
exports.provideNavigationManager = provideNavigationManager;
|
|
595
592
|
module.exports = Object.assign(exports.default, exports);
|
|
596
593
|
//# sourceMappingURL=index.cjs.map
|