@lingxiteam/ebe-utils 0.0.24 → 0.0.27
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 +1 -0
- package/es/index.js +50 -42
- package/lib/h5public/src/hooks/usePageForm.ts +30 -3
- package/lib/h5public/yarn.lock +19383 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +4 -2
- package/lib/pcpublic/src/hooks/usePageForm.ts +5 -3
- package/lib/pcpublic/src/utils/exportCustomData/index.tsx +726 -0
- package/lib/pcpublic/src/utils/exportCustomData/tool.ts +399 -0
- package/lib/pcpublic/src/utils/messageApi.ts +25 -20
- package/lib/pcpublic/yarn.lock +11441 -0
- package/lib/public/src/components/ProgressComp/index.tsx +4 -14
- package/lib/public/src/hooks/useBaseDataSource.ts +2 -1
- package/lib/public/src/services/api/engine.ts +19 -0
- package/lib/public/src/utils/cmd.ts +455 -0
- package/lib/public/src/utils/useComponentHoc.ts +6 -3
- package/package.json +2 -2
package/es/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ interface IncrementalConstruction {
|
|
|
58
58
|
busiCompIds?: string[];
|
|
59
59
|
globalStoreChange?: boolean;
|
|
60
60
|
frontendHookChange?: boolean;
|
|
61
|
+
themeCssChange?: boolean;
|
|
61
62
|
}
|
|
62
63
|
export declare const setWorkerJsUrl: (url: string) => void;
|
|
63
64
|
export declare const init: () => Promise<void>;
|
package/es/index.js
CHANGED
|
@@ -250,7 +250,7 @@ var getIsIncrementalConstruction = function getIsIncrementalConstruction(ic) {
|
|
|
250
250
|
export var fetchData = /*#__PURE__*/function () {
|
|
251
251
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
252
252
|
var _ref6, _attrSpecPage;
|
|
253
|
-
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, pages, _yield$services$qryBu, itemLists, _incrementalConstruct, itemHash, _itemLists, alllBusiComp, busiPages, getTranslateName, chinese, translateNames, key, _translateNames, pagePathEnglishMapping, pagePathEnglishSet, getName, pagesChinese, pagesTranslateNames, findPageKeyByPageId, _key2, _appPageList$_key2$pa, _pagePathEnglishMappi, _pagesTranslateNames, safeTranslateName, pageKey, pageDSLS, getPlatform, options, cleanedTree;
|
|
253
|
+
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, pages, _yield$services$qryBu, itemLists, _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
254
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
255
255
|
while (1) switch (_context3.prev = _context3.next) {
|
|
256
256
|
case 0:
|
|
@@ -311,7 +311,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
311
311
|
// pageTypeMap[o.pageContainerType][o.pageId] = true;
|
|
312
312
|
});
|
|
313
313
|
if (isIncrementalConstruction) {
|
|
314
|
-
_context3.next =
|
|
314
|
+
_context3.next = 27;
|
|
315
315
|
break;
|
|
316
316
|
}
|
|
317
317
|
_context3.next = 26;
|
|
@@ -322,8 +322,13 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
322
322
|
});
|
|
323
323
|
case 26:
|
|
324
324
|
attrSpecPage = _context3.sent;
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
case 27:
|
|
326
|
+
if (!(!isIncrementalConstruction || incrementalConstruction !== null && incrementalConstruction !== void 0 && incrementalConstruction.themeCssChange)) {
|
|
327
|
+
_context3.next = 38;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
_context3.prev = 28;
|
|
331
|
+
_context3.next = 31;
|
|
327
332
|
return Promise.race([new Promise(function (resolve, reject) {
|
|
328
333
|
services.getThemeCss({
|
|
329
334
|
appId: appId,
|
|
@@ -336,26 +341,26 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
336
341
|
resolve('');
|
|
337
342
|
}, 5000);
|
|
338
343
|
})]);
|
|
339
|
-
case
|
|
344
|
+
case 31:
|
|
340
345
|
themeCss = _context3.sent;
|
|
341
346
|
console.log('====获取主题成功');
|
|
342
|
-
_context3.next =
|
|
347
|
+
_context3.next = 38;
|
|
343
348
|
break;
|
|
344
|
-
case
|
|
345
|
-
_context3.prev =
|
|
346
|
-
_context3.t0 = _context3["catch"](
|
|
349
|
+
case 35:
|
|
350
|
+
_context3.prev = 35;
|
|
351
|
+
_context3.t0 = _context3["catch"](28);
|
|
347
352
|
console.error('====获取主题失败', _context3.t0);
|
|
348
|
-
case
|
|
353
|
+
case 38:
|
|
349
354
|
// 根据 appId 获取当前应用的使用的自定义组件
|
|
350
355
|
onProgress({
|
|
351
356
|
log: '获取当前应用的使用的自定义组件',
|
|
352
357
|
progress: 3
|
|
353
358
|
});
|
|
354
|
-
_context3.next =
|
|
359
|
+
_context3.next = 41;
|
|
355
360
|
return services.qryPageCompAssetList({
|
|
356
361
|
appId: appId
|
|
357
362
|
});
|
|
358
|
-
case
|
|
363
|
+
case 41:
|
|
359
364
|
temCompAssetList = _context3.sent;
|
|
360
365
|
// 兼容下割接数据,数组前面的自定义组件是新的
|
|
361
366
|
compAssetList = temCompAssetList.reduce(function (acc, current) {
|
|
@@ -368,7 +373,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
368
373
|
return acc;
|
|
369
374
|
}, []);
|
|
370
375
|
if (!(!isIncrementalConstruction || incrementalConstruction !== null && incrementalConstruction !== void 0 && incrementalConstruction.globalStoreChange)) {
|
|
371
|
-
_context3.next =
|
|
376
|
+
_context3.next = 50;
|
|
372
377
|
break;
|
|
373
378
|
}
|
|
374
379
|
// 根据appId 获取全局数据源
|
|
@@ -376,12 +381,12 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
376
381
|
log: '获取全局数据源',
|
|
377
382
|
progress: 4
|
|
378
383
|
});
|
|
379
|
-
_context3.next =
|
|
384
|
+
_context3.next = 47;
|
|
380
385
|
return services.queryFrontendDatasourcePage({
|
|
381
386
|
appId: appId,
|
|
382
387
|
pageSize: 10000
|
|
383
388
|
});
|
|
384
|
-
case
|
|
389
|
+
case 47:
|
|
385
390
|
globalDataInfo = _context3.sent;
|
|
386
391
|
dataSourceList = ((_globalDataInfo = globalDataInfo) === null || _globalDataInfo === void 0 ? void 0 : _globalDataInfo.list) || [];
|
|
387
392
|
dataSourceList.forEach(function (item) {
|
|
@@ -394,7 +399,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
394
399
|
} catch (err) {}
|
|
395
400
|
return null;
|
|
396
401
|
});
|
|
397
|
-
case
|
|
402
|
+
case 50:
|
|
398
403
|
pageIdMapping = {};
|
|
399
404
|
lastPageId = ''; // 根据 pageId 获得 dsl
|
|
400
405
|
data = [];
|
|
@@ -403,7 +408,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
403
408
|
progress: 5
|
|
404
409
|
});
|
|
405
410
|
needFindDataPages = isIncrementalConstruction ? incrementalConstructionPageList : appPageList;
|
|
406
|
-
_context3.next =
|
|
411
|
+
_context3.next = 57;
|
|
407
412
|
return Promise.all(needFindDataPages.map(function (i) {
|
|
408
413
|
lastPageId = i.pageId;
|
|
409
414
|
pageIdMapping[i.pagePath] = i.pageId;
|
|
@@ -412,11 +417,11 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
412
417
|
pageId: i.pageId
|
|
413
418
|
});
|
|
414
419
|
}));
|
|
415
|
-
case
|
|
420
|
+
case 57:
|
|
416
421
|
data = _context3.sent;
|
|
417
422
|
pages = getPageDsls(data);
|
|
418
423
|
if (isIncrementalConstruction) {
|
|
419
|
-
_context3.next =
|
|
424
|
+
_context3.next = 70;
|
|
420
425
|
break;
|
|
421
426
|
}
|
|
422
427
|
onProgress({
|
|
@@ -425,7 +430,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
425
430
|
});
|
|
426
431
|
|
|
427
432
|
// 业务组件从被使用才生成改为全部生成
|
|
428
|
-
_context3.next =
|
|
433
|
+
_context3.next = 63;
|
|
429
434
|
return services.qryBusiCompPage({
|
|
430
435
|
appIds: [appId],
|
|
431
436
|
appId: appId,
|
|
@@ -434,10 +439,10 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
434
439
|
pageSize: 999999,
|
|
435
440
|
terminalType: platform
|
|
436
441
|
});
|
|
437
|
-
case
|
|
442
|
+
case 63:
|
|
438
443
|
_yield$services$qryBu = _context3.sent;
|
|
439
444
|
itemLists = _yield$services$qryBu.list;
|
|
440
|
-
_context3.next =
|
|
445
|
+
_context3.next = 67;
|
|
441
446
|
return Promise.all(itemLists.map(function (i) {
|
|
442
447
|
return services.findBusiCompById({
|
|
443
448
|
busiCompId: i.busiCompId,
|
|
@@ -445,11 +450,11 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
445
450
|
pageId: lastPageId
|
|
446
451
|
});
|
|
447
452
|
}));
|
|
448
|
-
case
|
|
453
|
+
case 67:
|
|
449
454
|
busiData = _context3.sent;
|
|
450
|
-
_context3.next =
|
|
455
|
+
_context3.next = 77;
|
|
451
456
|
break;
|
|
452
|
-
case
|
|
457
|
+
case 70:
|
|
453
458
|
// busiCompId 过滤重复
|
|
454
459
|
itemHash = {}; // 找到所有页面使用到的 业务组件
|
|
455
460
|
findAllItem(pages, function (item) {
|
|
@@ -457,7 +462,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
457
462
|
}, itemHash);
|
|
458
463
|
_itemLists = Object.keys(itemHash); // 请求所有业务组件的 dsl
|
|
459
464
|
alllBusiComp = ((_incrementalConstruct = incrementalConstruction === null || incrementalConstruction === void 0 ? void 0 : incrementalConstruction.busiCompIds) !== null && _incrementalConstruct !== void 0 ? _incrementalConstruct : []).concat(_itemLists);
|
|
460
|
-
_context3.next =
|
|
465
|
+
_context3.next = 76;
|
|
461
466
|
return Promise.all(alllBusiComp.map(function (i) {
|
|
462
467
|
return services.findBusiCompById({
|
|
463
468
|
busiCompId: i,
|
|
@@ -465,9 +470,9 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
465
470
|
pageId: lastPageId
|
|
466
471
|
});
|
|
467
472
|
}));
|
|
468
|
-
case 75:
|
|
469
|
-
busiData = _context3.sent;
|
|
470
473
|
case 76:
|
|
474
|
+
busiData = _context3.sent;
|
|
475
|
+
case 77:
|
|
471
476
|
// 过滤为空
|
|
472
477
|
busiPages = busiData.filter(Boolean).map(function (i, index) {
|
|
473
478
|
var _i$busiCompVersion;
|
|
@@ -540,26 +545,29 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
540
545
|
});
|
|
541
546
|
translateNames = {};
|
|
542
547
|
if (!(chinese.length > 0)) {
|
|
543
|
-
_context3.next =
|
|
548
|
+
_context3.next = 85;
|
|
544
549
|
break;
|
|
545
550
|
}
|
|
546
|
-
_context3.next =
|
|
551
|
+
_context3.next = 84;
|
|
547
552
|
return getTranslateName(appId, chinese, 'UPPER_CAMEL');
|
|
548
|
-
case 83:
|
|
549
|
-
translateNames = _context3.sent;
|
|
550
553
|
case 84:
|
|
554
|
+
translateNames = _context3.sent;
|
|
555
|
+
case 85:
|
|
551
556
|
// 翻译业务组件的名字
|
|
552
557
|
for (key = 0; key < busiPages.length; key++) {
|
|
553
558
|
onProgress({
|
|
554
559
|
log: '翻译业务组件名称',
|
|
555
560
|
progress: 6 + key / busiPages.length
|
|
556
561
|
});
|
|
557
|
-
|
|
558
|
-
|
|
562
|
+
translateName = (_translateNames = translateNames) === null || _translateNames === void 0 ? void 0 : _translateNames[getSafeTypeName(busiPages[key].pageName)]; // 翻译可能失败
|
|
563
|
+
if (translateName) {
|
|
564
|
+
busiPages[key]._pageName = busiPages[key].pageName;
|
|
565
|
+
busiPages[key].pageName = translateName;
|
|
566
|
+
}
|
|
559
567
|
}
|
|
560
568
|
pagePathEnglishMapping = {};
|
|
561
569
|
if (!needTranslatePagePathToEnglish) {
|
|
562
|
-
_context3.next =
|
|
570
|
+
_context3.next = 98;
|
|
563
571
|
break;
|
|
564
572
|
}
|
|
565
573
|
pagePathEnglishSet = {};
|
|
@@ -581,14 +589,14 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
581
589
|
});
|
|
582
590
|
pagesTranslateNames = {};
|
|
583
591
|
if (!(pagesChinese.length > 0)) {
|
|
584
|
-
_context3.next =
|
|
592
|
+
_context3.next = 96;
|
|
585
593
|
break;
|
|
586
594
|
}
|
|
587
|
-
_context3.next =
|
|
595
|
+
_context3.next = 95;
|
|
588
596
|
return getTranslateName(appId, pagesChinese, 'UPPER_CAMEL');
|
|
589
|
-
case 94:
|
|
590
|
-
pagesTranslateNames = _context3.sent;
|
|
591
597
|
case 95:
|
|
598
|
+
pagesTranslateNames = _context3.sent;
|
|
599
|
+
case 96:
|
|
592
600
|
findPageKeyByPageId = function findPageKeyByPageId(id, arrs) {
|
|
593
601
|
for (var _key = 0; _key < arrs.length; _key++) {
|
|
594
602
|
var _arrs$_key;
|
|
@@ -614,7 +622,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
614
622
|
pages[pageKey].pagePath = safeTranslateName;
|
|
615
623
|
}
|
|
616
624
|
}
|
|
617
|
-
case
|
|
625
|
+
case 98:
|
|
618
626
|
// 合并页面,生成器那边支持页面类型和业务组件类型
|
|
619
627
|
pageDSLS = [].concat(_toConsumableArray(pages), _toConsumableArray(busiPages));
|
|
620
628
|
getPlatform = function getPlatform(platFormtype) {
|
|
@@ -657,11 +665,11 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
657
665
|
options: options,
|
|
658
666
|
cleanedTree: cleanedTree
|
|
659
667
|
});
|
|
660
|
-
case
|
|
668
|
+
case 105:
|
|
661
669
|
case "end":
|
|
662
670
|
return _context3.stop();
|
|
663
671
|
}
|
|
664
|
-
}, _callee3, null, [[
|
|
672
|
+
}, _callee3, null, [[28, 35]]);
|
|
665
673
|
}));
|
|
666
674
|
return function fetchData(_x) {
|
|
667
675
|
return _ref5.apply(this, arguments);
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
getFormValueByFormId,
|
|
9
9
|
validateFields,
|
|
10
10
|
} from '@/utils/formUtils';
|
|
11
|
-
import { useContext } from 'react';
|
|
11
|
+
import { useContext, useState } from 'react';
|
|
12
12
|
|
|
13
13
|
const usePageForm = (refs: Record<string, any>) => {
|
|
14
14
|
const { refs: renderRefs } = useContext(Context);
|
|
15
|
+
const [, forceUpdate] = useState({});
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* 重置表单值
|
|
@@ -94,11 +95,12 @@ const usePageForm = (refs: Record<string, any>) => {
|
|
|
94
95
|
});
|
|
95
96
|
|
|
96
97
|
forms.forEach((form) => {
|
|
97
|
-
form?.setFieldsValue(formValues);
|
|
98
|
+
form?.setFieldsValue(formValues, refs);
|
|
98
99
|
});
|
|
99
100
|
} else {
|
|
100
|
-
refs[compId]?.setFieldsValue?.(formValues);
|
|
101
|
+
refs[compId]?.setFieldsValue?.(formValues, refs);
|
|
101
102
|
}
|
|
103
|
+
forceUpdate({});
|
|
102
104
|
};
|
|
103
105
|
|
|
104
106
|
/**
|
|
@@ -117,6 +119,30 @@ const usePageForm = (refs: Record<string, any>) => {
|
|
|
117
119
|
const getAllFormValues = () =>
|
|
118
120
|
validateFields({ refs, renderRefs }, getFieldsValueByCode);
|
|
119
121
|
|
|
122
|
+
/**
|
|
123
|
+
* 设置表单是否可编辑
|
|
124
|
+
* @param compId 组件id
|
|
125
|
+
* @param editor 是否可编辑
|
|
126
|
+
*/
|
|
127
|
+
const setFormDisabled = async (compId: string, editor: boolean) => {
|
|
128
|
+
if (!refs[compId]) return;
|
|
129
|
+
const compName = refs[compId].compName;
|
|
130
|
+
|
|
131
|
+
if (compName === 'BOFramer') {
|
|
132
|
+
const forms = getFormsByBoframerId({
|
|
133
|
+
refs,
|
|
134
|
+
renderRefs,
|
|
135
|
+
compId,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
forms.forEach((form) => {
|
|
139
|
+
form?.setDisabled(editor);
|
|
140
|
+
});
|
|
141
|
+
} else {
|
|
142
|
+
refs[compId]?.setDisabled?.(editor);
|
|
143
|
+
}
|
|
144
|
+
forceUpdate({});
|
|
145
|
+
};
|
|
120
146
|
return {
|
|
121
147
|
getFormValue,
|
|
122
148
|
validateForm,
|
|
@@ -124,6 +150,7 @@ const usePageForm = (refs: Record<string, any>) => {
|
|
|
124
150
|
getAllFormValues,
|
|
125
151
|
resetForm,
|
|
126
152
|
setFormValues,
|
|
153
|
+
setFormDisabled,
|
|
127
154
|
};
|
|
128
155
|
};
|
|
129
156
|
|