add new utilties - customfunction, setter/getter, replace code editor

This commit is contained in:
Henry
2023-12-15 17:15:00 +00:00
parent 1b0b1f13fa
commit 911b4fe7fb
22 changed files with 543 additions and 710 deletions
@@ -0,0 +1,56 @@
import { INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
class SetVariable_Utilities implements INode {
label: string
name: string
version: number
description: string
type: string
icon: string
category: string
baseClasses: string[]
inputs: INodeParams[]
outputs: INodeOutputsValue[]
constructor() {
this.label = 'Set Variable'
this.name = 'setVariable'
this.version = 1.0
this.type = 'SetVariable'
this.icon = 'setvar.svg'
this.category = 'Utilities'
this.description = `Set variable which can be retrieved at a later stage. Variable is only available during runtime.`
this.baseClasses = [this.type, 'Utilities']
this.inputs = [
{
label: 'Input',
name: 'input',
type: 'string | number | boolean | json | array',
optional: true,
list: true
},
{
label: 'Variable Name',
name: 'variableName',
type: 'string',
placeholder: 'var1'
}
]
this.outputs = [
{
label: 'Output',
name: 'output',
baseClasses: ['string', 'number', 'boolean', 'json', 'array']
}
]
}
async init(nodeData: INodeData): Promise<any> {
const inputRaw = nodeData.inputs?.input
const variableName = nodeData.inputs?.variableName as string
return { output: inputRaw, dynamicVariables: { [variableName]: inputRaw } }
}
}
module.exports = { nodeClass: SetVariable_Utilities }
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-book-upload" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 20h-8a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12v5" /><path d="M11 16h-5a2 2 0 0 0 -2 2" /><path d="M15 16l3 -3l3 3" /><path d="M18 13v9" /></svg>

After

Width:  |  Height:  |  Size: 435 B