Merge pull request #3685 from nmtoblum/fix/3684_use_treeTop_setting_only_for_tree

This commit is contained in:
Hugo Bernier 2023-05-14 12:21:12 -04:00 committed by GitHub
commit 90161e9004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 7 deletions

View File

@ -1,3 +1,4 @@
# Pages Hierarchy
## Summary
@ -35,8 +36,8 @@ This web part allows users to create a faux page hierarchy in their pages librar
## Contributors
* [Bo George](https://github.com/bogeorge) ([@bo_george](https://twitter.com/bo_george))
* [Nick Brown](https://github.com/techienickb) ([@techienickb](https://twitter.com/techienickb))
* [Bo George](https://github.com/bogeorge)
* [Nick Brown](https://github.com/techienickb)
* [SlowRobot](https://github.com/SlowRobot)
* [ruslan-s](https://github.com/ruslan-s)
@ -49,6 +50,7 @@ Version|Date|Comments
1.3|March 31, 2022|Added a Tree View
1.4|July 29, 2022|Updated Tree View Functionality
1.5|March 29, 2023|Added support for non-English SitePages library paths
1.6|May 11, Uses treeFrom/expandTo web part properties
## Minimal path to awesome

View File

@ -9,7 +9,7 @@
"This web part allows users to create a faux page hierarchy in their pages library and use it for page-to-page navigation."
],
"creationDateTime": "2020-04-30",
"updateDateTime": "2023-03-29",
"updateDateTime": "2023-05-11",
"products": [
"SharePoint"
],
@ -53,7 +53,12 @@
"gitHubAccount": "ruslan-s",
"name": "ruslan-s",
"pictureUrl": "https://github.com/ruslan-s.png"
}
},
{
"gitHubAccount": "SlowRobot",
"name": "SlowRobot",
"pictureUrl": "https://github.com/SlowRobot.png"
}
],
"references": [
{

View File

@ -4,7 +4,7 @@
"name": "react-pages-hierarchy",
"id": "89758fb6-85e2-4e2b-ac88-4f4e7e5f60cb",
"title": "Pages Hierarchy",
"version": "1.0.3.1",
"version": "1.0.3.2",
"includeClientSideAssets": true,
"isDomainIsolated": false,
"developer": {

View File

@ -88,7 +88,7 @@ function pagesReducer(state: PagesState, action: Action): PagesState {
}
}
export function usePageApi(currentPageId: number, pageEditFinished: boolean, context: WebPartContext, treeTop: number, treeExpandTo: number): PageApi {
export function usePageApi(currentPageId: number, pageEditFinished: boolean, context: WebPartContext, treeTop?: number, treeExpandTo?: number): PageApi {
const [pagesState, pagesDispatch] = useReducer(pagesReducer, {
parentPageColumnExists: true,
userCanManagePages: false,

View File

@ -10,7 +10,10 @@ import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder";
import { TreeLayout } from '../Layouts/TreeLayout';
export const Container: React.FunctionComponent<IContainerProps> = props => {
const pagesApi = usePageApi(props.currentPageId, props.pageEditFinished, props.context, props.treeFrom, props.treeExpandTo);
// Use props.treeFrom / treeExpandTo value from settings only in display mode "tree"
const treeFrom = (props.pagesToDisplay === PagesToDisplay.Tree) ? props.treeFrom : undefined;
const treeExpandTo = (props.pagesToDisplay === PagesToDisplay.Tree) ? props.treeExpandTo : undefined;
const pagesApi = usePageApi(props.currentPageId, props.pageEditFinished, props.context, treeFrom, treeExpandTo);
let controlToRender = undefined;
switch (props.pagesToDisplay) {
case PagesToDisplay.Ancestors: