@next-core/brick-kit 2.166.1 → 2.167.1
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/dist/index.bundle.js +292 -15
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +296 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/package.json +4 -3
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
6
|
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, merge, sortBy, orderBy, isObject as isObject$1, uniq, pick, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
|
|
7
|
-
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, trackFormState, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, deepFreeze, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
7
|
+
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, trackFormState, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, deepFreeze, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript as loadScript$1, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import React, { useState, useEffect, useRef, useMemo, useCallback, forwardRef, useImperativeHandle, useContext, createContext, useReducer } from 'react';
|
|
9
9
|
import { http, HttpResponseError, HttpAbortError, HttpFetchError } from '@next-core/brick-http';
|
|
10
10
|
import { Modal, message, Empty, ConfigProvider } from 'antd';
|
|
@@ -2621,12 +2621,12 @@ function setupTemplateProxy(proxyContext, ref, slots) {
|
|
|
2621
2621
|
var _excluded$7 = ["properties", "slots"];
|
|
2622
2622
|
function setupUseBrickInTemplate(props, proxyContext) {
|
|
2623
2623
|
function walk(props) {
|
|
2624
|
-
if (!isObject(props)) {
|
|
2625
|
-
return props;
|
|
2626
|
-
}
|
|
2627
2624
|
if (Array.isArray(props)) {
|
|
2628
2625
|
return props.map(walk);
|
|
2629
2626
|
}
|
|
2627
|
+
if (!isObject(props) || !isPlainObject(props)) {
|
|
2628
|
+
return props;
|
|
2629
|
+
}
|
|
2630
2630
|
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
2631
2631
|
var [key, value] = _ref;
|
|
2632
2632
|
return isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
@@ -2653,6 +2653,9 @@ function setupUseBrickInTemplate(props, proxyContext) {
|
|
|
2653
2653
|
}
|
|
2654
2654
|
return walk(props);
|
|
2655
2655
|
}
|
|
2656
|
+
function isPlainObject(object) {
|
|
2657
|
+
return Object.prototype.toString.call(object) === "[object Object]";
|
|
2658
|
+
}
|
|
2656
2659
|
|
|
2657
2660
|
var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
2658
2661
|
var preEvaluated = isPreEvaluated(value);
|
|
@@ -6552,6 +6555,267 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
|
|
|
6552
6555
|
};
|
|
6553
6556
|
}();
|
|
6554
6557
|
|
|
6558
|
+
var cache$1 = new Map();
|
|
6559
|
+
function loadScript(src, prefix) {
|
|
6560
|
+
if (Array.isArray(src)) {
|
|
6561
|
+
return Promise.all(src.map(item => loadScript(item, prefix)));
|
|
6562
|
+
}
|
|
6563
|
+
var fixedSrc = prefix ? "".concat(prefix).concat(src) : src;
|
|
6564
|
+
var cachedPromise = cache$1.get(fixedSrc);
|
|
6565
|
+
if (cachedPromise) {
|
|
6566
|
+
return cachedPromise;
|
|
6567
|
+
}
|
|
6568
|
+
var promise = new Promise((resolve, reject) => {
|
|
6569
|
+
var end = () => {
|
|
6570
|
+
window.dispatchEvent(new Event("request.end"));
|
|
6571
|
+
};
|
|
6572
|
+
var script = document.createElement("script");
|
|
6573
|
+
script.src = fixedSrc;
|
|
6574
|
+
script.type = "text/javascript";
|
|
6575
|
+
script.async = true;
|
|
6576
|
+
script.onload = () => {
|
|
6577
|
+
resolve(fixedSrc);
|
|
6578
|
+
end();
|
|
6579
|
+
};
|
|
6580
|
+
script.onerror = e => {
|
|
6581
|
+
reject(e);
|
|
6582
|
+
end();
|
|
6583
|
+
};
|
|
6584
|
+
var firstScript = document.currentScript || document.getElementsByTagName("script")[0];
|
|
6585
|
+
firstScript.parentNode.insertBefore(script, firstScript);
|
|
6586
|
+
window.dispatchEvent(new Event("request.start"));
|
|
6587
|
+
});
|
|
6588
|
+
cache$1.set(fixedSrc, promise);
|
|
6589
|
+
return promise;
|
|
6590
|
+
}
|
|
6591
|
+
|
|
6592
|
+
// https://github.com/module-federation/module-federation-examples/blob/eda9493f3991a423479fd834cfb1d7b241d9d1f0/advanced-api/dynamic-remotes/app1/src/App.js
|
|
6593
|
+
function loadSharedModule(_x, _x2) {
|
|
6594
|
+
return _loadSharedModule.apply(this, arguments);
|
|
6595
|
+
}
|
|
6596
|
+
function _loadSharedModule() {
|
|
6597
|
+
_loadSharedModule = _asyncToGenerator$3(function* (scope, module) {
|
|
6598
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
6599
|
+
yield __webpack_init_sharing__("default");
|
|
6600
|
+
var container = window[scope]; // or get the container somewhere else
|
|
6601
|
+
// Initialize the container, it may provide shared modules
|
|
6602
|
+
yield container.init(__webpack_share_scopes__.default);
|
|
6603
|
+
var factory = yield container.get(module);
|
|
6604
|
+
return factory();
|
|
6605
|
+
});
|
|
6606
|
+
return _loadSharedModule.apply(this, arguments);
|
|
6607
|
+
}
|
|
6608
|
+
|
|
6609
|
+
var resolveBasicPkg;
|
|
6610
|
+
var basicPkgWillBeResolved = false;
|
|
6611
|
+
var waitBasicPkg = new Promise(resolve => {
|
|
6612
|
+
resolveBasicPkg = resolve;
|
|
6613
|
+
});
|
|
6614
|
+
function flushStableLoadBricks() {
|
|
6615
|
+
if (!basicPkgWillBeResolved) {
|
|
6616
|
+
resolveBasicPkg();
|
|
6617
|
+
}
|
|
6618
|
+
}
|
|
6619
|
+
function loadBricksImperatively(_x, _x2) {
|
|
6620
|
+
return _loadBricksImperatively.apply(this, arguments);
|
|
6621
|
+
}
|
|
6622
|
+
function _loadBricksImperatively() {
|
|
6623
|
+
_loadBricksImperatively = _asyncToGenerator$3(function* (bricks, brickPackages) {
|
|
6624
|
+
var promise = enqueueStableLoad("bricks", bricks, brickPackages);
|
|
6625
|
+
flushStableLoadBricks();
|
|
6626
|
+
return dispatchRequestStatus(promise);
|
|
6627
|
+
});
|
|
6628
|
+
return _loadBricksImperatively.apply(this, arguments);
|
|
6629
|
+
}
|
|
6630
|
+
function loadProcessorsImperatively(processors, brickPackages) {
|
|
6631
|
+
var promise = enqueueStableLoad("processors", processors, brickPackages);
|
|
6632
|
+
flushStableLoadBricks();
|
|
6633
|
+
return dispatchRequestStatus(promise);
|
|
6634
|
+
}
|
|
6635
|
+
var v2AdapterPromise;
|
|
6636
|
+
var V2_ADAPTER_LOAD_BRICKS = "v2-adapter.load-bricks";
|
|
6637
|
+
|
|
6638
|
+
// Get brick/processor items including their dependencies
|
|
6639
|
+
function getItemsByPkg(type, list, brickPackagesMap) {
|
|
6640
|
+
var itemsByPkg = new Map();
|
|
6641
|
+
var listToLoad = new Set();
|
|
6642
|
+
var add = item => {
|
|
6643
|
+
var _pkg$dependencies;
|
|
6644
|
+
if (listToLoad.has(item)) {
|
|
6645
|
+
return;
|
|
6646
|
+
}
|
|
6647
|
+
listToLoad.add(item);
|
|
6648
|
+
var pkg;
|
|
6649
|
+
var namespace;
|
|
6650
|
+
var itemName;
|
|
6651
|
+
if (type === "processors" || item.includes(".")) {
|
|
6652
|
+
[namespace, itemName] = item.split(".");
|
|
6653
|
+
var pkgId = "bricks/".concat(type === "processors" ? getProcessorPackageName(namespace) : namespace);
|
|
6654
|
+
pkg = brickPackagesMap.get(pkgId);
|
|
6655
|
+
} else {
|
|
6656
|
+
itemName = item;
|
|
6657
|
+
for (var p of brickPackagesMap.values()) {
|
|
6658
|
+
var _p$elements;
|
|
6659
|
+
if ((_p$elements = p.elements) !== null && _p$elements !== void 0 && _p$elements.some(e => e === itemName)) {
|
|
6660
|
+
pkg = p;
|
|
6661
|
+
break;
|
|
6662
|
+
}
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
if (!pkg) {
|
|
6666
|
+
throw new Error("Package for ".concat(item, " not found."));
|
|
6667
|
+
}
|
|
6668
|
+
var groupItems = itemsByPkg.get(pkg);
|
|
6669
|
+
if (!groupItems) {
|
|
6670
|
+
groupItems = [];
|
|
6671
|
+
itemsByPkg.set(pkg, groupItems);
|
|
6672
|
+
}
|
|
6673
|
+
groupItems.push(itemName);
|
|
6674
|
+
|
|
6675
|
+
// Load their dependencies too
|
|
6676
|
+
var deps = (_pkg$dependencies = pkg.dependencies) === null || _pkg$dependencies === void 0 ? void 0 : _pkg$dependencies[item];
|
|
6677
|
+
if (deps) {
|
|
6678
|
+
for (var dep of deps) {
|
|
6679
|
+
add(dep);
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
};
|
|
6683
|
+
for (var item of list) {
|
|
6684
|
+
add(item);
|
|
6685
|
+
}
|
|
6686
|
+
return itemsByPkg;
|
|
6687
|
+
}
|
|
6688
|
+
function loadBrickModule(_x3, _x4, _x5) {
|
|
6689
|
+
return _loadBrickModule.apply(this, arguments);
|
|
6690
|
+
}
|
|
6691
|
+
function _loadBrickModule() {
|
|
6692
|
+
_loadBrickModule = _asyncToGenerator$3(function* (type, pkgId, itemName) {
|
|
6693
|
+
var moduleName = "".concat(type === "processors" ? "./processors/" : "./").concat(itemName);
|
|
6694
|
+
try {
|
|
6695
|
+
yield loadSharedModule(pkgId, moduleName);
|
|
6696
|
+
} catch (error) {
|
|
6697
|
+
// eslint-disable-next-line no-console
|
|
6698
|
+
console.error(error);
|
|
6699
|
+
throw new Error("Load ".concat(type, " of \"").concat(pkgId.split("/").pop(), ".").concat(moduleName.split("/").pop(), "\" failed"));
|
|
6700
|
+
}
|
|
6701
|
+
});
|
|
6702
|
+
return _loadBrickModule.apply(this, arguments);
|
|
6703
|
+
}
|
|
6704
|
+
function loadRestBricks(type, pkgs, itemsMap) {
|
|
6705
|
+
return pkgs.map( /*#__PURE__*/function () {
|
|
6706
|
+
var _ref = _asyncToGenerator$3(function* (pkg) {
|
|
6707
|
+
var _window$PUBLIC_ROOT;
|
|
6708
|
+
yield loadScript(pkg.filePath, (_window$PUBLIC_ROOT = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT !== void 0 ? _window$PUBLIC_ROOT : "");
|
|
6709
|
+
yield waitBasicPkg;
|
|
6710
|
+
return Promise.all(
|
|
6711
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6712
|
+
itemsMap.get(pkg).map(itemName => loadBrickModule(type, pkg.id, itemName)));
|
|
6713
|
+
});
|
|
6714
|
+
return function (_x6) {
|
|
6715
|
+
return _ref.apply(this, arguments);
|
|
6716
|
+
};
|
|
6717
|
+
}());
|
|
6718
|
+
}
|
|
6719
|
+
function enqueueStableLoad(_x7, _x8, _x9) {
|
|
6720
|
+
return _enqueueStableLoad.apply(this, arguments);
|
|
6721
|
+
}
|
|
6722
|
+
function _enqueueStableLoad() {
|
|
6723
|
+
_enqueueStableLoad = _asyncToGenerator$3(function* (type, list, brickPackages) {
|
|
6724
|
+
var brickPackagesMap = new Map();
|
|
6725
|
+
for (var pkg of brickPackages) {
|
|
6726
|
+
var _pkg$id;
|
|
6727
|
+
var pkgId = (_pkg$id = pkg.id) !== null && _pkg$id !== void 0 ? _pkg$id : getPkgIdByFilePath(pkg.filePath);
|
|
6728
|
+
brickPackagesMap.set(pkgId, pkg);
|
|
6729
|
+
}
|
|
6730
|
+
var itemsByPkg = getItemsByPkg(type, list, brickPackagesMap);
|
|
6731
|
+
var foundBasicPkg;
|
|
6732
|
+
var v2Packages = [];
|
|
6733
|
+
var v3PackagesOtherThanBasic = [];
|
|
6734
|
+
var maybeV2Adapter;
|
|
6735
|
+
for (var _pkg of itemsByPkg.keys()) {
|
|
6736
|
+
if (_pkg.id) {
|
|
6737
|
+
if (_pkg.id === "bricks/basic") {
|
|
6738
|
+
foundBasicPkg = _pkg;
|
|
6739
|
+
} else {
|
|
6740
|
+
v3PackagesOtherThanBasic.push(_pkg);
|
|
6741
|
+
}
|
|
6742
|
+
} else {
|
|
6743
|
+
// Brick packages of v2 has no `id`
|
|
6744
|
+
v2Packages.push(_pkg);
|
|
6745
|
+
maybeV2Adapter = brickPackagesMap.get("bricks/v2-adapter");
|
|
6746
|
+
if (!maybeV2Adapter) {
|
|
6747
|
+
// eslint-disable-next-line no-console
|
|
6748
|
+
console.error("Using v2 bricks, but v2-adapter not found");
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
var v2Adapter = maybeV2Adapter;
|
|
6753
|
+
var basicPkgPromise;
|
|
6754
|
+
var basicPkg = foundBasicPkg;
|
|
6755
|
+
if (basicPkg) {
|
|
6756
|
+
var _window$PUBLIC_ROOT2;
|
|
6757
|
+
var tempPromise = loadScript(basicPkg.filePath, (_window$PUBLIC_ROOT2 = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT2 !== void 0 ? _window$PUBLIC_ROOT2 : "");
|
|
6758
|
+
// Packages other than BASIC will wait for an extra micro-task tick.
|
|
6759
|
+
if (!basicPkgWillBeResolved) {
|
|
6760
|
+
basicPkgWillBeResolved = true;
|
|
6761
|
+
tempPromise.then(() => Promise.resolve()).then(resolveBasicPkg);
|
|
6762
|
+
}
|
|
6763
|
+
basicPkgPromise = tempPromise.then(() => Promise.all(
|
|
6764
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6765
|
+
itemsByPkg.get(basicPkg).map(itemName => loadBrickModule(type, basicPkg.id, itemName))));
|
|
6766
|
+
}
|
|
6767
|
+
var pkgPromises = [basicPkgPromise].concat(loadRestBricks(type, v3PackagesOtherThanBasic, itemsByPkg));
|
|
6768
|
+
if (v2Adapter && v2Packages.length > 0) {
|
|
6769
|
+
if (!v2AdapterPromise) {
|
|
6770
|
+
// Load `v2-adapter.load-bricks` and its dependencies
|
|
6771
|
+
var v2AdapterItemsByPkg = getItemsByPkg("bricks", [V2_ADAPTER_LOAD_BRICKS], brickPackagesMap);
|
|
6772
|
+
var v2AdapterPackages = [...v2AdapterItemsByPkg.keys()];
|
|
6773
|
+
var loadV2Adapter = /*#__PURE__*/function () {
|
|
6774
|
+
var _ref2 = _asyncToGenerator$3(function* () {
|
|
6775
|
+
yield Promise.all(loadRestBricks("bricks", v2AdapterPackages, v2AdapterItemsByPkg));
|
|
6776
|
+
return document.createElement(V2_ADAPTER_LOAD_BRICKS);
|
|
6777
|
+
});
|
|
6778
|
+
return function loadV2Adapter() {
|
|
6779
|
+
return _ref2.apply(this, arguments);
|
|
6780
|
+
};
|
|
6781
|
+
}();
|
|
6782
|
+
v2AdapterPromise = loadV2Adapter();
|
|
6783
|
+
}
|
|
6784
|
+
pkgPromises.push(v2AdapterPromise.then(adapter => Promise.all(v2Packages.map(pkg => {
|
|
6785
|
+
var pkgId = getPkgIdByFilePath(pkg.filePath);
|
|
6786
|
+
var pkgNamespace = pkgId.split("/")[1];
|
|
6787
|
+
return adapter.resolve(v2Adapter.filePath, pkg.filePath, type === "bricks" ?
|
|
6788
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6789
|
+
itemsByPkg.get(pkg).map(itemName => "".concat(pkgNamespace, ".").concat(itemName)) : [], pkg.dll,
|
|
6790
|
+
// Todo: remove `brickPackages` as an argument
|
|
6791
|
+
brickPackages);
|
|
6792
|
+
}))));
|
|
6793
|
+
}
|
|
6794
|
+
yield Promise.all(pkgPromises);
|
|
6795
|
+
});
|
|
6796
|
+
return _enqueueStableLoad.apply(this, arguments);
|
|
6797
|
+
}
|
|
6798
|
+
function dispatchRequestStatus(_x10) {
|
|
6799
|
+
return _dispatchRequestStatus.apply(this, arguments);
|
|
6800
|
+
}
|
|
6801
|
+
function _dispatchRequestStatus() {
|
|
6802
|
+
_dispatchRequestStatus = _asyncToGenerator$3(function* (promise) {
|
|
6803
|
+
window.dispatchEvent(new Event("request.start"));
|
|
6804
|
+
try {
|
|
6805
|
+
yield promise;
|
|
6806
|
+
} finally {
|
|
6807
|
+
window.dispatchEvent(new Event("request.end"));
|
|
6808
|
+
}
|
|
6809
|
+
});
|
|
6810
|
+
return _dispatchRequestStatus.apply(this, arguments);
|
|
6811
|
+
}
|
|
6812
|
+
function getProcessorPackageName(camelPackageName) {
|
|
6813
|
+
return camelPackageName.replace(/[A-Z]/g, match => "-".concat(match[0].toLocaleLowerCase())).replace(/_[0-9]/g, match => "-".concat(match[1]));
|
|
6814
|
+
}
|
|
6815
|
+
function getPkgIdByFilePath(filePath) {
|
|
6816
|
+
return filePath.split("/").slice(0, 2).join("/");
|
|
6817
|
+
}
|
|
6818
|
+
|
|
6555
6819
|
/**
|
|
6556
6820
|
* Merge `app.defaultConfig` and `app.userConfig` to `app.config`.
|
|
6557
6821
|
*
|
|
@@ -8319,6 +8583,7 @@ class Kernel {
|
|
|
8319
8583
|
pendingTask: Promise.resolve()
|
|
8320
8584
|
};
|
|
8321
8585
|
} else {
|
|
8586
|
+
var _eager$v3Bricks;
|
|
8322
8587
|
// 先加载模板
|
|
8323
8588
|
var templateDeps = getTemplateDepsOfStoryboard(storyboard, templatePackages);
|
|
8324
8589
|
yield loadScriptOfBricksOrTemplates(templateDeps);
|
|
@@ -8327,6 +8592,8 @@ class Kernel {
|
|
|
8327
8592
|
dll,
|
|
8328
8593
|
deps,
|
|
8329
8594
|
bricks,
|
|
8595
|
+
v3Bricks,
|
|
8596
|
+
v3Processors,
|
|
8330
8597
|
eager
|
|
8331
8598
|
} = getDllAndDepsOfStoryboard(yield asyncProcessStoryboard(storyboard, brickTemplateRegistry, templatePackages), brickPackages, {
|
|
8332
8599
|
ignoreBricksInUnusedCustomTemplates: true
|
|
@@ -8334,10 +8601,15 @@ class Kernel {
|
|
|
8334
8601
|
// 需要先阻塞加载 Custom Processors 和 widgets。
|
|
8335
8602
|
yield loadScriptOfDll(eager.dll);
|
|
8336
8603
|
yield loadScriptOfBricksOrTemplates(eager.deps);
|
|
8604
|
+
if ((_eager$v3Bricks = eager.v3Bricks) !== null && _eager$v3Bricks !== void 0 && _eager$v3Bricks.length) {
|
|
8605
|
+
yield loadBricksImperatively(eager.v3Bricks, brickPackages);
|
|
8606
|
+
}
|
|
8337
8607
|
// 加载构件资源时,不再阻塞后续业务数据的加载,在挂载构件时再等待该任务完成。
|
|
8338
8608
|
// 挂载构件可能包括:Provider 构件实时挂载、路由准备完成后的统一挂载等。
|
|
8339
8609
|
return {
|
|
8340
|
-
pendingTask: loadScriptOfDll(dll).then(() => loadScriptOfBricksOrTemplates(deps)).then((
|
|
8610
|
+
pendingTask: loadScriptOfDll(dll).then(() => loadScriptOfBricksOrTemplates(deps)).then( /*#__PURE__*/_asyncToGenerator$3(function* () {
|
|
8611
|
+
yield Promise.all([loadLazyBricks(bricks), (v3Bricks === null || v3Bricks === void 0 ? void 0 : v3Bricks.length) && loadBricksImperatively(v3Bricks, brickPackages), (v3Processors === null || v3Processors === void 0 ? void 0 : v3Processors.length) && loadProcessorsImperatively(v3Processors, brickPackages)]);
|
|
8612
|
+
}))
|
|
8341
8613
|
};
|
|
8342
8614
|
}
|
|
8343
8615
|
});
|
|
@@ -8346,28 +8618,33 @@ class Kernel {
|
|
|
8346
8618
|
};
|
|
8347
8619
|
}());
|
|
8348
8620
|
_defineProperty$1(this, "_loadDynamicBricks", /*#__PURE__*/function () {
|
|
8349
|
-
var
|
|
8621
|
+
var _ref3 = _asyncToGenerator$3(function* (bricks, processors) {
|
|
8350
8622
|
var filteredBricks = bricks.filter(
|
|
8351
8623
|
// Only try to load undefined custom elements.
|
|
8352
8624
|
item => !customElements.get(item));
|
|
8625
|
+
var {
|
|
8626
|
+
brickPackages
|
|
8627
|
+
} = _this.bootstrapData;
|
|
8353
8628
|
// Try to load deps for dynamic added bricks.
|
|
8354
8629
|
var {
|
|
8355
8630
|
dll,
|
|
8356
|
-
deps
|
|
8631
|
+
deps,
|
|
8632
|
+
v3Bricks,
|
|
8633
|
+
v3Processors
|
|
8357
8634
|
} = getDllAndDepsByResource({
|
|
8358
8635
|
bricks: filteredBricks,
|
|
8359
8636
|
processors
|
|
8360
8637
|
}, _this.bootstrapData.brickPackages);
|
|
8361
8638
|
yield loadScriptOfDll(dll);
|
|
8362
8639
|
yield loadScriptOfBricksOrTemplates(deps);
|
|
8363
|
-
yield loadLazyBricks(filteredBricks);
|
|
8640
|
+
yield Promise.all([loadLazyBricks(filteredBricks), (v3Bricks === null || v3Bricks === void 0 ? void 0 : v3Bricks.length) && loadBricksImperatively(v3Bricks, brickPackages), (v3Processors === null || v3Processors === void 0 ? void 0 : v3Processors.length) && loadProcessorsImperatively(v3Processors, brickPackages)]);
|
|
8364
8641
|
});
|
|
8365
8642
|
return function (_x2, _x3) {
|
|
8366
|
-
return
|
|
8643
|
+
return _ref3.apply(this, arguments);
|
|
8367
8644
|
};
|
|
8368
8645
|
}());
|
|
8369
8646
|
_defineProperty$1(this, "_loadEditorBricks", /*#__PURE__*/function () {
|
|
8370
|
-
var
|
|
8647
|
+
var _ref4 = _asyncToGenerator$3(function* (editorBricks) {
|
|
8371
8648
|
var {
|
|
8372
8649
|
dll,
|
|
8373
8650
|
deps
|
|
@@ -8380,7 +8657,7 @@ class Kernel {
|
|
|
8380
8657
|
yield loadScriptOfBricksOrTemplates(deps);
|
|
8381
8658
|
});
|
|
8382
8659
|
return function (_x4) {
|
|
8383
|
-
return
|
|
8660
|
+
return _ref4.apply(this, arguments);
|
|
8384
8661
|
};
|
|
8385
8662
|
}());
|
|
8386
8663
|
}
|
|
@@ -8564,8 +8841,8 @@ class Kernel {
|
|
|
8564
8841
|
// Prefix to avoid conflict between brick package's i18n namespace.
|
|
8565
8842
|
var i18nNamespace = getI18nNamespace("app", storyboard.app.id);
|
|
8566
8843
|
// Support any language in `meta.i18n`.
|
|
8567
|
-
Object.entries(storyboard.meta.i18n).forEach(
|
|
8568
|
-
var [lang, resources] =
|
|
8844
|
+
Object.entries(storyboard.meta.i18n).forEach(_ref5 => {
|
|
8845
|
+
var [lang, resources] = _ref5;
|
|
8569
8846
|
i18next.addResourceBundle(lang, i18nNamespace, resources);
|
|
8570
8847
|
});
|
|
8571
8848
|
}
|
|
@@ -8987,8 +9264,8 @@ class Kernel {
|
|
|
8987
9264
|
});
|
|
8988
9265
|
});
|
|
8989
9266
|
if (!filterMenus.length) {
|
|
8990
|
-
var
|
|
8991
|
-
filterMenus = (
|
|
9267
|
+
var _ref6, _yield$InstanceApi_po;
|
|
9268
|
+
filterMenus = (_ref6 = (_yield$InstanceApi_po = yield InstanceApi_postSearch("STANDALONE_MENU@EASYOPS", {
|
|
8992
9269
|
page: 1,
|
|
8993
9270
|
page_size: 200,
|
|
8994
9271
|
fields: {
|
|
@@ -9017,7 +9294,7 @@ class Kernel {
|
|
|
9017
9294
|
$eq: true
|
|
9018
9295
|
}
|
|
9019
9296
|
}
|
|
9020
|
-
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null &&
|
|
9297
|
+
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null && _ref6 !== void 0 ? _ref6 : [];
|
|
9021
9298
|
}
|
|
9022
9299
|
return filterMenus;
|
|
9023
9300
|
})();
|
|
@@ -9060,15 +9337,15 @@ function _loadScriptOfDll() {
|
|
|
9060
9337
|
_loadScriptOfDll = _asyncToGenerator$3(function* (dlls) {
|
|
9061
9338
|
if (dlls.some(dll => dll.startsWith("dll-of-editor-bricks-helper."))) {
|
|
9062
9339
|
var dllPath = window.DLL_PATH || {};
|
|
9063
|
-
yield loadScript(dllPath["react-dnd"], window.CORE_ROOT);
|
|
9340
|
+
yield loadScript$1(dllPath["react-dnd"], window.CORE_ROOT);
|
|
9064
9341
|
}
|
|
9065
9342
|
// `loadScript` is auto cached, no need to filter out `react-dnd`.
|
|
9066
|
-
yield loadScript(dlls, window.CORE_ROOT);
|
|
9343
|
+
yield loadScript$1(dlls, window.CORE_ROOT);
|
|
9067
9344
|
});
|
|
9068
9345
|
return _loadScriptOfDll.apply(this, arguments);
|
|
9069
9346
|
}
|
|
9070
9347
|
function loadScriptOfBricksOrTemplates(src) {
|
|
9071
|
-
return loadScript(src, window.PUBLIC_ROOT);
|
|
9348
|
+
return loadScript$1(src, window.PUBLIC_ROOT);
|
|
9072
9349
|
}
|
|
9073
9350
|
function generateColorTheme(theme) {
|
|
9074
9351
|
if (!theme) {
|