diff --git a/packages/amis/src/minimal.ts b/packages/amis/src/minimal.ts index 6c01693d9..2a7b8f8b2 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 aad9e1b95..cfe381392 100644 --- a/packages/amis/src/renderers/CRUD2.tsx +++ b/packages/amis/src/renderers/CRUD2.tsx @@ -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 { 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 { } addButtonParent.className += ' is-fixed-right-bottom-wrapper'; } + } - if (searchBox) { - fixedHeader(); - } + if ( + searchBox && + (buttonCount === 0 || (buttonCount === 1 && addButton)) && + isEmpty(this.props.filterSchema) + ) { + fixedHeader(); } }