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
@@ -10,15 +10,16 @@ An AntdTable component.
10
10
  Keyword arguments:
11
11
  - `id` (String; optional)
12
12
  - `bordered` (Bool; optional)
13
+ - `checkedDataIndex` (String; optional)
13
14
  - `className` (String; optional)
14
15
  - `clickedContent` (String; optional)
15
16
  - `columns` (optional): . columns has the following type: Array of lists containing elements 'title', 'dataIndex', 'renderOptions', 'fixed', 'editable', 'align', 'width', 'ellipsis', 'sorter', 'render', 'onCell', 'title_'.
16
17
  Those elements have the following types:
17
18
  - `title` (String; required)
18
19
  - `dataIndex` (String; required)
19
- - `renderOptions` (optional): . renderOptions has the following type: lists containing elements 'renderType', 'renderLinkText', 'renderButtonPopConfirmProps', 'tooltipCustomContent'.
20
+ - `renderOptions` (optional): . renderOptions has the following type: lists containing elements 'renderType', 'renderLinkText', 'renderButtonPopConfirmProps', 'tooltipCustomContent', 'progressOneHundredPercentColor', 'ringProgressFontSize'.
20
21
  Those elements have the following types:
21
- - `renderType` (a value equal to: 'link', 'ellipsis', 'mini-line', 'mini-bar', 'mini-progress', 'mini-ring-progress', 'mini-area', 'tags', 'button', 'copyable', 'status-badge', 'image', 'custom-format', 'ellipsis-copyable', 'corner-mark'; optional)
22
+ - `renderType` (a value equal to: 'link', 'ellipsis', 'mini-line', 'mini-bar', 'mini-progress', 'mini-ring-progress', 'mini-area', 'tags', 'button', 'copyable', 'status-badge', 'image', 'custom-format', 'ellipsis-copyable', 'corner-mark', 'checkbox', 'switch', 'row-merge'; optional)
22
23
  - `renderLinkText` (String; optional)
23
24
  - `renderButtonPopConfirmProps` (optional): . renderButtonPopConfirmProps has the following type: lists containing elements 'title', 'okText', 'cancelText'.
24
25
  Those elements have the following types:
@@ -26,6 +27,8 @@ Those elements have the following types:
26
27
  - `okText` (String; optional)
27
28
  - `cancelText` (String; optional)
28
29
  - `tooltipCustomContent` (String; optional)
30
+ - `progressOneHundredPercentColor` (String; optional)
31
+ - `ringProgressFontSize` (Real; optional)
29
32
  - `fixed` (a value equal to: 'left', 'right'; optional)
30
33
  - `editable` (Bool; optional)
31
34
  - `align` (a value equal to: 'left', 'center', 'right'; optional)
@@ -79,7 +82,22 @@ Those elements have the following types:
79
82
  - `content` (Real | String; optional)
80
83
  - `offsetX` (Real; optional)
81
84
  - `offsetY` (Real; optional)
82
- - `hide` (Bool; optional)s
85
+ - `hide` (Bool; optional) | lists containing elements 'checked', 'disabled', 'label'.
86
+ Those elements have the following types:
87
+ - `checked` (Bool; optional)
88
+ - `disabled` (Bool; optional)
89
+ - `label` (String; optional) | lists containing elements 'checked', 'disabled', 'label', 'checkedChildren', 'unCheckedChildren'.
90
+ Those elements have the following types:
91
+ - `checked` (Bool; optional)
92
+ - `disabled` (Bool; optional)
93
+ - `label` (String; optional)
94
+ - `checkedChildren` (String; optional)
95
+ - `unCheckedChildren` (String; optional) | lists containing elements 'content', 'rowSpan'.
96
+ Those elements have the following types:
97
+ - `content` (Real | String; optional)
98
+ - `rowSpan` (Real; optional)s
99
+ - `emptyContent` (a list of or a singular dash component, string or number; optional)
100
+ - `enableCellClickListenColumns` (Bool; optional)
83
101
  - `enableHoverListen` (Bool; optional)
84
102
  - `expandRowByClick` (Bool; optional)
85
103
  - `expandedRowKeyToContent` (optional): . expandedRowKeyToContent has the following type: Array of lists containing elements 'key', 'content'.
@@ -107,6 +125,7 @@ Those elements have the following types:
107
125
  - `miniChartHeight` (Real; optional)
108
126
  - `mode` (a value equal to: 'client-side', 'server-side'; optional)
109
127
  - `nClicksButton` (Real; optional)
128
+ - `nClicksCell` (Real; optional)
110
129
  - `pagination` (optional): . pagination has the following type: Bool | lists containing elements 'position', 'pageSize', 'current', 'showSizeChanger', 'pageSizeOptions', 'showTitle', 'showQuickJumper', 'showTotalPrefix', 'showTotalSuffix', 'total', 'hideOnSinglePage', 'simple', 'disabled', 'responsive', 'size'.
111
130
  Those elements have the following types:
112
131
  - `position` (a value equal to: 'topLeft', 'topCenter', 'topRight', 'bottomLeft', 'bottomCenter', 'bottomRight'; optional)
@@ -125,9 +144,16 @@ Those elements have the following types:
125
144
  - `responsive` (Bool; optional)
126
145
  - `size` (a value equal to: 'default', 'small'; optional)
127
146
  - `recentlyButtonClickedRow` (Dict; optional)
147
+ - `recentlyCellClickColumn` (String; optional)
148
+ - `recentlyCellClickRecord` (String | Real; optional)
128
149
  - `recentlyChangedRow` (Dict; optional)
150
+ - `recentlyCheckedLabel` (String; optional)
151
+ - `recentlyCheckedRow` (Dict; optional)
152
+ - `recentlyCheckedStatus` (Bool; optional)
129
153
  - `recentlyMouseEnterColumn` (String; optional)
130
154
  - `recentlyMouseEnterRow` (String | Real; optional)
155
+ - `recentlySwtichRow` (Dict; optional)
156
+ - `recentlySwtichStatus` (Bool; optional)
131
157
  - `rowSelectionType` (a value equal to: 'checkbox', 'radio'; optional)
132
158
  - `rowSelectionWidth` (String | Real; optional)
133
159
  - `selectedRowKeys` (Array of String | Reals; optional)
@@ -151,10 +177,11 @@ Those elements have the following types:
151
177
  - `colSpan` (Real; optional)
152
178
  - `align` (a value equal to: 'left', 'center', 'right'; optional)s
153
179
  - `summaryRowFixed` (Bool; optional)
180
+ - `swtichDataIndex` (String; optional)
154
181
  - `titlePopoverInfo` (Dict; optional)
