diff --git a/packages/amis/src/renderers/CRUD.tsx b/packages/amis/src/renderers/CRUD.tsx index e43a35b13..fb016e4c4 100644 --- a/packages/amis/src/renderers/CRUD.tsx +++ b/packages/amis/src/renderers/CRUD.tsx @@ -2666,6 +2666,7 @@ export default class CRUD extends React.Component { footerToolbarRender, testIdBuilder, id, + filterCanAccessSuperData = true, ...rest } = this.props; @@ -2702,7 +2703,7 @@ export default class CRUD extends React.Component { onSubmit: this.handleFilterSubmit, onInit: this.handleFilterInit, formStore: undefined, - canAccessSuperData: false + canAccessSuperData: filterCanAccessSuperData } ) : null} @@ -2726,6 +2727,7 @@ export default class CRUD extends React.Component { className: cx('Crud-body', bodyClassName), ref: this.controlRef, autoGenerateFilter: !filter && autoGenerateFilter, + filterCanAccessSuperData, autoFillHeight: autoFillHeight, selectable: !!( (this.hasBulkActionsToolbar() && this.hasBulkActions()) || diff --git a/packages/amis/src/renderers/Form/Picker.tsx b/packages/amis/src/renderers/Form/Picker.tsx index 842f64587..2c75bc64e 100644 --- a/packages/amis/src/renderers/Form/Picker.tsx +++ b/packages/amis/src/renderers/Form/Picker.tsx @@ -268,6 +268,7 @@ export default class PickerControl extends React.PureComponent< type: 'crud', pickerMode: true, syncLocation: false, + filterCanAccessSuperData: false, api: isScopeData ? null : props.source, source: isScopeData ? props.source : null, keepItemSelectionOnPageChange: true, diff --git a/packages/amis/src/renderers/Table/AutoFilterForm.tsx b/packages/amis/src/renderers/Table/AutoFilterForm.tsx index 9b969ce6c..491bdd0a9 100644 --- a/packages/amis/src/renderers/Table/AutoFilterForm.tsx +++ b/packages/amis/src/renderers/Table/AutoFilterForm.tsx @@ -19,6 +19,8 @@ export interface AutoFilterFormProps extends RendererProps { onToggleExpanded?: () => void; query?: any; + canAccessSuperData?: boolean; + popOverContainer?: any; onSearchableFromReset?: any; onSearchableFromSubmit?: any; @@ -40,7 +42,8 @@ export function AutoFilterForm({ onSearchableFromSubmit, onSearchableFromInit, popOverContainer, - testIdBuilder + testIdBuilder, + canAccessSuperData }: AutoFilterFormProps) { const schema = React.useMemo(() => { const {columnsNum, showBtnToolbar} = @@ -194,13 +197,14 @@ export function AutoFilterForm({ submitText: __('search'), body: body, actions: [], - canAccessSuperData: false + canAccessSuperData: canAccessSuperData }; }, [ autoGenerateFilter, activedSearchableColumns, searchableColumns, searchFormExpanded, + canAccessSuperData, __ // 保证语言更新后能重新渲染 ]); diff --git a/packages/amis/src/renderers/Table/index.tsx b/packages/amis/src/renderers/Table/index.tsx index 8a749e363..604313c5f 100644 --- a/packages/amis/src/renderers/Table/index.tsx +++ b/packages/amis/src/renderers/Table/index.tsx @@ -1693,7 +1693,8 @@ export default class Table extends React.Component { query, data, autoGenerateFilter, - testIdBuilder + testIdBuilder, + filterCanAccessSuperData = true } = this.props; const searchableColumns = store.searchableColumns; @@ -1708,6 +1709,7 @@ export default class Table extends React.Component { translate={__} classnames={cx} render={render} + canAccessSuperData={filterCanAccessSuperData} autoGenerateFilter={autoGenerateFilter} onSearchableFromReset={onSearchableFromReset} onSearchableFromSubmit={onSearchableFromSubmit}