mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
feat: Hackmation - automatically switch to expression mode (#13213)
Co-authored-by: Michael Kret <mishakret@gmail.com> Co-authored-by: Elias Meire <elias@meire.dev>
This commit is contained in:
@@ -66,6 +66,7 @@ import type { EventBus } from 'n8n-design-system/utils';
|
||||
import { createEventBus } from 'n8n-design-system/utils';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useElementSize } from '@vueuse/core';
|
||||
import { completeExpressionSyntax, isStringWithExpressionSyntax } from '@/utils/expressions';
|
||||
|
||||
type Picker = { $emit: (arg0: string, arg1: Date) => void };
|
||||
|
||||
@@ -813,16 +814,25 @@ function valueChanged(value: NodeParameterValueType | {} | Date) {
|
||||
if (remoteParameterOptionsLoading.value) {
|
||||
return;
|
||||
}
|
||||
// Only update the value if it has changed
|
||||
|
||||
const oldValue = get(node.value, props.path);
|
||||
|
||||
if (oldValue !== undefined && oldValue === value) {
|
||||
// Only update the value if it has changed
|
||||
return;
|
||||
}
|
||||
|
||||
if (!oldValue && oldValue !== undefined && isStringWithExpressionSyntax(value)) {
|
||||
// if empty old value and updated value has an expression, add '=' prefix to switch to expression mode
|
||||
value = '=' + value;
|
||||
}
|
||||
|
||||
if (props.parameter.name === 'nodeCredentialType') {
|
||||
activeCredentialType.value = value as string;
|
||||
}
|
||||
|
||||
value = completeExpressionSyntax(value);
|
||||
|
||||
if (value instanceof Date) {
|
||||
value = value.toISOString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user