fix: Table内部兼容CRUD动作, ResultBox过滤不需要透传的属性; chore: overflowTagPopover设置为可选属性 (#4506)

This commit is contained in:
RUNZE LU 2022-05-31 18:12:36 +08:00 committed by GitHub
parent fca53a1b9e
commit 71647689cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 4 deletions

View File

@ -215,6 +215,8 @@ export class ResultBox extends React.Component<ResultBoxProps> {
} = this.props;
const isFocused = this.state.isFocused;
const mobileUI = useMobileUI && isMobile();
/** 不需要透传给Input的属性 */
const omitPropsList = ['maxTagCount', 'overflowTagPopover'];
return (
<div
@ -248,7 +250,7 @@ export class ResultBox extends React.Component<ResultBoxProps> {
{allowInput && !disabled ? (
<Input
{...rest}
{...omit(rest, omitPropsList)}
onKeyPress={onKeyPress}
ref={this.inputRef}
value={value || ''}

View File

@ -41,7 +41,7 @@ export interface TagControlSchema extends FormOptionsControl {
/**
* Popover配置
*/
overflowTagPopover: object;
overflowTagPopover?: object;
}
// declare function matchSorter(items:Array<any>, input:any, options:any): Array<any>;

View File

@ -121,7 +121,7 @@ export interface SelectControlSchema extends FormOptionsControl {
/**
* Popover配置
*/
overflowTagPopover: object;
overflowTagPopover?: object;
}
export interface SelectProps extends OptionsControlProps {

View File

@ -2797,6 +2797,26 @@ export default class Table extends React.Component<TableProps, object> {
storeType: TableStore.name,
name: 'table'
})
export class TableRenderer extends Table {}
export class TableRenderer extends Table {
receive(values: any, subPath?: string) {
const scoped = this.context as IScopedContext;
const parents = scoped?.parent?.getComponents();
/**
* Table在scope上注册getComponentByName查询组件时会优先找到TableCRUD联动的动作都会失效
* CRUD处理
*/
if (Array.isArray(parents) && parents.length) {
// CRUD的name会透传给Table这样可以保证找到CRUD
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
return crud?.receive?.(values, subPath);
}
if (subPath) {
return scoped.send(subPath, values);
}
}
}
export {TableCell};