@next-core/brick-kit 2.133.2 → 2.134.2
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/CHANGELOG.md +41 -0
- package/dist/index.bundle.js +32 -138
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +33 -139
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts +3 -11
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/Runtime.d.ts +3 -3
- package/dist/types/core/Runtime.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +0 -11
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parsePath, createBrowserHistory, locationsAreEqual
|
|
1
|
+
import { parsePath, createBrowserHistory, locationsAreEqual } from 'history';
|
|
2
2
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
|
|
@@ -1353,24 +1353,6 @@ var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
|
|
|
1353
1353
|
return _ref.apply(this, arguments);
|
|
1354
1354
|
};
|
|
1355
1355
|
}();
|
|
1356
|
-
/**
|
|
1357
|
-
* @description 查询模型关联小产品列表
|
|
1358
|
-
* @endpoint LIST /api/micro_app/v1/object_micro_app
|
|
1359
|
-
*/
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
var ObjectMicroAppApi_getObjectMicroAppList = /*#__PURE__*/function () {
|
|
1363
|
-
var _ref = _asyncToGenerator$3(function* (options) {
|
|
1364
|
-
return (
|
|
1365
|
-
/**! @contract easyops.api.micro_app.object_micro_app.GetObjectMicroAppList@1.0.0 */
|
|
1366
|
-
(yield http.get("api/gateway/micro_app.object_micro_app.GetObjectMicroAppList/api/micro_app/v1/object_micro_app", options)).data
|
|
1367
|
-
);
|
|
1368
|
-
});
|
|
1369
|
-
|
|
1370
|
-
return function ObjectMicroAppApi_getObjectMicroAppList(_x) {
|
|
1371
|
-
return _ref.apply(this, arguments);
|
|
1372
|
-
};
|
|
1373
|
-
}();
|
|
1374
1356
|
/**
|
|
1375
1357
|
* @description 校验系统权限
|
|
1376
1358
|
* @endpoint POST /api/micro_app/v1/permission/validate
|
|
@@ -3667,8 +3649,7 @@ class Runtime {
|
|
|
3667
3649
|
/* istanbul ignore next */
|
|
3668
3650
|
|
|
3669
3651
|
|
|
3670
|
-
reloadSharedData() {
|
|
3671
|
-
return kernel.loadSharedData();
|
|
3652
|
+
reloadSharedData() {// Drop supports for related apps;
|
|
3672
3653
|
}
|
|
3673
3654
|
/* istanbul ignore next */
|
|
3674
3655
|
|
|
@@ -3770,27 +3751,25 @@ class Runtime {
|
|
|
3770
3751
|
|
|
3771
3752
|
/* istanbul ignore next */
|
|
3772
3753
|
getRelatedApps(appId) {
|
|
3773
|
-
// eslint-disable-next-line no-console
|
|
3774
|
-
console.warn("`getRuntime().getRelatedApps()` is deprecated and will always return an empty array, please use `await getRuntime().getRelatedAppsAsync()` instead");
|
|
3775
3754
|
return [];
|
|
3776
3755
|
}
|
|
3777
3756
|
/* istanbul ignore next */
|
|
3778
3757
|
|
|
3779
3758
|
|
|
3780
3759
|
getRelatedAppsAsync(appId) {
|
|
3781
|
-
|
|
3760
|
+
// eslint-disable-next-line no-console
|
|
3761
|
+
console.warn("`getRuntime().getRelatedAppsAsync()` is deprecated and will always resolve with an empty array");
|
|
3762
|
+
return Promise.resolve([]);
|
|
3782
3763
|
}
|
|
3783
3764
|
/* istanbul ignore next */
|
|
3784
3765
|
|
|
3785
3766
|
|
|
3786
|
-
popWorkspaceStack() {
|
|
3787
|
-
return kernel.popWorkspaceStack();
|
|
3767
|
+
popWorkspaceStack() {// deprecated
|
|
3788
3768
|
}
|
|
3789
3769
|
/* istanbul ignore next */
|
|
3790
3770
|
|
|
3791
3771
|
|
|
3792
|
-
resetWorkspaceStack() {
|
|
3793
|
-
kernel.workspaceStack = [];
|
|
3772
|
+
resetWorkspaceStack() {// deprecated
|
|
3794
3773
|
}
|
|
3795
3774
|
|
|
3796
3775
|
applyPageTitle(pageTitle) {
|
|
@@ -8854,19 +8833,15 @@ class Kernel {
|
|
|
8854
8833
|
|
|
8855
8834
|
_defineProperty$1(this, "nextApp", void 0);
|
|
8856
8835
|
|
|
8857
|
-
_defineProperty$1(this, "currentUrl", void 0);
|
|
8858
|
-
|
|
8859
8836
|
_defineProperty$1(this, "currentRoute", void 0);
|
|
8860
8837
|
|
|
8861
|
-
_defineProperty$1(this, "workspaceStack", []);
|
|
8862
|
-
|
|
8863
8838
|
_defineProperty$1(this, "currentLayout", void 0);
|
|
8864
8839
|
|
|
8865
8840
|
_defineProperty$1(this, "allUserMapPromise", Promise.resolve(new Map()));
|
|
8866
8841
|
|
|
8867
8842
|
_defineProperty$1(this, "allMagicBrickConfigMapPromise", Promise.resolve(new Map()));
|
|
8868
8843
|
|
|
8869
|
-
_defineProperty$1(this, "
|
|
8844
|
+
_defineProperty$1(this, "originFaviconHref", void 0);
|
|
8870
8845
|
|
|
8871
8846
|
_defineProperty$1(this, "allMicroAppApiOrchestrationPromise", Promise.resolve(new Map()));
|
|
8872
8847
|
|
|
@@ -8956,7 +8931,7 @@ class Kernel {
|
|
|
8956
8931
|
var _this2 = this;
|
|
8957
8932
|
|
|
8958
8933
|
return _asyncToGenerator$3(function* () {
|
|
8959
|
-
var _this2$bootstrapData$, _this2$bootstrapData$2;
|
|
8934
|
+
var _this2$bootstrapData$, _this2$bootstrapData$2, _document$querySelect;
|
|
8960
8935
|
|
|
8961
8936
|
listenDevtoolsEagerly();
|
|
8962
8937
|
_this2.mountPoints = mountPoints;
|
|
@@ -8972,16 +8947,12 @@ class Kernel {
|
|
|
8972
8947
|
}
|
|
8973
8948
|
|
|
8974
8949
|
generateColorTheme((_this2$bootstrapData$ = _this2.bootstrapData.settings) === null || _this2$bootstrapData$ === void 0 ? void 0 : (_this2$bootstrapData$2 = _this2$bootstrapData$.misc) === null || _this2$bootstrapData$2 === void 0 ? void 0 : _this2$bootstrapData$2.theme);
|
|
8975
|
-
|
|
8976
|
-
if (isLoggedIn()) {
|
|
8977
|
-
_this2.loadSharedData();
|
|
8978
|
-
}
|
|
8979
|
-
|
|
8980
8950
|
_this2.menuBar = new MenuBar(_this2, "menuBar");
|
|
8981
8951
|
_this2.appBar = new AppBar(_this2, "appBar");
|
|
8982
8952
|
_this2.loadingBar = new BaseBar(_this2, "loadingBar");
|
|
8983
8953
|
_this2.router = new Router(_this2);
|
|
8984
8954
|
initAnalytics();
|
|
8955
|
+
_this2.originFaviconHref = (_document$querySelect = document.querySelector("link[rel='shortcut icon']")) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.href;
|
|
8985
8956
|
yield _this2.router.bootstrap();
|
|
8986
8957
|
|
|
8987
8958
|
if (!window.STANDALONE_MICRO_APPS) {
|
|
@@ -9500,12 +9471,6 @@ class Kernel {
|
|
|
9500
9471
|
document.body.classList.toggle("show-legacy-iframe", visible);
|
|
9501
9472
|
}
|
|
9502
9473
|
|
|
9503
|
-
loadSharedData() {
|
|
9504
|
-
if (!window.STANDALONE_MICRO_APPS) {
|
|
9505
|
-
this.loadRelatedAppsAsync();
|
|
9506
|
-
}
|
|
9507
|
-
}
|
|
9508
|
-
|
|
9509
9474
|
loadUsersAsync() {
|
|
9510
9475
|
if (!this.loadUsersStarted) {
|
|
9511
9476
|
this.loadUsersStarted = true;
|
|
@@ -9626,95 +9591,10 @@ class Kernel {
|
|
|
9626
9591
|
})();
|
|
9627
9592
|
}
|
|
9628
9593
|
|
|
9629
|
-
loadRelatedAppsAsync() {
|
|
9630
|
-
this.allRelatedAppsPromise = this.loadRelatedApps();
|
|
9631
|
-
}
|
|
9632
|
-
|
|
9633
|
-
loadRelatedApps() {
|
|
9634
|
-
return _asyncToGenerator$3(function* () {
|
|
9635
|
-
var relatedApps = [];
|
|
9636
|
-
|
|
9637
|
-
try {
|
|
9638
|
-
relatedApps = (yield ObjectMicroAppApi_getObjectMicroAppList()).list;
|
|
9639
|
-
} catch (error) {
|
|
9640
|
-
// eslint-disable-next-line no-console
|
|
9641
|
-
console.warn("Load related apps error:", error);
|
|
9642
|
-
}
|
|
9643
|
-
|
|
9644
|
-
return relatedApps;
|
|
9645
|
-
})();
|
|
9646
|
-
}
|
|
9647
|
-
|
|
9648
|
-
getRelatedAppsAsync(appId) {
|
|
9649
|
-
var _this11 = this;
|
|
9650
|
-
|
|
9651
|
-
return _asyncToGenerator$3(function* () {
|
|
9652
|
-
if (!appId) {
|
|
9653
|
-
return [];
|
|
9654
|
-
}
|
|
9655
|
-
|
|
9656
|
-
var allRelatedApps = yield _this11.allRelatedAppsPromise;
|
|
9657
|
-
var thisApp = allRelatedApps.find(item => item.microAppId === appId);
|
|
9658
|
-
|
|
9659
|
-
if (!thisApp) {
|
|
9660
|
-
return [];
|
|
9661
|
-
}
|
|
9662
|
-
|
|
9663
|
-
return sortBy(allRelatedApps.filter(item => item.objectId === thisApp.objectId), ["order"]);
|
|
9664
|
-
})();
|
|
9665
|
-
}
|
|
9666
|
-
|
|
9667
|
-
updateWorkspaceStack() {
|
|
9668
|
-
var _this12 = this;
|
|
9669
|
-
|
|
9670
|
-
return _asyncToGenerator$3(function* () {
|
|
9671
|
-
if (_this12.currentApp && _this12.currentApp.id) {
|
|
9672
|
-
var workspace = {
|
|
9673
|
-
appId: _this12.currentApp.id,
|
|
9674
|
-
appName: _this12.currentApp.name,
|
|
9675
|
-
appLocaleName: _this12.currentApp.localeName,
|
|
9676
|
-
url: _this12.currentUrl
|
|
9677
|
-
};
|
|
9678
|
-
|
|
9679
|
-
if (_this12.workspaceStack.length > 0) {
|
|
9680
|
-
var previousWorkspace = _this12.workspaceStack[_this12.workspaceStack.length - 1];
|
|
9681
|
-
|
|
9682
|
-
var _relatedApps = yield _this12.getRelatedAppsAsync(previousWorkspace.appId);
|
|
9683
|
-
|
|
9684
|
-
if (_relatedApps.some(item => item.microAppId === _this12.currentApp.id)) {
|
|
9685
|
-
Object.assign(previousWorkspace, workspace);
|
|
9686
|
-
return;
|
|
9687
|
-
}
|
|
9688
|
-
}
|
|
9689
|
-
|
|
9690
|
-
var relatedApps = yield _this12.getRelatedAppsAsync(_this12.currentApp.id);
|
|
9691
|
-
|
|
9692
|
-
if (relatedApps.length > 0) {
|
|
9693
|
-
_this12.workspaceStack.push(workspace);
|
|
9694
|
-
|
|
9695
|
-
return;
|
|
9696
|
-
}
|
|
9697
|
-
}
|
|
9698
|
-
|
|
9699
|
-
_this12.workspaceStack = [];
|
|
9700
|
-
})();
|
|
9701
|
-
}
|
|
9702
|
-
|
|
9703
|
-
getPreviousWorkspace() {
|
|
9704
|
-
if (this.workspaceStack.length > 1) {
|
|
9705
|
-
return this.workspaceStack[this.workspaceStack.length - 2];
|
|
9706
|
-
}
|
|
9707
|
-
}
|
|
9708
|
-
|
|
9709
|
-
popWorkspaceStack() {
|
|
9710
|
-
this.workspaceStack.pop();
|
|
9711
|
-
}
|
|
9712
|
-
|
|
9713
9594
|
getRecentApps() {
|
|
9714
9595
|
return {
|
|
9715
9596
|
previousApp: this.previousApp,
|
|
9716
|
-
currentApp: this.currentApp
|
|
9717
|
-
previousWorkspace: this.getPreviousWorkspace()
|
|
9597
|
+
currentApp: this.currentApp
|
|
9718
9598
|
};
|
|
9719
9599
|
}
|
|
9720
9600
|
|
|
@@ -9742,23 +9622,27 @@ class Kernel {
|
|
|
9742
9622
|
});
|
|
9743
9623
|
}
|
|
9744
9624
|
|
|
9625
|
+
getOriginFaviconHref() {
|
|
9626
|
+
return this.originFaviconHref;
|
|
9627
|
+
}
|
|
9628
|
+
|
|
9745
9629
|
getProviderBrick(provider) {
|
|
9746
|
-
var
|
|
9630
|
+
var _this11 = this;
|
|
9747
9631
|
|
|
9748
9632
|
return _asyncToGenerator$3(function* () {
|
|
9749
9633
|
if (isCustomApiProvider(provider)) {
|
|
9750
9634
|
provider = CUSTOM_API_PROVIDER;
|
|
9751
9635
|
}
|
|
9752
9636
|
|
|
9753
|
-
if (
|
|
9754
|
-
return
|
|
9637
|
+
if (_this11.providerRepository.has(provider)) {
|
|
9638
|
+
return _this11.providerRepository.get(provider);
|
|
9755
9639
|
}
|
|
9756
9640
|
|
|
9757
9641
|
if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
|
|
9758
9642
|
registerCustomApi();
|
|
9759
9643
|
}
|
|
9760
9644
|
|
|
9761
|
-
yield
|
|
9645
|
+
yield _this11.loadDynamicBricks([provider]);
|
|
9762
9646
|
|
|
9763
9647
|
if (!customElements.get(provider)) {
|
|
9764
9648
|
throw new Error("Provider not defined: \"".concat(provider, "\"."));
|
|
@@ -9766,7 +9650,7 @@ class Kernel {
|
|
|
9766
9650
|
|
|
9767
9651
|
var brick = document.createElement(provider);
|
|
9768
9652
|
|
|
9769
|
-
|
|
9653
|
+
_this11.providerRepository.set(provider, brick);
|
|
9770
9654
|
|
|
9771
9655
|
return brick;
|
|
9772
9656
|
})();
|
|
@@ -11937,7 +11821,7 @@ class Router {
|
|
|
11937
11821
|
var _this3 = this;
|
|
11938
11822
|
|
|
11939
11823
|
return _asyncToGenerator$3(function* () {
|
|
11940
|
-
var _apiAnalyzer$getInsta, _getLocalAppsTheme;
|
|
11824
|
+
var _apiAnalyzer$getInsta, _currentApp$config, _currentApp$config$_e, _getLocalAppsTheme;
|
|
11941
11825
|
|
|
11942
11826
|
_this3.state = "initial";
|
|
11943
11827
|
_this3.renderId = uniqueId("render-id-");
|
|
@@ -11997,6 +11881,17 @@ class Router {
|
|
|
11997
11881
|
var legacy = currentApp ? currentApp.legacy : undefined;
|
|
11998
11882
|
_this3.kernel.nextApp = currentApp;
|
|
11999
11883
|
var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
|
|
11884
|
+
var faviconElement = document.querySelector("link[rel='shortcut icon']");
|
|
11885
|
+
var customFaviconHref = currentApp === null || currentApp === void 0 ? void 0 : (_currentApp$config = currentApp.config) === null || _currentApp$config === void 0 ? void 0 : (_currentApp$config$_e = _currentApp$config._easyops_app_favicon) === null || _currentApp$config$_e === void 0 ? void 0 : _currentApp$config$_e.default;
|
|
11886
|
+
|
|
11887
|
+
if (faviconElement) {
|
|
11888
|
+
if (customFaviconHref) {
|
|
11889
|
+
faviconElement.href = /^(?:https?|data):|^\//.test(customFaviconHref) ? customFaviconHref : imagesFactory(currentApp.id, currentApp.isBuildPush).get(customFaviconHref);
|
|
11890
|
+
} else {
|
|
11891
|
+
faviconElement.href = _this3.kernel.getOriginFaviconHref();
|
|
11892
|
+
}
|
|
11893
|
+
}
|
|
11894
|
+
|
|
12000
11895
|
setTheme(((_getLocalAppsTheme = getLocalAppsTheme()) === null || _getLocalAppsTheme === void 0 ? void 0 : _getLocalAppsTheme[currentApp === null || currentApp === void 0 ? void 0 : currentApp.id]) || (currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
|
|
12001
11896
|
setMode("default");
|
|
12002
11897
|
devtoolsHookEmit("rendering");
|
|
@@ -12101,9 +11996,8 @@ class Router {
|
|
|
12101
11996
|
_this3.kernel.previousApp = previousApp;
|
|
12102
11997
|
}
|
|
12103
11998
|
|
|
12104
|
-
_this3.kernel.currentUrl = createPath(location);
|
|
12105
11999
|
_this3.kernel.currentRoute = route;
|
|
12106
|
-
yield
|
|
12000
|
+
yield _this3.kernel.layoutBootstrap(layoutType);
|
|
12107
12001
|
_this3.state = "ready-to-mount"; // Unmount main tree to avoid app change fired before new routes mounted.
|
|
12108
12002
|
|
|
12109
12003
|
unmountTree(mountPoints.main);
|