Skip to content

Commit cc0a92b

Browse files
authored
Merge pull request #414 from microsoftgraph/nmetulev/typescleanup
ensured types are correct and exported
2 parents 0443f6d + 95c0c76 commit cc0a92b

File tree

13 files changed

+110
-29
lines changed

13 files changed

+110
-29
lines changed

src/components/components.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,4 @@ export * from './mgt-person/mgt-person';
2525
export * from './mgt-tasks/mgt-tasks';
2626
export * from './mgt-teams-channel-picker/mgt-teams-channel-picker';
2727

28-
// Sub-Components, not for export!
29-
// export * from './sub-components/mgt-dot-options/mgt-dot-options';
30-
// export * from './sub-components/mgt-arrow-options/mgt-arrow-options';
28+
export { ComponentMediaQuery } from './baseComponent';

src/components/mgt-agenda/mgt-agenda.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { getEventsPageIterator } from './mgt-agenda.graph';
2424
* @class MgtAgenda
2525
* @extends {MgtTemplatedComponent}
2626
*
27+
* @fires eventClick - Fired when user click an event
28+
*
2729
* @cssprop --event-box-shadow - {String} Event box shadow color and size
2830
* @cssprop --event-margin - {String} Event margin
2931
* @cssprop --event-padding - {String} Event padding
@@ -150,7 +152,7 @@ export class MgtAgenda extends MgtTemplatedComponent {
150152

151153
/**
152154
* allows developer to define agenda to group events by day.
153-
* @type {Boolean}
155+
* @type {boolean}
154156
*/
155157
@property({
156158
attribute: 'group-by-day',

src/components/mgt-get/mgt-get.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { MgtTemplatedComponent } from '../templatedComponent';
1515
/**
1616
* Custom element for making Microsoft Graph get queries
1717
*
18+
* @fires dataChange - Fired when data changes
19+
*
1820
* @export
1921
* @class mgt-get
2022
* @extends {MgtTemplatedComponent}
@@ -94,15 +96,15 @@ export class MgtGet extends MgtTemplatedComponent {
9496
/**
9597
* Gets or sets the response of the request
9698
*
97-
* @type {*}
99+
* @type any
98100
* @memberof MgtGet
99101
*/
100102
@property({ attribute: false }) public response: any;
101103

102104
/**
103105
*
104106
* Gets or sets the error (if any) of the request
105-
* @type {*}
107+
* @type any
106108
* @memberof MgtGet
107109
*/
108110
@property({ attribute: false }) public error: any;

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

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

8-
import { User } from '@microsoft/microsoft-graph-types';
9-
import { customElement, html, property, query } from 'lit-element';
8+
import { customElement, html, property } from 'lit-element';
109
import { classMap } from 'lit-html/directives/class-map';
10+
import { IDynamicPerson } from '../../graph/types';
1111
import { Providers } from '../../Providers';
1212
import { ProviderState } from '../../providers/IProvider';
1313
import '../../styles/fabric-icon-font';
@@ -23,6 +23,12 @@ import { styles } from './mgt-login-css';
2323
* @class MgtLogin
2424
* @extends {MgtBaseComponent}
2525
*
26+
* @fires loginInitiated - Fired when login is initiated by the user
27+
* @fires loginCompleted - Fired when login completes
28+
* @fires loginFailed - Fired when login fails
29+
* @fires logoutInitiated - Fired when logout is initiated by the user
30+
* @fires logoutCompleted - Fired when logout completed
31+
*
2632
* @cssprop --font-size - {Length} Login font size
2733
* @cssprop --font-weight - {Length} Login font weight
2834
* @cssprop --height - {String} Login height percentage
@@ -46,13 +52,13 @@ export class MgtLogin extends MgtBaseComponent {
4652

4753
/**
4854
* allows developer to use specific user details for login
49-
* @type {MgtPersonDetails}
55+
* @type {IDynamicPerson}
5056
*/
5157
@property({
5258
attribute: 'user-details',
5359
type: Object
5460
})
55-
public userDetails: User;
61+
public userDetails: IDynamicPerson;
5662

5763
/**
5864
* Gets the flyout element

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ interface IFocusable {
4141
* @class MgtPicker
4242
* @extends {MgtTemplatedComponent}
4343
*
44+
* @fires selectionChanged - Fired when selection changes
45+
*
4446
* @cssprop --people-list-background-color - {Color} People list background color
4547
* @cssprop --accent-color - {Color} Accent color
4648
*/
@@ -55,8 +57,8 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
5557
}
5658

5759
/**
58-
* containing object of MgtPersonDetails.
59-
* @type {MgtPersonDetails}
60+
* containing object of IDynamicPerson.
61+
* @type {IDynamicPerson[]}
6062
*/
6163
@property({
6264
attribute: 'people',
@@ -76,7 +78,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
7678

7779
/**
7880
* array of user picked people.
79-
* @type {Array<IDynamicPerson>}
81+
* @type {IDynamicPerson[]}
8082
*/
8183
@property({
8284
attribute: 'selected-people',

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
9-
import { Presence } from '@microsoft/microsoft-graph-types-beta';
109
import { customElement, html, property, TemplateResult } from 'lit-element';
1110
import { repeat } from 'lit-html/directives/repeat';
1211
import { getPeople, getPeopleFromGroup } from '../../graph/graph.people';
@@ -21,6 +20,8 @@ import { MgtTemplatedComponent } from '../templatedComponent';
2120
import { PersonCardInteraction } from './../PersonCardInteraction';
2221
import { styles } from './mgt-people-css';
2322

23+
export { PersonCardInteraction } from './../PersonCardInteraction';
24+
2425
/**
2526
* web component to display a group of people or contacts by using their photos or initials.
2627
*
@@ -84,7 +85,7 @@ export class MgtPeople extends MgtTemplatedComponent {
8485

8586
/**
8687
* containing array of people used in the component.
87-
* @type {Array<MgtPersonDetails>}
88+
* @type {IDynamicPerson[]}
8889
*/
8990
@property({
9091
attribute: 'people',

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

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

88
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
9-
import { Presence } from '@microsoft/microsoft-graph-types-beta';
9+
import * as MicrosoftGraphBeta from '@microsoft/microsoft-graph-types-beta';
1010
import { customElement, html, property, TemplateResult } from 'lit-element';
1111
import { findPeople, getEmailFromGraphEntity } from '../../graph/graph.people';
1212
import { getPersonImage } from '../../graph/graph.photos';
@@ -131,14 +131,14 @@ export class MgtPersonCard extends MgtTemplatedComponent {
131131
/**
132132
* Gets or sets presence of person
133133
*
134-
* @type {Presence}
134+
* @type {MicrosoftGraphBeta.Presence}
135135
* @memberof MgtPerson
136136
*/
137137
@property({
138138
attribute: 'person-presence',
139139
type: Object
140140
})
141-
public personPresence: Presence;
141+
public personPresence: MicrosoftGraphBeta.Presence;
142142

143143
/**
144144
* Invoked each time the custom element is appended into a document-connected element
@@ -260,7 +260,11 @@ export class MgtPersonCard extends MgtTemplatedComponent {
260260
* @param {*} image
261261
* @memberof MgtPersonCard
262262
*/
263-
protected renderPersonImage(imageSrc?: string, presence?: Presence, showPresence?: boolean): TemplateResult {
263+
protected renderPersonImage(
264+
imageSrc?: string,
265+
presence?: MicrosoftGraphBeta.Presence,
266+
showPresence?: boolean
267+
): TemplateResult {
264268
imageSrc = imageSrc || this.getImage();
265269
presence = presence || this.personPresence;
266270
showPresence = showPresence || this.showPresence;

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';
9-
import { Presence } from '@microsoft/microsoft-graph-types-beta';
9+
import * as MicrosoftGraphBeta from '@microsoft/microsoft-graph-types-beta';
1010
import { customElement, html, property, query, TemplateResult } from 'lit-element';
1111
import { classMap } from 'lit-html/directives/class-map';
1212
import { findPeople, getEmailFromGraphEntity } from '../../graph/graph.people';
@@ -25,6 +25,8 @@ import { MgtTemplatedComponent } from '../templatedComponent';
2525
import { PersonCardInteraction } from './../PersonCardInteraction';
2626
import { styles } from './mgt-person-css';
2727

28+
export { PersonCardInteraction } from './../PersonCardInteraction';
29+
2830
/**
2931
* The person component is used to display a person or contact by using their photo, name, and/or email address.
3032
*
@@ -156,14 +158,14 @@ export class MgtPerson extends MgtTemplatedComponent {
156158
/**
157159
* Gets or sets presence of person
158160
*
159-
* @type {Presence}
161+
* @type {MicrosoftGraphBeta.Presence}
160162
* @memberof MgtPerson
161163
*/
162164
@property({
163165
attribute: 'person-presence',
164166
type: Object
165167
})
166-
public personPresence: Presence;
168+
public personPresence: MicrosoftGraphBeta.Presence;
167169

168170
/**
169171
* Sets how the person-card is invoked
@@ -384,7 +386,7 @@ export class MgtPerson extends MgtTemplatedComponent {
384386
* @param
385387
* @memberof MgtPersonCard
386388
*/
387-
protected renderPresence(presence?: Presence): TemplateResult {
389+
protected renderPresence(presence?: MicrosoftGraphBeta.Presence): TemplateResult {
388390
if (!this.showPresence) {
389391
return html``;
390392
}
@@ -492,7 +494,7 @@ export class MgtPerson extends MgtTemplatedComponent {
492494
* @param
493495
* @memberof MgtPersonCard
494496
*/
495-
protected renderImageWithPresence(image?: string, presence?: Presence): TemplateResult {
497+
protected renderImageWithPresence(image?: string, presence?: MicrosoftGraphBeta.Presence): TemplateResult {
496498
if (!image) {
497499
image = this.getImage();
498500
}

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import { MgtFlyout } from '../sub-components/mgt-flyout/mgt-flyout';
3434
* @export
3535
* @enum {number}
3636
*
37+
* @fires taskClick - Fired when the user clicks a task
38+
*
3739
* @cssprop --tasks-header-padding - {String} Tasks header padding
3840
* @cssprop --tasks-header-margin - {String} Tasks header margin
3941
* @cssprop --tasks-title-padding - {String} Tasks title padding
@@ -93,6 +95,56 @@ export enum TasksSource {
9395
todo
9496
}
9597

98+
/**
99+
* String resources for Mgt Tasks
100+
*
101+
* @export
102+
* @interface TasksStringResource
103+
*/
104+
export interface TasksStringResource {
105+
/**
106+
* Self Assigned string
107+
*
108+
* @type {string}
109+
* @memberof TasksStringResource
110+
*/
111+
BASE_SELF_ASSIGNED: string;
112+
/**
113+
* Self Assigned Buckets string
114+
*
115+
* @type {string}
116+
* @memberof TasksStringResource
117+
*/
118+
BUCKETS_SELF_ASSIGNED: string;
119+
/**
120+
* Buckets not found string
121+
*
122+
* @type {string}
123+
* @memberof TasksStringResource
124+
*/
125+
BUCKET_NOT_FOUND: string;
126+
/**
127+
* Self Assigned Plans string
128+
*
129+
* @type {string}
130+
* @memberof TasksStringResource
131+
*/
132+
PLANS_SELF_ASSIGNED: string;
133+
/**
134+
* Plan not found string
135+
*
136+
* @type {string}
137+
* @memberof TasksStringResource
138+
*/
139+
PLAN_NOT_FOUND: string;
140+
}
141+
142+
/*
143+
* Filter function
144+
*/
145+
// tslint:disable-next-line: completed-docs
146+
export type TaskFilter = (task: PlannerTask | OutlookTask) => boolean;
147+
96148
// Strings and Resources for different task contexts
97149
// tslint:disable-next-line: completed-docs
98150
const TASK_RES = {
@@ -131,6 +183,7 @@ export class MgtTasks extends MgtTemplatedComponent {
131183
* determines whether todo, or planner functionality for task component
132184
*
133185
* @readonly
186+
* @type {TasksStringResource}
134187
* @memberof MgtTasks
135188
*/
136189
public get res() {
@@ -256,7 +309,7 @@ export class MgtTasks extends MgtTemplatedComponent {
256309
*
257310
* @memberof MgtTasks
258311
*/
259-
public taskFilter: (task: PlannerTask | OutlookTask) => boolean;
312+
public taskFilter: TaskFilter;
260313

261314
@property() private _isNewTaskVisible: boolean;
262315
@property() private _newTaskBeingAdded: boolean;

src/components/mgt-teams-channel-picker/mgt-teams-channel-picker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ interface ChannelPickerItemState {
122122
* @class MgtTeamsChannelPicker
123123
* @extends {MgtTemplatedComponent}
124124
*
125+
* @fires selectionChanged - Fired when the selection changes
126+
*
125127
* @cssprop --font-color - {font} Default font color
126128
*
127129
* @cssprop --input-border - {String} Input section entire border

0 commit comments

Comments
 (0)