hqchart 1.1.13171 → 1.1.13182

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.
@@ -0,0 +1,266 @@
1
+ /*
2
+ Copyright (c) 2018 jones
3
+
4
+ http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ 开源项目 https://github.com/jones2000/HQChart
7
+
8
+ jones_2000@163.com
9
+
10
+ 内置菜单 使用table模式
11
+ */
12
+
13
+ function JSPopMenu()
14
+ {
15
+ this.Data={ Menu:[], Position:0 }; //{ Name:, SVG, ID, bChecked:, SubMenu:[] } Position 0=右键菜单 1=Tab弹菜单 2=下拉菜单
16
+
17
+ this.RootDOM=null;
18
+ this.TBodyDOM=null;
19
+ this.ArySubRootDOM=[];
20
+
21
+ this.ClickCallback=null; //点击回调
22
+ this.CheckedClassName="UMyChart_MenuItem_Span_Checked iconfont icon-checked"; //选中图标
23
+ this.RightArrowClassName="UMyChart_MenuItem_Span_Arrow iconfont icon-menu_arraw_right"; //右侧箭头
24
+
25
+ this.AryTDClassName=
26
+ [
27
+ "UMyChart_MenuItem_Td_Status", //图标
28
+ "UMyChart_MenuItem_Td_Content", //文字
29
+ "UMyChart_MenuItem_Td_Shortcut", //快捷方式
30
+ "UMyChart_MenuItem_Td_Arrow" //箭头
31
+ ];
32
+
33
+ this.Inital=function()
34
+ {
35
+ window.addEventListener('mousedown', (e)=>{ this.OnWindowMouseDown(e)});
36
+ }
37
+
38
+ //创建菜单
39
+ this.CreatePopMenu=function(data)
40
+ {
41
+ this.Clear();
42
+
43
+ var root=document.createElement("div");
44
+ root.className="UMyChart_PopMenu";
45
+
46
+ var table=document.createElement("table");
47
+ table.className="UMyChart_PopMenu_Table";
48
+ root.appendChild(table);
49
+
50
+ var tbody=document.createElement("tbody");
51
+ tbody.className="UMyChart_PopMenu_Tbody";
52
+ table.appendChild(tbody);
53
+
54
+
55
+ var rootData={ Root:root, TBody:tbody, Table:table };
56
+ for(var i=0;i<data.Menu.length;++i)
57
+ {
58
+ var item=data.Menu[i];
59
+ var trDom=this.CreateMenu(rootData, item);
60
+ tbody.appendChild(trDom);
61
+ }
62
+
63
+ document.body.appendChild(root);
64
+ this.RootDOM=root;
65
+ this.TBodyDOM=tbody;
66
+
67
+ if (IFrameSplitOperator.IsNumber(data.Position)) this.Data.Position=data.Position;
68
+ if (data.ClickCallback) this.ClickCallback=data.ClickCallback;
69
+
70
+ }
71
+
72
+ //清除菜单
73
+ this.Clear=function()
74
+ {
75
+ this.Data.Menu=[];
76
+ this.Data.Position=JSPopMenu.POSITION_ID.RIGHT_MENU_ID;
77
+ this.ClickCallback=null;
78
+
79
+ if (!this.RootDOM) return;
80
+
81
+ document.body.removeChild(this.RootDOM);
82
+ this.RootDOM=null;
83
+ this.TBodyDOM=null;
84
+
85
+ for(var i=0;i<this.ArySubRootDOM.length;++i)
86
+ {
87
+ document.body.removeChild(this.ArySubRootDOM[i]);
88
+ }
89
+ this.ArySubRootDOM=[]
90
+ }
91
+
92
+ this.CreateMenu=function(parentItem, item)
93
+ {
94
+ var trDom=document.createElement("tr");
95
+ trDom.className='UMyChart_MenuItem_Tr';
96
+
97
+ var prtTdDom=null;
98
+ for(var i=0;i<this.AryTDClassName.length;++i)
99
+ {
100
+ var tdDom=document.createElement("td");
101
+ tdDom.className=this.AryTDClassName[i];
102
+
103
+ if (i==0) //图标
104
+ {
105
+ if (item.Checked)
106
+ {
107
+ var spanDom=document.createElement("span");
108
+ spanDom.className=this.CheckedClassName;
109
+ tdDom.appendChild(spanDom);
110
+ }
111
+ }
112
+ else if (i==1) //内容
113
+ {
114
+ tdDom.innerText=item.Name;
115
+ }
116
+ else if (i==2) //快捷方式
117
+ {
118
+
119
+ }
120
+ else if (i==3) //箭头
121
+ {
122
+ if (IFrameSplitOperator.IsNonEmptyArray(item.SubMenu))
123
+ {
124
+ var spanDom=document.createElement("span");
125
+ spanDom.className=this.RightArrowClassName;
126
+ tdDom.appendChild(spanDom);
127
+ }
128
+ }
129
+
130
+ trDom.appendChild(tdDom);
131
+ }
132
+
133
+ if (IFrameSplitOperator.IsNonEmptyArray(item.SubMenu)) //子菜单
134
+ {
135
+ var subRoot=document.createElement("div");
136
+ subRoot.className="UMyChart_PopSubMenu";
137
+
138
+ var subTable=document.createElement("table");
139
+ subTable.className="UMyChart_PopMenu_Table";
140
+ subRoot.appendChild(subTable);
141
+
142
+ var subTbody=document.createElement("tbody");
143
+ subTbody.className="UMyChart_PopMenu_TBody";
144
+ subTable.appendChild(subTbody);
145
+
146
+ var subRootData={ Root:subRoot, TBody:subTbody, Table:subTable };
147
+ var preTrDom=null;
148
+ for(var i=0;i<item.SubMenu.length;++i)
149
+ {
150
+ var subItem=item.SubMenu[i];
151
+ if (subItem.Name==JSPopMenu.SEPARATOR_LINE_NAME)
152
+ {
153
+ if (preTrDom) preTrDom.classList.add("border");
154
+ continue;
155
+ }
156
+
157
+ var subTrDom=this.CreateMenu(subRootData, subItem);
158
+ preTrDom=subTrDom;
159
+ subTbody.appendChild(subTrDom);
160
+ }
161
+
162
+ trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem, trDom, subRoot); }
163
+ document.body.appendChild(subRoot);
164
+ this.ArySubRootDOM.push(subRoot);
165
+ }
166
+ else
167
+ {
168
+ trDom.onmousedown=(e)=> { this.OnClickMenu(e, item, false); }; //菜单点击
169
+ trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem); }
170
+ }
171
+
172
+ return trDom;
173
+ }
174
+
175
+ //弹tab菜单
176
+ this.PopupMenuByTab=function(rtTab)
177
+ {
178
+ if (!this.RootDOM) return;
179
+ if (!rtTab) return;
180
+
181
+ var xLeft=rtTab.Left;
182
+ var yTop=rtTab.Top-this.RootDOM.offsetHeight;
183
+
184
+ this.RootDOM.style.visibility='visible';
185
+ this.RootDOM.style.top = yTop + "px";
186
+ this.RootDOM.style.left = xLeft + "px";
187
+ }
188
+
189
+ //弹右键菜单
190
+ this.PopupMenuByRight=function(x,y)
191
+ {
192
+ if (!this.RootDOM) return;
193
+ if (!IFrameSplitOperator.IsNumber(x) || !IFrameSplitOperator.IsNumber(y)) return;
194
+
195
+ this.RootDOM.style.visibility='visible';
196
+ this.RootDOM.style.top = y + "px";
197
+ this.RootDOM.style.left = x + "px";
198
+ }
199
+
200
+ this.OnClickMenu=function(e, item, bSubMenu)
201
+ {
202
+ console.log("[JSPopMenu::OnClickMenu] e=, item=, bSubMenu", e, item, bSubMenu);
203
+ if (!this.ClickCallback) return;
204
+
205
+ this.ClickCallback(item);
206
+ }
207
+
208
+ this.OnMouseOver=function(e, parentItem, trDom, subMenu)
209
+ {
210
+ if (parentItem && parentItem.PopMenu && parentItem.PopMenu!=subMenu)
211
+ {
212
+ parentItem.PopMenu.style.visibility="hidden";
213
+ parentItem.PopMenu=null;
214
+ parentItem.PopRow=null;
215
+ }
216
+
217
+ if (subMenu)
218
+ {
219
+ if (subMenu.style.visibility=="visible")
220
+ {
221
+
222
+ }
223
+ else
224
+ {
225
+ var rtParent=trDom.getBoundingClientRect();
226
+ subMenu.style.left=`${rtParent.right}px`;
227
+ subMenu.style.top=`${rtParent.top}px`;
228
+
229
+ /*
230
+ if (this.Data.Position==JSPopMenu.POSITION_ID.TAB_MENU_ID)
231
+ {
232
+ var yButton=parentItem.Root.getBoundingClientRect().bottom;
233
+ var ySubButton=subMenu.getBoundingClientRect().bottom;
234
+ if (yButton<ySubButton)
235
+ {
236
+ var yOffset=yButton-ySubButton;
237
+ subMenu.style.top=`${yOffset}px`;
238
+ }
239
+ }
240
+ */
241
+
242
+ subMenu.style.visibility="visible";
243
+ }
244
+
245
+ parentItem.PopMenu=subMenu;
246
+ parentItem.PopRow=trDom;
247
+ }
248
+ }
249
+
250
+
251
+
252
+ this.OnWindowMouseDown=function(e)
253
+ {
254
+ if (!this.RootDOM) return;
255
+
256
+ console.log("[JSPopMenu::OnWindowMouseDown] e=", e);
257
+
258
+ this.Clear();
259
+ }
260
+ }
261
+
262
+
263
+ JSPopMenu.POSITION_ID={ };
264
+ JSPopMenu.POSITION_ID.RIGHT_MENU_ID=0;
265
+ JSPopMenu.POSITION_ID.TAB_MENU_ID=1;
266
+ JSPopMenu.SEPARATOR_LINE_NAME="MENU_SEPARATOR"; //分割线
@@ -0,0 +1,92 @@
1
+
2
+
3
+ /*右键菜单*/
4
+ .UMyChart_PopMenu {
5
+ position: absolute;
6
+ z-index: 500;
7
+ border: 1px solid;
8
+ border-color:rgb(116, 112, 112);
9
+ background-color: #fff;
10
+ visibility:hidden;
11
+ font-size: 12px;
12
+ font-family: "微软雅黑";
13
+ cursor: default;
14
+ }
15
+
16
+ .UMyChart_PopMenu_Table
17
+ {
18
+ border-collapse: collapse;
19
+ border-spacing: 2px;
20
+ }
21
+
22
+ .UMyChart_PopMenu_Tbody {
23
+
24
+ }
25
+
26
+ .UMyChart_MenuItem_Tr
27
+ {
28
+ display: table-row;
29
+ height:20px;
30
+ }
31
+
32
+ .UMyChart_MenuItem_Td_Status {
33
+ width: 25px;
34
+
35
+ }
36
+
37
+ .UMyChart_MenuItem_Td_Shortcut {
38
+ width: 60px;
39
+ text-align:right;
40
+ }
41
+
42
+ .UMyChart_MenuItem_Td_Content
43
+ {
44
+ margin-left: 3px;
45
+ text-align:left;
46
+ }
47
+
48
+ .UMyChart_MenuItem_Td_Arrow
49
+ {
50
+ width: 25px;
51
+ text-align:right;
52
+ margin-right: 10px;
53
+ }
54
+
55
+
56
+ .UMyChart_MenuItem_Tr:hover
57
+ {
58
+ background: rgb(172,172,221);
59
+ border:1px solid;
60
+ border-color:rgb(0, 120, 215);
61
+ }
62
+
63
+ .UMyChart_PopSubMenu{
64
+ position: absolute;
65
+ left: 99px;
66
+ top: 0;
67
+ border: 1px solid;
68
+ border-color:rgb(116, 112, 112);
69
+ background-color: #fff;
70
+ visibility:hidden;
71
+ z-index: 501;
72
+ font-size: 12px;
73
+ font-family: "微软雅黑";
74
+ cursor: default;
75
+ }
76
+
77
+ .UMyChart_MenuItem_Span_Checked
78
+ {
79
+ color:rgb(105,105,105);
80
+ font-size: 10px;
81
+ margin-left: 5px;
82
+ text-align:left;
83
+ }
84
+
85
+ .UMyChart_MenuItem_Span_Arrow
86
+ {
87
+ color:rgb(105,105,105);
88
+ font-size: 10px;
89
+ text-align:right;
90
+ }
91
+
92
+
@@ -1,8 +1,8 @@
1
1
  @font-face {
2
2
  font-family: "iconfont"; /* Project id 1040563 */
3
- src: url('iconfont.woff2?t=1690947130935') format('woff2'),
4
- url('iconfont.woff?t=1690947130935') format('woff'),
5
- url('iconfont.ttf?t=1690947130935') format('truetype');
3
+ src: url('iconfont.woff2?t=1713231415841') format('woff2'),
4
+ url('iconfont.woff?t=1713231415841') format('woff'),
5
+ url('iconfont.ttf?t=1713231415841') format('truetype');
6
6
  }
7
7
 
8
8
  .iconfont {
@@ -13,6 +13,10 @@
13
13
  -moz-osx-font-smoothing: grayscale;
14
14
  }
15
15
 
16
+ .icon-checked:before {
17
+ content: "\e6af";
18
+ }
19
+
16
20
  .icon-eye:before {
17
21
  content: "\e78f";
18
22
  }