feffery_antd_components 0.2.10-rc13 → 0.2.10-rc15

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 (53) hide show
  1. package/DESCRIPTION +1 -1
  2. package/Project.toml +1 -1
  3. package/build/lib/feffery_antd_components/AntdTable.py +5 -3
  4. package/build/lib/feffery_antd_components/AntdTree.py +7 -3
  5. package/build/lib/feffery_antd_components/AntdUpload.py +2 -0
  6. package/build/lib/feffery_antd_components/__init__.py +16 -0
  7. package/build/lib/feffery_antd_components/async-antd_table.js +1 -1
  8. package/build/lib/feffery_antd_components/async-antd_upload.js +1 -1
  9. package/build/lib/feffery_antd_components/feffery_antd_components.min.js +1 -1
  10. package/build/lib/feffery_antd_components/metadata.json +33 -0
  11. package/build/lib/feffery_antd_components/package-info.json +1 -1
  12. package/feffery_antd_components/AntdTable.py +5 -3
  13. package/feffery_antd_components/AntdTree.py +7 -3
  14. package/feffery_antd_components/AntdUpload.py +2 -0
  15. package/feffery_antd_components/__init__.py +16 -0
  16. package/feffery_antd_components/async-antd_table.js +1 -1
  17. package/feffery_antd_components/async-antd_upload.js +1 -1
  18. package/feffery_antd_components/feffery_antd_components.min.js +1 -1
  19. package/feffery_antd_components/metadata.json +33 -0
  20. package/feffery_antd_components/package-info.json +1 -1
  21. package/package.json +1 -1
  22. package/src/jl/'feffery'_antdtable.jl +2 -1
  23. package/src/jl/'feffery'_antdtree.jl +3 -1
  24. package/src/jl/'feffery'_antdupload.jl +2 -1
  25. package/src/lib/components/dataDisplay/AntdComment.react.js +16 -16
  26. package/src/lib/components/dataDisplay/AntdSegmented.react.js +16 -16
  27. package/src/lib/components/dataDisplay/AntdTable.react.js +8 -2
  28. package/src/lib/components/dataDisplay/AntdTree.react.js +81 -19
  29. package/src/lib/components/dataEntry/AntdCascader.react.js +16 -16
  30. package/src/lib/components/dataEntry/AntdCheckbox.react.js +17 -17
  31. package/src/lib/components/dataEntry/AntdCheckboxGroup.react.js +17 -17
  32. package/src/lib/components/dataEntry/AntdDatePicker.react.js +16 -16
  33. package/src/lib/components/dataEntry/AntdDateRangePicker.react.js +16 -16
  34. package/src/lib/components/dataEntry/AntdInput.react.js +16 -16
  35. package/src/lib/components/dataEntry/AntdInputNumber.react.js +16 -16
  36. package/src/lib/components/dataEntry/AntdMentions.react.js +17 -17
  37. package/src/lib/components/dataEntry/AntdRadioGroup.react.js +16 -16
  38. package/src/lib/components/dataEntry/AntdRate.react.js +16 -16
  39. package/src/lib/components/dataEntry/AntdSegmentedColoring.react.js +17 -17
  40. package/src/lib/components/dataEntry/AntdSelect.react.js +16 -16
  41. package/src/lib/components/dataEntry/AntdSlider.react.js +16 -16
  42. package/src/lib/components/dataEntry/AntdSwitch.react.js +16 -16
  43. package/src/lib/components/dataEntry/AntdTimePicker.react.js +16 -16
  44. package/src/lib/components/dataEntry/AntdTimeRangePicker.react.js +16 -16
  45. package/src/lib/components/dataEntry/AntdTransfer.react.js +17 -17
  46. package/src/lib/components/dataEntry/AntdTreeSelect.react.js +16 -16
  47. package/src/lib/components/dataEntry/upload/AntdUpload.react.js +4 -0
  48. package/src/lib/components/navigation/AntdDropdown.react.js +17 -17
  49. package/src/lib/components/navigation/AntdPagination.react.js +16 -16
  50. package/src/lib/components/styles.css +5 -0
  51. package/src/lib/fragments/AntdTable.react.js +3 -3
  52. package/src/lib/fragments/upload/AntdUpload.react.js +3 -249
  53. package/usage.py +60 -89
@@ -5691,6 +5691,17 @@
5691
5691
  "computed": false
