spitfirepm 1.10.67 → 1.10.71

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.
@@ -159,6 +159,7 @@ export declare class sfRestClient {
159
159
  BuildViewModelForContext(partName: string, context: string, forDocType: GUID | undefined, rawData: [{}] | {}): Promise<DataModelCollection>;
160
160
  /**
161
161
  * Legacy version of BuildViewModelForContext - use .done()
162
+ * @deprecated use BuildViewModelForContext()
162
163
  */
163
164
  BuildViewModel(partName: string, context: string, rawData: any, unusedCfgData: undefined, forDocType: GUID | undefined): JQueryPromise<any>;
164
165
  /**
@@ -373,7 +374,7 @@ export declare class sfRestClient {
373
374
  FindRowIndexByKey(rawData: DataModelCollection, keyName: string, keyValue: string): number | undefined;
374
375
  /**
375
376
  * Builds a string array of values that help define the context of a lookup or evaluation
376
- * @param dependsOnList semicolon separated list of related field and constants. eg #DocMasterDetail.Project;=Subtype
377
+ * @param dependsOnList semicolon separated list of related field and constants. eg #DocMasterDetail.Project;=Subtype (# is optional)
377
378
  * @param rawRow primary source of data
378
379
  */
379
380
  GatherDependsOnValues(dependsOnList: string, rawRow: any): string[] | undefined;
@@ -425,9 +426,18 @@ export declare class sfRestClient {
425
426
  * - Nav To (dcmodules and admin tools)
426
427
  */
427
428
  InvokeAction(actionString: string | _SwaggerClientExports.MenuAction, rowData?: DataModelRow): void;
429
+ FollowLinkViaSFLink(targetURL: string, afterOpenArg?: boolean | string | [string, string] | Function, autoCloseDoc?: boolean): void;
430
+ /**
431
+ *
432
+ * @param et token passed to sfLink
433
+ * @param afterOpenArg boolean/true: closes document page; false/0: posts back default refresh; ['e','a']: posts back e with a;
434
+ * @param autoCloseDoc
435
+ */
436
+ OpenWindowsLinkHelper(et: string, afterOpenArg?: boolean | string | [string, string] | Function, autoCloseDoc?: boolean): void;
428
437
  /** Finds $$ and other replacable values */
429
438
  protected ExpandActionMarkers(rawAction: string, rowData?: DataModelRow): string;
430
439
  protected GetActionMarkerReplacement(markerName: string, rowData?: DataModelRow): string;
440
+ protected getCookie(cname: string): string;
431
441
  /**
432
442
  * Figures out the type of page and the amount of viewable height (without scrolling)
433
443
  * @returns height of top frame
@@ -484,6 +494,12 @@ export declare class sfRestClient {
484
494
  * @param dep4
485
495
  */
486
496
  sfAC($AC: string | JQuery<HTMLInputElement>, lookupName: string, depends1: string | string[], dep2?: string, dep3?: string, dep4?: string): void;
497
+ /** Displays a modal dialog and returns a reference to the dialog for further manipulation
498
+ * @argument msg the text for the dialog message. Can include html
499
+ * @argument title optional title
500
+ * @argument uiAlertIcon if specified, and not false, ui-icon class name (see https://api.jqueryui.com/theming/icons/)
501
+ */
502
+ jqAlert(msg: string, title?: string, uiAlertIcon?: string): JQuery<HTMLElement>;
487
503
  ModalDialog(url: string, eventId: string, eventArg: string, eventContext: Window): Promise<boolean | undefined> | undefined;
488
504
  protected $LookupDialog: JQuery<HTMLDivElement> | undefined;
489
505
  protected $LookupDialogStack: JQuery<HTMLDivElement>[];
@@ -502,6 +518,13 @@ export declare class sfRestClient {
502
518
  * this is the lookup DIV
503
519
  */
504
520
  protected sfModelDialogResizedHandler(): void;
521
+ /**
522
+ * (OBSOLETE) Resize parent sfDash window
523
+ * @deprecated We cannot change the size of the parent window (dates back to sfDash)
524
+ * @param canShrink
525
+ * @param DesiredWidth
526
+ * @param DesiredHeight
527
+ */
505
528
  protected sfSetParentWindowSize(canShrink: boolean, DesiredWidth: number, DesiredHeight: number): void;
506
529
  private sfLookupHeightChangeTo;
507
530
  private _LookupViewPortAdjustments;
@@ -9,7 +9,7 @@ const BrowserExtensionChecker_1 = require("./BrowserExtensionChecker");
9
9
  //import localForage from "localforage"; requires --allowSyntheticDefaultImports in tsconfig
10
10
  const localForage = require("localforage");
11
11
  //import {dialog} from "jquery-ui";
12
- const ClientPackageVersion = "1.10.67";
12
+ const ClientPackageVersion = "1.10.71";
13
13
  //export type GUID = string //& { isGuid: true };
14
14
  /* eslint-disable prefer-template */
15
15
  /* eslint-disable no-extend-native */
@@ -515,6 +515,7 @@ class sfRestClient {
515
515
  }
516
516
  /**
517
517
  * Legacy version of BuildViewModelForContext - use .done()
518
+ * @deprecated use BuildViewModelForContext()
518
519
  */
519
520
  BuildViewModel(partName, context, rawData, unusedCfgData, forDocType) {
520
521
  if (!sfRestClient._z.WCCLoaded)
@@ -957,6 +958,13 @@ class sfRestClient {
957
958
  }
958
959
  else if (dependsOn)
959
960
  DependsOnSet[0] = dependsOn;
961
+ //removed all "undefined" from the end, leaving at least one
962
+ for (let index = DependsOnSet.length - 1; index >= 1; index--) {
963
+ if (DependsOnSet[index - 1] != "undefined")
964
+ break;
965
+ if (DependsOnSet[index] == "undefined")
966
+ DependsOnSet.pop();
967
+ }
960
968
  var DVFilters = new SwaggerClients_1.QueryFilters();
961
969
  DVFilters.MatchingSeed = keyValue;
962
970
  DVFilters.DependsOn = DependsOnSet;
@@ -1702,7 +1710,7 @@ class sfRestClient {
1702
1710
  }
1703
1711
  /**
1704
1712
  * Builds a string array of values that help define the context of a lookup or evaluation
1705
- * @param dependsOnList semicolon separated list of related field and constants. eg #DocMasterDetail.Project;=Subtype
1713
+ * @param dependsOnList semicolon separated list of related field and constants. eg #DocMasterDetail.Project;=Subtype (# is optional)
1706
1714
  * @param rawRow primary source of data
1707
1715
  */
1708
1716
  GatherDependsOnValues(dependsOnList, rawRow) {
@@ -1712,8 +1720,9 @@ class sfRestClient {
1712
1720
  dependsOnList.split(";").forEach(element => {
1713
1721
  if (element.startsWith("="))
1714
1722
  result.push(element.substring(1));
1715
- if (element.startsWith("#")) {
1716
- element = element.substring(1);
1723
+ else {
1724
+ if (element.startsWith("#"))
1725
+ element = element.substring(1);
1717
1726
  if (element.indexOf(".") > 0) {
1718
1727
  var ElementNameParts = element.split(".");
1719
1728
  var TableName = ElementNameParts[0];
@@ -2058,6 +2067,31 @@ class sfRestClient {
2058
2067
  Acct = rowData["acct"];
2059
2068
  this.VModalPage("TranHistory", "&project={0}&task={1}&acct={2}&period=%".sfFormat(Project, Task, Acct), 999, 444, undefined);
2060
2069
  }
2070
+ else if (ActionString.indexOf("PopXLTool(") >= 0 ||
2071
+ ActionString.indexOf("PopFVC(") >= 0 ||
2072
+ ActionString.indexOf("PopMSWindowTool(") >= 0 ||
2073
+ ActionString.indexOf("PopAuditTool(") >= 0) {
2074
+ var targetURL = "";
2075
+ if (ActionString.indexOf("PopFVC(") >= 0) {
2076
+ var rx = /javascript:PopFVC\(['"`](?<URL>.*)[`'"],['"`](?<fileKey>.*)[`'"],['"`](?<idname>.*)[`'"],['"`](?<command>.*)[`'"]/gm;
2077
+ var match = rx.exec(ActionString);
2078
+ if (match && match.groups) {
2079
+ targetURL = `${this._SiteRootURL}/cabs/FileVersion.application?key=${match.groups.fileKey}&id=${match.groups.idname}&cmd=${match.groups.command}`;
2080
+ }
2081
+ else
2082
+ console.warn("InvokeAction() could not parse PopFVC() ", actionString);
2083
+ }
2084
+ else {
2085
+ var rx = /javascript:(PopMSWindowTool|PopXLTool|PopAuditTool)\(['"`](?<URL>.*)[`'"]\)/gm;
2086
+ var match = rx.exec(ActionString);
2087
+ if (match && match.groups) {
2088
+ targetURL = match.groups.URL;
2089
+ }
2090
+ else
2091
+ console.warn("InvokeAction() could not parse", actionString);
2092
+ }
2093
+ this.FollowLinkViaSFLink(targetURL, false);
2094
+ }
2061
2095
  else if (ActionString.indexOf("/dcmodules/") >= 0 || ActionString.indexOf("/admin/") >= 0) {
2062
2096
  console.warn("InvokeAction::tools not really done", ActionString);
2063
2097
  top.location.href = ActionString;
@@ -2079,6 +2113,113 @@ class sfRestClient {
2079
2113
  console.warn("InvokeAction() could not handle ", actionString);
2080
2114
  }
2081
2115
  }
2116
+ FollowLinkViaSFLink(targetURL, afterOpenArg, autoCloseDoc) {
2117
+ var RESTClient = this;
2118
+ if (targetURL.endsWith("&Project="))
2119
+ targetURL += RESTClient.GetPageProjectKey();
2120
+ if (!top?.ClickOnceExtension.HasDotNetApplicationExtension()) {
2121
+ var RetryLater = `FollowLinkViaSFLink('${targetURL}'`;
2122
+ if (typeof afterOpenArg !== "undefined") {
2123
+ RetryLater = RetryLater + `,${afterOpenArg}`;
2124
+ if (typeof autoCloseDoc !== "undefined")
2125
+ RetryLater = RetryLater + `,${autoCloseDoc}`;
2126
+ }
2127
+ RetryLater = RetryLater + ");";
2128
+ setTimeout(RetryLater, 222);
2129
+ return;
2130
+ }
2131
+ if (!top.ClickOnceExtension.HasDotNetApplicationExtension()) {
2132
+ var DialogButtons = [];
2133
+ DialogButtons.push({
2134
+ text: "Install",
2135
+ "id": "btnOK",
2136
+ click: function () {
2137
+ RESTClient.InvokeAction(BrowserExtensionChecker_1.BrowserExtensionChecker.WRemixWebstoreLink);
2138
+ $(this).dialog("close");
2139
+ }
2140
+ });
2141
+ DialogButtons.push({
2142
+ text: "Ignore",
2143
+ "id": "btnIgnore",
2144
+ click: function () {
2145
+ top?.ClickOnceExtension.IgnoreMissingExtension();
2146
+ $(this).dialog("close");
2147
+ RESTClient.jqAlert("Please try your action again. If you see a prompt to keep or open (at the bottom), click to proceed!", ".NET Link Helper Recommended");
2148
+ return;
2149
+ }
2150
+ });
2151
+ var $A = RESTClient.jqAlert(`ClickOnce Helper is required. Please install <a href='${BrowserExtensionChecker_1.BrowserExtensionChecker.WRemixWebstoreLink}' style='text-decoration: underline' target='_blank'>this extension</a>!`, ".NET Link Helper Required");
2152
+ $A.dialog('option', 'buttons', DialogButtons);
2153
+ return;
2154
+ }
2155
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
2156
+ console.log("FollowLinkViaSFLink() xt for: " + targetURL);
2157
+ var api = new SwaggerClients_1.SessionClient(RESTClient._SiteURL);
2158
+ var tokeArgs = new _SwaggerClientExports.TokenRequest();
2159
+ tokeArgs.Args = targetURL;
2160
+ tokeArgs.UserKey = RESTClient.GetPageContextValue("UserKey");
2161
+ tokeArgs.LoginSessionKey = RESTClient.GetPageContextValue("LoginSessionKey");
2162
+ tokeArgs.DataLockFlag = RESTClient.GetPageContextValue("DataLockFlag");
2163
+ tokeArgs.DataPK = RESTClient.GetPageContextValue("DataPK");
2164
+ tokeArgs.DocSessionKey = RESTClient.GetPageContextValue("DocSessionKey");
2165
+ tokeArgs.dsCacheKey = RESTClient.GetPageContextValue("dsCacheKey");
2166
+ tokeArgs.SiteID = RESTClient.GetPageContextValue("SiteID");
2167
+ tokeArgs.PageName = RESTClient.GetPageContextValue("PageName");
2168
+ tokeArgs.PartName = RESTClient.GetPageContextValue("PartName");
2169
+ tokeArgs.TZOffset = RESTClient.GetPageContextValue("TZOffset");
2170
+ api.createExchangeToken(tokeArgs).then((xToken) => {
2171
+ if (xToken && xToken?.length > 3) {
2172
+ if (!autoCloseDoc && typeof autoCloseDoc !== "boolean")
2173
+ autoCloseDoc = false;
2174
+ RESTClient.OpenWindowsLinkHelper(xToken, afterOpenArg, autoCloseDoc);
2175
+ }
2176
+ else {
2177
+ RESTClient.jqAlert("Could not get link exchange token - contact support");
2178
+ }
2179
+ });
2180
+ }
2181
+ /**
2182
+ *
2183
+ * @param et token passed to sfLink
2184
+ * @param afterOpenArg boolean/true: closes document page; false/0: posts back default refresh; ['e','a']: posts back e with a;
2185
+ * @param autoCloseDoc
2186
+ */
2187
+ OpenWindowsLinkHelper(et, afterOpenArg, autoCloseDoc) {
2188
+ var RESTClient = this;
2189
+ var openURL = `${this._SiteURL}/cabs/sflink/sfLink.application?et=${et}&ak=${this.getCookie("ARRAffinity")}`;
2190
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
2191
+ console.log("OpenWindowsLinkHelper() to: " + openURL);
2192
+ var xscript = "";
2193
+ var innerScript = "";
2194
+ var innerDelay = 255 + (BrowserExtensionChecker_1.BrowserExtensionChecker.browser.isEdge ? 789 : 0);
2195
+ xscript = `top.location.href = '${openURL}';`;
2196
+ // afterOpenArg: boolean/true: closes document page; false/0: posts back default refresh; ['e','a']: posts back e with a;
2197
+ if (RESTClient.IsDocumentPage() && typeof afterOpenArg === "boolean" && afterOpenArg) {
2198
+ innerScript = "top.ResetUnsavedChanges();";
2199
+ if (autoCloseDoc) {
2200
+ innerScript += 'setTimeout(\\\'top.location.href = "about:blank";\\\', 842);';
2201
+ innerScript += "window.top.close();";
2202
+ }
2203
+ xscript = `setTimeout(\'${innerScript};\', 242);` + xscript;
2204
+ }
2205
+ else if (!afterOpenArg || typeof afterOpenArg === "string" || (Array.isArray(afterOpenArg) && afterOpenArg.length === 2)) {
2206
+ if (!afterOpenArg)
2207
+ afterOpenArg = "ibtnRefreshAttachList";
2208
+ var pbArg = 'AfterPopFVC';
2209
+ if (Array.isArray(afterOpenArg) && afterOpenArg.length === 2) {
2210
+ pbArg = afterOpenArg[1];
2211
+ afterOpenArg = afterOpenArg[0];
2212
+ }
2213
+ innerScript = `PostbackRefresh(\\\'${afterOpenArg}\\\',\\\'${pbArg}\\\');`;
2214
+ }
2215
+ else if (typeof afterOpenArg === "function")
2216
+ afterOpenArg(et);
2217
+ else
2218
+ console.log("OpenWindowsLinkHelper() - no post action", afterOpenArg);
2219
+ if (typeof innerScript === "string" && innerScript.length > 0)
2220
+ xscript = `setTimeout(\'${innerScript};\', ${innerDelay});` + xscript;
2221
+ setTimeout(xscript, 211);
2222
+ }
2082
2223
  /** Finds $$ and other replacable values */
2083
2224
  ExpandActionMarkers(rawAction, rowData) {
2084
2225
  if (rawAction.indexOf("$$PROJECT") >= 0) {
@@ -2101,6 +2242,18 @@ class sfRestClient {
2101
2242
  }
2102
2243
  return result;
2103
2244
  }
2245
+ getCookie(cname) {
2246
+ var name = cname + "=";
2247
+ var ca = document.cookie.split(';');
2248
+ for (var i = 0; i < ca.length; i++) {
2249
+ var c = ca[i]; //.trim() did not work in IE
2250
+ while (c.length > 0 && c.charAt(0) === ' ')
2251
+ c = c.substring(1, c.length);
2252
+ if (c.indexOf(name) === 0)
2253
+ return c.substring(name.length, c.length);
2254
+ }
2255
+ return "";
2256
+ }
2104
2257
  /**
2105
2258
  * Figures out the type of page and the amount of viewable height (without scrolling)
2106
2259
  * @returns height of top frame
@@ -2455,6 +2608,51 @@ class sfRestClient {
2455
2608
  console.log(`sfAC Key ${e.which}; autofocus off`);
2456
2609
  }).data("acOpen", false).data("acChange", false);
2457
2610
  }
2611
+ /** Displays a modal dialog and returns a reference to the dialog for further manipulation
2612
+ * @argument msg the text for the dialog message. Can include html
2613
+ * @argument title optional title
2614
+ * @argument uiAlertIcon if specified, and not false, ui-icon class name (see https://api.jqueryui.com/theming/icons/)
2615
+ */
2616
+ jqAlert(msg, title, uiAlertIcon) {
2617
+ console.log("jqAlert: " + msg);
2618
+ var $ALERT;
2619
+ if (!title)
2620
+ title = "Message from Web Application";
2621
+ if ((typeof uiAlertIcon === "undefined") || (typeof uiAlertIcon === "boolean" && uiAlertIcon)) {
2622
+ uiAlertIcon = '<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>';
2623
+ }
2624
+ else if ((typeof uiAlertIcon === "boolean" && !uiAlertIcon))
2625
+ uiAlertIcon = "";
2626
+ else if ((typeof uiAlertIcon === "string") && (uiAlertIcon.length > 1))
2627
+ uiAlertIcon = `<span class="ui-icon ${uiAlertIcon}" style="float: left; margin: 0 7px 20px 0;"></span>`;
2628
+ var fullMsg = `<div id="sfUI-Dialog-Alert" title="${title}" style="font-size: 0.8em">${uiAlertIcon}<span id="AlertMsgText">${msg}</span></div>`;
2629
+ var dialogOptions = {
2630
+ modal: true,
2631
+ minWidth: 250,
2632
+ width: "300",
2633
+ height: 'auto',
2634
+ show: {
2635
+ effect: "blind",
2636
+ duration: 444
2637
+ },
2638
+ hide: {
2639
+ effect: "puff",
2640
+ duration: 333
2641
+ },
2642
+ buttons: {
2643
+ Ok: function () {
2644
+ $(this).dialog("close");
2645
+ }
2646
+ },
2647
+ open: function () {
2648
+ $(this).parent('DIV').find('.ui-dialog-buttonpane button:eq(0)').trigger("focus");
2649
+ }
2650
+ };
2651
+ if (msg.length > 20)
2652
+ dialogOptions.width = "auto";
2653
+ $ALERT = $(fullMsg).dialog(dialogOptions);
2654
+ return ($ALERT);
2655
+ }
2458
2656
  ModalDialog(url, eventId, eventArg, eventContext) {
2459
2657
  var newValue;
2460
2658
  var formName = "0";
@@ -2486,7 +2684,8 @@ class sfRestClient {
2486
2684
  if (!this.$LookupDialog) {
2487
2685
  this.$LookupDialog = $(`<div class='clsJQLookup' autofocus='autofocus' ><iframe id='sfClassicUIHolder' src='${sfRestClient._Options.BlankPageURI}' style='width: 100%; height: 150px;border:0;' seamless='seamless' autofocus='autofocus' /></div>`)
2488
2686
  .dialog({ autoOpen: false, modal: true, title: 'Lookup Dialog', width: DefaultWidth, height: 200, close: top.sfClient.sfModalDialogClosed, dialogClass: "lookup",
2489
- resizeStop: top?.sfClient.sfModelDialogResizedHandler });
2687
+ resizeStop: top?.sfClient.sfModelDialogResizedHandler,
2688
+ dragStop: top?.sfClient.sfModelDialogResizedHandler });
2490
2689
  top?.sfClient.AddDialogTitleButton(top.sfClient.$LookupDialog, "btnMaximizeDialog", "Maximize", "ui-icon-arrow-4-diag").on("click", function () {
2491
2690
  var $BTN = $(this);
2492
2691
  var $DialogDiv = $(top.sfClient.$LookupDialog).closest("DIV.ui-dialog");
@@ -2569,6 +2768,8 @@ class sfRestClient {
2569
2768
  var ThisURLHash = OpenUrl.sfHashCode();
2570
2769
  if (sfRestClient._DialogCoordinateCache.has(ThisURLHash)) {
2571
2770
  var TargetSizeData = sfRestClient._DialogCoordinateCache.get(ThisURLHash);
2771
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
2772
+ console.log('ModalDialog() Target size/loc', TargetSizeData);
2572
2773
  var $DialogDiv = $(top.sfClient.$LookupDialog).closest("DIV.ui-dialog");
2573
2774
  top?.sfClient.sfLookupHeightChangeTo(top.sfClient.$LookupDialog, TargetSizeData.height);
2574
2775
  top?.sfClient.sfLookupWidthChangeTo(top.sfClient.$LookupDialog, TargetSizeData.width);
@@ -2760,6 +2961,10 @@ class sfRestClient {
2760
2961
  $LookupDialog.dialog('destroy');
2761
2962
  this.$LookupDialog?.remove();
2762
2963
  this.$LookupDialog = undefined;
2964
+ if (!Array.isArray(this.$LookupDialogStack)) {
2965
+ console.warn("sfModalDialogClosed: re-init $LookupDialogStack");
2966
+ this.$LookupDialogStack = [];
2967
+ }
2763
2968
  if (this.$LookupDialogStack.length > 0)
2764
2969
  this.$LookupDialog = this.$LookupDialogStack.pop();
2765
2970
  if (dialogMode == 'modalDialog') {
@@ -2823,6 +3028,13 @@ class sfRestClient {
2823
3028
  }
2824
3029
  top?.sfClient.sfModelDialogResized($LookupDialog);
2825
3030
  }
3031
+ /**
3032
+ * (OBSOLETE) Resize parent sfDash window
3033
+ * @deprecated We cannot change the size of the parent window (dates back to sfDash)
3034
+ * @param canShrink
3035
+ * @param DesiredWidth
3036
+ * @param DesiredHeight
3037
+ */
2826
3038
  sfSetParentWindowSize(canShrink, DesiredWidth, DesiredHeight) {
2827
3039
  console.warn("sfSetParentWindowSize not implemented");
2828
3040
  // if (top == window) {
@@ -2834,37 +3046,45 @@ class sfRestClient {
2834
3046
  }
2835
3047
  sfLookupHeightChangeTo(ld, newValue) {
2836
3048
  // here newValue represents the intended size for the inner iFrame's rendering area
3049
+ if (typeof newValue === "undefined")
3050
+ newValue = 890;
3051
+ if (typeof newValue === "string")
3052
+ newValue = Number.parseInt(newValue);
3053
+ if (newValue === NaN)
3054
+ newValue = 789;
2837
3055
  if ($("HTML").css("font-size") > "16px") {
2838
3056
  newValue = newValue * 1.1;
2839
3057
  } //"Enlarged" theme is 18px
2840
- if (($(window).height() < (newValue + this._LookupViewPortAdjustments.outsidExtraH)))
2841
- this.sfSetParentWindowSize(false, -1, newValue + this._LookupViewPortAdjustments.outsidExtraH);
3058
+ // if (($(window).height()! < (newValue + this._LookupViewPortAdjustments.outsidExtraH))) this.sfSetParentWindowSize(false, -1, newValue + this._LookupViewPortAdjustments.outsidExtraH);
2842
3059
  if (($(window).height() < (newValue + this._LookupViewPortAdjustments.outsidExtraH))) {
2843
3060
  // requested size still too large
2844
3061
  var requestedH = newValue;
2845
3062
  newValue = $(window).height() - this._LookupViewPortAdjustments.outsidExtraH;
2846
- console.log('dialog height requested cannot be accomidated by window, reduce from ' + requestedH + ' to ' + newValue);
3063
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
3064
+ console.log('dialog height requested cannot be accomidated by window, reduce from ' + requestedH + ' to ' + newValue);
2847
3065
  }
2848
3066
  var tdh = newValue + this._LookupViewPortAdjustments.vpExtraH + this._LookupViewPortAdjustments.frameExtraH;
2849
3067
  ld.dialog('option', "height", tdh);
2850
3068
  //var LookupFrame = $(ld.children("iframe").get(0))
2851
3069
  top?.sfClient.sfModelDialogResized(ld);
2852
3070
  ld.dialog('option', 'position', 'center');
2853
- console.log('dialog height explicitly set to ' + newValue);
3071
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Debug)
3072
+ console.log('dialog height explicitly set to ' + newValue);
2854
3073
  }
2855
3074
  sfLookupWidthChangeTo(ld, newValue) {
2856
- if (($(window).width() < (newValue + this._LookupViewPortAdjustments.outsidExtraW)))
2857
- this.sfSetParentWindowSize(false, newValue + this._LookupViewPortAdjustments.outsidExtraW + this._LookupViewPortAdjustments.vpExtraW, -1);
3075
+ // if (($(window).width()! < (newValue + this._LookupViewPortAdjustments.outsidExtraW))) this.sfSetParentWindowSize(false, newValue + this._LookupViewPortAdjustments.outsidExtraW + this._LookupViewPortAdjustments.vpExtraW, -1);
2858
3076
  if (($(window).width() < (newValue + this._LookupViewPortAdjustments.outsidExtraW))) {
2859
3077
  // requested size still too wide
2860
3078
  var requestedW = newValue;
2861
3079
  newValue = $(window).width() - this._LookupViewPortAdjustments.outsidExtraW;
2862
- console.log('dialog width requested cannot be accomidated by window, reduce from ' + requestedW + ' to ' + newValue);
3080
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
3081
+ console.log('dialog width requested cannot be accomidated by window, reduce from ' + requestedW + ' to ' + newValue);
2863
3082
  }
2864
3083
  ld.dialog('option', "width", newValue + this._LookupViewPortAdjustments.vpExtraW);
2865
3084
  top?.sfClient.sfModelDialogResized(ld);
2866
3085
  setTimeout(function () { ld.dialog('option', 'position', 'center'); }, 259); // need this to happen after above has all completed
2867
- console.log('dialog width explicitly set to ' + newValue);
3086
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Debug)
3087
+ console.log('dialog width explicitly set to ' + newValue);
2868
3088
  }
2869
3089
  /**
2870
3090
  * Updates internal sizes after the dialog frame size is changed
@@ -2872,7 +3092,7 @@ class sfRestClient {
2872
3092
  * @returns
2873
3093
  */
2874
3094
  sfModelDialogResized(forDialog) {
2875
- // this is called after a user resizes the dialog
3095
+ // this is called after a user resizes or moves the dialog
2876
3096
  var dg = forDialog;
2877
3097
  if (!$(window))
2878
3098
  return;
@@ -2881,15 +3101,14 @@ class sfRestClient {
2881
3101
  var height = dg.height(); // actual content area
2882
3102
  var width = Math.round(dg.width() + 1); // actual content area
2883
3103
  var fh = dg.height() - this.DialogViewPortAdjustments.frameExtraH;
2884
- console.log('sfDialogResized resized to {0}w, {1}h inside {2}x{3}, frame h={4}'.sfFormat(width, height, tdw, tdh, fh));
2885
- if ((($(window).width() < (width + this.DialogViewPortAdjustments.outsidExtraW)) || ($(window).height() < (height + this.DialogViewPortAdjustments.outsidExtraH))))
2886
- this.sfSetParentWindowSize(false, width + this.DialogViewPortAdjustments.outsidExtraW, height + this.DialogViewPortAdjustments.outsidExtraH);
3104
+ // console.log('sfDialogResized resized to {0}w, {1}h inside {2}x{3}, frame h={4}'.sfFormat( width ,height , tdw , tdh, fh));
3105
+ // if ((($(window).width()! < (width + this.DialogViewPortAdjustments.outsidExtraW)) || ($(window).height()! < (height + this.DialogViewPortAdjustments.outsidExtraH)))) this.sfSetParentWindowSize(false, width + this.DialogViewPortAdjustments.outsidExtraW, height + this.DialogViewPortAdjustments.outsidExtraH);
2887
3106
  var $DFrame = $(dg.children("iframe").get(0)); // what if there is no frame???
2888
3107
  // $($DFrame).contents().find("html").outerHeight() -- but not a good place to force the height
2889
3108
  $DFrame.css('height', fh); // also iframe
2890
3109
  $DFrame.css('width', '100%'); // also iframe
2891
3110
  var NewSizeData;
2892
- var PositionNow = dg.position();
3111
+ var PositionNow = dg.closest("DIV.ui-dialog").position();
2893
3112
  NewSizeData = { top: PositionNow.top,
2894
3113
  left: PositionNow.left, width: dg.width(),
2895
3114
  height: dg.height()
@@ -2897,6 +3116,8 @@ class sfRestClient {
2897
3116
  var DialogURL = $DFrame.attr("src");
2898
3117
  var DialogURLHash = DialogURL.sfHashCode();
2899
3118
  sfRestClient._DialogCoordinateCache.set(DialogURLHash, NewSizeData);
3119
+ if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
3120
+ console.log(`sfDialogResized(${width}w,${height}h) size cache `, NewSizeData);
2900
3121
  }
2901
3122
  /**
2902
3123
  * Applies UI CFG to all rows in a dataset