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
e35e42f4
Commit
e35e42f4
authored
Nov 29, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
anchor
parent
5c879afa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
11 deletions
+85
-11
index.js
src/util/index.js
+40
-2
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+43
-7
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+1
-1
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+1
-1
No files found.
src/util/index.js
View file @
e35e42f4
...
@@ -508,4 +508,42 @@ export function getValidString(strs) {
...
@@ -508,4 +508,42 @@ export function getValidString(strs) {
return
str
return
str
}
}
}
}
}
}
\ No newline at end of file
function
getOffsetTop
(
element
,
container
)
{
if
(
!
element
.
getClientRects
().
length
)
{
return
0
;
}
const
rect
=
element
.
getBoundingClientRect
();
if
(
rect
.
width
||
rect
.
height
)
{
if
(
container
===
window
)
{
container
=
element
.
ownerDocument
?.
documentElement
;
return
rect
.
top
-
container
?.
clientTop
;
}
return
rect
.
top
-
container
?.
getBoundingClientRect
().
top
;
}
return
rect
.
top
;
}
export
function
getInternalCurrentAnchor
(
_linkIds
,
_offsetTop
=
0
,
_bounds
=
5
,
container
=
window
)
{
const
linkSections
:
Section
[]
=
[];
_linkIds
.
forEach
((
id
)
=>
{
const
target
=
document
.
getElementById
(
id
);
if
(
target
)
{
const
top
=
getOffsetTop
(
target
,
container
);
if
(
top
<
_offsetTop
+
_bounds
)
{
linkSections
.
push
({
id
,
top
});
}
}
});
console
.
log
(
'linkSections'
,
linkSections
);
if
(
linkSections
.
length
)
{
const
maxSection
=
linkSections
.
reduce
((
prev
,
curr
)
=>
(
curr
.
top
>
prev
.
top
?
curr
:
prev
));
return
maxSection
.
id
;
}
return
''
;
};
\ No newline at end of file
src/view/Manage/Model/Component/ImportAction.jsx
View file @
e35e42f4
...
@@ -6,7 +6,7 @@ import ImportActionHeader from './ImportActionHeader';
...
@@ -6,7 +6,7 @@ import ImportActionHeader from './ImportActionHeader';
import
ImportActionInherited
from
'./ImportActionInherited'
;
import
ImportActionInherited
from
'./ImportActionInherited'
;
import
{
ImportActionTable
}
from
'./ImportActionTable'
;
import
{
ImportActionTable
}
from
'./ImportActionTable'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
ImportActionIndex
from
'./ImportActionIndex'
;
import
{
getQueryParam
}
from
'../../../../util'
;
import
{
get
InternalCurrentAnchor
,
get
QueryParam
}
from
'../../../../util'
;
import
{
Action
}
from
'../../../../util/constant'
;
import
{
Action
}
from
'../../../../util/constant'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
...
@@ -23,9 +23,12 @@ const ImportAction = React.forwardRef((props, ref) => {
...
@@ -23,9 +23,12 @@ const ImportAction = React.forwardRef((props, ref) => {
const
[
supportedIndextypes
,
setSupportedIndextypes
]
=
useState
([]);
const
[
supportedIndextypes
,
setSupportedIndextypes
]
=
useState
([]);
const
[
validateReports
,
setValidateReports
]
=
useState
([]);
const
[
validateReports
,
setValidateReports
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
container
,
setContainer
]
=
useState
();
const
[
activeValue
,
setActiveValue
]
=
useState
();
const
mountRef
=
useRef
(
true
);
const
mountRef
=
useRef
(
true
);
const
modelerDataRef
=
useRef
(
null
);
const
modelerDataRef
=
useRef
(
null
);
const
animating
=
useRef
(
false
);
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
isLoading
:
()
=>
{
isLoading
:
()
=>
{
...
@@ -106,6 +109,36 @@ const ImportAction = React.forwardRef((props, ref) => {
...
@@ -106,6 +109,36 @@ const ImportAction = React.forwardRef((props, ref) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
constraint
])
},
[
constraint
])
React
.
useEffect
(()
=>
{
if
(
container
)
{
handleScroll
();
container
?.
addEventListener
(
'scroll'
,
handleScroll
);
return
()
=>
{
container
?.
removeEventListener
(
'scroll'
,
handleScroll
);
};
}
},
[
container
]);
const
handleScroll
=
React
.
useCallback
(()
=>
{
if
(
animating
.
current
)
{
animating
.
current
=
false
;
return
;
}
const
currentActiveLink
=
getInternalCurrentAnchor
(
[
'model-import-action-header'
,
'model-import-action-table'
,
'model-import-action-index'
,
],
0
,
5
,
container
);
setActiveValue
(
currentActiveLink
)
},
[
container
]);
const
getTemplates
=
()
=>
{
const
getTemplates
=
()
=>
{
dispatch
({
dispatch
({
type
:
'datamodel.getAllTemplates'
,
type
:
'datamodel.getAllTemplates'
,
...
@@ -542,17 +575,20 @@ const ImportAction = React.forwardRef((props, ref) => {
...
@@ -542,17 +575,20 @@ const ImportAction = React.forwardRef((props, ref) => {
{loading?'':'暂无权限'}
{loading?'':'暂无权限'}
</div> : <div>
</div> : <div>
<div style={{ position: 'sticky', top: 0 }}>
<div style={{ position: 'sticky', top: 0 }}>
<Tabs centered onChange={(val) => {
<Tabs activeKey={activeValue} centered onChange={(val) => {
var targetElements = document.getElementsByClassName(val); // 找到目标元素
setActiveValue(val);
for (const element of targetElements) {
var targetElement = document.getElementById(val); // 找到目标元素
element?.scrollIntoView()
if (targetElement) {
animating.current = true;
targetElement.scrollIntoView();
}
}
}} style={{ margin: 0 }}>
}} style={{ margin: 0 }}>
<Tabs.TabPane tab='基本信息' key="
1
" />
<Tabs.TabPane tab='基本信息' key="
model-import-action-header
" />
<Tabs.TabPane tab='数据表结构' key="model-import-action-table" />
<Tabs.TabPane tab='数据表结构' key="model-import-action-table" />
<Tabs.TabPane tab='数据表索引' key="model-import-action-index" />
</Tabs>
</Tabs>
</div>
</div>
<div style={{ height: 'calc(100vh - 44px - 64px - 82px)', overflow: 'auto', padding: '0 20px' }}>
<div
ref={setContainer}
style={{ height: 'calc(100vh - 44px - 64px - 82px)', overflow: 'auto', padding: '0 20px' }}>
<ImportActionHeader
<ImportActionHeader
form={form}
form={form}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
editable={action!=='detail'&&action!=='flow'&&action!=='detail-version'&&action!=='edit-inherited'}
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
e35e42f4
...
@@ -305,7 +305,7 @@ const ImportActionHeader = (props) => {
...
@@ -305,7 +305,7 @@ const ImportActionHeader = (props) => {
}
}
return
(
return
(
<
div
className=
'model-import-action-header'
>
<
div
className=
'model-import-action-header'
id=
'model-import-action-header'
>
<
div
<
div
className=
'mb-3'
className=
'mb-3'
style=
{
{
style=
{
{
...
...
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
e35e42f4
...
@@ -840,7 +840,7 @@ const ImportActionIndex = (props) => {
...
@@ -840,7 +840,7 @@ const ImportActionIndex = (props) => {
}
}
return
(
return
(
<
div
className=
'model-import-action-index'
>
<
div
className=
'model-import-action-index'
id=
'model-import-action-index'
>
<
div
className=
'd-flex mb-3'
style=
{
{
justifyContent
:
'space-between'
}
}
>
<
div
className=
'd-flex mb-3'
style=
{
{
justifyContent
:
'space-between'
}
}
>
<
Space
>
<
Space
>
<
h2
style=
{
{
marginBottom
:
0
}
}
>
数据表索引
</
h2
>
<
h2
style=
{
{
marginBottom
:
0
}
}
>
数据表索引
</
h2
>
...
...
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