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