mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
* feat(editor): Remove `.ph-no-capture` class from some of the fields * ✔️ Updating test snapshots * ⚡ Redacting expressions preview in credentials form * 🔧 Disable posthog input masking * 🚨 Testing PostHog iFrame settings * Reverting iframe test * ⚡ Hiding API key in PostHog recordings * ✅ Added tests for redacted values * ✔️ Updating checkbox snapshots after label component update * ✔️ Updating test snapshots in editor-ui * 👕 Fix lint errors
150 lines
2.7 KiB
Vue
150 lines
2.7 KiB
Vue
<template>
|
|
<el-input
|
|
v-bind="$props"
|
|
:size="computedSize"
|
|
:class="['n8n-input', ...classes]"
|
|
:autoComplete="autocomplete"
|
|
ref="innerInput"
|
|
v-on="$listeners"
|
|
:name="name"
|
|
>
|
|
<template #prepend>
|
|
<slot name="prepend" />
|
|
</template>
|
|
<template #append>
|
|
<slot name="append" />
|
|
</template>
|
|
<template #prefix>
|
|
<slot name="prefix" />
|
|
</template>
|
|
<template #suffix>
|
|
<slot name="suffix" />
|
|
</template>
|
|
</el-input>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { Input as ElInput } from 'element-ui';
|
|
import { defineComponent } from 'vue';
|
|
|
|
type InputRef = InstanceType<typeof ElInput>;
|
|
|
|
export default defineComponent({
|
|
name: 'n8n-input',
|
|
components: {
|
|
ElInput,
|
|
},
|
|
props: {
|
|
value: {},
|
|
type: {
|
|
type: String,
|
|
validator: (value: string): boolean =>
|
|
['text', 'textarea', 'number', 'password', 'email'].includes(value),
|
|
},
|
|
size: {
|
|
type: String,
|
|
default: 'large',
|
|
validator: (value: string): boolean =>
|
|
['mini', 'small', 'medium', 'large', 'xlarge'].includes(value),
|
|
},
|
|
placeholder: {
|
|
type: String,
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
},
|
|
readonly: {
|
|
type: Boolean,
|
|
},
|
|
clearable: {
|
|
type: Boolean,
|
|
},
|
|
rows: {
|
|
type: Number,
|
|
},
|
|
maxlength: {
|
|
type: Number,
|
|
},
|
|
title: {
|
|
type: String,
|
|
},
|
|
name: {
|
|
type: String,
|
|
},
|
|
autocomplete: {
|
|
type: String,
|
|
default: 'off',
|
|
},
|
|
},
|
|
computed: {
|
|
computedSize(): string | undefined {
|
|
if (this.size === 'xlarge') {
|
|
return undefined;
|
|
}
|
|
|
|
return this.size;
|
|
},
|
|
classes(): string[] {
|
|
const classes = [];
|
|
if (this.size === 'xlarge') {
|
|
classes.push('xlarge');
|
|
}
|
|
if (this.type === 'password') {
|
|
classes.push('ph-no-capture');
|
|
}
|
|
return classes;
|
|
},
|
|
},
|
|
methods: {
|
|
focus() {
|
|
const innerInput = this.$refs.innerInput as InputRef | undefined;
|
|
|
|
if (!innerInput) return;
|
|
|
|
const inputElement = innerInput.$el.querySelector(
|
|
this.type === 'textarea' ? 'textarea' : 'input',
|
|
);
|
|
|
|
if (!inputElement) return;
|
|
|
|
inputElement.focus();
|
|
},
|
|
blur() {
|
|
const innerInput = this.$refs.innerInput as InputRef | undefined;
|
|
|
|
if (!innerInput) return;
|
|
|
|
const inputElement = innerInput.$el.querySelector(
|
|
this.type === 'textarea' ? 'textarea' : 'input',
|
|
);
|
|
|
|
if (!inputElement) return;
|
|
|
|
inputElement.blur();
|
|
},
|
|
select() {
|
|
const innerInput = this.$refs.innerInput as InputRef | undefined;
|
|
|
|
if (!innerInput) return;
|
|
|
|
const inputElement = innerInput.$el.querySelector(
|
|
this.type === 'textarea' ? 'textarea' : 'input',
|
|
);
|
|
|
|
if (!inputElement) return;
|
|
|
|
inputElement.select();
|
|
},
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.xlarge {
|
|
--input-font-size: var(--font-size-m);
|
|
input {
|
|
height: 48px;
|
|
}
|
|
}
|
|
</style>
|