@jswork/antd-components 1.0.154 → 1.0.156

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.154",
3
+ "version": "1.0.156",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.esm.js",
6
6
  "types": "dist/main.d.ts",
@@ -2,10 +2,10 @@
2
2
  * @Author: aric 1290657123@qq.com
3
3
  * @Date: 2025-10-24 20:40:55
4
4
  * @LastEditors: aric 1290657123@qq.com
5
- * @LastEditTime: 2025-10-26 14:48:21
5
+ * @LastEditTime: 2025-10-27 13:26:45
6
6
  */
7
7
  import { Space, SpaceProps } from 'antd';
8
- import React, { FC } from 'react';
8
+ import React, { FC, Fragment } from 'react';
9
9
  import nx from '@jswork/next';
10
10
  import { BtnBack, BtnCreate, BtnRefresh } from './button';
11
11
 
@@ -19,6 +19,7 @@ export type AcTableExtrasProps = SpaceProps & {
19
19
  name: string;
20
20
  lang?: string;
21
21
  as?: React.ComponentType<any>;
22
+ extra?: React.ReactNode;
22
23
  asProps?: any;
23
24
  actions?: string []
24
25
  }
@@ -29,20 +30,21 @@ const defaultExtras = {
29
30
  };
30
31
 
31
32
  export const AcTableExtras: FC<AcTableExtrasProps> = (props) => {
32
- const { name, lang, as, asProps, actions } = { ...defaultExtras, ...props };
33
+ const { name, lang, as, extra, asProps, actions } = { ...defaultExtras, ...props };
33
34
  const handleRefresh = () => nx.$event?.emit?.(`${name}:reset`);
34
35
  const handleAdd = () => nx.$event?.emit?.(`${name}:add`);
35
36
  const handleBack = () => history.back();
36
37
  const AsComponent = as || Space;
37
38
  const items = {
38
- reset: <BtnRefresh key="reset" lang={lang} onClick={handleRefresh} />,
39
- add: <BtnCreate key="add" lang={lang} onClick={handleAdd} />,
40
- back: <BtnBack key="back" lang={lang} onClick={handleBack} />,
39
+ reset: <BtnRefresh lang={lang} onClick={handleRefresh} />,
40
+ add: <BtnCreate lang={lang} onClick={handleAdd} />,
41
+ back: <BtnBack lang={lang} onClick={handleBack} />,
41
42
  };
42
43
 
43
44
  return (
44
45
  <AsComponent {...asProps}>
45
- {actions?.map((action) => items[action])}
46
+ {actions?.map((action) => <Fragment key={action}>{items[action]}</Fragment>)}
47
+ {extra}
46
48
  </AsComponent>
47
49
  );
48
50
  };
@@ -31,6 +31,7 @@ export type AcTableLinksProps = {
31
31
  name: string;
32
32
  model?: any;
33
33
  lang?: string;
34
+ extra?: React.ReactNode;
34
35
  as?: React.ComponentType<any>;
35
36
  asProps?: any;
36
37
  actions?: string []
@@ -42,7 +43,7 @@ const defaultProps = {
42
43
  };
43
44
 
44
45
  export const AcTableLinks: FC<AcTableLinksProps> = (props) => {
45
- const { name, as, lang, actions, model, asProps } = { ...defaultProps, ...props };
46
+ const { name, as, lang, actions, model, asProps, extra } = { ...defaultProps, ...props };
46
47
  const t = (key: string) => locales[lang][key];
47
48
  const AsComponent = as || Space;
48
49
  const handleEdit = () => nx.$event?.emit?.(`${name}:edit`, model);
@@ -53,6 +54,7 @@ export const AcTableLinks: FC<AcTableLinksProps> = (props) => {
53
54
  };
54
55
  return <AsComponent {...asProps}>
55
56
  {actions.map(((action) => items[action]))}
57
+ {extra}
56
58
  </AsComponent>;
57
59
  };
58
60