@lingxiteam/ebe-utils 0.0.29 → 0.0.31
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/es/index.d.ts +8 -2
- package/es/index.js +56 -8
- package/lib/pcpublic/src/utils/formUtils.ts +20 -1
- package/package.json +2 -2
package/es/index.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ interface CodeServices {
|
|
|
37
37
|
pageSize?: number;
|
|
38
38
|
terminalType?: string;
|
|
39
39
|
}) => Promise<any>;
|
|
40
|
+
queryAppFileResourcePage: (data: any) => Promise<any>;
|
|
41
|
+
downloadFileByFileCode: (data: any) => Promise<any>;
|
|
40
42
|
}
|
|
41
43
|
export declare const getSafeTypeName: (name: any) => any;
|
|
42
44
|
interface CodeOptions {
|
|
@@ -52,6 +54,8 @@ interface CodeOptions {
|
|
|
52
54
|
autoDownloadOnBower?: boolean;
|
|
53
55
|
useEbeSetup?: boolean;
|
|
54
56
|
incrementalConstruction?: IncrementalConstruction;
|
|
57
|
+
hasAppFileResource?: boolean;
|
|
58
|
+
hasExtendsApp?: boolean;
|
|
55
59
|
}
|
|
56
60
|
interface IncrementalConstruction {
|
|
57
61
|
pageIds?: string[];
|
|
@@ -62,7 +66,7 @@ interface IncrementalConstruction {
|
|
|
62
66
|
}
|
|
63
67
|
export declare const setWorkerJsUrl: (url: string) => void;
|
|
64
68
|
export declare const init: () => Promise<void>;
|
|
65
|
-
export declare const fetchData: ({ appId, services, platform, baseUrl, onProgress, needTranslatePagePathToEnglish, incrementalConstruction, }: CodeOptions) => Promise<{
|
|
69
|
+
export declare const fetchData: ({ appId, services, platform, baseUrl, onProgress, needTranslatePagePathToEnglish, incrementalConstruction, hasAppFileResource, hasExtendsApp, }: CodeOptions) => Promise<{
|
|
66
70
|
options: {
|
|
67
71
|
platform: string;
|
|
68
72
|
appId: string;
|
|
@@ -79,10 +83,12 @@ export declare const fetchData: ({ appId, services, platform, baseUrl, onProgres
|
|
|
79
83
|
pagePathEnglishMapping: any;
|
|
80
84
|
incrementalConstruction: IncrementalConstruction | undefined;
|
|
81
85
|
pageTypeMap: any;
|
|
86
|
+
appFileResource: any;
|
|
87
|
+
hasExtendsApp: boolean | undefined;
|
|
82
88
|
};
|
|
83
89
|
cleanedTree: any;
|
|
84
90
|
}>;
|
|
85
|
-
export declare const codeCreate: ({ appId, services, platform, baseUrl, onProgress, needTranslatePagePathToEnglish, autoDownloadOnBower, useEbeSetup, incrementalConstruction, }: CodeOptions) => Promise<import("@lingxiteam/ebe/types/core").IPublisherResponse<string | import("../../types/core/publisher/zip").ZipBuffer> | {
|
|
91
|
+
export declare const codeCreate: ({ appId, services, platform, baseUrl, onProgress, needTranslatePagePathToEnglish, autoDownloadOnBower, useEbeSetup, incrementalConstruction, hasExtendsApp, }: CodeOptions) => Promise<import("@lingxiteam/ebe/types/core").IPublisherResponse<string | import("../../types/core/publisher/zip").ZipBuffer> | {
|
|
86
92
|
msg: unknown;
|
|
87
93
|
success: boolean;
|
|
88
94
|
}>;
|
package/es/index.js
CHANGED
|
@@ -251,11 +251,11 @@ var getIsIncrementalConstruction = function getIsIncrementalConstruction(ic) {
|
|
|
251
251
|
export var fetchData = /*#__PURE__*/function () {
|
|
252
252
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
253
253
|
var _ref6, _attrSpecPage;
|
|
254
|
-
var appId, services, platform, baseUrl, onProgress, needTranslatePagePathToEnglish, incrementalConstruction, isIncrementalConstruction, attrSpecPage, incrementalConstructionPageList, globalDataInfo, busiData, themeCss, frontendHookList, pageTypeMap, globalDataMap, appInfo, appPageList, temCompAssetList, compAssetList, _globalDataInfo, dataSourceList, pageIdMapping, lastPageId, data, needFindDataPages, requestQueue, requests, pages, _yield$services$qryBu, itemLists, BusiCompRequest, _incrementalConstruct, itemHash, _itemLists, alllBusiComp, busiPages, getTranslateName, chinese, translateNames, key, _translateNames, translateName, pagePathEnglishMapping, pagePathEnglishSet, getName, pagesChinese, pagesTranslateNames, findPageKeyByPageId, _key2, _appPageList$_key2$pa, _pagePathEnglishMappi, _pagesTranslateNames, safeTranslateName, pageKey, pageDSLS, getPlatform, options, cleanedTree;
|
|
254
|
+
var appId, services, platform, baseUrl, onProgress, needTranslatePagePathToEnglish, incrementalConstruction, hasAppFileResource, hasExtendsApp, isIncrementalConstruction, attrSpecPage, incrementalConstructionPageList, globalDataInfo, busiData, themeCss, frontendHookList, pageTypeMap, globalDataMap, appInfo, appPageList, temCompAssetList, compAssetList, _globalDataInfo, dataSourceList, pageIdMapping, lastPageId, data, needFindDataPages, requestQueue, requests, pages, _yield$services$qryBu, itemLists, BusiCompRequest, _incrementalConstruct, itemHash, _itemLists, alllBusiComp, busiPages, getTranslateName, chinese, translateNames, key, _translateNames, translateName, pagePathEnglishMapping, pagePathEnglishSet, getName, pagesChinese, pagesTranslateNames, findPageKeyByPageId, _key2, _appPageList$_key2$pa, _pagePathEnglishMappi, _pagesTranslateNames, safeTranslateName, pageKey, pageDSLS, getPlatform, appFileResource, _services$queryAppFil, _yield$services$query, list, appFileResourceList, options, cleanedTree;
|
|
255
255
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
256
256
|
while (1) switch (_context3.prev = _context3.next) {
|
|
257
257
|
case 0:
|
|
258
|
-
appId = _ref4.appId, services = _ref4.services, platform = _ref4.platform, baseUrl = _ref4.baseUrl, onProgress = _ref4.onProgress, needTranslatePagePathToEnglish = _ref4.needTranslatePagePathToEnglish, incrementalConstruction = _ref4.incrementalConstruction;
|
|
258
|
+
appId = _ref4.appId, services = _ref4.services, platform = _ref4.platform, baseUrl = _ref4.baseUrl, onProgress = _ref4.onProgress, needTranslatePagePathToEnglish = _ref4.needTranslatePagePathToEnglish, incrementalConstruction = _ref4.incrementalConstruction, hasAppFileResource = _ref4.hasAppFileResource, hasExtendsApp = _ref4.hasExtendsApp;
|
|
259
259
|
isIncrementalConstruction = getIsIncrementalConstruction(incrementalConstruction);
|
|
260
260
|
attrSpecPage = {};
|
|
261
261
|
incrementalConstructionPageList = (_ref6 = (incrementalConstruction === null || incrementalConstruction === void 0 ? void 0 : incrementalConstruction.pageIds) || []) === null || _ref6 === void 0 ? void 0 : _ref6.map(function (i) {
|
|
@@ -650,7 +650,52 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
650
650
|
default:
|
|
651
651
|
return 'pc';
|
|
652
652
|
}
|
|
653
|
-
};
|
|
653
|
+
}; // { '31232133':{fileName:'xxx',data:base64 }}
|
|
654
|
+
appFileResource = {}; // 如果开启下载静态资源
|
|
655
|
+
if (!hasAppFileResource) {
|
|
656
|
+
_context3.next = 115;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
_context3.next = 109;
|
|
660
|
+
return services === null || services === void 0 || (_services$queryAppFil = services.queryAppFileResourcePage) === null || _services$queryAppFil === void 0 ? void 0 : _services$queryAppFil.call(services, {
|
|
661
|
+
appId: appId,
|
|
662
|
+
orderType: 'DESC',
|
|
663
|
+
pageNum: 1,
|
|
664
|
+
pageSize: 999999,
|
|
665
|
+
sharedObjFilter: 'F'
|
|
666
|
+
});
|
|
667
|
+
case 109:
|
|
668
|
+
_yield$services$query = _context3.sent;
|
|
669
|
+
list = _yield$services$query.list;
|
|
670
|
+
_context3.next = 113;
|
|
671
|
+
return Promise.all(list.map(function (item) {
|
|
672
|
+
return new Promise(function (resolve, reject) {
|
|
673
|
+
requestQueue.sendRequest(function () {
|
|
674
|
+
return services.downloadFileByFileCode({
|
|
675
|
+
appId: appId,
|
|
676
|
+
fileCode: item === null || item === void 0 ? void 0 : item.fileCode
|
|
677
|
+
});
|
|
678
|
+
}).then(function (d) {
|
|
679
|
+
if (!d) {
|
|
680
|
+
resolve('');
|
|
681
|
+
} else {
|
|
682
|
+
resolve({
|
|
683
|
+
fileCode: item === null || item === void 0 ? void 0 : item.fileCode,
|
|
684
|
+
data: d,
|
|
685
|
+
fileRealName: item === null || item === void 0 ? void 0 : item.fileRealName,
|
|
686
|
+
// 根据 fileType R_COMP ASSET_COMP
|
|
687
|
+
fileType: item === null || item === void 0 ? void 0 : item.fileType
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
}).catch(reject);
|
|
691
|
+
});
|
|
692
|
+
}));
|
|
693
|
+
case 113:
|
|
694
|
+
appFileResourceList = _context3.sent;
|
|
695
|
+
appFileResourceList.filter(Boolean).forEach(function (i) {
|
|
696
|
+
appFileResource[i.fileCode] = i;
|
|
697
|
+
});
|
|
698
|
+
case 115:
|
|
654
699
|
options = {
|
|
655
700
|
platform: getPlatform(platform),
|
|
656
701
|
appId: appId,
|
|
@@ -669,7 +714,9 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
669
714
|
// 英文路径的对应关系
|
|
670
715
|
pagePathEnglishMapping: pagePathEnglishMapping,
|
|
671
716
|
incrementalConstruction: incrementalConstruction,
|
|
672
|
-
pageTypeMap: pageTypeMap
|
|
717
|
+
pageTypeMap: pageTypeMap,
|
|
718
|
+
appFileResource: appFileResource,
|
|
719
|
+
hasExtendsApp: hasExtendsApp
|
|
673
720
|
};
|
|
674
721
|
onProgress({
|
|
675
722
|
log: '清理无用数据',
|
|
@@ -681,7 +728,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
681
728
|
options: options,
|
|
682
729
|
cleanedTree: cleanedTree
|
|
683
730
|
});
|
|
684
|
-
case
|
|
731
|
+
case 120:
|
|
685
732
|
case "end":
|
|
686
733
|
return _context3.stop();
|
|
687
734
|
}
|
|
@@ -693,11 +740,11 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
693
740
|
}();
|
|
694
741
|
export var codeCreate = /*#__PURE__*/function () {
|
|
695
742
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref8) {
|
|
696
|
-
var appId, services, platform, baseUrl, _onProgress, _ref8$needTranslatePa, needTranslatePagePathToEnglish, _ref8$autoDownloadOnB, autoDownloadOnBower, _ref8$useEbeSetup, useEbeSetup, incrementalConstruction, _yield$fetchData, cleanedTree, options, result, zipRes;
|
|
743
|
+
var appId, services, platform, baseUrl, _onProgress, _ref8$needTranslatePa, needTranslatePagePathToEnglish, _ref8$autoDownloadOnB, autoDownloadOnBower, _ref8$useEbeSetup, useEbeSetup, incrementalConstruction, hasExtendsApp, _yield$fetchData, cleanedTree, options, result, zipRes;
|
|
697
744
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
698
745
|
while (1) switch (_context4.prev = _context4.next) {
|
|
699
746
|
case 0:
|
|
700
|
-
appId = _ref8.appId, services = _ref8.services, platform = _ref8.platform, baseUrl = _ref8.baseUrl, _onProgress = _ref8.onProgress, _ref8$needTranslatePa = _ref8.needTranslatePagePathToEnglish, needTranslatePagePathToEnglish = _ref8$needTranslatePa === void 0 ? false : _ref8$needTranslatePa, _ref8$autoDownloadOnB = _ref8.autoDownloadOnBower, autoDownloadOnBower = _ref8$autoDownloadOnB === void 0 ? true : _ref8$autoDownloadOnB, _ref8$useEbeSetup = _ref8.useEbeSetup, useEbeSetup = _ref8$useEbeSetup === void 0 ? true : _ref8$useEbeSetup, incrementalConstruction = _ref8.incrementalConstruction;
|
|
747
|
+
appId = _ref8.appId, services = _ref8.services, platform = _ref8.platform, baseUrl = _ref8.baseUrl, _onProgress = _ref8.onProgress, _ref8$needTranslatePa = _ref8.needTranslatePagePathToEnglish, needTranslatePagePathToEnglish = _ref8$needTranslatePa === void 0 ? false : _ref8$needTranslatePa, _ref8$autoDownloadOnB = _ref8.autoDownloadOnBower, autoDownloadOnBower = _ref8$autoDownloadOnB === void 0 ? true : _ref8$autoDownloadOnB, _ref8$useEbeSetup = _ref8.useEbeSetup, useEbeSetup = _ref8$useEbeSetup === void 0 ? true : _ref8$useEbeSetup, incrementalConstruction = _ref8.incrementalConstruction, hasExtendsApp = _ref8.hasExtendsApp;
|
|
701
748
|
_context4.prev = 1;
|
|
702
749
|
_context4.next = 4;
|
|
703
750
|
return fetchData({
|
|
@@ -707,7 +754,8 @@ export var codeCreate = /*#__PURE__*/function () {
|
|
|
707
754
|
baseUrl: baseUrl,
|
|
708
755
|
onProgress: _onProgress,
|
|
709
756
|
needTranslatePagePathToEnglish: needTranslatePagePathToEnglish,
|
|
710
|
-
incrementalConstruction: incrementalConstruction
|
|
757
|
+
incrementalConstruction: incrementalConstruction,
|
|
758
|
+
hasExtendsApp: hasExtendsApp
|
|
711
759
|
});
|
|
712
760
|
case 4:
|
|
713
761
|
_yield$fetchData = _context4.sent;
|
|
@@ -323,7 +323,7 @@ export const getAllForm = (options: {
|
|
|
323
323
|
*/
|
|
324
324
|
export const getBOFramers = (compId: string, refs: RefsType = {}) => {
|
|
325
325
|
const boframerUids = Object.keys(refs).filter(
|
|
326
|
-
(id) => refs[id].compId === compId,
|
|
326
|
+
(id) => refs[id].compId === compId || id === compId,
|
|
327
327
|
);
|
|
328
328
|
// 如果没找到组件,就返回null
|
|
329
329
|
if (!boframerUids.length) {
|
|
@@ -456,3 +456,22 @@ export const updateNodeChildren = (
|
|
|
456
456
|
});
|
|
457
457
|
return arr;
|
|
458
458
|
};
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* 业务组件把表单变化方法事件注册进表单组件内部进行监听
|
|
462
|
+
*/
|
|
463
|
+
export const registerFormListenerOnValueChange = (
|
|
464
|
+
options: {
|
|
465
|
+
currentRefs: RefsType;
|
|
466
|
+
renderRefs: RefsManager;
|
|
467
|
+
compId: string;
|
|
468
|
+
},
|
|
469
|
+
onValuesChange: (changedValues: any, values: any, form: RefsType) => void,
|
|
470
|
+
) => {
|
|
471
|
+
const forms = getBoframerOwnForms(options);
|
|
472
|
+
forms.forEach((form) => {
|
|
473
|
+
form.listenerOnValueChange((changedValues: any, values: any) => {
|
|
474
|
+
onValuesChange(changedValues, values, form);
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiteam/ebe-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@babel/parser": "^7.12.12",
|
|
18
18
|
"@babel/traverse": "^7.12.12",
|
|
19
19
|
"@babel/types": "^7.12.12",
|
|
20
|
-
"@lingxiteam/ebe": "0.0.
|
|
20
|
+
"@lingxiteam/ebe": "0.0.31",
|
|
21
21
|
"cac": "^6.7.14",
|
|
22
22
|
"fs-extra": "9.x"
|
|
23
23
|
},
|