Browse Source

Enable to expand/collapse label types card

pull/2054/head
Hironsan 2 years ago
parent
commit
0d81dd5612
1 changed files with 42 additions and 30 deletions
  1. 72
      frontend/pages/projects/_id/sequence-labeling/index.vue

72
frontend/pages/projects/_id/sequence-labeling/index.vue

@ -41,36 +41,44 @@
<template #sidebar> <template #sidebar>
<annotation-progress :progress="progress" /> <annotation-progress :progress="progress" />
<v-card class="mt-4"> <v-card class="mt-4">
<v-card-title>Label Types</v-card-title>
<v-card-text>
<v-switch v-if="useRelationLabeling" v-model="relationMode">
<template #label>
<span v-if="relationMode">Relation</span>
<span v-else>Span</span>
</template>
</v-switch>
<v-chip-group v-model="selectedLabelIndex" column>
<v-chip
v-for="(item, index) in labelTypes"
:key="item.id"
v-shortkey="[item.suffixKey]"
:color="item.backgroundColor"
filter
:text-color="$contrastColor(item.backgroundColor)"
@shortkey="selectedLabelIndex = index"
>
{{ item.text }}
<v-avatar
v-if="item.suffixKey"
right
color="white"
class="black--text font-weight-bold"
<v-card-title>
Label Types
<v-spacer />
<v-btn icon @click="showLabelTypes = !showLabelTypes">
<v-icon>{{ showLabelTypes ? mdiChevronUp : mdiChevronDown }}</v-icon>
</v-btn>
</v-card-title>
<v-expand-transition>
<v-card-text v-show="showLabelTypes">
<v-switch v-if="useRelationLabeling" v-model="relationMode">
<template #label>
<span v-if="relationMode">Relation</span>
<span v-else>Span</span>
</template>
</v-switch>
<v-chip-group v-model="selectedLabelIndex" column>
<v-chip
v-for="(item, index) in labelTypes"
:key="item.id"
v-shortkey="[item.suffixKey]"
:color="item.backgroundColor"
filter
:text-color="$contrastColor(item.backgroundColor)"
@shortkey="selectedLabelIndex = index"
> >
{{ item.suffixKey }}
</v-avatar>
</v-chip>
</v-chip-group>
</v-card-text>
{{ item.text }}
<v-avatar
v-if="item.suffixKey"
right
color="white"
class="black--text font-weight-bold"
>
{{ item.suffixKey }}
</v-avatar>
</v-chip>
</v-chip-group>
</v-card-text>
</v-expand-transition>
</v-card> </v-card>
<list-metadata :metadata="doc.meta" class="mt-4" /> <list-metadata :metadata="doc.meta" class="mt-4" />
</template> </template>
@ -80,6 +88,7 @@
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { mdiChevronUp, mdiChevronDown } from '@mdi/js'
import LayoutText from '@/components/tasks/layout/LayoutText' import LayoutText from '@/components/tasks/layout/LayoutText'
import ListMetadata from '@/components/tasks/metadata/ListMetadata' import ListMetadata from '@/components/tasks/metadata/ListMetadata'
import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop' import ToolbarLaptop from '@/components/tasks/toolbar/ToolbarLaptop'
@ -115,7 +124,10 @@ export default {
rtl: false, rtl: false,
selectedLabelIndex: null, selectedLabelIndex: null,
progress: {}, progress: {},
relationMode: false
relationMode: false,
showLabelTypes: true,
mdiChevronUp,
mdiChevronDown
} }
}, },

Loading…
Cancel
Save