@douyinfe/semi-ui 2.45.3-alpha.0 → 2.46.0-beta.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.
@@ -37008,6 +37008,8 @@ class CascaderFoundation extends foundation {
37008
37008
  init() {
37009
37009
  const isOpen = this.getProp('open') || this.getProp('defaultOpen');
37010
37010
  this.collectOptions(true);
37011
+ this._adapter.updateLoadingKeyRefValue(new Set());
37012
+ this._adapter.updateLoadedKeyRefValue(new Set());
37011
37013
  if (isOpen && !this._isDisabled()) {
37012
37014
  this.open();
37013
37015
  }
@@ -37194,11 +37196,11 @@ class CascaderFoundation extends foundation {
37194
37196
  } = this.getProps();
37195
37197
  const {
37196
37198
  activeKeys,
37197
- loadingKeys,
37198
37199
  loading,
37199
37200
  keyEntities: keyEntityState,
37200
37201
  selectedKeys: selectedKeysState
37201
37202
  } = this.getStates();
37203
+ const loadingKeys = this._adapter.getLoadingKeyRefValue();
37202
37204
  const filterable = this._isFilterable();
37203
37205
  const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
37204
37206
  const valuePath = onChangeWithObject ? util_normalizedArr(value).map(i => i.value) : util_normalizedArr(value);
@@ -37446,17 +37448,18 @@ class CascaderFoundation extends foundation {
37446
37448
  data,
37447
37449
  key
37448
37450
  } = item;
37449
- const {
37450
- loadedKeys: prevLoadedKeys,
37451
- loadingKeys: prevLoadingKeys
37452
- } = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
37451
+ const prevLoadingKeys = cloneDeep_default()(this._adapter.getLoadingKeyRefValue());
37452
+ const prevLoadedKeys = cloneDeep_default()(this._adapter.getLoadedKeyRefValue());
37453
37453
  const newLoadedKeys = prevLoadedKeys.add(key);
37454
37454
  const newLoadingKeys = new Set([...prevLoadingKeys]);
37455
37455
  newLoadingKeys.delete(key);
37456
37456
  // onLoad should trigger before internal setState to avoid `loadData` trigger twice.
37457
37457
  this._adapter.notifyOnLoad(newLoadedKeys, data);
37458
+ this._adapter.updateLoadingKeyRefValue(newLoadingKeys);
37459
+ this._adapter.updateLoadedKeyRefValue(newLoadedKeys);
37458
37460
  this._adapter.updateStates({
37459
- loadingKeys: newLoadingKeys
37461
+ loadingKeys: newLoadingKeys,
37462
+ loadedKeys: newLoadedKeys
37460
37463
  });
37461
37464
  }
37462
37465
  notifyIfLoadData(item) {
@@ -37468,10 +37471,8 @@ class CascaderFoundation extends foundation {
37468
37471
  loading: false
37469
37472
  });
37470
37473
  if (!data.isLeaf && !data.children && this.getProp('loadData')) {
37471
- const {
37472
- loadedKeys,
37473
- loadingKeys
37474
- } = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
37474
+ const loadedKeys = this._adapter.getLoadedKeyRefValue();
37475
+ const loadingKeys = cloneDeep_default()(this._adapter.getLoadingKeyRefValue());
37475
37476
  if (loadedKeys.has(key) || loadingKeys.has(key)) {
37476
37477
  return;
37477
37478
  }
@@ -37482,8 +37483,10 @@ class CascaderFoundation extends foundation {
37482
37483
  keyEntities
37483
37484
  } = this.getStates();
37484
37485
  const optionPath = this.getItemPropPath(key, [], keyEntities);
37486
+ const newLoadingKeys = loadingKeys.add(key);
37487
+ this._adapter.updateLoadingKeyRefValue(newLoadingKeys);
37485
37488
  this._adapter.updateStates({
37486
- loadingKeys: loadingKeys.add(key)
37489
+ loadingKeys: newLoadingKeys
37487
37490
  });
37488
37491
  this._adapter.notifyLoadData(optionPath, this.handleNodeLoad.bind(this, item));
37489
37492
  }
@@ -47979,6 +47982,8 @@ class Cascader extends BaseComponent {
47979
47982
  this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
47980
47983
  this.clickOutsideHandler = null;
47981
47984
  this.foundation = new CascaderFoundation(this.adapter);
47985
+ this.loadingKeysRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
47986
+ this.loadedKeysRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
47982
47987
  }
47983
47988
  get adapter() {
47984
47989
  var _this = this;
@@ -48124,6 +48129,18 @@ class Cascader extends BaseComponent {
48124
48129
  this.setState({
48125
48130
  isFocus
48126
48131
  });
48132
+ },
48133
+ updateLoadingKeyRefValue: keys => {
48134
+ this.loadingKeysRef.current = keys;
48135
+ },
48136
+ getLoadingKeyRefValue: () => {
48137
+ return this.loadingKeysRef.current;
48138
+ },
48139
+ updateLoadedKeyRefValue: keys => {
48140
+ this.loadedKeysRef.current = keys;
48141
+ },
48142
+ getLoadedKeyRefValue: () => {
48143
+ return this.loadedKeysRef.current;
48127
48144
  }
48128
48145
  });
48129
48146
  }
@@ -90411,7 +90428,7 @@ class TreeSelect extends BaseComponent {
90411
90428
  } = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
90412
90429
  index,
90413
90430
  onClose
90414
- }) : null;
90431
+ }) : {};
90415
90432
  if (isNull_default()(content) || isUndefined_default()(content)) {
90416
90433
  return;
90417
90434
  }
@@ -90707,7 +90724,7 @@ class TreeSelect extends BaseComponent {
90707
90724
  } = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
90708
90725
  index: idx,
90709
90726
  onClose
90710
- }) : null;
90727
+ }) : {};
90711
90728
  if (isRenderInTag) {
90712
90729
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Tag, Object.assign({}, tagProps), content);
90713
90730
  } else {