Skip to content

Commit c5e1358

Browse files
committed
Merge branch 'master' into nivogt/card-window-bounds
2 parents 3781711 + 277031c commit c5e1358

File tree

6 files changed

+41
-26
lines changed

6 files changed

+41
-26
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
7676
// User input in search
7777
@property() private _userInput: string = '';
7878

79+
// if search is still loading don't load "people not found" state
80+
@property() private showLoading = false;
81+
@property() private isLoading = false;
82+
7983
// tracking of user arrow key input for selection
8084
private arrowSelectionCount: number = 0;
8185
// List of people requested if group property is provided
8286
private groupPeople: any[];
83-
// if search is still loading don't load "people not found" state
84-
private isLoading = false;
8587
private debouncedSearch;
8688

8789
constructor() {
@@ -320,13 +322,10 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
320322
let people: any;
321323

322324
if (provider && provider.state === ProviderState.SignedIn) {
323-
const that = this;
324-
let loading = true;
325+
this.isLoading = true;
325326

326327
setTimeout(() => {
327-
if (loading) {
328-
that.isLoading = true;
329-
}
328+
this.showLoading = this.isLoading;
330329
}, 400);
331330

332331
const client = Providers.globalProvider.graph;
@@ -345,8 +344,8 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
345344
}
346345

347346
this.people = this.filterPeople(people);
348-
loading = false;
349347
this.isLoading = false;
348+
this.showLoading = false;
350349
}
351350
} else {
352351
this.people = [];
@@ -508,12 +507,12 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
508507
let people: any = this.people;
509508
let content: TemplateResult;
510509

511-
if (people) {
510+
if (this.showLoading) {
511+
content = this.renderTemplate('loading', null, 'loading') || this.renderLoadingMessage();
512+
} else if (people) {
512513
people = people.slice(0, this.showMax);
513514

514-
if (this.isLoading) {
515-
content = this.renderTemplate('loading', null, 'loading') || this.renderLoadingMessage();
516-
} else if (people.length === 0 && this._userInput.length > 0) {
515+
if (!this.isLoading && people.length === 0 && this._userInput.length > 0) {
517516
content = this.renderTemplate('error', null, 'error') || this.renderErrorMessage();
518517
} else {
519518
if (people[0]) {

src/components/mgt-people/mgt-people.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@ mgt-people .people-list {
1616
list-style-type: none;
1717
margin: $list-margin;
1818
padding: 0;
19-
font-family: var(--default-font-family, "Segoe UI");
19+
font-family: var(--default-font-family, 'Segoe UI');
2020
font-style: normal;
2121
font-weight: normal;
2222
display: flex;
23+
align-items: center;
2324
}
2425

2526
:host .people-person,
2627
mgt-people .people-person {
2728
margin: $avatar-margin;
2829
display: flex;
2930
}
31+
:host .overflow,
32+
mgt-people .overflow {
33+
span {
34+
vertical-align: middle;
35+
}
36+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class MgtPeople extends MgtTemplatedComponent {
140140
people: this.people
141141
}) ||
142142
html`
143-
<li>+${this.people.length - this.showMax}</li>
143+
<li class="overflow"><span>+${this.people.length - this.showMax}<span></li>
144144
`
145145
: null}
146146
</ul>

src/components/mgt-person/mgt-person.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ $email-color: var(--email-color, #{$ms-color-neutralPrimary});
2727
display: inline-block;
2828
color: $color;
2929
position: relative;
30+
vertical-align: top;
3031
}
3132

3233
:host svg,
@@ -65,11 +66,11 @@ mgt-person .Details {
6566
mgt-person .user-avatar {
6667
width: $avatar-size;
6768
height: $avatar-size;
69+
display: flex;
70+
justify-content: center;
71+
align-items: center;
6872

6973
&.initials {
70-
display: flex;
71-
justify-content: center;
72-
align-items: center;
7374
color: $initials-color;
7475
background-color: $initials-background-color;
7576
border-radius: 50%;
@@ -89,7 +90,6 @@ mgt-person .user-avatar {
8990

9091
img {
9192
height: 100%;
92-
width: 100%;
9393
}
9494
}
9595

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,11 @@ export class MgtPerson extends MgtTemplatedComponent {
319319
}
320320

321321
private _handleMouseEnter(e: MouseEvent) {
322+
clearTimeout(this._mouseEnterTimeout);
323+
clearTimeout(this._mouseLeaveTimeout);
322324
if (this.personCardInteraction !== PersonCardInteraction.hover) {
323325
return;
324326
}
325-
326-
clearTimeout(this._mouseEnterTimeout);
327-
clearTimeout(this._mouseLeaveTimeout);
328327
this._mouseEnterTimeout = setTimeout(this._showPersonCard.bind(this), 500);
329328
}
330329

@@ -450,7 +449,6 @@ export class MgtPerson extends MgtTemplatedComponent {
450449
const initials = this.getInitials();
451450

452451
imageHtml = html`
453-
<img />
454452
<span class="initials-text" aria-label="${initials}">
455453
${initials}
456454
</span>

src/components/mgt-tasks/mgt-tasks.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* -------------------------------------------------------------------------------------------
66
*/
77

8-
import { Person, PlannerAssignments, User } from '@microsoft/microsoft-graph-types';
9-
import { Contact, OutlookTaskFolder } from '@microsoft/microsoft-graph-types-beta';
8+
import { Person, PlannerAssignments, PlannerTask, User } from '@microsoft/microsoft-graph-types';
9+
import { Contact, OutlookTask, OutlookTaskFolder } from '@microsoft/microsoft-graph-types-beta';
1010
import { customElement, html, property } from 'lit-element';
1111
import { classMap } from 'lit-html/directives/class-map';
1212
import { repeat } from 'lit-html/directives/repeat';
@@ -192,6 +192,13 @@ export class MgtTasks extends MgtTemplatedComponent {
192192
@property({ attribute: 'group-id', type: String })
193193
public groupId: string = null;
194194

195+
/**
196+
* Optional filter function when rendering tasks
197+
*
198+
* @memberof MgtTasks
199+
*/
200+
public taskFilter: (task: PlannerTask | OutlookTask) => boolean;
201+
195202
@property() private _isNewTaskVisible: boolean = false;
196203
@property() private _newTaskBeingAdded: boolean = false;
197204
@property() private _newTaskName: string = '';
@@ -313,11 +320,15 @@ export class MgtTasks extends MgtTemplatedComponent {
313320
* trigger the element to update.
314321
*/
315322
protected render() {
316-
const tasks = this._tasks
323+
let tasks = this._tasks
317324
.filter(task => this.isTaskInSelectedGroupFilter(task))
318325
.filter(task => this.isTaskInSelectedFolderFilter(task))
319326
.filter(task => !this._hiddenTasks.includes(task.id));
320327

328+
if (this.taskFilter) {
329+
tasks = tasks.filter(task => this.taskFilter(task._raw));
330+
}
331+
321332
const loadingTask = this._inTaskLoad && !this._hasDoneInitialLoad ? this.renderLoadingTask() : null;
322333

323334
let header;
@@ -982,7 +993,7 @@ export class MgtTasks extends MgtTemplatedComponent {
982993
const groupTitle = this._currentGroup ? null : this.getPlanTitle(task.topParentId);
983994
const folderTitle = this._currentFolder ? null : this.getFolderName(task.immediateParentId);
984995

985-
const context = { task: { ...task, groupTitle, folderTitle } };
996+
const context = { task: { ...task._raw, groupTitle, folderTitle } };
986997
const taskTemplate = this.renderTemplate('task', context, task.id);
987998
if (taskTemplate) {
988999
return taskTemplate;

0 commit comments

Comments
 (0)