@douyinfe/semi-ui 2.56.2 → 2.56.3

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.
@@ -62215,6 +62215,7 @@ class Modal extends BaseComponent {
62215
62215
  footerFill
62216
62216
  } = this.props;
62217
62217
  const getCancelButton = locale => {
62218
+ var _a;
62218
62219
  if (!hasCancel) {
62219
62220
  return null;
62220
62221
  } else {
@@ -62226,6 +62227,9 @@ class Modal extends BaseComponent {
62226
62227
  block: footerFill,
62227
62228
  autoFocus: true
62228
62229
  }, this.props.cancelButtonProps, {
62230
+ style: Object.assign(Object.assign({}, footerFill ? {
62231
+ marginLeft: "unset"
62232
+ } : {}), (_a = this.props.cancelButtonProps) === null || _a === void 0 ? void 0 : _a.style),
62229
62233
  "x-semi-children-alias": "cancelText"
62230
62234
  }), cancelText || locale.cancel);
62231
62235
  }
@@ -90389,7 +90393,7 @@ class TreeSelectFoundation extends foundation {
90389
90393
  } = this.getProps();
90390
90394
  const newExpandedKeys = new Set(expandedKeys);
90391
90395
  const isExpandControlled = this._isExpandControlled();
90392
- const expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
90396
+ const expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities, false);
90393
90397
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
90394
90398
  const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
90395
90399
  this._adapter.updateState({
@@ -90401,6 +90405,7 @@ class TreeSelectFoundation extends foundation {
90401
90405
  filteredExpandedKeys: new Set(expandedOptsKeys),
90402
90406
  filteredShownKeys: new Set([])
90403
90407
  });
90408
+ this._adapter.rePositionDropdown();
90404
90409
  }
90405
90410
  handleInputChange(sugInput) {
90406
90411
  // Input is used as controlled component
@@ -90425,7 +90430,7 @@ class TreeSelectFoundation extends foundation {
90425
90430
  let newFlattenNodes = [];
90426
90431
  let filteredShownKeys = new Set([]);
90427
90432
  if (!sugInput) {
90428
- expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
90433
+ expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities, false);
90429
90434
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
90430
90435
  newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
90431
90436
  } else {
@@ -90450,6 +90455,7 @@ class TreeSelectFoundation extends foundation {
90450
90455
  filteredExpandedKeys: newFilteredExpandedKeys,
90451
90456
  filteredShownKeys
90452
90457
  });
90458
+ this._adapter.rePositionDropdown();
90453
90459
  }
90454
90460
  handleNodeSelect(e, treeNode) {
90455
90461
  const isDisabled = this._isDisabled(treeNode);
@@ -90718,7 +90724,8 @@ class TreeSelectFoundation extends foundation {
90718
90724
  * When the search box is on the trigger, the focus event processing method
90719
90725
  */
90720
90726
  handleInputTriggerFocus() {
90721
- this.clearInput();
90727
+ const inputValue = this.getState('inputValue');
90728
+ inputValue && this.clearInput();
90722
90729
  this._adapter.updateState({
90723
90730
  inputTriggerFocus: true
90724
90731
  });
@@ -90726,6 +90733,36 @@ class TreeSelectFoundation extends foundation {
90726
90733
  setLoadKeys(data, resolve) {
90727
90734
  this._adapter.updateLoadKeys(data, resolve);
90728
90735
  }
90736
+ handlePopoverVisibleChange(isVisible) {
90737
+ const {
90738
+ filterTreeNode,
90739
+ searchAutoFocus,
90740
+ searchPosition
90741
+ } = this.getProps();
90742
+ const inputValue = this.getState('inputValue');
90743
+ // 将 inputValue 清空,如果有选中值的话,选中项能够快速回显
90744
+ // Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
90745
+ if (isVisible === false && filterTreeNode) {
90746
+ inputValue && this._adapter.setClearInputFlag(true);
90747
+ this.clearInputValue();
90748
+ }
90749
+ if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
90750
+ this.focusInput(true);
90751
+ }
90752
+ }
90753
+ handleAfterClose() {
90754
+ // flattenNode 的变化将导致弹出层面板中的选项数目变化
90755
+ // 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
90756
+ // 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
90757
+ // Changes to flattenNode will cause the number of options in the popup panel to change
90758
+ // After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
90759
+ // Prevent the pop-up layer from flickering visually due to changes in the number of options in the pop-up panel when the pop-up layer is not collapsed.
90760
+ const {
90761
+ filterTreeNode
90762
+ } = this.getProps();
90763
+ const shouldClear = this._adapter.getClearInputFlag();
90764
+ filterTreeNode && shouldClear && this.clearInput();
90765
+ }
90729
90766
  }
90730
90767
  // EXTERNAL MODULE: ../semi-foundation/treeSelect/treeSelect.scss
90731
90768
  var treeSelect = __webpack_require__("ZrYm");
@@ -91405,33 +91442,12 @@ class TreeSelect extends BaseComponent {
91405
91442
  } = data;
91406
91443
  return key;
91407
91444
  };
91408
- /* Event handler function after popover is closed */
91409
- this.handlePopoverClose = isVisible => {
91410
- const {
91411
- filterTreeNode,
91412
- searchAutoFocus,
91413
- searchPosition
91414
- } = this.props;
91415
- // 将 inputValue 清空,如果有选中值的话,选中项能够快速回显
91416
- // Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
91417
- if (isVisible === false && filterTreeNode) {
91418
- this.foundation.clearInputValue();
91419
- }
91420
- if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
91421
- this.foundation.focusInput(true);
91422
- }
91445
+ /* Event handler function after popover visible change */
91446
+ this.handlePopoverVisibleChange = isVisible => {
91447
+ this.foundation.handlePopoverVisibleChange(isVisible);
91423
91448
  };
91424
91449
  this.afterClose = () => {
91425
- // flattenNode 的变化将导致弹出层面板中的选项数目变化
91426
- // 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
91427
- // 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
91428
- // Changes to flattenNode will cause the number of options in the popup panel to change
91429
- // After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
91430
- // Prevent the pop-up layer from flickering visually due to changes in the number of options in the pop-up panel when the pop-up layer is not collapsed.
91431
- const {
91432
- filterTreeNode
91433
- } = this.props;
91434
- filterTreeNode && this.foundation.clearInput();
91450
+ this.foundation.handleAfterClose();
91435
91451
  };
91436
91452
  this.renderTreeNode = (treeNode, ind, style) => {
91437
91453
  const {
@@ -91627,6 +91643,7 @@ class TreeSelect extends BaseComponent {
91627
91643
  this.triggerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
91628
91644
  this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
91629
91645
  this.clickOutsideHandler = null;
91646
+ this.clearInputFlag = false;
91630
91647
  this.foundation = new TreeSelectFoundation(this.adapter);
91631
91648
  this.treeSelectID = Math.random().toString(36).slice(2);
91632
91649
  this.onMotionEnd = () => {
@@ -91977,6 +91994,12 @@ class TreeSelect extends BaseComponent {
91977
91994
  this.setState({
91978
91995
  isFocus: bool
91979
91996
  });
91997
+ },
91998
+ setClearInputFlag: flag => {
91999
+ this.clearInputFlag = flag;
92000
+ },
92001
+ getClearInputFlag: () => {
92002
+ return this.clearInputFlag;
91980
92003
  }
91981
92004
  });
91982
92005
  }
@@ -92020,7 +92043,7 @@ class TreeSelect extends BaseComponent {
92020
92043
  autoAdjustOverflow: autoAdjustOverflow,
92021
92044
  mouseLeaveDelay: mouseLeaveDelay,
92022
92045
  mouseEnterDelay: mouseEnterDelay,
92023
- onVisibleChange: this.handlePopoverClose,
92046
+ onVisibleChange: this.handlePopoverVisibleChange,
92024
92047
  afterClose: this.afterClose
92025
92048
  }, selection);
92026
92049
  }
