diff --git a/packages/nc-gui/components/cell/GeoData.vue b/packages/nc-gui/components/cell/GeoData.vue index a8bbbce170..2dc34d06e8 100644 --- a/packages/nc-gui/components/cell/GeoData.vue +++ b/packages/nc-gui/components/cell/GeoData.vue @@ -73,7 +73,7 @@ const onClickSetCurrentLocation = () => { {{ latLongStr }} diff --git a/packages/nc-gui/components/dlg/ViewCreate.vue b/packages/nc-gui/components/dlg/ViewCreate.vue index 2252acf1fe..780aa8d499 100644 --- a/packages/nc-gui/components/dlg/ViewCreate.vue +++ b/packages/nc-gui/components/dlg/ViewCreate.vue @@ -83,15 +83,9 @@ const viewNameRules = [ }, ] -const groupingFieldColumnRules = [ - // name is required - { required: true, message: `${t('general.groupingField')} ${t('general.required')}` }, -] +const groupingFieldColumnRules = [{ required: true, message: `${t('general.groupingField')} ${t('general.required')}` }] -const geoDataFieldColumnRules = [ - // name is required - { required: true, message: `${t('general.geoDataField')} ${t('general.required')}` }, -] +const geoDataFieldColumnRules = [{ required: true, message: `${t('general.geoDataField')} ${t('general.required')}` }] const typeAlias = computed( () => diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vue index 6695e74a49..3b3f5ac263 100644 --- a/packages/nc-gui/components/smartsheet/Gallery.vue +++ b/packages/nc-gui/components/smartsheet/Gallery.vue @@ -105,7 +105,6 @@ const expandForm = (row: RowType, state?: Record) => { expandedFormRow.value = row expandedFormRowState.value = state expandedFormDlg.value = true - console.log(state) } } diff --git a/packages/nc-gui/components/smartsheet/Kanban.vue b/packages/nc-gui/components/smartsheet/Kanban.vue index b6fd7e3458..26578fd027 100644 --- a/packages/nc-gui/components/smartsheet/Kanban.vue +++ b/packages/nc-gui/components/smartsheet/Kanban.vue @@ -12,7 +12,6 @@ import { IsPublicInj, MetaInj, OpenNewRecordFormHookInj, - ReadonlyInj, inject, onBeforeMount, onBeforeUnmount, @@ -85,8 +84,6 @@ provide(IsGridInj, ref(false)) provide(IsKanbanInj, ref(true)) -provide(ReadonlyInj, !isUIAllowed('xcDatatableEditable')) - const hasEditPermission = $computed(() => isUIAllowed('xcDatatableEditable')) const fields = inject(FieldsInj, ref([])) diff --git a/packages/nc-gui/components/smartsheet/Map.vue b/packages/nc-gui/components/smartsheet/Map.vue index d0c955d639..5014fdc70b 100644 --- a/packages/nc-gui/components/smartsheet/Map.vue +++ b/packages/nc-gui/components/smartsheet/Map.vue @@ -3,35 +3,44 @@ import 'leaflet/dist/leaflet.css' import L, { LatLng } from 'leaflet' import 'leaflet.markercluster' import { ViewTypes } from 'nocodb-sdk' -// import contextmenu from 'vue3-contextmenu' -// import 'vue3-contextmenu/dist/vue3-contextmenu.css' import { IsGalleryInj, IsGridInj, IsMapInj, OpenNewRecordFormHookInj, onMounted, provide, ref } from '#imports' - import type { Row as RowType } from '~/lib' import { latLongToJoinedString } from '~~/utils/geoDataUtils' provide(IsGalleryInj, ref(false)) + provide(IsGridInj, ref(false)) + provide(IsMapInj, ref(true)) + const route = useRoute() + const router = useRouter() + const reloadViewDataHook = inject(ReloadViewDataHookInj) + const reloadViewMetaHook = inject(ReloadViewMetaHookInj) + const { formattedData, loadMapData, loadMapMeta, mapMetaData, geoDataFieldColumn, addEmptyRow, syncCount, paginationData } = useMapViewStoreOrThrow() const markersClusterGroupRef = ref() + const mapContainerRef = ref() + const myMapRef = ref() const meta = inject(MetaInj, ref()) + const view = inject(ActiveViewInj, ref()) + const openNewRecordFormHook = inject(OpenNewRecordFormHookInj, createEventHook()) const expandedFormDlg = ref(false) + const expandedFormRow = ref() + const expandedFormRowState = ref>() -const expandedFormClickedLatLongForNewRow = ref<[number, number]>() const fallBackCenterLocation = { lat: 51, @@ -39,11 +48,11 @@ const fallBackCenterLocation = { } const getMapZoomLocalStorageKey = (viewId: string) => { - return `mapView.zoom.${viewId}` + return `mapView.${viewId}.zoom` } -const getMapCenterLocalStorageKey = (viewId: string) => `mapView.center.${viewId}` +const getMapCenterLocalStorageKey = (viewId: string) => `mapView.${viewId}.center` -const expandForm = (row: RowType, state?: Record, clickedLatLongForNewRow?: [number, number]) => { +const expandForm = (row: RowType, state?: Record) => { const rowId = extractPkFromRow(row.row, meta.value!.columns!) if (rowId) { router.push({ @@ -53,13 +62,9 @@ const expandForm = (row: RowType, state?: Record, clickedLatLongFor }, }) } else { - expandedFormClickedLatLongForNewRow.value = clickedLatLongForNewRow expandedFormRow.value = row expandedFormRowState.value = state expandedFormDlg.value = true - - // const lat = state?.lat - // const lng = state?.lng } } @@ -85,7 +90,7 @@ const expandedFormOnRowIdDlg = computed({ const addMarker = (lat: number, long: number, row: RowType) => { if (markersClusterGroupRef.value == null) { - throw new Error('Map is null') + throw new Error('Marker cluster is null') } const newMarker = L.marker([lat, long]).on('click', () => { expandForm(row) @@ -98,7 +103,6 @@ const resetZoomAndCenterBasedOnLocalStorage = () => { return } const initialZoomLevel = parseInt(localStorage.getItem(getMapZoomLocalStorageKey(mapMetaData.value.fk_view_id)) || '10') - const initialCenterLocalStorageStr = localStorage.getItem(getMapCenterLocalStorageKey(mapMetaData.value.fk_view_id)) const initialCenter = initialCenterLocalStorageStr ? JSON.parse(initialCenterLocalStorageStr) : fallBackCenterLocation @@ -142,13 +146,12 @@ onMounted(async () => { }) myMap.on('contextmenu', async function (e) { - const lat = e.latlng.lat - const lng = e.latlng.lng + const { lat, lng } = e.latlng const newRow = await addEmptyRow() if (geoDataFieldColumn.value?.title) { newRow.row[geoDataFieldColumn.value.title] = latLongToJoinedString(lat, lng) } - expandForm(newRow, [lat, lng]) + expandForm(newRow) }) }) @@ -205,13 +208,13 @@ const count = computed(() => paginationData.value.totalRows)
-
{{ count }} records
+
{{ count }} {{ $t('objects.records') }}
diff --git a/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue b/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue index 1d3b206bea..2ee1ada1c6 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue @@ -72,12 +72,7 @@ const handleChange = () => {