155
182
  """
156
183
  function 'feffery'_antdtable(; kwargs...)
157
- available_props = Symbol[:id, :bordered, :className, :clickedContent, :columns, :columnsFormatConstraint, :conditionalStyleFuncs, :containerId, :currentData, :customFormatFuncs, :data, :enableHoverListen, :expandRowByClick, :expandedRowKeyToContent, :expandedRowWidth, :filter, :filterOptions, :key, :loading_state, :locale, :maxHeight, :maxWidth, :miniChartAnimation, :miniChartHeight, :mode, :nClicksButton, :pagination, :recentlyButtonClickedRow, :recentlyChangedRow, :recentlyMouseEnterColumn, :recentlyMouseEnterRow, :rowSelectionType, :rowSelectionWidth, :selectedRowKeys, :selectedRows, :size, :sortOptions, :sorter, :sticky, :style, :summaryRowContents, :summaryRowFixed, :titlePopoverInfo]
184
+ available_props = Symbol[:id, :bordered, :checkedDataIndex, :className, :clickedContent, :columns, :columnsFormatConstraint, :conditionalStyleFuncs, :containerId, :currentData, :customFormatFuncs, :data, :emptyContent, :enableCellClickListenColumns, :enableHoverListen, :expandRowByClick, :expandedRowKeyToContent, :expandedRowWidth, :filter, :filterOptions, :key, :loading_state, :locale, :maxHeight, :maxWidth, :miniChartAnimation, :miniChartHeight, :mode, :nClicksButton, :nClicksCell, :pagination, :recentlyButtonClickedRow, :recentlyCellClickColumn, :recentlyCellClickRecord, :recentlyChangedRow, :recentlyCheckedLabel, :recentlyCheckedRow, :recentlyCheckedStatus, :recentlyMouseEnterColumn, :recentlyMouseEnterRow, :recentlySwtichRow, :recentlySwtichStatus, :rowSelectionType, :rowSelectionWidth, :selectedRowKeys, :selectedRows, :size, :sortOptions, :sorter, :sticky, :style, :summaryRowContents, :summaryRowFixed, :swtichDataIndex, :titlePopoverInfo]
158
185
  wild_props = Symbol[]
159
186
  return Component("'feffery'_antdtable", "AntdTable", "feffery_antd_components", available_props, wild_props; kwargs...)
160
187
  end
@@ -13,7 +13,7 @@ An AntdTabPane component.
13
13
  Keyword arguments:
14
14
  - `children` (a list of or a singular dash component, string or number; optional): The content of the tab - will only be displayed if this tab is selected
15
15
  - `id` (String; optional)
16
- - `className` (String; optional)
16
+ - `className` (String | Dict; optional)
17
17
  - `closable` (Bool; optional)
18
18
  - `disabled` (Bool; optional)
19
19
  - `key` (String; optional)
@@ -9,7 +9,7 @@ An AntdTag component.
9
9
 
10
10
  Keyword arguments:
11
11
  - `id` (String; optional)
12
- - `className` (String; optional)
12
+ - `className` (String | Dict; optional)
13
13
  - `color` (String; optional)
14
14
  - `content` (String; optional)
15
15
  - `href` (String; optional)
@@ -13,7 +13,7 @@ An AntdText component.
13
13
  Keyword arguments:
14
14
  - `children` (a list of or a singular dash component, string or number; optional): The content of the tab - will only be displayed if this tab is selected
15
15
  - `id` (String; optional)
16
- - `className` (String; optional)
16
+ - `className` (String | Dict; optional)
17
17
  - `code` (Bool; optional)
18
18
  - `copyable` (Bool; optional)
19
19
  - `disabled` (Bool; optional)
@@ -13,7 +13,7 @@ An AntdTitle component.
13
13
  Keyword arguments:
14
14
  - `children` (a list of or a singular dash component, string or number; optional): The content of the tab - will only be displayed if this tab is selected
15
15
  - `id` (String; optional)
16
- - `className` (String; optional)
16
+ - `className` (String | Dict; optional)
17
17
  - `code` (Bool; optional)
18
18
  - `copyable` (Bool; optional)
19
19
  - `disabled` (Bool; optional)
@@ -48,10 +48,11 @@ session: window.sessionStorage, data is cleared once the browser quit.
48
48
  Those elements have the following types:
49
49
  - `showLeafIcon` (Bool; optional)
50
50
  - `style` (Dict; optional)
51
- - `treeData` (optional)
51
+ - `treeData` (Array; optional)
52
+ - `treeDataMode` (a value equal to: 'tree', 'flat'; optional)
52
53
  """
53
54
  function 'feffery'_antdtree(; kwargs...)
54
- available_props = Symbol[:id, :checkStrictly, :checkable, :checkedKeys, :className, :defaultCheckedKeys, :defaultExpandAll, :defaultExpandParent, :defaultExpandedKeys, :defaultSelectedKeys, :expandedKeys, :halfCheckedKeys, :height, :key, :loading_state, :multiple, :persisted_props, :persistence, :persistence_type, :selectable, :selectedKeys, :showIcon, :showLine, :style, :treeData]
55
+ available_props = Symbol[:id, :checkStrictly, :checkable, :checkedKeys, :className, :defaultCheckedKeys, :defaultExpandAll, :defaultExpandParent, :defaultExpandedKeys, :defaultSelectedKeys, :expandedKeys, :halfCheckedKeys, :height, :key, :loading_state, :multiple, :persisted_props, :persistence, :persistence_type, :selectable, :selectedKeys, :showIcon, :showLine, :style, :treeData, :treeDataMode]
55
56
  wild_props = Symbol[]
