rsuite 4.10.10 → 4.11.1

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.
@@ -1,14 +1,21 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { FormControlPickerProps } from '../@types/common';
4
- import { SelectProps } from '../SelectPicker/SelectPicker.d';
3
+ import { FormControlPickerProps, ItemDataType } from '../@types/common';
4
+ import { BaseSelectProps } from '../SelectPicker/SelectPicker.d';
5
5
 
6
- export interface CheckPickerProps extends FormControlPickerProps<any[]>, SelectProps<any[]> {
6
+ export interface CheckPickerProps extends FormControlPickerProps<any[]>, BaseSelectProps {
7
7
  /** Top the selected option in the options */
8
8
  sticky?: boolean;
9
9
 
10
10
  /** A picker that can be counted */
11
11
  countable?: boolean;
12
+
13
+ /** Custom render selected items */
14
+ renderValue?: (
15
+ value: any[],
16
+ item: ItemDataType[],
17
+ selectedElement: React.ReactNode
18
+ ) => React.ReactNode;
12
19
  }
13
20
 
14
21
  declare const CheckPicker: React.ComponentType<CheckPickerProps>;
@@ -21,7 +21,7 @@ import { CHECK_STATE } from '../constants';
21
21
  import { clone, defaultProps, prefix, defaultClassPrefix, getUnhandledProps, createChainedFunction, mergeRefs } from '../utils';
22
22
  import { PickerToggle, getToggleWrapperClassName, onMenuKeyDown, MenuWrapper, SearchBar, SelectedElement, PickerToggleTrigger, createConcatChildrenFunction, shouldDisplay } from '../Picker';
23
23
  import { isEveryChildChecked, isSomeChildChecked, isSomeNodeHasChildren, getSiblingNodeUncheckable, getEveryFisrtLevelNodeUncheckable, getUncheckableState, getFormattedTree, getDisabledState } from './utils';
24
- import { compareArray, shouldShowNodeByExpanded, flattenTree, getNodeParents, getVirtualLisHeight, hasVisibleChildren, treeDeprecatedWarning, getExpandItemValues, getExpandAll, getExpandState, getExpandWhenSearching } from '../utils/treeUtils';
24
+ import { compareArray, shouldShowNodeByExpanded, flattenTree, getNodeParents, hasVisibleChildren, treeDeprecatedWarning, getExpandItemValues, getExpandAll, getExpandState, getExpandWhenSearching } from '../utils/treeUtils';
25
25
  import { listPickerPropTypes, listPickerDefaultProps } from '../Picker/propTypes'; // default value for virtualized
26
26
 
27
27
  var defaultHeight = 360;
@@ -427,7 +427,7 @@ function (_React$Component) {
427
427
  _this.unserializeLists({
428
428
  check: nextValue,
429
429
  expand: _nextExpandItemValues
430
- }, _props);
430
+ }, _props, true);
431
431
 
432
432
  _this.state = {
433
433
  data: data,
@@ -901,13 +901,17 @@ function (_React$Component) {
901
901
  return list;
902
902
  };
903
903
 
904
- _proto.unserializeLists = function unserializeLists(lists, nextProps) {
904
+ _proto.unserializeLists = function unserializeLists(lists, nextProps, initial) {
905
905
  var _this8 = this;
906
906
 
907
907
  if (nextProps === void 0) {
908
908
  nextProps = this.props;
909
909
  }
910
910
 
911
+ if (initial === void 0) {
912
+ initial = false;
913
+ }
914
+
911
915
  var _nextProps = nextProps,
912
916
  valueKey = _nextProps.valueKey,
913
917
  cascade = _nextProps.cascade,
@@ -945,7 +949,7 @@ function (_React$Component) {
945
949
  }
946
950
  });
947
951
  } else {
948
- _this8.nodes[refKey][listKey] = expandAll;
952
+ _this8.nodes[refKey][listKey] = initial ? expandAll : false;
949
953
  }
950
954
  }
951
955
  });
