@douyinfe/semi-ui 2.1.0-beta.0 → 2.1.0-beta.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.
@@ -31452,14 +31452,14 @@ class option_Option extends external_root_React_commonjs2_react_commonjs_react_a
31452
31452
  style: style
31453
31453
  }, showTick ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
31454
31454
  className: selectedIconClassName
31455
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconTick, null)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
31455
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconTick, null)) : null, Object(isString["a" /* default */])(children) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
31456
31456
  className: "".concat(prefixCls, "-text")
31457
31457
  }, this.renderOptionContent({
31458
31458
  children,
31459
31459
  config,
31460
31460
  inputValue,
31461
31461
  prefixCls
31462
- })));
31462
+ })) : children);
31463
31463
  }
31464
31464
 
31465
31465
  }
@@ -41192,6 +41192,7 @@ function max_max(array) {
41192
41192
 
41193
41193
 
41194
41194
 
41195
+
41195
41196
  /**
41196
41197
  * Part of the utils function implementation process reference
41197
41198
  * https://github.com/react-component/tree/blob/master/src/util.tsx
@@ -41694,7 +41695,9 @@ function normalizeKeyList(keyList, keyEntities) {
41694
41695
  res.push(key);
41695
41696
  });
41696
41697
  } else {
41697
- res = filter_default()(keyList).call(keyList, key => keyEntities[key] && !treeUtil_isValid(keyEntities[key].children));
41698
+ var _context8;
41699
+
41700
+ res = filter_default()(_context8 = from_default()(keyList)).call(_context8, key => keyEntities[key] && !treeUtil_isValid(keyEntities[key].children));
41698
41701
  }
41699
41702
 
41700
41703
  return res;
@@ -41703,9 +41706,9 @@ function getMotionKeys(eventKey, expandedKeys, keyEntities) {
41703
41706
  const res = [];
41704
41707
 
41705
41708
  const getChild = itemKey => {
41706
- var _context8;
41709
+ var _context9;
41707
41710
 
41708
- keyEntities[itemKey].children && for_each_default()(_context8 = keyEntities[itemKey].children).call(_context8, item => {
41711
+ keyEntities[itemKey].children && for_each_default()(_context9 = keyEntities[itemKey].children).call(_context9, item => {
41709
41712
  const {
41710
41713
  key
41711
41714
  } = item;
@@ -41821,7 +41824,7 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
41821
41824
  };
41822
41825
  }
41823
41826
  function filterTreeData(info) {
41824
- var _context9, _context10;
41827
+ var _context10, _context11;
41825
41828
 
41826
41829
  const {
41827
41830
  showFilteredOnly,
@@ -41833,7 +41836,7 @@ function filterTreeData(info) {
41833
41836
  prevExpandedKeys
41834
41837
  } = info;
41835
41838
  let filteredOptsKeys = [];
41836
- filteredOptsKeys = map_default()(_context9 = filter_default()(_context10 = values_default()(keyEntities)).call(_context10, item => treeUtil_filter(inputValue, item.data, filterTreeNode, filterProps))).call(_context9, item => item.key);
41839
+ filteredOptsKeys = map_default()(_context10 = filter_default()(_context11 = values_default()(keyEntities)).call(_context11, item => treeUtil_filter(inputValue, item.data, filterTreeNode, filterProps))).call(_context10, item => item.key);
41837
41840
  let expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
41838
41841
 
41839
41842
  if (prevExpandedKeys.length) {
@@ -41874,9 +41877,9 @@ function updateKeys(keySet, keyEntities) {
41874
41877
  return filter_default()(keyArr).call(keyArr, key => key in keyEntities);
41875
41878
  }
41876
41879
  function calcDisabledKeys(keyEntities) {
41877
- var _context11;
41880
+ var _context12;
41878
41881
 
41879
- const disabledKeys = filter_default()(_context11 = keys_default()(keyEntities)).call(_context11, key => keyEntities[key].data.disabled);
41882
+ const disabledKeys = filter_default()(_context12 = keys_default()(keyEntities)).call(_context12, key => keyEntities[key].data.disabled);
41880
41883
 
41881
41884
  const {
41882
41885
  checkedKeys
@@ -45176,15 +45179,27 @@ class cascader_Cascader extends baseComponent_BaseComponent {
45176
45179
  this.renderCustomTrigger = () => {
45177
45180
  const {
45178
45181
  disabled,
45179
- triggerRender
45182
+ triggerRender,
45183
+ multiple,
45184
+ autoMergeValue
45180
45185
  } = this.props;
45181
45186
  const {
45182
45187
  selectedKeys,
45183
45188
  inputValue,
45184
- inputPlaceHolder
45189
+ inputPlaceHolder,
45190
+ mergedCheckedKeys,
45191
+ checkedKeys
45185
45192
  } = this.state;
45193
+ let realValue;
45194
+
45195
+ if (multiple) {
45196
+ realValue = autoMergeValue ? mergedCheckedKeys : checkedKeys;
45197
+ } else {
45198
+ realValue = [...selectedKeys][0];
45199
+ }
45200
+
45186
45201
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(trigger_0, {
45187
- value: [...selectedKeys][0],
45202
+ value: realValue,
45188
45203
  inputValue: inputValue,
45189
45204
  onChange: this.handleInputChange,
45190
45205
  onClear: this.handleClear,
@@ -69906,12 +69921,14 @@ class foundation_SelectFoundation extends foundation {
69906
69921
  let optionNotExist = {
69907
69922
  value: propValue,
69908
69923
  label: propValue,
69909
- _notExist: true
69924
+ _notExist: true,
69925
+ _scrollIndex: -1
69910
69926
  };
69911
69927
 
69912
69928
  if (onChangeWithObject) {
69913
69929
  optionNotExist = assign_default()(assign_default()({}, propValue), {
69914
- _notExist: true
69930
+ _notExist: true,
69931
+ _scrollIndex: -1
69915
69932
  });
69916
69933
  }
69917
69934
 
@@ -69970,7 +69987,9 @@ class foundation_SelectFoundation extends foundation {
69970
69987
  onChangeWithObject ? optionNotExist = assign_default()(assign_default()({}, propValue[i]), {
69971
69988
  _notExist: true
69972
69989
  }) : null;
69973
- selections.set(optionNotExist.label, optionNotExist);
69990
+ selections.set(optionNotExist.label, assign_default()(assign_default()({}, optionNotExist), {
69991
+ _scrollIndex: -1
69992
+ }));
69974
69993
  }
69975
69994
  }
69976
69995
  });
@@ -70155,7 +70174,7 @@ class foundation_SelectFoundation extends foundation {
70155
70174
  this._adapter.notifyMaxLimit(assign_default()({
70156
70175
  value,
70157
70176
  label
70158
- }, rest));
70177
+ }, lodash_es_omit(rest, '_scrollIndex')));
70159
70178
 
70160
70179
  return;
70161
70180
  } else {
@@ -70656,6 +70675,7 @@ class foundation_SelectFoundation extends foundation {
70656
70675
  delete option._parentGroup;
70657
70676
  delete option._show;
70658
70677
  delete option._selected;
70678
+ delete option._scrollIndex;
70659
70679
 
70660
70680
  if ('_keyInOptionList' in option) {
70661
70681
  option.key = option._keyInOptionList;
@@ -70992,7 +71012,7 @@ var utils_rest = undefined && undefined.__rest || function (s, e) {
70992
71012
 
70993
71013
 
70994
71014
 
70995
- const generateOption = (child, parent) => {
71015
+ const generateOption = (child, parent, index) => {
70996
71016
  const childProps = child.props;
70997
71017
 
70998
71018
  if (!child || !childProps) {
@@ -71004,7 +71024,8 @@ const generateOption = (child, parent) => {
71004
71024
  // Drop-down menu rendering priority label value, children, value in turn downgrade
71005
71025
  label: childProps.label || childProps.children || childProps.value,
71006
71026
  _show: true,
71007
- _selected: false
71027
+ _selected: false,
71028
+ _scrollIndex: index
71008
71029
  }, childProps), {
71009
71030
  _parentGroup: parent
71010
71031
  });
@@ -71027,11 +71048,13 @@ const getOptionsFromGroup = selectChildren => {
71027
71048
  const childNodes = filter_default()(_context = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(selectChildren)).call(_context, childNode => childNode && childNode.props);
71028
71049
 
71029
71050
  let type = '';
71051
+ let optionIndex = -1;
71030
71052
 
71031
71053
  for_each_default()(childNodes).call(childNodes, child => {
71032
71054
  if (child.type.isSelectOption) {
71033
71055
  type = 'option';
71034
- const option = generateOption(child);
71056
+ optionIndex++;
71057
+ const option = generateOption(child, undefined, optionIndex);
71035
71058
  emptyGroup.children.push(option);
71036
71059
  options.push(option);
71037
71060
  } else if (child.type.isSelectOptionGroup) {
@@ -71046,7 +71069,10 @@ const getOptionsFromGroup = selectChildren => {
71046
71069
 
71047
71070
  children = external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Children.toArray(children);
71048
71071
 
71049
- const childrenOption = map_default()(children).call(children, option => generateOption(option, restGroupProps));
71072
+ const childrenOption = map_default()(children).call(children, option => {
71073
+ optionIndex++;
71074
+ return generateOption(option, restGroupProps, optionIndex);
71075
+ });
71050
71076
 
71051
71077
  const group = assign_default()(assign_default()({}, child.props), {
71052
71078
  children: childrenOption,
@@ -71311,9 +71337,10 @@ class select_Select extends baseComponent_BaseComponent {
71311
71337
  } = _this.props;
71312
71338
 
71313
71339
  if (optionList && optionList.length) {
71314
- options = map_default()(optionList).call(optionList, itemOpt => assign_default()({
71340
+ options = map_default()(optionList).call(optionList, (itemOpt, index) => assign_default()({
71315
71341
  _show: true,
71316
- _selected: false
71342
+ _selected: false,
71343
+ _scrollIndex: index
71317
71344
  }, itemOpt));
71318
71345
  optionGroups[0] = {
71319
71346
  children: options,
@@ -71888,15 +71915,21 @@ class select_Select extends baseComponent_BaseComponent {
71888
71915
  }
71889
71916
 
71890
71917
  if (virtualize) {
71891
- let minKey;
71918
+ let minItemIndex = -1;
71919
+
71920
+ for_each_default()(selections).call(selections, item => {
71921
+ const itemIndex = Object(lodash_es_get["a" /* default */])(item, '_scrollIndex');
71922
+ /* When the itemIndex is legal */
71892
71923
 
71893
- for_each_default()(selections).call(selections, (v, k) => {
71894
- const tempKey = Number(String(k).match(/option-(.*)/)[1]);
71895
- minKey = typeof minKey === 'number' && minKey < tempKey ? minKey : tempKey;
71924
+ if (lodash_es_isNumber(itemIndex) && itemIndex >= 0) {
71925
+ minItemIndex = minItemIndex !== -1 && minItemIndex < itemIndex ? minItemIndex : itemIndex;
71926
+ }
71896
71927
  });
71897
71928
 
71898
- if (minKey) {
71899
- this.virtualizeListRef.current.scrollToItem(minKey, 'center');
71929
+ if (minItemIndex !== -1) {
71930
+ try {
71931
+ this.virtualizeListRef.current.scrollToItem(minItemIndex, 'center');
71932
+ } catch (error) {}
71900
71933
  }
71901
71934
  } else {
71902
71935
  this.foundation.updateScrollTop();