zydx-plus 1.35.604 → 1.35.605
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
CHANGED
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
<div class="mind-btn">
|
|
12
12
|
<span>结构切换</span>
|
|
13
13
|
<div class="mind-btn-list">
|
|
14
|
-
<button @click="structure('logicalStructure')"
|
|
15
|
-
|
|
14
|
+
<button @click="structure('logicalStructure')"
|
|
15
|
+
:disabled="layoutList === 'logicalStructure' || layoutList === ''">向右结构
|
|
16
|
+
</button>
|
|
17
|
+
<button @click="structure('organizationStructure')" :disabled="layoutList === 'organizationStructure'">
|
|
18
|
+
向下结构
|
|
19
|
+
</button>
|
|
16
20
|
<button @click="structure('mindMap')" :disabled="layoutList === 'mindMap'">左右结构</button>
|
|
17
21
|
</div>
|
|
18
22
|
</div>
|
|
@@ -132,6 +136,8 @@ export default {
|
|
|
132
136
|
this.id = this.randomId()
|
|
133
137
|
setTimeout(() => {
|
|
134
138
|
this.init()
|
|
139
|
+
const resizeObserver = new ResizeObserver(this.throttle(this.resizeCallback, 300));
|
|
140
|
+
resizeObserver.observe(this.$refs[this.id]);
|
|
135
141
|
}, 0)
|
|
136
142
|
window.onresize = () => {
|
|
137
143
|
if (!document.fullscreenElement) {
|
|
@@ -141,6 +147,35 @@ export default {
|
|
|
141
147
|
}
|
|
142
148
|
},
|
|
143
149
|
methods: {
|
|
150
|
+
resizeCallback (entries) {
|
|
151
|
+
entries.forEach(entry => {
|
|
152
|
+
this.mindMap?.resize()
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
throttle(fn, delay = 300) {
|
|
156
|
+
let lastExecuteTime = 0; // 上一次函数执行的时间戳
|
|
157
|
+
let timer = null; // 定时器标识
|
|
158
|
+
|
|
159
|
+
return function (...args) {
|
|
160
|
+
const currentTime = Date.now(); // 当前时间戳
|
|
161
|
+
const remainingTime = delay - (currentTime - lastExecuteTime); // 距离下次可执行的剩余时间
|
|
162
|
+
|
|
163
|
+
// 清除之前的定时器(避免重复触发)
|
|
164
|
+
clearTimeout(timer);
|
|
165
|
+
|
|
166
|
+
// 1. 如果剩余时间 <= 0,说明已经过了节流间隔,直接执行函数
|
|
167
|
+
if (remainingTime <= 0) {
|
|
168
|
+
fn.apply(this, args);
|
|
169
|
+
lastExecuteTime = currentTime; // 更新上一次执行时间
|
|
170
|
+
} else {
|
|
171
|
+
// 2. 否则,设置定时器,在剩余时间后执行一次(避免最后一次变化不触发)
|
|
172
|
+
timer = setTimeout(() => {
|
|
173
|
+
fn.apply(this, args);
|
|
174
|
+
lastExecuteTime = Date.now();
|
|
175
|
+
}, remainingTime);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
},
|
|
144
179
|
lineToolSelect(v) {
|
|
145
180
|
const associativeLineStyle = this.activeLineNode.getData('associativeLineStyle') || {}
|
|
146
181
|
const toNodeUid = this.activeLineToNode.getData('uid')
|
|
@@ -239,7 +274,7 @@ export default {
|
|
|
239
274
|
this.nodeData = node
|
|
240
275
|
this.activeNodes = activeNodeList
|
|
241
276
|
this.mindShow = !node
|
|
242
|
-
if(node) {
|
|
277
|
+
if (node) {
|
|
243
278
|
this.lineData = null
|
|
244
279
|
this.lineShow = true
|
|
245
280
|
}
|
|
@@ -301,7 +336,7 @@ export default {
|
|
|
301
336
|
})
|
|
302
337
|
},
|
|
303
338
|
getImage(v) {
|
|
304
|
-
const name = v? v : 'mind'
|
|
339
|
+
const name = v ? v : 'mind'
|
|
305
340
|
this.mindMap.export('png', true, name, true, false, null, true)
|
|
306
341
|
},
|
|
307
342
|
lineStyle() {
|
|
@@ -118,7 +118,7 @@ export default {
|
|
|
118
118
|
value: {
|
|
119
119
|
handler(val) {
|
|
120
120
|
this.$nextTick(() => {
|
|
121
|
-
document.getElementById('htmlText').innerHTML = json2html(JSON.parse(val.html))
|
|
121
|
+
document.getElementById('htmlText').innerHTML = typeof val.html ==='string' ? json2html(JSON.parse(val.html)) : json2html(val.html)
|
|
122
122
|
document.getElementById('htmlText').style.width = this.$refs.tagging.offsetWidth + 'px'
|
|
123
123
|
this.annotationsData = val.annotations
|
|
124
124
|
setTimeout(() => {
|