fix: errors

This commit is contained in:
2025-08-06 14:59:39 +08:00
parent c4ad0c1dc9
commit aa20b6d7e6
10 changed files with 188 additions and 23 deletions

View File

@@ -384,6 +384,12 @@ input[type="search"]::-webkit-search-results-decoration {
justify-content: center;
z-index: 1000;
padding: 16px;
animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.modal.hidden {
@@ -398,6 +404,18 @@ input[type="search"]::-webkit-search-results-decoration {
width: 100%;
max-height: 80vh;
overflow-y: auto;
animation: slideUp 0.2s ease;
}
@keyframes slideUp {
from {
transform: translateY(20px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.modal-header {
@@ -423,6 +441,9 @@ input[type="search"]::-webkit-search-results-decoration {
cursor: pointer;
border-radius: var(--radius-sm);
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
}
.modal-close:hover {
@@ -430,10 +451,54 @@ input[type="search"]::-webkit-search-results-decoration {
color: var(--text-primary);
}
.modal-close svg {
width: 24px;
height: 24px;
stroke: currentColor;
stroke-width: 2;
}
.modal-body {
padding: 24px;
}
/* 详情内容样式 */
.detail-content {
display: flex;
flex-direction: column;
gap: 16px;
}
.detail-item {
display: flex;
flex-direction: column;
gap: 4px;
padding: 12px;
background: var(--bg-secondary);
border-radius: var(--radius-md);
border: 1px solid var(--border-light);
}
.detail-label {
font-weight: 600;
font-size: 14px;
color: var(--text-secondary);
text-transform: capitalize;
}
.detail-value {
font-size: 16px;
color: var(--text-primary);
line-height: 1.5;
word-break: break-word;
}
.detail-value:empty::before {
content: '- -';
color: var(--text-muted);
font-style: italic;
}
/* 通知样式 */
.notification {
position: fixed;

View File

@@ -205,23 +205,34 @@
flex: 1;
min-width: 0;
overflow: hidden;
display: flex;
flex-direction: column;
gap: 1px;
}
.nav-title {
display: block;
font-size: 14px;
line-height: 1.3;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--text-primary);
}
.nav-subtitle {
font-size: 11px;
color: var(--text-muted);
font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
opacity: 0.8;
}
.nav-description {
display: block;
font-size: 12px;
color: var(--text-muted);
margin-top: 1px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

View File

@@ -216,9 +216,12 @@ class AppState {
navLinks.forEach(link => {
const title = link.querySelector('.nav-title').textContent.toLowerCase();
const subtitle = link.querySelector('.nav-subtitle').textContent.toLowerCase();
const description = link.querySelector('.nav-description').textContent.toLowerCase();
const matches = title.includes(searchTerm) || description.includes(searchTerm);
const matches = title.includes(searchTerm) ||
subtitle.includes(searchTerm) ||
description.includes(searchTerm);
link.style.display = matches ? 'flex' : 'none';
link.parentElement.style.display = matches ? 'block' : 'none';
@@ -517,7 +520,7 @@ class AppState {
for (const [key, value] of Object.entries(data.data || {})) {
html += `
<div class="detail-item">
<label class="detail-label">${key}</label>
<div class="detail-label">${key}</div>
<div class="detail-value">${value || ''}</div>
</div>
`;
@@ -609,6 +612,7 @@ class AppState {
// 全局函数
window.toggleSidebar = () => app.toggleSidebar();
window.closeSidebar = () => app.closeSidebar();
window.toggleTheme = () => app.toggleTheme();
window.debounceSearch = (query) => app.handleSearchInput(query);
window.performSearch = () => {
const searchInput = document.getElementById('searchInput');

View File

@@ -63,7 +63,7 @@
class="nav-link {{if eq .Name $.Table}}active{{end}}"
role="menuitem"
aria-current="{{if eq .Name $.Table}}page{{end}}"
title="{{.Alias}} - {{.Description}}">
title="{{.Alias}} ({{.Name}}) - {{.Description}}">
<div class="nav-link-content">
<svg class="nav-icon" width="18" height="18" fill="none" viewBox="0 0 24 24">
<path d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2z" stroke="currentColor" stroke-width="2"/>
@@ -71,6 +71,7 @@
</svg>
<div class="nav-text-content">
<span class="nav-title">{{.Alias}}</span>
<span class="nav-subtitle">{{.Name}}</span>
<span class="nav-description">{{.RowCount}} 条记录</span>
</div>
{{if eq .Name $.Table}}
@@ -357,12 +358,14 @@
{{$start = max 1 (sub .Pages 4)}}
{{end}}
{{range $i := $start | $end}}
{{if eq $i .Page}}
<span class="pagination-button active">{{$i}}</span>
{{else}}
<a href="?table={{.Table}}&page={{$i}}&per_page={{.PerPage}}&search={{.Search}}&sort={{.SortField}}&order={{.SortOrder}}"
class="pagination-button">{{$i}}</a>
{{range $i := until $end}}
{{if ge $i $start}}
{{if eq $i $.Page}}
<span class="pagination-button active">{{$i}}</span>
{{else}}
<a href="?table={{$.Table}}&page={{$i}}&per_page={{$.PerPage}}&search={{$.Search}}&sort={{$.SortField}}&order={{$.SortOrder}}"
class="pagination-button">{{$i}}</a>
{{end}}
{{end}}
{{end}}
@@ -379,18 +382,18 @@
</div>
<!-- Detail Modal -->
<div id="detailModal" class="modal">
<div id="detailModal" class="modal hidden">
<div class="modal-content">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium">详情信息</h3>
<button onclick="closeModal()" class="text-gray-400 hover:text-gray-600">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div id="detailContent" class="space-y-4">
<div class="modal-header">
<h3 class="modal-title">详情信息</h3>
<button onclick="closeModal()" class="modal-close" aria-label="关闭">
<svg width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<div class="modal-body">
<div id="detailContent" class="detail-content">
<!-- Content will be loaded here -->
</div>
</div>