Browse Source

WIP mapViewStore

pull/4140/head
flisowna 2 years ago
parent
commit
207f0e365a
  1. 26
      packages/nc-gui/components/smartsheet/Map.vue
  2. 0
      packages/nc-gui/composables/useMapViewDataStore.ts

26
packages/nc-gui/components/smartsheet/Map.vue

@ -12,17 +12,27 @@ provide(IsGalleryInj, ref(false))
provide(IsGridInj, ref(false))
provide(IsMapInj, ref(true))
provide(ReadonlyInj, !isUIAllowed('xcDatatableEditable'))
const reloadViewDataHook = inject(ReloadViewDataHookInj)
const meta = inject(MetaInj, ref())
const view = inject(ActiveViewInj, ref())
const { loadData, formattedData: data } = useViewData(meta, view)
// const { isUIAllowed } = useUIPermission()
watch(view, async (nextView) => {
if (nextView?.type === ViewTypes.MAP) {
// loadData()
console.log('change')
alert('JO')
}
})
// const { isUIAllowed } = useUIPermission()
onMounted(async () => {
await loadData()
// const geodata = data.value[0].row.geo.split(';')
})
const markerRef = ref()
@ -31,6 +41,12 @@ const latitude = ref()
const longitude = ref()
const markersRef = ref()
const { loadMapData, mapData } = useMapViewDataStore()
reloadViewDataHook?.on(async () => {
alert('reloadViewDataHook for Map')
})
function addMarker() {
const markerNew = markerRef.value([parseFloat(latitude.value), parseFloat(longitude.value)])
console.log(markersRef.value)
@ -54,18 +70,20 @@ onMounted(async () => {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(myMap)
})
// const geodata = data.value[0].row.geo.split(';')
</script>
<template>
<div class="flex flex-col h-full w-full">
{{ JSON.stringify(data) }}
<div class="flex m-4 gap-4">
{{ JSON.stringify(view) }}
<!-- <div class="flex m-4 gap-4">
<label :for="latitude">latitude</label>
<input v-model="latitude" />
<label :for="longitude">longitude</label>
<input v-model="longitude" />
<button class="bg-blue" @click="addMarker">Submit</button>
</div>
</div> -->
<client-only placeholder="Loading...">
<div class="nounderline" id="map"></div>
</client-only>

0
packages/nc-gui/composables/useMapViewDataStore.ts

Loading…
Cancel
Save