@resconet/jsbridge 18.0.0-beta.4 → 18.0.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resconet/jsbridge",
3
- "version": "18.0.0-beta.4",
3
+ "version": "18.0.0",
4
4
  "main": "./src/JSBridge.js",
5
5
  "types": "./src/JSBridge.d.ts",
6
6
  "description": "Install npm JSBridge module",
package/src/JSBridge.d.ts CHANGED
@@ -1899,9 +1899,16 @@ declare module MobileCRM.UI {
1899
1899
  * @param index Item index on the view.
1900
1900
  * @param dialogSetup Lookup setup for modal lookup dialog.
1901
1901
  * @param inlinePickSetup Optional setup for inline lookup picker. Leave empty to use the same setup as modal dialog.
1902
- * @param dialogOnly Indicates whether to allow the inline picker. Set "true" to disable the inline picker and always use the modal dialog. Set false to allow the inline picker.
1902
+ * @param dialogOnly Optional - indicates whether to allow the inline picker. Set "true" to disable the inline picker and always use the modal dialog. Set "false" to allow the inline picker. Default value is "false".
1903
+ * @param allowCreateNew Optional - [18.0+] indicates whether to allow creation of new items. Default value is "true".
1903
1904
  */
1904
- updateLinkItemViews(index: number, dialogSetup: DetailViewItems.LookupSetup, inlinePickSetup?: DetailViewItems.LookupSetup, dialogOnly?: boolean);
1905
+ updateLinkItemViews(
1906
+ index: number,
1907
+ dialogSetup: DetailViewItems.LookupSetup,
1908
+ inlinePickSetup?: DetailViewItems.LookupSetup,
1909
+ dialogOnly?: boolean = false,
1910
+ allowCreateNew?: boolean = true
1911
+ );
1905
1912
  /**
1906
1913
  * @since 13.1
1907
1914
  * Add detail item to desired position in to grid.
@@ -2134,6 +2141,21 @@ declare module MobileCRM.UI {
2134
2141
  errorCallback?: (err: string) => void,
2135
2142
  scope?: any
2136
2143
  );
2144
+ /**
2145
+ * @since 18.0
2146
+ * Sets the field value on entity record shown on this EntityForm.
2147
+ * @param fieldName Logical name of the field that has to be changed.
2148
+ * @param value New value of entity field with given name.
2149
+ * @returns A promise resolved with boolean result of native field setter.
2150
+ */
2151
+ public static setFieldValue(fieldName: string, value: any): Promise<boolean>;
2152
+ /**
2153
+ * @since 18.0
2154
+ * Sets several field values on entity record loaded on this EntityForm.
2155
+ * @param changes An object defining field changes that has to be done on form entity.
2156
+ * @returns A promise resolved with boolean result of native field setter.
2157
+ */
2158
+ public static setFieldValues(changes: { [fieldName: string]: any }): Promise<boolean>;
2137
2159
  /**
2138
2160
  * Binds or unbinds the handler for EntityForm command.
2139
2161
  * @param command The name of the EntityForm command.
package/src/JSBridge.js CHANGED
@@ -3927,17 +3927,22 @@
3927
3927
  //this.items[index].value = defaultValue !== undefined ? defaultValue : listDataSource[Object.keys(listDataSource)[0]];
3928
3928
  MobileCRM.bridge.command("detailViewAction", JSON.stringify(data));
3929
3929
  };
3930
- MobileCRM.UI._DetailView.prototype.updateLinkItemViews = function (index, dialogSetup, inlinePickSetup, dialogOnly) {
3930
+ MobileCRM.UI._DetailView.prototype.updateLinkItemViews = function (index, dialogSetup, inlinePickSetup, dialogOnly, allowCreateNew) {
3931
3931
  /// <summary>[v10.1] Changes the <see cref="MobileCRM.UI.DetailViewItems.ComboBoxItem">ComboBoxItem</see> views and/or filters.</summary>
3932
3932
  /// <param name="index" type="Number">Item index on the view.</param>
3933
3933
  /// <param name="dialogSetup" type="MobileCRM.UI.DetailViewItems.LookupSetup">Lookup setup for modal lookup dialog.</param>
3934
3934
  /// <param name="inlinePickSetup" type="MobileCRM.UI.DetailViewItems.LookupSetup">Optional setup for inline lookup picker. Leave empty to use the same setup as modal dialog.</param>
3935
- /// <param name="dialogOnly" type="Boolean">Indicates whether to allow the inline picker. Set &quot;true&quot; to disable the inline picker and always use the modal dialog. Set &quot;false&quot; to allow the inline picker.<param>
3935
+ /// <param name="dialogOnly" type="Boolean">Optional - indicates whether to allow the inline picker. Set **true** to disable the inline picker and always use the modal dialog. Set **false**; to allow the inline picker. Default value is **true**</param>
3936
+ /// <param name="allowCreateNew" type="Boolean">Optional - [v18.0] Indicates whether to allow creation of new items. Default value is **true**.</param>
3936
3937
  var xml = "<lookup>";
3937
3938
  xml += dialogSetup._serialize();
3938
3939
  if (!dialogOnly && inlinePickSetup) {
3939
3940
  xml += inlinePickSetup._serialize();
3940
3941
  }
3942
+ if (allowCreateNew === undefined || allowCreateNew === null) {
3943
+ allowCreateNew = true;
3944
+ }
3945
+ xml += "<createNew>" + (allowCreateNew ? 1 : 0) + "</createNew>";
3941
3946
  xml += "<dialog>" + (dialogOnly ? 1 : 0) + "</dialog>";
3942
3947
  xml += "</lookup>";
3943
3948
  var data = {
@@ -5725,6 +5730,21 @@
5725
5730
  /// <param name="scope" type="Object">The scope for callback.</param>
5726
5731
  MobileCRM.bridge.invokeMethodAsync("EntityForm", "LoadView", [tabName, load], undefined, errorCallback, scope);
5727
5732
  };
5733
+ MobileCRM.UI.EntityForm.setFieldValue = function (fieldName, value) {
5734
+ /// <summary>[v18.0] Sets the field value on entity record shown on this EntityForm.</summary>
5735
+ /// <param name="fieldName" type="String">Logical name of the field that has to be changed.</param>
5736
+ /// <param name="value" type="any">New value of entity field with given name.</param>
5737
+ /// <returns type="Promise&lt;boolean&gt;">A promise resolved with boolean result of native field setter.</returns>
5738
+ var obj = {};
5739
+ obj[fieldName] = value;
5740
+ return MobileCRM.UI.EntityForm.setFieldValues(obj);
5741
+ };
5742
+ MobileCRM.UI.EntityForm.setFieldValues = function (changes) {
5743
+ /// <summary>[v18.0] Sets several field values on entity record loaded on this EntityForm.</summary>
5744
+ /// <param name="changes" type="{ [fieldName: string]: any }">An object defining field changes that has to be done on form entity record.</param>
5745
+ /// <returns type="Promise&lt;boolean&gt;">A promise resolved with boolean result of native field setter.</returns>
5746
+ return MobileCRM.bridge.invokeCommandPromise("setFormEntityFields", JSON.stringify(changes));
5747
+ };
5728
5748
  MobileCRM.UI.EntityForm.requestObject = function (callback, errorCallback, scope) {
5729
5749
  /// <summary>Requests the managed EntityForm object.</summary>
5730
5750
  /// <remarks>Method initiates an asynchronous request which either ends with calling the <b>errorCallback</b> or with calling the <b>callback</b> with Javascript version of EntityForm object. See <see cref="MobileCRM.Bridge.requestObject">MobileCRM.Bridge.requestObject</see> for further details.</remarks>