mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: Table内部兼容CRUD动作, ResultBox过滤不需要透传的属性; chore: overflowTagPopover设置为可选属性 (#4506)
This commit is contained in:
parent
fca53a1b9e
commit
71647689cc
@ -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 || ''}
|
||||
|
@ -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>;
|
||||
|
@ -121,7 +121,7 @@ export interface SelectControlSchema extends FormOptionsControl {
|
||||
/**
|
||||
* 收纳标签的Popover配置
|
||||
*/
|
||||
overflowTagPopover: object;
|
||||
overflowTagPopover?: object;
|
||||
}
|
||||
|
||||
export interface SelectProps extends OptionsControlProps {
|
||||
|
@ -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查询组件时会优先找到Table,和CRUD联动的动作都会失效
|
||||
* 这里先做兼容处理,把动作交给上层的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};
|
||||
|
Loading…
Reference in New Issue
Block a user