@resconet/jsbridge 14.2.0 → 15.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/JSBridge.d.ts +74 -4
- package/src/JSBridge.js +47 -6
package/package.json
CHANGED
package/src/JSBridge.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// JSBridge.js TypeScript definition file
|
|
2
|
-
//
|
|
3
|
-
// (c)
|
|
2
|
+
// v15.1
|
|
3
|
+
// (c) 2022 Resco
|
|
4
4
|
|
|
5
5
|
declare module MobileCRM {
|
|
6
6
|
|
|
@@ -53,7 +53,9 @@ declare module MobileCRM {
|
|
|
53
53
|
|
|
54
54
|
class Settings {
|
|
55
55
|
/**Gets the absolute URL (including the CrmOrganization).*/
|
|
56
|
-
|
|
56
|
+
absoluteUrl: string;
|
|
57
|
+
/**Gets or sets the currently selected Application ID.*/
|
|
58
|
+
activeAppID: string;
|
|
57
59
|
/**Gets or sets the last active entity in the ActivityList.*/
|
|
58
60
|
activityListInitialEntity: number;
|
|
59
61
|
/**Gets or sets the application lock state (0=None, 1=Soft, 2=Permanent).*/
|
|
@@ -603,6 +605,17 @@ declare module MobileCRM {
|
|
|
603
605
|
*/
|
|
604
606
|
public static email(address: string, subject: string, body: string, errorCallback?: () => void, scope?: any);
|
|
605
607
|
/**
|
|
608
|
+
* @since 15.0
|
|
609
|
+
* Opens the platform-specific e-mail message form with pre-filled data.
|
|
610
|
+
* @param address Recipients email address.
|
|
611
|
+
* @param subject An e-mail subject.
|
|
612
|
+
* @param body A string with email body.
|
|
613
|
+
* @param mimeType Body content MIME type.
|
|
614
|
+
* @param errorCallback The errorCallback which is called asynchronously in case of error.
|
|
615
|
+
* @param scope The scope for errorCallback.
|
|
616
|
+
*/
|
|
617
|
+
public static sendEmail(address: string, subject: string, body: string, mimeType: string, errorCallback?: () => void, scope?: any);
|
|
618
|
+
/**
|
|
606
619
|
* @since 9.1
|
|
607
620
|
* Sends a list of files (full paths or IReferences to blobs) as email attachments.
|
|
608
621
|
* This method either open the CRM Email form or the native mail client (depending on application settings).
|
|
@@ -1422,12 +1435,39 @@ declare module MobileCRM.UI {
|
|
|
1422
1435
|
*/
|
|
1423
1436
|
addItemToGrid(gridName: string, item: MobileCRM.UI.DetailViewItems.Item, column?: number, row?: number, colSpan?: number, rowSpan?: number);
|
|
1424
1437
|
}
|
|
1438
|
+
/** Represents bulk update item status. */
|
|
1439
|
+
enum BulkUpdateItemStatus {
|
|
1440
|
+
Registered = 0,
|
|
1441
|
+
LoadFailed = 1,
|
|
1442
|
+
Loaded = 2,
|
|
1443
|
+
ValidateFailed = 3,
|
|
1444
|
+
Validated = 4,
|
|
1445
|
+
SaveFailed = 5,
|
|
1446
|
+
Saved = 6,
|
|
1447
|
+
}
|
|
1448
|
+
/** Represents bulk update item.*/
|
|
1449
|
+
interface BulkUpdateItem {
|
|
1450
|
+
/** Record id.*/
|
|
1451
|
+
id: string;
|
|
1452
|
+
/** Holds record. Can be null for records that aren't loaded yet (status Registered or LoadFailed).*/
|
|
1453
|
+
record: DynamicEntity;
|
|
1454
|
+
/** Gets bulk update item status.*/
|
|
1455
|
+
status: BulkUpdateItemStatus;
|
|
1456
|
+
/** Gets human-readable error or warning description.*/
|
|
1457
|
+
statusMessage: string;
|
|
1458
|
+
/** Indicates whether there was an error loading or saving item. */
|
|
1459
|
+
hasError: boolean;
|
|
1460
|
+
/** Indicates whether there item was saved with a warning. */
|
|
1461
|
+
hasWarning: boolean;
|
|
1462
|
+
}
|
|
1425
1463
|
/**
|
|
1426
1464
|
* Represents the Javascript equivalent of native entity form object.
|
|
1427
1465
|
*/
|
|
1428
1466
|
class EntityForm {
|
|
1429
1467
|
/** Gets the associated views as an array of MobileCRM.UI.IEntityList objects.*/
|
|
1430
1468
|
associatedViews: Array<IEntityList>;
|
|
1469
|
+
/** A list of entity records editted on this bulk update form.*/
|
|
1470
|
+
bulkUpdateItems: Array<BulkUpdateItem>;
|
|
1431
1471
|
/** Gets whether the form can be edited.*/
|
|
1432
1472
|
canEdit: boolean;
|
|
1433
1473
|
/** Determines if form can be closed, i.e. there are no unsaved data being edited.*/
|
|
@@ -1446,6 +1486,8 @@ declare module MobileCRM.UI {
|
|
|
1446
1486
|
form: Form;
|
|
1447
1487
|
/** Carries the custom parameters that can be specified when opening the form using { MobileCRM.UI.FormManager } */
|
|
1448
1488
|
iFrameOptions: any;
|
|
1489
|
+
/** Indicates whether the form is bulk update form.*/
|
|
1490
|
+
isBulkUpdateForm: boolean;
|
|
1449
1491
|
/** Indicates whether the form has unsaved data. */
|
|
1450
1492
|
isDirty: boolean;
|
|
1451
1493
|
/** Defines relationship with parent entity. */
|
|
@@ -1467,6 +1509,13 @@ declare module MobileCRM.UI {
|
|
|
1467
1509
|
*/
|
|
1468
1510
|
getController(name: string): _Controller;
|
|
1469
1511
|
/**
|
|
1512
|
+
* Returns the entity list by its view name.
|
|
1513
|
+
* This method looks for plain associated views but also for controllers that can be flipped into a list (in addition to map or chart).
|
|
1514
|
+
* @param name A name of associated view.
|
|
1515
|
+
* @returns IEntityList
|
|
1516
|
+
*/
|
|
1517
|
+
getEntityList(name: string): IEntityList;
|
|
1518
|
+
/**
|
|
1470
1519
|
* Sets the address fields according to the current geo-location from platform-specific location service.
|
|
1471
1520
|
* @param latitude The latitude from geo-location from platform-specific location service
|
|
1472
1521
|
* @param longitude longitude from geo-location from platform-specific location service
|
|
@@ -1556,6 +1605,14 @@ declare module MobileCRM.UI {
|
|
|
1556
1605
|
*/
|
|
1557
1606
|
public static onChange(handler: (entityForm: EntityForm) => void, bind: boolean, scope?: any);
|
|
1558
1607
|
/**
|
|
1608
|
+
* @since 15.1
|
|
1609
|
+
* Binds or unbinds the handler for onProcessLoaded event on EntityForm.
|
|
1610
|
+
* @param handler The handler function that has to be bound or unbound.
|
|
1611
|
+
* @param bind Determines whether to bind or unbind the handler.
|
|
1612
|
+
* @param scope The scope for callbacks.
|
|
1613
|
+
*/
|
|
1614
|
+
public static onProcessLoaded(handler: (entityForm: EntityForm) => void, bind: boolean, scope?: any);
|
|
1615
|
+
/**
|
|
1559
1616
|
* @since 11.2
|
|
1560
1617
|
* Binds or unbinds the handler for specific item change event on EntityForm.
|
|
1561
1618
|
* @param itemName The name of desired detail item (mostly logical name of the field).
|
|
@@ -2311,6 +2368,20 @@ declare module MobileCRM.UI {
|
|
|
2311
2368
|
* @param scope The scope for callback.
|
|
2312
2369
|
*/
|
|
2313
2370
|
changeProccess(callback: (processReference: MobileCRM.Reference) => void, errorCallback?: (err: string) => void, scope?: any);
|
|
2371
|
+
/**
|
|
2372
|
+
* @since 15.0
|
|
2373
|
+
* Progresses to the next stage of the active process.
|
|
2374
|
+
* @param errorCallback The errorCallback which is called asynchronously in case of error
|
|
2375
|
+
* @param scope The scope for callback.
|
|
2376
|
+
*/
|
|
2377
|
+
MoveToPreviousStage(errorCallback?: (err: string) => void, scope?: any);
|
|
2378
|
+
/**
|
|
2379
|
+
* @since 15.0
|
|
2380
|
+
* Moves to the previous stage of the active process.
|
|
2381
|
+
* @param errorCallback The errorCallback which is called asynchronously in case of error
|
|
2382
|
+
* @param scope The scope for callback.
|
|
2383
|
+
*/
|
|
2384
|
+
MoveToNextStage(errorCallback?: (err: string) => void, scope?: any);
|
|
2314
2385
|
}
|
|
2315
2386
|
|
|
2316
2387
|
class ViewDefinition {
|
|
@@ -2359,7 +2430,6 @@ declare module MobileCRM.UI {
|
|
|
2359
2430
|
entities: Array<string>;
|
|
2360
2431
|
source: MobileCRM.Relationship;
|
|
2361
2432
|
dataSource: Array<MobileCRM.Reference>;
|
|
2362
|
-
prevSelection: MobileCRM.Reference;
|
|
2363
2433
|
allowNull: boolean;
|
|
2364
2434
|
|
|
2365
2435
|
show(success: (obj?: MobileCRM.Reference) => void, failed?: (err: string) => void, scope?: any);
|
package/src/JSBridge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// v15.1
|
|
2
2
|
(function () {
|
|
3
|
-
var _scriptVersion =
|
|
3
|
+
var _scriptVersion = 15.1
|
|
4
4
|
// Private objects & functions
|
|
5
5
|
var _inherit = (function () {
|
|
6
6
|
function _() { }
|
|
@@ -540,11 +540,13 @@
|
|
|
540
540
|
/// <summary>Represents the Javascript equivalent of native entity form object.</summary>
|
|
541
541
|
/// <remarks>This object cannot be created directly. To obtain/modify this object, use <see cref="MobileCRM.UI.EntityForm.requestObject">MobileCRM.UI.EntityForm.requestObject</see> function.</remarks>
|
|
542
542
|
/// <field name="associatedViews" type="Array">Gets the associated views as an array of <see cref="MobileCRM.UI._EntityList">MobileCRM.UI._EntityList</see> objects.</field>
|
|
543
|
+
/// <field name="bulkUpdateItems" type="Array">A list of entity records editted on this bulk update form.</field>
|
|
543
544
|
/// <field name="canEdit" type="Boolean">Gets whether the form can be edited.</field>
|
|
544
545
|
/// <field name="canClose" type="Boolean">Determines if form can be closed, i.e. there are no unsaved data being edited.</field>
|
|
545
546
|
/// <field name="context" type="Object">Gets the specific context object for onChange and onSave handlers. The onChange context contains single property "changedItem" with the name of the changed detail item and the onSave context contains property "errorMessage" which can be used to break the save process with certain error message.</field>
|
|
546
547
|
/// <field name="controllers" type="Array">Gets the form controllers (map, web) as an array of <see cref="MobileCRM.UI._Controller">MobileCRM.UI._Controller</see> objects.</field>
|
|
547
548
|
/// <field name="detailViews" type="Array">Gets the detailView controls as an array of <see cref="MobileCRM.UI._DetailView">MobileCRM.UI._DetailView</see> objects.</field>
|
|
549
|
+
/// <field name="isBulkUpdateForm" type="Boolean">Indicates whether the form is bulk update form.</field>
|
|
548
550
|
/// <field name="entity" type="MobileCRM.DynamicEntity">Gets or sets the entity instance the form is showing.</field>
|
|
549
551
|
/// <field name="form" type="MobileCRM.UI.Form">Gets the top level form.</field>
|
|
550
552
|
/// <field name="iFrameOptions" type="Object">Carries the custom parameters that can be specified when opening the form using <see cref="MobileCRM.UI.FormManager">MobileCRM.UI.FormManager</see>.</field>
|
|
@@ -721,9 +723,7 @@
|
|
|
721
723
|
/// <field name="entities" type="Array">An array of allowed entity kinds (schema names).</field>
|
|
722
724
|
/// <field name="source" type="MobileCRM.Relationship">The entity whose property will be set to the chosen value.</field>
|
|
723
725
|
/// <field name="dataSource" type="MobileCRM.Reference[]">The list of entities that should be displayed as selected.</field>
|
|
724
|
-
/// <field name="prevSelection" type="MobileCRM.Reference">The entity whose property will be set to the chosen value.</field>
|
|
725
726
|
/// <field name="allowNull" type="Boolean">Whether to allow selecting no entity.</field>
|
|
726
|
-
/// <field name="preventClose" type="Boolean">Whether to prevent closing form without choosing a value.</field>
|
|
727
727
|
MobileCRM.UI.MultiLookupForm.superproto.constructor.apply(this, arguments);
|
|
728
728
|
this.dataSource = [];
|
|
729
729
|
},
|
|
@@ -2684,6 +2684,18 @@
|
|
|
2684
2684
|
var emailContent = { Address: address, Subject: subject, Body: body };
|
|
2685
2685
|
_executePlatformAction(1, emailContent, null, errorCallback, scope);
|
|
2686
2686
|
};
|
|
2687
|
+
MobileCRM.Platform.sendEmail = function (address, subject, body, mimeType, errorCallback, scope) {
|
|
2688
|
+
/// <summary>[v15.0] Opens the platform-specific e-mail message form with pre-filled data.</summary>
|
|
2689
|
+
/// <param name="address" type="String">Recipient's email address.</param>
|
|
2690
|
+
/// <param name="subject" type="String">An e-mail subject.</param>
|
|
2691
|
+
/// <param name="body" type="String">A string with email body.</param>
|
|
2692
|
+
/// <param name="mimeType" type="String">Body content MIME type.</param>
|
|
2693
|
+
/// <param name="errorCallback" type="function(errorMsg)">The errorCallback which is called asynchronously in case of error.</param>
|
|
2694
|
+
/// <param name="scope" type="Object">The scope for errorCallback.</param>
|
|
2695
|
+
|
|
2696
|
+
var emailContent = { Address: address, Subject: subject, Body: body, MimeType: mimeType };
|
|
2697
|
+
_executePlatformAction(1, emailContent, null, errorCallback, scope);
|
|
2698
|
+
};
|
|
2687
2699
|
MobileCRM.Platform.openDocument = function (path, mimeType, args, errorCallback, scope) {
|
|
2688
2700
|
/// <summary>[v8.1] Opens specified document in associated program.</summary>
|
|
2689
2701
|
/// <remarks>Apple security policy doesn&t allow this functionality on iOS.</remarks>
|
|
@@ -3612,7 +3624,25 @@
|
|
|
3612
3624
|
var controller = MobileCRM.bridge.exposeObjectAsync("EntityForm.GetController", [this.view.name]);
|
|
3613
3625
|
controller.invokeMethodAsync("ChangeProcessTo", [processRef], function () { }, errorCallback, scope);
|
|
3614
3626
|
controller.release();
|
|
3615
|
-
|
|
3627
|
+
};
|
|
3628
|
+
|
|
3629
|
+
MobileCRM.UI.ProcessController.prototype.moveToPreviousStage = function (errorCallback, scope) {
|
|
3630
|
+
/// <summary>[15.0] Moves to the previous stage of the active process.</summary>
|
|
3631
|
+
/// <param name="errorCallback" type="function(errorMsg)">The errorCallback which is called asynchronously in case of error.</param>
|
|
3632
|
+
/// <param name="scope" type="Object">The scope for callback.</param>
|
|
3633
|
+
var controller = MobileCRM.bridge.exposeObjectAsync("EntityForm.GetController", [this.view.name]);
|
|
3634
|
+
controller.invokeMethodAsync("MoveToPreviousStage", [], function () { }, errorCallback, scope);
|
|
3635
|
+
controller.release();
|
|
3636
|
+
};
|
|
3637
|
+
|
|
3638
|
+
MobileCRM.UI.ProcessController.prototype.moveToNextStage = function ( errorCallback, scope) {
|
|
3639
|
+
/// <summary>[15.0] Progresses to the next stage of the active process.</summary>
|
|
3640
|
+
/// <param name="errorCallback" type="function(errorMsg)">The errorCallback which is called asynchronously in case of error.</param>
|
|
3641
|
+
/// <param name="scope" type="Object">The scope for callback.</param>
|
|
3642
|
+
var controller = MobileCRM.bridge.exposeObjectAsync("EntityForm.GetController", [this.view.name]);
|
|
3643
|
+
controller.invokeMethodAsync("MoveToNextStage", [], function () { }, errorCallback, scope);
|
|
3644
|
+
controller.release();
|
|
3645
|
+
};
|
|
3616
3646
|
|
|
3617
3647
|
// MobileCRM.UI.ViewDefinition
|
|
3618
3648
|
MobileCRM.UI.ViewDefinition.loadEntityViews = function (entityName, callback, errorCallback, scope) {
|
|
@@ -4738,7 +4768,7 @@
|
|
|
4738
4768
|
|
|
4739
4769
|
// MobileCRM.UI.EntityForm
|
|
4740
4770
|
_inherit(MobileCRM.UI.EntityForm, MobileCRM.ObservableObject);
|
|
4741
|
-
|
|
4771
|
+
MobileCRM.UI.EntityForm._handlers = { onChange: [], onSave: [], onPostSave: [], onDetailCollectionChange: [], onSelectedViewChanged: [], onProcessLoaded: [] };
|
|
4742
4772
|
|
|
4743
4773
|
MobileCRM.UI.EntityForm.prototype.getDetailView = function (name) {
|
|
4744
4774
|
/// <summary>Returns the DetailView by its name.</summary>
|
|
@@ -4970,6 +5000,17 @@
|
|
|
4970
5000
|
if (register)
|
|
4971
5001
|
MobileCRM.bridge.command("registerEvents", "onChange");
|
|
4972
5002
|
}
|
|
5003
|
+
MobileCRM.UI.EntityForm.onProcessLoaded = function (handler, bind, scope) {
|
|
5004
|
+
/// <summary>Binds or unbinds the handler for onProcessLoaded event on EntityForm.</summary>
|
|
5005
|
+
/// <param name="handler" type="function(entityForm)">The handler function that has to be bound or unbound.</param>
|
|
5006
|
+
/// <param name="bind" type="Boolean">Determines whether to bind or unbind the handler.</param>
|
|
5007
|
+
/// <param name="scope" type="Object">The scope for handler calls.</param>
|
|
5008
|
+
var handlers = MobileCRM.UI.EntityForm._handlers.onProcessLoaded;
|
|
5009
|
+
var register = handlers.length == 0;
|
|
5010
|
+
_bindHandler(handler, handlers, bind, scope);
|
|
5011
|
+
if (register)
|
|
5012
|
+
MobileCRM.bridge.command("registerEvents", "onProcessLoaded");
|
|
5013
|
+
}
|
|
4973
5014
|
MobileCRM.UI.EntityForm.onItemChange = function (itemName, handler, bind, scope) {
|
|
4974
5015
|
/// <summary>[v11.2] Binds or unbinds the handler for specific item change event on EntityForm.</summary>
|
|
4975
5016
|
/// <param name="itemName" type="String">The name of desired detail item (mostly logical name of the field).</param>
|