@douyinfe/semi-ui 2.21.0 → 2.21.2

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.
@@ -59423,6 +59423,18 @@ class modalFoundation_ModalFoundation extends foundation {
59423
59423
  class modalContentFoundation_ModalContentFoundation extends foundation {
59424
59424
  constructor(adapter) {
59425
59425
  super(Object.assign(Object.assign({}, modalContentFoundation_ModalContentFoundation.defaultAdapter), adapter));
59426
+
59427
+ this.handleKeyDown = e => {
59428
+ const {
59429
+ closeOnEsc
59430
+ } = this.getProps();
59431
+
59432
+ if (closeOnEsc && e.keyCode === utils_keyCode.ESC) {
59433
+ e.stopPropagation();
59434
+ this.close(e);
59435
+ return;
59436
+ }
59437
+ };
59426
59438
  }
59427
59439
 
59428
59440
  destroy() {
@@ -59439,18 +59451,6 @@ class modalContentFoundation_ModalContentFoundation extends foundation {
59439
59451
  this._adapter.notifyDialogMouseUp();
59440
59452
  }
59441
59453
 
59442
- handleKeyDown(e) {
59443
- const {
59444
- closeOnEsc
59445
- } = this.getProps();
59446
-
59447
- if (closeOnEsc && e.keyCode === utils_keyCode.ESC) {
59448
- e.stopPropagation();
59449
- this.close(e);
59450
- return;
59451
- }
59452
- }
59453
-
59454
59454
  handleKeyDownEventListenerMount() {
59455
59455
  this._adapter.addKeyDownEventListener();
59456
59456
  }
@@ -59886,12 +59886,12 @@ class ModalContent_ModalContent extends baseComponent_BaseComponent {
59886
59886
  },
59887
59887
  addKeyDownEventListener: () => {
59888
59888
  if (this.props.closeOnEsc) {
59889
- document.addEventListener('keydown', this.foundation.handleKeyDown.bind(this.foundation));
59889
+ document.addEventListener('keydown', this.foundation.handleKeyDown);
59890
59890
  }
59891
59891
  },
59892
59892
  removeKeyDownEventListener: () => {
59893
59893
  if (this.props.closeOnEsc) {
59894
- document.removeEventListener('keydown', this.foundation.handleKeyDown.bind(this.foundation));
59894
+ document.removeEventListener('keydown', this.foundation.handleKeyDown);
59895
59895
  }
59896
59896
  },
59897
59897
  getMouseState: () => this.state.dialogMouseDown,