Browse Source

geodata: fix decimal value formatting for geo data input

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

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

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

Loading…
Cancel
Save