mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Compare commits
128 Commits
0.7.1-fix.
...
0.8.0-fix.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23a3e26800 | ||
|
|
c7b0cbc128 | ||
|
|
9915479354 | ||
|
|
abddafa3cf | ||
|
|
5b057ff9de | ||
|
|
6dcbc0604d | ||
|
|
0e5fed6645 | ||
|
|
b6d91ec07a | ||
|
|
baf36acc97 | ||
|
|
e0db4ad4f6 | ||
|
|
4fc2d79616 | ||
|
|
9e4652b7b5 | ||
|
|
8466a3e99f | ||
|
|
e85f187199 | ||
|
|
77167c572d | ||
|
|
9aae8bf55c | ||
|
|
250fb2eb50 | ||
|
|
2a49dd9140 | ||
|
|
4dedaaea3b | ||
|
|
7bc666be36 | ||
|
|
93a56ef4ee | ||
|
|
83b916d3c9 | ||
|
|
20157fcc8d | ||
|
|
2c3fb4d7ea | ||
|
|
75ad40ffbc | ||
|
|
e263eb8252 | ||
|
|
8e43cd609f | ||
|
|
1a3401fd1a | ||
|
|
d1dcef2537 | ||
|
|
e732415aa3 | ||
|
|
ddbde0141a | ||
|
|
bc907f4b37 | ||
|
|
1caf2c7f15 | ||
|
|
22b56fb8dc | ||
|
|
87eccc298c | ||
|
|
ca9e47183d | ||
|
|
1fbfe6f5ac | ||
|
|
84d2a374d1 | ||
|
|
74a000723b | ||
|
|
5079ad2190 | ||
|
|
21053c43c9 | ||
|
|
4c6270881a | ||
|
|
c17e5430ed | ||
|
|
0a36555343 | ||
|
|
bce2bb8fc4 | ||
|
|
d6ae06dbd6 | ||
|
|
9221c404ee | ||
|
|
697e53ff7d | ||
|
|
9360aff6c9 | ||
|
|
c68d629b7a | ||
|
|
caedfb46a9 | ||
|
|
2e4c6bc08e | ||
|
|
777eafcd2f | ||
|
|
20780a0c59 | ||
|
|
5d433cce16 | ||
|
|
ba77fde93b | ||
|
|
45b8850493 | ||
|
|
39c2c15259 | ||
|
|
6d780c6c26 | ||
|
|
4cf66adc18 | ||
|
|
7bff14e1bb | ||
|
|
7986e0d0cc | ||
|
|
a316d0f0fe | ||
|
|
88fa6225eb | ||
|
|
7ec720823f | ||
|
|
c39daf72b4 | ||
|
|
9c4e72eb29 | ||
|
|
88e3c1f660 | ||
|
|
e6c92d4a5e | ||
|
|
745531f20f | ||
|
|
3acd425c09 | ||
|
|
8dcc7c985d | ||
|
|
253ded33bf | ||
|
|
2c6b8294f4 | ||
|
|
83a5ef8e2e | ||
|
|
b959e90723 | ||
|
|
89ebc9a1fa | ||
|
|
56d2e34fbd | ||
|
|
0f2aed7e8a | ||
|
|
288ceafa92 | ||
|
|
99dc443142 | ||
|
|
b6440eba1a | ||
|
|
545e46babc | ||
|
|
b95b6af1b1 | ||
|
|
ccef5fc581 | ||
|
|
ed82fe5a61 | ||
|
|
1550f032d9 | ||
|
|
7d2758a21c | ||
|
|
e4fab73017 | ||
|
|
1beb03eaa6 | ||
|
|
20f67efd58 | ||
|
|
8c3d66eb3c | ||
|
|
a4f6006efd | ||
|
|
1d297350cc | ||
|
|
07650f8978 | ||
|
|
b26e5625ce | ||
|
|
1e38731ecb | ||
|
|
ef9b9804cb | ||
|
|
9fe321a127 | ||
|
|
464e57d019 | ||
|
|
50f125471e | ||
|
|
6bbee4a5cc | ||
|
|
5052c0427a | ||
|
|
9528631ed1 | ||
|
|
2a816f62fa | ||
|
|
8596e3356d | ||
|
|
7422af7f3b | ||
|
|
0f047da78b | ||
|
|
f866abb34c | ||
|
|
01d7e36990 | ||
|
|
a9493b9c16 | ||
|
|
a59a283d74 | ||
|
|
aafcba8bb7 | ||
|
|
11ea7d452c | ||
|
|
47d21d85fb | ||
|
|
518b7642a0 | ||
|
|
a9ea4b8e33 | ||
|
|
443465eb86 | ||
|
|
e1172c8d0d | ||
|
|
7a2605fdad | ||
|
|
a97d549d69 | ||
|
|
fcf48ca3dc | ||
|
|
c0ad18cff8 | ||
|
|
73e7855575 | ||
|
|
69ef7faf49 | ||
|
|
036f845968 | ||
|
|
740e2e3410 | ||
|
|
ba44f69f9f |
35
README.md
35
README.md
@@ -25,18 +25,21 @@ Github:[releases](https://github.com/wanglin2/mind-map/releases)。
|
||||
|
||||
百度云盘:[地址](https://pan.baidu.com/s/1huasEbKsGNH2Af68dvWiOg?pwd=3bp3)。
|
||||
|
||||
> 客户端版本会落后于在线版本,尝试最新功能请优先使用在线版。
|
||||
|
||||
# 特性
|
||||
|
||||
- [x] 插件化架构,除核心功能外,其他功能作为插件提供,按需使用,减小打包体积
|
||||
- [x] 支持逻辑结构图、思维导图、组织结构图、目录组织图、时间轴(横向、竖向)、鱼骨图等结构
|
||||
- [x] 内置多种主题,允许高度自定义样式,支持注册新主题
|
||||
- [x] 节点内容支持文本(普通文本、富文本)、图片、图标、超链接、备注、标签、概要
|
||||
- [x] 节点内容支持文本(普通文本、富文本)、图片、图标、超链接、备注、标签、概要、数学公式
|
||||
- [x] 节点支持拖拽(拖拽移动、自由调整)、多种节点形状,支持使用 DDM 完全自定义节点内容
|
||||
- [x] 支持画布拖动、缩放
|
||||
- [x] 支持鼠标按键拖动选择和Ctrl+左键两种多选节点方式
|
||||
- [x] 支持导出为`json`、`png`、`svg`、`pdf`、`markdown`、`xmind`,支持从`json`、`xmind`、`markdown`导入
|
||||
- [x] 支持快捷键、前进后退、关联线、搜索替换、小地图、水印
|
||||
- [x] 支持快捷键、前进后退、关联线、搜索替换、小地图、水印、滚动条
|
||||
- [x] 提供丰富的配置,满足各种场景各种使用习惯
|
||||
- [x] 支持协同编辑
|
||||
|
||||
# 安装
|
||||
|
||||
@@ -91,11 +94,11 @@ const mindMap = new MindMap({
|
||||
|
||||
# 请作者喝杯咖啡
|
||||
|
||||
开源不易,如果本项目有帮助到你的话,可以考虑请作者喝杯咖啡哟~
|
||||
开源不易,如果本项目有帮助到你的话,可以考虑请作者喝杯咖啡~
|
||||
|
||||
> 厚椰乳一盒 + 纯牛奶半盒 + 冰块 + 咖啡液 = 生椰拿铁 yyds
|
||||
|
||||
> 推荐使用支付宝,微信获取不到头像。转账请备注【思维导图】。你的头像和名字将会出现在下面和[文档页面](https://wanglin2.github.io/mind-map/#/doc/zh/introduction/%E8%AF%B7%E4%BD%9C%E8%80%85%E5%96%9D%E6%9D%AF%E5%92%96%E5%95%A1)
|
||||
> 推荐使用支付宝,微信获取不到头像。转账请备注【思维导图】。
|
||||
|
||||
<p>
|
||||
<img src="./web/src/assets/img/alipay.jpg" style="width: 300px" />
|
||||
@@ -183,4 +186,28 @@ const mindMap = new MindMap({
|
||||
<img src="./web/src/assets/avatar/敏.jpg" style="width: 50px;height: 50px;" />
|
||||
<span>敏</span>
|
||||
</span>
|
||||
<span>
|
||||
<img src="./web/src/assets/avatar/沐风牧草.jpg" style="width: 50px;height: 50px;" />
|
||||
<span>沐风牧草</span>
|
||||
</span>
|
||||
<span>
|
||||
<img src="./web/src/assets/avatar/有希.jpg" style="width: 50px;height: 50px;" />
|
||||
<span>有希</span>
|
||||
</span>
|
||||
<span>
|
||||
<img src="./web/src/assets/avatar/樊笼.jpg" style="width: 50px;height: 50px;" />
|
||||
<span>樊笼</span>
|
||||
</span>
|
||||
<span>
|
||||
<img src="./web/src/assets/avatar/达仁科技.jpg" style="width: 50px;height: 50px;" />
|
||||
<span>达仁科技</span>
|
||||
</span>
|
||||
<span>
|
||||
<img src="./web/src/assets/avatar/小逗比.png" style="width: 50px;height: 50px;" />
|
||||
<span>小逗比</span>
|
||||
</span>
|
||||
<span>
|
||||
<img src="./web/src/assets/avatar/天清如愿.jpg" style="width: 50px;height: 50px;" />
|
||||
<span>天清如愿</span>
|
||||
</span>
|
||||
</p>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1"><link rel="icon" href="dist/logo.ico"><title>思绪思维导图</title><script>// 自定义静态资源的路径
|
||||
window.externalPublicPath = './dist/'
|
||||
// 接管应用
|
||||
window.takeOverApp = false</script><link href="dist/css/chunk-vendors.css?3d449dfd2d4c7693c086" rel="stylesheet"><link href="dist/css/app.css?3d449dfd2d4c7693c086" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script>const getDataFromBackend = () => {
|
||||
window.takeOverApp = false</script><link href="dist/css/chunk-vendors.css?8082e15354ee539c1308" rel="stylesheet"><link href="dist/css/app.css?8082e15354ee539c1308" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script>const getDataFromBackend = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
@@ -66,4 +66,4 @@
|
||||
// 可以通过window.$bus.$on()来监听应用的一些事件
|
||||
// 实例化页面
|
||||
window.initApp()
|
||||
}</script><script src="dist/js/chunk-vendors.js?3d449dfd2d4c7693c086"></script><script src="dist/js/app.js?3d449dfd2d4c7693c086"></script></body></html>
|
||||
}</script><script src="dist/js/chunk-vendors.js?8082e15354ee539c1308"></script><script src="dist/js/app.js?8082e15354ee539c1308"></script></body></html>
|
||||
152
simple-mind-map/bin/wsServer.mjs
Normal file
152
simple-mind-map/bin/wsServer.mjs
Normal file
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import ws from 'ws'
|
||||
import http from 'http'
|
||||
import * as map from 'lib0/map'
|
||||
|
||||
const wsReadyStateConnecting = 0
|
||||
const wsReadyStateOpen = 1
|
||||
const wsReadyStateClosing = 2 // eslint-disable-line
|
||||
const wsReadyStateClosed = 3 // eslint-disable-line
|
||||
|
||||
const pingTimeout = 30000
|
||||
|
||||
const port = process.env.PORT || 4444
|
||||
// @ts-ignore
|
||||
const wss = new ws.Server({ noServer: true })
|
||||
|
||||
const server = http.createServer((request, response) => {
|
||||
response.writeHead(200, { 'Content-Type': 'text/plain' })
|
||||
response.end('okay')
|
||||
})
|
||||
|
||||
/**
|
||||
* Map froms topic-name to set of subscribed clients.
|
||||
* @type {Map<string, Set<any>>}
|
||||
*/
|
||||
const topics = new Map()
|
||||
|
||||
/**
|
||||
* @param {any} conn
|
||||
* @param {object} message
|
||||
*/
|
||||
const send = (conn, message) => {
|
||||
if (
|
||||
conn.readyState !== wsReadyStateConnecting &&
|
||||
conn.readyState !== wsReadyStateOpen
|
||||
) {
|
||||
conn.close()
|
||||
}
|
||||
try {
|
||||
conn.send(JSON.stringify(message))
|
||||
} catch (e) {
|
||||
conn.close()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup a new client
|
||||
* @param {any} conn
|
||||
*/
|
||||
const onconnection = conn => {
|
||||
/**
|
||||
* @type {Set<string>}
|
||||
*/
|
||||
const subscribedTopics = new Set()
|
||||
let closed = false
|
||||
// Check if connection is still alive
|
||||
let pongReceived = true
|
||||
const pingInterval = setInterval(() => {
|
||||
if (!pongReceived) {
|
||||
conn.close()
|
||||
clearInterval(pingInterval)
|
||||
} else {
|
||||
pongReceived = false
|
||||
try {
|
||||
conn.ping()
|
||||
} catch (e) {
|
||||
conn.close()
|
||||
}
|
||||
}
|
||||
}, pingTimeout)
|
||||
conn.on('pong', () => {
|
||||
pongReceived = true
|
||||
})
|
||||
conn.on('close', () => {
|
||||
subscribedTopics.forEach(topicName => {
|
||||
const subs = topics.get(topicName) || new Set()
|
||||
subs.delete(conn)
|
||||
if (subs.size === 0) {
|
||||
topics.delete(topicName)
|
||||
}
|
||||
})
|
||||
subscribedTopics.clear()
|
||||
closed = true
|
||||
})
|
||||
conn.on(
|
||||
'message',
|
||||
/** @param {object} message */ message => {
|
||||
if (typeof message === 'string') {
|
||||
message = JSON.parse(message)
|
||||
}
|
||||
if (message && message.type && !closed) {
|
||||
switch (message.type) {
|
||||
case 'subscribe':
|
||||
/** @type {Array<string>} */ ;(message.topics || []).forEach(
|
||||
topicName => {
|
||||
if (typeof topicName === 'string') {
|
||||
// add conn to topic
|
||||
const topic = map.setIfUndefined(
|
||||
topics,
|
||||
topicName,
|
||||
() => new Set()
|
||||
)
|
||||
topic.add(conn)
|
||||
// add topic to conn
|
||||
subscribedTopics.add(topicName)
|
||||
}
|
||||
}
|
||||
)
|
||||
break
|
||||
case 'unsubscribe':
|
||||
/** @type {Array<string>} */ ;(message.topics || []).forEach(
|
||||
topicName => {
|
||||
const subs = topics.get(topicName)
|
||||
if (subs) {
|
||||
subs.delete(conn)
|
||||
}
|
||||
}
|
||||
)
|
||||
break
|
||||
case 'publish':
|
||||
if (message.topic) {
|
||||
const receivers = topics.get(message.topic)
|
||||
if (receivers) {
|
||||
message.clients = receivers.size
|
||||
receivers.forEach(receiver => send(receiver, message))
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'ping':
|
||||
send(conn, { type: 'pong' })
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
wss.on('connection', onconnection)
|
||||
|
||||
server.on('upgrade', (request, socket, head) => {
|
||||
// You may check auth of request here..
|
||||
/**
|
||||
* @param {any} ws
|
||||
*/
|
||||
const handleAuth = ws => {
|
||||
wss.emit('connection', ws, request)
|
||||
}
|
||||
wss.handleUpgrade(request, socket, head, handleAuth)
|
||||
})
|
||||
|
||||
server.listen(port)
|
||||
|
||||
console.log('Signaling server running on localhost:', port)
|
||||
@@ -14,6 +14,7 @@ import TouchEvent from './src/plugins/TouchEvent.js'
|
||||
import Search from './src/plugins/Search.js'
|
||||
import Painter from './src/plugins/Painter.js'
|
||||
import Scrollbar from './src/plugins/Scrollbar.js'
|
||||
import Formula from './src/plugins/Formula.js'
|
||||
import xmind from './src/parse/xmind.js'
|
||||
import markdown from './src/parse/markdown.js'
|
||||
import icons from './src/svg/icons.js'
|
||||
@@ -43,5 +44,6 @@ MindMap.usePlugin(MiniMap)
|
||||
.usePlugin(Search)
|
||||
.usePlugin(Painter)
|
||||
.usePlugin(Scrollbar)
|
||||
.usePlugin(Formula)
|
||||
|
||||
export default MindMap
|
||||
|
||||
@@ -35,21 +35,16 @@ class MindMap {
|
||||
// 容器元素
|
||||
this.el = this.opt.el
|
||||
if (!this.el) throw new Error('缺少容器元素el')
|
||||
this.elRect = this.el.getBoundingClientRect()
|
||||
|
||||
// 画布宽高
|
||||
this.width = this.elRect.width
|
||||
this.height = this.elRect.height
|
||||
if (this.width <= 0 || this.height <= 0)
|
||||
throw new Error('容器元素el的宽高不能为0')
|
||||
// 获取容器尺寸位置信息
|
||||
this.getElRectInfo()
|
||||
|
||||
// 添加css
|
||||
this.cssEl = null
|
||||
this.addCss()
|
||||
|
||||
// 画布
|
||||
this.svg = SVG().addTo(this.el).size(this.width, this.height)
|
||||
this.draw = this.svg.group()
|
||||
this.initContainer()
|
||||
|
||||
// 初始化主题
|
||||
this.initTheme()
|
||||
@@ -79,8 +74,7 @@ class MindMap {
|
||||
|
||||
// 视图操作类
|
||||
this.view = new View({
|
||||
mindMap: this,
|
||||
draw: this.draw
|
||||
mindMap: this
|
||||
})
|
||||
|
||||
// 批量执行类
|
||||
@@ -111,6 +105,46 @@ class MindMap {
|
||||
return opt
|
||||
}
|
||||
|
||||
// 创建容器元素
|
||||
initContainer() {
|
||||
const { associativeLineIsAlwaysAboveNode } = this.opt
|
||||
// 节点关联线容器
|
||||
const createAssociativeLineDraw = () => {
|
||||
this.associativeLineDraw = this.draw.group()
|
||||
this.associativeLineDraw.addClass('smm-associative-line-container')
|
||||
}
|
||||
// 画布
|
||||
this.svg = SVG().addTo(this.el).size(this.width, this.height)
|
||||
// 容器
|
||||
this.draw = this.svg.group()
|
||||
this.draw.addClass('smm-container')
|
||||
// 节点连线容器
|
||||
this.lineDraw = this.draw.group()
|
||||
this.lineDraw.addClass('smm-line-container')
|
||||
// 默认处于节点下方
|
||||
if (!associativeLineIsAlwaysAboveNode) {
|
||||
createAssociativeLineDraw()
|
||||
}
|
||||
// 节点容器
|
||||
this.nodeDraw = this.draw.group()
|
||||
this.nodeDraw.addClass('smm-node-container')
|
||||
// 关联线始终处于节点上方
|
||||
if (associativeLineIsAlwaysAboveNode) {
|
||||
createAssociativeLineDraw()
|
||||
}
|
||||
// 其他内容的容器
|
||||
this.otherDraw = this.draw.group()
|
||||
this.otherDraw.addClass('smm-other-container')
|
||||
}
|
||||
|
||||
// 清空各容器
|
||||
clearDraw() {
|
||||
this.lineDraw.clear()
|
||||
this.associativeLineDraw.clear()
|
||||
this.nodeDraw.clear()
|
||||
this.otherDraw.clear()
|
||||
}
|
||||
|
||||
// 添加必要的css样式到页面
|
||||
addCss() {
|
||||
this.cssEl = document.createElement('style')
|
||||
@@ -136,19 +170,27 @@ class MindMap {
|
||||
// 重新渲染
|
||||
reRender(callback, source = '') {
|
||||
this.batchExecution.push('render', () => {
|
||||
this.draw.clear()
|
||||
this.clearDraw()
|
||||
this.initTheme()
|
||||
this.renderer.reRender = true
|
||||
this.renderer.render(callback, source)
|
||||
})
|
||||
}
|
||||
|
||||
// 容器尺寸变化,调整尺寸
|
||||
resize() {
|
||||
// 获取或更新容器尺寸位置信息
|
||||
getElRectInfo() {
|
||||
this.elRect = this.el.getBoundingClientRect()
|
||||
this.width = this.elRect.width
|
||||
this.height = this.elRect.height
|
||||
if (this.width <= 0 || this.height <= 0)
|
||||
throw new Error('容器元素el的宽高不能为0')
|
||||
}
|
||||
|
||||
// 容器尺寸变化,调整尺寸
|
||||
resize() {
|
||||
this.getElRectInfo()
|
||||
this.svg.size(this.width, this.height)
|
||||
this.emit('resize')
|
||||
}
|
||||
|
||||
// 监听事件
|
||||
@@ -192,10 +234,12 @@ class MindMap {
|
||||
}
|
||||
|
||||
// 设置主题
|
||||
setTheme(theme) {
|
||||
this.renderer.clearAllActive()
|
||||
setTheme(theme, notRender = false) {
|
||||
this.execCommand('CLEAR_ACTIVE_NODE')
|
||||
this.opt.theme = theme
|
||||
this.render(null, CONSTANTS.CHANGE_THEME)
|
||||
if (!notRender) {
|
||||
this.render(null, CONSTANTS.CHANGE_THEME)
|
||||
}
|
||||
this.emit('view_theme_change', theme)
|
||||
}
|
||||
|
||||
@@ -205,13 +249,15 @@ class MindMap {
|
||||
}
|
||||
|
||||
// 设置主题配置
|
||||
setThemeConfig(config) {
|
||||
setThemeConfig(config, notRender = false) {
|
||||
// 计算改变了的配置
|
||||
const changedConfig = getObjectChangedProps(this.themeConfig, config)
|
||||
this.opt.themeConfig = config
|
||||
// 检查改变的是否是节点大小无关的主题属性
|
||||
let res = checkIsNodeSizeIndependenceConfig(changedConfig)
|
||||
this.render(null, res ? '' : CONSTANTS.CHANGE_THEME)
|
||||
if (!notRender) {
|
||||
// 检查改变的是否是节点大小无关的主题属性
|
||||
let res = checkIsNodeSizeIndependenceConfig(changedConfig)
|
||||
this.render(null, res ? '' : CONSTANTS.CHANGE_THEME)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取自定义主题配置
|
||||
@@ -240,7 +286,7 @@ class MindMap {
|
||||
}
|
||||
|
||||
// 设置布局结构
|
||||
setLayout(layout) {
|
||||
setLayout(layout, notRender = false) {
|
||||
// 检查布局配置
|
||||
if (!layoutValueList.includes(layout)) {
|
||||
layout = CONSTANTS.LAYOUT.LOGICAL_STRUCTURE
|
||||
@@ -248,7 +294,9 @@ class MindMap {
|
||||
this.opt.layout = layout
|
||||
this.view.reset()
|
||||
this.renderer.setLayout()
|
||||
this.render(null, CONSTANTS.CHANGE_LAYOUT)
|
||||
if (!notRender) {
|
||||
this.render(null, CONSTANTS.CHANGE_LAYOUT)
|
||||
}
|
||||
}
|
||||
|
||||
// 执行命令
|
||||
@@ -258,15 +306,13 @@ class MindMap {
|
||||
|
||||
// 动态设置思维导图数据,纯节点数据
|
||||
setData(data) {
|
||||
data = simpleDeepClone(data || {})
|
||||
this.execCommand('CLEAR_ACTIVE_NODE')
|
||||
this.command.clearHistory()
|
||||
this.command.addHistory()
|
||||
if (this.richText) {
|
||||
this.renderer.renderTree = this.richText.handleSetData(data)
|
||||
} else {
|
||||
this.renderer.renderTree = data
|
||||
}
|
||||
this.renderer.setData(data)
|
||||
this.reRender(() => {}, CONSTANTS.SET_DATA)
|
||||
this.emit('set_data', data)
|
||||
}
|
||||
|
||||
// 动态设置思维导图数据,包括节点数据、布局、主题、视图
|
||||
@@ -336,20 +382,20 @@ class MindMap {
|
||||
this.opt.readonly = mode === CONSTANTS.MODE.READONLY
|
||||
if (this.opt.readonly) {
|
||||
// 取消当前激活的元素
|
||||
this.renderer.clearAllActive()
|
||||
this.execCommand('CLEAR_ACTIVE_NODE')
|
||||
}
|
||||
this.emit('mode_change', mode)
|
||||
}
|
||||
|
||||
// 获取svg数据
|
||||
getSvgData({ paddingX = 0, paddingY = 0 } = {}) {
|
||||
getSvgData({ paddingX = 0, paddingY = 0, ignoreWatermark = false } = {}) {
|
||||
const svg = this.svg
|
||||
const draw = this.draw
|
||||
// 保存原始信息
|
||||
const origWidth = svg.width()
|
||||
const origHeight = svg.height()
|
||||
const origTransform = draw.transform()
|
||||
const elRect = this.el.getBoundingClientRect()
|
||||
const elRect = this.elRect
|
||||
// 去除放大缩小的变换效果
|
||||
draw.scale(1 / origTransform.scaleX, 1 / origTransform.scaleY)
|
||||
// 获取变换后的位置尺寸信息,其实是getBoundingClientRect方法的包装方法
|
||||
@@ -364,10 +410,9 @@ class MindMap {
|
||||
draw.translate(-rect.x + elRect.left, -rect.y + elRect.top)
|
||||
// 克隆一份数据
|
||||
let clone = svg.clone()
|
||||
// 添加必要的样式
|
||||
clone.add(SVG(`<style>${cssContent}</style>`))
|
||||
// 如果实际图形宽高超出了屏幕宽高,且存在水印的话需要重新绘制水印,否则会出现超出部分没有水印的问题
|
||||
if (
|
||||
!ignoreWatermark &&
|
||||
(rect.width > origWidth || rect.height > origHeight) &&
|
||||
this.watermark &&
|
||||
this.watermark.hasWatermark()
|
||||
@@ -380,6 +425,16 @@ class MindMap {
|
||||
this.height = origHeight
|
||||
this.watermark.draw()
|
||||
}
|
||||
// 添加必要的样式
|
||||
clone.add(SVG(`<style>${cssContent}</style>`))
|
||||
// 修正关联线箭头marker的id
|
||||
const markerList = svg.find('marker')
|
||||
if (markerList && markerList.length > 0) {
|
||||
const id = markerList[0].attr('id')
|
||||
clone.find('marker').forEach(item => {
|
||||
item.attr('id', id)
|
||||
})
|
||||
}
|
||||
// 恢复原先的大小和变换信息
|
||||
svg.size(origWidth, origHeight)
|
||||
draw.transform(origTransform)
|
||||
|
||||
646
simple-mind-map/package-lock.json
generated
646
simple-mind-map/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "simple-mind-map",
|
||||
"version": "0.7.1-fix.2",
|
||||
"version": "0.8.0-fix.1",
|
||||
"description": "一个简单的web在线思维导图",
|
||||
"authors": [
|
||||
{
|
||||
@@ -13,6 +13,7 @@
|
||||
}
|
||||
],
|
||||
"types": "./types/index.d.ts",
|
||||
"typings": "./types/index.d.ts",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,7 +22,8 @@
|
||||
"scripts": {
|
||||
"lint": "eslint src/",
|
||||
"format": "prettier --write .",
|
||||
"types": "npx -p typescript tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types --target es2017"
|
||||
"types": "npx -p typescript tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types --target es2017 --skipLibCheck",
|
||||
"wsServe": "node ./bin/wsServer.mjs"
|
||||
},
|
||||
"module": "index.js",
|
||||
"main": "./dist/simpleMindMap.umd.min.js",
|
||||
@@ -31,11 +33,14 @@
|
||||
"eventemitter3": "^4.0.7",
|
||||
"jspdf": "^2.5.1",
|
||||
"jszip": "^3.10.1",
|
||||
"katex": "^0.16.8",
|
||||
"mdast-util-from-markdown": "^1.3.0",
|
||||
"quill": "^1.3.6",
|
||||
"tern": "^0.24.3",
|
||||
"uuid": "^9.0.0",
|
||||
"xml-js": "^1.6.11"
|
||||
"xml-js": "^1.6.11",
|
||||
"y-webrtc": "^10.2.5",
|
||||
"yjs": "^13.6.8"
|
||||
},
|
||||
"keywords": [
|
||||
"javascript",
|
||||
|
||||
@@ -1,27 +1,3 @@
|
||||
// 标签颜色列表
|
||||
export const tagColorList = [
|
||||
{
|
||||
color: 'rgb(77, 65, 0)',
|
||||
background: 'rgb(255, 244, 179)'
|
||||
},
|
||||
{
|
||||
color: 'rgb(0, 50, 77)',
|
||||
background: 'rgb(179, 229, 255)'
|
||||
},
|
||||
{
|
||||
color: 'rgb(77, 0, 73)',
|
||||
background: 'rgb(255, 179, 251)'
|
||||
},
|
||||
{
|
||||
color: 'rgb(57, 77, 0)',
|
||||
background: 'rgb(236, 255, 179)'
|
||||
},
|
||||
{
|
||||
color: 'rgb(0, 77, 47)',
|
||||
background: 'rgb(179, 255, 226)'
|
||||
}
|
||||
]
|
||||
|
||||
// 主题列表
|
||||
export const themeList = [
|
||||
{
|
||||
@@ -365,7 +341,7 @@ export const cssContent = `
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
.smm-node:hover .smm-hover-node{
|
||||
.smm-node:not(.smm-node-dragging):hover .smm-hover-node{
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,8 +173,8 @@ export const defaultOpt = {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
`,
|
||||
// 开启鼠标双击复位思维导图位置及缩放
|
||||
enableDblclickReset: false,
|
||||
// 是否在鼠标双击时回到根节点,也就是让根节点居中显示
|
||||
enableDblclickBackToRootNode: false,
|
||||
// 导出图片时canvas的缩放倍数,该配置会和window.devicePixelRatio值取最大值
|
||||
minExportImgCanvasScale: 2,
|
||||
// 节点鼠标hover和激活时显示的矩形边框的颜色
|
||||
@@ -188,5 +188,36 @@ export const defaultOpt = {
|
||||
// 拖拽节点时鼠标移动到画布边缘是否开启画布自动移动
|
||||
autoMoveWhenMouseInEdgeOnDrag: true,
|
||||
// 是否首次加载fit view
|
||||
fit: false
|
||||
fit: false,
|
||||
// 拖拽多个节点时随鼠标移动的示意矩形的样式配置
|
||||
dragMultiNodeRectConfig: {
|
||||
width: 40,
|
||||
height: 20,
|
||||
fill: '' // 填充颜色,如果不传默认使用连线的颜色
|
||||
},
|
||||
// 节点拖拽时新位置的示意矩形的填充颜色,如果不传默认使用连线的颜色
|
||||
dragPlaceholderRectFill: '',
|
||||
// 节点拖拽时的透明度配置
|
||||
dragOpacityConfig: {
|
||||
cloneNodeOpacity: 0.5, // 跟随鼠标移动的克隆节点或矩形的透明度
|
||||
beingDragNodeOpacity: 0.3 // 被拖拽节点的透明度
|
||||
},
|
||||
// 自定义标签的颜色
|
||||
// {pass: 'green, unpass: 'red'}
|
||||
tagsColorMap: {},
|
||||
// 节点协作样式配置
|
||||
cooperateStyle: {
|
||||
avatarSize: 22,// 头像大小
|
||||
fontSize: 12,// 如果是文字头像,那么文字的大小
|
||||
},
|
||||
// 关联线是否始终显示在节点上层
|
||||
// false:即创建关联线和激活关联线时处于最顶层,其他情况下处于节点下方
|
||||
associativeLineIsAlwaysAboveNode: true,
|
||||
// 插入概要的默认文本
|
||||
defaultGeneralizationText: '概要',
|
||||
// 粘贴文本的方式创建新节点时,控制是否按换行自动分割节点,即如果存在换行,那么会根据换行创建多个节点,否则只会创建一个节点
|
||||
// 可以传递一个函数,返回promise,resolve代表根据换行分割,reject代表忽略换行
|
||||
handleIsSplitByWrapOnPasteCreateNewNode: null,
|
||||
// 多少时间内只允许添加一次历史记录,避免添加没有必要的中间状态,单位:ms
|
||||
addHistoryTime: 100
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { copyRenderTree, simpleDeepClone, nextTick } from '../../utils'
|
||||
import { copyRenderTree, simpleDeepClone, throttle } from '../../utils'
|
||||
|
||||
// 命令类
|
||||
class Command {
|
||||
@@ -11,7 +11,11 @@ class Command {
|
||||
this.activeHistoryIndex = 0
|
||||
// 注册快捷键
|
||||
this.registerShortcutKeys()
|
||||
this.addHistory = nextTick(this.addHistory, this)
|
||||
this.addHistory = throttle(
|
||||
this.addHistory,
|
||||
this.mindMap.opt.addHistoryTime,
|
||||
this
|
||||
)
|
||||
}
|
||||
|
||||
// 清空历史数据
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,10 @@
|
||||
import { getStrWithBrFromHtml, checkNodeOuter } from '../../utils'
|
||||
import {
|
||||
getStrWithBrFromHtml,
|
||||
checkNodeOuter,
|
||||
focusInput,
|
||||
selectAllInput,
|
||||
htmlEscape
|
||||
} from '../../utils'
|
||||
import { ERROR_TYPES } from '../../constants/constant'
|
||||
|
||||
// 节点文字编辑类
|
||||
@@ -167,9 +173,11 @@ export default class TextEdit {
|
||||
let scale = this.mindMap.view.scale
|
||||
let lineHeight = node.style.merge('lineHeight')
|
||||
let fontSize = node.style.merge('fontSize')
|
||||
let textLines = (this.cacheEditingText || node.nodeData.data.text).split(
|
||||
/\n/gim
|
||||
)
|
||||
let textLines = (this.cacheEditingText || node.getData('text'))
|
||||
.split(/\n/gim)
|
||||
.map(item => {
|
||||
return htmlEscape(item)
|
||||
})
|
||||
let isMultiLine = node._textData.node.attr('data-ismultiLine') === 'true'
|
||||
node.style.domText(this.textEditNode, scale, isMultiLine)
|
||||
this.textEditNode.style.zIndex = nodeTextEditZIndex
|
||||
@@ -188,35 +196,16 @@ export default class TextEdit {
|
||||
this.showTextEdit = true
|
||||
// 选中文本
|
||||
// if (!this.cacheEditingText) {
|
||||
// this.selectNodeText()
|
||||
// selectAllInput(this.textEditNode)
|
||||
// }
|
||||
if (isInserting || (selectTextOnEnterEditText && !isFromKeyDown)) {
|
||||
this.selectNodeText()
|
||||
selectAllInput(this.textEditNode)
|
||||
} else {
|
||||
this.focus()
|
||||
focusInput(this.textEditNode)
|
||||
}
|
||||
this.cacheEditingText = ''
|
||||
}
|
||||
|
||||
// 聚焦
|
||||
focus() {
|
||||
let selection = window.getSelection()
|
||||
let range = document.createRange()
|
||||
range.selectNodeContents(this.textEditNode)
|
||||
range.collapse()
|
||||
selection.removeAllRanges()
|
||||
selection.addRange(range)
|
||||
}
|
||||
|
||||
// 选中文本
|
||||
selectNodeText() {
|
||||
let selection = window.getSelection()
|
||||
let range = document.createRange()
|
||||
range.selectNodeContents(this.textEditNode)
|
||||
selection.removeAllRanges()
|
||||
selection.addRange(range)
|
||||
}
|
||||
|
||||
// 获取当前正在编辑的内容
|
||||
getEditText() {
|
||||
return getStrWithBrFromHtml(this.textEditNode.innerHTML)
|
||||
|
||||
@@ -6,6 +6,7 @@ import nodeExpandBtnMethods from './nodeExpandBtn'
|
||||
import nodeCommandWrapsMethods from './nodeCommandWraps'
|
||||
import nodeCreateContentsMethods from './nodeCreateContents'
|
||||
import nodeExpandBtnPlaceholderRectMethods from './nodeExpandBtnPlaceholderRect'
|
||||
import nodeCooperateMethods from './nodeCooperate'
|
||||
import { CONSTANTS } from '../../../constants/constant'
|
||||
|
||||
// 节点类
|
||||
@@ -14,14 +15,16 @@ class Node {
|
||||
constructor(opt = {}) {
|
||||
// 节点数据
|
||||
this.nodeData = this.handleData(opt.data || {})
|
||||
// id
|
||||
// uid
|
||||
this.uid = opt.uid
|
||||
// 控制实例
|
||||
this.mindMap = opt.mindMap
|
||||
// 渲染实例
|
||||
this.renderer = opt.renderer
|
||||
// 渲染器
|
||||
this.draw = opt.draw || null
|
||||
this.draw = this.mindMap.draw
|
||||
this.nodeDraw = this.mindMap.nodeDraw
|
||||
this.lineDraw = this.mindMap.lineDraw
|
||||
// 样式实例
|
||||
this.style = new Style(this)
|
||||
// 形状实例
|
||||
@@ -55,6 +58,8 @@ class Node {
|
||||
this.parent = opt.parent || null
|
||||
// 子节点
|
||||
this.children = opt.children || []
|
||||
// 当前同时操作该节点的用户列表
|
||||
this.userList = []
|
||||
// 节点内容的容器
|
||||
this.group = null
|
||||
this.shapeNode = null // 节点形状节点
|
||||
@@ -74,6 +79,7 @@ class Node {
|
||||
this._openExpandNode = null
|
||||
this._closeExpandNode = null
|
||||
this._fillExpandNode = null
|
||||
this._userListGroup = null
|
||||
this._lines = []
|
||||
this._generalizationLine = null
|
||||
this._generalizationNode = null
|
||||
@@ -121,6 +127,12 @@ class Node {
|
||||
Object.keys(nodeCreateContentsMethods).forEach(item => {
|
||||
this[item] = nodeCreateContentsMethods[item].bind(this)
|
||||
})
|
||||
// 协同相关
|
||||
if (this.mindMap.cooperate) {
|
||||
Object.keys(nodeCooperateMethods).forEach(item => {
|
||||
this[item] = nodeCooperateMethods[item].bind(this)
|
||||
})
|
||||
}
|
||||
// 初始化
|
||||
this.getSize()
|
||||
}
|
||||
@@ -283,6 +295,8 @@ class Node {
|
||||
this.group.add(this.shapeNode)
|
||||
// 渲染一个隐藏的矩形区域,用来触发展开收起按钮的显示
|
||||
this.renderExpandBtnPlaceholderRect()
|
||||
// 创建协同头像节点
|
||||
if (this.createUserListNode) this.createUserListNode()
|
||||
// 概要节点添加一个带所属节点id的类名
|
||||
if (this.isGeneralization && this.generalizationBelongNode) {
|
||||
this.group.addClass('generalization_' + this.generalizationBelongNode.uid)
|
||||
@@ -416,17 +430,16 @@ class Node {
|
||||
// 多选和取消多选
|
||||
if (e.ctrlKey && enableCtrlKeyNodeSelection) {
|
||||
this.isMultipleChoice = true
|
||||
let isActive = this.nodeData.data.isActive
|
||||
let isActive = this.getData('isActive')
|
||||
if (!isActive)
|
||||
this.mindMap.emit(
|
||||
'before_node_active',
|
||||
this,
|
||||
this.renderer.activeNodeList
|
||||
)
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this, !isActive)
|
||||
this.mindMap.renderer[isActive ? 'removeActiveNode' : 'addActiveNode'](
|
||||
this
|
||||
)
|
||||
this.mindMap.renderer[
|
||||
isActive ? 'removeNodeFromActiveList' : 'addNodeToActiveList'
|
||||
](this)
|
||||
this.mindMap.emit('node_active', isActive ? null : this, [
|
||||
...this.mindMap.renderer.activeNodeList
|
||||
])
|
||||
@@ -440,12 +453,14 @@ class Node {
|
||||
this.mindMap.emit('node_mouseup', this, e)
|
||||
})
|
||||
this.group.on('mouseenter', e => {
|
||||
if (this.isDrag) return
|
||||
this._isMouseenter = true
|
||||
// 显示展开收起按钮
|
||||
this.showExpandBtn()
|
||||
this.mindMap.emit('node_mouseenter', this, e)
|
||||
})
|
||||
this.group.on('mouseleave', e => {
|
||||
if (!this._isMouseenter) return
|
||||
this._isMouseenter = false
|
||||
this.hideExpandBtn()
|
||||
this.mindMap.emit('node_mouseleave', this, e)
|
||||
@@ -475,10 +490,13 @@ class Node {
|
||||
) {
|
||||
return
|
||||
}
|
||||
if (this.nodeData.data.isActive) {
|
||||
this.renderer.clearActive()
|
||||
// 如果有且只有当前节点激活了,那么不需要重新激活
|
||||
if (
|
||||
!(this.getData('isActive') && this.renderer.activeNodeList.length === 1)
|
||||
) {
|
||||
this.renderer.clearActiveNodeList()
|
||||
this.active(e)
|
||||
}
|
||||
this.active(e)
|
||||
this.mindMap.emit('node_contextmenu', e, this)
|
||||
})
|
||||
}
|
||||
@@ -489,13 +507,12 @@ class Node {
|
||||
return
|
||||
}
|
||||
e && e.stopPropagation()
|
||||
if (this.nodeData.data.isActive) {
|
||||
if (this.getData('isActive')) {
|
||||
return
|
||||
}
|
||||
this.mindMap.emit('before_node_active', this, this.renderer.activeNodeList)
|
||||
this.renderer.clearActive()
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this, true)
|
||||
this.renderer.addActiveNode(this)
|
||||
this.renderer.clearActiveNodeList()
|
||||
this.renderer.addNodeToActiveList(this)
|
||||
this.mindMap.emit('node_active', this, [...this.renderer.activeNodeList])
|
||||
}
|
||||
|
||||
@@ -504,7 +521,7 @@ class Node {
|
||||
if (!this.group) {
|
||||
return
|
||||
}
|
||||
this.updateNodeActive()
|
||||
this.updateNodeActiveClass()
|
||||
let { alwaysShowExpandBtn } = this.mindMap.opt
|
||||
if (alwaysShowExpandBtn) {
|
||||
// 需要移除展开收缩按钮
|
||||
@@ -515,7 +532,7 @@ class Node {
|
||||
this.renderExpandBtn()
|
||||
}
|
||||
} else {
|
||||
let { isActive, expand } = this.nodeData.data
|
||||
let { isActive, expand } = this.getData()
|
||||
// 展开状态且非激活状态,且当前鼠标不在它上面,才隐藏
|
||||
if (expand && !isActive && !this._isMouseenter) {
|
||||
this.hideExpandBtn()
|
||||
@@ -525,6 +542,8 @@ class Node {
|
||||
}
|
||||
// 更新概要
|
||||
this.renderGeneralization()
|
||||
// 更新协同头像
|
||||
if (this.updateUserListNode) this.updateUserListNode()
|
||||
// 更新节点位置
|
||||
let t = this.group.transform()
|
||||
// // 如果上次不在可视区内,且本次也不在,那么直接返回
|
||||
@@ -578,12 +597,25 @@ class Node {
|
||||
}
|
||||
|
||||
// 更新节点激活状态
|
||||
updateNodeActive() {
|
||||
updateNodeActiveClass() {
|
||||
if (!this.group) return
|
||||
const isActive = this.nodeData.data.isActive
|
||||
const isActive = this.getData('isActive')
|
||||
this.group[isActive ? 'addClass' : 'removeClass']('active')
|
||||
}
|
||||
|
||||
// 根据是否激活更新节点
|
||||
updateNodeByActive(active) {
|
||||
if (this.group) {
|
||||
// 切换激活状态,需要切换展开收起按钮的显隐
|
||||
if (active) {
|
||||
this.showExpandBtn()
|
||||
} else {
|
||||
this.hideExpandBtn()
|
||||
}
|
||||
this.updateNodeActiveClass()
|
||||
}
|
||||
}
|
||||
|
||||
// 递归渲染
|
||||
render(callback = () => {}) {
|
||||
// 节点
|
||||
@@ -597,11 +629,11 @@ class Node {
|
||||
cursor: 'default'
|
||||
})
|
||||
this.bindGroupEvent()
|
||||
this.draw.add(this.group)
|
||||
this.nodeDraw.add(this.group)
|
||||
this.layout()
|
||||
this.update()
|
||||
} else {
|
||||
this.draw.add(this.group)
|
||||
this.nodeDraw.add(this.group)
|
||||
if (this.needLayout) {
|
||||
this.needLayout = false
|
||||
this.layout()
|
||||
@@ -613,7 +645,7 @@ class Node {
|
||||
if (
|
||||
this.children &&
|
||||
this.children.length &&
|
||||
this.nodeData.data.expand !== false
|
||||
this.getData('expand') !== false
|
||||
) {
|
||||
let index = 0
|
||||
this.children.forEach(item => {
|
||||
@@ -658,6 +690,9 @@ class Node {
|
||||
this.removeGeneralization()
|
||||
this.removeLine()
|
||||
this.group = null
|
||||
if (this.parent) {
|
||||
this.parent.removeLine()
|
||||
}
|
||||
}
|
||||
|
||||
// 隐藏节点
|
||||
@@ -701,9 +736,64 @@ class Node {
|
||||
}
|
||||
}
|
||||
|
||||
// 设置节点透明度
|
||||
// 包括连接线和下级节点
|
||||
setOpacity(val) {
|
||||
// 自身及连线
|
||||
this.group.opacity(val)
|
||||
this._lines.forEach(line => {
|
||||
line.opacity(val)
|
||||
})
|
||||
// 子节点
|
||||
this.children.forEach(item => {
|
||||
item.setOpacity(val)
|
||||
})
|
||||
// 概要节点
|
||||
if (this._generalizationNode) {
|
||||
this._generalizationLine.opacity(val)
|
||||
this._generalizationNode.group.opacity(val)
|
||||
}
|
||||
}
|
||||
|
||||
// 隐藏子节点
|
||||
hideChildren() {
|
||||
this._lines.forEach(item => {
|
||||
item.hide()
|
||||
})
|
||||
if (this.children && this.children.length) {
|
||||
this.children.forEach(item => {
|
||||
item.hide()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 显示子节点
|
||||
showChildren() {
|
||||
this._lines.forEach(item => {
|
||||
item.show()
|
||||
})
|
||||
if (this.children && this.children.length) {
|
||||
this.children.forEach(item => {
|
||||
item.show()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 被拖拽中
|
||||
startDrag() {
|
||||
this.isDrag = true
|
||||
this.group.addClass('smm-node-dragging')
|
||||
}
|
||||
|
||||
// 拖拽结束
|
||||
endDrag() {
|
||||
this.isDrag = false
|
||||
this.group.removeClass('smm-node-dragging')
|
||||
}
|
||||
|
||||
// 连线
|
||||
renderLine(deep = false) {
|
||||
if (this.nodeData.data.expand === false) {
|
||||
if (this.getData('expand') === false) {
|
||||
return
|
||||
}
|
||||
let childrenLen = this.nodeData.children.length
|
||||
@@ -717,7 +807,7 @@ class Node {
|
||||
if (childrenLen > this._lines.length) {
|
||||
// 创建缺少的线
|
||||
new Array(childrenLen - this._lines.length).fill(0).forEach(() => {
|
||||
this._lines.push(this.draw.path())
|
||||
this._lines.push(this.lineDraw.path())
|
||||
})
|
||||
} else if (childrenLen < this._lines.length) {
|
||||
// 删除多余的线
|
||||
@@ -825,7 +915,7 @@ class Node {
|
||||
|
||||
// 获取padding值
|
||||
getPaddingVale() {
|
||||
let { isActive } = this.nodeData.data
|
||||
let { isActive } = this.getData()
|
||||
return {
|
||||
paddingX: this.getStyle('paddingX', true, isActive),
|
||||
paddingY: this.getStyle('paddingY', true, isActive)
|
||||
@@ -868,7 +958,7 @@ class Node {
|
||||
|
||||
// 获取数据
|
||||
getData(key) {
|
||||
return key ? this.nodeData.data[key] || '' : this.nodeData.data
|
||||
return key ? this.nodeData.data[key] : this.nodeData.data
|
||||
}
|
||||
|
||||
// 是否存在自定义样式
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { tagColorList } from '../../../constants/constant'
|
||||
import { checkIsNodeStyleDataKey } from '../../../utils/index'
|
||||
import {
|
||||
checkIsNodeStyleDataKey,
|
||||
generateColorByContent
|
||||
} from '../../../utils/index'
|
||||
|
||||
const rootProp = ['paddingX', 'paddingY']
|
||||
const backgroundStyleProps = [
|
||||
@@ -86,7 +88,7 @@ class Style {
|
||||
|
||||
// 获取自身自定义样式
|
||||
getSelfStyle(prop) {
|
||||
return this.ctx.nodeData.data[prop]
|
||||
return this.ctx.getData(prop)
|
||||
}
|
||||
|
||||
// 矩形
|
||||
@@ -105,7 +107,7 @@ class Style {
|
||||
// !this.ctx.isRoot &&
|
||||
// !this.ctx.isGeneralization &&
|
||||
// this.ctx.mindMap.themeConfig.nodeUseLineStyle &&
|
||||
// !this.ctx.nodeData.data.isActive
|
||||
// !this.ctx.getData('isActive')
|
||||
// ) {
|
||||
// return
|
||||
// }
|
||||
@@ -163,10 +165,10 @@ class Style {
|
||||
}
|
||||
|
||||
// 标签文字
|
||||
tagText(node, index) {
|
||||
tagText(node) {
|
||||
node
|
||||
.fill({
|
||||
color: tagColorList[index].color
|
||||
color: '#fff'
|
||||
})
|
||||
.css({
|
||||
'font-size': '12px'
|
||||
@@ -174,9 +176,9 @@ class Style {
|
||||
}
|
||||
|
||||
// 标签矩形
|
||||
tagRect(node, index) {
|
||||
tagRect(node, text, color) {
|
||||
node.fill({
|
||||
color: tagColorList[index].background
|
||||
color: color || generateColorByContent(text.node.textContent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -223,7 +225,7 @@ class Style {
|
||||
// 是否设置了自定义的样式
|
||||
hasCustomStyle() {
|
||||
let res = false
|
||||
Object.keys(this.ctx.nodeData.data).forEach(item => {
|
||||
Object.keys(this.ctx.getData()).forEach(item => {
|
||||
if (checkIsNodeStyleDataKey(item)) {
|
||||
res = true
|
||||
}
|
||||
|
||||
104
simple-mind-map/src/core/render/node/nodeCooperate.js
Normal file
104
simple-mind-map/src/core/render/node/nodeCooperate.js
Normal file
@@ -0,0 +1,104 @@
|
||||
import { Circle, G, Text, Image } from '@svgdotjs/svg.js'
|
||||
import { generateColorByContent } from '../../../utils/index'
|
||||
|
||||
// 协同相关功能
|
||||
|
||||
// 创建容器
|
||||
function createUserListNode() {
|
||||
// 如果没有注册协作插件,那么需要创建
|
||||
if (!this.mindMap.cooperate) return
|
||||
this._userListGroup = new G()
|
||||
this.group.add(this._userListGroup)
|
||||
}
|
||||
|
||||
// 创建文本头像
|
||||
function createTextAvatar(item) {
|
||||
const { avatarSize, fontSize } = this.mindMap.opt.cooperateStyle
|
||||
const g = new G()
|
||||
const str = item.isMore ? item.name : String(item.name)[0]
|
||||
// 圆
|
||||
const circle = new Circle().size(avatarSize, avatarSize)
|
||||
circle.fill({
|
||||
color: item.color || generateColorByContent(str)
|
||||
})
|
||||
// 文本
|
||||
const text = new Text()
|
||||
.text(str)
|
||||
.fill({
|
||||
color: '#fff'
|
||||
})
|
||||
.css({
|
||||
'font-size': fontSize
|
||||
})
|
||||
.dx(-fontSize / 2)
|
||||
.dy((avatarSize - fontSize) / 2)
|
||||
g.add(circle).add(text)
|
||||
return g
|
||||
}
|
||||
|
||||
// 创建图片头像
|
||||
function createImageAvatar(item) {
|
||||
const { avatarSize } = this.mindMap.opt.cooperateStyle
|
||||
return new Image().load(item.avatar).size(avatarSize, avatarSize)
|
||||
}
|
||||
|
||||
// 更新渲染
|
||||
function updateUserListNode() {
|
||||
if (!this._userListGroup) return
|
||||
const { avatarSize } = this.mindMap.opt.cooperateStyle
|
||||
this._userListGroup.clear()
|
||||
// 根据当前节点长度计算最多能显示几个
|
||||
const length = this.userList.length
|
||||
const maxShowCount = Math.floor(this.width / avatarSize)
|
||||
const list = []
|
||||
if (length > maxShowCount) {
|
||||
// 如果当前用户数量比最多能显示的多,最后需要显示一个提示信息
|
||||
list.push(...this.userList.slice(0, maxShowCount - 1), {
|
||||
isMore: true,
|
||||
name: '+' + (length - maxShowCount + 1)
|
||||
})
|
||||
} else {
|
||||
list.push(...this.userList)
|
||||
}
|
||||
list.forEach((item, index) => {
|
||||
let node = null
|
||||
if (item.avatar) {
|
||||
node = this.createImageAvatar(item)
|
||||
} else {
|
||||
node = this.createTextAvatar(item)
|
||||
}
|
||||
node.x(index * avatarSize).cy(-avatarSize / 2)
|
||||
this._userListGroup.add(node)
|
||||
})
|
||||
}
|
||||
|
||||
// 添加用户
|
||||
function addUser(userInfo) {
|
||||
if (
|
||||
this.userList.find(item => {
|
||||
return item.id == userInfo.id
|
||||
})
|
||||
)
|
||||
return
|
||||
this.userList.push(userInfo)
|
||||
this.updateUserListNode()
|
||||
}
|
||||
|
||||
// 移除用户
|
||||
function removeUser(userInfo) {
|
||||
const index = this.userList.findIndex(item => {
|
||||
return item.id == userInfo.id
|
||||
})
|
||||
if (index === -1) return
|
||||
this.userList.splice(index, 1)
|
||||
this.updateUserListNode()
|
||||
}
|
||||
|
||||
export default {
|
||||
createUserListNode,
|
||||
updateUserListNode,
|
||||
createTextAvatar,
|
||||
createImageAvatar,
|
||||
addUser,
|
||||
removeUser
|
||||
}
|
||||
@@ -3,7 +3,8 @@ import {
|
||||
resizeImgSize,
|
||||
removeHtmlStyle,
|
||||
addHtmlStyle,
|
||||
checkIsRichText
|
||||
checkIsRichText,
|
||||
isUndef
|
||||
} from '../../../utils'
|
||||
import { Image, SVG, A, G, Rect, Text, ForeignObject } from '@svgdotjs/svg.js'
|
||||
import iconsSvg from '../../../svg/icons'
|
||||
@@ -11,14 +12,14 @@ import { CONSTANTS, commonCaches } from '../../../constants/constant'
|
||||
|
||||
// 创建图片节点
|
||||
function createImgNode() {
|
||||
let img = this.nodeData.data.image
|
||||
let img = this.getData('image')
|
||||
if (!img) {
|
||||
return
|
||||
}
|
||||
let imgSize = this.getImgShowSize()
|
||||
let node = new Image().load(img).size(...imgSize)
|
||||
if (this.nodeData.data.imageTitle) {
|
||||
node.attr('title', this.nodeData.data.imageTitle)
|
||||
if (this.getData('imageTitle')) {
|
||||
node.attr('title', this.getData('imageTitle'))
|
||||
}
|
||||
node.on('dblclick', e => {
|
||||
this.mindMap.emit('node_img_dblclick', this, e)
|
||||
@@ -41,7 +42,7 @@ function createImgNode() {
|
||||
|
||||
// 获取图片显示宽高
|
||||
function getImgShowSize() {
|
||||
const { custom, width, height } = this.nodeData.data.imageSize
|
||||
const { custom, width, height } = this.getData('imageSize')
|
||||
// 如果是自定义了图片的宽高,那么不受最大宽高限制
|
||||
if (custom) return [width, height]
|
||||
return resizeImgSize(
|
||||
@@ -54,7 +55,7 @@ function getImgShowSize() {
|
||||
|
||||
// 创建icon节点
|
||||
function createIconNode() {
|
||||
let _data = this.nodeData.data
|
||||
let _data = this.getData()
|
||||
if (!_data.icon || _data.icon.length <= 0) {
|
||||
return []
|
||||
}
|
||||
@@ -90,7 +91,7 @@ function createRichTextNode() {
|
||||
let g = new G()
|
||||
// 重新设置富文本节点内容
|
||||
let recoverText = false
|
||||
if (this.nodeData.data.resetRichText) {
|
||||
if (this.getData('resetRichText')) {
|
||||
delete this.nodeData.data.resetRichText
|
||||
recoverText = true
|
||||
}
|
||||
@@ -101,7 +102,7 @@ function createRichTextNode() {
|
||||
}
|
||||
}
|
||||
if (recoverText) {
|
||||
let text = this.nodeData.data.text
|
||||
let text = this.getData('text')
|
||||
// 判断节点内容是否是富文本
|
||||
let isRichText = checkIsRichText(text)
|
||||
// 样式字符串
|
||||
@@ -115,9 +116,11 @@ function createRichTextNode() {
|
||||
// 非富文本
|
||||
text = `<p><span style="${style}">${text}</span></p>`
|
||||
}
|
||||
this.nodeData.data.text = text
|
||||
this.setData({
|
||||
text: text
|
||||
})
|
||||
}
|
||||
let html = `<div>${this.nodeData.data.text}</div>`
|
||||
let html = `<div>${this.getData('text')}</div>`
|
||||
if (!commonCaches.measureRichtextNodeTextSizeEl) {
|
||||
commonCaches.measureRichtextNodeTextSizeEl = document.createElement('div')
|
||||
commonCaches.measureRichtextNodeTextSizeEl.style.position = 'fixed'
|
||||
@@ -156,7 +159,7 @@ function createRichTextNode() {
|
||||
|
||||
// 创建文本节点
|
||||
function createTextNode() {
|
||||
if (this.nodeData.data.richText) {
|
||||
if (this.getData('richText')) {
|
||||
return this.createRichTextNode()
|
||||
}
|
||||
let g = new G()
|
||||
@@ -164,7 +167,10 @@ function createTextNode() {
|
||||
let lineHeight = this.getStyle('lineHeight', false)
|
||||
// 文本超长自动换行
|
||||
let textStyle = this.style.getTextFontStyle()
|
||||
let textArr = this.nodeData.data.text.split(/\n/gim)
|
||||
let textArr = []
|
||||
if (!isUndef(this.getData('text'))) {
|
||||
textArr = String(this.getData('text')).split(/\n/gim)
|
||||
}
|
||||
let maxWidth = this.mindMap.opt.textAutoWrapWidth
|
||||
let isMultiLine = false
|
||||
textArr.forEach((item, index) => {
|
||||
@@ -211,7 +217,7 @@ function createTextNode() {
|
||||
|
||||
// 创建超链接节点
|
||||
function createHyperlinkNode() {
|
||||
let { hyperlink, hyperlinkTitle } = this.nodeData.data
|
||||
let { hyperlink, hyperlinkTitle } = this.getData()
|
||||
if (!hyperlink) {
|
||||
return
|
||||
}
|
||||
@@ -241,7 +247,7 @@ function createHyperlinkNode() {
|
||||
|
||||
// 创建标签节点
|
||||
function createTagNode() {
|
||||
let tagData = this.nodeData.data.tag
|
||||
let tagData = this.getData('tag')
|
||||
if (!tagData || tagData.length <= 0) {
|
||||
return []
|
||||
}
|
||||
@@ -249,12 +255,15 @@ function createTagNode() {
|
||||
tagData.slice(0, this.mindMap.opt.maxTag).forEach((item, index) => {
|
||||
let tag = new G()
|
||||
// 标签文本
|
||||
let text = new Text().text(item).x(8).cy(10)
|
||||
let text = new Text().text(item).x(8).cy(8)
|
||||
this.style.tagText(text, index)
|
||||
let { width } = text.bbox()
|
||||
// 标签矩形
|
||||
let rect = new Rect().size(width + 16, 20)
|
||||
this.style.tagRect(rect, index)
|
||||
// 先从自定义的颜色中获取颜色,没有的话就按照内容生成
|
||||
const tagsColorList = this.mindMap.opt.tagsColorMap || {}
|
||||
const color = tagsColorList[text.node.textContent]
|
||||
this.style.tagRect(rect, text, color)
|
||||
tag.add(rect).add(text)
|
||||
nodes.push({
|
||||
node: tag,
|
||||
@@ -267,7 +276,7 @@ function createTagNode() {
|
||||
|
||||
// 创建备注节点
|
||||
function createNoteNode() {
|
||||
if (!this.nodeData.data.note) {
|
||||
if (!this.getData('note')) {
|
||||
return null
|
||||
}
|
||||
let iconSize = this.mindMap.themeConfig.iconSize
|
||||
@@ -295,7 +304,7 @@ function createNoteNode() {
|
||||
this.mindMap.opt.customInnerElsAppendTo || document.body
|
||||
targetNode.appendChild(this.noteEl)
|
||||
}
|
||||
this.noteEl.innerText = this.nodeData.data.note
|
||||
this.noteEl.innerText = this.getData('note')
|
||||
}
|
||||
node.on('mouseover', () => {
|
||||
let { left, top } = node.node.getBoundingClientRect()
|
||||
@@ -305,7 +314,7 @@ function createNoteNode() {
|
||||
this.noteEl.style.display = 'block'
|
||||
} else {
|
||||
this.mindMap.opt.customNoteContentShow.show(
|
||||
this.nodeData.data.note,
|
||||
this.getData('note'),
|
||||
left,
|
||||
top + iconSize
|
||||
)
|
||||
|
||||
@@ -52,7 +52,7 @@ function sumNode(data = []) {
|
||||
}
|
||||
// 创建或更新展开收缩按钮内容
|
||||
function updateExpandBtnNode() {
|
||||
let { expand } = this.nodeData.data
|
||||
let { expand } = this.getData()
|
||||
// 如果本次和上次的展开状态一样则返回
|
||||
if (expand === this._lastExpandBtnType) return
|
||||
if (this._expandBtn) {
|
||||
@@ -129,13 +129,14 @@ function renderExpandBtn() {
|
||||
this.mindMap.execCommand(
|
||||
'SET_NODE_EXPAND',
|
||||
this,
|
||||
!this.nodeData.data.expand
|
||||
!this.getData('expand')
|
||||
)
|
||||
this.mindMap.emit('expand_btn_click', this)
|
||||
})
|
||||
this._expandBtn.on('dblclick', e => {
|
||||
e.stopPropagation()
|
||||
})
|
||||
this._expandBtn.addClass('smm-expand-btn')
|
||||
this.group.add(this._expandBtn)
|
||||
}
|
||||
this._showExpandBtn = true
|
||||
@@ -163,7 +164,7 @@ function showExpandBtn() {
|
||||
function hideExpandBtn() {
|
||||
if (this.mindMap.opt.alwaysShowExpandBtn || this._isMouseenter) return
|
||||
// 非激活状态且展开状态鼠标移出才隐藏按钮
|
||||
let { isActive, expand } = this.nodeData.data
|
||||
let { isActive, expand } = this.getData()
|
||||
if (!isActive && expand) {
|
||||
setTimeout(() => {
|
||||
this.removeExpandBtn()
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createUid } from '../../../utils/index'
|
||||
|
||||
// 检查是否存在概要
|
||||
function checkHasGeneralization() {
|
||||
return !!this.nodeData.data.generalization
|
||||
return !!this.getData('generalization')
|
||||
}
|
||||
|
||||
// 创建概要节点
|
||||
@@ -12,24 +12,23 @@ function createGeneralizationNode() {
|
||||
return
|
||||
}
|
||||
if (!this._generalizationLine) {
|
||||
this._generalizationLine = this.draw.path()
|
||||
this._generalizationLine = this.lineDraw.path()
|
||||
}
|
||||
if (!this._generalizationNode) {
|
||||
this._generalizationNode = new Node({
|
||||
data: {
|
||||
data: this.nodeData.data.generalization
|
||||
data: this.getData('generalization')
|
||||
},
|
||||
uid: createUid(),
|
||||
renderer: this.renderer,
|
||||
mindMap: this.mindMap,
|
||||
draw: this.draw,
|
||||
isGeneralization: true
|
||||
})
|
||||
this._generalizationNodeWidth = this._generalizationNode.width
|
||||
this._generalizationNodeHeight = this._generalizationNode.height
|
||||
this._generalizationNode.generalizationBelongNode = this
|
||||
if (this.nodeData.data.generalization.isActive) {
|
||||
this.renderer.addActiveNode(this._generalizationNode)
|
||||
if (this.getData('generalization').isActive) {
|
||||
this.renderer.addNodeToActiveList(this._generalizationNode)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +49,7 @@ function renderGeneralization() {
|
||||
this._generalizationNodeHeight = 0
|
||||
return
|
||||
}
|
||||
if (this.nodeData.data.expand === false) {
|
||||
if (this.getData('expand') === false) {
|
||||
this.removeGeneralization()
|
||||
return
|
||||
}
|
||||
@@ -73,13 +72,13 @@ function removeGeneralization() {
|
||||
}
|
||||
if (this._generalizationNode) {
|
||||
// 删除概要节点时要同步从激活节点里删除
|
||||
this.renderer.removeActiveNode(this._generalizationNode)
|
||||
this.renderer.removeNodeFromActiveList(this._generalizationNode)
|
||||
this._generalizationNode.remove()
|
||||
this._generalizationNode = null
|
||||
}
|
||||
// hack修复当激活一个节点时创建概要,然后立即激活创建的概要节点后会重复创建概要节点并且无法删除的问题
|
||||
if (this.generalizationBelongNode) {
|
||||
this.draw
|
||||
this.nodeDraw
|
||||
.find('.generalization_' + this.generalizationBelongNode.uid)
|
||||
.remove()
|
||||
}
|
||||
|
||||
@@ -25,16 +25,9 @@ class View {
|
||||
this.mindMap.keyCommand.addShortcut('Control+-', () => {
|
||||
this.narrow()
|
||||
})
|
||||
this.mindMap.keyCommand.addShortcut('Control+Enter', () => {
|
||||
this.reset()
|
||||
})
|
||||
this.mindMap.keyCommand.addShortcut('Control+i', () => {
|
||||
this.fit()
|
||||
})
|
||||
this.mindMap.svg.on('dblclick', () => {
|
||||
if (!this.mindMap.opt.enableDblclickReset) return
|
||||
this.reset()
|
||||
})
|
||||
// 拖动视图
|
||||
this.mindMap.event.on('mousedown', () => {
|
||||
this.sx = this.x
|
||||
@@ -267,7 +260,7 @@ class View {
|
||||
let drawHeight = rect.height / origTransform.scaleY
|
||||
let drawRatio = drawWidth / drawHeight
|
||||
let { width: elWidth, height: elHeight } =
|
||||
this.mindMap.el.getBoundingClientRect()
|
||||
this.mindMap.elRect
|
||||
elWidth = elWidth - fitPadding * 2
|
||||
elHeight = elHeight - fitPadding * 2
|
||||
let elRatio = elWidth / elHeight
|
||||
|
||||
@@ -13,6 +13,7 @@ class Base {
|
||||
this.mindMap = renderer.mindMap
|
||||
// 绘图对象
|
||||
this.draw = this.mindMap.draw
|
||||
this.lineDraw = this.mindMap.lineDraw
|
||||
// 根节点
|
||||
this.root = null
|
||||
this.lru = new Lru(this.mindMap.opt.maxNodeCacheCount)
|
||||
@@ -90,7 +91,7 @@ class Base {
|
||||
// 数据上没有保存节点引用,但是通过uid找到了缓存的节点,也可以复用
|
||||
newNode = this.lru.get(data.data.uid)
|
||||
// 保存该节点上一次的数据
|
||||
let lastData = JSON.stringify(newNode.nodeData.data)
|
||||
let lastData = JSON.stringify(newNode.getData())
|
||||
let isLayerTypeChange = this.checkIsLayerTypeChange(
|
||||
newNode.layerIndex,
|
||||
layerIndex
|
||||
@@ -126,9 +127,15 @@ class Base {
|
||||
// 数据关联实际节点
|
||||
data._node = newNode
|
||||
if (data.data.isActive) {
|
||||
this.renderer.addActiveNode(newNode)
|
||||
this.renderer.addNodeToActiveList(newNode)
|
||||
}
|
||||
}
|
||||
// 如果当前节点在激活节点列表里,那么添加上激活的状态
|
||||
if (this.mindMap.renderer.findActiveNodeIndex(newNode) !== -1) {
|
||||
newNode.setData({
|
||||
isActive: true
|
||||
})
|
||||
}
|
||||
// 根节点
|
||||
if (isRoot) {
|
||||
newNode.isRoot = true
|
||||
@@ -293,12 +300,12 @@ class Base {
|
||||
let { left, right, top, bottom } = walk(child)
|
||||
// 概要内容的宽度
|
||||
let generalizationWidth =
|
||||
child.checkHasGeneralization() && child.nodeData.data.expand
|
||||
child.checkHasGeneralization() && child.getData('expand')
|
||||
? child._generalizationNodeWidth + generalizationNodeMargin
|
||||
: 0
|
||||
// 概要内容的高度
|
||||
let generalizationHeight =
|
||||
child.checkHasGeneralization() && child.nodeData.data.expand
|
||||
child.checkHasGeneralization() && child.getData('expand')
|
||||
? child._generalizationNodeHeight + generalizationNodeMargin
|
||||
: 0
|
||||
if (left - (dir === 'h' ? generalizationWidth : 0) < _left) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
|
||||
// 目录组织图
|
||||
class CatalogOrganization extends Base {
|
||||
@@ -73,7 +73,7 @@ class CatalogOrganization extends Base {
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (
|
||||
node.nodeData.data.expand &&
|
||||
node.getData('expand') &&
|
||||
node.children &&
|
||||
node.children.length
|
||||
) {
|
||||
@@ -114,7 +114,7 @@ class CatalogOrganization extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
// 调整left
|
||||
@@ -159,9 +159,7 @@ class CatalogOrganization extends Base {
|
||||
updateBrothersLeft(node, addWidth) {
|
||||
if (node.parent) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition() || _index <= index) {
|
||||
// 适配自定义位置
|
||||
@@ -182,9 +180,7 @@ class CatalogOrganization extends Base {
|
||||
updateBrothersTop(node, addHeight) {
|
||||
if (node.parent && !node.parent.isRoot) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
@@ -247,14 +243,14 @@ class CatalogOrganization extends Base {
|
||||
minx = Math.min(minx, x1)
|
||||
maxx = Math.max(maxx, x1)
|
||||
// 父节点的竖线
|
||||
let line1 = this.draw.path()
|
||||
let line1 = this.lineDraw.path()
|
||||
node.style.line(line1)
|
||||
line1.plot(`M ${x1},${y1} L ${x1},${y1 + s1}`)
|
||||
node._lines.push(line1)
|
||||
style && style(line1, node)
|
||||
// 水平线
|
||||
if (len > 0) {
|
||||
let lin2 = this.draw.path()
|
||||
let lin2 = this.lineDraw.path()
|
||||
node.style.line(lin2)
|
||||
lin2.plot(`M ${minx},${y1 + s1} L ${maxx},${y1 + s1}`)
|
||||
node._lines.push(lin2)
|
||||
@@ -315,7 +311,7 @@ class CatalogOrganization extends Base {
|
||||
})
|
||||
// 竖线
|
||||
if (len > 0) {
|
||||
let lin2 = this.draw.path()
|
||||
let lin2 = this.lineDraw.path()
|
||||
expandBtnSize = len > 0 ? expandBtnSize : 0
|
||||
node.style.line(lin2)
|
||||
if (maxy < y1 + expandBtnSize) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun, degToRad } from '../utils'
|
||||
import { walk, asyncRun, degToRad, getNodeIndexInNodeList } from '../utils'
|
||||
import { CONSTANTS } from '../constants/constant'
|
||||
import utils from './fishboneUtils'
|
||||
|
||||
@@ -112,7 +112,7 @@ class Fishbone extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
let params = { node, parent, layerIndex, ctx: this }
|
||||
@@ -193,9 +193,7 @@ class Fishbone extends Base {
|
||||
updateBrothersTop(node, addHeight) {
|
||||
if (node.parent && !node.parent.isRoot) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
@@ -252,7 +250,7 @@ class Fishbone extends Base {
|
||||
let nodeLineX = item.left
|
||||
let offset = node.height / 2 + marginY
|
||||
let offsetX = offset / Math.tan(degToRad(this.mindMap.opt.fishboneDeg))
|
||||
let line = this.draw.path()
|
||||
let line = this.lineDraw.path()
|
||||
if (this.checkIsTop(item)) {
|
||||
line.plot(
|
||||
`M ${nodeLineX - offsetX},${item.top + item.height + offset} L ${
|
||||
@@ -273,7 +271,7 @@ class Fishbone extends Base {
|
||||
// 从根节点出发的水平线
|
||||
let nodeHalfTop = node.top + node.height / 2
|
||||
let offset = node.height / 2 + this.getMarginY(node.layerIndex + 1)
|
||||
let line = this.draw.path()
|
||||
let line = this.lineDraw.path()
|
||||
line.plot(
|
||||
`M ${node.left + node.width},${nodeHalfTop} L ${
|
||||
maxx - offset / Math.tan(degToRad(this.mindMap.opt.fishboneDeg))
|
||||
@@ -308,7 +306,7 @@ class Fishbone extends Base {
|
||||
})
|
||||
// 斜线
|
||||
if (len >= 0) {
|
||||
let line = this.draw.path()
|
||||
let line = this.lineDraw.path()
|
||||
expandBtnSize = len > 0 ? expandBtnSize : 0
|
||||
let lineLength = maxx - node.left - node.width * this.indent
|
||||
lineLength = Math.max(lineLength, 0)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
import { CONSTANTS } from '../utils/constant'
|
||||
|
||||
const degToRad = deg => {
|
||||
@@ -127,7 +127,7 @@ class Fishbone extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
// 调整top
|
||||
@@ -237,9 +237,7 @@ class Fishbone extends Base {
|
||||
updateBrothersTop(node, addHeight) {
|
||||
if (node.parent && !node.parent.isRoot) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
@@ -307,7 +305,7 @@ class Fishbone extends Base {
|
||||
})
|
||||
// 竖线
|
||||
if (len > 0) {
|
||||
let line = this.draw.path()
|
||||
let line = this.lineDraw.path()
|
||||
expandBtnSize = len > 0 ? expandBtnSize : 0
|
||||
let lineLength = maxx - node.left - node.width * 0.3
|
||||
if (node.parent && node.parent.isRoot) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
import { CONSTANTS } from '../utils/constant'
|
||||
|
||||
const degToRad = deg => {
|
||||
@@ -110,7 +110,7 @@ class Fishbone extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
// 调整top
|
||||
@@ -206,9 +206,7 @@ class Fishbone extends Base {
|
||||
updateBrothersTop(node, addHeight) {
|
||||
if (node.parent && !node.parent.isRoot) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
@@ -276,7 +274,7 @@ class Fishbone extends Base {
|
||||
})
|
||||
// 竖线
|
||||
if (len > 0) {
|
||||
let line = this.draw.path()
|
||||
let line = this.lineDraw.path()
|
||||
expandBtnSize = len > 0 ? expandBtnSize : 0
|
||||
let lineLength = maxx - node.left - node.width * 0.3
|
||||
if (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
|
||||
// 逻辑结构图
|
||||
class LogicalStructure extends Base {
|
||||
@@ -78,7 +78,7 @@ class LogicalStructure extends Base {
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (
|
||||
node.nodeData.data.expand &&
|
||||
node.getData('expand') &&
|
||||
node.children &&
|
||||
node.children.length
|
||||
) {
|
||||
@@ -103,7 +103,7 @@ class LogicalStructure extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
// 判断子节点所占的高度之和是否大于该节点自身,大于则需要调整位置
|
||||
@@ -124,9 +124,7 @@ class LogicalStructure extends Base {
|
||||
updateBrothers(node, addHeight) {
|
||||
if (node.parent) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.uid === node.uid || item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
import { CONSTANTS } from '../constants/constant'
|
||||
|
||||
// 思维导图
|
||||
@@ -117,7 +117,7 @@ class MindMap extends Base {
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (
|
||||
node.nodeData.data.expand &&
|
||||
node.getData('expand') &&
|
||||
node.children &&
|
||||
node.children.length
|
||||
) {
|
||||
@@ -148,7 +148,7 @@ class MindMap extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
// 判断子节点所占的高度之和是否大于该节点自身,大于则需要调整位置
|
||||
@@ -171,9 +171,7 @@ class MindMap extends Base {
|
||||
let childrenList = node.parent.children.filter(item => {
|
||||
return item.dir === node.dir
|
||||
})
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
|
||||
// 组织结构图
|
||||
// 和逻辑结构图基本一样,只是方向变成向下生长,所以先计算节点的top,后计算节点的left、最后调整节点的left即可
|
||||
@@ -79,7 +79,7 @@ class OrganizationStructure extends Base {
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (
|
||||
node.nodeData.data.expand &&
|
||||
node.getData('expand') &&
|
||||
node.children &&
|
||||
node.children.length
|
||||
) {
|
||||
@@ -104,7 +104,7 @@ class OrganizationStructure extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
// 判断子节点所占的宽度之和是否大于该节点自身,大于则需要调整位置
|
||||
@@ -125,9 +125,7 @@ class OrganizationStructure extends Base {
|
||||
updateBrothers(node, addWidth) {
|
||||
if (node.parent) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
@@ -218,7 +216,7 @@ class OrganizationStructure extends Base {
|
||||
minx = Math.min(x1, minx)
|
||||
maxx = Math.max(x1, maxx)
|
||||
// 父节点的竖线
|
||||
let line1 = this.draw.path()
|
||||
let line1 = this.lineDraw.path()
|
||||
node.style.line(line1)
|
||||
expandBtnSize = len > 0 && !isRoot ? expandBtnSize : 0
|
||||
line1.plot(`M ${x1},${y1 + expandBtnSize} L ${x1},${y1 + s1}`)
|
||||
@@ -226,7 +224,7 @@ class OrganizationStructure extends Base {
|
||||
style && style(line1, node)
|
||||
// 水平线
|
||||
if (len > 0) {
|
||||
let lin2 = this.draw.path()
|
||||
let lin2 = this.lineDraw.path()
|
||||
node.style.line(lin2)
|
||||
lin2.plot(`M ${minx},${y1 + s1} L ${maxx},${y1 + s1}`)
|
||||
node._lines.push(lin2)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
import { CONSTANTS } from '../constants/constant'
|
||||
|
||||
// 时间轴
|
||||
@@ -81,7 +81,7 @@ class Timeline extends Base {
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex, index) => {
|
||||
if (
|
||||
node.nodeData.data.expand &&
|
||||
node.getData('expand') &&
|
||||
node.children &&
|
||||
node.children.length
|
||||
) {
|
||||
@@ -122,7 +122,7 @@ class Timeline extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
// 调整left
|
||||
@@ -208,9 +208,7 @@ class Timeline extends Base {
|
||||
updateBrothersTop(node, addHeight) {
|
||||
if (node.parent && !node.parent.isRoot) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
@@ -275,7 +273,7 @@ class Timeline extends Base {
|
||||
})
|
||||
// 竖线
|
||||
if (len > 0) {
|
||||
let line = this.draw.path()
|
||||
let line = this.lineDraw.path()
|
||||
expandBtnSize = len > 0 ? expandBtnSize : 0
|
||||
if (
|
||||
node.parent &&
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Base from './Base'
|
||||
import { walk, asyncRun } from '../utils'
|
||||
import { walk, asyncRun, getNodeIndexInNodeList } from '../utils'
|
||||
import { CONSTANTS } from '../constants/constant'
|
||||
|
||||
// 竖向时间轴
|
||||
@@ -98,7 +98,7 @@ class VerticalTimeline extends Base {
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex, index) => {
|
||||
if (
|
||||
node.nodeData.data.expand &&
|
||||
node.getData('expand') &&
|
||||
node.children &&
|
||||
node.children.length
|
||||
) {
|
||||
@@ -135,7 +135,7 @@ class VerticalTimeline extends Base {
|
||||
this.root,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
if (!node.nodeData.data.expand) {
|
||||
if (!node.getData('expand')) {
|
||||
return
|
||||
}
|
||||
if (isRoot) return
|
||||
@@ -155,9 +155,7 @@ class VerticalTimeline extends Base {
|
||||
updateBrothers(node, addHeight) {
|
||||
if (node.parent) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
// 自定义节点位置
|
||||
if (item.hasCustomPosition()) return
|
||||
@@ -201,9 +199,7 @@ class VerticalTimeline extends Base {
|
||||
updateBrothersTop(node, addHeight) {
|
||||
if (node.parent && !node.parent.isRoot) {
|
||||
let childrenList = node.parent.children
|
||||
let index = childrenList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, childrenList)
|
||||
childrenList.forEach((item, _index) => {
|
||||
if (item.hasCustomPosition()) {
|
||||
// 适配自定义位置
|
||||
|
||||
@@ -15,7 +15,7 @@ import associativeLineTextMethods from './associativeLine/associativeLineText'
|
||||
class AssociativeLine {
|
||||
constructor(opt = {}) {
|
||||
this.mindMap = opt.mindMap
|
||||
this.draw = this.mindMap.draw
|
||||
this.associativeLineDraw = this.mindMap.associativeLineDraw
|
||||
// 当前所有连接线
|
||||
this.lineList = []
|
||||
// 当前激活的连接线
|
||||
@@ -98,7 +98,7 @@ class AssociativeLine {
|
||||
|
||||
// 创建箭头
|
||||
createMarker() {
|
||||
return this.draw.marker(20, 20, add => {
|
||||
return this.associativeLineDraw.marker(20, 20, add => {
|
||||
add.ref(12, 5)
|
||||
add.size(10, 10)
|
||||
add.attr('orient', 'auto-start-reverse')
|
||||
@@ -142,15 +142,15 @@ class AssociativeLine {
|
||||
null,
|
||||
cur => {
|
||||
if (!cur) return
|
||||
let data = cur.nodeData.data
|
||||
let data = cur.getData()
|
||||
if (
|
||||
data.associativeLineTargets &&
|
||||
data.associativeLineTargets.length > 0
|
||||
) {
|
||||
nodeToIds.set(cur, data.associativeLineTargets)
|
||||
}
|
||||
if (data.id) {
|
||||
idToNode.set(data.id, cur)
|
||||
if (data.uid) {
|
||||
idToNode.set(data.uid, cur)
|
||||
}
|
||||
},
|
||||
() => {},
|
||||
@@ -158,10 +158,10 @@ class AssociativeLine {
|
||||
0
|
||||
)
|
||||
nodeToIds.forEach((ids, node) => {
|
||||
ids.forEach((id, index) => {
|
||||
let toNode = idToNode.get(id)
|
||||
ids.forEach((uid, index) => {
|
||||
let toNode = idToNode.get(uid)
|
||||
if (!node || !toNode) return
|
||||
const associativeLinePoint = (node.nodeData.data.associativeLinePoint ||
|
||||
const associativeLinePoint = (node.getData('associativeLinePoint') ||
|
||||
[])[index]
|
||||
// 切换结构和布局,都会更新坐标
|
||||
const [startPoint, endPoint] = this.updateAllLinesPos(
|
||||
@@ -194,7 +194,7 @@ class AssociativeLine {
|
||||
toNode
|
||||
)
|
||||
// 虚线
|
||||
let path = this.draw.path()
|
||||
let path = this.associativeLineDraw.path()
|
||||
path
|
||||
.stroke({
|
||||
width: associativeLineWidth,
|
||||
@@ -205,7 +205,7 @@ class AssociativeLine {
|
||||
path.plot(pathStr)
|
||||
path.marker('end', this.marker)
|
||||
// 不可见的点击线
|
||||
let clickPath = this.draw.path()
|
||||
let clickPath = this.associativeLineDraw.path()
|
||||
clickPath
|
||||
.stroke({ width: associativeLineActiveWidth, color: 'transparent' })
|
||||
.fill({ color: 'none' })
|
||||
@@ -234,6 +234,11 @@ class AssociativeLine {
|
||||
controlPoints
|
||||
})
|
||||
})
|
||||
// 双击进入关联线文本编辑状态
|
||||
clickPath.dblclick(() => {
|
||||
if (!this.activeLine) return
|
||||
this.showEditTextBox(text)
|
||||
})
|
||||
// 渲染关联线文字
|
||||
this.renderText(this.getText(node, toNode), path, text)
|
||||
this.lineList.push([path, clickPath, text, node, toNode])
|
||||
@@ -252,28 +257,26 @@ class AssociativeLine {
|
||||
}) {
|
||||
let { associativeLineActiveColor } = this.mindMap.themeConfig
|
||||
// 如果当前存在激活节点,那么取消激活节点
|
||||
if (this.mindMap.renderer.activeNodeList.length > 0) {
|
||||
this.clearActiveNodes()
|
||||
} else {
|
||||
// 否则清除当前的关联线的激活状态,如果有的话
|
||||
this.clearActiveLine()
|
||||
// 保存当前激活的关联线信息
|
||||
this.activeLine = [path, clickPath, text, node, toNode]
|
||||
// 让不可见的点击线显示
|
||||
clickPath.stroke({ color: associativeLineActiveColor })
|
||||
// 如果没有输入过关联线文字,那么显示默认文字
|
||||
if (!this.getText(node, toNode)) {
|
||||
this.renderText(this.mindMap.opt.defaultAssociativeLineText, path, text)
|
||||
}
|
||||
// 渲染控制点和连线
|
||||
this.renderControls(
|
||||
startPoint,
|
||||
endPoint,
|
||||
controlPoints[0],
|
||||
controlPoints[1]
|
||||
)
|
||||
this.mindMap.emit('associative_line_click', path, clickPath, node, toNode)
|
||||
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
||||
// 否则清除当前的关联线的激活状态,如果有的话
|
||||
this.clearActiveLine()
|
||||
// 保存当前激活的关联线信息
|
||||
this.activeLine = [path, clickPath, text, node, toNode]
|
||||
// 让不可见的点击线显示
|
||||
clickPath.stroke({ color: associativeLineActiveColor })
|
||||
// 如果没有输入过关联线文字,那么显示默认文字
|
||||
if (!this.getText(node, toNode)) {
|
||||
this.renderText(this.mindMap.opt.defaultAssociativeLineText, path, text)
|
||||
}
|
||||
// 渲染控制点和连线
|
||||
this.renderControls(
|
||||
startPoint,
|
||||
endPoint,
|
||||
controlPoints[0],
|
||||
controlPoints[1]
|
||||
)
|
||||
this.mindMap.emit('associative_line_click', path, clickPath, node, toNode)
|
||||
this.front()
|
||||
}
|
||||
|
||||
// 移除所有连接线
|
||||
@@ -298,9 +301,10 @@ class AssociativeLine {
|
||||
let { associativeLineWidth, associativeLineColor } =
|
||||
this.mindMap.themeConfig
|
||||
if (this.isCreatingLine || !fromNode) return
|
||||
this.front()
|
||||
this.isCreatingLine = true
|
||||
this.creatingStartNode = fromNode
|
||||
this.creatingLine = this.draw.path()
|
||||
this.creatingLine = this.associativeLineDraw.path()
|
||||
this.creatingLine
|
||||
.stroke({
|
||||
width: associativeLineWidth,
|
||||
@@ -355,12 +359,13 @@ class AssociativeLine {
|
||||
height
|
||||
}
|
||||
}
|
||||
|
||||
// 检测当前移动到的目标节点
|
||||
checkOverlapNode(x, y) {
|
||||
this.overlapNode = null
|
||||
bfsWalk(this.mindMap.renderer.root, node => {
|
||||
if (node.nodeData.data.isActive) {
|
||||
this.mindMap.renderer.setNodeActive(node, false)
|
||||
if (node.getData('isActive')) {
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', node, false)
|
||||
}
|
||||
if (node.uid === this.creatingStartNode.uid || this.overlapNode) {
|
||||
return
|
||||
@@ -372,8 +377,8 @@ class AssociativeLine {
|
||||
this.overlapNode = node
|
||||
}
|
||||
})
|
||||
if (this.overlapNode && !this.overlapNode.nodeData.data.isActive) {
|
||||
this.mindMap.renderer.setNodeActive(this.overlapNode, true)
|
||||
if (this.overlapNode && !this.overlapNode.getData('isActive')) {
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this.overlapNode, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,35 +386,36 @@ class AssociativeLine {
|
||||
completeCreateLine(node) {
|
||||
if (this.creatingStartNode.uid === node.uid) return
|
||||
this.addLine(this.creatingStartNode, node)
|
||||
if (this.overlapNode && this.overlapNode.nodeData.data.isActive) {
|
||||
this.mindMap.renderer.setNodeActive(this.overlapNode, false)
|
||||
if (this.overlapNode && this.overlapNode.getData('isActive')) {
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this.overlapNode, false)
|
||||
}
|
||||
this.isCreatingLine = false
|
||||
this.creatingStartNode = null
|
||||
this.creatingLine.remove()
|
||||
this.creatingLine = null
|
||||
this.overlapNode = null
|
||||
this.back()
|
||||
}
|
||||
|
||||
// 添加连接线
|
||||
addLine(fromNode, toNode) {
|
||||
if (!fromNode || !toNode) return
|
||||
// 目标节点如果没有id,则生成一个id
|
||||
let id = toNode.nodeData.data.id
|
||||
if (!id) {
|
||||
id = uuid()
|
||||
let uid = toNode.getData('uid')
|
||||
if (!uid) {
|
||||
uid = uuid()
|
||||
this.mindMap.execCommand('SET_NODE_DATA', toNode, {
|
||||
id
|
||||
uid
|
||||
})
|
||||
}
|
||||
// 将目标节点id保存起来
|
||||
let list = fromNode.nodeData.data.associativeLineTargets || []
|
||||
let list = fromNode.getData('associativeLineTargets') || []
|
||||
// 连线节点是否存在相同的id,存在则阻止添加关联线
|
||||
const sameLine = list.some(item => item === id)
|
||||
const sameLine = list.some(item => item === uid)
|
||||
if (sameLine) {
|
||||
return
|
||||
}
|
||||
list.push(id)
|
||||
list.push(uid)
|
||||
// 保存控制点
|
||||
let [startPoint, endPoint] = computeNodePoints(fromNode, toNode)
|
||||
let controlPoints = computeCubicBezierPathPoints(
|
||||
@@ -419,7 +425,7 @@ class AssociativeLine {
|
||||
endPoint.y
|
||||
)
|
||||
let offsetList =
|
||||
fromNode.nodeData.data.associativeLineTargetControlOffsets || []
|
||||
fromNode.getData('associativeLineTargetControlOffsets') || []
|
||||
// 保存的实际是控制点和端点的差值,否则当节点位置改变了,控制点还是原来的位置,连线就不对了
|
||||
offsetList[list.length - 1] = [
|
||||
{
|
||||
@@ -431,7 +437,7 @@ class AssociativeLine {
|
||||
y: controlPoints[1].y - endPoint.y
|
||||
}
|
||||
]
|
||||
let associativeLinePoint = fromNode.nodeData.data.associativeLinePoint || []
|
||||
let associativeLinePoint = fromNode.getData('associativeLinePoint') || []
|
||||
// 记录关联的起始|结束坐标
|
||||
associativeLinePoint[list.length - 1] = { startPoint, endPoint }
|
||||
this.mindMap.execCommand('SET_NODE_DATA', fromNode, {
|
||||
@@ -451,14 +457,14 @@ class AssociativeLine {
|
||||
associativeLinePoint,
|
||||
associativeLineTargetControlOffsets,
|
||||
associativeLineText
|
||||
} = node.nodeData.data
|
||||
} = node.getData()
|
||||
associativeLinePoint = associativeLinePoint || []
|
||||
let targetIndex = getAssociativeLineTargetIndex(node, toNode)
|
||||
// 更新关联线文本数据
|
||||
let newAssociativeLineText = {}
|
||||
if (associativeLineText) {
|
||||
Object.keys(associativeLineText).forEach(item => {
|
||||
if (item !== toNode.nodeData.data.id) {
|
||||
if (item !== toNode.getData('uid')) {
|
||||
newAssociativeLineText[item] = associativeLineText[item]
|
||||
}
|
||||
})
|
||||
@@ -483,13 +489,6 @@ class AssociativeLine {
|
||||
})
|
||||
}
|
||||
|
||||
// 清除当前激活的节点
|
||||
clearActiveNodes() {
|
||||
if (this.mindMap.renderer.activeNodeList.length > 0) {
|
||||
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
||||
}
|
||||
}
|
||||
|
||||
// 清除激活的线
|
||||
clearActiveLine() {
|
||||
if (this.activeLine) {
|
||||
@@ -505,6 +504,7 @@ class AssociativeLine {
|
||||
}
|
||||
this.activeLine = null
|
||||
this.removeControls()
|
||||
this.back()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,6 +531,19 @@ class AssociativeLine {
|
||||
this.showControls()
|
||||
this.isNodeDragging = false
|
||||
}
|
||||
|
||||
// 关联线顶层显示
|
||||
front() {
|
||||
if (this.mindMap.opt.associativeLineIsAlwaysAboveNode) return
|
||||
this.associativeLineDraw.front()
|
||||
}
|
||||
|
||||
// 关联线回到原有层级
|
||||
back() {
|
||||
if (this.mindMap.opt.associativeLineIsAlwaysAboveNode) return
|
||||
this.associativeLineDraw.back() // 最底层
|
||||
this.associativeLineDraw.forward() // 连线层上面
|
||||
}
|
||||
}
|
||||
|
||||
AssociativeLine.instanceName = 'associativeLine'
|
||||
|
||||
345
simple-mind-map/src/plugins/Cooperate.js
Normal file
345
simple-mind-map/src/plugins/Cooperate.js
Normal file
@@ -0,0 +1,345 @@
|
||||
import * as Y from 'yjs'
|
||||
import { WebrtcProvider } from 'y-webrtc'
|
||||
import { isSameObject, simpleDeepClone, getType, isUndef } from '../utils/index'
|
||||
|
||||
// 协同插件
|
||||
class Cooperate {
|
||||
constructor(opt) {
|
||||
this.opt = opt
|
||||
this.mindMap = opt.mindMap
|
||||
// yjs文档
|
||||
this.ydoc = new Y.Doc()
|
||||
// 共享数据
|
||||
this.ymap = null
|
||||
// 连接提供者
|
||||
this.provider = null
|
||||
// 感知数据
|
||||
this.awareness = null
|
||||
this.currentAwarenessData = []
|
||||
this.waitNodeUidMap = {} // 该列表中的uid对应的节点还未渲染完毕
|
||||
// 当前的平级对象类型的思维导图数据
|
||||
this.currentData = null
|
||||
// 用户信息
|
||||
this.userInfo = null
|
||||
// 绑定事件
|
||||
this.bindEvent()
|
||||
// 处理实例化时传入的思维导图数据
|
||||
if (this.mindMap.opt.data) {
|
||||
this.initData(this.mindMap.opt.data)
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
initData(data) {
|
||||
data = simpleDeepClone(data)
|
||||
// 解绑原来的数据
|
||||
if (this.ymap) {
|
||||
this.ymap.unobserve(this.onObserve)
|
||||
}
|
||||
// 创建共享数据
|
||||
this.ymap = this.ydoc.getMap()
|
||||
// 思维导图树结构转平级对象结构
|
||||
this.currentData = this.transformTreeDataToObject(data)
|
||||
// 将思维导图数据添加到共享数据中
|
||||
Object.keys(this.currentData).forEach(uid => {
|
||||
this.ymap.set(uid, this.currentData[uid])
|
||||
})
|
||||
// 监听数据同步
|
||||
this.onObserve = this.onObserve.bind(this)
|
||||
this.ymap.observe(this.onObserve)
|
||||
}
|
||||
|
||||
// 获取yjs doc实例
|
||||
getDoc() {
|
||||
return this.ydoc
|
||||
}
|
||||
|
||||
// 设置连接提供者
|
||||
setProvider(provider, webrtcProviderConfig = {}) {
|
||||
const { roomName, signalingList, ...otherConfig } = webrtcProviderConfig
|
||||
this.provider =
|
||||
provider ||
|
||||
new WebrtcProvider(roomName, this.ydoc, {
|
||||
signaling: signalingList,
|
||||
...otherConfig
|
||||
})
|
||||
this.awareness = this.provider.awareness
|
||||
|
||||
// 监听状态同步事件
|
||||
this.onAwareness = this.onAwareness.bind(this)
|
||||
this.awareness.on('change', this.onAwareness)
|
||||
}
|
||||
|
||||
// 绑定事件
|
||||
bindEvent() {
|
||||
// 监听思维导图改变
|
||||
this.onDataChange = this.onDataChange.bind(this)
|
||||
this.mindMap.on('data_change', this.onDataChange)
|
||||
|
||||
// 监听思维导图节点激活事件
|
||||
this.onNodeActive = this.onNodeActive.bind(this)
|
||||
this.mindMap.on('node_active', this.onNodeActive)
|
||||
|
||||
// 监听思维导图渲染完毕事件
|
||||
this.onNodeTreeRenderEnd = this.onNodeTreeRenderEnd.bind(this)
|
||||
this.mindMap.on('node_tree_render_end', this.onNodeTreeRenderEnd)
|
||||
|
||||
// 监听设置思维导图数据事件
|
||||
this.initData = this.initData.bind(this)
|
||||
this.mindMap.on('set_data', this.initData)
|
||||
}
|
||||
|
||||
// 解绑事件
|
||||
unBindEvent() {
|
||||
if (this.ymap) {
|
||||
this.ymap.unobserve(this.onObserve)
|
||||
}
|
||||
this.mindMap.off('data_change', this.onDataChange)
|
||||
this.mindMap.off('node_active', this.onNodeActive)
|
||||
this.mindMap.off('node_tree_render_end', this.onNodeTreeRenderEnd)
|
||||
this.mindMap.off('set_data', this.initData)
|
||||
this.ydoc.destroy()
|
||||
}
|
||||
|
||||
// 数据同步时的处理,更新当前思维导图
|
||||
onObserve(event) {
|
||||
const data = event.target.toJSON()
|
||||
// 如果数据没有改变直接返回
|
||||
if (isSameObject(data, this.currentData)) return
|
||||
this.currentData = data
|
||||
// 平级对象转树结构
|
||||
const res = this.transformObjectToTreeData(data)
|
||||
if (!res) return
|
||||
// 更新思维导图画布
|
||||
this.mindMap.renderer.setData(res)
|
||||
this.mindMap.render()
|
||||
this.mindMap.command.addHistory()
|
||||
}
|
||||
|
||||
// 当前思维导图改变后的处理,触发同步
|
||||
onDataChange(data) {
|
||||
const res = this.transformTreeDataToObject(data)
|
||||
this.updateChanges(res)
|
||||
}
|
||||
|
||||
// 找出更新点
|
||||
updateChanges(data) {
|
||||
const oldData = this.currentData
|
||||
this.currentData = data
|
||||
this.ydoc.transact(() => {
|
||||
// 找出新增的或修改的
|
||||
Object.keys(data).forEach(uid => {
|
||||
// 新增的或已经存在的,如果数据发生了改变
|
||||
if (!oldData[uid] || !isSameObject(oldData[uid], data[uid])) {
|
||||
this.ymap.set(uid, data[uid])
|
||||
}
|
||||
})
|
||||
// 找出删除的
|
||||
Object.keys(oldData).forEach(uid => {
|
||||
if (!data[uid]) {
|
||||
this.ymap.delete(uid)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 节点激活状态改变后触发感知数据同步
|
||||
onNodeActive(node, nodeList) {
|
||||
if (this.userInfo) {
|
||||
this.awareness.setLocalStateField(this.userInfo.name, {
|
||||
// 用户信息
|
||||
userInfo: {
|
||||
...this.userInfo
|
||||
},
|
||||
// 当前激活的节点id列表
|
||||
nodeIdList: nodeList.map(item => {
|
||||
return item.uid
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 节点树渲染完毕事件
|
||||
onNodeTreeRenderEnd() {
|
||||
Object.keys(this.waitNodeUidMap).forEach(uid => {
|
||||
const node = this.mindMap.renderer.findNodeByUid(uid)
|
||||
if (node) {
|
||||
node.addUser(this.waitNodeUidMap[uid])
|
||||
}
|
||||
})
|
||||
this.waitNodeUidMap = {}
|
||||
}
|
||||
|
||||
// 设置用户信息
|
||||
/**
|
||||
* {
|
||||
* id: '', // 必传,用户唯一的id
|
||||
* name: '', // 用户名称。name和avatar两个只传一个即可,如果都传了,会显示avatar
|
||||
* avatar: '', // 用户头像
|
||||
* color: '' // 如果没有传头像,那么会以一个圆形来显示名称的第一个字,文字的颜色为白色,圆的颜色可以通过该字段设置
|
||||
* }
|
||||
**/
|
||||
setUserInfo(userInfo) {
|
||||
if (
|
||||
getType(userInfo) !== 'Object' ||
|
||||
isUndef(userInfo.id) ||
|
||||
(isUndef(userInfo.name) && isUndef(userInfo.avatar))
|
||||
)
|
||||
return
|
||||
this.userInfo = userInfo || null
|
||||
}
|
||||
|
||||
// 监听感知数据同步事件
|
||||
onAwareness() {
|
||||
const walk = (list, callback) => {
|
||||
list.forEach(value => {
|
||||
const userName = Object.keys(value)[0]
|
||||
if (!userName) return
|
||||
const data = value[userName]
|
||||
const userInfo = data.userInfo
|
||||
const nodeIdList = data.nodeIdList
|
||||
nodeIdList.forEach(uid => {
|
||||
const node = this.mindMap.renderer.findNodeByUid(uid)
|
||||
callback(uid, node, userInfo)
|
||||
})
|
||||
})
|
||||
}
|
||||
// 清除之前的数据
|
||||
walk(this.currentAwarenessData, (uid, node, userInfo) => {
|
||||
if (node) {
|
||||
node.removeUser(userInfo)
|
||||
}
|
||||
})
|
||||
// 设置当前数据
|
||||
const data = Array.from(this.awareness.getStates().values())
|
||||
this.currentAwarenessData = data
|
||||
walk(data, (uid, node, userInfo) => {
|
||||
// 不显示自己
|
||||
if (userInfo.id === this.userInfo.id) return
|
||||
if (node) {
|
||||
node.addUser(userInfo)
|
||||
} else {
|
||||
this.waitNodeUidMap[uid] = userInfo
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 将树结构转平级对象
|
||||
/*
|
||||
{
|
||||
data: {
|
||||
uid: 'xxx'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
data: {
|
||||
uid: 'xxx'
|
||||
},
|
||||
children: []
|
||||
}
|
||||
]
|
||||
}
|
||||
转为:
|
||||
{
|
||||
uid: {
|
||||
children: [uid1, uid2],
|
||||
data: {}
|
||||
}
|
||||
}
|
||||
*/
|
||||
transformTreeDataToObject(data) {
|
||||
const res = {}
|
||||
const walk = (root, parent) => {
|
||||
const uid = root.data.uid
|
||||
if (parent) {
|
||||
parent.children.push(uid)
|
||||
}
|
||||
res[uid] = {
|
||||
isRoot: !parent,
|
||||
data: {
|
||||
...root.data
|
||||
},
|
||||
children: []
|
||||
}
|
||||
if (root.children && root.children.length > 0) {
|
||||
root.children.forEach(item => {
|
||||
walk(item, res[uid])
|
||||
})
|
||||
}
|
||||
}
|
||||
walk(data, null)
|
||||
return res
|
||||
}
|
||||
|
||||
// 找到父节点的uid
|
||||
findParentUid(data, targetUid) {
|
||||
const uids = Object.keys(data)
|
||||
let res = ''
|
||||
uids.forEach(uid => {
|
||||
const children = data[uid].children
|
||||
const isParent =
|
||||
children.findIndex(childUid => {
|
||||
return childUid === targetUid
|
||||
}) !== -1
|
||||
if (isParent) {
|
||||
res = uid
|
||||
}
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
// 将平级对象转树结构
|
||||
transformObjectToTreeData(data) {
|
||||
const uids = Object.keys(data)
|
||||
if (uids.length <= 0) return null
|
||||
const rootKey = uids.find(uid => {
|
||||
return data[uid].isRoot
|
||||
})
|
||||
if (!rootKey || !data[rootKey]) return null
|
||||
// 根节点
|
||||
const res = {
|
||||
data: simpleDeepClone(data[rootKey].data),
|
||||
children: []
|
||||
}
|
||||
const map = {}
|
||||
map[rootKey] = res
|
||||
uids.forEach(uid => {
|
||||
const parentUid = this.findParentUid(data, uid)
|
||||
const cur = data[uid]
|
||||
const node = map[uid] || {
|
||||
data: simpleDeepClone(cur.data),
|
||||
children: []
|
||||
}
|
||||
if (!map[uid]) {
|
||||
map[uid] = node
|
||||
}
|
||||
if (parentUid) {
|
||||
const index = data[parentUid].children.findIndex(item => {
|
||||
return item === uid
|
||||
})
|
||||
if (!map[parentUid]) {
|
||||
map[parentUid] = {
|
||||
data: simpleDeepClone(data[parentUid].data),
|
||||
children: []
|
||||
}
|
||||
}
|
||||
map[parentUid].children[index] = node
|
||||
}
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
// 插件被移除前做的事情
|
||||
beforePluginRemove() {
|
||||
this.unBindEvent()
|
||||
}
|
||||
|
||||
// 插件被卸载前做的事情
|
||||
beforePluginDestroy() {
|
||||
this.unBindEvent()
|
||||
}
|
||||
}
|
||||
|
||||
Cooperate.instanceName = 'cooperate'
|
||||
|
||||
export default Cooperate
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bfsWalk, throttle } from '../utils'
|
||||
import { bfsWalk, throttle, getTopAncestorsFomNodeList, getNodeIndexInNodeList } from '../utils'
|
||||
import Base from '../layouts/Base'
|
||||
|
||||
// 节点拖动插件
|
||||
@@ -13,10 +13,14 @@ class Drag extends Base {
|
||||
|
||||
// 复位
|
||||
reset() {
|
||||
// 是否正在跳转中
|
||||
this.isDragging = false
|
||||
// 鼠标按下的节点
|
||||
this.mousedownNode = null
|
||||
// 被拖拽中的节点列表
|
||||
this.beingDragNodeList = []
|
||||
// 当前画布节点列表
|
||||
this.nodeList = []
|
||||
// 当前拖拽节点
|
||||
this.node = null
|
||||
// 当前重叠节点
|
||||
this.overlapNode = null
|
||||
// 当前上一个同级节点
|
||||
@@ -27,16 +31,11 @@ class Drag extends Base {
|
||||
this.drawTransform = null
|
||||
// 克隆节点
|
||||
this.clone = null
|
||||
// 连接线
|
||||
this.line = null
|
||||
// 同级位置占位符
|
||||
this.placeholder = null
|
||||
// 鼠标按下位置和节点左上角的偏移量
|
||||
this.offsetX = 0
|
||||
this.offsetY = 0
|
||||
// 克隆节点左上角的坐标
|
||||
this.cloneNodeLeft = 0
|
||||
this.cloneNodeTop = 0
|
||||
// 当前鼠标是否按下
|
||||
this.isMousedown = false
|
||||
// 拖拽的鼠标位置变量
|
||||
@@ -53,45 +52,42 @@ class Drag extends Base {
|
||||
bindEvent() {
|
||||
this.checkOverlapNode = throttle(this.checkOverlapNode, 300, this)
|
||||
this.mindMap.on('node_mousedown', (node, e) => {
|
||||
if (this.mindMap.opt.readonly || node.isGeneralization) {
|
||||
return
|
||||
}
|
||||
if (e.which !== 1 || node.isRoot) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
// 计算鼠标按下的位置距离节点左上角的距离
|
||||
this.drawTransform = this.mindMap.draw.transform()
|
||||
let { scaleX, scaleY, translateX, translateY } = this.drawTransform
|
||||
let { x, y } = this.mindMap.toPos(e.clientX, e.clientY)
|
||||
this.offsetX = x - (node.left * scaleX + translateX)
|
||||
this.offsetY = y - (node.top * scaleY + translateY)
|
||||
this.node = node
|
||||
this.isMousedown = true
|
||||
this.mouseDownX = x
|
||||
this.mouseDownY = y
|
||||
this.nodeTreeToList()
|
||||
})
|
||||
this.mindMap.on('mousemove', e => {
|
||||
if (this.mindMap.opt.readonly) {
|
||||
return
|
||||
}
|
||||
if (!this.isMousedown) {
|
||||
return
|
||||
}
|
||||
this.mindMap.emit('node_dragging', this.node)
|
||||
e.preventDefault()
|
||||
let { x, y } = this.mindMap.toPos(e.clientX, e.clientY)
|
||||
this.mouseMoveX = x
|
||||
this.mouseMoveY = y
|
||||
// 只读模式、不是鼠标左键按下、按下的是概要节点或根节点直接返回
|
||||
if (
|
||||
Math.abs(x - this.mouseDownX) <= this.checkDragOffset &&
|
||||
Math.abs(y - this.mouseDownY) <= this.checkDragOffset &&
|
||||
!this.node.isDrag
|
||||
this.mindMap.opt.readonly ||
|
||||
e.which !== 1 ||
|
||||
node.isGeneralization ||
|
||||
node.isRoot
|
||||
) {
|
||||
return
|
||||
}
|
||||
this.mindMap.renderer.clearAllActive()
|
||||
e.preventDefault()
|
||||
this.isMousedown = true
|
||||
// 记录鼠标按下时的节点
|
||||
this.mousedownNode = node
|
||||
// 记录鼠标按下的坐标
|
||||
const { x, y } = this.mindMap.toPos(e.clientX, e.clientY)
|
||||
this.mouseDownX = x
|
||||
this.mouseDownY = y
|
||||
})
|
||||
this.mindMap.on('mousemove', e => {
|
||||
if (this.mindMap.opt.readonly || !this.isMousedown) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
const { x, y } = this.mindMap.toPos(e.clientX, e.clientY)
|
||||
this.mouseMoveX = x
|
||||
this.mouseMoveY = y
|
||||
// 还没开始移动时鼠标位移过小不认为是拖拽
|
||||
if (
|
||||
!this.isDragging &&
|
||||
Math.abs(x - this.mouseDownX) <= this.checkDragOffset &&
|
||||
Math.abs(y - this.mouseDownY) <= this.checkDragOffset
|
||||
) {
|
||||
return
|
||||
}
|
||||
this.mindMap.emit('node_dragging')
|
||||
this.handleStartMove()
|
||||
this.onMove(x, y, e)
|
||||
})
|
||||
this.onMouseup = this.onMouseup.bind(this)
|
||||
@@ -105,29 +101,48 @@ class Drag extends Base {
|
||||
return
|
||||
}
|
||||
this.isMousedown = false
|
||||
let _nodeIsDrag = this.node.isDrag
|
||||
this.node.isDrag = false
|
||||
this.node.show()
|
||||
// 恢复被拖拽节点的临时设置
|
||||
this.beingDragNodeList.forEach(node => {
|
||||
node.setOpacity(1)
|
||||
node.showChildren()
|
||||
node.endDrag()
|
||||
})
|
||||
this.removeCloneNode()
|
||||
let overlapNodeUid = this.overlapNode
|
||||
? this.overlapNode.nodeData.data.uid
|
||||
? this.overlapNode.getData('uid')
|
||||
: ''
|
||||
let prevNodeUid = this.prevNode ? this.prevNode.nodeData.data.uid : ''
|
||||
let nextNodeUid = this.nextNode ? this.nextNode.nodeData.data.uid : ''
|
||||
let prevNodeUid = this.prevNode ? this.prevNode.getData('uid') : ''
|
||||
let nextNodeUid = this.nextNode ? this.nextNode.getData('uid') : ''
|
||||
// 存在重叠子节点,则移动作为其子节点
|
||||
if (this.overlapNode) {
|
||||
this.mindMap.renderer.setNodeActive(this.overlapNode, false)
|
||||
this.mindMap.execCommand('MOVE_NODE_TO', this.node, this.overlapNode)
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this.overlapNode, false)
|
||||
this.mindMap.execCommand(
|
||||
'MOVE_NODE_TO',
|
||||
this.beingDragNodeList,
|
||||
this.overlapNode
|
||||
)
|
||||
} else if (this.prevNode) {
|
||||
// 存在前一个相邻节点,作为其下一个兄弟节点
|
||||
this.mindMap.renderer.setNodeActive(this.prevNode, false)
|
||||
this.mindMap.execCommand('INSERT_AFTER', this.node, this.prevNode)
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this.prevNode, false)
|
||||
this.mindMap.execCommand(
|
||||
'INSERT_AFTER',
|
||||
this.beingDragNodeList,
|
||||
this.prevNode
|
||||
)
|
||||
} else if (this.nextNode) {
|
||||
// 存在下一个相邻节点,作为其前一个兄弟节点
|
||||
this.mindMap.renderer.setNodeActive(this.nextNode, false)
|
||||
this.mindMap.execCommand('INSERT_BEFORE', this.node, this.nextNode)
|
||||
} else if (_nodeIsDrag && this.mindMap.opt.enableFreeDrag) {
|
||||
// 自定义位置
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this.nextNode, false)
|
||||
this.mindMap.execCommand(
|
||||
'INSERT_BEFORE',
|
||||
this.beingDragNodeList,
|
||||
this.nextNode
|
||||
)
|
||||
} else if (
|
||||
this.clone &&
|
||||
this.mindMap.opt.enableFreeDrag &&
|
||||
this.beingDragNodeList.length === 1
|
||||
) {
|
||||
// 如果只拖拽了一个节点,那么设置自定义位置
|
||||
let { x, y } = this.mindMap.toPos(
|
||||
e.clientX - this.offsetX,
|
||||
e.clientY - this.offsetY
|
||||
@@ -135,11 +150,16 @@ class Drag extends Base {
|
||||
let { scaleX, scaleY, translateX, translateY } = this.drawTransform
|
||||
x = (x - translateX) / scaleX
|
||||
y = (y - translateY) / scaleY
|
||||
this.node.left = x
|
||||
this.node.top = y
|
||||
this.node.customLeft = x
|
||||
this.node.customTop = y
|
||||
this.mindMap.execCommand('SET_NODE_CUSTOM_POSITION', this.node, x, y)
|
||||
this.mousedownNode.left = x
|
||||
this.mousedownNode.top = y
|
||||
this.mousedownNode.customLeft = x
|
||||
this.mousedownNode.customTop = y
|
||||
this.mindMap.execCommand(
|
||||
'SET_NODE_CUSTOM_POSITION',
|
||||
this.mousedownNode,
|
||||
x,
|
||||
y
|
||||
)
|
||||
this.mindMap.render()
|
||||
}
|
||||
this.reset()
|
||||
@@ -150,24 +170,131 @@ class Drag extends Base {
|
||||
})
|
||||
}
|
||||
|
||||
// 拖动中
|
||||
onMove(x, y, e) {
|
||||
if (!this.isMousedown) {
|
||||
return
|
||||
}
|
||||
// 更新克隆节点的位置
|
||||
let { scaleX, scaleY, translateX, translateY } = this.drawTransform
|
||||
let cloneNodeLeft = x - this.offsetX
|
||||
let cloneNodeTop = y - this.offsetY
|
||||
x = (cloneNodeLeft - translateX) / scaleX
|
||||
y = (cloneNodeTop - translateY) / scaleY
|
||||
let t = this.clone.transform()
|
||||
this.clone.translate(x - t.translateX, y - t.translateY)
|
||||
// 检测新位置
|
||||
this.checkOverlapNode()
|
||||
// 如果注册了多选节点插件,那么复用它的边缘自动移动画布功能
|
||||
if (this.mindMap.opt.autoMoveWhenMouseInEdgeOnDrag && this.mindMap.select) {
|
||||
this.drawTransform = this.mindMap.draw.transform()
|
||||
this.mindMap.select.clearAutoMoveTimer()
|
||||
this.mindMap.select.onMove(e.clientX, e.clientY)
|
||||
}
|
||||
}
|
||||
|
||||
// 开始拖拽时初始化一些数据
|
||||
handleStartMove() {
|
||||
if (!this.isDragging) {
|
||||
this.isDragging = true
|
||||
// 鼠标按下的节点
|
||||
let node = this.mousedownNode
|
||||
// 计算鼠标按下的位置距离节点左上角的距离
|
||||
this.drawTransform = this.mindMap.draw.transform()
|
||||
let { scaleX, scaleY, translateX, translateY } = this.drawTransform
|
||||
this.offsetX = this.mouseDownX - (node.left * scaleX + translateX)
|
||||
this.offsetY = this.mouseDownY - (node.top * scaleY + translateY)
|
||||
// 如果鼠标按下的节点是激活节点,那么保存当前所有激活的节点
|
||||
if (node.getData('isActive')) {
|
||||
// 找出这些激活节点中的最顶层节点
|
||||
this.beingDragNodeList = getTopAncestorsFomNodeList(
|
||||
// 过滤掉根节点和概要节点
|
||||
this.mindMap.renderer.activeNodeList.filter(item => {
|
||||
return !item.isRoot && !item.isGeneralization
|
||||
})
|
||||
)
|
||||
} else {
|
||||
// 否则只拖拽按下的节点
|
||||
this.beingDragNodeList = [node]
|
||||
}
|
||||
// 将节点树转为节点数组
|
||||
this.nodeTreeToList()
|
||||
// 创建克隆节点
|
||||
this.createCloneNode()
|
||||
// 清除当前所有激活的节点
|
||||
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
||||
}
|
||||
}
|
||||
|
||||
// 节点由树转换成数组,从子节点到根节点
|
||||
nodeTreeToList() {
|
||||
const list = []
|
||||
bfsWalk(this.mindMap.renderer.root, node => {
|
||||
// 过滤掉当前被拖拽的节点
|
||||
if (this.checkIsInBeingDragNodeList(node)) {
|
||||
return
|
||||
}
|
||||
if (!list[node.layerIndex]) {
|
||||
list[node.layerIndex] = []
|
||||
}
|
||||
list[node.layerIndex].push(node)
|
||||
})
|
||||
this.nodeList = list.reduceRight((res, cur) => {
|
||||
return [...res, ...cur]
|
||||
}, [])
|
||||
}
|
||||
|
||||
// 创建克隆节点
|
||||
createCloneNode() {
|
||||
if (!this.clone) {
|
||||
// 节点
|
||||
this.clone = this.node.group.clone()
|
||||
this.clone.opacity(0.5)
|
||||
const {
|
||||
dragMultiNodeRectConfig,
|
||||
dragPlaceholderRectFill,
|
||||
dragOpacityConfig
|
||||
} = this.mindMap.opt
|
||||
const {
|
||||
width: rectWidth,
|
||||
height: rectHeight,
|
||||
fill: rectFill
|
||||
} = dragMultiNodeRectConfig
|
||||
const node = this.beingDragNodeList[0]
|
||||
const lineColor = node.style.merge('lineColor', true)
|
||||
// 如果当前被拖拽的节点数量大于1,那么创建一个矩形示意
|
||||
if (this.beingDragNodeList.length > 1) {
|
||||
this.clone = this.mindMap.otherDraw
|
||||
.rect()
|
||||
.size(rectWidth, rectHeight)
|
||||
.radius(rectHeight / 2)
|
||||
.fill({
|
||||
color: rectFill || lineColor
|
||||
})
|
||||
this.offsetX = rectWidth / 2
|
||||
this.offsetY = rectHeight / 2
|
||||
} else {
|
||||
// 否则克隆当前的节点
|
||||
this.clone = node.group.clone()
|
||||
// 删除展开收起按钮元素
|
||||
const expandEl = this.clone.findOne('.smm-expand-btn')
|
||||
if (expandEl) {
|
||||
expandEl.remove()
|
||||
}
|
||||
this.mindMap.otherDraw.add(this.clone)
|
||||
}
|
||||
this.clone.opacity(dragOpacityConfig.cloneNodeOpacity)
|
||||
this.clone.css('z-index', 99999)
|
||||
this.node.isDrag = true
|
||||
this.node.hide()
|
||||
// 连接线
|
||||
this.line = this.draw.path()
|
||||
this.line.opacity(0.5)
|
||||
this.node.styleLine(this.line, this.node)
|
||||
// 同级位置占位符
|
||||
this.placeholder = this.draw.rect().fill({
|
||||
color: this.node.style.merge('lineColor', true)
|
||||
// 同级位置提示元素
|
||||
this.placeholder = this.mindMap.otherDraw.rect().fill({
|
||||
color: dragPlaceholderRectFill || lineColor
|
||||
})
|
||||
// 当前被拖拽的节点的临时设置
|
||||
this.beingDragNodeList.forEach(node => {
|
||||
// 降低透明度
|
||||
node.setOpacity(dragOpacityConfig.beingDragNodeOpacity)
|
||||
// 隐藏连线及下级节点
|
||||
node.hideChildren()
|
||||
// 设置拖拽状态
|
||||
node.startDrag()
|
||||
})
|
||||
this.mindMap.draw.add(this.clone)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,42 +304,9 @@ class Drag extends Base {
|
||||
return
|
||||
}
|
||||
this.clone.remove()
|
||||
this.line.remove()
|
||||
this.placeholder.remove()
|
||||
}
|
||||
|
||||
// 拖动中
|
||||
onMove(x, y, e) {
|
||||
if (!this.isMousedown) {
|
||||
return
|
||||
}
|
||||
this.createCloneNode()
|
||||
let { scaleX, scaleY, translateX, translateY } = this.drawTransform
|
||||
this.cloneNodeLeft = x - this.offsetX
|
||||
this.cloneNodeTop = y - this.offsetY
|
||||
x = (this.cloneNodeLeft - translateX) / scaleX
|
||||
y = (this.cloneNodeTop - translateY) / scaleY
|
||||
let t = this.clone.transform()
|
||||
this.clone.translate(x - t.translateX, y - t.translateY)
|
||||
// 连接线
|
||||
let parent = this.node.parent
|
||||
this.line.plot(
|
||||
this.quadraticCurvePath(
|
||||
parent.left + parent.width / 2,
|
||||
parent.top + parent.height / 2,
|
||||
x + this.node.width / 2,
|
||||
y + this.node.height / 2
|
||||
)
|
||||
)
|
||||
this.checkOverlapNode()
|
||||
// 如果注册了多选节点插件,那么复用它的边缘自动移动画布功能
|
||||
if (this.mindMap.opt.autoMoveWhenMouseInEdgeOnDrag && this.mindMap.select) {
|
||||
this.drawTransform = this.mindMap.draw.transform()
|
||||
this.mindMap.select.clearAutoMoveTimer()
|
||||
this.mindMap.select.onMove(e.clientX, e.clientY)
|
||||
}
|
||||
}
|
||||
|
||||
// 检测重叠节点
|
||||
checkOverlapNode() {
|
||||
if (!this.drawTransform || !this.placeholder) {
|
||||
@@ -223,11 +317,8 @@ class Drag extends Base {
|
||||
this.nextNode = null
|
||||
this.placeholder.size(0, 0)
|
||||
this.nodeList.forEach(node => {
|
||||
if (node.nodeData.data.isActive) {
|
||||
this.mindMap.renderer.setNodeActive(node, false)
|
||||
}
|
||||
if (node.uid === this.node.uid || this.node.isParent(node)) {
|
||||
return
|
||||
if (node.getData('isActive')) {
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', node, false)
|
||||
}
|
||||
if (this.overlapNode || (this.prevNode && this.nextNode)) {
|
||||
return
|
||||
@@ -262,7 +353,7 @@ class Drag extends Base {
|
||||
}
|
||||
})
|
||||
if (this.overlapNode) {
|
||||
this.mindMap.renderer.setNodeActive(this.overlapNode, true)
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', this.overlapNode, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,9 +487,7 @@ class Drag extends Base {
|
||||
getNodeDistanceToSiblingNode(checkList, node, nodeRect, dir) {
|
||||
let dir1 = dir === 'v' ? 'top' : 'left'
|
||||
let dir2 = dir === 'v' ? 'bottom' : 'right'
|
||||
let index = checkList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
let index = getNodeIndexInNodeList(node, checkList)
|
||||
let prevBrother = null
|
||||
let nextBrother = null
|
||||
if (index !== -1) {
|
||||
@@ -484,7 +573,7 @@ class Drag extends Base {
|
||||
if (node.layerIndex === 1) {
|
||||
sameDir = item.dir === node.dir
|
||||
}
|
||||
return item !== this.node && sameDir
|
||||
return sameDir && !this.checkIsInBeingDragNodeList(item)
|
||||
})
|
||||
: []
|
||||
this.handleVerticalCheck(node, checkList)
|
||||
@@ -535,7 +624,7 @@ class Drag extends Base {
|
||||
handleFishbone(node) {
|
||||
let checkList = node.parent
|
||||
? node.parent.children.filter(item => {
|
||||
return item !== this.node && item.layerIndex > 1
|
||||
return item.layerIndex > 1 && !this.checkIsInBeingDragNodeList(item)
|
||||
})
|
||||
: []
|
||||
if (node.layerIndex === 1) {
|
||||
@@ -553,8 +642,8 @@ class Drag extends Base {
|
||||
// 获取节点的兄弟节点列表通用方法
|
||||
commonGetNodeCheckList(node) {
|
||||
return node.parent
|
||||
? node.parent.children.filter(item => {
|
||||
return item !== this.node
|
||||
? [...node.parent.children].filter(item => {
|
||||
return !this.checkIsInBeingDragNodeList(item)
|
||||
})
|
||||
: []
|
||||
}
|
||||
@@ -585,18 +674,11 @@ class Drag extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
// 节点由树转换成数组,从子节点到根节点
|
||||
nodeTreeToList() {
|
||||
const list = []
|
||||
bfsWalk(this.mindMap.renderer.root, node => {
|
||||
if (!list[node.layerIndex]) {
|
||||
list[node.layerIndex] = []
|
||||
}
|
||||
list[node.layerIndex].push(node)
|
||||
// 检查某个节点是否在被拖拽节点内
|
||||
checkIsInBeingDragNodeList(node) {
|
||||
return !!this.beingDragNodeList.find(item => {
|
||||
return item.uid === node.uid || item.isParent(node)
|
||||
})
|
||||
this.nodeList = list.reduceRight((res, cur) => {
|
||||
return [...res, ...cur]
|
||||
}, [])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class Export {
|
||||
let task = imageList.map(async item => {
|
||||
let imgUlr = item.attr('href') || item.attr('xlink:href')
|
||||
// 已经是data:URL形式不用转换
|
||||
if (/^data:/.test(imgUlr)) {
|
||||
if (/^data:/.test(imgUlr) || imgUlr === 'none') {
|
||||
return
|
||||
}
|
||||
let imgData = await imgToDataUrl(imgUlr)
|
||||
|
||||
53
simple-mind-map/src/plugins/Formula.js
Normal file
53
simple-mind-map/src/plugins/Formula.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import katex from 'katex'
|
||||
import Quill from 'quill'
|
||||
|
||||
// 数学公式支持插件
|
||||
// 该插件在富文本模式下可用
|
||||
class Formula {
|
||||
// 构造函数
|
||||
constructor(opt) {
|
||||
this.opt = opt
|
||||
this.mindMap = opt.mindMap
|
||||
window.katex = katex
|
||||
this.extendQuill()
|
||||
}
|
||||
|
||||
// 修改formula格式工具
|
||||
extendQuill() {
|
||||
const QuillFormula = Quill.import('formats/formula')
|
||||
|
||||
class CustomFormulaBlot extends QuillFormula {
|
||||
static create(value) {
|
||||
let node = super.create(value)
|
||||
if (typeof value === 'string') {
|
||||
katex.render(value, node, {
|
||||
throwOnError: false,
|
||||
errorColor: '#f00',
|
||||
output: 'mathml' // 增加该配置,默认只输出公式
|
||||
})
|
||||
node.setAttribute('data-value', value)
|
||||
}
|
||||
return node
|
||||
}
|
||||
}
|
||||
|
||||
Quill.register('formats/formula', CustomFormulaBlot, true)
|
||||
}
|
||||
|
||||
// 给指定的节点插入指定公式
|
||||
insertFormulaToNode(node, formula) {
|
||||
let richTextPlugin = this.mindMap.richText
|
||||
richTextPlugin.showEditText(node)
|
||||
richTextPlugin.quill.insertEmbed(
|
||||
richTextPlugin.quill.getLength() - 1,
|
||||
'formula',
|
||||
formula
|
||||
)
|
||||
richTextPlugin.setTextStyleIfNotRichText(richTextPlugin.node)
|
||||
richTextPlugin.hideEditText([node])
|
||||
}
|
||||
}
|
||||
|
||||
Formula.instanceName = 'formula'
|
||||
|
||||
export default Formula
|
||||
@@ -1,7 +1,8 @@
|
||||
import {
|
||||
isWhite,
|
||||
isTransparent,
|
||||
getVisibleColorFromTheme
|
||||
getVisibleColorFromTheme,
|
||||
readBlob
|
||||
} from '../utils/index'
|
||||
|
||||
// 小地图插件
|
||||
@@ -27,7 +28,9 @@ class MiniMap {
|
||||
*/
|
||||
calculationMiniMap(boxWidth, boxHeight) {
|
||||
let { svg, rect, origWidth, origHeight, scaleX, scaleY } =
|
||||
this.mindMap.getSvgData()
|
||||
this.mindMap.getSvgData({
|
||||
ignoreWatermark: true
|
||||
})
|
||||
// 计算数据
|
||||
const elRect = this.mindMap.elRect
|
||||
rect.x -= elRect.left
|
||||
@@ -85,10 +88,18 @@ class MiniMap {
|
||||
Object.keys(viewBoxStyle).forEach(key => {
|
||||
viewBoxStyle[key] = viewBoxStyle[key] + 'px'
|
||||
})
|
||||
|
||||
this.removeNodeContent(svg)
|
||||
const svgStr = svg.svg()
|
||||
|
||||
return {
|
||||
svgHTML: svg.svg(), // 小地图html
|
||||
getImgUrl: async callback => {
|
||||
const blob = new Blob([svgStr], {
|
||||
type: 'image/svg+xml'
|
||||
})
|
||||
const res = await readBlob(blob)
|
||||
callback(res)
|
||||
},
|
||||
svgHTML: svgStr, // 小地图html
|
||||
viewBoxStyle, // 视图框的位置信息
|
||||
miniMapBoxScale, // 视图框的缩放值
|
||||
miniMapBoxLeft, // 视图框的left值
|
||||
|
||||
@@ -205,7 +205,7 @@ class NodeImgAdjust {
|
||||
// 隐藏节点实际图片
|
||||
this.hideNodeImage()
|
||||
// 将节点图片渲染到自定义元素上
|
||||
this.handleEl.style.backgroundImage = `url(${this.node.nodeData.data.image})`
|
||||
this.handleEl.style.backgroundImage = `url(${this.node.getData('image')})`
|
||||
}
|
||||
|
||||
// 鼠标移动
|
||||
@@ -214,7 +214,7 @@ class NodeImgAdjust {
|
||||
e.preventDefault()
|
||||
// 计算当前拖拽位置对应的图片的实时大小
|
||||
let { width: imageOriginWidth, height: imageOriginHeight } =
|
||||
this.node.nodeData.data.imageSize
|
||||
this.node.getData('imageSize')
|
||||
let newWidth = e.clientX - this.rect.x
|
||||
let newHeight = e.clientY - this.rect.y
|
||||
if (newWidth <= 0 || newHeight <= 0) return
|
||||
@@ -237,7 +237,7 @@ class NodeImgAdjust {
|
||||
// 隐藏自定义元素
|
||||
this.hideHandleEl()
|
||||
// 更新节点图片为新的大小
|
||||
let { image, imageTitle } = this.node.nodeData.data
|
||||
let { image, imageTitle } = this.node.getData()
|
||||
let { scaleX, scaleY } = this.mindMap.draw.transform()
|
||||
this.mindMap.execCommand('SET_NODE_IMAGE', this.node, {
|
||||
url: image,
|
||||
|
||||
@@ -53,7 +53,7 @@ class Painter {
|
||||
)
|
||||
return
|
||||
const style = {}
|
||||
const painterNodeData = this.painterNode.nodeData.data
|
||||
const painterNodeData = this.painterNode.getData()
|
||||
Object.keys(painterNodeData).forEach(key => {
|
||||
if (checkIsNodeStyleDataKey(key)) {
|
||||
style[key] = painterNodeData[key]
|
||||
|
||||
@@ -5,7 +5,8 @@ import {
|
||||
walk,
|
||||
getTextFromHtml,
|
||||
isWhite,
|
||||
getVisibleColorFromTheme
|
||||
getVisibleColorFromTheme,
|
||||
isUndef
|
||||
} from '../utils'
|
||||
import { CONSTANTS } from '../constants/constant'
|
||||
|
||||
@@ -235,14 +236,17 @@ class RichText {
|
||||
this.textEditNode.style.borderRadius = (node.height || 50) + 'px'
|
||||
}
|
||||
}
|
||||
if (!node.nodeData.data.richText) {
|
||||
if (!node.getData('richText')) {
|
||||
// 还不是富文本的情况
|
||||
let text = node.nodeData.data.text.split(/\n/gim).join('<br>')
|
||||
let text = ''
|
||||
if (!isUndef(node.getData('text'))) {
|
||||
text = String(node.getData('text')).split(/\n/gim).join('<br>')
|
||||
}
|
||||
let html = `<p>${text}</p>`
|
||||
this.textEditNode.innerHTML = this.cacheEditingText || html
|
||||
} else {
|
||||
this.textEditNode.innerHTML =
|
||||
this.cacheEditingText || node.nodeData.data.text
|
||||
this.cacheEditingText || node.getData('text')
|
||||
}
|
||||
this.initQuillEditor()
|
||||
document.querySelector('.ql-editor').style.minHeight = originHeight + 'px'
|
||||
@@ -252,7 +256,7 @@ class RichText {
|
||||
this.focus(
|
||||
isInserting || (selectTextOnEnterEditText && !isFromKeyDown) ? 0 : null
|
||||
)
|
||||
if (!node.nodeData.data.richText) {
|
||||
if (!node.getData('richText')) {
|
||||
// 如果是非富文本的情况,需要手动应用文本样式
|
||||
this.setTextStyleIfNotRichText(node)
|
||||
}
|
||||
@@ -490,7 +494,7 @@ class RichText {
|
||||
})
|
||||
} else {
|
||||
let data = this.richTextStyleToNormalStyle(config)
|
||||
this.mindMap.renderer.setNodeData(this.node, data)
|
||||
this.mindMap.execCommand('SET_NODE_DATA', this.node, data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,6 +564,16 @@ class RichText {
|
||||
return data
|
||||
}
|
||||
|
||||
// 给未激活的节点设置富文本样式
|
||||
setNotActiveNodeStyle(node, style) {
|
||||
const config = this.normalStyleToRichTextStyle(style)
|
||||
if (Object.keys(config).length > 0) {
|
||||
this.showEditText(node)
|
||||
this.formatAllText(config)
|
||||
this.hideEditText([node])
|
||||
}
|
||||
}
|
||||
|
||||
// 处理导出为图片
|
||||
async handleExportPng(node) {
|
||||
let el = document.createElement('div')
|
||||
@@ -616,7 +630,7 @@ class RichText {
|
||||
// 处理导入数据
|
||||
handleSetData(data) {
|
||||
let walk = root => {
|
||||
if (!root.data.richText) {
|
||||
if (root.data && !root.data.richText) {
|
||||
root.data.richText = true
|
||||
root.data.resetRichText = true
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class Search {
|
||||
this.matchNodeList = []
|
||||
this.currentIndex = -1
|
||||
bfsWalk(this.mindMap.renderer.root, node => {
|
||||
let { richText, text } = node.nodeData.data
|
||||
let { richText, text } = node.getData()
|
||||
if (richText) {
|
||||
text = getTextFromHtml(text)
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class Search {
|
||||
if (!currentNode) return
|
||||
let text = this.getReplacedText(currentNode, this.searchText, replaceText)
|
||||
this.notResetSearchText = true
|
||||
currentNode.setText(text, currentNode.nodeData.data.richText, true)
|
||||
currentNode.setText(text, currentNode.getData('richText'), true)
|
||||
this.matchNodeList = this.matchNodeList.filter(node => {
|
||||
return currentNode !== node
|
||||
})
|
||||
@@ -143,7 +143,7 @@ class Search {
|
||||
node,
|
||||
{
|
||||
text,
|
||||
resetRichText: !!node.nodeData.data.richText
|
||||
resetRichText: !!node.getData('richText')
|
||||
},
|
||||
true
|
||||
)
|
||||
@@ -155,7 +155,7 @@ class Search {
|
||||
|
||||
// 获取某个节点替换后的文本
|
||||
getReplacedText(node, searchText, replaceText) {
|
||||
let { richText, text } = node.nodeData.data
|
||||
let { richText, text } = node.getData()
|
||||
if (richText) {
|
||||
return replaceHtmlText(text, searchText, replaceText)
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bfsWalk, throttle } from '../utils'
|
||||
import { bfsWalk, throttle, checkTwoRectIsOverlap } from '../utils'
|
||||
|
||||
// 节点选择插件
|
||||
class Select {
|
||||
@@ -89,23 +89,28 @@ class Select {
|
||||
}
|
||||
)
|
||||
})
|
||||
this.mindMap.on('mouseup', () => {
|
||||
if (this.mindMap.opt.readonly) {
|
||||
return
|
||||
}
|
||||
if (!this.isMousedown) {
|
||||
return
|
||||
}
|
||||
this.checkTriggerNodeActiveEvent()
|
||||
clearTimeout(this.autoMoveTimer)
|
||||
this.isMousedown = false
|
||||
this.cacheActiveList = []
|
||||
if (this.rect) this.rect.remove()
|
||||
this.rect = null
|
||||
setTimeout(() => {
|
||||
this.isSelecting = false
|
||||
}, 0)
|
||||
})
|
||||
this.onMouseup = this.onMouseup.bind(this)
|
||||
this.mindMap.on('mouseup', this.onMouseup)
|
||||
this.mindMap.on('node_mouseup', this.onMouseup)
|
||||
}
|
||||
|
||||
// 结束框选
|
||||
onMouseup() {
|
||||
if (this.mindMap.opt.readonly) {
|
||||
return
|
||||
}
|
||||
if (!this.isMousedown) {
|
||||
return
|
||||
}
|
||||
this.checkTriggerNodeActiveEvent()
|
||||
clearTimeout(this.autoMoveTimer)
|
||||
this.isMousedown = false
|
||||
this.cacheActiveList = []
|
||||
if (this.rect) this.rect.remove()
|
||||
this.rect = null
|
||||
setTimeout(() => {
|
||||
this.isSelecting = false
|
||||
}, 0)
|
||||
}
|
||||
|
||||
// 如果激活节点改变了,那么触发事件
|
||||
@@ -119,7 +124,7 @@ class Select {
|
||||
let cur = this.cacheActiveList[i]
|
||||
if (
|
||||
!this.mindMap.renderer.activeNodeList.find(item => {
|
||||
return item.nodeData.data.uid === cur.nodeData.data.uid
|
||||
return item.getData('uid') === cur.getData('uid')
|
||||
})
|
||||
) {
|
||||
isNodeChange = true
|
||||
@@ -184,6 +189,7 @@ class Select {
|
||||
|
||||
// 创建矩形
|
||||
createRect(x, y) {
|
||||
if (this.rect) this.rect.remove()
|
||||
this.rect = this.mindMap.svg
|
||||
.polygon()
|
||||
.stroke({
|
||||
@@ -210,24 +216,17 @@ class Select {
|
||||
left = left * scaleX + translateX
|
||||
top = top * scaleY + translateY
|
||||
if (
|
||||
((left >= minx && left <= maxx) || (right >= minx && right <= maxx)) &&
|
||||
((top >= miny && top <= maxy) || (bottom >= miny && bottom <= maxy))
|
||||
checkTwoRectIsOverlap(minx, maxx, miny, maxy, left, right, top, bottom)
|
||||
) {
|
||||
// this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
||||
if (node.nodeData.data.isActive) {
|
||||
if (node.getData('isActive')) {
|
||||
return
|
||||
}
|
||||
this.mindMap.renderer.setNodeActive(node, true)
|
||||
this.mindMap.renderer.addActiveNode(node)
|
||||
// })
|
||||
} else if (node.nodeData.data.isActive) {
|
||||
// this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
||||
if (!node.nodeData.data.isActive) {
|
||||
this.mindMap.renderer.addNodeToActiveList(node)
|
||||
} else if (node.getData('isActive')) {
|
||||
if (!node.getData('isActive')) {
|
||||
return
|
||||
}
|
||||
this.mindMap.renderer.setNodeActive(node, false)
|
||||
this.mindMap.renderer.removeActiveNode(node)
|
||||
// })
|
||||
this.mindMap.renderer.removeNodeFromActiveList(node)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,13 +11,48 @@ class Watermark {
|
||||
this.angle = 0 // 旋转角度
|
||||
this.text = '' // 水印文字
|
||||
this.textStyle = {} // 水印文字样式
|
||||
this.watermarkDraw = null // 容器
|
||||
this.maxLong = this.getMaxLong()
|
||||
this.updateWatermark(this.mindMap.opt.watermarkConfig || {})
|
||||
this.bindEvent()
|
||||
}
|
||||
|
||||
getMaxLong() {
|
||||
return Math.sqrt(
|
||||
Math.pow(this.mindMap.width, 2) + Math.pow(this.mindMap.height, 2)
|
||||
)
|
||||
}
|
||||
|
||||
bindEvent() {
|
||||
this.onResize = this.onResize.bind(this)
|
||||
this.mindMap.on('resize', this.onResize)
|
||||
}
|
||||
|
||||
unBindEvent() {
|
||||
this.mindMap.off('resize', this.onResize)
|
||||
}
|
||||
|
||||
onResize() {
|
||||
this.maxLong = this.getMaxLong()
|
||||
this.draw()
|
||||
}
|
||||
|
||||
// 创建水印容器
|
||||
createContainer() {
|
||||
if (this.watermarkDraw) return
|
||||
this.watermarkDraw = this.mindMap.svg
|
||||
.group()
|
||||
.css({ 'pointer-events': 'none', 'user-select': 'none' })
|
||||
this.maxLong = Math.sqrt(
|
||||
Math.pow(this.mindMap.width, 2) + Math.pow(this.mindMap.height, 2)
|
||||
)
|
||||
this.updateWatermark(this.mindMap.opt.watermarkConfig || {})
|
||||
.addClass('smm-water-mark-container')
|
||||
}
|
||||
|
||||
// 删除水印容器
|
||||
removeContainer() {
|
||||
if (!this.watermarkDraw) {
|
||||
return
|
||||
}
|
||||
this.watermarkDraw.remove()
|
||||
this.watermarkDraw = null
|
||||
}
|
||||
|
||||
// 获取是否存在水印
|
||||
@@ -40,10 +75,14 @@ class Watermark {
|
||||
// 绘制水印
|
||||
// 非精确绘制,会绘制一些超出可视区域的水印
|
||||
draw() {
|
||||
this.watermarkDraw.clear()
|
||||
// 清空之前的水印
|
||||
if (this.watermarkDraw) this.watermarkDraw.clear()
|
||||
// 如果没有水印数据,那么水印容器也删除掉
|
||||
if (!this.hasWatermark()) {
|
||||
this.removeContainer()
|
||||
return
|
||||
}
|
||||
this.createContainer()
|
||||
let x = 0
|
||||
while (x < this.mindMap.width) {
|
||||
this.drawText(x)
|
||||
@@ -116,6 +155,16 @@ class Watermark {
|
||||
this.handleConfig(config)
|
||||
this.draw()
|
||||
}
|
||||
|
||||
// 插件被移除前做的事情
|
||||
beforePluginRemove() {
|
||||
this.unBindEvent()
|
||||
}
|
||||
|
||||
// 插件被卸载前做的事情
|
||||
beforePluginDestroy() {
|
||||
this.unBindEvent()
|
||||
}
|
||||
}
|
||||
|
||||
Watermark.instanceName = 'watermark'
|
||||
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
function createControlNodes() {
|
||||
let { associativeLineActiveColor } = this.mindMap.themeConfig
|
||||
// 连线
|
||||
this.controlLine1 = this.draw
|
||||
this.controlLine1 = this.associativeLineDraw
|
||||
.line()
|
||||
.stroke({ color: associativeLineActiveColor, width: 2 })
|
||||
this.controlLine2 = this.draw
|
||||
this.controlLine2 = this.associativeLineDraw
|
||||
.line()
|
||||
.stroke({ color: associativeLineActiveColor, width: 2 })
|
||||
// 控制点
|
||||
@@ -23,7 +23,7 @@ function createControlNodes() {
|
||||
// 创建控制点
|
||||
function createOneControlNode(pointKey) {
|
||||
let { associativeLineActiveColor } = this.mindMap.themeConfig
|
||||
return this.draw
|
||||
return this.associativeLineDraw
|
||||
.circle(this.controlPointDiameter)
|
||||
.stroke({ color: associativeLineActiveColor })
|
||||
.fill({ color: '#fff' })
|
||||
@@ -64,7 +64,7 @@ function onControlPointMousemove(e) {
|
||||
let [, , , node, toNode] = this.activeLine
|
||||
let targetIndex = getAssociativeLineTargetIndex(node, toNode)
|
||||
let { associativeLinePoint, associativeLineTargetControlOffsets } =
|
||||
node.nodeData.data
|
||||
node.getData()
|
||||
associativeLinePoint = associativeLinePoint || []
|
||||
const nodePos = this.getNodePos(node)
|
||||
const toNodePos = this.getNodePos(toNode)
|
||||
@@ -160,7 +160,7 @@ function onControlPointMouseup(e) {
|
||||
let [, , , node] = this.activeLine
|
||||
let offsetList = []
|
||||
let { associativeLinePoint, associativeLineTargetControlOffsets } =
|
||||
node.nodeData.data
|
||||
node.getData()
|
||||
if (!associativeLinePoint) {
|
||||
associativeLinePoint = []
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { Text } from '@svgdotjs/svg.js'
|
||||
import { getStrWithBrFromHtml } from '../../utils/index'
|
||||
import {
|
||||
getStrWithBrFromHtml,
|
||||
focusInput,
|
||||
selectAllInput
|
||||
} from '../../utils/index'
|
||||
|
||||
// 创建文字节点
|
||||
function createText(data) {
|
||||
let g = this.draw.group()
|
||||
let g = this.associativeLineDraw.group()
|
||||
const setActive = () => {
|
||||
if (
|
||||
!this.activeLine ||
|
||||
@@ -36,7 +40,7 @@ function showEditTextBox(g) {
|
||||
this.mindMap.keyCommand.addShortcut('Enter', () => {
|
||||
this.hideEditTextBox()
|
||||
})
|
||||
|
||||
// 输入框元素没有创建过,则先创建
|
||||
if (!this.textEditNode) {
|
||||
this.textEditNode = document.createElement('div')
|
||||
this.textEditNode.style.cssText = `position:fixed;box-sizing: border-box;background-color:#fff;box-shadow: 0 0 20px rgba(0,0,0,.5);padding: 3px 5px;margin-left: -5px;margin-top: -3px;outline: none; word-break: break-all;`
|
||||
@@ -55,20 +59,27 @@ function showEditTextBox(g) {
|
||||
associativeLineTextFontFamily,
|
||||
associativeLineTextLineHeight
|
||||
} = this.mindMap.themeConfig
|
||||
let { defaultAssociativeLineText, nodeTextEditZIndex } = this.mindMap.opt
|
||||
let scale = this.mindMap.view.scale
|
||||
let [, , , node, toNode] = this.activeLine
|
||||
let textLines = (
|
||||
this.getText(node, toNode) || this.mindMap.opt.defaultAssociativeLineText
|
||||
).split(/\n/gim)
|
||||
let text = this.getText(node, toNode)
|
||||
let textLines = (text || defaultAssociativeLineText).split(/\n/gim)
|
||||
this.textEditNode.style.fontFamily = associativeLineTextFontFamily
|
||||
this.textEditNode.style.fontSize = associativeLineTextFontSize * scale + 'px'
|
||||
this.textEditNode.style.lineHeight =
|
||||
textLines.length > 1 ? associativeLineTextLineHeight : 'normal'
|
||||
this.textEditNode.style.zIndex = this.mindMap.opt.nodeTextEditZIndex
|
||||
this.textEditNode.style.zIndex = nodeTextEditZIndex
|
||||
this.textEditNode.innerHTML = textLines.join('<br>')
|
||||
this.textEditNode.style.display = 'block'
|
||||
this.updateTextEditBoxPos(g)
|
||||
this.showTextEdit = true
|
||||
// 如果是默认文本要全选输入框
|
||||
if (text === '' || text === defaultAssociativeLineText) {
|
||||
selectAllInput(this.textEditNode)
|
||||
} else {
|
||||
// 否则聚焦即可
|
||||
focusInput(this.textEditNode)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理画布缩放
|
||||
@@ -94,10 +105,13 @@ function hideEditTextBox() {
|
||||
}
|
||||
let [path, , text, node, toNode] = this.activeLine
|
||||
let str = getStrWithBrFromHtml(this.textEditNode.innerHTML)
|
||||
// 如果是默认文本,那么不保存
|
||||
let isDefaultText = str === this.mindMap.opt.defaultAssociativeLineText
|
||||
str = isDefaultText ? '' : str
|
||||
this.mindMap.execCommand('SET_NODE_DATA', node, {
|
||||
associativeLineText: {
|
||||
...(node.nodeData.data.associativeLineText || {}),
|
||||
[toNode.nodeData.data.id]: str
|
||||
...(node.getData('associativeLineText') || {}),
|
||||
[toNode.getData('uid')]: str
|
||||
}
|
||||
})
|
||||
this.textEditNode.style.display = 'none'
|
||||
@@ -109,11 +123,11 @@ function hideEditTextBox() {
|
||||
|
||||
// 获取某根关联线的文字
|
||||
function getText(node, toNode) {
|
||||
let obj = node.nodeData.data.associativeLineText
|
||||
let obj = node.getData('associativeLineText')
|
||||
if (!obj) {
|
||||
return ''
|
||||
}
|
||||
return obj[toNode.nodeData.data.id] || ''
|
||||
return obj[toNode.getData('uid')] || ''
|
||||
}
|
||||
|
||||
// 渲染关联线文字
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 获取目标节点在起始节点的目标数组中的索引
|
||||
export const getAssociativeLineTargetIndex = (node, toNode) => {
|
||||
return node.nodeData.data.associativeLineTargets.findIndex(item => {
|
||||
return item === toNode.nodeData.data.id
|
||||
return node.getData('associativeLineTargets').findIndex(item => {
|
||||
return item === toNode.getData('uid')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ export const computeNodePoints = (fromNode, toNode) => {
|
||||
// 中心点坐标的差值
|
||||
let offsetX = toCx - fromCx
|
||||
let offsetY = toCy - fromCy
|
||||
if (offsetX === 0 && offsetY === 0) return
|
||||
if (offsetX === 0 && offsetY === 0) return []
|
||||
let fromDir = ''
|
||||
let toDir = ''
|
||||
if (offsetX <= 0 && offsetX <= offsetY && offsetX <= -offsetY) {
|
||||
@@ -231,7 +231,7 @@ export const getNodeLinePath = (startPoint, endPoint, node, toNode) => {
|
||||
// 控制点
|
||||
let controlPoints = []
|
||||
let associativeLineTargetControlOffsets =
|
||||
node.nodeData.data.associativeLineTargetControlOffsets
|
||||
node.getData('associativeLineTargetControlOffsets')
|
||||
if (
|
||||
associativeLineTargetControlOffsets &&
|
||||
associativeLineTargetControlOffsets[targetIndex]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { mergerIconList } from '../utils'
|
||||
|
||||
// 超链接图标
|
||||
const hyperlink =
|
||||
'<svg t="1624174958075" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7982" ><path d="M435.484444 251.733333v68.892445L295.822222 320.682667a168.504889 168.504889 0 0 0-2.844444 336.952889h142.506666v68.892444H295.822222a237.397333 237.397333 0 0 1 0-474.794667h139.662222z m248.945778 0a237.397333 237.397333 0 0 1 0 474.851556H544.654222v-69.006222l139.776 0.056889a168.504889 168.504889 0 0 0 2.844445-336.952889H544.597333V251.676444h139.776z m-25.827555 203.946667a34.474667 34.474667 0 0 1 0 68.892444H321.649778a34.474667 34.474667 0 0 1 0-68.892444h336.952889z" p-id="7983"></path></svg>'
|
||||
@@ -281,12 +283,21 @@ export const nodeIconList = [
|
||||
// 获取nodeIconList icon内容
|
||||
const getNodeIconListIcon = (name, extendIconList = []) => {
|
||||
let arr = name.split('_')
|
||||
let typeData = [...nodeIconList, ...extendIconList].find(item => {
|
||||
const iconList = mergerIconList([...nodeIconList, ...extendIconList])
|
||||
let typeData = iconList.find(item => {
|
||||
return item.type === arr[0]
|
||||
})
|
||||
return typeData.list.find(item => {
|
||||
return item.name === arr[1]
|
||||
}).icon
|
||||
if (typeData) {
|
||||
let typeName = typeData.list.find(item => {
|
||||
return item.name === arr[1]
|
||||
})
|
||||
if (typeName) {
|
||||
return typeName.icon
|
||||
}
|
||||
return ''
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { nodeDataNoStylePropList } from '../constants/constant'
|
||||
|
||||
import MersenneTwister from './mersenneTwister'
|
||||
// 深度优先遍历树
|
||||
export const walk = (
|
||||
root,
|
||||
@@ -167,19 +167,23 @@ export const copyNodeTree = (
|
||||
tree,
|
||||
root,
|
||||
removeActiveState = false,
|
||||
keepId = false
|
||||
removeId = true
|
||||
) => {
|
||||
tree.data = simpleDeepClone(root.nodeData ? root.nodeData.data : root.data)
|
||||
// 去除节点id,因为节点id不能重复
|
||||
if (tree.data.id && !keepId) delete tree.data.id
|
||||
if (tree.data.uid) delete tree.data.uid
|
||||
// 移除节点uid
|
||||
if (removeId) {
|
||||
delete tree.data.uid
|
||||
} else if (!tree.data.uid) {
|
||||
// 否则保留或生成
|
||||
tree.data.uid = createUid()
|
||||
}
|
||||
if (removeActiveState) {
|
||||
tree.data.isActive = false
|
||||
}
|
||||
tree.children = []
|
||||
if (root.children && root.children.length > 0) {
|
||||
root.children.forEach((item, index) => {
|
||||
tree.children[index] = copyNodeTree({}, item, removeActiveState, keepId)
|
||||
tree.children[index] = copyNodeTree({}, item, removeActiveState, removeId)
|
||||
})
|
||||
} else if (
|
||||
root.nodeData &&
|
||||
@@ -187,7 +191,7 @@ export const copyNodeTree = (
|
||||
root.nodeData.children.length > 0
|
||||
) {
|
||||
root.nodeData.children.forEach((item, index) => {
|
||||
tree.children[index] = copyNodeTree({}, item, removeActiveState, keepId)
|
||||
tree.children[index] = copyNodeTree({}, item, removeActiveState, removeId)
|
||||
})
|
||||
}
|
||||
return tree
|
||||
@@ -465,7 +469,7 @@ export const removeHTMLEntities = str => {
|
||||
|
||||
// 获取一个数据的类型
|
||||
export const getType = data => {
|
||||
return Object.prototype.toString.call(data).slice(7, -1)
|
||||
return Object.prototype.toString.call(data).slice(8, -1)
|
||||
}
|
||||
|
||||
// 判断一个数据是否是null和undefined和空字符串
|
||||
@@ -669,3 +673,251 @@ export const checkIsNodeStyleDataKey = key => {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 合并图标数组
|
||||
// const data = [
|
||||
// { type: 'priority', name: '优先级图标', list: [{ name: '1', icon: 'a' }, { name: 2, icon: 'b' }] },
|
||||
// { type: 'priority', name: '优先级图标', list: [{ name: '2', icon: 'c' }, { name: 3, icon: 'd' }] },
|
||||
// ];
|
||||
|
||||
// mergerIconList(data) 结果
|
||||
|
||||
// [
|
||||
// { type: 'priority', name: '优先级图标', list: [{ name: '1', icon: 'a' }, { name: 2, icon: 'c' }, { name: 3, icon: 'd' }] },
|
||||
// ]
|
||||
export const mergerIconList = list => {
|
||||
return list.reduce((result, item) => {
|
||||
const existingItem = result.find(x => x.type === item.type)
|
||||
if (existingItem) {
|
||||
item.list.forEach(newObj => {
|
||||
const existingObj = existingItem.list.find(x => x.name === newObj.name)
|
||||
if (existingObj) {
|
||||
existingObj.icon = newObj.icon
|
||||
} else {
|
||||
existingItem.list.push(newObj)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
result.push({ ...item })
|
||||
}
|
||||
return result
|
||||
}, [])
|
||||
}
|
||||
|
||||
// 从节点实例列表里找出顶层的节点
|
||||
export const getTopAncestorsFomNodeList = list => {
|
||||
let res = []
|
||||
list.forEach(node => {
|
||||
if (
|
||||
!list.find(item => {
|
||||
return item.uid !== node.uid && item.isParent(node)
|
||||
})
|
||||
) {
|
||||
res.push(node)
|
||||
}
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
// 判断两个矩形是否重叠
|
||||
export const checkTwoRectIsOverlap = (
|
||||
minx1,
|
||||
maxx1,
|
||||
miny1,
|
||||
maxy1,
|
||||
minx2,
|
||||
maxx2,
|
||||
miny2,
|
||||
maxy2
|
||||
) => {
|
||||
return maxx1 > minx2 && maxx2 > minx1 && maxy1 > miny2 && maxy2 > miny1
|
||||
}
|
||||
|
||||
// 聚焦指定输入框
|
||||
export const focusInput = el => {
|
||||
let selection = window.getSelection()
|
||||
let range = document.createRange()
|
||||
range.selectNodeContents(el)
|
||||
range.collapse()
|
||||
selection.removeAllRanges()
|
||||
selection.addRange(range)
|
||||
}
|
||||
|
||||
// 聚焦全选指定输入框
|
||||
export const selectAllInput = el => {
|
||||
let selection = window.getSelection()
|
||||
let range = document.createRange()
|
||||
range.selectNodeContents(el)
|
||||
selection.removeAllRanges()
|
||||
selection.addRange(range)
|
||||
}
|
||||
|
||||
// 给指定的节点列表树数据添加附加数据,会修改原数据
|
||||
export const addDataToAppointNodes = (appointNodes, data = {}) => {
|
||||
const walk = list => {
|
||||
list.forEach(node => {
|
||||
node.data = {
|
||||
...node.data,
|
||||
...data
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
walk(node.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
walk(appointNodes)
|
||||
return appointNodes
|
||||
}
|
||||
|
||||
// 给指定的节点列表树数据添加uid,会修改原数据
|
||||
// createNewId默认为false,即如果节点不存在uid的话,会创建新的uid。如果传true,那么无论节点数据原来是否存在uid,都会创建新的uid
|
||||
export const createUidForAppointNodes = (appointNodes, createNewId = false) => {
|
||||
const walk = list => {
|
||||
list.forEach(node => {
|
||||
if (!node.data) {
|
||||
node.data = {}
|
||||
}
|
||||
if (createNewId || isUndef(node.data.uid)) {
|
||||
node.data.uid = createUid()
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
walk(node.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
walk(appointNodes)
|
||||
return appointNodes
|
||||
}
|
||||
|
||||
// 传入一个数据,如果该数据是数组,那么返回该数组,否则返回一个以该数据为成员的数组
|
||||
export const formatDataToArray = data => {
|
||||
if (!data) return []
|
||||
return Array.isArray(data) ? data : [data]
|
||||
}
|
||||
|
||||
// 获取节点在同级里的位置索引
|
||||
export const getNodeDataIndex = node => {
|
||||
return node.parent
|
||||
? node.parent.nodeData.children.findIndex(item => {
|
||||
return item.data.uid === node.uid
|
||||
})
|
||||
: 0
|
||||
}
|
||||
|
||||
// 从一个节点列表里找出某个节点的索引
|
||||
export const getNodeIndexInNodeList = (node, nodeList) => {
|
||||
return nodeList.findIndex(item => {
|
||||
return item.uid === node.uid
|
||||
})
|
||||
}
|
||||
|
||||
// 根据内容生成颜色
|
||||
export const generateColorByContent = str => {
|
||||
let hash = 0
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
hash = str.charCodeAt(i) + ((hash << 5) - hash)
|
||||
}
|
||||
// 这里使用伪随机数的原因是因为
|
||||
// 1. 如果字符串的内容差不多,根据hash生产的颜色就比较相近,不好区分,比如v1.1 v1.2,所以需要加入随机数来使得颜色能够区分开
|
||||
// 2. 普通的随机数每次数值不一样,就会导致每次新增标签原来的标签颜色就会发生改变,所以加入了这个方法,使得内容不变随机数也不变
|
||||
const rng = new MersenneTwister(hash)
|
||||
const h = rng.genrand_int32() % 360
|
||||
return 'hsla(' + h + ', 50%, 50%, 1)'
|
||||
}
|
||||
|
||||
// html转义
|
||||
export const htmlEscape = str => {
|
||||
;[
|
||||
['&', '&'],
|
||||
['<', '<'],
|
||||
['>', '>']
|
||||
].forEach(item => {
|
||||
str = str.replace(new RegExp(item[0], 'g'), item[1])
|
||||
})
|
||||
return str
|
||||
}
|
||||
|
||||
// 判断两个对象是否相同,只处理对象或数组
|
||||
export const isSameObject = (a, b) => {
|
||||
const type = getType(a)
|
||||
// a、b类型不一致,那么肯定不相同
|
||||
if (type !== getType(b)) return false
|
||||
// 如果都是对象
|
||||
if (type === 'Object') {
|
||||
const keysa = Object.keys(a)
|
||||
const keysb = Object.keys(b)
|
||||
// 对象字段数量不一样,肯定不相同
|
||||
if (keysa.length !== keysb.length) return false
|
||||
// 字段数量一样,那么需要遍历字段进行判断
|
||||
for (let i = 0; i < keysa.length; i++) {
|
||||
const key = keysa[i]
|
||||
// b没有a的一个字段,那么肯定不相同
|
||||
if (!keysb.includes(key)) return false
|
||||
// 字段名称一样,那么需要递归判断它们的值
|
||||
const isSame = isSameObject(a[key], b[key])
|
||||
if (!isSame) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
} else if (type === 'Array') {
|
||||
// 如果都是数组
|
||||
// 数组长度不一样,肯定不相同
|
||||
if (a.length !== b.length) return false
|
||||
// 长度一样,那么需要遍历进行判断
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
const itema = a[i]
|
||||
const itemb = b[i]
|
||||
const typea = getType(itema)
|
||||
const typeb = getType(itemb)
|
||||
if (typea !== typeb) return false
|
||||
const isSame = isSameObject(itema, itemb)
|
||||
if (!isSame) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
// 其他类型,直接全等判断
|
||||
return a === b
|
||||
}
|
||||
}
|
||||
|
||||
// 将数据设置到用户剪切板中
|
||||
export const setDataToClipboard = data => {
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(JSON.stringify(data))
|
||||
}
|
||||
}
|
||||
|
||||
// 从用户剪贴板中读取文字和图片
|
||||
export const getDataFromClipboard = async () => {
|
||||
let text = null
|
||||
let img = null
|
||||
if (navigator.clipboard) {
|
||||
text = await navigator.clipboard.readText()
|
||||
const items = await navigator.clipboard.read()
|
||||
if (items && items.length > 0) {
|
||||
for (const clipboardItem of items) {
|
||||
for (const type of clipboardItem.types) {
|
||||
if (/^image\//.test(type)) {
|
||||
img = await clipboardItem.getType(type)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
text,
|
||||
img
|
||||
}
|
||||
}
|
||||
|
||||
// 从节点的父节点的nodeData.children列表中移除该节点的数据
|
||||
export const removeFromParentNodeData = node => {
|
||||
if (!node || !node.parent) return
|
||||
const index = getNodeDataIndex(node)
|
||||
if (index === -1) return
|
||||
node.parent.nodeData.children.splice(index, 1)
|
||||
}
|
||||
|
||||
65
simple-mind-map/src/utils/mersenneTwister.js
Normal file
65
simple-mind-map/src/utils/mersenneTwister.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @description 为了保证相同的内容每次生成的随机数都是一样的,我们可以使用一个伪随机数生成器(PRNG),并使用内容的哈希值作为种子。以下是一个使用Mersenne Twister算法的PRNG的实现:
|
||||
*
|
||||
* @param {*} seed
|
||||
*/
|
||||
|
||||
export default function MersenneTwister(seed) {
|
||||
this.N = 624
|
||||
this.M = 397
|
||||
this.MATRIX_A = 0x9908b0df
|
||||
this.UPPER_MASK = 0x80000000
|
||||
this.LOWER_MASK = 0x7fffffff
|
||||
|
||||
this.mt = new Array(this.N)
|
||||
this.mti = this.N + 1
|
||||
|
||||
this.init_genrand(seed)
|
||||
}
|
||||
|
||||
MersenneTwister.prototype.init_genrand = function (s) {
|
||||
this.mt[0] = s >>> 0
|
||||
for (this.mti = 1; this.mti < this.N; this.mti++) {
|
||||
s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30)
|
||||
this.mt[this.mti] =
|
||||
((((s & 0xffff0000) >>> 16) * 1812433253) << 16) +
|
||||
(s & 0x0000ffff) * 1812433253 +
|
||||
this.mti
|
||||
this.mt[this.mti] >>>= 0
|
||||
}
|
||||
}
|
||||
|
||||
MersenneTwister.prototype.genrand_int32 = function () {
|
||||
var y
|
||||
var mag01 = new Array(0x0, this.MATRIX_A)
|
||||
|
||||
if (this.mti >= this.N) {
|
||||
var kk
|
||||
|
||||
if (this.mti == this.N + 1) this.init_genrand(5489)
|
||||
|
||||
for (kk = 0; kk < this.N - this.M; kk++) {
|
||||
y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)
|
||||
this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1]
|
||||
}
|
||||
|
||||
for (; kk < this.N - 1; kk++) {
|
||||
y = (this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)
|
||||
this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1]
|
||||
}
|
||||
|
||||
y = (this.mt[this.N - 1] & this.UPPER_MASK) | (this.mt[0] & this.LOWER_MASK)
|
||||
this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1]
|
||||
|
||||
this.mti = 0
|
||||
}
|
||||
|
||||
y = this.mt[this.mti++]
|
||||
|
||||
y ^= y >>> 11
|
||||
y ^= (y << 7) & 0x9d2c5680
|
||||
y ^= (y << 15) & 0xefc60000
|
||||
y ^= y >>> 18
|
||||
|
||||
return y >>> 0
|
||||
}
|
||||
346
simple-mind-map/types/index.d.ts
vendored
346
simple-mind-map/types/index.d.ts
vendored
@@ -1,166 +1,188 @@
|
||||
export default MindMap
|
||||
export default MindMap;
|
||||
declare class MindMap {
|
||||
/**
|
||||
*
|
||||
* @param {defaultOpt} opt
|
||||
*/
|
||||
constructor(opt?: {
|
||||
readonly: boolean
|
||||
layout: string
|
||||
fishboneDeg: number
|
||||
theme: string
|
||||
themeConfig: {}
|
||||
scaleRatio: number
|
||||
mouseScaleCenterUseMousePosition: boolean
|
||||
maxTag: number
|
||||
expandBtnSize: number
|
||||
imgTextMargin: number
|
||||
textContentMargin: number
|
||||
selectTranslateStep: number
|
||||
selectTranslateLimit: number
|
||||
customNoteContentShow: any
|
||||
enableFreeDrag: boolean
|
||||
watermarkConfig: {
|
||||
text: string
|
||||
lineSpacing: number
|
||||
textSpacing: number
|
||||
angle: number
|
||||
textStyle: {
|
||||
color: string
|
||||
opacity: number
|
||||
fontSize: number
|
||||
}
|
||||
}
|
||||
textAutoWrapWidth: number
|
||||
customHandleMousewheel: any
|
||||
mousewheelAction: string
|
||||
mousewheelMoveStep: number
|
||||
mousewheelZoomActionReverse: boolean
|
||||
defaultInsertSecondLevelNodeText: string
|
||||
defaultInsertBelowSecondLevelNodeText: string
|
||||
expandBtnStyle: {
|
||||
color: string
|
||||
fill: string
|
||||
fontSize: number
|
||||
strokeColor: string
|
||||
}
|
||||
expandBtnIcon: {
|
||||
open: string
|
||||
close: string
|
||||
}
|
||||
expandBtnNumHandler: (num: any) => any
|
||||
isShowExpandNum: boolean
|
||||
enableShortcutOnlyWhenMouseInSvg: boolean
|
||||
initRootNodePosition: any
|
||||
exportPaddingX: number
|
||||
exportPaddingY: number
|
||||
nodeTextEditZIndex: number
|
||||
nodeNoteTooltipZIndex: number
|
||||
isEndNodeTextEditOnClickOuter: boolean
|
||||
maxHistoryCount: number
|
||||
alwaysShowExpandBtn: boolean
|
||||
iconList: any[]
|
||||
maxNodeCacheCount: number
|
||||
defaultAssociativeLineText: string
|
||||
fitPadding: number
|
||||
enableCtrlKeyNodeSelection: boolean
|
||||
useLeftKeySelectionRightKeyDrag: boolean
|
||||
beforeTextEdit: any
|
||||
isUseCustomNodeContent: boolean
|
||||
customCreateNodeContent: any
|
||||
customInnerElsAppendTo: any
|
||||
nodeDragPlaceholderMaxSize: number
|
||||
enableAutoEnterTextEditWhenKeydown: boolean
|
||||
richTextEditFakeInPlace: boolean
|
||||
customHandleClipboardText: any
|
||||
disableMouseWheelZoom: boolean
|
||||
errorHandler: (code: any, error: any) => void
|
||||
resetCss: string
|
||||
enableDblclickReset: boolean
|
||||
minExportImgCanvasScale: number
|
||||
hoverRectColor: string
|
||||
hoverRectPadding: number
|
||||
selectTextOnEnterEditText: boolean
|
||||
deleteNodeActive: boolean
|
||||
autoMoveWhenMouseInEdgeOnDrag: boolean
|
||||
})
|
||||
opt: any
|
||||
el: any
|
||||
elRect: any
|
||||
width: any
|
||||
height: any
|
||||
cssEl: HTMLStyleElement
|
||||
svg: any
|
||||
draw: any
|
||||
event: Event
|
||||
keyCommand: KeyCommand
|
||||
command: Command
|
||||
renderer: Render
|
||||
view: View
|
||||
batchExecution: BatchExecution
|
||||
handleOpt(opt: any): any
|
||||
addCss(): void
|
||||
removeCss(): void
|
||||
render(callback: any, source?: string): void
|
||||
reRender(callback: any, source?: string): void
|
||||
resize(): void
|
||||
on(event: any, fn: any): void
|
||||
emit(event: any, ...args: any[]): void
|
||||
off(event: any, fn: any): void
|
||||
initCache(): void
|
||||
initTheme(): void
|
||||
themeConfig: any
|
||||
setTheme(theme: any): void
|
||||
getTheme(): any
|
||||
setThemeConfig(config: any): void
|
||||
getCustomThemeConfig(): any
|
||||
getThemeConfig(prop: any): any
|
||||
getConfig(prop: any): any
|
||||
updateConfig(opt?: {}): void
|
||||
getLayout(): any
|
||||
setLayout(layout: any): void
|
||||
execCommand(...args: any[]): void
|
||||
setData(data: any): void
|
||||
setFullData(data: any): void
|
||||
getData(withConfig: any): any
|
||||
export(...args: any[]): Promise<any>
|
||||
toPos(
|
||||
x: any,
|
||||
y: any
|
||||
): {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
setMode(mode: any): void
|
||||
getSvgData({
|
||||
paddingX,
|
||||
paddingY
|
||||
}?: {
|
||||
paddingX?: number
|
||||
paddingY?: number
|
||||
}): {
|
||||
svg: any
|
||||
svgHTML: any
|
||||
rect: any
|
||||
origWidth: any
|
||||
origHeight: any
|
||||
scaleX: any
|
||||
scaleY: any
|
||||
}
|
||||
addPlugin(plugin: any, opt: any): void
|
||||
removePlugin(plugin: any): void
|
||||
initPlugin(plugin: any): void
|
||||
destroy(): void
|
||||
/**
|
||||
*
|
||||
* @param {defaultOpt} opt
|
||||
*/
|
||||
constructor(opt?: {
|
||||
readonly: boolean;
|
||||
layout: string;
|
||||
fishboneDeg: number;
|
||||
theme: string;
|
||||
themeConfig: {};
|
||||
scaleRatio: number;
|
||||
mouseScaleCenterUseMousePosition: boolean;
|
||||
maxTag: number;
|
||||
expandBtnSize: number;
|
||||
imgTextMargin: number;
|
||||
textContentMargin: number;
|
||||
selectTranslateStep: number;
|
||||
selectTranslateLimit: number;
|
||||
customNoteContentShow: any;
|
||||
enableFreeDrag: boolean;
|
||||
watermarkConfig: {
|
||||
text: string;
|
||||
lineSpacing: number;
|
||||
textSpacing: number;
|
||||
angle: number;
|
||||
textStyle: {
|
||||
color: string;
|
||||
opacity: number;
|
||||
fontSize: number;
|
||||
};
|
||||
};
|
||||
textAutoWrapWidth: number;
|
||||
customHandleMousewheel: any;
|
||||
mousewheelAction: string;
|
||||
mousewheelMoveStep: number;
|
||||
mousewheelZoomActionReverse: boolean;
|
||||
defaultInsertSecondLevelNodeText: string;
|
||||
defaultInsertBelowSecondLevelNodeText: string;
|
||||
expandBtnStyle: {
|
||||
color: string;
|
||||
fill: string;
|
||||
fontSize: number;
|
||||
strokeColor: string;
|
||||
};
|
||||
expandBtnIcon: {
|
||||
open: string;
|
||||
close: string;
|
||||
};
|
||||
expandBtnNumHandler: (num: any) => any;
|
||||
isShowExpandNum: boolean;
|
||||
enableShortcutOnlyWhenMouseInSvg: boolean;
|
||||
initRootNodePosition: any;
|
||||
exportPaddingX: number;
|
||||
exportPaddingY: number;
|
||||
nodeTextEditZIndex: number;
|
||||
nodeNoteTooltipZIndex: number;
|
||||
isEndNodeTextEditOnClickOuter: boolean;
|
||||
maxHistoryCount: number;
|
||||
alwaysShowExpandBtn: boolean;
|
||||
iconList: any[];
|
||||
maxNodeCacheCount: number;
|
||||
defaultAssociativeLineText: string;
|
||||
fitPadding: number;
|
||||
enableCtrlKeyNodeSelection: boolean;
|
||||
useLeftKeySelectionRightKeyDrag: boolean;
|
||||
beforeTextEdit: any;
|
||||
isUseCustomNodeContent: boolean;
|
||||
customCreateNodeContent: any;
|
||||
customInnerElsAppendTo: any;
|
||||
nodeDragPlaceholderMaxSize: number;
|
||||
enableAutoEnterTextEditWhenKeydown: boolean;
|
||||
richTextEditFakeInPlace: boolean;
|
||||
customHandleClipboardText: any;
|
||||
disableMouseWheelZoom: boolean;
|
||||
errorHandler: (code: any, error: any) => void;
|
||||
resetCss: string;
|
||||
enableDblclickBackToRootNode: boolean;
|
||||
minExportImgCanvasScale: number;
|
||||
hoverRectColor: string;
|
||||
hoverRectPadding: number;
|
||||
selectTextOnEnterEditText: boolean;
|
||||
deleteNodeActive: boolean;
|
||||
autoMoveWhenMouseInEdgeOnDrag: boolean;
|
||||
fit: boolean;
|
||||
dragMultiNodeRectConfig: {
|
||||
width: number;
|
||||
height: number;
|
||||
fill: string;
|
||||
};
|
||||
dragPlaceholderRectFill: string;
|
||||
dragOpacityConfig: {
|
||||
cloneNodeOpacity: number;
|
||||
beingDragNodeOpacity: number;
|
||||
};
|
||||
tagsColorMap: {};
|
||||
cooperateStyle: {
|
||||
avatarSize: number;
|
||||
fontSize: number;
|
||||
};
|
||||
associativeLineIsAlwaysAboveNode: boolean;
|
||||
defaultGeneralizationText: string;
|
||||
handleIsSplitByWrapOnPasteCreateNewNode: any;
|
||||
addHistoryTime: number;
|
||||
});
|
||||
opt: any;
|
||||
el: any;
|
||||
cssEl: HTMLStyleElement;
|
||||
event: Event;
|
||||
keyCommand: KeyCommand;
|
||||
command: Command;
|
||||
renderer: Render;
|
||||
view: View;
|
||||
batchExecution: BatchExecution;
|
||||
handleOpt(opt: any): any;
|
||||
initContainer(): void;
|
||||
associativeLineDraw: any;
|
||||
svg: any;
|
||||
draw: any;
|
||||
lineDraw: any;
|
||||
nodeDraw: any;
|
||||
otherDraw: any;
|
||||
clearDraw(): void;
|
||||
addCss(): void;
|
||||
removeCss(): void;
|
||||
render(callback: any, source?: string): void;
|
||||
reRender(callback: any, source?: string): void;
|
||||
getElRectInfo(): void;
|
||||
elRect: any;
|
||||
width: any;
|
||||
height: any;
|
||||
resize(): void;
|
||||
on(event: any, fn: any): void;
|
||||
emit(event: any, ...args: any[]): void;
|
||||
off(event: any, fn: any): void;
|
||||
initCache(): void;
|
||||
initTheme(): void;
|
||||
themeConfig: any;
|
||||
setTheme(theme: any, notRender?: boolean): void;
|
||||
getTheme(): any;
|
||||
setThemeConfig(config: any, notRender?: boolean): void;
|
||||
getCustomThemeConfig(): any;
|
||||
getThemeConfig(prop: any): any;
|
||||
getConfig(prop: any): any;
|
||||
updateConfig(opt?: {}): void;
|
||||
getLayout(): any;
|
||||
setLayout(layout: any, notRender?: boolean): void;
|
||||
execCommand(...args: any[]): void;
|
||||
setData(data: any): void;
|
||||
setFullData(data: any): void;
|
||||
getData(withConfig: any): any;
|
||||
export(...args: any[]): Promise<any>;
|
||||
toPos(x: any, y: any): {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
setMode(mode: any): void;
|
||||
getSvgData({ paddingX, paddingY, ignoreWatermark }?: {
|
||||
paddingX?: number;
|
||||
paddingY?: number;
|
||||
ignoreWatermark?: boolean;
|
||||
}): {
|
||||
svg: any;
|
||||
svgHTML: any;
|
||||
rect: any;
|
||||
origWidth: any;
|
||||
origHeight: any;
|
||||
scaleX: any;
|
||||
scaleY: any;
|
||||
};
|
||||
addPlugin(plugin: any, opt: any): void;
|
||||
removePlugin(plugin: any): void;
|
||||
initPlugin(plugin: any): void;
|
||||
destroy(): void;
|
||||
}
|
||||
declare namespace MindMap {
|
||||
let pluginList: any[]
|
||||
function usePlugin(plugin: any, opt?: {}): typeof MindMap
|
||||
function hasPlugin(plugin: any): number
|
||||
function defineTheme(name: any, config?: {}): Error
|
||||
const pluginList: any[];
|
||||
function usePlugin(plugin: any, opt?: {}): typeof MindMap;
|
||||
function hasPlugin(plugin: any): number;
|
||||
function defineTheme(name: any, config?: {}): Error;
|
||||
}
|
||||
import Event from './src/core/event/Event'
|
||||
import KeyCommand from './src/core/command/KeyCommand'
|
||||
import Command from './src/core/command/Command'
|
||||
import Render from './src/core/render/Render'
|
||||
import View from './src/core/view/View'
|
||||
import BatchExecution from './src/utils/BatchExecution'
|
||||
import Event from "./src/core/event/Event";
|
||||
import KeyCommand from "./src/core/command/KeyCommand";
|
||||
import Command from "./src/core/command/Command";
|
||||
import Render from "./src/core/render/Render";
|
||||
import View from "./src/core/view/View";
|
||||
import BatchExecution from "./src/utils/BatchExecution";
|
||||
|
||||
200
simple-mind-map/types/src/constants/constant.d.ts
vendored
200
simple-mind-map/types/src/constants/constant.d.ts
vendored
@@ -1,113 +1,109 @@
|
||||
export const tagColorList: {
|
||||
color: string
|
||||
background: string
|
||||
}[]
|
||||
export const themeList: {
|
||||
name: string
|
||||
value: string
|
||||
dark: boolean
|
||||
}[]
|
||||
name: string;
|
||||
value: string;
|
||||
dark: boolean;
|
||||
}[];
|
||||
export namespace CONSTANTS {
|
||||
let CHANGE_THEME: string
|
||||
let CHANGE_LAYOUT: string
|
||||
let SET_DATA: string
|
||||
let TRANSFORM_TO_NORMAL_NODE: string
|
||||
namespace MODE {
|
||||
let READONLY: string
|
||||
let EDIT: string
|
||||
}
|
||||
namespace LAYOUT {
|
||||
let LOGICAL_STRUCTURE: string
|
||||
let MIND_MAP: string
|
||||
let ORGANIZATION_STRUCTURE: string
|
||||
let CATALOG_ORGANIZATION: string
|
||||
let TIMELINE: string
|
||||
let TIMELINE2: string
|
||||
let FISHBONE: string
|
||||
let VERTICAL_TIMELINE: string
|
||||
}
|
||||
namespace DIR {
|
||||
let UP: string
|
||||
let LEFT: string
|
||||
let DOWN: string
|
||||
let RIGHT: string
|
||||
}
|
||||
namespace KEY_DIR {
|
||||
let LEFT_1: string
|
||||
export { LEFT_1 as LEFT }
|
||||
let UP_1: string
|
||||
export { UP_1 as UP }
|
||||
let RIGHT_1: string
|
||||
export { RIGHT_1 as RIGHT }
|
||||
let DOWN_1: string
|
||||
export { DOWN_1 as DOWN }
|
||||
}
|
||||
namespace SHAPE {
|
||||
let RECTANGLE: string
|
||||
let DIAMOND: string
|
||||
let PARALLELOGRAM: string
|
||||
let ROUNDED_RECTANGLE: string
|
||||
let OCTAGONAL_RECTANGLE: string
|
||||
let OUTER_TRIANGULAR_RECTANGLE: string
|
||||
let INNER_TRIANGULAR_RECTANGLE: string
|
||||
let ELLIPSE: string
|
||||
let CIRCLE: string
|
||||
}
|
||||
namespace MOUSE_WHEEL_ACTION {
|
||||
let ZOOM: string
|
||||
let MOVE: string
|
||||
}
|
||||
namespace INIT_ROOT_NODE_POSITION {
|
||||
let LEFT_2: string
|
||||
export { LEFT_2 as LEFT }
|
||||
export let TOP: string
|
||||
let RIGHT_2: string
|
||||
export { RIGHT_2 as RIGHT }
|
||||
export let BOTTOM: string
|
||||
export let CENTER: string
|
||||
}
|
||||
namespace LAYOUT_GROW_DIR {
|
||||
let LEFT_3: string
|
||||
export { LEFT_3 as LEFT }
|
||||
let TOP_1: string
|
||||
export { TOP_1 as TOP }
|
||||
let RIGHT_3: string
|
||||
export { RIGHT_3 as RIGHT }
|
||||
let BOTTOM_1: string
|
||||
export { BOTTOM_1 as BOTTOM }
|
||||
}
|
||||
namespace PASTE_TYPE {
|
||||
let CLIP_BOARD: string
|
||||
let CANVAS: string
|
||||
}
|
||||
namespace SCROLL_BAR_DIR {
|
||||
let VERTICAL: string
|
||||
let HORIZONTAL: string
|
||||
}
|
||||
const CHANGE_THEME: string;
|
||||
const CHANGE_LAYOUT: string;
|
||||
const SET_DATA: string;
|
||||
const TRANSFORM_TO_NORMAL_NODE: string;
|
||||
namespace MODE {
|
||||
const READONLY: string;
|
||||
const EDIT: string;
|
||||
}
|
||||
namespace LAYOUT {
|
||||
const LOGICAL_STRUCTURE: string;
|
||||
const MIND_MAP: string;
|
||||
const ORGANIZATION_STRUCTURE: string;
|
||||
const CATALOG_ORGANIZATION: string;
|
||||
const TIMELINE: string;
|
||||
const TIMELINE2: string;
|
||||
const FISHBONE: string;
|
||||
const VERTICAL_TIMELINE: string;
|
||||
}
|
||||
namespace DIR {
|
||||
const UP: string;
|
||||
const LEFT: string;
|
||||
const DOWN: string;
|
||||
const RIGHT: string;
|
||||
}
|
||||
namespace KEY_DIR {
|
||||
const LEFT_1: string;
|
||||
export { LEFT_1 as LEFT };
|
||||
const UP_1: string;
|
||||
export { UP_1 as UP };
|
||||
const RIGHT_1: string;
|
||||
export { RIGHT_1 as RIGHT };
|
||||
const DOWN_1: string;
|
||||
export { DOWN_1 as DOWN };
|
||||
}
|
||||
namespace SHAPE {
|
||||
const RECTANGLE: string;
|
||||
const DIAMOND: string;
|
||||
const PARALLELOGRAM: string;
|
||||
const ROUNDED_RECTANGLE: string;
|
||||
const OCTAGONAL_RECTANGLE: string;
|
||||
const OUTER_TRIANGULAR_RECTANGLE: string;
|
||||
const INNER_TRIANGULAR_RECTANGLE: string;
|
||||
const ELLIPSE: string;
|
||||
const CIRCLE: string;
|
||||
}
|
||||
namespace MOUSE_WHEEL_ACTION {
|
||||
const ZOOM: string;
|
||||
const MOVE: string;
|
||||
}
|
||||
namespace INIT_ROOT_NODE_POSITION {
|
||||
const LEFT_2: string;
|
||||
export { LEFT_2 as LEFT };
|
||||
export const TOP: string;
|
||||
const RIGHT_2: string;
|
||||
export { RIGHT_2 as RIGHT };
|
||||
export const BOTTOM: string;
|
||||
export const CENTER: string;
|
||||
}
|
||||
namespace LAYOUT_GROW_DIR {
|
||||
const LEFT_3: string;
|
||||
export { LEFT_3 as LEFT };
|
||||
const TOP_1: string;
|
||||
export { TOP_1 as TOP };
|
||||
const RIGHT_3: string;
|
||||
export { RIGHT_3 as RIGHT };
|
||||
const BOTTOM_1: string;
|
||||
export { BOTTOM_1 as BOTTOM };
|
||||
}
|
||||
namespace PASTE_TYPE {
|
||||
const CLIP_BOARD: string;
|
||||
const CANVAS: string;
|
||||
}
|
||||
namespace SCROLL_BAR_DIR {
|
||||
const VERTICAL: string;
|
||||
const HORIZONTAL: string;
|
||||
}
|
||||
}
|
||||
export const initRootNodePositionMap: {
|
||||
[x: string]: number
|
||||
}
|
||||
[x: string]: number;
|
||||
};
|
||||
export const layoutList: {
|
||||
name: string
|
||||
value: string
|
||||
}[]
|
||||
export const layoutValueList: string[]
|
||||
export const nodeDataNoStylePropList: string[]
|
||||
name: string;
|
||||
value: string;
|
||||
}[];
|
||||
export const layoutValueList: string[];
|
||||
export const nodeDataNoStylePropList: string[];
|
||||
export namespace commonCaches {
|
||||
let measureCustomNodeContentSizeEl: any
|
||||
let measureRichtextNodeTextSizeEl: any
|
||||
const measureCustomNodeContentSizeEl: any;
|
||||
const measureRichtextNodeTextSizeEl: any;
|
||||
}
|
||||
export namespace ERROR_TYPES {
|
||||
let READ_CLIPBOARD_ERROR: string
|
||||
let PARSE_PASTE_DATA_ERROR: string
|
||||
let CUSTOM_HANDLE_CLIPBOARD_TEXT_ERROR: string
|
||||
let LOAD_CLIPBOARD_IMAGE_ERROR: string
|
||||
let BEFORE_TEXT_EDIT_ERROR: string
|
||||
let EXPORT_ERROR: string
|
||||
const READ_CLIPBOARD_ERROR: string;
|
||||
const PARSE_PASTE_DATA_ERROR: string;
|
||||
const CUSTOM_HANDLE_CLIPBOARD_TEXT_ERROR: string;
|
||||
const LOAD_CLIPBOARD_IMAGE_ERROR: string;
|
||||
const BEFORE_TEXT_EDIT_ERROR: string;
|
||||
const EXPORT_ERROR: string;
|
||||
}
|
||||
export namespace a4Size {
|
||||
let width: number
|
||||
let height: number
|
||||
const width: number;
|
||||
const height: number;
|
||||
}
|
||||
export const cssContent: '\n /* 鼠标hover和激活时渲染的矩形 */\n .smm-hover-node{\n display: none;\n opacity: 0.6;\n stroke-width: 1;\n }\n\n .smm-node:hover .smm-hover-node{\n display: block;\n }\n\n .smm-node.active .smm-hover-node{\n display: block;\n opacity: 1;\n stroke-width: 2;\n }\n'
|
||||
export const cssContent: "\n /* 鼠标hover和激活时渲染的矩形 */\n .smm-hover-node{\n display: none;\n opacity: 0.6;\n stroke-width: 1;\n }\n\n .smm-node:not(.smm-node-dragging):hover .smm-hover-node{\n display: block;\n }\n\n .smm-node.active .smm-hover-node{\n display: block;\n opacity: 1;\n stroke-width: 2;\n }\n";
|
||||
|
||||
@@ -1,82 +1,104 @@
|
||||
export namespace defaultOpt {
|
||||
let readonly: boolean
|
||||
let layout: string
|
||||
let fishboneDeg: number
|
||||
let theme: string
|
||||
let themeConfig: {}
|
||||
let scaleRatio: number
|
||||
let mouseScaleCenterUseMousePosition: boolean
|
||||
let maxTag: number
|
||||
let expandBtnSize: number
|
||||
let imgTextMargin: number
|
||||
let textContentMargin: number
|
||||
let selectTranslateStep: number
|
||||
let selectTranslateLimit: number
|
||||
let customNoteContentShow: any
|
||||
let enableFreeDrag: boolean
|
||||
namespace watermarkConfig {
|
||||
let text: string
|
||||
let lineSpacing: number
|
||||
let textSpacing: number
|
||||
let angle: number
|
||||
namespace textStyle {
|
||||
let color: string
|
||||
let opacity: number
|
||||
let fontSize: number
|
||||
const readonly: boolean;
|
||||
const layout: string;
|
||||
const fishboneDeg: number;
|
||||
const theme: string;
|
||||
const themeConfig: {};
|
||||
const scaleRatio: number;
|
||||
const mouseScaleCenterUseMousePosition: boolean;
|
||||
const maxTag: number;
|
||||
const expandBtnSize: number;
|
||||
const imgTextMargin: number;
|
||||
const textContentMargin: number;
|
||||
const selectTranslateStep: number;
|
||||
const selectTranslateLimit: number;
|
||||
const customNoteContentShow: any;
|
||||
const enableFreeDrag: boolean;
|
||||
namespace watermarkConfig {
|
||||
const text: string;
|
||||
const lineSpacing: number;
|
||||
const textSpacing: number;
|
||||
const angle: number;
|
||||
namespace textStyle {
|
||||
const color: string;
|
||||
const opacity: number;
|
||||
const fontSize: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
let textAutoWrapWidth: number
|
||||
let customHandleMousewheel: any
|
||||
let mousewheelAction: string
|
||||
let mousewheelMoveStep: number
|
||||
let mousewheelZoomActionReverse: boolean
|
||||
let defaultInsertSecondLevelNodeText: string
|
||||
let defaultInsertBelowSecondLevelNodeText: string
|
||||
namespace expandBtnStyle {
|
||||
let color_1: string
|
||||
export { color_1 as color }
|
||||
export let fill: string
|
||||
let fontSize_1: number
|
||||
export { fontSize_1 as fontSize }
|
||||
export let strokeColor: string
|
||||
}
|
||||
namespace expandBtnIcon {
|
||||
let open: string
|
||||
let close: string
|
||||
}
|
||||
function expandBtnNumHandler(num: any): any
|
||||
let isShowExpandNum: boolean
|
||||
let enableShortcutOnlyWhenMouseInSvg: boolean
|
||||
let initRootNodePosition: any
|
||||
let exportPaddingX: number
|
||||
let exportPaddingY: number
|
||||
let nodeTextEditZIndex: number
|
||||
let nodeNoteTooltipZIndex: number
|
||||
let isEndNodeTextEditOnClickOuter: boolean
|
||||
let maxHistoryCount: number
|
||||
let alwaysShowExpandBtn: boolean
|
||||
let iconList: any[]
|
||||
let maxNodeCacheCount: number
|
||||
let defaultAssociativeLineText: string
|
||||
let fitPadding: number
|
||||
let enableCtrlKeyNodeSelection: boolean
|
||||
let useLeftKeySelectionRightKeyDrag: boolean
|
||||
let beforeTextEdit: any
|
||||
let isUseCustomNodeContent: boolean
|
||||
let customCreateNodeContent: any
|
||||
let customInnerElsAppendTo: any
|
||||
let nodeDragPlaceholderMaxSize: number
|
||||
let enableAutoEnterTextEditWhenKeydown: boolean
|
||||
let richTextEditFakeInPlace: boolean
|
||||
let customHandleClipboardText: any
|
||||
let disableMouseWheelZoom: boolean
|
||||
function errorHandler(code: any, error: any): void
|
||||
let resetCss: string
|
||||
let enableDblclickReset: boolean
|
||||
let minExportImgCanvasScale: number
|
||||
let hoverRectColor: string
|
||||
let hoverRectPadding: number
|
||||
let selectTextOnEnterEditText: boolean
|
||||
let deleteNodeActive: boolean
|
||||
let autoMoveWhenMouseInEdgeOnDrag: boolean
|
||||
const textAutoWrapWidth: number;
|
||||
const customHandleMousewheel: any;
|
||||
const mousewheelAction: string;
|
||||
const mousewheelMoveStep: number;
|
||||
const mousewheelZoomActionReverse: boolean;
|
||||
const defaultInsertSecondLevelNodeText: string;
|
||||
const defaultInsertBelowSecondLevelNodeText: string;
|
||||
namespace expandBtnStyle {
|
||||
const color_1: string;
|
||||
export { color_1 as color };
|
||||
export const fill: string;
|
||||
const fontSize_1: number;
|
||||
export { fontSize_1 as fontSize };
|
||||
export const strokeColor: string;
|
||||
}
|
||||
namespace expandBtnIcon {
|
||||
const open: string;
|
||||
const close: string;
|
||||
}
|
||||
function expandBtnNumHandler(num: any): any;
|
||||
const isShowExpandNum: boolean;
|
||||
const enableShortcutOnlyWhenMouseInSvg: boolean;
|
||||
const initRootNodePosition: any;
|
||||
const exportPaddingX: number;
|
||||
const exportPaddingY: number;
|
||||
const nodeTextEditZIndex: number;
|
||||
const nodeNoteTooltipZIndex: number;
|
||||
const isEndNodeTextEditOnClickOuter: boolean;
|
||||
const maxHistoryCount: number;
|
||||
const alwaysShowExpandBtn: boolean;
|
||||
const iconList: any[];
|
||||
const maxNodeCacheCount: number;
|
||||
const defaultAssociativeLineText: string;
|
||||
const fitPadding: number;
|
||||
const enableCtrlKeyNodeSelection: boolean;
|
||||
const useLeftKeySelectionRightKeyDrag: boolean;
|
||||
const beforeTextEdit: any;
|
||||
const isUseCustomNodeContent: boolean;
|
||||
const customCreateNodeContent: any;
|
||||
const customInnerElsAppendTo: any;
|
||||
const nodeDragPlaceholderMaxSize: number;
|
||||
const enableAutoEnterTextEditWhenKeydown: boolean;
|
||||
const richTextEditFakeInPlace: boolean;
|
||||
const customHandleClipboardText: any;
|
||||
const disableMouseWheelZoom: boolean;
|
||||
function errorHandler(code: any, error: any): void;
|
||||
const resetCss: string;
|
||||
const enableDblclickBackToRootNode: boolean;
|
||||
const minExportImgCanvasScale: number;
|
||||
const hoverRectColor: string;
|
||||
const hoverRectPadding: number;
|
||||
const selectTextOnEnterEditText: boolean;
|
||||
const deleteNodeActive: boolean;
|
||||
const autoMoveWhenMouseInEdgeOnDrag: boolean;
|
||||
const fit: boolean;
|
||||
namespace dragMultiNodeRectConfig {
|
||||
export const width: number;
|
||||
export const height: number;
|
||||
const fill_1: string;
|
||||
export { fill_1 as fill };
|
||||
}
|
||||
const dragPlaceholderRectFill: string;
|
||||
namespace dragOpacityConfig {
|
||||
const cloneNodeOpacity: number;
|
||||
const beingDragNodeOpacity: number;
|
||||
}
|
||||
const tagsColorMap: {};
|
||||
namespace cooperateStyle {
|
||||
export const avatarSize: number;
|
||||
const fontSize_2: number;
|
||||
export { fontSize_2 as fontSize };
|
||||
}
|
||||
const associativeLineIsAlwaysAboveNode: boolean;
|
||||
const defaultGeneralizationText: string;
|
||||
const handleIsSplitByWrapOnPasteCreateNewNode: any;
|
||||
const addHistoryTime: number;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
export default Command
|
||||
export default Command;
|
||||
declare class Command {
|
||||
constructor(opt?: {})
|
||||
opt: {}
|
||||
mindMap: any
|
||||
commands: {}
|
||||
history: any[]
|
||||
activeHistoryIndex: number
|
||||
addHistory(): void
|
||||
clearHistory(): void
|
||||
registerShortcutKeys(): void
|
||||
exec(name: any, ...args: any[]): void
|
||||
add(name: any, fn: any): void
|
||||
remove(name: any, fn: any): void
|
||||
back(step?: number): any
|
||||
forward(step?: number): any
|
||||
getCopyData(): any
|
||||
removeDataUid(data: any): any
|
||||
constructor(opt?: {});
|
||||
opt: {};
|
||||
mindMap: any;
|
||||
commands: {};
|
||||
history: any[];
|
||||
activeHistoryIndex: number;
|
||||
addHistory(): void;
|
||||
clearHistory(): void;
|
||||
registerShortcutKeys(): void;
|
||||
exec(name: any, ...args: any[]): void;
|
||||
add(name: any, fn: any): void;
|
||||
remove(name: any, fn: any): void;
|
||||
back(step?: number): any;
|
||||
forward(step?: number): any;
|
||||
getCopyData(): any;
|
||||
removeDataUid(data: any): any;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
export default class KeyCommand {
|
||||
constructor(opt: any)
|
||||
opt: any
|
||||
mindMap: any
|
||||
shortcutMap: {}
|
||||
shortcutMapCache: {}
|
||||
isPause: boolean
|
||||
isInSvg: boolean
|
||||
pause(): void
|
||||
recovery(): void
|
||||
save(): void
|
||||
restore(): void
|
||||
bindEvent(): void
|
||||
checkKey(e: any, key: any): boolean
|
||||
getOriginEventCodeArr(e: any): any[]
|
||||
hasCombinationKey(e: any): any
|
||||
getKeyCodeArr(key: any): any[]
|
||||
/**
|
||||
* Enter
|
||||
* Tab | Insert
|
||||
* Shift + a
|
||||
*/
|
||||
addShortcut(key: any, fn: any): void
|
||||
removeShortcut(key: any, fn: any): void
|
||||
getShortcutFn(key: any): any[]
|
||||
constructor(opt: any);
|
||||
opt: any;
|
||||
mindMap: any;
|
||||
shortcutMap: {};
|
||||
shortcutMapCache: {};
|
||||
isPause: boolean;
|
||||
isInSvg: boolean;
|
||||
pause(): void;
|
||||
recovery(): void;
|
||||
save(): void;
|
||||
restore(): void;
|
||||
bindEvent(): void;
|
||||
checkKey(e: any, key: any): boolean;
|
||||
getOriginEventCodeArr(e: any): any[];
|
||||
hasCombinationKey(e: any): any;
|
||||
getKeyCodeArr(key: any): any[];
|
||||
/**
|
||||
* Enter
|
||||
* Tab | Insert
|
||||
* Shift + a
|
||||
*/
|
||||
addShortcut(key: any, fn: any): void;
|
||||
removeShortcut(key: any, fn: any): void;
|
||||
getShortcutFn(key: any): any[];
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
export const keyMap: {
|
||||
Backspace: number
|
||||
Tab: number
|
||||
Enter: number
|
||||
Shift: number
|
||||
Control: number
|
||||
Alt: number
|
||||
CapsLock: number
|
||||
Esc: number
|
||||
Spacebar: number
|
||||
PageUp: number
|
||||
PageDown: number
|
||||
End: number
|
||||
Home: number
|
||||
Insert: number
|
||||
Left: number
|
||||
Up: number
|
||||
Right: number
|
||||
Down: number
|
||||
Del: number
|
||||
NumLock: number
|
||||
Cmd: number
|
||||
CmdFF: number
|
||||
F1: number
|
||||
F2: number
|
||||
F3: number
|
||||
F4: number
|
||||
F5: number
|
||||
F6: number
|
||||
F7: number
|
||||
F8: number
|
||||
F9: number
|
||||
F10: number
|
||||
F11: number
|
||||
F12: number
|
||||
'`': number
|
||||
'=': number
|
||||
'-': number
|
||||
'/': number
|
||||
'.': number
|
||||
}
|
||||
export function isKey(e: any, key: any): boolean
|
||||
Backspace: number;
|
||||
Tab: number;
|
||||
Enter: number;
|
||||
Shift: number;
|
||||
Control: number;
|
||||
Alt: number;
|
||||
CapsLock: number;
|
||||
Esc: number;
|
||||
Spacebar: number;
|
||||
PageUp: number;
|
||||
PageDown: number;
|
||||
End: number;
|
||||
Home: number;
|
||||
Insert: number;
|
||||
Left: number;
|
||||
Up: number;
|
||||
Right: number;
|
||||
Down: number;
|
||||
Del: number;
|
||||
NumLock: number;
|
||||
Cmd: number;
|
||||
CmdFF: number;
|
||||
F1: number;
|
||||
F2: number;
|
||||
F3: number;
|
||||
F4: number;
|
||||
F5: number;
|
||||
F6: number;
|
||||
F7: number;
|
||||
F8: number;
|
||||
F9: number;
|
||||
F10: number;
|
||||
F11: number;
|
||||
F12: number;
|
||||
'`': number;
|
||||
'=': number;
|
||||
'-': number;
|
||||
'/': number;
|
||||
'.': number;
|
||||
};
|
||||
export function isKey(e: any, key: any): boolean;
|
||||
|
||||
66
simple-mind-map/types/src/core/event/Event.d.ts
vendored
66
simple-mind-map/types/src/core/event/Event.d.ts
vendored
@@ -1,35 +1,35 @@
|
||||
export default Event
|
||||
export default Event;
|
||||
declare class Event {
|
||||
constructor(opt?: {})
|
||||
opt: {}
|
||||
mindMap: any
|
||||
isLeftMousedown: boolean
|
||||
isRightMousedown: boolean
|
||||
isMiddleMousedown: boolean
|
||||
mousedownPos: {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
mousemovePos: {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
mousemoveOffset: {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
bindFn(): void
|
||||
onBodyClick(e: any): void
|
||||
onDrawClick(e: any): void
|
||||
onMousedown(e: any): void
|
||||
onMousemove(e: any): void
|
||||
onMouseup(e: any): void
|
||||
onMousewheel(e: any): void
|
||||
onContextmenu(e: any): void
|
||||
onSvgMousedown(e: any): void
|
||||
onKeyup(e: any): void
|
||||
onMouseenter(e: any): void
|
||||
onMouseleave(e: any): void
|
||||
bind(): void
|
||||
unbind(): void
|
||||
constructor(opt?: {});
|
||||
opt: {};
|
||||
mindMap: any;
|
||||
isLeftMousedown: boolean;
|
||||
isRightMousedown: boolean;
|
||||
isMiddleMousedown: boolean;
|
||||
mousedownPos: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
mousemovePos: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
mousemoveOffset: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
bindFn(): void;
|
||||
onBodyClick(e: any): void;
|
||||
onDrawClick(e: any): void;
|
||||
onMousedown(e: any): void;
|
||||
onMousemove(e: any): void;
|
||||
onMouseup(e: any): void;
|
||||
onMousewheel(e: any): void;
|
||||
onContextmenu(e: any): void;
|
||||
onSvgMousedown(e: any): void;
|
||||
onKeyup(e: any): void;
|
||||
onMouseenter(e: any): void;
|
||||
onMouseleave(e: any): void;
|
||||
bind(): void;
|
||||
unbind(): void;
|
||||
}
|
||||
|
||||
202
simple-mind-map/types/src/core/render/Render.d.ts
vendored
202
simple-mind-map/types/src/core/render/Render.d.ts
vendored
@@ -1,107 +1,99 @@
|
||||
export default Render
|
||||
export default Render;
|
||||
declare class Render {
|
||||
constructor(opt?: {})
|
||||
opt: {}
|
||||
mindMap: any
|
||||
themeConfig: any
|
||||
draw: any
|
||||
renderTree: any
|
||||
reRender: boolean
|
||||
isRendering: boolean
|
||||
hasWaitRendering: boolean
|
||||
nodeCache: {}
|
||||
lastNodeCache: {}
|
||||
renderSource: string
|
||||
activeNodeList: any[]
|
||||
root: any
|
||||
textEdit: TextEdit
|
||||
lastBeingCopyData: any
|
||||
beingCopyData: any
|
||||
beingPasteText: string
|
||||
beingPasteImgSize: number
|
||||
currentBeingPasteType: string
|
||||
setLayout(): void
|
||||
layout:
|
||||
| MindMap
|
||||
| CatalogOrganization
|
||||
| OrganizationStructure
|
||||
| Timeline
|
||||
| VerticalTimeline
|
||||
bindEvent(): void
|
||||
registerCommands(): void
|
||||
selectAll(): void
|
||||
back(step: any): void
|
||||
forward(step: any): void
|
||||
insertNode(
|
||||
openEdit?: boolean,
|
||||
appointNodes?: any[],
|
||||
appointData?: any,
|
||||
appointChildren?: any[]
|
||||
): void
|
||||
insertChildNode(
|
||||
openEdit?: boolean,
|
||||
appointNodes?: any[],
|
||||
appointData?: any,
|
||||
appointChildren?: any[]
|
||||
): void
|
||||
upNode(): void
|
||||
downNode(): void
|
||||
insertAfter(node: any, exist: any): void
|
||||
insertBefore(node: any, exist: any): void
|
||||
moveNodeTo(node: any, toNode: any): void
|
||||
removeNode(appointNodes?: any[]): void
|
||||
pasteNode(data: any): void
|
||||
cutNode(callback: any): any
|
||||
setNodeStyle(node: any, prop: any, value: any): void
|
||||
setNodeStyles(node: any, style: any): void
|
||||
setNodeActive(node: any, active: any): void
|
||||
clearAllActive(): void
|
||||
setNodeExpand(node: any, expand: any): void
|
||||
expandAllNode(): void
|
||||
unexpandAllNode(): void
|
||||
expandToLevel(level: any): void
|
||||
setNodeData(node: any, data: any): void
|
||||
setNodeText(node: any, text: any, richText: any, resetRichText: any): void
|
||||
setNodeImage(node: any, data: any): void
|
||||
setNodeIcon(node: any, icons: any): void
|
||||
setNodeHyperlink(node: any, link: any, title?: string): void
|
||||
setNodeNote(node: any, note: any): void
|
||||
setNodeTag(node: any, tag: any): void
|
||||
addGeneralization(data: any): void
|
||||
removeGeneralization(): void
|
||||
setNodeCustomPosition(node: any, left?: any, top?: any): void
|
||||
resetLayout(): void
|
||||
setNodeShape(node: any, shape: any): void
|
||||
goTargetNode(node: any, callback?: () => void): void
|
||||
registerShortcutKeys(): void
|
||||
insertNodeWrap: () => void
|
||||
toggleActiveExpand(): void
|
||||
removeNodeWrap: () => void
|
||||
copy(): void
|
||||
cut(): void
|
||||
startTextEdit(): void
|
||||
endTextEdit(): void
|
||||
render(callback: () => void, source: any): void
|
||||
clearActive(): void
|
||||
addActiveNode(node: any): void
|
||||
removeActiveNode(node: any): void
|
||||
findActiveNodeIndex(node: any): number
|
||||
getNodeIndex(node: any): any
|
||||
formatAppointNodes(appointNodes: any): any[]
|
||||
setCoptyDataToClipboard(data: any): void
|
||||
paste(): void
|
||||
onPaste(): Promise<void>
|
||||
removeOneNode(node: any): void
|
||||
copyNode(): any
|
||||
toggleNodeExpand(node: any): void
|
||||
setNodeDataRender(node: any, data: any, notRender?: boolean): void
|
||||
moveNodeToCenter(node: any): void
|
||||
expandToNodeUid(uid: any, callback?: () => void): void
|
||||
findNodeByUid(uid: any): any
|
||||
constructor(opt?: {});
|
||||
opt: {};
|
||||
mindMap: any;
|
||||
themeConfig: any;
|
||||
renderTree: any;
|
||||
reRender: boolean;
|
||||
isRendering: boolean;
|
||||
hasWaitRendering: boolean;
|
||||
waitRenderingParams: any[];
|
||||
nodeCache: {};
|
||||
lastNodeCache: {};
|
||||
renderSource: string;
|
||||
activeNodeList: any[];
|
||||
root: any;
|
||||
textEdit: TextEdit;
|
||||
lastBeingCopyData: any;
|
||||
beingCopyData: any;
|
||||
beingPasteText: string;
|
||||
beingPasteImgSize: number;
|
||||
currentBeingPasteType: string;
|
||||
setLayout(): void;
|
||||
layout: MindMap | CatalogOrganization | OrganizationStructure | Timeline | VerticalTimeline;
|
||||
setData(data: any): void;
|
||||
bindEvent(): void;
|
||||
registerCommands(): void;
|
||||
selectAll(): void;
|
||||
back(step: any): void;
|
||||
forward(step: any): void;
|
||||
insertNode(openEdit?: boolean, appointNodes?: any[], appointData?: any, appointChildren?: any[]): void;
|
||||
insertMultiNode(appointNodes: any, nodeList: any): void;
|
||||
insertChildNode(openEdit?: boolean, appointNodes?: any[], appointData?: any, appointChildren?: any[]): void;
|
||||
insertMultiChildNode(appointNodes: any, childList: any): void;
|
||||
insertParentNode(openEdit: boolean, appointNodes: any, appointData: any): void;
|
||||
upNode(): void;
|
||||
downNode(): void;
|
||||
insertAfter(node: any, exist: any): void;
|
||||
insertBefore(node: any, exist: any): void;
|
||||
moveNodeTo(node: any, toNode: any): void;
|
||||
removeNode(appointNodes?: any[]): void;
|
||||
removeCurrentNode(appointNodes?: any[]): void;
|
||||
pasteNode(data: any): void;
|
||||
cutNode(callback: any): void;
|
||||
setNodeStyle(node: any, prop: any, value: any): void;
|
||||
setNodeStyles(node: any, style: any): void;
|
||||
setNodeActive(node: any, active: any): void;
|
||||
clearActiveNode(): void;
|
||||
setNodeExpand(node: any, expand: any): void;
|
||||
expandAllNode(): void;
|
||||
unexpandAllNode(): void;
|
||||
expandToLevel(level: any): void;
|
||||
setNodeData(node: any, data: any): void;
|
||||
setNodeText(node: any, text: any, richText: any, resetRichText: any): void;
|
||||
setNodeImage(node: any, data: any): void;
|
||||
setNodeIcon(node: any, icons: any): void;
|
||||
setNodeHyperlink(node: any, link: any, title?: string): void;
|
||||
setNodeNote(node: any, note: any): void;
|
||||
setNodeTag(node: any, tag: any): void;
|
||||
insertFormula(formula: any, appointNodes?: any[]): void;
|
||||
addGeneralization(data: any): void;
|
||||
removeGeneralization(): void;
|
||||
setNodeCustomPosition(node: any, left?: any, top?: any): void;
|
||||
resetLayout(): void;
|
||||
setNodeShape(node: any, shape: any): void;
|
||||
goTargetNode(node: any, callback?: () => void): void;
|
||||
registerShortcutKeys(): void;
|
||||
toggleActiveExpand(): void;
|
||||
clearActiveNodeListOnDrawClick(e: any, eventType: any): void;
|
||||
startTextEdit(): void;
|
||||
endTextEdit(): void;
|
||||
render(callback: () => void, source: any): void;
|
||||
clearActiveNodeList(): void;
|
||||
addNodeToActiveList(node: any): void;
|
||||
removeNodeFromActiveList(node: any): void;
|
||||
findActiveNodeIndex(node: any): any;
|
||||
backForward(type: any, step: any): void;
|
||||
copy(): void;
|
||||
cut(): void;
|
||||
paste(): void;
|
||||
onPaste(): Promise<void>;
|
||||
insertTo(node: any, exist: any, dir?: string): void;
|
||||
checkNodeLayerChange(node: any, toNode: any): void;
|
||||
getNextActiveNode(): any;
|
||||
copyNode(): any;
|
||||
toggleNodeExpand(node: any): void;
|
||||
setNodeDataRender(node: any, data: any, notRender?: boolean): void;
|
||||
moveNodeToCenter(node: any): void;
|
||||
setRootNodeCenter(): void;
|
||||
expandToNodeUid(uid: any, callback?: () => void): void;
|
||||
findNodeByUid(uid: any): any;
|
||||
emitNodeActiveEvent(): void;
|
||||
}
|
||||
import TextEdit from './TextEdit'
|
||||
import MindMap from '../../layouts/MindMap'
|
||||
import CatalogOrganization from '../../layouts/CatalogOrganization'
|
||||
import OrganizationStructure from '../../layouts/OrganizationStructure'
|
||||
import Timeline from '../../layouts/Timeline'
|
||||
import VerticalTimeline from '../../layouts/VerticalTimeline'
|
||||
import TextEdit from "./TextEdit";
|
||||
import MindMap from "../../layouts/MindMap";
|
||||
import CatalogOrganization from "../../layouts/CatalogOrganization";
|
||||
import OrganizationStructure from "../../layouts/OrganizationStructure";
|
||||
import Timeline from "../../layouts/Timeline";
|
||||
import VerticalTimeline from "../../layouts/VerticalTimeline";
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
export default class TextEdit {
|
||||
constructor(renderer: any)
|
||||
renderer: any
|
||||
mindMap: any
|
||||
currentNode: any
|
||||
textEditNode: HTMLDivElement
|
||||
showTextEdit: boolean
|
||||
cacheEditingText: string
|
||||
bindEvent(): void
|
||||
show(
|
||||
node: any,
|
||||
e: any,
|
||||
isInserting?: boolean,
|
||||
isFromKeyDown?: boolean
|
||||
): Promise<void>
|
||||
onScale(): void
|
||||
checkIsAutoEnterTextEditKey(e: any): boolean
|
||||
registerTmpShortcut(): void
|
||||
showEditTextBox(
|
||||
node: any,
|
||||
rect: any,
|
||||
isInserting: any,
|
||||
isFromKeyDown: any
|
||||
): void
|
||||
focus(): void
|
||||
selectNodeText(): void
|
||||
getEditText(): any
|
||||
hideEditTextBox(): any
|
||||
constructor(renderer: any);
|
||||
renderer: any;
|
||||
mindMap: any;
|
||||
currentNode: any;
|
||||
textEditNode: HTMLDivElement;
|
||||
showTextEdit: boolean;
|
||||
cacheEditingText: string;
|
||||
bindEvent(): void;
|
||||
show(node: any, e: any, isInserting?: boolean, isFromKeyDown?: boolean): Promise<void>;
|
||||
onScale(): void;
|
||||
checkIsAutoEnterTextEditKey(e: any): boolean;
|
||||
registerTmpShortcut(): void;
|
||||
showEditTextBox(node: any, rect: any, isInserting: any, isFromKeyDown: any): void;
|
||||
getEditText(): any;
|
||||
hideEditTextBox(): any;
|
||||
}
|
||||
|
||||
235
simple-mind-map/types/src/core/render/node/Node.d.ts
vendored
235
simple-mind-map/types/src/core/render/node/Node.d.ts
vendored
@@ -1,116 +1,123 @@
|
||||
export default Node
|
||||
export default Node;
|
||||
declare class Node {
|
||||
constructor(opt?: {})
|
||||
nodeData: any
|
||||
uid: any
|
||||
mindMap: any
|
||||
renderer: any
|
||||
draw: any
|
||||
style: Style
|
||||
shapeInstance: Shape
|
||||
shapePadding: {
|
||||
paddingX: number
|
||||
paddingY: number
|
||||
}
|
||||
isRoot: any
|
||||
isGeneralization: any
|
||||
generalizationBelongNode: any
|
||||
layerIndex: any
|
||||
width: any
|
||||
height: any
|
||||
_left: any
|
||||
_top: any
|
||||
customLeft: any
|
||||
customTop: any
|
||||
isDrag: boolean
|
||||
parent: any
|
||||
children: any
|
||||
group: any
|
||||
shapeNode: any
|
||||
hoverNode: any
|
||||
_customNodeContent: any
|
||||
_imgData: any
|
||||
_iconData: any
|
||||
_textData: any
|
||||
_hyperlinkData: any
|
||||
_tagData: any
|
||||
_noteData: any
|
||||
noteEl: any
|
||||
_expandBtn: any
|
||||
_lastExpandBtnType: any
|
||||
_showExpandBtn: boolean
|
||||
_openExpandNode: any
|
||||
_closeExpandNode: any
|
||||
_fillExpandNode: any
|
||||
_lines: any[]
|
||||
_generalizationLine: any
|
||||
_generalizationNode: any
|
||||
_unVisibleRectRegionNode: any
|
||||
_isMouseenter: boolean
|
||||
_rectInfo: {
|
||||
imgContentWidth: number
|
||||
imgContentHeight: number
|
||||
textContentWidth: number
|
||||
textContentHeight: number
|
||||
}
|
||||
_generalizationNodeWidth: number
|
||||
_generalizationNodeHeight: number
|
||||
textContentItemMargin: any
|
||||
blockContentMargin: any
|
||||
expandBtnSize: any
|
||||
isMultipleChoice: boolean
|
||||
needLayout: boolean
|
||||
isHide: boolean
|
||||
set left(arg: any)
|
||||
get left(): any
|
||||
set top(arg: any)
|
||||
get top(): any
|
||||
reset(): void
|
||||
handleData(data: any): any
|
||||
createNodeData(): void
|
||||
getSize(): boolean
|
||||
getNodeRect(): {
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
layout(): void
|
||||
bindGroupEvent(): void
|
||||
active(e: any): void
|
||||
update(): void
|
||||
getNodePosInClient(
|
||||
_left: any,
|
||||
_top: any
|
||||
): {
|
||||
left: any
|
||||
top: any
|
||||
}
|
||||
reRender(): boolean
|
||||
updateNodeActive(): void
|
||||
render(callback?: () => void): void
|
||||
remove(): void
|
||||
destroy(): void
|
||||
hide(): void
|
||||
show(): void
|
||||
renderLine(deep?: boolean): void
|
||||
getShape(): any
|
||||
hasCustomPosition(): boolean
|
||||
ancestorHasCustomPosition(): boolean
|
||||
addChildren(node: any): void
|
||||
styleLine(line: any, node: any): void
|
||||
removeLine(): void
|
||||
isParent(node: any): boolean
|
||||
isBrother(node: any): any
|
||||
getPaddingVale(): {
|
||||
paddingX: any
|
||||
paddingY: any
|
||||
}
|
||||
getStyle(prop: any, root: any): any
|
||||
getSelfStyle(prop: any): any
|
||||
getParentSelfStyle(prop: any): any
|
||||
getSelfInhertStyle(prop: any): any
|
||||
getBorderWidth(): any
|
||||
getData(key: any): any
|
||||
hasCustomStyle(): boolean
|
||||
constructor(opt?: {});
|
||||
nodeData: any;
|
||||
uid: any;
|
||||
mindMap: any;
|
||||
renderer: any;
|
||||
draw: any;
|
||||
nodeDraw: any;
|
||||
lineDraw: any;
|
||||
style: Style;
|
||||
shapeInstance: Shape;
|
||||
shapePadding: {
|
||||
paddingX: number;
|
||||
paddingY: number;
|
||||
};
|
||||
isRoot: any;
|
||||
isGeneralization: any;
|
||||
generalizationBelongNode: any;
|
||||
layerIndex: any;
|
||||
width: any;
|
||||
height: any;
|
||||
_left: any;
|
||||
_top: any;
|
||||
customLeft: any;
|
||||
customTop: any;
|
||||
isDrag: boolean;
|
||||
parent: any;
|
||||
children: any;
|
||||
userList: any[];
|
||||
group: any;
|
||||
shapeNode: any;
|
||||
hoverNode: any;
|
||||
_customNodeContent: any;
|
||||
_imgData: any;
|
||||
_iconData: any;
|
||||
_textData: any;
|
||||
_hyperlinkData: any;
|
||||
_tagData: any;
|
||||
_noteData: any;
|
||||
noteEl: any;
|
||||
_expandBtn: any;
|
||||
_lastExpandBtnType: any;
|
||||
_showExpandBtn: boolean;
|
||||
_openExpandNode: any;
|
||||
_closeExpandNode: any;
|
||||
_fillExpandNode: any;
|
||||
_userListGroup: any;
|
||||
_lines: any[];
|
||||
_generalizationLine: any;
|
||||
_generalizationNode: any;
|
||||
_unVisibleRectRegionNode: any;
|
||||
_isMouseenter: boolean;
|
||||
_rectInfo: {
|
||||
imgContentWidth: number;
|
||||
imgContentHeight: number;
|
||||
textContentWidth: number;
|
||||
textContentHeight: number;
|
||||
};
|
||||
_generalizationNodeWidth: number;
|
||||
_generalizationNodeHeight: number;
|
||||
textContentItemMargin: any;
|
||||
blockContentMargin: any;
|
||||
expandBtnSize: any;
|
||||
isMultipleChoice: boolean;
|
||||
needLayout: boolean;
|
||||
isHide: boolean;
|
||||
set left(arg: any);
|
||||
get left(): any;
|
||||
set top(arg: any);
|
||||
get top(): any;
|
||||
reset(): void;
|
||||
handleData(data: any): any;
|
||||
createNodeData(): void;
|
||||
getSize(): boolean;
|
||||
getNodeRect(): {
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
layout(): void;
|
||||
bindGroupEvent(): void;
|
||||
active(e: any): void;
|
||||
update(): void;
|
||||
getNodePosInClient(_left: any, _top: any): {
|
||||
left: any;
|
||||
top: any;
|
||||
};
|
||||
reRender(): boolean;
|
||||
updateNodeActiveClass(): void;
|
||||
updateNodeByActive(active: any): void;
|
||||
render(callback?: () => void): void;
|
||||
remove(): void;
|
||||
destroy(): void;
|
||||
hide(): void;
|
||||
show(): void;
|
||||
setOpacity(val: any): void;
|
||||
hideChildren(): void;
|
||||
showChildren(): void;
|
||||
startDrag(): void;
|
||||
endDrag(): void;
|
||||
renderLine(deep?: boolean): void;
|
||||
getShape(): any;
|
||||
hasCustomPosition(): boolean;
|
||||
ancestorHasCustomPosition(): boolean;
|
||||
addChildren(node: any): void;
|
||||
styleLine(line: any, node: any): void;
|
||||
removeLine(): void;
|
||||
isParent(node: any): boolean;
|
||||
isBrother(node: any): any;
|
||||
getPaddingVale(): {
|
||||
paddingX: any;
|
||||
paddingY: any;
|
||||
};
|
||||
getStyle(prop: any, root: any): any;
|
||||
getSelfStyle(prop: any): any;
|
||||
getParentSelfStyle(prop: any): any;
|
||||
getSelfInhertStyle(prop: any): any;
|
||||
getBorderWidth(): any;
|
||||
getData(key: any): any;
|
||||
hasCustomStyle(): boolean;
|
||||
}
|
||||
import Style from './Style'
|
||||
import Shape from './Shape'
|
||||
import Style from "./Style";
|
||||
import Shape from "./Shape";
|
||||
|
||||
@@ -1,28 +1,23 @@
|
||||
export default class Shape {
|
||||
constructor(node: any)
|
||||
node: any
|
||||
getShapePadding(
|
||||
width: any,
|
||||
height: any,
|
||||
paddingX: any,
|
||||
paddingY: any
|
||||
): {
|
||||
paddingX: number
|
||||
paddingY: number
|
||||
}
|
||||
createShape(): any
|
||||
getNodeSize(): {
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
createRect(): any
|
||||
createDiamond(): any
|
||||
createParallelogram(): any
|
||||
createRoundedRectangle(): any
|
||||
createOctagonalRectangle(): any
|
||||
createOuterTriangularRectangle(): any
|
||||
createInnerTriangularRectangle(): any
|
||||
createEllipse(): any
|
||||
createCircle(): any
|
||||
constructor(node: any);
|
||||
node: any;
|
||||
getShapePadding(width: any, height: any, paddingX: any, paddingY: any): {
|
||||
paddingX: number;
|
||||
paddingY: number;
|
||||
};
|
||||
createShape(): any;
|
||||
getNodeSize(): {
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
createRect(): any;
|
||||
createDiamond(): any;
|
||||
createParallelogram(): any;
|
||||
createRoundedRectangle(): any;
|
||||
createOctagonalRectangle(): any;
|
||||
createOuterTriangularRectangle(): any;
|
||||
createInnerTriangularRectangle(): any;
|
||||
createEllipse(): any;
|
||||
createCircle(): any;
|
||||
}
|
||||
export const shapeList: string[]
|
||||
export const shapeList: string[];
|
||||
|
||||
@@ -1,43 +1,36 @@
|
||||
export default Style
|
||||
export default Style;
|
||||
declare class Style {
|
||||
static setBackgroundStyle(el: any, themeConfig: any): void
|
||||
static removeBackgroundStyle(el: any): void
|
||||
constructor(ctx: any)
|
||||
ctx: any
|
||||
merge(prop: any, root: any): any
|
||||
getStyle(prop: any, root: any): any
|
||||
getSelfStyle(prop: any): any
|
||||
rect(node: any): void
|
||||
shape(node: any): void
|
||||
text(node: any): void
|
||||
createStyleText(): string
|
||||
getTextFontStyle(): {
|
||||
italic: boolean
|
||||
bold: any
|
||||
fontSize: any
|
||||
fontFamily: any
|
||||
}
|
||||
domText(node: any, fontSizeScale: number, isMultiLine: any): void
|
||||
tagText(node: any, index: any): void
|
||||
tagRect(node: any, index: any): void
|
||||
iconNode(node: any): void
|
||||
line(
|
||||
node: any,
|
||||
{
|
||||
width,
|
||||
color,
|
||||
dasharray
|
||||
}?: {
|
||||
width: any
|
||||
color: any
|
||||
dasharray: any
|
||||
}
|
||||
): void
|
||||
generalizationLine(node: any): void
|
||||
iconBtn(node: any, node2: any, fillNode: any): void
|
||||
hasCustomStyle(): boolean
|
||||
hoverNode(node: any): void
|
||||
static setBackgroundStyle(el: any, themeConfig: any): void;
|
||||
static removeBackgroundStyle(el: any): void;
|
||||
constructor(ctx: any);
|
||||
ctx: any;
|
||||
merge(prop: any, root: any): any;
|
||||
getStyle(prop: any, root: any): any;
|
||||
getSelfStyle(prop: any): any;
|
||||
rect(node: any): void;
|
||||
shape(node: any): void;
|
||||
text(node: any): void;
|
||||
createStyleText(): string;
|
||||
getTextFontStyle(): {
|
||||
italic: boolean;
|
||||
bold: any;
|
||||
fontSize: any;
|
||||
fontFamily: any;
|
||||
};
|
||||
domText(node: any, fontSizeScale: number, isMultiLine: any): void;
|
||||
tagText(node: any): void;
|
||||
tagRect(node: any, text: any, color: any): void;
|
||||
iconNode(node: any): void;
|
||||
line(node: any, { width, color, dasharray }?: {
|
||||
width: any;
|
||||
color: any;
|
||||
dasharray: any;
|
||||
}): void;
|
||||
generalizationLine(node: any): void;
|
||||
iconBtn(node: any, node2: any, fillNode: any): void;
|
||||
hasCustomStyle(): boolean;
|
||||
hoverNode(node: any): void;
|
||||
}
|
||||
declare namespace Style {
|
||||
let cacheStyle: any
|
||||
const cacheStyle: any;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
declare namespace _default {
|
||||
export { setData }
|
||||
export { setText }
|
||||
export { setImage }
|
||||
export { setIcon }
|
||||
export { setHyperlink }
|
||||
export { setNote }
|
||||
export { setTag }
|
||||
export { setShape }
|
||||
export { setStyle }
|
||||
export { setStyles }
|
||||
export { setData };
|
||||
export { setText };
|
||||
export { setImage };
|
||||
export { setIcon };
|
||||
export { setHyperlink };
|
||||
export { setNote };
|
||||
export { setTag };
|
||||
export { setShape };
|
||||
export { setStyle };
|
||||
export { setStyles };
|
||||
}
|
||||
export default _default
|
||||
declare function setData(data?: {}): void
|
||||
declare function setText(text: any, richText: any, resetRichText: any): void
|
||||
declare function setImage(imgData: any): void
|
||||
declare function setIcon(icons: any): void
|
||||
declare function setHyperlink(link: any, title: any): void
|
||||
declare function setNote(note: any): void
|
||||
declare function setTag(tag: any): void
|
||||
declare function setShape(shape: any): void
|
||||
declare function setStyle(prop: any, value: any): void
|
||||
declare function setStyles(style: any): void
|
||||
export default _default;
|
||||
declare function setData(data?: {}): void;
|
||||
declare function setText(text: any, richText: any, resetRichText: any): void;
|
||||
declare function setImage(imgData: any): void;
|
||||
declare function setIcon(icons: any): void;
|
||||
declare function setHyperlink(link: any, title: any): void;
|
||||
declare function setNote(note: any): void;
|
||||
declare function setTag(tag: any): void;
|
||||
declare function setShape(shape: any): void;
|
||||
declare function setStyle(prop: any, value: any): void;
|
||||
declare function setStyles(style: any): void;
|
||||
|
||||
18
simple-mind-map/types/src/core/render/node/nodeCooperate.d.ts
vendored
Normal file
18
simple-mind-map/types/src/core/render/node/nodeCooperate.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
declare namespace _default {
|
||||
export { createUserListNode };
|
||||
export { updateUserListNode };
|
||||
export { createTextAvatar };
|
||||
export { createImageAvatar };
|
||||
export { addUser };
|
||||
export { removeUser };
|
||||
}
|
||||
export default _default;
|
||||
declare function createUserListNode(): void;
|
||||
declare class createUserListNode {
|
||||
_userListGroup: any;
|
||||
}
|
||||
declare function updateUserListNode(): void;
|
||||
declare function createTextAvatar(item: any): any;
|
||||
declare function createImageAvatar(item: any): any;
|
||||
declare function addUser(userInfo: any): void;
|
||||
declare function removeUser(userInfo: any): void;
|
||||
@@ -1,45 +1,45 @@
|
||||
declare namespace _default {
|
||||
export { createImgNode }
|
||||
export { getImgShowSize }
|
||||
export { createIconNode }
|
||||
export { createRichTextNode }
|
||||
export { createTextNode }
|
||||
export { createHyperlinkNode }
|
||||
export { createTagNode }
|
||||
export { createNoteNode }
|
||||
export { measureCustomNodeContentSize }
|
||||
export { isUseCustomNodeContent }
|
||||
export { createImgNode };
|
||||
export { getImgShowSize };
|
||||
export { createIconNode };
|
||||
export { createRichTextNode };
|
||||
export { createTextNode };
|
||||
export { createHyperlinkNode };
|
||||
export { createTagNode };
|
||||
export { createNoteNode };
|
||||
export { measureCustomNodeContentSize };
|
||||
export { isUseCustomNodeContent };
|
||||
}
|
||||
export default _default
|
||||
export default _default;
|
||||
declare function createImgNode(): {
|
||||
node: any
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
declare function getImgShowSize(): any
|
||||
declare function createIconNode(): any
|
||||
node: any;
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
declare function getImgShowSize(): any;
|
||||
declare function createIconNode(): any;
|
||||
declare function createRichTextNode(): {
|
||||
node: any
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
declare function createTextNode(): any
|
||||
node: any;
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
declare function createTextNode(): any;
|
||||
declare function createHyperlinkNode(): {
|
||||
node: any
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
declare function createTagNode(): any[]
|
||||
node: any;
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
declare function createTagNode(): any[];
|
||||
declare function createNoteNode(): {
|
||||
node: any
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
node: any;
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
declare class createNoteNode {
|
||||
noteEl: HTMLDivElement
|
||||
noteEl: HTMLDivElement;
|
||||
}
|
||||
declare function measureCustomNodeContentSize(content: any): {
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
declare function isUseCustomNodeContent(): boolean
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
declare function isUseCustomNodeContent(): boolean;
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
declare namespace _default {
|
||||
export { createExpandNodeContent }
|
||||
export { updateExpandBtnNode }
|
||||
export { updateExpandBtnPos }
|
||||
export { renderExpandBtn }
|
||||
export { removeExpandBtn }
|
||||
export { showExpandBtn }
|
||||
export { hideExpandBtn }
|
||||
export { sumNode }
|
||||
export { createExpandNodeContent };
|
||||
export { updateExpandBtnNode };
|
||||
export { updateExpandBtnPos };
|
||||
export { renderExpandBtn };
|
||||
export { removeExpandBtn };
|
||||
export { showExpandBtn };
|
||||
export { hideExpandBtn };
|
||||
export { sumNode };
|
||||
}
|
||||
export default _default
|
||||
declare function createExpandNodeContent(): void
|
||||
export default _default;
|
||||
declare function createExpandNodeContent(): void;
|
||||
declare class createExpandNodeContent {
|
||||
_openExpandNode: any
|
||||
_closeExpandNode: any
|
||||
_fillExpandNode: any
|
||||
_openExpandNode: any;
|
||||
_closeExpandNode: any;
|
||||
_fillExpandNode: any;
|
||||
}
|
||||
declare function updateExpandBtnNode(): void
|
||||
declare function updateExpandBtnNode(): void;
|
||||
declare class updateExpandBtnNode {
|
||||
_lastExpandBtnType: boolean
|
||||
_lastExpandBtnType: boolean;
|
||||
}
|
||||
declare function updateExpandBtnPos(): void
|
||||
declare function renderExpandBtn(): void
|
||||
declare function updateExpandBtnPos(): void;
|
||||
declare function renderExpandBtn(): void;
|
||||
declare class renderExpandBtn {
|
||||
_expandBtn: any
|
||||
_showExpandBtn: boolean
|
||||
_expandBtn: any;
|
||||
_showExpandBtn: boolean;
|
||||
}
|
||||
declare function removeExpandBtn(): void
|
||||
declare function removeExpandBtn(): void;
|
||||
declare class removeExpandBtn {
|
||||
_showExpandBtn: boolean
|
||||
_showExpandBtn: boolean;
|
||||
}
|
||||
declare function showExpandBtn(): void
|
||||
declare function hideExpandBtn(): void
|
||||
declare function sumNode(data?: any[]): any
|
||||
declare function showExpandBtn(): void;
|
||||
declare function hideExpandBtn(): void;
|
||||
declare function sumNode(data?: any[]): any;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
declare namespace _default {
|
||||
export { renderExpandBtnPlaceholderRect }
|
||||
export { clearExpandBtnPlaceholderRect }
|
||||
export { updateExpandBtnPlaceholderRect }
|
||||
export { renderExpandBtnPlaceholderRect };
|
||||
export { clearExpandBtnPlaceholderRect };
|
||||
export { updateExpandBtnPlaceholderRect };
|
||||
}
|
||||
export default _default
|
||||
declare function renderExpandBtnPlaceholderRect(): void
|
||||
export default _default;
|
||||
declare function renderExpandBtnPlaceholderRect(): void;
|
||||
declare class renderExpandBtnPlaceholderRect {
|
||||
_unVisibleRectRegionNode: any
|
||||
_unVisibleRectRegionNode: any;
|
||||
}
|
||||
declare function clearExpandBtnPlaceholderRect(): void
|
||||
declare function clearExpandBtnPlaceholderRect(): void;
|
||||
declare class clearExpandBtnPlaceholderRect {
|
||||
_unVisibleRectRegionNode: any
|
||||
_unVisibleRectRegionNode: any;
|
||||
}
|
||||
declare function updateExpandBtnPlaceholderRect(): void
|
||||
declare function updateExpandBtnPlaceholderRect(): void;
|
||||
declare class updateExpandBtnPlaceholderRect {
|
||||
needRerenderExpandBtnPlaceholderRect: boolean
|
||||
needRerenderExpandBtnPlaceholderRect: boolean;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
declare namespace _default {
|
||||
export { checkHasGeneralization }
|
||||
export { createGeneralizationNode }
|
||||
export { updateGeneralization }
|
||||
export { renderGeneralization }
|
||||
export { removeGeneralization }
|
||||
export { hideGeneralization }
|
||||
export { showGeneralization }
|
||||
export { checkHasGeneralization };
|
||||
export { createGeneralizationNode };
|
||||
export { updateGeneralization };
|
||||
export { renderGeneralization };
|
||||
export { removeGeneralization };
|
||||
export { hideGeneralization };
|
||||
export { showGeneralization };
|
||||
}
|
||||
export default _default
|
||||
declare function checkHasGeneralization(): boolean
|
||||
declare function createGeneralizationNode(): void
|
||||
export default _default;
|
||||
declare function checkHasGeneralization(): boolean;
|
||||
declare function createGeneralizationNode(): void;
|
||||
declare class createGeneralizationNode {
|
||||
_generalizationLine: any
|
||||
_generalizationNode: Node
|
||||
_generalizationNodeWidth: any
|
||||
_generalizationNodeHeight: any
|
||||
_generalizationLine: any;
|
||||
_generalizationNode: Node;
|
||||
_generalizationNodeWidth: any;
|
||||
_generalizationNodeHeight: any;
|
||||
}
|
||||
declare function updateGeneralization(): void
|
||||
declare function renderGeneralization(): void
|
||||
declare function updateGeneralization(): void;
|
||||
declare function renderGeneralization(): void;
|
||||
declare class renderGeneralization {
|
||||
_generalizationNodeWidth: number
|
||||
_generalizationNodeHeight: number
|
||||
_generalizationNodeWidth: number;
|
||||
_generalizationNodeHeight: number;
|
||||
}
|
||||
declare function removeGeneralization(): void
|
||||
declare function removeGeneralization(): void;
|
||||
declare class removeGeneralization {
|
||||
_generalizationLine: any
|
||||
_generalizationNode: any
|
||||
_generalizationLine: any;
|
||||
_generalizationNode: any;
|
||||
}
|
||||
declare function hideGeneralization(): void
|
||||
declare function showGeneralization(): void
|
||||
import Node from './Node'
|
||||
declare function hideGeneralization(): void;
|
||||
declare function showGeneralization(): void;
|
||||
import Node from "./Node";
|
||||
|
||||
68
simple-mind-map/types/src/core/view/View.d.ts
vendored
68
simple-mind-map/types/src/core/view/View.d.ts
vendored
@@ -1,36 +1,36 @@
|
||||
export default View
|
||||
export default View;
|
||||
declare class View {
|
||||
constructor(opt?: {})
|
||||
opt: {}
|
||||
mindMap: any
|
||||
scale: number
|
||||
sx: number
|
||||
sy: number
|
||||
x: number
|
||||
y: number
|
||||
firstDrag: boolean
|
||||
bind(): void
|
||||
getTransformData(): {
|
||||
transform: any
|
||||
state: {
|
||||
scale: number
|
||||
x: number
|
||||
y: number
|
||||
sx: number
|
||||
sy: number
|
||||
}
|
||||
}
|
||||
setTransformData(viewData: any): void
|
||||
translateXY(x: any, y: any): void
|
||||
translateX(step: any): void
|
||||
translateXTo(x: any): void
|
||||
translateY(step: any): void
|
||||
translateYTo(y: any): void
|
||||
transform(): void
|
||||
reset(): void
|
||||
narrow(cx: any, cy: any, isTouchPad: any): void
|
||||
enlarge(cx: any, cy: any, isTouchPad: any): void
|
||||
scaleInCenter(scale: any, cx: any, cy: any): void
|
||||
setScale(scale: any, cx: any, cy: any): void
|
||||
fit(): void
|
||||
constructor(opt?: {});
|
||||
opt: {};
|
||||
mindMap: any;
|
||||
scale: number;
|
||||
sx: number;
|
||||
sy: number;
|
||||
x: number;
|
||||
y: number;
|
||||
firstDrag: boolean;
|
||||
bind(): void;
|
||||
getTransformData(): {
|
||||
transform: any;
|
||||
state: {
|
||||
scale: number;
|
||||
x: number;
|
||||
y: number;
|
||||
sx: number;
|
||||
sy: number;
|
||||
};
|
||||
};
|
||||
setTransformData(viewData: any): void;
|
||||
translateXY(x: any, y: any): void;
|
||||
translateX(step: any): void;
|
||||
translateXTo(x: any): void;
|
||||
translateY(step: any): void;
|
||||
translateYTo(y: any): void;
|
||||
transform(): void;
|
||||
reset(): void;
|
||||
narrow(cx: any, cy: any, isTouchPad: any): void;
|
||||
enlarge(cx: any, cy: any, isTouchPad: any): void;
|
||||
scaleInCenter(scale: any, cx: any, cy: any): void;
|
||||
setScale(scale: any, cx: any, cy: any): void;
|
||||
fit(): void;
|
||||
}
|
||||
|
||||
86
simple-mind-map/types/src/layouts/Base.d.ts
vendored
86
simple-mind-map/types/src/layouts/Base.d.ts
vendored
@@ -1,46 +1,44 @@
|
||||
export default Base
|
||||
export default Base;
|
||||
declare class Base {
|
||||
constructor(renderer: any)
|
||||
renderer: any
|
||||
mindMap: any
|
||||
draw: any
|
||||
root: any
|
||||
lru: Lru
|
||||
doLayout(): void
|
||||
renderLine(): void
|
||||
renderExpandBtn(): void
|
||||
renderGeneralization(): void
|
||||
cacheNode(uid: any, node: any): void
|
||||
checkIsNeedResizeSources(): boolean
|
||||
checkIsLayerTypeChange(oldIndex: any, newIndex: any): boolean
|
||||
checkIsLayoutChangeRerenderExpandBtnPlaceholderRect(node: any): void
|
||||
createNode(data: any, parent: any, isRoot: any, layerIndex: any): any
|
||||
formatPosition(value: any, size: any, nodeSize: any): number
|
||||
setNodeCenter(node: any): void
|
||||
updateChildren(children: any, prop: any, offset: any): void
|
||||
updateChildrenPro(children: any, props: any): void
|
||||
getNodeAreaWidth(node: any, withGeneralization?: boolean): number
|
||||
quadraticCurvePath(x1: any, y1: any, x2: any, y2: any): string
|
||||
cubicBezierPath(x1: any, y1: any, x2: any, y2: any): string
|
||||
getMarginX(layerIndex: any): any
|
||||
getMarginY(layerIndex: any): any
|
||||
getNodeWidthWithGeneralization(node: any): number
|
||||
getNodeHeightWithGeneralization(node: any): number
|
||||
/**
|
||||
* dir:生长方向,h(水平)、v(垂直)
|
||||
* isLeft:是否向左生长
|
||||
*/
|
||||
getNodeBoundaries(
|
||||
node: any,
|
||||
dir: any
|
||||
): {
|
||||
left: any
|
||||
right: any
|
||||
top: any
|
||||
bottom: any
|
||||
generalizationLineMargin: any
|
||||
generalizationNodeMargin: any
|
||||
}
|
||||
getNodeActChildrenLength(node: any): any
|
||||
constructor(renderer: any);
|
||||
renderer: any;
|
||||
mindMap: any;
|
||||
draw: any;
|
||||
lineDraw: any;
|
||||
root: any;
|
||||
lru: Lru;
|
||||
doLayout(): void;
|
||||
renderLine(): void;
|
||||
renderExpandBtn(): void;
|
||||
renderGeneralization(): void;
|
||||
cacheNode(uid: any, node: any): void;
|
||||
checkIsNeedResizeSources(): boolean;
|
||||
checkIsLayerTypeChange(oldIndex: any, newIndex: any): boolean;
|
||||
checkIsLayoutChangeRerenderExpandBtnPlaceholderRect(node: any): void;
|
||||
createNode(data: any, parent: any, isRoot: any, layerIndex: any): any;
|
||||
formatPosition(value: any, size: any, nodeSize: any): number;
|
||||
setNodeCenter(node: any): void;
|
||||
updateChildren(children: any, prop: any, offset: any): void;
|
||||
updateChildrenPro(children: any, props: any): void;
|
||||
getNodeAreaWidth(node: any, withGeneralization?: boolean): number;
|
||||
quadraticCurvePath(x1: any, y1: any, x2: any, y2: any): string;
|
||||
cubicBezierPath(x1: any, y1: any, x2: any, y2: any): string;
|
||||
getMarginX(layerIndex: any): any;
|
||||
getMarginY(layerIndex: any): any;
|
||||
getNodeWidthWithGeneralization(node: any): number;
|
||||
getNodeHeightWithGeneralization(node: any): number;
|
||||
/**
|
||||
* dir:生长方向,h(水平)、v(垂直)
|
||||
* isLeft:是否向左生长
|
||||
*/
|
||||
getNodeBoundaries(node: any, dir: any): {
|
||||
left: any;
|
||||
right: any;
|
||||
top: any;
|
||||
bottom: any;
|
||||
generalizationLineMargin: any;
|
||||
generalizationNodeMargin: any;
|
||||
};
|
||||
getNodeActChildrenLength(node: any): any;
|
||||
}
|
||||
import Lru from '../utils/Lru'
|
||||
import Lru from "../utils/Lru";
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
export default CatalogOrganization
|
||||
export default CatalogOrganization;
|
||||
declare class CatalogOrganization extends Base {
|
||||
constructor(opt?: {})
|
||||
doLayout(callback: any): void
|
||||
computedBaseValue(): void
|
||||
computedLeftTopValue(): void
|
||||
adjustLeftTopValue(): void
|
||||
updateBrothersLeft(node: any, addWidth: any): void
|
||||
updateBrothersTop(node: any, addHeight: any): void
|
||||
renderLine(node: any, lines: any, style: any): any[]
|
||||
renderExpandBtn(node: any, btn: any): void
|
||||
renderGeneralization(node: any, gLine: any, gNode: any): void
|
||||
renderExpandBtnRect(
|
||||
rect: any,
|
||||
expandBtnSize: any,
|
||||
width: any,
|
||||
height: any,
|
||||
node: any
|
||||
): void
|
||||
constructor(opt?: {});
|
||||
computedBaseValue(): void;
|
||||
computedLeftTopValue(): void;
|
||||
adjustLeftTopValue(): void;
|
||||
updateBrothersLeft(node: any, addWidth: any): void;
|
||||
updateBrothersTop(node: any, addHeight: any): void;
|
||||
renderExpandBtnRect(rect: any, expandBtnSize: any, width: any, height: any, node: any): void;
|
||||
}
|
||||
import Base from './Base'
|
||||
import Base from "./Base";
|
||||
|
||||
36
simple-mind-map/types/src/layouts/Fishbone.d.ts
vendored
36
simple-mind-map/types/src/layouts/Fishbone.d.ts
vendored
@@ -1,25 +1,15 @@
|
||||
export default Fishbone
|
||||
export default Fishbone;
|
||||
declare class Fishbone extends Base {
|
||||
constructor(opt?: {})
|
||||
indent: number
|
||||
childIndent: number
|
||||
doLayout(callback: any): void
|
||||
computedBaseValue(): void
|
||||
computedLeftTopValue(): void
|
||||
adjustLeftTopValue(): void
|
||||
getNodeAreaHeight(node: any): number
|
||||
updateBrothersLeft(node: any): void
|
||||
updateBrothersTop(node: any, addHeight: any): void
|
||||
checkIsTop(node: any): boolean
|
||||
renderLine(node: any, lines: any, style: any): any[]
|
||||
renderExpandBtn(node: any, btn: any): void
|
||||
renderGeneralization(node: any, gLine: any, gNode: any): void
|
||||
renderExpandBtnRect(
|
||||
rect: any,
|
||||
expandBtnSize: any,
|
||||
width: any,
|
||||
height: any,
|
||||
node: any
|
||||
): void
|
||||
constructor(opt?: {});
|
||||
indent: number;
|
||||
childIndent: number;
|
||||
computedBaseValue(): void;
|
||||
computedLeftTopValue(): void;
|
||||
adjustLeftTopValue(): void;
|
||||
getNodeAreaHeight(node: any): number;
|
||||
updateBrothersLeft(node: any): void;
|
||||
updateBrothersTop(node: any, addHeight: any): void;
|
||||
checkIsTop(node: any): boolean;
|
||||
renderExpandBtnRect(rect: any, expandBtnSize: any, width: any, height: any, node: any): void;
|
||||
}
|
||||
import Base from './Base'
|
||||
import Base from "./Base";
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
export default LogicalStructure
|
||||
export default LogicalStructure;
|
||||
declare class LogicalStructure extends Base {
|
||||
constructor(opt?: {})
|
||||
doLayout(callback: any): void
|
||||
computedBaseValue(): void
|
||||
computedTopValue(): void
|
||||
adjustTopValue(): void
|
||||
updateBrothers(node: any, addHeight: any): void
|
||||
renderLine(node: any, lines: any, style: any, lineStyle: any): void
|
||||
renderLineStraight(node: any, lines: any, style: any): any[]
|
||||
renderLineDirect(node: any, lines: any, style: any): any[]
|
||||
renderLineCurve(node: any, lines: any, style: any): any[]
|
||||
renderExpandBtn(node: any, btn: any): void
|
||||
renderGeneralization(node: any, gLine: any, gNode: any): void
|
||||
renderExpandBtnRect(
|
||||
rect: any,
|
||||
expandBtnSize: any,
|
||||
width: any,
|
||||
height: any,
|
||||
node: any
|
||||
): void
|
||||
constructor(opt?: {});
|
||||
computedBaseValue(): void;
|
||||
computedTopValue(): void;
|
||||
adjustTopValue(): void;
|
||||
updateBrothers(node: any, addHeight: any): void;
|
||||
renderLineStraight(node: any, lines: any, style: any): any[];
|
||||
renderLineDirect(node: any, lines: any, style: any): any[];
|
||||
renderLineCurve(node: any, lines: any, style: any): any[];
|
||||
renderExpandBtnRect(rect: any, expandBtnSize: any, width: any, height: any, node: any): void;
|
||||
}
|
||||
import Base from './Base'
|
||||
import Base from "./Base";
|
||||
|
||||
32
simple-mind-map/types/src/layouts/MindMap.d.ts
vendored
32
simple-mind-map/types/src/layouts/MindMap.d.ts
vendored
@@ -1,23 +1,13 @@
|
||||
export default MindMap
|
||||
export default MindMap;
|
||||
declare class MindMap extends Base {
|
||||
constructor(opt?: {})
|
||||
doLayout(callback: any): void
|
||||
computedBaseValue(): void
|
||||
computedTopValue(): void
|
||||
adjustTopValue(): void
|
||||
updateBrothers(node: any, leftAddHeight: any, rightAddHeight: any): void
|
||||
renderLine(node: any, lines: any, style: any, lineStyle: any): void
|
||||
renderLineStraight(node: any, lines: any, style: any): any[]
|
||||
renderLineDirect(node: any, lines: any, style: any): any[]
|
||||
renderLineCurve(node: any, lines: any, style: any): any[]
|
||||
renderExpandBtn(node: any, btn: any): void
|
||||
renderGeneralization(node: any, gLine: any, gNode: any): void
|
||||
renderExpandBtnRect(
|
||||
rect: any,
|
||||
expandBtnSize: any,
|
||||
width: any,
|
||||
height: any,
|
||||
node: any
|
||||
): void
|
||||
constructor(opt?: {});
|
||||
computedBaseValue(): void;
|
||||
computedTopValue(): void;
|
||||
adjustTopValue(): void;
|
||||
updateBrothers(node: any, leftAddHeight: any, rightAddHeight: any): void;
|
||||
renderLineStraight(node: any, lines: any, style: any): any[];
|
||||
renderLineDirect(node: any, lines: any, style: any): any[];
|
||||
renderLineCurve(node: any, lines: any, style: any): any[];
|
||||
renderExpandBtnRect(rect: any, expandBtnSize: any, width: any, height: any, node: any): void;
|
||||
}
|
||||
import Base from './Base'
|
||||
import Base from "./Base";
|
||||
|
||||
@@ -1,22 +1,12 @@
|
||||
export default OrganizationStructure
|
||||
export default OrganizationStructure;
|
||||
declare class OrganizationStructure extends Base {
|
||||
constructor(opt?: {})
|
||||
doLayout(callback: any): void
|
||||
computedBaseValue(): void
|
||||
computedLeftValue(): void
|
||||
adjustLeftValue(): void
|
||||
updateBrothers(node: any, addWidth: any): void
|
||||
renderLine(node: any, lines: any, style: any, lineStyle: any): void
|
||||
renderLineDirect(node: any, lines: any, style: any): any[]
|
||||
renderLineStraight(node: any, lines: any, style: any): any[]
|
||||
renderExpandBtn(node: any, btn: any): void
|
||||
renderGeneralization(node: any, gLine: any, gNode: any): void
|
||||
renderExpandBtnRect(
|
||||
rect: any,
|
||||
expandBtnSize: any,
|
||||
width: any,
|
||||
height: any,
|
||||
node: any
|
||||
): void
|
||||
constructor(opt?: {});
|
||||
computedBaseValue(): void;
|
||||
computedLeftValue(): void;
|
||||
adjustLeftValue(): void;
|
||||
updateBrothers(node: any, addWidth: any): void;
|
||||
renderLineDirect(node: any, lines: any, style: any): any[];
|
||||
renderLineStraight(node: any, lines: any, style: any): any[];
|
||||
renderExpandBtnRect(rect: any, expandBtnSize: any, width: any, height: any, node: any): void;
|
||||
}
|
||||
import Base from './Base'
|
||||
import Base from "./Base";
|
||||
|
||||
32
simple-mind-map/types/src/layouts/Timeline.d.ts
vendored
32
simple-mind-map/types/src/layouts/Timeline.d.ts
vendored
@@ -1,23 +1,13 @@
|
||||
export default Timeline
|
||||
export default Timeline;
|
||||
declare class Timeline extends Base {
|
||||
constructor(opt: {}, layout: any)
|
||||
layout: any
|
||||
doLayout(callback: any): void
|
||||
computedBaseValue(): void
|
||||
computedLeftTopValue(): void
|
||||
adjustLeftTopValue(): void
|
||||
getNodeAreaHeight(node: any): number
|
||||
updateBrothersLeft(node: any): void
|
||||
updateBrothersTop(node: any, addHeight: any): void
|
||||
renderLine(node: any, lines: any, style: any): any[]
|
||||
renderExpandBtn(node: any, btn: any): void
|
||||
renderGeneralization(node: any, gLine: any, gNode: any): void
|
||||
renderExpandBtnRect(
|
||||
rect: any,
|
||||
expandBtnSize: any,
|
||||
width: any,
|
||||
height: any,
|
||||
node: any
|
||||
): void
|
||||
constructor(opt: {}, layout: any);
|
||||
layout: any;
|
||||
computedBaseValue(): void;
|
||||
computedLeftTopValue(): void;
|
||||
adjustLeftTopValue(): void;
|
||||
getNodeAreaHeight(node: any): number;
|
||||
updateBrothersLeft(node: any): void;
|
||||
updateBrothersTop(node: any, addHeight: any): void;
|
||||
renderExpandBtnRect(rect: any, expandBtnSize: any, width: any, height: any, node: any): void;
|
||||
}
|
||||
import Base from './Base'
|
||||
import Base from "./Base";
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
export default VerticalTimeline
|
||||
export default VerticalTimeline;
|
||||
declare class VerticalTimeline extends Base {
|
||||
constructor(opt: {}, layout: any)
|
||||
layout: any
|
||||
doLayout(callback: any): void
|
||||
computedBaseValue(): void
|
||||
computedTopValue(): void
|
||||
adjustLeftTopValue(): void
|
||||
updateBrothers(node: any, addHeight: any): void
|
||||
updateBrothersTop(node: any, addHeight: any): void
|
||||
renderLine(node: any, lines: any, style: any, lineStyle: any): void
|
||||
renderLineStraight(node: any, lines: any, style: any): any[]
|
||||
renderLineDirect(node: any, lines: any, style: any): any[]
|
||||
renderLineCurve(node: any, lines: any, style: any): any[]
|
||||
renderExpandBtn(node: any, btn: any): void
|
||||
renderGeneralization(node: any, gLine: any, gNode: any): void
|
||||
renderExpandBtnRect(
|
||||
rect: any,
|
||||
expandBtnSize: any,
|
||||
width: any,
|
||||
height: any,
|
||||
node: any
|
||||
): void
|
||||
constructor(opt: {}, layout: any);
|
||||
layout: any;
|
||||
computedBaseValue(): void;
|
||||
computedTopValue(): void;
|
||||
adjustLeftTopValue(): void;
|
||||
updateBrothers(node: any, addHeight: any): void;
|
||||
updateBrothersTop(node: any, addHeight: any): void;
|
||||
renderLineStraight(node: any, lines: any, style: any): any[];
|
||||
renderLineDirect(node: any, lines: any, style: any): any[];
|
||||
renderLineCurve(node: any, lines: any, style: any): any[];
|
||||
renderExpandBtnRect(rect: any, expandBtnSize: any, width: any, height: any, node: any): void;
|
||||
}
|
||||
import Base from './Base'
|
||||
import Base from "./Base";
|
||||
|
||||
280
simple-mind-map/types/src/layouts/fishboneUtils.d.ts
vendored
280
simple-mind-map/types/src/layouts/fishboneUtils.d.ts
vendored
@@ -1,137 +1,147 @@
|
||||
declare namespace _default {
|
||||
namespace top {
|
||||
function renderExpandBtn({
|
||||
node,
|
||||
btn,
|
||||
expandBtnSize,
|
||||
translateX,
|
||||
translateY,
|
||||
width,
|
||||
height
|
||||
}: {
|
||||
node: any
|
||||
btn: any
|
||||
expandBtnSize: any
|
||||
translateX: any
|
||||
translateY: any
|
||||
width: any
|
||||
height: any
|
||||
}): void
|
||||
function renderLine({
|
||||
node,
|
||||
line,
|
||||
top,
|
||||
x,
|
||||
lineLength,
|
||||
height,
|
||||
expandBtnSize,
|
||||
maxy,
|
||||
ctx
|
||||
}: {
|
||||
node: any
|
||||
line: any
|
||||
top: any
|
||||
x: any
|
||||
lineLength: any
|
||||
height: any
|
||||
expandBtnSize: any
|
||||
maxy: any
|
||||
ctx: any
|
||||
}): void
|
||||
function computedLeftTopValue({
|
||||
layerIndex,
|
||||
node,
|
||||
ctx
|
||||
}: {
|
||||
layerIndex: any
|
||||
node: any
|
||||
ctx: any
|
||||
}): void
|
||||
function adjustLeftTopValueBefore({
|
||||
node,
|
||||
parent,
|
||||
ctx,
|
||||
layerIndex
|
||||
}: {
|
||||
node: any
|
||||
parent: any
|
||||
ctx: any
|
||||
layerIndex: any
|
||||
}): void
|
||||
function adjustLeftTopValueAfter({
|
||||
parent,
|
||||
node,
|
||||
ctx
|
||||
}: {
|
||||
parent: any
|
||||
node: any
|
||||
ctx: any
|
||||
}): void
|
||||
}
|
||||
namespace bottom {
|
||||
function renderExpandBtn({
|
||||
node,
|
||||
btn,
|
||||
expandBtnSize,
|
||||
translateX,
|
||||
translateY,
|
||||
width,
|
||||
height
|
||||
}: {
|
||||
node: any
|
||||
btn: any
|
||||
expandBtnSize: any
|
||||
translateX: any
|
||||
translateY: any
|
||||
width: any
|
||||
height: any
|
||||
}): void
|
||||
function renderLine({
|
||||
node,
|
||||
line,
|
||||
top,
|
||||
x,
|
||||
lineLength,
|
||||
height,
|
||||
miny,
|
||||
ctx
|
||||
}: {
|
||||
node: any
|
||||
line: any
|
||||
top: any
|
||||
x: any
|
||||
lineLength: any
|
||||
height: any
|
||||
miny: any
|
||||
ctx: any
|
||||
}): void
|
||||
function computedLeftTopValue({
|
||||
layerIndex,
|
||||
node,
|
||||
ctx
|
||||
}: {
|
||||
layerIndex: any
|
||||
node: any
|
||||
ctx: any
|
||||
}): void
|
||||
function adjustLeftTopValueBefore({
|
||||
node,
|
||||
ctx,
|
||||
layerIndex
|
||||
}: {
|
||||
node: any
|
||||
ctx: any
|
||||
layerIndex: any
|
||||
}): void
|
||||
function adjustLeftTopValueAfter({
|
||||
parent,
|
||||
node,
|
||||
ctx
|
||||
}: {
|
||||
parent: any
|
||||
node: any
|
||||
ctx: any
|
||||
}): void
|
||||
}
|
||||
namespace top {
|
||||
function renderExpandBtn({ node, btn, expandBtnSize, translateX, translateY, width, height }: {
|
||||
node: any;
|
||||
btn: any;
|
||||
expandBtnSize: any;
|
||||
translateX: any;
|
||||
translateY: any;
|
||||
width: any;
|
||||
height: any;
|
||||
}): void;
|
||||
function renderExpandBtn({ node, btn, expandBtnSize, translateX, translateY, width, height }: {
|
||||
node: any;
|
||||
btn: any;
|
||||
expandBtnSize: any;
|
||||
translateX: any;
|
||||
translateY: any;
|
||||
width: any;
|
||||
height: any;
|
||||
}): void;
|
||||
function renderLine({ node, line, top, x, lineLength, height, expandBtnSize, maxy, ctx }: {
|
||||
node: any;
|
||||
line: any;
|
||||
top: any;
|
||||
x: any;
|
||||
lineLength: any;
|
||||
height: any;
|
||||
expandBtnSize: any;
|
||||
maxy: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function renderLine({ node, line, top, x, lineLength, height, expandBtnSize, maxy, ctx }: {
|
||||
node: any;
|
||||
line: any;
|
||||
top: any;
|
||||
x: any;
|
||||
lineLength: any;
|
||||
height: any;
|
||||
expandBtnSize: any;
|
||||
maxy: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function computedLeftTopValue({ layerIndex, node, ctx }: {
|
||||
layerIndex: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function computedLeftTopValue({ layerIndex, node, ctx }: {
|
||||
layerIndex: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueBefore({ node, parent, ctx, layerIndex }: {
|
||||
node: any;
|
||||
parent: any;
|
||||
ctx: any;
|
||||
layerIndex: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueBefore({ node, parent, ctx, layerIndex }: {
|
||||
node: any;
|
||||
parent: any;
|
||||
ctx: any;
|
||||
layerIndex: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueAfter({ parent, node, ctx }: {
|
||||
parent: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueAfter({ parent, node, ctx }: {
|
||||
parent: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
}
|
||||
namespace bottom {
|
||||
function renderExpandBtn({ node, btn, expandBtnSize, translateX, translateY, width, height }: {
|
||||
node: any;
|
||||
btn: any;
|
||||
expandBtnSize: any;
|
||||
translateX: any;
|
||||
translateY: any;
|
||||
width: any;
|
||||
height: any;
|
||||
}): void;
|
||||
function renderExpandBtn({ node, btn, expandBtnSize, translateX, translateY, width, height }: {
|
||||
node: any;
|
||||
btn: any;
|
||||
expandBtnSize: any;
|
||||
translateX: any;
|
||||
translateY: any;
|
||||
width: any;
|
||||
height: any;
|
||||
}): void;
|
||||
function renderLine({ node, line, top, x, lineLength, height, miny, ctx }: {
|
||||
node: any;
|
||||
line: any;
|
||||
top: any;
|
||||
x: any;
|
||||
lineLength: any;
|
||||
height: any;
|
||||
miny: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function renderLine({ node, line, top, x, lineLength, height, miny, ctx }: {
|
||||
node: any;
|
||||
line: any;
|
||||
top: any;
|
||||
x: any;
|
||||
lineLength: any;
|
||||
height: any;
|
||||
miny: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function computedLeftTopValue({ layerIndex, node, ctx }: {
|
||||
layerIndex: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function computedLeftTopValue({ layerIndex, node, ctx }: {
|
||||
layerIndex: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueBefore({ node, ctx, layerIndex }: {
|
||||
node: any;
|
||||
ctx: any;
|
||||
layerIndex: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueBefore({ node, ctx, layerIndex }: {
|
||||
node: any;
|
||||
ctx: any;
|
||||
layerIndex: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueAfter({ parent, node, ctx }: {
|
||||
parent: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
function adjustLeftTopValueAfter({ parent, node, ctx }: {
|
||||
parent: any;
|
||||
node: any;
|
||||
ctx: any;
|
||||
}): void;
|
||||
}
|
||||
}
|
||||
export default _default
|
||||
export default _default;
|
||||
|
||||
18
simple-mind-map/types/src/svg/btns.d.ts
vendored
18
simple-mind-map/types/src/svg/btns.d.ts
vendored
@@ -1,11 +1,11 @@
|
||||
declare namespace _default {
|
||||
export { open }
|
||||
export { close }
|
||||
export { remove }
|
||||
export { imgAdjust }
|
||||
export { open };
|
||||
export { close };
|
||||
export { remove };
|
||||
export { imgAdjust };
|
||||
}
|
||||
export default _default
|
||||
declare const open: '<svg t="1618141562310" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13476" width="200" height="200"><path d="M475.136 327.168v147.968h-147.968v74.24h147.968v147.968h74.24v-147.968h147.968v-74.24h-147.968v-147.968h-74.24z m36.864-222.208c225.28 0 407.04 181.76 407.04 407.04s-181.76 407.04-407.04 407.04-407.04-181.76-407.04-407.04 181.76-407.04 407.04-407.04z m0-74.24c-265.216 0-480.768 215.552-480.768 480.768s215.552 480.768 480.768 480.768 480.768-215.552 480.768-480.768-215.552-480.768-480.768-480.768z" p-id="13477"></path></svg>'
|
||||
declare const close: '<svg t="1618141589243" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13611" width="200" height="200"><path d="M512 105.472c225.28 0 407.04 181.76 407.04 407.04s-181.76 407.04-407.04 407.04-407.04-181.76-407.04-407.04 181.76-407.04 407.04-407.04z m0-74.24c-265.216 0-480.768 215.552-480.768 480.768s215.552 480.768 480.768 480.768 480.768-215.552 480.768-480.768-215.552-480.768-480.768-480.768z" p-id="13612"></path><path d="M252.928 474.624h518.144v74.24h-518.144z" p-id="13613"></path></svg>'
|
||||
declare const remove: '<svg width="14px" height="14px" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13611" width="200" height="200"><path fill="#ffffff" d="M512 105.472c225.28 0 407.04 181.76 407.04 407.04s-181.76 407.04-407.04 407.04-407.04-181.76-407.04-407.04 181.76-407.04 407.04-407.04z m0-74.24c-265.216 0-480.768 215.552-480.768 480.768s215.552 480.768 480.768 480.768 480.768-215.552 480.768-480.768-215.552-480.768-480.768-480.768z" p-id="13612"></path><path fill="#ffffff" d="M252.928 474.624h518.144v74.24h-518.144z" p-id="13613"></path></svg>'
|
||||
declare const imgAdjust: '<svg width="12px" height="12px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M1008.128 614.4a25.6 25.6 0 0 0-27.648 5.632l-142.848 142.848L259.072 186.88 401.92 43.52A25.6 25.6 0 0 0 384 0h-358.4a25.6 25.6 0 0 0-25.6 25.6v358.4a25.6 25.6 0 0 0 43.52 17.92l143.36-142.848 578.048 578.048-142.848 142.848a25.6 25.6 0 0 0 17.92 43.52h358.4a25.6 25.6 0 0 0 25.6-25.6v-358.4a25.6 25.6 0 0 0-15.872-25.088z" /></svg>'
|
||||
export default _default;
|
||||
declare const open: "<svg t=\"1618141562310\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"13476\" width=\"200\" height=\"200\"><path d=\"M475.136 327.168v147.968h-147.968v74.24h147.968v147.968h74.24v-147.968h147.968v-74.24h-147.968v-147.968h-74.24z m36.864-222.208c225.28 0 407.04 181.76 407.04 407.04s-181.76 407.04-407.04 407.04-407.04-181.76-407.04-407.04 181.76-407.04 407.04-407.04z m0-74.24c-265.216 0-480.768 215.552-480.768 480.768s215.552 480.768 480.768 480.768 480.768-215.552 480.768-480.768-215.552-480.768-480.768-480.768z\" p-id=\"13477\"></path></svg>";
|
||||
declare const close: "<svg t=\"1618141589243\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"13611\" width=\"200\" height=\"200\"><path d=\"M512 105.472c225.28 0 407.04 181.76 407.04 407.04s-181.76 407.04-407.04 407.04-407.04-181.76-407.04-407.04 181.76-407.04 407.04-407.04z m0-74.24c-265.216 0-480.768 215.552-480.768 480.768s215.552 480.768 480.768 480.768 480.768-215.552 480.768-480.768-215.552-480.768-480.768-480.768z\" p-id=\"13612\"></path><path d=\"M252.928 474.624h518.144v74.24h-518.144z\" p-id=\"13613\"></path></svg>";
|
||||
declare const remove: "<svg width=\"14px\" height=\"14px\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"13611\" width=\"200\" height=\"200\"><path fill=\"#ffffff\" d=\"M512 105.472c225.28 0 407.04 181.76 407.04 407.04s-181.76 407.04-407.04 407.04-407.04-181.76-407.04-407.04 181.76-407.04 407.04-407.04z m0-74.24c-265.216 0-480.768 215.552-480.768 480.768s215.552 480.768 480.768 480.768 480.768-215.552 480.768-480.768-215.552-480.768-480.768-480.768z\" p-id=\"13612\"></path><path fill=\"#ffffff\" d=\"M252.928 474.624h518.144v74.24h-518.144z\" p-id=\"13613\"></path></svg>";
|
||||
declare const imgAdjust: "<svg width=\"12px\" height=\"12px\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"><path fill=\"#ffffff\" d=\"M1008.128 614.4a25.6 25.6 0 0 0-27.648 5.632l-142.848 142.848L259.072 186.88 401.92 43.52A25.6 25.6 0 0 0 384 0h-358.4a25.6 25.6 0 0 0-25.6 25.6v358.4a25.6 25.6 0 0 0 43.52 17.92l143.36-142.848 578.048 578.048-142.848 142.848a25.6 25.6 0 0 0 17.92 43.52h358.4a25.6 25.6 0 0 0 25.6-25.6v-358.4a25.6 25.6 0 0 0-15.872-25.088z\" /></svg>";
|
||||
|
||||
30
simple-mind-map/types/src/svg/icons.d.ts
vendored
30
simple-mind-map/types/src/svg/icons.d.ts
vendored
@@ -1,18 +1,18 @@
|
||||
export const nodeIconList: {
|
||||
name: string
|
||||
type: string
|
||||
list: {
|
||||
name: string
|
||||
icon: string
|
||||
}[]
|
||||
}[]
|
||||
name: string;
|
||||
type: string;
|
||||
list: {
|
||||
name: string;
|
||||
icon: string;
|
||||
}[];
|
||||
}[];
|
||||
declare namespace _default {
|
||||
export { hyperlink }
|
||||
export { note }
|
||||
export { nodeIconList }
|
||||
export { getNodeIconListIcon }
|
||||
export { hyperlink };
|
||||
export { note };
|
||||
export { nodeIconList };
|
||||
export { getNodeIconListIcon };
|
||||
}
|
||||
export default _default
|
||||
declare const hyperlink: '<svg t="1624174958075" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7982" ><path d="M435.484444 251.733333v68.892445L295.822222 320.682667a168.504889 168.504889 0 0 0-2.844444 336.952889h142.506666v68.892444H295.822222a237.397333 237.397333 0 0 1 0-474.794667h139.662222z m248.945778 0a237.397333 237.397333 0 0 1 0 474.851556H544.654222v-69.006222l139.776 0.056889a168.504889 168.504889 0 0 0 2.844445-336.952889H544.597333V251.676444h139.776z m-25.827555 203.946667a34.474667 34.474667 0 0 1 0 68.892444H321.649778a34.474667 34.474667 0 0 1 0-68.892444h336.952889z" p-id="7983"></path></svg>'
|
||||
declare const note: '<svg t="1624195132675" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8792" ><path d="M152.768 985.984 152.768 49.856l434.56 0 66.816 0 234.048 267.392 0 66.816 0 601.92L152.768 985.984 152.768 985.984zM654.144 193.088l0 124.16 108.736 0L654.144 193.088 654.144 193.088zM821.312 384.064l-167.168 0L587.328 384.064 587.328 317.312 587.328 116.736 219.584 116.736 219.584 919.04l601.728 0L821.312 384.064 821.312 384.064zM386.688 517.888 319.808 517.888 319.808 450.944l66.816 0L386.624 517.888 386.688 517.888zM386.688 651.584 319.808 651.584 319.808 584.704l66.816 0L386.624 651.584 386.688 651.584zM386.688 785.344 319.808 785.344l0-66.88 66.816 0L386.624 785.344 386.688 785.344zM721.024 517.888 453.632 517.888 453.632 450.944l267.392 0L721.024 517.888 721.024 517.888zM654.144 651.584 453.632 651.584 453.632 584.704l200.512 0L654.144 651.584 654.144 651.584zM620.672 785.344l-167.04 0 0-66.88 167.04 0L620.672 785.344 620.672 785.344z" p-id="8793"></path></svg>'
|
||||
declare function getNodeIconListIcon(name: any, extendIconList?: any[]): any
|
||||
export default _default;
|
||||
declare const hyperlink: "<svg t=\"1624174958075\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"7982\" ><path d=\"M435.484444 251.733333v68.892445L295.822222 320.682667a168.504889 168.504889 0 0 0-2.844444 336.952889h142.506666v68.892444H295.822222a237.397333 237.397333 0 0 1 0-474.794667h139.662222z m248.945778 0a237.397333 237.397333 0 0 1 0 474.851556H544.654222v-69.006222l139.776 0.056889a168.504889 168.504889 0 0 0 2.844445-336.952889H544.597333V251.676444h139.776z m-25.827555 203.946667a34.474667 34.474667 0 0 1 0 68.892444H321.649778a34.474667 34.474667 0 0 1 0-68.892444h336.952889z\" p-id=\"7983\"></path></svg>";
|
||||
declare const note: "<svg t=\"1624195132675\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"8792\" ><path d=\"M152.768 985.984 152.768 49.856l434.56 0 66.816 0 234.048 267.392 0 66.816 0 601.92L152.768 985.984 152.768 985.984zM654.144 193.088l0 124.16 108.736 0L654.144 193.088 654.144 193.088zM821.312 384.064l-167.168 0L587.328 384.064 587.328 317.312 587.328 116.736 219.584 116.736 219.584 919.04l601.728 0L821.312 384.064 821.312 384.064zM386.688 517.888 319.808 517.888 319.808 450.944l66.816 0L386.624 517.888 386.688 517.888zM386.688 651.584 319.808 651.584 319.808 584.704l66.816 0L386.624 651.584 386.688 651.584zM386.688 785.344 319.808 785.344l0-66.88 66.816 0L386.624 785.344 386.688 785.344zM721.024 517.888 453.632 517.888 453.632 450.944l267.392 0L721.024 517.888 721.024 517.888zM654.144 651.584 453.632 651.584 453.632 584.704l200.512 0L654.144 651.584 654.144 651.584zM620.672 785.344l-167.04 0 0-66.88 167.04 0L620.672 785.344 620.672 785.344z\" p-id=\"8793\"></path></svg>";
|
||||
declare function getNodeIconListIcon(name: any, extendIconList?: any[]): any;
|
||||
|
||||
282
simple-mind-map/types/src/themes/default.d.ts
vendored
282
simple-mind-map/types/src/themes/default.d.ts
vendored
@@ -1,143 +1,143 @@
|
||||
declare namespace _default {
|
||||
let paddingX: number
|
||||
let paddingY: number
|
||||
let imgMaxWidth: number
|
||||
let imgMaxHeight: number
|
||||
let iconSize: number
|
||||
let lineWidth: number
|
||||
let lineColor: string
|
||||
let lineDasharray: string
|
||||
let lineStyle: string
|
||||
let rootLineKeepSameInCurve: boolean
|
||||
let generalizationLineWidth: number
|
||||
let generalizationLineColor: string
|
||||
let generalizationLineMargin: number
|
||||
let generalizationNodeMargin: number
|
||||
let associativeLineWidth: number
|
||||
let associativeLineColor: string
|
||||
let associativeLineActiveWidth: number
|
||||
let associativeLineActiveColor: string
|
||||
let associativeLineTextColor: string
|
||||
let associativeLineTextFontSize: number
|
||||
let associativeLineTextLineHeight: number
|
||||
let associativeLineTextFontFamily: string
|
||||
let backgroundColor: string
|
||||
let backgroundImage: string
|
||||
let backgroundRepeat: string
|
||||
let backgroundPosition: string
|
||||
let backgroundSize: string
|
||||
let nodeUseLineStyle: boolean
|
||||
namespace root {
|
||||
let shape: string
|
||||
let fillColor: string
|
||||
let fontFamily: string
|
||||
let color: string
|
||||
let fontSize: number
|
||||
let fontWeight: string
|
||||
let fontStyle: string
|
||||
let lineHeight: number
|
||||
let borderColor: string
|
||||
let borderWidth: number
|
||||
let borderDasharray: string
|
||||
let borderRadius: number
|
||||
let textDecoration: string
|
||||
}
|
||||
namespace second {
|
||||
let shape_1: string
|
||||
export { shape_1 as shape }
|
||||
export let marginX: number
|
||||
export let marginY: number
|
||||
let fillColor_1: string
|
||||
export { fillColor_1 as fillColor }
|
||||
let fontFamily_1: string
|
||||
export { fontFamily_1 as fontFamily }
|
||||
let color_1: string
|
||||
export { color_1 as color }
|
||||
let fontSize_1: number
|
||||
export { fontSize_1 as fontSize }
|
||||
let fontWeight_1: string
|
||||
export { fontWeight_1 as fontWeight }
|
||||
let fontStyle_1: string
|
||||
export { fontStyle_1 as fontStyle }
|
||||
let lineHeight_1: number
|
||||
export { lineHeight_1 as lineHeight }
|
||||
let borderColor_1: string
|
||||
export { borderColor_1 as borderColor }
|
||||
let borderWidth_1: number
|
||||
export { borderWidth_1 as borderWidth }
|
||||
let borderDasharray_1: string
|
||||
export { borderDasharray_1 as borderDasharray }
|
||||
let borderRadius_1: number
|
||||
export { borderRadius_1 as borderRadius }
|
||||
let textDecoration_1: string
|
||||
export { textDecoration_1 as textDecoration }
|
||||
}
|
||||
namespace node {
|
||||
let shape_2: string
|
||||
export { shape_2 as shape }
|
||||
let marginX_1: number
|
||||
export { marginX_1 as marginX }
|
||||
let marginY_1: number
|
||||
export { marginY_1 as marginY }
|
||||
let fillColor_2: string
|
||||
export { fillColor_2 as fillColor }
|
||||
let fontFamily_2: string
|
||||
export { fontFamily_2 as fontFamily }
|
||||
let color_2: string
|
||||
export { color_2 as color }
|
||||
let fontSize_2: number
|
||||
export { fontSize_2 as fontSize }
|
||||
let fontWeight_2: string
|
||||
export { fontWeight_2 as fontWeight }
|
||||
let fontStyle_2: string
|
||||
export { fontStyle_2 as fontStyle }
|
||||
let lineHeight_2: number
|
||||
export { lineHeight_2 as lineHeight }
|
||||
let borderColor_2: string
|
||||
export { borderColor_2 as borderColor }
|
||||
let borderWidth_2: number
|
||||
export { borderWidth_2 as borderWidth }
|
||||
let borderRadius_2: number
|
||||
export { borderRadius_2 as borderRadius }
|
||||
let borderDasharray_2: string
|
||||
export { borderDasharray_2 as borderDasharray }
|
||||
let textDecoration_2: string
|
||||
export { textDecoration_2 as textDecoration }
|
||||
}
|
||||
namespace generalization {
|
||||
let shape_3: string
|
||||
export { shape_3 as shape }
|
||||
let marginX_2: number
|
||||
export { marginX_2 as marginX }
|
||||
let marginY_2: number
|
||||
export { marginY_2 as marginY }
|
||||
let fillColor_3: string
|
||||
export { fillColor_3 as fillColor }
|
||||
let fontFamily_3: string
|
||||
export { fontFamily_3 as fontFamily }
|
||||
let color_3: string
|
||||
export { color_3 as color }
|
||||
let fontSize_3: number
|
||||
export { fontSize_3 as fontSize }
|
||||
let fontWeight_3: string
|
||||
export { fontWeight_3 as fontWeight }
|
||||
let fontStyle_3: string
|
||||
export { fontStyle_3 as fontStyle }
|
||||
let lineHeight_3: number
|
||||
export { lineHeight_3 as lineHeight }
|
||||
let borderColor_3: string
|
||||
export { borderColor_3 as borderColor }
|
||||
let borderWidth_3: number
|
||||
export { borderWidth_3 as borderWidth }
|
||||
let borderDasharray_3: string
|
||||
export { borderDasharray_3 as borderDasharray }
|
||||
let borderRadius_3: number
|
||||
export { borderRadius_3 as borderRadius }
|
||||
let textDecoration_3: string
|
||||
export { textDecoration_3 as textDecoration }
|
||||
}
|
||||
const paddingX: number;
|
||||
const paddingY: number;
|
||||
const imgMaxWidth: number;
|
||||
const imgMaxHeight: number;
|
||||
const iconSize: number;
|
||||
const lineWidth: number;
|
||||
const lineColor: string;
|
||||
const lineDasharray: string;
|
||||
const lineStyle: string;
|
||||
const rootLineKeepSameInCurve: boolean;
|
||||
const generalizationLineWidth: number;
|
||||
const generalizationLineColor: string;
|
||||
const generalizationLineMargin: number;
|
||||
const generalizationNodeMargin: number;
|
||||
const associativeLineWidth: number;
|
||||
const associativeLineColor: string;
|
||||
const associativeLineActiveWidth: number;
|
||||
const associativeLineActiveColor: string;
|
||||
const associativeLineTextColor: string;
|
||||
const associativeLineTextFontSize: number;
|
||||
const associativeLineTextLineHeight: number;
|
||||
const associativeLineTextFontFamily: string;
|
||||
const backgroundColor: string;
|
||||
const backgroundImage: string;
|
||||
const backgroundRepeat: string;
|
||||
const backgroundPosition: string;
|
||||
const backgroundSize: string;
|
||||
const nodeUseLineStyle: boolean;
|
||||
namespace root {
|
||||
const shape: string;
|
||||
const fillColor: string;
|
||||
const fontFamily: string;
|
||||
const color: string;
|
||||
const fontSize: number;
|
||||
const fontWeight: string;
|
||||
const fontStyle: string;
|
||||
const lineHeight: number;
|
||||
const borderColor: string;
|
||||
const borderWidth: number;
|
||||
const borderDasharray: string;
|
||||
const borderRadius: number;
|
||||
const textDecoration: string;
|
||||
}
|
||||
namespace second {
|
||||
const shape_1: string;
|
||||
export { shape_1 as shape };
|
||||
export const marginX: number;
|
||||
export const marginY: number;
|
||||
const fillColor_1: string;
|
||||
export { fillColor_1 as fillColor };
|
||||
const fontFamily_1: string;
|
||||
export { fontFamily_1 as fontFamily };
|
||||
const color_1: string;
|
||||
export { color_1 as color };
|
||||
const fontSize_1: number;
|
||||
export { fontSize_1 as fontSize };
|
||||
const fontWeight_1: string;
|
||||
export { fontWeight_1 as fontWeight };
|
||||
const fontStyle_1: string;
|
||||
export { fontStyle_1 as fontStyle };
|
||||
const lineHeight_1: number;
|
||||
export { lineHeight_1 as lineHeight };
|
||||
const borderColor_1: string;
|
||||
export { borderColor_1 as borderColor };
|
||||
const borderWidth_1: number;
|
||||
export { borderWidth_1 as borderWidth };
|
||||
const borderDasharray_1: string;
|
||||
export { borderDasharray_1 as borderDasharray };
|
||||
const borderRadius_1: number;
|
||||
export { borderRadius_1 as borderRadius };
|
||||
const textDecoration_1: string;
|
||||
export { textDecoration_1 as textDecoration };
|
||||
}
|
||||
namespace node {
|
||||
const shape_2: string;
|
||||
export { shape_2 as shape };
|
||||
const marginX_1: number;
|
||||
export { marginX_1 as marginX };
|
||||
const marginY_1: number;
|
||||
export { marginY_1 as marginY };
|
||||
const fillColor_2: string;
|
||||
export { fillColor_2 as fillColor };
|
||||
const fontFamily_2: string;
|
||||
export { fontFamily_2 as fontFamily };
|
||||
const color_2: string;
|
||||
export { color_2 as color };
|
||||
const fontSize_2: number;
|
||||
export { fontSize_2 as fontSize };
|
||||
const fontWeight_2: string;
|
||||
export { fontWeight_2 as fontWeight };
|
||||
const fontStyle_2: string;
|
||||
export { fontStyle_2 as fontStyle };
|
||||
const lineHeight_2: number;
|
||||
export { lineHeight_2 as lineHeight };
|
||||
const borderColor_2: string;
|
||||
export { borderColor_2 as borderColor };
|
||||
const borderWidth_2: number;
|
||||
export { borderWidth_2 as borderWidth };
|
||||
const borderRadius_2: number;
|
||||
export { borderRadius_2 as borderRadius };
|
||||
const borderDasharray_2: string;
|
||||
export { borderDasharray_2 as borderDasharray };
|
||||
const textDecoration_2: string;
|
||||
export { textDecoration_2 as textDecoration };
|
||||
}
|
||||
namespace generalization {
|
||||
const shape_3: string;
|
||||
export { shape_3 as shape };
|
||||
const marginX_2: number;
|
||||
export { marginX_2 as marginX };
|
||||
const marginY_2: number;
|
||||
export { marginY_2 as marginY };
|
||||
const fillColor_3: string;
|
||||
export { fillColor_3 as fillColor };
|
||||
const fontFamily_3: string;
|
||||
export { fontFamily_3 as fontFamily };
|
||||
const color_3: string;
|
||||
export { color_3 as color };
|
||||
const fontSize_3: number;
|
||||
export { fontSize_3 as fontSize };
|
||||
const fontWeight_3: string;
|
||||
export { fontWeight_3 as fontWeight };
|
||||
const fontStyle_3: string;
|
||||
export { fontStyle_3 as fontStyle };
|
||||
const lineHeight_3: number;
|
||||
export { lineHeight_3 as lineHeight };
|
||||
const borderColor_3: string;
|
||||
export { borderColor_3 as borderColor };
|
||||
const borderWidth_3: number;
|
||||
export { borderWidth_3 as borderWidth };
|
||||
const borderDasharray_3: string;
|
||||
export { borderDasharray_3 as borderDasharray };
|
||||
const borderRadius_3: number;
|
||||
export { borderRadius_3 as borderRadius };
|
||||
const textDecoration_3: string;
|
||||
export { textDecoration_3 as textDecoration };
|
||||
}
|
||||
}
|
||||
export default _default
|
||||
export const supportActiveStyle: string[]
|
||||
export function checkIsNodeSizeIndependenceConfig(config: any): boolean
|
||||
export const lineStyleProps: string[]
|
||||
export default _default;
|
||||
export const supportActiveStyle: string[];
|
||||
export function checkIsNodeSizeIndependenceConfig(config: any): boolean;
|
||||
export const lineStyleProps: string[];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
export default BatchExecution
|
||||
export default BatchExecution;
|
||||
declare class BatchExecution {
|
||||
has: {}
|
||||
queue: any[]
|
||||
nextTick: any
|
||||
push(name: any, fn: any): void
|
||||
flush(): void
|
||||
has: {};
|
||||
queue: any[];
|
||||
nextTick: any;
|
||||
push(name: any, fn: any): void;
|
||||
flush(): void;
|
||||
}
|
||||
|
||||
18
simple-mind-map/types/src/utils/Lru.d.ts
vendored
18
simple-mind-map/types/src/utils/Lru.d.ts
vendored
@@ -1,10 +1,10 @@
|
||||
export default class CRU {
|
||||
constructor(max: any)
|
||||
max: any
|
||||
size: number
|
||||
pool: Map<any, any>
|
||||
add(key: any, value: any): void
|
||||
delete(key: any): void
|
||||
has(key: any): boolean
|
||||
get(key: any): any
|
||||
export default class Lru {
|
||||
constructor(max: any);
|
||||
max: any;
|
||||
size: number;
|
||||
pool: Map<any, any>;
|
||||
add(key: any, value: any): void;
|
||||
delete(key: any): void;
|
||||
has(key: any): boolean;
|
||||
get(key: any): any;
|
||||
}
|
||||
|
||||
190
simple-mind-map/types/src/utils/index.d.ts
vendored
190
simple-mind-map/types/src/utils/index.d.ts
vendored
@@ -1,113 +1,77 @@
|
||||
export function walk(
|
||||
root: any,
|
||||
parent: any,
|
||||
beforeCallback: any,
|
||||
afterCallback: any,
|
||||
isRoot: any,
|
||||
layerIndex?: number,
|
||||
index?: number
|
||||
): void
|
||||
export function bfsWalk(root: any, callback: any): void
|
||||
export function resizeImgSizeByOriginRatio(
|
||||
width: any,
|
||||
height: any,
|
||||
newWidth: any,
|
||||
newHeight: any
|
||||
): any[]
|
||||
export function resizeImgSize(
|
||||
width: any,
|
||||
height: any,
|
||||
maxWidth: any,
|
||||
maxHeight: any
|
||||
): any[]
|
||||
export function resizeImg(
|
||||
imgUrl: any,
|
||||
maxWidth: any,
|
||||
maxHeight: any
|
||||
): Promise<any>
|
||||
export function getStrWithBrFromHtml(str: any): any
|
||||
export function simpleDeepClone(data: any): any
|
||||
export function copyRenderTree(
|
||||
tree: any,
|
||||
root: any,
|
||||
removeActiveState?: boolean
|
||||
): any
|
||||
export function copyNodeTree(
|
||||
tree: any,
|
||||
root: any,
|
||||
removeActiveState?: boolean,
|
||||
keepId?: boolean
|
||||
): any
|
||||
export function imgToDataUrl(src: any): Promise<any>
|
||||
export function parseDataUrl(data: any): any
|
||||
export function downloadFile(file: any, fileName: any): void
|
||||
export function throttle(
|
||||
fn: any,
|
||||
time: number,
|
||||
ctx: any
|
||||
): (...args: any[]) => void
|
||||
export function asyncRun(taskList: any, callback?: () => void): void
|
||||
export function degToRad(deg: any): number
|
||||
export function camelCaseToHyphen(str: any): any
|
||||
export function measureText(
|
||||
text: any,
|
||||
{
|
||||
italic,
|
||||
bold,
|
||||
fontSize,
|
||||
fontFamily
|
||||
}: {
|
||||
italic: any
|
||||
bold: any
|
||||
fontSize: any
|
||||
fontFamily: any
|
||||
}
|
||||
): {
|
||||
width: any
|
||||
height: any
|
||||
}
|
||||
export function joinFontStr({
|
||||
italic,
|
||||
bold,
|
||||
fontSize,
|
||||
fontFamily
|
||||
}: {
|
||||
italic: any
|
||||
bold: any
|
||||
fontSize: any
|
||||
fontFamily: any
|
||||
}): string
|
||||
export function nextTick(fn: any, ctx: any): () => void
|
||||
export function checkNodeOuter(
|
||||
mindMap: any,
|
||||
node: any
|
||||
): {
|
||||
isOuter: boolean
|
||||
offsetLeft: number
|
||||
offsetTop: number
|
||||
}
|
||||
export function getTextFromHtml(html: any): any
|
||||
export function readBlob(blob: any): Promise<any>
|
||||
export function nodeToHTML(node: any): any
|
||||
export function getImageSize(src: any): Promise<any>
|
||||
export function createUid(): any
|
||||
export function loadImage(imgFile: any): Promise<any>
|
||||
export function removeHTMLEntities(str: any): any
|
||||
export function getType(data: any): any
|
||||
export function isUndef(data: any): boolean
|
||||
export function removeHtmlStyle(html: any): any
|
||||
export function addHtmlStyle(html: any, tag: any, style: any): any
|
||||
export function checkIsRichText(str: any): boolean
|
||||
export function replaceHtmlText(
|
||||
html: any,
|
||||
searchText: any,
|
||||
replaceText: any
|
||||
): any
|
||||
export function isWhite(color: any): boolean
|
||||
export function isTransparent(color: any): boolean
|
||||
export function getVisibleColorFromTheme(themeConfig: any): any
|
||||
export function nodeRichTextToTextWithWrap(html: any): string
|
||||
export function textToNodeRichTextWithWrap(html: any): string
|
||||
export function isMobile(): boolean
|
||||
export function getObjectChangedProps(oldObject: any, newObject: any): {}
|
||||
export function checkIsNodeStyleDataKey(key: any): boolean
|
||||
export function walk(root: any, parent: any, beforeCallback: any, afterCallback: any, isRoot: any, layerIndex?: number, index?: number): void;
|
||||
export function bfsWalk(root: any, callback: any): void;
|
||||
export function resizeImgSizeByOriginRatio(width: any, height: any, newWidth: any, newHeight: any): any[];
|
||||
export function resizeImgSize(width: any, height: any, maxWidth: any, maxHeight: any): any[];
|
||||
export function resizeImg(imgUrl: any, maxWidth: any, maxHeight: any): Promise<any>;
|
||||
export function getStrWithBrFromHtml(str: any): any;
|
||||
export function simpleDeepClone(data: any): any;
|
||||
export function copyRenderTree(tree: any, root: any, removeActiveState?: boolean): any;
|
||||
export function copyNodeTree(tree: any, root: any, removeActiveState?: boolean, removeId?: boolean): any;
|
||||
export function imgToDataUrl(src: any): Promise<any>;
|
||||
export function parseDataUrl(data: any): any;
|
||||
export function downloadFile(file: any, fileName: any): void;
|
||||
export function throttle(fn: any, time: number, ctx: any): (...args: any[]) => void;
|
||||
export function asyncRun(taskList: any, callback?: () => void): void;
|
||||
export function degToRad(deg: any): number;
|
||||
export function camelCaseToHyphen(str: any): any;
|
||||
export function measureText(text: any, { italic, bold, fontSize, fontFamily }: {
|
||||
italic: any;
|
||||
bold: any;
|
||||
fontSize: any;
|
||||
fontFamily: any;
|
||||
}): {
|
||||
width: any;
|
||||
height: any;
|
||||
};
|
||||
export function joinFontStr({ italic, bold, fontSize, fontFamily }: {
|
||||
italic: any;
|
||||
bold: any;
|
||||
fontSize: any;
|
||||
fontFamily: any;
|
||||
}): string;
|
||||
export function nextTick(fn: any, ctx: any): () => void;
|
||||
export function checkNodeOuter(mindMap: any, node: any): {
|
||||
isOuter: boolean;
|
||||
offsetLeft: number;
|
||||
offsetTop: number;
|
||||
};
|
||||
export function getTextFromHtml(html: any): any;
|
||||
export function readBlob(blob: any): Promise<any>;
|
||||
export function nodeToHTML(node: any): any;
|
||||
export function getImageSize(src: any): Promise<any>;
|
||||
export function createUid(): any;
|
||||
export function loadImage(imgFile: any): Promise<any>;
|
||||
export function removeHTMLEntities(str: any): any;
|
||||
export function getType(data: any): any;
|
||||
export function isUndef(data: any): boolean;
|
||||
export function removeHtmlStyle(html: any): any;
|
||||
export function addHtmlStyle(html: any, tag: any, style: any): any;
|
||||
export function checkIsRichText(str: any): boolean;
|
||||
export function replaceHtmlText(html: any, searchText: any, replaceText: any): any;
|
||||
export function isWhite(color: any): boolean;
|
||||
export function isTransparent(color: any): boolean;
|
||||
export function getVisibleColorFromTheme(themeConfig: any): any;
|
||||
export function nodeRichTextToTextWithWrap(html: any): string;
|
||||
export function textToNodeRichTextWithWrap(html: any): string;
|
||||
export function isMobile(): boolean;
|
||||
export function getObjectChangedProps(oldObject: any, newObject: any): {};
|
||||
export function checkIsNodeStyleDataKey(key: any): boolean;
|
||||
export function mergerIconList(list: any): any;
|
||||
export function getTopAncestorsFomNodeList(list: any): any[];
|
||||
export function checkTwoRectIsOverlap(minx1: any, maxx1: any, miny1: any, maxy1: any, minx2: any, maxx2: any, miny2: any, maxy2: any): boolean;
|
||||
export function focusInput(el: any): void;
|
||||
export function selectAllInput(el: any): void;
|
||||
export function addDataToAppointNodes(appointNodes: any, data?: {}): any;
|
||||
export function createUidForAppointNodes(appointNodes: any, createNewId?: boolean): any;
|
||||
export function formatDataToArray(data: any): any[];
|
||||
export function getNodeDataIndex(node: any): any;
|
||||
export function getNodeIndexInNodeList(node: any, nodeList: any): any;
|
||||
export function generateColorByContent(str: any): string;
|
||||
export function htmlEscape(str: any): any;
|
||||
export function isSameObject(a: any, b: any): boolean;
|
||||
export function setDataToClipboard(data: any): void;
|
||||
export function getDataFromClipboard(): Promise<{
|
||||
text: string;
|
||||
img: any;
|
||||
}>;
|
||||
export function removeFromParentNodeData(node: any): void;
|
||||
|
||||
23
simple-mind-map/types/src/utils/mersenneTwister.d.ts
vendored
Normal file
23
simple-mind-map/types/src/utils/mersenneTwister.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @description 为了保证相同的内容每次生成的随机数都是一样的,我们可以使用一个伪随机数生成器(PRNG),并使用内容的哈希值作为种子。以下是一个使用Mersenne Twister算法的PRNG的实现:
|
||||
*
|
||||
* @param {*} seed
|
||||
*/
|
||||
export default function MersenneTwister(seed: any): void;
|
||||
export default class MersenneTwister {
|
||||
/**
|
||||
* @description 为了保证相同的内容每次生成的随机数都是一样的,我们可以使用一个伪随机数生成器(PRNG),并使用内容的哈希值作为种子。以下是一个使用Mersenne Twister算法的PRNG的实现:
|
||||
*
|
||||
* @param {*} seed
|
||||
*/
|
||||
constructor(seed: any);
|
||||
N: number;
|
||||
M: number;
|
||||
MATRIX_A: number;
|
||||
UPPER_MASK: number;
|
||||
LOWER_MASK: number;
|
||||
mt: any[];
|
||||
mti: number;
|
||||
init_genrand(s: any): void;
|
||||
genrand_int32(): number;
|
||||
}
|
||||
2
web/package-lock.json
generated
2
web/package-lock.json
generated
@@ -18488,6 +18488,7 @@
|
||||
"integrity": "sha512-VCNRiAt2P/bLo09rYt3DLe6xXUMlhJwrvU18Ddd/lYJgC7s8+wvhgYs+MTx4OiAXdu58drGwSBO9SPx7C6J82Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/core": "^7.11.0",
|
||||
"@babel/helper-compilation-targets": "^7.9.6",
|
||||
"@babel/helper-module-imports": "^7.8.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
@@ -18500,6 +18501,7 @@
|
||||
"@vue/babel-plugin-jsx": "^1.0.3",
|
||||
"@vue/babel-preset-jsx": "^1.2.4",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"core-js": "^3.6.5",
|
||||
"core-js-compat": "^3.6.5",
|
||||
"semver": "^6.1.0"
|
||||
}
|
||||
|
||||
BIN
web/src/assets/avatar/天清如愿.jpg
Normal file
BIN
web/src/assets/avatar/天清如愿.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
BIN
web/src/assets/avatar/小逗比.png
Normal file
BIN
web/src/assets/avatar/小逗比.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
BIN
web/src/assets/avatar/有希.jpg
Normal file
BIN
web/src/assets/avatar/有希.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
BIN
web/src/assets/avatar/樊笼.jpg
Normal file
BIN
web/src/assets/avatar/樊笼.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
web/src/assets/avatar/沐风牧草.jpg
Normal file
BIN
web/src/assets/avatar/沐风牧草.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
BIN
web/src/assets/avatar/达仁科技.jpg
Normal file
BIN
web/src/assets/avatar/达仁科技.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
@@ -1,8 +1,8 @@
|
||||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 2479351 */
|
||||
src: url('iconfont.woff2?t=1691822758372') format('woff2'),
|
||||
url('iconfont.woff?t=1691822758372') format('woff'),
|
||||
url('iconfont.ttf?t=1691822758372') format('truetype');
|
||||
src: url('iconfont.woff2?t=1697073602349') format('woff2'),
|
||||
url('iconfont.woff?t=1697073602349') format('woff'),
|
||||
url('iconfont.ttf?t=1697073602349') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
@@ -13,6 +13,14 @@
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icondodeparent:before {
|
||||
content: "\e70f";
|
||||
}
|
||||
|
||||
.icongongshi:before {
|
||||
content: "\e617";
|
||||
}
|
||||
|
||||
.icontouming:before {
|
||||
content: "\e60c";
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,60 +1,83 @@
|
||||
// 布局结构图片映射
|
||||
export const layoutImgMap = {
|
||||
logicalStructure: require('../assets/img/structures/logicalStructure.png'),
|
||||
mindMap: require('../assets/img/structures/mindMap.png'),
|
||||
organizationStructure: require('../assets/img/structures/organizationStructure.png'),
|
||||
catalogOrganization: require('../assets/img/structures/catalogOrganization.png'),
|
||||
timeline: require('../assets/img/structures/timeline.png'),
|
||||
timeline2: require('../assets/img/structures/timeline2.png'),
|
||||
fishbone: require('../assets/img/structures/fishbone.png'),
|
||||
verticalTimeline: require('../assets/img/structures/verticalTimeline.png'),
|
||||
logicalStructure: require('../assets/img/structures/logicalStructure.png'),
|
||||
mindMap: require('../assets/img/structures/mindMap.png'),
|
||||
organizationStructure: require('../assets/img/structures/organizationStructure.png'),
|
||||
catalogOrganization: require('../assets/img/structures/catalogOrganization.png'),
|
||||
timeline: require('../assets/img/structures/timeline.png'),
|
||||
timeline2: require('../assets/img/structures/timeline2.png'),
|
||||
fishbone: require('../assets/img/structures/fishbone.png'),
|
||||
verticalTimeline: require('../assets/img/structures/verticalTimeline.png')
|
||||
}
|
||||
|
||||
// 主题图片映射
|
||||
export const themeMap = {
|
||||
default: require('../assets/img/themes/default.jpg'),
|
||||
classic: require('../assets/img/themes/classic.jpg'),
|
||||
minions: require('../assets/img/themes/minions.jpg'),
|
||||
pinkGrape: require('../assets/img/themes/pinkGrape.jpg'),
|
||||
mint: require('../assets/img/themes/mint.jpg'),
|
||||
gold: require('../assets/img/themes/gold.jpg'),
|
||||
vitalityOrange: require('../assets/img/themes/vitalityOrange.jpg'),
|
||||
greenLeaf: require('../assets/img/themes/greenLeaf.jpg'),
|
||||
dark2: require('../assets/img/themes/dark2.jpg'),
|
||||
skyGreen: require('../assets/img/themes/skyGreen.jpg'),
|
||||
classic2: require('../assets/img/themes/classic2.jpg'),
|
||||
classic3: require('../assets/img/themes/classic3.jpg'),
|
||||
classic4: require('../assets/img/themes/classic4.jpg'),
|
||||
classicGreen: require('../assets/img/themes/classicGreen.jpg'),
|
||||
classicBlue: require('../assets/img/themes/classicBlue.jpg'),
|
||||
blueSky: require('../assets/img/themes/blueSky.jpg'),
|
||||
brainImpairedPink: require('../assets/img/themes/brainImpairedPink.jpg'),
|
||||
dark: require('../assets/img/themes/dark.jpg'),
|
||||
earthYellow: require('../assets/img/themes/earthYellow.jpg'),
|
||||
freshGreen: require('../assets/img/themes/freshGreen.jpg'),
|
||||
freshRed: require('../assets/img/themes/freshRed.jpg'),
|
||||
romanticPurple: require('../assets/img/themes/romanticPurple.jpg'),
|
||||
simpleBlack: require('../assets/img/themes/simpleBlack.jpg'),
|
||||
courseGreen: require('../assets/img/themes/courseGreen.jpg'),
|
||||
coffee: require('../assets/img/themes/coffee.jpg'),
|
||||
redSpirit: require('../assets/img/themes/redSpirit.jpg'),
|
||||
blackHumour: require('../assets/img/themes/blackHumour.jpg'),
|
||||
lateNightOffice: require('../assets/img/themes/lateNightOffice.jpg'),
|
||||
blackGold: require('../assets/img/themes/blackGold.jpg'),
|
||||
autumn: require('../assets/img/themes/autumn.jpg'),
|
||||
avocado: require('../assets/img/themes/avocado.jpg'),
|
||||
orangeJuice: require('../assets/img/themes/orangeJuice.jpg'),
|
||||
oreo: require('../assets/img/themes/oreo.jpg'),
|
||||
shallowSea: require('../assets/img/themes/shallowSea.jpg'),
|
||||
lemonBubbles: require('../assets/img/themes/lemonBubbles.jpg'),
|
||||
rose: require('../assets/img/themes/rose.jpg'),
|
||||
seaBlueLine: require('../assets/img/themes/seaBlueLine.jpg'),
|
||||
neonLamp: require('../assets/img/themes/neonLamp.jpg'),
|
||||
darkNightLceBlade: require('../assets/img/themes/darkNightLceBlade.jpg'),
|
||||
morandi: require('../assets/img/themes/morandi.jpg'),
|
||||
classic5: require('../assets/img/themes/classic5.jpg'),
|
||||
dark3: require('../assets/img/themes/dark3.jpg'),
|
||||
dark4: require('../assets/img/themes/dark4.jpg'),
|
||||
cactus: require('../assets/img/themes/cactus.jpg'),
|
||||
default: require('../assets/img/themes/default.jpg'),
|
||||
classic: require('../assets/img/themes/classic.jpg'),
|
||||
minions: require('../assets/img/themes/minions.jpg'),
|
||||
pinkGrape: require('../assets/img/themes/pinkGrape.jpg'),
|
||||
mint: require('../assets/img/themes/mint.jpg'),
|
||||
gold: require('../assets/img/themes/gold.jpg'),
|
||||
vitalityOrange: require('../assets/img/themes/vitalityOrange.jpg'),
|
||||
greenLeaf: require('../assets/img/themes/greenLeaf.jpg'),
|
||||
dark2: require('../assets/img/themes/dark2.jpg'),
|
||||
skyGreen: require('../assets/img/themes/skyGreen.jpg'),
|
||||
classic2: require('../assets/img/themes/classic2.jpg'),
|
||||
classic3: require('../assets/img/themes/classic3.jpg'),
|
||||
classic4: require('../assets/img/themes/classic4.jpg'),
|
||||
classicGreen: require('../assets/img/themes/classicGreen.jpg'),
|
||||
classicBlue: require('../assets/img/themes/classicBlue.jpg'),
|
||||
blueSky: require('../assets/img/themes/blueSky.jpg'),
|
||||
brainImpairedPink: require('../assets/img/themes/brainImpairedPink.jpg'),
|
||||
dark: require('../assets/img/themes/dark.jpg'),
|
||||
earthYellow: require('../assets/img/themes/earthYellow.jpg'),
|
||||
freshGreen: require('../assets/img/themes/freshGreen.jpg'),
|
||||
freshRed: require('../assets/img/themes/freshRed.jpg'),
|
||||
romanticPurple: require('../assets/img/themes/romanticPurple.jpg'),
|
||||
simpleBlack: require('../assets/img/themes/simpleBlack.jpg'),
|
||||
courseGreen: require('../assets/img/themes/courseGreen.jpg'),
|
||||
coffee: require('../assets/img/themes/coffee.jpg'),
|
||||
redSpirit: require('../assets/img/themes/redSpirit.jpg'),
|
||||
blackHumour: require('../assets/img/themes/blackHumour.jpg'),
|
||||
lateNightOffice: require('../assets/img/themes/lateNightOffice.jpg'),
|
||||
blackGold: require('../assets/img/themes/blackGold.jpg'),
|
||||
autumn: require('../assets/img/themes/autumn.jpg'),
|
||||
avocado: require('../assets/img/themes/avocado.jpg'),
|
||||
orangeJuice: require('../assets/img/themes/orangeJuice.jpg'),
|
||||
oreo: require('../assets/img/themes/oreo.jpg'),
|
||||
shallowSea: require('../assets/img/themes/shallowSea.jpg'),
|
||||
lemonBubbles: require('../assets/img/themes/lemonBubbles.jpg'),
|
||||
rose: require('../assets/img/themes/rose.jpg'),
|
||||
seaBlueLine: require('../assets/img/themes/seaBlueLine.jpg'),
|
||||
neonLamp: require('../assets/img/themes/neonLamp.jpg'),
|
||||
darkNightLceBlade: require('../assets/img/themes/darkNightLceBlade.jpg'),
|
||||
morandi: require('../assets/img/themes/morandi.jpg'),
|
||||
classic5: require('../assets/img/themes/classic5.jpg'),
|
||||
dark3: require('../assets/img/themes/dark3.jpg'),
|
||||
dark4: require('../assets/img/themes/dark4.jpg'),
|
||||
cactus: require('../assets/img/themes/cactus.jpg')
|
||||
}
|
||||
|
||||
|
||||
// 公式列表
|
||||
export const formulaList = [
|
||||
'a^2',
|
||||
'a_2',
|
||||
'a^{2+2}',
|
||||
'a_{i,j}',
|
||||
'x_2^3',
|
||||
'\\overbrace{1+2+\\cdots+100}',
|
||||
'\\sum_{k=1}^N k^2',
|
||||
'\\lim_{n \\to \\infty}x_n',
|
||||
'\\int_{-N}^{N} e^x\\, dx',
|
||||
'\\sqrt{3}',
|
||||
'\\sqrt[n]{3}',
|
||||
'\\sin\\theta',
|
||||
'\\log X',
|
||||
'\\log_{10}',
|
||||
'\\log_\\alpha X',
|
||||
'\\lim_{t\\to n}T',
|
||||
'\\frac{1}{2}=0.5',
|
||||
'\\binom{n}{k}',
|
||||
'\\begin{matrix}x & y \\\\z & v\\end{matrix}',
|
||||
'\\begin{cases}3x + 5y + z \\\\7x - 2y + 4z \\\\-6x + 3y + 2z\\end{cases}'
|
||||
]
|
||||
|
||||
@@ -209,6 +209,11 @@ export const shortcutKeyList = [
|
||||
name: 'Insert sibling node',
|
||||
value: 'Enter'
|
||||
},
|
||||
{
|
||||
icon: 'icondodeparent',
|
||||
name: 'Insert parent node',
|
||||
value: 'Shift + Tab'
|
||||
},
|
||||
{
|
||||
icon: 'iconshangyi',
|
||||
name: 'Move up node',
|
||||
@@ -234,6 +239,11 @@ export const shortcutKeyList = [
|
||||
name: 'Delete node',
|
||||
value: 'Delete | Backspace'
|
||||
},
|
||||
{
|
||||
icon: 'iconshanchu',
|
||||
name: 'Delete current node',
|
||||
value: 'Shift + Backspace'
|
||||
},
|
||||
{
|
||||
icon: 'iconfuzhi',
|
||||
name: 'Copy node',
|
||||
@@ -306,7 +316,7 @@ export const shortcutKeyList = [
|
||||
},
|
||||
{
|
||||
icon: 'icondingwei',
|
||||
name: 'Reset',
|
||||
name: 'Back root node',
|
||||
value: 'Ctrl + Enter'
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -276,6 +276,11 @@ export const shortcutKeyList = [
|
||||
name: '插入同级节点',
|
||||
value: 'Enter'
|
||||
},
|
||||
{
|
||||
icon: 'icondodeparent',
|
||||
name: '插入父节点',
|
||||
value: 'Shift + Tab'
|
||||
},
|
||||
{
|
||||
icon: 'iconshangyi',
|
||||
name: '上移节点',
|
||||
@@ -301,6 +306,11 @@ export const shortcutKeyList = [
|
||||
name: '删除节点',
|
||||
value: 'Delete | Backspace'
|
||||
},
|
||||
{
|
||||
icon: 'iconshanchu',
|
||||
name: '仅删除当前节点',
|
||||
value: 'Shift + Backspace'
|
||||
},
|
||||
{
|
||||
icon: 'iconfuzhi',
|
||||
name: '复制节点',
|
||||
@@ -373,7 +383,7 @@ export const shortcutKeyList = [
|
||||
},
|
||||
{
|
||||
icon: 'icondingwei',
|
||||
name: '恢复默认',
|
||||
name: '回到根节点',
|
||||
value: 'Ctrl + Enter'
|
||||
},
|
||||
{
|
||||
|
||||
@@ -59,14 +59,16 @@ export default {
|
||||
contextmenu: {
|
||||
insertSiblingNode: 'Insert sibling node',
|
||||
insertChildNode: 'Insert child node',
|
||||
insertParentNode: 'Insert parent node',
|
||||
insertSummary: 'Insert summary',
|
||||
moveUpNode: 'Move up node',
|
||||
moveDownNode: 'Move down node',
|
||||
deleteNode: 'Delete node',
|
||||
deleteCurrentNode: 'Only del cur node',
|
||||
copyNode: 'Copy node',
|
||||
cutNode: 'Cut node',
|
||||
pasteNode: 'Paste node',
|
||||
backCenter: 'Back center',
|
||||
backCenter: 'Back root node',
|
||||
expandAll: 'Expand all',
|
||||
unExpandAll: 'Un expand all',
|
||||
expandTo: 'Expand to',
|
||||
@@ -103,14 +105,17 @@ export default {
|
||||
markdownFile: 'markdown file',
|
||||
tips: 'tips: .smm and .json file can be import',
|
||||
isTransparent: 'Background is transparent',
|
||||
pngTips: 'tips: Exporting pictures in rich text mode is time-consuming. It is recommended to export to svg format',
|
||||
pngTips:
|
||||
'tips: Exporting pictures in rich text mode is time-consuming. It is recommended to export to svg format',
|
||||
svgTips: 'tips: Exporting pictures in rich text mode is time-consuming',
|
||||
transformingDomToImages: 'Converting nodes: ',
|
||||
notifyTitle: 'Info',
|
||||
notifyMessage: 'If the download is not triggered, check whether it is blocked by the browser',
|
||||
notifyMessage:
|
||||
'If the download is not triggered, check whether it is blocked by the browser',
|
||||
paddingX: 'Padding x',
|
||||
paddingY: 'Padding y',
|
||||
useMultiPageExport: 'Export multi page'
|
||||
useMultiPageExport: 'Export multi page',
|
||||
defaultFileName: 'Mind map'
|
||||
},
|
||||
fullscreen: {
|
||||
fullscreenShow: 'Full screen show',
|
||||
@@ -119,7 +124,13 @@ export default {
|
||||
import: {
|
||||
title: 'Import',
|
||||
selectFile: 'Select file',
|
||||
supportFile: 'Support .smm、.json、.xmind、.xlsx、.md file'
|
||||
supportFile: 'Support .smm、.json、.xmind、.xlsx、.md file',
|
||||
enableFileTip: 'Please select .smm、.json、.xmind、.xlsx、.md file',
|
||||
maxFileNum: 'At most one file can be selected',
|
||||
notSelectTip: 'Please select the file to import',
|
||||
fileContentError: 'The file content is incorrect',
|
||||
importSuccess: 'Import success',
|
||||
fileParsingFailed: 'File parsing failed'
|
||||
},
|
||||
navigatorToolbar: {
|
||||
openMiniMap: 'Open mini map',
|
||||
@@ -188,13 +199,21 @@ export default {
|
||||
vertical: 'Vertical'
|
||||
},
|
||||
theme: {
|
||||
title: 'Theme'
|
||||
title: 'Theme',
|
||||
classics: 'Classics',
|
||||
dark: 'Darkness',
|
||||
simple: 'Simple',
|
||||
coverTip:
|
||||
'You have currently customized the basic style, do you want to overwrite it?',
|
||||
tip: 'Tip',
|
||||
cover: 'Cover',
|
||||
reserve: 'Reserve'
|
||||
},
|
||||
toolbar: {
|
||||
undo: 'Undo',
|
||||
redo: 'Redo',
|
||||
insertSiblingNode: 'Insert sibling node',
|
||||
insertChildNode: 'Insert child node',
|
||||
insertSiblingNode: 'Sibling node',
|
||||
insertChildNode: 'Child node',
|
||||
deleteNode: 'Delete node',
|
||||
image: 'Image',
|
||||
icon: 'Icon',
|
||||
@@ -213,15 +232,35 @@ export default {
|
||||
export: 'Export',
|
||||
shortcutKey: 'Shortcut key',
|
||||
associativeLine: 'Associative line',
|
||||
painter: 'Painter'
|
||||
painter: 'Painter',
|
||||
formula: 'Formula',
|
||||
more: 'More',
|
||||
selectFileTip: 'Please select a file',
|
||||
notSupportTip:
|
||||
'Your browser or network protocol does not support this feature',
|
||||
tip: 'Tip',
|
||||
editingLocalFileTipFront: 'Currently editing your local【',
|
||||
editingLocalFileTipEnd: '】file',
|
||||
fileContentError: 'File content error',
|
||||
fileOpenFailed: 'File open failed',
|
||||
defaultFileName: 'Mind map',
|
||||
creatingTip: 'Creating file'
|
||||
},
|
||||
edit: {
|
||||
newFeatureNoticeTitle: 'New feature reminder',
|
||||
newFeatureNoticeMessage: 'This update supports node rich text editing, But there are some defects, The most important impact is that the time to export the image is proportional to the number of nodes, Therefore, if you are more dependent on export requirements, you can use【Base style】-【Other config】-【Enable node rich text editing】Set to turn off rich text editing mode.'
|
||||
newFeatureNoticeMessage:
|
||||
'This update supports node rich text editing, But there are some defects, The most important impact is that the time to export the image is proportional to the number of nodes, Therefore, if you are more dependent on export requirements, you can use【Base style】-【Other config】-【Enable node rich text editing】Set to turn off rich text editing mode.',
|
||||
root: 'Root node',
|
||||
splitByWrap: 'Is automatically split nodes based on line breaks?',
|
||||
tip: 'Tip',
|
||||
yes: 'Yes',
|
||||
no: 'No'
|
||||
},
|
||||
mouseAction: {
|
||||
tip1: 'Current: Left click to drag the canvas, right click to box select nodes',
|
||||
tip2: 'Current: Left click to box select nodes, right click to drag the canvas',
|
||||
tip1:
|
||||
'Current: Left click to drag the canvas, right click to box select nodes',
|
||||
tip2:
|
||||
'Current: Left click to box select nodes, right click to drag the canvas'
|
||||
},
|
||||
search: {
|
||||
searchPlaceholder: 'Please enter the search content',
|
||||
@@ -229,5 +268,31 @@ export default {
|
||||
replace: 'Replace',
|
||||
replaceAll: 'Replace all',
|
||||
cancel: 'Cancel'
|
||||
},
|
||||
nodeIconSidebar: {
|
||||
title: 'Icon/Sticker',
|
||||
icon: 'Icon',
|
||||
sticker: 'Sticker'
|
||||
},
|
||||
formulaSidebar: {
|
||||
title: 'Formula',
|
||||
placeholder: 'Please enter LaText syntax',
|
||||
confirm: 'Confirm',
|
||||
common: 'Common formulas',
|
||||
tip: 'Inserting formulas is not supported in non rich text mode'
|
||||
},
|
||||
richTextToolbar: {
|
||||
bold: 'Bold',
|
||||
italic: 'Italic',
|
||||
underline: 'Underline',
|
||||
strike: 'Strike',
|
||||
fontFamily: 'Font family',
|
||||
fontSize: 'Font size',
|
||||
color: 'Color',
|
||||
backgroundColor: 'Background color',
|
||||
removeFormat: 'Clear Style'
|
||||
},
|
||||
other: {
|
||||
loading: 'Loading, please wait...'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,14 +59,16 @@ export default {
|
||||
contextmenu: {
|
||||
insertSiblingNode: '插入同级节点',
|
||||
insertChildNode: '插入子级节点',
|
||||
insertParentNode: '插入父节点',
|
||||
insertSummary: '插入概要',
|
||||
moveUpNode: '上移节点',
|
||||
moveDownNode: '下移节点',
|
||||
deleteNode: '删除节点',
|
||||
deleteCurrentNode: '仅删除当前节点',
|
||||
copyNode: '复制节点',
|
||||
cutNode: '剪切节点',
|
||||
pasteNode: '粘贴节点',
|
||||
backCenter: '回到中心',
|
||||
backCenter: '回到根节点',
|
||||
expandAll: '展开所有',
|
||||
unExpandAll: '收起所有',
|
||||
expandTo: '展开到',
|
||||
@@ -110,7 +112,8 @@ export default {
|
||||
notifyMessage: '如果没有触发下载,请检查是否被浏览器拦截了',
|
||||
paddingX: '水平内边距',
|
||||
paddingY: '垂直内边距',
|
||||
useMultiPageExport: '是否多页导出'
|
||||
useMultiPageExport: '是否多页导出',
|
||||
defaultFileName: '思维导图'
|
||||
},
|
||||
fullscreen: {
|
||||
fullscreenShow: '全屏查看',
|
||||
@@ -119,7 +122,13 @@ export default {
|
||||
import: {
|
||||
title: '导入',
|
||||
selectFile: '选取文件',
|
||||
supportFile: '支持.smm、.json、.xmind、.xlsx、.md文件'
|
||||
supportFile: '支持.smm、.json、.xmind、.xlsx、.md文件',
|
||||
enableFileTip: '请选择.smm、.json、.xmind、.xlsx、.md文件',
|
||||
maxFileNum: '最多只能选择一个文件',
|
||||
notSelectTip: '请选择要导入的文件',
|
||||
fileContentError: '文件内容有误',
|
||||
importSuccess: '导入成功',
|
||||
fileParsingFailed: '文件解析失败'
|
||||
},
|
||||
navigatorToolbar: {
|
||||
openMiniMap: '开启小地图',
|
||||
@@ -188,13 +197,20 @@ export default {
|
||||
vertical: '垂直'
|
||||
},
|
||||
theme: {
|
||||
title: '主题'
|
||||
title: '主题',
|
||||
classics: '经典',
|
||||
dark: '深色',
|
||||
simple: '朴素',
|
||||
coverTip: '你当前自定义过基础样式,是否覆盖?',
|
||||
tip: '提示',
|
||||
cover: '覆盖',
|
||||
reserve: '保留'
|
||||
},
|
||||
toolbar: {
|
||||
undo: '回退',
|
||||
redo: '前进',
|
||||
insertSiblingNode: '插入同级节点',
|
||||
insertChildNode: '插入子节点',
|
||||
insertSiblingNode: '同级节点',
|
||||
insertChildNode: '子节点',
|
||||
deleteNode: '删除节点',
|
||||
image: '图片',
|
||||
icon: '图标',
|
||||
@@ -213,15 +229,32 @@ export default {
|
||||
export: '导出',
|
||||
shortcutKey: '快捷键',
|
||||
associativeLine: '关联线',
|
||||
painter: '格式刷'
|
||||
painter: '格式刷',
|
||||
formula: '公式',
|
||||
more: '更多',
|
||||
selectFileTip: '请选择文件',
|
||||
notSupportTip: '你的浏览器或网络协议不支持该功能',
|
||||
tip: '提示',
|
||||
editingLocalFileTipFront: '当前正在编辑你本机的【',
|
||||
editingLocalFileTipEnd: '】文件',
|
||||
fileContentError: '文件内容有误',
|
||||
fileOpenFailed: '文件打开失败',
|
||||
defaultFileName: '思维导图',
|
||||
creatingTip: '正在创建文件'
|
||||
},
|
||||
edit: {
|
||||
newFeatureNoticeTitle: '新特性提醒',
|
||||
newFeatureNoticeMessage: '本次更新支持了节点富文本编辑,但是存在一定缺陷,最主要的影响是导出为图片的时间和节点数量成正比,所以对导出需求比较依赖的话可以通过【基础样式】-【其他配置】-【是否开启节点富文本编辑】设置关掉富文本编辑模式。'
|
||||
newFeatureNoticeMessage:
|
||||
'本次更新支持了节点富文本编辑,但是存在一定缺陷,最主要的影响是导出为图片的时间和节点数量成正比,所以对导出需求比较依赖的话可以通过【基础样式】-【其他配置】-【是否开启节点富文本编辑】设置关掉富文本编辑模式。',
|
||||
root: '根节点',
|
||||
splitByWrap: '是否按换行自动分割节点?',
|
||||
tip: '提示',
|
||||
yes: '是',
|
||||
no: '否'
|
||||
},
|
||||
mouseAction: {
|
||||
tip1: '当前:左键拖动画布,右键框选节点',
|
||||
tip2: '当前:左键框选节点,右键拖动画布',
|
||||
tip2: '当前:左键框选节点,右键拖动画布'
|
||||
},
|
||||
search: {
|
||||
searchPlaceholder: '请输入查找内容',
|
||||
@@ -229,5 +262,31 @@ export default {
|
||||
replace: '替换',
|
||||
replaceAll: '全部替换',
|
||||
cancel: '取消'
|
||||
},
|
||||
nodeIconSidebar: {
|
||||
title: '图标/贴纸',
|
||||
icon: '图标',
|
||||
sticker: '贴纸'
|
||||
},
|
||||
formulaSidebar: {
|
||||
title: '公式',
|
||||
placeholder: '请输入 LaText 语法',
|
||||
confirm: '完成',
|
||||
common: '常用公式',
|
||||
tip: '非富文本模式下不支持插入公式'
|
||||
},
|
||||
richTextToolbar: {
|
||||
bold: '加粗',
|
||||
italic: '斜体',
|
||||
underline: '下划线',
|
||||
strike: '删除线',
|
||||
fontFamily: '字体',
|
||||
fontSize: '字号',
|
||||
color: '字体颜色',
|
||||
backgroundColor: '背景颜色',
|
||||
removeFormat: '清除样式'
|
||||
},
|
||||
other: {
|
||||
loading: '正在加载,请稍后...'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ let APIList = [
|
||||
'search',
|
||||
'painter',
|
||||
'scrollbar',
|
||||
'formula',
|
||||
'cooperate',
|
||||
'xmind',
|
||||
'markdown',
|
||||
'utils'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user