diff --git a/packages/amis/src/minimal.ts b/packages/amis/src/minimal.ts index 6c01693d948..2a7b8f8b2fc 100644 --- a/packages/amis/src/minimal.ts +++ b/packages/amis/src/minimal.ts @@ -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', diff --git a/packages/amis/src/renderers/CRUD2.tsx b/packages/amis/src/renderers/CRUD2.tsx index aad9e1b95e7..be12ea8ba33 100644 --- a/packages/amis/src/renderers/CRUD2.tsx +++ b/packages/amis/src/renderers/CRUD2.tsx @@ -1421,7 +1421,7 @@ export default class CRUD2 extends React.Component { 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)); @@ -1457,7 +1457,25 @@ export default class CRUD2 extends React.Component { } 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(); } } }