Browse Source

geodata: fix decimal value formatting for geo data input

pull/4749/head
flisowna 1 year ago
parent
commit
3c867f90a4
  1. 15
      packages/nc-gui/components/cell/GeoData.vue
  2. 3
      packages/nc-gui/utils/geoDataUtils.ts

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

@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { GeoLocationType } from 'nocodb-sdk'
import { useVModel } from '#imports'
import { Modal as AModal, useVModel } from '#imports'
import { latLongToJoinedString } from '~~/utils/geoDataUtils'
interface Props {
@ -49,6 +49,7 @@ const onClickSetCurrentLocation = () => {
isLoading = true
const onSuccess = (position) => {
const crd = position.coords
console.log('crd', crd)
formState.latitude = crd.latitude
formState.longitude = crd.longitude
isLoading = false
@ -84,11 +85,7 @@ const onClickSetCurrentLocation = () => {
:min="-90"
required
:max="90"
@keydown.down.stop
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
@keydown.stop
@selectstart.capture.stop
@mousedown.stop
/>
@ -105,11 +102,7 @@ const onClickSetCurrentLocation = () => {
required
:min="-180"
:max="180"
@keydown.down.stop
@keydown.left.stop
@keydown.right.stop
@keydown.up.stop
@keydown.delete.stop
@keydown.stop
@selectstart.capture.stop
@mousedown.stop
/>

3
packages/nc-gui/utils/geoDataUtils.ts

@ -1,4 +1,3 @@
const latLongToJoinedString = (lat: number, long: number) =>
`${lat.toFixed(7).replace('.', ',')};${long.toFixed(7).replace('.', ',')}`
const latLongToJoinedString = (lat: number, long: number) => `${lat.toFixed(7)};${long.toFixed(7)}`
export { latLongToJoinedString }

Loading…
Cancel
Save