@@ -1024,13 +1028,10 @@ function (_React$Component) {
1024
1028
 
1025
1029
  _proto.renderDropdownMenu = function renderDropdownMenu() {
1026
1030
  var _this$props10 = this.props,
1027
- _this$props10$height = _this$props10.height,
1028
- height = _this$props10$height === void 0 ? defaultHeight : _this$props10$height,
1029
1031
  locale = _this$props10.locale,
1030
1032
  menuStyle = _this$props10.menuStyle,
1031
1033
  searchable = _this$props10.searchable,
1032
1034
  renderMenu = _this$props10.renderMenu,
1033
- virtualized = _this$props10.virtualized,
1034
1035
  searchKeyword = _this$props10.searchKeyword,
1035
1036
  renderExtraFooter = _this$props10.renderExtraFooter,
1036
1037
  menuClassName = _this$props10.menuClassName,
@@ -1038,13 +1039,10 @@ function (_React$Component) {
1038
1039
  var keyword = !_isUndefined(searchKeyword) ? searchKeyword : this.state.searchKeyword;
1039
1040
  var classes = classNames(menuClassName, this.addPrefix('check-tree-menu'));
1040
1041
  var menu = this.renderCheckTree();
1041
- var styles = virtualized ? _extends({
1042
- height: height
1043
- }, menuStyle) : menuStyle;
1044
1042
  return React.createElement(MenuWrapper, {
1045
1043
  autoWidth: menuAutoWidth,
1046
1044
  className: classes,
1047
- style: styles,
1045
+ style: menuStyle,
1048
1046
  ref: this.menuRef,
1049
1047
  getToggleInstance: this.getToggleInstance,
1050
1048
  getPositionInstance: this.getPositionInstance
@@ -1192,8 +1190,7 @@ function (_React$Component) {
1192
1190
  className = _this$props13.className,
1193
1191
  onScroll = _this$props13.onScroll,
1194
1192
  locale = _this$props13.locale,
1195
- virtualized = _this$props13.virtualized,
1196
- searchable = _this$props13.searchable; // 树节点的层级
1193
+ virtualized = _this$props13.virtualized; // 树节点的层级
1197
1194
 
1198
1195
  var layer = 0;
1199
1196
  var classes = classNames(defaultClassPrefix('check-tree'), (_classNames2 = {}, _classNames2[className] = inline, _classNames2['without-children'] = !isSomeNodeHasChildren, _classNames2));
@@ -1221,34 +1218,37 @@ function (_React$Component) {
1221
1218
  className: this.addPrefix('none')
1222
1219
  }, locale.noResultsText);
1223
1220
  }
1224
- } // 当未定义 height 设置了 virtualized true,treeHeight 设置默认高度
1221
+ } // The height of virtualized tree should be subtract the value of paddingBottom
1225
1222
 
1226
1223
 
1227
- var treeHeight = _isUndefined(height) && virtualized ? defaultHeight : height;
1224
+ var treeHeight = height - 12;
1228
1225
  var treeWidth = _isUndefined(style === null || style === void 0 ? void 0 : style.width) ? defaultWidth : style.width;
1229
- var styles = inline ? _extends({
1230
- height: treeHeight
1231
- }, style) : {};
1226
+ var listStyles = inline ? _extends({
1227
+ height: height
1228
+ }, style) : style;
1232
1229
  var treeNodesClass = classNames(this.addTreePrefix('nodes'), (_classNames3 = {}, _classNames3[this.addTreePrefix('all-uncheckable')] = getEveryFisrtLevelNodeUncheckable(this.nodes), _classNames3));
1233
- var listHeight = getVirtualLisHeight(inline, searchable, treeHeight);
1234
1230
  return React.createElement("div", {
1235
1231
  ref: this.treeViewRef,
1236
1232
  className: classes,
1237
- style: styles,
1233
+ style: listStyles,
1238
1234
  onScroll: onScroll,
1239
1235
  onKeyDown: this.handleKeyDown
1240
1236
  }, React.createElement("div", {
1241
1237
  className: treeNodesClass
1242
1238
  }, virtualized ? React.createElement(AutoSizer, {
1243
- defaultHeight: listHeight,
1244
- defaultWidth: treeWidth
1239
+ defaultHeight: treeHeight,
1240
+ defaultWidth: treeWidth,
1241
+ style: {
1242
+ width: 'auto',
1243
+ height: 'auto'
1244
+ }
1245
1245
  }, function (_ref3) {
1246
1246
  var height = _ref3.height,
1247
1247
  width = _ref3.width;
1248
1248
  return React.createElement(List, {
1249
1249
  ref: _this11.listRef,
1250
1250
  width: width || treeWidth,
1251
- height: height || listHeight,
1251
+ height: height,
1252
1252
  rowHeight: 36,
1253
1253
  rowCount: formattedNodes.length,
1254
1254
  rowRenderer: _this11.measureRowRenderer(formattedNodes)
@@ -1369,6 +1369,7 @@ CheckTreePicker.propTypes = _extends({}, listPickerPropTypes, {
1369
1369
  searchBy: PropTypes.func
1370
1370
  });
1371
1371
  CheckTreePicker.defaultProps = _extends({}, listPickerDefaultProps, {
1372
+ height: defaultHeight,
1372
1373
  cascade: true,
1373
1374
  countable: true,
1374
1375
  searchable: true,
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import { FormControlPickerProps } from '../@types/common';
4
- import { SelectProps } from '../SelectPicker/SelectPicker.d';
4
+ import { BaseSelectProps } from '../SelectPicker/SelectPicker.d';
5
5
  import { TagProps } from '../Tag/Tag.d';
6
6
 
7
- export interface InputPickerProps extends FormControlPickerProps<any>, SelectProps<any> {
7
+ export interface InputPickerProps extends FormControlPickerProps<any>, BaseSelectProps {
8
8
  /** Settings can create new options */
9
9
  creatable?: boolean;
10
10
 
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { FormControlPickerProps, ItemDataType } from '../@types/common';
4
4
  import { ListProps } from 'react-virtualized/dist/commonjs/List';
5
5
 
6
- export interface SelectProps<ValueType = any> {
6
+ export interface BaseSelectProps {
7
7
  /** Set group condition key in data */
8
8
  groupBy?: string;
9
9
 
@@ -22,13 +22,6 @@ export interface SelectProps<ValueType = any> {
22
22
  /** Custom render menu group */
23
23
  renderMenuGroup?: (title: React.ReactNode, item: ItemDataType) => React.ReactNode;
24
24
 
25
- /** Custom render selected items */
26
- renderValue?: (
27
- value: ValueType,
28
- item: ItemDataType | ItemDataType[],
29
- selectedElement: React.ReactNode
30
- ) => React.ReactNode;
31
-
32
25
  /** Called when the option is selected */
33
26
  onSelect?: (value: any, item: ItemDataType, event: React.SyntheticEvent<any>) => void;
34
27
 
@@ -53,6 +46,14 @@ export interface SelectProps<ValueType = any> {
53
46
  /** Custom search rules. */
54
47
  searchBy?: (keyword: string, label: React.ReactNode, item: ItemDataType) => boolean;
55
48
  }
49
+ export interface SelectProps<ValueType> extends BaseSelectProps {
50
+ /** Custom render selected items */
51
+ renderValue?: (
52
+ value: ValueType,
53
+ item: ItemDataType,
54
+ selectedElement: React.ReactNode
55
+ ) => React.ReactNode;
56
+ }
56
57
 
57
58
  export interface SelectPickerProps extends FormControlPickerProps<any>, SelectProps<any> {}
58
59
 
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { FormControlPickerProps } from '../@types/common';
4
- import { SelectProps } from '../SelectPicker/SelectPicker.d';
3
+ import { FormControlPickerProps, ItemDataType } from '../@types/common';
4
+ import { BaseSelectProps } from '../SelectPicker/SelectPicker.d';
5
5
  import { TagProps } from '../Tag/Tag.d';
6
6
 
7
- export interface TagPickerProps extends FormControlPickerProps, SelectProps<any[]> {
7
+ export interface TagPickerProps extends FormControlPickerProps, BaseSelectProps {
8
8
  /** Option to cache value when searching asynchronously */
9
9
  cacheData?: any[];
10
10
 
@@ -16,6 +16,13 @@ export interface TagPickerProps extends FormControlPickerProps, SelectProps<any[
16
16
  * https://github.com/rsuite/rsuite/blob/master/src/Tag/Tag.d.ts
17
17
  */
18
18
  tagProps?: TagProps;
19
+
20
+ /** Custom render selected items */
21
+ renderValue?: (
22
+ value: any[],
23
+ item: ItemDataType[],
24
+ selectedElement: React.ReactNode
25
+ ) => React.ReactNode;
19
26
  }
20
27
 
21
28
  declare const TagPicker: React.ComponentType<TagPickerProps>;
@@ -20,7 +20,7 @@ import { polyfill } from 'react-lifecycles-compat';
20
20
  import shallowEqual from '../utils/shallowEqual';
21
21
  import TreeNode from './TreeNode';
22
22
  import { defaultProps, prefix, defaultClassPrefix, getUnhandledProps, createChainedFunction, mergeRefs } from '../utils';
23
- import { flattenTree, getExpandWhenSearching, getNodeParents, shouldShowNodeByExpanded, getVirtualLisHeight, treeDeprecatedWarning, hasVisibleChildren, compareArray, getExpandAll, getExpandItemValues, getExpandState, getDragNodeKeys, calDropNodePosition, createUpdateTreeDataFunction } from '../utils/treeUtils';
23
+ import { flattenTree, getExpandWhenSearching, getNodeParents, shouldShowNodeByExpanded, treeDeprecatedWarning, hasVisibleChildren, compareArray, getExpandAll, getExpandItemValues, getExpandState, getDragNodeKeys, calDropNodePosition, createUpdateTreeDataFunction } from '../utils/treeUtils';
24
24
  import { PickerToggle, getToggleWrapperClassName, onMenuKeyDown, MenuWrapper, SearchBar, PickerToggleTrigger, createConcatChildrenFunction, shouldDisplay } from '../Picker';
25
25
  import { TREE_NODE_DROP_POSITION } from '../constants';
26
26
  import { listPickerPropTypes, listPickerDefaultProps } from '../Picker/propTypes'; // default value for virtualized
@@ -547,7 +547,7 @@ function (_React$Component) {
547
547
  nextState.selectedValue = value;
548
548
  }
549
549
 
550
- if (compareArray(expandItemValues, prevState.expandItemValues)) {
550
+ if (compareArray(expandItemValues, prevState.expandItemValues) && Array.isArray(expandItemValues)) {
551
551
  nextState.expandItemValues = expandItemValues;
552
552
  }
553
553
 
@@ -639,7 +639,7 @@ function (_React$Component) {
639
639
  _proto.updateExpandItemValuesChange = function updateExpandItemValuesChange(prevState) {
640
640
  var expandItemValues = this.props.expandItemValues;
641
641
 
642
- if (compareArray(expandItemValues, prevState.expandItemValues)) {
642
+ if (compareArray(expandItemValues, prevState.expandItemValues) && Array.isArray(expandItemValues)) {
643
643
  this.unserializeLists('expand', expandItemValues);
644
644
  this.setState({
645
645
  expandItemValues: expandItemValues
@@ -1002,26 +1002,20 @@ function (_React$Component) {
1002
1002
 
1003
1003
  _proto.renderDropdownMenu = function renderDropdownMenu() {
1004
1004
  var _this$props16 = this.props,
1005
- _this$props16$height = _this$props16.height,
1006
- height = _this$props16$height === void 0 ? defaultHeight : _this$props16$height,
1007
1005
  searchable = _this$props16.searchable,
1008
1006
  searchKeyword = _this$props16.searchKeyword,
1009
1007
  renderExtraFooter = _this$props16.renderExtraFooter,
1010
1008
  locale = _this$props16.locale,
1011
1009
  renderMenu = _this$props16.renderMenu,
1012
1010
  menuStyle = _this$props16.menuStyle,
1013
- virtualized = _this$props16.virtualized,
1014
1011
  menuClassName = _this$props16.menuClassName,
1015
1012
  menuAutoWidth = _this$props16.menuAutoWidth;
1016
1013
  var keyword = !_isUndefined(searchKeyword) ? searchKeyword : this.state.searchKeyword;
1017
1014
  var classes = classNames(menuClassName, this.addPrefix('tree-menu'));
1018
- var styles = virtualized ? _extends({
1019
- height: height
1020
- }, menuStyle) : menuStyle;
1021
1015
  return React.createElement(MenuWrapper, {
1022
1016
  autoWidth: menuAutoWidth,
1023
1017
  className: classes,
1024
- style: styles,
1018
+ style: menuStyle,
1025
1019
  ref: this.menuRef,
1026
1020
  getToggleInstance: this.getToggleInstance,
1027
1021
  getPositionInstance: this.getPositionInstance
@@ -1122,8 +1116,7 @@ function (_React$Component) {
1122
1116
  inline = _this$props18.inline,
1123
1117
  style = _this$props18.style,
1124
1118
  locale = _this$props18.locale,
1125
- virtualized = _this$props18.virtualized,
1126
- searchable = _this$props18.searchable;
1119
+ virtualized = _this$props18.virtualized;
1127
1120
  var layer = 0;
1128
1121
  var classes = classNames(defaultClassPrefix('tree'), (_classNames2 = {}, _classNames2[className] = inline, _classNames2));
1129
1122
  var nodes = [];
@@ -1150,33 +1143,36 @@ function (_React$Component) {
1150
1143
  className: this.addPrefix('none')
1151
1144
  }, locale.noResultsText);
1152
1145
  }
1153
- } // 当未定义 height 设置了 virtualized true,treeHeight 设置默认高度
1146
+ } // The height of virtualized tree should be subtract the value of paddingBottom
1154
1147
 
1155
1148
 
1156
- var treeHeight = _isUndefined(height) && virtualized ? defaultHeight : height;
1149
+ var treeHeight = height - 12;
1157
1150
  var treeWidth = _isUndefined(style === null || style === void 0 ? void 0 : style.width) ? defaultWidth : style.width;
1158
- var styles = inline ? _extends({
1159
- height: treeHeight
1160
- }, style) : {};
1161
- var listHeight = getVirtualLisHeight(inline, searchable, treeHeight);
1151
+ var listStyles = inline ? _extends({
1152
+ height: height
1153
+ }, style) : style;
1162
1154
  return React.createElement(React.Fragment, null, React.createElement("div", {
1163
1155
  ref: this.treeViewRef,
1164
1156
  className: classes,
1165
- style: styles,
1157
+ style: listStyles,
1166
1158
  onKeyDown: this.handleKeyDown
1167
1159
  }, React.createElement("div", {
1168
1160
  className: this.addTreePrefix('nodes')
1169
1161
  }, virtualized ? React.createElement(AutoSizer, {
1170
- defaultHeight: listHeight,
1171
- defaultWidth: treeWidth
1162
+ defaultHeight: treeHeight,
1163
+ defaultWidth: treeWidth,
1164
+ style: {
1165
+ width: 'auto',
1166
+ height: 'auto'
1167
+ }
1172
1168
  }, function (_ref4) {
1173
1169
  var height = _ref4.height,
1174
1170
  width = _ref4.width;
1175
1171
  return React.createElement(List, {
1176
1172
  ref: _this9.listRef,
1177
1173
  width: width || treeWidth,
1178
- height: height || listHeight,
1179
- rowHeight: 38,
1174
+ height: height,
1175
+ rowHeight: 36,
1180
1176
  rowCount: nodes.length,
1181
1177
  rowRenderer: _this9.measureRowRenderer(nodes)
1182
1178
  });
@@ -1306,6 +1302,7 @@ TreePicker.propTypes = _extends({}, listPickerPropTypes, {
1306
1302
  searchBy: PropTypes.func
1307
1303
  });
1308
1304
  TreePicker.defaultProps = _extends({}, listPickerDefaultProps, {
1305
+ height: defaultHeight,
1309
1306
  searchable: true,
1310
1307
  menuAutoWidth: true,
1311
1308
  locale: {
@@ -8,12 +8,11 @@ import _intersection from "lodash/intersection";
8
8
  import shallowEqual from '../utils/shallowEqual';
9
9
  import shallowEqualArray from '../utils/shallowEqualArray';
10
10
  import { TREE_NODE_DROP_POSITION } from '../constants';
11
- var SEARCH_BAR_HEIGHT = 48;
12
- var MENU_PADDING = 12; // Tree Node 之间的 间隔
13
-
11
+ // Tree Node 之间的 间隔
14
12
  var TREE_NODE_GAP = 4;
15
13
  /**
16
- * 判断当前节点是否应该显示
14
+ * Whether current node is visible
15
+ * when all the parents of the current node is expanded, the current node should be visible
17
16
  * @param {*} expandItemValues
18
17
  * @param {*} parentKeys
19
18
  */
@@ -95,20 +94,6 @@ export function getNodeParents(node, parentKey, valueKey) {
95
94
  traverse(node);
96
95
  return parents;
97
96
  }
98
- /**
99
- * 获取 VirtualList 的高度
100
- * @param {*} inline
101
- * @param {*} height
102
- */
103
-
104
- export function getVirtualLisHeight(inline, searchable, height) {
105
- if (height === void 0) {
106
- height = 0;
107
- }
108
-
109
- var searchBarHeight = searchable ? SEARCH_BAR_HEIGHT : 0;
110
- return inline ? height - MENU_PADDING * 2 : height - searchBarHeight - MENU_PADDING * 2;
111
- }
112
97
  /**
113
98
  * 判断节点是否存在可见的子节点。
114
99
  * @param node
@@ -1,14 +1,21 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { FormControlPickerProps } from '../@types/common';
4
- import { SelectProps } from '../SelectPicker/SelectPicker.d';
3
+ import { FormControlPickerProps, ItemDataType } from '../@types/common';
4
+ import { BaseSelectProps } from '../SelectPicker/SelectPicker.d';
5
5
 
6
- export interface CheckPickerProps extends FormControlPickerProps<any[]>, SelectProps<any[]> {
6
+ export interface CheckPickerProps extends FormControlPickerProps<any[]>, BaseSelectProps {
7
7
  /** Top the selected option in the options */
8
8
  sticky?: boolean;
9
9
 
10
10
  /** A picker that can be counted */
11
11
  countable?: boolean;
12
+
13
+ /** Custom render selected items */
14
+ renderValue?: (
15
+ value: any[],
16
+ item: ItemDataType[],
17
+ selectedElement: React.ReactNode
18
+ ) => React.ReactNode;
12
19
  }
13
20
 
14
21
  declare const CheckPicker: React.ComponentType<CheckPickerProps>;
@@ -461,7 +461,7 @@ function (_React$Component) {
461
461
  _this.unserializeLists({
462
462
  check: nextValue,
463
463
  expand: _nextExpandItemValues
464
- }, _props);
464
+ }, _props, true);
465
465
 
466
466
  _this.state = {
467
467
  data: data,
@@ -935,13 +935,17 @@ function (_React$Component) {
935
935
  return list;
936
936
  };
937
937
 
938
- _proto.unserializeLists = function unserializeLists(lists, nextProps) {
938
+ _proto.unserializeLists = function unserializeLists(lists, nextProps, initial) {
939
939
  var _this8 = this;
940
940
 
941
941
  if (nextProps === void 0) {
942
942
  nextProps = this.props;
943
943
  }
944
944
 
945
+ if (initial === void 0) {
946
+ initial = false;
947
+ }
948
+
945
949
  var _nextProps = nextProps,
946
950
  valueKey = _nextProps.valueKey,
947
951
  cascade = _nextProps.cascade,
@@ -979,7 +983,7 @@ function (_React$Component) {
979
983
  }
980
984
  });
981
985
  } else {
982
- _this8.nodes[refKey][listKey] = expandAll;
986
+ _this8.nodes[refKey][listKey] = initial ? expandAll : false;
983
987
  }
984
988
  }
985
989
  });
@@ -1058,13 +1062,10 @@ function (_React$Component) {
1058
1062
 
1059
1063
  _proto.renderDropdownMenu = function renderDropdownMenu() {
1060
1064
  var _this$props10 = this.props,
1061
- _this$props10$height = _this$props10.height,
1062
- height = _this$props10$height === void 0 ? defaultHeight : _this$props10$height,
1063
1065
  locale = _this$props10.locale,
1064
1066
  menuStyle = _this$props10.menuStyle,
1065
1067
  searchable = _this$props10.searchable,
1066
1068
  renderMenu = _this$props10.renderMenu,
1067
- virtualized = _this$props10.virtualized,
1068
1069
  searchKeyword = _this$props10.searchKeyword,
1069
1070
  renderExtraFooter = _this$props10.renderExtraFooter,
1070
1071
  menuClassName = _this$props10.menuClassName,
@@ -1072,13 +1073,10 @@ function (_React$Component) {
1072
1073
  var keyword = !(0, _isUndefined2.default)(searchKeyword) ? searchKeyword : this.state.searchKeyword;
1073
1074
  var classes = (0, _classnames.default)(menuClassName, this.addPrefix('check-tree-menu'));
1074
1075
  var menu = this.renderCheckTree();
1075
- var styles = virtualized ? (0, _extends2.default)({
1076
- height: height
1077
- }, menuStyle) : menuStyle;
1078
1076
  return React.createElement(_Picker.MenuWrapper, {
1079
1077
  autoWidth: menuAutoWidth,
1080
1078
  className: classes,
1081
- style: styles,
1079
+ style: menuStyle,
1082
1080
  ref: this.menuRef,
1083
1081
  getToggleInstance: this.getToggleInstance,
1084
1082
  getPositionInstance: this.getPositionInstance
@@ -1226,8 +1224,7 @@ function (_React$Component) {
1226
1224
  className = _this$props13.className,
1227
1225
  onScroll = _this$props13.onScroll,
1228
1226
  locale = _this$props13.locale,
1229
- virtualized = _this$props13.virtualized,
1230
- searchable = _this$props13.searchable; // 树节点的层级
1227
+ virtualized = _this$props13.virtualized; // 树节点的层级
1231
1228
 
1232
1229
  var layer = 0;
1233
1230
  var classes = (0, _classnames.default)((0, _utils.defaultClassPrefix)('check-tree'), (_classNames2 = {}, _classNames2[className] = inline, _classNames2['without-children'] = !isSomeNodeHasChildren, _classNames2));
@@ -1255,34 +1252,37 @@ function (_React$Component) {
1255
1252
  className: this.addPrefix('none')
1256
1253
  }, locale.noResultsText);
1257
1254
  }
1258
- } // 当未定义 height 设置了 virtualized true,treeHeight 设置默认高度
1255
+ } // The height of virtualized tree should be subtract the value of paddingBottom
1259
1256
 
1260
1257
 
1261
- var treeHeight = (0, _isUndefined2.default)(height) && virtualized ? defaultHeight : height;
1258
+ var treeHeight = height - 12;
1262
1259
  var treeWidth = (0, _isUndefined2.default)(style === null || style === void 0 ? void 0 : style.width) ? defaultWidth : style.width;
1263
- var styles = inline ? (0, _extends2.default)({
1264
- height: treeHeight
1265
- }, style) : {};
1260
+ var listStyles = inline ? (0, _extends2.default)({
1261
+ height: height
1262
+ }, style) : style;
1266
1263
  var treeNodesClass = (0, _classnames.default)(this.addTreePrefix('nodes'), (_classNames3 = {}, _classNames3[this.addTreePrefix('all-uncheckable')] = (0, _utils2.getEveryFisrtLevelNodeUncheckable)(this.nodes), _classNames3));
1267
- var listHeight = (0, _treeUtils.getVirtualLisHeight)(inline, searchable, treeHeight);
1268
1264
  return React.createElement("div", {
1269
1265
  ref: this.treeViewRef,
1270
1266
  className: classes,
1271
- style: styles,
1267
+ style: listStyles,
1272
1268
  onScroll: onScroll,
1273
1269
  onKeyDown: this.handleKeyDown
1274
1270
  }, React.createElement("div", {
1275
1271
  className: treeNodesClass
1276
1272
  }, virtualized ? React.createElement(_AutoSizer.default, {
1277
- defaultHeight: listHeight,
1278
- defaultWidth: treeWidth
1273
+ defaultHeight: treeHeight,
1274
+ defaultWidth: treeWidth,
1275
+ style: {
1276
+ width: 'auto',
1277
+ height: 'auto'
1278
+ }
1279
1279
  }, function (_ref3) {
1280
1280
  var height = _ref3.height,
1281
1281
  width = _ref3.width;
1282
1282
  return React.createElement(_List.default, {
1283
1283
  ref: _this11.listRef,
1284
1284
  width: width || treeWidth,
1285
- height: height || listHeight,
1285
+ height: height,
1286
1286
  rowHeight: 36,
1287
1287
  rowCount: formattedNodes.length,
1288
1288
  rowRenderer: _this11.measureRowRenderer(formattedNodes)
@@ -1400,6 +1400,7 @@ CheckTreePicker.propTypes = (0, _extends2.default)({}, _propTypes2.listPickerPro
1400
1400
  searchBy: _propTypes.default.func
1401
1401
  });
1402
1402
  CheckTreePicker.defaultProps = (0, _extends2.default)({}, _propTypes2.listPickerDefaultProps, {
1403
+ height: defaultHeight,
1403
1404
  cascade: true,
1404
1405
  countable: true,
1405
1406
  searchable: true,
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import { FormControlPickerProps } from '../@types/common';
4
- import { SelectProps } from '../SelectPicker/SelectPicker.d';
4
+ import { BaseSelectProps } from '../SelectPicker/SelectPicker.d';
5
5
  import { TagProps } from '../Tag/Tag.d';
6
6
 
7
- export interface InputPickerProps extends FormControlPickerProps<any>, SelectProps<any> {
7
+ export interface InputPickerProps extends FormControlPickerProps<any>, BaseSelectProps {
8
8
  /** Settings can create new options */
9
9
  creatable?: boolean;
10
10
 
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { FormControlPickerProps, ItemDataType } from '../@types/common';
4
4
  import { ListProps } from 'react-virtualized/dist/commonjs/List';
5
5
 
6
- export interface SelectProps<ValueType = any> {
6
+ export interface BaseSelectProps {
7
7
  /** Set group condition key in data */
8
8
  groupBy?: string;
9
9
 
@@ -22,13 +22,6 @@ export interface SelectProps<ValueType = any> {
22
22
  /** Custom render menu group */
23
23
  renderMenuGroup?: (title: React.ReactNode, item: ItemDataType) => React.ReactNode;
24
24
 
25
- /** Custom render selected items */
26
- renderValue?: (
27
- value: ValueType,
28
- item: ItemDataType | ItemDataType[],
29
- selectedElement: React.ReactNode
30
- ) => React.ReactNode;
31
-
32
25
  /** Called when the option is selected */
33
26
  onSelect?: (value: any, item: ItemDataType, event: React.SyntheticEvent<any>) => void;
34
27
 
@@ -53,6 +46,14 @@ export interface SelectProps<ValueType = any> {
53
46
  /** Custom search rules. */
54
47
  searchBy?: (keyword: string, label: React.ReactNode, item: ItemDataType) => boolean;
55
48
  }
49
+ export interface SelectProps<ValueType> extends BaseSelectProps {
50
+ /** Custom render selected items */
51
+ renderValue?: (
52
+ value: ValueType,
53
+ item: ItemDataType,
54
+ selectedElement: React.ReactNode
55
+ ) => React.ReactNode;
56
+ }
56
57
 
57
58
  export interface SelectPickerProps extends FormControlPickerProps<any>, SelectProps<any> {}
58
59
 
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { FormControlPickerProps } from '../@types/common';
4
- import { SelectProps } from '../SelectPicker/SelectPicker.d';
3
+ import { FormControlPickerProps, ItemDataType } from '../@types/common';
4
+ import { BaseSelectProps } from '../SelectPicker/SelectPicker.d';
5
5
  import { TagProps } from '../Tag/Tag.d';
6
6
 
7
- export interface TagPickerProps extends FormControlPickerProps, SelectProps<any[]> {
7
+ export interface TagPickerProps extends FormControlPickerProps, BaseSelectProps {
8
8
  /** Option to cache value when searching asynchronously */
9
9
  cacheData?: any[];
10
10
 
@@ -16,6 +16,13 @@ export interface TagPickerProps extends FormControlPickerProps, SelectProps<any[
16
16
  * https://github.com/rsuite/rsuite/blob/master/src/Tag/Tag.d.ts
17
17
  */
18
18
  tagProps?: TagProps;
19
+
20
+ /** Custom render selected items */
21
+ renderValue?: (
22
+ value: any[],
23
+ item: ItemDataType[],
24
+ selectedElement: React.ReactNode
25
+ ) => React.ReactNode;
19
26
  }
20
27
 
21
28
  declare const TagPicker: React.ComponentType<TagPickerProps>;