@douyinfe/semi-ui 2.56.3-alpha.0 → 2.56.4-alpha.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.
Files changed (53) hide show
  1. package/dist/umd/semi-ui.js +118 -78
  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 +56 -54
  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 +56 -54
  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");
@@ -91093,15 +91127,17 @@ class TreeSelect extends BaseComponent {
91093
91127
  leafOnly,
91094
91128
  searchPosition,
91095
91129
  triggerRender,
91096
- borderless
91130
+ borderless,
91131
+ checkRelation
91097
91132
  } = _a,
91098
- rest = treeSelect_rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless"]);
91133
+ rest = treeSelect_rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless", "checkRelation"]);
91099
91134
  const {
91100
91135
  inputValue,
91101
91136
  selectedKeys,
91102
91137
  checkedKeys,
91103
91138
  keyEntities,
91104
- isFocus
91139
+ isFocus,
91140
+ realCheckedKeys
91105
91141
  } = this.state;
91106
91142
  const filterable = Boolean(filterTreeNode);
91107
91143
  const useCustomTrigger = typeof triggerRender === 'function';
@@ -91129,31 +91165,45 @@ class TreeSelect extends BaseComponent {
91129
91165
  [`${treeSelect_prefixcls}-with-suffix`]: suffix,
91130
91166
  [`${treeSelect_prefixcls}-with-suffix`]: suffix
91131
91167
  }, className);
91132
- const triggerRenderKeys = multiple ? normalizeKeyList([...checkedKeys], keyEntities, leafOnly, true) : selectedKeys;
91133
- const inner = useCustomTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger, {
91134
- inputValue: inputValue,
91135
- value: triggerRenderKeys.map(key => get_default()(keyEntities, [key, 'data'])),
91136
- disabled: disabled,
91137
- placeholder: placeholder,
91138
- onClear: this.handleClear,
91139
- componentName: 'TreeSelect',
91140
- triggerRender: triggerRender,
91141
- componentProps: Object.assign({}, this.props),
91142
- onSearch: this.search,
91143
- onRemove: this.removeTag
91144
- }) : [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91145
- key: 'prefix'
91146
- }, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91147
- key: 'selection'
91148
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
91149
- className: `${treeSelect_prefixcls}-selection`
91150
- }, this.renderSelectContent())), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91151
- key: 'suffix'
91152
- }, suffix ? this.renderSuffix() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91153
- key: 'clearBtn'
91154
- }, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91155
- key: 'arrow'
91156
- }, this.renderArrow())];
91168
+ let inner;
91169
+ if (useCustomTrigger) {
91170
+ let triggerRenderKeys = [];
91171
+ if (multiple) {
91172
+ if (checkRelation === 'related') {
91173
+ triggerRenderKeys = normalizeKeyList(checkedKeys, keyEntities, leafOnly, true);
91174
+ } else if (checkRelation === 'unRelated') {
91175
+ triggerRenderKeys = [...realCheckedKeys];
91176
+ }
91177
+ } else {
91178
+ triggerRenderKeys = selectedKeys;
91179
+ }
91180
+ inner = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger, {
91181
+ inputValue: inputValue,
91182
+ value: triggerRenderKeys.map(key => get_default()(keyEntities, [key, 'data'])),
91183
+ disabled: disabled,
91184
+ placeholder: placeholder,
91185
+ onClear: this.handleClear,
91186
+ componentName: 'TreeSelect',
91187
+ triggerRender: triggerRender,
91188
+ componentProps: Object.assign({}, this.props),
91189
+ onSearch: this.search,
91190
+ onRemove: this.removeTag
91191
+ });
91192
+ } else {
91193
+ inner = [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91194
+ key: 'prefix'
91195
+ }, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91196
+ key: 'selection'
91197
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
91198
+ className: `${treeSelect_prefixcls}-selection`
91199
+ }, this.renderSelectContent())), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91200
+ key: 'suffix'
91201
+ }, suffix ? this.renderSuffix() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91202
+ key: 'clearBtn'
91203
+ }, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
91204
+ key: 'arrow'
91205
+ }, this.renderArrow())];
91206
+ }
91157
91207
  const tabIndex = disabled ? null : 0;
