feffery_antd_components 0.1.16 → 0.2.0-rc0

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 (148) hide show
  1. package/DESCRIPTION +1 -1
  2. package/NAMESPACE +1 -0
  3. package/Project.toml +1 -1
  4. package/README-en_US.md +51 -0
  5. package/README.md +14 -5
  6. package/feffery_antd_components/AntdAlert.py +1 -1
  7. package/feffery_antd_components/AntdAnchor.py +1 -1
  8. package/feffery_antd_components/AntdAvatar.py +1 -1
  9. package/feffery_antd_components/AntdBackTop.py +1 -1
  10. package/feffery_antd_components/AntdButton.py +10 -6
  11. package/feffery_antd_components/AntdCarousel.py +1 -1
  12. package/feffery_antd_components/AntdCascader.py +9 -5
  13. package/feffery_antd_components/AntdCol.py +1 -1
  14. package/feffery_antd_components/AntdContent.py +1 -1
  15. package/feffery_antd_components/AntdCustomSkeleton.py +1 -1
  16. package/feffery_antd_components/AntdDraggerUpload.py +1 -1
  17. package/feffery_antd_components/AntdDrawer.py +1 -1
  18. package/feffery_antd_components/AntdFooter.py +1 -1
  19. package/feffery_antd_components/AntdHeader.py +1 -1
  20. package/feffery_antd_components/AntdIcon.py +8 -4
  21. package/feffery_antd_components/AntdImage.py +1 -1
  22. package/feffery_antd_components/AntdInput.py +16 -8
  23. package/feffery_antd_components/AntdInputNumber.py +11 -7
  24. package/feffery_antd_components/AntdLayout.py +1 -1
  25. package/feffery_antd_components/AntdModal.py +10 -4
  26. package/feffery_antd_components/AntdParagraph.py +1 -1
  27. package/feffery_antd_components/AntdPasteImage.py +1 -1
  28. package/feffery_antd_components/AntdPopupCard.py +72 -0
  29. package/feffery_antd_components/AntdRibbon.py +3 -3
  30. package/feffery_antd_components/AntdRow.py +1 -1
  31. package/feffery_antd_components/AntdSegmented.py +5 -3
  32. package/feffery_antd_components/AntdSegmentedColoring.py +7 -3
  33. package/feffery_antd_components/AntdSider.py +1 -1
  34. package/feffery_antd_components/AntdSkeleton.py +1 -1
  35. package/feffery_antd_components/AntdSpace.py +1 -1
  36. package/feffery_antd_components/AntdSpin.py +2 -2
  37. package/feffery_antd_components/AntdStatistic.py +1 -1
  38. package/feffery_antd_components/AntdTabPane.py +1 -1
  39. package/feffery_antd_components/AntdTable.py +55 -7
  40. package/feffery_antd_components/AntdTag.py +1 -1
  41. package/feffery_antd_components/AntdText.py +1 -1
  42. package/feffery_antd_components/AntdTitle.py +1 -1
  43. package/feffery_antd_components/AntdTree.py +6 -4
  44. package/feffery_antd_components/AntdTreeSelect.py +8 -6
  45. package/feffery_antd_components/_imports_.py +2 -0
  46. package/feffery_antd_components/feffery_antd_components.min.js +1 -1
  47. package/feffery_antd_components/metadata.json +1042 -93
  48. package/feffery_antd_components/package-info.json +6 -2
  49. package/git-operations.md +0 -1
  50. package/images//345/233/275/351/231/205/345/214/226/347/244/272/344/276/213.png +0 -0
  51. package/package.json +6 -2
  52. package/setup.py +0 -1
  53. package/src/FefferyAntdComponents.jl +4 -3
  54. package/src/jl/'feffery'_antdalert.jl +1 -1
  55. package/src/jl/'feffery'_antdanchor.jl +1 -1
  56. package/src/jl/'feffery'_antdavatar.jl +1 -1
  57. package/src/jl/'feffery'_antdbacktop.jl +1 -1
  58. package/src/jl/'feffery'_antdbutton.jl +4 -2
  59. package/src/jl/'feffery'_antdcarousel.jl +1 -1
  60. package/src/jl/'feffery'_antdcascader.jl +4 -2
  61. package/src/jl/'feffery'_antdcol.jl +1 -1
  62. package/src/jl/'feffery'_antdcontent.jl +1 -1
  63. package/src/jl/'feffery'_antdcustomskeleton.jl +1 -1
  64. package/src/jl/'feffery'_antddraggerupload.jl +1 -1
  65. package/src/jl/'feffery'_antddrawer.jl +1 -1
  66. package/src/jl/'feffery'_antdfooter.jl +1 -1
  67. package/src/jl/'feffery'_antdheader.jl +1 -1
  68. package/src/jl/'feffery'_antdicon.jl +4 -2
  69. package/src/jl/'feffery'_antdimage.jl +1 -1
  70. package/src/jl/'feffery'_antdinput.jl +8 -4
  71. package/src/jl/'feffery'_antdinputnumber.jl +5 -3
  72. package/src/jl/'feffery'_antdlayout.jl +1 -1
  73. package/src/jl/'feffery'_antdmodal.jl +5 -2
  74. package/src/jl/'feffery'_antdparagraph.jl +1 -1
  75. package/src/jl/'feffery'_antdpasteimage.jl +1 -1
  76. package/src/jl/'feffery'_antdpopupcard.jl +43 -0
  77. package/src/jl/'feffery'_antdribbon.jl +1 -1
  78. package/src/jl/'feffery'_antdrow.jl +1 -1
  79. package/src/jl/'feffery'_antdsegmented.jl +5 -4
  80. package/src/jl/'feffery'_antdsegmentedcoloring.jl +3 -1
  81. package/src/jl/'feffery'_antdsider.jl +1 -1
  82. package/src/jl/'feffery'_antdskeleton.jl +1 -1
  83. package/src/jl/'feffery'_antdspace.jl +1 -1
  84. package/src/jl/'feffery'_antdspin.jl +2 -2
  85. package/src/jl/'feffery'_antdstatistic.jl +1 -1
  86. package/src/jl/'feffery'_antdtable.jl +31 -4
  87. package/src/jl/'feffery'_antdtabpane.jl +1 -1
  88. package/src/jl/'feffery'_antdtag.jl +1 -1
  89. package/src/jl/'feffery'_antdtext.jl +1 -1
  90. package/src/jl/'feffery'_antdtitle.jl +1 -1
  91. package/src/jl/'feffery'_antdtree.jl +3 -2
  92. package/src/jl/'feffery'_antdtreeselect.jl +3 -2
  93. package/src/lib/components/AntdAlert.react.js +16 -3
  94. package/src/lib/components/AntdAnchor.react.js +79 -70
  95. package/src/lib/components/AntdAvatar.react.js +21 -4
  96. package/src/lib/components/AntdBackTop.react.js +11 -2
  97. package/src/lib/components/AntdButton.react.js +82 -54
  98. package/src/lib/components/AntdCarousel.react.js +11 -2
  99. package/src/lib/components/AntdCascader.react.js +128 -82
  100. package/src/lib/components/AntdCheckboxGroup.react.js +2 -0
  101. package/src/lib/components/AntdDrawer.react.js +11 -2
  102. package/src/lib/components/AntdIcon.react.js +70 -37
  103. package/src/lib/components/AntdImage.react.js +16 -3
  104. package/src/lib/components/AntdInput.react.js +212 -175
  105. package/src/lib/components/AntdInputNumber.react.js +12 -2
  106. package/src/lib/components/AntdModal.react.js +22 -1
  107. package/src/lib/components/AntdPasteImage.react.js +11 -2
  108. package/src/lib/components/AntdPopupCard.react.js +241 -0
  109. package/src/lib/components/AntdRibbon.react.js +1 -1
  110. package/src/lib/components/AntdSegmented.react.js +19 -4
  111. package/src/lib/components/AntdSegmentedColoring.react.js +107 -82
  112. package/src/lib/components/AntdSelect.react.js +5 -0
  113. package/src/lib/components/AntdSpace.react.js +21 -4
  114. package/src/lib/components/AntdSpin.react.js +21 -6
  115. package/src/lib/components/AntdStatistic.react.js +11 -2
  116. package/src/lib/components/AntdTable.react.js +252 -18
  117. package/src/lib/components/AntdTag.react.js +12 -2
  118. package/src/lib/components/AntdTree.react.js +182 -136
  119. package/src/lib/components/AntdTreeSelect.react.js +144 -101
  120. package/src/lib/components/grid/AntdCol.react.js +11 -2
  121. package/src/lib/components/grid/AntdRow.react.js +12 -3
  122. package/src/lib/components/layout/AntdContent.react.js +11 -2
  123. package/src/lib/components/layout/AntdFooter.react.js +11 -2
  124. package/src/lib/components/layout/AntdHeader.react.js +11 -2
  125. package/src/lib/components/layout/AntdLayout.react.js +11 -2
  126. package/src/lib/components/layout/AntdSider.react.js +11 -2
  127. package/src/lib/components/skeleton/AntdCustomSkeleton.react.js +11 -3
  128. package/src/lib/components/skeleton/AntdSkeleton.react.js +11 -2
  129. package/src/lib/components/styles.css +4 -0
  130. package/src/lib/components/tabs/AntdTabPane.react.js +11 -2
  131. package/src/lib/components/typography/AntdParagraph.react.js +11 -2
  132. package/src/lib/components/typography/AntdText.react.js +11 -2
  133. package/src/lib/components/typography/AntdTitle.react.js +11 -2
  134. package/src/lib/components/upload/AntdDraggerUpload.react.js +11 -2
  135. package/src/lib/components/utils.js +17 -2
  136. package/src/lib/index.js +24 -1
  137. package/tests/DebounceTest/app.py +89 -0
  138. package/tests/SegmentedColoringTest/app.py +106 -0
  139. package/tests/TableCellClickTest/app.py +67 -0
  140. package/tests/TableCellRowMergeTest/app.py +88 -0
  141. package/tests/TableEmptyContentTest/app.py +37 -0
  142. package/tests/TableMiniChartAdvanceTest/app.py +85 -0
  143. package/tests/TreeNodeStyleTest/app.py +73 -0
  144. package/tests/TreeTest/app.py +96 -0
  145. package/tests/VirtualClassNameTest/app.py +49 -0
  146. package/usage.py +125 -62
  147. package/webpack.config.js +45 -11
  148. package/tests/UploadTest/app.py +0 -70
