feat: 增加自动生成dts声明文件,执行了一下format

This commit is contained in:
wanghao1993
2023-09-17 18:08:56 +08:00
parent 1452fd2a28
commit 19d4788489
103 changed files with 2051 additions and 174 deletions

View File

@@ -28,8 +28,7 @@ MindMap.constants = constants
MindMap.themes = themes
MindMap.defaultTheme = defaultTheme
MindMap
.usePlugin(MiniMap)
MindMap.usePlugin(MiniMap)
.usePlugin(Watermark)
.usePlugin(Drag)
.usePlugin(KeyboardNavigation)

View File

@@ -1,14 +0,0 @@
// declare module "simple-mind-map";
declare module 'simple-mind-map'{
class MindMap {
constructor(opt:any);
handleOpt(opt:any):void;
render(callback:any, source:string):void;
reRender(callback:any, source:string):void;
resize():void;
on(event:any, fn:any):void;
setFullData(data:any):void;
getData(withConfig:any):any;
}
export default MindMap;
}

View File

@@ -24,6 +24,10 @@ import { defaultOpt } from './src/constants/defaultOptions'
// 思维导图
class MindMap {
// 构造函数
/**
*
* @param {defaultOpt} opt
*/
constructor(opt = {}) {
// 合并选项
this.opt = this.handleOpt(merge(defaultOpt, opt))
@@ -36,7 +40,8 @@ class MindMap {
// 画布宽高
this.width = this.elRect.width
this.height = this.elRect.height
if (this.width <= 0 || this.height <= 0) throw new Error('容器元素el的宽高不能为0')
if (this.width <= 0 || this.height <= 0)
throw new Error('容器元素el的宽高不能为0')
// 添加css
this.cssEl = null
@@ -360,7 +365,7 @@ class MindMap {
// 克隆一份数据
let clone = svg.clone()
// 添加必要的样式
clone.add(SVG(`<style>${ cssContent }</style>`))
clone.add(SVG(`<style>${cssContent}</style>`))
// 如果实际图形宽高超出了屏幕宽高,且存在水印的话需要重新绘制水印,否则会出现超出部分没有水印的问题
if (
(rect.width > origWidth || rect.height > origHeight) &&

View File

@@ -12,6 +12,7 @@
"url": "http://lxqnsys.com/"
}
],
"types": "./types/index.d.ts",
"license": "MIT",
"repository": {
"type": "git",
@@ -19,7 +20,8 @@
},
"scripts": {
"lint": "eslint src/",
"format": "prettier --write ."
"format": "prettier --write .",
"types": "npx -p typescript tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types --target es2017"
},
"module": "index.js",
"__main": "./dist/simpleMindMap.umd.min.js",
@@ -31,6 +33,7 @@
"jszip": "^3.10.1",
"mdast-util-from-markdown": "^1.3.0",
"quill": "^1.3.6",
"tern": "^0.24.3",
"uuid": "^9.0.0",
"xml-js": "^1.6.11"
},

View File

@@ -17,7 +17,7 @@ const transform = dir => {
}
const transformFile = file => {
console.log(file);
console.log(file)
let content = fs.readFileSync(file, 'utf-8')
countCodeLines(content)
// transformComments(file, content)
@@ -25,7 +25,7 @@ const transformFile = file => {
// 统计代码行数
let totalLines = 0
const countCodeLines = (content) => {
const countCodeLines = content => {
totalLines += content.split(/\n/).length
}
@@ -43,4 +43,4 @@ const transformComments = (file, content) => {
transform(entryPath)
transformFile(path.join(__dirname, '../index.js'))
console.log(totalLines);
console.log(totalLines)

View File

@@ -261,42 +261,42 @@ export const initRootNodePositionMap = {
[CONSTANTS.INIT_ROOT_NODE_POSITION.TOP]: 0,
[CONSTANTS.INIT_ROOT_NODE_POSITION.RIGHT]: 1,
[CONSTANTS.INIT_ROOT_NODE_POSITION.BOTTOM]: 1,
[CONSTANTS.INIT_ROOT_NODE_POSITION.CENTER]: 0.5,
[CONSTANTS.INIT_ROOT_NODE_POSITION.CENTER]: 0.5
}
// 布局结构列表
export const layoutList = [
{
name: '逻辑结构图',
value: CONSTANTS.LAYOUT.LOGICAL_STRUCTURE,
value: CONSTANTS.LAYOUT.LOGICAL_STRUCTURE
},
{
name: '思维导图',
value: CONSTANTS.LAYOUT.MIND_MAP,
value: CONSTANTS.LAYOUT.MIND_MAP
},
{
name: '组织结构图',
value: CONSTANTS.LAYOUT.ORGANIZATION_STRUCTURE,
value: CONSTANTS.LAYOUT.ORGANIZATION_STRUCTURE
},
{
name: '目录组织图',
value: CONSTANTS.LAYOUT.CATALOG_ORGANIZATION,
value: CONSTANTS.LAYOUT.CATALOG_ORGANIZATION
},
{
name: '时间轴',
value: CONSTANTS.LAYOUT.TIMELINE,
value: CONSTANTS.LAYOUT.TIMELINE
},
{
name: '时间轴2',
value: CONSTANTS.LAYOUT.TIMELINE2,
value: CONSTANTS.LAYOUT.TIMELINE2
},
{
name: '竖向时间轴',
value: CONSTANTS.LAYOUT.VERTICAL_TIMELINE,
value: CONSTANTS.LAYOUT.VERTICAL_TIMELINE
},
{
name: '鱼骨图',
value: CONSTANTS.LAYOUT.FISHBONE,
value: CONSTANTS.LAYOUT.FISHBONE
}
]
export const layoutValueList = [

View File

@@ -37,7 +37,11 @@ class Command {
this.commands[name].forEach(fn => {
fn(...args)
})
if (['BACK', 'FORWARD', 'SET_NODE_ACTIVE', 'CLEAR_ACTIVE_NODE'].includes(name)) {
if (
['BACK', 'FORWARD', 'SET_NODE_ACTIVE', 'CLEAR_ACTIVE_NODE'].includes(
name
)
) {
return
}
this.addHistory()
@@ -78,7 +82,11 @@ class Command {
}
let data = this.getCopyData()
// 此次数据和上次一样则不重复添加
if (this.history.length > 0 && JSON.stringify(this.history[this.history.length - 1]) === JSON.stringify(data)) {
if (
this.history.length > 0 &&
JSON.stringify(this.history[this.history.length - 1]) ===
JSON.stringify(data)
) {
return
}
// 删除当前历史指针后面的数据
@@ -123,7 +131,11 @@ class Command {
let len = this.history.length
if (this.activeHistoryIndex + step <= len - 1) {
this.activeHistoryIndex += step
this.mindMap.emit('back_forward', this.activeHistoryIndex, this.history.length)
this.mindMap.emit(
'back_forward',
this.activeHistoryIndex,
this.history.length
)
let data = simpleDeepClone(this.history[this.activeHistoryIndex])
this.mindMap.emit('data_change', data)
return data
@@ -138,10 +150,10 @@ class Command {
// 移除节点数据中的uid
removeDataUid(data) {
data = simpleDeepClone(data)
let walk = (root) => {
let walk = root => {
delete root.data.uid
if (root.children && root.children.length > 0) {
root.children.forEach((item) => {
root.children.forEach(item => {
walk(item)
})
}

View File

@@ -46,13 +46,20 @@ export default class KeyCommand {
if (this.mindMap.richText && this.mindMap.richText.showTextEdit) {
return
}
if (this.mindMap.renderer.textEdit.showTextEdit || (this.mindMap.associativeLine && this.mindMap.associativeLine.showTextEdit)) {
if (
this.mindMap.renderer.textEdit.showTextEdit ||
(this.mindMap.associativeLine &&
this.mindMap.associativeLine.showTextEdit)
) {
return
}
this.isInSvg = false
})
window.addEventListener('keydown', e => {
if (this.isPause || (this.mindMap.opt.enableShortcutOnlyWhenMouseInSvg && !this.isInSvg)) {
if (
this.isPause ||
(this.mindMap.opt.enableShortcutOnlyWhenMouseInSvg && !this.isInSvg)
) {
return
}
Object.keys(this.shortcutMap).forEach(key => {

View File

@@ -394,7 +394,11 @@ class Node {
this.active(e)
})
this.group.on('mousedown', e => {
const { readonly, enableCtrlKeyNodeSelection, useLeftKeySelectionRightKeyDrag } = this.mindMap.opt
const {
readonly,
enableCtrlKeyNodeSelection,
useLeftKeySelectionRightKeyDrag
} = this.mindMap.opt
// 只读模式不需要阻止冒泡
if (!readonly) {
if (this.isRoot) {
@@ -423,11 +427,9 @@ class Node {
this.mindMap.renderer[isActive ? 'removeActiveNode' : 'addActiveNode'](
this
)
this.mindMap.emit(
'node_active',
isActive ? null : this,
[...this.mindMap.renderer.activeNodeList]
)
this.mindMap.emit('node_active', isActive ? null : this, [
...this.mindMap.renderer.activeNodeList
])
}
this.mindMap.emit('node_mousedown', this, e)
})
@@ -466,7 +468,11 @@ class Node {
e.stopPropagation()
e.preventDefault()
// 如果是多选节点结束,那么不要触发右键菜单事件
if(this.mindMap.select && !useLeftKeySelectionRightKeyDrag && this.mindMap.select.hasSelectRange()) {
if (
this.mindMap.select &&
!useLeftKeySelectionRightKeyDrag &&
this.mindMap.select.hasSelectRange()
) {
return
}
if (this.nodeData.data.isActive) {

View File

@@ -234,10 +234,7 @@ class Style {
// hover和激活节点
hoverNode(node) {
const { hoverRectColor } = this.ctx.mindMap.opt
node
.radius(5)
.fill('none')
.stroke({
node.radius(5).fill('none').stroke({
color: hoverRectColor
})
}

View File

@@ -70,7 +70,8 @@ function updateExpandBtnNode() {
if (this._expandBtn) {
// 如果是收起按钮加上边框
let { isShowExpandNum, expandBtnStyle, expandBtnNumHandler } = this.mindMap.opt
let { isShowExpandNum, expandBtnStyle, expandBtnNumHandler } =
this.mindMap.opt
if (isShowExpandNum) {
if (!expand) {
// 数字按钮添加边框

View File

@@ -2,12 +2,12 @@ import Node from './Node'
import { createUid } from '../../../utils/index'
// 检查是否存在概要
function checkHasGeneralization () {
function checkHasGeneralization() {
return !!this.nodeData.data.generalization
}
// 创建概要节点
function createGeneralizationNode () {
function createGeneralizationNode() {
if (this.isGeneralization || !this.checkHasGeneralization()) {
return
}
@@ -35,14 +35,14 @@ function createGeneralizationNode () {
}
// 更新概要节点
function updateGeneralization () {
function updateGeneralization() {
if (this.isGeneralization) return
this.removeGeneralization()
this.createGeneralizationNode()
}
// 渲染概要节点
function renderGeneralization () {
function renderGeneralization() {
if (this.isGeneralization) return
if (!this.checkHasGeneralization()) {
this.removeGeneralization()
@@ -65,7 +65,7 @@ function renderGeneralization () {
}
// 删除概要节点
function removeGeneralization () {
function removeGeneralization() {
if (this.isGeneralization) return
if (this._generalizationLine) {
this._generalizationLine.remove()
@@ -86,7 +86,7 @@ function removeGeneralization () {
}
// 隐藏概要节点
function hideGeneralization () {
function hideGeneralization() {
if (this.isGeneralization) return
if (this._generalizationLine) {
this._generalizationLine.hide()
@@ -97,7 +97,7 @@ function hideGeneralization () {
}
// 显示概要节点
function showGeneralization () {
function showGeneralization() {
if (this.isGeneralization) return
if (this._generalizationLine) {
this._generalizationLine.show()

View File

@@ -79,7 +79,10 @@ class View {
// 鼠标滚轮事件控制缩放
if (mousewheelAction === CONSTANTS.MOUSE_WHEEL_ACTION.ZOOM) {
if (disableMouseWheelZoom) return
const { x: clientX, y: clientY } = this.mindMap.toPos(e.clientX, e.clientY)
const { x: clientX, y: clientY } = this.mindMap.toPos(
e.clientX,
e.clientY
)
let cx = mouseScaleCenterUseMousePosition ? clientX : undefined
let cy = mouseScaleCenterUseMousePosition ? clientY : undefined
switch (dir) {

View File

@@ -87,11 +87,18 @@ class CatalogOrganization extends Base {
totalLeft += cur.width + marginX
})
} else {
let totalTop = node.top + this.getNodeHeightWithGeneralization(node) + marginY + (this.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0)
let totalTop =
node.top +
this.getNodeHeightWithGeneralization(node) +
marginY +
(this.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0)
node.children.forEach(cur => {
cur.left = node.left + node.width * 0.5
cur.top = totalTop
totalTop += this.getNodeHeightWithGeneralization(cur) + marginY + (this.getNodeActChildrenLength(cur) > 0 ? cur.expandBtnSize : 0)
totalTop +=
this.getNodeHeightWithGeneralization(cur) +
marginY +
(this.getNodeActChildrenLength(cur) > 0 ? cur.expandBtnSize : 0)
})
}
}
@@ -124,7 +131,13 @@ class CatalogOrganization extends Base {
let marginY = this.getMarginY(layerIndex + 1)
let totalHeight =
node.children.reduce((h, item) => {
return h + this.getNodeHeightWithGeneralization(item) + (this.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0)
return (
h +
this.getNodeHeightWithGeneralization(item) +
(this.getNodeActChildrenLength(item) > 0
? item.expandBtnSize
: 0)
)
}, 0) +
len * marginY
this.updateBrothersTop(node, totalHeight)
@@ -134,7 +147,7 @@ class CatalogOrganization extends Base {
if (isRoot) {
let { right, left } = this.getNodeBoundaries(node, 'h')
let childrenWidth = right - left
let offset = (node.left - left) - (childrenWidth - node.width) / 2
let offset = node.left - left - (childrenWidth - node.width) / 2
this.updateChildren(node.children, 'left', offset)
}
},

View File

@@ -159,7 +159,8 @@ class Fishbone extends Base {
let marginY = this.getMarginY(node.layerIndex)
totalHeight +=
node.height +
(this.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) + marginY
(this.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) +
marginY
if (node.children.length) {
node.children.forEach(item => {
loop(item)

View File

@@ -170,7 +170,8 @@ class Fishbone extends Base {
item.top += _top
// 调整left
let offsetLeft =
(totalHeight2 + nodeTotalHeight) / Math.tan(degToRad(this.mindMap.opt.fishboneDeg))
(totalHeight2 + nodeTotalHeight) /
Math.tan(degToRad(this.mindMap.opt.fishboneDeg))
item.left += offsetLeft
totalHeight += offset
totalHeight2 += nodeTotalHeight
@@ -312,7 +313,9 @@ class Fishbone extends Base {
if (node.parent && node.parent.isRoot) {
line.plot(
`M ${x},${top + height} L ${x + lineLength},${
top + height + Math.tan(degToRad(this.mindMap.opt.fishboneDeg)) * lineLength
top +
height +
Math.tan(degToRad(this.mindMap.opt.fishboneDeg)) * lineLength
}`
)
} else {

View File

@@ -140,7 +140,8 @@ class Fishbone extends Base {
node.top - (item.top - node.top) - nodeTotalHeight + node.height
// 调整left
let offsetLeft =
(nodeTotalHeight + totalHeight) / Math.tan(degToRad(this.mindMap.opt.fishboneDeg))
(nodeTotalHeight + totalHeight) /
Math.tan(degToRad(this.mindMap.opt.fishboneDeg))
item.left += offsetLeft
totalHeight += nodeTotalHeight
// 同步更新后代节点
@@ -285,14 +286,16 @@ class Fishbone extends Base {
) {
line.plot(
`M ${x},${top} L ${x + lineLength},${
top - Math.tan(degToRad(this.mindMap.opt.fishboneDeg)) * lineLength
top -
Math.tan(degToRad(this.mindMap.opt.fishboneDeg)) * lineLength
}`
)
} else {
if (node.parent && node.parent.isRoot) {
line.plot(
`M ${x},${top} L ${x + lineLength},${
top - Math.tan(degToRad(this.mindMap.opt.fishboneDeg)) * lineLength
top -
Math.tan(degToRad(this.mindMap.opt.fishboneDeg)) * lineLength
}`
)
} else {

View File

@@ -57,8 +57,14 @@ class LogicalStructure extends Base {
(len + 1) * this.getMarginY(layerIndex + 1)
: 0
// 如果存在概要,则和概要的高度取最大值
let generalizationNodeHeight = cur._node.checkHasGeneralization() ? cur._node._generalizationNodeHeight + this.getMarginY(layerIndex + 1) : 0
cur._node.childrenAreaHeight2 = Math.max(cur._node.childrenAreaHeight, generalizationNodeHeight)
let generalizationNodeHeight = cur._node.checkHasGeneralization()
? cur._node._generalizationNodeHeight +
this.getMarginY(layerIndex + 1)
: 0
cur._node.childrenAreaHeight2 = Math.max(
cur._node.childrenAreaHeight,
generalizationNodeHeight
)
},
true,
0
@@ -103,7 +109,8 @@ class LogicalStructure extends Base {
// 判断子节点所占的高度之和是否大于该节点自身,大于则需要调整位置
let difference =
node.childrenAreaHeight2 -
this.getMarginY(layerIndex + 1) * 2 - node.height
this.getMarginY(layerIndex + 1) * 2 -
node.height
if (difference > 0) {
this.updateBrothers(node, difference / 2)
}

View File

@@ -92,9 +92,18 @@ class MindMap extends Base {
(rightLen + 1) * this.getMarginY(layerIndex + 1)
// 如果存在概要,则和概要的高度取最大值
let generalizationNodeHeight = cur._node.checkHasGeneralization() ? cur._node._generalizationNodeHeight + this.getMarginY(layerIndex + 1) : 0
cur._node.leftChildrenAreaHeight2 = Math.max(cur._node.leftChildrenAreaHeight, generalizationNodeHeight)
cur._node.rightChildrenAreaHeight2 = Math.max(cur._node.rightChildrenAreaHeight, generalizationNodeHeight)
let generalizationNodeHeight = cur._node.checkHasGeneralization()
? cur._node._generalizationNodeHeight +
this.getMarginY(layerIndex + 1)
: 0
cur._node.leftChildrenAreaHeight2 = Math.max(
cur._node.leftChildrenAreaHeight,
generalizationNodeHeight
)
cur._node.rightChildrenAreaHeight2 = Math.max(
cur._node.rightChildrenAreaHeight,
generalizationNodeHeight
)
},
true,
0

View File

@@ -59,8 +59,13 @@ class OrganizationStructure extends Base {
: 0
// 如果存在概要,则和概要的高度取最大值
let generalizationNodeWidth = cur._node.checkHasGeneralization() ? cur._node._generalizationNodeWidth + this.getMarginY(layerIndex + 1) : 0
cur._node.childrenAreaWidth2 = Math.max(cur._node.childrenAreaWidth, generalizationNodeWidth)
let generalizationNodeWidth = cur._node.checkHasGeneralization()
? cur._node._generalizationNodeWidth + this.getMarginY(layerIndex + 1)
: 0
cur._node.childrenAreaWidth2 = Math.max(
cur._node.childrenAreaWidth,
generalizationNodeWidth
)
},
true,
0

View File

@@ -52,13 +52,15 @@ export default {
let totalTop =
node.top +
node.height +
(ctx.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) + marginY
(ctx.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) +
marginY
node.children.forEach(item => {
item.left = startLeft
item.top += totalTop
totalTop +=
item.height +
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) + marginY
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) +
marginY
})
}
},
@@ -72,7 +74,8 @@ export default {
return (
h +
item.height +
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) + marginY
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) +
marginY
)
}, 0)
ctx.updateBrothersTop(node, totalHeight)
@@ -92,7 +95,11 @@ export default {
item.top =
node.top - (item.top - node.top) - nodeTotalHeight + node.height
// 调整left
item.left = node.left + node.width * ctx.indent + (nodeTotalHeight + totalHeight) / Math.tan(degToRad(ctx.mindMap.opt.fishboneDeg))
item.left =
node.left +
node.width * ctx.indent +
(nodeTotalHeight + totalHeight) /
Math.tan(degToRad(ctx.mindMap.opt.fishboneDeg))
totalHeight += nodeTotalHeight
// 同步更新后代节点
ctx.updateChildrenPro(item.children, {
@@ -129,7 +136,9 @@ export default {
if (node.parent && node.parent.isRoot) {
line.plot(
`M ${x},${top + height} L ${x + lineLength},${
top + height + Math.tan(degToRad(ctx.mindMap.opt.fishboneDeg)) * lineLength
top +
height +
Math.tan(degToRad(ctx.mindMap.opt.fishboneDeg)) * lineLength
}`
)
} else {
@@ -144,7 +153,8 @@ export default {
let totalTop =
node.top +
node.height +
(ctx.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) + marginY
(ctx.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) +
marginY
node.children.forEach(item => {
item.left = startLeft
@@ -153,7 +163,8 @@ export default {
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0)
totalTop +=
item.height +
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) + marginY
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) +
marginY
})
}
if (layerIndex > 1 && node.children) {
@@ -161,13 +172,15 @@ export default {
let startLeft = node.left + node.width * ctx.childIndent
let totalTop =
node.top -
(ctx.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) - marginY
(ctx.getNodeActChildrenLength(node) > 0 ? node.expandBtnSize : 0) -
marginY
node.children.forEach(item => {
item.left = startLeft
item.top = totalTop - item.height
totalTop -=
item.height +
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) + marginY
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) +
marginY
})
}
},
@@ -180,7 +193,8 @@ export default {
return (
h +
item.height +
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) + marginY
(ctx.getNodeActChildrenLength(item) > 0 ? item.expandBtnSize : 0) +
marginY
)
}, 0)
ctx.updateBrothersTop(node, -totalHeight)
@@ -197,18 +211,21 @@ export default {
// 调整top
let hasChildren = ctx.getNodeActChildrenLength(item) > 0
let nodeTotalHeight = ctx.getNodeAreaHeight(item)
let offset =
hasChildren
let offset = hasChildren
? nodeTotalHeight -
item.height -
(hasChildren ? item.expandBtnSize : 0)
: 0
offset -= (hasChildren ? marginY : 0)
offset -= hasChildren ? marginY : 0
let _top = totalHeight + offset
let _left = item.left
item.top += _top
// 调整left
item.left = node.left + node.width * ctx.indent + (nodeTotalHeight + totalHeight2) / Math.tan(degToRad(ctx.mindMap.opt.fishboneDeg))
item.left =
node.left +
node.width * ctx.indent +
(nodeTotalHeight + totalHeight2) /
Math.tan(degToRad(ctx.mindMap.opt.fishboneDeg))
totalHeight += offset
totalHeight2 += nodeTotalHeight
// 同步更新后代节点

View File

@@ -191,7 +191,7 @@ const transformOldXmind = content => {
if (_children && _children.elements && _children.elements.length > 0) {
_children.elements.forEach(item => {
if (item.name === 'topics') {
(item.elements || []).forEach(item2 => {
;(item.elements || []).forEach(item2 => {
let newChild = {}
newNode.children.push(newChild)
walk(item2, newChild)

View File

@@ -58,7 +58,13 @@ class Export {
}
// svg转png
svgToPng(svgSrc, transparent, checkRotate = () => { return false }) {
svgToPng(
svgSrc,
transparent,
checkRotate = () => {
return false
}
) {
return new Promise((resolve, reject) => {
const img = new Image()
// 跨域图片需要添加这个属性,否则画布被污染了无法导出图片
@@ -66,7 +72,10 @@ class Export {
img.onload = async () => {
try {
const canvas = document.createElement('canvas')
const dpr = Math.max(window.devicePixelRatio, this.mindMap.opt.minExportImgCanvasScale)
const dpr = Math.max(
window.devicePixelRatio,
this.mindMap.opt.minExportImgCanvasScale
)
const imgWidth = img.width
const imgHeight = img.height
// 如果宽比高长那么旋转90度
@@ -185,7 +194,9 @@ class Export {
// 覆盖html默认的样式
let foreignObjectList = node.find('foreignObject')
if (foreignObjectList.length > 0) {
foreignObjectList[0].add(SVG(`<style>${ this.mindMap.opt.resetCss }</style>`))
foreignObjectList[0].add(
SVG(`<style>${this.mindMap.opt.resetCss}</style>`)
)
}
str = node.svg()
// 使用其他库html2canvas、dom-to-image-more等来完成导出
@@ -204,11 +215,7 @@ class Export {
// 转换成data:url数据
let svgUrl = await readBlob(blob)
// 绘制到canvas上
let res = await this.svgToPng(
svgUrl,
transparent,
checkRotate
)
let res = await this.svgToPng(svgUrl, transparent, checkRotate)
return res
}
@@ -219,7 +226,7 @@ class Export {
}
let img = await this.png('', false, (width, height) => {
if (width <= a4Size.width && height && a4Size.height) return false
return (width / height) > 1
return width / height > 1
})
this.mindMap.doExportPDF.pdf(name, img, useMultiPageExport)
}
@@ -243,7 +250,9 @@ class Export {
if (this.mindMap.richText) {
let foreignObjectList = node.find('foreignObject')
if (foreignObjectList.length > 0) {
foreignObjectList[0].add(SVG(`<style>${ this.mindMap.opt.resetCss }</style>`))
foreignObjectList[0].add(
SVG(`<style>${this.mindMap.opt.resetCss}</style>`)
)
}
}
node.first().before(SVG(`<title>${name}</title>`))

View File

@@ -40,7 +40,14 @@ class ExportPDF {
w = a4Size.width
h = a4Size.width / imageRatio
}
pdf.addImage(img, 'PNG', (a4Size.width - w) / 2, (a4Size.height - h) / 2, w, h)
pdf.addImage(
img,
'PNG',
(a4Size.width - w) / 2,
(a4Size.height - h) / 2,
w,
h
)
pdf.save(name)
}
image.src = img

View File

@@ -1,4 +1,8 @@
import { isWhite, isTransparent, getVisibleColorFromTheme } from '../utils/index'
import {
isWhite,
isTransparent,
getVisibleColorFromTheme
} from '../utils/index'
// 小地图插件
class MiniMap {
@@ -78,7 +82,7 @@ class MiniMap {
viewBoxStyle.left = miniMapBoxLeft + actWidth
}
Object.keys(viewBoxStyle).forEach((key) => {
Object.keys(viewBoxStyle).forEach(key => {
viewBoxStyle[key] = viewBoxStyle[key] + 'px'
})
@@ -106,7 +110,7 @@ class MiniMap {
}
let children = svg.children()
if (children && children.length > 0) {
children.forEach((node) => {
children.forEach(node => {
this.removeNodeContent(node)
})
}

View File

@@ -49,7 +49,7 @@ class NodeImgAdjust {
// 如果当前正在拖动调整中那么直接返回
if (this.isMousedown || this.isAdjusted || this.mindMap.opt.readonly) return
// 如果在当前节点内移动,以及自定义元素已经是显示状态,那么直接返回
if ((this.node && this.node.uid === node.uid) && this.isShowHandleEl) return
if (this.node && this.node.uid === node.uid && this.isShowHandleEl) return
// 更新当前节点信息
this.node = node
this.img = img

View File

@@ -249,7 +249,9 @@ class RichText {
this.showTextEdit = true
// 如果是刚创建的节点那么默认全选否则普通激活不全选除非selectTextOnEnterEditText配置为true
// 在selectTextOnEnterEditText时如果是在keydown事件进入的节点编辑也不需要全选
this.focus(isInserting || (selectTextOnEnterEditText && !isFromKeyDown) ? 0 : null)
this.focus(
isInserting || (selectTextOnEnterEditText && !isFromKeyDown) ? 0 : null
)
if (!node.nodeData.data.richText) {
// 如果是非富文本的情况,需要手动应用文本样式
this.setTextStyleIfNotRichText(node)
@@ -373,7 +375,7 @@ class RichText {
}
})
// 拦截粘贴,只允许粘贴纯文本
this.quill.clipboard.addMatcher(Node.TEXT_NODE, (node) => {
this.quill.clipboard.addMatcher(Node.TEXT_NODE, node => {
let style = this.getPasteTextStyle()
return new Delta().insert(node.data, style)
})

View File

@@ -1,4 +1,9 @@
import { bfsWalk, getTextFromHtml, isUndef, replaceHtmlText } from '../utils/index'
import {
bfsWalk,
getTextFromHtml,
isUndef,
replaceHtmlText
} from '../utils/index'
// 搜索插件
class Search {

View File

@@ -109,7 +109,10 @@ class Watermark {
// 更新水印
updateWatermark(config) {
this.mindMap.opt.watermarkConfig = merge(this.mindMap.opt.watermarkConfig, config)
this.mindMap.opt.watermarkConfig = merge(
this.mindMap.opt.watermarkConfig,
config
)
this.handleConfig(config)
this.draw()
}

View File

@@ -119,10 +119,8 @@ function getText(node, toNode) {
// 渲染关联线文字
function renderText(str, path, text) {
if (!str) return
let {
associativeLineTextFontSize,
associativeLineTextLineHeight
} = this.mindMap.themeConfig
let { associativeLineTextFontSize, associativeLineTextLineHeight } =
this.mindMap.themeConfig
text.clear()
let textArr = str.split(/\n/gim)
textArr.forEach((item, index) => {

View File

@@ -161,12 +161,14 @@ const nodeSizeIndependenceList = [
'backgroundSize',
'rootLineKeepSameInCurve'
]
export const checkIsNodeSizeIndependenceConfig = (config) => {
export const checkIsNodeSizeIndependenceConfig = config => {
let keys = Object.keys(config)
for(let i = 0; i < keys.length; i++) {
if (!nodeSizeIndependenceList.find((item) => {
for (let i = 0; i < keys.length; i++) {
if (
!nodeSizeIndependenceList.find(item => {
return item === keys[i]
})) {
})
) {
return false
}
}

View File

@@ -17,7 +17,6 @@ export default class CRU {
let last = keys.next()
this.delete(last.value)
}
}
delete(key) {

View File

@@ -637,7 +637,7 @@ export const isMobile = () => {
// 获取对象改变了的的属性
export const getObjectChangedProps = (oldObject, newObject) => {
const res = {}
Object.keys(newObject).forEach((prop) => {
Object.keys(newObject).forEach(prop => {
const oldVal = oldObject[prop]
const newVal = newObject[prop]
if (getType(oldVal) !== getType(newVal)) {
@@ -660,7 +660,7 @@ export const getObjectChangedProps = (oldObject, newObject) => {
}
// 判断一个字段是否是节点数据中的样式字段
export const checkIsNodeStyleDataKey = (key) => {
export const checkIsNodeStyleDataKey = key => {
// 用户自定义字段
if (/^_/.test(key)) return false
// 不在节点非样式字段列表里,那么就是样式字段

166
simple-mind-map/types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,166 @@
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
}
declare namespace MindMap {
let 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'

View File

@@ -0,0 +1,113 @@
export const tagColorList: {
color: string
background: string
}[]
export const themeList: {
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
}
}
export const initRootNodePositionMap: {
[x: string]: number
}
export const layoutList: {
name: string
value: string
}[]
export const layoutValueList: string[]
export const nodeDataNoStylePropList: string[]
export namespace commonCaches {
let measureCustomNodeContentSizeEl: any
let 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
}
export namespace a4Size {
let width: number
let 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'

View File

@@ -0,0 +1,82 @@
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
}
}
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
}

View File

@@ -0,0 +1,19 @@
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
}

View File

@@ -0,0 +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[]
}

View File

@@ -0,0 +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

View File

@@ -0,0 +1,35 @@
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
}

View File

@@ -0,0 +1,107 @@
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
}
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'

View File

@@ -0,0 +1,29 @@
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
}

View File

@@ -0,0 +1,116 @@
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
}
import Style from './Style'
import Shape from './Shape'

View File

@@ -0,0 +1,28 @@
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
}
export const shapeList: string[]

View File

@@ -0,0 +1,43 @@
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
}
declare namespace Style {
let cacheStyle: any
}

View File

@@ -0,0 +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 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

View File

@@ -0,0 +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 default _default
declare function createImgNode(): {
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
declare function createHyperlinkNode(): {
node: any
width: any
height: any
}
declare function createTagNode(): any[]
declare function createNoteNode(): {
node: any
width: any
height: any
}
declare class createNoteNode {
noteEl: HTMLDivElement
}
declare function measureCustomNodeContentSize(content: any): {
width: any
height: any
}
declare function isUseCustomNodeContent(): boolean

View File

@@ -0,0 +1,34 @@
declare namespace _default {
export { createExpandNodeContent }
export { updateExpandBtnNode }
export { updateExpandBtnPos }
export { renderExpandBtn }
export { removeExpandBtn }
export { showExpandBtn }
export { hideExpandBtn }
export { sumNode }
}
export default _default
declare function createExpandNodeContent(): void
declare class createExpandNodeContent {
_openExpandNode: any
_closeExpandNode: any
_fillExpandNode: any
}
declare function updateExpandBtnNode(): void
declare class updateExpandBtnNode {
_lastExpandBtnType: boolean
}
declare function updateExpandBtnPos(): void
declare function renderExpandBtn(): void
declare class renderExpandBtn {
_expandBtn: any
_showExpandBtn: boolean
}
declare function removeExpandBtn(): void
declare class removeExpandBtn {
_showExpandBtn: boolean
}
declare function showExpandBtn(): void
declare function hideExpandBtn(): void
declare function sumNode(data?: any[]): any

View File

@@ -0,0 +1,18 @@
declare namespace _default {
export { renderExpandBtnPlaceholderRect }
export { clearExpandBtnPlaceholderRect }
export { updateExpandBtnPlaceholderRect }
}
export default _default
declare function renderExpandBtnPlaceholderRect(): void
declare class renderExpandBtnPlaceholderRect {
_unVisibleRectRegionNode: any
}
declare function clearExpandBtnPlaceholderRect(): void
declare class clearExpandBtnPlaceholderRect {
_unVisibleRectRegionNode: any
}
declare function updateExpandBtnPlaceholderRect(): void
declare class updateExpandBtnPlaceholderRect {
needRerenderExpandBtnPlaceholderRect: boolean
}

View File

@@ -0,0 +1,32 @@
declare namespace _default {
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
declare class createGeneralizationNode {
_generalizationLine: any
_generalizationNode: Node
_generalizationNodeWidth: any
_generalizationNodeHeight: any
}
declare function updateGeneralization(): void
declare function renderGeneralization(): void
declare class renderGeneralization {
_generalizationNodeWidth: number
_generalizationNodeHeight: number
}
declare function removeGeneralization(): void
declare class removeGeneralization {
_generalizationLine: any
_generalizationNode: any
}
declare function hideGeneralization(): void
declare function showGeneralization(): void
import Node from './Node'

View File

@@ -0,0 +1,36 @@
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
}

View File

@@ -0,0 +1,46 @@
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
}
import Lru from '../utils/Lru'

View File

@@ -0,0 +1,21 @@
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
}
import Base from './Base'

View File

@@ -0,0 +1,25 @@
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
}
import Base from './Base'

View File

@@ -0,0 +1,23 @@
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
}
import Base from './Base'

View File

@@ -0,0 +1,23 @@
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
}
import Base from './Base'

View File

@@ -0,0 +1,22 @@
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
}
import Base from './Base'

View File

@@ -0,0 +1,23 @@
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
}
import Base from './Base'

View File

@@ -0,0 +1,25 @@
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
}
import Base from './Base'

View File

@@ -0,0 +1,137 @@
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
}
}
export default _default

11
simple-mind-map/types/src/svg/btns.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
declare namespace _default {
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>'

View File

@@ -0,0 +1,18 @@
export const nodeIconList: {
name: string
type: string
list: {
name: string
icon: string
}[]
}[]
declare namespace _default {
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

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +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 }
}
}
export default _default
export const supportActiveStyle: string[]
export function checkIsNodeSizeIndependenceConfig(config: any): boolean
export const lineStyleProps: string[]

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,67 @@
declare namespace _default {
export { defaultTheme as default }
export { freshGreen }
export { blueSky }
export { brainImpairedPink }
export { romanticPurple }
export { freshRed }
export { earthYellow }
export { classic }
export { classic2 }
export { classic3 }
export { classic4 }
export { dark }
export { classicGreen }
export { classicBlue }
export { minions }
export { pinkGrape }
export { mint }
export { gold }
export { vitalityOrange }
export { greenLeaf }
export { dark2 }
export { skyGreen }
export { simpleBlack }
export { courseGreen }
export { coffee }
export { redSpirit }
export { blackHumour }
export { lateNightOffice }
export { blackGold }
export { avocado }
export { autumn }
export { orangeJuice }
}
export default _default
import defaultTheme from './default'
import freshGreen from './freshGreen'
import blueSky from './blueSky'
import brainImpairedPink from './brainImpairedPink'
import romanticPurple from './romanticPurple'
import freshRed from './freshRed'
import earthYellow from './earthYellow'
import classic from './classic'
import classic2 from './classic2'
import classic3 from './classic3'
import classic4 from './classic4'
import dark from './dark'
import classicGreen from './classicGreen'
import classicBlue from './classicBlue'
import minions from './minions'
import pinkGrape from './pinkGrape'
import mint from './mint'
import gold from './gold'
import vitalityOrange from './vitalityOrange'
import greenLeaf from './greenLeaf'
import dark2 from './dark2'
import skyGreen from './skyGreen'
import simpleBlack from './simpleBlack'
import courseGreen from './courseGreen'
import coffee from './coffee'
import redSpirit from './redSpirit'
import blackHumour from './blackHumour'
import lateNightOffice from './lateNightOffice'
import blackGold from './blackGold'
import avocado from './avocado'
import autumn from './autumn'
import orangeJuice from './orangeJuice'

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,2 @@
declare const _default: any
export default _default

View File

@@ -0,0 +1,8 @@
export default BatchExecution
declare class BatchExecution {
has: {}
queue: any[]
nextTick: any
push(name: any, fn: any): void
flush(): void
}

View File

@@ -0,0 +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
}

View File

@@ -0,0 +1,113 @@
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