mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
fix(editor): JSON view values can be mapped like keys (#4702)
* fix(editor): JSON view values can be mapped like keys, resolving to the same expression * fix(editor): JSON view list item draggable pill name
This commit is contained in:
parent
430cc65a4e
commit
6d4e959884
|
@ -239,7 +239,6 @@
|
||||||
class="ph-no-capture"
|
class="ph-no-capture"
|
||||||
:paneType="paneType"
|
:paneType="paneType"
|
||||||
:editMode="editMode"
|
:editMode="editMode"
|
||||||
:currentOutputIndex="currentOutputIndex"
|
|
||||||
:sessioId="sessionId"
|
:sessioId="sessionId"
|
||||||
:node="node"
|
:node="node"
|
||||||
:inputData="inputData"
|
:inputData="inputData"
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
:disabled="!mappingEnabled"
|
:disabled="!mappingEnabled"
|
||||||
@dragstart="onDragStart"
|
@dragstart="onDragStart"
|
||||||
@dragend="onDragEnd"
|
@dragend="onDragEnd"
|
||||||
ref="draggable"
|
|
||||||
>
|
>
|
||||||
<template #preview="{ canDrop, el }">
|
<template #preview="{ canDrop, el }">
|
||||||
<div :class="[$style.dragPill, canDrop ? $style.droppablePill : $style.defaultPill]">
|
<div :class="[$style.dragPill, canDrop ? $style.droppablePill : $style.defaultPill]">
|
||||||
|
@ -47,7 +46,19 @@
|
||||||
>"{{ node.key }}"</span>
|
>"{{ node.key }}"</span>
|
||||||
</template>
|
</template>
|
||||||
<template #nodeValue="{ node }">
|
<template #nodeValue="{ node }">
|
||||||
<span>{{ getContent(node.content) }}</span>
|
<span v-if="isNaN(node.index)">{{ getContent(node.content) }}</span>
|
||||||
|
<span
|
||||||
|
v-else
|
||||||
|
data-target="mappable"
|
||||||
|
:data-value="getJsonParameterPath(node.path)"
|
||||||
|
:data-name="getListItemName(node.path)"
|
||||||
|
:data-path="node.path"
|
||||||
|
:data-depth="node.level"
|
||||||
|
:class="{
|
||||||
|
[$style.mappable]: mappingEnabled,
|
||||||
|
[$style.dragged]: draggingPath === node.path,
|
||||||
|
}"
|
||||||
|
>{{ getContent(node.content) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</vue-json-pretty>
|
</vue-json-pretty>
|
||||||
</template>
|
</template>
|
||||||
|
@ -81,9 +92,6 @@ export default mixins(externalHooks).extend({
|
||||||
editMode: {
|
editMode: {
|
||||||
type: Object as () => { enabled?: boolean; value?: string; },
|
type: Object as () => { enabled?: boolean; value?: string; },
|
||||||
},
|
},
|
||||||
currentOutputIndex: {
|
|
||||||
type: Number,
|
|
||||||
},
|
|
||||||
sessionId: {
|
sessionId: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
@ -197,6 +205,9 @@ export default mixins(externalHooks).extend({
|
||||||
getContent(value: unknown): string {
|
getContent(value: unknown): string {
|
||||||
return isString(value) ? `"${ value }"` : JSON.stringify(value);
|
return isString(value) ? `"${ value }"` : JSON.stringify(value);
|
||||||
},
|
},
|
||||||
|
getListItemName(path: string): string {
|
||||||
|
return path.replace(/^(\["?\d"?]\.?)/g, '');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue