Files
n8n-enterprise-unlocked/packages/editor-ui/src/components/ParameterInputExpanded.vue
Mutasem Aldmour 577c73ee25 feat(editor): Add drag and drop data mapping (#3708)
* commit package lock

* refactor param options out

* use action toggle

* handle click on toggle

* update color toggle

* fix toggle

* show options

* update expression color

* update pointer

* fix readonly

* fix readonly

* fix expression spacing

* refactor input label

* show icon for headers

* center icon

* fix multi params

* add credential options

* increase spacing

* update expression view

* update transition

* update el padding

* rename side to options

* fix label overflow

* fix bug with unnessary lines

* add overlay

* fix bug affecting other pages

* clean up spacing

* rename

* update icon size

* fix toggle in users

* clean up func

* clean up css

* use css var

* fix overlay bug

* clean up input

* clean up input

* clean up unnessary css

* revert

* update quotes

* rename method

* remove console errors

* refactor data table

* add drag button

* make hoverable cells

* add drag hint

* disabel for output panel

* add drag

* disable for readonly

* Add dragging

* add draggable pill

* add mapping targets

* remove font color

* Transferable

* fix linting issue

* teleport component

* fix line

* disable for readonly

* fix position of data pill

* fix position of data pill

* ignore import

* add droppable state

* remove draggable key

* update bg color

* add value drop

* use direct input

* remove transition

* add animation

* shorten name

* handle empty value

* fix switch bug

* fix up animation

* add notification

* add hint

* add tooltip

* show draggable hintm

* fix multiple expre

* fix hoverable

* keep options on focus

* increase timeouts

* fix bug in set node

* add transition on hover out

* fix tooltip onboarding bug

* only update expression if changes

* add open delay

* fix header highlight issue

* update text

* dont show tooltip always

* update docs url

* update ee border

* add sticky behav

* hide error highlight if dropping

* switch out grip icon

* increase timeout

* add delay

* show hint on execprev

* add telemetry event

* add telemetry event

* add telemetry event

* fire event on hint showing

* fix telemetry event

* add path

* fix drag hint issue

* decrease bottom margin

* update mapping keys

* remove file

* hide overflow

* sort params

* add space

* prevent scrolling

* remove dropshadow

* force cursor

* address some comments

* add thead tbody

* add size opt
2022-07-20 13:32:51 +02:00

143 lines
3.2 KiB
Vue

<template>
<n8n-input-label
:label="$locale.credText().inputLabelDisplayName(parameter)"
:tooltipText="$locale.credText().inputLabelDescription(parameter)"
:required="parameter.required"
:showTooltip="focused"
:showOptions="menuExpanded"
>
<template #options>
<parameter-options
:parameter="parameter"
:value="value"
:isReadOnly="false"
:showOptions="true"
@optionSelected="optionSelected"
@menu-expanded="onMenuExpanded"
/>
</template>
<template>
<parameter-input
ref="param"
inputSize="large"
:parameter="parameter"
:value="value"
:path="parameter.name"
:hideIssues="true"
:displayOptions="true"
:documentationUrl="documentationUrl"
:errorHighlight="showRequiredErrors"
:isForCredential="true"
:eventSource="eventSource"
@focus="onFocus"
@blur="onBlur"
@textInput="valueChanged"
@valueChanged="valueChanged"
/>
<div :class="$style.errors" v-if="showRequiredErrors">
<n8n-text color="danger" size="small">
{{ $locale.baseText('parameterInputExpanded.thisFieldIsRequired') }}
<n8n-link v-if="documentationUrl" :to="documentationUrl" size="small" :underline="true" @click="onDocumentationUrlClick">
{{ $locale.baseText('parameterInputExpanded.openDocs') }}
</n8n-link>
</n8n-text>
</div>
<input-hint :class="$style.hint" :hint="$locale.credText().hint(parameter)" />
</template>
</n8n-input-label>
</template>
<script lang="ts">
import { IUpdateInformation } from '@/Interface';
import ParameterInput from './ParameterInput.vue';
import ParameterOptions from './ParameterOptions.vue';
import InputHint from './ParameterInputHint.vue';
import Vue from 'vue';
export default Vue.extend({
name: 'ParameterInputExpanded',
components: {
ParameterInput,
InputHint,
ParameterOptions,
},
props: {
parameter: {
},
value: {
},
showValidationWarnings: {
type: Boolean,
},
documentationUrl: {
type: String,
},
eventSource: {
type: String,
},
},
data() {
return {
focused: false,
blurredEver: false,
menuExpanded: false,
};
},
computed: {
showRequiredErrors(): boolean {
if (!this.$props.parameter.required) {
return false;
}
if (this.blurredEver || this.showValidationWarnings) {
if (this.$props.parameter.type === 'string') {
return !this.value;
}
if (this.$props.parameter.type === 'number') {
return typeof this.value !== 'number';
}
}
return false;
},
},
methods: {
onFocus() {
this.focused = true;
},
onBlur() {
this.blurredEver = true;
this.focused = false;
},
onMenuExpanded(expanded: boolean) {
this.menuExpanded = expanded;
},
optionSelected (command: string) {
if (this.$refs.param) {
(this.$refs.param as Vue).$emit('optionSelected', command);
}
},
valueChanged(parameterData: IUpdateInformation) {
this.$emit('change', parameterData);
},
onDocumentationUrlClick (): void {
this.$telemetry.track('User clicked credential modal docs link', {
docs_link: this.documentationUrl,
source: 'field',
workflow_id: this.$store.getters.workflowId,
});
},
},
});
</script>
<style lang="scss" module>
.errors {
margin-top: var(--spacing-2xs);
}
.hint {
margin-top: var(--spacing-4xs);
}
</style>