Commit de8bc44cefa47959f3de54f4fff2bec81ac418dc

Authored by xp.Huang
2 parents dba90c5c 2bdc34af

Merge branch 'ww' into 'main'

fix: fix some bug in phone

See merge request huang/thingskit-drawio!29
@@ -2,61 +2,62 @@ @@ -2,61 +2,62 @@
2 <meta http-equiv="X-UA-Compatible" content="IE=5"><![endif]--> 2 <meta http-equiv="X-UA-Compatible" content="IE=5"><![endif]-->
3 <!DOCTYPE html> 3 <!DOCTYPE html>
4 <html> 4 <html>
  5 +
5 <head> 6 <head>
6 - <!-- <title>Flowchart Maker &amp; Online Diagram Software</title>-->  
7 - <title>thingskit 云组态</title>  
8 - <meta charset="utf-8">  
9 - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
10 - <meta name="Description"  
11 - content="diagrams.net is free online diagram software for making flowcharts, process diagrams, org charts, UML, ER and network diagrams">  
12 - <meta name="Keywords" content="diagram, online, flow chart, flowchart maker, uml, erd">  
13 - <meta itemprop="name" content="diagrams.net - free flowchart maker and diagrams online">  
14 - <meta itemprop="description" content="diagrams.net is a free online diagramming application and flowchart maker . You can use it to create UML, entity relationship, 7 + <!-- <title>Flowchart Maker &amp; Online Diagram Software</title>-->
  8 + <title>thingskit 云组态</title>
  9 + <meta charset="utf-8">
  10 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  11 + <meta name="Description"
  12 + content="diagrams.net is free online diagram software for making flowcharts, process diagrams, org charts, UML, ER and network diagrams">
  13 + <meta name="Keywords" content="diagram, online, flow chart, flowchart maker, uml, erd">
  14 + <meta itemprop="name" content="diagrams.net - free flowchart maker and diagrams online">
  15 + <meta itemprop="description" content="diagrams.net is a free online diagramming application and flowchart maker . You can use it to create UML, entity relationship,
15 org charts, BPMN and BPM, database schema and networks. Also possible are telecommunication network, workflow, flowcharts, maps overlays and GIS, electronic 16 org charts, BPMN and BPM, database schema and networks. Also possible are telecommunication network, workflow, flowcharts, maps overlays and GIS, electronic
16 circuit and social network diagrams."> 17 circuit and social network diagrams.">
17 - <meta itemprop="image"  
18 - content="https://lh4.googleusercontent.com/-cLKEldMbT_E/Tx8qXDuw6eI/AAAAAAAAAAs/Ke0pnlk8Gpg/w500-h344-k/BPMN%2Bdiagram%2Brc2f.png">  
19 - <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">  
20 - <meta name="msapplication-config" content="images/browserconfig.xml">  
21 - <meta name="mobile-web-app-capable" content="yes">  
22 - <meta name="theme-color" content="#d89000">  
23 - <!-- crypto-js -->  
24 - <script src="./js/plugin/crypto-js/crypto-js.js"></script>  
25 - <!-- 持续话存储 -->  
26 - <script src="./js/const/persistentStorage.js"></script>  
27 - <!-- 全局变量 -->  
28 - <script src="./js/const/const.js"></script>  
29 - <!-- echarts -->  
30 - <script src="./js/plugin/echarts/echarts.js"></script>  
31 -  
32 - <script src="./plugins/axios.min.js"></script>  
33 - <!-- <script src="./js/jquery/jquery-3.3.1.min.js"></script>-->  
34 - <link rel="stylesheet" href="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/css/layui.min.css"  
35 - integrity="sha512-iQBJbsNHXUcgEIgWThd2dr8tOdKPvICwqjPEZYY81z3eMya44A5MiAqfWSCh+Ee1YzNYkdrI982Qhwgr8LEYOQ=="  
36 - crossorigin="anonymous" referrerpolicy="no-referrer"/>  
37 - <script src="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/layui.min.js"  
38 - integrity="sha512-EKrFvch3qTzLFQgjbcjpsRmF8T3UCtc9ojtMAu6dvvP+bV8qYUDOaQ84nwYCkSLT7lbqGoya/Kf+8fyCBE0vRg=="  
39 - crossorigin="anonymous" referrerpolicy="no-referrer"></script>  
40 -  
41 - <!-- 引入修改样式 -->  
42 - <link rel="stylesheet" href="./styles/formatChange.css">  
43 -  
44 - <!-- 引入select.zTree及相关依赖 -->  
45 - <!-- <link rel="stylesheet" href="./styles/zTreeStyle.css" type="text/css">-->  
46 - <!-- <link rel="stylesheet" href="./styles/jquery.select.zTree.v1.5.css" type="text/css">-->  
47 - <!-- <script type="text/javascript" src="./js/jquery.ztree.core.min.js"></script>-->  
48 - <!-- <script type="text/javascript" src="./js/jquery.ztree.exhide.min.js"></script>-->  
49 - <!-- <script type="text/javascript" src="./js/jquery.select.zTree.v1.5.min.js"></script>-->  
50 -  
51 - <!-- Axios -->  
52 - <script src="./plugins/DefHttp.js"></script>  
53 -  
54 - <script src="./js/api/index.js"></script>  
55 -  
56 - <!-- act editor -->  
57 - <script src="./js/plugin/ace/ace.js"></script>  
58 -  
59 - <script type="text/javascript"> 18 + <meta itemprop="image"
  19 + content="https://lh4.googleusercontent.com/-cLKEldMbT_E/Tx8qXDuw6eI/AAAAAAAAAAs/Ke0pnlk8Gpg/w500-h344-k/BPMN%2Bdiagram%2Brc2f.png">
  20 + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  21 + <meta name="msapplication-config" content="images/browserconfig.xml">
  22 + <meta name="mobile-web-app-capable" content="yes">
  23 + <meta name="theme-color" content="#d89000">
  24 + <!-- crypto-js -->
  25 + <script src="./js/plugin/crypto-js/crypto-js.js"></script>
  26 + <!-- 持续话存储 -->
  27 + <script src="./js/const/persistentStorage.js"></script>
  28 + <!-- 全局变量 -->
  29 + <script src="./js/const/const.js"></script>
  30 + <!-- echarts -->
  31 + <script src="./js/plugin/echarts/echarts.js"></script>
  32 +
  33 + <script src="./plugins/axios.min.js"></script>
  34 + <!-- <script src="./js/jquery/jquery-3.3.1.min.js"></script>-->
  35 + <link rel="stylesheet" href="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/css/layui.min.css"
  36 + integrity="sha512-iQBJbsNHXUcgEIgWThd2dr8tOdKPvICwqjPEZYY81z3eMya44A5MiAqfWSCh+Ee1YzNYkdrI982Qhwgr8LEYOQ=="
  37 + crossorigin="anonymous" referrerpolicy="no-referrer" />
  38 + <script src="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/layui.min.js"
  39 + integrity="sha512-EKrFvch3qTzLFQgjbcjpsRmF8T3UCtc9ojtMAu6dvvP+bV8qYUDOaQ84nwYCkSLT7lbqGoya/Kf+8fyCBE0vRg=="
  40 + crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  41 +
  42 + <!-- 引入修改样式 -->
  43 + <link rel="stylesheet" href="./styles/formatChange.css">
  44 +
  45 + <!-- 引入select.zTree及相关依赖 -->
  46 + <!-- <link rel="stylesheet" href="./styles/zTreeStyle.css" type="text/css">-->
  47 + <!-- <link rel="stylesheet" href="./styles/jquery.select.zTree.v1.5.css" type="text/css">-->
  48 + <!-- <script type="text/javascript" src="./js/jquery.ztree.core.min.js"></script>-->
  49 + <!-- <script type="text/javascript" src="./js/jquery.ztree.exhide.min.js"></script>-->
  50 + <!-- <script type="text/javascript" src="./js/jquery.select.zTree.v1.5.min.js"></script>-->
  51 +
  52 + <!-- Axios -->
  53 + <script src="./plugins/DefHttp.js"></script>
  54 +
  55 + <script src="./js/api/index.js"></script>
  56 +
  57 + <!-- act editor -->
  58 + <script src="./js/plugin/ace/ace.js"></script>
  59 +
  60 + <script type="text/javascript">
60 /** 61 /**
61 * URL Parameters and protocol description are here: 62 * URL Parameters and protocol description are here:
62 * 63 *
@@ -248,9 +249,11 @@ @@ -248,9 +249,11 @@
248 if (urlParams['dev'] == '1') { 249 if (urlParams['dev'] == '1') {
249 // Used to request grapheditor/mxgraph sources in dev mode 250 // Used to request grapheditor/mxgraph sources in dev mode
250 var mxDevUrl = document.location.protocol + '//devhost.jgraph.com/drawio/src/main'; 251 var mxDevUrl = document.location.protocol + '//devhost.jgraph.com/drawio/src/main';
  252 + // var mxDevUrl = document.location.protocol + '//192.168.10.104:8083/thingskit-drawio/';
251 253
252 // Used to request draw.io sources in dev mode 254 // Used to request draw.io sources in dev mode
253 var drawDevUrl = document.location.protocol + '//devhost.jgraph.com/drawio/src/main/webapp/'; 255 var drawDevUrl = document.location.protocol + '//devhost.jgraph.com/drawio/src/main/webapp/';
  256 + // var drawDevUrl = document.location.protocol + '//192.168.10.104:8083/thingskit-drawio/';
254 var geBasePath = drawDevUrl + '/js/grapheditor'; 257 var geBasePath = drawDevUrl + '/js/grapheditor';
255 var mxBasePath = mxDevUrl + '/mxgraph'; 258 var mxBasePath = mxDevUrl + '/mxgraph';
256 259
@@ -263,9 +266,9 @@ @@ -263,9 +266,9 @@
263 mxForceIncludes = true; 266 mxForceIncludes = true;
264 } 267 }
265 if (location.hostname == 'localhost' || location.hostname == '127.0.0.1' || location.hostname == '192.168.10.111') { 268 if (location.hostname == 'localhost' || location.hostname == '127.0.0.1' || location.hostname == '192.168.10.111') {
266 - drawDevUrl = `http://${ location.hostname }:3000/`;  
267 - geBasePath = `http://${ location.hostname }:3000/js/grapheditor`;  
268 - mxBasePath = `http://${ location.hostname }:3000/mxgraph`; 269 + drawDevUrl = `http://${location.hostname}:3000/`;
  270 + geBasePath = `http://${location.hostname}:3000/js/grapheditor`;
  271 + mxBasePath = `http://${location.hostname}:3000/mxgraph`;
269 mxForceIncludes = true; 272 mxForceIncludes = true;
270 } 273 }
271 mxForceIncludes = false; 274 mxForceIncludes = false;
@@ -335,90 +338,91 @@ @@ -335,90 +338,91 @@
335 status.innerHTML = 'Page could not be loaded. Please try refreshing.'; 338 status.innerHTML = 'Page could not be loaded. Please try refreshing.';
336 } 339 }
337 }; 340 };
338 - </script>  
339 - <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/plgmlhohecdddhbmmkncjdmlhcmaachm">  
340 - <link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png">  
341 - <!-- <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">-->  
342 - <link rel="icon" type="image/png" sizes="32x32" href="images/logo-32x32.png">  
343 - <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">  
344 - <!-- <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">-->  
345 - <link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#d89000">  
346 - <link rel="stylesheet" type="text/css" href="styles/grapheditor.css">  
347 - <link rel="preconnect" href="https://storage.googleapis.com">  
348 - <link rel="canonical" href="https://app.diagrams.net">  
349 - <link rel="manifest" href="images/manifest.json">  
350 - <!-- <link rel="shortcut icon" href="favicon.ico">-->  
351 - <link rel="shortcut icon" href="images/logo-16x16.ico">  
352 - <style type="text/css">  
353 - body {  
354 - overflow: hidden;  
355 - }  
356 -  
357 - div.picker {  
358 - z-index: 10007;  
359 - }  
360 -  
361 - .geSidebarContainer .geTitle input {  
362 - font-size: 8pt;  
363 - color: #606060;  
364 - }  
365 -  
366 - .geBlock {  
367 - z-index: -3;  
368 - margin: 100px;  
369 - margin-top: 40px;  
370 - margin-bottom: 30px;  
371 - padding: 20px;  
372 - text-align: center;  
373 - min-width: 50%;  
374 - }  
375 -  
376 - .geBlock h1, .geBlock h2 {  
377 - margin-top: 0px;  
378 - padding-top: 0px;  
379 - }  
380 -  
381 - .geEditor *:not(.geScrollable)::-webkit-scrollbar {  
382 - width: 14px;  
383 - height: 14px;  
384 - }  
385 -  
386 - .geEditor ::-webkit-scrollbar-track {  
387 - background-clip: padding-box;  
388 - border: solid transparent;  
389 - border-width: 1px;  
390 - }  
391 -  
392 - .geEditor ::-webkit-scrollbar-corner {  
393 - background-color: transparent;  
394 - }  
395 -  
396 - .geEditor ::-webkit-scrollbar-thumb {  
397 - background-color: rgba(0, 0, 0, .1);  
398 - background-clip: padding-box;  
399 - border: solid transparent;  
400 - border-radius: 10px;  
401 - }  
402 -  
403 - .geEditor ::-webkit-scrollbar-thumb:hover {  
404 - background-color: rgba(0, 0, 0, .4);  
405 - }  
406 -  
407 - .geTemplate {  
408 - border: 1px solid transparent;  
409 - display: inline-block;  
410 - _display: inline;  
411 - vertical-align: top;  
412 - border-radius: 3px;  
413 - overflow: hidden;  
414 - font-size: 14pt;  
415 - cursor: pointer;  
416 - margin: 5px;  
417 - }  
418 - </style>  
419 - <!-- Workaround for binary XHR in IE 9/10, see App.loadUrl -->  
420 - <!--[if (IE 9)|(IE 10)]><!-->  
421 - <script type="text/vbscript"> 341 + </script>
  342 + <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/plgmlhohecdddhbmmkncjdmlhcmaachm">
  343 + <link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png">
  344 + <!-- <link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">-->
  345 + <link rel="icon" type="image/png" sizes="32x32" href="images/logo-32x32.png">
  346 + <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
  347 + <!-- <link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">-->
  348 + <link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#d89000">
  349 + <link rel="stylesheet" type="text/css" href="styles/grapheditor.css">
  350 + <link rel="preconnect" href="https://storage.googleapis.com">
  351 + <link rel="canonical" href="https://app.diagrams.net">
  352 + <link rel="manifest" href="images/manifest.json">
  353 + <!-- <link rel="shortcut icon" href="favicon.ico">-->
  354 + <link rel="shortcut icon" href="images/logo-16x16.ico">
  355 + <style type="text/css">
  356 + body {
  357 + overflow: hidden;
  358 + }
  359 +
  360 + div.picker {
  361 + z-index: 10007;
  362 + }
  363 +
  364 + .geSidebarContainer .geTitle input {
  365 + font-size: 8pt;
  366 + color: #606060;
  367 + }
  368 +
  369 + .geBlock {
  370 + z-index: -3;
  371 + margin: 100px;
  372 + margin-top: 40px;
  373 + margin-bottom: 30px;
  374 + padding: 20px;
  375 + text-align: center;
  376 + min-width: 50%;
  377 + }
  378 +
  379 + .geBlock h1,
  380 + .geBlock h2 {
  381 + margin-top: 0px;
  382 + padding-top: 0px;
  383 + }
  384 +
  385 + .geEditor *:not(.geScrollable)::-webkit-scrollbar {
  386 + width: 14px;
  387 + height: 14px;
  388 + }
  389 +
  390 + .geEditor ::-webkit-scrollbar-track {
  391 + background-clip: padding-box;
  392 + border: solid transparent;
  393 + border-width: 1px;
  394 + }
  395 +
  396 + .geEditor ::-webkit-scrollbar-corner {
  397 + background-color: transparent;
  398 + }
  399 +
  400 + .geEditor ::-webkit-scrollbar-thumb {
  401 + background-color: rgba(0, 0, 0, .1);
  402 + background-clip: padding-box;
  403 + border: solid transparent;
  404 + border-radius: 10px;
  405 + }
  406 +
  407 + .geEditor ::-webkit-scrollbar-thumb:hover {
  408 + background-color: rgba(0, 0, 0, .4);
  409 + }
  410 +
  411 + .geTemplate {
  412 + border: 1px solid transparent;
  413 + display: inline-block;
  414 + _display: inline;
  415 + vertical-align: top;
  416 + border-radius: 3px;
  417 + overflow: hidden;
  418 + font-size: 14pt;
  419 + cursor: pointer;
  420 + margin: 5px;
  421 + }
  422 + </style>
  423 + <!-- Workaround for binary XHR in IE 9/10, see App.loadUrl -->
  424 + <!--[if (IE 9)|(IE 10)]><!-->
  425 + <script type="text/vbscript">
422 Function mxUtilsBinaryToArray(Binary) 426 Function mxUtilsBinaryToArray(Binary)
423 Dim i 427 Dim i
424 ReDim byteArray(LenB(Binary)) 428 ReDim byteArray(LenB(Binary))
@@ -429,36 +433,171 @@ @@ -429,36 +433,171 @@
429 End Function 433 End Function
430 434
431 </script> 435 </script>
432 - <!--<![endif]--> 436 + <!--<![endif]-->
  437 + <style>
  438 + figure {
  439 + position: absolute;
  440 + margin: auto;
  441 + top: 0;
  442 + bottom: 0;
  443 + left: 0;
  444 + right: 0;
  445 + width: 6.250em;
  446 + height: 6.250em;
  447 + animation: rotate 2.4s linear infinite;
  448 + }
  449 +
  450 + .white {
  451 + top: 0;
  452 + bottom: 0;
  453 + left: 0;
  454 + right: 0;
  455 + background: white;
  456 + animation: flash 2.4s linear infinite;
  457 + opacity: 0;
  458 + }
  459 +
  460 + .dot {
  461 + position: absolute;
  462 + margin: auto;
  463 + width: 2.4em;
  464 + height: 2.4em;
  465 + border-radius: 100%;
  466 + transition: all 1s ease;
  467 + }
  468 +
  469 + .dot:nth-child(2) {
  470 + top: 0;
  471 + bottom: 0;
  472 + left: 0;
  473 + background: #FF4444;
  474 + animation: dotsY 2.4s linear infinite;
  475 + }
  476 +
  477 + .dot:nth-child(3) {
  478 + left: 0;
  479 + right: 0;
  480 + top: 0;
  481 + background: #FFBB33;
  482 + animation: dotsX 2.4s linear infinite;
  483 + }
  484 +
  485 + .dot:nth-child(4) {
  486 + top: 0;
  487 + bottom: 0;
  488 + right: 0;
  489 + background: #99CC00;
  490 + animation: dotsY 2.4s linear infinite;
  491 + }
  492 +
  493 + .dot:nth-child(5) {
  494 + left: 0;
  495 + right: 0;
  496 + bottom: 0;
  497 + background: #33B5E5;
  498 + animation: dotsX 2.4s linear infinite;
  499 + }
  500 +
  501 + @keyframes rotate {
  502 + 0% {
  503 + transform: rotate(0);
  504 + }
  505 +
  506 + 10% {
  507 + width: 6.250em;
  508 + height: 6.250em;
  509 + }
  510 +
  511 + 66% {
  512 + width: 2.4em;
  513 + height: 2.4em;
  514 + }
  515 +
  516 + 100% {
  517 + transform: rotate(360deg);
  518 + width: 6.250em;
  519 + height: 6.250em;
  520 + }
  521 + }
  522 +
  523 + @keyframes dotsY {
  524 + 66% {
  525 + opacity: .1;
  526 + width: 2.4em;
  527 + }
  528 +
  529 + 77% {
  530 + opacity: 1;
  531 + width: 0;
  532 + }
  533 + }
  534 +
  535 + @keyframes dotsX {
  536 + 66% {
  537 + opacity: .1;
  538 + height: 2.4em;
  539 + }
  540 +
  541 + 77% {
  542 + opacity: 1;
  543 + height: 0;
  544 + }
  545 + }
  546 +
  547 + @keyframes flash {
  548 + 33% {
  549 + opacity: 0;
  550 + border-radius: 0%;
  551 + }
  552 +
  553 + 55% {
  554 + opacity: .6;
  555 + border-radius: 100%;
  556 + }
  557 +
  558 + 66% {
  559 + opacity: 0;
  560 + }
  561 + }
  562 + </style>
433 </head> 563 </head>
  564 +
434 <body class="geEditor"> 565 <body class="geEditor">
435 -<div id="geInfo">  
436 - <div class="geBlock">  
437 - <h1>ThingsKit云组态启动中.......</h1>  
438 - </div>  
439 -</div>  
440 -<script type="text/javascript">  
441 - /**  
442 - * Main  
443 - */  
444 - if (navigator.userAgent != null && navigator.userAgent.toLowerCase().indexOf(' electron/') >= 0 && typeof process !== 'undefined' && process.versions.electron < 5) {  
445 - // Redirects old Electron app to latest version  
446 - var div = document.getElementById('geInfo');  
447 -  
448 - if (div != null) {  
449 - div.innerHTML = '<center><h2>You are using an out of date version of this app.<br>Please download the latest version ' +  
450 - '<a href="https://github.com/jgraph/drawio-desktop/releases/latest" target="_blank">here</a>.</h2></center>';  
451 - }  
452 - } else {  
453 - if (urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function") {  
454 - window.addEventListener('load', function () {  
455 - mxWinLoaded = true;  
456 - checkAllLoaded();  
457 - }); 566 + <div id="geInfo">
  567 + <div class="geBlock">
  568 + <h1>ThingsKit云组态启动中,请耐心等待</h1>
  569 + </div>
  570 + <figure>
  571 + <div class="dot white"></div>
  572 + <div class="dot"></div>
  573 + <div class="dot"></div>
  574 + <div class="dot"></div>
  575 + <div class="dot"></div>
  576 + </figure>
  577 + </div>
  578 + <script type="text/javascript">
  579 + /**
  580 + * Main
  581 + */
  582 + if (navigator.userAgent != null && navigator.userAgent.toLowerCase().indexOf(' electron/') >= 0 && typeof process !== 'undefined' && process.versions.electron < 5) {
  583 + // Redirects old Electron app to latest version
  584 + var div = document.getElementById('geInfo');
  585 +
  586 + if (div != null) {
  587 + div.innerHTML = '<center><h2>You are using an out of date version of this app.<br>Please download the latest version ' +
  588 + '<a href="https://github.com/jgraph/drawio-desktop/releases/latest" target="_blank">here</a>.</h2></center>';
  589 + }
458 } else { 590 } else {
459 - App.main(); 591 + if (urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function") {
  592 + window.addEventListener('load', function () {
  593 + mxWinLoaded = true;
  594 + checkAllLoaded();
  595 + });
  596 + } else {
  597 + App.main();
  598 + }
460 } 599 }
461 - }  
462 -</script> 600 + </script>
463 </body> 601 </body>
  602 +
