feat: Add assignment component with drag and drop to Set node (#8283)

Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
Elias Meire
2024-02-06 18:34:34 +01:00
committed by GitHub
parent c04f92f7fd
commit 2799de491b
53 changed files with 3296 additions and 1060 deletions

View File

@@ -21,7 +21,7 @@ const versionDescription: INodeTypeDescription = {
name: 'set',
icon: 'fa:pen',
group: ['input'],
version: [3, 3.1, 3.2],
version: [3, 3.1, 3.2, 3.3],
description: 'Modify, add, or remove item fields',
subtitle: '={{$parameter["mode"]}}',
defaults: {
@@ -44,7 +44,7 @@ const versionDescription: INodeTypeDescription = {
action: 'Edit item fields one by one',
},
{
name: 'JSON Output',
name: 'JSON',
value: 'raw',
description: 'Customize item output with JSON',
action: 'Customize item output with JSON',
@@ -96,6 +96,11 @@ const versionDescription: INodeTypeDescription = {
type: 'options',
description: 'How to select the fields you want to include in your output items',
default: 'all',
displayOptions: {
show: {
'@version': [3, 3.1, 3.2],
},
},
options: [
{
name: 'All Input Fields',
@@ -119,6 +124,49 @@ const versionDescription: INodeTypeDescription = {
},
],
},
{
displayName: 'Include Other Input Fields',
name: 'includeOtherFields',
type: 'boolean',
default: false,
description:
"Whether to pass to the output all the input fields (along with the fields set in 'Fields to Set')",
displayOptions: {
hide: {
'@version': [3, 3.1, 3.2],
},
},
},
{
displayName: 'Input Fields to Include',
name: 'include',
type: 'options',
description: 'How to select the fields you want to include in your output items',
default: 'all',
displayOptions: {
hide: {
'@version': [3, 3.1, 3.2],
'/includeOtherFields': [false],
},
},
options: [
{
name: 'All',
value: INCLUDE.ALL,
description: 'Also include all unchanged fields from the input',
},
{
name: 'Selected',
value: INCLUDE.SELECTED,
description: 'Also include the fields listed in the parameter “Fields to Include”',
},
{
name: 'All Except',
value: INCLUDE.EXCEPT,
description: 'Exclude the fields listed in the parameter “Fields to Exclude”',
},
],
},
{
displayName: 'Fields to Include',
name: 'includeFields',
@@ -232,11 +280,16 @@ export class SetV2 implements INodeType {
}
for (let i = 0; i < items.length; i++) {
const include = this.getNodeParameter('include', i) as IncludeMods;
const includeOtherFields = this.getNodeParameter('includeOtherFields', i, false) as boolean;
const include = this.getNodeParameter('include', i, 'all') as IncludeMods;
const options = this.getNodeParameter('options', i, {});
const node = this.getNode();
options.include = include;
if (node.typeVersion >= 3.3) {
options.include = includeOtherFields ? include : 'none';
} else {
options.include = include;
}
const newItem = await setNode[mode].execute.call(
this,