主要改动: - 重构目录结构:合并子目录到根目录,简化项目结构 - 添加完整的查询 API:支持复杂条件查询、字段选择、游标模式 - 实现 LSM-Tree Compaction:7层结构、Score-based策略、后台异步合并 - 添加 Web UI:基于 Lit 的现代化管理界面,支持数据浏览和 Manifest 查看 - 完善文档:添加 README.md 和 examples/webui/README.md 新增功能: - Query Builder:链式查询 API,支持 Eq/Lt/Gt/In/Between/Contains 等操作符 - Web UI 组件:srdb-app、srdb-table-list、srdb-data-view、srdb-manifest-view 等 - 列选择持久化:自动保存到 localStorage - 刷新按钮:一键刷新当前视图 - 主题切换:深色/浅色主题支持 代码优化: - 使用 Go 1.24 新特性:range 7、min()、maps.Copy()、slices.Sort() - 统一组件命名:所有 Web Components 使用 srdb-* 前缀 - CSS 优化:提取共享样式,减少重复代码 - 清理遗留代码:删除未使用的方法和样式
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
import { LitElement, html, css, svg } from 'https://cdn.jsdelivr.net/gh/lit/dist@3/core/lit-core.min.js';
|
|
|
|
export class FieldIcon extends LitElement {
|
|
static properties = {
|
|
indexed: { type: Boolean }
|
|
};
|
|
|
|
static styles = css`
|
|
:host {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 20px;
|
|
height: 20px;
|
|
}
|
|
|
|
svg {
|
|
width: 16px;
|
|
height: 16px;
|
|
}
|
|
|
|
.indexed {
|
|
fill: var(--success);
|
|
color: var(--success);
|
|
opacity: 1;
|
|
}
|
|
|
|
.not-indexed {
|
|
fill: var(--text-secondary);
|
|
color: var(--text-secondary);
|
|
opacity: 0.6;
|
|
}
|
|
`;
|
|
|
|
constructor() {
|
|
super();
|
|
this.indexed = false;
|
|
}
|
|
|
|
render() {
|
|
if (this.indexed) {
|
|
// 闪电图标 - 已索引(快速)
|
|
return html`
|
|
<svg viewBox="0 0 24 24" class="indexed" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" fill="currentColor" stroke="none"/>
|
|
</svg>
|
|
`;
|
|
} else {
|
|
// 圆点图标 - 未索引
|
|
return html`
|
|
<svg viewBox="0 0 24 24" class="not-indexed" xmlns="http://www.w3.org/2000/svg">
|
|
<circle cx="12" cy="12" r="4" fill="currentColor"/>
|
|
</svg>
|
|
`;
|
|
}
|
|
}
|
|
}
|
|
|
|
customElements.define('srdb-field-icon', FieldIcon);
|