Skip to content

Commit

Permalink
fix ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenaelp committed Nov 29, 2023
1 parent 64f0f75 commit 2db8239
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 45 deletions.
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

19 changes: 0 additions & 19 deletions jest.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions jest.setup.js

This file was deleted.

16 changes: 8 additions & 8 deletions src/components/NodeTypes/Image.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<g>
<image :href="options.image" x="5" :width="nodeModel.width - 10" :height="nodeModel.height" />
<image :href="options.image" x="5" :width="nodeModel?.width - 10" :height="nodeModel?.height" />
<text
:class="options.editableTitle ? 'title-editable': ''"
:x="nodeModel.width / 2"
:y="nodeModel.height + 14"
:width="nodeModel.width"
:x="nodeModel?.width / 2"
:y="nodeModel?.height + 14"
:width="nodeModel?.width"
ref="title"
text-anchor="middle"
font-size="14"
Expand All @@ -14,7 +14,7 @@
:style="options.titleStyle || ''"
@click="options.editableTitle ? parentDiagram.editText(nodeModel, 'title', $refs.title) : undefined"
>
{{nodeModel.title}}
{{nodeModel?.title}}
</text>
<g class="prevent-node-drag">
<slot />
Expand All @@ -32,10 +32,10 @@ export default defineComponent({
},
computed: {
options () {
return this.nodeModel.options || {};
return this.nodeModel?.options || {};
},
parentDiagram() {
return this.$parent.$parent.$parent;
parentDiagram (): any {
return this.$parent?.$parent?.$parent;
},
},
});
Expand Down
20 changes: 10 additions & 10 deletions src/components/NodeTypes/Shader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
:style="options.titleStyle || ''"
@click="options.editableTitle ? parentDiagram.editText(nodeModel, 'title', $refs.title) : undefined"
>
{{nodeModel.title}}
{{nodeModel?.title}}
</text>
<g v-if="nodeModel.deletable" @click="$emit('deleteNode')">
<g v-if="nodeModel?.deletable" @click="$emit('deleteNode')">
<rect
:x="nodeModel.width - 12"
:x="nodeModel?.width - 12"
y="3"
width="14"
height="14"
Expand All @@ -38,14 +38,14 @@
:fill-opacity="0.25"
/>
<line
:x1="nodeModel.width" :y1="5"
:x2="nodeModel.width - 10" :y2="15"
:x1="nodeModel?.width" :y1="5"
:x2="nodeModel?.width - 10" :y2="15"
style="stroke:rgb(0,0,0);"
stroke-width="2"
/>
<line
:x1="nodeModel.width - 10" :y1="5"
:x2="nodeModel.width" :y2="15"
:x1="nodeModel?.width - 10" :y1="5"
:x2="nodeModel?.width" :y2="15"
style="stroke:rgb(0,0,0);"
stroke-width="2"
/>
Expand All @@ -54,8 +54,8 @@
fill="#ffffff"
x="2" y="20"
rx="3" ry="3"
:width="nodeModel.width - 4"
:height="nodeModel.height - 22"
:width="nodeModel?.width - 4"
:height="nodeModel?.height - 22"
class="node-light-background"
/>
<g class="prevent-node-drag">
Expand Down Expand Up @@ -88,7 +88,7 @@ export default defineComponent({
color () {
return this.nodeModel?.color || '#66cc00';
},
parentDiagram() {
parentDiagram () : any {
return this.$parent?.$parent?.$parent;
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/components/NodeTypes/Text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
:class="options.editableTitle ? 'title-editable': ''"
:x="nodeModel?.width || 0 / 2"
:y="nodeModel?.height || 0 / 2"
:width="nodeModel.width"
:width="nodeModel?.width"
ref="title"
text-anchor="middle"
font-size="14"
font-weight="bold"
fill="#000000"
:style="options.titleStyle || ''"
@click="options.editableTitle ? parentDiagram.editText(nodeModel, 'title', $refs.title) : undefined"
@click="options.editableTitle ? parentDiagram?.editText(nodeModel, 'title', $refs.title) : undefined"
>
{{nodeModel.title}}
{{nodeModel?.title}}
</text>
<g class="prevent-node-drag">
<slot />
Expand All @@ -31,7 +31,7 @@ export default {
options () {
return this.nodeModel?.options || {};
},
parentDiagram() {
parentDiagram() : any {
return this.$parent?.$parent?.$parent;
},
},
Expand Down

0 comments on commit 2db8239

Please sign in to comment.