Commit c56977cc by zhaochengxiang

bug fix

parent e35e42f4
...@@ -528,10 +528,10 @@ function getOffsetTop(element, container) { ...@@ -528,10 +528,10 @@ function getOffsetTop(element, container) {
return rect.top; return rect.top;
} }
export function getInternalCurrentAnchor(_linkIds, _offsetTop = 0, _bounds = 5, container = window) { export function getInternalCurrentAnchor(_linkIds, _offsetTop = 0, _bounds = 5, container) {
const linkSections: Section[] = []; const linkSections: Section[] = [];
_linkIds.forEach((id) => { _linkIds.forEach((id) => {
const target = document.getElementById(id); const target = container?.querySelector(`.${id}`);
if (target) { if (target) {
const top = getOffsetTop(target, container); const top = getOffsetTop(target, container);
if (top < _offsetTop + _bounds) { if (top < _offsetTop + _bounds) {
...@@ -540,7 +540,6 @@ export function getInternalCurrentAnchor(_linkIds, _offsetTop = 0, _bounds = 5, ...@@ -540,7 +540,6 @@ export function getInternalCurrentAnchor(_linkIds, _offsetTop = 0, _bounds = 5,
} }
}); });
console.log('linkSections', linkSections);
if (linkSections.length) { if (linkSections.length) {
const maxSection = linkSections.reduce((prev, curr) => (curr.top > prev.top ? curr : prev)); const maxSection = linkSections.reduce((prev, curr) => (curr.top > prev.top ? curr : prev));
return maxSection.id; return maxSection.id;
......
...@@ -150,9 +150,7 @@ const FC = (props) => { ...@@ -150,9 +150,7 @@ const FC = (props) => {
} }
key={inheritanceHistoricalType} key={inheritanceHistoricalType}
> >
<div style={{ height: '75vh', overflowX: 'hidden' }}>
{ historicalModelerData && <ImportAction form={historicalForm} action='edit-inherite-modal' roughModelerData={historicalModelerData} onChange={onHistoricalChange} /> } { historicalModelerData && <ImportAction form={historicalForm} action='edit-inherite-modal' roughModelerData={historicalModelerData} onChange={onHistoricalChange} /> }
</div>
</Tabs.TabPane> </Tabs.TabPane>
<Tabs.TabPane <Tabs.TabPane
tab={ tab={
...@@ -168,9 +166,7 @@ const FC = (props) => { ...@@ -168,9 +166,7 @@ const FC = (props) => {
} }
key={inheritanceZipperType} key={inheritanceZipperType}
> >
<div style={{ height: '75vh', overflowX: 'hidden' }}>
{ zipperModelerData && <ImportAction form={zipperForm} action='edit-inherite-modal' roughModelerData={zipperModelerData} onChange={onZipperChange} /> } { zipperModelerData && <ImportAction form={zipperForm} action='edit-inherite-modal' roughModelerData={zipperModelerData} onChange={onZipperChange} /> }
</div>
</Tabs.TabPane> </Tabs.TabPane>
</Tabs> </Tabs>
} }
......
...@@ -577,7 +577,7 @@ const ImportAction = React.forwardRef((props, ref) => { ...@@ -577,7 +577,7 @@ const ImportAction = React.forwardRef((props, ref) => {
<div style={{ position: 'sticky', top: 0 }}> <div style={{ position: 'sticky', top: 0 }}>
<Tabs activeKey={activeValue} centered onChange={(val) => { <Tabs activeKey={activeValue} centered onChange={(val) => {
setActiveValue(val); setActiveValue(val);
var targetElement = document.getElementById(val); // 找到目标元素 var targetElement = container?.querySelector(`.${val}`); // 找到目标元素
if (targetElement) { if (targetElement) {
animating.current = true; animating.current = true;
targetElement.scrollIntoView(); targetElement.scrollIntoView();
...@@ -588,7 +588,7 @@ const ImportAction = React.forwardRef((props, ref) => { ...@@ -588,7 +588,7 @@ const ImportAction = React.forwardRef((props, ref) => {
<Tabs.TabPane tab='数据表索引' key="model-import-action-index" /> <Tabs.TabPane tab='数据表索引' key="model-import-action-index" />
</Tabs> </Tabs>
</div> </div>
<div ref={setContainer} style={{ height: 'calc(100vh - 44px - 64px - 82px)', overflow: 'auto', padding: '0 20px' }}> <div ref={setContainer} style={{ height: action==='edit-inherite-modal'?'60vh':'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'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment