mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
DATA LAYERS keeps its curated core layers; regional and niche sources live in the Data Library, opened from Browse data library at the foot of the panel. Each entry is a JSON manifest in src/library/entries/ pointing at a live upstream (query API, provider-hosted file or tile endpoint), so nothing is bundled and a self-hosted instance hosts no data. Sources without CORS go through one allowlisted /api/library route. Kinds: dataset (GeoJSON, CSV, JSON records, ArcGIS, partitioned GeoParquet), tiles (XYZ, WMS/ArcGIS bbox export, terrarium relief) and pack. Selections persist and travel in share links as lib=, separate from the core layer tokens. Library rows get Zoom and Remove icon chips that work while the layer is off, rendered through RailChips. Strings are translated in every locale.
105 lines
3.8 KiB
Vue
105 lines
3.8 KiB
Vue
<script setup>
|
|
import RailChips from '../rail/RailChips.vue';
|
|
import RailRowList from '../rail/RailRowList.vue';
|
|
import RowRange from './RowRange.vue';
|
|
import RowSlider from './RowSlider.vue';
|
|
import RowSwitch from './RowSwitch.vue';
|
|
import RowText from './RowText.vue';
|
|
import { vClassToggle } from '../rail/classToggle.js';
|
|
|
|
// The data layer rows under their group headings. LayerPanel presents every
|
|
// value; clicks reach it with the layer id, and it re-reads the live
|
|
// descriptor before acting.
|
|
defineProps({
|
|
items: { type: Array, required: true },
|
|
onToggle: { type: Function, default: () => {} },
|
|
onChip: { type: Function, default: () => {} },
|
|
onListItem: { type: Function, default: () => {} },
|
|
onSlider: { type: Function, default: () => {} },
|
|
onRange: { type: Function, default: () => {} },
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<template v-for="item in items" :key="item.key"
|
|
><h3 v-if="item.heading" class="data-layer-group-heading">{{
|
|
item.heading
|
|
}}</h3
|
|
><div
|
|
v-else
|
|
class="data-toggle-row"
|
|
v-class-toggle="{
|
|
'data-toggle-row--count-line': item.count?.countLine,
|
|
}"
|
|
:data-layer-id="item.id"
|
|
:data-layer-name="item.englishName"
|
|
:data-library-entry="item.libraryEntry || undefined"
|
|
><div class="data-toggle-top"
|
|
><div class="data-toggle-left"
|
|
><span class="data-icon" aria-hidden="true">{{ item.icon }}</span
|
|
><RowText class="data-name" :text="item.name" /></div
|
|
><div class="data-toggle-right"
|
|
><RowText
|
|
v-if="item.count"
|
|
:class="['data-count', { 'data-count-empty': item.count.empty }]"
|
|
:text="item.count.text"
|
|
/><button
|
|
type="button"
|
|
:class="['data-toggle-btn', item.toggle.classes]"
|
|
:data-feed-state="item.toggle.feedState"
|
|
:aria-disabled="String(item.toggle.ariaDisabled)"
|
|
:aria-busy="String(item.toggle.ariaBusy)"
|
|
:title="item.toggle.title"
|
|
:aria-label="item.toggle.ariaLabel"
|
|
@click="onToggle(item.id)"
|
|
>{{ item.toggle.text }}</button
|
|
></div
|
|
></div
|
|
><RowText tag="div" class="data-toggle-meta" :text="item.meta" /><template
|
|
v-if="item.controls"
|
|
><div class="data-toggle-controls" :hidden="item.controls.hidden"
|
|
><RailChips
|
|
:chips="item.controls.chips"
|
|
:on-select="(chip) => onChip(item.id, chip.id)"
|
|
/><RowSwitch
|
|
v-if="item.controls.segmented"
|
|
:segmented="item.controls.segmented"
|
|
:on-select="(optionId) => onChip(item.id, optionId)"
|
|
/><RowSlider
|
|
v-if="item.controls.slider"
|
|
:slider="item.controls.slider"
|
|
:on-input="
|
|
(value) => onSlider(item.id, item.controls.slider.id, value)
|
|
"
|
|
/><RowRange
|
|
v-if="item.controls.range"
|
|
:range="item.controls.range"
|
|
:on-select="
|
|
(end, value) =>
|
|
onRange(item.id, item.controls.range.id, end, value)
|
|
"
|
|
/><span
|
|
v-for="(entry, index) in item.controls.legend"
|
|
:key="index"
|
|
class="data-toggle-legend-item"
|
|
:title="entry.blurb || undefined"
|
|
><span
|
|
class="data-toggle-legend-swatch"
|
|
:style="{ background: entry.color }"
|
|
></span
|
|
><span>{{ entry.text }}</span></span
|
|
><div
|
|
v-if="item.controls.info"
|
|
class="data-toggle-controls-info"
|
|
:title="item.controls.info.title"
|
|
:hidden="!item.controls.info.text"
|
|
>{{ item.controls.info.text }}</div
|
|
></div
|
|
><RailRowList
|
|
:list="item.controls.list"
|
|
:on-select="
|
|
(entry) => onListItem(item.id, entry.id)
|
|
" /></template></div
|
|
></template>
|
|
</template>
|