@@ -1,6 +1,8 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Carousel } from 'antd';
4
+ import { useCss } from 'react-use';
5
+ import { isString } from 'lodash';
4
6
  import 'antd/dist/antd.css';
5
7
 
6
8
  // 定义走马灯组件AntdCarousel,api参数参考https://ant.design/components/carousel-cn/
@@ -24,7 +26,11 @@ export default class AntdCarousel extends Component {
24
26
  return (
25
27
  <Carousel
26
28
  id={id}
27
- className={className}
29
+ className={
30
+ isString(className) ?
31
+ className :
32
+ useCss(className)
33
+ }
28
34
  style={style}
29
35
  key={key}
30
36
  autoplay={autoplay}
@@ -48,7 +54,10 @@ AntdCarousel.propTypes = {
48
54
  children: PropTypes.node,
49
55
 
50
56
  // css类名
51
- className: PropTypes.string,
57
+ className: PropTypes.oneOfType([
58
+ PropTypes.string,
59
+ PropTypes.object
60
+ ]),
52
61
 
53
62
  // 自定义css字典
54
63
  style: PropTypes.object,
@@ -1,92 +1,107 @@
1
- import React, { Component } from 'react';
1
+ import { useEffect, useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Cascader, ConfigProvider } from 'antd';
4
4
  import { str2Locale } from './locales.react';
5
+ import { flatToTree } from './utils';
5
6
  import 'antd/dist/antd.css';
6
7
 
7
- // 定义级联选择组件AntdCascader,api参数参考https://ant.design/components/cascader-cn/
8
- export default class AntdCascader extends Component {
8
+ const { SHOW_CHILD, SHOW_PARENT } = Cascader;
9
9
 
10
- constructor(props) {
11
- super(props)
12
- if (!props.value) {
13
- props.setProps({ value: props.defaultValue })
14
- }
15
- }
10
+ const str2ShowCheckedStrategy = new Map([
11
+ ['show-child', SHOW_CHILD],
12
+ ['show-parent', SHOW_PARENT]
13
+ ])
16
14
 
17
- render() {
18
- // 取得必要属性或参数
19
- let {
20
- id,
21
- style,
22
- className,
23
- key,
24
- locale,
25
- options,
26
- changeOnSelect,
27
- size,
28
- bordered,
29
- disabled,
30
- placeholder,
31
- defaultValue,
32
- value,
33
- placement,
34
- maxTagCount,
35
- multiple,
36
- expandTrigger,
37
- status,
38
- allowClear,
39
- setProps,
40
- persistence,
41
- persisted_props,
42
- persistence_type,
43
- loading_state
44
- } = this.props;
45
-
46
-
47
- const filter = (inputValue, path) => {
48
- return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
15
+ // 定义级联选择组件AntdCascader,api参数参考https://ant.design/components/cascader-cn/
16
+ const AntdCascader = (props) => {
17
+ // 取得必要属性或参数
18
+ let {
19
+ id,
20
+ style,
21
+ className,
22
+ key,
23
+ locale,
24
+ options,
25
+ optionsMode,
26
+ changeOnSelect,
27
+ size,
28
+ bordered,
29
+ disabled,
30
+ placeholder,
31
+ defaultValue,
32
+ value,
33
+ placement,
34
+ maxTagCount,
35
+ multiple,
36
+ expandTrigger,
37
+ status,
38
+ allowClear,
39
+ showCheckedStrategy,
40
+ setProps,
41
+ persistence,
42
+ persisted_props,
43
+ persistence_type,
44
+ loading_state
45
+ } = props;
46
+
47
+ useEffect(() => {
48
+ if (!value) {
49
+ setProps({ value: defaultValue })
49
50
  }
51
+ }, [])
50
52
 
51
- const onSelect = (e) => {
52
- setProps({ value: e })
53
- }
53
+ const flatToTreeOptions = useMemo(() => {
54
+ return flatToTree(options);
55
+ }, [options])
56
+
57
+ // 根据optionsMode对options进行预处理
58
+ if (optionsMode === 'flat') {
59
+ options = flatToTreeOptions
60
+ }
54
61
 
55
- // 返回定制化的前端组件
56
- return (
57
- <ConfigProvider locale={str2Locale.get(locale)}>
58
- <Cascader
59
- id={id}
60
- className={className}
61
- style={{ ...{ width: '100%' }, ...style }}
62
- key={key}
63
- options={options}
64
- changeOnSelect={changeOnSelect}
65
- size={size}
66
- bordered={bordered}
67
- disabled={disabled}
68
- placeholder={placeholder}
69
- defaultValue={defaultValue}
70
- value={value}
71
- placement={placement}
72
- maxTagCount={maxTagCount}
73
- multiple={multiple}
74
- persistence={persistence}
75
- persisted_props={persisted_props}
76
- persistence_type={persistence_type}
77
- expandTrigger={expandTrigger}
78
- status={status}
79
- allowClear={allowClear}
80
- showSearch={filter}
81
- onChange={onSelect}
82
- data-dash-is-loading={
83
- (loading_state && loading_state.is_loading) || undefined
84
- }
85
- getPopupContainer={(triggerNode) => triggerNode.parentNode}
86
- />
87
- </ConfigProvider>
88
- );
62
+ const filter = (inputValue, path) => {
63
+ return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
89
64
  }
65
+
66
+ const onSelect = (e) => {
67
+ setProps({ value: e })
68
+ }
69
+
70
+ // 返回定制化的前端组件
71
+ return (
72
+ <ConfigProvider locale={str2Locale.get(locale)}>
73
+ <Cascader
74
+ id={id}
75
+ className={className}
76
+ style={{ ...{ width: '100%' }, ...style }}
77
+ key={key}
78
+ options={options}
79
+ changeOnSelect={changeOnSelect}
80
+ size={size}
81
+ bordered={bordered}
82
+ disabled={disabled}
83
+ placeholder={placeholder}
84
+ defaultValue={defaultValue}
85
+ value={value}
86
+ placement={placement}
87
+ maxTagCount={maxTagCount}
88
+ multiple={multiple}
89
+ persistence={persistence}
90
+ persisted_props={persisted_props}
91
+ persistence_type={persistence_type}
92
+ expandTrigger={expandTrigger}
93
+ status={status}
94
+ allowClear={allowClear}
95
+ showCheckedStrategy={str2ShowCheckedStrategy.get(showCheckedStrategy)}
96
+ showSearch={filter}
97
+ onChange={onSelect}
98
+ data-dash-is-loading={
99
+ (loading_state && loading_state.is_loading) || undefined
100
+ }
101
+ getPopupContainer={(triggerNode) => triggerNode.parentNode}
102
+ />
103
+ </ConfigProvider>
104
+ );
90
105
  }
91
106
 
92
107
  // 定义递归PropTypes
@@ -98,14 +113,31 @@ const PropOptionNodeShape = {
98
113
  label: PropTypes.string.isRequired,
99
114
 
100
115
  // 设置是否禁止选中
101
- disabled: PropTypes.bool,
102
-
116
+ disabled: PropTypes.bool
103
117
  };
104
118
 
105
119
  const PropOptionNode = PropTypes.shape(PropOptionNodeShape);
106
120
  PropOptionNodeShape.children = PropTypes.arrayOf(PropOptionNode);
107
121
  const optionDataPropTypes = PropTypes.arrayOf(PropOptionNode);
108
122
 
123
+ // 定义扁平节点PropTypes
124
+ const PropFlatOptionNodeShape = {
125
+ // 选项对应的值
126
+ value: PropTypes.string.isRequired,
127
+
128
+ // 选项对应显示的文字标题
129
+ label: PropTypes.string.isRequired,
130
+
131
+ // 设置是否禁止选中
132
+ disabled: PropTypes.bool,
133
+
134
+ // 对应当前节点唯一key值
135
+ key: PropTypes.string,
136
+
137
+ // 可选,设置对应节点的父节点key值
138
+ parent: PropTypes.string
139
+ };
140
+
109
141
  // 定义参数或属性
110
142
  AntdCascader.propTypes = {
111
143
  // 组件id
@@ -124,7 +156,13 @@ AntdCascader.propTypes = {
124
156
  locale: PropTypes.oneOf(['zh-cn', 'en-us']),
125
157
 
126
158
  // 组织选项层级结构对应的json数据
127
- options: optionDataPropTypes.isRequired,
159
+ options: PropTypes.oneOfType([
160
+ optionDataPropTypes,
161
+ PropTypes.arrayOf(PropFlatOptionNodeShape)
162
+ ]).isRequired,
163
+
164
+ // 设置options模式,可选的有'tree'、'flat',默认为'tree'
165
+ optionsMode: PropTypes.oneOf(['tree', 'flat']),
128
166
 
129
167
  // 设置是否禁用组件
130
168
  disabled: PropTypes.bool,
@@ -184,6 +222,10 @@ AntdCascader.propTypes = {
184
222
  // 设置是否添加内容清除按钮,默认true
185
223
  allowClear: PropTypes.bool,
186
224
 
225
+ // 设置已选项回填策略,可选的有'show-parent'、'show-children'
226
+ // 默认为'show-parent'
227
+ showCheckedStrategy: PropTypes.oneOf(['show-parent', 'show-children']),
228
+
187
229
  loading_state: PropTypes.shape({
188
230
  /**
189
231
  * Determines if the component is loading or not
@@ -240,5 +282,9 @@ AntdCascader.defaultProps = {
240
282
  changeOnSelect: false,
241
283
  persisted_props: ['value'],
242
284
  persistence_type: 'local',
243
- locale: 'zh-cn'
285
+ locale: 'zh-cn',
286
+ optionsMode: 'tree',
287
+ showCheckedStrategy: 'show-parent'
244
288
  }
289
+
290
+ export default AntdCascader;
@@ -22,6 +22,7 @@ export default class AntdCheckboxGroup extends Component {
22
22
  key,
23
23
  options,
24
24
  value,
25
+ disabled,
25
26
  setProps,
26
27
  persistence,
27
28
  persisted_props,
@@ -42,6 +43,7 @@ export default class AntdCheckboxGroup extends Component {
42
43
  key={key}
43
44
  options={options}
44
45
  value={value}
46
+ disabled={disabled}
45
47
  onChange={onChange}
46
48
  persistence={persistence}
47
49
  persisted_props={persisted_props}
@@ -1,5 +1,7 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { useCss } from 'react-use';
4
+ import { isString } from 'lodash';
3
5
  import zhCN from 'antd/lib/locale/zh_CN';
4
6
  import { Drawer, ConfigProvider } from 'antd';
5
7
  import 'antd/dist/antd.css';
@@ -39,7 +41,11 @@ export default class AntdDrawer extends Component {
39
41
  <ConfigProvider locale={zhCN}>
40
42
  <Drawer
41
43
  id={id}
42
- className={className}
44
+ className={
45
+ isString(className) ?
46
+ className :
47
+ useCss(className)
48
+ }
43
49
  style={containerId ? { ...style, ...{ position: 'absolute' } } : style}
44
50
  key={key}
45
51
  visible={visible}
@@ -74,7 +80,10 @@ AntdDrawer.propTypes = {
74
80
  children: PropTypes.node,
75
81
 
76
82
  // css类名
77
- className: PropTypes.string,
83
+ className: PropTypes.oneOfType([
84
+ PropTypes.string,
85
+ PropTypes.object
86
+ ]),
78
87
 
79
88
  // 自定义css字典
80
89
  style: PropTypes.object,
@@ -1,47 +1,67 @@
1
1
  import { str2Icon } from './icons.react';
2
- import React, { Component } from 'react';
3
2
  import PropTypes from 'prop-types';
3
+ import { useCss } from 'react-use';
4
+ import { isString } from 'lodash';
4
5
  import 'antd/dist/antd.css';
6
+ import { useRequest } from 'ahooks';
5
7
 
6
8
  // 定义图标组件AntdIcon
7
- export default class AntdIcon extends Component {
8
- render() {
9
- // 取得必要属性或参数
10
- let {
11
- id,
12
- className,
13
- icon,
14
- style,
15
- key,
16
- loading_state
17
- } = this.props;
9
+ const AntdIcon = (props) => {
10
+ // 取得必要属性或参数
11
+ let {
12
+ id,
13
+ className,
14
+ icon,
15
+ style,
16
+ key,
17
+ nClicks,
18
+ debounceWait,
19
+ loading_state,
20
+ setProps
21
+ } = props;
18
22
 
19
- if (icon) {
20
- return (
21
- <span id={id}
22
- className={className}
23
- style={
24
- (
25
- icon.startsWith('fc-') ||
26
- icon.startsWith('md-') ||
27
- icon.startsWith('di-') ||
28
- icon.startsWith('bi-') ||
29
- icon.startsWith('bs-') ||
30
- icon.startsWith('gi-')
31
- ) ?
32
- { ...{ verticalAlign: 'middle' }, ...style } :
33
- style
34
- }
35
- key={key}
36
- data-dash-is-loading={
37
- (loading_state && loading_state.is_loading) || undefined
38
- }>
39
- {str2Icon.get(icon)}
40
- </span>
41
- );
23
+ const { run: onClick } = useRequest(
24
+ () => {
25
+ // 更新nClicks
26
+ setProps({ nClicks: nClicks + 1 })
27
+ },
28
+ {
29
+ debounceWait: debounceWait,
30
+ debounceLeading: true,
31
+ manual: true
42
32
  }
43
- return <span />;
33
+ )
34
+
35
+ if (icon) {
36
+ return (
37
+ <span id={id}
38
+ className={
39
+ isString(className) ?
40
+ className :
41
+ useCss(className)
42
+ }
43
+ style={
44
+ (
45
+ icon.startsWith('fc-') ||
46
+ icon.startsWith('md-') ||
47
+ icon.startsWith('di-') ||
48
+ icon.startsWith('bi-') ||
49
+ icon.startsWith('bs-') ||
50
+ icon.startsWith('gi-')
51
+ ) ?
52
+ { ...{ verticalAlign: 'middle' }, ...style } :
53
+ style
54
+ }
55
+ key={key}
56
+ onClick={onClick}
57
+ data-dash-is-loading={
58
+ (loading_state && loading_state.is_loading) || undefined
59
+ }>
60
+ {str2Icon.get(icon)}
61
+ </span>
62
+ );
44
63
  }
64
+ return null;
45
65
  }
46
66
 
47
67
  // 定义参数或属性
@@ -50,7 +70,10 @@ AntdIcon.propTypes = {
50
70
  id: PropTypes.string,
51
71
 
52
72
  // css类名
53
- className: PropTypes.string,
73
+ className: PropTypes.oneOfType([
74
+ PropTypes.string,
75
+ PropTypes.object
76
+ ]),
54
77
 
55
78
  // 用于指定icon类型,
56
79
  icon: PropTypes.string,
@@ -61,6 +84,12 @@ AntdIcon.propTypes = {
61
84
  // 辅助刷新用唯一标识key值
62
85
  key: PropTypes.string,
63
86
 
87
+ // 记录按钮从渲染后开始被点击的次数,默认为0
88
+ nClicks: PropTypes.number,
89
+
90
+ // 用于配置value变化更新的防抖等待时长(单位:毫秒),默认为0
91
+ debounceWait: PropTypes.number,
92
+
64
93
  loading_state: PropTypes.shape({
65
94
  /**
66
95
  * Determines if the component is loading or not
@@ -85,4 +114,8 @@ AntdIcon.propTypes = {
85
114
 
86
115
  // 设置默认参数
87
116
  AntdIcon.defaultProps = {
117
+ nClicks: 0,
118
+ debounceWait: 0
88
119
  }
120
+
121
+ export default AntdIcon;
@@ -1,5 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { useCss } from 'react-use';
4
+ import { isString } from 'lodash';
3
5
  import { Image, ConfigProvider } from 'antd';
4
6
  import { str2Locale } from './locales.react';
5
7
  import 'antd/dist/antd.css';
@@ -33,7 +35,11 @@ const AntdImage = (props) => {
33
35
  <Image
34
36
  id={id}
35
37
  style={style}
36
- className={className}
38
+ className={
39
+ isString(className) ?
40
+ className :
41
+ useCss(className)
42
+ }
37
43
  key={key}
38
44
  preview={{ visible: false }}
39
45
  width={width}
@@ -56,7 +62,11 @@ const AntdImage = (props) => {
56
62
  <ConfigProvider locale={str2Locale.get(locale)}>
57
63
  <Image.PreviewGroup id={id}
58
64
  style={style}
59
- className={className}
65
+ className={
66
+ isString(className) ?
67
+ className :
68
+ useCss(className)
69
+ }
60
70
  key={key}>
61
71
  {src.map(
62
72
  src_ => <Image src={src_} fallback={fallback} width={width} height={height} />
@@ -90,7 +100,10 @@ AntdImage.propTypes = {
90
100
  id: PropTypes.string,
91
101
 
92
102
  // css类名
93
- className: PropTypes.string,
103
+ className: PropTypes.oneOfType([
104
+ PropTypes.string,
105
+ PropTypes.object
106
+ ]),
94
107
 
95
108
  // 自定义css字典
96
109
  style: PropTypes.object,