mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix: indexof
This commit is contained in:
parent
ec7a5fb534
commit
82a82e9230
@ -141,6 +141,7 @@ export class TableModel extends DataBlockModel<TableModelStructure> {
|
|||||||
color: #1890ff;
|
color: #1890ff;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
z-index: 100;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
@ -157,6 +158,9 @@ export class TableModel extends DataBlockModel<TableModelStructure> {
|
|||||||
<EditOutlined
|
<EditOutlined
|
||||||
className="edit-icon"
|
className="edit-icon"
|
||||||
onClick={async (e) => {
|
onClick={async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
// 阻止事件冒泡,避免触发行选中
|
||||||
try {
|
try {
|
||||||
await QuickEditForm.open({
|
await QuickEditForm.open({
|
||||||
target: ref.current,
|
target: ref.current,
|
||||||
@ -266,7 +270,7 @@ export class TableModel extends DataBlockModel<TableModelStructure> {
|
|||||||
selectedRowKeys: this.resource.getSelectedRows().map((row) => row.id),
|
selectedRowKeys: this.resource.getSelectedRows().map((row) => row.id),
|
||||||
}}
|
}}
|
||||||
virtual={this.props.virtual}
|
virtual={this.props.virtual}
|
||||||
scroll={{ x: 'max-content', y: 'calc(100vh - 200px)' }}
|
scroll={{ x: 'max-content', y: 600 }}
|
||||||
dataSource={this.resource.getData()}
|
dataSource={this.resource.getData()}
|
||||||
columns={this.getColumns()}
|
columns={this.getColumns()}
|
||||||
pagination={{
|
pagination={{
|
||||||
@ -276,9 +280,9 @@ export class TableModel extends DataBlockModel<TableModelStructure> {
|
|||||||
}}
|
}}
|
||||||
onChange={(pagination) => {
|
onChange={(pagination) => {
|
||||||
console.log('onChange pagination:', pagination);
|
console.log('onChange pagination:', pagination);
|
||||||
|
this.resource.loading = true;
|
||||||
this.resource.setPage(pagination.current);
|
this.resource.setPage(pagination.current);
|
||||||
this.resource.setPageSize(pagination.pageSize);
|
this.resource.setPageSize(pagination.pageSize);
|
||||||
this.resource.loading = true;
|
|
||||||
this.resource.refresh();
|
this.resource.refresh();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
MultiRecordResource,
|
MultiRecordResource,
|
||||||
} from '@nocobase/flow-engine';
|
} from '@nocobase/flow-engine';
|
||||||
import { tval } from '@nocobase/utils/client';
|
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 _ from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ColumnDefinition, TabulatorFull as Tabulator } from 'tabulator-tables';
|
import { ColumnDefinition, TabulatorFull as Tabulator } from 'tabulator-tables';
|
||||||
@ -262,6 +262,7 @@ export class TabulatorModel extends DataBlockModel<S> {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
|
<Spin spinning={this.resource.loading}>
|
||||||
<DndProvider>
|
<DndProvider>
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
||||||
<Space>
|
<Space>
|
||||||
@ -269,7 +270,10 @@ export class TabulatorModel extends DataBlockModel<S> {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (action.props.position === 'left') {
|
if (action.props.position === 'left') {
|
||||||
return (
|
return (
|
||||||
<FlowModelRenderer model={action} showFlowSettings={{ showBackground: false, showBorder: false }} />
|
<FlowModelRenderer
|
||||||
|
model={action}
|
||||||
|
showFlowSettings={{ showBackground: false, showBorder: false }}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +287,10 @@ export class TabulatorModel extends DataBlockModel<S> {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (action.props.position !== 'left') {
|
if (action.props.position !== 'left') {
|
||||||
return (
|
return (
|
||||||
<FlowModelRenderer model={action} showFlowSettings={{ showBackground: false, showBorder: false }} />
|
<FlowModelRenderer
|
||||||
|
model={action}
|
||||||
|
showFlowSettings={{ showBackground: false, showBorder: false }}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,11 +309,13 @@ export class TabulatorModel extends DataBlockModel<S> {
|
|||||||
total={this.resource.getMeta('count')}
|
total={this.resource.getMeta('count')}
|
||||||
showSizeChanger
|
showSizeChanger
|
||||||
onChange={async (page, pageSize) => {
|
onChange={async (page, pageSize) => {
|
||||||
|
this.resource.loading = true;
|
||||||
this.resource.setPage(page);
|
this.resource.setPage(page);
|
||||||
this.resource.setPageSize(pageSize);
|
this.resource.setPageSize(pageSize);
|
||||||
await this.resource.refresh();
|
await this.resource.refresh();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
</Spin>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -361,20 +361,19 @@ export class FlowEngine {
|
|||||||
const subModelValue = modelInstance.parent.subModels[subKey];
|
const subModelValue = modelInstance.parent.subModels[subKey];
|
||||||
|
|
||||||
if (Array.isArray(subModelValue)) {
|
if (Array.isArray(subModelValue)) {
|
||||||
const index = subModelValue.indexOf(modelInstance);
|
const index = subModelValue.findIndex((subModel) => subModel.uid === modelInstance.uid);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
subModelValue.splice(index, 1);
|
subModelValue.splice(index, 1);
|
||||||
modelInstance.parent.emitter.emit('onSubModelRemoved', modelInstance);
|
modelInstance.parent.emitter.emit('onSubModelRemoved', modelInstance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (subModelValue === modelInstance) {
|
} else if (subModelValue && subModelValue.uid === modelInstance.uid) {
|
||||||
delete modelInstance.parent.subModels[subKey];
|
delete modelInstance.parent.subModels[subKey];
|
||||||
modelInstance.parent.emitter.emit('onSubModelRemoved', modelInstance);
|
modelInstance.parent.emitter.emit('onSubModelRemoved', modelInstance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
modelInstance['onRemove']?.();
|
|
||||||
this.modelInstances.delete(uid);
|
this.modelInstances.delete(uid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user