Merge pull request #1264 from plamber/master

This commit is contained in:
Hugo Bernier 2020-04-30 01:24:21 -04:00 committed by GitHub
commit a11cb52af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 8770 additions and 9356 deletions

View File

@ -1,11 +1,12 @@
{ {
"@microsoft/generator-sharepoint": { "@microsoft/generator-sharepoint": {
"version": "1.6.0", "version": "1.10.0",
"libraryName": "spfx-api-scopes-tutorial", "libraryName": "spfx-api-scopes-tutorial",
"libraryId": "6b58cc7d-badc-4721-bfe2-9e4d91efd07c", "libraryId": "6b58cc7d-badc-4721-bfe2-9e4d91efd07c",
"environment": "spo", "environment": "spo",
"isCreatingSolution": true,
"packageManager": "npm", "packageManager": "npm",
"isCreatingSolution": true,
"isDomainIsolated": true,
"componentType": "webpart" "componentType": "webpart"
} }
} }

View File

@ -2,7 +2,7 @@
## Summary ## Summary
This sub folders contains a client-side project that is related to the tutorial available at the following URL: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aad-tutorial This sub-folder contains a client-side project that is related to the tutorial available at the following URL: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aad-tutorial
![The UI of the sample application](./images/api-scopes.gif) ![The UI of the sample application](./images/api-scopes.gif)
@ -16,8 +16,9 @@ This sub folders contains a client-side project that is related to the tutorial
| Version | Date | Comments | | Version | Date | Comments |
| ------------- | ------------- | ------------- | | ------------- | ------------- | ------------- |
| 1.0.0 | August 28th 2018 | Updated sample to SPFx v1.6.0 | | 1.0.0 | April 29th, 2020 | Updated sample to SPFx v1.10.0 |
| 1.0.0 | February 18th 2018 | Initial release | | 1.0.0 | August 28th, 2018 | Updated sample to SPFx v1.6.0 |
| 1.0.0 | February 18th, 2018 | Initial release |
## Disclaimer ## Disclaimer

View File

@ -6,6 +6,7 @@
"version": "1.0.0.0", "version": "1.0.0.0",
"includeClientSideAssets": true, "includeClientSideAssets": true,
"skipFeatureDeployment": true, "skipFeatureDeployment": true,
"isDomainIsolated": false,
"webApiPermissionRequests": [ "webApiPermissionRequests": [
{ {
"resource": "Microsoft Graph", "resource": "Microsoft Graph",

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web'); 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.`); build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
build.initialize(gulp); build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
"name": "spfx-api-scopes-tutorial", "name": "spfx-api-scopes-tutorial",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"main": "lib/index.js",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
@ -11,25 +12,31 @@
"test": "gulp test" "test": "gulp test"
}, },
"dependencies": { "dependencies": {
"@microsoft/sp-core-library": "1.6.0", "react": "16.8.5",
"@microsoft/sp-lodash-subset": "1.6.0", "react-dom": "16.8.5",
"@microsoft/sp-office-ui-fabric-core": "1.6.0", "@types/react": "16.8.8",
"@microsoft/sp-webpart-base": "1.6.0", "@types/react-dom": "16.8.3",
"@types/es6-promise": "0.0.33", "office-ui-fabric-react": "6.189.2",
"@types/react": "15.6.6", "@microsoft/sp-core-library": "1.10.0",
"@types/react-dom": "15.5.6", "@microsoft/sp-property-pane": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@types/webpack-env": "1.13.1", "@types/webpack-env": "1.13.1",
"react": "15.6.2", "@types/es6-promise": "0.0.33"
"react-dom": "15.6.2" },
"resolutions": {
"@types/react": "16.8.8"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "1.6.0", "@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-module-interfaces": "1.6.0", "@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.6.0", "@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"gulp": "~3.9.1",
"@types/chai": "3.4.34", "@types/chai": "3.4.34",
"@types/mocha": "2.2.38", "@types/mocha": "2.2.38",
"ajv": "~5.2.2", "ajv": "~5.2.2"
"gulp": "~3.9.1",
"tslint-microsoft-contrib": "5.0.0"
} }
} }

View File

@ -12,6 +12,7 @@
// Components that allow authors to embed arbitrary script code should set this to true. // Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false, "requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"preconfiguredEntries": [{ "preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other "groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other

View File

