feat(n8n Form Trigger Node): Add text area and password input types (#7474)

Signed-off-by: yoshino-s <cy-cui@outlook.com>
This commit is contained in:
Yoshino-s 2023-11-01 20:23:28 +08:00 committed by GitHub
parent ce14f6266b
commit b72040aa54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 8 deletions

View file

@ -283,6 +283,20 @@
</div> </div>
{{/if}} {{/if}}
{{#if isTextarea}}
<div class='form-group'>
<label class='form-label' for='{{id}}'>{{label}}</label>
<textarea
class='form-input {{inputRequired}}'
id='{{id}}'
name='{{id}}'
></textarea>
<p class='{{errorId}} error-hidden'>
This field is required
</p>
</div>
{{/if}}
{{#if isInput}} {{#if isInput}}
<div class='form-group'> <div class='form-group'>
<label class='form-label' for='{{id}}'>{{label}}</label> <label class='form-label' for='{{id}}'>{{label}}</label>

View file

@ -106,14 +106,6 @@ export class FormTrigger implements INodeType {
default: 'text', default: 'text',
description: 'The type of field to add to the form', description: 'The type of field to add to the form',
options: [ options: [
{
name: 'Text',
value: 'text',
},
{
name: 'Number',
value: 'number',
},
{ {
name: 'Date', name: 'Date',
value: 'date', value: 'date',
@ -122,6 +114,22 @@ export class FormTrigger implements INodeType {
name: 'Dropdown List', name: 'Dropdown List',
value: 'dropdown', value: 'dropdown',
}, },
{
name: 'Number',
value: 'number',
},
{
name: 'Password',
value: 'password',
},
{
name: 'Text',
value: 'text',
},
{
name: 'Textarea',
value: 'textarea',
},
], ],
required: true, required: true,
}, },

View file

@ -9,6 +9,7 @@ export type FormField = {
export type FormTriggerInput = { export type FormTriggerInput = {
isSelect?: boolean; isSelect?: boolean;
isMultiSelect?: boolean; isMultiSelect?: boolean;
isTextarea?: boolean;
isInput?: boolean; isInput?: boolean;
labbel: string; labbel: string;
id: string; id: string;

View file

@ -52,6 +52,8 @@ export const prepareFormData = (
input.isSelect = true; input.isSelect = true;
const fieldOptions = field.fieldOptions?.values ?? []; const fieldOptions = field.fieldOptions?.values ?? [];
input.selectOptions = fieldOptions.map((e) => e.option); input.selectOptions = fieldOptions.map((e) => e.option);
} else if (fieldType === 'textarea') {
input.isTextarea = true;
} else { } else {
input.isInput = true; input.isInput = true;
input.type = fieldType as 'text' | 'number' | 'date'; input.type = fieldType as 'text' | 'number' | 'date';