@jswork/antd-components 1.0.219 → 1.0.220
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.cjs.js.map +1 -1
- package/dist/main.d.mts +65 -91
- package/dist/main.d.ts +65 -91
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +1 -2
- package/src/lib/_abstract-upload.tsx +6 -6
- package/src/lib/breadcrumb.tsx +0 -2
- package/src/lib/button.tsx +112 -66
- package/src/lib/card-extras.tsx +13 -8
- package/src/lib/checkable-dropdown.tsx +8 -10
- package/src/lib/checkable-tag-list.tsx +4 -7
- package/src/lib/checkable-tag.tsx +5 -8
- package/src/lib/checkbox-group.tsx +4 -8
- package/src/lib/checkbox.tsx +3 -8
- package/src/lib/codeflask.tsx +0 -2
- package/src/lib/color-picker.tsx +2 -5
- package/src/lib/editable-tag-group.tsx +5 -9
- package/src/lib/input-copyable.tsx +27 -5
- package/src/lib/input-number.tsx +3 -8
- package/src/lib/input-tags.tsx +2 -5
- package/src/lib/input-token.tsx +1 -3
- package/src/lib/input.tsx +2 -5
- package/src/lib/interactive-list.tsx +1 -7
- package/src/lib/pre-select.tsx +0 -3
- package/src/lib/radio-group.tsx +5 -8
- package/src/lib/range-picker.tsx +4 -12
- package/src/lib/rate.tsx +4 -14
- package/src/lib/search.tsx +1 -4
- package/src/lib/select.tsx +4 -8
- package/src/lib/slider-range.tsx +4 -9
- package/src/lib/slider.tsx +4 -15
- package/src/lib/switch.tsx +3 -7
- package/src/lib/textarea.tsx +3 -7
- package/src/lib/time-picker.tsx +2 -5
- package/src/lib/transfer.tsx +3 -6
- package/src/lib/tree-select.tsx +5 -17
- package/src/lib/upload-dragger.tsx +4 -7
- package/src/lib/upload-picture-card.tsx +0 -2
- package/src/lib/upload-picture.tsx +0 -2
- package/src/lib/upload.tsx +5 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jswork/antd-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.220",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.esm.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"@jswork/next-tmpl": "^1.0.7",
|
|
65
65
|
"@jswork/next-tree-walk": "^1.0.7",
|
|
66
66
|
"@jswork/next-unique": "^1.0.2",
|
|
67
|
-
"@jswork/noop": "^1.0.0",
|
|
68
67
|
"@jswork/react-codeflask": "^1.1.2",
|
|
69
68
|
"@jswork/react-list": "^1.4.3",
|
|
70
69
|
"@jswork/url-sync-flat": "^1.0.8",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import Sortable from 'sortablejs';
|
|
3
1
|
import { loadScript, loadStyle } from '@jswork/loadkit';
|
|
2
|
+
import { UploadFile } from 'antd';
|
|
4
3
|
import { DraggerProps } from 'antd/es/upload';
|
|
5
4
|
import { UploadChangeParam } from 'antd/es/upload/interface';
|
|
6
|
-
import {
|
|
5
|
+
import React, { ReactNode } from 'react';
|
|
7
6
|
import { flushSync } from 'react-dom';
|
|
7
|
+
import Sortable from 'sortablejs';
|
|
8
8
|
|
|
9
9
|
import '@jswork/next-gpid';
|
|
10
10
|
|
|
@@ -45,7 +45,7 @@ export class AcAbstractUpload extends React.Component<AcAbstractUploadProps, Sta
|
|
|
45
45
|
constructor(inProps: AcAbstractUploadProps) {
|
|
46
46
|
super(inProps);
|
|
47
47
|
this.state = {
|
|
48
|
-
fileList: this.toFileList(inProps.value)
|
|
48
|
+
fileList: this.toFileList(inProps.value),
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -72,7 +72,7 @@ export class AcAbstractUpload extends React.Component<AcAbstractUploadProps, Sta
|
|
|
72
72
|
ghostClass: 'sortable-ghost',
|
|
73
73
|
chosenClass: 'sortable-chosen',
|
|
74
74
|
dragClass: 'sortable-drag',
|
|
75
|
-
onEnd: this.handleSortEnd
|
|
75
|
+
onEnd: this.handleSortEnd,
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -112,7 +112,7 @@ export class AcAbstractUpload extends React.Component<AcAbstractUploadProps, Sta
|
|
|
112
112
|
doChange = (inValue) => {
|
|
113
113
|
const { onChange, transformResponse } = this.props;
|
|
114
114
|
const value = inValue.map((item) => item.response ?? item);
|
|
115
|
-
onChange
|
|
115
|
+
onChange?.({ target: { value: transformResponse!(value) } });
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
previewFile = (file): Promise<string> => {
|
package/src/lib/breadcrumb.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import noop from '@jswork/noop';
|
|
3
2
|
import { Breadcrumb, BreadcrumbProps } from 'antd';
|
|
4
3
|
import ReactList, { TemplateArgs } from '@jswork/react-list';
|
|
5
4
|
import { breadcrumbDefault } from '../tpls/breadcrumb';
|
|
@@ -25,7 +24,6 @@ export type AcBreadcrumbProps = {
|
|
|
25
24
|
export class AcBreadcrumb extends React.Component<AcBreadcrumbProps> {
|
|
26
25
|
static displayName = CLASS_NAME;
|
|
27
26
|
static defaultProps = {
|
|
28
|
-
onChange: noop,
|
|
29
27
|
template: breadcrumbDefault,
|
|
30
28
|
};
|
|
31
29
|
|
package/src/lib/button.tsx
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* @LastEditors: aric 1290657123@qq.com
|
|
5
5
|
* @LastEditTime: 2025-10-25 07:32:18
|
|
6
6
|
*/
|
|
7
|
-
import React, { FC } from 'react';
|
|
8
|
-
import { Button, ButtonProps } from 'antd';
|
|
9
7
|
import {
|
|
10
|
-
ArrowLeftOutlined,
|
|
8
|
+
ArrowLeftOutlined,
|
|
9
|
+
BulbOutlined,
|
|
11
10
|
CheckOutlined,
|
|
12
|
-
CloseOutlined,
|
|
11
|
+
CloseOutlined,
|
|
12
|
+
CopyOutlined,
|
|
13
13
|
DownloadOutlined,
|
|
14
14
|
EditOutlined,
|
|
15
15
|
EyeOutlined,
|
|
@@ -20,8 +20,29 @@ import {
|
|
|
20
20
|
SaveOutlined,
|
|
21
21
|
SyncOutlined,
|
|
22
22
|
} from '@ant-design/icons';
|
|
23
|
+
import { Button, ButtonProps } from 'antd';
|
|
24
|
+
import React, { FC } from 'react';
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
// 类型定义
|
|
27
|
+
export type Locale = 'zh-CN' | 'en-US';
|
|
28
|
+
type ActionType =
|
|
29
|
+
| 'create'
|
|
30
|
+
| 'edit'
|
|
31
|
+
| 'del'
|
|
32
|
+
| 'view'
|
|
33
|
+
| 'preview'
|
|
34
|
+
| 'save'
|
|
35
|
+
| 'export'
|
|
36
|
+
| 'imp'
|
|
37
|
+
| 'refresh'
|
|
38
|
+
| 'back'
|
|
39
|
+
| 'submit'
|
|
40
|
+
| 'cancel'
|
|
41
|
+
| 'sync'
|
|
42
|
+
| 'copy';
|
|
43
|
+
|
|
44
|
+
// 文案
|
|
45
|
+
const locals: Record<Locale, Record<ActionType, string>> = {
|
|
25
46
|
'zh-CN': {
|
|
26
47
|
create: '添加',
|
|
27
48
|
edit: '编辑',
|
|
@@ -56,66 +77,91 @@ const locals = {
|
|
|
56
77
|
},
|
|
57
78
|
};
|
|
58
79
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
// 图标映射
|
|
81
|
+
const iconMap: Record<ActionType, React.ReactNode> = {
|
|
82
|
+
create: <PlusOutlined />,
|
|
83
|
+
edit: <EditOutlined />,
|
|
84
|
+
del: <CloseOutlined />,
|
|
85
|
+
view: <EyeOutlined />,
|
|
86
|
+
preview: <BulbOutlined />,
|
|
87
|
+
save: <SaveOutlined />,
|
|
88
|
+
export: <DownloadOutlined />,
|
|
89
|
+
imp: <ImportOutlined />,
|
|
90
|
+
refresh: <ReloadOutlined />,
|
|
91
|
+
back: <ArrowLeftOutlined />,
|
|
92
|
+
submit: <CheckOutlined />,
|
|
93
|
+
cancel: <RedoOutlined />,
|
|
94
|
+
sync: <SyncOutlined />,
|
|
95
|
+
copy: <CopyOutlined />,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// 国际化工具函数
|
|
99
|
+
const t = (locale: Locale, key: ActionType): string => {
|
|
100
|
+
return locals[locale]?.[key] ?? key;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// 通用按钮组件
|
|
104
|
+
interface ActionButtonProps extends ButtonProps {
|
|
105
|
+
action: ActionType;
|
|
106
|
+
lang?: Locale;
|
|
65
107
|
}
|
|
66
108
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
109
|
+
const ActionButton: FC<ActionButtonProps> = ({
|
|
110
|
+
action,
|
|
111
|
+
lang = 'zh-CN',
|
|
112
|
+
size = 'small',
|
|
113
|
+
children,
|
|
114
|
+
...props
|
|
115
|
+
}) => {
|
|
116
|
+
const text = children ?? t(lang, action);
|
|
117
|
+
const icon = iconMap[action];
|
|
118
|
+
return (
|
|
119
|
+
<Button size={size} icon={icon} {...props}>
|
|
120
|
+
{text}
|
|
121
|
+
</Button>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// 导出具体命名的按钮(保持 API 兼容)
|
|
126
|
+
export const BtnCreate = (props: ButtonProps & { lang?: Locale }) => (
|
|
127
|
+
<ActionButton action="create" {...props} />
|
|
128
|
+
);
|
|
129
|
+
export const BtnEdit = (props: ButtonProps & { lang?: Locale }) => (
|
|
130
|
+
<ActionButton action="edit" {...props} />
|
|
131
|
+
);
|
|
132
|
+
export const BtnDelete = (props: ButtonProps & { lang?: Locale }) => (
|
|
133
|
+
<ActionButton action="del" {...props} />
|
|
134
|
+
);
|
|
135
|
+
export const BtnView = (props: ButtonProps & { lang?: Locale }) => (
|
|
136
|
+
<ActionButton action="view" {...props} />
|
|
137
|
+
);
|
|
138
|
+
export const BtnPreview = (props: ButtonProps & { lang?: Locale }) => (
|
|
139
|
+
<ActionButton action="preview" {...props} />
|
|
140
|
+
);
|
|
141
|
+
export const BtnSave = (props: ButtonProps & { lang?: Locale }) => (
|
|
142
|
+
<ActionButton action="save" {...props} />
|
|
143
|
+
);
|
|
144
|
+
export const BtnExport = (props: ButtonProps & { lang?: Locale }) => (
|
|
145
|
+
<ActionButton action="export" {...props} />
|
|
146
|
+
);
|
|
147
|
+
export const BtnImport = (props: ButtonProps & { lang?: Locale }) => (
|
|
148
|
+
<ActionButton action="imp" {...props} />
|
|
149
|
+
);
|
|
150
|
+
export const BtnRefresh = (props: ButtonProps & { lang?: Locale }) => (
|
|
151
|
+
<ActionButton action="refresh" {...props} />
|
|
152
|
+
);
|
|
153
|
+
export const BtnBack = (props: ButtonProps & { lang?: Locale }) => (
|
|
154
|
+
<ActionButton action="back" {...props} />
|
|
155
|
+
);
|
|
156
|
+
export const BtnSubmit = (props: ButtonProps & { lang?: Locale }) => (
|
|
157
|
+
<ActionButton action="submit" {...props} />
|
|
158
|
+
);
|
|
159
|
+
export const BtnCancel = (props: ButtonProps & { lang?: Locale }) => (
|
|
160
|
+
<ActionButton action="cancel" {...props} />
|
|
161
|
+
);
|
|
162
|
+
export const BtnSync = (props: ButtonProps & { lang?: Locale }) => (
|
|
163
|
+
<ActionButton action="sync" {...props} />
|
|
164
|
+
);
|
|
165
|
+
export const BtnCopy = (props: ButtonProps & { lang?: Locale }) => (
|
|
166
|
+
<ActionButton action="copy" {...props} />
|
|
167
|
+
);
|
package/src/lib/card-extras.tsx
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @LastEditors: aric 1290657123@qq.com
|
|
5
5
|
* @LastEditTime: 2025-10-31 14:07:56
|
|
6
6
|
*/
|
|
7
|
+
import nx from '@jswork/next';
|
|
7
8
|
import { Space, SpaceProps } from 'antd';
|
|
8
9
|
import React, { FC, Fragment } from 'react';
|
|
9
|
-
import
|
|
10
|
-
import { BtnBack, BtnCreate, BtnRefresh } from './button';
|
|
10
|
+
import { BtnBack, BtnCreate, BtnRefresh, Locale } from './button';
|
|
11
11
|
|
|
12
12
|
declare global {
|
|
13
13
|
interface NxStatic {
|
|
@@ -17,21 +17,24 @@ declare global {
|
|
|
17
17
|
|
|
18
18
|
export type AcCardExtrasProps = SpaceProps & {
|
|
19
19
|
name: string;
|
|
20
|
-
lang?:
|
|
20
|
+
lang?: Locale;
|
|
21
21
|
as?: React.ComponentType<any>;
|
|
22
22
|
extraBefore?: React.ReactNode;
|
|
23
23
|
extraAfter?: React.ReactNode;
|
|
24
24
|
asProps?: any;
|
|
25
|
-
actions?: string
|
|
26
|
-
}
|
|
25
|
+
actions?: string[];
|
|
26
|
+
};
|
|
27
27
|
|
|
28
28
|
const defaultExtras = {
|
|
29
|
-
lang: 'zh-CN',
|
|
29
|
+
lang: 'zh-CN' as const,
|
|
30
30
|
actions: ['refetch', 'add'],
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export const AcCardExtras: FC<AcCardExtrasProps> = (props) => {
|
|
34
|
-
const { name, lang, as, extraBefore, extraAfter, asProps, actions } = {
|
|
34
|
+
const { name, lang, as, extraBefore, extraAfter, asProps, actions } = {
|
|
35
|
+
...defaultExtras,
|
|
36
|
+
...props,
|
|
37
|
+
};
|
|
35
38
|
const handleRefresh = () => nx.$event?.emit?.(`${name}:refetch`);
|
|
36
39
|
const handleReset = () => nx.$event?.emit?.(`${name}:reset`);
|
|
37
40
|
const handleAdd = () => nx.$event?.emit?.(`${name}:add`);
|
|
@@ -47,7 +50,9 @@ export const AcCardExtras: FC<AcCardExtrasProps> = (props) => {
|
|
|
47
50
|
return (
|
|
48
51
|
<AsComponent {...asProps}>
|
|
49
52
|
{extraBefore}
|
|
50
|
-
{actions?.map((action) =>
|
|
53
|
+
{actions?.map((action) => (
|
|
54
|
+
<Fragment key={action}>{items[action]}</Fragment>
|
|
55
|
+
))}
|
|
51
56
|
{extraAfter}
|
|
52
57
|
</AsComponent>
|
|
53
58
|
);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import noop from '@jswork/noop';
|
|
3
|
-
import { Checkbox, Dropdown, Button, MenuProps } from 'antd';
|
|
4
1
|
import { DownOutlined } from '@ant-design/icons';
|
|
5
2
|
import '@jswork/next-dom-event';
|
|
3
|
+
import { Button, Checkbox, Dropdown, MenuProps } from 'antd';
|
|
6
4
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
5
|
+
import React from 'react';
|
|
7
6
|
|
|
8
7
|
const CLASS_NAME = 'ac-checkable-dropdown';
|
|
9
8
|
const locales = { 'zh-CN': { selectAll: '全部' }, 'en-US': { selectAll: 'All' } };
|
|
@@ -27,17 +26,16 @@ export class AcCheckableDropdown extends React.Component<AcCheckableDropdownProp
|
|
|
27
26
|
static id = 1;
|
|
28
27
|
static defaultProps = {
|
|
29
28
|
lang: 'zh-CN',
|
|
30
|
-
onChange: noop,
|
|
31
29
|
items: [],
|
|
32
30
|
value: [],
|
|
33
|
-
width: 140
|
|
31
|
+
width: 140,
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
private readonly overlayClass = `${CLASS_NAME}-overlay--${AcCheckableDropdown.id++}`;
|
|
37
35
|
|
|
38
36
|
state = {
|
|
39
37
|
visible: false,
|
|
40
|
-
value: this.props.value
|
|
38
|
+
value: this.props.value,
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
private overlayRes: any;
|
|
@@ -73,7 +71,7 @@ export class AcCheckableDropdown extends React.Component<AcCheckableDropdownProp
|
|
|
73
71
|
}}>
|
|
74
72
|
{this.t('selectAll')}
|
|
75
73
|
</Checkbox>
|
|
76
|
-
)
|
|
74
|
+
),
|
|
77
75
|
},
|
|
78
76
|
{ type: 'divider' },
|
|
79
77
|
...items!.map((opt) => {
|
|
@@ -91,9 +89,9 @@ export class AcCheckableDropdown extends React.Component<AcCheckableDropdownProp
|
|
|
91
89
|
checked={shouldChecked}>
|
|
92
90
|
{opt.label}
|
|
93
91
|
</Checkbox>
|
|
94
|
-
)
|
|
92
|
+
),
|
|
95
93
|
};
|
|
96
|
-
})
|
|
94
|
+
}),
|
|
97
95
|
] as MenuProps['items'];
|
|
98
96
|
}
|
|
99
97
|
|
|
@@ -106,7 +104,7 @@ export class AcCheckableDropdown extends React.Component<AcCheckableDropdownProp
|
|
|
106
104
|
const { onChange } = this.props;
|
|
107
105
|
const target = { value: inValue };
|
|
108
106
|
this.setState(target);
|
|
109
|
-
onChange
|
|
107
|
+
onChange?.({ target });
|
|
110
108
|
};
|
|
111
109
|
|
|
112
110
|
componentDidMount() {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import noop from '@jswork/noop';
|
|
3
|
-
import cx from 'classnames';
|
|
4
1
|
import ReactList from '@jswork/react-list';
|
|
5
|
-
import {
|
|
2
|
+
import { Button, Space } from 'antd';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import React from 'react';
|
|
6
5
|
import { AcCheckableTag } from './checkable-tag';
|
|
7
6
|
|
|
8
7
|
const CLASS_NAME = 'ac-checkable-tag-list';
|
|
@@ -46,7 +45,6 @@ export class AcCheckableTagList extends React.Component<AcCheckableTagListProps>
|
|
|
46
45
|
static defaultProps = {
|
|
47
46
|
lang: 'zh-CN',
|
|
48
47
|
value: [],
|
|
49
|
-
onChange: noop,
|
|
50
48
|
};
|
|
51
49
|
|
|
52
50
|
state = {
|
|
@@ -68,7 +66,7 @@ export class AcCheckableTagList extends React.Component<AcCheckableTagListProps>
|
|
|
68
66
|
const { onChange } = this.props;
|
|
69
67
|
const target = { value: inEvent };
|
|
70
68
|
this.setState(target, () => {
|
|
71
|
-
onChange
|
|
69
|
+
onChange?.({ target });
|
|
72
70
|
});
|
|
73
71
|
};
|
|
74
72
|
|
|
@@ -122,7 +120,6 @@ export class AcCheckableTagList extends React.Component<AcCheckableTagListProps>
|
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
|
|
126
123
|
export const AcCheckableTagListFc = (props: AcCheckableTagListProps) => {
|
|
127
124
|
return <AcCheckableTagList {...props} />;
|
|
128
125
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import noop from '@jswork/noop';
|
|
1
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
3
2
|
import { Tag } from 'antd';
|
|
4
|
-
import cx from 'classnames';
|
|
5
3
|
import { CheckableTagProps } from 'antd/es/tag';
|
|
6
|
-
import
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import React, { ReactNode } from 'react';
|
|
7
6
|
|
|
8
7
|
const CLASS_NAME = 'ac-checkable-tag';
|
|
9
8
|
const { CheckableTag } = Tag;
|
|
@@ -34,8 +33,6 @@ export class AcCheckableTag extends React.Component<AcCheckableTagProps> {
|
|
|
34
33
|
disabled: false,
|
|
35
34
|
toggleable: false,
|
|
36
35
|
propagation: false,
|
|
37
|
-
onChange: noop,
|
|
38
|
-
onCloseClick: noop,
|
|
39
36
|
};
|
|
40
37
|
|
|
41
38
|
state = {
|
|
@@ -63,14 +60,14 @@ export class AcCheckableTag extends React.Component<AcCheckableTagProps> {
|
|
|
63
60
|
const { onChange } = this.props;
|
|
64
61
|
const target = { value: inEvent };
|
|
65
62
|
this.setState(target, () => {
|
|
66
|
-
onChange
|
|
63
|
+
onChange?.({ target });
|
|
67
64
|
});
|
|
68
65
|
};
|
|
69
66
|
|
|
70
67
|
handleCloseClick = (inEvent) => {
|
|
71
68
|
const { propagation, onCloseClick } = this.props;
|
|
72
69
|
!propagation && inEvent.stopPropagation();
|
|
73
|
-
onCloseClick
|
|
70
|
+
onCloseClick?.(inEvent);
|
|
74
71
|
};
|
|
75
72
|
|
|
76
73
|
render() {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import ReactList from '@jswork/react-list';
|
|
3
|
-
import noop from '@jswork/noop';
|
|
4
2
|
import { Checkbox } from 'antd';
|
|
3
|
+
import { CheckboxGroupProps } from 'antd/es/checkbox';
|
|
5
4
|
import cx from 'classnames';
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import { checkboxKv } from '../tpls/kv';
|
|
7
|
-
import { CheckboxGroupProps } from 'antd/es/checkbox';
|
|
8
7
|
|
|
9
8
|
const CLASS_NAME = 'ac-checkbox-group';
|
|
10
9
|
type StdEventTarget = { target: { value: any } };
|
|
@@ -27,8 +26,6 @@ export class AcCheckboxGroup extends React.Component<AcCheckboxGroupProps> {
|
|
|
27
26
|
items: [],
|
|
28
27
|
value: [],
|
|
29
28
|
template: checkboxKv,
|
|
30
|
-
onChange: noop,
|
|
31
|
-
onSearch: noop,
|
|
32
29
|
};
|
|
33
30
|
|
|
34
31
|
state = {
|
|
@@ -49,8 +46,8 @@ export class AcCheckboxGroup extends React.Component<AcCheckboxGroupProps> {
|
|
|
49
46
|
const target = { value: inEvent };
|
|
50
47
|
const stdEvent = { target };
|
|
51
48
|
this.setState(target, () => {
|
|
52
|
-
onChange
|
|
53
|
-
onSearch
|
|
49
|
+
onChange?.(stdEvent);
|
|
50
|
+
onSearch?.(stdEvent);
|
|
54
51
|
});
|
|
55
52
|
};
|
|
56
53
|
|
|
@@ -74,4 +71,3 @@ export class AcCheckboxGroup extends React.Component<AcCheckboxGroupProps> {
|
|
|
74
71
|
export const AcCheckboxGroupFc = (props: AcCheckboxGroupProps) => {
|
|
75
72
|
return <AcCheckboxGroup {...props} />;
|
|
76
73
|
};
|
|
77
|
-
|
package/src/lib/checkbox.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from 'react';
|
|
2
|
-
import noop from '@jswork/noop';
|
|
3
1
|
import { Checkbox, CheckboxProps } from 'antd';
|
|
4
2
|
import cx from 'classnames';
|
|
3
|
+
import React, { HTMLAttributes } from 'react';
|
|
5
4
|
|
|
6
5
|
const CLASS_NAME = 'ac-checkbox';
|
|
7
6
|
type StdEventTarget = { target: { value: any } };
|
|
@@ -17,9 +16,7 @@ export type AcCheckboxProps = {
|
|
|
17
16
|
export class AcCheckbox extends React.Component<AcCheckboxProps> {
|
|
18
17
|
static displayName = CLASS_NAME;
|
|
19
18
|
static formSchema = CLASS_NAME;
|
|
20
|
-
static defaultProps = {
|
|
21
|
-
onChange: noop,
|
|
22
|
-
};
|
|
19
|
+
static defaultProps = {};
|
|
23
20
|
|
|
24
21
|
state = {
|
|
25
22
|
value: this.props.value,
|
|
@@ -39,7 +36,7 @@ export class AcCheckbox extends React.Component<AcCheckboxProps> {
|
|
|
39
36
|
const target = { value: checked };
|
|
40
37
|
|
|
41
38
|
this.setState(target, () => {
|
|
42
|
-
onChange
|
|
39
|
+
onChange?.({ target });
|
|
43
40
|
});
|
|
44
41
|
};
|
|
45
42
|
|
|
@@ -58,8 +55,6 @@ export class AcCheckbox extends React.Component<AcCheckboxProps> {
|
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
|
|
61
|
-
|
|
62
58
|
export const AcCheckboxFc = (props: AcCheckboxProps) => {
|
|
63
59
|
return <AcCheckbox {...props} />;
|
|
64
60
|
};
|
|
65
|
-
|
package/src/lib/codeflask.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import noop from '@jswork/noop';
|
|
3
2
|
import ReactCodeFlask from '@jswork/react-codeflask';
|
|
4
3
|
|
|
5
4
|
const CLASS_NAME = 'ac-codeflask';
|
|
@@ -8,7 +7,6 @@ export class AcCodeFlask extends React.Component {
|
|
|
8
7
|
static displayName = CLASS_NAME;
|
|
9
8
|
static formSchema = CLASS_NAME;
|
|
10
9
|
static defaultProps = {
|
|
11
|
-
onChange: noop,
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
render() {
|
package/src/lib/color-picker.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import noop from '@jswork/noop';
|
|
2
1
|
import { ColorPicker, ColorPickerProps } from 'antd';
|
|
3
2
|
import cx from 'classnames';
|
|
4
3
|
import React from 'react';
|
|
@@ -16,9 +15,7 @@ export type AcColorPickerProps = {
|
|
|
16
15
|
export class AcColorPicker extends React.Component<AcColorPickerProps> {
|
|
17
16
|
static displayName = CLASS_NAME;
|
|
18
17
|
static formSchema = CLASS_NAME;
|
|
19
|
-
static defaultProps = {
|
|
20
|
-
onChange: noop,
|
|
21
|
-
};
|
|
18
|
+
static defaultProps = {};
|
|
22
19
|
|
|
23
20
|
state = { value: this.props.value };
|
|
24
21
|
|
|
@@ -40,7 +37,7 @@ export class AcColorPicker extends React.Component<AcColorPickerProps> {
|
|
|
40
37
|
const { onChange } = this.props;
|
|
41
38
|
const target = { value: '' };
|
|
42
39
|
this.setState({ value: '' });
|
|
43
|
-
onChange
|
|
40
|
+
onChange?.({ target });
|
|
44
41
|
};
|
|
45
42
|
|
|
46
43
|
render() {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import '@jswork/next-dom-event';
|
|
2
|
+
import '@jswork/next-unique';
|
|
3
|
+
import { Button, Tag } from 'antd';
|
|
1
4
|
import cx from 'classnames';
|
|
5
|
+
import deepEqual from 'fast-deep-equal';
|
|
2
6
|
import React, { createRef } from 'react';
|
|
3
|
-
import noop from '@jswork/noop';
|
|
4
7
|
import AutosizeInput from 'react-input-autosize';
|
|
5
|
-
import { Button, Tag } from 'antd';
|
|
6
|
-
import deepEqual from 'fast-deep-equal';
|
|
7
|
-
import '@jswork/next-dom-event';
|
|
8
|
-
import '@jswork/next-unique';
|
|
9
8
|
import { AcInteractiveList } from './interactive-list';
|
|
10
9
|
|
|
11
10
|
const CLASS_NAME = 'ac-editable-tag-group';
|
|
@@ -54,7 +53,6 @@ export class AcEditableTagGroup extends React.Component<AcEditableTagGroupProps>
|
|
|
54
53
|
value: [],
|
|
55
54
|
min: 0,
|
|
56
55
|
max: 10,
|
|
57
|
-
onChange: noop,
|
|
58
56
|
triggers: [' ', 'Tab'],
|
|
59
57
|
};
|
|
60
58
|
|
|
@@ -181,13 +179,12 @@ export class AcEditableTagGroup extends React.Component<AcEditableTagGroupProps>
|
|
|
181
179
|
};
|
|
182
180
|
|
|
183
181
|
handleChange = (inValue, inCallback?) => {
|
|
184
|
-
const callback = inCallback || noop;
|
|
185
182
|
const { onChange } = this.props;
|
|
186
183
|
const value = inValue.map((item) => item.trim());
|
|
187
184
|
const target = { value };
|
|
188
185
|
this.setState(target, () => {
|
|
189
186
|
onChange!({ target });
|
|
190
|
-
|
|
187
|
+
inCallback?.(value);
|
|
191
188
|
});
|
|
192
189
|
};
|
|
193
190
|
|
|
@@ -235,4 +232,3 @@ export class AcEditableTagGroup extends React.Component<AcEditableTagGroupProps>
|
|
|
235
232
|
export const AcEditableTagGroupFc = (props: AcEditableTagGroupProps) => {
|
|
236
233
|
return <AcEditableTagGroup {...props} />;
|
|
237
234
|
};
|
|
238
|
-
|