Upgraded to SPFx v1.14. Issue 2442 fixed (using latest mgt version)

This commit is contained in:
Luis Mañez 2022-03-16 17:59:57 +01:00
parent 6e5b871e9c
commit dd791d23bb
10 changed files with 13891 additions and 9054 deletions

View File

@ -1,5 +1,6 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"environment": "spo",
"version": "1.11.0",
@ -7,6 +8,7 @@
"libraryId": "9ac063b7-aed6-4fcb-a226-5813ac363fad",
"packageManager": "npm",
"isDomainIsolated": false,
"skipFeatureDeployment": true,
"componentType": "webpart"
}
}

View File

@ -9,12 +9,11 @@ This web part allows you to add images to a SharePoint List, and renders them wi
## Compatibility
![SPFx 1.11](https://img.shields.io/badge/SPFx-1.11-green.svg)
![Node.js v10](https://img.shields.io/badge/Node.js-v10-green.svg)
![SPFx 1.14](https://img.shields.io/badge/SPFx-1.14-green.svg)
![Node.js v14](https://img.shields.io/badge/Node.js-v14-green.svg)
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg)
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
![Local Workbench Compatible](https://img.shields.io/badge/Local%20Workbench-Compatible-green.svg)
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
@ -27,6 +26,8 @@ This web part allows you to add images to a SharePoint List, and renders them wi
## Prerequisites
- Before deploying your SharePoint Framework package to your tenant, you will need to deploy the @microsoft/mgt-spfx SharePoint Framework package to your tenant. You can download the package corresponding to the version of @microsoft/mgt-spfx that you used in your project, from the [Releases](https://github.com/microsoftgraph/microsoft-graph-toolkit/releases) section on GitHub.
See here for more information about using Microsoft Graph Toolkit components in SPFx: https://docs.microsoft.com/en-gb/graph/toolkit/get-started/mgt-spfx
- A SharePoint list called "Stories" with the following fields:
- Image: image field type
- Content: multi-line field type
@ -45,11 +46,14 @@ react-company-stories | Luis Mañez (MVP, [ClearPeople](http://www.clearpeople.c
Version|Date|Comments
-------|----|--------
1.0|March 31, 2021|Initial release
2.0|March 16, 2022|Upgraded to SPFx v1.14. Issue 2442 fixed. Using latest MGT version
## Minimal Path to Awesome
- Before deploying your SharePoint Framework package to your tenant, you will need to deploy the @microsoft/mgt-spfx SharePoint Framework package to your tenant. You can download the package corresponding to the version of @microsoft/mgt-spfx that you used in your project, from the [Releases](https://github.com/microsoftgraph/microsoft-graph-toolkit/releases) section on GitHub.
See here for more information about using Microsoft Graph Toolkit components in SPFx: https://docs.microsoft.com/en-gb/graph/toolkit/get-started/mgt-spfx
- Configure SharePoint permissions to Graph API (see Prerequisites). Suggest you to use the [Microsoft 365 CLI](https://blog.mastykarz.nl/grant-api-permissions-office-365-cli/)
- Clone this repository
- Ensure that you are at the solution folder
@ -84,6 +88,4 @@ About SPFx:
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
<img src="https://pnptelemetry.azurewebsites.net/sp-dev-fx-webparts/samples/react-company-stories" />

View File

@ -4,4 +4,13 @@ const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -12,33 +12,31 @@
"test": "gulp test"
},
"dependencies": {
"@microsoft/mgt": "^1.3.6",
"@microsoft/mgt-react": "^2.0.0-preview.8",
"@microsoft/sp-core-library": "1.11.0",
"@microsoft/sp-lodash-subset": "1.11.0",
"@microsoft/sp-office-ui-fabric-core": "1.11.0",
"@microsoft/sp-property-pane": "1.11.0",
"@microsoft/sp-webpart-base": "1.11.0",
"@pnp/spfx-controls-react": "2.2.0",
"office-ui-fabric-react": "6.214.0",
"react": "16.8.5",
"react-dom": "16.8.5",
"react-insta-stories": "^2.1.3"
"@microsoft/decorators": "1.14.0",
"@microsoft/mgt-spfx": "^2.4.0",
"@microsoft/sp-core-library": "1.14.0",
"@microsoft/sp-dialog": "1.14.0",
"@microsoft/sp-listview-extensibility": "1.14.0",
"@microsoft/sp-lodash-subset": "1.14.0",
"@microsoft/sp-office-ui-fabric-core": "1.14.0",
"@microsoft/sp-property-pane": "1.14.0",
"@microsoft/sp-webpart-base": "1.14.0",
"@microsoft/sp-webpart-workbench": "^1.12.1",
"@pnp/spfx-controls-react": "3.6.0",
"office-ui-fabric-react": "7.174.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-insta-stories": "^2.3.0"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"@microsoft/rush-stack-compiler-3.7": "^0.6.35",
"@microsoft/sp-build-web": "1.11.0",
"@microsoft/sp-module-interfaces": "1.11.0",
"@microsoft/sp-tslint-rules": "1.11.0",
"@microsoft/sp-webpart-workbench": "1.11.0",
"@types/chai": "3.4.34",
"@types/es6-promise": "0.0.33",
"@types/mocha": "2.2.38",
"@types/react": "16.8.8",
"@types/react-dom": "16.8.3",
"@types/webpack-env": "1.13.1",
"@types/react": "16.9.51",
"@types/react-dom": "16.9.8",
"@microsoft/sp-build-web": "1.14.0",
"@microsoft/sp-tslint-rules": "1.14.0",
"@microsoft/sp-module-interfaces": "1.14.0",
"@microsoft/rush-stack-compiler-3.9": "0.4.47",
"gulp": "~4.0.2",
"ajv": "~5.2.2",
"gulp": "~3.9.1"
"@types/webpack-env": "1.13.1"
}
}

View File

@ -11,7 +11,7 @@ import * as strings from 'SharePointStoriesWebPartStrings';
import SharePointStories from './components/SharePointStories';
import { ISharePointStoriesProps } from './components/ISharePointStoriesProps';
import { Providers, SharePointProvider } from '@microsoft/mgt';
import { Providers, SharePointProvider } from '@microsoft/mgt-spfx';
export interface ISharePointStoriesWebPartProps {
description: string;
@ -20,7 +20,9 @@ export interface ISharePointStoriesWebPartProps {
export default class SharePointStoriesWebPart extends BaseClientSideWebPart<ISharePointStoriesWebPartProps> {
protected async onInit(): Promise<void> {
Providers.globalProvider = new SharePointProvider(this.context);
if (!Providers.globalProvider) {
Providers.globalProvider = new SharePointProvider(this.context);
}
}
public render(): void {

View File

@ -4,10 +4,9 @@ import { ISharePointStoriesProps } from "./ISharePointStoriesProps";
import { ISharePointStoriesState } from "./ISharePointStoriesState";
import Stories from "react-insta-stories";
import { SPHttpClient} from '@microsoft/sp-http';
import { Header, Renderer, Story } from "react-insta-stories/dist/interfaces";
import { WithHeader } from 'react-insta-stories';
import { Person } from '@microsoft/mgt-react';
import { PersonViewType } from "@microsoft/mgt";
import { Renderer, Story } from "react-insta-stories/dist/interfaces";
import { Person } from '@microsoft/mgt-react/dist/es6/spfx';
import { PersonViewType } from '@microsoft/mgt-spfx';
import { WithSeeMore } from 'react-insta-stories';
export default class SharePointStories extends React.Component<ISharePointStoriesProps, ISharePointStoriesState> {
@ -63,9 +62,9 @@ export default class SharePointStories extends React.Component<ISharePointStorie
padding: 0
};
var storyRenderer: Renderer = ({ action, isPaused, story, config}) => {
return <WithSeeMore story={story} action={action}>
<div style={{ ...contentStyle, backgroundImage: `url("${story.url}")`, backgroundRepeat: 'no-repeat', paddingTop: '50px' }}>
var storyRenderer: Renderer = ({ action, isPaused, story: thisStory, config}) => {
return <WithSeeMore story={thisStory} action={action}>
<div style={{ ...contentStyle, backgroundImage: `url("${thisStory.url}")`, backgroundRepeat: 'no-repeat', paddingTop: '50px' }}>
<div>
<Person userId={authorId} avatarSize={'large'} view={PersonViewType.twolines} />
</div>

View File

@ -1,5 +1,5 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.7/includes/tsconfig-web.json",
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.9/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
@ -19,21 +19,17 @@
"./node_modules/@microsoft"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
],
"exclude": [
"node_modules",
"lib"
]
}

View File

@ -1,5 +1,5 @@
{
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
"extends": "./node_modules/@microsoft/sp-tslint-rules/base-tslint.json",
"rules": {
"class-name": false,
"export-name": false,
@ -26,4 +26,4 @@
"variable-name": false,
"whitespace": false
}
}
}