@next-core/brick-kit 2.73.2 → 2.75.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 +32 -68
- package/dist/index.bundle.js +375 -328
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +78 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/types/BrickAsComponent.d.ts.map +1 -1
- package/dist/types/checkIf.d.ts +1 -0
- package/dist/types/checkIf.d.ts.map +1 -1
- package/dist/types/core/Kernel.d.ts +6 -0
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/LocationContext.d.ts +2 -2
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/internal/menu.d.ts.map +1 -1
- package/package.json +11 -11
package/dist/index.esm.js
CHANGED
|
@@ -10,12 +10,11 @@ import React__default, { useState, useEffect, forwardRef, useRef, useImperativeH
|
|
|
10
10
|
import { HttpResponseError, HttpFetchError, http } from '@next-core/brick-http';
|
|
11
11
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
12
12
|
import i18next from 'i18next';
|
|
13
|
-
import lodash, { set, get, sortBy, isEmpty, difference, cloneDeep, merge, clamp, uniqueId, orderBy, omit } from 'lodash';
|
|
13
|
+
import lodash, { set, get, isNil, sortBy, isEmpty, difference, cloneDeep, merge, clamp, uniqueId, orderBy, omit } from 'lodash';
|
|
14
14
|
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';
|
|
@@ -1349,7 +1348,16 @@ function _constructMenu() {
|
|
|
1349
1348
|
var hasSubMenu = !!menuBar.subMenuId;
|
|
1350
1349
|
|
|
1351
1350
|
if (menuBar.menuId) {
|
|
1352
|
-
|
|
1351
|
+
var _menuBar$menu;
|
|
1352
|
+
|
|
1353
|
+
var defaultCollapsed = (_menuBar$menu = menuBar.menu) === null || _menuBar$menu === void 0 ? void 0 : _menuBar$menu.defaultCollapsed;
|
|
1354
|
+
var menu = yield processMenu(menuBar.menuId, context, kernel, hasSubMenu);
|
|
1355
|
+
|
|
1356
|
+
if (!isNil(defaultCollapsed)) {
|
|
1357
|
+
menu.defaultCollapsed = defaultCollapsed;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
menuBar.menu = menu;
|
|
1353
1361
|
}
|
|
1354
1362
|
|
|
1355
1363
|
if (hasSubMenu) {
|
|
@@ -3286,7 +3294,7 @@ var path = {
|
|
|
3286
3294
|
};
|
|
3287
3295
|
|
|
3288
3296
|
try {
|
|
3289
|
-
path = require
|
|
3297
|
+
path = require('path');
|
|
3290
3298
|
} catch (er) {}
|
|
3291
3299
|
|
|
3292
3300
|
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
|
@@ -5044,8 +5052,8 @@ function builtinWindowListenerFactory(args, ifContainer, context) {
|
|
|
5044
5052
|
return;
|
|
5045
5053
|
}
|
|
5046
5054
|
|
|
5047
|
-
var [url, target] = argsFactory(args, context, event);
|
|
5048
|
-
window.open(url, target || "_self");
|
|
5055
|
+
var [url, target, features] = argsFactory(args, context, event);
|
|
5056
|
+
window.open(url, target || "_self", features);
|
|
5049
5057
|
};
|
|
5050
5058
|
}
|
|
5051
5059
|
|
|
@@ -5656,6 +5664,14 @@ class Kernel {
|
|
|
5656
5664
|
|
|
5657
5665
|
_defineProperty$2(this, "loadingBar", void 0);
|
|
5658
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
|
+
|
|
5659
5675
|
_defineProperty$2(this, "router", void 0);
|
|
5660
5676
|
|
|
5661
5677
|
_defineProperty$2(this, "currentApp", void 0);
|
|
@@ -5670,6 +5686,8 @@ class Kernel {
|
|
|
5670
5686
|
|
|
5671
5687
|
_defineProperty$2(this, "currentLayout", void 0);
|
|
5672
5688
|
|
|
5689
|
+
_defineProperty$2(this, "enableUiV8", false);
|
|
5690
|
+
|
|
5673
5691
|
_defineProperty$2(this, "allUserMapPromise", Promise.resolve(new Map()));
|
|
5674
5692
|
|
|
5675
5693
|
_defineProperty$2(this, "allMagicBrickConfigMapPromise", Promise.resolve(new Map()));
|
|
@@ -5698,13 +5716,20 @@ class Kernel {
|
|
|
5698
5716
|
throw new Error("No storyboard were found.");
|
|
5699
5717
|
}
|
|
5700
5718
|
|
|
5719
|
+
_this.setUiVersion();
|
|
5720
|
+
|
|
5701
5721
|
if (isLoggedIn()) {
|
|
5702
5722
|
_this.loadSharedData();
|
|
5703
5723
|
}
|
|
5704
5724
|
|
|
5705
5725
|
_this.menuBar = new MenuBar(_this, "menuBar");
|
|
5706
5726
|
_this.appBar = new AppBar(_this, "appBar");
|
|
5707
|
-
_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");
|
|
5708
5733
|
_this.router = new Router(_this);
|
|
5709
5734
|
yield _this.router.bootstrap();
|
|
5710
5735
|
|
|
@@ -5729,7 +5754,13 @@ class Kernel {
|
|
|
5729
5754
|
loadingBar: "business-website.loading-bar",
|
|
5730
5755
|
pageNotFound: "business-website.page-not-found",
|
|
5731
5756
|
pageError: "business-website.page-error"
|
|
5732
|
-
} : _objectSpread(_objectSpread({}, _this2.
|
|
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), {}, {
|
|
5733
5764
|
pageNotFound: "basic-bricks.page-not-found",
|
|
5734
5765
|
pageError: "basic-bricks.page-error"
|
|
5735
5766
|
});
|
|
@@ -5744,7 +5775,7 @@ class Kernel {
|
|
|
5744
5775
|
|
|
5745
5776
|
yield Promise.all([_this2.menuBar.bootstrap(_this2.presetBricks.menuBar, {
|
|
5746
5777
|
testid: "brick-next-menu-bar"
|
|
5747
|
-
}), _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)]);
|
|
5748
5779
|
})();
|
|
5749
5780
|
}
|
|
5750
5781
|
|
|
@@ -6262,6 +6293,16 @@ class Kernel {
|
|
|
6262
6293
|
})();
|
|
6263
6294
|
}
|
|
6264
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
|
+
|
|
6265
6306
|
} // Since `@next-dll/editor-bricks-helper` depends on `@next-dll/react-dnd`,
|
|
6266
6307
|
// always load react-dnd before loading editor-bricks-helper.
|
|
6267
6308
|
|
|
@@ -7552,7 +7593,7 @@ class LocationContext {
|
|
|
7552
7593
|
|
|
7553
7594
|
if (menuId) {
|
|
7554
7595
|
mountRoutesResult.menuBar.menuId = menuId;
|
|
7555
|
-
mountRoutesResult.menuBar.menu =
|
|
7596
|
+
mountRoutesResult.menuBar.menu = sidebarMenu;
|
|
7556
7597
|
} else if (sidebarMenu) {
|
|
7557
7598
|
mountRoutesResult.menuBar.menu = sidebarMenu;
|
|
7558
7599
|
mountRoutesResult.menuBar.menuId = null;
|
|
@@ -8519,7 +8560,10 @@ class Router {
|
|
|
8519
8560
|
}; // Omit the "key" when checking whether locations are equal in certain situations.
|
|
8520
8561
|
|
|
8521
8562
|
if ( // When current location is triggered by browser action of hash link.
|
|
8522
|
-
location.key === undefined ||
|
|
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.
|
|
8523
8567
|
((_this$prevLocation$st = _this.prevLocation.state) === null || _this$prevLocation$st === void 0 ? void 0 : _this$prevLocation$st.notify) === false)) {
|
|
8524
8568
|
omittedLocationProps.key = null;
|
|
8525
8569
|
}
|
|
@@ -8755,30 +8799,33 @@ class Router {
|
|
|
8755
8799
|
if (barsHidden || getRuntimeMisc().isInIframeOfLegacyConsole) {
|
|
8756
8800
|
_this3.kernel.toggleBars(false);
|
|
8757
8801
|
} else if (_this3.kernel.currentLayout === "console") {
|
|
8758
|
-
|
|
8802
|
+
/* istanbul ignore next */
|
|
8803
|
+
if (!_this3.kernel.enableUiV8) {
|
|
8804
|
+
var _menuBar$menu, _menuBar$menu2;
|
|
8759
8805
|
|
|
8760
|
-
|
|
8806
|
+
yield constructMenu(menuBar, _this3.locationContext.getCurrentContext(), _this3.kernel);
|
|
8761
8807
|
|
|
8762
|
-
|
|
8763
|
-
|
|
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);
|
|
8764
8810
|
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8811
|
+
_this3.defaultCollapsed = true;
|
|
8812
|
+
} else {
|
|
8813
|
+
if (_this3.defaultCollapsed) {
|
|
8814
|
+
_this3.kernel.menuBar.collapse(false);
|
|
8815
|
+
}
|
|
8816
|
+
|
|
8817
|
+
_this3.defaultCollapsed = false;
|
|
8769
8818
|
}
|
|
8770
8819
|
|
|
8771
|
-
|
|
8772
|
-
|
|
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
|
+
}
|
|
8773
8825
|
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
// it will be *popped* from iframe automatically.
|
|
8777
|
-
delete appBar.breadcrumb;
|
|
8826
|
+
mountStaticNode(_this3.kernel.menuBar.element, menuBar);
|
|
8827
|
+
mountStaticNode(_this3.kernel.appBar.element, appBar);
|
|
8778
8828
|
}
|
|
8779
|
-
|
|
8780
|
-
mountStaticNode(_this3.kernel.menuBar.element, menuBar);
|
|
8781
|
-
mountStaticNode(_this3.kernel.appBar.element, appBar);
|
|
8782
8829
|
}
|
|
8783
8830
|
|
|
8784
8831
|
_this3.kernel.toggleLegacyIframe(actualLegacy === "iframe");
|
|
@@ -9378,7 +9425,9 @@ var SingleBrickAsComponent = /*#__PURE__*/React__default.memo(function SingleBri
|
|
|
9378
9425
|
// eslint-disable-next-line
|
|
9379
9426
|
console.warn("Currently resolvable-if in `useBrick` is not supported.");
|
|
9380
9427
|
} else if (!looseCheckIfByTransform(useBrick, data, {
|
|
9381
|
-
allowInject: true
|
|
9428
|
+
allowInject: true,
|
|
9429
|
+
// useBrick 中嵌套custom-template的情况下, 会存在丢失getTplVariables的情况, 因此需要在此进行补充
|
|
9430
|
+
getTplVariables: () => tplContext.getContext(useBrick[symbolForTplContextId])
|
|
9382
9431
|
})) {
|
|
9383
9432
|
return false;
|
|
9384
9433
|
}
|