hqchart 1.1.14820 → 1.1.14827

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.
@@ -7413,6 +7413,73 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7413
7413
  this.FastSlideConfig={ MinDistance:500, MinSpeed:3, MaxTime:250, Enable:false }; //快速滑动配置 MinDistance=最小的距离 MinSpeed=最小速度 MaxTime=最大间隔时间(ms)
7414
7414
  this.KeyboardMove={ Timer:null, Delay:100 , Enable:false, Event:null }; //键盘左右移动
7415
7415
 
7416
+ this.MapEventListenerCache=new Map(); //addEventListener 监听事件 key=type:"keydown|keyup ....", value:{ Callback:, Option: }
7417
+
7418
+ this.AddEventListener=function(eventTarget, type, listener, option)
7419
+ {
7420
+ if (!eventTarget || !type || !listener) return false;
7421
+
7422
+ var callback=listener.bind(this);
7423
+ var item={ Callback:callback, Option:option, Type:type, Element:eventTarget };
7424
+
7425
+ eventTarget.addEventListener(type, callback, option);
7426
+
7427
+ this.MapEventListenerCache.set(item.Type, item);
7428
+
7429
+ return true;
7430
+ }
7431
+
7432
+ this.RemoveEventListener=function(eventTarget, type)
7433
+ {
7434
+ if (!eventTarget || !type) return false;
7435
+ if (!this.MapEventListenerCache.has(type)) return false;
7436
+
7437
+ var item=this.MapEventListenerCache.get(type);
7438
+ if (!item.Element || !item.Callback) return false;
7439
+
7440
+ this.MapEventListenerCache.delete(item.Type);
7441
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
7442
+ }
7443
+
7444
+ //option={ KeyDown:, Wheel }
7445
+ this.AddDefaultEventListener=function(option)
7446
+ {
7447
+ var bRegisterKeydown=true;
7448
+ var bRegisterWheel=true;
7449
+
7450
+ if (option)
7451
+ {
7452
+ if (IFrameSplitOperator.IsBool(option.KeyDown)) bRegisterKeydown=option.KeyDown;
7453
+ if (IFrameSplitOperator.IsBool(option.Wheel)) bRegisterWheel=option.Wheel;
7454
+ }
7455
+
7456
+ if (bRegisterKeydown)
7457
+ {
7458
+ this.AddEventListener(this.UIElement,"keydown", this.OnKeyDown, true);
7459
+ this.AddEventListener(this.UIElement,"keyup", this.OnKeyUp, true);
7460
+ }
7461
+
7462
+ if (bRegisterWheel)
7463
+ {
7464
+ this.AddEventListener(this.UIElement,"wheel", this.OnWheel, true);
7465
+ }
7466
+
7467
+ JSConsole.Chart.Log(`[JSChartContainer::AddDefaultEventListener] [keydown,keyup]=${bRegisterKeydown}, [wheel]=${bRegisterWheel}`);
7468
+ }
7469
+
7470
+ this.RemoveAllEventListener=function()
7471
+ {
7472
+ for(var mapItem of this.MapEventListenerCache)
7473
+ {
7474
+ var item=mapItem[1];
7475
+ if (!item.Element || !item.Callback) continue;
7476
+
7477
+ item.Element.removeEventListener(item.Type, item.Callback, item.Option);
7478
+ }
7479
+
7480
+ this.MapEventListenerCache.clear();
7481
+ }
7482
+
7416
7483
  this.RestoreFocus=function(delay)
7417
7484
  {
7418
7485
  var value=1000;
@@ -7716,6 +7783,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7716
7783
  this.DialogModifyDraw=null;
7717
7784
  }
7718
7785
 
7786
+ this.DestroyPopMenu=function()
7787
+ {
7788
+ if (!this.JSPopMenu) return;
7789
+
7790
+ this.JSPopMenu.Destroy();
7791
+ this.JSPopMenu=null;
7792
+ }
7793
+
7719
7794
  //隐藏内置的弹框div
7720
7795
  this.HideAllPopDiv=function()
7721
7796
  {
@@ -7791,6 +7866,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7791
7866
  this.DestroyDialogModifyDraw();
7792
7867
 
7793
7868
  this.DestroyDialogSelectRect();
7869
+
7870
+ this.DestroyPopMenu();
7871
+
7872
+ document.oncontextmenu=null;
7873
+ this.RemoveAllEventListener();
7794
7874
  }
7795
7875
 
7796
7876
  this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
@@ -84053,32 +84133,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
84053
84133
  this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;
84054
84134
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
84055
84135
 
84056
- var bRegisterKeydown=true;
84057
- var bRegisterWheel=true;
84058
-
84059
- if (option && option.Listener)
84060
- {
84061
- var item=option.Listener;
84062
- if (item.KeyDown===false)
84063
- {
84064
- bRegisterKeydown=false;
84065
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');
84066
- }
84067
-
84068
- if (item.Wheel===false)
84069
- {
84070
- bRegisterWheel=false;
84071
- JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');
84072
- }
84073
- }
84074
-
84075
- if (bRegisterKeydown)
84076
- {
84077
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
84078
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
84079
- }
84080
-
84081
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
84136
+ if (option) this.AddDefaultEventListener(option.Listener);
84082
84137
 
84083
84138
  this.InitalPopMinuteChart(option);
84084
84139
  }
@@ -86688,7 +86743,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86688
86743
  if (IFrameSplitOperator.IsNumber(item.DataWidth)) this.KLineSize={ DataWidth:item.DataWidth };
86689
86744
  }
86690
86745
 
86691
- if (option.Reload==true) isReload=true;
86746
+ if (IFrameSplitOperator.IsBool(option.Reload)) isReload=option.Reload;
86747
+ if (IFrameSplitOperator.IsBool(option.IsApiPeriod)) this.IsApiPeriod=option.IsApiPeriod;
86692
86748
  };
