Skip to content

Commit 244b27c

Browse files
authored
Merge pull request #1863 from microsoftgraph/next/wc-registration-samples
feat: no-framework spfx webpart
2 parents 38d8b01 + 6363b76 commit 244b27c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+794
-117
lines changed

lerna.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"samples/angular-app",
77
"samples/vue-app",
88
"samples/electron-app",
9-
"samples/sp-webpart"
9+
"samples/sp-webpart",
10+
"samples/sp-mgt"
1011
],
1112
"npmClient": "yarn",
1213
"useWorkspaces": true,

package.json

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,35 @@
22
"name": "root",
33
"private": true,
44
"version": "3.0.0",
5-
"workspaces": [
6-
"packages/*",
7-
"packages/providers/*",
8-
"samples/react-app",
9-
"samples/angular-app",
10-
"samples/vue-app",
11-
"samples/electron-app",
12-
"samples/sp-webpart",
13-
"samples/teamsfx-app/tabs"
14-
],
5+
"workspaces": {
6+
"packages": [
7+
"packages/*",
8+
"packages/providers/*",
9+
"samples/react-app",
10+
"samples/angular-app",
11+
"samples/vue-app",
12+
"samples/electron-app",
13+
"samples/sp-webpart",
14+
"samples/sp-mgt",
15+
"samples/teamsfx-app/tabs"
16+
],
17+
"nohoist": [
18+
"**/@microsoft/sp*",
19+
"**/@microsoft/eslint*",
20+
"**/@rushstack/*"
21+
]
22+
},
1523
"scripts": {
1624
"build": "npm run prettier:check && npm run clean && lerna run build --scope @microsoft/*",
1725
"build:compile": "npm run prettier:check && npm run clean && lerna run build:compile --scope @microsoft/*",
1826
"build:mgt": "cd ./packages/mgt && npm run build",
1927
"build:mgt-element": "cd ./packages/mgt-element && npm run build",
2028
"build:mgt-components": "cd ./packages/mgt-components && npm run build",
2129
"build:mgt-react": "lerna run build --scope @microsoft/mgt-react",
30+
"build:sp-webpart": "lerna run build --scope mgt-demo",
31+
"build:sp-mgt": "lerna run build --scope sp-mgt-no-framework",
32+
"package:sp-webpart": "lerna run package --scope mgt-demo",
33+
"package:sp-mgt": "lerna run package --scope sp-mgt-no-framework",
2234
"bundle": "cd ./packages/mgt && npm run bundle",
2335
"bootstrap": "lerna bootstrap --useWorkspaces",
2436
"clean": "lerna run --parallel --stream --scope @microsoft/* clean",

packages/mgt-components/src/components/components.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import './mgt-people-picker/mgt-people-picker';
1414
import './mgt-people/mgt-people';
1515
import './mgt-person-card/mgt-person-card';
1616
import './mgt-person/mgt-person';
17+
import './mgt-person/mgt-person-types';
1718
import './mgt-tasks/mgt-tasks';
1819
import './mgt-teams-channel-picker/mgt-teams-channel-picker';
1920
import './mgt-todo/mgt-todo';
@@ -27,6 +28,7 @@ export * from './mgt-people-picker/mgt-people-picker';
2728
export * from './mgt-people/mgt-people';
2829
export * from './mgt-person-card/mgt-person-card';
2930
export * from './mgt-person/mgt-person';
31+
export * from './mgt-person/mgt-person-types';
3032
export * from './mgt-tasks/mgt-tasks';
3133
export * from './mgt-teams-channel-picker/mgt-teams-channel-picker';
3234
export * from './mgt-todo/mgt-todo';

packages/mgt-components/src/components/mgt-login/mgt-login.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import {
2020
import { AvatarSize, IDynamicPerson, ViewType } from '../../graph/types';
2121
import { MgtFlyout } from '../sub-components/mgt-flyout/mgt-flyout';
2222
import { getUserWithPhoto } from '../../graph/graph.userWithPhoto';
23-
import { MgtPerson, PersonViewType } from '../mgt-person/mgt-person';
23+
import { MgtPerson } from '../mgt-person/mgt-person';
24+
import { PersonViewType } from '../mgt-person/mgt-person-types';
2425

2526
import { getSvg, SvgIcon } from '../../utils/SvgHelper';
2627

packages/mgt-components/src/components/mgt-people-picker/mgt-people-picker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
12321232
*/
12331233
private async getGroupsForGroupIds(graph: IGraph, people: IDynamicPerson[]) {
12341234
const groups = await getGroupsForGroupIds(graph, this.groupIds, this.groupFilters);
1235-
for (let group of groups as IDynamicPerson[]) {
1235+
for (const group of groups as IDynamicPerson[]) {
12361236
people = people.concat(group);
12371237
}
12381238
people = people.filter(person => person);

packages/mgt-components/src/components/mgt-person-card/mgt-person-card.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,18 +755,18 @@ export class MgtPersonCard extends MgtTemplatedComponent {
755755
active: i === currentSectionIndex,
756756
'section-nav__icon': true
757757
});
758-
const tagName = section.tagName;
759-
const ariaLabel = tagName.substring(16, tagName.length).toLowerCase();
758+
760759
return html`
761760
<fluent-tab
762761
id="${name}-Tab"
763762
class=${classes}
764763
slot="tab"
765764
@keyup="${() => this.updateCurrentSection(section)}"
766-
@click=${() => this.updateCurrentSection(section)}>
765+
@click=${() => this.updateCurrentSection(section)}
766+
>
767767
${section.renderIcon()}
768768
</fluent-tab>
769-
`;
769+
`;
770770
});
771771

772772
const additionalPanelTemplates = this.sections.map((section, i) => {

packages/mgt-components/src/components/mgt-person-card/sections/mgt-person-card-organization/mgt-person-card-organization.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,13 @@ export class MgtPersonCardOrganization extends BasePersonCardSection {
170170
*/
171171
protected renderManager(person: User): TemplateResult {
172172
return mgtHtml`
173-
<div class="org-member" @keydown=${(e: KeyboardEvent) => {
174-
e.code === 'Enter' ? this.navigateCard(person) : '';
175-
}} @click=${() => this.navigateCard(person)}>
173+
<div
174+
class="org-member"
175+
@keydown=${(e: KeyboardEvent) => {
176+
e.code === 'Enter' ? this.navigateCard(person) : '';
177+
}}
178+
@click=${() => this.navigateCard(person)}
179+
>
176180
<div class="org-member__person">
177181
<mgt-person
178182
.personDetails=${person}
@@ -235,9 +239,13 @@ export class MgtPersonCardOrganization extends BasePersonCardSection {
235239
<div>
236240
${directReports.map(
237241
person => mgtHtml`
238-
<div class="org-member org-member--direct-report" @keydown=${(e: KeyboardEvent) => {
239-
e.code === 'Enter' ? this.navigateCard(person) : '';
240-
}} @click=${() => this.navigateCard(person)}>
242+
<div
243+
class="org-member org-member--direct-report"
244+
@keydown=${(e: KeyboardEvent) => {
245+
e.code === 'Enter' ? this.navigateCard(person) : '';
246+
}}
247+
@click=${() => this.navigateCard(person)}
248+
>
241249
<div class="org-member__person">
242250
<mgt-person
243251
.personDetails=${person}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Enumeration to define what parts of the person component render
3+
*
4+
* @export
5+
* @enum {number}
6+
*/
7+
8+
export enum PersonViewType {
9+
/**
10+
* Render only the avatar
11+
*/
12+
avatar = 2,
13+
14+
/**
15+
* Render the avatar and one line of text
16+
*/
17+
oneline = 3,
18+
19+
/**
20+
* Render the avatar and two lines of text
21+
*/
22+
twolines = 4,
23+
24+
/**
25+
* Render the avatar and three lines of text
26+
*/
27+
threelines = 5,
28+
29+
/**
30+
* Render the avatar and four lines of text
31+
*/
32+
fourlines = 6
33+
}
34+
35+
export enum avatarType {
36+
/**
37+
* Renders avatar photo if available, falls back to initials
38+
*/
39+
photo = 'photo',
40+
41+
/**
42+
* Forces render avatar initials
43+
*/
44+
initials = 'initials'
45+
}
46+
47+
/**
48+
* Configuration object for the Person component
49+
*
50+
* @export
51+
* @interface MgtPersonConfig
52+
*/
53+
export interface MgtPersonConfig {
54+
/**
55+
* Sets or gets whether the person component can use Contacts APIs to
56+
* find contacts and their images
57+
*
58+
* @type {boolean}
59+
*/
60+
useContactApis: boolean;
61+
}

packages/mgt-components/src/components/mgt-person/mgt-person.ts

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -23,70 +23,10 @@ import '../sub-components/mgt-flyout/mgt-flyout';
2323
import { MgtFlyout } from '../sub-components/mgt-flyout/mgt-flyout';
2424
import { PersonCardInteraction } from './../PersonCardInteraction';
2525
import { styles } from './mgt-person-css';
26+
import { PersonViewType, MgtPersonConfig, avatarType } from './mgt-person-types';
2627

2728
export { PersonCardInteraction } from '../PersonCardInteraction';
2829

29-
/**
30-
* Enumeration to define what parts of the person component render
31-
*
32-
* @export
33-
* @enum {number}
34-
*/
35-
export enum PersonViewType {
36-
/**
37-
* Render only the avatar
38-
*/
39-
avatar = 2,
40-
41-
/**
42-
* Render the avatar and one line of text
43-
*/
44-
oneline = 3,
45-
46-
/**
47-
* Render the avatar and two lines of text
48-
*/
49-
twolines = 4,
50-
51-
/**
52-
* Render the avatar and three lines of text
53-
*/
54-
threelines = 5,
55-
56-
/**
57-
* Render the avatar and four lines of text
58-
*/
59-
fourlines = 6
60-
}
61-
62-
export enum avatarType {
63-
/**
64-
* Renders avatar photo if available, falls back to initials
65-
*/
66-
photo = 'photo',
67-
68-
/**
69-
* Forces render avatar initials
70-
*/
71-
initials = 'initials'
72-
}
73-
74-
/**
75-
* Configuration object for the Person component
76-
*
77-
* @export
78-
* @interface MgtPersonConfig
79-
*/
80-
export interface MgtPersonConfig {
81-
/**
82-
* Sets or gets whether the person component can use Contacts APIs to
83-
* find contacts and their images
84-
*
85-
* @type {boolean}
86-
*/
87-
useContactApis: boolean;
88-
}
89-
9030
/**
9131
* Person properties part of original set provided by graph by default
9232
*/

packages/mgt-element/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,3 @@ export * from './utils/GraphPageIterator';
3030
export * from './utils/LocalizationHelper';
3131
export * from './utils/mgtHtml';
3232
export * from './utils/CustomElement';
33-
34-
export * from './mock/MockProvider';
35-
export * from './mock/mgt-mock-provider';

0 commit comments

Comments
 (0)