mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Added a missing RepositoryTimeValue component [SCI-9153-v2]
PR fix [SCI-9153-v2] PR fix 02 [SCI-9153-v2]
This commit is contained in:
parent
7dac5e63be
commit
4e6646e3f9
3 changed files with 57 additions and 18 deletions
|
@ -16,15 +16,12 @@
|
||||||
<nav class="w-full">
|
<nav class="w-full">
|
||||||
<ul class="flex flex-col gap-3 text-right list-none">
|
<ul class="flex flex-col gap-3 text-right list-none">
|
||||||
<li v-for="nav in navigations" :key="nav.value" class="cursor-pointer inline-block relative">
|
<li v-for="nav in navigations" :key="nav.value" class="cursor-pointer inline-block relative">
|
||||||
<span
|
<span :class="`${activeNav === nav.value ? 'text-sn-science-blue' : 'text-sn-grey'} mr-8 transition-colors`"
|
||||||
:class="`${activeNav === nav.value ? 'text-sn-science-blue' : 'text-sn-grey'} mr-8 transition-colors`"
|
@click.prevent="hightlightContent(nav.value)">
|
||||||
@click.prevent="hightlightContent(nav.value)"
|
|
||||||
>
|
|
||||||
{{ nav.label }}
|
{{ nav.label }}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
:class="`${activeNav === nav.value ? 'bg-sn-science-blue w-1 inset-y-0 right-0.5' : 'transparent hidden'} absolute transition-all rounded`"
|
:class="`${activeNav === nav.value ? 'bg-sn-science-blue w-1 inset-y-0 right-0.5' : 'transparent hidden'} absolute transition-all rounded`">
|
||||||
>
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -128,7 +125,8 @@
|
||||||
<div id="divider" class="w-500 bg-sn-light-grey flex px-8 items-center self-stretch h-px "></div>
|
<div id="divider" class="w-500 bg-sn-light-grey flex px-8 items-center self-stretch h-px "></div>
|
||||||
|
|
||||||
<section id="qr_wrapper">
|
<section id="qr_wrapper">
|
||||||
<h4 class="font-inter text-base font-semibold leading-7 mb-4 mt-0">{{ i18n.t('repositories.item_card.navigations.qr') }}</h4>
|
<h4 class="font-inter text-base font-semibold leading-7 mb-4 mt-0">{{
|
||||||
|
i18n.t('repositories.item_card.navigations.qr') }}</h4>
|
||||||
<div class="bar-code-container">
|
<div class="bar-code-container">
|
||||||
<canvas id="bar-code-canvas" class="hidden"></canvas>
|
<canvas id="bar-code-canvas" class="hidden"></canvas>
|
||||||
<img id="bar-code-image" />
|
<img id="bar-code-image" />
|
||||||
|
@ -162,6 +160,7 @@ import RepositoryDateTimeRangeValue from './repository_values/RepositoryDateTime
|
||||||
import RepositoryDateValue from './repository_values/RepositoryDateValue.vue';
|
import RepositoryDateValue from './repository_values/RepositoryDateValue.vue';
|
||||||
import RepositoryDateRangeValue from './repository_values/RepositoryDateRangeValue.vue';
|
import RepositoryDateRangeValue from './repository_values/RepositoryDateRangeValue.vue';
|
||||||
import RepositoryTimeRangeValue from './repository_values/RepositoryTimeRangeValue.vue'
|
import RepositoryTimeRangeValue from './repository_values/RepositoryTimeRangeValue.vue'
|
||||||
|
import RepositoryTimeValue from './repository_values/RepositoryTimeValue.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RepositoryItemSidebar',
|
name: 'RepositoryItemSidebar',
|
||||||
|
@ -178,6 +177,7 @@ export default {
|
||||||
RepositoryDateValue,
|
RepositoryDateValue,
|
||||||
RepositoryDateRangeValue,
|
RepositoryDateRangeValue,
|
||||||
RepositoryTimeRangeValue,
|
RepositoryTimeRangeValue,
|
||||||
|
RepositoryTimeValue
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -252,25 +252,25 @@ export default {
|
||||||
hightlightContent(nav) {
|
hightlightContent(nav) {
|
||||||
this.activeNav = nav;
|
this.activeNav = nav;
|
||||||
this.navClicked = true;
|
this.navClicked = true;
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function () {
|
||||||
$(`#repository-item-sidebar #${nav}_wrapper`)[0].scrollIntoView();
|
$(`#repository-item-sidebar #${nav}_wrapper`)[0].scrollIntoView();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
attachScrollEvent() {
|
attachScrollEvent() {
|
||||||
const topOffsets = {}
|
const topOffsets = {}
|
||||||
const sections = ['information', 'custom_columns', 'assigned', 'qr'];
|
const sections = ['information', 'custom_columns', 'assigned', 'qr'];
|
||||||
for(let idx = 0; idx < sections.length; idx++) {
|
for (let idx = 0; idx < sections.length; idx++) {
|
||||||
topOffsets[sections[idx]] = $(`#repository-item-sidebar #${sections[idx]}_wrapper`).offset().top;
|
topOffsets[sections[idx]] = $(`#repository-item-sidebar #${sections[idx]}_wrapper`).offset().top;
|
||||||
}
|
}
|
||||||
let isScrolling;
|
let isScrolling;
|
||||||
$('.content').on('scroll', () => {
|
$('.content').on('scroll', () => {
|
||||||
if(isScrolling !== null) clearTimeout(isScrolling);
|
if (isScrolling !== null) clearTimeout(isScrolling);
|
||||||
isScrolling = setTimeout(() => {
|
isScrolling = setTimeout(() => {
|
||||||
const scrollPosition = $('.content').scrollTop();
|
const scrollPosition = $('.content').scrollTop();
|
||||||
for(let idx = 0; idx < sections.length; idx++) {
|
for (let idx = 0; idx < sections.length; idx++) {
|
||||||
if(scrollPosition < topOffsets[sections[idx + 1]] - topOffsets['information']) {
|
if (scrollPosition < topOffsets[sections[idx + 1]] - topOffsets['information']) {
|
||||||
// Set nav only when scrolling is not triggered by ckicking nav
|
// Set nav only when scrolling is not triggered by ckicking nav
|
||||||
if(sections[idx] !== this.activeNav && !this.navClicked) this.activeNav = sections[idx];
|
if (sections[idx] !== this.activeNav && !this.navClicked) this.activeNav = sections[idx];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
generateBarCode(text) {
|
generateBarCode(text) {
|
||||||
if(!text) return;
|
if (!text) return;
|
||||||
|
|
||||||
const barCodeCanvas = bwipjs.toCanvas('bar-code-canvas', {
|
const barCodeCanvas = bwipjs.toCanvas('bar-code-canvas', {
|
||||||
bcid: 'qrcode',
|
bcid: 'qrcode',
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<template>
|
||||||
|
<div id="repository-time-value-wrapper" class="flex flex-col min-min-h-[46px] h-auto gap-[6px]">
|
||||||
|
<div class="font-inter text-sm font-semibold leading-5">
|
||||||
|
{{ colName }}
|
||||||
|
</div>
|
||||||
|
<div v-if="formatted" class="text-sn-dark-grey font-inter text-sm font-normal leading-5 flex">
|
||||||
|
<div>
|
||||||
|
{{ formatted }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="text-sn-dark-grey font-inter text-sm font-normal leading-5">
|
||||||
|
{{ i18n.t('repositories.item_card.repository_time_value.no_time') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'RepositoryTimeValue',
|
||||||
|
props: {
|
||||||
|
data_type: String,
|
||||||
|
colId: Number,
|
||||||
|
colName: String,
|
||||||
|
colVal: Object
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formatted: null,
|
||||||
|
datetime: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.formatted = this.colVal.formatted
|
||||||
|
this.datetime = this.colVal.datetime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -2145,6 +2145,8 @@ en:
|
||||||
no_checklist: 'No selection'
|
no_checklist: 'No selection'
|
||||||
repository_asset_value:
|
repository_asset_value:
|
||||||
no_asset: 'No file'
|
no_asset: 'No file'
|
||||||
|
repository_time_value:
|
||||||
|
no_time: 'No time'
|
||||||
repository_stock_values:
|
repository_stock_values:
|
||||||
manage_modal:
|
manage_modal:
|
||||||
title: "Stock %{item}"
|
title: "Stock %{item}"
|
||||||
|
|
Loading…
Reference in a new issue