|
|
@ -1,41 +1,46 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import type { VNodeRef } from '@vue/runtime-core' |
|
|
|
import type { VNodeRef } from '@vue/runtime-core' |
|
|
|
import { EditModeInj, inject, useVModel } from '#imports' |
|
|
|
import type { GeoLocationType } from 'nocodb-sdk' |
|
|
|
|
|
|
|
import { EditModeInj, inject, ReadonlyInj, ref, useVModel } from '#imports' |
|
|
|
|
|
|
|
import { onKeyDown } from '@vueuse/core' |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
modelValue?: number | null | string |
|
|
|
modelValue?: GeoLocationType |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface Emits { |
|
|
|
interface Emits { |
|
|
|
(event: 'update:modelValue', model: number): void |
|
|
|
(event: 'update:modelValue', model: GeoLocationType): void |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<Props>() |
|
|
|
const props = defineProps<Props>() |
|
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits<Emits>() |
|
|
|
const emits = defineEmits<Emits>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isOpen = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const visible = ref<boolean>(false) |
|
|
|
|
|
|
|
|
|
|
|
const editEnabled = inject(EditModeInj) |
|
|
|
const editEnabled = inject(EditModeInj) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const readOnly = inject(ReadonlyInj)! |
|
|
|
|
|
|
|
|
|
|
|
const vModel = useVModel(props, 'modelValue', emits) |
|
|
|
const vModel = useVModel(props, 'modelValue', emits) |
|
|
|
|
|
|
|
|
|
|
|
const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus() |
|
|
|
const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const toggleVisbility = () => { |
|
|
|
|
|
|
|
visible.value = !visible.value |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div v-on:click="toggleVisbility" :style="{ minWidth: '100%', minHeight: '100%', backgroundColor: 'red' }"> |
|
|
|
TEST |
|
|
|
<a-popover v-model:visible="visible" title="Title" trigger="click"> |
|
|
|
<a-input-group v-if="editEnabled"> |
|
|
|
<template> |
|
|
|
<a-input |
|
|
|
<a-input /> |
|
|
|
:ref="focus" |
|
|
|
|
|
|
|
v-model="vModel" |
|
|
|
|
|
|
|
class="outline-none px-2 border-none w-full h-full text-sm" |
|
|
|
|
|
|
|
type="number" |
|
|
|
|
|
|
|
step="0.1" |
|
|
|
|
|
|
|
@blur="editEnabled = false" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<a-input /> |
|
|
|
<a-input /> |
|
|
|
</a-input-group> |
|
|
|
</template> |
|
|
|
<span v-else class="text-sm">{{ vModel }}</span> |
|
|
|
</a-popover> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|