From 99ecc40f9ac9a349716b92e6ace4b4d606eceddf Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:38:56 +0530 Subject: [PATCH] Nc Refactor: Gallery view (#8674) * fix(nc-gui): introduce header icon in gallery view card and update style * fix(nc-gui): field modal width issue if it is rich text * fix(nc-gui): hide longtext expanded icon on gallery & kanban view card hove * fix(nc-gui): date field alignment issue * fix(nc-gui): udpate kanban view card * fix(nc-gui): udpate gallery & kanban view card display value style * fix(nocodb): hide cover image in new gallery, kanban view if it is not pv column * feat(nc-gui): change cover image object fit property change support * fix(nc-gui): virtual cell card value alignment issue * fix(nc-gui): gallery view card image navigation issue * fix(nc-gui): gallerym, kanban card cover image dots navigation overflow issue * fix(nocodb): use optional chaining to access nested variable * chore(nc-gui): lint * fix(nc-gui): long text max line shuld be 4 in card * test: update open expanded form in gallery test * fix(nc-gui): add empty card in gallery view if cards length is less than 4 * fix(nc-gui): update gallery view card min width * fix(nocodb): small changes * fix(nc-gui): review changes * fix(nc-gui): add input shadow effect * fix(nc-gui): update card image navigation buttons icon * fix(nc-gui): udpate gallery view bg color * fix(nc-gui): update email, url, phone cell height from card * fix(nc-gui): update isEmptyRow function logic * fix(nc-gui): some review changes * fix(nc-gui): card display value color * fix(nc-gui): udpate gallery view card min width * fix(nc-gui): update card shadow & border on hover * fix(nc-gui): update gallery loader card width * fix(nc-gui): add min height for card image * chore(nc-gui): lint * fix(nc-gui): card rich text height * fix(nc-gui): align record count in right side in gallery view * fix(nc-gui): review changes * fix(nc-gui): shared view show & hide field issue * chore(nc-gui): lint * fix(nc-gui): link record test fail issue --- packages/nc-gui/components/cell/Checkbox.vue | 2 +- .../nc-gui/components/cell/DateTimePicker.vue | 15 +- packages/nc-gui/components/cell/RichText.vue | 16 +- packages/nc-gui/components/cell/TextArea.vue | 24 +- .../components/cell/attachment/index.vue | 2 +- .../notification/Item/ProjectInvite.vue | 3 +- .../nc-gui/components/smartsheet/Gallery.vue | 274 +++++++++++++----- .../nc-gui/components/smartsheet/Kanban.vue | 258 ++++++++++++----- .../smartsheet/SharedMapMarkerPopup.vue | 7 - .../smartsheet/column/EditOrAdd.vue | 1 - .../smartsheet/toolbar/FieldsMenu.vue | 187 +++++++++++- .../nc-gui/components/virtual-cell/QrCode.vue | 3 - .../virtual-cell/barcode/JsBarcodeWrapper.vue | 1 - .../virtual-cell/components/ListItem.vue | 9 +- packages/nc-gui/composables/useViewColumns.ts | 45 ++- packages/nc-gui/lang/en.json | 5 +- packages/nc-gui/lib/enums.ts | 5 + packages/nc-gui/utils/dataUtils.ts | 3 +- packages/nc-gui/utils/formValidations.ts | 4 +- packages/nc-gui/windi.config.ts | 2 + packages/nocodb/src/models/GalleryView.ts | 15 +- packages/nocodb/src/models/KanbanView.ts | 14 +- packages/nocodb/src/models/View.ts | 18 +- .../pages/Dashboard/Gallery/index.ts | 4 +- 24 files changed, 713 insertions(+), 204 deletions(-) diff --git a/packages/nc-gui/components/cell/Checkbox.vue b/packages/nc-gui/components/cell/Checkbox.vue index 834e4d98e4..52480dbdf6 100644 --- a/packages/nc-gui/components/cell/Checkbox.vue +++ b/packages/nc-gui/components/cell/Checkbox.vue @@ -114,7 +114,7 @@ useSelectedCellKeyupListener(active, (e) => { 'justify-center': !isEditColumnMenu && !isGallery && !isForm, 'py-2': isEditColumnMenu, }" - @click="onClick(true)" + @click.stop="onClick(true)" >
diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue index 1ab109f118..33c6c4d0cc 100644 --- a/packages/nc-gui/components/cell/RichText.vue +++ b/packages/nc-gui/components/cell/RichText.vue @@ -48,10 +48,20 @@ const isGrid = inject(IsGridInj, ref(false)) const isSurveyForm = inject(IsSurveyFormInj, ref(false)) +const isGallery = inject(IsGalleryInj, ref(false)) + +const isKanban = inject(IsKanbanInj, ref(false)) + const isFocused = ref(false) const keys = useMagicKeys() +const localRowHeight = computed(() => { + if (readOnlyCell.value && !isExpandedFormOpen.value && (isGallery.value || isKanban.value)) return 6 + + return rowHeight.value +}) + const shouldShowLinkOption = computed(() => { return isFormField.value ? isFocused.value : true }) @@ -157,7 +167,7 @@ const editor = useEditor({ .turndown(editor.getHTML().replaceAll(/

<\/p>/g, '
')) .replaceAll(/\n\n
\n\n/g, '
\n\n') - vModel.value = isFormField.value && markdown === '
' ? '' : markdown + vModel.value = markdown === '
' ? '' : markdown }, editable: !props.readOnly, autofocus: props.autofocus, @@ -322,8 +332,8 @@ onClickOutside(editorDom, (e) => { 'mt-2.5 flex-grow': fullMode, 'scrollbar-thin scrollbar-thumb-gray-200 scrollbar-track-transparent': !fullMode || (!fullMode && isExpandedFormOpen), 'flex-grow': isExpandedFormOpen, - [`!overflow-hidden nc-truncate nc-line-clamp-${rowHeightTruncateLines(rowHeight)}`]: - !fullMode && readOnly && rowHeight && !isExpandedFormOpen && !isForm, + [`!overflow-hidden nc-truncate nc-line-clamp-${rowHeightTruncateLines(localRowHeight)}`]: + !fullMode && readOnly && localRowHeight && !isExpandedFormOpen && !isForm, }" @keydown.alt.enter.stop @keydown.shift.enter.stop diff --git a/packages/nc-gui/components/cell/TextArea.vue b/packages/nc-gui/components/cell/TextArea.vue index b959ab9962..4b35a74cb7 100644 --- a/packages/nc-gui/components/cell/TextArea.vue +++ b/packages/nc-gui/components/cell/TextArea.vue @@ -21,6 +21,10 @@ const isForm = inject(IsFormInj, ref(false)) const isGrid = inject(IsGridInj, ref(false)) +const isGallery = inject(IsGalleryInj, ref(false)) + +const isKanban = inject(IsKanbanInj, ref(false)) + const readOnly = inject(ReadonlyInj, ref(false)) const { showNull } = useGlobal() @@ -60,6 +64,12 @@ const height = computed(() => { return rowHeight.value * 36 }) +const localRowHeight = computed(() => { + if (readOnly.value && !isExpandedFormOpen.value && (isGallery.value || isKanban.value)) return 6 + + return rowHeight.value +}) + const isVisible = ref(false) const inputWrapperRef = ref(null) @@ -222,11 +232,11 @@ watch(inputWrapperRef, () => { class="w-full cursor-pointer nc-readonly-rich-text-wrapper" :class="{ 'nc-readonly-rich-text-grid ': !isExpandedFormOpen && !isForm, - 'nc-readonly-rich-text-sort-height': rowHeight === 1 && !isExpandedFormOpen && !isForm, + 'nc-readonly-rich-text-sort-height': localRowHeight === 1 && !isExpandedFormOpen && !isForm, }" :style="{ - maxHeight: isForm ? undefined : isExpandedFormOpen ? `${height}px` : `${21 * rowHeightTruncateLines(rowHeight)}px`, - minHeight: isForm ? undefined : isExpandedFormOpen ? `${height}px` : `${21 * rowHeightTruncateLines(rowHeight)}px`, + maxHeight: isForm ? undefined : isExpandedFormOpen ? `${height}px` : `${21 * rowHeightTruncateLines(localRowHeight)}px`, + minHeight: isForm ? undefined : isExpandedFormOpen ? `${height}px` : `${21 * rowHeightTruncateLines(localRowHeight)}px`, }" @dblclick="onExpand" @keydown.enter="onExpand" @@ -265,12 +275,12 @@ watch(inputWrapperRef, () => { @@ -280,7 +290,7 @@ watch(inputWrapperRef, () => {

{{ item.body.user.display_name ?? item.body.user.email }} has invited you to collaborate - on - {{ item.body.base.title }} base. + on {{ item.body.base.title }} base.
diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vue index df749761c1..598ded899c 100644 --- a/packages/nc-gui/components/smartsheet/Gallery.vue +++ b/packages/nc-gui/components/smartsheet/Gallery.vue @@ -56,12 +56,12 @@ const coverImageColumn: any = computed(() => : {}, ) -const isRowEmpty = (record: any, col: any) => { - const val = record.row[col.title] - if (!val) return true +const coverImageObjectFitClass = computed(() => { + const fk_cover_image_object_fit = parseProp(galleryData.value?.meta)?.fk_cover_image_object_fit || CoverImageObjectFit.FIT - return Array.isArray(val) && val.length === 0 -} + if (fk_cover_image_object_fit === CoverImageObjectFit.FIT) return '!object-contain' + if (fk_cover_image_object_fit === CoverImageObjectFit.COVER) return '!object-cover' +}) const { isUIAllowed } = useRoles() const hasEditPermission = computed(() => isUIAllowed('dataEdit')) @@ -205,7 +205,7 @@ watch(