From 207f0e365aa7c553e771569c7c9ea7493a45f534 Mon Sep 17 00:00:00 2001 From: flisowna Date: Sun, 30 Oct 2022 21:31:11 +0400 Subject: [PATCH] WIP mapViewStore --- packages/nc-gui/components/smartsheet/Map.vue | 26 ++++++++++++++++--- .../nc-gui/composables/useMapViewDataStore.ts | 0 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 packages/nc-gui/composables/useMapViewDataStore.ts diff --git a/packages/nc-gui/components/smartsheet/Map.vue b/packages/nc-gui/components/smartsheet/Map.vue index eec68ebf6a..590b7b4908 100644 --- a/packages/nc-gui/components/smartsheet/Map.vue +++ b/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: '© OpenStreetMap', }).addTo(myMap) }) + +// const geodata = data.value[0].row.geo.split(';')