rsuite 4.10.8 → 4.11.0

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>;
@@ -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
  });
@@ -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
 
@@ -36,7 +29,7 @@ export interface SelectProps<ValueType = any> {
36
29
  onGroupTitleClick?: (event: React.SyntheticEvent<any>) => void;
37
30
 
38
31
  /** Called when searching */
39
- onSearch?: (searchKeyword: string, event: React.SyntheticEvent<any>) => void;
32
+ onSearch?: (searchKeyword: string, event?: React.SyntheticEvent<any>) => void;
40
33
 
41
34
  /** Called when clean */
42
35
  onClean?: (event: React.SyntheticEvent<any>) => void;
@@ -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
 
@@ -239,18 +239,19 @@ function (_React$Component) {
239
239
  };
240
240
 
241
241
  _this.handleExit = function () {
242
- var _this$props$onClose, _this$props6;
242
+ var _this$props$onSearch, _this$props6, _this$props$onClose, _this$props7;
243
243
 
244
244
  _this.setState({
245
245
  searchKeyword: '',
246
246
  active: false
247
247
  });
248
248
 
249
- (_this$props$onClose = (_this$props6 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props6);
249
+ (_this$props$onSearch = (_this$props6 = _this.props).onSearch) === null || _this$props$onSearch === void 0 ? void 0 : _this$props$onSearch.call(_this$props6, '');
250
+ (_this$props$onClose = (_this$props7 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props7);
250
251
  };
251
252
 
252
253
  _this.handleOpen = function () {
253
- var _this$props$onOpen, _this$props7;
254
+ var _this$props$onOpen, _this$props8;
254
255
 
255
256
  var value = _this.getValue();
256
257
 
@@ -259,7 +260,7 @@ function (_React$Component) {
259
260
  focusItemValue: value
260
261
  });
261
262
 
262
- (_this$props$onOpen = (_this$props7 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props7);
263
+ (_this$props$onOpen = (_this$props8 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props8);
263
264
  };
264
265
 
265
266
  _this.addPrefix = function (name) {
@@ -303,9 +304,9 @@ function (_React$Component) {
303
304
  * @param {node} label
304
305
  */
305
306
  _proto.shouldDisplay = function shouldDisplay(item, word) {
306
- var _this$props8 = this.props,
307
- searchBy = _this$props8.searchBy,
308
- labelKey = _this$props8.labelKey;
307
+ var _this$props9 = this.props,
308
+ searchBy = _this$props9.searchBy,
309
+ labelKey = _this$props9.labelKey;
309
310
  var label = item === null || item === void 0 ? void 0 : item[labelKey];
310
311
  var searchKeyword = typeof word === 'undefined' ? this.state.searchKeyword : word;
311
312
 
@@ -334,18 +335,18 @@ function (_React$Component) {
334
335
  _proto.renderDropdownMenu = function renderDropdownMenu() {
335
336
  var _this4 = this;
336
337
 
337
- var _this$props9 = this.props,
338
- data = _this$props9.data,
339
- groupBy = _this$props9.groupBy,
340
- searchable = _this$props9.searchable,
341
- locale = _this$props9.locale,
342
- renderMenu = _this$props9.renderMenu,
343
- renderExtraFooter = _this$props9.renderExtraFooter,
344
- menuClassName = _this$props9.menuClassName,
345
- menuStyle = _this$props9.menuStyle,
346
- menuAutoWidth = _this$props9.menuAutoWidth,
347
- sort = _this$props9.sort,
348
- virtualized = _this$props9.virtualized;
338
+ var _this$props10 = this.props,
339
+ data = _this$props10.data,
340
+ groupBy = _this$props10.groupBy,
341
+ searchable = _this$props10.searchable,
342
+ locale = _this$props10.locale,
343
+ renderMenu = _this$props10.renderMenu,
344
+ renderExtraFooter = _this$props10.renderExtraFooter,
345
+ menuClassName = _this$props10.menuClassName,
346
+ menuStyle = _this$props10.menuStyle,
347
+ menuAutoWidth = _this$props10.menuAutoWidth,
348
+ sort = _this$props10.sort,
349
+ virtualized = _this$props10.virtualized;
349
350
  var focusItemValue = this.state.focusItemValue;
350
351
  var classes = classNames(this.addPrefix('select-menu'), menuClassName);
351
352
  var filteredData = filterNodesOfTree(data, function (item) {
@@ -390,22 +391,22 @@ function (_React$Component) {
390
391
  };
391
392
 
392
393
  _proto.render = function render() {
393
- var _this$props10 = this.props,
394
- data = _this$props10.data,
395
- valueKey = _this$props10.valueKey,
396
- labelKey = _this$props10.labelKey,
397
- placeholder = _this$props10.placeholder,
398
- renderValue = _this$props10.renderValue,
399
- disabled = _this$props10.disabled,
400
- cleanable = _this$props10.cleanable,
401
- locale = _this$props10.locale,
402
- toggleComponentClass = _this$props10.toggleComponentClass,
403
- style = _this$props10.style,
404
- onEntered = _this$props10.onEntered,
405
- onExited = _this$props10.onExited,
406
- onClean = _this$props10.onClean,
407
- positionRef = _this$props10.positionRef,
408
- rest = _objectWithoutPropertiesLoose(_this$props10, ["data", "valueKey", "labelKey", "placeholder", "renderValue", "disabled", "cleanable", "locale", "toggleComponentClass", "style", "onEntered", "onExited", "onClean", "positionRef"]);
394
+ var _this$props11 = this.props,
395
+ data = _this$props11.data,
396
+ valueKey = _this$props11.valueKey,
397
+ labelKey = _this$props11.labelKey,
398
+ placeholder = _this$props11.placeholder,
399
+ renderValue = _this$props11.renderValue,
400
+ disabled = _this$props11.disabled,
401
+ cleanable = _this$props11.cleanable,
402
+ locale = _this$props11.locale,
403
+ toggleComponentClass = _this$props11.toggleComponentClass,
404
+ style = _this$props11.style,
405
+ onEntered = _this$props11.onEntered,
406
+ onExited = _this$props11.onExited,
407
+ onClean = _this$props11.onClean,
408
+ positionRef = _this$props11.positionRef,
409
+ rest = _objectWithoutPropertiesLoose(_this$props11, ["data", "valueKey", "labelKey", "placeholder", "renderValue", "disabled", "cleanable", "locale", "toggleComponentClass", "style", "onEntered", "onExited", "onClean", "positionRef"]);
409
410
 
410
411
  var unhandled = getUnhandledProps(SelectPicker, rest);
411
412
  var value = this.getValue(); // Find active `MenuItem` by `value`
@@ -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>;
@@ -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
  });
@@ -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
 
@@ -36,7 +29,7 @@ export interface SelectProps<ValueType = any> {
36
29
  onGroupTitleClick?: (event: React.SyntheticEvent<any>) => void;
37
30
 
38
31
  /** Called when searching */
39
- onSearch?: (searchKeyword: string, event: React.SyntheticEvent<any>) => void;
32
+ onSearch?: (searchKeyword: string, event?: React.SyntheticEvent<any>) => void;
40
33
 
41
34
  /** Called when clean */
42
35
  onClean?: (event: React.SyntheticEvent<any>) => void;
@@ -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
 
@@ -264,18 +264,19 @@ function (_React$Component) {
264
264
  };
265
265
 
266
266
  _this.handleExit = function () {
267
- var _this$props$onClose, _this$props6;
267
+ var _this$props$onSearch, _this$props6, _this$props$onClose, _this$props7;
268
268
 
269
269
  _this.setState({
270
270
  searchKeyword: '',
271
271
  active: false
272
272
  });
273
273
 
274
- (_this$props$onClose = (_this$props6 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props6);
274
+ (_this$props$onSearch = (_this$props6 = _this.props).onSearch) === null || _this$props$onSearch === void 0 ? void 0 : _this$props$onSearch.call(_this$props6, '');
275
+ (_this$props$onClose = (_this$props7 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props7);
275
276
  };
276
277
 
277
278
  _this.handleOpen = function () {
278
- var _this$props$onOpen, _this$props7;
279
+ var _this$props$onOpen, _this$props8;
279
280
 
280
281
  var value = _this.getValue();
281
282
 
@@ -284,7 +285,7 @@ function (_React$Component) {
284
285
  focusItemValue: value
285
286
  });
286
287
 
287
- (_this$props$onOpen = (_this$props7 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props7);
288
+ (_this$props$onOpen = (_this$props8 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props8);
288
289
  };
289
290
 
290
291
  _this.addPrefix = function (name) {
@@ -328,9 +329,9 @@ function (_React$Component) {
328
329
  * @param {node} label
329
330
  */
330
331
  _proto.shouldDisplay = function shouldDisplay(item, word) {
331
- var _this$props8 = this.props,
332
- searchBy = _this$props8.searchBy,
333
- labelKey = _this$props8.labelKey;
332
+ var _this$props9 = this.props,
333
+ searchBy = _this$props9.searchBy,
334
+ labelKey = _this$props9.labelKey;
334
335
  var label = item === null || item === void 0 ? void 0 : item[labelKey];
335
336
  var searchKeyword = typeof word === 'undefined' ? this.state.searchKeyword : word;
336
337
 
@@ -359,18 +360,18 @@ function (_React$Component) {
359
360
  _proto.renderDropdownMenu = function renderDropdownMenu() {
360
361
  var _this4 = this;
361
362
 
362
- var _this$props9 = this.props,
363
- data = _this$props9.data,
364
- groupBy = _this$props9.groupBy,
365
- searchable = _this$props9.searchable,
366
- locale = _this$props9.locale,
367
- renderMenu = _this$props9.renderMenu,
368
- renderExtraFooter = _this$props9.renderExtraFooter,
369
- menuClassName = _this$props9.menuClassName,
370
- menuStyle = _this$props9.menuStyle,
371
- menuAutoWidth = _this$props9.menuAutoWidth,
372
- sort = _this$props9.sort,
373
- virtualized = _this$props9.virtualized;
363
+ var _this$props10 = this.props,
364
+ data = _this$props10.data,
365
+ groupBy = _this$props10.groupBy,
366
+ searchable = _this$props10.searchable,
367
+ locale = _this$props10.locale,
368
+ renderMenu = _this$props10.renderMenu,
369
+ renderExtraFooter = _this$props10.renderExtraFooter,
370
+ menuClassName = _this$props10.menuClassName,
371
+ menuStyle = _this$props10.menuStyle,
372
+ menuAutoWidth = _this$props10.menuAutoWidth,
373
+ sort = _this$props10.sort,
374
+ virtualized = _this$props10.virtualized;
374
375
  var focusItemValue = this.state.focusItemValue;
375
376
  var classes = (0, _classnames.default)(this.addPrefix('select-menu'), menuClassName);
376
377
  var filteredData = (0, _treeUtils.filterNodesOfTree)(data, function (item) {
@@ -414,22 +415,22 @@ function (_React$Component) {
414
415
  };
415
416
 
416
417
  _proto.render = function render() {
417
- var _this$props10 = this.props,
418
- data = _this$props10.data,
419
- valueKey = _this$props10.valueKey,
420
- labelKey = _this$props10.labelKey,
421
- placeholder = _this$props10.placeholder,
422
- renderValue = _this$props10.renderValue,
423
- disabled = _this$props10.disabled,
424
- cleanable = _this$props10.cleanable,
425
- locale = _this$props10.locale,
426
- toggleComponentClass = _this$props10.toggleComponentClass,
427
- style = _this$props10.style,
428
- onEntered = _this$props10.onEntered,
429
- onExited = _this$props10.onExited,
430
- onClean = _this$props10.onClean,
431
- positionRef = _this$props10.positionRef,
432
- rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props10, ["data", "valueKey", "labelKey", "placeholder", "renderValue", "disabled", "cleanable", "locale", "toggleComponentClass", "style", "onEntered", "onExited", "onClean", "positionRef"]);
418
+ var _this$props11 = this.props,
419
+ data = _this$props11.data,
420
+ valueKey = _this$props11.valueKey,
421
+ labelKey = _this$props11.labelKey,
422
+ placeholder = _this$props11.placeholder,
423
+ renderValue = _this$props11.renderValue,
424
+ disabled = _this$props11.disabled,
425
+ cleanable = _this$props11.cleanable,
426
+ locale = _this$props11.locale,
427
+ toggleComponentClass = _this$props11.toggleComponentClass,
428
+ style = _this$props11.style,
429
+ onEntered = _this$props11.onEntered,
430
+ onExited = _this$props11.onExited,
431
+ onClean = _this$props11.onClean,
432
+ positionRef = _this$props11.positionRef,
433
+ rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props11, ["data", "valueKey", "labelKey", "placeholder", "renderValue", "disabled", "cleanable", "locale", "toggleComponentClass", "style", "onEntered", "onExited", "onClean", "positionRef"]);
433
434
  var unhandled = (0, _utils.getUnhandledProps)(SelectPicker, rest);
434
435
  var value = this.getValue(); // Find active `MenuItem` by `value`
435
436
 
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "4.10.8",
3
+ "version": "4.11.0",
4
4
  "description": "A suite of react components",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -63,7 +63,7 @@
63
63
  "prop-types": "^15.7.2",
64
64
  "react-lifecycles-compat": "^3.0.4",
65
65
  "react-virtualized": "^9.21.0",
66
- "rsuite-table": "^3.16.0",
66
+ "rsuite-table": "^3.16.1",
67
67
  "schema-typed": "^1.5.1"
68
68
  },
69
69
  "peerDependencies": {
@@ -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>;
@@ -144,7 +144,8 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
144
144
  check: nextValue,
145
145
  expand: nextExpandItemValues
146
146
  },
147
- props
147
+ props,
148
+ true
148
149
  );
149
150
 
150
151
  this.state = {
@@ -582,7 +583,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
582
583
  return list;
583
584
  }
584
585
 
585
- unserializeLists(lists: any, nextProps: CheckTreePickerProps = this.props) {
586
+ unserializeLists(lists: any, nextProps: CheckTreePickerProps = this.props, initial = false) {
586
587
  const { valueKey, cascade, uncheckableItemValues = [] } = nextProps;
587
588
  const expandAll = getExpandAll(nextProps);
588
589
  // Reset values to false
@@ -613,7 +614,7 @@ class CheckTreePicker extends React.Component<CheckTreePickerProps, CheckTreePic
613
614
  }
614
615
  });
615
616
  } else {
616
- this.nodes[refKey][listKey] = expandAll;
617
+ this.nodes[refKey][listKey] = initial ? expandAll : false;
617
618
  }
618
619
  }
619
620
  });