@blocklet/meta 1.16.44-beta-20250524-065731-c62fd374 → 1.16.44-beta-20250526-130644-5e05dc90
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.
|
@@ -13,6 +13,7 @@ exports.cleanOrphanNavigation = cleanOrphanNavigation;
|
|
|
13
13
|
exports.joinLink = joinLink;
|
|
14
14
|
exports.flattenNavigation = flattenNavigation;
|
|
15
15
|
exports.splitNavigationBySection = splitNavigationBySection;
|
|
16
|
+
const constant_1 = require("@abtnode/constant");
|
|
16
17
|
const unionWith_1 = __importDefault(require("lodash/unionWith"));
|
|
17
18
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
18
19
|
const pick_1 = __importDefault(require("lodash/pick"));
|
|
@@ -191,6 +192,26 @@ function flattenNavigation(list = [], { depth = 1, transform = (v) => v } = {})
|
|
|
191
192
|
}, { key: 'items', order: 'last' });
|
|
192
193
|
return finalList;
|
|
193
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* 将 bottomNavigation 导航项中的国际化字段标准化为 { locale: value } 格式
|
|
197
|
+
* @param item 导航项
|
|
198
|
+
* @returns 标准化后的导航项
|
|
199
|
+
*/
|
|
200
|
+
function normalizeI18nFields(item) {
|
|
201
|
+
// 如果不是 bottomNavigation,直接返回原对象
|
|
202
|
+
if (item.section !== 'bottomNavigation') {
|
|
203
|
+
return item;
|
|
204
|
+
}
|
|
205
|
+
const result = { ...item };
|
|
206
|
+
constant_1.NAVIGATION_I18N_FIELDS.forEach((field) => {
|
|
207
|
+
const value = result[field];
|
|
208
|
+
if (typeof value === 'string') {
|
|
209
|
+
// 如果是字符串,转换为 { en: value } 格式
|
|
210
|
+
result[field] = { en: value };
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
194
215
|
/**
|
|
195
216
|
* 将 blocklet 中的数据进行处理,获得当前应用的导航数据及组件数据
|
|
196
217
|
* @param {object} blocklet blocklet 应用实例对象
|
|
@@ -525,7 +546,7 @@ function parseNavigation(blocklet = {}, options = {}) {
|
|
|
525
546
|
blocklet.settings.navigations = [...blocklet.settings.navigations].filter((item) => !(item?.parent === '/team' && item.from === 'team-tmpl'));
|
|
526
547
|
}
|
|
527
548
|
}
|
|
528
|
-
const customNavigationList = cleanOldNavigationHistory(blocklet?.settings?.navigations || []);
|
|
549
|
+
const customNavigationList = normalizeNavigationList(cleanOldNavigationHistory(blocklet?.settings?.navigations || [])).map(normalizeI18nFields);
|
|
529
550
|
const compactedNavigation = compactNavigation(beforeProcess(builtinNavigation));
|
|
530
551
|
const patchedNavigation = patchBuiltinNavigation(compactedNavigation);
|
|
531
552
|
const splitNavigation = splitNavigationBySection(patchedNavigation);
|
|
@@ -553,10 +574,10 @@ function parseNavigation(blocklet = {}, options = {}) {
|
|
|
553
574
|
if (parent?.component) {
|
|
554
575
|
component = [parent.component, item.component].filter(Boolean).join('.');
|
|
555
576
|
}
|
|
556
|
-
return { ...item, component };
|
|
577
|
+
return normalizeI18nFields({ ...item, component });
|
|
557
578
|
},
|
|
558
579
|
});
|
|
559
|
-
const rawNavigation = (0, unionWith_1.default)(
|
|
580
|
+
const rawNavigation = (0, unionWith_1.default)(customNavigationList, flatNavigation, (prev, next) => {
|
|
560
581
|
const keys = ['id', 'section'];
|
|
561
582
|
return (0, isEqual_1.default)((0, pick_1.default)(prev, keys), (0, pick_1.default)(next, keys));
|
|
562
583
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.44-beta-
|
|
6
|
+
"version": "1.16.44-beta-20250526-130644-5e05dc90",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@abtnode/constant": "1.16.44-beta-
|
|
29
|
-
"@abtnode/docker-utils": "1.16.44-beta-
|
|
28
|
+
"@abtnode/constant": "1.16.44-beta-20250526-130644-5e05dc90",
|
|
29
|
+
"@abtnode/docker-utils": "1.16.44-beta-20250526-130644-5e05dc90",
|
|
30
30
|
"@arcblock/did": "1.20.11",
|
|
31
31
|
"@arcblock/did-ext": "1.20.11",
|
|
32
32
|
"@arcblock/did-util": "1.20.11",
|
|
33
33
|
"@arcblock/jwt": "1.20.11",
|
|
34
|
-
"@blocklet/constant": "1.16.44-beta-
|
|
34
|
+
"@blocklet/constant": "1.16.44-beta-20250526-130644-5e05dc90",
|
|
35
35
|
"@ocap/asset": "1.20.11",
|
|
36
36
|
"@ocap/mcrypto": "1.20.11",
|
|
37
37
|
"@ocap/types": "1.20.11",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"ts-node": "^10.9.1",
|
|
82
82
|
"typescript": "^5.6.3"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "9309b29c0ae0ed55c5ec272aede5dcdd45ae88f2"
|
|
85
85
|
}
|