@@ -92366,7 +92389,7 @@ class UploadFoundation extends foundation {
92366
92389
  addOnPasting
92367
92390
  } = this.getProps();
92368
92391
  this.releaseMemory();
92369
- if (addOnPasting && !disabled) {
92392
+ if (!disabled) {
92370
92393
  this.unbindPastingHandler();
92371
92394
  }
92372
92395
  }
@@ -93249,27 +93272,31 @@ class UploadFoundation extends foundation {
93249
93272
  handlePasting(e) {
93250
93273
  const isMac = this._adapter.isMac();
93251
93274
  const isCombineKeydown = isMac ? e.metaKey : e.ctrlKey;
93252
- if (isCombineKeydown && e.code === 'KeyV' && e.target === document.body) {
93253
- // https://github.com/microsoft/TypeScript/issues/33923
93254
- const permissionName = "clipboard-read";
93255
- // The main thread should not be blocked by clipboard, so callback writing is required here. No await here
93256
- navigator.permissions.query({
93257
- name: permissionName
93258
- }).then(result => {
93259
- console.log(result);
93260
- if (result.state === 'granted' || result.state === 'prompt') {
93261
- // user has authorized or will authorize
93262
- navigator.clipboard.read().then(clipboardItems => {
93263
- // Process the data read from the pasteboard
93264
- // Check the returned data type to determine if it is image data, and process accordingly
93265
- this.readFileFromClipboard(clipboardItems);
93266
- });
93267
- } else {
93268
- this._adapter.notifyPastingError(result);
93269
- }
93270
- }).catch(error => {
93271
- this._adapter.notifyPastingError(error);
93272
- });
93275
+ const {
93276
+ addOnPasting
93277
+ } = this.getProps();
93278
+ if (addOnPasting) {
93279
+ if (isCombineKeydown && e.code === 'KeyV' && e.target === document.body) {
93280
+ // https://github.com/microsoft/TypeScript/issues/33923
93281
+ const permissionName = 'clipboard-read';
93282
+ // The main thread should not be blocked by clipboard, so callback writing is required here. No await here
93283
+ navigator.permissions.query({
93284
+ name: permissionName
93285
+ }).then(result => {
93286
+ if (result.state === 'granted' || result.state === 'prompt') {
93287
+ // user has authorized or will authorize
93288
+ navigator.clipboard.read().then(clipboardItems => {
93289
+ // Process the data read from the pasteboard
93290
+ // Check the returned data type to determine if it is image data, and process accordingly
93291
+ this.readFileFromClipboard(clipboardItems);
93292
+ });
93293
+ } else {
93294
+ this._adapter.notifyPastingError(result);
93295
+ }
93296
+ }).catch(error => {
93297
+ this._adapter.notifyPastingError(error);
93298
+ });
93299
+ }
93273
93300
  }
93274
93301
  }
93275
93302
  bindPastingHandler() {