@jswork/antd-components 1.0.108 → 1.0.109

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.108",
3
+ "version": "1.0.109",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.esm.js",
6
6
  "types": "dist/main.d.ts",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@jswork/harmony-events": "^1.2.11",
21
- "@jswork/next": "^1.2.11",
21
+ "@jswork/next": "^1.4.2",
22
22
  "@swc/core": "^1.3.93",
23
23
  "@types/react": "^18.2.28",
24
24
  "@types/react-dom": "^18.2.13",
25
- "antd": "^5.27.4",
25
+ "antd": "^5.27.5",
26
26
  "autoprefixer": "^10.4.16",
27
27
  "classnames": "^2.5.1",
28
28
  "cssnano": "^6.0.1",
package/src/lib/alert.tsx CHANGED
@@ -1,14 +1,25 @@
1
1
  import React from 'react';
2
- import { Input, InputProps, Modal } from 'antd';
2
+ import { Input, InputProps, message, Modal } from 'antd';
3
3
 
4
4
  declare global {
5
5
  interface NxStatic {
6
+ err: (inMessage: string) => any;
7
+ msg: (inMessage: string) => any;
6
8
  alert: (inMessage: string, inTitle?: String) => any;
7
9
  confirm: (inMessage: string, inTitle?: String) => any;
8
10
  prompt: (inMessage: string, inOptions?: InputProps) => any;
9
11
  }
10
12
  }
11
13
 
14
+ export const msg = (inMessage: string) => {
15
+ return message.success(inMessage);
16
+ };
17
+
18
+ export const err = (inMessage: string) => {
19
+ return message.error(inMessage);
20
+ };
21
+
22
+
12
23
  export const alert = (inMessage: string, inTitle?: String) => {
13
24
  return Modal.info({
14
25
  title: inTitle || 'Tips',
@@ -47,6 +58,8 @@ export const prompt = (inMessage: string, inOptions?: InputProps) => {
47
58
  });
48
59
  };
49
60
 
61
+ nx.msg = msg;
62
+ nx.err = err;
50
63
  nx.alert = alert;
51
64
  nx.confirm = confirm;
52
65
  nx.prompt = prompt;
@@ -32,9 +32,13 @@ export class AcBreadcrumb extends React.Component<AcBreadcrumbProps> {
32
32
  render() {
33
33
  const { className, value, items, template, onChange, ...props } = this.props;
34
34
  return (
35
- <Breadcrumb className={cx(className, CLASS_NAME)} {...props}>
36
- <ReactList items={items || []} template={template} />
37
- </Breadcrumb>
35
+ <ReactList
36
+ items={items || []}
37
+ template={template}
38
+ as={Breadcrumb}
39
+ className={cx(className, CLASS_NAME)}
40
+ {...props}
41
+ />
38
42
  );
39
43
  }
40
44
  }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @Author: aric 1290657123@qq.com
3
+ * @Date: 2025-10-18 07:09:31
4
+ * @LastEditors: aric 1290657123@qq.com
5
+ * @LastEditTime: 2025-10-18 07:29:35
6
+ */
7
+ import React, { FC } from 'react';
8
+ import { Button, ButtonProps } from 'antd';
9
+
10
+ const locals = {
11
+ 'zh-CN': {
12
+ create: '添加',
13
+ edit: '编辑',
14
+ del: '删除',
15
+ view: '查看',
16
+ save: '保存',
17
+ export: '导出',
18
+ imp: '导入',
19
+ refresh: '刷新',
20
+ back: '返回',
21
+ submit: '提交',
22
+ cancel: '取消',
23
+ },
24
+ 'en-US': {
25
+ create: 'Create',
26
+ edit: 'Edit',
27
+ del: 'Delete',
28
+ view: 'View',
29
+ save: 'Save',
30
+ export: 'Export',
31
+ imp: 'Import',
32
+ refresh: 'Refresh',
33
+ back: 'Back',
34
+ submit: 'Submit',
35
+ cancel: 'Cancel',
36
+ },
37
+ };
38
+
39
+ const t = (locale: string, key: string) => {
40
+ return locals[locale][key] || key;
41
+ };
42
+
43
+ type AcButtonProps = ButtonProps & {
44
+ lang: 'zh-CN' | 'en-US';
45
+ }
46
+
47
+ export const BtnCreate: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
48
+ return <Button size="small" {...props}>
49
+
50
+ <span>{t(lang, 'create')}</span>
51
+ </Button>;
52
+ };
53
+
54
+ export const BtnEdit: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
55
+ return <Button size="small" {...props}>
56
+ ✏️
57
+ <span>{t(lang, 'edit')}</span>
58
+ </Button>;
59
+ };
60
+
61
+ export const BtnDelete: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
62
+ return <Button size="small" {...props}>
63
+ 🗑️
64
+ <span>{t(lang, 'del')}</span>
65
+ </Button>;
66
+ };
67
+
68
+ export const BtnView: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
69
+ return <Button size="small" {...props}>
70
+ 👁️
71
+ <span>{t(lang, 'view')}</span>
72
+ </Button>;
73
+ };
74
+
75
+ export const BtnSave: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
76
+ return <Button size="small" {...props}>
77
+ 💾
78
+ <span>{t(lang, 'save')}</span>
79
+ </Button>;
80
+ };
81
+
82
+ export const BtnExport: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
83
+ return <Button size="small" {...props}>
84
+ 📤
85
+ <span>{t(lang, 'export')}</span>
86
+ </Button>;
87
+ };
88
+
89
+ export const BtnImport: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
90
+ return <Button size="small" {...props}>
91
+ 📥
92
+ <span>{t(lang, 'imp')}</span>
93
+ </Button>;
94
+ };
95
+
96
+ export const BtnRefresh: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
97
+ return <Button size="small" {...props}>
98
+ ⚡️
99
+ <span>{t(lang, 'refresh')}</span>
100
+ </Button>;
101
+ };
102
+
103
+ export const BtnBack: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
104
+ return <Button size="small" {...props}>
105
+ 🔙
106
+ <span>{t(lang, 'back')}</span>
107
+ </Button>;
108
+ };
109
+
110
+ export const BtnSubmit: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
111
+ return <Button size="small" {...props}>
112
+ 📨
113
+ <span>{t(lang, 'submit')}</span>
114
+ </Button>;
115
+ };
116
+
117
+ export const BtnCancel: FC<AcButtonProps> = ({ lang = 'zh-CN', ...props }) => {
118
+ return <Button size="small" {...props}>
119
+
120
+ <span>{t(lang, 'cancel')}</span>
121
+ </Button>;
122
+ };
package/src/main.ts CHANGED
@@ -43,6 +43,7 @@ import './lib/alert';
43
43
  // commands
44
44
  import useTableCommand from './lib/use-table-command';
45
45
 
46
+ export * from './lib/button';
46
47
 
47
48
  // export all templates
48
49
  export {
@@ -3,6 +3,7 @@ import React from 'react';
3
3
 
4
4
  export const breadcrumbDefault = ({ item, index, items }) => {
5
5
  const last = items?.length - 1 === index;
6
- const child = last ? <span>{item.label}</span> : <a href={item.value}>{item.label}</a>;
6
+ const { label, ...rest } = item;
7
+ const child = last ? <span {...rest}>{label}</span> : <a {...rest}>{label}</a>;
7
8
  return <Breadcrumb.Item key={index}>{child}</Breadcrumb.Item>;
8
9
  };