Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ObjectPage): Add 'Pin-Header' button #354

Merged
merged 38 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
49ed1ca
feat(ObjectPage): Add Sticky Header
MarcusNotheis Feb 28, 2020
95a73d6
further refactoring
MarcusNotheis Mar 4, 2020
994f135
Extract AnchorBarStyles to dedicated componnet
MarcusNotheis Mar 4, 2020
dc3b91c
Clean up old classes
MarcusNotheis Mar 4, 2020
a2b49d6
Cleanup
MarcusNotheis Mar 4, 2020
7148938
Update Tests
MarcusNotheis Mar 4, 2020
779ba9d
Merge remote-tracking branch 'origin/master' into feat/object-page-st…
MarcusNotheis Mar 11, 2020
2b2a199
Merge remote-tracking branch 'origin/master' into feat/object-page-st…
MarcusNotheis Mar 12, 2020
cbc6971
Merge remote-tracking branch 'origin/master' into feat/object-page-st…
MarcusNotheis Mar 13, 2020
63939e3
Merge remote-tracking branch 'origin/master' into feat/object-page-st…
MarcusNotheis Mar 13, 2020
94c3563
Fix post merge issue
MarcusNotheis Mar 13, 2020
4374650
WIP: ObjectPageScrolling
MarcusNotheis Mar 16, 2020
f496bc9
Fix selected section detection
MarcusNotheis Mar 16, 2020
41b8c1c
Use IconTabBar in Object Page
MarcusNotheis Mar 16, 2020
449eb68
Merge remote-tracking branch 'origin/master' into feat/object-page-st…
MarcusNotheis Mar 16, 2020
44a2391
Fix scrolling
MarcusNotheis Mar 16, 2020
2c80d0c
WIP: Make Tests runnable
MarcusNotheis Mar 17, 2020
592a8dc
Add Intersection Observer polyfill
MarcusNotheis Mar 17, 2020
a6bf8de
Fix Scrolling
MarcusNotheis Mar 17, 2020
01e2a14
Add polyfills
MarcusNotheis Mar 17, 2020
792ef9b
Merge branch 'master' into feat/object-page-sticky-header-button
MarcusNotheis Mar 17, 2020
a688a52
fix tests
MarcusNotheis Mar 17, 2020
d01116c
Update code coverage settings
MarcusNotheis Mar 17, 2020
db0a74c
Merge remote-tracking branch 'origin/master' into feat/object-page-st…
MarcusNotheis Mar 17, 2020
3194aa4
Update snapshots
MarcusNotheis Mar 17, 2020
6123a2c
Fix showTitleInHeaderContent scrolling
MarcusNotheis Mar 18, 2020
b836425
Fix Display of Expand Collapse Button
MarcusNotheis Mar 18, 2020
fb0c24b
Fix ScrollTo Section when subsection was already selected
MarcusNotheis Mar 18, 2020
0a0f506
Improve scrolling
MarcusNotheis Mar 18, 2020
19a864d
Update ObjectPage.test.tsx.snap
MarcusNotheis Mar 18, 2020
de710e3
Merge branch 'master' into feat/object-page-sticky-header-button
MarcusNotheis Mar 18, 2020
59eba16
Merge branch 'master' into feat/object-page-sticky-header-button
vbersch Mar 19, 2020
437b884
Improve Styling of AnchorBar
MarcusNotheis Mar 19, 2020
0be724e
Minor improvements
MarcusNotheis Mar 19, 2020
2765d73
Enable scrollTo Subsection
MarcusNotheis Mar 19, 2020
fa1aa79
PR Comments: Add deprecation notice
MarcusNotheis Mar 19, 2020
d1e93dd
Remove unused code
MarcusNotheis Mar 19, 2020
f5e3fa1
ThemingParameters for scroll bar
MarcusNotheis Mar 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ module.exports = {
'!packages/main/src/components/AnalyticalTable/types/*', // no table enums
'!packages/base/src/styling/sap_fiori_3.ts', // no old theming parameters
'!packages/base/src/styling/HSLColor.ts', // no deprecated HSL Util
'!packages/base/src/styling/font72.ts' // no deprecated font
'!packages/base/src/styling/font72.ts', // no deprecated font
'!packages/base/src/Scroller/*' // no scroll lib as it is not longer used
],
setupFiles: ['jest-canvas-mock'],
setupFilesAfterEnv: ['./config/jestsetup.ts'],
Expand Down
1 change: 1 addition & 0 deletions config/jestsetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { createSerializer } from 'enzyme-to-json';
import ResizeObserver from 'resize-observer-polyfill';
import 'intersection-observer';
import '@ui5/webcomponents/dist/json-imports/i18n';

