@blocklet/ui-react 2.1.33 → 2.1.36

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.
@@ -182,7 +182,7 @@ function Header(_ref) {
182
182
  theme: muiTheme,
183
183
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledUxHeader, _objectSpread(_objectSpread({
184
184
  logo: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
185
- href: "/",
185
+ href: _utils.publicPath,
186
186
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
187
187
  src: appLogo,
188
188
  alt: "logo"
@@ -194,14 +194,12 @@ function Header(_ref) {
194
194
  $bgcolor: theme === null || theme === void 0 ? void 0 : theme.background,
195
195
  children: !(navItems !== null && navItems !== void 0 && navItems.length) ? null : _ref2 => {
196
196
  let {
197
- isMobile,
198
- closeMenu
197
+ isMobile
199
198
  } = _ref2;
200
199
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NavMenu.default, {
201
200
  mode: isMobile ? 'inline' : 'horizontal',
202
201
  activeId: activeId,
203
202
  items: navItems,
204
- onSelected: closeMenu,
205
203
  className: "header-nav",
206
204
  bgColor: "transparent"
207
205
  });
package/lib/utils.js CHANGED
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.matchPaths = exports.matchPath = exports.mapRecursive = exports.isUrl = exports.flatRecursive = void 0;
6
+ exports.publicPath = exports.matchPaths = exports.matchPath = exports.mapRecursive = exports.isUrl = exports.flatRecursive = void 0;
7
+
8
+ var _window, _window$blocklet;
7
9
 
8
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
11
 
@@ -83,4 +85,6 @@ const matchPaths = function matchPaths() {
83
85
  return mostSpecific.index;
84
86
  };
85
87
 
86
- exports.matchPaths = matchPaths;
88
+ exports.matchPaths = matchPaths;
89
+ const publicPath = ((_window = window) === null || _window === void 0 ? void 0 : (_window$blocklet = _window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.prefix) || '/';
90
+ exports.publicPath = publicPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.1.33",
3
+ "version": "2.1.36",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -34,8 +34,8 @@
34
34
  "url": "https://github.com/ArcBlock/ux/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@arcblock/did-connect": "^2.1.33",
38
- "@arcblock/ux": "^2.1.33",
37
+ "@arcblock/did-connect": "^2.1.36",
38
+ "@arcblock/ux": "^2.1.36",
39
39
  "@iconify/iconify": "^2.2.1",
40
40
  "@mui/material": "^5.6.4",
41
41
  "core-js": "^3.6.4",
@@ -57,5 +57,5 @@
57
57
  "eslint-plugin-react-hooks": "^4.2.0",
58
58
  "jest": "^24.1.0"
59
59
  },
60
- "gitHead": "616c11e20c48d33f153258bcf00eba030dabf648"
60
+ "gitHead": "fc0e64437926f532b89f8e027da4df083a705fec"
61
61
  }
@@ -14,7 +14,7 @@ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
14
14
  import '@iconify/iconify';
15
15
 
16
16
  import { blockletMetaProps, sessionManagerProps } from '../types';
17
- import { mapRecursive, flatRecursive, matchPaths } from '../utils';
17
+ import { mapRecursive, flatRecursive, matchPaths, publicPath } from '../utils';
18
18
 
19
19
  const muiTheme = create();
20
20
 
@@ -99,7 +99,7 @@ function Header({ meta, addons, sessionManagerProps, ...rest }) {
99
99
  <ThemeProvider theme={muiTheme}>
100
100
  <StyledUxHeader
101
101
  logo={
102
- <a href="/">
102
+ <a href={publicPath}>
103
103
  <img src={appLogo} alt="logo" />
104
104
  </a>
105
105
  }
@@ -110,12 +110,11 @@ function Header({ meta, addons, sessionManagerProps, ...rest }) {
110
110
  {/* blocklet.yml 没有配置 navigation 时, 则为 children 传入 null, 此时 ResponsiveHeader 会渲染普通的不带 menu 的 Header */}
111
111
  {!navItems?.length
112
112
  ? null
113
- : ({ isMobile, closeMenu }) => (
113
+ : ({ isMobile }) => (
114
114
  <NavMenu
115
115
  mode={isMobile ? 'inline' : 'horizontal'}
116
116
  activeId={activeId}
117
117
  items={navItems}
118
- onSelected={closeMenu}
119
118
  className="header-nav"
120
119
  bgColor="transparent"
121
120
  />
package/src/utils.js CHANGED
@@ -49,3 +49,5 @@ export const matchPaths = (paths = []) => {
49
49
  }, matched[0]);
50
50
  return mostSpecific.index;
51
51
  };
52
+
53
+ export const publicPath = window?.blocklet?.prefix || '/';