@jswork/antd-components 1.0.149 → 1.0.150

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@jswork/antd-components",
3
- "version": "1.0.149",
3
+ "version": "1.0.150",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.esm.js",
6
6
  "types": "dist/main.d.ts",
package/src/lib/table.tsx CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author: aric 1290657123@qq.com
3
3
  * @Date: 2025-10-03 07:11:26
4
4
  * @LastEditors: aric 1290657123@qq.com
5
- * @LastEditTime: 2025-10-26 08:56:31
5
+ * @LastEditTime: 2025-10-26 19:06:05
6
6
  *
7
7
  *
8
8
  * 路由风格: /{module}/{name} eg: /admin/staff-roles
@@ -44,6 +44,16 @@ export type AcTableProps = TableProps & {
44
44
  * The extra params when query data.
45
45
  */
46
46
  params?: Record<string, any>;
47
+ /**
48
+ * The extra params when redirect to add page.
49
+ * `paramsAdd` will merge with `params` when redirect to add page.
50
+ */
51
+ paramsAdd?: Record<string, any>;
52
+ /**
53
+ * The extra params when redirect to edit page.
54
+ * `paramsEdit` will merge with `paramsAdd` when redirect to edit page.
55
+ */
56
+ paramsEdit?: Record<string, any>;
47
57
  /**
48
58
  * Custom get standard data.
49
59
  * @param params { current: number; pageSize: number }
@@ -228,13 +238,15 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
228
238
  };
229
239
 
230
240
  public add = () => {
231
- const { module } = this.props;
232
- nx.$nav?.(`/${module}/${this.routerKey}/add`);
241
+ const { module, paramsAdd } = this.props;
242
+ const qs = paramsAdd ? `?${new URLSearchParams(paramsAdd).toString()}` : '';
243
+ nx.$nav?.(`/${module}/${this.routerKey}/add${qs}`);
233
244
  };
234
245
 
235
246
  public edit = (item: any) => {
236
- const { module, rowKey } = this.props;
237
- nx.$nav?.(`/${module}/${this.routerKey}/${item[rowKey as string]}/edit`);
247
+ const { module, rowKey, paramsEdit } = this.props;
248
+ const qs = paramsEdit ? `?${new URLSearchParams(paramsEdit).toString()}` : '';
249
+ nx.$nav?.(`/${module}/${this.routerKey}/${item[rowKey as string]}/edit${qs}`);
238
250
  };
239
251
 
240
252
  /* ----- public eventBus methods end ----- */
@@ -252,8 +264,20 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
252
264
  };
253
265
 
254
266
  render() {
255
- const { className, pagination, onPageChange, params, fetcher, dataPath, totalPath, ...rest } = this.props;
267
+ const {
268
+ className,
269
+ pagination,
270
+ onPageChange,
271
+ params,
272
+ paramsAdd,
273
+ paramsEdit,
274
+ fetcher,
275
+ dataPath,
276
+ totalPath,
277
+ ...rest
278
+ } = this.props;
256
279
  const { dataSource, isLoading, current, pageSize, total } = this.state;
280
+
257
281
  return (
258
282
  <Table
259
283
  className={cx(className, CLASS_NAME)}