zydx-plus 1.12.50 → 1.13.52

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.12.50",
3
+ "version": "1.13.52",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -25,7 +25,9 @@
25
25
  "flipbook-vue": "^1.0.0-beta.4",
26
26
  "@wangeditor/editor": "^5.1.23",
27
27
  "@wangeditor/plugin-upload-attachment": "^1.1.0",
28
- "snabbdom": "^3.5.1"
28
+ "snabbdom": "^3.5.1",
29
+ "@wangeditor/plugin-formula": "^1.0.11",
30
+ "katex": "^0.16.6"
29
31
  },
30
32
  "peerDependencies": {
31
33
  "vue": "^3.2.13"
@@ -10,10 +10,12 @@ import '@wangeditor/editor/dist/css/style.css'
10
10
  import { defineComponent, shallowReactive } from 'vue'
11
11
  import { Boot } from '@wangeditor/editor'
12
12
  import attachmentModule from '@wangeditor/plugin-upload-attachment'
13
+ import formulaModule from '@wangeditor/plugin-formula'
13
14
  import { menuModule } from './menu'
14
15
  import { nodeModule } from './node'
15
16
  import { useWangEditor,WeEditable, WeToolbar } from './wangeditor5-for-vue3/index'
16
17
  Boot.registerModule(attachmentModule)
18
+ Boot.registerModule(formulaModule)
17
19
  Boot.registerModule(nodeModule)
18
20
  Boot.registerModule(menuModule)
19
21
 
@@ -0,0 +1,7 @@
1
+ import mind from './src/mind.vue';
2
+
3
+ mind.install = function(Vue) {
4
+ Vue.component(mind.name, mind);
5
+ };
6
+
7
+ export default mind;
@@ -0,0 +1,514 @@
1
+ <template>
2
+ <div class="mind" ref="mind">
3
+ <div class="table">
4
+ <button :disabled="retShow" @click="ret">返回</button>
5
+ <button :disabled="forwardShow" @click="forward">前进</button>
6
+ <button :disabled="mindShow" @click="addNode">添加节点</button>
7
+ <button :disabled="mindShow" @click="brotherNode">兄弟节点</button>
8
+ <button :disabled="mindShow" @click="delNode">删除节点</button>
9
+ <button :disabled="mindShow" @click="associativeLine">关联线</button>
10
+ <button :disabled="mindShow" @click="nodeStyle">节点样式</button>
11
+ <button @click="structure">结构切换</button>
12
+ <button @click="preservation">保存</button>
13
+ </div>
14
+ <div id="mindMapContainer"></div>
15
+ <div class="node-style" ref="nodeStyle" :class="{'node-s': trans, 'node-h': !trans}">
16
+ <div class="style-li">
17
+ <div class="style-title">文字</div>
18
+ <div class="style-list">
19
+ <div class="node-left zIndex2">
20
+ <span>字号</span>
21
+ <Select :options="optionSize" v-model:value="sizeValue"></Select>
22
+ </div>
23
+ <div class="node-left padd zIndex2">
24
+ <span>行高</span>
25
+ <Select :options="optionRow" v-model:value="rowValue"></Select>
26
+ </div>
27
+ </div>
28
+ <div class="node-but">
29
+ <button @click="colorTap($event,'color')">颜色</button>
30
+ <button :style="{'background-color': (boldAct)? '#549688': '#fff','color': (boldAct)? '#fff': '#333'}" @click="bolds">粗体</button>
31
+ <button :style="{'background-color': (italicAct)? '#549688': '#fff','color': (italicAct)? '#fff': '#333'}" @click="italics">斜体</button>
32
+ <button :style="{'background-color': (scribeAct)? '#549688': '#fff','color': (scribeAct)? '#fff': '#333'}" @click="scribes">划线</button>
33
+ </div>
34
+ </div>
35
+ <div class="style-li">
36
+ <div class="style-title">边框</div>
37
+ <div class="style-list">
38
+ <div class="node-left">
39
+ <span>颜色</span>
40
+ <div @click="colorTap($event,'borderColor')" class="backColor"></div>
41
+ </div>
42
+ <div class="node-left padd zIndex3">
43
+ <span>样式</span>
44
+ <Select :options="optionLine" v-model:value="styleValue"></Select>
45
+ </div>
46
+ </div>
47
+ <div class="style-list">
48
+ <div class="node-left zIndex3">
49
+ <span>宽度</span>
50
+ <Select :options="optionWidth" v-model:value="widthValue"></Select>
51
+ </div>
52
+ <div class="node-left padd zIndex4">
53
+ <span>圆角</span>
54
+ <Select :options="optionWidth" v-model:value="filletValue"></Select>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ <div class="style-li">
59
+ <div class="style-title">背景</div>
60
+ <div class="style-list">
61
+ <div class="node-left">
62
+ <span>颜色</span>
63
+ <div @click="colorTap($event,'fillColor')" class="backColor"></div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ <div class="style-li">
68
+ <div class="style-title">线条</div>
69
+ <div class="style-list">
70
+ <div class="node-left zIndex">
71
+ <span>宽度</span>
72
+ <Select :options="optionWidth" v-model:value="lineValue"></Select>
73
+ </div>
74
+ <div class="node-left padd zIndex">
75
+ <span>样式</span>
76
+ <Select :options="optionLine" v-model:value="lineStyleValue"></Select>
77
+ </div>
78
+ </div>
79
+ <div class="style-list">
80
+ <div class="node-left">
81
+ <span>颜色</span>
82
+ <div @click="colorTap($event,'lineColor')" class="backColor"></div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ <div class="style-li">
87
+ <div class="style-title">形状</div>
88
+ <div class="style-list">
89
+ <div class="node-left">
90
+ <span>形状</span>
91
+ <Select :options="optionShape" v-model:value="shapeValue"></Select>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ <div class="back-col" :style="{top: top + 'px'}" v-if="colorShow">
96
+ <Coloring @submit="submit" @empty="empty" @rgba="rgba" :color="color"></Coloring>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </template>
101
+
102
+ <script>
103
+ import Select from '../../select/src/select.vue'
104
+ import Coloring from '../../coloring/src/coloring.vue'
105
+ import MindMap from "simple-mind-map";
106
+ import Drag from 'simple-mind-map/src/Drag.js'
107
+ import AssociativeLine from 'simple-mind-map/src/AssociativeLine.js'
108
+ import Export from 'simple-mind-map/src/Export.js'
109
+ import "simple-mind-map/dist/simpleMindMap.esm.css";
110
+
111
+ // 注册插件
112
+ MindMap.usePlugin(Drag).usePlugin(AssociativeLine).usePlugin(Export)
113
+
114
+ export default {
115
+ components: {Select,Coloring},
116
+ name: "jsmind",
117
+ data() {
118
+ return {
119
+ mindMap: null,
120
+ mindShow: false,
121
+ retShow: false,
122
+ forwardShow: false,
123
+ optionSize: [
124
+ {label: "12", value: '12'},
125
+ {label: "14", value: '14'},
126
+ {label: "16", value: '16'},
127
+ {label: "18", value: '18'},
128
+ {label: "20", value: '20'},
129
+ {label: "24", value: '24'},
130
+ {label: "26", value: '26'},
131
+ {label: "28", value: '28'},
132
+ {label: "30", value: '30'}
133
+ ],
134
+ sizeValue: '18',
135
+ optionRow: [
136
+ {label: "1", value: '1'},
137
+ {label: "1.5", value: '1.5'},
138
+ {label: "2", value: '2'},
139
+ {label: "2.5", value: '2.5'},
140
+ {label: "3", value: '3'}
141
+ ],
142
+ rowValue: '1.5',
143
+ optionWidth: [
144
+ {label: "0", value: '0'},
145
+ {label: "1", value: '1'},
146
+ {label: "2", value: '2'},
147
+ {label: "3", value: '3'},
148
+ {label: "4", value: '4'},
149
+ {label: "5", value: '5'},
150
+ {label: "6", value: '6'},
151
+ {label: "7", value: '7'},
152
+ {label: "8", value: '8'},
153
+ {label: "9", value: '9'},
154
+ {label: "10", value: '10'},
155
+ ],
156
+ widthValue: '1',
157
+ filletValue: '5',
158
+ lineValue: '1',
159
+ optionLine: [
160
+ {label: "实线", value: 'none'},
161
+ {label: "虚线", value: '5,5'},
162
+ {label: "点线", value: '1,5'}
163
+ ],
164
+ lineStyleValue: 'none',
165
+ styleValue: 'none',
166
+ optionShape: [
167
+ {label: "矩形", value: 'rectangle'},
168
+ {label: "菱形", value: 'diamond'},
169
+ {label: "平行四边形", value: 'parallelogram'},
170
+ {label: "圆角矩形", value: 'roundedRectangle'},
171
+ {label: "八角形", value: 'octagonalRectangle'},
172
+ {label: "外三角矩形", value: 'outerTriangularRectangle'},
173
+ {label: "内三角矩形", value: 'innerTriangularRectangle'},
174
+ {label: "椭圆", value: 'ellipse'},
175
+ {label: "圆", value: 'circle'},
176
+ ],
177
+ shapeValue: 'rectangle',
178
+ trans: false,
179
+ colorShow: false,
180
+ top: 0,
181
+ colorData: {},
182
+ activeNodes: null,
183
+ color: 'rgba(84,150,136,1)',
184
+ boldAct: false,
185
+ italicAct: false,
186
+ scribeAct: false
187
+ }
188
+ },
189
+ props: {
190
+ data: { // 数据
191
+ type: Object,
192
+ default: {
193
+ "data": {
194
+ "text": "根节点"
195
+ },
196
+ "children": []
197
+ }
198
+ },
199
+ readOnly: { // 只读
200
+ type: Boolean,
201
+ default: false
202
+ },
203
+ },
204
+ watch: {
205
+ sizeValue(e) { // 字号
206
+ this.activeNodes.forEach(node => {
207
+ node.setStyle('fontSize',e)
208
+ })
209
+ },
210
+ rowValue(e) { // 行高
211
+ this.activeNodes.forEach(node => {
212
+ node.setStyle('lineHeight',e)
213
+ })
214
+ },
215
+ styleValue(e) { // 粗斜体
216
+ this.activeNodes.forEach(node => {
217
+ node.setStyle('borderDasharray',e)
218
+ })
219
+ },
220
+ widthValue(e) { // 线宽
221
+ this.activeNodes.forEach(node => {
222
+ node.setStyle('borderWidth',e)
223
+ })
224
+ },
225
+ filletValue(e) { // 圆角
226
+ this.activeNodes.forEach(node => {
227
+ node.setStyle('borderRadius',e)
228
+ })
229
+ },
230
+ shapeValue(e) { // 形状
231
+ this.activeNodes.forEach(node => {
232
+ node.setStyle('shape',e)
233
+ })
234
+ },
235
+ lineValue(e) { // 线宽
236
+ this.activeNodes.forEach(node => {
237
+ node.setStyle('lineWidth',e)
238
+ })
239
+ },
240
+ lineStyleValue(e) { // 线宽
241
+ this.activeNodes.forEach(node => {
242
+ node.setStyle('lineDasharray',e)
243
+ })
244
+ },
245
+ },
246
+ mounted() {
247
+ let mindSess = sessionStorage.getItem('mind')
248
+ this.mindMap = new MindMap({
249
+ el: document.getElementById('mindMapContainer'),
250
+ enableFreeDrag: false, // 是否开启自由拖拽
251
+ enableNodeTransitionMove: false, // 是否开启节点过渡动画
252
+ layout: 'logicalStructure', // 节点布局方式
253
+ data: this.data
254
+ });
255
+ this.mindMap.setMode(this.readOnly ? 'readonly':'edit')
256
+ this.mindMap.on('node_active', (node, activeNodeList) => {
257
+ this.mindShow = node === null;
258
+ })
259
+ this.mindMap.on('back_forward', (index, len) => {
260
+ this.retShow = index <= 0;
261
+ this.forwardShow = index >= len - 1
262
+ })
263
+ this.mindMap.on('node_active', (node, activeNodeList) => {
264
+ this.activeNodes = activeNodeList
265
+ })
266
+ },
267
+ methods: {
268
+ // readOnly() {
269
+ // this.mindMap.setMode(value ? 'readonly' : 'edit')
270
+ // },
271
+ scribes() {
272
+ this.scribeAct = !this.scribeAct
273
+ this.activeNodes.forEach(node => {
274
+ node.setStyle('textDecoration', (!this.scribeAct)? 'none':'underline')
275
+ })
276
+ },
277
+ italics() {
278
+ this.italicAct = !this.italicAct
279
+ this.activeNodes.forEach(node => {
280
+ node.setStyle('fontStyle', (!this.italicAct)? 'normal':'italic')
281
+ })
282
+ },
283
+ bolds() {
284
+ this.boldAct = !this.boldAct
285
+ this.activeNodes.forEach(node => {
286
+ node.setStyle('fontWeight', (!this.boldAct)? 'normal':'bold')
287
+ })
288
+ },
289
+ rgba(e) {
290
+ this.colorData.data.target.style.backgroundColor = e.rgba
291
+ },
292
+ submit(e) {
293
+ this.activeNodes.forEach(node => {
294
+ node.setStyle(this.colorData.index, e.rgba)
295
+ })
296
+ this.colorData.data.target.style.backgroundColor = e.rgba
297
+ this.colorShow = false
298
+ },
299
+ empty() {
300
+ this.colorShow = false
301
+ },
302
+ colorTap(e,i) {
303
+ this.colorData = {index: i, data: e}
304
+ let parent = this.colorData.data.target.parentNode.offsetTop + 32
305
+ if(parent > 330) parent = 300
306
+ this.colorShow = !this.colorShow
307
+ this.top = parent
308
+ },
309
+ structure() {
310
+ let layoutList = 'logicalStructure'
311
+ const layout = this.mindMap.getLayout()
312
+ if (layout === 'mindMap') {
313
+ layoutList = 'organizationStructure'
314
+ } else if (layout === 'organizationStructure') {
315
+ layoutList = 'logicalStructure'
316
+ }else {
317
+ layoutList = 'mindMap'
318
+ }
319
+ this.mindMap.setLayout(layoutList)
320
+ },
321
+ preservation() {
322
+ this.mindMap.export('png',true,'123213', true)
323
+ },
324
+ nodeStyle() {
325
+ this.$refs.nodeStyle.style.display = 'block'
326
+ this.$refs.mind.style.overflow = 'hidden'
327
+ this.trans = !this.trans
328
+ setTimeout(() => {
329
+ this.$refs.mind.style.overflow = 'visible'
330
+ if(!this.trans) {
331
+ this.$refs.nodeStyle.style.display = 'none'
332
+ }
333
+ }, 250)
334
+ },
335
+ // 关联线
336
+ associativeLine() {
337
+ this.mindMap.associativeLine.createLineFromActiveNode()
338
+ },
339
+ // 前进
340
+ forward() {
341
+ this.mindMap.execCommand('FORWARD')
342
+ },
343
+ // 返回
344
+ ret() {
345
+ this.mindMap.execCommand('BACK')
346
+ },
347
+ // 添加节点
348
+ addNode() {
349
+ this.mindMap.execCommand('INSERT_CHILD_NODE')
350
+ },
351
+ // 删除节点
352
+ delNode() {
353
+ this.mindMap.execCommand('REMOVE_NODE')
354
+ },
355
+ // 兄弟节点
356
+ brotherNode() {
357
+ this.mindMap.execCommand('INSERT_NODE')
358
+ }
359
+ }
360
+ }
361
+ </script>
362
+
363
+ <style scoped>
364
+ .node-s{
365
+ animation: nodeShow 0.3s;
366
+ display: block;
367
+ }
368
+ .node-h{
369
+ animation: nodeHide 0.3s;
370
+ }
371
+ @keyframes nodeHide {
372
+ 0% {
373
+ opacity: 1;
374
+ transform: translateX(0);
375
+ }
376
+ 100% {
377
+ opacity: 0;
378
+ transform: translateX(110%);
379
+ }
380
+ }
381
+ @keyframes nodeShow {
382
+ 0% {
383
+ opacity: 0;
384
+ transform: translateX(110%);
385
+ }
386
+ 10% {
387
+ opacity: 1;
388
+ transform: translateX(100%);
389
+ }
390
+ 100% {
391
+ opacity: 1;
392
+ transform: translateX(0);
393
+ }
394
+ }
395
+ .zIndex{
396
+ position: relative;
397
+ z-index: 30;
398
+ }
399
+ .zIndex2{
400
+ position: relative;
401
+ z-index: 33;
402
+ }
403
+ .zIndex3{
404
+ position: relative;
405
+ z-index: 32;
406
+ }
407
+ .zIndex4{
408
+ position: relative;
409
+ z-index: 31;
410
+ }
411
+ .backColor{
412
+ width: 93px;
413
+ height: 30px;
414
+ border: 1px solid #ccc;
415
+ border-radius: 3px;
416
+ margin-left: -40px;
417
+ box-shadow: 0 1px 0 1px rgb(0 0 0 / 4%);
418
+ cursor: pointer;
419
+ background-color: #549688;
420
+ }
421
+ .back-col{
422
+ position: absolute;
423
+ top: 0;
424
+ left: 60px;
425
+ z-index: 40;
426
+ }
427
+ .node-but{
428
+ display: flex;
429
+ padding: 5px 0;
430
+ }
431
+ .node-but button{
432
+ flex: 1;
433
+ margin-right: 5px;
434
+ background-color: #fff;
435
+ border: 1px solid #ccc;
436
+ border-radius: 3px;
437
+ padding: 5px 10px;
438
+ cursor: pointer;
439
+ font-size: 12px;
440
+ }
441
+ .node-but button:last-child{
442
+ margin: 0;
443
+ }
444
+ .style-title{
445
+ font-size: 16px;
446
+ font-weight: bold;
447
+ padding: 5px 0 10px 0;
448
+ }
449
+ .mind {
450
+ width: 100%;
451
+ height: 100%;
452
+ position: relative;
453
+ }
454
+ .table{
455
+ position: absolute;
456
+ top: 10px;
457
+ left: 30px;
458
+ background-color: #fff;
459
+ border-radius: 5px;
460
+ padding: 10px;
461
+ box-shadow: rgba(0, 0, 0, 0.06) 0 2px 16px 0;
462
+ z-index: 10;
463
+ }
464
+ .style-list{
465
+ display: flex;
466
+ padding: 5px 0;
467
+ }
468
+ .node-left{
469
+ display: flex;
470
+ padding-right: 10px;
471
+ }
472
+ .node-left>span{
473
+ display: inline-block;
474
+ width: 80px;
475
+ line-height: 32px;
476
+ padding-right: 10px;
477
+ box-sizing: border-box;
478
+ }
479
+ .padd{
480
+ padding-right: 0;
481
+ }
482
+ .node-style{
483
+ position: absolute;
484
+ right: 0;
485
+ top: 50%;
486
+ background-color: #fff;
487
+ border-bottom-left-radius: 5px;
488
+ border-top-left-radius: 5px;
489
+ padding: 20px;
490
+ box-shadow: rgba(0, 0, 0, 0.06) 0 2px 16px 0;
491
+ z-index: 11;
492
+ width: 320px;
493
+ height: 550px;
494
+ margin-top: -270px;
495
+ display: none;
496
+ }
497
+ .table button{
498
+ margin-right: 5px;
499
+ background-color: #fff;
500
+ border: 1px solid #ccc;
501
+ border-radius: 3px;
502
+ padding: 5px 10px;
503
+ cursor: pointer;
504
+ font-size: 12px;
505
+ }
506
+ .table button:last-child{
507
+ margin-right: 0;
508
+ }
509
+
510
+ #mindMapContainer {
511
+ width: 100%;
512
+ height: 100%;
513
+ }
514
+ </style>
@@ -5,16 +5,18 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
+ import katex from "katex";
9
+ import "katex/dist/katex.css";
8
10
  export default {
9
11
  name: "zydx-word",
10
12
  data() {
11
13
  return {
12
- perPage: 38,
14
+ perPage: 40,
13
15
  pages: [],
14
16
  imgList: [], // 图片列表
15
17
  strNum: 76, // 每行字符数
16
18
  pagesText: '', // 每页内容
17
- start: 0,
19
+ start: 0
18
20
  }
19
21
  },
20
22
  props: {
@@ -27,6 +29,11 @@ export default {
27
29
  this.splitHtml(this.content, this.perPage)
28
30
  },
29
31
  methods: {
32
+ ToString(data) {
33
+ return katex.renderToString(data, {
34
+ throwOnError: false,
35
+ });
36
+ },
30
37
  getImgHeight(imgs) {
31
38
  // 获取img标签里的图片地址
32
39
  imgs = imgs.join('')
@@ -87,6 +94,16 @@ export default {
87
94
  this.pagesText += `<p style="text-align: center;"><img style="width: ${(w < 693) ? w : 693}px;height: ${(h > 1020) ? 1020 : h}px;vertical-align: middle;padding: 14px 0" src="${src}" alt="" /></p>`
88
95
  imgIndex += 1
89
96
  } else {
97
+ // 判断是否data-w-e-type="video"
98
+ if (arr[i].indexOf('data-w-e-type="formula"') > -1) {
99
+ // 获取公式内容
100
+ const dataValue = arr[i].match(/data-value=".*?"/g)[0].replace(/data-value="|"/g, '')
101
+ // 删除span标签
102
+ arr[i] = arr[i].replace(/<span.*?>/g, '$')
103
+ arr[i] = arr[i].replace(/<\/span>/g, '$')
104
+ const sp = arr[i].split('$$')
105
+ arr[i] = `${sp[0]}${this.ToString(dataValue)}${sp[1]}`
106
+ }
90
107
  // 判断标签是否是h1-h6
91
108
  if (arr[i].indexOf('<h') > -1) {
92
109
  arr[i] = arr[i].replace(/<h[1-6]>/g, '<p style="font-size: 18px;font-weight: bold;">')
@@ -147,14 +164,12 @@ export default {
147
164
  background-color: #fff;
148
165
  padding: 50px;
149
166
  display: inline-block;
150
- box-sizing: border-box;
151
167
  white-space: pre-wrap;
152
168
  text-align: left;
153
169
  box-shadow: 0 0 5px rgba(0, 0, 0, .5);
154
170
  margin-bottom: 30px;
155
171
  font-size: 18px;
156
- line-height: 1.5;
157
- page-break-after: always;
158
172
  position: relative;
173
+ box-sizing: border-box;
159
174
  }
160
175
  </style>
package/src/index.js CHANGED
@@ -15,6 +15,7 @@ import flip from './components/flip/index';
15
15
  import editor from './components/editor/index';
16
16
  import tab from './components/tab/index';
17
17
  import word from './components/word/index';
18
+ import mind from './components/mind/index';
18
19
 
19
20
  const components = [
20
21
  Calendar,
@@ -31,7 +32,8 @@ const components = [
31
32
  flip,
32
33
  editor,
33
34
  tab,
34
- word
35
+ word,
36
+ mind
35
37
  ];
36
38
 
37
39
  function install(app) {
@@ -43,7 +45,7 @@ function install(app) {
43
45
  }
44
46
 
45
47
  export default {
46
- version: '1.12.50',
48
+ version: '1.13.52',
47
49
  install,
48
50
  Calendar,
49
51
  Message,
@@ -61,6 +63,7 @@ export default {
61
63
  flip,
62
64
  editor,
63
65
  tab,
64
- word
66
+ word,
67
+ mind
65
68
  };
66
69