chore(react-tree-orgchart): update to spfx 1.10.0

This commit is contained in:
Jake Stanger 2020-01-28 13:45:12 +00:00
parent b87f54e86c
commit 3156c3f710
5 changed files with 9096 additions and 5931 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,10 +11,10 @@
"test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.7.1-plusbeta",
"@microsoft/sp-lodash-subset": "1.7.1-plusbeta",
"@microsoft/sp-office-ui-fabric-core": "1.7.1-plusbeta",
"@microsoft/sp-webpart-base": "1.7.1-plusbeta",
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@pnp/common": "^1.2.9",
"@pnp/graph": "^1.2.9",
"@pnp/logging": "^1.2.9",
@ -34,10 +34,11 @@
"@types/react": "16.4.2"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.7.1-plusbeta",
"@microsoft/sp-tslint-rules": "1.7.1-plusbeta",
"@microsoft/sp-module-interfaces": "1.7.1-plusbeta",
"@microsoft/sp-webpart-workbench": "1.7.1-plusbeta",
"@microsoft/rush-stack-compiler-3.7": "^0.2.3",
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"gulp": "~3.9.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",

View File

@ -1,24 +1,14 @@
import { WebPartContext } from "@microsoft/sp-webpart-base";
import { graph } from "@pnp/graph";
import { sp } from '@pnp/sp';
import { ITreeChildren } from "../webparts/treeOrgChart/components/ITreeChildren";
export default class spservices {
constructor(private context:WebPartContext) {
constructor(private context: WebPartContext) {
sp.setup({
spfxContext: this.context
});
}
public async getUserProperties(user:string){
public async getUserProperties(user:string) {
let currentUserProperties:any = await sp.profiles.getPropertiesFor(user);
console.log(currentUserProperties);
@ -27,7 +17,8 @@ export default class spservices {
/**
* async GetUserProfileProperty
user:string */
* user:string
*/
public async getUserProfileProperty(user:string,property:string) {
let UserProperty:any = await sp.profiles.getUserProfilePropertyFor(user, property);
console.log(UserProperty);

View File

@ -6,11 +6,10 @@ import * as React from 'react';
import styles from './TreeOrgChart.module.scss';
import { ITreeOrgChartProps } from './ITreeOrgChartProps';
import { ITreeOrgChartState } from './ITreeOrgChartState';
import { escape } from '@microsoft/sp-lodash-subset';
import SortableTree from 'react-sortable-tree';
import 'react-sortable-tree/style.css';
import { IPersonaSharedProps, Persona, PersonaSize, PersonaPresence } from 'office-ui-fabric-react/lib/Persona';
import { IconButton, IButtonProps } from 'office-ui-fabric-react/lib/Button';
import { IPersonaSharedProps, Persona, PersonaSize } from 'office-ui-fabric-react/lib/Persona';
import { IconButton } from 'office-ui-fabric-react/lib/Button';
import { WebPartTitle } from "@pnp/spfx-controls-react/lib/WebPartTitle";
import spservice from '../../../services/spservices';
import { ITreeChildren } from './ITreeChildren';
@ -19,7 +18,6 @@ import { Spinner, SpinnerSize } from 'office-ui-fabric-react/lib/components/Spin
export default class TreeOrgChart extends React.Component<ITreeOrgChartProps, ITreeOrgChartState> {
private treeData: ITreeData[];
private treeChildren: ITreeChildren[];
private SPService: spservice;
constructor(props) {
@ -56,18 +54,16 @@ export default class TreeOrgChart extends React.Component<ITreeOrgChartProps, IT
// Test if show only my Team or All Organization Chart
if (!this.props.currentUserTeam) {
const treeManagers = await this.buildOrganizationChart(currentUserProperties);
treeManagers ?
this.treeData.push(treeManagers)
: null;
if (treeManagers)
this.treeData.push(treeManagers);
} else {
const treeManagers = await this.buildMyTeamOrganizationChart(currentUserProperties);
treeManagers ?
if (treeManagers)
this.treeData.push({
title: (treeManagers.person),
expanded: true,
children: treeManagers.treeChildren
})
: null;
});
}
console.log(JSON.stringify(this.treeData));
this.setState({ treeData: this.treeData, isLoading: false });
@ -79,7 +75,7 @@ export default class TreeOrgChart extends React.Component<ITreeOrgChartProps, IT
*/
public async buildOrganizationChart(currentUserProperties: any) {
// Get Managers
let treeManagers: ITreeData = null;
let treeManagers: ITreeData | null = null;
if (currentUserProperties.ExtendedManagers && currentUserProperties.ExtendedManagers.length > 0) {
treeManagers = await this.getUsers(currentUserProperties.ExtendedManagers[0]);
}
@ -179,7 +175,7 @@ export default class TreeOrgChart extends React.Component<ITreeOrgChartProps, IT
const usersDirectReports: any[] = await this.getChildren(currentUserProperties.DirectReports);
// Current USer Has Manager
if (hasManager) {
treeChildren.push({ title: (meCard), expanded: true, children: usersDirectReports })
treeChildren.push({ title: (meCard), expanded: true, children: usersDirectReports });
}else{
treeChildren = usersDirectReports;

View File

@ -1,4 +1,5 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.7/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,