process.env.NODE_ENV = 'test';
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"gzip-size": "^5.1.0",
"husky": "^4.2.1",
"identity-obj-proxy": "^3.0.0",
"intersection-observer": "^0.7.0",
"jest": "^25.1.0",
"jest-canvas-mock": "^2.2.0",
"jest-environment-jsdom-sixteen": "^1.0.2",
Expand Down
7 changes: 5 additions & 2 deletions packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"**/modernizr.js",
"core-js/**/*",
"./src/polyfill/*.ts",
"./polyfill/*.js"
"./polyfill/*.js",
"intersection-observer"
],
"scripts": {
"clean": "rimraf cjs Device hooks lib polyfill styling types utils index.esm.js index.d.ts",
Expand All @@ -26,7 +27,9 @@
},
"dependencies": {
"core-js": "3.6.4",
"resize-observer-polyfill": "^1.5.1"
"intersection-observer": "^0.7.0",
"resize-observer-polyfill": "^1.5.1",
"smoothscroll-polyfill": "^0.4.4"
},
"peerDependencies": {
"react": "^16.8.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/base/src/Scroller/Scroller.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IScroller } from '@ui5/webcomponents-react-base/interfaces/IScroller';
import React, { forwardRef, RefObject, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';

import { deprecationNotice } from '@ui5/webcomponents-react-base/lib/Utils';
import { ScrollContentProvider } from './ScrollContextProvider';
import { scrollTo } from './ScrollHelper';

Expand All @@ -10,6 +10,11 @@ export interface Props {
forceSelection?: boolean;
}

deprecationNotice(
'Scroller',
"'@ui5/webcomponents-react-base/lib/Scroller' is deprecated and will be removed in the next major release."
);

export const Scroller = forwardRef((props: Props, ref: RefObject<IScroller>) => {
const { children, scrollContainer, forceSelection = true } = props;

Expand Down
5 changes: 5 additions & 0 deletions packages/base/src/polyfill/Edge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import ResizeObserver from 'resize-observer-polyfill';
import 'intersection-observer';
import smoothscroll from 'smoothscroll-polyfill';

// @ts-ignore
window.ResizeObserver = ResizeObserver;

// required for scrollTo methods
smoothscroll.polyfill();
5 changes: 5 additions & 0 deletions packages/base/src/polyfill/IE11.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import 'core-js/modules/es.object.assign';
import 'core-js/modules/es.object.values';
import 'core-js/modules/es.array.from';
import ResizeObserver from 'resize-observer-polyfill';
import 'intersection-observer';
import smoothscroll from 'smoothscroll-polyfill';

// @ts-ignore
window.ResizeObserver = ResizeObserver;

// required for scrollTo methods
smoothscroll.polyfill();
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ const makeTreeEntry = (...lens) => {
return makeDataLevel();
};



const makeEntry = () => ({
name: getRandomName(),
longColumn: 'Really really long column content... don´t crop please',
Expand Down
10 changes: 4 additions & 6 deletions packages/main/src/components/ObjectPage/CollapsedAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StyleClassHelper } from '@ui5/webcomponents-react-base/lib/StyleClassHelper';
import { AvatarSize } from '@ui5/webcomponents-react/lib/AvatarSize';
import React, { ReactElement, useLayoutEffect, useMemo, useRef, useState } from 'react';
import React, { useEffect, useMemo, useRef, useState, ReactElement } from 'react';
import { createComponentStyles } from '@ui5/webcomponents-react-base/lib/createComponentStyles';

const styles = {
Expand Down Expand Up @@ -51,7 +51,7 @@ export const CollapsedAvatar = (props: CollapsedAvatarPropTypes) => {
className={classes.imageContainer}
style={{ borderRadius: imageShapeCircle ? '50%' : 0, overflow: 'hidden' }}
>
<img className={classes.image} src={image} alt="Company Logo" />
<img className={classes.image} src={image} alt="Object Page Image" />
</span>
);
} else {
Expand All @@ -65,10 +65,8 @@ export const CollapsedAvatar = (props: CollapsedAvatarPropTypes) => {
}
}, [image, imageShapeCircle]);

useLayoutEffect(() => {
requestAnimationFrame(() => {
setIsMounted(true);
});
useEffect(() => {
setIsMounted(true);
}, []);

const containerClasses = StyleClassHelper.of(classes.base);
Expand Down
124 changes: 43 additions & 81 deletions packages/main/src/components/ObjectPage/ObjectPage.jss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,66 @@ const styles = {
width: '100%',
height: '100%',
position: 'relative',
display: 'flex',
flexDirection: 'column',
isolation: 'isolate',
whiteSpace: 'normal',
fontFamily: ThemingParameters.sapFontFamily,
backgroundColor: ThemingParameters.sapBackgroundColor
},
contentContainer: {
backgroundColor: ThemingParameters.sapBackgroundColor,
overflowX: 'hidden',
overflowY: 'auto',
position: 'relative',
flexGrow: 1
},
outerContentContainer: {
width: '100%',
height: '100%',
overflow: 'hidden'
},
contentScrollContainer: {
position: 'relative'
'&::-webkit-scrollbar': {
backgroundColor: ThemingParameters.sapScrollBar_TrackColor,
width: ThemingParameters.sapScrollBar_Dimension
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: ThemingParameters.sapScrollBar_BorderColor,
'&:hover': {
backgroundColor: ThemingParameters.sapScrollBar_Hover_FaceColor
}
},
'&::-webkit-scrollbar-corner': {
backgroundColor: ThemingParameters.sapScrollBar_TrackColor
},
'& section[id="ObjectPageSection-1"] > div[role="heading"]': {
display: 'none'
}
},
anchorBar: {
paddingLeft: '2rem',
backgroundColor: ThemingParameters.sapObjectHeader_Background,
boxShadow: `inset 0 -0.0625rem ${ThemingParameters.sapObjectHeader_BorderColor}, inset 0 0.0625rem ${ThemingParameters.sapObjectHeader_BorderColor}`,
display: 'flex',
height: '2.75rem',
minHeight: '2.75rem',
position: 'relative'
iconTabBarMode: {
'& section[data-component-name="ObjectPageSection"] > div[role="heading"]': {
display: 'none'
}
},
sectionsContainer: {
'&:before': {
display: 'table',
content: '""'
},
'& :first-child > div[role="heading"]': {
noHeader: {
'& $header': {
display: 'none'
},
position: 'relative',
height: '100%',
// overflowX: 'hidden',
// overflowY: 'auto',
overflow: 'hidden',
backgroundColor: ThemingParameters.sapBackgroundColor,
'&:after': {
clear: 'both',
display: 'table',
content: '""'
'& $contentHeader': {
display: 'none'
}
},
fillerDiv: {
backgroundColor: ThemingParameters.sapBackgroundColor
headerCollapsed: {
'& $contentHeader': {
display: 'none'
}
},
// header
header: {
flexShrink: 0,
position: 'relative',
backgroundColor: ThemingParameters.sapObjectHeader_Background,
'&$stickied': {
'& $image': {
opacity: '1',
height: '3rem',
width: '3rem',
margin: '0.25rem 1rem 0.25rem 0'
}
}
position: 'sticky',
top: 0,
zIndex: 2
},
contentHeader: {
backgroundColor: ThemingParameters.sapObjectHeader_Background,
position: 'relative'
position: 'sticky',
paddingBottom: '0.25rem',
maxHeight: '500px',
overflow: 'hidden',
paddingLeft: '2rem'
},
anchorBar: {
position: 'sticky',
zIndex: 2,
'--_ui5_tc_header_box_shadow': 'inset 0px -1px 0 0px rgba(0,0,0,0.15)'
},
titleBar: {
padding: '0.5rem 2rem',
Expand Down Expand Up @@ -122,18 +112,8 @@ const styles = {
padding: 0
}
},
stickied: {},
headerContent: {
//paddingTop: '1.5rem',
paddingBottom: '0.25rem',
transition: 'max-height 0.5s',
maxHeight: '500px',
overflow: 'hidden',
paddingLeft: '2rem',
position: 'relative'
},
titleInHeaderContent: {
'& $headerContent': {
'& contentHeader': {
paddingTop: 0,
'& > *': {
display: 'flex',
Expand All @@ -148,17 +128,6 @@ const styles = {
// paddingTop: 0
}
},
alwaysVisibleHeader: {
'& $headerContent': {
paddingLeft: 0
},
'& $contentHeader': {
marginTop: '0.5rem'
},
'& $titleBar': {
paddingBottom: 0
}
},
headerCustomContent: {
display: 'inline-block',
verticalAlign: 'top',
Expand Down Expand Up @@ -196,13 +165,6 @@ const styles = {
},
avatar: {
marginRight: '1rem'
},
toggleHeaderButton: {
position: 'absolute',
'--_ui5_button_compact_height': '1.25rem',
'--_ui5_button_base_height': '1.25rem',
top: `-0.625rem`,
left: 'calc(50% - 1rem)'
}
};

Expand Down
Loading