mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:48:13 +08:00
fix: 修复 tree-select 搜索内容时卡顿 (#5125)
This commit is contained in:
parent
2d56c6f998
commit
96462effdb
@ -31,6 +31,7 @@ import FormLayoutTestSchema from './Form/layoutTest';
|
|||||||
import Definitions from './Form/Definitions';
|
import Definitions from './Form/Definitions';
|
||||||
import AnchorNav from './Form/AnchorNav';
|
import AnchorNav from './Form/AnchorNav';
|
||||||
import InputKVSSchema from './Form/InputKVS';
|
import InputKVSSchema from './Form/InputKVS';
|
||||||
|
import Tree from './Form/Tree';
|
||||||
|
|
||||||
import TableCrudSchema from './CRUD/Table';
|
import TableCrudSchema from './CRUD/Table';
|
||||||
import TableAutoFillSchema from './CRUD/TableAutoFill';
|
import TableAutoFillSchema from './CRUD/TableAutoFill';
|
||||||
@ -301,6 +302,12 @@ export const examples = [
|
|||||||
label: '复杂嵌套数据',
|
label: '复杂嵌套数据',
|
||||||
path: '/examples/form/input-kvs',
|
path: '/examples/form/input-kvs',
|
||||||
component: makeSchemaRenderer(InputKVSSchema)
|
component: makeSchemaRenderer(InputKVSSchema)
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '树形结构',
|
||||||
|
path: '/examples/form/tree',
|
||||||
|
component: makeSchemaRenderer(Tree)
|
||||||
}
|
}
|
||||||
|
|
||||||
// {
|
// {
|
||||||
|
31
examples/components/Form/Tree.jsx
Normal file
31
examples/components/Form/Tree.jsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
const options = [...new Array(1000)].map((item, index) => {
|
||||||
|
const value = `${10000 + index * 3}`;
|
||||||
|
return {
|
||||||
|
value: value,
|
||||||
|
label: value
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export default {
|
||||||
|
type: 'form',
|
||||||
|
body: {
|
||||||
|
type: 'tree-select',
|
||||||
|
// "type": "nested-select",
|
||||||
|
name: 'output_fields',
|
||||||
|
label: '输出字段',
|
||||||
|
description: '输出字段中的制表符会转换为"\\t",换行符会转换为"\
|
||||||
|
"',
|
||||||
|
mode: 'horizontal',
|
||||||
|
multiple: true,
|
||||||
|
required: true,
|
||||||
|
clearable: true,
|
||||||
|
withChildren: true,
|
||||||
|
extractValue: true,
|
||||||
|
joinValues: true,
|
||||||
|
cascade: true,
|
||||||
|
borderMode: 'full',
|
||||||
|
searchable: true,
|
||||||
|
options: options,
|
||||||
|
initiallyOpen: false
|
||||||
|
}
|
||||||
|
};
|
@ -162,7 +162,10 @@ export default class TreeSelectControl extends React.Component<
|
|||||||
this.handleFocus = this.handleFocus.bind(this);
|
this.handleFocus = this.handleFocus.bind(this);
|
||||||
this.handleBlur = this.handleBlur.bind(this);
|
this.handleBlur = this.handleBlur.bind(this);
|
||||||
this.handleKeyPress = this.handleKeyPress.bind(this);
|
this.handleKeyPress = this.handleKeyPress.bind(this);
|
||||||
this.handleInputChange = this.handleInputChange.bind(this);
|
this.handleInputChange = debouce(this.handleInputChange.bind(this), 150, {
|
||||||
|
trailing: true,
|
||||||
|
leading: false
|
||||||
|
});
|
||||||
this.handleInputKeyDown = this.handleInputKeyDown.bind(this);
|
this.handleInputKeyDown = this.handleInputKeyDown.bind(this);
|
||||||
|
|
||||||
this.loadRemote = debouce(this.loadRemote.bind(this), 250, {
|
this.loadRemote = debouce(this.loadRemote.bind(this), 250, {
|
||||||
|
Loading…
Reference in New Issue
Block a user