fix(ui): 收敛激活态描边、修正内层圆角溢出并替换 emoji 图标

This commit is contained in:
HIsheR
2026-10-26 18:47:04 +08:00
parent 6c4796cded
commit 106bbcaa56
8 changed files with 147 additions and 27 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import {
sortPlugin,
} from '@ui-arch/table-core';
import type { RowKey } from '@ui-arch/table-core';
import { computed, effect, h, renderList, signal } from '@ui-arch/frame';
import { iconSearch } from './icons.js'; import { computed, effect, h, renderList, signal } from '@ui-arch/frame';
import { attachResize } from './columnResize.js';
import { exportButton } from './csv.js';
import { button } from './button.js';
@@ -168,7 +168,7 @@ export function dataTable<T extends { id: RowKey }>(props: DataTableProps<T>): H
const filterInput = textField({
placeholder: `筛选 ${filterKey}…`,
prefix: '🔍',
prefix: iconSearch(),
value: keyword, // 受控信号:空状态里的「清除筛选」能同时清掉输入框内容
disabled: props.loading, // 加载中禁止筛选,避免与在途结果竞争
onInput: (value) => {
+30
View File
@@ -0,0 +1,30 @@
/*** 内联图标工厂:组件内部用小图标一律走 SVG,不用 emoji —— emoji 在 Windows / macOS 会渲染成彩色位图,尺寸、颜色、基线都不可控 ***/
const NS = 'http://www.w3.org/2000/svg'; // SVG 命名空间常量,createElementNS 必填
/*** 放大镜图标:搜索框的默认前缀。外层 span 承载布局,返回 HTMLElement 以兼容 prefix 入参类型 ***/
export function iconSearch(): HTMLElement {
const holder = document.createElement('span');
holder.style.display = 'inline-flex'; // 让图标与输入文本在同一基线居中
holder.setAttribute('aria-hidden', 'true'); // 纯装饰:语义由输入框 placeholder / label 承担
const svg = document.createElementNS(NS, 'svg');
svg.setAttribute('viewBox', '0 0 16 16');
svg.setAttribute('width', '14');
svg.setAttribute('height', '14');
svg.setAttribute('fill', 'none');
svg.setAttribute('stroke', 'currentColor'); // 跟随主题文字色,暗色自动翻转
svg.setAttribute('stroke-width', '1.5');
svg.setAttribute('stroke-linecap', 'round');
const lens = document.createElementNS(NS, 'circle');
lens.setAttribute('cx', '7');
lens.setAttribute('cy', '7');
lens.setAttribute('r', '4.5');
const handle = document.createElementNS(NS, 'line');
handle.setAttribute('x1', '10.5');
handle.setAttribute('y1', '10.5');
handle.setAttribute('x2', '14');
handle.setAttribute('y2', '14');
svg.append(lens, handle);
holder.append(svg);
return holder;
}