Browse Source

geodata: create new row on right-click/tap on map (pass data into expand form dialog - hacky code / needs refactoring) - WIP

pull/4723/head
flisowna 2 years ago
parent
commit
3fbe68317f
  1. 14
      packages/nc-gui/components/cell/GeoData.vue
  2. 2
      packages/nc-gui/components/smartsheet/Cell.vue
  3. 34
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

14
packages/nc-gui/components/cell/GeoData.vue

@ -1,13 +1,11 @@
<script lang="ts" setup>
import type { GeoLocationType } from 'nocodb-sdk'
import { useVModel } from '#imports'
// import { InitialGeoPositionData } from '../smartsheet/expanded-form/index.vue';
interface Props {
modelValue?: string | null
defaultGeoPosition?: {
lat: number
long: number
}
// defaultGeoPosition?: InitialGeoPositionData
}
interface Emits {
@ -20,14 +18,16 @@ const emits = defineEmits<Emits>()
const vModel = useVModel(props, 'modelValue', emits)
const defaultGeoPosition = useVModel(props, 'defaultGeoPosition')
// const defaultGeoPosition = useVModel(props, 'defaultGeoPosition')
let error = $ref<string | undefined>()
// let error = $ref<string | undefined>()
let isExpanded = $ref(false)
let isLoading = $ref(false)
// const shouldSetDefaultGeoPosition = defaultGeoPosition.value?.geoColId ===
const [latitude, longitude] = (vModel.value || '').split(';')
const latLongStr = computed(() => {
@ -46,7 +46,7 @@ const handleFinish = () => {
}
const clear = () => {
error = undefined
// error = undefined
isExpanded = false

2
packages/nc-gui/components/smartsheet/Cell.vue

@ -130,6 +130,8 @@ const syncAndNavigate = (dir: NavigateDir, e: KeyboardEvent) => {
if (!isForm.value) e.stopImmediatePropagation()
}
console.log('column.value in cell', column.value)
</script>
<template>

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

@ -136,40 +136,10 @@ if (isKanban.value) {
}
}
// if (isMap.value) {
// console.log('fields', fields.value)
// for (const [k, v] of Object.entries(row.value.row)) {
// if (v) {
// console.log('value', v, 'key', k)
// }
// }
// if (initialGeoPositionData?.value?.lat) {
// // Filter the columns by their id
// const filteredColumns = meta?.value?.columns.filter((col) => col.id === initialGeoPositionData?.value?.geoColId)
// // If there are any columns that match the geoColId
// if (filteredColumns.length > 0) {
// // Get the first (and possibly only) column that matches the geoColId
// const geoColumn = filteredColumns[0]
// console.log('geoColumn', geoColumn.id )
// // Load the lat and long values for the geoColumn
// if (geoColumn.title) {
// const lat = initialGeoPositionData.value.lat
// const long = initialGeoPositionData.value.long
// row.value.row[geoColumn.title] = lat
// console.log('lat', lat)
// console.log('long', long)
// }
// }
// }
// }
const cellWrapperEl = ref<HTMLElement>()
onMounted(() => {
setTimeout(() => {
;(cellWrapperEl.value?.querySelector('input,select,textarea') as HTMLInputElement)?.focus()
})
setTimeout(() => (cellWrapperEl.value?.querySelector('input,select,textarea') as HTMLInputElement)?.focus())
})
</script>
@ -192,7 +162,7 @@ export default {
<SmartsheetExpandedFormHeader :view="props.view" @cancel="onClose" />
<div class="!bg-gray-100 rounded flex-1">
FOO geodata: {{ JSON.stringify(initialGeoPositionData?.geoColId) }} BAR
FOO geodata: {{ JSON.stringify(initialGeoPositionData) }}
<div class="flex h-full nc-form-wrapper items-stretch min-h-[max(70vh,100%)]">
<div class="flex-1 overflow-auto scrollbar-thin-dull nc-form-fields-container">

Loading…
Cancel
Save