@jswork/antd-components 1.0.146 → 1.0.148
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 +4 -3
- package/dist/main.d.ts +4 -3
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/table.tsx +6 -5
- package/src/lib/use-table-command.ts +4 -3
package/package.json
CHANGED
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-
|
|
5
|
+
* @LastEditTime: 2025-10-26 08:56:31
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* 路由风格: /{module}/{name} eg: /admin/staff-roles
|
|
@@ -100,7 +100,7 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
|
|
|
100
100
|
static formSchema = CLASS_NAME;
|
|
101
101
|
private harmonyEvents: ReactHarmonyEvents | null = null;
|
|
102
102
|
static event: EventMittNamespace.EventMitt;
|
|
103
|
-
static events = ['refetch', 'reset', 'add', 'edit', 'destroy', '
|
|
103
|
+
static events = ['refetch', 'reset', 'add', 'edit', 'destroy', 'draft'];
|
|
104
104
|
static defaultProps = {
|
|
105
105
|
name: '@',
|
|
106
106
|
module: 'admin',
|
|
@@ -202,14 +202,15 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
|
|
|
202
202
|
);
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
public
|
|
205
|
+
public draft = async (payload: Record<string, any>) => {
|
|
206
206
|
const { rowKey } = this.props;
|
|
207
|
+
const id = payload[rowKey as string];
|
|
207
208
|
const dataSource = this.state.dataSource!.slice();
|
|
208
|
-
const index = dataSource.findIndex((item) => item[rowKey as string] ===
|
|
209
|
+
const index = dataSource.findIndex((item) => item[rowKey as string] === id);
|
|
209
210
|
if (index !== -1) {
|
|
210
211
|
dataSource[index] = {
|
|
211
212
|
...dataSource[index],
|
|
212
|
-
...
|
|
213
|
+
...payload,
|
|
213
214
|
};
|
|
214
215
|
this.setState({ dataSource });
|
|
215
216
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AcTable } from './table';
|
|
2
2
|
|
|
3
|
-
type ExecuteFn = (command: string,
|
|
3
|
+
type ExecuteFn = (command: string, data?: any) => void;
|
|
4
4
|
type ListenFn = (command: string, callback: any) => void;
|
|
5
|
+
type Payload = Record<string, any>;
|
|
5
6
|
|
|
6
7
|
const useCommand = (inName?: string) => {
|
|
7
8
|
const name = inName || '@';
|
|
@@ -14,7 +15,7 @@ const useCommand = (inName?: string) => {
|
|
|
14
15
|
const add = () => execute('add');
|
|
15
16
|
const edit = () => execute('edit');
|
|
16
17
|
const destroy = () => execute('destroy');
|
|
17
|
-
const
|
|
18
|
+
const draft = (payload: Payload) => execute('draft', payload);
|
|
18
19
|
|
|
19
20
|
return {
|
|
20
21
|
listen,
|
|
@@ -24,7 +25,7 @@ const useCommand = (inName?: string) => {
|
|
|
24
25
|
add,
|
|
25
26
|
edit,
|
|
26
27
|
destroy,
|
|
27
|
-
|
|
28
|
+
draft,
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
31
|
|