Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
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
Administrator
bkunyun
Commits
df2eeacb
Commit
df2eeacb
authored
Aug 02, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完成算子列表滚动加载判断条件
parent
aceff83a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
331 additions
and
24 deletions
+331
-24
util.ts
src/utils/util.ts
+14
-0
index.tsx
src/views/CustomOperator/components/OperatorList/index.tsx
+293
-1
index.module.css
...ews/WorkFlowEdit/components/OperatorList/index.module.css
+0
-15
index.tsx
src/views/WorkFlowEdit/components/OperatorList/index.tsx
+1
-5
interface.ts
src/views/WorkFlowEdit/components/OperatorList/interface.ts
+0
-2
index.module.css
src/views/WorkFlowEdit/index.module.css
+17
-0
index.tsx
src/views/WorkFlowEdit/index.tsx
+6
-1
No files found.
src/utils/util.ts
View file @
df2eeacb
...
...
@@ -113,3 +113,16 @@ export const getUrlThroughParams = (params: any, encodeArr: Array<string> = [],
})
return
url
}
// 判断上拉滚动是否需要加载 scrollLoaderThreshold 加载阈值 如0.25表示 离底部四分之一高度(包裹盒子的高)触发加载
export
const
getScrollLoader
=
(
e
:
any
,
scrollLoaderThreshold
:
number
=
0.25
)
=>
{
const
clientHeight
=
e
.
target
.
clientHeight
;
// 滚动的外层盒子高度
const
scrollHeight
=
e
.
target
.
scrollHeight
;
// 列表总高度
const
scrollTop
=
e
.
target
.
scrollTop
;
// 滚动的高度
if
(
scrollTop
+
clientHeight
*
(
1
+
scrollLoaderThreshold
)
>
scrollHeight
)
{
return
true
}
else
{
return
false
}
}
\ No newline at end of file
src/views/CustomOperator/components/OperatorList/index.tsx
View file @
df2eeacb
import
{
InputBase
,
IconButton
}
from
"@mui/material"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
styles
from
"./index.module.css"
;
import
{
getScrollLoader
}
from
"@/utils/util"
;
import
{
useState
}
from
"react"
;
const
OperatorList
=
()
=>
{
...
...
@@ -49,8 +50,299 @@ const OperatorList = () => {
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
{
name
:
"asdf"
,
version
:
"1.0.0"
,
},
];
window
.
onscroll
=
(
e
)
=>
{
console
.
log
(
e
);
};
const
handleScroll
=
(
e
:
any
)
=>
{
console
.
log
(
e
);
if
(
getScrollLoader
(
e
))
{
console
.
log
(
"加载"
);
}
};
const
randerIcon
=
()
=>
{
return
(
<
div
className=
{
styles
.
icon
}
>
...
...
@@ -90,7 +382,7 @@ const OperatorList = () => {
onChange=
{
nameChange
}
/>
</
div
>
<
div
className=
{
styles
.
list
}
>
<
div
className=
{
styles
.
list
}
onScroll=
{
(
e
)
=>
handleScroll
(
e
)
}
>
{
list
.
map
((
item
,
index
)
=>
{
return
(
<
div
key=
{
index
}
className=
{
styles
.
li
}
>
...
...
src/views/WorkFlowEdit/components/OperatorList/index.module.css
View file @
df2eeacb
...
...
@@ -52,21 +52,6 @@
height
:
calc
(
100%
-
48px
);
position
:
relative
;
}
.addOperator
{
position
:
absolute
;
right
:
24px
;
bottom
:
20px
;
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
box-shadow
:
0px
3px
10px
0px
rgba
(
0
,
24
,
57
,
0.14
);
font-size
:
30px
;
line-height
:
36px
;
text-align
:
center
;
color
:
RGBA
(
66
,
141
,
255
,
1
);
cursor
:
pointer
;
background-color
:
#fff
;
}
.versionBox
{
background
:
#e6e8eb
;
...
...
src/views/WorkFlowEdit/components/OperatorList/index.tsx
View file @
df2eeacb
...
...
@@ -211,8 +211,7 @@ const OperatorItem = (props: IOperatorItemProps) => {
const
OperatorList
=
observer
((
props
:
IOperatorListProps
)
=>
{
const
{
currentProjectStore
}
=
useStores
();
const
productId
=
toJS
(
currentProjectStore
.
currentProductInfo
.
id
);
const
{
templateConfigInfo
,
setTemplateConfigInfo
,
setShowCustomOperator
}
=
props
;
const
{
templateConfigInfo
,
setTemplateConfigInfo
}
=
props
;
const
[
operatorListData
,
setOperatorListData
]
=
useState
<
ITask
[]
>
([]);
const
[
keyword
,
setKeyword
]
=
useState
<
string
>
(
""
);
...
...
@@ -278,9 +277,6 @@ const OperatorList = observer((props: IOperatorListProps) => {
<
span
className=
{
styles
.
noDataText
}
>
没有找到相关算子
</
span
>
</
div
>
)
}
<
div
className=
{
styles
.
addOperator
}
onClick=
{
setShowCustomOperator
}
>
+
</
div
>
</
div
>
</
div
>
);
...
...
src/views/WorkFlowEdit/components/OperatorList/interface.ts
View file @
df2eeacb
...
...
@@ -17,7 +17,6 @@ export interface IOperatorItemProps {
}
export
interface
IOperatorListProps
{
setShowCustomOperator
:
any
templateConfigInfo
:
ITask
[]
setTemplateConfigInfo
:
(
val
:
ITask
[])
=>
void
}
\ No newline at end of file
src/views/WorkFlowEdit/index.module.css
View file @
df2eeacb
...
...
@@ -36,6 +36,23 @@
height
:
100%
;
/* overflow-y: scroll; */
box-sizing
:
border-box
;
position
:
relative
;
}
.addOperator
{
position
:
absolute
;
right
:
24px
;
bottom
:
20px
;
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
box-shadow
:
0px
3px
10px
0px
rgba
(
0
,
24
,
57
,
0.14
);
font-size
:
30px
;
line-height
:
36px
;
text-align
:
center
;
color
:
RGBA
(
66
,
141
,
255
,
1
);
cursor
:
pointer
;
background-color
:
#fff
;
}
.swFlowBox
{
flex
:
1
;
...
...
src/views/WorkFlowEdit/index.tsx
View file @
df2eeacb
...
...
@@ -206,7 +206,6 @@ const WorkFlowEdit = observer((props: IProps) => {
<
OperatorList
templateConfigInfo=
{
templateConfigInfo
}
setTemplateConfigInfo=
{
setTemplateConfigInfo
}
setShowCustomOperator=
{
()
=>
setShowCustomOperator
(
true
)
}
/>
)
}
{
leftContentType
!==
"list"
&&
(
...
...
@@ -216,6 +215,12 @@ const WorkFlowEdit = observer((props: IProps) => {
taskId=
{
selectTaskId
||
""
}
/>
)
}
<
div
className=
{
styles
.
addOperator
}
onClick=
{
()
=>
setShowCustomOperator
(
true
)
}
>
+
</
div
>
</
div
>
<
div
className=
{
styles
.
swFlowBox
}
id=
"workFlowEditRight"
>
<
Flow
...
...
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