Browse Source

fix: shared view issues

pull/6450/head
DarkPhoenix2704 1 year ago
parent
commit
54df112662
  1. 7
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 5
      packages/nc-gui/components/smartsheet/expanded-form/Header.vue
  3. 5
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  4. 2
      packages/nc-gui/composables/useExpandedFormStore.ts

7
packages/nc-gui/components/smartsheet/Gallery.vue

@ -126,7 +126,7 @@ const attachments = (record: any): Attachment[] => {
const expandForm = (row: RowType, state?: Record<string, any>) => { const expandForm = (row: RowType, state?: Record<string, any>) => {
const rowId = extractPkFromRow(row.row, meta.value!.columns!) const rowId = extractPkFromRow(row.row, meta.value!.columns!)
if (rowId) { if (rowId && !isPublic.value) {
router.push({ router.push({
query: { query: {
...route.query, ...route.query,
@ -244,10 +244,9 @@ watch(
<div v-for="(record, rowIndex) in data" :key="`record-${record.row.id}`"> <div v-for="(record, rowIndex) in data" :key="`record-${record.row.id}`">
<LazySmartsheetRow :row="record"> <LazySmartsheetRow :row="record">
<a-card <a-card
class="!rounded-lg h-full border-gray-200 border-1 group overflow-hidden break-all max-w-[450px] shadow-sm hover:shadow-md" class="!rounded-lg h-full border-gray-200 border-1 group overflow-hidden break-all max-w-[450px] shadow-sm hover:shadow-md cursor-pointer"
:body-style="{ padding: '0px' }" :body-style="{ padding: '0px' }"
:data-testid="`nc-gallery-card-${record.row.id}`" :data-testid="`nc-gallery-card-${record.row.id}`"
:style="isPublic ? { cursor: 'default' } : { cursor: 'pointer' }"
@click="expandFormClick($event, record)" @click="expandFormClick($event, record)"
@contextmenu="showContextMenu($event, { row: rowIndex })" @contextmenu="showContextMenu($event, { row: rowIndex })"
> >
@ -315,7 +314,7 @@ watch(
</h2> </h2>
<div v-for="col in fieldsWithoutDisplay" :key="`record-${record.row.id}-${col.id}`"> <div v-for="col in fieldsWithoutDisplay" :key="`record-${record.row.id}-${col.id}`">
<div class="flex flex-col ml-2 !pr-3.5 !mb-[0.75rem] rounded-lg w-full"> <div class="flex flex-col first:mt-3 ml-2 !pr-3.5 !mb-[0.75rem] rounded-lg w-full">
<div class="flex flex-row w-full justify-start scale-75"> <div class="flex flex-row w-full justify-start scale-75">
<div class="w-full pb-1 text-gray-300"> <div class="w-full pb-1 text-gray-300">
<LazySmartsheetHeaderVirtualCell <LazySmartsheetHeaderVirtualCell

5
packages/nc-gui/components/smartsheet/expanded-form/Header.vue

@ -2,6 +2,7 @@
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import type { ViewType } from 'nocodb-sdk' import type { ViewType } from 'nocodb-sdk'
import { import {
IsPublicInj,
ReloadRowDataHookInj, ReloadRowDataHookInj,
iconMap, iconMap,
isMac, isMac,
@ -20,6 +21,8 @@ const route = useRoute()
const { meta, isSqlView } = useSmartsheetStoreOrThrow() const { meta, isSqlView } = useSmartsheetStoreOrThrow()
const isPublic = inject(IsPublicInj, ref(false))
const { commentsDrawer, displayValue, primaryKey, save: _save, loadRow, deleteRowById } = useExpandedFormStoreOrThrow() const { commentsDrawer, displayValue, primaryKey, save: _save, loadRow, deleteRowById } = useExpandedFormStoreOrThrow()
const { isNew, syncLTARRefs, state } = useSmartsheetRowStoreOrThrow() const { isNew, syncLTARRefs, state } = useSmartsheetRowStoreOrThrow()
@ -98,7 +101,7 @@ const onConfirmDeleteRowClick = async () => {
</h5> </h5>
<div class="flex-1" /> <div class="flex-1" />
<a-tooltip placement="bottom"> <a-tooltip v-if="!isPublic" placement="bottom">
<template #title> <template #title>
<!-- todo: i18n --> <!-- todo: i18n -->
<div class="text-center w-full">Copy record URL</div> <div class="text-center w-full">Copy record URL</div>

5
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -8,6 +8,7 @@ import {
FieldsInj, FieldsInj,
IsExpandedFormOpenInj, IsExpandedFormOpenInj,
IsKanbanInj, IsKanbanInj,
IsPublicInj,
MetaInj, MetaInj,
ReloadRowDataHookInj, ReloadRowDataHookInj,
computedInject, computedInject,
@ -57,6 +58,8 @@ const meta = toRef(props, 'meta')
const router = useRouter() const router = useRouter()
const isPublic = inject(IsPublicInj, ref(false))
const { isUIAllowed } = useRoles() const { isUIAllowed } = useRoles()
// override cell click hook to avoid unexpected behavior at form fields // override cell click hook to avoid unexpected behavior at form fields
@ -360,6 +363,7 @@ export default {
:column="col" :column="col"
:edit-enabled="true" :edit-enabled="true"
:active="true" :active="true"
:read-only="isPublic"
@update:model-value="changedColumns.add(col.title)" @update:model-value="changedColumns.add(col.title)"
/> />
</LazySmartsheetDivDataCell> </LazySmartsheetDivDataCell>
@ -401,6 +405,7 @@ export default {
:column="col" :column="col"
:edit-enabled="true" :edit-enabled="true"
:active="true" :active="true"
:read-only="isPublic"
@update:model-value="changedColumns.add(col.title)" @update:model-value="changedColumns.add(col.title)"
/> />
</LazySmartsheetDivDataCell> </LazySmartsheetDivDataCell>

2
packages/nc-gui/composables/useExpandedFormStore.ts

@ -244,7 +244,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
undo: { undo: {
fn: async (id: string, data: Record<string, any>) => { fn: async (id: string, data: Record<string, any>) => {
await $api.dbTableRow.update(NOCO, project.value.id as string, meta.value.id, encodeURIComponent(id), data) await $api.dbTableRow.update(NOCO, project.value.id as string, meta.value.id, encodeURIComponent(id), data)
loadKanbanData() await loadKanbanData()
reloadTrigger?.trigger() reloadTrigger?.trigger()
}, },
args: [id, clone(undoObject)], args: [id, clone(undoObject)],

Loading…
Cancel
Save