Browse Source

WIP

pull/4140/head
flisowna 2 years ago
parent
commit
b90ef50150
  1. 42
      packages/nc-gui/components/cell/GeoData.vue

42
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 type { VNodeRef } from '@vue/runtime-core' import type { UnwrapRef, VNodeRef } from '@vue/runtime-core'
import { Modal as AModal, EditModeInj, inject, useVModel, ref } from '#imports' import { Modal as AModal, EditModeInj, inject, useVModel, ref } from '#imports'
interface Props { interface Props {
@ -123,8 +123,24 @@ const onSave = () => {
// }) // })
const latLongStr = computed(() => const latLongStr = computed(() =>
vModel?.value?.latitude && vModel?.value.longitude ? `${vModel?.value.latitude}; ${vModel?.value.longitude}` : 'Empty', vModel?.value?.latitude && vModel?.value.longitude ? `${vModel?.value.latitude}; ${vModel?.value.longitude}` : 'Set location',
) )
const latitude = ref('INITIAL')
interface FormState {
latitude: string
longitude: string
}
const formState: UnwrapRef<FormState> = reactive({
latitude: vModel.value?.latitude,
longitude: vModel.value?.longitude,
})
const handleFinish = () => {
alert('FORM SUBMIT')
}
</script> </script>
<template> <template>
@ -141,22 +157,26 @@ const latLongStr = computed(() =>
<a-dropdown :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" trigger="click"> <a-dropdown :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" trigger="click">
<a-button>{{ latLongStr }}</a-button> <a-button>{{ latLongStr }}</a-button>
<template #overlay> <template #overlay>
<a-form v-model="vModel"> <a-form :model="formState" @finish="handleFinish">
<a-form-item label="Field A"> <a-form-item v-model="latitude" label="Latitude">
<a-input placeholder="input placeholder" /> <a-input v-model:value="formState.latitude" placeholder="input placeholder" />
LAT:{{ formState.latitude }}
</a-form-item> </a-form-item>
<a-form-item label="Field B"> <a-form-item label="Longitude">
<a-input placeholder="input placeholder" /> <a-input v-model:value="formState.longitude" placeholder="input placeholder" />
LONG:{{ formState.longitude }}
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary">Submit</a-button> <a-button type="primary">Submit</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
<div v-if="!isForm || isExpanded" class="flex flex-row"> <div v-if="!isForm || isExpanded" class="flex flex-row">
<a-button type="primary" size="small"> <a-form-item>
<!-- :disabled="!!error || localValue === vModel" --> <a-button type="primary" size="small" html-type="submit">
<div class="text-xs" :onclick="onSave">Save</div> <!-- :disabled="!!error || localValue === vModel" -->
</a-button> <div class="text-xs" :onclick="onSave">Save</div>
</a-button>
</a-form-item>
</div> </div>
</template> </template>
</a-dropdown> </a-dropdown>

Loading…
Cancel
Save