From e867554ceff5772018b7a8eeb60fe234dfd5c1d8 Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Tue, 14 Oct 2025 15:38:08 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DTree=E7=9A=84?= =?UTF-8?q?=E5=88=97=E6=93=8D=E4=BD=9C=E6=97=A0=E6=B3=95=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=80=9A=E8=AE=AF=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tree-grid-component-config-resolver.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/renderer/src/component-config-resolver/tree-grid-component-config-resolver.ts b/packages/renderer/src/component-config-resolver/tree-grid-component-config-resolver.ts index 44e7798e2c..c758e964a0 100644 --- a/packages/renderer/src/component-config-resolver/tree-grid-component-config-resolver.ts +++ b/packages/renderer/src/component-config-resolver/tree-grid-component-config-resolver.ts @@ -76,15 +76,15 @@ export class TreeGridComponentConfigResolver extends ComponentConfigResolver { } // 编辑按钮 - commandSchema.onClickEditCommand = this.buildColumnCommandHandler('onClickEditCommand', commandSchema, schema, viewModel); - commandSchema.onClickDeleteCommand = this.buildColumnCommandHandler('onClickDeleteCommand', commandSchema, schema, viewModel); + commandSchema.onClickEditCommand = this.buildColumnCommandHandler('clickEditCommand', commandSchema, schema, viewModel); + commandSchema.onClickDeleteCommand = this.buildColumnCommandHandler('clickDeleteCommand', commandSchema, schema, viewModel); } /** * 构造列操作的处理函数 */ private buildColumnCommandHandler(eventType: string, commandSchema: any, viewSchema: any, viewModel: any) { - const eventBinding = commandSchema[eventType]; + const eventBinding = this.getColumnCommandBinding(eventType, commandSchema); const module = viewModel.getModule(); const { handleEvent } = useEvent(module); @@ -110,4 +110,12 @@ export class TreeGridComponentConfigResolver extends ComponentConfigResolver { } return relatedComponent.id; } + + /** + * 获取事件绑定 + */ + private getColumnCommandBinding(eventType: string, commandSchema: any) { + const eventPropName = `on${eventType.charAt(0).toUpperCase()}${eventType.slice(1)}`; + return commandSchema[eventPropName]; + } } -- Gitee From e4d725dad949028aa5bdde6f3716a47676eda03a Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Wed, 15 Oct 2025 09:22:35 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E8=BF=87=E7=A8=8B=E4=B8=AD=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5=E6=97=B6=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BA=86undefined=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E5=91=BD=E4=BB=A4=E4=B8=B2=E8=81=94=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=BB=88=E6=AD=A2=E5=90=8E=E7=BB=AD=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/devkit/lib/command/taskflow/task-flow.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/devkit/lib/command/taskflow/task-flow.ts b/packages/devkit/lib/command/taskflow/task-flow.ts index b7eaf73712..c19e7a1e17 100644 --- a/packages/devkit/lib/command/taskflow/task-flow.ts +++ b/packages/devkit/lib/command/taskflow/task-flow.ts @@ -31,6 +31,7 @@ class TaskFlow { public async execute() { let currentTask: TaskNode | null = this.getFistTask(); let rejectedOrHasException = false; + let firstError: any = null; let lastResult: any = undefined; while (currentTask && !rejectedOrHasException) { try { @@ -39,13 +40,11 @@ class TaskFlow { this.context.setTaskResult(currentTask.name, currentTaskResult); currentTask = this.getNextTask(currentTask); } catch (error: any) { - if (error) { - console.error(error); - } rejectedOrHasException = true; + firstError = error; } } - return !rejectedOrHasException ? lastResult : undefined; + return !rejectedOrHasException ? lastResult : Promise.reject(firstError); } /** -- Gitee From 99e558b53b62973143fe6c9244535ded1600622d Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Mon, 20 Oct 2025 16:32:50 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96Render=E5=AF=B9?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E8=A1=8C=E5=92=8C=E5=BD=93=E5=89=8D=E8=A1=8C?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ata-grid-selection-change-event-handler.ts | 86 ++++++++----------- ...ta-grid-selection-update-event-handler.ts} | 73 ++++++++++------ packages/renderer/src/event-handler/index.ts | 2 +- .../renderer/src/event-handler/providers.ts | 4 +- 4 files changed, 86 insertions(+), 79 deletions(-) rename packages/renderer/src/event-handler/{data-view-row-click-event-handler.ts => data-grid-selection-update-event-handler.ts} (38%) diff --git a/packages/renderer/src/event-handler/data-grid-selection-change-event-handler.ts b/packages/renderer/src/event-handler/data-grid-selection-change-event-handler.ts index a07cd452ef..68ea969f93 100644 --- a/packages/renderer/src/event-handler/data-grid-selection-change-event-handler.ts +++ b/packages/renderer/src/event-handler/data-grid-selection-change-event-handler.ts @@ -1,92 +1,76 @@ -import { Injector, Module } from "@farris/devkit-vue"; +import { Injector, Module, ViewModel, ViewModelState } from "@farris/devkit-vue"; import { EventEmitter } from "../common"; import { FormMetadataService } from "../service"; import { ViewEvent } from "../types"; /** - * 勾选事件处理器 + * 表格(或树表格)当前行切换事件处理器 */ export class DataGridSelectionChangeEventHandler { - constructor(private emitter: EventEmitter, private formMetadataService: FormMetadataService, private module: Module, private injector: Injector) { + /** + * 构造函数 + */ + constructor(private emitter: EventEmitter, private formMetadataService: FormMetadataService, private module: Module) { } + /** + * 绑定事件 + */ bind(): void { this.emitter.on('selectionChange', (payload: ViewEvent) => this.onSelectionChange(payload)); } + /** + * 注销事件绑定 + */ dispose(): void { this.emitter.on('selectionChange', (payload: ViewEvent) => this.onSelectionChange(payload)); } + /** + * 处理当前行切换 + */ private onSelectionChange(payload: ViewEvent) { if (!payload) { return; } const event: ViewEvent = payload; - const { token, type } = event; + const { token, type, payloads } = event; if ((type !== 'data-grid' && type !== 'tree-grid' && type !=='list-view') || !token) { return; } - const component = this.formMetadataService.getMetadataById(token); + + const viewModel = this.getViewModel(token); + if (!viewModel) { + throw new Error('Can not find the related ViewModel'); + } + + const currentItem = payloads[1]; + viewModel.entityStore?.changeCurrentEntityByPath(viewModel.bindingPath, currentItem.id); + } + + /** + * 获取视图模型ID + */ + private getViewModel(gridToken: string): ViewModel | null { + const component = this.formMetadataService.getMetadataById(gridToken); if (!component) { - return; + return null; } const { id } = component; if (!id) { - return; + return null; } const relatedComponent = this.formMetadataService.getRelatedComponent(id); if (!relatedComponent) { - return; + return null; } const viewModel = this.module.getViewModel(relatedComponent.id); if (!viewModel) { - return; - } - const { payloads } = event; - const items = payloads[0]; - const ids = items.map((item: any) => item.id); - viewModel.uiStore?.setValue('ids', ids); - - // 单选和多选不启用复选框这2个场景 会切换当前行 - const { schema } = payload as any; - const needChangeCurrentRow = this.needChangeCurrentRow(schema); - if (needChangeCurrentRow) { - const currentRowId = this.getCurrentRowId(ids); - if (currentRowId) { - viewModel.entityStore?.changeCurrentEntityByPath(viewModel.bindingPath, currentRowId); - } - } - } - - /** - * 是否需要切换当前行 - */ - private needChangeCurrentRow(gridSchema: any) { - const { selection } = gridSchema; - - // 单选模式:需要切换 - if (!selection || !selection.multiSelect) { - return true; - } - - // 多选模式:禁用复选框的场景,需要切换(暂不处理) - // if (selection.multiSelect && !selection.showCheckbox) { - // return true; - // } - - return false; - } - - /** - * 获取最后1条作为选中行 - */ - private getCurrentRowId(ids: string[]) { - if (!Array.isArray(ids) || ids.length === 0) { return null; } - return ids[ids.length - 1]; + return viewModel; } } diff --git a/packages/renderer/src/event-handler/data-view-row-click-event-handler.ts b/packages/renderer/src/event-handler/data-grid-selection-update-event-handler.ts similarity index 38% rename from packages/renderer/src/event-handler/data-view-row-click-event-handler.ts rename to packages/renderer/src/event-handler/data-grid-selection-update-event-handler.ts index 930b438c25..6deba4308e 100644 --- a/packages/renderer/src/event-handler/data-view-row-click-event-handler.ts +++ b/packages/renderer/src/event-handler/data-grid-selection-update-event-handler.ts @@ -1,53 +1,76 @@ - - -import { Injector, Module } from "@farris/devkit-vue"; +import { Injector, Module, ViewModel, ViewModelState } from "@farris/devkit-vue"; import { EventEmitter } from "../common"; import { FormMetadataService } from "../service"; import { ViewEvent } from "../types"; -import { EventHandler } from "./types"; -export class DataViewRowClickEventHandler implements EventHandler { +/** + * 表格(或树表格)选中行更新事件 + */ +export class DataGridSelectionUpdateEventHandler { + + /** + * 构造函数 + */ + constructor(private emitter: EventEmitter, private formMetadataService: FormMetadataService, private module: Module) { + } + + /** + * 绑定事件 + */ + public bind(): void { + this.emitter.on('selectionUpdate', (payload: ViewEvent) => this.onSelectionUpdate(payload)); + } - constructor(private emitter: EventEmitter, private formMetadataService: FormMetadataService, private module: Module, private injector: Injector) { + /** + * 取消事件绑定 + */ + public dispose(): void { + this.emitter.on('selectionUpdate', (payload: ViewEvent) => this.onSelectionUpdate(payload)); } - public onClickRow(payload: ViewEvent) { + /** + * 处理选中行更新事件 + */ + private onSelectionUpdate(payload: ViewEvent) { if (!payload) { return; } const event: ViewEvent = payload; - const { token, type } = event; + const { token, type, payloads } = event; if ((type !== 'data-grid' && type !== 'tree-grid') || !token) { return; } - const component = this.formMetadataService.getMetadataById(token); + + const viewModel = this.getViewModel(token); + if (!viewModel) { + throw new Error('Can not find the related ViewModel'); + } + + const selectedIds = [].concat(payloads[1]); + viewModel.uiStore?.setValue('ids', selectedIds); + } + + /** + * 获取视图模型ID + */ + private getViewModel(gridToken: string): ViewModel | null { + const component = this.formMetadataService.getMetadataById(gridToken); if (!component) { - return; + return null; } const { id } = component; if (!id) { - return; + return null; } const relatedComponent = this.formMetadataService.getRelatedComponent(id); if (!relatedComponent) { - return; + return null; } const viewModel = this.module.getViewModel(relatedComponent.id); if (!viewModel) { - return; + return null; } - // 行切换 - const { payloads } = event; - const item = payloads[1]; - const { id: dataId } = item; - viewModel.entityStore?.changeCurrentEntityByPath(viewModel.bindingPath, dataId); - } - - public bind() { - this.emitter.on('clickRow', (payload: ViewEvent) => this.onClickRow(payload)); - } - public dispose() { - this.emitter.off('clickRow', (payload: ViewEvent) => this.onClickRow(payload)); + return viewModel; } } diff --git a/packages/renderer/src/event-handler/index.ts b/packages/renderer/src/event-handler/index.ts index 2f29e09946..45cf276927 100644 --- a/packages/renderer/src/event-handler/index.ts +++ b/packages/renderer/src/event-handler/index.ts @@ -1,12 +1,12 @@ export * from './types'; export * from './lookup-data-mapping-event-handler'; export * from './model-value-update-event-handler'; -export * from './data-view-row-click-event-handler'; export * from './lookup-clear-event-handler'; export * from './end-edit-cell-event-handler'; export * from './data-grid-page-index-change-event-handler'; export * from './data-grid-page-size-change-event-handler'; export * from './data-grid-selection-change-event-handler'; +export * from './data-grid-selection-update-event-handler'; export * from './query-solution-condition-change-event-handler'; export * from './data-grid-double-click-row-event-handler'; export * from './list-view-click-item-event-handler'; diff --git a/packages/renderer/src/event-handler/providers.ts b/packages/renderer/src/event-handler/providers.ts index 54cac2ecb2..6f7616f076 100644 --- a/packages/renderer/src/event-handler/providers.ts +++ b/packages/renderer/src/event-handler/providers.ts @@ -5,11 +5,11 @@ import { EVENT_HANDLERS_TOKEN } from "../tokens"; import { LookupDataMappingEventHandler } from "./lookup-data-mapping-event-handler"; import { ModelValueUpdateEventHandler } from "./model-value-update-event-handler"; import { EndEditCellEventHandler } from "./end-edit-cell-event-handler"; -import { DataViewRowClickEventHandler } from "./data-view-row-click-event-handler"; import { LookupClearEventHandler } from "./lookup-clear-event-handler"; import { DataGridPageIndexChangeEventHandler } from "./data-grid-page-index-change-event-handler"; import { DataGridPageSizeChangeEventHandler } from "./data-grid-page-size-change-event-handler"; import { DataGridSelectionChangeEventHandler } from "./data-grid-selection-change-event-handler"; +import { DataGridSelectionUpdateEventHandler } from "./data-grid-selection-update-event-handler"; import { QuerySolutionConditionChangeEventHandler } from "./query-solution-condition-change-event-handler"; import { DataGridDoubleClickRowEventHandler } from './data-grid-double-click-row-event-handler'; import { ModalClosedEventHandler } from './modal-closed-event-handler'; @@ -19,11 +19,11 @@ export const eventHanderProviders: StaticProvider[] = [ { provide: EVENT_HANDLERS_TOKEN, useClass: LookupDataMappingEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: ModelValueUpdateEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: EndEditCellEventHandler, deps: [EventEmitter, FormMetadataService, Module, ComponentService, Injector], multi: true }, - { provide: EVENT_HANDLERS_TOKEN, useClass: DataViewRowClickEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: LookupClearEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: DataGridPageIndexChangeEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: DataGridPageSizeChangeEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: DataGridSelectionChangeEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, + { provide: EVENT_HANDLERS_TOKEN, useClass: DataGridSelectionUpdateEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: QuerySolutionConditionChangeEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: DataGridDoubleClickRowEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, { provide: EVENT_HANDLERS_TOKEN, useClass: ModalClosedEventHandler, deps: [EventEmitter, FormMetadataService, Module, Injector], multi: true }, -- Gitee From 44b40a7f9196599359731115d2158a31d6618753 Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Tue, 21 Oct 2025 16:42:54 +0800 Subject: [PATCH 4/9] =?UTF-8?q?fix:=201=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=85=B3=E9=97=AD=E5=89=8D=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=EF=BC=9B2=E3=80=81=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9A=84=E5=B8=AE=E5=8A=A9=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=90=8E=E7=95=8C=E9=9D=A2=E4=B8=8D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../composition/use-external-component.ts | 6 +++--- .../components/modal/src/property-config/modal-events.ts | 2 +- .../ui-vue/components/modal/src/schema/modal.schema.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/designer/src/components/components/form-designer/components/external-component-panel/composition/use-external-component.ts b/packages/designer/src/components/components/form-designer/components/external-component-panel/composition/use-external-component.ts index 2192cc4658..84b38b4116 100644 --- a/packages/designer/src/components/components/form-designer/components/external-component-panel/composition/use-external-component.ts +++ b/packages/designer/src/components/components/form-designer/components/external-component-panel/composition/use-external-component.ts @@ -1,4 +1,4 @@ -import { inject, Ref, ref, SetupContext, computed } from "vue"; +import { inject, Ref, ref, SetupContext, computed, reactive } from "vue"; import { ExternalComponentSchema, ExternalComponentType, UseExternalComponent } from "./types"; import { SchemaItem, FNotifyService, getSchemaByType, lookupDataSourceConverter } from "@farris/ui-vue/components"; import { UseFormSchema } from "../../../../../../components/types"; @@ -133,12 +133,12 @@ export default function (context: SetupContext): UseExternalComponent { if (externalComponentType === 'Lookup') { getLookupPropertyValue(component).then(propertyValue => { - const helpPropertyValue = { id: propertyValueId, ...propertyValue.editor }; + const helpPropertyValue = reactive({ id: propertyValueId, ...propertyValue.editor }); externalComponents.value.push(helpPropertyValue); selectExternalComponent(helpPropertyValue); }); } else { - const propertyValue = { id: propertyValueId, ...getModalPropertyValue(component) }; + const propertyValue = reactive({ id: propertyValueId, ...getModalPropertyValue(component) }); externalComponents.value.push(propertyValue); selectExternalComponent(propertyValue); } diff --git a/packages/ui-vue/components/modal/src/property-config/modal-events.ts b/packages/ui-vue/components/modal/src/property-config/modal-events.ts index 28bb12e1c9..98cff09ce7 100644 --- a/packages/ui-vue/components/modal/src/property-config/modal-events.ts +++ b/packages/ui-vue/components/modal/src/property-config/modal-events.ts @@ -2,7 +2,7 @@ export const ModalEvents = [ { label: 'beforeClose', - name: '关闭前回调事件' + name: '关闭前事件' }, { label: 'onAccept', diff --git a/packages/ui-vue/components/modal/src/schema/modal.schema.json b/packages/ui-vue/components/modal/src/schema/modal.schema.json index 73080c28e3..2d0fcab1f2 100644 --- a/packages/ui-vue/components/modal/src/schema/modal.schema.json +++ b/packages/ui-vue/components/modal/src/schema/modal.schema.json @@ -107,7 +107,7 @@ "default": null }, "beforeClose": { - "description": "关闭前回调", + "description": "关闭前事件", "type": "object", "default": null } -- Gitee From 0410a6d1b3e1cead18b8e2bb45d0a63223cbc442 Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Thu, 23 Oct 2025 17:11:43 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E5=8F=98=E5=8C=96=E6=97=B6=E7=BB=84=E4=BB=B6=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E8=A1=8C=E7=9A=84=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/compositions/use-data-grid-binding.ts | 59 +++++++++++++++---- .../lib/compositions/use-list-view-binding.ts | 51 +++++++++++++--- .../lib/compositions/use-tree-grid-binding.ts | 16 ++++- 3 files changed, 106 insertions(+), 20 deletions(-) diff --git a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts index b5d622896e..e4496a2cc3 100644 --- a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts +++ b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts @@ -42,6 +42,8 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio const entities = viewModel.entityStore?.getEntityListByPath(options.entityPath).getEntities(); data.value = datas; if (change.type === EntityChangeType.Load) { + + // 设置分页 const serverPagination = viewModel.entityStore?.getPaginationByPath(viewModel.bindingPath); if (serverPagination && serverPagination.pageSize !== 0) { pagination.value = { @@ -51,16 +53,23 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio mode: 'server', enable: serverPagination?.pageSize !== 0 }; + componentRef.value.updatePagination(pagination.value); } const entity = viewModel.entityStore?.getEntityListByPath(options.entityPath).getCurrentEntity(); const primaryValue = entity?.idValue; + + // 更新数据 componentRef.value.updateDataSource(datas); - componentRef.value.selectRowById(primaryValue); - selectItemById(primaryValue, true); + + // 更新ids变量 updateIdsState(primaryValue); - // 将当前行滚动到可视区域 + + // 设置当前行 + selectItemById(primaryValue); + + // 滚动到当前行 const index = getEntityIndexById(entities, primaryValue); scrollToRowByIndex(index); } else if (change.type === EntityChangeType.Append) { @@ -68,37 +77,61 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio const entities = appendEntityChange.entities; const entity = entities[entities.length - 1]; const primaryValue = entity.idValue; + + // 更新数据 componentRef.value.updateDataSource(datas); + + // 更新ids变量 + updateIdsState(primaryValue); + + // 设置当前行 if (primaryValue && datas && datas.length > 0) { - componentRef.value.activeRowById(primaryValue); + selectItemById(primaryValue); } + + // 滚动到最后一条 componentRef.value.scrollToBottom(); - updateIdsState(primaryValue); } else if (change.type === EntityChangeType.CurrentChange) { const newCurrentEntity: Entity = (change as any).newCurrentEntity as Entity; let dataSourceCurrentId: any = newCurrentEntity.idValue; const changePath = change && change.path.toShortPath(); - // 上级表行切换 + + // 上级表行切换,触发数据重新加载,并设置新数据的当前行ID if (changePath !== bindingPath && bindingPath.startsWith(changePath)) { componentRef.value.updateDataSource(datas); const entityList = viewModel.entityStore?.getEntityListByPath(options.entityPath); dataSourceCurrentId = entityList?.getCurrentEntity().idValue; } - // selectItemById(dataSourceCurrentId); + + // 设置当前行(仅设置,不触发事件,避免死循环) componentRef.value.activeRowById(dataSourceCurrentId); + + // 更新ids变量 updateIdsState(dataSourceCurrentId); } else if (change.type === EntityChangeType.Remove) { const removeChange = change as RemoveEntityChange; const ids = removeChange.entities.map((entity: Entity) => entity.idValue); + + // 从ids变量中移除已删除的数据 removeIdsFromIdsState(ids); + + // 更新数据 componentRef.value.updateDataSource(datas); + + // 如果当前行不存在,则置空ids变量 const newCurrentId = viewModel.entityStore?.getCurrentEntityByPath(options.entityPath).idValue; if (!newCurrentId) { updateIdsState(null); return; } + + // 更新ids变量 updateIdsState(newCurrentId); - // 将当前行滚动到可视区域 + + // 选中当前行 + selectItemById(newCurrentId); + + // 滚动到当前行 const index = getEntityIndexById(entities, newCurrentId); scrollToRowByIndex(index); } else if (change.type === EntityChangeType.ValueChange) { @@ -154,8 +187,14 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio if (componentCurrentEntity?.idValue !== currentEntity?.idValue) { viewModel.entityStore?.changeCurrentEntityByPath(options.entityPath, entity?.idValue); } - selectItemById(entity?.idValue); + + // 更新ids变量 updateIdsState(entity?.idValue); + + // 设置当前行 + selectItemById(entity?.idValue); + + // 滚动到当前行 const index = getEntityIndexById(entities, entity?.idValue); scrollToRowByIndex(index); } @@ -180,7 +219,7 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio if (currentId === id && !forceSelect) { return; } - componentRef.value.activeRowById(id); + componentRef.value.selectRowById(id); componentRef.value.clickRowItemById(id); } function removeIdsFromIdsState(ids: string[] | string | undefined | null) { diff --git a/packages/ui-binding/lib/compositions/use-list-view-binding.ts b/packages/ui-binding/lib/compositions/use-list-view-binding.ts index 2675a5bb95..3915032941 100644 --- a/packages/ui-binding/lib/compositions/use-list-view-binding.ts +++ b/packages/ui-binding/lib/compositions/use-list-view-binding.ts @@ -56,10 +56,17 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio const entity = viewModel.entityStore?.getEntityListByPath(options.entityPath).getCurrentEntity(); const primaryValue = entity?.idValue; + + // 更新数据 componentRef.value.updateDataSource(datas); - selectItemById(primaryValue, true); + + // 更新ids变量 updateIdsState(primaryValue); - // 将当前行滚动到可视区域 + + // 选中行 + selectItemById(primaryValue); + + // 滚动到当前行 const index = getEntityIndexById(entities, primaryValue); scrollToRowByIndex(index); } else if (change.type === EntityChangeType.Append) { @@ -67,12 +74,19 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio const entities = appendEntityChange.entities; const entity = entities[entities.length - 1]; const primaryValue = entity.idValue; + + // 更新数据 componentRef.value.updateDataSource(datas); + + // 更新ids + updateIdsState(primaryValue); + + // 选中行 if (primaryValue && datas && datas.length > 0) { - componentRef.value.activeRowById(primaryValue); + selectItemById(primaryValue); } // componentRef.value.scrollToBottom(); - updateIdsState(primaryValue); + } else if (change.type === EntityChangeType.CurrentChange) { const newCurrentEntity: Entity = (change as any).newCurrentEntity as Entity; let dataSourceCurrentId: any = newCurrentEntity.idValue; @@ -83,19 +97,34 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio const entityList = viewModel.entityStore?.getEntityListByPath(options.entityPath); dataSourceCurrentId = entityList?.getCurrentEntity().idValue; } - selectItemById(dataSourceCurrentId); + + // 更新ids变量 updateIdsState(dataSourceCurrentId); + + // 选中当前行 + selectItemById(dataSourceCurrentId); + } else if (change.type === EntityChangeType.Remove) { const removeChange = change as RemoveEntityChange; + + // 从ids变量中移除已删除的数据 const ids = removeChange.entities.map((entity: Entity) => entity.idValue); removeIdsFromIdsState(ids); + + // 更新数据 componentRef.value.updateDataSource(datas); + + // 更新ids变量 const newCurrentId = viewModel.entityStore?.getCurrentEntityByPath(options.entityPath).idValue; if (!newCurrentId) { updateIdsState(null); return; } updateIdsState(newCurrentId); + + // 选中当前行 + selectItemById(newCurrentId); + // 将当前行滚动到可视区域 const index = getEntityIndexById(entities, newCurrentId); scrollToRowByIndex(index); @@ -107,12 +136,20 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio const componentCurrentEntity = entityList?.getEntityById(componentCurrentId); const currentEntity = viewModel.entityStore?.getEntityListByPath(options.entityPath).getCurrentEntity(); const entity = componentCurrentEntity || currentEntity; + + // 更新数据 componentRef.value.updateDataSource(datas); if (componentCurrentEntity?.idValue !== currentEntity?.idValue) { viewModel.entityStore?.changeCurrentEntityByPath(options.entityPath, entity?.idValue); } - selectItemById(entity?.idValue); + + // 更新ids变量 updateIdsState(entity?.idValue); + + // 选中当前行 + selectItemById(entity?.idValue); + + // 滚动到当前行 const index = getEntityIndexById(entities, entity?.idValue); scrollToRowByIndex(index); } @@ -137,7 +174,7 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio if (currentId === id && !forceSelect) { return; } - componentRef.value.activeRowById(id); + componentRef.value.selectRowById(id); componentRef.value.clickRowItemById(id); } function removeIdsFromIdsState(ids: string[] | string | undefined | null) { diff --git a/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts b/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts index e3c68cfdf3..c1b0bc0e76 100644 --- a/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts +++ b/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts @@ -58,16 +58,20 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB const builder = getTreeBuilder(); const { data = [], rootId } = builder?.build() || {}; if (change.type === EntityChangeType.Load) { + + // 更新数据 componentRef.value.updateDataSource(data); if (rootId && isFirstRender) { - componentRef.value.selectRowById(rootId); + + // 设置当前行 selectItemById(rootId); isFirstRender = false; + + // 更新数据源当前行 viewModel.entityStore?.changeCurrentEntityByPath(viewModel.bindingPath, rootId); } else { const entity = viewModel.entityStore?.getEntityListByPath(options.entityPath).getCurrentEntity(); const primaryValue = entity?.idValue; - componentRef.value.selectRowById(primaryValue); selectItemById(primaryValue); viewModel.entityStore?.changeCurrentEntityByPath(viewModel.bindingPath, primaryValue); } @@ -78,7 +82,11 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB const parentId = builder?.getParentId(appendEntity); const ids = parentId ? [parentId] : []; const { data = [] } = builder?.build(ids) || {}; + + // 更新数据 componentRef.value.updateDataSource(data); + + // 设置当前行 const primaryValue = appendChange.entities[0].idValue; selectItemById(primaryValue); } else if (change.type === EntityChangeType.Remove) { @@ -87,6 +95,8 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB if (!newCurrentId) { return; } + + // 设置当前行 selectItemById(newCurrentId); } else if (change.type === EntityChangeType.Update) { const entity = viewModel.entityStore?.getEntityByPath(change.path); @@ -111,7 +121,7 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB if (currentId === id && !forceSelect) { return; } - componentRef.value.activeRowById(id); + componentRef.value.selectRowById(id); componentRef.value.clickRowItemById(id); } function getTreeBuilder(): TreeBuilder | null { -- Gitee From cc61e0f9aefddfdaab3a458a931e37c6dac40bb3 Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Mon, 27 Oct 2025 20:04:25 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=E4=B8=BA=E4=BA=86=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=EF=BC=8C=E4=B8=8D=E5=B8=A6=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9A=84reject=EF=BC=8C=E6=8E=A7=E5=88=B6=E5=8F=B0=E4=B8=8D?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/event/event-handlers-executor.ts | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/renderer/src/event/event-handlers-executor.ts b/packages/renderer/src/event/event-handlers-executor.ts index b2c93fd79c..b599b0d7fc 100644 --- a/packages/renderer/src/event/event-handlers-executor.ts +++ b/packages/renderer/src/event/event-handlers-executor.ts @@ -24,15 +24,22 @@ class EventHandlersExecutor { return; } - let lastResult; - for (const eventHandler of eventHandlers) { - const result = await eventHandler.handle(); - if (eventHandler.getType() === EventHandlerType.Command) { - lastResult = result; + try { + let lastResult; + for (const eventHandler of eventHandlers) { + const result = await eventHandler.handle(); + if (eventHandler.getType() === EventHandlerType.Command) { + lastResult = result; + } } - } + return lastResult; + } catch (error) { - return lastResult; + // 内置功能中已经使用了reject()来终止流,此类异常不输出错误 + if (error) { + console.error(error); + } + } } } -- Gitee From 63f51148e07203bd29c75006733f646df2ca3916 Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Tue, 28 Oct 2025 20:00:48 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=A1=8C=E5=88=87=E6=8D=A2=E6=97=B6Grid=E4=B8=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E8=A1=8C=E5=88=87=E6=8D=A2=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E8=BF=9B=E8=80=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=BB=8E=E8=A1=A8=E5=BD=93=E5=89=8D=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E4=BB=8E=E4=BB=8E=E8=A1=A8=E6=9B=B4=E6=8D=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=90=8E=E4=B8=8D=E8=A7=A6=E5=8F=91=E8=A1=8C=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/compositions/use-data-grid-binding.ts | 26 ++++++++++++++----- .../lib/compositions/use-list-view-binding.ts | 19 +++++++++++--- .../lib/compositions/use-tree-grid-binding.ts | 11 +++++--- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts index e4496a2cc3..3645efc782 100644 --- a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts +++ b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts @@ -19,24 +19,31 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio const entityPath = toShortPath(); const bindingPath = `/${entityPath?.join('/')}`; if (change.type === EntityChangeType.ValueChange || change.type === EntityChangeType.Update) { + + // 值变更和更新变更:先加工路径(移除最后一段属性的路径),再比较变更 const changePaths = change.path.clone(); const nodes = changePaths.getNodes(); let node = nodes[nodes.length - 1]; + while (node.getNodeType() !== EntityPathNodeType.IdValue) { nodes.pop(); node = nodes[nodes.length - 1]; } nodes.pop(); + const changePath = '/' + nodes.filter((node: EntityPathNode) => node.getNodeType() !== EntityPathNodeType.IdValue).map((node: EntityPathNode) => node.getNodeValue()).join('/'); if (!(changePath === bindingPath || bindingPath.startsWith(changePath))) { return; } } else { + + // 非值变更和更新变更:仅关注当前节点和父节点的变更 const changePath = change && change.path.toShortPath(); if (!(changePath === bindingPath || bindingPath.startsWith(changePath))) { return; } } + const entityData: Record[] | undefined = viewModel.entityStore?.getEntityListByPath(options.entityPath).toJSON(); const datas = cloneDeep(entityData); const entities = viewModel.entityStore?.getEntityListByPath(options.entityPath).getEntities(); @@ -63,12 +70,12 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio // 更新数据 componentRef.value.updateDataSource(datas); - // 更新ids变量 - updateIdsState(primaryValue); - // 设置当前行 selectItemById(primaryValue); + // 更新ids变量 + updateIdsState(primaryValue); + // 滚动到当前行 const index = getEntityIndexById(entities, primaryValue); scrollToRowByIndex(index); @@ -96,18 +103,19 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio let dataSourceCurrentId: any = newCurrentEntity.idValue; const changePath = change && change.path.toShortPath(); - // 上级表行切换,触发数据重新加载,并设置新数据的当前行ID + // 更新数据 if (changePath !== bindingPath && bindingPath.startsWith(changePath)) { componentRef.value.updateDataSource(datas); const entityList = viewModel.entityStore?.getEntityListByPath(options.entityPath); dataSourceCurrentId = entityList?.getCurrentEntity().idValue; } - // 设置当前行(仅设置,不触发事件,避免死循环) - componentRef.value.activeRowById(dataSourceCurrentId); - // 更新ids变量 updateIdsState(dataSourceCurrentId); + + // 设置当前行 + selectItemById(dataSourceCurrentId); + } else if (change.type === EntityChangeType.Remove) { const removeChange = change as RemoveEntityChange; const ids = removeChange.entities.map((entity: Entity) => entity.idValue); @@ -183,7 +191,11 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio const componentCurrentEntity = entityList?.getEntityById(componentCurrentId); const currentEntity = viewModel.entityStore?.getEntityListByPath(options.entityPath).getCurrentEntity(); const entity = componentCurrentEntity || currentEntity; + + // 更新数据 componentRef.value.updateDataSource(datas); + + // 更新数据源当前行(优先使用组件记录的当前行) if (componentCurrentEntity?.idValue !== currentEntity?.idValue) { viewModel.entityStore?.changeCurrentEntityByPath(options.entityPath, entity?.idValue); } diff --git a/packages/ui-binding/lib/compositions/use-list-view-binding.ts b/packages/ui-binding/lib/compositions/use-list-view-binding.ts index 3915032941..bcc1431655 100644 --- a/packages/ui-binding/lib/compositions/use-list-view-binding.ts +++ b/packages/ui-binding/lib/compositions/use-list-view-binding.ts @@ -37,10 +37,13 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio return; } } + + // 获取当前组件绑定的数据 const entityData: Record[] | undefined = viewModel.entityStore?.getEntityListByPath(options.entityPath).toJSON(); const datas = cloneDeep(entityData); const entities = viewModel.entityStore?.getEntityListByPath(options.entityPath).getEntities(); data.value = datas; + if (change.type === EntityChangeType.Load) { const serverPagination = viewModel.entityStore?.getPaginationByPath(viewModel.bindingPath); if (serverPagination && serverPagination.pageSize !== 0) { @@ -86,12 +89,12 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio selectItemById(primaryValue); } // componentRef.value.scrollToBottom(); - } else if (change.type === EntityChangeType.CurrentChange) { const newCurrentEntity: Entity = (change as any).newCurrentEntity as Entity; let dataSourceCurrentId: any = newCurrentEntity.idValue; const changePath = change && change.path.toShortPath(); - // 上级表行切换 + + // 父表行切换,更新数据 if (changePath !== bindingPath && bindingPath.startsWith(changePath)) { componentRef.value.updateDataSource(datas); const entityList = viewModel.entityStore?.getEntityListByPath(options.entityPath); @@ -103,7 +106,6 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio // 选中当前行 selectItemById(dataSourceCurrentId); - } else if (change.type === EntityChangeType.Remove) { const removeChange = change as RemoveEntityChange; @@ -120,6 +122,7 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio updateIdsState(null); return; } + updateIdsState(newCurrentId); // 选中当前行 @@ -129,16 +132,26 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio const index = getEntityIndexById(entities, newCurrentId); scrollToRowByIndex(index); } else if (change.type === EntityChangeType.ValueChange) { + + // 更新数据 componentRef.value.updateDataSource(datas); } else if (change.type === EntityChangeType.Update) { + + // 组件当前行 const componentCurrentId = componentRef.value.getCurrentRowId(); const entityList = viewModel.entityStore?.getEntityListByPath(options.entityPath); const componentCurrentEntity = entityList?.getEntityById(componentCurrentId); + + // 数据源中的当前实体 const currentEntity = viewModel.entityStore?.getEntityListByPath(options.entityPath).getCurrentEntity(); + + // 优先使用组件记录的当前行,不存在时使用数据源中的当前行 const entity = componentCurrentEntity || currentEntity; // 更新数据 componentRef.value.updateDataSource(datas); + + // 更新数据源当前行 if (componentCurrentEntity?.idValue !== currentEntity?.idValue) { viewModel.entityStore?.changeCurrentEntityByPath(options.entityPath, entity?.idValue); } diff --git a/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts b/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts index c1b0bc0e76..fd0338f34a 100644 --- a/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts +++ b/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts @@ -61,15 +61,17 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB // 更新数据 componentRef.value.updateDataSource(data); + + // 更新当前行 if (rootId && isFirstRender) { - // 设置当前行 + // 首次加载:将根节点设置为当前行 selectItemById(rootId); isFirstRender = false; - - // 更新数据源当前行 viewModel.entityStore?.changeCurrentEntityByPath(viewModel.bindingPath, rootId); } else { + + // 非首次加载:使用数据源中的当前行 const entity = viewModel.entityStore?.getEntityListByPath(options.entityPath).getCurrentEntity(); const primaryValue = entity?.idValue; selectItemById(primaryValue); @@ -90,6 +92,8 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB const primaryValue = appendChange.entities[0].idValue; selectItemById(primaryValue); } else if (change.type === EntityChangeType.Remove) { + + // 更新数据 componentRef.value.updateDataSource(data); const newCurrentId = viewModel.getModule().getContext().getParam('__TREE_CURRENT_ID__'); if (!newCurrentId) { @@ -99,6 +103,7 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB // 设置当前行 selectItemById(newCurrentId); } else if (change.type === EntityChangeType.Update) { + const entity = viewModel.entityStore?.getEntityByPath(change.path); componentRef.value.reassignRowData(entity?.idValue, entity?.toJSON()); } else if (change.type === EntityChangeType.ValueChange) { -- Gitee From 807fbb4fedbc1f3f3dd9a44da7bca2518cf376a8 Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Wed, 29 Oct 2025 09:27:45 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=B6Grid=E8=AE=BE=E7=BD=AEids=E5=92=8C?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=A1=8C=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui-binding/lib/compositions/use-data-grid-binding.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts index 3645efc782..112dffe046 100644 --- a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts +++ b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts @@ -70,12 +70,12 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio // 更新数据 componentRef.value.updateDataSource(datas); - // 设置当前行 - selectItemById(primaryValue); - // 更新ids变量 updateIdsState(primaryValue); + // 设置当前行 + selectItemById(primaryValue); + // 滚动到当前行 const index = getEntityIndexById(entities, primaryValue); scrollToRowByIndex(index); -- Gitee From c6da382a84d469503957572db09e6d40381d8846 Mon Sep 17 00:00:00 2001 From: jiweitao1986 Date: Wed, 29 Oct 2025 16:18:00 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E7=A9=BA=E6=95=B0=E6=8D=AE=E5=90=8E=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E8=A1=8C=E4=BE=9D=E7=84=B6=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui-binding/lib/compositions/use-data-grid-binding.ts | 1 + packages/ui-binding/lib/compositions/use-list-view-binding.ts | 1 + packages/ui-binding/lib/compositions/use-tree-grid-binding.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts index 112dffe046..ee43d2198b 100644 --- a/packages/ui-binding/lib/compositions/use-data-grid-binding.ts +++ b/packages/ui-binding/lib/compositions/use-data-grid-binding.ts @@ -225,6 +225,7 @@ export function useDataGridBinding(elementRef: ElementRef, options: BindingOptio } function selectItemById(id: string, forceSelect: boolean = false) { if (!id) { + componentRef.value.activeRowById(id); return; } const currentId = componentRef.value.getCurrentRowId(); diff --git a/packages/ui-binding/lib/compositions/use-list-view-binding.ts b/packages/ui-binding/lib/compositions/use-list-view-binding.ts index bcc1431655..6a4d4a3393 100644 --- a/packages/ui-binding/lib/compositions/use-list-view-binding.ts +++ b/packages/ui-binding/lib/compositions/use-list-view-binding.ts @@ -181,6 +181,7 @@ export function useListViewBinding(elementRef: ElementRef, options: BindingOptio } function selectItemById(id: string, forceSelect: boolean = false) { if (!id) { + componentRef.value.activeRowById(id); return; } const currentId = componentRef.value.getCurrentRowId(); diff --git a/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts b/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts index c3d19e13bb..e7828392ba 100644 --- a/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts +++ b/packages/ui-binding/lib/compositions/use-tree-grid-binding.ts @@ -122,6 +122,7 @@ export function useTreeGridBinding(elementRef: ElementRef, options: TreeBuilderB }; function selectItemById(id: string, forceSelect: boolean = false) { if (!id) { + componentRef.value.activeRowById(id); return; } const currentId = componentRef.value.getCurrentRowId(); -- Gitee