@jswork/antd-components 1.0.150 → 1.0.151

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.150",
3
+ "version": "1.0.151",
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 19:06:05
5
+ * @LastEditTime: 2025-10-26 19:11:01
6
6
  *
7
7
  *
8
8
  * 路由风格: /{module}/{name} eg: /admin/staff-roles
@@ -70,10 +70,10 @@ export type AcTableProps = TableProps & {
70
70
  */
71
71
  onPageChange?: (page: number, size: number) => void;
72
72
  /**
73
- * When destroy success.
73
+ * When destroy complete.
74
74
  * @param model
75
75
  */
76
- onDestroySuccess?: (model: any) => void;
76
+ onDestroyComplete?: (model: any) => void;
77
77
  /**
78
78
  * Default page.
79
79
  */
@@ -153,6 +153,10 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
153
153
  this.defaultFetcher = fetcher || nx.createFetcher(resourceId, { dataPath, totalPath });
154
154
  }
155
155
 
156
+ private toQueryString(params?: Record<string, any>) {
157
+ return params ? `?${new URLSearchParams(params).toString()}` : '';
158
+ }
159
+
156
160
  async componentDidMount() {
157
161
  const { current, pageSize } = this.state;
158
162
  this.harmonyEvents = ReactHarmonyEvents.create(this);
@@ -227,25 +231,25 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
227
231
  };
228
232
 
229
233
  public destroy = (item) => {
230
- const { name, onDestroySuccess } = this.props;
234
+ const { name, onDestroyComplete } = this.props;
231
235
  this.setState({ isLoading: true });
232
236
  nx.$api[`${name}_destroy`](item)
233
237
  .then(this.refetch)
234
238
  .finally(() => {
235
- onDestroySuccess?.(item);
239
+ onDestroyComplete?.(item);
236
240
  this.setState({ isLoading: false });
237
241
  });
238
242
  };
239
243
 
240
244
  public add = () => {
241
245
  const { module, paramsAdd } = this.props;
242
- const qs = paramsAdd ? `?${new URLSearchParams(paramsAdd).toString()}` : '';
246
+ const qs = this.toQueryString(paramsAdd);
243
247
  nx.$nav?.(`/${module}/${this.routerKey}/add${qs}`);
244
248
  };
245
249
 
246
250
  public edit = (item: any) => {
247
251
  const { module, rowKey, paramsEdit } = this.props;
248
- const qs = paramsEdit ? `?${new URLSearchParams(paramsEdit).toString()}` : '';
252
+ const qs = this.toQueryString(paramsEdit);
249
253
  nx.$nav?.(`/${module}/${this.routerKey}/${item[rowKey as string]}/edit${qs}`);
250
254
  };
251
255