Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
ae20244
refactor(DynamicPageTitle): rename `subHeading` to `subheading`
Lukas742 May 19, 2021
fdd15ed
refactor(ObjectPage): wip - replace title section with DynamicPageTit…
Lukas742 May 25, 2021
6ab6e14
use DynamicPageTitle component in ObjectPage
Lukas742 May 28, 2021
bb84b04
Merge branch 'main' into refactor/object-page
Lukas742 May 28, 2021
7ac8ee7
fix overflow button and some styles
Lukas742 May 31, 2021
858818e
commit unstaged files
Lukas742 May 31, 2021
7eca53a
remove unnecessary elements, fix navigation option
Lukas742 May 31, 2021
7ed4a45
fix rtl in DynamicPageTitle
Lukas742 May 31, 2021
ac17d57
merge branch 'main' into refactor/object-page
Lukas742 Jun 1, 2021
4abcba5
add ie11 support
Lukas742 Jun 1, 2021
b37c8ee
wip: add header and anchor bar
Lukas742 Jun 9, 2021
3871e7a
Merge branch 'main' into refactor/object-page
Lukas742 Jun 16, 2021
b1f3b22
scrolling and sticky behavior
Lukas742 Jun 21, 2021
66ea9b5
add sticky header, remove anchorbar if header or title is not set
Lukas742 Jun 22, 2021
c029d0a
fix anchorbar expand/collapse behavior
Lukas742 Jun 25, 2021
60616cb
title section click and hover behavior, move
Lukas742 Jun 28, 2021
1ae2f1f
fix scrolling, add footer
Lukas742 Jun 29, 2021
ca760f8
fix scrolling and focus
Lukas742 Jun 29, 2021
c98318f
refactor(DynamicPageAnchorBar): replace `headerContentHeight` with `h…
Lukas742 Jun 29, 2021
4892952
minor refactoring - todos, unused styles, etc
Lukas742 Jun 29, 2021
7bad974
remove padding from title section when in header
Lukas742 Jun 29, 2021
558c35f
cleanup
Lukas742 Jun 29, 2021
f1f6405
fix filler margin
Lukas742 Jun 30, 2021
86c55a1
fix rtl
Lukas742 Jun 30, 2021
719335e
fix import and typings
Lukas742 Jun 30, 2021
ce7cead
remove ie11 workarounds
Lukas742 Jul 1, 2021
b737aa5
story
Lukas742 Jul 1, 2021
521cca1
Merge branch 'main' into refactor/object-page
Lukas742 Jul 1, 2021
59b3536
add data-component-name attribute to sections
Lukas742 Jul 2, 2021
b4f1d6b
fix IconTabBar first section scroll behavior
Lukas742 Jul 2, 2021
e2592c2
improve tests
Lukas742 Jul 5, 2021
f0123da
Merge branch 'main' into refactor/object-page
Lukas742 Jul 5, 2021
4c73f89
rename `title` to `headerTitle
Lukas742 Jul 6, 2021
ff7c062
Merge branch 'main' into refactor/dynamic-page-title-rename-props
Lukas742 Jul 6, 2021
db8e677
Merge branch 'main' into refactor/object-page
Lukas742 Jul 6, 2021
30f5f52
update snapshots
Lukas742 Jul 6, 2021
5005008
Merge branch 'refactor/dynamic-page-title-rename-props' into refactor…
Lukas742 Jul 6, 2021
3a38265
refactor(DynamicPage): rename `title` to `headerTitle`
Lukas742 Jul 6, 2021
a718a48
Merge branch 'main' into refactor/object-page
Lukas742 Jul 6, 2021
dd887b3
fix tab sub-section selection, add fallback for fast scrolling
Lukas742 Jul 6, 2021
ec7195a
add migration guide
Lukas742 Jul 7, 2021
db1f656
Merge branch 'main' into refactor/object-page
Lukas742 Jul 7, 2021
66c273b
Merge branch 'main' into refactor/object-page
Lukas742 Jul 7, 2021
3a5d79c
fix typo
Lukas742 Jul 7, 2021
616d434
update snapshots
Lukas742 Jul 7, 2021
f236f55
fix(DynamicPageTitle): change cursor to pointer
Lukas742 Jul 9, 2021
d80be5c
fix hover and cursor behavior if header is not expandable
Lukas742 Jul 9, 2021
a8ad54c
update snapshots
Lukas742 Jul 9, 2021
a35f77a
Merge branch 'main' into refactor/object-page
Lukas742 Jul 12, 2021
6fde994
rename header to headerContent
Lukas742 Jul 12, 2021
ebceac0
remove pointer-events when header is not expandable
Lukas742 Jul 12, 2021
52b120d
responsive content padding uses element not window width
Lukas742 Jul 13, 2021
aae9701
move padding from sections to container
Lukas742 Jul 13, 2021
18e006f
update snapshots
Lukas742 Jul 13, 2021
173b569
chore: use UI5 Web Component extension for ObjectPageAnchorTabs (#1814)
MarcusNotheis Jul 13, 2021
d63baf2
fix(ObjectPage): header doesn't expand when scrolling if pinned
Lukas742 Jul 13, 2021
43fe999
collapsed & pinned header expands when scrolled to top
Lukas742 Jul 13, 2021
7001249
rename title props
Lukas742 Jul 14, 2021
95253fd
update migration guide
Lukas742 Jul 14, 2021
442fc44
fix(ObjectPage): prevent overflow of headerTitle and headerContent
Lukas742 Jul 14, 2021
5accb9c
remove getScrollBarWidth
Lukas742 Jul 14, 2021
435d669
Merge branch 'main' into refactor/object-page
Lukas742 Jul 14, 2021
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
93 changes: 93 additions & 0 deletions docs/2-MigrationGuide.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ or the [changelog](https://github.com/SAP/ui5-webcomponents-react/blob/master/CH

## Table of Contents

- [0.16.x to 0.17.0](#migrating-from-016x-to-0170)
- [0.15.x to 0.16.0](#migrating-from-015x-to-0160)
- [0.14.x to 0.15.0](#migrating-from-014x-to-0150)
- [0.13.x to 0.14.0](#migrating-from-013x-to-0140)
Expand All @@ -24,6 +25,98 @@ or the [changelog](https://github.com/SAP/ui5-webcomponents-react/blob/master/CH
- [0.9.x to 0.10.0](#migrating-from-09x-to-0100)
- [0.8.x to 0.9.0](#migrating-from-08x-to-090)

## Migrating from 0.16.x to 0.17.0

### Consolidate API of ObjectPage and DynamicPage

The DynamicPage and the ObjectPage are very similar but had completely different APIs and props.
We streamlined those APIs by adding components used by the `DynamicPage` to the `ObjectPage`.

#### DynamicPage changes

- `title` has been renamed to `headerTitle`.
- **`DynamicPageTitle`:** `subHeading` has been renamed to `subheading`.
- **`DynamicPageHeader`:** `children` are no longer displayed as `flex` items to support other display types like `grid`. To align children you now need to add the container (like `FlexBox`) and CSS yourself.
<br />
<br />
Example for aligning items next to each other:

```jsx
// Before
<DynamicPageHeader>
<div>Content 1</div>
<div>Content 2</div>
</DynamicPageHeader>

// Now
<DynamicPageHeader>
<FlexBox>
<div>Content 1</div>
<div>Content 2</div>
</FlexBox>
</DynamicPageHeader>
```

#### ObjectPage changes

- **`ObjectPageSection`:** `title` and `titleUppercase` has been renamed. Please use `heading` and `headingUppercase` instead.
- **`ObjectPageSubSection`:** `title` has been renamed to `heading`.
- `title` has been renamed to `headerTitle` and is now defining the upper, static, title section of the `ObjectPage`. It expects to receive the `DynamicPageTitle` component.
- `headerContent` has been renamed to `header` and expects now the `DynamicPageHeader` component to be passed.
- `noHeader` has been removed. It is now sufficient not to set `headerTitle` and `header` to achieve the same behavior.
- `title`, `subTitle`, `headerActions`, `breadcrumbs` and `keyInfos` should now be passed to the corresponding `DynamicPageTitle` props.

Setting the title section of the `ObjectPage`:

```jsx
//Before
<ObjectPage
title="Heading"
subTitle="Subheading"
breadcrumbs={
<Breadcrumbs currentLocationText="current Breadcrumb">
<Link>Breadcrumb 1</Link>
<Link>Breadcrumb 2</Link>
</Breadcrumbs>
}
headerActions={
<>
<Button>Action 1</Button>
<Button>Action 2</Button>
</>
}
keyInfos={<ObjectStatus>keyInfo</ObjectStatus>}
>
ObjectPage Content
</ObjectPage>

//Now
<ObjectPage
headerTitle={
<DynamicPageTitle
heading="Heading" // replaces `title`
subheading="Subheading" // replaces `subTitle`
breadcrumbs={
<Breadcrumbs currentLocationText="current Breadcrumb">
<Link>Breadcrumb 1</Link>
<Link>Breadcrumb 2</Link>
</Breadcrumbs>
}
actions={ /* replaces `headerActions`*/
<>
<Button>Action 1</Button>
<Button>Action 2</Button>
</>
}
>
<ObjectStatus>keyInfo</ObjectStatus> {/* replaces `keyInfos` */}
</DynamicPageTitle>
}
>
ObjectPage Content
</ObjectPage>
```

## Migrating from 0.15.x to 0.16.0

<br />
Expand Down
4 changes: 2 additions & 2 deletions packages/base/src/dist/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deprecationNotice, enrichEventWithDetails, getScrollBarWidth } from '../utils';
import { deprecationNotice, enrichEventWithDetails } from '../utils';
import { debounce } from '../utils/debounce';

export { deprecationNotice, getScrollBarWidth, enrichEventWithDetails, debounce };
export { deprecationNotice, enrichEventWithDetails, debounce };
4 changes: 3 additions & 1 deletion packages/base/src/hooks/useIsRTL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { RefObject, useState } from 'react';
const GLOBAL_DIR_CSS_VAR = '--_ui5_dir';

const detectRTL = (elementRef: RefObject<HTMLElement>) => {
if (!elementRef.current) {
return getRTL();
}
const doc = window.document;
const dirValues = ['ltr', 'rtl']; // exclude "auto" and "" from all calculations
const locallyAppliedDir = getComputedStyle(elementRef.current).getPropertyValue(GLOBAL_DIR_CSS_VAR);
Expand All @@ -29,7 +32,6 @@ const detectRTL = (elementRef: RefObject<HTMLElement>) => {

const useIsRTL = (elementRef: RefObject<HTMLElement>): boolean => {
const [isRTL, setRTL] = useState<boolean>(getRTL()); // use config RTL as best guess

useIsomorphicLayoutEffect(() => {
setRTL(detectRTL(elementRef)); // update immediately while rendering
const targets = [document.documentElement, document.body, elementRef.current].filter(Boolean);
Expand Down
3 changes: 1 addition & 2 deletions packages/base/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import { StyleClassHelper } from './dist/StyleClassHelper';
import { ThemingParameters } from './dist/ThemingParameters';
import { useConsolidatedRef } from './dist/useConsolidatedRef';
import { usePassThroughHtmlProps } from './dist/usePassThroughHtmlProps';
import { deprecationNotice, enrichEventWithDetails, getScrollBarWidth, debounce } from './dist/Utils';
import { deprecationNotice, enrichEventWithDetails, debounce } from './dist/Utils';

export {
StyleClassHelper,
deprecationNotice,
debounce,
getScrollBarWidth,
Logger,
LOG_LEVEL,
useConsolidatedRef,
Expand Down
28 changes: 0 additions & 28 deletions packages/base/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,6 @@ export const deprecationNotice = (component: string, message: string) => {
}
};

export const getScrollBarWidth = () => {
const inner = document.createElement('p');
inner.style.width = '100%';
inner.style.height = '200px';

const outer = document.createElement('div');
outer.style.position = 'absolute';
outer.style.top = '0px';
outer.style.left = '0px';
outer.style.visibility = 'hidden';
outer.style.width = '200px';
outer.style.height = '150px';
outer.style.overflow = 'hidden';
outer.appendChild(inner);

document.body.appendChild(outer);
const w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
let w2 = inner.offsetWidth;

if (w1 === w2) {
w2 = outer.clientWidth;
}

document.body.removeChild(outer);
return w1 - w2;
};

export const enrichEventWithDetails = <T extends Record<string, unknown>, ReturnType = CustomEvent<T>>(
event: UIEvent,
payload: T = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { sapUiResponsiveContentPadding } from '@ui5/webcomponents-react-base/dist/spacing';
import { ThemingParameters } from '@ui5/webcomponents-react-base/dist/ThemingParameters';

export const DynamicPageCssVariables = {
Expand Down Expand Up @@ -43,8 +42,7 @@ export const styles = {
backgroundColor: ThemingParameters.sapObjectHeader_Background
},
contentContainer: {
...sapUiResponsiveContentPadding,
paddingTop: '1rem !important',
paddingTop: '1rem',
boxSizing: 'border-box',
width: '100%',
height: 'auto',
Expand Down
Loading