@meta2d/core 1.1.5 → 1.1.6
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.
- package/package.json +40 -40
- package/src/canvas/canvas.js +22 -8
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +10 -9
- package/src/core.js.map +1 -1
- package/src/diagrams/iterator.d.ts +0 -0
- package/src/diagrams/iterator.js +109 -0
- package/src/diagrams/iterator.js.map +1 -0
- package/src/dialog/dialog.js +60 -60
- package/src/message/message.js +18 -18
- package/src/options.d.ts +1 -0
- package/src/options.js +1 -0
- package/src/options.js.map +1 -1
- package/src/utils/debounce.d.ts +4 -0
- package/src/utils/debounce.js +19 -0
- package/src/utils/debounce.js.map +1 -1
- package/src/utils/jetLinks.js +7 -7
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// import { Pen, setElemPosition } from '../pen';
|
|
2
|
+
// import { Point } from '../point';
|
|
3
|
+
// import { getMeta2dData, s8, debounce, deepClone } from '../utils';
|
|
4
|
+
// import { renderPen } from '../pen';
|
|
5
|
+
// import { ctxDrawCanvas, ctxDrawPath } from '../pen';
|
|
6
|
+
// import { calcTextLines } from '../pen';
|
|
7
|
+
// export function iterator(pen: Pen, ctx?: CanvasRenderingContext2D) {
|
|
8
|
+
// if (!pen.onDestroy) {
|
|
9
|
+
// pen.onAdd = add;
|
|
10
|
+
// pen.onDestroy = destory;
|
|
11
|
+
// pen.onMove = move;
|
|
12
|
+
// // pen.onBeforeValue = beforeValue;
|
|
13
|
+
// pen.onMouseDown = onMousedown;
|
|
14
|
+
// pen.onMouseUp = onMouseUp;
|
|
15
|
+
// }
|
|
16
|
+
// const store = pen.calculative.canvas.store;
|
|
17
|
+
// console.log()
|
|
18
|
+
// pen.originalData = deepClone(store.data);
|
|
19
|
+
// // pen.pens.forEach((cpen: any) => {
|
|
20
|
+
// // if (!cpen.parentId) {
|
|
21
|
+
// // cpen.width = cpen.width / c_scale;
|
|
22
|
+
// // cpen.height = cpen.height / c_scale;
|
|
23
|
+
// // cpen.x = (cpen.x - c_origin.x) / c_scale + (pen.x - origin.x) / scale;
|
|
24
|
+
// // cpen.y = (cpen.y - c_origin.y) / c_scale + (pen.y - origin.y) / scale;
|
|
25
|
+
// // }
|
|
26
|
+
// // if (!cpen.p_sceneId) {
|
|
27
|
+
// // cpen.p_sceneId = pen.sceneId;
|
|
28
|
+
// // if (cpen.name !== 'sceneContainer') {
|
|
29
|
+
// // cpen.p_vId = _vId;
|
|
30
|
+
// // }
|
|
31
|
+
// // }
|
|
32
|
+
// // });
|
|
33
|
+
// // for (let i = 0; i < pen.data.length; i++) {
|
|
34
|
+
// // }
|
|
35
|
+
// }
|
|
36
|
+
// function destory(pen: Pen) {
|
|
37
|
+
// }
|
|
38
|
+
// function add(pen: Pen) {
|
|
39
|
+
// if(!pen._iteratorID){
|
|
40
|
+
// pen._iteratorID = s8();
|
|
41
|
+
// }
|
|
42
|
+
// generatePens(pen);
|
|
43
|
+
// }
|
|
44
|
+
// function generatePens(pen: Pen) {
|
|
45
|
+
// let e = {
|
|
46
|
+
// x:pen.x,
|
|
47
|
+
// y:pen.y,
|
|
48
|
+
// }
|
|
49
|
+
// for(let i =0;i< 5;i++){
|
|
50
|
+
// e.x += 100;
|
|
51
|
+
// let pens = deepClone(pen.componentDatas);
|
|
52
|
+
// pens._iteratorIdx = i;
|
|
53
|
+
// pens.forEach((cpen: Pen) => {
|
|
54
|
+
// cpen._iteratorID = pen._iteratorID;
|
|
55
|
+
// })
|
|
56
|
+
// pen.calculative.canvas.dropPens(deepClone(pens),e)
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
// function collectPens(pen: Pen) {
|
|
60
|
+
// let pens = [];
|
|
61
|
+
// const meta2d = pen.calculative.canvas.parent;
|
|
62
|
+
// meta2d.store.data.pens.forEach((cpen: any) => {
|
|
63
|
+
// if (
|
|
64
|
+
// cpen._iteratorID &&
|
|
65
|
+
// cpen._iteratorID === pen._iteratorID &&
|
|
66
|
+
// cpen.id !== pen.id
|
|
67
|
+
// ) {
|
|
68
|
+
// cpen.calculative.locked = 0;
|
|
69
|
+
// cpen.locked = 0;
|
|
70
|
+
// pens.push(cpen);
|
|
71
|
+
// }
|
|
72
|
+
// });
|
|
73
|
+
// return pens;
|
|
74
|
+
// }
|
|
75
|
+
// function deletePens(pen: Pen) {
|
|
76
|
+
// const meta2d = pen.calculative.canvas.parent;
|
|
77
|
+
// let pens = collectPens(pen);
|
|
78
|
+
// pens.forEach((cpen: Pen) => {
|
|
79
|
+
// meta2d.canvas.delForce(cpen);
|
|
80
|
+
// });
|
|
81
|
+
// meta2d.canvas.canvasTemplate.init();
|
|
82
|
+
// meta2d.canvas.canvasImage.init();
|
|
83
|
+
// meta2d.canvas.canvasImageBottom.init();
|
|
84
|
+
// meta2d.render();
|
|
85
|
+
// }
|
|
86
|
+
// function moveToLast(pen) {
|
|
87
|
+
// let array = pen.calculative.canvas.store.data.pens;
|
|
88
|
+
// let index = array.findIndex((item) => item.id === pen.id);
|
|
89
|
+
// if (index < 0 || index >= array.length) return array;
|
|
90
|
+
// const element = array.splice(index, 1)[0];
|
|
91
|
+
// array.push(element);
|
|
92
|
+
// }
|
|
93
|
+
// function move(pen: Pen) {
|
|
94
|
+
// debounce(reGeneratePens, 500, pen);
|
|
95
|
+
// }
|
|
96
|
+
// function reGeneratePens(pen: Pen){
|
|
97
|
+
// if (pen.calculative.drag && pen.calculative.active && !(pen.locked > 1)) {
|
|
98
|
+
// pen.calculative.drag = false;
|
|
99
|
+
// deletePens(pen);
|
|
100
|
+
// generatePens(pen);
|
|
101
|
+
// }
|
|
102
|
+
// }
|
|
103
|
+
// function onMousedown(pen: any, e: Point) {
|
|
104
|
+
// pen.calculative.drag = true;
|
|
105
|
+
// }
|
|
106
|
+
// function onMouseUp(pen: any, e: Point) {
|
|
107
|
+
// pen.calculative.drag = false;
|
|
108
|
+
// }
|
|
109
|
+
//# sourceMappingURL=iterator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterator.js","sourceRoot":"","sources":["../../../../packages/core/src/diagrams/iterator.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,oCAAoC;AACpC,qEAAqE;AACrE,sCAAsC;AACtC,uDAAuD;AACvD,0CAA0C;AAE1C,uEAAuE;AACvE,yBAAyB;AACzB,uBAAuB;AACvB,+BAA+B;AAC/B,yBAAyB;AACzB,0CAA0C;AAC1C,qCAAqC;AACrC,iCAAiC;AACjC,MAAM;AACN,gDAAgD;AAChD,kBAAkB;AAClB,8CAA8C;AAC9C,yCAAyC;AACzC,iCAAiC;AACjC,gDAAgD;AAChD,kDAAkD;AAClD,oFAAoF;AACpF,oFAAoF;AACpF,aAAa;AACb,kCAAkC;AAClC,2CAA2C;AAC3C,mDAAmD;AACnD,kCAAkC;AAClC,eAAe;AACf,aAAa;AACb,aAAa;AACb,qDAAqD;AAErD,WAAW;AAEX,IAAI;AACJ,+BAA+B;AAE/B,IAAI;AAEJ,2BAA2B;AAC3B,0BAA0B;AAC1B,8BAA8B;AAC9B,MAAM;AAEN,uBAAuB;AACvB,IAAI;AAGJ,oCAAoC;AACpC,eAAe;AACf,eAAe;AACf,eAAe;AACf,MAAM;AACN,4BAA4B;AAC5B,kBAAkB;AAClB,gDAAgD;AAChD,6BAA6B;AAC7B,oCAAoC;AACpC,4CAA4C;AAC5C,SAAS;AACT,yDAAyD;AACzD,MAAM;AACN,IAAI;AAEJ,mCAAmC;AACnC,mBAAmB;AACnB,kDAAkD;AAClD,oDAAoD;AACpD,WAAW;AACX,4BAA4B;AAC5B,gDAAgD;AAChD,2BAA2B;AAC3B,UAAU;AACV,qCAAqC;AACrC,yBAAyB;AACzB,yBAAyB;AACzB,QAAQ;AACR,QAAQ;AACR,iBAAiB;AACjB,IAAI;AAEJ,kCAAkC;AAClC,mDAAmD;AACnD,mCAAmC;AACnC,oCAAoC;AACpC,sCAAsC;AACtC,UAAU;AAEV,2CAA2C;AAC3C,wCAAwC;AACxC,8CAA8C;AAC9C,uBAAuB;AACvB,IAAI;AAIJ,6BAA6B;AAC7B,wDAAwD;AACxD,+DAA+D;AAE/D,0DAA0D;AAE1D,+CAA+C;AAC/C,yBAAyB;AACzB,IAAI;AAEJ,4BAA4B;AAC5B,wCAAwC;AACxC,IAAI;AAEJ,qCAAqC;AACrC,8EAA8E;AAC9E,oCAAoC;AACpC,uBAAuB;AACvB,yBAAyB;AACzB,KAAK;AACL,IAAI;AAEJ,6CAA6C;AAC7C,iCAAiC;AACjC,IAAI;AAEJ,2CAA2C;AAC3C,kCAAkC;AAClC,IAAI"}
|
package/src/dialog/dialog.js
CHANGED
|
@@ -23,13 +23,13 @@ export class Dialog {
|
|
|
23
23
|
let header = document.createElement('div');
|
|
24
24
|
this.title = document.createElement('div');
|
|
25
25
|
this.close = document.createElement('span');
|
|
26
|
-
this.close.innerHTML = `
|
|
27
|
-
<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em">
|
|
28
|
-
<path
|
|
29
|
-
fill="currentColor"
|
|
30
|
-
d="M8 8.92L11.08 12l.92-.92L8.92 8 12 4.92 11.08 4 8 7.08 4.92 4 4 4.92 7.08 8 4 11.08l.92.92L8 8.92z"
|
|
31
|
-
fill-opacity="0.9"
|
|
32
|
-
></path>
|
|
26
|
+
this.close.innerHTML = `
|
|
27
|
+
<svg fill="none" viewBox="0 0 16 16" width="1em" height="1em">
|
|
28
|
+
<path
|
|
29
|
+
fill="currentColor"
|
|
30
|
+
d="M8 8.92L11.08 12l.92-.92L8.92 8 12 4.92 11.08 4 8 7.08 4.92 4 4 4.92 7.08 8 4 11.08l.92.92L8 8.92z"
|
|
31
|
+
fill-opacity="0.9"
|
|
32
|
+
></path>
|
|
33
33
|
</svg>`;
|
|
34
34
|
this.body = document.createElement('div');
|
|
35
35
|
this.iframe = document.createElement('iframe');
|
|
@@ -74,68 +74,68 @@ export class Dialog {
|
|
|
74
74
|
style.type = 'text/css';
|
|
75
75
|
document.head.appendChild(style);
|
|
76
76
|
sheet = style.sheet;
|
|
77
|
-
sheet.insertRule(`.meta2d-dialog_mask {
|
|
78
|
-
display: none;
|
|
79
|
-
position: absolute;
|
|
80
|
-
top: 0%;
|
|
81
|
-
left: 0%;
|
|
82
|
-
width: 100%;
|
|
83
|
-
height: 100%;
|
|
84
|
-
background-color: #0000006f;
|
|
77
|
+
sheet.insertRule(`.meta2d-dialog_mask {
|
|
78
|
+
display: none;
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0%;
|
|
81
|
+
left: 0%;
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 100%;
|
|
84
|
+
background-color: #0000006f;
|
|
85
85
|
z-index: 9999;`);
|
|
86
|
-
sheet.insertRule(`.meta2d-dialog_mask .meta2d-dialog {
|
|
87
|
-
position: absolute;
|
|
88
|
-
top: 15vh;
|
|
89
|
-
left: 10%;
|
|
90
|
-
width: 80%;
|
|
91
|
-
height:420px;
|
|
92
|
-
padding: 16px 20px;
|
|
93
|
-
border-radius: 9px;
|
|
94
|
-
z-index: 19999;
|
|
95
|
-
overflow: auto;
|
|
86
|
+
sheet.insertRule(`.meta2d-dialog_mask .meta2d-dialog {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 15vh;
|
|
89
|
+
left: 10%;
|
|
90
|
+
width: 80%;
|
|
91
|
+
height:420px;
|
|
92
|
+
padding: 16px 20px;
|
|
93
|
+
border-radius: 9px;
|
|
94
|
+
z-index: 19999;
|
|
95
|
+
overflow: auto;
|
|
96
96
|
}`);
|
|
97
|
-
sheet.insertRule(`.meta2d-dialog_header {
|
|
98
|
-
display: flex;
|
|
99
|
-
position: relative;
|
|
100
|
-
z-index: 999;
|
|
97
|
+
sheet.insertRule(`.meta2d-dialog_header {
|
|
98
|
+
display: flex;
|
|
99
|
+
position: relative;
|
|
100
|
+
z-index: 999;
|
|
101
101
|
}`);
|
|
102
|
-
sheet.insertRule(`.meta2d-dialog-content {
|
|
103
|
-
width: calc(100% - 20px);
|
|
104
|
-
font-weight: 600;
|
|
105
|
-
font-size: 14px;
|
|
106
|
-
color: #bdc7db;
|
|
107
|
-
padding-bottom:8px;
|
|
102
|
+
sheet.insertRule(`.meta2d-dialog-content {
|
|
103
|
+
width: calc(100% - 20px);
|
|
104
|
+
font-weight: 600;
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
color: #bdc7db;
|
|
107
|
+
padding-bottom:8px;
|
|
108
108
|
}`);
|
|
109
|
-
sheet.insertRule(`.meta2d-dialog-close {
|
|
110
|
-
width: 20px;
|
|
111
|
-
height: 20px;
|
|
112
|
-
line-height: 20px;
|
|
113
|
-
text-align: center;
|
|
114
|
-
color: #617b91;
|
|
115
|
-
position: absolute;
|
|
116
|
-
right:20px;
|
|
117
|
-
top:2px;
|
|
118
|
-
display:none;
|
|
109
|
+
sheet.insertRule(`.meta2d-dialog-close {
|
|
110
|
+
width: 20px;
|
|
111
|
+
height: 20px;
|
|
112
|
+
line-height: 20px;
|
|
113
|
+
text-align: center;
|
|
114
|
+
color: #617b91;
|
|
115
|
+
position: absolute;
|
|
116
|
+
right:20px;
|
|
117
|
+
top:2px;
|
|
118
|
+
display:none;
|
|
119
119
|
}`);
|
|
120
|
-
sheet.insertRule(`.meta2d-dialog-close svg{
|
|
121
|
-
width: 18px;
|
|
122
|
-
height: 18px;
|
|
120
|
+
sheet.insertRule(`.meta2d-dialog-close svg{
|
|
121
|
+
width: 18px;
|
|
122
|
+
height: 18px;
|
|
123
123
|
}`);
|
|
124
|
-
sheet.insertRule(`.meta2d-dialog-close :hover{
|
|
125
|
-
cursor: pointer;
|
|
124
|
+
sheet.insertRule(`.meta2d-dialog-close :hover{
|
|
125
|
+
cursor: pointer;
|
|
126
126
|
}`);
|
|
127
|
-
sheet.insertRule(`.meta2d-dialog_body{
|
|
128
|
-
width: 100%;
|
|
129
|
-
height: 100%;
|
|
127
|
+
sheet.insertRule(`.meta2d-dialog_body{
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 100%;
|
|
130
130
|
} `);
|
|
131
|
-
sheet.insertRule(`.meta2d-dialog_body iframe{
|
|
132
|
-
width: 100%;
|
|
133
|
-
height: 100%;
|
|
131
|
+
sheet.insertRule(`.meta2d-dialog_body iframe{
|
|
132
|
+
width: 100%;
|
|
133
|
+
height: 100%;
|
|
134
134
|
}`);
|
|
135
|
-
sheet.insertRule(`.meta2d-dialog_body .meta2d-dialog-meta2d{
|
|
136
|
-
width: 100%;
|
|
137
|
-
height: 100%;
|
|
138
|
-
display: none;
|
|
135
|
+
sheet.insertRule(`.meta2d-dialog_body .meta2d-dialog-meta2d{
|
|
136
|
+
width: 100%;
|
|
137
|
+
height: 100%;
|
|
138
|
+
display: none;
|
|
139
139
|
}`);
|
|
140
140
|
}
|
|
141
141
|
}
|
package/src/message/message.js
CHANGED
|
@@ -71,25 +71,25 @@ export class Message {
|
|
|
71
71
|
style.type = 'text/css';
|
|
72
72
|
document.head.appendChild(style);
|
|
73
73
|
sheet = style.sheet;
|
|
74
|
-
sheet.insertRule(`.meta2d-message{
|
|
75
|
-
position:absolute;
|
|
76
|
-
z-index:999;
|
|
77
|
-
transform: translateX(-50%);
|
|
78
|
-
padding:12px 16px;
|
|
79
|
-
max-width:400px;
|
|
80
|
-
background:#fff;
|
|
81
|
-
border-radius:6px;
|
|
82
|
-
box-shadow:0 3px 14px 2px rgba(0, 0, 0, .05),0 8px 10px 1px rgba(0, 0, 0, 6%),0 5px 5px -3px rgba(0, 0, 0, 10%);
|
|
83
|
-
display:flex;
|
|
74
|
+
sheet.insertRule(`.meta2d-message{
|
|
75
|
+
position:absolute;
|
|
76
|
+
z-index:999;
|
|
77
|
+
transform: translateX(-50%);
|
|
78
|
+
padding:12px 16px;
|
|
79
|
+
max-width:400px;
|
|
80
|
+
background:#fff;
|
|
81
|
+
border-radius:6px;
|
|
82
|
+
box-shadow:0 3px 14px 2px rgba(0, 0, 0, .05),0 8px 10px 1px rgba(0, 0, 0, 6%),0 5px 5px -3px rgba(0, 0, 0, 10%);
|
|
83
|
+
display:flex;
|
|
84
84
|
animation: fadein .5s;}`);
|
|
85
|
-
sheet.insertRule(`
|
|
86
|
-
@keyframes fadein {
|
|
87
|
-
0% {
|
|
88
|
-
transform: translate(-50%, -100%);
|
|
89
|
-
}
|
|
90
|
-
100% {
|
|
91
|
-
transform: translate(-50%,0);
|
|
92
|
-
}
|
|
85
|
+
sheet.insertRule(`
|
|
86
|
+
@keyframes fadein {
|
|
87
|
+
0% {
|
|
88
|
+
transform: translate(-50%, -100%);
|
|
89
|
+
}
|
|
90
|
+
100% {
|
|
91
|
+
transform: translate(-50%,0);
|
|
92
|
+
}
|
|
93
93
|
}`);
|
|
94
94
|
sheet.insertRule('.meta2d-message .icon{width:20px;height:20px;}');
|
|
95
95
|
sheet.insertRule('.meta2d-message .text{color:rgba(0, 0, 0, 0.9);font-size:12px;margin-left:8px;line-height:20px;}');
|
package/src/options.d.ts
CHANGED
package/src/options.js
CHANGED
package/src/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../packages/core/src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8CAAS,CAAA;IACT,qDAAQ,CAAA;IACR,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../packages/core/src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8CAAS,CAAA;IACT,qDAAQ,CAAA;IACR,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAwHD,MAAM,CAAC,MAAM,cAAc,GAAY;IACrC,UAAU,EACR,2EAA2E;IAC7E,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;IACf,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,QAAQ;IACtB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,EAAE,IAAI;IACjB,GAAG,EAAE,EAAE;IACP,aAAa,EAAE,EAAE;IACjB,SAAS,EAAE,EAAE;IACb,eAAe,EAAC,CAAC,WAAW,CAAC;IAC7B,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,EAAE;IAClB,aAAa,EAAC,IAAI;IAClB,aAAa,EAAC,EAAE;CACjB,CAAC"}
|
package/src/utils/debounce.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export declare function debounce(fn: Function, delay: number, params?: any): Promise<unknown>;
|
|
2
2
|
export declare function throttle(fn: Function, delay: number, params?: any): Promise<any>;
|
|
3
|
+
export declare class InstanceDebouncer {
|
|
4
|
+
static instances: WeakMap<object, any>;
|
|
5
|
+
static debounce(instance: any, methodName: any, wait?: number): (...args: any[]) => void;
|
|
6
|
+
}
|
package/src/utils/debounce.js
CHANGED
|
@@ -25,4 +25,23 @@ export async function throttle(fn, delay, params) {
|
|
|
25
25
|
}
|
|
26
26
|
return await fn(params);
|
|
27
27
|
}
|
|
28
|
+
export class InstanceDebouncer {
|
|
29
|
+
static instances = new WeakMap();
|
|
30
|
+
static debounce(instance, methodName, wait = 300) {
|
|
31
|
+
const key = Symbol(`${instance.constructor.name}.${methodName}`);
|
|
32
|
+
if (!this.instances.has(instance)) {
|
|
33
|
+
this.instances.set(instance, {});
|
|
34
|
+
}
|
|
35
|
+
const instanceData = this.instances.get(instance);
|
|
36
|
+
return (...args) => {
|
|
37
|
+
if (instanceData[key]) {
|
|
38
|
+
clearTimeout(instanceData[key]);
|
|
39
|
+
}
|
|
40
|
+
instanceData[key] = setTimeout(() => {
|
|
41
|
+
instance[methodName](...args);
|
|
42
|
+
delete instanceData[key];
|
|
43
|
+
}, wait);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
28
47
|
//# sourceMappingURL=debounce.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
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AAGD,MAAM,OAAO,iBAAiB;IAC5B,MAAM,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAEjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,GAAG,GAAG;QAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,UAAU,EAAE,CAAC,CAAC;QAEjE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAElD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE;YACjB,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;YAClC,CAAC;YAED,YAAY,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE;gBAClC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC9B,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC,CAAC;IACJ,CAAC"}
|
package/src/utils/jetLinks.js
CHANGED
|
@@ -62,13 +62,13 @@ function doWarning(meta2d, mess) {
|
|
|
62
62
|
let topicName = mess.payload.topicName;
|
|
63
63
|
let message = mess.payload.message;
|
|
64
64
|
let notifyTime = mess.payload.notifyTime;
|
|
65
|
-
let content = `<div style="padding:0px 12px 0px 0px;width:300px;">
|
|
66
|
-
<div style="display:flex;height: 20px;justify-content: space-between">
|
|
67
|
-
<div style="color: #000000d9;
|
|
68
|
-
font-size: 14px;
|
|
69
|
-
font-weight: 700;">${topicName}</div><div style="color: #00000073;">${getTime(notifyTime)}</div>
|
|
70
|
-
</div>
|
|
71
|
-
<span>${message}</span>
|
|
65
|
+
let content = `<div style="padding:0px 12px 0px 0px;width:300px;">
|
|
66
|
+
<div style="display:flex;height: 20px;justify-content: space-between">
|
|
67
|
+
<div style="color: #000000d9;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
font-weight: 700;">${topicName}</div><div style="color: #00000073;">${getTime(notifyTime)}</div>
|
|
70
|
+
</div>
|
|
71
|
+
<span>${message}</span>
|
|
72
72
|
</div>`;
|
|
73
73
|
meta2d.message({ content, duration: 0, closeBtn: true, placement: 'right', height: 75 });
|
|
74
74
|
if (mess.payload.detail?.alarmConfigId) {
|