@opentiny/vue-docs 2.2.9 → 2.2.11
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/demos/pc/menus.js +0 -5
- package/package.json +8 -8
- package/demos/pc/app/mind-map/basic-usage-composition-api.vue +0 -14
- package/demos/pc/app/mind-map/basic-usage.spec.ts +0 -36
- package/demos/pc/app/mind-map/basic-usage.vue +0 -20
- package/demos/pc/app/mind-map/event-composition-api.vue +0 -125
- package/demos/pc/app/mind-map/event.spec.ts +0 -52
- package/demos/pc/app/mind-map/event.vue +0 -136
- package/demos/pc/app/mind-map/export-data-composition-api.vue +0 -108
- package/demos/pc/app/mind-map/export-data.spec.ts +0 -19
- package/demos/pc/app/mind-map/export-data.vue +0 -119
- package/demos/pc/app/mind-map/webdoc/mind-map.cn.md +0 -7
- package/demos/pc/app/mind-map/webdoc/mind-map.en.md +0 -7
- package/demos/pc/app/mind-map/webdoc/mind-map.js +0 -250
package/demos/pc/menus.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-docs",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@unocss/reset": "0.38.2",
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"marked": "^4.3.0",
|
|
17
17
|
"sortablejs": "1.15.0",
|
|
18
18
|
"@opentiny/vue-repl": "^1.1.0",
|
|
19
|
-
"@opentiny/vue": "~3.
|
|
20
|
-
"@opentiny/vue-icon": "~3.
|
|
21
|
-
"@opentiny/vue
|
|
22
|
-
"@opentiny/vue-
|
|
23
|
-
"@opentiny/vue-
|
|
19
|
+
"@opentiny/vue-icon-saas": "~3.13.0",
|
|
20
|
+
"@opentiny/vue-icon": "~3.13.0",
|
|
21
|
+
"@opentiny/vue": "~3.13.0",
|
|
22
|
+
"@opentiny/vue-design-smb": "~3.13.0",
|
|
23
|
+
"@opentiny/vue-common": "~3.13.0",
|
|
24
|
+
"@opentiny/vue-design-aurora": "~3.13.0",
|
|
24
25
|
"@opentiny/vue-theme": "~3.13.1",
|
|
25
|
-
"@opentiny/vue-design-aurora": "~3.12.0",
|
|
26
|
-
"@opentiny/vue-vite-import": "~1.1.5",
|
|
27
26
|
"@opentiny/vue-theme-mobile": "~3.13.0",
|
|
27
|
+
"@opentiny/vue-vite-import": "~1.1.5",
|
|
28
28
|
"@opentiny/vue-theme-saas": "~3.13.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
|
|
3
|
-
test('基本使用', async ({ page }) => {
|
|
4
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
5
|
-
await page.goto('mind-map#basic-usage')
|
|
6
|
-
|
|
7
|
-
const root = page.locator('me-tpc').filter({ hasText: 'root' })
|
|
8
|
-
expect(root).not.toBeNull()
|
|
9
|
-
await expect(root).toHaveText('root')
|
|
10
|
-
})
|
|
11
|
-
test('追加节点', async ({ page }) => {
|
|
12
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
13
|
-
await page.goto('mind-map#basic-usage')
|
|
14
|
-
|
|
15
|
-
await page.locator('me-tpc').click()
|
|
16
|
-
await page.locator('.map-canvas').press('Tab')
|
|
17
|
-
await page.locator('me-tpc').filter({ hasText: 'root' }).click()
|
|
18
|
-
await page.locator('.map-canvas').press('Tab')
|
|
19
|
-
await expect(page.locator('me-main me-wrapper')).toHaveCount(2)
|
|
20
|
-
})
|
|
21
|
-
test('修改节点', async ({ page }) => {
|
|
22
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
23
|
-
await page.goto('mind-map#basic-usage')
|
|
24
|
-
await page.locator('me-tpc').dblclick()
|
|
25
|
-
await page.locator('#input-box').fill('root-new')
|
|
26
|
-
await page.locator('#input-box').press('Enter')
|
|
27
|
-
})
|
|
28
|
-
test('删除节点', async ({ page }) => {
|
|
29
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
30
|
-
await page.goto('mind-map#basic-usage')
|
|
31
|
-
await page.locator('me-tpc').click()
|
|
32
|
-
await page.locator('.map-canvas').press('Tab')
|
|
33
|
-
await page.locator('me-tpc').filter({ hasText: 'root' }).click()
|
|
34
|
-
await page.locator('.map-canvas').press('Tab')
|
|
35
|
-
await page.locator('me-tpc').nth(2).press('Delete')
|
|
36
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<tiny-mind-map class="mindmap" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { MindMap } from '@opentiny/vue'
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
components: {
|
|
10
|
-
TinyMindMap: MindMap
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<style scoped>
|
|
16
|
-
.mindmap {
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 300px;
|
|
19
|
-
}
|
|
20
|
-
</style>
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<tiny-mind-map
|
|
3
|
-
ref="mindmap"
|
|
4
|
-
class="mindmap"
|
|
5
|
-
@create="onCreate"
|
|
6
|
-
@operation="onOperation"
|
|
7
|
-
@select-node="onSelectNode"
|
|
8
|
-
@select-new-node="onSelectNewNode"
|
|
9
|
-
@select-nodes="onSelectNodes"
|
|
10
|
-
@unselect-node="onUnselectNode"
|
|
11
|
-
@unselect-nodes="onUnselectNodes"
|
|
12
|
-
@expand-node="onExpandNode"
|
|
13
|
-
v-model="exampleData"
|
|
14
|
-
/>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup>
|
|
18
|
-
import { Notify, MindMap as TinyMindMap } from '@opentiny/vue'
|
|
19
|
-
import { ref } from 'vue'
|
|
20
|
-
|
|
21
|
-
const exmpleData = ref({
|
|
22
|
-
'nodeData': {
|
|
23
|
-
'id': 'c9ee6647385c42de',
|
|
24
|
-
'topic': '前端修仙指南',
|
|
25
|
-
'root': true,
|
|
26
|
-
'children': [
|
|
27
|
-
{
|
|
28
|
-
'topic': 'Handfirst html and css',
|
|
29
|
-
'id': 'c9ee977189f3b1f1'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
'topic': '高程',
|
|
33
|
-
'id': 'c9ee9a4e8f3f83c5'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
'topic': 'Javascript权威指南',
|
|
37
|
-
'id': 'c9ee9b8e87958282'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
'topic': '算法 第四版',
|
|
41
|
-
'id': 'c9eea19c874d331f'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
'topic': '大话数据结构',
|
|
45
|
-
'id': 'c9eea8d788441a71'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
'topic': '算法导论',
|
|
49
|
-
'id': 'c9eeac4c84aaba37'
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
'topic': '编译原理',
|
|
53
|
-
'id': 'c9eeadee881cf229'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
'topic': '宫水三叶的刷题日记',
|
|
57
|
-
'id': 'c9eec88a85d8ff76'
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
const onCreate = () => {
|
|
63
|
-
Notify({
|
|
64
|
-
type: 'info',
|
|
65
|
-
message: '触发事件create',
|
|
66
|
-
duration: 1000
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
const onOperation = () => {
|
|
70
|
-
Notify({
|
|
71
|
-
type: 'info',
|
|
72
|
-
message: '触发事件operation',
|
|
73
|
-
duration: 1000
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
const onSelectNode = () => {
|
|
77
|
-
Notify({
|
|
78
|
-
type: 'info',
|
|
79
|
-
message: '触发事件selectNode',
|
|
80
|
-
duration: 1000
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
const onSelectNewNode = () => {
|
|
84
|
-
Notify({
|
|
85
|
-
type: 'info',
|
|
86
|
-
message: '触发事件selectNewNode',
|
|
87
|
-
duration: 1000
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
const onSelectNodes = () => {
|
|
91
|
-
Notify({
|
|
92
|
-
type: 'info',
|
|
93
|
-
message: '触发事件selectNodes',
|
|
94
|
-
duration: 1000
|
|
95
|
-
})
|
|
96
|
-
}
|
|
97
|
-
const onUnselectNode = () => {
|
|
98
|
-
Notify({
|
|
99
|
-
type: 'info',
|
|
100
|
-
message: '触发事件unselectNode',
|
|
101
|
-
duration: 1000
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
const onUnselectNodes = () => {
|
|
105
|
-
Notify({
|
|
106
|
-
type: 'info',
|
|
107
|
-
message: '触发事件unselectNodes',
|
|
108
|
-
duration: 1000
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
const onExpandNode = () => {
|
|
112
|
-
Notify({
|
|
113
|
-
type: 'info',
|
|
114
|
-
message: '触发事件expandNode',
|
|
115
|
-
duration: 1000
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
</script>
|
|
119
|
-
|
|
120
|
-
<style scoped>
|
|
121
|
-
.mindmap {
|
|
122
|
-
width: 100%;
|
|
123
|
-
height: 300px;
|
|
124
|
-
}
|
|
125
|
-
</style>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
|
|
3
|
-
test('测试创建事件', async ({ page }) => {
|
|
4
|
-
await page.goto('mind-map#event')
|
|
5
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
6
|
-
await page.getByText('触发事件create').isVisible()
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test('测试operation事件', async ({ page }) => {
|
|
10
|
-
await page.goto('mind-map#event')
|
|
11
|
-
await page.locator('me-tpc').click()
|
|
12
|
-
await page.locator('.map-canvas').press('Tab')
|
|
13
|
-
await page.getByText('触发事件operation').first().isVisible()
|
|
14
|
-
// 新创建node时会触发selectNewNode事件
|
|
15
|
-
// 这个触发是符合逻辑的, 因为创建后的node的确是new-node
|
|
16
|
-
// 创建后会自动选择, 自然触发selectNewNode是符合逻辑的
|
|
17
|
-
await page.getByText('触发事件selectNewNode').first().isVisible()
|
|
18
|
-
})
|
|
19
|
-
test('测试select-node, select-nodes, select-new-node事件', async ({ page }) => {
|
|
20
|
-
await page.goto('mind-map#event')
|
|
21
|
-
await page.locator('me-tpc').filter({ hasText: 'root' }).click()
|
|
22
|
-
await page.locator('.map-canvas').press('Tab')
|
|
23
|
-
await page.locator('me-tpc').filter({ hasText: 'root' }).click()
|
|
24
|
-
await page.locator('.map-canvas').press('Tab')
|
|
25
|
-
await page.locator('me-tpc').filter({ hasText: 'root' }).click()
|
|
26
|
-
await page
|
|
27
|
-
.locator('me-tpc')
|
|
28
|
-
.nth(1)
|
|
29
|
-
.filter({ hasText: 'new node' })
|
|
30
|
-
.click({
|
|
31
|
-
modifiers: ['Control']
|
|
32
|
-
})
|
|
33
|
-
await page.getByText('触发事件selectNode').first().isVisible()
|
|
34
|
-
await page.getByAltText('触发事件selectNodes').isVisible()
|
|
35
|
-
})
|
|
36
|
-
test('测试 unselect-node,unselect-nodes', async ({ page }) => {
|
|
37
|
-
await page.goto('mind-map#event')
|
|
38
|
-
await page.locator('me-tpc').filter({ hasText: 'root' }).click()
|
|
39
|
-
await page.locator('.map-canvas').press('Tab')
|
|
40
|
-
await page.locator('me-tpc').filter({ hasText: 'root' }).click()
|
|
41
|
-
await page.locator('.map-canvas').press('Tab')
|
|
42
|
-
|
|
43
|
-
await page.locator('me-tpc').nth(2).click()
|
|
44
|
-
await page
|
|
45
|
-
.locator('me-tpc')
|
|
46
|
-
.nth(1)
|
|
47
|
-
|
|
48
|
-
.click({
|
|
49
|
-
modifiers: ['Control']
|
|
50
|
-
})
|
|
51
|
-
await page.locator('.map-canvas').click()
|
|
52
|
-
})
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<tiny-mind-map
|
|
3
|
-
ref="mindmap"
|
|
4
|
-
class="mindmap"
|
|
5
|
-
@create="onCreate"
|
|
6
|
-
@operation="onOperation"
|
|
7
|
-
@select-node="onSelectNode"
|
|
8
|
-
@select-new-node="onSelectNewNode"
|
|
9
|
-
@select-nodes="onSelectNodes"
|
|
10
|
-
@unselect-node="onUnselectNode"
|
|
11
|
-
@unselect-nodes="onUnselectNodes"
|
|
12
|
-
@expand-node="onExpandNode"
|
|
13
|
-
v-model="exampleData"
|
|
14
|
-
/>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script lang="jsx">
|
|
18
|
-
import { MindMap, Notify } from '@opentiny/vue'
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
components: {
|
|
22
|
-
TinyMindMap: MindMap
|
|
23
|
-
},
|
|
24
|
-
data() {
|
|
25
|
-
return {
|
|
26
|
-
exampleData: {
|
|
27
|
-
'nodeData': {
|
|
28
|
-
'id': 'c9ee6647385c42de',
|
|
29
|
-
'topic': '前端修仙指南',
|
|
30
|
-
'root': true,
|
|
31
|
-
'children': [
|
|
32
|
-
{
|
|
33
|
-
'topic': 'Handfirst html and css',
|
|
34
|
-
'id': 'c9ee977189f3b1f1'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
'topic': '高程',
|
|
38
|
-
'id': 'c9ee9a4e8f3f83c5'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
'topic': 'Javascript权威指南',
|
|
42
|
-
'id': 'c9ee9b8e87958282'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
'topic': '算法 第四版',
|
|
46
|
-
'id': 'c9eea19c874d331f'
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
'topic': '大话数据结构',
|
|
50
|
-
'id': 'c9eea8d788441a71'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
'topic': '算法导论',
|
|
54
|
-
'id': 'c9eeac4c84aaba37'
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
'topic': '编译原理',
|
|
58
|
-
'id': 'c9eeadee881cf229'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
'topic': '宫水三叶的刷题日记',
|
|
62
|
-
'id': 'c9eec88a85d8ff76'
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
loading: false
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
methods: {
|
|
71
|
-
onCreate() {
|
|
72
|
-
Notify({
|
|
73
|
-
type: 'info',
|
|
74
|
-
message: '触发事件create',
|
|
75
|
-
duration: 1000
|
|
76
|
-
})
|
|
77
|
-
},
|
|
78
|
-
onOperation() {
|
|
79
|
-
Notify({
|
|
80
|
-
type: 'info',
|
|
81
|
-
message: '触发事件operation',
|
|
82
|
-
duration: 1000
|
|
83
|
-
})
|
|
84
|
-
},
|
|
85
|
-
onSelectNode() {
|
|
86
|
-
Notify({
|
|
87
|
-
type: 'info',
|
|
88
|
-
message: '触发事件selectNode',
|
|
89
|
-
duration: 1000
|
|
90
|
-
})
|
|
91
|
-
},
|
|
92
|
-
onSelectNewNode() {
|
|
93
|
-
Notify({
|
|
94
|
-
type: 'info',
|
|
95
|
-
message: '触发事件selectNewNode',
|
|
96
|
-
duration: 1000
|
|
97
|
-
})
|
|
98
|
-
},
|
|
99
|
-
onSelectNodes() {
|
|
100
|
-
Notify({
|
|
101
|
-
type: 'info',
|
|
102
|
-
message: '触发事件selectNodes',
|
|
103
|
-
duration: 1000
|
|
104
|
-
})
|
|
105
|
-
},
|
|
106
|
-
onUnselectNode() {
|
|
107
|
-
Notify({
|
|
108
|
-
type: 'info',
|
|
109
|
-
message: '触发事件unselectNode',
|
|
110
|
-
duration: 1000
|
|
111
|
-
})
|
|
112
|
-
},
|
|
113
|
-
onUnselectNodes() {
|
|
114
|
-
Notify({
|
|
115
|
-
type: 'info',
|
|
116
|
-
message: '触发事件unselectNodes',
|
|
117
|
-
duration: 1000
|
|
118
|
-
})
|
|
119
|
-
},
|
|
120
|
-
onExpandNode() {
|
|
121
|
-
Notify({
|
|
122
|
-
type: 'info',
|
|
123
|
-
message: '触发事件expandNode',
|
|
124
|
-
duration: 1000
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
</script>
|
|
130
|
-
|
|
131
|
-
<style scoped>
|
|
132
|
-
.mindmap {
|
|
133
|
-
width: 100%;
|
|
134
|
-
height: 300px;
|
|
135
|
-
}
|
|
136
|
-
</style>
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<tiny-mind-map class="mindmap" ref="mindmap" @create="onCreate" v-model="exampleData" />
|
|
3
|
-
<tiny-button @click="exportData">导出数据</tiny-button>
|
|
4
|
-
<tiny-button @click="importData" :loading="loading">导入示例数据</tiny-button>
|
|
5
|
-
<tiny-button @click="clearData" :loading="loading">清空数据</tiny-button>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MindMap as TinyMindMap, Button as TinyButton, Notify } from '@opentiny/vue'
|
|
10
|
-
import { ref } from 'vue'
|
|
11
|
-
|
|
12
|
-
const render = ref(null)
|
|
13
|
-
const exampleData = ref({
|
|
14
|
-
'nodeData': {
|
|
15
|
-
'id': 'c9ee6647385c42de',
|
|
16
|
-
'topic': '前端修仙指南',
|
|
17
|
-
'root': true,
|
|
18
|
-
'children': [
|
|
19
|
-
{
|
|
20
|
-
'topic': 'Handfirst html and css',
|
|
21
|
-
'id': 'c9ee977189f3b1f1'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
'topic': '高程',
|
|
25
|
-
'id': 'c9ee9a4e8f3f83c5'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
'topic': 'Javascript权威指南',
|
|
29
|
-
'id': 'c9ee9b8e87958282'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
'topic': '算法 第四版',
|
|
33
|
-
'id': 'c9eea19c874d331f'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
'topic': '大话数据结构',
|
|
37
|
-
'id': 'c9eea8d788441a71'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
'topic': '算法导论',
|
|
41
|
-
'id': 'c9eeac4c84aaba37'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
'topic': '编译原理',
|
|
45
|
-
'id': 'c9eeadee881cf229'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
'topic': '宫水三叶的刷题日记',
|
|
49
|
-
'id': 'c9eec88a85d8ff76'
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
const loading = ref(false)
|
|
55
|
-
const onCreate = (instance) => {
|
|
56
|
-
render.value = instance
|
|
57
|
-
}
|
|
58
|
-
const exportData = () => {
|
|
59
|
-
if (render.value) {
|
|
60
|
-
Notify({
|
|
61
|
-
type: 'info',
|
|
62
|
-
message: '数据已经输出于控制台, 请打开控制台查看'
|
|
63
|
-
})
|
|
64
|
-
// eslint-disable-next-line no-console
|
|
65
|
-
console.log(render.value.getData())
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const importData = () => {
|
|
69
|
-
if (render.value) {
|
|
70
|
-
const fn = async () => {
|
|
71
|
-
return new Promise((resolve) => {
|
|
72
|
-
setTimeout(() => {
|
|
73
|
-
if (render.value) {
|
|
74
|
-
render.value.init(exampleData.value)
|
|
75
|
-
}
|
|
76
|
-
resolve(null)
|
|
77
|
-
}, 1000)
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
loading.value = true
|
|
81
|
-
fn().finally(() => (loading.value = false))
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const clearData = () => {
|
|
85
|
-
loading.value = true
|
|
86
|
-
const clearNodeData = {
|
|
87
|
-
'nodeData': {
|
|
88
|
-
'id': 'c9ee6647385c42de',
|
|
89
|
-
'topic': '我的子节点被清空啦~',
|
|
90
|
-
'root': true,
|
|
91
|
-
'children': []
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
render.value.init(clearNodeData)
|
|
96
|
-
render.value.refresh(clearNodeData)
|
|
97
|
-
} finally {
|
|
98
|
-
loading.value = false
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<style scoped>
|
|
104
|
-
.mindmap {
|
|
105
|
-
width: 100%;
|
|
106
|
-
height: 300px;
|
|
107
|
-
}
|
|
108
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
|
|
3
|
-
test('导出数据', async ({ page }) => {
|
|
4
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
5
|
-
await page.goto('mind-map#export-data')
|
|
6
|
-
await page.locator('button').filter({ hasText: '导出数据' }).click()
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test('导入数据', async ({ page }) => {
|
|
10
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
11
|
-
await page.goto('mind-map#export-data')
|
|
12
|
-
await page.locator('button').filter({ hasText: '导入示例数据' }).click()
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
test('清空样例数据', async ({ page }) => {
|
|
16
|
-
page.on('pageerror', (exception) => expect(exception).toBeNull())
|
|
17
|
-
await page.goto('mind-map#export-data')
|
|
18
|
-
await page.locator('button').filter({ hasText: '清空数据' }).click()
|
|
19
|
-
})
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<tiny-mind-map class="mindmap" ref="mindmap" @create="onCreate" v-model="exampleData" />
|
|
3
|
-
<tiny-button @click="exportData">导出数据</tiny-button>
|
|
4
|
-
<tiny-button @click="importData" :loading="loading">导入示例数据</tiny-button>
|
|
5
|
-
<tiny-button @click="clearData" :loading="loading">清空数据</tiny-button>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script lang="jsx">
|
|
9
|
-
import { MindMap, Button, Notify } from '@opentiny/vue'
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
components: {
|
|
13
|
-
TinyMindMap: MindMap,
|
|
14
|
-
TinyButton: Button
|
|
15
|
-
},
|
|
16
|
-
data() {
|
|
17
|
-
return {
|
|
18
|
-
render: null,
|
|
19
|
-
exampleData: {
|
|
20
|
-
'nodeData': {
|
|
21
|
-
'id': 'c9ee6647385c42de',
|
|
22
|
-
'topic': '前端修仙指南',
|
|
23
|
-
'root': true,
|
|
24
|
-
'children': [
|
|
25
|
-
{
|
|
26
|
-
'topic': 'Handfirst html and css',
|
|
27
|
-
'id': 'c9ee977189f3b1f1'
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
'topic': '高程',
|
|
31
|
-
'id': 'c9ee9a4e8f3f83c5'
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
'topic': 'Javascript权威指南',
|
|
35
|
-
'id': 'c9ee9b8e87958282'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
'topic': '算法 第四版',
|
|
39
|
-
'id': 'c9eea19c874d331f'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
'topic': '大话数据结构',
|
|
43
|
-
'id': 'c9eea8d788441a71'
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
'topic': '算法导论',
|
|
47
|
-
'id': 'c9eeac4c84aaba37'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
'topic': '编译原理',
|
|
51
|
-
'id': 'c9eeadee881cf229'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
'topic': '宫水三叶的刷题日记',
|
|
55
|
-
'id': 'c9eec88a85d8ff76'
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
loading: false
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
methods: {
|
|
64
|
-
onCreate(instance) {
|
|
65
|
-
this.render = instance
|
|
66
|
-
},
|
|
67
|
-
exportData() {
|
|
68
|
-
if (this.render) {
|
|
69
|
-
Notify({
|
|
70
|
-
type: 'info',
|
|
71
|
-
message: '数据已经输出于控制台, 请打开控制台查看'
|
|
72
|
-
})
|
|
73
|
-
// eslint-disable-next-line no-console
|
|
74
|
-
console.log(this.render.getData())
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
importData() {
|
|
78
|
-
if (this.render) {
|
|
79
|
-
const fn = async () => {
|
|
80
|
-
return new Promise((resolve) => {
|
|
81
|
-
setTimeout(() => {
|
|
82
|
-
if (this.render) {
|
|
83
|
-
this.render.init(this.exampleData)
|
|
84
|
-
}
|
|
85
|
-
resolve(null)
|
|
86
|
-
}, 1000)
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
this.loading = true
|
|
90
|
-
fn().finally(() => (this.loading = false))
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
clearData() {
|
|
94
|
-
this.loading = true
|
|
95
|
-
const clearNodeData = {
|
|
96
|
-
'nodeData': {
|
|
97
|
-
'id': 'c9ee6647385c42de',
|
|
98
|
-
'topic': '我的子节点被清空啦~',
|
|
99
|
-
'root': true,
|
|
100
|
-
'children': []
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
this.render.init(clearNodeData)
|
|
105
|
-
this.render.refresh(clearNodeData)
|
|
106
|
-
} finally {
|
|
107
|
-
this.loading = false
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
</script>
|
|
113
|
-
|
|
114
|
-
<style scoped>
|
|
115
|
-
.mindmap {
|
|
116
|
-
width: 100%;
|
|
117
|
-
height: 300px;
|
|
118
|
-
}
|
|
119
|
-
</style>
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
column: '2',
|
|
3
|
-
owner: '',
|
|
4
|
-
demos: [
|
|
5
|
-
{
|
|
6
|
-
demoId: 'basic-usage',
|
|
7
|
-
name: { 'zh-CN': '基本用法', 'en-US': 'Basic Usage' },
|
|
8
|
-
codeFiles: ['basic-usage.vue'],
|
|
9
|
-
desc: {
|
|
10
|
-
'zh-CN': '本示例介绍了脑图的基本使用方法',
|
|
11
|
-
'en-US': 'This example introduces the basic usage of mind map'
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
demoId: 'export-data',
|
|
16
|
-
name: { 'zh-CN': '导出数据', 'en-US': 'Export data' },
|
|
17
|
-
codeFiles: ['export-data.vue'],
|
|
18
|
-
desc: {
|
|
19
|
-
'zh-CN': '本demo讲解了如何导入导出脑图',
|
|
20
|
-
'en-US': 'This demo introduces how to import/exprot mind map data'
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
demoId: 'event',
|
|
25
|
-
name: { 'zh-CN': '事件触发', 'en-US': 'Event' },
|
|
26
|
-
codeFiles: ['event.vue'],
|
|
27
|
-
desc: {
|
|
28
|
-
'zh-CN': '本demo讲解了该组件的所有可触发事件',
|
|
29
|
-
'en-US': 'This demo explains all the triggering events of the build'
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
apis: [
|
|
34
|
-
{
|
|
35
|
-
name: 'mind-map',
|
|
36
|
-
type: 'component',
|
|
37
|
-
props: [
|
|
38
|
-
{
|
|
39
|
-
name: 'modelValue',
|
|
40
|
-
type: 'NodeObj',
|
|
41
|
-
defaultValue: '{}',
|
|
42
|
-
desc: {
|
|
43
|
-
'zh-CN': '默认节点数据',
|
|
44
|
-
'en-US': 'Default node data'
|
|
45
|
-
},
|
|
46
|
-
demoId: 'basic-usage'
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'options',
|
|
50
|
-
type: 'Options',
|
|
51
|
-
defaultValue: '{contextMenu: false,toolBar: false,nodeMenu: false}',
|
|
52
|
-
desc: {
|
|
53
|
-
'zh-CN': '配置项',
|
|
54
|
-
'en-US': 'options'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
events: [
|
|
59
|
-
{
|
|
60
|
-
name: 'operation',
|
|
61
|
-
type: 'onOperation',
|
|
62
|
-
'desc': {
|
|
63
|
-
'zh-CN': '节点重新计算时, 例如将节点A拖拽到节点B, 使得节点A是节点B的子节点',
|
|
64
|
-
'en-US':
|
|
65
|
-
'When recalculating nodes, for example, dragging node A to node B so that node A is a child node of node B'
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'create',
|
|
70
|
-
type: '(render:MindElixirInstance)=>void',
|
|
71
|
-
'desc': {
|
|
72
|
-
'zh-CN': 'mindmap创建时会触发该事件',
|
|
73
|
-
'en-US': 'This event will be triggered when creating mindmap'
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'selectNode',
|
|
78
|
-
type: 'onSelectNode',
|
|
79
|
-
'desc': {
|
|
80
|
-
'zh-CN': '选择任意一个节点时, 会触发该事件',
|
|
81
|
-
'en-US': 'When selecting any node, this event will be triggered'
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'selectNewNode',
|
|
86
|
-
type: 'onSelectNewNode',
|
|
87
|
-
'desc': {
|
|
88
|
-
'zh-CN': '创建新节点时',
|
|
89
|
-
'en-US': 'when create new node'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'selectNodes',
|
|
94
|
-
type: 'onSelectNodes',
|
|
95
|
-
'desc': {
|
|
96
|
-
'zh-CN': '选择多个节点的时候会触发该事件',
|
|
97
|
-
'en-US': 'When selecting multiple nodes, this event will be triggered'
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'unselectNode',
|
|
102
|
-
type: 'onUnselectNode',
|
|
103
|
-
'desc': {
|
|
104
|
-
'zh-CN': '取消选择的时候会触发该事件',
|
|
105
|
-
'en-US': 'When deselecting, this event will be triggered'
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'unselectNodes',
|
|
110
|
-
type: 'onUnselectNode',
|
|
111
|
-
'desc': {
|
|
112
|
-
'zh-CN': '取消选择多个节点时会触发该事件',
|
|
113
|
-
'en-US': 'This event will be triggered when multiple nodes are unselected'
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'expandNode',
|
|
118
|
-
type: 'onExpandNode',
|
|
119
|
-
'desc': {
|
|
120
|
-
'zh-CN': '展开节点时会触发该事件',
|
|
121
|
-
'en-US': 'This event will be triggered when expanding a node'
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: 'beforeImport',
|
|
126
|
-
type: '({render, data}: {render:MindElixirInstance, data: })=>void',
|
|
127
|
-
'desc': {
|
|
128
|
-
'zh-CN': 'v-model更新前会触发',
|
|
129
|
-
'en-US': 'Triggered before updating the v-model'
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: 'afterImport',
|
|
134
|
-
type: '({render, data}: {render:MindElixirInstance, data: })=>void',
|
|
135
|
-
'desc': {
|
|
136
|
-
'zh-CN': 'v-model更新后会触发',
|
|
137
|
-
'en-US': 'After updating the v-model, it will trigger'
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
],
|
|
143
|
-
types: [
|
|
144
|
-
{
|
|
145
|
-
'name': 'Options',
|
|
146
|
-
type: 'interface',
|
|
147
|
-
code: `
|
|
148
|
-
interface Options {
|
|
149
|
-
direction?: number
|
|
150
|
-
locale?: string
|
|
151
|
-
draggable?: boolean
|
|
152
|
-
editable?: boolean
|
|
153
|
-
contextMenu?: boolean
|
|
154
|
-
contextMenuOption?: any
|
|
155
|
-
toolBar?: boolean
|
|
156
|
-
keypress?: boolean
|
|
157
|
-
mouseSelectionButton?: 0 | 2
|
|
158
|
-
before?: Before
|
|
159
|
-
newTopicName?: string
|
|
160
|
-
allowUndo?: boolean
|
|
161
|
-
overflowHidden?: boolean
|
|
162
|
-
mainLinkStyle?: number
|
|
163
|
-
subLinkStyle?: number
|
|
164
|
-
mobileMenu?: boolean
|
|
165
|
-
theme?: Theme
|
|
166
|
-
nodeMenu?: boolean
|
|
167
|
-
}
|
|
168
|
-
`
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: 'onOperation',
|
|
172
|
-
type: 'type',
|
|
173
|
-
code: `
|
|
174
|
-
type onOperation = ({render, info}: {render:MindElixirInstance, info: Operation}) => void
|
|
175
|
-
`
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: 'onSelectNode',
|
|
179
|
-
type: 'type',
|
|
180
|
-
code: `
|
|
181
|
-
type onSelectNode = ({render,nodeObj}: {render:MindElixirInstance,nodeObj:NodeObj}, e?: MouseEvent) => void
|
|
182
|
-
`
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: 'onSelectNewNode',
|
|
186
|
-
type: 'type',
|
|
187
|
-
code: `
|
|
188
|
-
type selectNewNode: ({render,nodeObj}: {render:MindElixirInstance,nodeObj:NodeObj}) => void
|
|
189
|
-
`
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: 'onSelectNodes',
|
|
193
|
-
type: 'type',
|
|
194
|
-
code: `
|
|
195
|
-
type selectNodes: ({render,nodeObj}: {render:MindElixirInstance,nodeObj:NodeObj[]}) => void
|
|
196
|
-
`
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: 'onUnselectNode',
|
|
200
|
-
type: 'type',
|
|
201
|
-
code: `
|
|
202
|
-
type unselectNodes: ({render}: {render: MindElixirInstance}) => void
|
|
203
|
-
`
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: 'onUnselectNodes',
|
|
207
|
-
type: 'type',
|
|
208
|
-
code: `
|
|
209
|
-
type unselectNodes: ({render}: {render: MindElixirInstance}) => void
|
|
210
|
-
`
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: 'onExpandNode',
|
|
214
|
-
type: 'type',
|
|
215
|
-
code: `
|
|
216
|
-
type expandNode: ({render,nodeObj}: {render:MindElixirInstance,nodeObj:NodeObj}) => void
|
|
217
|
-
`
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: 'NodeObj',
|
|
221
|
-
type: 'interface',
|
|
222
|
-
code: `
|
|
223
|
-
export interface NodeObj {
|
|
224
|
-
topic: string
|
|
225
|
-
id: Uid
|
|
226
|
-
style?: {
|
|
227
|
-
fontSize?: string
|
|
228
|
-
color?: string
|
|
229
|
-
background?: string
|
|
230
|
-
fontWeight?: string
|
|
231
|
-
}
|
|
232
|
-
children?: NodeObj[]
|
|
233
|
-
tags?: string[]
|
|
234
|
-
icons?: string[]
|
|
235
|
-
hyperLink?: string
|
|
236
|
-
expanded?: boolean
|
|
237
|
-
direction?: number
|
|
238
|
-
root?: boolean
|
|
239
|
-
image?: {
|
|
240
|
-
url: string
|
|
241
|
-
width: number
|
|
242
|
-
height: number
|
|
243
|
-
}
|
|
244
|
-
branchColor?: string
|
|
245
|
-
parent?: NodeObj
|
|
246
|
-
}
|
|
247
|
-
`
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
}
|