chore(fms-vue): WIP 基线快照——收编工作区未提交的前端改动
不含 fms-api Java 侧改动与后续导航状态化阶段提交。主要内容: - ui 组件库:date/dropdown/form/input/popover/select/tooltip 调整, 新增 Segmented 组件;fms-table 可编辑单元格渲染器与 FileCard 更新 - 模块管理:列表配置加载自动补全、查询缺配徽标与一键补充、 结构编辑内核 useStructureEditing/useBandLayout、子表表格编辑方式、 分组标题多语言、I18nKeyCell 等(含配套 spec) - 布局/主题/仪表盘/演示页小幅更新
This commit is contained in:
1 parent
a1079a7150
commit
05d0c7f304
58 files changed
+3698
-1343
No files matched your search
@@ -45,6 +45,9 @@ const triggerInputRef = ref(null)
|
||||
const triggerFocused = ref(false)
|
||||
const editing = ref(false)
|
||||
const selectedCache = ref(null)
|
||||
// 选中/清除后焦点会随下拉内容卸载丢到 body,主动交还输入框时会触发 focus 事件,
|
||||
// 但此时不应重新展开(「聚焦即展开」仅面向用户主动聚焦),用标记抑制这一次。
|
||||
const suppressNextAutoOpen = ref(false)
|
||||
|
||||
const selectId = useId()
|
||||
const listboxId = `${selectId}-listbox`
|
||||
@@ -210,9 +213,23 @@ function openDropdown() {
|
||||
if (!open.value) open.value = true
|
||||
}
|
||||
|
||||
// 程序化归还焦点(选中/清除/取消后):抑制本次聚焦触发的自动展开。
|
||||
// focus() 在已聚焦时不派发事件,标记可能残留,nextTick 兜底复位避免误吞下一次真实聚焦。
|
||||
function refocusTrigger() {
|
||||
suppressNextAutoOpen.value = true
|
||||
triggerInputRef.value?.focus({ preventScroll: true })
|
||||
nextTick(() => {
|
||||
suppressNextAutoOpen.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 聚焦(Tab / 点击空白处后聚焦)即展开;已聚焦时再点击浏览器不会重发 focus 事件,
|
||||
// 故点击也要兜底展开,让用户再次点击触发器即可重新打开下拉
|
||||
function onTriggerFocus() {
|
||||
if (suppressNextAutoOpen.value) {
|
||||
suppressNextAutoOpen.value = false
|
||||
return
|
||||
}
|
||||
openDropdown()
|
||||
}
|
||||
|
||||
@@ -297,6 +314,8 @@ function selectOption(option) {
|
||||
emit('update:modelValue', option.value)
|
||||
emit('change', option.value, option)
|
||||
open.value = false
|
||||
// 非 filterable 模式焦点在下拉容器上,随浮层卸载会丢失;交还输入框保持键盘流
|
||||
refocusTrigger()
|
||||
}
|
||||
|
||||
// 供默认插槽使用:按原始值选中并关闭(插槽自定义选项无规范化 option)
|
||||
@@ -306,6 +325,7 @@ function selectValue(value) {
|
||||
emit('update:modelValue', value)
|
||||
emit('change', value, undefined)
|
||||
open.value = false
|
||||
refocusTrigger()
|
||||
}
|
||||
|
||||
function closeDropdown() {
|
||||
@@ -318,7 +338,7 @@ function clearValue() {
|
||||
activeIndex.value = -1
|
||||
selectedCache.value = null
|
||||
// 键盘触发清除时按钮会被卸载,先把焦点交还输入框,避免焦点丢失后浮层残留。
|
||||
triggerInputRef.value?.focus({ preventScroll: true })
|
||||
refocusTrigger()
|
||||
emit('update:modelValue', undefined)
|
||||
emit('change', undefined, undefined)
|
||||
}
|
||||
@@ -353,6 +373,8 @@ function cancelEditing() {
|
||||
editing.value = false
|
||||
filterQuery.value = ''
|
||||
open.value = false
|
||||
// Esc 取消:焦点在下拉容器上会随卸载丢失,交还输入框保持键盘流
|
||||
refocusTrigger()
|
||||
}
|
||||
|
||||
function onTriggerKeydown(event) {
|
||||
@@ -417,6 +439,7 @@ function onTriggerKeydown(event) {
|
||||
:offset="4"
|
||||
:disabled="disabled"
|
||||
:follow-trigger-width="true"
|
||||
unwrapped
|
||||
@update:open="onOpenChange"
|
||||
>
|
||||
<!-- 触发器:类 Input 的框体,直接在此输入框键入即可筛选;含清除按钮与折叠箭头 -->
|
||||
|
||||
Reference in new issue
Block a user