Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
c7633b3b
Commit
c7633b3b
authored
Jan 20, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
输入框设置300ms延迟
parent
0b873519
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
9 deletions
+58
-9
DebounceInput.jsx
src/view/Manage/Model/Component/DebounceInput.jsx
+43
-0
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+7
-4
index.jsx
src/view/Manage/Model/index.jsx
+8
-5
No files found.
src/view/Manage/Model/Component/DebounceInput.jsx
0 → 100644
View file @
c7633b3b
import
React
from
"react"
;
import
_
from
"lodash"
;
export
default
(
triggerMs
=
0
)
=>
{
return
ReactElement
=>
{
class
DebounceInput
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
this
.
state
.
value
=
props
.
value
;
}
onChange
=
(()
=>
{
let
updb
=
this
.
props
.
onChange
;
if
(
triggerMs
>=
0
)
{
updb
=
_
.
debounce
(
value
=>
{
this
.
props
.
onChange
(
value
);
},
triggerMs
);
}
return
updb
;
})();
handleOnChange
=
event
=>
{
const
{
target
:
{
value
}
}
=
event
;
this
.
setState
({
value
});
return
this
.
onChange
(
value
);
};
render
()
{
const
theProps
=
{
...
this
.
props
,
...
this
.
state
};
theProps
.
onChange
=
this
.
handleOnChange
;
return
<
ReactElement
{
...
theProps
}
/>;
}
}
return
DebounceInput
;
};
};
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
c7633b3b
...
...
@@ -11,6 +11,7 @@ import { generateUUID, highlightSearchContentByTerms, showMessage, inputWidth, p
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
addEventListenerForSidebar
,
removeEventListenerForSidebar
}
from
'./Help'
;
import
{
AppContext
}
from
'../../../../App'
;
import
DebounceInput
from
'./DebounceInput'
;
import
'./ImportActionTable.less'
;
...
...
@@ -21,6 +22,8 @@ const perSuggestCount = 5;
const
supportMaxAttributeCountPerPage
=
100
;
const
MENU_ID
=
'model-attribute-menu'
;
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
const
DatatypeInput
=
({
value
=
{},
datatypes
,
onChange
})
=>
{
const
onNameChange
=
(
value
)
=>
{
...
...
@@ -129,7 +132,7 @@ const EditableCell = ({
if
(
editing
)
{
if
(
dataIndex
!==
'datatype'
)
{
const
inputNode
=
inputType
===
'check'
?
<
Checkbox
/>
:
<
Input
/>
const
inputNode
=
inputType
===
'check'
?
<
Checkbox
/>
:
<
Input
Debounce
/>
editingComponent
=
(
<
Form
.
Item
...
...
@@ -1069,9 +1072,9 @@ const ImportActionTable = (props) => {
[moveRowRef.current],
);
const onSearchInputChange = (e) => {
const onSearchInputChange = (
valu
e) => {
setEditingKey('');
setKeyword(
e.target.
value||'');
setKeyword(value||'');
}
const sourceOnClick = (id) => {
...
...
@@ -1131,7 +1134,7 @@ const ImportActionTable = (props) => {
</Tooltip>
}
<div className='d-flex' style={{ alignItems: 'center' }}>
<Input
<Input
Debounce
placeholder="请输入中文名称或者英文名称"
allowClear
value={keyword}
...
...
src/view/Manage/Model/index.jsx
View file @
c7633b3b
...
...
@@ -17,11 +17,14 @@ import { showMessage, showNotifaction, inputWidth, DeleteTipModal } from '../../
import
{
dispatch
,
dispatchLatestHomepage
}
from
'../../../model'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
,
Holder
}
from
'../../../util/constant'
;
import
{
AppContext
}
from
'../../../App'
;
import
DebounceInput
from
'./Component/DebounceInput'
;
import
'./index.less'
;
const
{
Option
}
=
Select
;
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
class
Model
extends
React
.
Component
{
constructor
()
{
...
...
@@ -183,9 +186,9 @@ class Model extends React.Component {
this.setState({ historyAndVersionDrawerVisible: true, modelerId: id });
}
onSearchInputChange = (e) => {
this.setState({ keyword:
e.target.
value||'', catalogId: '' }, () => {
if (
e.target.
value !== '') {
onSearchInputChange = (
valu
e) => {
this.setState({ keyword: value||'', catalogId: '' }, () => {
if (value !== '') {
this.onTableChange();
}
});
...
...
@@ -513,11 +516,11 @@ class Model extends React.Component {
</Space>
}
<Space>
<Input
<Input
Debounce
placeholder="通过模型名称全文搜索"
allowClear
value={keyword}
onChange={(
e) => { this.onSearchInputChange(
e); }}
onChange={(
value) => { this.onSearchInputChange(valu
e); }}
style={{ width: inputWidth, marginLeft: 'auto' }}
/>
</Space>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment