Skip to content

Commit 31016c3

Browse files
committed
- Minor corrections according to docs
- Removed some trailing whitespaces - warning by gulp
1 parent 094d5d0 commit 31016c3

4 files changed

Lines changed: 49 additions & 109 deletions

File tree

src/XrmDefinitelyTyped/Resources/Extensions/xrm_ext_9-.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ declare namespace Xrm {
513513
*/
514514
data?: string;
515515
}
516-
517516
interface Dashboard {
518517
/**
519518
* Specify "dashboard"
@@ -523,9 +522,8 @@ declare namespace Xrm {
523522
/**
524523
* The ID of the dashboard to load. If you don't specify the ID, navigates to the default dashboard.
525524
*/
526-
dashboardId: string;
527-
}
528-
525+
dashboardId?: string;
526+
}
529527
const enum NavigationOptionsTarget {
530528
PageInline = 1,
531529
Dialog = 2,

src/XrmDefinitelyTyped/Resources/Extensions/xrm_ext_9.1-.d.ts

Lines changed: 44 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,29 @@
55
declare namespace Xrm {
66
var App: App;
77
var Panel: Panel;
8-
98
interface App {
109
// --------------------------------------------------------------------------------------
11-
// TODO: app app.appSidePane
10+
// TODO: app app.appSidePane
1211
// TODO: Xrm.app implementation of methods. interface and generation of data needs to be set up
1312
// --------------------------------------------------------------------------------------
1413
appSidePane: AppSidePane;
1514

1615
sidePanes: SidePanes;
1716

18-
/**
17+
/**
1918
* Displays an error, information, warning, or success notification for an app, and lets you specify actions to
2019
* execute based on the notification.
21-
* @param notification The notification object to add.
22-
**/
23-
addGlobalNotification(notification: AppNotification): Promise<undefined>; // TODO figure out if Promise is correct return value
20+
* @param notification The notification object to add.
21+
* @return On success, returns a promise object containing a GUID value to uniquely identify the notification as described earlier in the description of the successCallback parameter.
22+
*/
23+
addGlobalNotification(notification: AppNotification): Promise<string>;
2424

2525
/**
2626
* Clears a notification in the app.
2727
* @param uniqueId The ID to use to clear a specific notification that was set using addGlobalNotification.
2828
*/
29-
clearGlobalNotification(uniqueId: string): Promise<undefined>; // TODO figure out if Promise is correct return value
30-
31-
32-
29+
clearGlobalNotification(uniqueId: string): Promise<undefined>;
3330
}
34-
35-
36-
3731
interface AppNotification {
3832
/**
3933
* Optional, lebel for action in message and function to execute when label is clicked
@@ -44,25 +38,23 @@ declare namespace Xrm {
4438
* Defines the level of notification.
4539
*/
4640
level: LevelValue;
47-
4841
/**
49-
*
42+
* The message to display in the notification.
5043
*/
5144
message: string;
5245

5346
/**
54-
* Indicates whether or not the user can close or dismiss the notification.
47+
* Indicates whether or not the user can close or dismiss the notification.
5548
* If you don't specify this parameter, users can't close or dismiss the notification by default.
5649
*/
5750
showCloseButton?: boolean;
5851

5952
/**
60-
* Defines the type of notification. Currently, only a value of 2 is supported,
53+
* Defines the type of notification. Currently, only a value of 2 is supported,
6154
* which displays a message bar at the top of the app.
6255
*/
6356
type: Number;
6457
}
65-
6658
interface AppAction {
6759

6860
/**
@@ -73,24 +65,17 @@ declare namespace Xrm {
7365
/**
7466
* Function reference. The function to execute when the action label is clicked.
7567
*/
76-
eventHandler?: Function;
77-
78-
68+
eventHandler?: Function;
7969
}
80-
8170
const enum LevelValue {
8271
Succes = 1,
8372
Error = 2,
8473
Warning = 3,
85-
Information = 4,
86-
74+
Information = 4,
8775
}
88-
89-
//TODO figure out how to implement the app side pane https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-app-appsidepane
76+
//TODO figure out how to implement the app side pane https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-app-appsidepane
9077
// should the methods take an input like paneID?
91-
92-
interface AppSidePane {
93-
78+
interface AppSidePane {
9479
/**
9580
* Closes the side pane and removes it from the side bar.
9681
*/
@@ -106,10 +91,7 @@ declare namespace Xrm {
10691
*/
10792
navigate(): any;
10893
}
109-
11094
interface SidePanes {
111-
112-
//TODO figure out if Object is a correct return type, make type any
11395
/**
11496
* Provides all the information to create side panes.
11597
*/
@@ -124,15 +106,11 @@ declare namespace Xrm {
124106
* returns the appSidePane object
125107
*/
126108
getPane(paneId: string): Object;
127-
128109
/**
129110
* returns the appSidePane object
130111
*/
131112
getSelectedPane(): Object;
132-
133-
134113
}
135-
136114
interface SidePaneOptions {
137115

138116
/**
@@ -164,12 +142,12 @@ declare namespace Xrm {
164142
* When set to false, the created pane is not selected and leaves the existing pane selected.
165143
* It also does not expand the pane if collapsed.
166144
*/
167-
isSelected?: Number;
145+
isSelected?: boolean;
168146

169147
/**
170148
* The width of the pane in pixels.
171149
*/
172-
width?: boolean;
150+
width?: number;
173151

174152
/**
175153
* Hides the pane and tab.
@@ -185,7 +163,6 @@ declare namespace Xrm {
185163
* Prevents the badge from getting cleared when the pane becomes selected.
186164
*/
187165
keepBadgeOnSelect?: boolean;
188-
189166
}
190167

191168
/**
@@ -198,11 +175,8 @@ declare namespace Xrm {
198175
* @param url URL of the page to be loaded in the side pane static area.
199176
* @param title Title of the side pane static area.
200177
*/
201-
loadPanel(url: string, title: string): any;
202-
//TODO Not sure this should return void, use any and test
203-
178+
loadPanel(url: string, title: string): Promise<undefined>;
204179
}
205-
206180
/**
207181
* Lookup-like type object for userSettings.roles.
208182
*/
@@ -258,7 +232,6 @@ declare namespace Xrm {
258232
*/
259233
fieldName: string;
260234
}
261-
262235
// TODO make sure it works
263236

264237
interface OnLookupTagClickEventArgs {
@@ -303,7 +276,7 @@ declare namespace Xrm {
303276
/**
304277
* Return a value that indicates whether the form is currently visible
305278
*/
306-
getVisible(visibility: boolean): boolean;
279+
getVisible(): boolean;
307280
}
308281

309282
/**
@@ -313,7 +286,6 @@ declare namespace Xrm {
313286
/**
314287
* Method to cause the ribbon to re-evaluate data that controls what is displayed in it.
315288
*/
316-
317289
/**
318290
* Provides information on how to set the visibility of header section.
319291
*/
@@ -323,18 +295,17 @@ declare namespace Xrm {
323295
* Provides information on how to set the visibility of footer section.
324296
*/
325297
footerSection: FooterSection;
326-
327298
/**
328299
* Provides objects and methods to interact with the business process flow control on a form.
329300
* More information: formContext.ui.process
330301
*/
331302
process: UiProcessModule;
332303

333304
/**
334-
* Provides methods to access all the quick view controls and its constituent controls on the
335-
* model-driven apps forms when using the new form rendering engine (also called "turbo forms").
336-
* A quick view control is a quick view form added to a main form in model-driven apps that enables
337-
* you to view information about a related table record within the main form. Data in constituent
305+
* Provides methods to access all the quick view controls and its constituent controls on the
306+
* model-driven apps forms when using the new form rendering engine (also called "turbo forms").
307+
* A quick view control is a quick view form added to a main form in model-driven apps that enables
308+
* you to view information about a related table record within the main form. Data in constituent
338309
* controls in a quick view control cannot be edited.
339310
* The quickForms collection provides access to all the quick view controls on a form, and supports all
340311
* the standard methods of the collections. See Collections) for information about the collection methods.
@@ -345,13 +316,10 @@ declare namespace Xrm {
345316
quickForms: QuickForms;
346317

347318
/**
348-
* A tab is a group of sections on a page. It contains properties and methods to manipulate tabs
319+
* A tab is a group of sections on a page. It contains properties and methods to manipulate tabs
349320
* as well as access to sections within the tab through the sections collection.
350321
*/
351322
tabs: T;
352-
353-
354-
355323
/**
356324
* Sets the name of the table to be displayed on the form.
357325
* @param tableName Name of the table to be displayed on the form.
@@ -361,15 +329,15 @@ declare namespace Xrm {
361329
/**
362330
* Displays form level notifications.
363331
* You can display any number of notifications and they will be displayed until they are removed using clearFormNotification.
364-
* The height of the notification area is limited so each new message will be added to the top.
332+
* The height of the notification area is limited so each new message will be added to the top.
365333
* Users can scroll down to view older messages that have not yet been removed.
366334
* @param messageText The text of the notification message.
367335
* @param level The level of the message, which defines how the message will be displayed. Specify one of the following values:
368336
* ERROR : Notification will use the system error icon.
369337
* WARNING : Notification will use the system warning icon.
370338
* INFO : Notification will use the system info icon.
371339
* @param uniqueId A unique identifier for the message that can be used later with clearFormNotification to remove the notification.
372-
* returns true if the method succeeded; false otherwise.
340+
* returns true if the method succeeded; false otherwise.
373341
*/
374342
setFormNotification(messageText: string, level: string, uniqueId: string): boolean;
375343

@@ -379,23 +347,19 @@ declare namespace Xrm {
379347
* returns true if the method succeeded, false otherwise.
380348
*/
381349
clearFormNotification(uniqueId: string): boolean;
382-
383-
// TODO figure out how to pass functionref as parameter for ui functions
384350
/**
385351
* Adds a function to be called on the form OnLoad event.
386-
* @param onLoadFunction The function to be executed on the form OnLoad event.
387-
* The function will be added to the bottom of the event handler pipeline.
388-
* The execution context is automatically passed as the first parameter to the function.
352+
* @param onLoadFunction The function to be executed on the form OnLoad event.
353+
* The function will be added to the bottom of the event handler pipeline.
354+
* The execution context is automatically passed as the first parameter to the function.
389355
* See Execution context for more information.
390356
*/
391-
addOnLoad(onLoadFunction: (context?: ExecutionContext<this, any>) => any): void;
392-
357+
addOnLoad(onLoadFunction: (context?: OnLoadEventContext) => any): void;
393358
/**
394359
* Removes a function from the form OnLoad event.
395360
* @param onLoadFunction The function to be removed from the form OnLoad event.
396361
*/
397362
removeOnLoad(onLoadFunction: Function): void;
398-
399363
}
400364

401365
interface HeaderSection {
@@ -491,12 +455,10 @@ declare namespace Xrm {
491455
* For example: quickViewControl.getControl("firstname") or quickViewControl.getControl(0)
492456
* Returns an Object or Object collection
493457
*/
494-
// getControl(arg?: string); // TODO figure out return type.
495-
496-
458+
getControl(arg?: string) : any // TODO figure out return type. Maybe: Xrm.AnyControl | undefined;
497459
/**
498460
* Returns a string value that categorizes quick view controls.
499-
* For a quick view control, the method returns "quickform".
461+
* For a quick view control, the method returns "quickform".
500462
* For a constituent control in a quick view control, the method returns the actual category of the control.
501463
*/
502464
getControlType(): string;
@@ -520,10 +482,8 @@ declare namespace Xrm {
520482
/**
521483
* Returns a reference to the section object that contains the control.
522484
*/
523-
getParent(): any;
485+
getParent(): any;
524486
// TODO figure out return type, could be something like (PageSection<Collection<QuickViewControl>>));
525-
526-
527487
/**
528488
* Returns a value that indicates whether the quick view control is currently visible.
529489
* Returns true if the control is visible; false otherwise.
@@ -721,11 +681,10 @@ declare namespace Xrm {
721681
addOnPostSave(functionRef: (context?: SaveEventContext<this>) => any): void;
722682
}
723683

724-
725-
// --------------------------------------------------------------------------------------
726-
// TODO: Tabs needs work
727-
// --------------------------------------------------------------------------------------
728-
684+
/**
685+
* Different Content Types
686+
*/
687+
type TabsContentType = "cardSections" | "singleComponent";
729688
interface PageTab<T extends SectionCollectionBase> {
730689
/**
731690
* Collection of sections within this tab.
@@ -734,9 +693,9 @@ declare namespace Xrm {
734693

735694
/**
736695
* Adds a function to be called when the TabStateChange event occurs.
737-
* @param tabStateChangeFunction The function to be executed on the TabStateChange event.
738-
* The function will be added to the bottom of the event handler pipeline.
739-
* The execution context is automatically passed as the first parameter to the function.
696+
* @param tabStateChangeFunction The function to be executed on the TabStateChange event.
697+
* The function will be added to the bottom of the event handler pipeline.
698+
* The execution context is automatically passed as the first parameter to the function.
740699
* See Execution context for more information.
741700
*/
742701
addTabStateChange(tabStateChangeFunction: (context?: ExecutionContext<this, any>) => any): void;
@@ -746,30 +705,19 @@ declare namespace Xrm {
746705
* only supported on unified interface
747706
* Returns "cardSections" or "singleComponent".
748707
*/
749-
getContentType(): any; //NotimplementedException
750-
// figure out return value
751-
708+
getContentType(): TabsContentType;
752709
/**
753710
* Removes a function to be called when the TabStateChange event occurs.
754711
* @param tabStateChangeFunction The function to be removed from the TabStateChange event.
755712
*/
756713
removeTabStateChange(tabStateChangeFunction: Function): void;
757-
758714
/**
759715
* Sets the content type.
760716
* only supported on unified interface
761717
* @param contentType Defines the content type. It has the following parameters:
762-
- cardSections: The default tab behavior.
763-
- singleComponent: Maximizes the content of the first component in the tab.
718+
* cardSections: The default tab behavior.
719+
* singleComponent: Maximizes the content of the first component in the tab.
764720
*/
765-
setContentType(contentType: string): void;
766-
767-
768-
}
769-
770-
771-
721+
setContentType(contentType: TabsContentType): void;
722+
}
772723
}
773-
774-
775-

0 commit comments

Comments
 (0)