@blocklet/meta 1.16.11-beta-069c3537 → 1.16.11-next-a232f5fb
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.
|
@@ -61,7 +61,7 @@ interface FlatternNavigationOption {
|
|
|
61
61
|
* @param {function} params.transform 当发生拍平处理时
|
|
62
62
|
* @returns 扁平化后的导航列表
|
|
63
63
|
*/
|
|
64
|
-
declare function
|
|
64
|
+
declare function flattenNavigation(list?: NavigationItem[], { depth, transform }?: FlatternNavigationOption): any[];
|
|
65
65
|
/**
|
|
66
66
|
* 根据导航中每一个子菜单所属的 section,将原由的导航数据分离为多个导航数据(此时每一个导航 item 只会包含一个 section)
|
|
67
67
|
* @param {array} navigation 导航列表数据(树状结构,目前只适用于两层的树状结构)
|
|
@@ -89,4 +89,4 @@ declare function parseNavigation(blocklet?: Blocklet, options?: ParseNavigationO
|
|
|
89
89
|
components: any[];
|
|
90
90
|
builtinList: any[];
|
|
91
91
|
};
|
|
92
|
-
export { parseNavigation, deepWalk, isMatchSection, nestNavigationList, filterNavigation, cleanOrphanNavigation, joinLink, checkLink,
|
|
92
|
+
export { parseNavigation, deepWalk, isMatchSection, nestNavigationList, filterNavigation, cleanOrphanNavigation, joinLink, checkLink, flattenNavigation, splitNavigationBySection, };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.splitNavigationBySection = exports.
|
|
6
|
+
exports.splitNavigationBySection = exports.flattenNavigation = exports.checkLink = exports.joinLink = exports.cleanOrphanNavigation = exports.filterNavigation = exports.nestNavigationList = exports.isMatchSection = exports.deepWalk = exports.parseNavigation = void 0;
|
|
7
7
|
const unionWith_1 = __importDefault(require("lodash/unionWith"));
|
|
8
8
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
9
9
|
const pick_1 = __importDefault(require("lodash/pick"));
|
|
@@ -166,7 +166,7 @@ exports.joinLink = joinLink;
|
|
|
166
166
|
* @param {function} params.transform 当发生拍平处理时
|
|
167
167
|
* @returns 扁平化后的导航列表
|
|
168
168
|
*/
|
|
169
|
-
function
|
|
169
|
+
function flattenNavigation(list = [], { depth = 1, transform = (v) => v } = {}) {
|
|
170
170
|
const copyList = (0, cloneDeep_1.default)(list);
|
|
171
171
|
const finalList = [];
|
|
172
172
|
deepWalk(copyList, (item, parent, { level }) => {
|
|
@@ -194,7 +194,7 @@ function flatternNavigation(list = [], { depth = 1, transform = (v) => v } = {})
|
|
|
194
194
|
}, { key: 'items', order: 'last' });
|
|
195
195
|
return finalList;
|
|
196
196
|
}
|
|
197
|
-
exports.
|
|
197
|
+
exports.flattenNavigation = flattenNavigation;
|
|
198
198
|
/**
|
|
199
199
|
* 将 blocklet 中的数据进行处理,获得当前应用的导航数据及组件数据
|
|
200
200
|
* @param {object} blocklet blocklet 应用实例对象
|
|
@@ -321,7 +321,7 @@ function patchBuiltinNavigation(navigation) {
|
|
|
321
321
|
*/
|
|
322
322
|
function compactNavigation(navigation, depth = 2) {
|
|
323
323
|
const copyNavigation = (0, cloneDeep_1.default)(navigation);
|
|
324
|
-
const resData =
|
|
324
|
+
const resData = flattenNavigation(copyNavigation, {
|
|
325
325
|
depth,
|
|
326
326
|
transform: (item, parent) => {
|
|
327
327
|
if (parent) {
|
|
@@ -533,7 +533,7 @@ function parseNavigation(blocklet = {}, options = {}) {
|
|
|
533
533
|
all.push(cur);
|
|
534
534
|
return all;
|
|
535
535
|
}, []);
|
|
536
|
-
const flatNavigation =
|
|
536
|
+
const flatNavigation = flattenNavigation(levelUpNavigation, {
|
|
537
537
|
transform(item, parent) {
|
|
538
538
|
let { component } = item;
|
|
539
539
|
if (parent?.component) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.11-
|
|
6
|
+
"version": "1.16.11-next-a232f5fb",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@abtnode/constant": "1.16.11-
|
|
28
|
-
"@abtnode/util": "1.16.11-
|
|
27
|
+
"@abtnode/constant": "1.16.11-next-a232f5fb",
|
|
28
|
+
"@abtnode/util": "1.16.11-next-a232f5fb",
|
|
29
29
|
"@arcblock/did": "1.18.80",
|
|
30
30
|
"@arcblock/did-ext": "1.18.80",
|
|
31
31
|
"@arcblock/did-util": "1.18.80",
|
|
32
32
|
"@arcblock/jwt": "1.18.80",
|
|
33
|
-
"@blocklet/constant": "1.16.11-
|
|
33
|
+
"@blocklet/constant": "1.16.11-next-a232f5fb",
|
|
34
34
|
"@ocap/asset": "1.18.80",
|
|
35
35
|
"@ocap/mcrypto": "1.18.80",
|
|
36
36
|
"@ocap/types": "1.18.80",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"ts-node": "^10.9.1",
|
|
80
80
|
"typescript": "^5.0.4"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "1af264e9b6648aa191fbf23c67717262ac717697"
|
|
83
83
|
}
|