464 </html> 603 </html>
@@ -2,7 +2,7 @@ const GLOBAL_STORAGE_KEY = (() => { @@ -2,7 +2,7 @@ const GLOBAL_STORAGE_KEY = (() => {
2 const isDEV = location.href.includes('dev=1') 2 const isDEV = location.href.includes('dev=1')
3 const DEVELOPMENT = 'DEVELOPMENT' 3 const DEVELOPMENT = 'DEVELOPMENT'
4 const PRODUCTION = 'PRODUCTION' 4 const PRODUCTION = 'PRODUCTION'
5 - return `UNDEFINED__${ isDEV ? DEVELOPMENT : PRODUCTION }__2.7.1__COMMON__LOCAL__KEY__` 5 + return `UNDEFINED__${isDEV ? DEVELOPMENT : PRODUCTION}__2.7.1__COMMON__LOCAL__KEY__`
6 })() 6 })()
7 7
8 const GLOBAL_TOKEN = (() => { 8 const GLOBAL_TOKEN = (() => {
@@ -12,11 +12,14 @@ const GLOBAL_TOKEN = (() => { @@ -12,11 +12,14 @@ const GLOBAL_TOKEN = (() => {
12 * @type {{JWT_TOKEN: {value: string}}} 12 * @type {{JWT_TOKEN: {value: string}}}
13 */ 13 */
14 const common = ls.get(GLOBAL_STORAGE_KEY) 14 const common = ls.get(GLOBAL_STORAGE_KEY)
15 - return common.JWT_TOKEN.value 15 + return {
  16 + token: common && common.JWT_TOKEN && common.JWT_TOKEN.value,
  17 + refreshToken: common && common.JWT_TOKEN && common.JWT_TOKEN.value,
  18 + }
16 })() 19 })()
17 20
18 -const GLOBAL_WS_URL = (() => { 21 +const GLOBAL_WS_URL = () => {
19 const { host, href } = location 22 const { host, href } = location
20 const reg = /^https/ 23 const reg = /^https/
21 - return `${ reg.test(href) ? 'wss' : 'ws' }://${ host }/api/ws/plugins/telemetry?token=${ GLOBAL_TOKEN }`  
22 -})() 24 + return `${reg.test(href) ? 'wss' : 'ws'}://${host}/api/ws/plugins/telemetry?token=${GLOBAL_TOKEN.token}`
  25 +}
@@ -599,7 +599,6 @@ App.main = function(callback, createUi) @@ -599,7 +599,6 @@ App.main = function(callback, createUi)
599 defHttp = createAxios({ 599 defHttp = createAxios({
600 timeout:10*1000, 600 timeout:10*1000,
601 baseURL:'/api', 601 baseURL:'/api',
602 - token: GLOBAL_TOKEN  
603 }) 602 })
604 // Logs uncaught errors 603 // Logs uncaught errors
605 window.onerror = function(message, url, linenumber, colno, err) 604 window.onerror = function(message, url, linenumber, colno, err)
@@ -619,16 +618,17 @@ App.main = function(callback, createUi) @@ -619,16 +618,17 @@ App.main = function(callback, createUi)
619 return; 618 return;
620 } 619 }
621 620
  621 + // TODO thingsKit extended loading life
622 // Removes info text in embed mode 622 // Removes info text in embed mode
623 - if (urlParams['embed'] == '1' || urlParams['lightbox'] == '1')  
624 - {  
625 - var geInfo = document.getElementById('geInfo');  
626 -  
627 - if (geInfo != null)  
628 - {  
629 - geInfo.parentNode.removeChild(geInfo);  
630 - }  
631 - } 623 + // if (urlParams['embed'] == '1' || urlParams['lightbox'] == '1')
  624 + // {
  625 + // var geInfo = document.getElementById('geInfo');
  626 +
  627 + // if (geInfo != null)
  628 + // {
  629 + // geInfo.parentNode.removeChild(geInfo);
  630 + // }
  631 + // }
632 632
633 // Redirects to the latest AWS icons 633 // Redirects to the latest AWS icons
634 if (document.referrer != null && urlParams['libs'] == 'aws3' && 634 if (document.referrer != null && urlParams['libs'] == 'aws3' &&
@@ -664,7 +664,7 @@ App.main = function(callback, createUi) @@ -664,7 +664,7 @@ App.main = function(callback, createUi)
664 var content = mxUtils.getTextContent(scripts[scripts.length - 1]); 664 var content = mxUtils.getTextContent(scripts[scripts.length - 1]);
665 665
666 // if (CryptoJS.MD5(content).toString() != 'd53805dd6f0bbba2da4966491ca0a505') 666 // if (CryptoJS.MD5(content).toString() != 'd53805dd6f0bbba2da4966491ca0a505')
667 - if (CryptoJS.MD5(content).toString() != 'ce6aa7729ae06957ca56e510739b70b3') 667 + if (CryptoJS.MD5(content).toString() != 'c4cfc8a77f5990a4d86c0fbc4443328b')
668 { 668 {
669 console.log('Change main script MD5 in the previous line:', CryptoJS.MD5(content).toString()); 669 console.log('Change main script MD5 in the previous line:', CryptoJS.MD5(content).toString());
670 alert('[Dev] Main script change requires update of CSP'); 670 alert('[Dev] Main script change requires update of CSP');
@@ -4991,33 +4991,69 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { @@ -4991,33 +4991,69 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4991 if (urlParams['openInSameWin'] == '1' || navigator.standalone) { 4991 if (urlParams['openInSameWin'] == '1' || navigator.standalone) {
4992 sameWindow = true; 4992 sameWindow = true;
4993 } 4993 }
4994 - //调用API,获取保存的内容  
4995 - defHttp.get('/yt/configuration/center/getConfigurationInfo/'+Editor.configurationId)  
4996 - .then(function (response) {  
4997 - Editor.configurationName = response.configurationName + ".drawio";  
4998 - if(response.configurationContentList.length > 0){  
4999 - response.configurationContentList.forEach((item)=>{  
5000 - Editor.configurationContentId = item.id;  
5001 - if(item.content){  
5002 - Editor.defaultContent = item.content;  
5003 - }else{  
5004 - //默认空白内容  
5005 - Editor.defaultContent = EditorUi.prototype.emptyDiagramXml;  
5006 - }  
5007 - })  
5008 - }  
5009 - if (id == null || id.length == 0) {  
5010 - fn();  
5011 - } else if (currentFile != null && !sameWindow) {  
5012 - this.showDialog(new PopupDialog(this, this.getUrl() + '#' + id,  
5013 - null, fn).container, 320, 140, true, true);  
5014 - } else {  
5015 - fn(); 4994 +
  4995 + function getToken() {
  4996 + const urlParams = (function () {
  4997 + var result = new Object();
  4998 + var params = window.location.search.slice(1).split('&');
  4999 +
  5000 + for (var i = 0; i < params.length; i++) {
  5001 + var idx = params[i].indexOf('=');
  5002 +
  5003 + if (idx > 0) {
  5004 + result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
  5005 + }
5016 } 5006 }
5017 - })  
5018 - .catch(function (error) {  
5019 - console.log(error);  
5020 - }); 5007 +
  5008 + return result;
  5009 + })();
  5010 +
  5011 + if (urlParams.userId) {
  5012 + axios.get(`/api/yt/third/login/id/${urlParams.userId}`)
  5013 + .then(res => {
  5014 + const {token, refreshToken} = res.data || {}
  5015 + GLOBAL_TOKEN.token = token
  5016 + GLOBAL_TOKEN.refreshToken = refreshToken
  5017 + getSaveContent()
  5018 + })
  5019 + } else {
  5020 + getSaveContent()
  5021 + }
  5022 + }
  5023 +
  5024 + getToken()
  5025 +
  5026 + //调用API,获取保存的内容
  5027 + function getSaveContent() {
  5028 + defHttp.get('/yt/configuration/center/getConfigurationInfo/'+Editor.configurationId)
  5029 + .then(function (response) {
  5030 + Editor.configurationName = response.configurationName + ".drawio";
  5031 + if(response.configurationContentList.length > 0){
  5032 + response.configurationContentList.forEach((item)=>{
  5033 + Editor.configurationContentId = item.id;
  5034 + if(item.content){
  5035 + Editor.defaultContent = item.content;
  5036 + }else{
  5037 + //默认空白内容
  5038 + Editor.defaultContent = EditorUi.prototype.emptyDiagramXml;
  5039 + }
  5040 + })
  5041 + }
  5042 + if (id == null || id.length == 0) {
  5043 + fn();
  5044 + } else if (currentFile != null && !sameWindow) {
  5045 + this.showDialog(new PopupDialog(this, this.getUrl() + '#' + id,
  5046 + null, fn).container, 320, 140, true, true);
  5047 + } else {
  5048 + fn();
  5049 + }
  5050 + })
  5051 + .catch(function (error) {
  5052 + console.log(error);
  5053 + });
  5054 + }
  5055 +
  5056 +
5021 this.hideDialog(); 5057 this.hideDialog();
5022 var fn2 = mxUtils.bind(this, function () { 5058 var fn2 = mxUtils.bind(this, function () {
5023 //加载数据开始 5059 //加载数据开始
@@ -1525,7 +1525,8 @@ EditorUi.prototype.installShapePicker = function() @@ -1525,7 +1525,8 @@ EditorUi.prototype.installShapePicker = function()
1525 // Asynchronous to avoid direct insert after double tap 1525 // Asynchronous to avoid direct insert after double tap
1526 window.setTimeout(mxUtils.bind(this, function() 1526 window.setTimeout(mxUtils.bind(this, function()
1527 { 1527 {
1528 - ui.showShapePicker(pt.x, pt.y); 1528 + // TODO thingsKit 隐藏双击图层插入图形
  1529 + // ui.showShapePicker(pt.x, pt.y);
1529 }), 30); 1530 }), 30);
1530 } 1531 }
1531 else 1532 else
@@ -2570,28 +2571,29 @@ EditorUi.prototype.initCanvas = function() @@ -2570,28 +2571,29 @@ EditorUi.prototype.initCanvas = function()
2570 mxEvent.consume(evt); 2571 mxEvent.consume(evt);
2571 }), Editor.zoomInImage, mxResources.get('zoomIn') + ' (Alt+Mousewheel)'); 2572 }), Editor.zoomInImage, mxResources.get('zoomIn') + ' (Alt+Mousewheel)');
2572 2573
2573 - addButton(mxUtils.bind(this, function(evt)  
2574 - {  
2575 - if (graph.isLightboxView())  
2576 - {  
2577 - if (graph.view.scale == 1)  
2578 - {  
2579 - this.lightboxFit();  
2580 - }  
2581 - else  
2582 - {  
2583 - graph.zoomTo(1);  
2584 - } 2574 + // TODO thingsKit 隐藏自适应按钮
  2575 + // addButton(mxUtils.bind(this, function(evt)
  2576 + // {
  2577 + // if (graph.isLightboxView())
  2578 + // {
  2579 + // if (graph.view.scale == 1)
  2580 + // {
  2581 + // this.lightboxFit();
  2582 + // }
  2583 + // else
  2584 + // {
  2585 + // graph.zoomTo(1);
  2586 + // }
2585 2587
2586 - this.chromelessResize(false);  
2587 - }  
2588 - else  
2589 - {  
2590 - this.chromelessResize(true);  
2591 - } 2588 + // this.chromelessResize(false);
  2589 + // }
  2590 + // else
  2591 + // {
  2592 + // this.chromelessResize(true);
  2593 + // }
2592 2594
2593 - mxEvent.consume(evt);  
2594 - }), Editor.zoomFitImage, mxResources.get('fit')); 2595 + // mxEvent.consume(evt);
  2596 + // }), Editor.zoomFitImage, mxResources.get('fit'));
2595 2597
2596 // Changes toolbar opacity on hover 2598 // Changes toolbar opacity on hover
2597 var fadeThread = null; 2599 var fadeThread = null;
@@ -3300,11 +3302,12 @@ EditorUi.prototype.initCanvas = function() @@ -3300,11 +3302,12 @@ EditorUi.prototype.initCanvas = function()
3300 */ 3302 */
3301 EditorUi.prototype.addChromelessToolbarItems = function(addButton) 3303 EditorUi.prototype.addChromelessToolbarItems = function(addButton)
3302 { 3304 {
3303 - addButton(mxUtils.bind(this, function(evt)  
3304 - {  
3305 - this.actions.get('print').funct();  
3306 - mxEvent.consume(evt);  
3307 - }), Editor.printImage, mxResources.get('print')); 3305 + // TODO thingsKit 隐藏预览打印按钮
  3306 + // addButton(mxUtils.bind(this, function(evt)
  3307 + // {
  3308 + // this.actions.get('print').funct();
  3309 + // mxEvent.consume(evt);
  3310 + // }), Editor.printImage, mxResources.get('print'));
3308 }; 3311 };
3309 3312
3310 /** 3313 /**
@@ -6109,6 +6109,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6109,6 +6109,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6109 const { component, echoDataSource, getValue } = generatorDataSourceComponent() 6109 const { component, echoDataSource, getValue } = generatorDataSourceComponent()
6110 getDataSourceValue = getValue 6110 getDataSourceValue = getValue
6111 $(`#${enumActionEl.DATA_SOURCE_COMP_EL}`).append(component) 6111 $(`#${enumActionEl.DATA_SOURCE_COMP_EL}`).append(component)
  6112 + form.render()
6112 const info = getLayerBindInfo('act', type) 6113 const info = getLayerBindInfo('act', type)
6113 const { condition = [] } = info 6114 const { condition = [] } = info
6114 if (!condition.length) { 6115 if (!condition.length) {
@@ -7524,7 +7525,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -7524,7 +7525,6 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7524 url: '/yt/oss/upload', 7525 url: '/yt/oss/upload',
7525 method: 'post', 7526 method: 'post',
7526 choose(obj) { 7527 choose(obj) {
7527 - console.log('enter choose')  
7528 obj.preview(async function (index, file, result) { 7528 obj.preview(async function (index, file, result) {
7529 const formData = new FormData() 7529 const formData = new FormData()
7530 formData.set('file', file) 7530 formData.set('file', file)
@@ -7536,7 +7536,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -7536,7 +7536,6 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7536 imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = fileStaticUri 7536 imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = fileStaticUri
7537 $(`#${enumActionEl.IMAGE_UPLOAD_STATE_EL}`).html('上传成功').css({ color: '#5fb878' }) 7537 $(`#${enumActionEl.IMAGE_UPLOAD_STATE_EL}`).html('上传成功').css({ color: '#5fb878' })
7538 } else { 7538 } else {
7539 - console.log(err)  
7540 $(`#${enumActionEl.IMAGE_UPLOAD_STATE_EL}`).html('上传失败').css({ color: 'red' }) 7539 $(`#${enumActionEl.IMAGE_UPLOAD_STATE_EL}`).html('上传失败').css({ color: 'red' })
7541 } 7540 }
7542 }); 7541 });
@@ -7634,7 +7633,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -7634,7 +7633,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7634 function proxyFn(fn) { 7633 function proxyFn(fn) {
7635 return (...args) => { 7634 return (...args) => {
7636 const currentDataSource = getDataSourceBindValue() || {} 7635 const currentDataSource = getDataSourceBindValue() || {}
7637 - 7636 +
7638 to(ConfigurationNodeApi.updateNodeInfo({ 7637 to(ConfigurationNodeApi.updateNodeInfo({
7639 configurationId, 7638 configurationId,
7640 contentId: currentPageId.id, 7639 contentId: currentPageId.id,
@@ -12341,7 +12340,7 @@ class DispatchCenter { @@ -12341,7 +12340,7 @@ class DispatchCenter {
12341 * @description 建立socket连接 12340 * @description 建立socket连接
12342 */ 12341 */
12343 connectSocket() { 12342 connectSocket() {
12344 - this.socket = Ws.getInstance({ url: GLOBAL_WS_URL, onmessageCallback: this.socketOnmessage }) 12343 + this.socket = Ws.getInstance({ url: GLOBAL_WS_URL(), onmessageCallback: this.socketOnmessage })
12345 } 12344 }
12346 12345
12347 /** 12346 /**
@@ -13016,10 +13015,11 @@ class HandleDataInteraction { @@ -13016,10 +13015,11 @@ class HandleDataInteraction {
13016 * @description 事件映射 13015 * @description 事件映射
13017 * @type {Map<>} 13016 * @type {Map<>}
13018 */ 13017 */
13019 - eventMapping = new Map() 13018 + static eventMapping = new Map()
13020 13019
13021 constructor(DispatchInstance) { 13020 constructor(DispatchInstance) {
13022 this.DispatchInstance = DispatchInstance 13021 this.DispatchInstance = DispatchInstance
  13022 + HandleDataInteraction.eventMapping = new Map()
13023 this.init() 13023 this.init()
13024 } 13024 }
13025 13025
@@ -13028,6 +13028,10 @@ class HandleDataInteraction { @@ -13028,6 +13028,10 @@ class HandleDataInteraction {
13028 this.createGraphEventListener() 13028 this.createGraphEventListener()
13029 } 13029 }
13030 13030
  13031 + get eventMapping() {
  13032 + return HandleDataInteraction.eventMapping
  13033 + }
  13034 +
13031 /** 13035 /**
13032 * @description DispatchCenter 实例中保存的 graph 对象 13036 * @description DispatchCenter 实例中保存的 graph 对象
13033 * @return {*} 13037 * @return {*}
@@ -13107,7 +13111,10 @@ class HandleDataInteraction { @@ -13107,7 +13111,10 @@ class HandleDataInteraction {
13107 * @param sender 13111 * @param sender
13108 */ 13112 */
13109 handleMouseDownEvent(eventName, event, sender) { 13113 handleMouseDownEvent(eventName, event, sender) {
13110 - const { state: { cell: { id } = {} } = {} } = event 13114 + const { state } = event
  13115 + if (!state) return
  13116 + const { cell = {} } = state
  13117 + const { id } = cell || {}
13111 const temp = this.eventMapping.get(id) 13118 const temp = this.eventMapping.get(id)
13112 if (temp && temp.has(DispatchCenter.enumEventType.DOWN)) { 13119 if (temp && temp.has(DispatchCenter.enumEventType.DOWN)) {
13113 const content = temp.get(DispatchCenter.enumEventType.DOWN) 13120 const content = temp.get(DispatchCenter.enumEventType.DOWN)
@@ -13122,7 +13129,10 @@ class HandleDataInteraction { @@ -13122,7 +13129,10 @@ class HandleDataInteraction {
13122 * @param sender 13129 * @param sender
13123 */ 13130 */
13124 handleMouseUpEvent(eventName, event, sender) { 13131 handleMouseUpEvent(eventName, event, sender) {
13125 - const { state: { cell: { id } = {} } = {} } = event 13132 + const { state } = event
  13133 + if (!state) return
  13134 + const { cell = {} } = state
  13135 + const { id } = cell || {}
13126 const temp = this.eventMapping.get(id) 13136 const temp = this.eventMapping.get(id)
13127 if (temp && temp.has(DispatchCenter.enumEventType.UP)) { 13137 if (temp && temp.has(DispatchCenter.enumEventType.UP)) {
13128 const content = temp.get(DispatchCenter.enumEventType.UP) 13138 const content = temp.get(DispatchCenter.enumEventType.UP)
@@ -13135,7 +13145,10 @@ class HandleDataInteraction { @@ -13135,7 +13145,10 @@ class HandleDataInteraction {
13135 * @param event 13145 * @param event
13136 */ 13146 */
13137 handleClickEvent(event) { 13147 handleClickEvent(event) {
13138 - const { state: { cell: { id } = {} } = {} } = event 13148 + const { state } = event
  13149 + if (!state) return
  13150 + const { cell = {} } = state
  13151 + const { id } = cell || {}
13139 const temp = this.eventMapping.get(id) 13152 const temp = this.eventMapping.get(id)
13140 if (temp && temp.has(DispatchCenter.enumEventType.SINGLE)) { 13153 if (temp && temp.has(DispatchCenter.enumEventType.SINGLE)) {
13141 const content = temp.get(DispatchCenter.enumEventType.SINGLE) 13154 const content = temp.get(DispatchCenter.enumEventType.SINGLE)
@@ -13154,6 +13167,7 @@ class HandleDataInteraction { @@ -13154,6 +13167,7 @@ class HandleDataInteraction {
13154 * @param cell 13167 * @param cell
13155 */ 13168 */
13156 handleDoubleClickEvent(event, cell = {}) { 13169 handleDoubleClickEvent(event, cell = {}) {
  13170 + if (!cell) return
13157 const { id } = cell 13171 const { id } = cell
13158 const temp = this.eventMapping.get(id) 13172 const temp = this.eventMapping.get(id)
13159 if (temp && temp.has(DispatchCenter.enumEventType.DOUBLE)) { 13173 if (temp && temp.has(DispatchCenter.enumEventType.DOUBLE)) {
@@ -10,9 +10,15 @@ function createAxios(options) { @@ -10,9 +10,15 @@ function createAxios(options) {
10 timeout: options.timeout, 10 timeout: options.timeout,
11 headers: { 11 headers: {
12 "content-type": "application/json; charset=UTF-8", 12 "content-type": "application/json; charset=UTF-8",
13 - "X-Authorization": "Bearer " + options.token, 13 + "X-Authorization": "Bearer " + GLOBAL_TOKEN.token,
14 }, 14 },
15 }); 15 });
  16 +
  17 + instance.interceptors.request.use((config) => {
  18 + config.headers["X-Authorization"] = "Bearer " + GLOBAL_TOKEN.token
  19 + return config
  20 + })
  21 +
16 /** 22 /**
17 * 数据返回拦截-响应拦截器 23 * 数据返回拦截-响应拦截器
18 */ 24 */