fix: 修复table2卡片模式下 columnToggler 渲染失败的问题,完善移动端特殊case headerToolbar 的吸顶逻辑

This commit is contained in:
jinye 2024-11-05 20:20:04 +08:00 committed by lmaomaoz
parent 82efeba01d
commit 781896f94c
2 changed files with 13 additions and 4 deletions

View File

@ -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',

View File

@ -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;
@ -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));
@ -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();
}
}