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 rowId = extractPkFromRow(row.row, meta.value!.columns!)
if (rowId) {
if (rowId && !isPublic.value) {
router.push({
query: {
...route.query,
@ -244,10 +244,9 @@ watch(
<div v-for="(record, rowIndex) in data" :key="`record-${record.row.id}`">
<LazySmartsheetRow :row="record">
<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' }"
:data-testid="`nc-gallery-card-${record.row.id}`"
:style="isPublic ? { cursor: 'default' } : { cursor: 'pointer' }"
@click="expandFormClick($event, record)"
@contextmenu="showContextMenu($event, { row: rowIndex })"
>
@ -315,7 +314,7 @@ watch(
</h2>
<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="w-full pb-1 text-gray-300">
<LazySmartsheetHeaderVirtualCell

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

@ -2,6 +2,7 @@
import { message } from 'ant-design-vue'
import type { ViewType } from 'nocodb-sdk'
import {
IsPublicInj,
ReloadRowDataHookInj,
iconMap,
isMac,
@ -20,6 +21,8 @@ const route = useRoute()
const { meta, isSqlView } = useSmartsheetStoreOrThrow()
const isPublic = inject(IsPublicInj, ref(false))
const { commentsDrawer, displayValue, primaryKey, save: _save, loadRow, deleteRowById } = useExpandedFormStoreOrThrow()
const { isNew, syncLTARRefs, state } = useSmartsheetRowStoreOrThrow()
@ -98,7 +101,7 @@ const onConfirmDeleteRowClick = async () => {
</h5>
<div class="flex-1" />
<a-tooltip placement="bottom">
<a-tooltip v-if="!isPublic" placement="bottom">
<template #title>
<!-- todo: i18n -->
<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,
IsExpandedFormOpenInj,
IsKanbanInj,
IsPublicInj,
MetaInj,
ReloadRowDataHookInj,
computedInject,
@ -57,6 +58,8 @@ const meta = toRef(props, 'meta')
const router = useRouter()
const isPublic = inject(IsPublicInj, ref(false))
const { isUIAllowed } = useRoles()
// override cell click hook to avoid unexpected behavior at form fields
@ -360,6 +363,7 @@ export default {
:column="col"
:edit-enabled="true"
:active="true"
:read-only="isPublic"
@update:model-value="changedColumns.add(col.title)"
/>
</LazySmartsheetDivDataCell>
@ -401,6 +405,7 @@ export default {
:column="col"
:edit-enabled="true"
:active="true"
:read-only="isPublic"
@update:model-value="changedColumns.add(col.title)"
/>
</LazySmartsheetDivDataCell>

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

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

Loading…
Cancel
Save