@ -19,7 +19,7 @@ export interface IGraphConsumerWebPartProps {
export default class GraphConsumerWebPart extends BaseClientSideWebPart<IGraphConsumerWebPartProps> { export default class GraphConsumerWebPart extends BaseClientSideWebPart<IGraphConsumerWebPartProps> {
public render(): void { public render(): void {
const element: React.ReactElement<IGraphConsumerProps > = React.createElement( const element: React.ReactElement<IGraphConsumerProps> = React.createElement(
GraphConsumer, GraphConsumer,
{ {
clientMode: this.properties.clientMode, clientMode: this.properties.clientMode,

View File

@ -1,4 +1,4 @@
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'; @import '~office-ui-fabric-react/dist/sass/_References.scss';
.graphConsumer { .graphConsumer {
.container { .container {

View File

@ -6,18 +6,16 @@ import { IGraphConsumerState } from './IGraphConsumerState';
import { ClientMode } from './ClientMode'; import { ClientMode } from './ClientMode';
import { IUserItem } from './IUserItem'; import { IUserItem } from './IUserItem';
import { escape } from '@microsoft/sp-lodash-subset'; import { escape } from '@microsoft/sp-lodash-subset';
import { import {
autobind,
PrimaryButton, PrimaryButton,
TextField, TextField,
Label,
DetailsList, DetailsList,
DetailsListLayoutMode, DetailsListLayoutMode,
CheckboxVisibility, CheckboxVisibility,
SelectionMode SelectionMode,
BaseButton,
Button
} from 'office-ui-fabric-react'; } from 'office-ui-fabric-react';
import { AadHttpClient, MSGraphClient } from "@microsoft/sp-http"; import { AadHttpClient, MSGraphClient } from "@microsoft/sp-http";
// Configure the columns for the DetailsList component // Configure the columns for the DetailsList component
@ -79,9 +77,9 @@ export default class GraphConsumer extends React.Component<IGraphConsumerProps,
<TextField <TextField
label={ strings.SearchFor } label={ strings.SearchFor }
required={ true } required={ true }
value={ this.state.searchFor } onChange={ this._onSearchForChanged }
onChanged={ this._onSearchForChanged }
onGetErrorMessage={ this._getSearchForErrorMessage } onGetErrorMessage={ this._getSearchForErrorMessage }
value={ this.state.searchFor }
/> />
</p> </p>
<p className={ styles.form }> <p className={ styles.form }>
@ -113,9 +111,8 @@ export default class GraphConsumer extends React.Component<IGraphConsumerProps,
); );
} }
@autobind private _onSearchForChanged = (event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {
private _onSearchForChanged(newValue: string): void {
// Update the component state accordingly to the current user's input // Update the component state accordingly to the current user's input
this.setState({ this.setState({
searchFor: newValue, searchFor: newValue,
@ -129,9 +126,7 @@ export default class GraphConsumer extends React.Component<IGraphConsumerProps,
: `${strings.SearchForValidationErrorMessage}`; : `${strings.SearchForValidationErrorMessage}`;
} }
@autobind private _search = (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement | BaseButton | Button, MouseEvent>) : void => {
private _search(): void {
console.log(this.props.clientMode); console.log(this.props.clientMode);
// Based on the clientMode value search users // Based on the clientMode value search users

View File

@ -1,15 +1,19 @@
{ {
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"module": "esnext", "module": "esnext",
"moduleResolution": "node",
"jsx": "react", "jsx": "react",
"declaration": true, "declaration": true,
"sourceMap": true, "sourceMap": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "node",
"skipLibCheck": true, "skipLibCheck": true,
"outDir": "lib", "outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"typeRoots": [ "typeRoots": [
"./node_modules/@types", "./node_modules/@types",
"./node_modules/@microsoft" "./node_modules/@microsoft"
@ -31,4 +35,4 @@
"node_modules", "node_modules",
"lib" "lib"
] ]
} }

View File

@ -1,7 +1,5 @@
{ {
"rulesDirectory": [ "extends": "@microsoft/sp-tslint-rules/base-tslint.json",
"tslint-microsoft-contrib"
],
"rules": { "rules": {
"class-name": false, "class-name": false,
"export-name": false, "export-name": false,
@ -29,4 +27,4 @@
"variable-name": false, "variable-name": false,
"whitespace": false "whitespace": false
} }
} }