91158
91208
  /**
91159
91209
  * Reasons for disabling the a11y eslint rule:
@@ -91408,33 +91458,12 @@ class TreeSelect extends BaseComponent {
91408
91458
  } = data;
91409
91459
  return key;
91410
91460
  };
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
- }
91461
+ /* Event handler function after popover visible change */
91462
+ this.handlePopoverVisibleChange = isVisible => {
91463
+ this.foundation.handlePopoverVisibleChange(isVisible);
91426
91464
  };
91427
91465
  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();
91466
+ this.foundation.handleAfterClose();
91438
91467
  };
91439
91468
  this.renderTreeNode = (treeNode, ind, style) => {
91440
91469
  const {
@@ -91630,6 +91659,7 @@ class TreeSelect extends BaseComponent {
91630
91659
  this.triggerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
91631
91660
  this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
91632
91661
  this.clickOutsideHandler = null;
91662
+ this.clearInputFlag = false;
91633
91663
  this.foundation = new TreeSelectFoundation(this.adapter);
91634
91664
  this.treeSelectID = Math.random().toString(36).slice(2);
91635
91665
  this.onMotionEnd = () => {
@@ -91980,6 +92010,12 @@ class TreeSelect extends BaseComponent {
91980
92010
  this.setState({
91981
92011
  isFocus: bool
91982
92012
  });
92013
+ },
92014
+ setClearInputFlag: flag => {
92015
+ this.clearInputFlag = flag;
92016
+ },
92017
+ getClearInputFlag: () => {
92018
+ return this.clearInputFlag;
91983
92019
  }
91984
92020
  });
91985
92021
  }
@@ -92023,7 +92059,7 @@ class TreeSelect extends BaseComponent {
92023
92059
  autoAdjustOverflow: autoAdjustOverflow,
92024
92060
  mouseLeaveDelay: mouseLeaveDelay,
92025
92061
  mouseEnterDelay: mouseEnterDelay,
92026
- onVisibleChange: this.handlePopoverClose,
92062
+ onVisibleChange: this.handlePopoverVisibleChange,
92027
92063
  afterClose: this.afterClose
92028
92064
  }, selection);
92029
92065
  }
@@ -92369,7 +92405,7 @@ class UploadFoundation extends foundation {
92369
92405
  addOnPasting
92370
92406
  } = this.getProps();
92371
92407
  this.releaseMemory();
92372
- if (addOnPasting && !disabled) {
92408
+ if (!disabled) {
92373
92409
  this.unbindPastingHandler();
92374
92410
  }
92375
92411
  }
@@ -93252,27 +93288,31 @@ class UploadFoundation extends foundation {
93252
93288
  handlePasting(e) {
93253
93289
  const isMac = this._adapter.isMac();
93254
93290
  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
- });
93291
+ const {
93292
+ addOnPasting
93293
+ } = this.getProps();
93294
+ if (addOnPasting) {
93295
+ if (isCombineKeydown && e.code === 'KeyV' && e.target === document.body) {
93296
+ // https://github.com/microsoft/TypeScript/issues/33923
93297
+ const permissionName = 'clipboard-read';
93298
+ // The main thread should not be blocked by clipboard, so callback writing is required here. No await here
93299
+ navigator.permissions.query({
93300
+ name: permissionName
93301
+ }).then(result => {
93302
+ if (result.state === 'granted' || result.state === 'prompt') {
93303
+ // user has authorized or will authorize
93304
+ navigator.clipboard.read().then(clipboardItems => {
93305
+ // Process the data read from the pasteboard
93306
+ // Check the returned data type to determine if it is image data, and process accordingly
93307
+ this.readFileFromClipboard(clipboardItems);
93308
+ });
93309
+ } else {
93310
+ this._adapter.notifyPastingError(result);
93311
+ }
93312
+ }).catch(error => {
93313
+ this._adapter.notifyPastingError(error);
93314
+ });
93315
+ }
93276
93316
  }
93277
93317
  }
93278
93318
  bindPastingHandler() {