56
57
  return Component("'feffery'_antdtree", "AntdTree", "feffery_antd_components", available_props, wild_props; kwargs...)
57
58
  end
@@ -44,7 +44,8 @@ session: window.sessionStorage, data is cleared once the browser quit.
44
44
  - `style` (Dict; optional)
45
45
  - `treeCheckStrictly` (Bool; optional)
46
46
  - `treeCheckable` (Bool; optional)
47
- - `treeData` (optional)
47
+ - `treeData` (Array; required)
48
+ - `treeDataMode` (a value equal to: 'tree', 'flat'; optional)
48
49
  - `treeDefaultExpandAll` (Bool; optional)
49
50
  - `treeDefaultExpandedKeys` (Array of Strings; optional)
50
51
  - `treeExpandedKeys` (Array of Strings; optional)
@@ -54,7 +55,7 @@ session: window.sessionStorage, data is cleared once the browser quit.
54
55
  - `virtual` (Bool; optional)
55
56
  """
56
57
  function 'feffery'_antdtreeselect(; kwargs...)
57
- available_props = Symbol[:id, :allowClear, :bordered, :className, :defaultValue, :disabled, :key, :listHeight, :loading_state, :locale, :maxTagCount, :multiple, :persisted_props, :persistence, :persistence_type, :placeholder, :placement, :size, :status, :style, :treeCheckStrictly, :treeCheckable, :treeData, :treeDefaultExpandAll, :treeDefaultExpandedKeys, :treeExpandedKeys, :treeLine, :treeNodeFilterProp, :value, :virtual]
58
+ available_props = Symbol[:id, :allowClear, :bordered, :className, :defaultValue, :disabled, :key, :listHeight, :loading_state, :locale, :maxTagCount, :multiple, :persisted_props, :persistence, :persistence_type, :placeholder, :placement, :size, :status, :style, :treeCheckStrictly, :treeCheckable, :treeData, :treeDataMode, :treeDefaultExpandAll, :treeDefaultExpandedKeys, :treeExpandedKeys, :treeLine, :treeNodeFilterProp, :value, :virtual]
58
59
  wild_props = Symbol[]
59
60
  return Component("'feffery'_antdtreeselect", "AntdTreeSelect", "feffery_antd_components", available_props, wild_props; kwargs...)
60
61
  end
@@ -2,6 +2,8 @@ import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import TextLoop from 'react-text-loop'
4
4
  import { Alert } from 'antd';
5
+ import { useCss } from 'react-use';
6
+ import { isString } from 'lodash';
5
7
  import Marquee from 'react-fast-marquee';
6
8
  import 'antd/dist/antd.css';
7
9
 
@@ -28,7 +30,11 @@ export default class AntdAlert extends Component {
28
30
  if (messageRenderMode === 'loop-text' && Array.isArray(message)) {
29
31
  return (
30
32
  <Alert id={id}
31
- className={className}
33
+ className={
34
+ isString(className) ?
35
+ className :
36
+ useCss(className)
37
+ }
32
38
  style={style}
33
39
  key={key}
34
40
  message={
@@ -50,7 +56,11 @@ export default class AntdAlert extends Component {
50
56
 
51
57
  return (
52
58
  <Alert id={id}
53
- className={className}
59
+ className={
60
+ isString(className) ?
61
+ className :
62
+ useCss(className)
63
+ }
54
64
  style={style}
55
65
  key={key}
56
66
  message={
@@ -77,7 +87,10 @@ AntdAlert.propTypes = {
77
87
  id: PropTypes.string,
78
88
 
79
89
  // css类名
80
- className: PropTypes.string,
90
+ className: PropTypes.oneOfType([
91
+ PropTypes.string,
92
+ PropTypes.object
93
+ ]),
81
94
 
82
95
  // 自定义css字典
83
96
  style: PropTypes.object,
@@ -1,86 +1,89 @@
1
- import React, { Component } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { useCss } from 'react-use';
4
+ import { isString } from 'lodash';
3
5
  import { Anchor } from 'antd';
4
6
  import 'antd/dist/antd.css';
5
7
 
6
8
  const { Link } = Anchor;
7
9
 
8
10
  // 定义锚点组件AntdAnchor,api参数参考https://ant.design/components/anchor-cn/
9
- export default class AntdAnchor extends Component {
10
- render() {
11
- // 取得必要属性或参数
12
- let {
13
- id,
14
- className,
15
- style,
16
- key,
17
- linkDict,
18
- align,
19
- containerId,
20
- targetOffset,
21
- affix,
22
- bounds,
23
- offsetTop,
24
- loading_state
25
- } = this.props;
26
-
27
-
28
- function renderAnchorTree(obj) {
29
- // 当anchorObj类型为对象时
30
- if (obj.hasOwnProperty('href')) {
31
- //当anchorObj具有children属性时
32
- if (obj.hasOwnProperty('children')) {
33
-
34
- obj = <Link
35
- href={obj.href}
36
- title={obj.title}
37
- >
38
- {renderAnchorTree(obj.children)}
39
- </Link>
40
-
41
- } else {
42
-
43
- obj = <Link
44
- href={obj.href}
45
- title={obj.title}
46
- />
47
- }
11
+ const AntdAnchor = (props) => {
12
+ // 取得必要属性或参数
13
+ let {
14
+ id,
15
+ className,
16
+ style,
17
+ key,
18
+ linkDict,
19
+ align,
20
+ containerId,
21
+ targetOffset,
22
+ affix,
23
+ bounds,
24
+ offsetTop,
25
+ loading_state
26
+ } = props;
27
+
28
+ const renderAnchorTree = (obj) => {
29
+ // 当anchorObj类型为对象时
30
+ if (obj.hasOwnProperty('href')) {
31
+ //当anchorObj具有children属性时
32
+ if (obj.hasOwnProperty('children')) {
33
+
34
+ obj = <Link
35
+ href={obj.href}
36
+ title={obj.title}
37
+ >
38
+ {renderAnchorTree(obj.children)}
39
+ </Link>
48
40
 
49
41
  } else {
50
- for (let i = 0; i < obj.length; i++) {
51
- obj[i] = renderAnchorTree(obj[i])
52
- }
42
+
43
+ obj = <Link
44
+ href={obj.href}
45
+ title={obj.title}
46
+ />
53
47
  }
54
48
 
55
- return obj;
49
+ } else {
50
+ for (let i = 0; i < obj.length; i++) {
51
+ obj[i] = renderAnchorTree(obj[i])
52
+ }
56
53
  }
57
54
 
58
- linkDict = renderAnchorTree(linkDict)
59
-
60
- return (
61
- <div
62
- style={{ float: align }}
63
- data-dash-is-loading={
64
- (loading_state && loading_state.is_loading) || undefined
65
- }
66
- >
67
- {
68
- <Anchor
69
- id={id}
70
- className={className}
71
- style={style}
72
- key={key}
73
- getContainer={containerId ? () => document.getElementById(containerId) : containerId}
74
- targetOffset={targetOffset}
75
- affix={affix}
76
- bounds={bounds}
77
- offsetTop={offsetTop}>
78
- {linkDict}
79
- </Anchor>
80
- }
81
- </div>
82
- );
55
+ return obj;
83
56
  }
57
+
58
+ return (
59
+ <div
60
+ style={{ float: align }}
61
+ data-dash-is-loading={
62
+ (loading_state && loading_state.is_loading) || undefined
63
+ }
64
+ >
65
+ {
66
+ <Anchor
67
+ id={id}
68
+ className={
69
+ isString(className) ?
70
+ className :
71
+ useCss(className)
72
+ }
73
+ style={style}
74
+ key={key}
75
+ getContainer={containerId ? (
76
+ document.getElementById(containerId) ? () => document.getElementById(containerId) : undefined
77
+ ) : undefined}
78
+ targetOffset={targetOffset}
79
+ affix={affix}
80
+ bounds={bounds}
81
+ offsetTop={offsetTop}>
82
+ {renderAnchorTree(linkDict)}
83
+ </Anchor>
84
+ }
85
+ </div>
86
+ );
84
87
  }
85
88
 
86
89
  // 定义递归PropTypes
@@ -102,7 +105,10 @@ AntdAnchor.propTypes = {
102
105
  id: PropTypes.string,
103
106
 
104
107
  // css类名
105
- className: PropTypes.string,
108
+ className: PropTypes.oneOfType([
109
+ PropTypes.string,
110
+ PropTypes.object
111
+ ]),
106
112
 
107
113
  // 自定义css字典
108
114
  style: PropTypes.object,
@@ -157,3 +163,6 @@ AntdAnchor.propTypes = {
157
163
  AntdAnchor.defaultProps = {
158
164
  align: 'right'
159
165
  }
166
+
167
+
168
+ export default AntdAnchor;
@@ -1,6 +1,8 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Avatar } from 'antd';
4
+ import { useCss } from 'react-use';
5
+ import { isString } from 'lodash';
4
6
  import AntdIcon from './AntdIcon.react';
5
7
  import 'antd/dist/antd.css';
6
8
 
@@ -31,7 +33,11 @@ export default class AntdAvatar extends Component {
31
33
  return (
32
34
  <Avatar
33
35
  id={id}
34
- className={className}
36
+ className={
37
+ isString(className) ?
38
+ className :
39
+ useCss(className)
40
+ }
35
41
  style={style}
36
42
  key={key}
37
43
  src={src}
@@ -50,7 +56,11 @@ export default class AntdAvatar extends Component {
50
56
  return (
51
57
  <Avatar
52
58
  id={id}
53
- className={className}
59
+ className={
60
+ isString(className) ?
61
+ className :
62
+ useCss(className)
63
+ }
54
64
  style={style}
55
65
  key={key}
56
66
  gap={gap}
@@ -66,7 +76,11 @@ export default class AntdAvatar extends Component {
66
76
  return (
67
77
  <Avatar
68
78
  id={id}
69
- className={className}
79
+ className={
80
+ isString(className) ?
81
+ className :
82
+ useCss(className)
83
+ }
70
84
  style={style}
71
85
  key={key}
72
86
  icon={icon ? <AntdIcon icon={icon} /> : <AntdIcon icon={'antd-user'} />}
@@ -88,7 +102,10 @@ AntdAvatar.propTypes = {
88
102
  id: PropTypes.string,
89
103
 
90
104
  // css类名
91
- className: PropTypes.string,
105
+ className: PropTypes.oneOfType([
106
+ PropTypes.string,
107
+ PropTypes.object
108
+ ]),
92
109
 
93
110
  // 自定义css字典
94
111
  style: PropTypes.object,
@@ -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 { BackTop } from 'antd';
4
6
  import 'antd/dist/antd.css';
5
7
 
@@ -21,7 +23,11 @@ export default class AntdBackTop extends Component {
21
23
 
22
24
  return (
23
25
  <BackTop id={id}
24
- className={className}
26
+ className={
27
+ isString(className) ?
28
+ className :
29
+ useCss(className)
30
+ }
25
31
  style={style}
26
32
  key={key}
27
33
  target={containerId ? () => document.getElementById(containerId) : () => window}
@@ -40,7 +46,10 @@ AntdBackTop.propTypes = {
40
46
  id: PropTypes.string,
41
47
 
42
48
  // css类名
43
- className: PropTypes.string,
49
+ className: PropTypes.oneOfType([
50
+ PropTypes.string,
51
+ PropTypes.object
52
+ ]),
44
53
 
45
54
  // 自定义css字典
46
55
  style: PropTypes.object,
@@ -1,60 +1,76 @@
1
- import React, { Component } from 'react';
2
1
  import PropTypes from 'prop-types';
3
2
  import { Button } from 'antd';
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
  // 定义分割线组件AntdButton,api参数参考https://ant.design/components/button-cn/
7
- export default class AntdButton extends Component {
8
- render() {
9
- // 取得必要属性或参数
10
- let {
11
- id,
12
- children,
13
- className,
14
- style,
15
- key,
16
- setProps,
17
- type,
18
- href,
19
- target,
20
- block,
21
- danger,
22
- disabled,
23
- shape,
24
- size,
25
- nClicks,
26
- loading,
27
- loading_state
28
- } = this.props;
29
-
30
- // 返回定制化的前端组件
31
- return (
32
- <Button
33
- id={id}
34
- className={className}
35
- style={style}
36
- key={key}
37
- type={type}
38
- href={href}
39
- target={target}
40
- block={block}
41
- danger={danger}
42
- disabled={disabled}
43
- shape={shape}
44
- size={size}
45
- onClick={(e) => {
46
- nClicks++;
47
- // 更新nClicks
48
- setProps({ nClicks: nClicks })
49
- }}
50
- loading={loading}
51
- data-dash-is-loading={
52
- (loading_state && loading_state.is_loading) || undefined
53
- }
54
- >{children}
55
- </Button>
56
- );
57
- }
9
+ const AntdButton = (props) => {
10
+ // 取得必要属性或参数
11
+ let {
12
+ id,
13
+ children,
14
+ className,
15
+ style,
16
+ key,
17
+ setProps,
18
+ type,
19
+ href,
20
+ target,
21
+ block,
22
+ danger,
23
+ disabled,
24
+ shape,
25
+ size,
26
+ nClicks,
27
+ debounceWait,
28
+ icon,
29
+ loading,
30
+ loading_state
31
+ } = props;
32
+
33
+ const { run: onClick } = useRequest(
34
+ () => {
35
+ nClicks++;
36
+ // 更新nClicks
37
+ setProps({ nClicks: nClicks })
38
+ },
39
+ {
40
+ debounceWait: debounceWait,
41
+ debounceLeading: true,
42
+ manual: true
43
+ }
44
+ )
45
+
46
+ // 返回定制化的前端组件
47
+ return (
48
+ <Button
49
+ id={id}
50
+ className={
51
+ isString(className) ?
52
+ className :
53
+ useCss(className)
54
+ }
55
+ style={style}
56
+ key={key}
57
+ type={type}
58
+ href={href}
59
+ target={target}
60
+ block={block}
61
+ danger={danger}
62
+ disabled={disabled}
63
+ shape={shape}
64
+ size={size}
65
+ icon={icon}
66
+ onClick={onClick}
67
+ loading={loading}
68
+ data-dash-is-loading={
69
+ (loading_state && loading_state.is_loading) || undefined
70
+ }
71
+ >{children}
72
+ </Button>
73
+ );
58
74
  }
59
75
 
60
76
  // 定义参数或属性
@@ -66,7 +82,10 @@ AntdButton.propTypes = {
66
82
  children: PropTypes.node,
67
83
 
68
84
  // css类名
69
- className: PropTypes.string,
85
+ className: PropTypes.oneOfType([
86
+ PropTypes.string,
87
+ PropTypes.object
88
+ ]),
70
89
 
71
90
  // 自定义css字典
72
91
  style: PropTypes.object,
@@ -101,6 +120,12 @@ AntdButton.propTypes = {
101
120
  // 记录按钮从渲染后开始被点击的次数,默认为0
102
121
  nClicks: PropTypes.number,
103
122
 
123
+ // 用于配置value变化更新的防抖等待时长(单位:毫秒),默认为0
124
+ debounceWait: PropTypes.number,
125
+
126
+ // 组件型参数,设置按钮前缀图标元素
127
+ icon: PropTypes.node,
128
+
104
129
  // 用于设置是否为按钮渲染“加载中不可点击”效果,默认为false
105
130
  loading: PropTypes.bool,
106
131
 
@@ -132,5 +157,8 @@ AntdButton.defaultProps = {
132
157
  block: false,
133
158
  danger: false,
134
159
  disabled: false,
135
- nClicks: 0
160
+ nClicks: 0,
161
+ debounceWait: 0
136
162
  }
163
+
164
+ export default AntdButton;