Browse Source

MapView: 'Mapped by' column values should always be delivered - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
503dbc8da9
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 10
      packages/nc-gui/components/smartsheet/Form.vue
  2. 20
      packages/nc-gui/composables/useViewColumns.ts

10
packages/nc-gui/components/smartsheet/Form.vue

@ -1,6 +1,7 @@
<script setup lang="ts">
import Draggable from 'vuedraggable'
import { RelationTypes, UITypes, ViewTypes, getSystemColumns, isVirtualCol } from 'nocodb-sdk'
import { Ref } from '@vue/reactivity'
import {
ActiveViewInj,
IsFormInj,
@ -238,8 +239,13 @@ async function removeAllColumns() {
for (const col of (localColumns as Record<string, any>)?.value) {
if (!shouldSkipColumn(col)) col.show = false
}
// // const FOO = (localColumns as Ref<Record<string, any>[]>)?.value
// const FOO = localColumns?.value
// .filter((col: Record<string, any>) => shouldSkipColumn(col))
// .map((col: Record<string, any>) => col.fk_column_id)
await hideAll(
(localColumns as Record<string, any>)?.value
localColumns?.value
.filter((col: Record<string, any>) => shouldSkipColumn(col))
.map((col: Record<string, any>) => col.fk_column_id),
)
@ -827,7 +833,7 @@ watch(view, (nextView) => {
@apply px-4 min-h-[75px] w-full h-full;
.nc-attachment {
@apply md:(w-[50px] h-[50px]) lg:(w-[75px] h-[75px]) min-h-[50px] min-w-[50px];
@apply md: (w-[50px] h-[50px]) lg:(w-[75px] h-[75px]) min-h-[50px] min-w-[50px];
}
.nc-attachment-cell-dropzone {

20
packages/nc-gui/composables/useViewColumns.ts

@ -102,27 +102,39 @@ export function useViewColumns(
reloadData?.()
$e('a:fields:show-all')
}
const hideAll = async (ignoreIds?: any) => {
const hideAll = async (ignoreIds?: any[]) => {
console.info('isLocalMode.value', isLocalMode.value)
const viewEssentialColumnIds = fields.value
?.filter((field: Field) => field.isViewEssentialField)
?.map((field: Field) => field.fk_column_id)
console.info('viewEssentialColumnIds', viewEssentialColumnIds)
const mergedIgnoreIds = [...(viewEssentialColumnIds || []), ...(ignoreIds || [])]
console.info('mergedIgnoreIds', mergedIgnoreIds)
if (isLocalMode.value) {
fields.value = fields.value?.map((field: Field) => ({
...field,
show: !!field.isViewEssentialField,
}))
console.log('fields.value', fields.value)
console.info('fields.value', fields.value)
reloadData?.()
return
}
if (view?.value?.id) {
if (ignoreIds) {
if (mergedIgnoreIds) {
console.info('API call with ignoreIds', mergedIgnoreIds)
await $api.dbView.hideAllColumn(view.value.id, {
ignoreIds,
ignoreIds: mergedIgnoreIds,
})
} else {
await $api.dbView.hideAllColumn(view.value.id)
}
console.info('fields.value AFTER API CALL for hideAllColumn', fields.value)
}
await loadViewColumns()
console.info('fields.value AFTER loadViewColumns', fields.value)
reloadData?.()
$e('a:fields:show-all')
}

Loading…
Cancel
Save