5692
5692
  }
5693
5693
  },
5694
+ "dataDeepCompare": {
5695
+ "type": {
5696
+ "name": "bool"
5697
+ },
5698
+ "required": false,
5699
+ "description": "",
5700
+ "defaultValue": {
5701
+ "value": "false",
5702
+ "computed": false
5703
+ }
5704
+ },
5694
5705
  "loading_state": {
5695
5706
  "type": {
5696
5707
  "name": "shape",
@@ -6655,6 +6666,24 @@
6655
6666
  "required": false,
6656
6667
  "description": ""
6657
6668
  },
6669
+ "searchKeyword": {
6670
+ "type": {
6671
+ "name": "string"
6672
+ },
6673
+ "required": false,
6674
+ "description": ""
6675
+ },
6676
+ "highlightStyle": {
6677
+ "type": {
6678
+ "name": "object"
6679
+ },
6680
+ "required": false,
6681
+ "description": "",
6682
+ "defaultValue": {
6683
+ "value": "{\r\n fontWeight: 'bold',\r\n backgroundColor: 'transparent',\r\n padding: 0,\r\n color: '#ff5500'\r\n}",
6684
+ "computed": false
6685
+ }
6686
+ },
6658
6687
  "nodeCheckedSuffix": {
6659
6688
  "type": {
6660
6689
  "name": "node"
@@ -17357,6 +17386,10 @@
17357
17386
  "name": "bool",
17358
17387
  "required": false
17359
17388
  },
17389
+ "block": {
17390
+ "name": "bool",
17391
+ "required": false
17392
+ },
17360
17393
  "style": {
17361
17394
  "name": "object",
17362
17395
  "required": false
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feffery_antd_components",
3
- "version": "0.2.10-rc13",
3
+ "version": "0.2.10-rc15",
4
4
  "description": "Best implementation of Antd components in Plotly Dash.",
5
5
  "repository": {
6
6
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feffery_antd_components",
3
- "version": "0.2.10-rc13",
3
+ "version": "0.2.10-rc15",
4
4
  "description": "Best implementation of Antd components in Plotly Dash.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -174,6 +174,7 @@ Those elements have the following types:
174
174
  - `maxTagCount` (Real | a value equal to: 'responsive'; optional)
175
175
  - `optionFilterProp` (a value equal to: 'value', 'label'; optional)
176
176
  - `allowClear` (Bool; optional)s
177
+ - `dataDeepCompare` (Bool; optional)
177
178
  - `defaultExpandedRowKeys` (Array of Strings; optional)
178
179
  - `defaultFilteredValues` (Dict with Strings as keys and values of type Array; optional): 监听或设置各字段筛选功能初始化时已选中值
179
180
  - `emptyContent` (a list of or a singular dash component, string or number; optional)
@@ -283,7 +284,7 @@ Those elements have the following types:
283
284
  - `overlayStyle` (Dict; optional)
284
285
  """
285
286
  function 'feffery'_antdtable(; kwargs...)
286
- available_props = Symbol[:id, :bordered, :cellUpdateOptimize, :className, :clickedContent, :clickedCustom, :columns, :columnsFormatConstraint, :conditionalStyleFuncs, :containerId, :currentData, :customFormatFuncs, :data, :defaultExpandedRowKeys, :defaultFilteredValues, :emptyContent, :enableCellClickListenColumns, :enableHoverListen, :expandRowByClick, :expandedRowKeyToContent, :expandedRowWidth, :filter, :filterOptions, :hiddenRowKeys, :key, :loading_state, :locale, :maxHeight, :maxWidth, :miniChartAnimation, :miniChartHeight, :mode, :nClicksButton, :nClicksCell, :nClicksDropdownItem, :nDoubleClicksCell, :pagination, :recentlyButtonClickedDataIndex, :recentlyButtonClickedRow, :recentlyCellClickColumn, :recentlyCellClickRecord, :recentlyCellDoubleClickColumn, :recentlyCellDoubleClickRecord, :recentlyChangedColumn, :recentlyChangedRow, :recentlyCheckedDataIndex, :recentlyCheckedLabel, :recentlyCheckedRow, :recentlyCheckedStatus, :recentlyClickedDropdownItemTitle, :recentlyDropdownItemClickedDataIndex, :recentlyDropdownItemClickedRow, :recentlyMouseEnterColumnDataIndex, :recentlyMouseEnterRow, :recentlyMouseEnterRowKey, :recentlySelectDataIndex, :recentlySelectRow, :recentlySelectValue, :recentlySwitchDataIndex, :recentlySwitchRow, :recentlySwitchStatus, :rowSelectionType, :rowSelectionWidth, :selectedRowKeys, :selectedRows, :selectedRowsSyncWithData, :size, :sortOptions, :sorter, :sticky, :style, :summaryRowContents, :summaryRowFixed, :titlePopoverInfo]
287
+ available_props = Symbol[:id, :bordered, :cellUpdateOptimize, :className, :clickedContent, :clickedCustom, :columns, :columnsFormatConstraint, :conditionalStyleFuncs, :containerId, :currentData, :customFormatFuncs, :data, :dataDeepCompare, :defaultExpandedRowKeys, :defaultFilteredValues, :emptyContent, :enableCellClickListenColumns, :enableHoverListen, :expandRowByClick, :expandedRowKeyToContent, :expandedRowWidth, :filter, :filterOptions, :hiddenRowKeys, :key, :loading_state, :locale, :maxHeight, :maxWidth, :miniChartAnimation, :miniChartHeight, :mode, :nClicksButton, :nClicksCell, :nClicksDropdownItem, :nDoubleClicksCell, :pagination, :recentlyButtonClickedDataIndex, :recentlyButtonClickedRow, :recentlyCellClickColumn, :recentlyCellClickRecord, :recentlyCellDoubleClickColumn, :recentlyCellDoubleClickRecord, :recentlyChangedColumn, :recentlyChangedRow, :recentlyCheckedDataIndex, :recentlyCheckedLabel, :recentlyCheckedRow, :recentlyCheckedStatus, :recentlyClickedDropdownItemTitle, :recentlyDropdownItemClickedDataIndex, :recentlyDropdownItemClickedRow, :recentlyMouseEnterColumnDataIndex, :recentlyMouseEnterRow, :recentlyMouseEnterRowKey, :recentlySelectDataIndex, :recentlySelectRow, :recentlySelectValue, :recentlySwitchDataIndex, :recentlySwitchRow, :recentlySwitchStatus, :rowSelectionType, :rowSelectionWidth, :selectedRowKeys, :selectedRows, :selectedRowsSyncWithData, :size, :sortOptions, :sorter, :sticky, :style, :summaryRowContents, :summaryRowFixed, :titlePopoverInfo]
287
288
  wild_props = Symbol[]
288
289
  return Component("'feffery'_antdtable", "AntdTable", "feffery_antd_components", available_props, wild_props; kwargs...)
289
290
  end
@@ -33,6 +33,7 @@ Those elements have the following types:
33
33
  - `favoritedKeys` (Array of Strings; optional)
34
34
  - `halfCheckedKeys` (Array of Strings; optional)
35
35
  - `height` (Real; optional)
36
+ - `highlightStyle` (Dict; optional)
36
37
  - `key` (String; optional)
37
38
  - `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
38
39
  Those elements have the following types:
@@ -62,6 +63,7 @@ Those elements have the following types:
62
63
  - `key` (String; required)
63
64
  - `align` (a value equal to: 'top', 'bottom', 'auto'; optional)
64
65
  - `offset` (Real; optional)
66
+ - `searchKeyword` (String; optional)
65
67
  - `selectable` (Bool; optional)
66
68
  - `selectedKeys` (Array of Strings; optional)
67
69
  - `showIcon` (Bool; optional)
@@ -73,7 +75,7 @@ Those elements have the following types:
73
75
  - `treeDataMode` (a value equal to: 'tree', 'flat'; optional)
74
76
  """
75
77
  function 'feffery'_antdtree(; kwargs...)
76
- available_props = Symbol[:id, :batchPropsNames, :batchPropsValues, :checkStrictly, :checkable, :checkedKeys, :className, :clickedContextMenu, :defaultCheckedKeys, :defaultExpandAll, :defaultExpandParent, :defaultExpandedKeys, :defaultSelectedKeys, :dragInSameLevel, :draggable, :draggedNodeKey, :enableNodeFavorites, :expandedKeys, :favoritedKeys, :halfCheckedKeys, :height, :key, :loading_state, :multiple, :nodeCheckedStyle, :nodeCheckedSuffix, :nodeUncheckedStyle, :nodeUncheckedSuffix, :persisted_props, :persistence, :persistence_type, :scrollTarget, :selectable, :selectedKeys, :showIcon, :showLine, :style, :treeData, :treeDataMode]
78
+ available_props = Symbol[:id, :batchPropsNames, :batchPropsValues, :checkStrictly, :checkable, :checkedKeys, :className, :clickedContextMenu, :defaultCheckedKeys, :defaultExpandAll, :defaultExpandParent, :defaultExpandedKeys, :defaultSelectedKeys, :dragInSameLevel, :draggable, :draggedNodeKey, :enableNodeFavorites, :expandedKeys, :favoritedKeys, :halfCheckedKeys, :height, :highlightStyle, :key, :loading_state, :multiple, :nodeCheckedStyle, :nodeCheckedSuffix, :nodeUncheckedStyle, :nodeUncheckedSuffix, :persisted_props, :persistence, :persistence_type, :scrollTarget, :searchKeyword, :selectable, :selectedKeys, :showIcon, :showLine, :style, :treeData, :treeDataMode]
77
79
  wild_props = Symbol[]
78
80
  return Component("'feffery'_antdtree", "AntdTree", "feffery_antd_components", available_props, wild_props; kwargs...)
79
81
  end
@@ -11,11 +11,12 @@ Keyword arguments:
11
11
  - `id` (String; optional)
12
12
  - `apiUrl` (String; optional)
13
13
  - `buttonContent` (a list of or a singular dash component, string or number; optional)
14
- - `buttonProps` (optional): . buttonProps has the following type: lists containing elements 'size', 'type', 'danger', 'style', 'className'.
14
+ - `buttonProps` (optional): . buttonProps has the following type: lists containing elements 'size', 'type', 'danger', 'block', 'style', 'className'.
15
15
  Those elements have the following types:
16
16
  - `size` (a value equal to: 'default', 'small', 'large'; optional)
17
17
  - `type` (a value equal to: 'primary', 'ghost', 'dashed', 'link', 'text', 'default'; optional)
18
18
  - `danger` (Bool; optional)
19
+ - `block` (Bool; optional)
19
20
  - `style` (Dict; optional)
20
21
  - `className` (String; optional)
21
22
  - `className` (String | Dict; optional)
@@ -38,9 +38,23 @@ const AntdComment = (props) => {
38
38
  avatarProps,
39
39
  popupContainer,
40
40
  setProps,
41
- loading_state
41
+ loading_state,
42
+ batchPropsNames
42
43
  } = props;
43
44
 
45
+ // 批属性监听
46
+ useEffect(() => {
47
+ if (batchPropsNames && batchPropsNames.length !== 0) {
48
+ let _batchPropsValues = {};
49
+ for (let propName of batchPropsNames) {
50
+ _batchPropsValues[propName] = props[propName];
51
+ }
52
+ setProps({
53
+ batchPropsValues: _batchPropsValues
54
+ })
55
+ }
56
+ })
57
+
44
58
  const context = useContext(PropsContext)
45
59
  locale = (context && context.locale) || locale
46
60
 
@@ -262,18 +276,4 @@ AntdComment.defaultProps = {
262
276
  batchPropsNames: []
263
277
  }
264
278
 
265
- export default React.memo(
266
- AntdComment,
267
- (prevProps, nextProps) => {
268
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
269
- let _batchPropsValues = {};
270
- for (let propName of nextProps.batchPropsNames) {
271
- _batchPropsValues[propName] = nextProps[propName];
272
- }
273
- nextProps.setProps({
274
- batchPropsValues: _batchPropsValues
275
- })
276
- }
277
- return false;
278
- }
279
- );
279
+ export default AntdComment;
@@ -26,9 +26,23 @@ const AntdSegmented = (props) => {
26
26
  persistence,
27
27
  persisted_props,
28
28
  persistence_type,
29
- loading_state
29
+ loading_state,
30
+ batchPropsNames
30
31
  } = props;
31
32
 
33
+ // 批属性监听
34
+ useEffect(() => {
35
+ if (batchPropsNames && batchPropsNames.length !== 0) {
36
+ let _batchPropsValues = {};
37
+ for (let propName of batchPropsNames) {
38
+ _batchPropsValues[propName] = props[propName];
39
+ }
40
+ setProps({
41
+ batchPropsValues: _batchPropsValues
42
+ })
43
+ }
44
+ })
45
+
32
46
  const context = useContext(PropsContext)
33
47
 
34
48
  options = options || []
@@ -233,18 +247,4 @@ AntdSegmented.defaultProps = {
233
247
  batchPropsNames: []
234
248
  }
235
249
 
236
- export default React.memo(
237
- AntdSegmented,
238
- (prevProps, nextProps) => {
239
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
240
- let _batchPropsValues = {};
241
- for (let propName of nextProps.batchPropsNames) {
242
- _batchPropsValues[propName] = nextProps[propName];
243
- }
244
- nextProps.setProps({
245
- batchPropsValues: _batchPropsValues
246
- })
247
- }
248
- return false;
249
- }
250
- );
250
+ export default AntdSegmented;
@@ -792,7 +792,7 @@ AntdTable.propTypes = {
792
792
  // 自定义空数据状态内容
793
793
  emptyContent: PropTypes.node,
794
794
 
795
- // 设置是否开启单元格渲染优化,默认为true
795
+ // 设置是否开启单元格渲染优化,默认为false
796
796
  cellUpdateOptimize: PropTypes.bool,
797
797
 
798
798
  // 再渲染模式
@@ -886,6 +886,11 @@ AntdTable.propTypes = {
886
886
  // 用于设置需要进行隐藏的行对应key值数组,默认为[]
887
887
  hiddenRowKeys: PropTypes.arrayOf(PropTypes.string),
888
888
 
889
+ // 用于设置是否针对data参数进行深比较,从而避免React默认的浅比较prop导致部分数据变化情况下未刷新的问题
890
+ // 开启此功能后,在数据量较大时会对刷新性能造成负面影响
891
+ // 默认:false
892
+ dataDeepCompare: PropTypes.bool,
893
+
889
894
  loading_state: PropTypes.shape({
890
895
  /**
891
896
  * Determines if the component is loading or not
@@ -941,7 +946,8 @@ AntdTable.defaultProps = {
941
946
  miniChartHeight: 30,
942
947
  miniChartAnimation: false,
943
948
  // dropdown模式相关
944
- nClicksDropdownItem: 0
949
+ nClicksDropdownItem: 0,
950
+ dataDeepCompare: false
945
951
  };
946
952
 
947
953
  export default AntdTable;
@@ -2,6 +2,7 @@ import React, { useEffect, useRef, useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Tree, Tooltip, Dropdown, Rate } from 'antd';
4
4
  import AntdIcon from '../general/AntdIcon.react';
5
+ import Highlighter from 'react-highlight-words';
5
6
  import { omitBy, isUndefined, isString, isObject, isArray, cloneDeep } from 'lodash';
6
7
  import { flatToTree } from '../utils';
7
8
  import useCss from '../../hooks/useCss';
@@ -23,6 +24,31 @@ const isSameParent = (a, b) => {
23
24
  return aLevel.join('') === bLevel.join('');
24
25
  }
25
26
 
27
+ const filterTree = (toFilterData, keyword) => {
28
+ return toFilterData.filter(node => {
29
+ // 首先检查当前节点是否匹配关键字
30
+ const isMatch = node.title.includes(keyword);
31
+
32
+ // 如果当前节点匹配关键字,但不是根节点,才保留它及其全部后代节点信息
33
+ if (isMatch) {
34
+ return true;
35
+ }
36
+
37
+ // 如果当前节点不匹配关键字,检查它的子节点
38
+ if (node.children && node.children.length > 0) {
39
+ node.children = filterTree(node.children, keyword);
40
+
41
+ // 如果有匹配的子节点,保留当前节点及其匹配的后代节点信息
42
+ if (node.children.length > 0) {
43
+ return true;
44
+ }
45
+ }
46
+
47
+ // 如果当前节点和它的子节点都不匹配,返回 false,表示不保留该节点
48
+ return false;
49
+ });
50
+ }
51
+
26
52
  // 定义树形控件AntdTree,api参数参考https://ant.design/components/tree-cn/
27
53
  const AntdTree = (props) => {
28
54
 
@@ -55,6 +81,8 @@ const AntdTree = (props) => {
55
81
  enableNodeFavorites,
56
82
  favoritedKeys,
57
83
  scrollTarget,
84
+ searchKeyword,
85
+ highlightStyle,
58
86
  nodeCheckedSuffix,
59
87
  nodeUncheckedSuffix,
60
88
  nodeCheckedStyle,
@@ -62,9 +90,23 @@ const AntdTree = (props) => {
62
90
  persistence,
63
91
  persisted_props,
64
92
  persistence_type,
65
- loading_state
93
+ loading_state,
94
+ batchPropsNames
66
95
  } = props;
67
96
 
97
+ // 批属性监听
98
+ useEffect(() => {
99
+ if (batchPropsNames && batchPropsNames.length !== 0) {
100
+ let _batchPropsValues = {};
101
+ for (let propName of batchPropsNames) {
102
+ _batchPropsValues[propName] = props[propName];
103
+ }
104
+ setProps({
105
+ batchPropsValues: _batchPropsValues
106
+ })
107
+ }
108
+ })
109
+
68
110
  const treeRef = useRef(null);
69
111
 
70
112
  // 控制一次性scrollTarget动作
@@ -267,7 +309,11 @@ const AntdTree = (props) => {
267
309
  style={style}
268
310
  key={key}
269
311
  ref={treeRef}
270
- treeData={add_leaf_node_icon(cloneDeep(treeData))}
312
+ treeData={
313
+ searchKeyword ?
314
+ add_leaf_node_icon(filterTree(cloneDeep(treeData), searchKeyword)) :
315
+ add_leaf_node_icon(cloneDeep(treeData))
316
+ }
271
317
  selectedKeys={selectedKeys}
272
318
  checkedKeys={checkedKeys}
273
319
  selectable={selectable}
@@ -333,7 +379,16 @@ const AntdTree = (props) => {
333
379
  ...(checkedKeys?.includes(nodeData.key) ? nodeCheckedStyle : nodeUncheckedStyle),
334
380
  ...nodeData.style // 优先级更高
335
381
  }}>
336
- {nodeData.title}
382
+ {
383
+ searchKeyword ?
384
+ <Highlighter
385
+ highlightStyle={highlightStyle}
386
+ searchWords={[searchKeyword]}
387
+ autoEscape
388
+ textToHighlight={nodeData.title}
389
+ /> :
390
+ nodeData.title
391
+ }
337
392
  {
338
393
  // 若当前节点满足收藏控件渲染条件
339
394
  enableNodeFavorites && (isUndefined(nodeData.enableFavorites) || nodeData.enableFavorites) ?
@@ -368,7 +423,16 @@ const AntdTree = (props) => {
368
423
  ...(checkedKeys?.includes(nodeData.key) ? nodeCheckedStyle : nodeUncheckedStyle),
369
424
  ...nodeData.style // 优先级更高
370
425
  }}>
371
- {nodeData.title}
426
+ {
427
+ searchKeyword ?
428
+ <Highlighter
429
+ highlightStyle={highlightStyle}
430
+ searchWords={[searchKeyword]}
431
+ autoEscape
432
+ textToHighlight={nodeData.title}
433
+ /> :
434
+ nodeData.title
435
+ }
372
436
  {
373
437
  // 若当前节点满足收藏控件渲染条件
374
438
  enableNodeFavorites && (isUndefined(nodeData.enableFavorites) || nodeData.enableFavorites) ?
@@ -669,6 +733,12 @@ AntdTree.propTypes = {
669
733
  offset: PropTypes.number
670
734
  }),
671
735
 
736
+ // 联动树搜索时使用,用于设置针对树节点title进行搜索的关键词
737
+ searchKeyword: PropTypes.string,
738
+
739
+ // 配合searchKeyword参数使用,用于设置树节点title命中关键词部分的高亮样式
740
+ highlightStyle: PropTypes.object,
741
+
672
742
  // 节点拓展元素相关功能
673
743
  // 为节点元素设置勾选状态下的后缀元素
674
744
  nodeCheckedSuffix: PropTypes.node,
@@ -752,6 +822,12 @@ AntdTree.defaultProps = {
752
822
  showLine: { 'showLeafIcon': false },
753
823
  draggable: false,
754
824
  dragInSameLevel: false,
825
+ highlightStyle: {
826
+ fontWeight: 'bold',
827
+ backgroundColor: 'transparent',
828
+ padding: 0,
829
+ color: '#ff5500'
830
+ },
755
831
  enableNodeFavorites: false,
756
832
  favoritedKeys: [],
757
833
  persisted_props: ['selectedKeys', 'checkedKeys', 'expandedKeys', 'halfCheckedKeys'],
@@ -759,18 +835,4 @@ AntdTree.defaultProps = {
759
835
  batchPropsNames: []
760
836
  }
761
837
 
762
- export default React.memo(
763
- AntdTree,
764
- (prevProps, nextProps) => {
765
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
766
- let _batchPropsValues = {};
767
- for (let propName of nextProps.batchPropsNames) {
768
- _batchPropsValues[propName] = nextProps[propName];
769
- }
770
- nextProps.setProps({
771
- batchPropsValues: _batchPropsValues
772
- })
773
- }
774
- return false;
775
- }
776
- );
838
+ export default AntdTree;
@@ -46,9 +46,23 @@ const AntdCascader = (props) => {
46
46
  persistence,
47
47
  persisted_props,
48
48
  persistence_type,
49
- loading_state
49
+ loading_state,
50
+ batchPropsNames
50
51
  } = props;
51
52
 
53
+ // 批属性监听
54
+ useEffect(() => {
55
+ if (batchPropsNames && batchPropsNames.length !== 0) {
56
+ let _batchPropsValues = {};
57
+ for (let propName of batchPropsNames) {
58
+ _batchPropsValues[propName] = props[propName];
59
+ }
60
+ setProps({
61
+ batchPropsValues: _batchPropsValues
62
+ })
63
+ }
64
+ })
65
+
52
66
  const context = useContext(PropsContext)
53
67
  locale = (context && context.locale) || locale
54
68
 
@@ -372,18 +386,4 @@ AntdCascader.defaultProps = {
372
386
  batchPropsNames: []
373
387
  }
374
388
 
375
- export default React.memo(
376
- AntdCascader,
377
- (prevProps, nextProps) => {
378
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
379
- let _batchPropsValues = {};
380
- for (let propName of nextProps.batchPropsNames) {
381
- _batchPropsValues[propName] = nextProps[propName];
382
- }
383
- nextProps.setProps({
384
- batchPropsValues: _batchPropsValues
385
- })
386
- }
387
- return false;
388
- }
389
- );
389
+ export default AntdCascader;
@@ -1,4 +1,4 @@
1
- import React, { useContext } from 'react';
1
+ import React, { useContext, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Checkbox } from 'antd';
4
4
  import { isString, isUndefined } from 'lodash';
@@ -23,9 +23,23 @@ const AntdCheckbox = (props) => {
23
23
  persistence,
24
24
  persisted_props,
25
25
  persistence_type,
26
- loading_state
26
+ loading_state,
27
+ batchPropsNames
27
28
  } = props;
28
29
 
30
+ // 批属性监听
31
+ useEffect(() => {
32
+ if (batchPropsNames && batchPropsNames.length !== 0) {
33
+ let _batchPropsValues = {};
34
+ for (let propName of batchPropsNames) {
35
+ _batchPropsValues[propName] = props[propName];
36
+ }
37
+ setProps({
38
+ batchPropsValues: _batchPropsValues
39
+ })
40
+ }
41
+ })
42
+
29
43
  const context = useContext(PropsContext)
30
44
 
31
45
  const onChange = e => {
@@ -166,18 +180,4 @@ AntdCheckbox.defaultProps = {
166
180
  batchPropsNames: []
167
181
  }
168
182
 
169
- export default React.memo(
170
- AntdCheckbox,
171
- (prevProps, nextProps) => {
172
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
173
- let _batchPropsValues = {};
174
- for (let propName of nextProps.batchPropsNames) {
175
- _batchPropsValues[propName] = nextProps[propName];
176
- }
177
- nextProps.setProps({
178
- batchPropsValues: _batchPropsValues
179
- })
180
- }
181
- return false;
182
- }
183
- );
183
+ export default AntdCheckbox;
@@ -1,4 +1,4 @@
1
- import React, { useContext } from 'react';
1
+ import React, { useContext, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Checkbox } from 'antd';
4
4
  import { isString, isUndefined } from 'lodash';
@@ -22,9 +22,23 @@ const AntdCheckboxGroup = (props) => {
22
22
  persistence,
23
23
  persisted_props,
24
24
  persistence_type,
25
- loading_state
25
+ loading_state,
26
+ batchPropsNames
26
27
  } = props;
27
28
 
29
+ // 批属性监听
30
+ useEffect(() => {
31
+ if (batchPropsNames && batchPropsNames.length !== 0) {
32
+ let _batchPropsValues = {};
33
+ for (let propName of batchPropsNames) {
34
+ _batchPropsValues[propName] = props[propName];
35
+ }
36
+ setProps({
37
+ batchPropsValues: _batchPropsValues
38
+ })
39
+ }
40
+ })
41
+
28
42
  const context = useContext(PropsContext)
29
43
 
30
44
  const onChange = e => {
@@ -176,18 +190,4 @@ AntdCheckboxGroup.defaultProps = {
176
190
  batchPropsNames: []
177
191
  }
178
192
 
179
- export default React.memo(
180
- AntdCheckboxGroup,
181
- (prevProps, nextProps) => {
182
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
183
- let _batchPropsValues = {};
184
- for (let propName of nextProps.batchPropsNames) {
185
- _batchPropsValues[propName] = nextProps[propName];
186
- }
187
- nextProps.setProps({
188
- batchPropsValues: _batchPropsValues
189
- })
190
- }
191
- return false;
192
- }
193
- );
193
+ export default AntdCheckboxGroup;
@@ -40,9 +40,23 @@ const AntdDatePicker = (props) => {
40
40
  persistence,
41
41
  persisted_props,
42
42
  persistence_type,
43
- loading_state
43
+ loading_state,
44
+ batchPropsNames
44
45
  } = props;
45
46
 
47
+ // 批属性监听
48
+ useEffect(() => {
49
+ if (batchPropsNames && batchPropsNames.length !== 0) {
50
+ let _batchPropsValues = {};
51
+ for (let propName of batchPropsNames) {
52
+ _batchPropsValues[propName] = props[propName];
53
+ }
54
+ setProps({
55
+ batchPropsValues: _batchPropsValues
56
+ })
57
+ }
58
+ })
59
+
46
60
  const context = useContext(PropsContext)
47
61
  locale = (context && context.locale) || locale
48
62
 
@@ -601,18 +615,4 @@ AntdDatePicker.defaultProps = {
601
615
  batchPropsNames: []
602
616
  }
603
617
 
604
- export default React.memo(
605
- AntdDatePicker,
606
- (prevProps, nextProps) => {
607
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
608
- let _batchPropsValues = {};
609
- for (let propName of nextProps.batchPropsNames) {
610
- _batchPropsValues[propName] = nextProps[propName];
611
- }
612
- nextProps.setProps({
613
- batchPropsValues: _batchPropsValues
614
- })
615
- }
616
- return false;
617
- }
618
- );
618
+ export default AntdDatePicker;
@@ -42,9 +42,23 @@ const AntdDateRangePicker = (props) => {
42
42
  persistence,
43
43
  persisted_props,
44
44
  persistence_type,
45
- loading_state
45
+ loading_state,
46
+ batchPropsNames
46
47
  } = props;
47
48
 
49
+ // 批属性监听
50
+ useEffect(() => {
51
+ if (batchPropsNames && batchPropsNames.length !== 0) {
52
+ let _batchPropsValues = {};
53
+ for (let propName of batchPropsNames) {
54
+ _batchPropsValues[propName] = props[propName];
55
+ }
56
+ setProps({
57
+ batchPropsValues: _batchPropsValues
58
+ })
59
+ }
60
+ })
61
+
48
62
  const context = useContext(PropsContext)
49
63
  locale = (context && context.locale) || locale
50
64
 
@@ -625,18 +639,4 @@ AntdDateRangePicker.defaultProps = {
625
639
  batchPropsNames: []
626
640
  }
627
641
 
628
- export default React.memo(
629
- AntdDateRangePicker,
630
- (prevProps, nextProps) => {
631
- if (nextProps.batchPropsNames && nextProps.batchPropsNames.length !== 0) {
632
- let _batchPropsValues = {};
633
- for (let propName of nextProps.batchPropsNames) {
634
- _batchPropsValues[propName] = nextProps[propName];
635
- }
636
- nextProps.setProps({
637
- batchPropsValues: _batchPropsValues
638
- })
639
- }
640
- return false;
641
- }
642
- );
642
+ export default AntdDateRangePicker;