@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.
Files changed (42) hide show
  1. package/dist/main.cjs.js +1 -1
  2. package/dist/main.cjs.js.map +1 -1
  3. package/dist/main.d.mts +65 -91
  4. package/dist/main.d.ts +65 -91
  5. package/dist/main.esm.js +1 -1
  6. package/dist/main.esm.js.map +1 -1
  7. package/package.json +1 -2
  8. package/src/lib/_abstract-upload.tsx +6 -6
  9. package/src/lib/breadcrumb.tsx +0 -2
  10. package/src/lib/button.tsx +112 -66
  11. package/src/lib/card-extras.tsx +13 -8
  12. package/src/lib/checkable-dropdown.tsx +8 -10
  13. package/src/lib/checkable-tag-list.tsx +4 -7
  14. package/src/lib/checkable-tag.tsx +5 -8
  15. package/src/lib/checkbox-group.tsx +4 -8
  16. package/src/lib/checkbox.tsx +3 -8
  17. package/src/lib/codeflask.tsx +0 -2
  18. package/src/lib/color-picker.tsx +2 -5
  19. package/src/lib/editable-tag-group.tsx +5 -9
  20. package/src/lib/input-copyable.tsx +27 -5
  21. package/src/lib/input-number.tsx +3 -8
  22. package/src/lib/input-tags.tsx +2 -5
  23. package/src/lib/input-token.tsx +1 -3
  24. package/src/lib/input.tsx +2 -5
  25. package/src/lib/interactive-list.tsx +1 -7
  26. package/src/lib/pre-select.tsx +0 -3
  27. package/src/lib/radio-group.tsx +5 -8
  28. package/src/lib/range-picker.tsx +4 -12
  29. package/src/lib/rate.tsx +4 -14
  30. package/src/lib/search.tsx +1 -4
  31. package/src/lib/select.tsx +4 -8
  32. package/src/lib/slider-range.tsx +4 -9
  33. package/src/lib/slider.tsx +4 -15
  34. package/src/lib/switch.tsx +3 -7
  35. package/src/lib/textarea.tsx +3 -7
  36. package/src/lib/time-picker.tsx +2 -5
  37. package/src/lib/transfer.tsx +3 -6
  38. package/src/lib/tree-select.tsx +5 -17
  39. package/src/lib/upload-dragger.tsx +4 -7
  40. package/src/lib/upload-picture-card.tsx +0 -2
  41. package/src/lib/upload-picture.tsx +0 -2
  42. package/src/lib/upload.tsx +5 -8
@@ -1,3 +1,4 @@
1
+ import { LinkOutlined } from '@ant-design/icons';
1
2
  import { Space, Typography } from 'antd';
2
3
  import cx from 'classnames';
3
4
  import { ValueType } from 'rc-input/lib/interface';
@@ -6,16 +7,24 @@ import { AcInput, AcInputProps } from './input';
6
7
 
7
8
  const CLASS_NAME = 'ac-input-copyable';
8
9
 
10
+ export type AcInputCopyableValueType = 'text' | 'link';
11
+
12
+ export interface AcInputCopyableProps extends AcInputProps {
13
+ valueType?: AcInputCopyableValueType;
14
+ }
15
+
9
16
  interface AcInputCopyableState {
10
17
  value?: ValueType;
11
18
  }
12
19
 
