Browse Source

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

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
e9425e280f
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 42
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
  2. 3
      packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue
  3. 2
      packages/nc-gui/composables/useViewColumns.ts
  4. 1
      packages/nc-gui/lib/enums.ts

42
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -56,6 +56,10 @@ eventBus.on((event) => {
if (event === SmartsheetStoreEvents.FIELD_RELOAD) { if (event === SmartsheetStoreEvents.FIELD_RELOAD) {
loadViewColumns() loadViewColumns()
} }
else if (event === SmartsheetStoreEvents.MAPPED_BY_COLUMN_CHANGE) {
// alert('SmartsheetStoreEvents.MAPPED_BY_COLUMN_CHANGE')
loadViewColumns()
}
}) })
watch( watch(
@ -163,21 +167,11 @@ useMenuCloseOnEsc(open)
<template #overlay> <template #overlay>
<div <div
class="p-3 min-w-[280px] bg-gray-50 shadow-lg nc-table-toolbar-menu max-h-[max(80vh,500px)] overflow-auto !border" class="p-3 min-w-[280px] bg-gray-50 shadow-lg nc-table-toolbar-menu max-h-[max(80vh,500px)] overflow-auto !border"
data-testid="nc-fields-menu" data-testid="nc-fields-menu" @click.stop>
@click.stop <a-card v-if="activeView.type === ViewTypes.GALLERY || activeView.type === ViewTypes.KANBAN" size="small"
> title="Cover image">
<a-card <a-select v-model:value="coverImageColumnId" class="w-full" :options="coverOptions"
v-if="activeView.type === ViewTypes.GALLERY || activeView.type === ViewTypes.KANBAN" dropdown-class-name="nc-dropdown-cover-image" @click.stop />
size="small"
title="Cover image"
>
<a-select
v-model:value="coverImageColumnId"
class="w-full"
:options="coverOptions"
dropdown-class-name="nc-dropdown-cover-image"
@click.stop
/>
</a-card> </a-card>
<div class="p-1" @click.stop> <div class="p-1" @click.stop>
@ -187,20 +181,10 @@ useMenuCloseOnEsc(open)
<div class="nc-fields-list py-1"> <div class="nc-fields-list py-1">
<Draggable v-model="fields" item-key="id" @change="onMove($event)"> <Draggable v-model="fields" item-key="id" @change="onMove($event)">
<template #item="{ element: field, index: index }"> <template #item="{ element: field, index: index }">
<div <div v-show="filteredFieldList.includes(field)" :key="field.id" class="px-2 py-1 flex items-center"
v-show="filteredFieldList.includes(field)" :data-testid="`nc-fields-menu-${field.title}`" @click.stop>
:key="field.id" <a-checkbox v-model:checked="field.show" v-e="['a:fields:show-hide']" class="shrink"
class="px-2 py-1 flex items-center" :disabled="field.isViewEssentialField" @change="saveOrUpdate(field, index)">
:data-testid="`nc-fields-menu-${field.title}`"
@click.stop
>
<a-checkbox
v-model:checked="field.show"
v-e="['a:fields:show-hide']"
class="shrink"
:disabled="field.isViewEssentialField"
@change="saveOrUpdate(field, index)"
>
<div class="flex items-center"> <div class="flex items-center">
<component :is="getIcon(metaColumnById[field.fk_column_id])" /> <component :is="getIcon(metaColumnById[field.fk_column_id])" />

3
packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue

@ -14,6 +14,8 @@ import {
watch, watch,
} from '#imports' } from '#imports'
const { eventBus } = useSmartsheetStoreOrThrow()
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
const activeView = inject(ActiveViewInj, ref()) const activeView = inject(ActiveViewInj, ref())
@ -48,6 +50,7 @@ const geoDataMappingFieldColumnId = computed({
await loadMapMeta() await loadMapMeta()
await loadMapData() await loadMapData()
;(activeView.value?.view as MapType).fk_geo_data_col_id = val ;(activeView.value?.view as MapType).fk_geo_data_col_id = val
eventBus.emit(SmartsheetStoreEvents.MAPPED_BY_COLUMN_CHANGE)
} }
}, },
}) })

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

@ -1,4 +1,4 @@
import { isSystemColumn } from 'nocodb-sdk' import { isSystemColumn, MapType, ViewTypes } from 'nocodb-sdk'
import type { ColumnType, TableType, ViewType } from 'nocodb-sdk' import type { ColumnType, TableType, ViewType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue' import type { ComputedRef, Ref } from 'vue'
import { IsPublicInj, computed, inject, ref, useNuxtApp, useProject, useUIPermission, watch } from '#imports' import { IsPublicInj, computed, inject, ref, useNuxtApp, useProject, useUIPermission, watch } from '#imports'

1
packages/nc-gui/lib/enums.ts

@ -88,6 +88,7 @@ export enum SmartsheetStoreEvents {
DATA_RELOAD = 'data-reload', DATA_RELOAD = 'data-reload',
FIELD_RELOAD = 'field-reload', FIELD_RELOAD = 'field-reload',
FIELD_ADD = 'field-add', FIELD_ADD = 'field-add',
MAPPED_BY_COLUMN_CHANGE = 'mapped-by-column-change',
} }
export enum DataSourcesSubTab { export enum DataSourcesSubTab {

Loading…
Cancel
Save