@blocklet/ui-react 2.11.14 → 2.11.15

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.
@@ -1,4 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
2
3
  import { Box, Divider, Typography } from "@mui/material";
3
4
  import { useCreation, useMemoizedFn } from "ahooks";
4
5
  import { translate } from "@arcblock/ux/lib/Locale/util";
@@ -67,6 +68,13 @@ export default function Settings({
67
68
  }
68
69
  ].filter(Boolean);
69
70
  }, [user, privacyConfigList]);
71
+ useEffect(() => {
72
+ const id = window.location.hash.slice(1);
73
+ if (id) {
74
+ const element = document.getElementById(id);
75
+ element?.scrollIntoView({ behavior: "smooth" });
76
+ }
77
+ }, []);
70
78
  return /* @__PURE__ */ jsx(
71
79
  Box,
72
80
  {
@@ -78,7 +86,7 @@ export default function Settings({
78
86
  },
79
87
  maxWidth: "100%"
80
88
  },
81
- children: tabs.map((tab, index) => /* @__PURE__ */ jsxs(Box, { children: [
89
+ children: tabs.map((tab, index) => /* @__PURE__ */ jsxs(Box, { id: tab.value, children: [
82
90
  /* @__PURE__ */ jsx(
83
91
  Typography,
84
92
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.11.14",
3
+ "version": "2.11.15",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -32,8 +32,8 @@
32
32
  "url": "https://github.com/ArcBlock/ux/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/bridge": "^2.11.14",
36
- "@arcblock/react-hooks": "^2.11.14",
35
+ "@arcblock/bridge": "^2.11.15",
36
+ "@arcblock/react-hooks": "^2.11.15",
37
37
  "@blocklet/did-space-react": "^0.6.0",
38
38
  "@iconify-icons/logos": "^1.2.36",
39
39
  "@iconify-icons/material-symbols": "^1.2.58",
@@ -81,5 +81,5 @@
81
81
  "jest": "^29.7.0",
82
82
  "unbuild": "^2.0.0"
83
83
  },
84
- "gitHead": "6e1596d1a8ab9b74fd0588be21beb80eaeb68e35"
84
+ "gitHead": "08b1daa5c17ade28952f1c44fb4e6f79f1c3b178"
85
85
  }
@@ -1,3 +1,4 @@
1
+ import { useEffect } from 'react';
1
2
  import { Box, Divider, Typography } from '@mui/material';
2
3
  import type { BoxProps } from '@mui/material';
3
4
  import { useCreation, useMemoizedFn } from 'ahooks';
@@ -81,6 +82,15 @@ export default function Settings({
81
82
  ].filter(Boolean);
82
83
  }, [user, privacyConfigList]);
83
84
 
85
+ // 支持 hash 锚点定位
86
+ useEffect(() => {
87
+ const id = window.location.hash.slice(1);
88
+ if (id) {
89
+ const element = document.getElementById(id);
90
+ element?.scrollIntoView({ behavior: 'smooth' });
91
+ }
92
+ }, []);
93
+
84
94
  return (
85
95
  <Box
86
96
  {...rest}
@@ -92,7 +102,7 @@ export default function Settings({
92
102
  maxWidth: '100%',
93
103
  }}>
94
104
  {tabs.map((tab, index) => (
95
- <Box key={tab.value}>
105
+ <Box id={tab.value} key={tab.value}>
96
106
  <Typography
97
107
  sx={{
98
108
  color: colors.foregroundsFgBase,