13
- export class AcInputCopyable extends React.Component<AcInputProps, AcInputCopyableState> {
20
+ export class AcInputCopyable extends React.Component<AcInputCopyableProps, AcInputCopyableState> {
14
21
  static displayName = CLASS_NAME;
15
22
  static formSchema = CLASS_NAME;
16
- static defaultProps = {};
23
+ static defaultProps = {
24
+ valueType: 'text',
25
+ };
17
26
 
18
- constructor(props) {
27
+ constructor(props: AcInputCopyableProps) {
19
28
  super(props);
20
29
  this.state = {
21
30
  value: props.value || '',
@@ -27,6 +36,17 @@ export class AcInputCopyable extends React.Component<AcInputProps, AcInputCopyab
27
36
  return <Typography.Text copyable={{ text: String(value) }} />;
28
37
  }
29
38
 
39
+ get linkView() {
40
+ const { value } = this.state;
41
+ if (!value) return null;
42
+ return (
43
+ <LinkOutlined
44
+ onClick={() => window.open(String(value), '_blank')}
45
+ style={{ cursor: 'pointer', fontSize: 14 }}
46
+ />
47
+ );
48
+ }
49
+
30
50
  shouldComponentUpdate(props: Readonly<AcInputProps>): boolean {
31
51
  const { value } = props;
32
52
  if (value !== this.props.value) this.setState({ value });
@@ -41,16 +61,18 @@ export class AcInputCopyable extends React.Component<AcInputProps, AcInputCopyab
41
61
  };
42
62
 
43
63
  render() {
44
- const { onChange, className, ...rest } = this.props;
64
+ const { onChange, className, valueType = 'text', ...rest } = this.props;
65
+
45
66
  return (
46
67
  <Space.Compact className={cx(CLASS_NAME, className)}>
47
68
  <AcInput onChange={this.handleInputChange} {...rest} />
48
69
  <Space.Addon>{this.copyView}</Space.Addon>
70
+ {valueType === 'link' && <Space.Addon>{this.linkView}</Space.Addon>}
49
71
  </Space.Compact>
50
72
  );
51
73
  }
52
74
  }
53
75
 
54
- export const AcInputCopyableFc = (props: AcInputProps) => {
76
+ export const AcInputCopyableFc = (props: AcInputCopyableProps) => {
55
77
  return <AcInputCopyable {...props} />;
56
78
  };
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { InputNumber, InputNumberProps } from 'antd';
4
2
  import cx from 'classnames';
3
+ import React from 'react';
5
4
 
6
5
  const CLASS_NAME = 'ac-input-number';
7
6
  type StdEventTarget = { target: { value: any } };
@@ -16,9 +15,7 @@ export type AcInputNumberProps = {
16
15
  export class AcInputNumber extends React.Component<AcInputNumberProps> {
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 = {
24
21
  value: this.props.value,
@@ -34,7 +31,7 @@ export class AcInputNumber extends React.Component<AcInputNumberProps> {
34
31
  const { onChange } = this.props;
35
32
  const target = { value: inEvent };
36
33
  this.setState(target);
37
- onChange!({ target });
34
+ onChange?.({ target });
38
35
  };
39
36
 
40
37
  render() {
@@ -54,5 +51,3 @@ export class AcInputNumber extends React.Component<AcInputNumberProps> {
54
51
  export const AcInputNumberFc = (props: AcInputNumberProps) => {
55
52
  return <AcInputNumber {...props} />;
56
53
  };
57
-
58
-
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Tag } from 'antd';
4
2
  import cx from 'classnames';
5
3
  import fde from 'fast-deep-equal';
4
+ import React from 'react';
6
5
 
7
6
  const CLASS_NAME = 'ac-input-tags';
8
7
  const TRIGGER_KEYS = ['Tab', 'Enter', 'Space'];
@@ -30,7 +29,6 @@ export class AcInputTags extends React.Component<AcInputTagsProps, State> {
30
29
  static defaultProps = {
31
30
  items: [],
32
31
  disabled: false,
33
- onChange: noop,
34
32
  };
35
33
 
36
34
  inputRef = React.createRef<HTMLInputElement>();
@@ -96,7 +94,7 @@ export class AcInputTags extends React.Component<AcInputTagsProps, State> {
96
94
  const { onChange } = this.props;
97
95
  this.setState({ items: (inItems || []).slice(0) }, () => {
98
96
  this.inputRef.current?.focus();
99
- onChange!({ target: { value: inItems } });
97
+ onChange?.({ target: { value: inItems } });
100
98
  });
101
99
  };
102
100
 
@@ -142,4 +140,3 @@ export class AcInputTags extends React.Component<AcInputTagsProps, State> {
142
140
  export const AcInputTagsFc = (props: AcInputTagsProps) => {
143
141
  return <AcInputTags {...props} />;
144
142
  };
145
-
@@ -1,5 +1,4 @@
1
1
  import { LockOutlined, UnlockOutlined } from '@ant-design/icons';
2
- import noop from '@jswork/noop';
3
2
  import { Button, Input, InputProps, Space } from 'antd';
4
3
  import cx from 'classnames';
5
4
  import { nanoid } from 'nanoid';
@@ -22,7 +21,6 @@ export class AcInputToken extends React.Component<AcInputTokenProps> {
22
21
  static displayName = CLASS_NAME;
23
22
  static formSchema = CLASS_NAME;
24
23
  static defaultProps = {
25
- onChange: noop,
26
24
  autoComplete: false,
27
25
  labelCreate: '生成Token',
28
26
  labelRemove: '去掉Token',
@@ -81,7 +79,7 @@ export class AcInputToken extends React.Component<AcInputTokenProps> {
81
79
  const { onChange } = this.props;
82
80
  const target = { value: inValue };
83
81
  this.setState(target);
84
- onChange!({ target });
82
+ onChange?.({ target });
85
83
  };
86
84
 
87
85
  render() {
package/src/lib/input.tsx CHANGED
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Input, InputProps } from 'antd';
4
2
  import cx from 'classnames';
3
+ import React from 'react';
5
4
 
6
5
  const CLASS_NAME = 'ac-input';
7
6
  type StdEventTarget = { target: { value: any } };
@@ -17,7 +16,6 @@ export class AcInput extends React.Component<AcInputProps> {
17
16
  static displayName = CLASS_NAME;
18
17
  static formSchema = CLASS_NAME;
19
18
  static defaultProps = {
20
- onChange: noop,
21
19
  autoComplete: false,
22
20
  };
23
21
 
@@ -34,7 +32,7 @@ export class AcInput extends React.Component<AcInputProps> {
34
32
  const { value } = inEvent.target;
35
33
  const target = { value };
36
34
  this.setState(target);
37
- onChange!({ target });
35
+ onChange?.({ target });
38
36
  };
39
37
 
40
38
  get complete() {
@@ -60,4 +58,3 @@ export class AcInput extends React.Component<AcInputProps> {
60
58
  export const AcInputFc = (props: AcInputProps) => {
61
59
  return <AcInput {...props} />;
62
60
  };
63
-
@@ -1,8 +1,7 @@
1
- import noop from '@jswork/noop';
2
1
  import ReactList from '@jswork/react-list';
3
2
  import cx from 'classnames';
4
- import React, { Component, HTMLAttributes } from 'react';
5
3
  import deepEqual from 'fast-deep-equal';
4
+ import React, { Component, HTMLAttributes } from 'react';
6
5
 
7
6
  const CLASS_NAME = 'ac-interactive-list';
8
7
 
@@ -66,11 +65,6 @@ class ReactInteractiveList extends Component<ReactInteractiveListProps, ReactInt
66
65
  min: 0,
67
66
  max: 10,
68
67
  items: [],
69
- template: noop,
70
- templateCreate: noop,
71
- templateDefault: noop,
72
- onChange: noop,
73
- onError: noop
74
68
  };
75
69
 
76
70
  get length() {
@@ -1,4 +1,3 @@
1
- import noop from '@jswork/noop';
2
1
  import cx from 'classnames';
3
2
  import React from 'react';
4
3
  import { AcInput } from './input';
@@ -53,8 +52,6 @@ export class AcPreSelect extends React.Component<AcPreSelectProps> {
53
52
  static formSchema = CLASS_NAME;
54
53
  static version = '__VERSION__';
55
54
  static defaultProps = {
56
- onChange: noop,
57
- onSearch: noop,
58
55
  searchable: false,
59
56
  };
60
57
 
@@ -1,8 +1,7 @@
1
- import React, { HTMLAttributes } from 'react';
2
1
  import ReactList from '@jswork/react-list';
3
- import noop from '@jswork/noop';
4
2
  import { Radio, RadioGroupProps } from 'antd';
5
3
  import cx from 'classnames';
4
+ import React, { HTMLAttributes } from 'react';
6
5
  import { radioKv } from '../tpls/kv';
7
6
 
8
7
  const CLASS_NAME = 'ac-radio-group';
@@ -20,7 +19,8 @@ export type AcRadioGroupProps = {
20
19
  template?: TemplateCallback;
21
20
  templateOptions?: any;
22
21
  buttonStyle?: 'solid' | 'outline';
23
- } & RadioGroupProps & HTMLAttributes<any>;
22
+ } & RadioGroupProps &
23
+ HTMLAttributes<any>;
24
24
 
25
25
  export class AcRadioGroup extends React.Component<AcRadioGroupProps> {
26
26
  static displayName = CLASS_NAME;
@@ -28,8 +28,6 @@ export class AcRadioGroup extends React.Component<AcRadioGroupProps> {
28
28
  static defaultProps = {
29
29
  items: [],
30
30
  template: radioKv,
31
- onChange: noop,
32
- onSearch: noop,
33
31
  };
34
32
 
35
33
  get templateCallback() {
@@ -50,8 +48,8 @@ export class AcRadioGroup extends React.Component<AcRadioGroupProps> {
50
48
  const { value } = inEvent.target;
51
49
  const target = { value };
52
50
  this.setState(target);
53
- onChange!({ target });
54
- onSearch!({ target });
51
+ onChange?.({ target });
52
+ onSearch?.({ target });
55
53
  };
56
54
 
57
55
  render() {
@@ -69,4 +67,3 @@ export class AcRadioGroup extends React.Component<AcRadioGroupProps> {
69
67
  export const AcRadioGroupFc = (props: AcRadioGroupProps) => {
70
68
  return <AcRadioGroup {...props} />;
71
69
  };
72
-
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { DatePicker } from 'antd';
2
+ import { RangePickerProps } from 'antd/es/date-picker';
4
3
  import cx from 'classnames';
5
4
  import moment from 'dayjs';
6
- import { RangePickerProps } from 'antd/es/date-picker';
5
+ import React from 'react';
7
6
 
8
7
  const CLASS_NAME = 'ac-range-picker';
9
8
  const STD_FORMAT = 'YYYY-MM-DD HH:mm:ss';
@@ -23,13 +22,12 @@ export class AcRangePicker extends React.Component<AcRangePickerProps> {
23
22
  static displayName = CLASS_NAME;
24
23
  static formSchema = CLASS_NAME;
25
24
  static defaultProps = {
26
- onChange: noop,
27
25
  format: STD_FORMAT,
28
26
  };
29
27
 
30
28
  handleChange = (inEvent) => {
31
29
  const { onChange } = this.props;
32
- onChange!({ target: { value: this.stringify(inEvent) } });
30
+ onChange?.({ target: { value: this.stringify(inEvent) } });
33
31
  };
34
32
 
35
33
  parse = (inValue) => {
@@ -49,11 +47,7 @@ export class AcRangePicker extends React.Component<AcRangePickerProps> {
49
47
  if (value) props['value'] = this.parse(value);
50
48
 
51
49
  return (
52
- <RangePicker
53
- className={cx(CLASS_NAME, className)}
54
- onChange={this.handleChange}
55
- {...props}
56
- />
50
+ <RangePicker className={cx(CLASS_NAME, className)} onChange={this.handleChange} {...props} />
57
51
  );
58
52
  }
59
53
  }
@@ -61,5 +55,3 @@ export class AcRangePicker extends React.Component<AcRangePickerProps> {
61
55
  export const AcRangePickerFc = (props: AcRangePickerProps) => {
62
56
  return <AcRangePicker {...props} />;
63
57
  };
64
-
65
-
package/src/lib/rate.tsx CHANGED
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Rate, RateProps } from 'antd';
4
2
  import cx from 'classnames';
3
+ import React from 'react';
5
4
 
6
5
  const CLASS_NAME = 'ac-rate';
7
6
  type StdEventTarget = { target: { value: any } };
@@ -16,28 +15,19 @@ export type AcRateProps = {
16
15
  export class AcRate extends React.Component<AcRateProps> {
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
  handleChange = (inEvent) => {
24
21
  const { onChange } = this.props;
25
- onChange!({ target: { value: inEvent } });
22
+ onChange?.({ target: { value: inEvent } });
26
23
  };
27
24
 
28
25
  render() {
29
26
  const { className, value, onChange, ...props } = this.props;
30
- return (
31
- <Rate
32
- className={cx(CLASS_NAME, className)}
33
- onChange={this.handleChange}
34
- {...props}
35
- />
36
- );
27
+ return <Rate className={cx(CLASS_NAME, className)} onChange={this.handleChange} {...props} />;
37
28
  }
38
29
  }
39
30
 
40
31
  export const AcRateFc = (props: AcRateProps) => {
41
32
  return <AcRate {...props} />;
42
33
  };
43
-
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import noop from '@jswork/noop';
3
2
  import { Input } from 'antd';
4
3
  import cx from 'classnames';
5
4
  import { SearchProps } from 'antd/es/input';
@@ -19,8 +18,6 @@ export class AcSearch extends React.Component<AcSearchProps> {
19
18
  static displayName = CLASS_NAME;
20
19
  static formSchema = CLASS_NAME;
21
20
  static defaultProps = {
22
- onChange: noop,
23
- onSearch: noop,
24
21
  autoComplete: false,
25
22
  placeholder: '输入关键字搜索',
26
23
  };
@@ -31,7 +28,7 @@ export class AcSearch extends React.Component<AcSearchProps> {
31
28
 
32
29
  handleSearch = (inEvent) => {
33
30
  const { onSearch } = this.props;
34
- onSearch!({ target: { value: inEvent } });
31
+ onSearch?.({ target: { value: inEvent } });
35
32
  };
36
33
 
37
34
  render() {
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
1
  import ReactList from '@jswork/react-list';
3
- import noop from '@jswork/noop';
4
2
  import { Select, SelectProps } from 'antd';
5
3
  import cx from 'classnames';
6
- import { selectKv, kv as KvTmpl } from '../tpls/kv';
4
+ import React from 'react';
5
+ import { kv as KvTmpl, selectKv } from '../tpls/kv';
7
6
 
8
7
  const CLASS_NAME = 'ac-select';
9
8
  const DEFAULT_KV = {
@@ -32,8 +31,6 @@ export class AcSelect extends React.Component<AcSelectProps> {
32
31
  items: [],
33
32
  kv: DEFAULT_KV,
34
33
  template: selectKv,
35
- onChange: noop,
36
- onSearch: noop,
37
34
  };
38
35
 
39
36
  state = {
@@ -54,8 +51,8 @@ export class AcSelect extends React.Component<AcSelectProps> {
54
51
  const target = { value: inValue };
55
52
  const stdEvent: StdEventTarget = { target: { value: inValue } };
56
53
  this.setState(target, () => {
57
- onChange!(stdEvent);
58
- onSearch!(stdEvent);
54
+ onChange?.(stdEvent);
55
+ onSearch?.(stdEvent);
59
56
  });
60
57
  };
61
58
 
@@ -92,4 +89,3 @@ export class AcSelect extends React.Component<AcSelectProps> {
92
89
  export const AcSelectFc = (props: AcSelectProps) => {
93
90
  return <AcSelect {...props} />;
94
91
  };
95
-
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Slider } from 'antd';
4
- import cx from 'classnames';
5
2
  import { SliderRangeProps } from 'antd/es/slider';
3
+ import cx from 'classnames';
4
+ import React from 'react';
6
5
 
7
6
  const CLASS_NAME = 'ac-slider-range';
8
7
  type StdEventTarget = { target: { value: any } };
@@ -17,13 +16,11 @@ export type AcSliderRangeProps = {
17
16
  export class AcSliderRange extends React.Component<AcSliderRangeProps> {
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
  handleChange = (inEvent) => {
25
22
  const { onChange } = this.props;
26
- onChange!({ target: { value: inEvent } });
23
+ onChange?.({ target: { value: inEvent } });
27
24
  };
28
25
 
29
26
  render() {
@@ -42,5 +39,3 @@ export class AcSliderRange extends React.Component<AcSliderRangeProps> {
42
39
  export const AcSliderRangeFc = (props: AcSliderRangeProps) => {
43
40
  return <AcSliderRange {...props} />;
44
41
  };
45
-
46
-
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Slider, SliderSingleProps } from 'antd';
4
2
  import cx from 'classnames';
3
+ import React from 'react';
5
4
 
6
5
  const CLASS_NAME = 'ac-slider';
7
6
  type StdEventTarget = { target: { value: any } };
@@ -15,29 +14,19 @@ export type AcSliderProps = {
15
14
  export class AcSlider extends React.Component<AcSliderProps> {
16
15
  static displayName = CLASS_NAME;
17
16
  static formSchema = CLASS_NAME;
18
- static defaultProps = {
19
- onChange: noop
20
- };
17
+ static defaultProps = {};
21
18
 
22
19
  handleChange = (inEvent) => {
23
20
  const { onChange } = this.props;
24
- onChange!({ target: { value: inEvent } });
21
+ onChange?.({ target: { value: inEvent } });
25
22
  };
26
23
 
27
24
  render() {
28
25
  const { className, value, onChange, ...props } = this.props;
29
- return (
30
- <Slider
31
- className={cx(CLASS_NAME, className)}
32
- onChange={this.handleChange}
33
- {...props}
34
- />
35
- );
26
+ return <Slider className={cx(CLASS_NAME, className)} onChange={this.handleChange} {...props} />;
36
27
  }
37
28
  }
38
29
 
39
30
  export const AcSliderFc = (props: AcSliderProps) => {
40
31
  return <AcSlider {...props} />;
41
32
  };
42
-
43
-
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Switch, SwitchProps } from 'antd';
4
2
  import cx from 'classnames';
3
+ import React from 'react';
5
4
 
6
5
  const CLASS_NAME = 'ac-switch';
7
6
  type StdEventTarget = { target: { value: any } };
@@ -16,9 +15,7 @@ export type AcSwitchProps = {
16
15
  export class AcSwitch extends React.Component<AcSwitchProps> {
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 = {
24
21
  value: Boolean(this.props.value),
@@ -33,7 +30,7 @@ export class AcSwitch extends React.Component<AcSwitchProps> {
33
30
  handleChange = (value) => {
34
31
  const { onChange } = this.props;
35
32
  const target = { value };
36
- this.setState(target, () => onChange!({ target }));
33
+ this.setState(target, () => onChange?.({ target }));
37
34
  };
38
35
 
39
36
  render() {
@@ -54,4 +51,3 @@ export class AcSwitch extends React.Component<AcSwitchProps> {
54
51
  export const AcSwitchFc = React.forwardRef<AcSwitch, AcSwitchProps>((props, ref) => {
55
52
  return <AcSwitch {...props} ref={ref} />;
56
53
  });
57
-
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Input } from 'antd';
4
- import cx from 'classnames';
5
2
  import { TextAreaProps } from 'antd/es/input';
3
+ import cx from 'classnames';
4
+ import React from 'react';
6
5
 
7
6
  const CLASS_NAME = 'ac-textarea';
8
7
  const TextArea = Input.TextArea;
@@ -18,9 +17,7 @@ export type AcTextareaProps = {
18
17
  export class AcTextarea extends React.Component<AcTextareaProps> {
19
18
  static displayName = CLASS_NAME;
20
19
  static formSchema = CLASS_NAME;
21
- static defaultProps = {
22
- onChange: noop,
23
- };
20
+ static defaultProps = {};
24
21
 
25
22
  render() {
26
23
  const { className, defaultValue, ...props } = this.props;
@@ -31,4 +28,3 @@ export class AcTextarea extends React.Component<AcTextareaProps> {
31
28
  export const AcTextareaFc = (props: AcTextareaProps) => {
32
29
  return <AcTextarea {...props} />;
33
30
  };
34
-
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { TimePicker, TimePickerProps } from 'antd';
4
2
  import cx from 'classnames';
5
3
  import dayjs from 'dayjs';
4
+ import React from 'react';
6
5
 
7
6
  const CLASS_NAME = 'ac-time-picker';
8
7
  const STD_FORMAT = 'HH:mm:ss';
@@ -20,14 +19,13 @@ export class AcTimePicker extends React.Component<AcTimePickerProps> {
20
19
  static displayName = CLASS_NAME;
21
20
  static formSchema = CLASS_NAME;
22
21
  static defaultProps = {
23
- onChange: noop,
24
22
  format: STD_FORMAT,
25
23
  };
26
24
 
27
25
  handleChange = (inEvent) => {
28
26
  const value = this.stringify(inEvent);
29
27
  const { onChange } = this.props;
30
- onChange!({ target: { value } });
28
+ onChange?.({ target: { value } });
31
29
  };
32
30
 
33
31
  parse = (inValue) => {
@@ -68,4 +66,3 @@ export class AcTimePicker extends React.Component<AcTimePickerProps> {
68
66
  export const AcTimePickerFc = (props: AcTimePickerProps) => {
69
67
  return <AcTimePicker {...props} />;
70
68
  };
71
-
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- import noop from '@jswork/noop';
3
1
  import { Transfer, TransferProps } from 'antd';
4
2
  import cx from 'classnames';
3
+ import React from 'react';
5
4
  import { transferLabel } from '../tpls/transfer';
6
5
 
7
6
  const CLASS_NAME = 'ac-transfer';
@@ -23,7 +22,6 @@ export class AcTransfer extends React.Component<AcTransferProps> {
23
22
  static defaultProps = {
24
23
  items: [],
25
24
  template: transferLabel,
26
- onChange: noop
27
25
  };
28
26
 
29
27
  get templateCallback(): any {
@@ -32,7 +30,7 @@ export class AcTransfer extends React.Component<AcTransferProps> {
32
30
  }
33
31
 
34
32
  state = {
35
- value: this.props.value
33
+ value: this.props.value,
36
34
  };
37
35
 
38
36
  shouldComponentUpdate(nextProps: Readonly<AcTransferProps>): boolean {
@@ -47,7 +45,7 @@ export class AcTransfer extends React.Component<AcTransferProps> {
47
45
  handleChange = (inEvent) => {
48
46
  const { onChange } = this.props;
49
47
  const target = { value: inEvent };
50
- this.setState(target, () => onChange!({ target }));
48
+ this.setState(target, () => onChange?.({ target }));
51
49
  };
52
50
 
53
51
  render() {
@@ -72,4 +70,3 @@ export class AcTransfer extends React.Component<AcTransferProps> {
72
70
  export const AcTransferFc = (props: AcTransferProps) => {
73
71
  return <AcTransfer {...props} />;
74
72
  };
75
-
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import noop from '@jswork/noop';
4
- import { TreeSelect, TreeSelectProps } from 'antd';
5
1
  import '@jswork/next-tree-walk';
2
+ import { TreeSelect, TreeSelectProps } from 'antd';
3
+ import cx from 'classnames';
4
+ import React from 'react';
6
5
  import { treeSelectKv } from '../tpls/kv';
7
6
 
8
7
  const CLASS_NAME = 'ac-tree-select';
@@ -26,7 +25,6 @@ export class AcTreeSelect extends React.Component<AcTreeSelectProps> {
26
25
  items: [],
27
26
  template: treeSelectKv,
28
27
  itemsKey: 'children',
29
- onChange: noop,
30
28
  };
31
29
 
32
30
  get childView() {
@@ -36,19 +34,11 @@ export class AcTreeSelect extends React.Component<AcTreeSelectProps> {
36
34
 
37
35
  handleChange = (inValue) => {
38
36
  const { onChange } = this.props;
39
- onChange!({ target: { value: inValue } });
37
+ onChange?.({ target: { value: inValue } });
40
38
  };
41
39
 
42
40
  render() {
43
- const {
44
- className,
45
- items,
46
- itemsKey,
47
- template,
48
- treeData,
49
- onChange,
50
- ...props
51
- } = this.props;
41
+ const { className, items, itemsKey, template, treeData, onChange, ...props } = this.props;
52
42
 
53
43
  return (
54
44
  <TreeSelect
@@ -66,5 +56,3 @@ export class AcTreeSelect extends React.Component<AcTreeSelectProps> {
66
56
  export const AcTreeSelectFc = (props: AcTreeSelectProps) => {
67
57
  return <AcTreeSelect {...props} />;
68
58
  };
69
-
70
-