@flexem/fc-gui 3.0.0-alpha.173 → 3.0.0-alpha.174

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.
@@ -37191,6 +37191,9 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37191
37191
  this.needResize = true;
37192
37192
  this.dropdownListEl = null;
37193
37193
  this.dropdownTriggerEl = null;
37194
+ this._outsideClickHandler = null;
37195
+ this._fullscreenChangeHandler = null;
37196
+ this._resizeHideHandler = null;
37194
37197
  this.setNeedResize = () => {
37195
37198
  this.needResize = false;
37196
37199
  setTimeout(() => this.needResize = true, 500);
@@ -37232,6 +37235,24 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37232
37235
  window.removeEventListener('native.keyboardshow', this.setNeedResize);
37233
37236
  window.removeEventListener('native.keyboardhide', this.setNeedResize);
37234
37237
  }
37238
+ // 清理下拉相关事件监听及 DOM
37239
+ if (this._outsideClickHandler) {
37240
+ document.removeEventListener('click', this._outsideClickHandler);
37241
+ this._outsideClickHandler = null;
37242
+ }
37243
+ if (this._fullscreenChangeHandler) {
37244
+ document.removeEventListener('fullscreenchange', this._fullscreenChangeHandler);
37245
+ document.removeEventListener('webkitfullscreenchange', this._fullscreenChangeHandler);
37246
+ this._fullscreenChangeHandler = null;
37247
+ }
37248
+ if (this._resizeHideHandler) {
37249
+ window.removeEventListener('resize', this._resizeHideHandler);
37250
+ this._resizeHideHandler = null;
37251
+ }
37252
+ if (this.dropdownListEl && this.dropdownListEl.parentNode) {
37253
+ this.dropdownListEl.parentNode.removeChild(this.dropdownListEl);
37254
+ this.dropdownListEl = null;
37255
+ }
37235
37256
  // 取消语种变化订阅
37236
37257
  if (this.languageChangeSubscription) {
37237
37258
  this.languageChangeSubscription.unsubscribe();
@@ -37881,12 +37902,20 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
37881
37902
  }
37882
37903
  });
37883
37904
  // 点击外部收起
37884
- document.addEventListener('click', (event) => {
37905
+ this._outsideClickHandler = (event) => {
37885
37906
  const triggerNode = dropdownTrigger.node();
37886
37907
  if (!dropdownListEl.contains(event.target) && !triggerNode.contains(event.target)) {
37887
37908
  hideDropdown();
37888
37909
  }
37889
- });
37910
+ };
37911
+ document.addEventListener('click', this._outsideClickHandler);
37912
+ // 全屏切换(含点击全屏按钮和 F11)时收起
37913
+ this._fullscreenChangeHandler = () => { hideDropdown(); };
37914
+ document.addEventListener('fullscreenchange', this._fullscreenChangeHandler);
37915
+ document.addEventListener('webkitfullscreenchange', this._fullscreenChangeHandler);
37916
+ // F11 退出全屏时 keydown 被浏览器拦截,用 resize 兜底
37917
+ this._resizeHideHandler = () => { hideDropdown(); };
37918
+ window.addEventListener('resize', this._resizeHideHandler);
37890
37919
  // 滚动时收起
37891
37920
  document.addEventListener('scroll', hideDropdown, true);
37892
37921
  const buttonWidth = this.displayOption.operationButtonWidth + 'px', buttonHeight = this.displayOption.operationButtonHeight + 'px';