diff --git a/entries/static/entries/js/components/LexicalUnitEdit.js b/entries/static/entries/js/components/LexicalUnitEdit.js index 3c782e7029d615d6d8b68e7ec620d047c90b4d53..e66b6d9060ec7197df99fdb6b1d2ec637e4f8042 100644 --- a/entries/static/entries/js/components/LexicalUnitEdit.js +++ b/entries/static/entries/js/components/LexicalUnitEdit.js @@ -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" diff --git a/entries/static/entries/js/components/frame-components/ExamplesComponent.js b/entries/static/entries/js/components/frame-components/ExamplesComponent.js index 2a7454509760171d6b9f597c31dff525106181fc..3a384d8ee154aaf30ed12918a55de215dfc95893 100644 --- a/entries/static/entries/js/components/frame-components/ExamplesComponent.js +++ b/entries/static/entries/js/components/frame-components/ExamplesComponent.js @@ -5,6 +5,7 @@ export default { examples: Object, frame: Object, frame_arguments: Object, + frame_arguments_or_type: null, schemas: Object, lus: Object, }, @@ -23,7 +24,11 @@ export default { } if(this.frame_arguments && this.frame_arguments.length > 0) { // ograniczone do argumentu ramy - ret = ret.filter(e => this.frame_arguments.every(a => e.argument_ids.includes(a.id))); + 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));