From 49bfa4bf749893e7203a5284941aad9d7d628d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pumar?= Date: Tue, 18 Jun 2024 10:57:52 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=AF=20feat/enable=20bulk=20span=20(#49?= =?UTF-8?q?86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../annotation/container/fields/Record.vue | 29 +++++++++--- .../SpanAnnotationTextField.vue | 2 +- .../components/highlighting.ts | 18 +++----- .../components/span-selection.test.ts | 32 ++++++++++++++ .../components/span-selection.ts | 30 +++++++++---- .../useSpanAnnotationTextFieldViewModel.ts | 8 ++-- .../container/mode/BulkAnnotation.vue | 30 ++++++++++++- .../questions/form/Questions.component.vue | 1 - .../questions/form/span/SpanComponent.vue | 4 +- argilla-frontend/translation/de.js | 1 - argilla-frontend/translation/en.js | 1 - .../domain/entities/question/Question.test.ts | 17 +++++++ .../v1/domain/entities/question/Question.ts | 44 ++++++++++++------- .../entities/question/QuestionAnswer.ts | 14 +++++- .../v1/domain/entities/record/Record.ts | 16 ++++--- .../get-records-by-criteria-use-case.ts | 35 ++++++++------- 16 files changed, 205 insertions(+), 77 deletions(-) diff --git a/argilla-frontend/components/features/annotation/container/fields/Record.vue b/argilla-frontend/components/features/annotation/container/fields/Record.vue index 652230fa4e..ec445bb619 100644 --- a/argilla-frontend/components/features/annotation/container/fields/Record.vue +++ b/argilla-frontend/components/features/annotation/container/fields/Record.vue @@ -40,16 +40,35 @@ export default { type: Array, }, }, - computed: { - searchValue() { - return this.$route.query?._search ?? ""; - }, - }, methods: { onSelectedRecord(isSelected) { this.$emit("on-select-record", isSelected, this.record); }, }, + computed: { + spanQuestionsAnswers() { + return this.record.questions + .filter((q) => q.isSpanType) + .map((q) => ({ + id: q.id, + answer: q.answer.values, + })); + }, + }, + watch: { + spanQuestionsAnswers: { + deep: true, + handler() { + if ( + this.record.questions + .filter((q) => q.isSpanType) + .some((q) => q.isModified) + ) { + this.onSelectedRecord(true); + } + }, + }, + }, };