@jswork/antd-components 1.0.208 → 1.0.210
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/dist/main.cjs.js +1 -1
- package/dist/main.d.mts +10 -2
- package/dist/main.d.ts +10 -2
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/lib/table.tsx +16 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jswork/antd-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.210",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.esm.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@ant-design/icons": "*",
|
|
21
21
|
"@ebay/nice-form-react": "*",
|
|
22
|
-
"@jswork/react-ant-status-switch": "*",
|
|
23
22
|
"@jswork/next": "*",
|
|
23
|
+
"@jswork/react-ant-status-switch": "*",
|
|
24
24
|
"antd": "*",
|
|
25
25
|
"react-router-dom": "*"
|
|
26
26
|
},
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@jswork/next-create-fetcher": "^1.0.6",
|
|
61
61
|
"@jswork/next-dom-event": "^1.0.8",
|
|
62
62
|
"@jswork/next-gpid": "^1.0.4",
|
|
63
|
+
"@jswork/next-tmpl": "^1.0.7",
|
|
63
64
|
"@jswork/next-tree-walk": "^1.0.7",
|
|
64
65
|
"@jswork/next-unique": "^1.0.2",
|
|
65
66
|
"@jswork/noop": "^1.0.0",
|
package/src/lib/table.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import { ReactHarmonyEvents } from '@jswork/harmony-events';
|
|
|
13
13
|
import nx from '@jswork/next';
|
|
14
14
|
import '@jswork/next-compact-object';
|
|
15
15
|
import '@jswork/next-create-fetcher';
|
|
16
|
+
import '@jswork/next-tmpl';
|
|
16
17
|
import UrlSyncFlat from '@jswork/url-sync-flat';
|
|
17
18
|
import { Table, TableProps } from 'antd';
|
|
18
19
|
import { ColumnsType } from 'antd/es/table';
|
|
@@ -67,6 +68,14 @@ export type AcTableProps = TableProps & {
|
|
|
67
68
|
* The extra params when reset the page.
|
|
68
69
|
*/
|
|
69
70
|
paramsReset?: Record<string, any>;
|
|
71
|
+
/**
|
|
72
|
+
* Use custom router path for add page.
|
|
73
|
+
*/
|
|
74
|
+
pathAdd?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Use custom router path for edit page.
|
|
77
|
+
*/
|
|
78
|
+
pathEdit?: string;
|
|
70
79
|
/**
|
|
71
80
|
* Custom get standard data.
|
|
72
81
|
* @param params { current: number; pageSize: number }
|
|
@@ -360,8 +369,9 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
|
|
|
360
369
|
* CURD(page): Redirect to add page.
|
|
361
370
|
*/
|
|
362
371
|
public add = () => {
|
|
363
|
-
const { module, paramsAdd } = this.props;
|
|
372
|
+
const { module, paramsAdd, pathAdd } = this.props;
|
|
364
373
|
const qs = this.toQueryString(paramsAdd);
|
|
374
|
+
if (pathAdd) return nx.$nav?.(pathAdd);
|
|
365
375
|
nx.$nav?.(`/${module}/${this.routerKey}/add${qs}`);
|
|
366
376
|
};
|
|
367
377
|
|
|
@@ -369,8 +379,12 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
|
|
|
369
379
|
* CURD(page): Redirect to edit page.
|
|
370
380
|
*/
|
|
371
381
|
public edit = (item: any) => {
|
|
372
|
-
const { module, rowKey, paramsEdit } = this.props;
|
|
382
|
+
const { module, rowKey, paramsEdit, pathEdit } = this.props;
|
|
373
383
|
const qs = this.toQueryString(paramsEdit);
|
|
384
|
+
if (pathEdit) {
|
|
385
|
+
const _editPath = nx.tmpl(pathEdit, item);
|
|
386
|
+
return nx.$nav?.(nx.tmpl(_editPath, item));
|
|
387
|
+
}
|
|
374
388
|
nx.$nav?.(`/${module}/${this.routerKey}/${item[rowKey as string]}/edit${qs}`);
|
|
375
389
|
};
|
|
376
390
|
|