@lingxiteam/ebe-utils 0.0.27 → 0.0.29
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/constants.js +0 -1
- package/es/index.js +52 -36
- package/es/node/move.d.ts +1 -0
- package/es/node/move.js +7 -4
- package/es/requestQueue.d.ts +9 -0
- package/es/requestQueue.js +59 -0
- package/lib/h5public/src/components/common/PreviewFile/index.tsx +3 -7
- package/lib/h5public/src/components/factory/package.json +1 -1
- package/lib/h5public/src/components/factory/src/BlockSelect/components/CheckBox/index.tsx +14 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/components/Icon/index.tsx +4 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/index.tsx +13 -21
- package/lib/h5public/src/components/factory/src/Button/index.tsx +1 -0
- package/lib/h5public/src/components/factory/src/Card/index.less +11 -24
- package/lib/h5public/src/components/factory/src/Card/index.tsx +61 -22
- package/lib/h5public/src/components/factory/src/DGroup/index.less +7 -3
- package/lib/h5public/src/components/factory/src/DformFile/FormFile.tsx +17 -4
- package/lib/h5public/src/components/factory/src/DformFile/assets/closeIcon.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/default.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/fileName.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/img.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/js.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/pdf.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/ppt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/txt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/word.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/xls.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/zip.png +0 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.less +41 -5
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/h5public/src/components/factory/src/DynamicList/index.tsx +4 -2
- package/lib/h5public/src/components/factory/src/DynamicTable/Table.tsx +3 -1
- package/lib/h5public/src/components/factory/src/Image/BasicImage/index.tsx +36 -1
- package/lib/h5public/src/components/factory/src/StackColumn/loader.tsx +1 -1
- package/lib/h5public/src/components/factory/src/StaticTabs/index.tsx +1 -1
- package/lib/h5public/src/components/factory/src/VerificationCode/index.tsx +14 -3
- package/lib/h5public/src/components/factory/src/VideoPlayer/loader.ts +1 -1
- package/lib/h5public/src/components/factory/src/utils/CustomModule.tsx +3 -0
- package/lib/h5public/src/components/factory/src/utils/hooks/useFormItem.ts +3 -0
- package/lib/h5public/src/hooks/usePageForm.ts +2 -3
- package/lib/h5public/src/utils/native.ts +94 -0
- package/lib/node/move.d.ts +1 -0
- package/lib/node/move.js +6 -3
- package/lib/pcpublic/src/components/common/PreviewFile/index.tsx +8 -0
- package/lib/pcpublic/src/components/common/PreviewFile/utils.ts +45 -0
- package/lib/pcpublic/src/components/pcfactory/package.json +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/CollapsePanel/index.tsx +6 -4
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/pcpublic/src/components/pcfactory/src/Img/index.tsx +34 -2
- package/lib/pcpublic/src/components/pcfactory/src/LoopList/index.tsx +9 -4
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +8 -1
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/index.tsx +39 -13
- package/lib/pcpublic/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +22 -14
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +12 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +54 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +516 -485
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +40 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +3 -34
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +30 -3
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +34 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +15 -4
- package/lib/pcpublic/src/components/pcfactory/src/Tabs/index.tsx +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tag/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +13 -2
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/FormGroup.less +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Icon.less +4 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/StdUpload.less +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +15 -0
- package/lib/pcpublic/src/hooks/usePageForm.ts +2 -3
- package/lib/pcpublic/src/utils/exportCustomData/index.tsx +0 -3
- package/lib/public/src/hooks/useExportCustomDataFile.ts +4 -0
- package/lib/public/src/services/api/index.ts +12 -0
- package/lib/public/src/utils/Context/context.tsx +1 -0
- package/lib/public/src/utils/historytool.ts +3 -0
- package/lib/public/src/utils/lcdpBaseApi.ts +2 -2
- package/lib/public/src/utils/platform/utils/fileUtils.ts +12 -11
- package/lib/public/src/utils/polyfills.ts +4 -0
- package/lib/public/src/utils/popoverUtils.ts +56 -0
- package/lib/public/src/utils/service/baseRequest.ts +8 -8
- package/lib/public/src/utils/service/urlHelper.ts +2 -0
- package/package.json +2 -2
package/es/constants.js
CHANGED
package/es/index.js
CHANGED
|
@@ -22,6 +22,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
22
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
23
|
import { generateCode, init as ebeInit, publishers } from '@lingxiteam/ebe';
|
|
24
24
|
import { lingxiDslRules } from "./constants";
|
|
25
|
+
import RequestQueue from "./requestQueue";
|
|
25
26
|
export * from "./types";
|
|
26
27
|
var isArray = function isArray(arr) {
|
|
27
28
|
if (Array.isArray) {
|
|
@@ -219,7 +220,7 @@ export var clearLXPagesDSL = function clearLXPagesDSL(pages) {
|
|
|
219
220
|
});
|
|
220
221
|
};
|
|
221
222
|
export var getSafeTypeName = function getSafeTypeName(name) {
|
|
222
|
-
return name.replaceAll(' ', '').replaceAll('/', '').replaceAll('-', '').replaceAll('(', '').replaceAll(')', '');
|
|
223
|
+
return name.replaceAll(' ', '').replaceAll('/', '').replaceAll('-', '').replaceAll('(', '').replaceAll(',', '').replaceAll(',', '').replaceAll(')', '');
|
|
223
224
|
};
|
|
224
225
|
var workerJsUrl = '';
|
|
225
226
|
export var setWorkerJsUrl = function setWorkerJsUrl(url) {
|
|
@@ -250,7 +251,7 @@ var getIsIncrementalConstruction = function getIsIncrementalConstruction(ic) {
|
|
|
250
251
|
export var fetchData = /*#__PURE__*/function () {
|
|
251
252
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
252
253
|
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, 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, 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
255
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
255
256
|
while (1) switch (_context3.prev = _context3.next) {
|
|
256
257
|
case 0:
|
|
@@ -408,20 +409,28 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
408
409
|
progress: 5
|
|
409
410
|
});
|
|
410
411
|
needFindDataPages = isIncrementalConstruction ? incrementalConstructionPageList : appPageList;
|
|
411
|
-
|
|
412
|
-
|
|
412
|
+
requestQueue = new RequestQueue(8);
|
|
413
|
+
requests = needFindDataPages.map(function (i) {
|
|
413
414
|
lastPageId = i.pageId;
|
|
414
415
|
pageIdMapping[i.pagePath] = i.pageId;
|
|
415
|
-
return
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
return new Promise(function (resolve, reject) {
|
|
417
|
+
requestQueue.sendRequest(function () {
|
|
418
|
+
return services.findPageInstByVersionId({
|
|
419
|
+
appId: appId,
|
|
420
|
+
pageId: i.pageId
|
|
421
|
+
});
|
|
422
|
+
}).then(resolve).catch(reject);
|
|
418
423
|
});
|
|
419
|
-
})
|
|
420
|
-
|
|
424
|
+
});
|
|
425
|
+
_context3.next = 59;
|
|
426
|
+
return Promise.all(requests);
|
|
427
|
+
case 59:
|
|
421
428
|
data = _context3.sent;
|
|
429
|
+
// 先清空
|
|
430
|
+
requests = null;
|
|
422
431
|
pages = getPageDsls(data);
|
|
423
432
|
if (isIncrementalConstruction) {
|
|
424
|
-
_context3.next =
|
|
433
|
+
_context3.next = 75;
|
|
425
434
|
break;
|
|
426
435
|
}
|
|
427
436
|
onProgress({
|
|
@@ -430,7 +439,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
430
439
|
});
|
|
431
440
|
|
|
432
441
|
// 业务组件从被使用才生成改为全部生成
|
|
433
|
-
_context3.next =
|
|
442
|
+
_context3.next = 66;
|
|
434
443
|
return services.qryBusiCompPage({
|
|
435
444
|
appIds: [appId],
|
|
436
445
|
appId: appId,
|
|
@@ -439,22 +448,29 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
439
448
|
pageSize: 999999,
|
|
440
449
|
terminalType: platform
|
|
441
450
|
});
|
|
442
|
-
case
|
|
451
|
+
case 66:
|
|
443
452
|
_yield$services$qryBu = _context3.sent;
|
|
444
453
|
itemLists = _yield$services$qryBu.list;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
454
|
+
BusiCompRequest = itemLists.map(function (i) {
|
|
455
|
+
return new Promise(function (resolve, reject) {
|
|
456
|
+
requestQueue.sendRequest(function () {
|
|
457
|
+
return services.findBusiCompById({
|
|
458
|
+
busiCompId: i.busiCompId,
|
|
459
|
+
appId: appId,
|
|
460
|
+
pageId: lastPageId
|
|
461
|
+
});
|
|
462
|
+
}).then(resolve).catch(reject);
|
|
451
463
|
});
|
|
452
|
-
})
|
|
453
|
-
|
|
464
|
+
});
|
|
465
|
+
_context3.next = 71;
|
|
466
|
+
return Promise.all(BusiCompRequest);
|
|
467
|
+
case 71:
|
|
454
468
|
busiData = _context3.sent;
|
|
455
|
-
|
|
469
|
+
// 先清空
|
|
470
|
+
BusiCompRequest = null;
|
|
471
|
+
_context3.next = 82;
|
|
456
472
|
break;
|
|
457
|
-
case
|
|
473
|
+
case 75:
|
|
458
474
|
// busiCompId 过滤重复
|
|
459
475
|
itemHash = {}; // 找到所有页面使用到的 业务组件
|
|
460
476
|
findAllItem(pages, function (item) {
|
|
@@ -462,7 +478,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
462
478
|
}, itemHash);
|
|
463
479
|
_itemLists = Object.keys(itemHash); // 请求所有业务组件的 dsl
|
|
464
480
|
alllBusiComp = ((_incrementalConstruct = incrementalConstruction === null || incrementalConstruction === void 0 ? void 0 : incrementalConstruction.busiCompIds) !== null && _incrementalConstruct !== void 0 ? _incrementalConstruct : []).concat(_itemLists);
|
|
465
|
-
_context3.next =
|
|
481
|
+
_context3.next = 81;
|
|
466
482
|
return Promise.all(alllBusiComp.map(function (i) {
|
|
467
483
|
return services.findBusiCompById({
|
|
468
484
|
busiCompId: i,
|
|
@@ -470,9 +486,9 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
470
486
|
pageId: lastPageId
|
|
471
487
|
});
|
|
472
488
|
}));
|
|
473
|
-
case
|
|
489
|
+
case 81:
|
|
474
490
|
busiData = _context3.sent;
|
|
475
|
-
case
|
|
491
|
+
case 82:
|
|
476
492
|
// 过滤为空
|
|
477
493
|
busiPages = busiData.filter(Boolean).map(function (i, index) {
|
|
478
494
|
var _i$busiCompVersion;
|
|
@@ -545,14 +561,14 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
545
561
|
});
|
|
546
562
|
translateNames = {};
|
|
547
563
|
if (!(chinese.length > 0)) {
|
|
548
|
-
_context3.next =
|
|
564
|
+
_context3.next = 90;
|
|
549
565
|
break;
|
|
550
566
|
}
|
|
551
|
-
_context3.next =
|
|
567
|
+
_context3.next = 89;
|
|
552
568
|
return getTranslateName(appId, chinese, 'UPPER_CAMEL');
|
|
553
|
-
case
|
|
569
|
+
case 89:
|
|
554
570
|
translateNames = _context3.sent;
|
|
555
|
-
case
|
|
571
|
+
case 90:
|
|
556
572
|
// 翻译业务组件的名字
|
|
557
573
|
for (key = 0; key < busiPages.length; key++) {
|
|
558
574
|
onProgress({
|
|
@@ -567,7 +583,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
567
583
|
}
|
|
568
584
|
pagePathEnglishMapping = {};
|
|
569
585
|
if (!needTranslatePagePathToEnglish) {
|
|
570
|
-
_context3.next =
|
|
586
|
+
_context3.next = 103;
|
|
571
587
|
break;
|
|
572
588
|
}
|
|
573
589
|
pagePathEnglishSet = {};
|
|
@@ -589,14 +605,14 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
589
605
|
});
|
|
590
606
|
pagesTranslateNames = {};
|
|
591
607
|
if (!(pagesChinese.length > 0)) {
|
|
592
|
-
_context3.next =
|
|
608
|
+
_context3.next = 101;
|
|
593
609
|
break;
|
|
594
610
|
}
|
|
595
|
-
_context3.next =
|
|
611
|
+
_context3.next = 100;
|
|
596
612
|
return getTranslateName(appId, pagesChinese, 'UPPER_CAMEL');
|
|
597
|
-
case
|
|
613
|
+
case 100:
|
|
598
614
|
pagesTranslateNames = _context3.sent;
|
|
599
|
-
case
|
|
615
|
+
case 101:
|
|
600
616
|
findPageKeyByPageId = function findPageKeyByPageId(id, arrs) {
|
|
601
617
|
for (var _key = 0; _key < arrs.length; _key++) {
|
|
602
618
|
var _arrs$_key;
|
|
@@ -622,7 +638,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
622
638
|
pages[pageKey].pagePath = safeTranslateName;
|
|
623
639
|
}
|
|
624
640
|
}
|
|
625
|
-
case
|
|
641
|
+
case 103:
|
|
626
642
|
// 合并页面,生成器那边支持页面类型和业务组件类型
|
|
627
643
|
pageDSLS = [].concat(_toConsumableArray(pages), _toConsumableArray(busiPages));
|
|
628
644
|
getPlatform = function getPlatform(platFormtype) {
|
|
@@ -665,7 +681,7 @@ export var fetchData = /*#__PURE__*/function () {
|
|
|
665
681
|
options: options,
|
|
666
682
|
cleanedTree: cleanedTree
|
|
667
683
|
});
|
|
668
|
-
case
|
|
684
|
+
case 110:
|
|
669
685
|
case "end":
|
|
670
686
|
return _context3.stop();
|
|
671
687
|
}
|
package/es/node/move.d.ts
CHANGED
package/es/node/move.js
CHANGED
|
@@ -5,7 +5,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
5
5
|
import { existsSync, mkdirpSync, readFileSync, readJSONSync, writeFileSync, writeJSONSync } from 'fs-extra';
|
|
6
6
|
import { dirname, isAbsolute, join, relative } from 'path';
|
|
7
7
|
import { getAllImportFiles } from "./babel/getAllImportFiles";
|
|
8
|
-
var copyFileSyncAlias = function copyFileSyncAlias(cwd, from, to) {
|
|
8
|
+
var copyFileSyncAlias = function copyFileSyncAlias(cwd, from, to, plugin) {
|
|
9
9
|
var _context$match;
|
|
10
10
|
// copyFileSync(file, absTarget);
|
|
11
11
|
var context = readFileSync(from, 'utf-8');
|
|
@@ -17,6 +17,9 @@ var copyFileSyncAlias = function copyFileSyncAlias(cwd, from, to) {
|
|
|
17
17
|
var filePath = relative(dirname(from), absolute);
|
|
18
18
|
context = context.replace("@/".concat(source), filePath);
|
|
19
19
|
});
|
|
20
|
+
if (plugin) {
|
|
21
|
+
context = plugin(to, context);
|
|
22
|
+
}
|
|
20
23
|
writeFileSync(to, context, 'utf-8');
|
|
21
24
|
};
|
|
22
25
|
export function move(_x) {
|
|
@@ -24,11 +27,11 @@ export function move(_x) {
|
|
|
24
27
|
}
|
|
25
28
|
function _move() {
|
|
26
29
|
_move = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moveConfig) {
|
|
27
|
-
var target, outDir, _moveConfig$cwd, cwd, resolvedTarget, allImportFiles, keys, count, pkg, context;
|
|
30
|
+
var target, outDir, _moveConfig$cwd, cwd, plugin, resolvedTarget, allImportFiles, keys, count, pkg, context;
|
|
28
31
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
32
|
while (1) switch (_context.prev = _context.next) {
|
|
30
33
|
case 0:
|
|
31
|
-
target = moveConfig.target, outDir = moveConfig.outDir, _moveConfig$cwd = moveConfig.cwd, cwd = _moveConfig$cwd === void 0 ? process.cwd() : _moveConfig$cwd;
|
|
34
|
+
target = moveConfig.target, outDir = moveConfig.outDir, _moveConfig$cwd = moveConfig.cwd, cwd = _moveConfig$cwd === void 0 ? process.cwd() : _moveConfig$cwd, plugin = moveConfig.plugin;
|
|
32
35
|
resolvedTarget = isAbsolute(target) ? target : join(cwd, target);
|
|
33
36
|
if (existsSync(resolvedTarget)) {
|
|
34
37
|
_context.next = 4;
|
|
@@ -50,7 +53,7 @@ function _move() {
|
|
|
50
53
|
var absTarget = isAbsolute(outDir) ? join(outDir, filePath) : join(cwd, outDir, filePath);
|
|
51
54
|
// console.log(`[COPY] 拷贝 ${absTarget}`);
|
|
52
55
|
mkdirpSync(dirname(absTarget));
|
|
53
|
-
copyFileSyncAlias(cwd, file, absTarget);
|
|
56
|
+
copyFileSyncAlias(cwd, file, absTarget, plugin);
|
|
54
57
|
});
|
|
55
58
|
console.log("[COPY] \u5171\u62F7\u8D1D\u6587\u4EF6\u6570 ".concat(count));
|
|
56
59
|
pkg = join(cwd, 'package.json');
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
var RequestQueue = /*#__PURE__*/function () {
|
|
9
|
+
function RequestQueue() {
|
|
10
|
+
var maxConcurrent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 8;
|
|
11
|
+
_classCallCheck(this, RequestQueue);
|
|
12
|
+
_defineProperty(this, "maxConcurrent", void 0);
|
|
13
|
+
_defineProperty(this, "pendingRequests", void 0);
|
|
14
|
+
_defineProperty(this, "activeRequests", void 0);
|
|
15
|
+
this.maxConcurrent = maxConcurrent;
|
|
16
|
+
this.pendingRequests = [];
|
|
17
|
+
this.activeRequests = 0;
|
|
18
|
+
}
|
|
19
|
+
_createClass(RequestQueue, [{
|
|
20
|
+
key: "next",
|
|
21
|
+
value: function next() {
|
|
22
|
+
if (this.pendingRequests.length > 0 && this.activeRequests < this.maxConcurrent) {
|
|
23
|
+
var _ref = this.pendingRequests.shift(),
|
|
24
|
+
request = _ref.request,
|
|
25
|
+
resolve = _ref.resolve,
|
|
26
|
+
reject = _ref.reject;
|
|
27
|
+
this.sendRequest(request).then(resolve).catch(reject);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "sendRequest",
|
|
32
|
+
value: function sendRequest(request) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
return new Promise(function (resolve, reject) {
|
|
35
|
+
if (_this.activeRequests < _this.maxConcurrent) {
|
|
36
|
+
_this.activeRequests++;
|
|
37
|
+
request().then(function (response) {
|
|
38
|
+
_this.activeRequests--;
|
|
39
|
+
_this.next();
|
|
40
|
+
resolve(response);
|
|
41
|
+
}).catch(function (error) {
|
|
42
|
+
_this.activeRequests--;
|
|
43
|
+
_this.next();
|
|
44
|
+
reject(error);
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
_this.pendingRequests.push({
|
|
48
|
+
request: request,
|
|
49
|
+
resolve: resolve,
|
|
50
|
+
reject: reject
|
|
51
|
+
});
|
|
52
|
+
_this.next();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}]);
|
|
57
|
+
return RequestQueue;
|
|
58
|
+
}();
|
|
59
|
+
export default RequestQueue;
|
|
@@ -172,7 +172,7 @@ const PreviewFile: React.FC<PreviewFileProps> = (props) => {
|
|
|
172
172
|
};
|
|
173
173
|
xhr.onloadend = () => {
|
|
174
174
|
if (xhr.status === 404) {
|
|
175
|
-
messageApi.error(
|
|
175
|
+
messageApi.error('文件资源不存在');
|
|
176
176
|
onClose?.();
|
|
177
177
|
reject();
|
|
178
178
|
}
|
|
@@ -277,16 +277,12 @@ const PreviewFile: React.FC<PreviewFileProps> = (props) => {
|
|
|
277
277
|
onLoaded?.(true);
|
|
278
278
|
} else if (!fileInfo?.previewMode) {
|
|
279
279
|
// setResultInfo('当前文件不支持在线预览');
|
|
280
|
-
messageApi.error(
|
|
281
|
-
getLocale('fileNotSupportPreview') ?? '当前文件不支持在线预览',
|
|
282
|
-
);
|
|
280
|
+
messageApi.error('当前文件不支持在线预览');
|
|
283
281
|
onClose?.();
|
|
284
282
|
}
|
|
285
283
|
} catch (e: any) {
|
|
286
284
|
// setResultInfo(e.resultMsg);
|
|
287
|
-
messageApi.error(
|
|
288
|
-
getLocale('fileNotSupportPreview') ?? '当前文件不支持在线预览',
|
|
289
|
-
);
|
|
285
|
+
messageApi.error('当前文件不支持在线预览');
|
|
290
286
|
onClose?.();
|
|
291
287
|
} finally {
|
|
292
288
|
setLoading(false);
|
|
@@ -14,7 +14,7 @@ interface CheckBoxProps extends IconProps {
|
|
|
14
14
|
style?: React.CSSProperties;
|
|
15
15
|
valueKey?: string;
|
|
16
16
|
iconPosition?: string;
|
|
17
|
-
defaulIcon?:
|
|
17
|
+
defaulIcon?: 'square' | 'circle' | 'custom' | 'none';
|
|
18
18
|
normalIconColor?: any;
|
|
19
19
|
selectIconColor?: any;
|
|
20
20
|
}
|
|
@@ -37,15 +37,25 @@ const CheckBox: FC<CheckBoxProps> = (props) => {
|
|
|
37
37
|
}
|
|
38
38
|
return (
|
|
39
39
|
<div style={myStyle} className={classNames(`${prefixCls}-blockSelect`)}>
|
|
40
|
-
{iconPosition === 'left' && (
|
|
40
|
+
{iconPosition === 'left' && defaultIcon !== 'none' && (
|
|
41
41
|
<Icon
|
|
42
42
|
{...iconProps}
|
|
43
43
|
iconPosition={iconPosition}
|
|
44
44
|
defaultIcon={defaultIcon}
|
|
45
45
|
/>
|
|
46
46
|
)}
|
|
47
|
-
<div
|
|
48
|
-
|
|
47
|
+
<div
|
|
48
|
+
className={`${prefixCls}-content`}
|
|
49
|
+
onClick={() =>
|
|
50
|
+
iconProps?.onChange?.({
|
|
51
|
+
restItem: iconProps?.restItem,
|
|
52
|
+
index: iconProps?.index,
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</div>
|
|
58
|
+
{iconPosition === 'right' && defaultIcon !== 'none' && (
|
|
49
59
|
<Icon
|
|
50
60
|
{...iconProps}
|
|
51
61
|
iconPosition={iconPosition}
|
|
@@ -45,12 +45,12 @@ const Icon: FC<IconProps> = (props) => {
|
|
|
45
45
|
name,
|
|
46
46
|
} = props;
|
|
47
47
|
|
|
48
|
-
const { compatConfig } = getEngineApis?.() || {};
|
|
48
|
+
// const { compatConfig } = getEngineApis?.() || {};
|
|
49
49
|
|
|
50
50
|
const myOnClick = (e: any) => {
|
|
51
|
-
if (compatConfig?.cmd?.stopPropagation) {
|
|
52
|
-
|
|
53
|
-
}
|
|
51
|
+
// if (compatConfig?.cmd?.stopPropagation) {
|
|
52
|
+
// e.stopPropagation();
|
|
53
|
+
// }
|
|
54
54
|
if (onChange) {
|
|
55
55
|
onChange({
|
|
56
56
|
restItem,
|
|
@@ -41,12 +41,16 @@ export interface MyBlockSelectProps {
|
|
|
41
41
|
) => void;
|
|
42
42
|
iconPosition?: string;
|
|
43
43
|
checkModel?: any;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated 废弃
|
|
47
|
+
*/
|
|
44
48
|
status?: string;
|
|
45
49
|
showAllCheck?: boolean;
|
|
46
50
|
showChecked?: boolean;
|
|
47
51
|
actionView?: any;
|
|
48
52
|
actionViewPosition?: string;
|
|
49
|
-
|
|
53
|
+
defaulIcon?: 'square' | 'circle' | 'custom' | 'none';
|
|
50
54
|
selectedAllAction?: any;
|
|
51
55
|
selectIconColor?: any;
|
|
52
56
|
normalIconColor?: any;
|
|
@@ -81,7 +85,8 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
81
85
|
normalImg,
|
|
82
86
|
onChange: uOnChange = () => {},
|
|
83
87
|
iconPosition = 'left',
|
|
84
|
-
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
|
+
status,
|
|
85
90
|
checkModel,
|
|
86
91
|
actionViewPosition,
|
|
87
92
|
defaultIcon,
|
|
@@ -98,13 +103,14 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
98
103
|
closeOnAction = false,
|
|
99
104
|
closeOnTouchOutside = false,
|
|
100
105
|
$$componentItem,
|
|
106
|
+
disabled,
|
|
107
|
+
visible,
|
|
101
108
|
} = props;
|
|
102
109
|
const {
|
|
103
110
|
MemoRenderer: { renderer, MemoLoopItem, getLoopItemExtraProps },
|
|
104
111
|
getAppFileUrlByFileCode,
|
|
105
112
|
} = getEngineApis();
|
|
106
113
|
const col = columnNum || 1;
|
|
107
|
-
const [status, setStatus] = useState<any>(myStatus);
|
|
108
114
|
const [value, setValues] = useState<any[]>();
|
|
109
115
|
const [myIsMultiple, setMyIsMultiple] = useState<any>(false);
|
|
110
116
|
const [myIsChecked, setMyIsChecked] = useState<any>(false);
|
|
@@ -120,10 +126,6 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
120
126
|
return [props?.itemKey || 'item', props?.indexKey || 'i'];
|
|
121
127
|
}, []);
|
|
122
128
|
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
setStatus(status);
|
|
125
|
-
}, [status]);
|
|
126
|
-
|
|
127
129
|
// 默认值支持对象数组及字符串数组
|
|
128
130
|
useEffect(() => {
|
|
129
131
|
if (Array.isArray(defaultValue) && isUndefined(value)) {
|
|
@@ -137,12 +139,12 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
137
139
|
display: 'flex',
|
|
138
140
|
flexDirection: 'column',
|
|
139
141
|
};
|
|
140
|
-
if (
|
|
142
|
+
if (visible === false) {
|
|
141
143
|
// 状态隐藏
|
|
142
144
|
style.display = 'none';
|
|
143
145
|
}
|
|
144
146
|
return style;
|
|
145
|
-
}, [uStyle,
|
|
147
|
+
}, [uStyle, visible]) as React.CSSProperties;
|
|
146
148
|
|
|
147
149
|
const getItemStyle = useCallback(
|
|
148
150
|
(checked, top) => {
|
|
@@ -161,7 +163,7 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
161
163
|
);
|
|
162
164
|
|
|
163
165
|
const onChange = ({ index, restItem }: { index: number; restItem: any }) => {
|
|
164
|
-
if (
|
|
166
|
+
if (disabled || restItem?.myBSState === '3') {
|
|
165
167
|
// 禁用状态设置无法选中
|
|
166
168
|
return;
|
|
167
169
|
}
|
|
@@ -254,16 +256,6 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
254
256
|
realValues,
|
|
255
257
|
];
|
|
256
258
|
},
|
|
257
|
-
get visible() {
|
|
258
|
-
if (status === '2') {
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
return true;
|
|
262
|
-
},
|
|
263
|
-
setVisible: (v: boolean) => {
|
|
264
|
-
const newStatus = myStatus === '2' ? '1' : myStatus;
|
|
265
|
-
setStatus(v ? newStatus : '2');
|
|
266
|
-
},
|
|
267
259
|
setBlockSelectStateData: changeBlockItemState,
|
|
268
260
|
setBlockSelectSelectedData: changeBlockItemSelectedState,
|
|
269
261
|
setBlockSelectHiddenData: changeBlockItemHidden,
|
|
@@ -512,7 +504,7 @@ const BlockSelect = LingxiForwardRef<any, MyBlockSelectProps>((props, ref) => {
|
|
|
512
504
|
...getLoopItemExtraProps?.(item, i),
|
|
513
505
|
};
|
|
514
506
|
|
|
515
|
-
if (swipe && swipeAction?.length &&
|
|
507
|
+
if (swipe && swipeAction?.length && !disabled) {
|
|
516
508
|
return (
|
|
517
509
|
<MySwipe
|
|
518
510
|
closeOnAction={closeOnAction}
|
|
@@ -83,37 +83,24 @@
|
|
|
83
83
|
// padding-bottom: 12px !important;
|
|
84
84
|
position: relative;
|
|
85
85
|
border-radius: 0px !important;
|
|
86
|
+
// 卡片头部不受padding控制
|
|
87
|
+
padding: 12px;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
.adm-card-header:not(:last-child) {
|
|
89
91
|
border-bottom: solid 1px #f0f0f0;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
.adm-card-body {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.@{prefixCls}-after381-card {
|
|
99
|
-
.adm-card-body {
|
|
100
|
-
padding-top: 0 !important;
|
|
101
|
-
padding-bottom: 0 !important;
|
|
102
|
-
}
|
|
103
|
-
.lcdp-card-body {
|
|
104
|
-
padding: 0 !important;
|
|
105
|
-
}
|
|
106
|
-
.lcdp-card-footer-draw-box {
|
|
107
|
-
// padding-top: 12 * @hd !important;
|
|
108
|
-
padding-left: 0 !important;
|
|
109
|
-
padding-right: 0 !important;
|
|
110
|
-
}
|
|
111
|
-
|
|
94
|
+
// .adm-card-body {
|
|
95
|
+
// padding-top: 12px !important;
|
|
96
|
+
// padding-bottom: 12px !important;
|
|
97
|
+
// }
|
|
112
98
|
}
|
|
113
99
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
// 简洁的卡片样式
|
|
101
|
+
.@{prefixCls}.@{prefixCls}-after381-card {
|
|
102
|
+
// 卡片头部不受padding控制
|
|
103
|
+
.adm-card-header {
|
|
104
|
+
padding: 12px 12px 0 12px;
|
|
117
105
|
}
|
|
118
|
-
|
|
119
106
|
}
|