@next-core/brick-kit 2.74.0 → 2.74.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.esm.js CHANGED
@@ -15,7 +15,6 @@ import moment from 'moment';
15
15
  import { pipes } from '@next-core/pipes';
16
16
  import yaml from 'js-yaml';
17
17
  import { apiAnalyzer } from '@next-core/easyops-analytics';
18
- import require$$0 from 'path';
19
18
  import { withTranslation } from 'react-i18next';
20
19
  import _extends$2 from '@babel/runtime/helpers/esm/extends';
21
20
  import { getIllustration } from '@next-core/illustrations';
@@ -3295,7 +3294,7 @@ var path = {
3295
3294
  };
3296
3295
 
3297
3296
  try {
3298
- path = require$$0;
3297
+ path = require('path');
3299
3298
  } catch (er) {}
3300
3299
 
3301
3300
  var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
@@ -5665,6 +5664,14 @@ class Kernel {
5665
5664
 
5666
5665
  _defineProperty$2(this, "loadingBar", void 0);
5667
5666
 
5667
+ _defineProperty$2(this, "navBar", void 0);
5668
+
5669
+ _defineProperty$2(this, "sideBar", void 0);
5670
+
5671
+ _defineProperty$2(this, "footer", void 0);
5672
+
5673
+ _defineProperty$2(this, "breadcrumb", void 0);
5674
+
5668
5675
  _defineProperty$2(this, "router", void 0);
5669
5676
 
5670
5677
  _defineProperty$2(this, "currentApp", void 0);
@@ -5679,6 +5686,8 @@ class Kernel {
5679
5686
 
5680
5687
  _defineProperty$2(this, "currentLayout", void 0);
5681
5688
 
5689
+ _defineProperty$2(this, "enableUiV8", false);
5690
+
5682
5691
  _defineProperty$2(this, "allUserMapPromise", Promise.resolve(new Map()));
5683
5692
 
5684
5693
  _defineProperty$2(this, "allMagicBrickConfigMapPromise", Promise.resolve(new Map()));
@@ -5707,13 +5716,20 @@ class Kernel {
5707
5716
  throw new Error("No storyboard were found.");
5708
5717
  }
5709
5718
 
5719
+ _this.setUiVersion();
5720
+
5710
5721
  if (isLoggedIn()) {
5711
5722
  _this.loadSharedData();
5712
5723
  }
5713
5724
 
5714
5725
  _this.menuBar = new MenuBar(_this, "menuBar");
5715
5726
  _this.appBar = new AppBar(_this, "appBar");
5716
- _this.loadingBar = new BaseBar(_this, "loadingBar");
5727
+ _this.loadingBar = new BaseBar(_this, "loadingBar"); // Todo(nlicro): 这里需要新写对应的NavBar...
5728
+
5729
+ _this.navBar = new BaseBar(_this, "navBar");
5730
+ _this.sideBar = new BaseBar(_this, "sideBar");
5731
+ _this.breadcrumb = new BaseBar(_this, "breadcrumb");
5732
+ _this.footer = new BaseBar(_this, "footer");
5717
5733
  _this.router = new Router(_this);
5718
5734
  yield _this.router.bootstrap();
5719
5735
 
@@ -5738,7 +5754,13 @@ class Kernel {
5738
5754
  loadingBar: "business-website.loading-bar",
5739
5755
  pageNotFound: "business-website.page-not-found",
5740
5756
  pageError: "business-website.page-error"
5741
- } : _objectSpread(_objectSpread({}, _this2.bootstrapData.navbar), {}, {
5757
+ } : _objectSpread(_objectSpread({}, _this2.enableUiV8 ? {
5758
+ loadingBar: _this2.bootstrapData.navbar.loadingBar,
5759
+ navBar: "frame-bricks.nav-bar",
5760
+ sideBar: "frame-bricks.side-bar",
5761
+ breadcrumb: null,
5762
+ footer: null
5763
+ } : _this2.bootstrapData.navbar), {}, {
5742
5764
  pageNotFound: "basic-bricks.page-not-found",
5743
5765
  pageError: "basic-bricks.page-error"
5744
5766
  });
@@ -5753,7 +5775,7 @@ class Kernel {
5753
5775
 
5754
5776
  yield Promise.all([_this2.menuBar.bootstrap(_this2.presetBricks.menuBar, {
5755
5777
  testid: "brick-next-menu-bar"
5756
- }), _this2.appBar.bootstrap(_this2.presetBricks.appBar), _this2.loadingBar.bootstrap(_this2.presetBricks.loadingBar)]);
5778
+ }), _this2.appBar.bootstrap(_this2.presetBricks.appBar), _this2.navBar.bootstrap(_this2.presetBricks.navBar), _this2.sideBar.bootstrap(_this2.presetBricks.sideBar), _this2.footer.bootstrap(_this2.presetBricks.footer), _this2.breadcrumb.bootstrap(_this2.presetBricks.breadcrumb), _this2.loadingBar.bootstrap(_this2.presetBricks.loadingBar)]);
5757
5779
  })();
