Merge pull request #1954 from AriGunawan/features/add_support_for_homepage

This commit is contained in:
Hugo Bernier 2021-07-11 00:49:13 -04:00 committed by GitHub
commit abef47034a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 873 additions and 702 deletions

View File

@ -1,6 +1,6 @@
{
"bundles": {
"page-contributors-web-part": {
"hero-webpart-web-part": {
"dependencies": [
{
"componentId": "f9e737b7-f0df-4597-ba8c-3060f82380db",

View File

@ -0,0 +1,153 @@
{
"id": "71d58a4f-1896-46aa-94a5-dbef33d14166",
"alias": "HeroWebpartWebPart",
"componentType": "WebPart",
"version": "0.0.1",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": [
"SharePointWebPart"
],
"preconfiguredEntries": [
{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70",
"group": {
"default": "Other"
},
"title": {
"default": "Hero Layout Webpart"
},
"description": {
"default": "Provides a customisable Hero webpart that displays 5 images in a standlone or carousel view"
},
"officeFabricIconFontName": "Page",
"properties": {
"description": "Hero Layout Webpart",
"isPaginated": false,
"hideFirstPageJump": false,
"hideLastPageJump": false,
"showAllHero": false
}
}
],
"loaderConfig": {
"internalModuleBaseUrls": [
"<!-- PATH TO CDN -->"
],
"entryModuleId": "hero-webpart-web-part",
"scriptResources": {
"hero-webpart-web-part": {
"type": "path",
"path": "hero-webpart-web-part.js"
},
"@microsoft/sp-property-pane": {
"type": "component",
"id": "f9e737b7-f0df-4597-ba8c-3060f82380db",
"version": "1.12.1"
},
"@microsoft/sp-lodash-subset": {
"type": "component",
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a",
"version": "1.12.1"
},
"ControlStrings": {
"type": "localizedPath",
"paths": {
"bg-BG": "ControlStrings_bg-bg.js",
"ca-ES": "ControlStrings_ca-es.js",
"da-DK": "ControlStrings_da-dk.js",
"de-DE": "ControlStrings_de-de.js",
"el-GR": "ControlStrings_el-gr.js",
"en-US": "ControlStrings_en-us.js",
"es-ES": "ControlStrings_es-es.js",
"et-EE": "ControlStrings_et-ee.js",
"eu-ES": "ControlStrings_eu-es.js",
"fi-FI": "ControlStrings_fi-fi.js",
"fr-CA": "ControlStrings_fr-ca.js",
"fr-FR": "ControlStrings_fr-fr.js",
"it-IT": "ControlStrings_it-it.js",
"ja-JP": "ControlStrings_ja-jp.js",
"lt-LT": "ControlStrings_lt-lt.js",
"lv-LV": "ControlStrings_lv-lv.js",
"nb-NO": "ControlStrings_nb-no.js",
"nl-NL": "ControlStrings_nl-nl.js",
"pl-PL": "ControlStrings_pl-pl.js",
"pt-PT": "ControlStrings_pt-pt.js",
"ro-RO": "ControlStrings_ro-ro.js",
"ru-RU": "ControlStrings_ru-ru.js",
"sk-SK": "ControlStrings_sk-sk.js",
"sr-Latn-RS": "ControlStrings_sr-latn-rs.js",
"sv-SE": "ControlStrings_sv-se.js",
"tr-TR": "ControlStrings_tr-tr.js",
"vi-VN": "ControlStrings_vi-vn.js",
"zh-CN": "ControlStrings_zh-cn.js",
"zh-TW": "ControlStrings_zh-tw.js"
},
"defaultPath": "ControlStrings_en-us.js"
},
"@microsoft/sp-core-library": {
"type": "component",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
"version": "1.12.1"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0",
"version": "1.12.1"
},
"react": {
"type": "component",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"version": "16.9.0"
},
"react-dom": {
"type": "component",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"version": "16.9.0"
},
"HeroWebpartWebPartStrings": {
"type": "path",
"path": "HeroWebpartWebPartStrings_en-us.js"
},
"@microsoft/sp-http": {
"type": "component",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6",
"version": "1.12.1"
},
"PropertyControlStrings": {
"type": "localizedPath",
"paths": {
"bg-BG": "PropertyControlStrings_bg-bg.js",
"ca-ES": "PropertyControlStrings_ca-es.js",
"da-DK": "PropertyControlStrings_da-dk.js",
"de-DE": "PropertyControlStrings_de-de.js",
"el-GR": "PropertyControlStrings_el-gr.js",
"en-US": "PropertyControlStrings_en-us.js",
"es-ES": "PropertyControlStrings_es-es.js",
"et-EE": "PropertyControlStrings_et-ee.js",
"fi-FI": "PropertyControlStrings_fi-fi.js",
"fr-FR": "PropertyControlStrings_fr-fr.js",
"it-IT": "PropertyControlStrings_it-it.js",
"ja-JP": "PropertyControlStrings_ja-jp.js",
"lt-LT": "PropertyControlStrings_lt-lt.js",
"lv-LV": "PropertyControlStrings_lv-lv.js",
"nb-NO": "PropertyControlStrings_nb-no.js",
"nl-NL": "PropertyControlStrings_nl-nl.js",
"no": "PropertyControlStrings_no.js",
"pl-PL": "PropertyControlStrings_pl-pl.js",
"pt-PT": "PropertyControlStrings_pt-pt.js",
"ro-RO": "PropertyControlStrings_ro-ro.js",
"ru-RU": "PropertyControlStrings_ru-ru.js",
"sk-SK": "PropertyControlStrings_sk-sk.js",
"sr-Latn-RS": "PropertyControlStrings_sr-latn-rs.js",
"sv-SE": "PropertyControlStrings_sv-se.js",
"tr-TR": "PropertyControlStrings_tr-tr.js",
"vi-VN": "PropertyControlStrings_vi-vn.js",
"zh-CN": "PropertyControlStrings_zh-cn.js",
"zh-TW": "PropertyControlStrings_zh-tw.js"
},
"defaultPath": "PropertyControlStrings_en-us.js"
}
}
}
}

View File

@ -12,6 +12,7 @@ lib
solution
temp
*.sppkg
release
# Coverage directory used by tools like istanbul
coverage
@ -30,5 +31,3 @@ obj
# Styles Generated Code
*.scss.ts
release

View File

@ -26,7 +26,7 @@ Displays page contributors in reverse chronological order.
## Compatibility
![SPFx 1.12.1](https://img.shields.io/badge/SPFx-1.12.1-green.svg)
![Node.js LTS 10.x](https://img.shields.io/badge/Node.js-LTS%2010.x-green.svg)
![Node.js LTS 14.x](https://img.shields.io/badge/Node.js-LTS%2014.x-green.svg)
![SharePoint Online](https://img.shields.io/badge/SharePoint-Online-yellow.svg)
![Teams N/A: Untested with Microsoft Teams](https://img.shields.io/badge/Teams-N%2FA-lightgrey.svg "Untested with Microsoft Teams")
![Workbench Local | Hosted](https://img.shields.io/badge/Workbench-Local%20%7C%20Hosted-green.svg)
@ -51,6 +51,7 @@ Version|Date|Comments
-------|----|--------
1.0.0|July 27, 2017|Initial release
1.1.0|May 23, 2021|Update SPFx (v1.12.1) version and replace sp-pnp-js with @pnp/sp (v2.5)
1.2.0|July 5, 2021|Add support for homepage page
## Minimal Path to Awesome

View File

@ -9,7 +9,7 @@
"Displays page contributors in reverse chronological order."
],
"creationDateTime": "2017-07-27",
"updateDateTime": "2021-05-23",
"updateDateTime": "2021-07-05",
"products": [
"SharePoint",
"Office"

View File

@ -3,7 +3,7 @@
"solution": {
"name": "react-pagecontributors-client-side-solution",
"id": "1c18830a-4c18-4b82-a571-77863b19c66d",
"version": "1.1.0.0",
"version": "1.2.0.0",
"skipFeatureDeployment": true,
"developer": {
"name": "",

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +0,0 @@
{
"id": "dfb5229a-c1c3-4e98-870b-c40dd6e4ec4b",
"alias": "PageContributorsWebPart",
"componentType": "WebPart",
"version": "1.0.0",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": [
"SharePointWebPart"
],
"preconfiguredEntries": [
{
"groupId": "dfb5229a-c1c3-4e98-870b-c40dd6e4ec4b",
"group": {
"default": "Other"
},
"title": {
"default": "Page Contributors"
},
"description": {
"default": "Displays page contributors in reverse chronological order"
},
"officeFabricIconFontName": "People",
"properties": {
"numberOfFaces": 5,
"personaSize": 3
}
}
],
"loaderConfig": {
"internalModuleBaseUrls": [
"https://localhost:4321/dist/"
],
"entryModuleId": "page-contributors-web-part",
"scriptResources": {
"page-contributors-web-part": {
"type": "path",
"path": "page-contributors-web-part_4d2033f670297cd13b0c.js"
},
"@microsoft/sp-property-pane": {
"type": "component",
"id": "f9e737b7-f0df-4597-ba8c-3060f82380db",
"version": "1.12.1"
},
"@microsoft/sp-core-library": {
"type": "component",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
"version": "1.12.1"
},
"pageContributorsStrings": {
"type": "path",
"path": "pageContributorsStrings_en-us_6ae41e2edb727df21538267edcd92249.js"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0",
"version": "1.12.1"
},
"react": {
"type": "component",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"version": "16.9.0"
},
"react-dom": {
"type": "component",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"version": "16.9.0"
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,17 +0,0 @@
define([], function() {
return {
"PropertyPaneDescription": "Displays page contributors in reverse chronological order",
"PropertyPaneNbPersonasText": "Maximum number of persons to display",
"PropertyPaneBasicGroupName": "General",
"PropertyPanePersonaSizeText": "Icons size",
"PropertyPaneIconsSizeTiny": "tiny",
"PropertyPaneIconsSizeEES": "extraExtraSmall",
"PropertyPaneIconsSizeES": "extraSmall",
"PropertyPaneIconsSizeS": "small",
"PropertyPaneIconsSizeR": "regular",
"PropertyPaneIconsSizeL": "large",
"PropertyPaneIconsSizeEL": "extraLarge",
"PropertyPanePageUrlText": "Page server relative URL (leave empty for current page)",
"Loading": "Loading..."
}
});

View File

@ -1,71 +0,0 @@
{
"id": "dfb5229a-c1c3-4e98-870b-c40dd6e4ec4b",
"alias": "PageContributorsWebPart",
"componentType": "WebPart",
"version": "1.0.0",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": [
"SharePointWebPart"
],
"preconfiguredEntries": [
{
"groupId": "dfb5229a-c1c3-4e98-870b-c40dd6e4ec4b",
"group": {
"default": "Other"
},
"title": {
"default": "Page Contributors"
},
"description": {
"default": "Displays page contributors in reverse chronological order"
},
"officeFabricIconFontName": "People",
"properties": {
"numberOfFaces": 5,
"personaSize": 3
}
}
],
"loaderConfig": {
"internalModuleBaseUrls": [
"<!-- PATH TO CDN -->"
],
"entryModuleId": "page-contributors-web-part",
"scriptResources": {
"page-contributors-web-part": {
"type": "path",
"path": "page-contributors-web-part_4d2033f670297cd13b0c.js"
},
"@microsoft/sp-property-pane": {
"type": "component",
"id": "f9e737b7-f0df-4597-ba8c-3060f82380db",
"version": "1.12.1"
},
"@microsoft/sp-core-library": {
"type": "component",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
"version": "1.12.1"
},
"pageContributorsStrings": {
"type": "path",
"path": "pageContributorsStrings_en-us_6ae41e2edb727df21538267edcd92249.js"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0",
"version": "1.12.1"
},
"react": {
"type": "component",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"version": "16.9.0"
},
"react-dom": {
"type": "component",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"version": "16.9.0"
}
}
}
}

View File

@ -1,71 +0,0 @@
{
"id": "dfb5229a-c1c3-4e98-870b-c40dd6e4ec4b",
"alias": "PageContributorsWebPart",
"componentType": "WebPart",
"version": "1.0.0",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": [
"SharePointWebPart"
],
"preconfiguredEntries": [
{
"groupId": "dfb5229a-c1c3-4e98-870b-c40dd6e4ec4b",
"group": {
"default": "Other"
},
"title": {
"default": "Page Contributors"
},
"description": {
"default": "Displays page contributors in reverse chronological order"
},
"officeFabricIconFontName": "People",
"properties": {
"numberOfFaces": 5,
"personaSize": 3
}
}
],
"loaderConfig": {
"internalModuleBaseUrls": [
"<!-- PATH TO CDN -->"
],
"entryModuleId": "page-contributors-web-part",
"scriptResources": {
"page-contributors-web-part": {
"type": "path",
"path": "page-contributors-web-part_4d2033f670297cd13b0c.js"
},
"@microsoft/sp-property-pane": {
"type": "component",
"id": "f9e737b7-f0df-4597-ba8c-3060f82380db",
"version": "1.12.1"
},
"@microsoft/sp-core-library": {
"type": "component",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
"version": "1.12.1"
},
"pageContributorsStrings": {
"type": "path",
"path": "pageContributorsStrings_en-us_6ae41e2edb727df21538267edcd92249.js"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0",
"version": "1.12.1"
},
"react": {
"type": "component",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"version": "16.9.0"
},
"react-dom": {
"type": "component",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"version": "16.9.0"
}
}
}
}

View File

@ -28,11 +28,15 @@ export default class PagecontributionWebPart extends BaseClientSideWebPart<IPage
React.createElement(PageContributors, {
personaSize: this.properties.personaSize,
numberOfFaces: this.properties.numberOfFaces,
pageUrl: this.properties.pageUrl
pageUrl: this.properties.pageUrl || this.getCurrentPageRelativeUrl()
})
, this.domElement);
}
private getCurrentPageRelativeUrl(): string {
return this.context.pageContext.legacyPageContext.serverRequestPath;
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}

View File

@ -160,7 +160,7 @@ export default class PageContributors extends React.Component<IPageContributorsP
}
else if (Environment.type == EnvironmentType.SharePoint ||
Environment.type == EnvironmentType.ClassicSharePoint) {
PageContributorsService.getPageContributors(this.props.pageUrl || location.pathname).then(
PageContributorsService.getPageContributors(this.props.pageUrl).then(
(response) => {
this._setContributors(response);
},