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 82efeba commit e9403ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 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
22 changes: 20 additions & 2 deletions packages/amis/src/renderers/CRUD2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,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 @@ -1457,7 +1457,25 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
}

if (searchBox) {
fixedHeader();
// 没有 filter 的时候才可以把搜索框 吸顶
const filterSchema = this.props.filterSchema;
let hasFilter = false;
if (filterSchema) {
if (Array.isArray(filterSchema) && filterSchema?.length > 0) {
hasFilter = true;
} else {
const filterSchemas = Array.isArray(filterSchema)
? filterSchema
: isObject(filterSchema) && filterSchema.type != null
? [filterSchema]
: [];

if (filterSchemas.length > 0) {
hasFilter = true;
}
}
}
!hasFilter && fixedHeader();
}
}
}
Expand Down

0 comments on commit e9403ee

Please sign in to comment.