diff --git a/packages/core/client/src/flow/models/data-blocks/table/TableModel.tsx b/packages/core/client/src/flow/models/data-blocks/table/TableModel.tsx index 36c070883c..49c965e706 100644 --- a/packages/core/client/src/flow/models/data-blocks/table/TableModel.tsx +++ b/packages/core/client/src/flow/models/data-blocks/table/TableModel.tsx @@ -141,6 +141,7 @@ export class TableModel extends DataBlockModel { color: #1890ff; margin-left: 8px; cursor: pointer; + z-index: 100; top: 50%; right: 8px; transform: translateY(-50%); @@ -157,6 +158,9 @@ export class TableModel extends DataBlockModel { { + e.preventDefault(); + e.stopPropagation(); + // 阻止事件冒泡,避免触发行选中 try { await QuickEditForm.open({ target: ref.current, @@ -266,7 +270,7 @@ export class TableModel extends DataBlockModel { selectedRowKeys: this.resource.getSelectedRows().map((row) => row.id), }} virtual={this.props.virtual} - scroll={{ x: 'max-content', y: 'calc(100vh - 200px)' }} + scroll={{ x: 'max-content', y: 600 }} dataSource={this.resource.getData()} columns={this.getColumns()} pagination={{ @@ -276,9 +280,9 @@ export class TableModel extends DataBlockModel { }} onChange={(pagination) => { console.log('onChange pagination:', pagination); + this.resource.loading = true; this.resource.setPage(pagination.current); this.resource.setPageSize(pagination.pageSize); - this.resource.loading = true; this.resource.refresh(); }} /> diff --git a/packages/core/client/src/flow/models/data-blocks/tabulator/TabulatorModel.tsx b/packages/core/client/src/flow/models/data-blocks/tabulator/TabulatorModel.tsx index b3cc093eb1..d11ffcd3b7 100644 --- a/packages/core/client/src/flow/models/data-blocks/tabulator/TabulatorModel.tsx +++ b/packages/core/client/src/flow/models/data-blocks/tabulator/TabulatorModel.tsx @@ -20,7 +20,7 @@ import { MultiRecordResource, } from '@nocobase/flow-engine'; import { tval } from '@nocobase/utils/client'; -import { Button, Card, Pagination, Skeleton, Space } from 'antd'; +import { Button, Card, Pagination, Skeleton, Space, Spin } from 'antd'; import _ from 'lodash'; import React from 'react'; import { ColumnDefinition, TabulatorFull as Tabulator } from 'tabulator-tables'; @@ -262,51 +262,60 @@ export class TabulatorModel extends DataBlockModel { render() { return ( - -
- - {this.mapSubModels('actions', (action) => { - // @ts-ignore - if (action.props.position === 'left') { - return ( - - ); - } + + +
+ + {this.mapSubModels('actions', (action) => { + // @ts-ignore + if (action.props.position === 'left') { + return ( + + ); + } - return null; - })} - {/* 占位 */} - - - - {this.mapSubModels('actions', (action) => { - // @ts-ignore - if (action.props.position !== 'left') { - return ( - - ); - } + return null; + })} + {/* 占位 */} + + + + {this.mapSubModels('actions', (action) => { + // @ts-ignore + if (action.props.position !== 'left') { + return ( + + ); + } - return null; - })} - - -
-
-
- { - this.resource.setPage(page); - this.resource.setPageSize(pageSize); - await this.resource.refresh(); - }} - /> + return null; + })} + + +
+ +
+ { + this.resource.loading = true; + this.resource.setPage(page); + this.resource.setPageSize(pageSize); + await this.resource.refresh(); + }} + /> + ); } diff --git a/packages/core/flow-engine/src/flowEngine.ts b/packages/core/flow-engine/src/flowEngine.ts index cafccdd070..aabc73534b 100644 --- a/packages/core/flow-engine/src/flowEngine.ts +++ b/packages/core/flow-engine/src/flowEngine.ts @@ -361,20 +361,19 @@ export class FlowEngine { const subModelValue = modelInstance.parent.subModels[subKey]; if (Array.isArray(subModelValue)) { - const index = subModelValue.indexOf(modelInstance); + const index = subModelValue.findIndex((subModel) => subModel.uid === modelInstance.uid); if (index !== -1) { subModelValue.splice(index, 1); modelInstance.parent.emitter.emit('onSubModelRemoved', modelInstance); break; } - } else if (subModelValue === modelInstance) { + } else if (subModelValue && subModelValue.uid === modelInstance.uid) { delete modelInstance.parent.subModels[subKey]; modelInstance.parent.emitter.emit('onSubModelRemoved', modelInstance); break; } } } - modelInstance['onRemove']?.(); this.modelInstances.delete(uid); return false; }