feat: show username/password fields for Access database connections

This commit is contained in:
t8y2 committed 2026-06-10 08:37:18 +08:00
1 parent 2e021d37d1
commit edba8214b5
477 files changed
+5720 -19773

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -143,81 +143,37 @@ watch(
<template>
<Dialog :open="open" @update:open="(value) => emit('update:open', value)">
<DialogContent
:show-close-button="false"
class="image-preview-dialog h-[min(86vh,920px)] w-[min(92vw,1280px)] max-w-none gap-0 overflow-hidden rounded-xl border-white/10 bg-[#090b0f] p-0 text-white shadow-2xl"
@escape-key-down="close"
>
<DialogContent :show-close-button="false" class="image-preview-dialog h-[min(86vh,920px)] w-[min(92vw,1280px)] max-w-none gap-0 overflow-hidden rounded-xl border-white/10 bg-[#090b0f] p-0 text-white shadow-2xl" @escape-key-down="close">
<div class="flex h-12 shrink-0 items-center gap-3 border-b border-white/10 bg-white/[0.035] px-4">
<div class="min-w-0 flex-1">
<DialogTitle class="truncate text-sm font-semibold text-white">{{ imageTitle }}</DialogTitle>
<div class="truncate text-[11px] text-white/45">{{ hostLabel || src }}</div>
</div>
<div class="flex items-center gap-1 rounded-md border border-white/10 bg-black/20 p-1">
<Button
variant="ghost"
size="icon"
class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white"
:title="t('grid.zoomOut')"
@click="zoomOut"
>
<Button variant="ghost" size="icon" class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white" :title="t('grid.zoomOut')" @click="zoomOut">
<ZoomOut class="h-3.5 w-3.5" />
</Button>
<div class="w-12 text-center text-[11px] tabular-nums text-white/65">{{ zoomLabel }}</div>
<Button
variant="ghost"
size="icon"
class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white"
:title="t('grid.zoomIn')"
@click="zoomIn"
>
<Button variant="ghost" size="icon" class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white" :title="t('grid.zoomIn')" @click="zoomIn">
<ZoomIn class="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"
class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white"
:title="t('grid.fitImage')"
@click="fitImage"
>
<Button variant="ghost" size="icon" class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white" :title="t('grid.fitImage')" @click="fitImage">
<Maximize2 class="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"
class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white"
:title="t('grid.openImage')"
@click="openExternal"
>
<Button variant="ghost" size="icon" class="h-7 w-7 text-white/75 hover:bg-white/10 hover:text-white" :title="t('grid.openImage')" @click="openExternal">
<ExternalLink class="h-3.5 w-3.5" />
</Button>
</div>
<Button
variant="ghost"
size="icon"
class="h-8 w-8 text-white/70 hover:bg-white/10 hover:text-white"
:title="t('dangerDialog.cancel')"
@click="close"
>
<Button variant="ghost" size="icon" class="h-8 w-8 text-white/70 hover:bg-white/10 hover:text-white" :title="t('dangerDialog.cancel')" @click="close">
<X class="h-4 w-4" />
</Button>
</div>
<div
ref="stageRef"
class="image-preview-stage relative min-h-0 flex-1 overflow-hidden"
:class="{ 'cursor-grabbing': dragStart, 'cursor-grab': !dragStart && imageLoaded && !imageError }"
@wheel="onWheel"
>
<div ref="stageRef" class="image-preview-stage relative min-h-0 flex-1 overflow-hidden" :class="{ 'cursor-grabbing': dragStart, 'cursor-grab': !dragStart && imageLoaded && !imageError }" @wheel="onWheel">
<div v-if="!imageLoaded && !imageError" class="absolute inset-0 flex items-center justify-center">
<div
class="h-16 w-16 animate-pulse rounded-full border border-white/10 bg-white/10 shadow-[0_0_80px_rgba(255,255,255,0.12)]"
/>
<div class="h-16 w-16 animate-pulse rounded-full border border-white/10 bg-white/10 shadow-[0_0_80px_rgba(255,255,255,0.12)]" />
</div>
<div
v-if="imageError"
class="absolute inset-0 flex items-center justify-center px-8 text-center text-sm text-white/55"
>
<div v-if="imageError" class="absolute inset-0 flex items-center justify-center px-8 text-center text-sm text-white/55">
{{ t("grid.imageLoadFailed") }}
</div>
<img
@@ -247,10 +203,7 @@ watch(
.image-preview-stage {
background-color: #07090d;
background-image:
linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%),
linear-gradient(-45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%),
linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%),
linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%), linear-gradient(-45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%), linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%),
radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.08), transparent 42%);
background-position:
0 0,
@@ -436,12 +436,7 @@ onBeforeUnmount(() => cleanupMap());
<template>
<Dialog :open="open" @update:open="(value) => emit('update:open', value)">
<DialogContent
:show-close-button="false"
:style="contentStyle"
class="layer-preview-dialog flex w-[96vw] max-w-[1800px] h-[88vh] max-h-[960px] min-w-[640px] min-h-[400px] flex-col gap-0 overflow-hidden rounded-xl border p-0 shadow-2xl"
@escape-key-down="close"
>
<DialogContent :show-close-button="false" :style="contentStyle" class="layer-preview-dialog flex w-[96vw] max-w-[1800px] h-[88vh] max-h-[960px] min-w-[640px] min-h-[400px] flex-col gap-0 overflow-hidden rounded-xl border p-0 shadow-2xl" @escape-key-down="close">
<!-- Header -->
<div class="flex h-12 shrink-0 items-center gap-2 border-b bg-muted/20 px-3">
<div class="flex min-w-0 shrink-0 items-center gap-2">
@@ -450,12 +445,7 @@ onBeforeUnmount(() => cleanupMap());
</div>
<!-- Label property selector -->
<select
v-if="labelProperties.length"
v-model="labelProperty"
class="h-6 shrink-0 rounded border bg-background px-1.5 text-[11px] outline-none"
@change="onLabelPropertyChange"
>
<select v-if="labelProperties.length" v-model="labelProperty" class="h-6 shrink-0 rounded border bg-background px-1.5 text-[11px] outline-none" @change="onLabelPropertyChange">
<option value="">— 标签 —</option>
<option v-for="p in labelProperties" :key="p" :value="p">
{{ p }}
@@ -465,94 +455,43 @@ onBeforeUnmount(() => cleanupMap());
<div class="flex flex-1" />
<!-- Basemap selector -->
<select
v-model="selectedBasemapId"
class="h-6 shrink-0 rounded border bg-background px-1.5 text-[11px] outline-none"
>
<select v-model="selectedBasemapId" class="h-6 shrink-0 rounded border bg-background px-1.5 text-[11px] outline-none">
<option v-for="bm in basemaps" :key="bm.id" :value="bm.id">
{{ bm.label }}
</option>
</select>
<!-- Save as image -->
<Button
variant="ghost"
size="icon"
class="h-7 w-7 shrink-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground"
title="导出图片"
:disabled="isExporting"
@click="saveAsImage"
>
<Button variant="ghost" size="icon" class="h-7 w-7 shrink-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground" title="导出图片" :disabled="isExporting" @click="saveAsImage">
<Camera v-if="!isExporting" class="h-3.5 w-3.5" />
<Loader2 v-else class="h-3.5 w-3.5 animate-spin" />
</Button>
<!-- Maximise -->
<Button
variant="ghost"
size="icon"
class="h-7 w-7 shrink-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground"
:title="isMaximized ? '还原' : '最大化'"
@click="toggleMaximize"
>
<Button variant="ghost" size="icon" class="h-7 w-7 shrink-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground" :title="isMaximized ? '还原' : '最大化'" @click="toggleMaximize">
<Maximize2 v-if="!isMaximized" class="h-3.5 w-3.5" />
<Minimize2 v-else class="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"
class="h-7 w-7 shrink-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground"
:title="t('dangerDialog.cancel')"
@click="close"
>
<Button variant="ghost" size="icon" class="h-7 w-7 shrink-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground" :title="t('dangerDialog.cancel')" @click="close">
<X class="h-3.5 w-3.5" />
</Button>
</div>
<!-- Map -->
<div ref="mapContainer" class="relative w-full flex-1" style="min-height: 200px" data-map-container>
<div
class="absolute inset-0 z-10 flex items-center justify-center text-xs text-muted-foreground pointer-events-none"
data-map-placeholder
>
Loading map…
</div>
<div class="absolute inset-0 z-10 flex items-center justify-center text-xs text-muted-foreground pointer-events-none" data-map-placeholder>Loading map…</div>
</div>
<div
v-if="mapError"
class="absolute inset-0 flex items-center justify-center bg-background/80 p-4 text-sm text-destructive"
>
<div v-if="mapError" class="absolute inset-0 flex items-center justify-center bg-background/80 p-4 text-sm text-destructive">
{{ mapError }}
</div>
<!-- Resize handles -->
<div
class="absolute bottom-0 right-0 z-50 h-5 w-5 cursor-se-resize"
@pointerdown.prevent="onResizePointerDown($event, 'se')"
@pointermove="onResizePointerMove"
@pointerup="onResizePointerUp"
@pointercancel="onResizePointerUp"
>
<div
class="absolute bottom-0.5 right-0.5 h-2.5 w-2.5"
style="border-right: 2px solid; border-bottom: 2px solid; opacity: 0.3"
/>
<div class="absolute bottom-0 right-0 z-50 h-5 w-5 cursor-se-resize" @pointerdown.prevent="onResizePointerDown($event, 'se')" @pointermove="onResizePointerMove" @pointerup="onResizePointerUp" @pointercancel="onResizePointerUp">
<div class="absolute bottom-0.5 right-0.5 h-2.5 w-2.5" style="border-right: 2px solid; border-bottom: 2px solid; opacity: 0.3" />
</div>
<div
class="absolute bottom-0 left-2 right-6 z-50 h-2 cursor-s-resize opacity-0 hover:opacity-25"
@pointerdown.prevent="onResizePointerDown($event, 's')"
@pointermove="onResizePointerMove"
@pointerup="onResizePointerUp"
@pointercancel="onResizePointerUp"
/>
<div
class="absolute right-0 top-2 bottom-6 z-50 w-2 cursor-e-resize opacity-0 hover:opacity-25"
@pointerdown.prevent="onResizePointerDown($event, 'e')"
@pointermove="onResizePointerMove"
@pointerup="onResizePointerUp"
@pointercancel="onResizePointerUp"
/>
<div class="absolute bottom-0 left-2 right-6 z-50 h-2 cursor-s-resize opacity-0 hover:opacity-25" @pointerdown.prevent="onResizePointerDown($event, 's')" @pointermove="onResizePointerMove" @pointerup="onResizePointerUp" @pointercancel="onResizePointerUp" />
<div class="absolute right-0 top-2 bottom-6 z-50 w-2 cursor-e-resize opacity-0 hover:opacity-25" @pointerdown.prevent="onResizePointerDown($event, 'e')" @pointermove="onResizePointerMove" @pointerup="onResizePointerUp" @pointercancel="onResizePointerUp" />
</DialogContent>
</Dialog>
</template>
@@ -37,10 +37,7 @@ const displayValue = computed(() => props.modelValue || "NULL");
const triggerClass = computed(() =>
props.variant === "inline"
? "cell-edit-input flex h-9 w-full items-center gap-2 rounded border bg-background px-2 text-left text-xs outline-none hover:border-primary/60 focus:border-primary"
: [
"cell-edit-input absolute inset-0 z-10 flex items-center gap-1 border-2 border-primary bg-background py-0 text-left text-xs outline-none",
props.cellLayout === "transpose" ? "px-1.5" : "px-2.5",
],
: ["cell-edit-input absolute inset-0 z-10 flex items-center gap-1 border-2 border-primary bg-background py-0 text-left text-xs outline-none", props.cellLayout === "transpose" ? "px-1.5" : "px-2.5"],
);
const dateParts = computed(() => {
const text = formatTemporalInputValue(props.modelValue, "date");
@@ -131,16 +128,8 @@ function setNull() {
function setNow() {
const now = new Date();
const dateText = [
String(now.getFullYear()).padStart(4, "0"),
String(now.getMonth() + 1).padStart(2, "0"),
String(now.getDate()).padStart(2, "0"),
].join("-");
const nextTime = [
String(now.getHours()).padStart(2, "0"),
String(now.getMinutes()).padStart(2, "0"),
String(now.getSeconds()).padStart(2, "0"),
].join(":");
const dateText = [String(now.getFullYear()).padStart(4, "0"), String(now.getMonth() + 1).padStart(2, "0"), String(now.getDate()).padStart(2, "0")].join("-");
const nextTime = [String(now.getHours()).padStart(2, "0"), String(now.getMinutes()).padStart(2, "0"), String(now.getSeconds()).padStart(2, "0")].join(":");
if (props.kind === "date") setModelValue(dateText);
else if (props.kind === "time") setModelValue(nextTime);
else setModelValue(`${dateText} ${nextTime}`);
@@ -186,9 +175,7 @@ function normalizeTimePart(value: string | number, max: number): string {
}
function setDateTimeValue(year: number, month: number, day: number, time: string) {
const dateText = [String(year).padStart(4, "0"), String(month).padStart(2, "0"), String(day).padStart(2, "0")].join(
"-",
);
const dateText = [String(year).padStart(4, "0"), String(month).padStart(2, "0"), String(day).padStart(2, "0")].join("-");
if (props.kind === "date") setModelValue(dateText);
else setModelValue(`${dateText} ${time}`);
}
@@ -210,82 +197,39 @@ function twoDigit(value: string | number): string {
<span class="min-w-0 flex-1 truncate">{{ displayValue }}</span>
</button>
</PopoverTrigger>
<PopoverContent
align="start"
side="bottom"
class="w-auto gap-1.5 rounded-md p-1.5"
@click.stop
@keydown.stop="onKeydown"
@interact-outside="onPopoverInteractOutside"
>
<PopoverContent align="start" side="bottom" class="w-auto gap-1.5 rounded-md p-1.5" @click.stop @keydown.stop="onKeydown" @interact-outside="onPopoverInteractOutside">
<div v-if="hasDate" class="grid grid-cols-[4.5rem_4.5rem_4.5rem] gap-1.5">
<div
class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background"
>
<input
:value="dateParts.year"
data-temporal-part="year"
inputmode="numeric"
class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none"
@change="updateDateFromInput('year', $event)"
/>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
<input :value="dateParts.year" data-temporal-part="year" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateDateFromInput('year', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepDate('year', 1)">
<ChevronUp class="h-3 w-3" />
</button>
<button
type="button"
class="flex items-center justify-center border-t hover:bg-muted"
@click="stepDate('year', -1)"
>
<button type="button" class="flex items-center justify-center border-t hover:bg-muted" @click="stepDate('year', -1)">
<ChevronDown class="h-3 w-3" />
</button>
</div>
</div>
<div
class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background"
>
<input
:value="twoDigit(dateParts.month)"
data-temporal-part="month"
inputmode="numeric"
class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none"
@change="updateDateFromInput('month', $event)"
/>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
<input :value="twoDigit(dateParts.month)" data-temporal-part="month" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateDateFromInput('month', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepDate('month', 1)">
<ChevronUp class="h-3 w-3" />
</button>
<button
type="button"
class="flex items-center justify-center border-t hover:bg-muted"
@click="stepDate('month', -1)"
>
<button type="button" class="flex items-center justify-center border-t hover:bg-muted" @click="stepDate('month', -1)">
<ChevronDown class="h-3 w-3" />
</button>
</div>
</div>
<div
class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background"
>
<input
:value="twoDigit(dateParts.day)"
data-temporal-part="day"
inputmode="numeric"
class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none"
@change="updateDateFromInput('day', $event)"
/>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
<input :value="twoDigit(dateParts.day)" data-temporal-part="day" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateDateFromInput('day', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepDate('day', 1)">
<ChevronUp class="h-3 w-3" />
</button>
<button
type="button"
class="flex items-center justify-center border-t hover:bg-muted"
@click="stepDate('day', -1)"
>
<button type="button" class="flex items-center justify-center border-t hover:bg-muted" @click="stepDate('day', -1)">
<ChevronDown class="h-3 w-3" />
</button>
</div>
@@ -293,81 +237,37 @@ function twoDigit(value: string | number): string {
</div>
<div v-if="hasTime" class="grid grid-cols-[3.5rem_0.5rem_3.5rem_0.5rem_3.5rem] items-center gap-1.5">
<div
class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background"
>
<input
:value="twoDigit(timeParts.hour)"
data-temporal-part="hour"
inputmode="numeric"
class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none"
@change="updateTimeFromInput('hour', $event)"
/>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
<input :value="twoDigit(timeParts.hour)" data-temporal-part="hour" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateTimeFromInput('hour', $event)" />
<div class="grid border-l">
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepTime('hour', 1)">
<ChevronUp class="h-3 w-3" />
</button>
<button
type="button"
class="flex items-center justify-center border-t hover:bg-muted"
@click="stepTime('hour', -1)"
>
<button type="button" class="flex items-center justify-center border-t hover:bg-muted" @click="stepTime('hour', -1)">
<ChevronDown class="h-3 w-3" />
</button>
</div>
</div>
<span class="text-center text-xs text-muted-foreground">:</span>
<div
class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background"
>
<input
:value="twoDigit(timeParts.minute)"
data-temporal-part="minute"
inputmode="numeric"
class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none"
@change="updateTimeFromInput('minute', $event)"
/>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
<input :value="twoDigit(timeParts.minute)" data-temporal-part="minute" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateTimeFromInput('minute', $event)" />
<div class="grid border-l">
<button
type="button"
class="flex items-center justify-center hover:bg-muted"
@click="stepTime('minute', 1)"
>
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepTime('minute', 1)">
<ChevronUp class="h-3 w-3" />
</button>
<button
type="button"
class="flex items-center justify-center border-t hover:bg-muted"
@click="stepTime('minute', -1)"
>
<button type="button" class="flex items-center justify-center border-t hover:bg-muted" @click="stepTime('minute', -1)">
<ChevronDown class="h-3 w-3" />
</button>
</div>
</div>
<span class="text-center text-xs text-muted-foreground">:</span>
<div
class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background"
>
<input
:value="twoDigit(timeParts.second)"
data-temporal-part="second"
inputmode="numeric"
class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none"
@change="updateTimeFromInput('second', $event)"
/>
<div class="grid h-7 min-w-0 grid-cols-[1fr_1.35rem] overflow-hidden rounded-md border border-input bg-background">
<input :value="twoDigit(timeParts.second)" data-temporal-part="second" inputmode="numeric" class="min-w-0 bg-transparent px-1 text-center text-[13px] tabular-nums outline-none" @change="updateTimeFromInput('second', $event)" />
<div class="grid border-l">
<button
type="button"
class="flex items-center justify-center hover:bg-muted"
@click="stepTime('second', 1)"
>
<button type="button" class="flex items-center justify-center hover:bg-muted" @click="stepTime('second', 1)">
<ChevronUp class="h-3 w-3" />
</button>
<button
type="button"
class="flex items-center justify-center border-t hover:bg-muted"
@click="stepTime('second', -1)"
>
<button type="button" class="flex items-center justify-center border-t hover:bg-muted" @click="stepTime('second', -1)">
<ChevronDown class="h-3 w-3" />
</button>
</div>