From 010c1a303cb01b918e0bdf3d1496653cd3abb8b3 Mon Sep 17 00:00:00 2001 From: Kevin Fabre Date: Fri, 28 Jun 2024 10:18:28 +0200 Subject: [PATCH] feat(Table): minimap preview for geo fields --- .../Table/Cell/Format/GeoFormat.svelte | 44 ++++++++++++++----- .../utils/{tippy.ts => tippy/index.ts} | 1 + .../src/components/utils/tippy/themes.scss | 26 +++++++++++ 3 files changed, 59 insertions(+), 12 deletions(-) rename packages/visualizations/src/components/utils/{tippy.ts => tippy/index.ts} (94%) create mode 100644 packages/visualizations/src/components/utils/tippy/themes.scss diff --git a/packages/visualizations/src/components/Table/Cell/Format/GeoFormat.svelte b/packages/visualizations/src/components/Table/Cell/Format/GeoFormat.svelte index 34c455831..59991f3de 100644 --- a/packages/visualizations/src/components/Table/Cell/Format/GeoFormat.svelte +++ b/packages/visualizations/src/components/Table/Cell/Format/GeoFormat.svelte @@ -1,5 +1,8 @@ -
+
{ + showMap = true; + }, + onUntrigger: (instance) => { + showMap = false; + }, + }} +> -
{display(rawValue)}
+
{display(rawValue)}
+ {#if showMap} -
+
{/if}
- diff --git a/packages/visualizations/src/components/utils/tippy.ts b/packages/visualizations/src/components/utils/tippy/index.ts similarity index 94% rename from packages/visualizations/src/components/utils/tippy.ts rename to packages/visualizations/src/components/utils/tippy/index.ts index 4efddb000..2802b9b8f 100644 --- a/packages/visualizations/src/components/utils/tippy.ts +++ b/packages/visualizations/src/components/utils/tippy/index.ts @@ -1,5 +1,6 @@ import tippy, { Props } from 'tippy.js'; import 'tippy.js/dist/tippy.css'; +import './themes.scss'; export default function tippyAction(node: HTMLElement, initialProps: Partial) { const instance = tippy(node, initialProps); diff --git a/packages/visualizations/src/components/utils/tippy/themes.scss b/packages/visualizations/src/components/utils/tippy/themes.scss new file mode 100644 index 000000000..47cc2a390 --- /dev/null +++ b/packages/visualizations/src/components/utils/tippy/themes.scss @@ -0,0 +1,26 @@ +$table-theme: 'ods-visualization-table'; +$table-background-color: white; +$tippy-box-shadow: 0 6px 13px 0 rgba(0, 0, 0, 0.26); + +.tippy-box[data-theme~='#{$table-theme}'] { + background-color: $table-background-color; + box-shadow: $tippy-box-shadow; +} + +.tippy-box[data-theme~='#{$table-theme}'] > .tippy-content { + padding: 6px; + border-radius: 6px; +} + +.tippy-box[data-theme~='#{$table-theme}'][data-placement^='top'] > .tippy-arrow::before { + border-top-color: $table-background-color; +} +.tippy-box[data-theme~='#{$table-theme}'][data-placement^='bottom'] > .tippy-arrow::before { + border-bottom-color: $table-background-color; +} +.tippy-box[data-theme~='#{$table-theme}'][data-placement^='left'] > .tippy-arrow::before { + border-left-color: $table-background-color; +} +.tippy-box[data-theme~='#{$table-theme}'][data-placement^='right'] > .tippy-arrow::before { + border-right-color: $table-background-color; +}