beer-assembly-biz 1.1.3-alpha.3 → 1.1.3-alpha.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "beer-assembly-biz",
3
3
  "private": false,
4
- "version": "1.1.3-alpha.3",
4
+ "version": "1.1.3-alpha.5",
5
5
  "scripts": {
6
6
  "pub-w": "tsc && copy package.json .\\dist\\package.json && npm publish ./dist",
7
7
  "copy": "cp -a src/rich/AIEditor.css dist/rich/AIEditor.css && cp -a src/icon dist/icon && cp -a src/images dist/images",
@@ -14,6 +14,7 @@
14
14
  "aieditor": "^1.3.6",
15
15
  "antd": "5.23.2",
16
16
  "beer-network": "1.2.1",
17
+ "beer-assembly-plus": "1.1.2-alpha.6",
17
18
  "dayjs": "^1.11.13",
18
19
  "react": "^18.2.0",
19
20
  "react-dom": "^18.2.0",
package/promises.d.ts CHANGED
@@ -45,5 +45,11 @@ export declare class ArrayUtils {
45
45
  * 后退导航工具类.
46
46
  */
47
47
  export declare class NavigateUtils {
48
- static useBack(): () => void;
48
+ /**
49
+ * 功能性后退页面.
50
+ * <li>页面依赖浏览器堆栈非常不可靠的,因此在实际操作中是前进页面</li>
51
+ * <li><b>默认是</b>根据当前 <b>路径参数</b> 以及 <b>分页规则</b> 后退到根路径</li>
52
+ * @param param 路径参数 (数值类型:如果是则根据数值后退 字符串:根据指定路径后退).
53
+ */
54
+ static useBack(param?: string | number): (value?: string | number) => void;
49
55
  }
package/promises.js CHANGED
@@ -118,23 +118,36 @@ export class ArrayUtils {
118
118
  * 后退导航工具类.
119
119
  */
120
120
  export class NavigateUtils {
121
- static useBack() {
121
+ /**
122
+ * 功能性后退页面.
123
+ * <li>页面依赖浏览器堆栈非常不可靠的,因此在实际操作中是前进页面</li>
124
+ * <li><b>默认是</b>根据当前 <b>路径参数</b> 以及 <b>分页规则</b> 后退到根路径</li>
125
+ * @param param 路径参数 (数值类型:如果是则根据数值后退 字符串:根据指定路径后退).
126
+ */
127
+ static useBack(param) {
122
128
  const location = useLocation();
123
129
  const navigate = useNavigate();
124
- return () => {
130
+ const getPath = () => {
125
131
  let partition = pathPartition.find(path => {
126
132
  return location.pathname.toUpperCase()
127
133
  .indexOf(`/${path}/`) > -1;
128
134
  });
129
135
  // 无法确认是否是子页面 则后退一步
130
136
  if (partition === undefined) {
131
- navigate(-1);
132
- return;
137
+ return undefined;
133
138
  }
134
139
  // 如果确认是子页面 则前进路由
135
140
  partition = partition.toLowerCase();
136
- const path = location.pathname.split(`/${partition}/`)[0];
137
- navigate(path);
141
+ return location.pathname.split(`/${partition}/`)[0];
142
+ };
143
+ return (value) => {
144
+ const to = value ?? param ?? getPath() ?? -1;
145
+ if (typeof to === 'string') {
146
+ navigate(to);
147
+ }
148
+ else {
149
+ navigate(to);
150
+ }
138
151
  };
139
152
  }
140
153
  }