Skip to content

Commit

Permalink
fix(editor): Fix collapsing nested items in expression modal schema v…
Browse files Browse the repository at this point in the history
…iew (#11645)
  • Loading branch information
elsmr authored Nov 11, 2024
1 parent 8f695f3 commit 41dea52
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions packages/editor-ui/src/components/ExpressionEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ async function onDrop(expression: string, event: MouseEvent) {
:mapping-enabled="!isReadOnly"
:connection-type="NodeConnectionType.Main"
pane-type="input"
context="modal"
/>
</div>

Expand Down
6 changes: 4 additions & 2 deletions packages/editor-ui/src/components/RunDataSchema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Props = {
paneType: 'input' | 'output';
connectionType?: NodeConnectionType;
search?: string;
context?: 'ndv' | 'modal';
};
type SchemaNode = {
Expand All @@ -58,6 +59,7 @@ const props = withDefaults(defineProps<Props>(), {
connectionType: NodeConnectionType.Main,
search: '',
mappingEnabled: false,
context: 'ndv',
});
const draggingPath = ref<string>('');
Expand Down Expand Up @@ -381,7 +383,7 @@ watch(
:level="0"
:parent="null"
:pane-type="paneType"
:sub-key="snakeCase(currentNode.node.name)"
:sub-key="`${props.context}_${snakeCase(currentNode.node.name)}`"
:mapping-enabled="mappingEnabled"
:dragging-path="draggingPath"
:distance-from-active="currentNode.depth"
Expand Down Expand Up @@ -427,7 +429,7 @@ watch(
:level="0"
:parent="null"
:pane-type="paneType"
:sub-key="`output_${nodeSchema.type}-0-0`"
:sub-key="`${props.context}_output_${nodeSchema.type}-0-0`"
:mapping-enabled="mappingEnabled"
:dragging-path="draggingPath"
:node="node"
Expand Down
7 changes: 4 additions & 3 deletions packages/editor-ui/src/components/RunDataSchemaItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { checkExhaustive } from '@/utils/typeGuards';
import { shorten } from '@/utils/typesUtils';
import { getMappedExpression } from '@/utils/mappingUtils';
import TextWithHighlights from './TextWithHighlights.vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
type Props = {
schema: Schema;
Expand Down Expand Up @@ -95,7 +96,7 @@ const getIconBySchemaType = (type: Schema['type']): string => {
:data-depth="level"
data-target="mappable"
>
<font-awesome-icon :icon="getIconBySchemaType(schema.type)" size="sm" />
<FontAwesomeIcon :icon="getIconBySchemaType(schema.type)" size="sm" />
<TextWithHighlights
v-if="isSchemaParentTypeArray"
:content="props.parent?.key"
Expand All @@ -120,12 +121,12 @@ const getIconBySchemaType = (type: Schema['type']): string => {
<input v-if="level > 0 && isSchemaValueArray" :id="subKey" type="checkbox" inert checked />
<label v-if="level > 0 && isSchemaValueArray" :class="$style.toggle" :for="subKey">
<font-awesome-icon icon="angle-right" />
<FontAwesomeIcon icon="angle-right" />
</label>
<div v-if="isSchemaValueArray" :class="$style.sub">
<div :class="$style.innerSub">
<run-data-schema-item
<RunDataSchemaItem
v-for="s in schemaArray"
:key="s.key ?? s.type"
:schema="s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,13 @@ exports[`RunDataSchema.vue > renders schema for data 1`] = `
</div>
<input
checked=""
id="set_1-hobbies"
id="ndv_set_1-hobbies"
inert=""
type="checkbox"
/>
<label
class="toggle"
for="set_1-hobbies"
for="ndv_set_1-hobbies"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1138,13 +1138,13 @@ exports[`RunDataSchema.vue > renders schema for data 2`] = `
</div>
<input
checked=""
id="set_2-hobbies"
id="ndv_set_2-hobbies"
inert=""
type="checkbox"
/>
<label
class="toggle"
for="set_2-hobbies"
for="ndv_set_2-hobbies"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1575,13 +1575,13 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
</div>
<input
checked=""
id="output_object-0-0-hobbies"
id="ndv_output_object-0-0-hobbies"
inert=""
type="checkbox"
/>
<label
class="toggle"
for="output_object-0-0-hobbies"
for="ndv_output_object-0-0-hobbies"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1967,13 +1967,13 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
</div>
<input
checked=""
id="set_1-hello world"
id="ndv_set_1-hello world"
inert=""
type="checkbox"
/>
<label
class="toggle"
for="set_1-hello world"
for="ndv_set_1-hello world"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -2060,13 +2060,13 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
</div>
<input
checked=""
id="set_1-hello world-0"
id="ndv_set_1-hello world-0"
inert=""
type="checkbox"
/>
<label
class="toggle"
for="set_1-hello world-0"
for="ndv_set_1-hello world-0"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -2144,13 +2144,13 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
</div>
<input
checked=""
id="set_1-hello world-0-test"
id="ndv_set_1-hello world-0-test"
inert=""
type="checkbox"
/>
<label
class="toggle"
for="set_1-hello world-0-test"
for="ndv_set_1-hello world-0-test"
>
<svg
aria-hidden="true"
Expand Down

0 comments on commit 41dea52

Please sign in to comment.