diff --git a/packages/editor-ui/src/components/FixedCollectionParameter.vue b/packages/editor-ui/src/components/FixedCollectionParameter.vue
index 210aa54bbc..bbd88fcad7 100644
--- a/packages/editor-ui/src/components/FixedCollectionParameter.vue
+++ b/packages/editor-ui/src/components/FixedCollectionParameter.vue
@@ -4,7 +4,11 @@
{{ $locale.baseText('fixedCollectionParameter.currentlyNoItemsExist') }}
-
+
-
+
-
+
-
+ :value="item.name"
+ >
-
@@ -78,18 +131,18 @@ export default mixins(genericHelpers)
'path', // string
'values', // INodeParameters
],
- data () {
+ data() {
return {
selectedOption: undefined,
};
},
computed: {
- getPlaceholderText (): string {
+ getPlaceholderText(): string {
const placeholder = this.$locale.nodeText().placeholder(this.parameter, this.path);
return placeholder ? placeholder : this.$locale.baseText('fixedCollectionParameter.choose');
},
- getProperties (): INodePropertyCollection[] {
+ getProperties(): INodePropertyCollection[] {
const returnProperties = [];
let tempProperties;
for (const name of this.propertyNames) {
@@ -100,14 +153,14 @@ export default mixins(genericHelpers)
}
return returnProperties;
},
- multipleValues (): boolean {
+ multipleValues(): boolean {
if (this.parameter.typeOptions !== undefined && this.parameter.typeOptions.multipleValues === true) {
return true;
}
return false;
},
- parameterOptions (): INodePropertyCollection[] {
+ parameterOptions(): INodePropertyCollection[] {
if (this.multipleValues === true) {
return this.parameter.options;
}
@@ -116,29 +169,37 @@ export default mixins(genericHelpers)
return !this.propertyNames.includes(option.name);
});
},
- propertyNames (): string[] {
+ propertyNames(): string[] {
if (this.values) {
return Object.keys(this.values);
}
return [];
},
- sortable (): string {
+ sortable(): string {
return this.parameter.typeOptions && this.parameter.typeOptions.sortable;
},
},
methods: {
- deleteOption (optionName: string, index?: number) {
- const parameterData = {
- name: this.getPropertyPath(optionName, index),
- value: undefined,
- };
-
- this.$emit('valueChanged', parameterData);
+ deleteOption(optionName: string, index?: number) {
+ const currentOptionsOfSameType = this.values[optionName];
+ if (!currentOptionsOfSameType || currentOptionsOfSameType.length > 1) {
+ // it's not the only option of this type, so just remove it.
+ this.$emit('valueChanged', {
+ name: this.getPropertyPath(optionName, index),
+ value: undefined,
+ });
+ } else {
+ // it's the only option, so remove the whole type
+ this.$emit('valueChanged', {
+ name: this.getPropertyPath(optionName),
+ value: undefined,
+ });
+ }
},
- getPropertyPath (name: string, index?: number) {
+ getPropertyPath(name: string, index?: number) {
return `${this.path}.${name}` + (index !== undefined ? `[${index}]` : '');
},
- getOptionProperties (optionName: string): INodePropertyCollection | undefined {
+ getOptionProperties(optionName: string): INodePropertyCollection | undefined {
for (const option of this.parameter.options) {
if (option.name === optionName) {
return option;
@@ -147,7 +208,7 @@ export default mixins(genericHelpers)
return undefined;
},
- moveOptionDown (optionName: string, index: number) {
+ moveOptionDown(optionName: string, index: number) {
this.values[optionName].splice(index + 1, 0, this.values[optionName].splice(index, 1)[0]);
const parameterData = {
@@ -157,7 +218,7 @@ export default mixins(genericHelpers)
this.$emit('valueChanged', parameterData);
},
- moveOptionUp (optionName: string, index: number) {
+ moveOptionUp(optionName: string, index: number) {
this.values[optionName].splice(index - 1, 0, this.values[optionName].splice(index, 1)[0]);
const parameterData = {
@@ -167,7 +228,7 @@ export default mixins(genericHelpers)
this.$emit('valueChanged', parameterData);
},
- optionSelected (optionName: string) {
+ optionSelected(optionName: string) {
const option = this.getOptionProperties(optionName);
if (option === undefined) {
return;
@@ -212,7 +273,7 @@ export default mixins(genericHelpers)
this.$emit('valueChanged', parameterData);
this.selectedOption = undefined;
},
- valueChanged (parameterData: IUpdateInformation) {
+ valueChanged(parameterData: IUpdateInformation) {
this.$emit('valueChanged', parameterData);
},
},
@@ -225,7 +286,6 @@ export default mixins(genericHelpers)