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

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

Loading…
Cancel
Save