Skip to content

Commit

Permalink
fix: 修复table2卡片模式下 columnToggler 渲染失败的问题,完善移动端特殊case headerToolbar 的吸顶逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
jinye committed Nov 5, 2024
1 parent ad91d78 commit a3e0ed0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/amis/src/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,10 @@ registerRenderer({
type: 'table2',
getComponent: () => import('./renderers/Table2/index')
});
registerRenderer({
type: 'column-toggler',
getComponent: () => import('./renderers/Table2/ColumnToggler')
});
// import './renderers/Words';
registerRenderer({
type: 'words',
Expand Down
13 changes: 9 additions & 4 deletions packages/amis/src/renderers/CRUD2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {SchemaCollection} from '../Schema';
import type {Table2RendererEvent} from './Table2';
import type {CardsRendererEvent} from './Cards';
import isPlainObject from 'lodash/isPlainObject';
import isEmpty from 'lodash/isEmpty';

export type CRUDRendererEvent = Table2RendererEvent | CardsRendererEvent;

Expand Down Expand Up @@ -1421,7 +1422,7 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
let buttonCount = 0;
let addButton: any = {};
let addButtonParent: any = {};
let searchBox: any = {};
let searchBox: any = null;
function traverse(node: any, parentObj?: any) {
if (Array.isArray(node)) {
node.forEach((item: any) => traverse(item, parentObj));
Expand Down Expand Up @@ -1455,10 +1456,14 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
}
addButtonParent.className += ' is-fixed-right-bottom-wrapper';
}
}

if (searchBox) {
fixedHeader();
}
if (
searchBox &&
(buttonCount === 0 || (buttonCount === 1 && addButton)) &&
isEmpty(this.props.filterSchema)
) {
fixedHeader();
}
}

Expand Down

0 comments on commit a3e0ed0

Please sign in to comment.