Skip to content
Snippets Groups Projects
Commit 1c067d51 authored by dcz's avatar dcz
Browse files

Show examples for unified argument selected.

parent ceb40e5c
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,7 @@ Object.assign(LexicalUnitEdit, {
realisation_descriptions: null,
examples: null,
selectedFrameArguments: null,
frame_arguments_or_type: false,
selectedLus: null,
selectedSchemas: null,
hidden_frames: [],
......@@ -177,8 +178,15 @@ Object.assign(LexicalUnitEdit, {
unifiedFrameArgumentSelected(argument) {
if (this.active_unified_frame_argument === argument) {
this.active_unified_frame_argument = null;
this.frame_arguments_or_type = false;
this.deselectSlowalFrameSelectedElements();
} else {
this.active_slowal_frame = null;
this.active_unified_frame_argument = argument;
const slowalFrameArguments = this.getSlowalFrameArgumentsBy(argument);
this.frame_arguments_or_type = true;
this.deselectSlowalFrameSelectedElements();
this.selectedFrameArguments = slowalFrameArguments;
}
this.unifiedFrameArgumentHovered(argument);
},
......@@ -456,6 +464,21 @@ Object.assign(LexicalUnitEdit, {
}
});
},
getSlowalFrameArgumentsBy(unified_frame_argument) {
const slowalFrameArgumentIds = [];
for (let i in this.unified_frame.slowal_frame_mapping) {
const slowal_frame_mapping = this.unified_frame.slowal_frame_mapping[i];
const slowalFrame = this.frames.find(frame => frame.id === slowal_frame_mapping.slowal_frame_id);
for (let j in slowal_frame_mapping.slowal_frame_argument_mapping) {
const slowal_frame_argument_mapping = slowal_frame_mapping.slowal_frame_argument_mapping[j];
if (slowal_frame_argument_mapping.unified_frame_agrument_id == unified_frame_argument.id) {
const slowalFrameArgument = slowalFrame.arguments.find(arg => arg.argument_id === slowal_frame_argument_mapping.slowal_frame_agrument_id);
slowalFrameArgumentIds.push(slowalFrameArgument);
}
}
}
return slowalFrameArgumentIds;
},
removeArgument() {
if (!this.active_unified_frame_argument) {
alert(gettext("Zaznacz argument, który chcesz usunąć."));
......@@ -1070,6 +1093,7 @@ Object.assign(LexicalUnitEdit, {
:examples="examples"
:frame="active_slowal_frame"
:frame_arguments="selectedFrameArguments"
:frame_arguments_or_type="frame_arguments_or_type"
:lus="selectedLus"
:schemas="selectedSchemas"
:key="examples"
......
......@@ -5,6 +5,7 @@ export default {
examples: Object,
frame: Object,
frame_arguments: Object,
frame_arguments_or_type: null,
schemas: Object,
lus: Object,
},
......@@ -23,8 +24,12 @@ export default {
}
if(this.frame_arguments && this.frame_arguments.length > 0) {
// ograniczone do argumentu ramy
if(this.frame_arguments_or_type) {
ret = ret.filter(e => this.frame_arguments.some(a => e.argument_ids.includes(a.id)));
} else {
ret = ret.filter(e => this.frame_arguments.every(a => e.argument_ids.includes(a.id)));
}
}
if(this.frame) {
ret = ret.filter(e => e.frame_ids.includes(this.frame.id));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment