Merge branch '2.0' of github.com:nocobase/nocobase into 2.0

This commit is contained in:
gchust 2025-06-28 22:38:58 +08:00
commit 5c19dc754a
3 changed files with 63 additions and 15 deletions

View File

@ -40,6 +40,7 @@ export class FilterActionModel extends GlobalActionModel {
filterValue?: any; filterValue?: any;
ignoreFieldsNames?: string[]; ignoreFieldsNames?: string[];
open?: boolean; open?: boolean;
position: 'left';
}; };
defaultProps: any = { defaultProps: any = {
@ -73,6 +74,13 @@ FilterActionModel.registerFlow({
title: tval('Filter configuration'), title: tval('Filter configuration'),
auto: true, auto: true,
steps: { steps: {
position: {
title: '位置',
uiSchema: {},
handler(ctx, params) {
ctx.model.setProps('position', 'left');
},
},
ignoreFieldsNames: { ignoreFieldsNames: {
title: tval('Filterable fields'), title: tval('Filterable fields'),
uiSchema: { uiSchema: {

View File

@ -212,16 +212,49 @@ export class TableModel extends DataBlockModel<TableModelStructure> {
return ( return (
<Card> <Card>
<Spin spinning={this.resource.loading}> <Spin spinning={this.resource.loading}>
<Space style={{ marginBottom: 16 }}> <DndProvider
{this.mapSubModels('actions', (action) => ( onDragEnd={({ active, over }) => {
<FlowModelRenderer if (active.id && over?.id && active.id !== over.id) {
model={action} this.flowEngine.moveModel(active.id as string, over.id as string);
showFlowSettings={{ showBackground: false, showBorder: false }} }
sharedContext={{ currentBlockModel: this }} }}
/> >
))} <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
<AddActionButton model={this} subModelBaseClass="GlobalActionModel" subModelKey="actions" /> <Space>
</Space> {this.mapSubModels('actions', (action) => {
// @ts-ignore
if (action.props.position === 'left') {
return (
<FlowModelRenderer
model={action}
showFlowSettings={{ showBackground: false, showBorder: false }}
sharedContext={{ currentBlockModel: this }}
/>
);
}
return null;
})}
</Space>
<Space>
{this.mapSubModels('actions', (action) => {
// @ts-ignore
if (action.props.position !== 'left') {
return (
<FlowModelRenderer
model={action}
showFlowSettings={{ showBackground: false, showBorder: false }}
sharedContext={{ currentBlockModel: this }}
/>
);
}
return null;
})}
<AddActionButton model={this} subModelBaseClass="GlobalActionModel" subModelKey="actions" />
</Space>
</div>
</DndProvider>
<Table <Table
components={this.components} components={this.components}
tableLayout="fixed" tableLayout="fixed"

View File

@ -37,15 +37,22 @@ export const Droppable: FC<{ model: FlowModel; children: React.ReactNode }> = ({
<div <div
ref={setNodeRef} ref={setNodeRef}
style={{ style={{
background: isOver ? '#e6f7ff' : 'transparent', position: 'relative',
borderRadius: 4,
transition: 'all 0.2s',
marginBottom: 8,
padding: 8,
opacity: isActiveDroppable ? 0.3 : 1, opacity: isActiveDroppable ? 0.3 : 1,
}} }}
> >
{children} {children}
<div
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: isOver ? 'var(--colorBgSettingsHover)' : 'transparent',
pointerEvents: 'none',
}}
></div>
</div> </div>
); );
}; };