-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from TingShine/feat/use-td
Feat/use td
- Loading branch information
Showing
13 changed files
with
146 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = { | ||
types: [ | ||
{ | ||
value: `feat`, | ||
name : 'feat: 新功能' | ||
}, | ||
{ | ||
value: `fix`, | ||
name : 'fix: 修复bug' | ||
}, | ||
{ | ||
value: `docs`, | ||
name : 'docs: 文档注释更改' | ||
}, | ||
{ | ||
value: `refactor`, | ||
name : 'refactor: 重构(不修复bug和新增功能)' | ||
}, | ||
{ | ||
value: `style`, | ||
name : 'style: 修改样式问题,不影响功能' | ||
}, | ||
{ | ||
value: `perf`, | ||
name : 'perf: 性能优化' | ||
}, | ||
{ | ||
value: `test`, | ||
name : 'test: 增加测试用例或修正测试用例' | ||
}, | ||
{ | ||
value: `revert`, | ||
name : 'revert: 回退版本' | ||
} | ||
], | ||
skipQuestions: ['body', 'scopes', 'breaking', 'footer'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
extends: ["@commitlint/config-conventional"], | ||
ignores: [(commit) => /Merge/.test(commit)], | ||
defaultIgnores: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ref } from "vue"; | ||
|
||
const treeData = ref<any[]>([]); | ||
|
||
export const useData = () => { | ||
return { | ||
treeData | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { INodeItem } from "./type"; | ||
import { useData } from "./useData"; | ||
import { canAddChildNode } from "./useTool"; | ||
|
||
export const useMove = () => { | ||
const { treeData } = useData(); | ||
|
||
const checkChildren = (parent: any[], list: any[]): false | INodeItem => { | ||
let parentNode = null; | ||
parent.some((node) => { | ||
if (node.children === list) { | ||
parentNode = node; | ||
return true; | ||
} | ||
|
||
if (Array.isArray(node.children) && node.children.length > 0) { | ||
return checkChildren(node.children, list); | ||
} | ||
|
||
return false; | ||
}); | ||
|
||
return parentNode || false; | ||
}; | ||
|
||
const handleMoveCallback = (evt: any): boolean => { | ||
const { draggedContext, relatedContext } = evt; | ||
|
||
if (!relatedContext.list) { | ||
return false; | ||
} | ||
const fromType = draggedContext.element?.type; | ||
const { list } = relatedContext; | ||
|
||
// 判断在root节点 | ||
if (treeData.value === list) { | ||
return canAddChildNode(fromType, "Single_Object"); | ||
} | ||
|
||
const node = checkChildren(treeData.value, list); | ||
if (node) { | ||
return canAddChildNode(fromType, node.type!); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
return { | ||
handleMoveCallback, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters