mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(editor): Port more components over to composition API (no-changelog) (#8794)
This commit is contained in:
committed by
GitHub
parent
edce632ee6
commit
e2131b9ab6
@@ -143,7 +143,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
tagSize: 'small',
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
const $emit = defineEmits<{
|
||||
(event: 'validate', shouldValidate: boolean): void;
|
||||
(event: 'update:modelValue', value: unknown): void;
|
||||
(event: 'focus'): void;
|
||||
@@ -203,22 +203,22 @@ function getInputValidationError(): ReturnType<IValidator['validate']> {
|
||||
function onBlur() {
|
||||
state.hasBlurred = true;
|
||||
state.isTyping = false;
|
||||
emit('blur');
|
||||
$emit('blur');
|
||||
}
|
||||
|
||||
function onUpdateModelValue(value: FormState) {
|
||||
state.isTyping = true;
|
||||
emit('update:modelValue', value);
|
||||
$emit('update:modelValue', value);
|
||||
}
|
||||
|
||||
function onFocus() {
|
||||
emit('focus');
|
||||
$emit('focus');
|
||||
}
|
||||
|
||||
function onEnter(event: Event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
emit('enter');
|
||||
$emit('enter');
|
||||
}
|
||||
|
||||
const validationError = computed<string | null>(() => {
|
||||
@@ -244,14 +244,14 @@ const showErrors = computed(
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
emit('validate', !validationError.value);
|
||||
$emit('validate', !validationError.value);
|
||||
|
||||
if (props.focusInitially && inputRef.value) inputRef.value.focus();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => validationError.value,
|
||||
(error) => emit('validate', !error),
|
||||
(error) => $emit('validate', !error),
|
||||
);
|
||||
|
||||
defineExpose({ inputRef });
|
||||
|
||||
Reference in New Issue
Block a user