-
-
Notifications
You must be signed in to change notification settings - Fork 106
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 #356 from starker-xp/feat-textarea-interface
feat(Interface): Add textarea interface
- Loading branch information
Showing
6 changed files
with
72 additions
and
0 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
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,18 @@ | ||
import { NodeInterface, defineNode } from "@baklavajs/core"; | ||
import { TextareaInputInterface } from "../src/nodeinterfaces/textareainput/TextareaInputInterface"; | ||
import { TextInputInterface } from "../src"; | ||
|
||
export const DialogNode = defineNode({ | ||
type: "dialog", | ||
title: "Dialogue", | ||
onCreate() { | ||
this.width = 400; | ||
}, | ||
inputs: { | ||
input: () => new TextInputInterface("Title", ""), | ||
input2: () => new TextareaInputInterface("Description", ""), | ||
}, | ||
outputs: { | ||
result: () => new NodeInterface("", ""), | ||
}, | ||
}); |
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
9 changes: 9 additions & 0 deletions
9
packages/renderer-vue/src/nodeinterfaces/textareainput/TextareaInputInterface.ts
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 { type ComponentOptions, markRaw } from "vue"; | ||
import { NodeInterface } from "@baklavajs/core"; | ||
import TextareaInputInterfaceComponent from "./TextareaInputInterface.vue"; | ||
|
||
export class TextareaInputInterface extends NodeInterface<string> { | ||
component = markRaw(TextareaInputInterfaceComponent) as ComponentOptions; | ||
} | ||
|
||
export { TextareaInputInterfaceComponent }; |
33 changes: 33 additions & 0 deletions
33
packages/renderer-vue/src/nodeinterfaces/textareainput/TextareaInputInterface.vue
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,33 @@ | ||
<template> | ||
<div> | ||
<textarea v-model="v" rows="5" class="baklava-input" :placeholder="intf.name" :title="intf.name" /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { computed, defineComponent } from "vue"; | ||
import type { TextareaInputInterface } from "./TextareaInputInterface"; | ||
export default defineComponent({ | ||
props: { | ||
intf: { | ||
type: Object as () => TextareaInputInterface, | ||
required: true, | ||
}, | ||
modelValue: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
emits: ["update:modelValue"], | ||
setup(props, { emit }) { | ||
const v = computed({ | ||
get: () => props.modelValue, | ||
set: (v) => { | ||
emit("update:modelValue", v); | ||
}, | ||
}); | ||
return { v }; | ||
}, | ||
}); | ||
</script> |