chore: lint files

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-04-11 20:28:02 +02:00
committed by Braks
parent ab18bbc7d8
commit 5560949ed1
23 changed files with 247 additions and 80 deletions
@@ -10,14 +10,22 @@ interface Props extends HTMLAttributes {
}
function shiftX(x: number, shift: number, position: Position): number {
if (position === Position.Left) return x - shift
if (position === Position.Right) return x + shift
if (position === Position.Left) {
return x - shift
}
if (position === Position.Right) {
return x + shift
}
return x
}
function shiftY(y: number, shift: number, position: Position): number {
if (position === Position.Top) return y - shift
if (position === Position.Bottom) return y + shift
if (position === Position.Top) {
return y - shift
}
if (position === Position.Bottom) {
return y + shift
}
return y
}
@@ -25,7 +25,9 @@ onMounted(getBox)
watch([() => x, () => y, $$(el), () => label], getBox)
function getBox() {
if (!el) return
if (!el) {
return
}
const nextBox = el.getBBox()
@@ -71,7 +71,9 @@ const EdgeWrapper = defineComponent({
})
return () => {
if (!sourceNode || !targetNode || !edge) return null
if (!sourceNode || !targetNode || !edge) {
return null
}
let sourceNodeHandles
if (connectionMode.value === ConnectionMode.Strict) {
@@ -238,7 +240,9 @@ const EdgeWrapper = defineComponent({
}
function handleEdgeUpdater(event: MouseEvent, isSourceHandle: boolean) {
if (event.button !== 0) return
if (event.button !== 0) {
return
}
updating = true
@@ -85,11 +85,15 @@ until(() => node.initialized)
.then(() => {
const existingBounds = node.handleBounds[type.value]?.find((b) => b.id === handleId.value)
if (!vueFlowRef.value || existingBounds) return
if (!vueFlowRef.value || existingBounds) {
return
}
const viewportNode = vueFlowRef.value.querySelector('.vue-flow__transformationpane')
if (!nodeEl || !handle.value || !viewportNode || !handleId.value) return
if (!nodeEl || !handle.value || !viewportNode || !handleId.value) {
return
}
const nodeBounds = nodeEl.value.getBoundingClientRect()
@@ -81,9 +81,13 @@ const NodeWrapper = defineComponent({
const width = node.width instanceof Function ? node.width(node) : node.width
const height = node.height instanceof Function ? node.height(node) : node.height
if (width) styles.width = typeof width === 'string' ? width : `${width}px`
if (width) {
styles.width = typeof width === 'string' ? width : `${width}px`
}
if (height) styles.height = typeof height === 'string' ? height : `${height}px`
if (height) {
styles.height = typeof height === 'string' ? height : `${height}px`
}
return styles
})
@@ -248,7 +252,9 @@ const NodeWrapper = defineComponent({
}
function updateInternals() {
if (nodeElement.value) updateNodeDimensions([{ id: props.id, nodeElement: nodeElement.value, forceUpdate: true }])
if (nodeElement.value) {
updateNodeDimensions([{ id: props.id, nodeElement: nodeElement.value, forceUpdate: true }])
}
}
function onMouseEnter(event: MouseEvent) {
@@ -294,7 +300,9 @@ const NodeWrapper = defineComponent({
}
function onKeyDown(event: KeyboardEvent) {
if (isInputDOMNode(event)) return
if (isInputDOMNode(event)) {
return
}
if (elementSelectionKeys.includes(event.key) && props.selectable) {
const unselect = event.key === 'Escape'
@@ -38,7 +38,9 @@ function onContextMenu(event: MouseEvent) {
}
function onKeyDown(event: KeyboardEvent) {
if (disableKeyboardA11y) return
if (disableKeyboardA11y) {
return
}
if (arrowKeyDiffs[event.key]) {
updatePositions(