@douyinfe/semi-ui 2.45.2 → 2.45.3-alpha.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.
Files changed (41) hide show
  1. package/dist/umd/semi-ui.js +28 -11
  2. package/dist/umd/semi-ui.js.map +1 -1
  3. package/dist/umd/semi-ui.min.js +1 -1
  4. package/dist/umd/semi-ui.min.js.map +1 -1
  5. package/lib/cjs/anchor/index.d.ts +1 -1
  6. package/lib/cjs/autoComplete/index.d.ts +1 -1
  7. package/lib/cjs/button/Button.d.ts +1 -1
  8. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  9. package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
  10. package/lib/cjs/carousel/index.d.ts +2 -2
  11. package/lib/cjs/cascader/index.d.ts +2 -0
  12. package/lib/cjs/cascader/index.js +14 -0
  13. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  14. package/lib/cjs/dropdown/index.d.ts +1 -1
  15. package/lib/cjs/form/baseForm.d.ts +3 -3
  16. package/lib/cjs/form/field.d.ts +3 -3
  17. package/lib/cjs/modal/confirm.d.ts +11 -11
  18. package/lib/cjs/popover/index.d.ts +1 -1
  19. package/lib/cjs/select/index.d.ts +1 -1
  20. package/lib/cjs/table/Table.d.ts +1 -1
  21. package/lib/cjs/tooltip/index.d.ts +1 -1
  22. package/lib/cjs/typography/title.d.ts +2 -2
  23. package/lib/es/anchor/index.d.ts +1 -1
  24. package/lib/es/autoComplete/index.d.ts +1 -1
  25. package/lib/es/button/Button.d.ts +1 -1
  26. package/lib/es/button/buttonGroup.d.ts +1 -1
  27. package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
  28. package/lib/es/carousel/index.d.ts +2 -2
  29. package/lib/es/cascader/index.d.ts +2 -0
  30. package/lib/es/cascader/index.js +14 -0
  31. package/lib/es/datePicker/datePicker.d.ts +1 -1
  32. package/lib/es/dropdown/index.d.ts +1 -1
  33. package/lib/es/form/baseForm.d.ts +3 -3
  34. package/lib/es/form/field.d.ts +3 -3
  35. package/lib/es/modal/confirm.d.ts +11 -11
  36. package/lib/es/popover/index.d.ts +1 -1
  37. package/lib/es/select/index.d.ts +1 -1
  38. package/lib/es/table/Table.d.ts +1 -1
  39. package/lib/es/tooltip/index.d.ts +1 -1
  40. package/lib/es/typography/title.d.ts +2 -2
  41. package/package.json +8 -8
@@ -36997,6 +36997,8 @@ class CascaderFoundation extends foundation {
36997
36997
  init() {
36998
36998
  const isOpen = this.getProp('open') || this.getProp('defaultOpen');
36999
36999
  this.collectOptions(true);
37000
+ this._adapter.updateLoadingKeyRefValue(new Set());
37001
+ this._adapter.updateLoadedKeyRefValue(new Set());
37000
37002
  if (isOpen && !this._isDisabled()) {
37001
37003
  this.open();
37002
37004
  }
@@ -37183,11 +37185,11 @@ class CascaderFoundation extends foundation {
37183
37185
  } = this.getProps();
37184
37186
  const {
37185
37187
  activeKeys,
37186
- loadingKeys,
37187
37188
  loading,
37188
37189
  keyEntities: keyEntityState,
37189
37190
  selectedKeys: selectedKeysState
37190
37191
  } = this.getStates();
37192
+ const loadingKeys = this._adapter.getLoadingKeyRefValue();
37191
37193
  const filterable = this._isFilterable();
37192
37194
  const loadingActive = [...activeKeys].filter(i => loadingKeys.has(i));
37193
37195
  const valuePath = onChangeWithObject ? util_normalizedArr(value).map(i => i.value) : util_normalizedArr(value);
@@ -37435,17 +37437,18 @@ class CascaderFoundation extends foundation {
37435
37437
  data,
37436
37438
  key
37437
37439
  } = item;
37438
- const {
37439
- loadedKeys: prevLoadedKeys,
37440
- loadingKeys: prevLoadingKeys
37441
- } = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
37440
+ const prevLoadingKeys = cloneDeep_default()(this._adapter.getLoadingKeyRefValue());
37441
+ const prevLoadedKeys = cloneDeep_default()(this._adapter.getLoadedKeyRefValue());
37442
37442
  const newLoadedKeys = prevLoadedKeys.add(key);
37443
37443
  const newLoadingKeys = new Set([...prevLoadingKeys]);
37444
37444
  newLoadingKeys.delete(key);
37445
37445
  // onLoad should trigger before internal setState to avoid `loadData` trigger twice.
37446
37446
  this._adapter.notifyOnLoad(newLoadedKeys, data);
37447
+ this._adapter.updateLoadingKeyRefValue(newLoadingKeys);
37448
+ this._adapter.updateLoadedKeyRefValue(newLoadedKeys);
37447
37449
  this._adapter.updateStates({
37448
- loadingKeys: newLoadingKeys
37450
+ loadingKeys: newLoadingKeys,
37451
+ loadedKeys: newLoadedKeys
37449
37452
  });
37450
37453
  }
37451
37454
  notifyIfLoadData(item) {
@@ -37457,10 +37460,8 @@ class CascaderFoundation extends foundation {
37457
37460
  loading: false
37458
37461
  });
37459
37462
  if (!data.isLeaf && !data.children && this.getProp('loadData')) {
37460
- const {
37461
- loadedKeys,
37462
- loadingKeys
37463
- } = this.getCopyFromState(['loadedKeys', 'loadingKeys']);
37463
+ const loadedKeys = this._adapter.getLoadedKeyRefValue();
37464
+ const loadingKeys = cloneDeep_default()(this._adapter.getLoadingKeyRefValue());
37464
37465
  if (loadedKeys.has(key) || loadingKeys.has(key)) {
37465
37466
  return;
37466
37467
  }
@@ -37471,8 +37472,10 @@ class CascaderFoundation extends foundation {
37471
37472
  keyEntities
37472
37473
  } = this.getStates();
37473
37474
  const optionPath = this.getItemPropPath(key, [], keyEntities);
37475
+ const newLoadingKeys = loadingKeys.add(key);
37476
+ this._adapter.updateLoadingKeyRefValue(newLoadingKeys);
37474
37477
  this._adapter.updateStates({
37475
- loadingKeys: loadingKeys.add(key)
37478
+ loadingKeys: newLoadingKeys
37476
37479
  });
37477
37480
  this._adapter.notifyLoadData(optionPath, this.handleNodeLoad.bind(this, item));
37478
37481
  }
@@ -47968,6 +47971,8 @@ class Cascader extends BaseComponent {
47968
47971
  this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
47969
47972
  this.clickOutsideHandler = null;
47970
47973
  this.foundation = new CascaderFoundation(this.adapter);
47974
+ this.loadingKeysRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
47975
+ this.loadedKeysRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
47971
47976
  }
47972
47977
  get adapter() {
47973
47978
  var _this = this;
@@ -48113,6 +48118,18 @@ class Cascader extends BaseComponent {
48113
48118
  this.setState({
48114
48119
  isFocus
48115
48120
  });
48121
+ },
48122
+ updateLoadingKeyRefValue: keys => {
48123
+ this.loadingKeysRef.current = keys;
48124
+ },
48125
+ getLoadingKeyRefValue: () => {
48126
+ return this.loadingKeysRef.current;
48127
+ },
48128
+ updateLoadedKeyRefValue: keys => {
48129
+ this.loadedKeysRef.current = keys;
48130
+ },
48131
+ getLoadedKeyRefValue: () => {
48132
+ return this.loadedKeysRef.current;
48116
48133
  }
48117
48134
  });
48118
48135
  }