@next-core/brick-kit 2.133.1 → 2.134.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/CHANGELOG.md CHANGED
@@ -3,6 +3,47 @@
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.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.134.0...@next-core/brick-kit@2.134.1) (2022-08-31)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * remove dead code ([61db875](https://github.com/easyops-cn/next-core/commit/61db8759d48e0de3a31c55bf2ced50cf8617a5a2))
12
+
13
+
14
+
15
+
16
+
17
+ # [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * support visual builder favicon ([af61b02](https://github.com/easyops-cn/next-core/commit/af61b02f8d8d507a68525264bc1348a6416d4cf8))
23
+ * update code ([5497f33](https://github.com/easyops-cn/next-core/commit/5497f33d6b3a23831ebe24e8decb3f207d431c96))
24
+ * update code ([2578ef5](https://github.com/easyops-cn/next-core/commit/2578ef5e313e928ba13bbc237822274910e1513b))
25
+ * update get image type ([d151d3c](https://github.com/easyops-cn/next-core/commit/d151d3ce0ddd1211e6156f2646b96533969b3e35))
26
+
27
+
28
+
29
+
30
+
31
+ ## [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)
32
+
33
+ **Note:** Version bump only for package @next-core/brick-kit
34
+
35
+
36
+
37
+
38
+
39
+ ## [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)
40
+
41
+ **Note:** Version bump only for package @next-core/brick-kit
42
+
43
+
44
+
45
+
46
+
6
47
  ## [2.133.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.133.0...@next-core/brick-kit@2.133.1) (2022-08-26)
7
48
 
8
49
  **Note:** Version bump only for package @next-core/brick-kit
@@ -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
- return kernel.getRelatedAppsAsync(appId);
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,19 +8832,15 @@
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
 
8868
- _defineProperty__default["default"](this, "allRelatedAppsPromise", Promise.resolve([]));
8843
+ _defineProperty__default["default"](this, "originFaviconHref", void 0);
8869
8844
 
8870
8845
  _defineProperty__default["default"](this, "allMicroAppApiOrchestrationPromise", Promise.resolve(new Map()));
8871
8846
 
@@ -8955,7 +8930,7 @@
8955
8930
  var _this2 = this;
8956
8931
 
8957
8932
  return _asyncToGenerator__default["default"](function* () {
8958
- var _this2$bootstrapData$, _this2$bootstrapData$2;
8933
+ var _this2$bootstrapData$, _this2$bootstrapData$2, _document$querySelect;
8959
8934
 
8960
8935
  listenDevtoolsEagerly();
8961
8936
  _this2.mountPoints = mountPoints;
@@ -8971,16 +8946,12 @@
8971
8946
  }
8972
8947
 
8973
8948
  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
8949
  _this2.menuBar = new MenuBar(_this2, "menuBar");
8980
8950
  _this2.appBar = new AppBar(_this2, "appBar");
8981
8951
  _this2.loadingBar = new BaseBar(_this2, "loadingBar");
8982
8952
  _this2.router = new Router(_this2);
8983
8953
  initAnalytics();
8954
+ _this2.originFaviconHref = (_document$querySelect = document.querySelector("link[rel='shortcut icon']")) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.href;
8984
8955
  yield _this2.router.bootstrap();
8985
8956
 
8986
8957
  if (!window.STANDALONE_MICRO_APPS) {
@@ -9499,12 +9470,6 @@
9499
9470
  document.body.classList.toggle("show-legacy-iframe", visible);
9500
9471
  }
9501
9472
 
9502
- loadSharedData() {
9503
- if (!window.STANDALONE_MICRO_APPS) {
9504
- this.loadRelatedAppsAsync();
9505
- }
9506
- }
9507
-
9508
9473
  loadUsersAsync() {
9509
9474
  if (!this.loadUsersStarted) {
9510
9475
  this.loadUsersStarted = true;
@@ -9625,95 +9590,10 @@
9625
9590
  })();
9626
9591
  }
9627
9592
 
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
9593
  getRecentApps() {
9713
9594
  return {
9714
9595
  previousApp: this.previousApp,
9715
- currentApp: this.currentApp,
9716
- previousWorkspace: this.getPreviousWorkspace()
9596
+ currentApp: this.currentApp
9717
9597
  };
9718
9598
  }
9719
9599
 
@@ -9741,23 +9621,27 @@
9741
9621
  });
9742
9622
  }
9743
9623
 
9624
+ getOriginFaviconHref() {
9625
+ return this.originFaviconHref;
9626
+ }
9627
+
9744
9628
  getProviderBrick(provider) {
9745
- var _this13 = this;
9629
+ var _this11 = this;
9746
9630
 
9747
9631
  return _asyncToGenerator__default["default"](function* () {
9748
9632
  if (isCustomApiProvider(provider)) {
9749
9633
  provider = CUSTOM_API_PROVIDER;
9750
9634
  }
9751
9635
 
9752
- if (_this13.providerRepository.has(provider)) {
9753
- return _this13.providerRepository.get(provider);
9636
+ if (_this11.providerRepository.has(provider)) {
9637
+ return _this11.providerRepository.get(provider);
9754
9638
  }
9755
9639
 
9756
9640
  if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
9757
9641
  registerCustomApi();
9758
9642
  }
9759
9643
 
9760
- yield _this13.loadDynamicBricks([provider]);
9644
+ yield _this11.loadDynamicBricks([provider]);
9761
9645
 
9762
9646
  if (!customElements.get(provider)) {
9763
9647
  throw new Error("Provider not defined: \"".concat(provider, "\"."));
@@ -9765,7 +9649,7 @@
9765
9649
 
9766
9650
  var brick = document.createElement(provider);
9767
9651
 
9768
- _this13.providerRepository.set(provider, brick);
9652
+ _this11.providerRepository.set(provider, brick);
9769
9653
 
9770
9654
  return brick;
9771
9655
  })();
@@ -11936,7 +11820,7 @@
11936
11820
  var _this3 = this;
11937
11821
 
11938
11822
  return _asyncToGenerator__default["default"](function* () {
11939
- var _apiAnalyzer$getInsta, _getLocalAppsTheme;
11823
+ var _apiAnalyzer$getInsta, _currentApp$config, _currentApp$config$_e, _getLocalAppsTheme;
11940
11824
 
11941
11825
  _this3.state = "initial";
11942
11826
  _this3.renderId = _.uniqueId("render-id-");
@@ -11996,6 +11880,17 @@
11996
11880
  var legacy = currentApp ? currentApp.legacy : undefined;
11997
11881
  _this3.kernel.nextApp = currentApp;
11998
11882
  var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
11883
+ var faviconElement = document.querySelector("link[rel='shortcut icon']");
11884
+ 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;
11885
+
11886
+ if (faviconElement) {
11887
+ if (customFaviconHref) {
11888
+ faviconElement.href = /^(?:https?|data):|^\//.test(customFaviconHref) ? customFaviconHref : imagesFactory(currentApp.id, currentApp.isBuildPush).get(customFaviconHref);
11889
+ } else {
11890
+ faviconElement.href = _this3.kernel.getOriginFaviconHref();
11891
+ }
11892
+ }
11893
+
11999
11894
  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
11895
  setMode("default");
12001
11896
  devtoolsHookEmit("rendering");
@@ -12100,9 +11995,8 @@
12100
11995
  _this3.kernel.previousApp = previousApp;
12101
11996
  }
12102
11997
 
12103
- _this3.kernel.currentUrl = history$1.createPath(location);
12104
11998
  _this3.kernel.currentRoute = route;
12105
- yield Promise.all([...(window.STANDALONE_MICRO_APPS ? [] : [_this3.kernel.updateWorkspaceStack()]), _this3.kernel.layoutBootstrap(layoutType)]);
11999
+ yield _this3.kernel.layoutBootstrap(layoutType);
12106
12000
  _this3.state = "ready-to-mount"; // Unmount main tree to avoid app change fired before new routes mounted.
12107
12001
 
12108
12002
  unmountTree(mountPoints.main);