Skip to content

Commit 8f19bcd

Browse files
authored
Merge pull request #1203 from xieliuduo/dev47-viewBoard
refactor: useWidgetAutoFetch and ZIndex
2 parents 3698d92 + 4400b17 commit 8f19bcd

File tree

35 files changed

+126
-119
lines changed

35 files changed

+126
-119
lines changed

frontend/src/app/components/ChartEditor.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
6060
import { useDispatch, useSelector } from 'react-redux';
6161
import { useHistory } from 'react-router';
6262
import styled from 'styled-components/macro';
63+
import { EMPHASIS_LEVEL } from 'styles/StyleConstants';
6364
import { CloneValueDeep, isEmptyArray } from 'utils/object';
6465
import ChartWorkbench from '../pages/ChartWorkbenchPage/components/ChartWorkbench/ChartWorkbench';
6566
import {
@@ -597,7 +598,7 @@ const StyledChartWorkbenchPage = styled.div`
597598
right: 0;
598599
bottom: 0;
599600
left: 0;
600-
z-index: 55;
601+
z-index: ${EMPHASIS_LEVEL * 6};
601602
display: flex;
602603
min-width: 0;
603604
min-height: 0;

frontend/src/app/components/ChartGraph/BasicTableChart/TableComponents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Tooltip } from 'antd';
33
import React from 'react';
44
import { Resizable } from 'react-resizable';
55
import styled from 'styled-components/macro';
6-
import { BLUE } from 'styles/StyleConstants';
6+
import { BLUE, STICKY_LEVEL } from 'styles/StyleConstants';
77

88
export const TableComponentsTd = ({
99
children,
@@ -78,7 +78,7 @@ const ResizableHandleStyle = styled.span`
7878
position: absolute;
7979
right: -5px;
8080
bottom: 0;
81-
z-index: 1;
81+
z-index: ${STICKY_LEVEL};
8282
width: 10px;
8383
height: 100%;
8484
cursor: col-resize;

frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartDraggable/ChartDragLayer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
* limitations under the License.
1717
*/
1818

19-
import React from 'react';
2019
import { DragLayer } from 'react-dnd';
2120
import styled from 'styled-components';
21+
import { EMPHASIS_LEVEL } from 'styles/StyleConstants';
2222
import ChartDragPreview from './ChartDragPreview';
2323

2424
const collect = monitor => {
@@ -72,10 +72,10 @@ export default DragLayer(collect)(CardDragLayer);
7272

7373
const LayerStyles = styled.div`
7474
position: fixed;
75-
pointer-events: none;
76-
z-index: 100;
77-
left: 0;
7875
top: 0;
7976
right: 0;
8077
bottom: 0;
78+
left: 0;
79+
z-index: ${EMPHASIS_LEVEL * 10};
80+
pointer-events: none;
8181
`;

frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartPresentPanel/ChartPresentPanel.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { useSelector } from 'react-redux';
3333
import styled from 'styled-components/macro';
3434
import {
3535
BORDER_RADIUS,
36+
EMPHASIS_LEVEL,
3637
LINE_HEIGHT_ICON_XXL,
3738
SPACE_LG,
3839
SPACE_MD,
@@ -173,12 +174,12 @@ const ChartPresentPanel: FC<{
173174
export default ChartPresentPanel;
174175

175176
const StyledChartPresentPanel = styled.div`
177+
position: relative;
176178
display: flex;
177179
flex: 1;
178180
flex-direction: column;
179181
background-color: ${p => p.theme.componentBackground};
180182
border-radius: ${BORDER_RADIUS};
181-
position: relative;
182183
`;
183184

184185
const StyledReusableChartContainer = styled.div``;
@@ -203,16 +204,16 @@ const ReloadMask = styled.div`
203204
position: absolute;
204205
top: 0;
205206
left: 0;
206-
z-index: 10;
207-
width: 100%;
208-
height: 100%;
207+
z-index: ${EMPHASIS_LEVEL};
209208
display: flex;
210209
align-items: center;
211210
justify-content: center;
211+
width: 100%;
212+
height: 100%;
212213
background: rgba(255, 255, 255, 0.9);
213214
.fetchDataIcon {
214-
cursor: pointer;
215-
color: ${p => p.theme.primary};
216215
font-size: ${LINE_HEIGHT_ICON_XXL};
216+
color: ${p => p.theme.primary};
217+
cursor: pointer;
217218
}
218219
`;

frontend/src/app/pages/DashBoardPage/components/BoardHeader/ViewHeader.tsx renamed to frontend/src/app/pages/DashBoardPage/components/BoardHeader/TitleHeader.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { BoardDropdownList } from '../BoardDropdownList/BoardDropdownList';
4040
import { BoardContext } from '../BoardProvider/BoardProvider';
4141
import SaveToStoryBoard from '../SaveToStoryBoard';
4242

43-
const TitleHeader: FC = memo(() => {
43+
export const TitleHeader: FC = memo(() => {
4444
const t = useI18NPrefix(`viz.action`);
4545
const publishLoading = useSelector(selectPublishLoading);
4646
const history = useHistory();
@@ -137,7 +137,6 @@ const TitleHeader: FC = memo(() => {
137137
);
138138
});
139139

140-
export default TitleHeader;
141140
const Wrapper = styled.div`
142141
display: flex;
143142
flex-shrink: 0;

frontend/src/app/pages/DashBoardPage/components/FullScreenPanel/FullScreenPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { BoardState } from 'app/pages/DashBoardPage/pages/Board/slice/types';
2727
import React, { useCallback, useContext, useMemo, useState } from 'react';
2828
import { useDispatch, useSelector } from 'react-redux';
2929
import styled from 'styled-components/macro';
30-
import { G90, WHITE } from 'styles/StyleConstants';
30+
import { EMPHASIS_LEVEL, G90, WHITE } from 'styles/StyleConstants';
3131
import { CanFullScreenWidgetTypes } from '../../constants';
3232
import { BoardContext } from '../BoardProvider/BoardProvider';
3333
import { FullScreenWidgetMapper } from './FullScreenWidgetMapper';
@@ -131,7 +131,7 @@ const FullScreenWrap = styled.div<{ show: boolean }>`
131131
right: 0;
132132
bottom: 0;
133133
left: 0;
134-
z-index: 100;
134+
z-index: ${EMPHASIS_LEVEL * 10};
135135
display: flex;
136136
flex-direction: column;
137137
width: 100%;
@@ -158,7 +158,7 @@ const FullScreenWrap = styled.div<{ show: boolean }>`
158158
position: absolute;
159159
top: 64px;
160160
left: ${p => (p.show ? '0' : '-300px')};
161-
z-index: 10;
161+
z-index: ${EMPHASIS_LEVEL};
162162
width: 300px;
163163
height: 100%;
164164

frontend/src/app/pages/DashBoardPage/components/WidgetComponents/BlockMaskLayer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import React, { memo, useCallback, useMemo } from 'react';
2424
import { useDispatch, useSelector } from 'react-redux';
2525
import styled from 'styled-components/macro';
26-
import { INFO, SUCCESS } from 'styles/StyleConstants';
26+
import { EMPHASIS_LEVEL, INFO, SUCCESS } from 'styles/StyleConstants';
2727
import {
2828
editDashBoardInfoActions,
2929
editWidgetInfoActions,
@@ -104,7 +104,7 @@ const MaskLayer = styled.div<MaskLayerProps>`
104104
position: absolute;
105105
top: -5px;
106106
left: -5px;
107-
z-index: ${p => (p.front ? 20 : 9)};
107+
z-index: ${p => (p.front ? EMPHASIS_LEVEL + 10 : EMPHASIS_LEVEL - 5)};
108108
width: calc(100% + 10px);
109109
height: calc(100% + 10px);
110110
cursor: move;

frontend/src/app/pages/DashBoardPage/components/WidgetComponents/StyledWidgetToolBar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
*/
1818
import { memo } from 'react';
1919
import styled from 'styled-components/macro';
20+
import { EMPHASIS_LEVEL } from 'styles/StyleConstants';
2021
export const StyledWidgetToolBar: React.FC<{}> = memo(props => {
2122
return <StyleWrap>{props.children} </StyleWrap>;
2223
});
2324
const StyleWrap = styled.div`
2425
position: absolute;
2526
top: 0;
2627
right: 0;
27-
z-index: 30;
28+
z-index: ${EMPHASIS_LEVEL * 3};
2829
overflow: hidden;
2930
text-align: right;
3031
.widget-tool-dropdown {

frontend/src/app/pages/DashBoardPage/components/WidgetComponents/WidgetDndHandleMask.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import React, { memo } from 'react';
2424
import { useDrag } from 'react-dnd';
2525
import { useDispatch } from 'react-redux';
26+
import { EMPHASIS_LEVEL } from 'styles/StyleConstants';
2627
import { editBoardStackActions } from '../../pages/BoardEditor/slice';
2728
export interface WidgetDndHandleMaskProps {
2829
widgetId: string;
@@ -85,7 +86,7 @@ export const WidgetDndHandleMask: React.FC<WidgetDndHandleMaskProps> = memo(
8586
position: 'absolute',
8687
cursor: 'grabbing',
8788
top: '0',
88-
zIndex: 15,
89+
zIndex: EMPHASIS_LEVEL + 5,
8990
width: '100%',
9091
height: '100%',
9192
}}

frontend/src/app/pages/DashBoardPage/components/WidgetComponents/ZIndexWrapper.tsx renamed to frontend/src/app/pages/DashBoardPage/components/WidgetComponents/constants.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
import { memo } from 'react';
19-
import styled from 'styled-components/macro';
20-
export const ZIndexWrapper: React.FC<{}> = memo(props => {
21-
return <Wrapper>{props.children} </Wrapper>;
22-
});
23-
const Wrapper = styled.div`
24-
z-index: 10;
25-
display: flex;
26-
flex-direction: column;
27-
width: 100%;
28-
height: 100%;
29-
`;
18+
19+
import type { CSSProperties } from 'react';
20+
import { EMPHASIS_LEVEL } from 'styles/StyleConstants';
21+
export const FlexStyle: CSSProperties = {
22+
display: 'flex',
23+
flex: '1',
24+
minHeight: '0',
25+
};
26+
export const ZIndexStyle: CSSProperties = {
27+
zIndex: EMPHASIS_LEVEL,
28+
display: 'flex',
29+
flexDirection: 'column',
30+
width: '100%',
31+
height: ' 100%',
32+
};

0 commit comments

Comments
 (0)