86693
86749
 
86694
86750
  if (this.Period==period && isReload==false)
@@ -93960,31 +94016,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
93960
94016
  if (this.ChartCorssCursor.CallAcutionXOperator)
93961
94017
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
93962
94018
 
93963
- var bRegisterKeydown=true;
93964
- var bRegisterWheel=true;
93965
-
93966
- if (option && option.Listener)
93967
- {
93968
- var item=option.Listener;
93969
- if (item.KeyDown===false)
93970
- {
93971
- bRegisterKeydown=false;
93972
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');
93973
- }
93974
-
93975
- if (item.Wheel===false)
93976
- {
93977
- bRegisterWheel=false;
93978
- JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');
93979
- }
93980
- }
93981
-
93982
- if (bRegisterKeydown)
93983
- {
93984
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e);} , true); //键盘消息
93985
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
93986
- }
93987
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
94019
+ if (option) this.AddDefaultEventListener(option.Listener);
93988
94020
  }
93989
94021
 
93990
94022
  //创建子窗口
@@ -99513,8 +99545,7 @@ function KLineChartHScreenContainer(uielement)
99513
99545
  this.TitlePaint.push(titlePaint);
99514
99546
  }
99515
99547
 
99516
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99517
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
99548
+ this.AddDefaultEventListener({ KeyDown:true, Wheel:false });
99518
99549
  }
99519
99550
 
99520
99551
  //创建子窗口
@@ -99702,8 +99733,7 @@ function MinuteChartHScreenContainer(uielement)
99702
99733
  this.ChartCorssCursor.StringFormatY.Frame=this.Frame;
99703
99734
  this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;
99704
99735
 
99705
- this.UIElement.addEventListener("keydown", OnKeyDown, true); //键盘消息
99706
- this.UIElement.addEventListener("keyup", OnKeyUp, true);
99736
+ this.AddDefaultEventListener({ KeyDown:false, Wheel:false });
99707
99737
  }
99708
99738
 
99709
99739
  //创建子窗口
@@ -99861,28 +99891,12 @@ function DepthChartContainer(uielement)
99861
99891
  chartItem.Name="深度图"
99862
99892
  this.ChartPaint.push(chartItem);
99863
99893
 
99864
- var bRegisterKeydown=true;
99865
- var bRegisterWheel=true;
99866
- if (option)
99867
- {
99868
- if (option.Wheel===false)
99869
- {
99870
- bRegisterWheel=false;
99871
- JSConsole.Chart.Log('[DepthChartContainer::Create] not register wheel event.');
99872
- }
99873
- }
99874
-
99875
- if (bRegisterKeydown)
99876
- {
99877
- this.UIElement.addEventListener("keydown", (e)=>{ this.OnKeyDown(e); }, true); //键盘消息
99878
- this.UIElement.addEventListener("keyup", (e)=>{ this.OnKeyUp(e);}, true);
99879
- }
99880
- if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
99894
+ if (option) this.AddDefaultEventListener(option.Listener);
99881
99895
  }
99882
99896
 
99883
99897
  this.OnWheel=function(e)
99884
99898
  {
99885
- JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);
99899
+ JSConsole.Chart.Log('[DepthChartContainer::OnWheel]',e);
99886
99900
  var x = e.clientX-this.UIElement.getBoundingClientRect().left;
99887
99901
  var y = e.clientY-this.UIElement.getBoundingClientRect().top;
99888
99902
 
@@ -152888,6 +152902,8 @@ function JSPopMenu()
152888
152902
 
152889
152903
  this.RestoreFocusDelay=1000;
152890
152904
 
152905
+ this.MouseDownlistenerPtr=null;
152906
+
152891
152907
  this.AryTDClassName=
152892
152908
  [
152893
152909
  "UMyChart_MenuItem_Td_Status", //图标
@@ -152899,7 +152915,17 @@ function JSPopMenu()
152899
152915
  this.Inital=function(hqchart, option)
152900
152916
  {
152901
152917
  this.HQChart=hqchart;
152902
- window.addEventListener('mousedown', (e)=>{ this.OnWindowMouseDown(e)});
152918
+ this.MouseDownlistenerPtr=this.OnWindowMouseDown.bind(this);
152919
+ window.addEventListener('mousedown', this.MouseDownlistenerPtr);
152920
+ }
152921
+
152922
+ this.Destroy=function()
152923
+ {
152924
+ if (this.MouseDownlistenerPtr)
152925
+ {
152926
+ window.removeEventListener('mousedown', this.MouseDownlistenerPtr);
152927
+ this.MouseDownlistenerPtr=null;
152928
+ }
152903
152929
  }
152904
152930
 
152905
152931
  //创建菜单
@@ -160580,7 +160606,7 @@ function HQChartScriptWorker()
160580
160606
 
160581
160607
 
160582
160608
 
160583
- var HQCHART_VERSION="1.1.14819";
160609
+ var HQCHART_VERSION="1.1.14826";
160584
160610
 
160585
160611
  function PrintHQChartVersion()
160586
160612
  {
@@ -160745,7 +160771,7 @@ export default {
160745
160771
  JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,
160746
160772
  JSCHART_WORKER_MESSAGE_ID:JSCHART_WORKER_MESSAGE_ID,
160747
160773
  JSCHART_MENU_ID:JSCHART_MENU_ID,
160748
- JSCHART_TRADE_STATUS_ID, //交易状态
160774
+ JSCHART_TRADE_STATUS_ID:JSCHART_TRADE_STATUS_ID, //交易状态
160749
160775
  },
160750
160776
 
160751
160777