5758
5780
  }
5759
5781
 
@@ -6271,6 +6293,16 @@ class Kernel {
6271
6293
  })();
6272
6294
  }
6273
6295
 
6296
+ setUiVersion() {
6297
+ // get from localStorage fot test
6298
+ // this.enableUiV8 = this.getFeatureFlags()["ui-v8"];
6299
+ this.enableUiV8 = !!localStorage.getItem("test-ui-v8");
6300
+
6301
+ if (this.enableUiV8) {
6302
+ document.documentElement.dataset.ui = "v8";
6303
+ }
6304
+ }
6305
+
6274
6306
  } // Since `@next-dll/editor-bricks-helper` depends on `@next-dll/react-dnd`,
6275
6307
  // always load react-dnd before loading editor-bricks-helper.
6276
6308
 
@@ -8528,7 +8560,10 @@ class Router {
8528
8560
  }; // Omit the "key" when checking whether locations are equal in certain situations.
8529
8561
 
8530
8562
  if ( // When current location is triggered by browser action of hash link.
8531
- location.key === undefined || action === "POP" && (_this.prevLocation.key === undefined || // or the previous location specified notify false.
8563
+ location.key === undefined || // When current location is triggered by browser action of non-push-or-replace,
8564
+ // such as goBack or goForward,
8565
+ action === "POP" && ( // and the previous location was triggered by hash link,
8566
+ _this.prevLocation.key === undefined || // or the previous location specified notify false.
8532
8567
  ((_this$prevLocation$st = _this.prevLocation.state) === null || _this$prevLocation$st === void 0 ? void 0 : _this$prevLocation$st.notify) === false)) {
8533
8568
  omittedLocationProps.key = null;
8534
8569
  }
@@ -8764,30 +8799,33 @@ class Router {
8764
8799
  if (barsHidden || getRuntimeMisc().isInIframeOfLegacyConsole) {
8765
8800
  _this3.kernel.toggleBars(false);
8766
8801
  } else if (_this3.kernel.currentLayout === "console") {
8767
- var _menuBar$menu, _menuBar$menu2;
8802
+ /* istanbul ignore next */
8803
+ if (!_this3.kernel.enableUiV8) {
8804
+ var _menuBar$menu, _menuBar$menu2;
8768
8805
 
8769
- yield constructMenu(menuBar, _this3.locationContext.getCurrentContext(), _this3.kernel);
8806
+ yield constructMenu(menuBar, _this3.locationContext.getCurrentContext(), _this3.kernel);
8770
8807
 
8771
- if (shouldBeDefaultCollapsed((_menuBar$menu = menuBar.menu) === null || _menuBar$menu === void 0 ? void 0 : _menuBar$menu.defaultCollapsed, (_menuBar$menu2 = menuBar.menu) === null || _menuBar$menu2 === void 0 ? void 0 : _menuBar$menu2.defaultCollapsedBreakpoint)) {
8772
- _this3.kernel.menuBar.collapse(true);
8808
+ if (shouldBeDefaultCollapsed((_menuBar$menu = menuBar.menu) === null || _menuBar$menu === void 0 ? void 0 : _menuBar$menu.defaultCollapsed, (_menuBar$menu2 = menuBar.menu) === null || _menuBar$menu2 === void 0 ? void 0 : _menuBar$menu2.defaultCollapsedBreakpoint)) {
8809
+ _this3.kernel.menuBar.collapse(true);
8773
8810
 
8774
- _this3.defaultCollapsed = true;
8775
- } else {
8776
- if (_this3.defaultCollapsed) {
8777
- _this3.kernel.menuBar.collapse(false);
8811
+ _this3.defaultCollapsed = true;
8812
+ } else {
8813
+ if (_this3.defaultCollapsed) {
8814
+ _this3.kernel.menuBar.collapse(false);
8815
+ }
8816
+
8817
+ _this3.defaultCollapsed = false;
8778
8818
  }
8779
8819
 
8780
- _this3.defaultCollapsed = false;
8781
- }
8820
+ if (actualLegacy === "iframe") {
8821
+ // Do not modify breadcrumb in iframe mode,
8822
+ // it will be *popped* from iframe automatically.
8823
+ delete appBar.breadcrumb;
8824
+ }
8782
8825
 
8783
- if (actualLegacy === "iframe") {
8784
- // Do not modify breadcrumb in iframe mode,
8785
- // it will be *popped* from iframe automatically.
8786
- delete appBar.breadcrumb;
8826
+ mountStaticNode(_this3.kernel.menuBar.element, menuBar);
8827
+ mountStaticNode(_this3.kernel.appBar.element, appBar);
8787
8828
  }
8788
-
8789
- mountStaticNode(_this3.kernel.menuBar.element, menuBar);
8790
- mountStaticNode(_this3.kernel.appBar.element, appBar);
8791
8829
  }
8792
8830
 
8793
8831
  _this3.kernel.toggleLegacyIframe(actualLegacy === "iframe");