hqchart 1.1.13171 → 1.1.13191

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,311 @@
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
+ this.SelectedClassName="UMyChart_MenuItem_Tr_Selected";
25
+
26
+ this.AryTDClassName=
27
+ [
28
+ "UMyChart_MenuItem_Td_Status", //图标
29
+ "UMyChart_MenuItem_Td_Content", //文字
30
+ "UMyChart_MenuItem_Td_Shortcut", //快捷方式
31
+ "UMyChart_MenuItem_Td_Arrow" //箭头
32
+ ];
33
+
34
+ this.Inital=function()
35
+ {
36
+ window.addEventListener('mousedown', (e)=>{ this.OnWindowMouseDown(e)});
37
+ }
38
+
39
+ //创建菜单
40
+ this.CreatePopMenu=function(data)
41
+ {
42
+ this.Clear();
43
+
44
+ var root=document.createElement("div");
45
+ root.className="UMyChart_PopMenu";
46
+
47
+ var table=document.createElement("table");
48
+ table.className="UMyChart_PopMenu_Table";
49
+ root.appendChild(table);
50
+
51
+ var tbody=document.createElement("tbody");
52
+ tbody.className="UMyChart_PopMenu_Tbody";
53
+ table.appendChild(tbody);
54
+
55
+
56
+ var rootData={ Root:root, TBody:tbody, Table:table };
57
+ for(var i=0;i<data.Menu.length;++i)
58
+ {
59
+ var item=data.Menu[i];
60
+ var trDom=this.CreateMenu(rootData, item);
61
+ tbody.appendChild(trDom);
62
+ }
63
+
64
+ document.body.appendChild(root);
65
+ this.RootDOM=root;
66
+ this.TBodyDOM=tbody;
67
+
68
+ if (IFrameSplitOperator.IsNumber(data.Position)) this.Data.Position=data.Position;
69
+ if (data.ClickCallback) this.ClickCallback=data.ClickCallback;
70
+
71
+ }
72
+
73
+ //清除菜单
74
+ this.Clear=function()
75
+ {
76
+ this.Data.Menu=[];
77
+ this.Data.Position=JSPopMenu.POSITION_ID.RIGHT_MENU_ID;
78
+ this.ClickCallback=null;
79
+
80
+ if (!this.RootDOM) return;
81
+
82
+ document.body.removeChild(this.RootDOM);
83
+ this.RootDOM=null;
84
+ this.TBodyDOM=null;
85
+
86
+ for(var i=0;i<this.ArySubRootDOM.length;++i)
87
+ {
88
+ document.body.removeChild(this.ArySubRootDOM[i]);
89
+ }
90
+ this.ArySubRootDOM=[]
91
+ }
92
+
93
+ this.CreateMenu=function(parentItem, item)
94
+ {
95
+ var trDom=document.createElement("tr");
96
+ trDom.className='UMyChart_MenuItem_Tr';
97
+
98
+ var prtTdDom=null;
99
+ for(var i=0;i<this.AryTDClassName.length;++i)
100
+ {
101
+ var tdDom=document.createElement("td");
102
+ tdDom.className=this.AryTDClassName[i];
103
+
104
+ if (i==0) //图标
105
+ {
106
+ if (item.Checked)
107
+ {
108
+ var spanDom=document.createElement("span");
109
+ spanDom.className=this.CheckedClassName;
110
+ spanDom.style["font-size"]="10px";
111
+ tdDom.appendChild(spanDom);
112
+ }
113
+ }
114
+ else if (i==1) //内容
115
+ {
116
+ tdDom.innerText=item.Name;
117
+ }
118
+ else if (i==2) //快捷方式
119
+ {
120
+
121
+ }
122
+ else if (i==3) //箭头
123
+ {
124
+ if (IFrameSplitOperator.IsNonEmptyArray(item.SubMenu))
125
+ {
126
+ var spanDom=document.createElement("span");
127
+ spanDom.className=this.RightArrowClassName;
128
+ spanDom.style["font-size"]="10px";
129
+ tdDom.appendChild(spanDom);
130
+ }
131
+ }
132
+
133
+ trDom.appendChild(tdDom);
134
+ }
135
+
136
+ if (IFrameSplitOperator.IsNonEmptyArray(item.SubMenu)) //子菜单
137
+ {
138
+ var subRoot=document.createElement("div");
139
+ subRoot.className="UMyChart_PopSubMenu";
140
+
141
+ var subTable=document.createElement("table");
142
+ subTable.className="UMyChart_PopMenu_Table";
143
+ subRoot.appendChild(subTable);
144
+
145
+ var subTbody=document.createElement("tbody");
146
+ subTbody.className="UMyChart_PopMenu_TBody";
147
+ subTable.appendChild(subTbody);
148
+
149
+ var subRootData={ Root:subRoot, TBody:subTbody, Table:subTable };
150
+ var preTrDom=null;
151
+ for(var i=0;i<item.SubMenu.length;++i)
152
+ {
153
+ var subItem=item.SubMenu[i];
154
+ if (subItem.Name==JSPopMenu.SEPARATOR_LINE_NAME)
155
+ {
156
+ var trSeparator=document.createElement("tr");
157
+ trSeparator.className='UMyChart_MenuItem_Tr_Separator';
158
+ var tdDom=document.createElement("td");
159
+ tdDom.className="UMyChart_MenuItem_Td_Status_Separator";
160
+ trSeparator.appendChild(tdDom);
161
+ var tdDom=document.createElement("td");
162
+ tdDom.className="UMyChart_MenuItem_Td_Separator";
163
+ trSeparator.appendChild(tdDom);
164
+ var tdDom=document.createElement("td");
165
+ tdDom.className="UMyChart_MenuItem_Td_Separator";
166
+ trSeparator.appendChild(tdDom);
167
+ var tdDom=document.createElement("td");
168
+ tdDom.className="UMyChart_MenuItem_Td_Separator";
169
+ trSeparator.appendChild(tdDom);
170
+ subTbody.appendChild(trSeparator);
171
+ continue;
172
+ }
173
+
174
+ var subTrDom=this.CreateMenu(subRootData, subItem);
175
+ preTrDom=subTrDom;
176
+ subTbody.appendChild(subTrDom);
177
+ }
178
+
179
+ trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem, trDom, subRoot); }
180
+ document.body.appendChild(subRoot);
181
+ this.ArySubRootDOM.push(subRoot);
182
+ }
183
+ else
184
+ {
185
+ trDom.onmousedown=(e)=> { this.OnClickMenu(e, item, false); }; //菜单点击
186
+ trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem); }
187
+ }
188
+
189
+ return trDom;
190
+ }
191
+
192
+ //弹tab菜单
193
+ this.PopupMenuByTab=function(rtTab)
194
+ {
195
+ if (!this.RootDOM) return;
196
+ if (!rtTab) return;
197
+
198
+ var xLeft=rtTab.Left;
199
+ var yTop=rtTab.Top-this.RootDOM.offsetHeight;
200
+
201
+ this.RootDOM.style.visibility='visible';
202
+ this.RootDOM.style.top = yTop + "px";
203
+ this.RootDOM.style.left = xLeft + "px";
204
+ }
205
+
206
+ //弹右键菜单
207
+ this.PopupMenuByRight=function(x,y)
208
+ {
209
+ if (!this.RootDOM) return;
210
+ if (!IFrameSplitOperator.IsNumber(x) || !IFrameSplitOperator.IsNumber(y)) return;
211
+
212
+ //菜单在当前屏幕无法显示需要调整
213
+ var menuHeight=this.RootDOM.offsetHeight;
214
+ var yMenuBottom=y+menuHeight;
215
+ var yBottom=window.innerHeight-15;
216
+ if (yMenuBottom>yBottom) y=yBottom-menuHeight;
217
+
218
+ var menuWidth=this.RootDOM.offsetWidth;
219
+ var yMenuRight=x+menuWidth;
220
+ var yRight=window.innerWidth-15;
221
+ if (yMenuRight>yRight) x=yRight-menuWidth;
222
+
223
+ this.RootDOM.style.visibility='visible';
224
+ this.RootDOM.style.top = y + "px";
225
+ this.RootDOM.style.left = x + "px";
226
+ }
227
+
228
+ this.OnClickMenu=function(e, item, bSubMenu)
229
+ {
230
+ console.log("[JSPopMenu::OnClickMenu] e=, item=, bSubMenu", e, item, bSubMenu);
231
+ if (!this.ClickCallback) return;
232
+
233
+ this.ClickCallback(item);
234
+ }
235
+
236
+ this.OnMouseOver=function(e, parentItem, trDom, subMenu)
237
+ {
238
+ if (parentItem && parentItem.PopMenu && parentItem.PopMenu!=subMenu)
239
+ {
240
+ parentItem.PopMenu.style.visibility="hidden";
241
+ if (parentItem.PopRow) parentItem.PopRow.classList.remove(this.SelectedClassName);
242
+
243
+ parentItem.PopMenu=null;
244
+ parentItem.PopRow=null;
245
+ }
246
+
247
+ if (subMenu)
248
+ {
249
+ if (subMenu.style.visibility=="visible")
250
+ {
251
+
252
+ }
253
+ else
254
+ {
255
+ var rtParent=trDom.getBoundingClientRect();
256
+ var x=rtParent.right, y=rtParent.top;
257
+
258
+ //菜单在当前屏幕无法显示需要调整
259
+ var yBottom=window.innerHeight-15;
260
+ var yRight=window.innerWidth-15;
261
+ var menuHeight=subMenu.offsetHeight;
262
+ var menuWidth=subMenu.offsetWidth;
263
+ var yMenuBottom=y+menuHeight;
264
+ var yMenuRight=x+menuWidth;
265
+
266
+ if (yMenuBottom>yBottom) y=yBottom-menuHeight;
267
+ if (yMenuRight>yRight) x=rtParent.left-menuWidth;
268
+
269
+ subMenu.style.left=`${x}px`;
270
+ subMenu.style.top=`${y}px`;
271
+
272
+ trDom.classList.add(this.SelectedClassName);
273
+
274
+ /*
275
+ if (this.Data.Position==JSPopMenu.POSITION_ID.TAB_MENU_ID)
276
+ {
277
+ var yButton=parentItem.Root.getBoundingClientRect().bottom;
278
+ var ySubButton=subMenu.getBoundingClientRect().bottom;
279
+ if (yButton<ySubButton)
280
+ {
281
+ var yOffset=yButton-ySubButton;
282
+ subMenu.style.top=`${yOffset}px`;
283
+ }
284
+ }
285
+ */
286
+
287
+ subMenu.style.visibility="visible";
288
+ }
289
+
290
+ parentItem.PopMenu=subMenu;
291
+ parentItem.PopRow=trDom;
292
+ }
293
+ }
294
+
295
+
296
+
297
+ this.OnWindowMouseDown=function(e)
298
+ {
299
+ if (!this.RootDOM) return;
300
+
301
+ console.log("[JSPopMenu::OnWindowMouseDown] e=", e);
302
+
303
+ this.Clear();
304
+ }
305
+ }
306
+
307
+
308
+ JSPopMenu.POSITION_ID={ };
309
+ JSPopMenu.POSITION_ID.RIGHT_MENU_ID=0;
310
+ JSPopMenu.POSITION_ID.TAB_MENU_ID=1;
311
+ JSPopMenu.SEPARATOR_LINE_NAME="MENU_SEPARATOR"; //分割线
@@ -1194,3 +1194,138 @@ input[type="color"] {
1194
1194
  .subtool-del{
1195
1195
  position: relative;
1196
1196
  }
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+ /*
1203
+ Copyright (c) 2018 jones
1204
+
1205
+ http://www.apache.org/licenses/LICENSE-2.0
1206
+
1207
+ 开源项目 https://github.com/jones2000/HQChart
1208
+
1209
+ jones_2000@163.com
1210
+
1211
+ 右键菜单
1212
+ */
1213
+ .UMyChart_PopMenu {
1214
+ position: absolute;
1215
+ z-index: 500;
1216
+ border: 1px solid;
1217
+ border-color:rgb(116, 112, 112);
1218
+ background-color: #fff;
1219
+ visibility:hidden;
1220
+ font-size: 12px;
1221
+ font-family: "微软雅黑";
1222
+ cursor: default;
1223
+ padding: 2px;
1224
+
1225
+ }
1226
+
1227
+ .UMyChart_PopMenu_Table
1228
+ {
1229
+ border-collapse: collapse;
1230
+ border-spacing: 2px;
1231
+ }
1232
+
1233
+ .UMyChart_PopMenu_Tbody
1234
+ {
1235
+
1236
+ }
1237
+
1238
+ .UMyChart_MenuItem_Tr
1239
+ {
1240
+ display: table-row;
1241
+ height:20px;
1242
+ }
1243
+
1244
+ .UMyChart_MenuItem_Tr_Separator
1245
+ {
1246
+ height:5px;
1247
+ }
1248
+
1249
+ .UMyChart_MenuItem_Td_Separator
1250
+ {
1251
+ border-top:1px solid;
1252
+ border-color:rgb(116, 112, 112);
1253
+ }
1254
+
1255
+ .UMyChart_MenuItem_Td_Status_Separator
1256
+ {
1257
+ height:5px;
1258
+ background: rgb(204,204,204);
1259
+ }
1260
+
1261
+ .UMyChart_MenuItem_Tr_Selected
1262
+ {
1263
+ background: rgb(172,172,221);
1264
+ border:0px solid;
1265
+ }
1266
+
1267
+ .UMyChart_MenuItem_Td_Status
1268
+ {
1269
+ width: 23px;
1270
+ background: rgb(204,204,204);
1271
+ }
1272
+
1273
+ .UMyChart_MenuItem_Td_Shortcut {
1274
+ width: 60px;
1275
+ text-align:right;
1276
+ }
1277
+
1278
+ .UMyChart_MenuItem_Td_Content
1279
+ {
1280
+ padding-left: 5px;
1281
+ text-align:left;
1282
+ }
1283
+
1284
+ .UMyChart_MenuItem_Td_Arrow
1285
+ {
1286
+ width: 25px;
1287
+ text-align:right;
1288
+ margin-right: 10px;
1289
+ }
1290
+
1291
+
1292
+ .UMyChart_MenuItem_Tr:hover
1293
+ {
1294
+ background: rgb(172,172,221);
1295
+ }
1296
+
1297
+ .UMyChart_PopSubMenu{
1298
+ position: absolute;
1299
+ left: 99px;
1300
+ top: 0;
1301
+ border: 1px solid;
1302
+ border-color:rgb(116, 112, 112);
1303
+ background-color: #fff;
1304
+ visibility:hidden;
1305
+ z-index: 501;
1306
+ font-size: 12px;
1307
+ font-family: "微软雅黑";
1308
+ cursor: default;
1309
+ padding: 2px;
1310
+ }
1311
+
1312
+ .UMyChart_MenuItem_Span_Checked
1313
+ {
1314
+ color:rgb(0,0,0);
1315
+ font-size: 10px;
1316
+ margin-left: 5px;
1317
+ text-align:left;
1318
+ }
1319
+
1320
+ .UMyChart_MenuItem_Span_Arrow
1321
+ {
1322
+ color:rgb(0,0,0);
1323
+ font-size: 10px;
1324
+ text-align:right;
1325
+ }
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
@@ -0,0 +1,129 @@
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
+ 右键菜单
11
+ */
12
+ .UMyChart_PopMenu {
13
+ position: absolute;
14
+ z-index: 500;
15
+ border: 1px solid;
16
+ border-color:rgb(116, 112, 112);
17
+ background-color: #fff;
18
+ visibility:hidden;
19
+ font-size: 12px;
20
+ font-family: "微软雅黑";
21
+ cursor: default;
22
+ padding: 2px;
23
+
24
+ }
25
+
26
+ .UMyChart_PopMenu_Table
27
+ {
28
+ border-collapse: collapse;
29
+ border-spacing: 2px;
30
+ }
31
+
32
+ .UMyChart_PopMenu_Tbody
33
+ {
34
+
35
+ }
36
+
37
+ .UMyChart_MenuItem_Tr
38
+ {
39
+ display: table-row;
40
+ height:20px;
41
+ }
42
+
43
+ .UMyChart_MenuItem_Tr_Separator
44
+ {
45
+ height:5px;
46
+ }
47
+
48
+ .UMyChart_MenuItem_Td_Separator
49
+ {
50
+ border-top:1px solid;
51
+ border-color:rgb(116, 112, 112);
52
+ }
53
+
54
+ .UMyChart_MenuItem_Td_Status_Separator
55
+ {
56
+ height:5px;
57
+ background: rgb(204,204,204);
58
+ }
59
+
60
+ .UMyChart_MenuItem_Tr_Selected
61
+ {
62
+ background: rgb(172,172,221);
63
+ border:0px solid;
64
+ }
65
+
66
+ .UMyChart_MenuItem_Td_Status
67
+ {
68
+ width: 23px;
69
+ background: rgb(204,204,204);
70
+ }
71
+
72
+ .UMyChart_MenuItem_Td_Shortcut {
73
+ width: 60px;
74
+ text-align:right;
75
+ }
76
+
77
+ .UMyChart_MenuItem_Td_Content
78
+ {
79
+ padding-left: 5px;
80
+ text-align:left;
81
+ }
82
+
83
+ .UMyChart_MenuItem_Td_Arrow
84
+ {
85
+ width: 25px;
86
+ text-align:right;
87
+ margin-right: 10px;
88
+ }
89
+
90
+
91
+ .UMyChart_MenuItem_Tr:hover
92
+ {
93
+ background: rgb(172,172,221);
94
+ }
95
+
96
+ .UMyChart_PopSubMenu{
97
+ position: absolute;
98
+ left: 99px;
99
+ top: 0;
100
+ border: 1px solid;
101
+ border-color:rgb(116, 112, 112);
102
+ background-color: #fff;
103
+ visibility:hidden;
104
+ z-index: 501;
105
+ font-size: 12px;
106
+ font-family: "微软雅黑";
107
+ cursor: default;
108
+ padding: 2px;
109
+ }
110
+
111
+ .UMyChart_MenuItem_Span_Checked
112
+ {
113
+ color:rgb(0,0,0);
114
+ font-size: 10px;
115
+ margin-left: 5px;
116
+ text-align:left;
117
+ }
118
+
119
+ .UMyChart_MenuItem_Span_Arrow
120
+ {
121
+ color:rgb(0,0,0);
122
+ font-size: 10px;
123
+ text-align:right;
124
+ }
125
+
126
+
127
+
128
+
129
+
@@ -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
  }