多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.2 KiB

<script setup lang="ts">
import { useQRCode } from '@vueuse/integrations/useQRCode'
import type QRCode from 'qrcode'
const maxNumberOfAllowedCharsForQrValue = 2000
const cellValue = inject(CellValueInj)
const isGallery = inject(IsGalleryInj, ref(false))
Nc feat/link record dropdown (#8345) * feat(nc-gui): link record dropdown setup * fix(nc-gui): move link record pagination to the bottom * feat(nc-gui): link record new design * fix(nc-gui): update bank state subtitle * fix(nc-gui): small changes * fix(nc-gui): update skeleton of link records item * fix(nc-gui): ui break issue * fix(nc-gui): increase z index of link dropdown overlay * fix(nc-gui): update link record dropdown header * fix(nc-gui): update link record dropdown * fix(nc-gui): new changes * fix: remove margin * fix(nc-gui): unlinked records empty state alignment * fix(nc-gui): make tooltip text size 14px * fix(nc-gui): reduce subtext font size * fix(nc-gui): link record item rich text cell alignment issue * fix(nc-gui): on esc link record dropdown should close * fix(nc-gui): update link record header and footer height * fix(nc-gui): add link record dropdown for bt cell * fix(nc-gui): fix invalid offset issue * fix(nc-gui): link record z index issue * fix: PW link unlink corrections * fix(nc-gui): link record dropdown close on outside issue in expanded form * fix(nc-gui): close dropdown after adding link in bt cell * fix(nc-gui): allow close link record dropdown on esc * fix(nc-gui): add link record dropdown in mm component * fix(nc-gui): add link record dropdown in hm component * fix(nc-gui): add link record dropdown in oo component * fix: auto close for BT * fix: ltar modal operations * fix: close link modal * fix: PW tests (wip) * test: fix link modal close in share view * test: fix LTAR in cell handling * fix(nc-gui): reduce link items skeleton height * fix(nc-gui): expanded form open issue on clicking bt cell record * fix(nc-gui): hide back btn if user directly opens record list dropdown * fix(nc-gui): reset offset when user opens link record dropdwon and switch between linked and unlinked records * fix(nc-gui): link record item height * fix(nc-gui): linked record list reload issue on link/unlink * fix(nc-gui): link record item subtext fields width should be same * fix(nc-gui): email, url cell truncate text issue * fix(nc-gui): shared form link record dropdwon ui * chore(nc-gui): lint * fix(nc-gu): small changes * fix(nc-gui): ai review changes * fix(nc-gui): link record list offset issue * fix(nc-gui): show plus btn in bt cell even if it is not blank * fix(nc-gui): barcode visiblility issue in link record dropdown * fix(nc-gui): do not focus links cell plus btn on close dropdown * fix(nc-gui): text color * fix(nc-gui): skip showing qr code null value * fix(nc-gui): virtual cell margin left issue in link record dropdwon * fix(nc-gui): link record subtext order should be same as default view col order * chore(nc-gui): lint * refactor(nocodb): add default view column order in col meta * fix(nc-gui): update default view order on reordering column from fields menu --------- Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
6 months ago
const qrValue = computed(() => String(cellValue?.value || ''))
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))
const tooManyCharsForQrCode = computed(() => qrValue?.value.length > maxNumberOfAllowedCharsForQrValue)
const showQrCode = computed(() => qrValue?.value?.length > 0 && !tooManyCharsForQrCode.value)
const qrCodeOptions: QRCode.QRCodeToDataURLOptions = {
errorCorrectionLevel: 'M',
margin: 1,
rendererOpts: {
quality: 1,
},
}
const rowHeight = inject(RowHeightInj, ref(undefined))
const qrCode = useQRCode(qrValue, {
...qrCodeOptions,
width: 150,
})
const qrCodeLarge = useQRCode(qrValue, {
...qrCodeOptions,
width: 600,
})
const modalVisible = ref(false)
const showQrModal = (ev: MouseEvent) => {
if (isGallery.value) return
ev.stopPropagation()
modalVisible.value = true
}
const handleModalOkClick = () => (modalVisible.value = false)
const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning } = useShowNotEditableWarning()
</script>
<template>
<a-modal
v-model:visible="modalVisible"
:class="{ active: modalVisible }"
wrap-class-name="nc-qr-code-large"
:body-style="{ padding: '0px' }"
@ok="handleModalOkClick"
>
<template #footer>
<div class="flex flex-row">
<div class="flex flex-row flex-grow mr-2 !overflow-y-auto py-2" data-testid="nc-qr-code-large-value-label">
{{ qrValue }}
</div>
<a v-if="showQrCode" :href="qrCodeLarge" :download="`${qrValue}.png`">
<NcTooltip>
<template #title>
{{ $t('labels.clickToDownload') }}
</template>
<NcButton size="small" type="secondary">
<GeneralIcon icon="download" class="w-4 h-4" />
</NcButton>
</NcTooltip>
</a>
</div>
</template>
<img v-if="showQrCode" :src="qrCodeLarge" :alt="$t('title.qrCode')" />
</a-modal>
<div
v-if="showQrCode"
class="w-full flex"
:class="{
'flex-start pl-2': isExpandedFormOpen,
'justify-center': !isExpandedFormOpen,
}"
>
<img
v-if="rowHeight"
Nc fix: UI improvements (#8223) * fix(nc-gui): add background color for row on hover in grid view * fix(nc-gui): reduce width of index column * fix(nc-gui): on hover grid row bg opacity issue * fix(nc-gui): reduce font size and grid cell height * fix(nc-gui): reduce font size * fix(nc-gui): set column default width to 180px * fix(nc-gui): revert sidebar changes * fix(nc-gui): disable grid row hover effect if fillMode is true * fix(nc-gui): display checkbox & row expand icon if it is active row * fix(nc-gui): increase the weight of display value cell * fix(nc-gui): grid cell should have constant padding * fix(nc-gui): att cell row height auto increase issue * fix(nc-gui): att cell center align issue * fix(nc-gui): percent cell spacing issue * fix(nc-gui): text overflow ellipsis * fix(nc-gui): single select auto increase height issue if rowHeight is short * fix(nc-gui): grayed out header text color * fix(nc-gui): reduce header icon size * fix(nc-gui): set 12px grid header horizontal padding * fix(nc-gui): center align expand icon for short row height * fix(nc-gui): rich text and select type field auto row height increase issue * fix(nc-gui): lookup cell auto increase height issue * fix(nc-gui): small changes * fix(nc-gui): truncate text after no. of lines base on rowHeight * fix(nc-gui): barcode & qrcode cell row height issue * chore(nc-gui): lint * fix(test): update row height pw test * fix(test): grid toolbar rowHeight test update * fix(nc-gui): ai review changes * fix(test): multiselect pw test update * fix(test): verify multiselct options test update * fix(nc-gui): merge conflicts * fix(nc-gui): small changes * fix(nc-gui): small changes * fix(nc-gui): display value should be in blue color
7 months ago
:style="{
height: rowHeight ? `${rowHeight === 1 ? rowHeightInPx['1'] - 4 : rowHeightInPx[`${rowHeight}`] - 20}px` : `1.8rem`,
}"
:src="qrCode"
:alt="$t('title.qrCode')"
class="min-w-[1.4em]"
@click="showQrModal"
/>
<img v-else class="mx-auto min-w-[1.4em]" :src="qrCode" :alt="$t('title.qrCode')" @click="showQrModal" />
</div>
<div v-if="tooManyCharsForQrCode" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('labels.qrCodeValueTooLong') }}
</div>
<div v-if="showEditNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.warning.nonEditableFields.computedFieldUnableToClear') }}
</div>
<div v-if="showClearNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.warning.nonEditableFields.qrFieldsCannotBeDirectlyChanged') }}
</div>
</template>