@douyinfe/semi-ui 2.56.3-alpha.0 → 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.
Files changed (53) hide show
  1. package/dist/umd/semi-ui.js +74 -50
  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/button/index.d.ts +1 -1
  10. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  11. package/lib/cjs/form/baseForm.d.ts +1 -1
  12. package/lib/cjs/form/field.d.ts +1 -1
  13. package/lib/cjs/input/index.d.ts +1 -1
  14. package/lib/cjs/input/inputGroup.d.ts +1 -1
  15. package/lib/cjs/locale/source/vi_VN.js +41 -41
  16. package/lib/cjs/modal/Modal.js +4 -0
  17. package/lib/cjs/modal/confirm.d.ts +6 -6
  18. package/lib/cjs/rating/index.d.ts +1 -1
  19. package/lib/cjs/rating/item.d.ts +1 -1
  20. package/lib/cjs/switch/index.d.ts +1 -1
  21. package/lib/cjs/table/Table.d.ts +2 -2
  22. package/lib/cjs/table/index.d.ts +1 -1
  23. package/lib/cjs/tagInput/index.d.ts +1 -1
  24. package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
  25. package/lib/cjs/timePicker/index.d.ts +1 -1
  26. package/lib/cjs/treeSelect/index.d.ts +2 -1
  27. package/lib/cjs/treeSelect/index.js +12 -26
  28. package/lib/cjs/typography/title.d.ts +1 -1
  29. package/lib/es/anchor/index.d.ts +1 -1
  30. package/lib/es/autoComplete/index.d.ts +1 -1
  31. package/lib/es/button/Button.d.ts +1 -1
  32. package/lib/es/button/buttonGroup.d.ts +1 -1
  33. package/lib/es/button/index.d.ts +1 -1
  34. package/lib/es/datePicker/datePicker.d.ts +1 -1
  35. package/lib/es/form/baseForm.d.ts +1 -1
  36. package/lib/es/form/field.d.ts +1 -1
  37. package/lib/es/input/index.d.ts +1 -1
  38. package/lib/es/input/inputGroup.d.ts +1 -1
  39. package/lib/es/locale/source/vi_VN.js +41 -41
  40. package/lib/es/modal/Modal.js +4 -0
  41. package/lib/es/modal/confirm.d.ts +6 -6
  42. package/lib/es/rating/index.d.ts +1 -1
  43. package/lib/es/rating/item.d.ts +1 -1
  44. package/lib/es/switch/index.d.ts +1 -1
  45. package/lib/es/table/Table.d.ts +2 -2
  46. package/lib/es/table/index.d.ts +1 -1
  47. package/lib/es/tagInput/index.d.ts +1 -1
  48. package/lib/es/timePicker/TimePicker.d.ts +1 -1
  49. package/lib/es/timePicker/index.d.ts +1 -1
  50. package/lib/es/treeSelect/index.d.ts +2 -1
  51. package/lib/es/treeSelect/index.js +12 -26
  52. package/lib/es/typography/title.d.ts +1 -1
  53. package/package.json +8 -8
