Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): show attachment drop zone area with solid border

Ramesh Mane3aa2151571a8
diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue
index 99153c0509..86569f5d3d 100644
--- a/packages/nc-gui/components/cell/attachment/index.vue
+++ b/packages/nc-gui/components/cell/attachment/index.vue
@@ -325,7 +325,13 @@ onUnmounted(() => {
</script>
<template>
- <div v-if="isExpandedForm || isForm" class="form-attachment-cell relative">
+ <div
+ v-if="isExpandedForm || isForm"
+ class="form-attachment-cell"
+ :class="{
+ 'nc-has-attachments': visibleItems.length,
+ }"
+ >
<LazyCellAttachmentCarousel v-if="selectedFile" />
<div v-if="visibleItems.length > 0" ref="sortableRef" class="flex flex-wrap items-stretch mb-2 gap-2">
<CellAttachmentCard
@@ -406,7 +412,13 @@ onUnmounted(() => {
<span class="py-3">
{{ $t('labels.clickTo') }}
- <span :tabindex="0" class="font-semibold text-nc-content-brand"> {{ $t('labels.browseFiles') }} </span>
+ <span
+ :tabindex="0"
+ class="font-semibold text-nc-content-brand focus:(!outline-none) focus-visible:(outline-none)"
+ @keydown.enter="openAttachmentModal"
+ >
+ {{ $t('labels.browseFiles') }}
+ </span>
{{ $t('general.or') }}
<span class="font-semibold"> {{ $t('labels.dragFilesHere') }} </span>
@@ -425,16 +437,8 @@ onUnmounted(() => {
</div>
<div
- class="absolute border-dashed border-2 rounded-lg flex flex-col items-center justify-center pointer-events-none"
- :class="{
- 'top-0 bottom-0 -right-1 left-0': !visibleItems.length,
- '-top-1 -left-1 -right-1 bottom-0': visibleItems.length,
- 'hidden':
- (visibleItems.length && (!isOverDropZone || isReadonly || dragging || !currentCellRef)) ||
- (isUploading && !visibleItems.length),
- 'border-nc-border-medium': !visibleItems.length && !isOverDropZone,
- 'border-nc-fill-primary': isOverDropZone && isEditAllowed,
- }"
+ v-if="isOverDropZone && isEditAllowed && !isReadonly && !dragging && currentCellRef"
+ class="nc-is-over-drop-zone absolute inset-0 flex flex-col items-center justify-center pointer-events-none"
>
<template v-if="visibleItems.length">
<GeneralIcon icon="upload" class="flex-none w-6 h-6 text-nc-content-brand" />
@@ -614,17 +618,25 @@ onUnmounted(() => {
<style lang="scss">
.nc-data-cell {
- &:has(.form-attachment-cell) {
+ &:has(.form-attachment-cell.nc-has-attachments) {
@apply !border-none pt-1 -mt-1 -ml-1;
box-shadow: none !important;
&:focus-within:not(.nc-readonly-div-data-cell):not(.nc-system-field) {
box-shadow: none !important;
}
+
+ .nc-cell-attachment {
+ @apply !border-none;
+ }
}
- .nc-cell-attachment {
- @apply !border-none;
+ &:has(.form-attachment-cell .nc-is-over-drop-zone) {
+ @apply relative;
+
+ &::after {
+ @apply content-[''] block absolute inset-0 border-dashed border-2 border-nc-fill-primary rounded-lg pointer-events-none;
+ }
}
}
.nc-cell {
diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue
index 4138272ecb..9ae705d3cc 100644
--- a/packages/nc-gui/components/smartsheet/Form.vue
+++ b/packages/nc-gui/components/smartsheet/Form.vue
@@ -2186,7 +2186,7 @@ const { message: templatedMessage } = useTemplatedMessage(
.nc-input {
@apply appearance-none w-full;
&:not(.layout-list) {
- &:not(.nc-cell-attachment) {
+ &:not(:has(.form-attachment-cell.nc-has-attachments)) {
@apply !bg-white rounded-lg border-solid border-1 border-gray-200 !focus-within:border-brand-500;
}
}