@jswork/antd-components 1.0.104 → 1.0.106
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 +100 -71
- package/dist/main.d.ts +100 -71
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/checkable-tag-list.tsx +12 -6
- package/src/lib/checkable-tag.tsx +9 -5
- package/src/lib/checkbox-group.tsx +7 -2
- package/src/lib/checkbox.tsx +11 -5
- package/src/lib/codeflask.tsx +8 -3
- package/src/lib/date-picker.tsx +10 -4
- package/src/lib/editable-tag-group.tsx +10 -5
- package/src/lib/input-hidden.tsx +6 -0
- package/src/lib/input-number.tsx +11 -5
- package/src/lib/input-tags.tsx +10 -5
- package/src/lib/input-token.tsx +9 -4
- package/src/lib/input.tsx +9 -4
- package/src/lib/pre-select.tsx +7 -1
- package/src/lib/radio-group.tsx +8 -3
- package/src/lib/range-picker.tsx +9 -3
- package/src/lib/rate.tsx +8 -3
- package/src/lib/search.tsx +9 -3
- package/src/lib/select.tsx +8 -3
- package/src/lib/slider-range.tsx +8 -2
- package/src/lib/slider.tsx +8 -2
- package/src/lib/switch.tsx +8 -3
- package/src/lib/textarea.tsx +8 -3
- package/src/lib/time-picker.tsx +9 -4
- package/src/lib/transfer.tsx +8 -3
- package/src/lib/tree-select.tsx +8 -2
- package/src/lib/upload-dragger.tsx +7 -2
- package/src/lib/upload-picture-card.tsx +5 -0
- package/src/lib/upload-picture.tsx +6 -1
- package/src/lib/upload.tsx +7 -2
- package/src/main.ts +60 -29
package/package.json
CHANGED
|
@@ -8,11 +8,12 @@ import { AcCheckableTag } from './checkable-tag';
|
|
|
8
8
|
const CLASS_NAME = 'ac-checkable-tag-list';
|
|
9
9
|
const locales = {
|
|
10
10
|
'zh-CN': { selectAll: '全部' },
|
|
11
|
-
'en-US': { selectAll: 'All' }
|
|
11
|
+
'en-US': { selectAll: 'All' },
|
|
12
12
|
};
|
|
13
13
|
type StdEventTarget = { target: { value: any } };
|
|
14
14
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
export type AcCheckableTagListProps = {
|
|
16
17
|
/**
|
|
17
18
|
* Main className.
|
|
18
19
|
*/
|
|
@@ -39,17 +40,17 @@ type Props = {
|
|
|
39
40
|
disabled?: boolean;
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
export class AcCheckableTagList extends React.Component<
|
|
43
|
+
export class AcCheckableTagList extends React.Component<AcCheckableTagListProps> {
|
|
43
44
|
static displayName = CLASS_NAME;
|
|
44
45
|
static formSchema = CLASS_NAME;
|
|
45
46
|
static defaultProps = {
|
|
46
47
|
lang: 'zh-CN',
|
|
47
48
|
value: [],
|
|
48
|
-
onChange: noop
|
|
49
|
+
onChange: noop,
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
state = {
|
|
52
|
-
value: this.props.value
|
|
53
|
+
value: this.props.value,
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
t = (inKey: string) => {
|
|
@@ -57,7 +58,7 @@ export class AcCheckableTagList extends React.Component<Props> {
|
|
|
57
58
|
return locales[lang!][inKey] || inKey;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
61
|
+
shouldComponentUpdate(nextProps: Readonly<AcCheckableTagListProps>): boolean {
|
|
61
62
|
const { value } = nextProps;
|
|
62
63
|
if (value !== this.props.value) this.setState({ value });
|
|
63
64
|
return true;
|
|
@@ -120,3 +121,8 @@ export class AcCheckableTagList extends React.Component<Props> {
|
|
|
120
121
|
);
|
|
121
122
|
}
|
|
122
123
|
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
export const AcCheckableTagListFc = (props: AcCheckableTagListProps) => {
|
|
127
|
+
return <AcCheckableTagList {...props} />;
|
|
128
|
+
};
|
|
@@ -14,7 +14,7 @@ type StdCallback = (inEvent: StdEventTarget) => void;
|
|
|
14
14
|
* @see https://ant.design/components/tag-cn/#Tag.CheckableTag
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
type
|
|
17
|
+
export type AcCheckableTagProps = {
|
|
18
18
|
className?: string;
|
|
19
19
|
value?: boolean;
|
|
20
20
|
disabled?: boolean;
|
|
@@ -25,7 +25,7 @@ type Props = {
|
|
|
25
25
|
onCloseClick?: StdCallback;
|
|
26
26
|
} & Omit<CheckableTagProps, 'checked'>;
|
|
27
27
|
|
|
28
|
-
export class AcCheckableTag extends React.Component<
|
|
28
|
+
export class AcCheckableTag extends React.Component<AcCheckableTagProps> {
|
|
29
29
|
static displayName = CLASS_NAME;
|
|
30
30
|
static formSchema = CLASS_NAME;
|
|
31
31
|
static defaultProps = {
|
|
@@ -35,11 +35,11 @@ export class AcCheckableTag extends React.Component<Props> {
|
|
|
35
35
|
toggleable: false,
|
|
36
36
|
propagation: false,
|
|
37
37
|
onChange: noop,
|
|
38
|
-
onCloseClick: noop
|
|
38
|
+
onCloseClick: noop,
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
state = {
|
|
42
|
-
value: Boolean(this.props.value)
|
|
42
|
+
value: Boolean(this.props.value),
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
get closeIcon() {
|
|
@@ -51,7 +51,7 @@ export class AcCheckableTag extends React.Component<Props> {
|
|
|
51
51
|
return view;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
54
|
+
shouldComponentUpdate(nextProps: Readonly<AcCheckableTagProps>): boolean {
|
|
55
55
|
const { value } = nextProps;
|
|
56
56
|
if (value !== this.state.value) {
|
|
57
57
|
this.setState({ value });
|
|
@@ -99,3 +99,7 @@ export class AcCheckableTag extends React.Component<Props> {
|
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
export const AcCheckableTagFc = (props: AcCheckableTagProps) => {
|
|
104
|
+
return <AcCheckableTag {...props} />;
|
|
105
|
+
};
|
|
@@ -28,11 +28,11 @@ export class AcCheckboxGroup extends React.Component<AcCheckboxGroupProps> {
|
|
|
28
28
|
value: [],
|
|
29
29
|
template: checkboxKv,
|
|
30
30
|
onChange: noop,
|
|
31
|
-
onSearch: noop
|
|
31
|
+
onSearch: noop,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
state = {
|
|
35
|
-
value: this.props.value
|
|
35
|
+
value: this.props.value,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
shouldComponentUpdate(nextProps: Readonly<AcCheckboxGroupProps>): boolean {
|
|
@@ -70,3 +70,8 @@ export class AcCheckboxGroup extends React.Component<AcCheckboxGroupProps> {
|
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
export const AcCheckboxGroupFc = (props: AcCheckboxGroupProps) => {
|
|
75
|
+
return <AcCheckboxGroup {...props} />;
|
|
76
|
+
};
|
|
77
|
+
|
package/src/lib/checkbox.tsx
CHANGED
|
@@ -7,25 +7,25 @@ const CLASS_NAME = 'ac-checkbox';
|
|
|
7
7
|
type StdEventTarget = { target: { value: any } };
|
|
8
8
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type AcCheckboxProps = {
|
|
11
11
|
className?: string;
|
|
12
12
|
value?: boolean;
|
|
13
13
|
onChange?: StdCallback;
|
|
14
14
|
} & CheckboxProps &
|
|
15
15
|
HTMLAttributes<any>;
|
|
16
16
|
|
|
17
|
-
export class AcCheckbox extends React.Component<
|
|
17
|
+
export class AcCheckbox extends React.Component<AcCheckboxProps> {
|
|
18
18
|
static displayName = CLASS_NAME;
|
|
19
19
|
static formSchema = CLASS_NAME;
|
|
20
20
|
static defaultProps = {
|
|
21
|
-
onChange: noop
|
|
21
|
+
onChange: noop,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
state = {
|
|
25
|
-
value: this.props.value
|
|
25
|
+
value: this.props.value,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
28
|
+
shouldComponentUpdate(nextProps: Readonly<AcCheckboxProps>): boolean {
|
|
29
29
|
const { value } = nextProps;
|
|
30
30
|
if (value !== this.state.value) {
|
|
31
31
|
this.setState({ value });
|
|
@@ -57,3 +57,9 @@ export class AcCheckbox extends React.Component<Props> {
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export const AcCheckboxFc = (props: AcCheckboxProps) => {
|
|
63
|
+
return <AcCheckbox {...props} />;
|
|
64
|
+
};
|
|
65
|
+
|
package/src/lib/codeflask.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import noop from '@jswork/noop';
|
|
3
|
-
import
|
|
3
|
+
import ReactCodeFlask from '@jswork/react-codeflask';
|
|
4
4
|
|
|
5
5
|
const CLASS_NAME = 'ac-codeflask';
|
|
6
6
|
|
|
@@ -8,10 +8,15 @@ export class AcCodeFlask extends React.Component {
|
|
|
8
8
|
static displayName = CLASS_NAME;
|
|
9
9
|
static formSchema = CLASS_NAME;
|
|
10
10
|
static defaultProps = {
|
|
11
|
-
onChange: noop
|
|
11
|
+
onChange: noop,
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
render() {
|
|
15
|
-
return <
|
|
15
|
+
return <ReactCodeFlask {...this.props} />;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
export const AcCodeFlaskFc = (props) => {
|
|
20
|
+
return <AcCodeFlask {...props} />;
|
|
21
|
+
};
|
|
22
|
+
|
package/src/lib/date-picker.tsx
CHANGED
|
@@ -8,11 +8,11 @@ const STD_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
|
8
8
|
type StdEventTarget = { target: { value: string } };
|
|
9
9
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
10
10
|
|
|
11
|
-
type
|
|
11
|
+
export type AcDatePickerProps = Omit<DatePickerProps, 'value' | 'onChange' | 'ref'> & {
|
|
12
12
|
className?: string;
|
|
13
13
|
value?: any;
|
|
14
14
|
onChange?: StdCallback;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
|
|
17
17
|
const DATA_FORMAT_HOOKS = {
|
|
18
18
|
date: 'YYYY-MM-DD',
|
|
@@ -20,10 +20,10 @@ const DATA_FORMAT_HOOKS = {
|
|
|
20
20
|
time: 'HH:mm:ss',
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export class AcDatePicker extends React.Component<
|
|
23
|
+
export class AcDatePicker extends React.Component<AcDatePickerProps> {
|
|
24
24
|
static displayName = CLASS_NAME;
|
|
25
25
|
static formSchema = CLASS_NAME;
|
|
26
|
-
static defaultProps:
|
|
26
|
+
static defaultProps: AcDatePickerProps = {
|
|
27
27
|
format: STD_FORMAT,
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -56,3 +56,9 @@ export class AcDatePicker extends React.Component<Props> {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
export const AcDatePickerFc = (props: AcDatePickerProps) => {
|
|
61
|
+
return <AcDatePicker {...props} />;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
|
|
@@ -13,7 +13,7 @@ const CLASS_NAME = 'ac-editable-tag-group';
|
|
|
13
13
|
type StdEventTarget = { target: { value: any } };
|
|
14
14
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
15
15
|
|
|
16
|
-
type
|
|
16
|
+
export type AcEditableTagGroupProps = {
|
|
17
17
|
/**
|
|
18
18
|
* The extended className for component.
|
|
19
19
|
*/
|
|
@@ -48,7 +48,7 @@ type Props = {
|
|
|
48
48
|
triggers?: string[];
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
export class AcEditableTagGroup extends React.Component<
|
|
51
|
+
export class AcEditableTagGroup extends React.Component<AcEditableTagGroupProps> {
|
|
52
52
|
static displayName = CLASS_NAME;
|
|
53
53
|
static formSchema = CLASS_NAME;
|
|
54
54
|
static defaultProps = {
|
|
@@ -56,7 +56,7 @@ export class AcEditableTagGroup extends React.Component<Props> {
|
|
|
56
56
|
min: 0,
|
|
57
57
|
max: 10,
|
|
58
58
|
onChange: noop,
|
|
59
|
-
triggers: [' ', 'Tab']
|
|
59
|
+
triggers: [' ', 'Tab'],
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
private inputRef = createRef<HTMLInputElement>();
|
|
@@ -75,7 +75,7 @@ export class AcEditableTagGroup extends React.Component<Props> {
|
|
|
75
75
|
|
|
76
76
|
state = {
|
|
77
77
|
value: this.props.value,
|
|
78
|
-
ime: false
|
|
78
|
+
ime: false,
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
template = ({ item, index }, cb) => {
|
|
@@ -203,7 +203,7 @@ export class AcEditableTagGroup extends React.Component<Props> {
|
|
|
203
203
|
this.imeEndRes.destroy();
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
206
|
+
shouldComponentUpdate(nextProps: Readonly<AcEditableTagGroupProps>): boolean {
|
|
207
207
|
const { value } = nextProps;
|
|
208
208
|
if (!deepEqual(value, this.props.value)) {
|
|
209
209
|
this.setState({ value: value!.slice() });
|
|
@@ -232,3 +232,8 @@ export class AcEditableTagGroup extends React.Component<Props> {
|
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
+
|
|
236
|
+
export const AcEditableTagGroupFc = (props: AcEditableTagGroupProps) => {
|
|
237
|
+
return <AcEditableTagGroup {...props} />;
|
|
238
|
+
};
|
|
239
|
+
|
package/src/lib/input-hidden.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { InputProps } from 'antd';
|
|
2
3
|
|
|
3
4
|
const CLASS_NAME = 'ac-input-hidden';
|
|
4
5
|
|
|
@@ -11,3 +12,8 @@ export class AcInputHidden extends React.Component {
|
|
|
11
12
|
return <input type="hidden" {...this.props} />;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
|
|
16
|
+
export const AcInputHiddenFc = (props: InputProps) => {
|
|
17
|
+
return <AcInputHidden {...props} />;
|
|
18
|
+
};
|
|
19
|
+
|
package/src/lib/input-number.tsx
CHANGED
|
@@ -7,24 +7,24 @@ const CLASS_NAME = 'ac-input-number';
|
|
|
7
7
|
type StdEventTarget = { target: { value: any } };
|
|
8
8
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type AcInputNumberProps = {
|
|
11
11
|
className?: string;
|
|
12
12
|
value?: number;
|
|
13
13
|
onChange?: StdCallback;
|
|
14
14
|
} & InputNumberProps;
|
|
15
15
|
|
|
16
|
-
export class AcInputNumber extends React.Component<
|
|
16
|
+
export class AcInputNumber extends React.Component<AcInputNumberProps> {
|
|
17
17
|
static displayName = CLASS_NAME;
|
|
18
18
|
static formSchema = CLASS_NAME;
|
|
19
19
|
static defaultProps = {
|
|
20
|
-
onChange: noop
|
|
20
|
+
onChange: noop,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
state = {
|
|
24
|
-
value: this.props.value
|
|
24
|
+
value: this.props.value,
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
shouldComponentUpdate(inProps: Readonly<
|
|
27
|
+
shouldComponentUpdate(inProps: Readonly<AcInputNumberProps>): boolean {
|
|
28
28
|
const { value } = inProps;
|
|
29
29
|
if (value !== this.props.value) this.setState({ value });
|
|
30
30
|
return true;
|
|
@@ -50,3 +50,9 @@ export class AcInputNumber extends React.Component<Props> {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
export const AcInputNumberFc = (props: AcInputNumberProps) => {
|
|
55
|
+
return <AcInputNumber {...props} />;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
|
package/src/lib/input-tags.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const TRIGGER_KEYS = ['Tab', 'Enter', 'Space'];
|
|
|
11
11
|
type StdEventTarget = { target: { value: any } };
|
|
12
12
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
13
13
|
|
|
14
|
-
type
|
|
14
|
+
type AcInputTagsProps = {
|
|
15
15
|
className?: string;
|
|
16
16
|
items?: string[];
|
|
17
17
|
disabled?: boolean;
|
|
@@ -24,13 +24,13 @@ type State = {
|
|
|
24
24
|
isComposite: boolean;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export class AcInputTags extends React.Component<
|
|
27
|
+
export class AcInputTags extends React.Component<AcInputTagsProps, State> {
|
|
28
28
|
static displayName = CLASS_NAME;
|
|
29
29
|
static formSchema = CLASS_NAME;
|
|
30
30
|
static defaultProps = {
|
|
31
31
|
items: [],
|
|
32
32
|
disabled: false,
|
|
33
|
-
onChange: noop
|
|
33
|
+
onChange: noop,
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
inputRef = React.createRef<HTMLInputElement>();
|
|
@@ -41,11 +41,11 @@ export class AcInputTags extends React.Component<Props, State> {
|
|
|
41
41
|
this.state = {
|
|
42
42
|
items,
|
|
43
43
|
isComposite: false,
|
|
44
|
-
inputValue: ''
|
|
44
|
+
inputValue: '',
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
48
|
+
shouldComponentUpdate(nextProps: Readonly<AcInputTagsProps>): boolean {
|
|
49
49
|
const { items } = nextProps;
|
|
50
50
|
if (!fde(items, this.props.items)) {
|
|
51
51
|
this.setState({ items });
|
|
@@ -138,3 +138,8 @@ export class AcInputTags extends React.Component<Props, State> {
|
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
+
|
|
142
|
+
export const AcInputTagsFc = (props: AcInputTagsProps) => {
|
|
143
|
+
return <AcInputTags {...props} />;
|
|
144
|
+
};
|
|
145
|
+
|
package/src/lib/input-token.tsx
CHANGED
|
@@ -9,7 +9,7 @@ const CLASS_NAME = 'ac-input-token';
|
|
|
9
9
|
type StdEventTarget = { target: { value: any } };
|
|
10
10
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
11
11
|
|
|
12
|
-
type
|
|
12
|
+
type AcInputTokenProps = {
|
|
13
13
|
className?: string;
|
|
14
14
|
value?: string;
|
|
15
15
|
onChange?: StdCallback;
|
|
@@ -18,20 +18,20 @@ type Props = {
|
|
|
18
18
|
labelRemove?: string;
|
|
19
19
|
} & InputProps;
|
|
20
20
|
|
|
21
|
-
export class AcInputToken extends React.Component<
|
|
21
|
+
export class AcInputToken extends React.Component<AcInputTokenProps> {
|
|
22
22
|
static displayName = CLASS_NAME;
|
|
23
23
|
static formSchema = CLASS_NAME;
|
|
24
24
|
static defaultProps = {
|
|
25
25
|
onChange: noop,
|
|
26
26
|
autoComplete: false,
|
|
27
27
|
labelCreate: '生成Token',
|
|
28
|
-
labelRemove: '去掉Token'
|
|
28
|
+
labelRemove: '去掉Token',
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
private rootRef = React.createRef<any>();
|
|
32
32
|
state = { value: this.props.value };
|
|
33
33
|
|
|
34
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
34
|
+
shouldComponentUpdate(nextProps: Readonly<AcInputTokenProps>): boolean {
|
|
35
35
|
const { value } = nextProps;
|
|
36
36
|
if (value !== this.props.value) this.setState({ value });
|
|
37
37
|
return true;
|
|
@@ -100,3 +100,8 @@ export class AcInputToken extends React.Component<Props> {
|
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
export const AcInputTokenFc = (props: AcInputTokenProps) => {
|
|
105
|
+
return <AcInputToken {...props} />;
|
|
106
|
+
};
|
|
107
|
+
|
package/src/lib/input.tsx
CHANGED
|
@@ -7,23 +7,23 @@ const CLASS_NAME = 'ac-input';
|
|
|
7
7
|
type StdEventTarget = { target: { value: any } };
|
|
8
8
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type AcInputProps = {
|
|
11
11
|
className?: string;
|
|
12
12
|
onChange?: StdCallback;
|
|
13
13
|
autoComplete?: boolean;
|
|
14
14
|
} & InputProps;
|
|
15
15
|
|
|
16
|
-
export class AcInput extends React.Component<
|
|
16
|
+
export class AcInput extends React.Component<AcInputProps> {
|
|
17
17
|
static displayName = CLASS_NAME;
|
|
18
18
|
static formSchema = CLASS_NAME;
|
|
19
19
|
static defaultProps = {
|
|
20
20
|
onChange: noop,
|
|
21
|
-
autoComplete: false
|
|
21
|
+
autoComplete: false,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
state = { value: this.props.value };
|
|
25
25
|
|
|
26
|
-
shouldComponentUpdate(inProps: Readonly<
|
|
26
|
+
shouldComponentUpdate(inProps: Readonly<AcInputProps>): boolean {
|
|
27
27
|
const { value } = inProps;
|
|
28
28
|
if (value !== this.props.value) this.setState({ value });
|
|
29
29
|
return true;
|
|
@@ -56,3 +56,8 @@ export class AcInput extends React.Component<Props> {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
export const AcInputFc = (props: AcInputProps) => {
|
|
61
|
+
return <AcInput {...props} />;
|
|
62
|
+
};
|
|
63
|
+
|
package/src/lib/pre-select.tsx
CHANGED
|
@@ -55,7 +55,7 @@ export class AcPreSelect extends React.Component<AcPreSelectProps> {
|
|
|
55
55
|
static defaultProps = {
|
|
56
56
|
onChange: noop,
|
|
57
57
|
onSearch: noop,
|
|
58
|
-
searchable: false
|
|
58
|
+
searchable: false,
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
state = { value: this.props.value };
|
|
@@ -126,3 +126,9 @@ export class AcPreSelect extends React.Component<AcPreSelectProps> {
|
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
export const AcPreSelectFc = (props: AcPreSelectProps) => {
|
|
132
|
+
return <AcPreSelect {...props} />;
|
|
133
|
+
};
|
|
134
|
+
|
package/src/lib/radio-group.tsx
CHANGED
|
@@ -10,7 +10,7 @@ type StdEventTarget = { target: { value: any } };
|
|
|
10
10
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
11
11
|
type TemplateCallback = (item: { item: any; index: number }, opts?: any) => React.ReactNode;
|
|
12
12
|
|
|
13
|
-
type
|
|
13
|
+
type AcRadioGroupProps = {
|
|
14
14
|
className?: string;
|
|
15
15
|
value?: any;
|
|
16
16
|
defaultValue?: any;
|
|
@@ -22,7 +22,7 @@ type Props = {
|
|
|
22
22
|
buttonStyle?: 'solid' | 'outline';
|
|
23
23
|
} & RadioGroupProps & HTMLAttributes<any>;
|
|
24
24
|
|
|
25
|
-
export class AcRadioGroup extends React.Component<
|
|
25
|
+
export class AcRadioGroup extends React.Component<AcRadioGroupProps> {
|
|
26
26
|
static displayName = CLASS_NAME;
|
|
27
27
|
static formSchema = CLASS_NAME;
|
|
28
28
|
static defaultProps = {
|
|
@@ -39,7 +39,7 @@ export class AcRadioGroup extends React.Component<Props> {
|
|
|
39
39
|
|
|
40
40
|
state = { value: this.props.value };
|
|
41
41
|
|
|
42
|
-
static getDerivedStateFromProps(inProps: Readonly<
|
|
42
|
+
static getDerivedStateFromProps(inProps: Readonly<AcRadioGroupProps>, inState: any) {
|
|
43
43
|
const { value } = inProps;
|
|
44
44
|
if (value !== inState.value) return { value };
|
|
45
45
|
return null;
|
|
@@ -65,3 +65,8 @@ export class AcRadioGroup extends React.Component<Props> {
|
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
export const AcRadioGroupFc = (props: AcRadioGroupProps) => {
|
|
70
|
+
return <AcRadioGroup {...props} />;
|
|
71
|
+
};
|
|
72
|
+
|
package/src/lib/range-picker.tsx
CHANGED
|
@@ -12,19 +12,19 @@ const { RangePicker } = DatePicker;
|
|
|
12
12
|
type StdEventTarget = { target: { value: any } };
|
|
13
13
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
14
14
|
|
|
15
|
-
type
|
|
15
|
+
type AcRangePickerProps = {
|
|
16
16
|
className?: string;
|
|
17
17
|
value?: any;
|
|
18
18
|
defaultValue?: any;
|
|
19
19
|
onChange?: StdCallback;
|
|
20
20
|
} & RangePickerProps;
|
|
21
21
|
|
|
22
|
-
export class AcRangePicker extends React.Component<
|
|
22
|
+
export class AcRangePicker extends React.Component<AcRangePickerProps> {
|
|
23
23
|
static displayName = CLASS_NAME;
|
|
24
24
|
static formSchema = CLASS_NAME;
|
|
25
25
|
static defaultProps = {
|
|
26
26
|
onChange: noop,
|
|
27
|
-
format: STD_FORMAT
|
|
27
|
+
format: STD_FORMAT,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
handleChange = (inEvent) => {
|
|
@@ -57,3 +57,9 @@ export class AcRangePicker extends React.Component<Props> {
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
export const AcRangePickerFc = (props: AcRangePickerProps) => {
|
|
62
|
+
return <AcRangePicker {...props} />;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
|
package/src/lib/rate.tsx
CHANGED
|
@@ -7,17 +7,17 @@ const CLASS_NAME = 'ac-rate';
|
|
|
7
7
|
type StdEventTarget = { target: { value: any } };
|
|
8
8
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type AcRateProps = {
|
|
11
11
|
className?: string;
|
|
12
12
|
value?: number;
|
|
13
13
|
onChange?: StdCallback;
|
|
14
14
|
} & RateProps;
|
|
15
15
|
|
|
16
|
-
export class AcRate extends React.Component<
|
|
16
|
+
export class AcRate extends React.Component<AcRateProps> {
|
|
17
17
|
static displayName = CLASS_NAME;
|
|
18
18
|
static formSchema = CLASS_NAME;
|
|
19
19
|
static defaultProps = {
|
|
20
|
-
onChange: noop
|
|
20
|
+
onChange: noop,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
handleChange = (inEvent) => {
|
|
@@ -36,3 +36,8 @@ export class AcRate extends React.Component<Props> {
|
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
export const AcRateFc = (props: AcRateProps) => {
|
|
41
|
+
return <AcRate {...props} />;
|
|
42
|
+
};
|
|
43
|
+
|
package/src/lib/search.tsx
CHANGED
|
@@ -8,7 +8,7 @@ const CLASS_NAME = 'ac-search';
|
|
|
8
8
|
type StdEventTarget = { target: { value: any } };
|
|
9
9
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
10
10
|
|
|
11
|
-
type
|
|
11
|
+
type AcSearchProps = {
|
|
12
12
|
className?: string;
|
|
13
13
|
value?: boolean;
|
|
14
14
|
onChange?: StdCallback;
|
|
@@ -16,14 +16,14 @@ type Props = {
|
|
|
16
16
|
autoComplete?: boolean;
|
|
17
17
|
} & SearchProps;
|
|
18
18
|
|
|
19
|
-
export class AcSearch extends React.Component<
|
|
19
|
+
export class AcSearch extends React.Component<AcSearchProps> {
|
|
20
20
|
static displayName = CLASS_NAME;
|
|
21
21
|
static formSchema = CLASS_NAME;
|
|
22
22
|
static defaultProps = {
|
|
23
23
|
onChange: noop,
|
|
24
24
|
onSearch: noop,
|
|
25
25
|
autoComplete: false,
|
|
26
|
-
placeholder: '输入关键字搜索'
|
|
26
|
+
placeholder: '输入关键字搜索',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
get complete() {
|
|
@@ -47,3 +47,9 @@ export class AcSearch extends React.Component<Props> {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
export const AcSearchFc = (props: AcSearchProps) => {
|
|
52
|
+
return <AcSearch {...props} />;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
|
package/src/lib/select.tsx
CHANGED
|
@@ -15,7 +15,7 @@ type StdEventTarget = { target: { value: any } };
|
|
|
15
15
|
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
16
16
|
type TemplateCallback = (item: { item: any; index: number }) => React.ReactNode;
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type AcSelectProps = {
|
|
19
19
|
className?: string;
|
|
20
20
|
items?: any[];
|
|
21
21
|
kv?: Record<string, string>;
|
|
@@ -24,7 +24,7 @@ type Props = {
|
|
|
24
24
|
template?: TemplateCallback;
|
|
25
25
|
} & Omit<SelectProps, 'options'>;
|
|
26
26
|
|
|
27
|
-
export class AcSelect extends React.Component<
|
|
27
|
+
export class AcSelect extends React.Component<AcSelectProps> {
|
|
28
28
|
static displayName = CLASS_NAME;
|
|
29
29
|
static formSchema = CLASS_NAME;
|
|
30
30
|
static defaultProps = {
|
|
@@ -40,7 +40,7 @@ export class AcSelect extends React.Component<Props> {
|
|
|
40
40
|
value: this.props.value,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
shouldComponentUpdate(nextProps: Readonly<
|
|
43
|
+
shouldComponentUpdate(nextProps: Readonly<AcSelectProps>): boolean {
|
|
44
44
|
const { value } = nextProps;
|
|
45
45
|
const isNewValue = this.props.value !== value;
|
|
46
46
|
if (isNewValue && value !== this.state.value) {
|
|
@@ -88,3 +88,8 @@ export class AcSelect extends React.Component<Props> {
|
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
export const AcSelectFc = (props: AcSelectProps) => {
|
|
93
|
+
return <AcSelect {...props} />;
|
|
94
|
+
};
|
|
95
|
+
|