Skip to content

Commit

Permalink
⚡ Using onClickOutside as a function in expression input
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Aug 15, 2024
1 parent 4b52e21 commit 1dbce36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
13 changes: 6 additions & 7 deletions cypress/e2e/2111-ado-support-pinned-data-in-expressions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,20 @@ describe('ADO-2111 expressions should support pinned data', () => {
workflowPage.actions.openNode('NotPinnedWithExpressions');
ndv.getters.nodeParameters().find('parameter-expression-preview-value').should('not.exist');

ndv.getters.expressionExpanders().eq(0).click();
ndv.getters.parameterInput('value').eq(0).click();
ndv.getters
.expressionModalOutput()
.eq(0)
.inlineExpressionEditorOutput()
.should(
'have.text',
'[Execute node ‘PinnedSet’ for preview][Execute node ‘PinnedSet’ for preview][Execute node ‘PinnedSet’ for preview][Execute node ‘PinnedSet’ for preview][Execute node ‘PinnedSet’ for preview][Execute node ‘PinnedSet’ for preview][Execute previous nodes for preview][Execute previous nodes for preview][undefined]',
);

// close open expression
ndv.getters.expressionModalOutput().type('{esc}');
ndv.getters.inputLabel().eq(0).click();

ndv.getters.expressionExpanders().eq(1).click();
ndv.getters.parameterInput('value').eq(1).click();
ndv.getters
.expressionModalOutput()
.eq(1)
.inlineExpressionEditorOutput()
.should(
'have.text',
'0,0[Execute node ‘PinnedSet’ for preview][Execute node ‘PinnedSet’ for preview][Execute previous nodes for preview][Execute previous nodes for preview][Execute previous nodes for preview]',
Expand Down
10 changes: 5 additions & 5 deletions packages/editor-ui/src/components/ExpressionParameterInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, onMounted, ref, toRaw, watch } from 'vue';
import { onClickOutside } from '@vueuse/core';
import ExpressionFunctionIcon from '@/components/ExpressionFunctionIcon.vue';
import InlineExpressionEditorInput from '@/components/InlineExpressionEditor/InlineExpressionEditorInput.vue';
Expand All @@ -21,6 +22,7 @@ const segments = ref<Segment[]>([]);
const editorState = ref<EditorState>();
const selection = ref<SelectionRange>();
const inlineInput = ref<InstanceType<typeof InlineExpressionEditorInput>>();
const container = ref<HTMLDivElement>();
type Props = {
path: string;
Expand Down Expand Up @@ -156,15 +158,13 @@ watch(isDragging, (newIsDragging) => {
}
});
onClickOutside(container, (event) => onBlur(event));
defineExpose({ focus });
</script>

<template>
<div
v-on-click-outside="onBlur"
:class="$style['expression-parameter-input']"
@keydown.tab="onBlur"
>
<div ref="container" :class="$style['expression-parameter-input']" @keydown.tab="onBlur">
<div
:class="[
$style['all-sections'],
Expand Down

0 comments on commit 1dbce36

Please sign in to comment.