zydx-plus 1.35.604 → 1.35.606

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.35.604",
3
+ "version": "1.35.606",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -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')" :disabled="layoutList === 'logicalStructure' || layoutList === ''">向右结构</button>
15
- <button @click="structure('organizationStructure')" :disabled="layoutList === 'organizationStructure'">向下结构</button>
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.debounce(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,23 @@ export default {
141
147
  }
142
148
  },
143
149
  methods: {
150
+ resizeCallback(entries) {
151
+ entries.forEach(entry => {
152
+ this.mindMap?.resize()
153
+ });
154
+ },
155
+ debounce(fn, delay = 500) {
156
+ let timer = null; // 定时器标识,用于重置延迟
157
+
158
+ return function (...args) {
159
+ // 每次触发时,清除之前的定时器(重置延迟)
160
+ clearTimeout(timer);
161
+ // 重新设置定时器,延迟执行目标函数
162
+ timer = setTimeout(() => {
163
+ fn.apply(this, args); // 保证this指向和参数传递正常
164
+ }, delay);
165
+ };
166
+ },
144
167
  lineToolSelect(v) {
145
168
  const associativeLineStyle = this.activeLineNode.getData('associativeLineStyle') || {}
146
169
  const toNodeUid = this.activeLineToNode.getData('uid')
@@ -239,7 +262,7 @@ export default {
239
262
  this.nodeData = node
240
263
  this.activeNodes = activeNodeList
241
264
  this.mindShow = !node
242
- if(node) {
265
+ if (node) {
243
266
  this.lineData = null
244
267
  this.lineShow = true
245
268
  }
@@ -301,7 +324,7 @@ export default {
301
324
  })
302
325
  },
303
326
  getImage(v) {
304
- const name = v? v : 'mind'
327
+ const name = v ? v : 'mind'
305
328
  this.mindMap.export('png', true, name, true, false, null, true)
306
329
  },
307
330
  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(() => {
package/src/index.js CHANGED
@@ -87,7 +87,7 @@ function install(app) {
87
87
  }
88
88
 
89
89
  export default {
90
- version: '1.35.604',
90
+ version: '1.35.606',
91
91
  install,
92
92
  Calendar,
93
93
  Message,