@@ -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({
@@ -90426,7 +90430,7 @@ class TreeSelectFoundation extends foundation {
90426
90430
  let newFlattenNodes = [];
90427
90431
  let filteredShownKeys = new Set([]);
90428
90432
  if (!sugInput) {
90429
- expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
90433
+ expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities, false);
90430
90434
  expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
90431
90435
  newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
90432
90436
  } else {
@@ -90729,6 +90733,36 @@ class TreeSelectFoundation extends foundation {
90729
90733
  setLoadKeys(data, resolve) {
90730
90734
  this._adapter.updateLoadKeys(data, resolve);
90731
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
+ }
90732
90766
  }
90733
90767
  // EXTERNAL MODULE: ../semi-foundation/treeSelect/treeSelect.scss
90734
90768
  var treeSelect = __webpack_require__("ZrYm");
@@ -91408,33 +91442,12 @@ class TreeSelect extends BaseComponent {
91408
91442
  } = data;
91409
91443
  return key;
91410
91444
  };
91411
- /* Event handler function after popover is closed */
91412
- this.handlePopoverClose = isVisible => {
91413
- const {
91414
- filterTreeNode,
91415
- searchAutoFocus,
91416
- searchPosition
91417
- } = this.props;
91418
- // 将 inputValue 清空,如果有选中值的话,选中项能够快速回显
91419
- // Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
91420
- if (isVisible === false && filterTreeNode) {
91421
- this.foundation.clearInputValue();
91422
- }
91423
- if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
91424
- this.foundation.focusInput(true);
91425
- }
91445
+ /* Event handler function after popover visible change */
91446
+ this.handlePopoverVisibleChange = isVisible => {
91447
+ this.foundation.handlePopoverVisibleChange(isVisible);
91426
91448
  };
91427
91449
  this.afterClose = () => {
91428
- // flattenNode 的变化将导致弹出层面板中的选项数目变化
91429
- // 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
91430
- // 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
91431
- // Changes to flattenNode will cause the number of options in the popup panel to change
91432
- // After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
91433
- // 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.
91434
- const {
91435
- filterTreeNode
91436
- } = this.props;
91437
- filterTreeNode && this.foundation.clearInput();
91450
+ this.foundation.handleAfterClose();
91438
91451
  };
91439
91452
  this.renderTreeNode = (treeNode, ind, style) => {
91440
91453
  const {
@@ -91630,6 +91643,7 @@ class TreeSelect extends BaseComponent {
91630
91643
  this.triggerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
91631
91644
  this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
91632
91645
  this.clickOutsideHandler = null;
91646
+ this.clearInputFlag = false;
91633
91647
  this.foundation = new TreeSelectFoundation(this.adapter);
91634
91648
  this.treeSelectID = Math.random().toString(36).slice(2);
91635
91649
  this.onMotionEnd = () => {
@@ -91980,6 +91994,12 @@ class TreeSelect extends BaseComponent {
91980
91994
  this.setState({
91981
91995
  isFocus: bool
91982
91996
  });
91997
+ },
91998
+ setClearInputFlag: flag => {
91999
+ this.clearInputFlag = flag;
92000
+ },
92001
+ getClearInputFlag: () => {
92002
+ return this.clearInputFlag;
91983
92003
  }
91984
92004
  });
91985
92005
  }
@@ -92023,7 +92043,7 @@ class TreeSelect extends BaseComponent {
92023
92043
  autoAdjustOverflow: autoAdjustOverflow,
92024
92044
  mouseLeaveDelay: mouseLeaveDelay,
92025
92045
  mouseEnterDelay: mouseEnterDelay,
92026
- onVisibleChange: this.handlePopoverClose,
92046
+ onVisibleChange: this.handlePopoverVisibleChange,
92027
92047
  afterClose: this.afterClose
92028
92048
  }, selection);
92029
92049
  }
@@ -92369,7 +92389,7 @@ class UploadFoundation extends foundation {
92369
92389
  addOnPasting
92370
92390
  } = this.getProps();
92371
92391
  this.releaseMemory();
92372
- if (addOnPasting && !disabled) {
92392
+ if (!disabled) {
92373
92393
  this.unbindPastingHandler();
92374
92394
  }
92375
92395
  }
@@ -93252,27 +93272,31 @@ class UploadFoundation extends foundation {
93252
93272
  handlePasting(e) {
93253
93273
  const isMac = this._adapter.isMac();
93254
93274
  const isCombineKeydown = isMac ? e.metaKey : e.ctrlKey;
93255
- if (isCombineKeydown && e.code === 'KeyV' && e.target === document.body) {
93256
- // https://github.com/microsoft/TypeScript/issues/33923
93257
- const permissionName = "clipboard-read";
93258
- // The main thread should not be blocked by clipboard, so callback writing is required here. No await here
93259
- navigator.permissions.query({
93260
- name: permissionName
93261
- }).then(result => {
93262
- console.log(result);
93263
- if (result.state === 'granted' || result.state === 'prompt') {
93264
- // user has authorized or will authorize
93265
- navigator.clipboard.read().then(clipboardItems => {
93266
- // Process the data read from the pasteboard
93267
- // Check the returned data type to determine if it is image data, and process accordingly
93268
- this.readFileFromClipboard(clipboardItems);
93269
- });
93270
- } else {
93271
- this._adapter.notifyPastingError(result);
93272
- }
93273
- }).catch(error => {
93274
- this._adapter.notifyPastingError(error);
93275
- });
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
+ }
93276
93300
  }
93277
93301
  }
93278
93302
  bindPastingHandler() {