fit-ui 2.5.3 → 2.5.4

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/dist/Fit.UI.js CHANGED
@@ -648,7 +648,7 @@ Fit._internal =
648
648
  {
649
649
  Core:
650
650
  {
651
- VersionInfo: { Major: 2, Minor: 5, Patch: 3 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
651
+ VersionInfo: { Major: 2, Minor: 5, Patch: 4 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
652
652
  }
653
653
  };
654
654
 
@@ -17487,6 +17487,13 @@ Fit.Controls.DropDown = function(ctlId)
17487
17487
  }
17488
17488
  }
17489
17489
 
17490
+ // Focus input field on mobile and keep it focused, even if DropDown was opened using arrow icon
17491
+ this._internal.ForceFocusMobile = function()
17492
+ {
17493
+ focusInputOnMobile = true;
17494
+ focusInput(txtPrimary);
17495
+ }
17496
+
17490
17497
  // ============================================
17491
17498
  // Private
17492
17499
  // ============================================
@@ -19179,6 +19186,9 @@ Fit.Controls.WSDropDown = function(ctlId)
19179
19186
  var useActionMenu = false;
19180
19187
  var useActionMenuForced = false;
19181
19188
  var useActionMenuAfterLoad = true;
19189
+ var treeViewEnabled = true;
19190
+ var orgPlaceholder = this.Placeholder;
19191
+ var customPlaceholderSet = false;
19182
19192
  var translations = null;
19183
19193
 
19184
19194
  var onRequestHandlers = [];
@@ -19523,21 +19533,29 @@ Fit.Controls.WSDropDown = function(ctlId)
19523
19533
  // Do not show action menu if the only option available is ShowAll.
19524
19534
  // In this case the user will not be able to select SeachMore, and
19525
19535
  // there is no selected items that can be removed from the control.
19526
- var onlyShowAllOptionDisplayedInActionMenu = actionMenu.GetItems().length === 1 && actionMenu.HasItem("ShowAll") === true;
19536
+ // In this case we ignore useActionMenu === true, even when useActionMenuForced is true.
19537
+ var onlyTheShowAllOptionIsDisplayedInActionMenu = actionMenu.GetItems().length === 1 && actionMenu.HasItem("ShowAll") === true;
19527
19538
 
19528
- if (useActionMenu === true && onlyShowAllOptionDisplayedInActionMenu === false)
19539
+ if (useActionMenu === true && onlyTheShowAllOptionIsDisplayedInActionMenu === false)
19529
19540
  {
19530
19541
  me.SetPicker(actionMenu);
19531
19542
  }
19532
19543
  else
19533
19544
  {
19534
- if (onlyShowAllOptionDisplayedInActionMenu === true)
19545
+ if (onlyTheShowAllOptionIsDisplayedInActionMenu === true)
19535
19546
  {
19536
19547
  useActionMenuAfterLoad = false;
19537
19548
  }
19538
19549
 
19539
- me.SetPicker(tree);
19540
- ensureTreeViewData();
19550
+ if (treeViewEnabled === true)
19551
+ {
19552
+ me.SetPicker(tree);
19553
+ ensureTreeViewData();
19554
+ }
19555
+ else
19556
+ {
19557
+ list.RemoveItems(); // Do not show previous search results again
19558
+ }
19541
19559
  }
19542
19560
  });
19543
19561
 
@@ -19771,12 +19789,98 @@ Fit.Controls.WSDropDown = function(ctlId)
19771
19789
  if (Fit.Validation.IsSet(val) === true && base() !== val)
19772
19790
  {
19773
19791
  base(val);
19774
- updateActionMenu(); // Update action menu to have SearchMore action added/removed depending on whether input is allowed or not
19792
+ localize(); // Add/remove placeholder depending on whether input is enabled or not - also calls updateActionMenu() which will make sure SearchMore action is added/removed depending on whether input is enabled or not
19793
+
19794
+ if (val === false && me.GetPicker() === list)
19795
+ {
19796
+ me.SetPicker(null); // Which picker to use is decided in the OnOpen handler
19797
+ }
19775
19798
  }
19776
19799
 
19777
19800
  return base();
19778
19801
  });
19779
19802
 
19803
+ /// <function container="Fit.Controls.WSDropDown" name="TreeViewEnabled" access="public" returns="boolean">
19804
+ /// <description> Get/set value indicating whether TreeView control is enabled or not </description>
19805
+ /// <param name="val" type="boolean" default="undefined"> If defined, True enables TreeView (default), False disables it </param>
19806
+ /// </function>
19807
+ this.TreeViewEnabled = function(val)
19808
+ {
19809
+ Fit.Validation.ExpectBoolean(val, true);
19810
+
19811
+ if (Fit.Validation.IsSet(val) === true && val !== treeViewEnabled)
19812
+ {
19813
+ treeViewEnabled = val;
19814
+
19815
+ if (useActionMenuForced === false)
19816
+ {
19817
+ // Use action menu if there is no data to display
19818
+
19819
+ if (val === true)
19820
+ {
19821
+ useActionMenu = nodesPopulated === false || tree.GetChildren().length === 0;
19822
+ }
19823
+ else
19824
+ {
19825
+ useActionMenu = true; // User must search to retrieve available options
19826
+ }
19827
+ }
19828
+
19829
+ if (val === false && me.GetPicker() === tree)
19830
+ {
19831
+ me.SetPicker(null); // Which picker to use is decided in the OnOpen handler
19832
+ }
19833
+
19834
+ updateActionMenu(); // Update action menu to have ShowAll action added/removed depending on whether TreeView is enabled or not
19835
+ }
19836
+
19837
+ return treeViewEnabled;
19838
+ }
19839
+
19840
+ /// <function container="Fit.Controls.WSDropDown" name="ListViewEnabled" access="public" returns="boolean">
19841
+ /// <description>
19842
+ /// Get/set flag indicating whether searchable ListView is enabled or not.
19843
+ /// The value provided also determines the value for InputEnabled and vice versa.
19844
+ /// </description>
19845
+ /// <param name="val" type="boolean" default="undefined"> If defined, True enables ListView and search capability (default), False disables it </param>
19846
+ /// </function>
19847
+ this.ListViewEnabled = function(val)
19848
+ {
19849
+ Fit.Validation.ExpectBoolean(val, true);
19850
+ return me.InputEnabled(val);
19851
+ }
19852
+
19853
+ this.Placeholder = function(val)
19854
+ {
19855
+ Fit.Validation.ExpectString(val, true);
19856
+
19857
+ customPlaceholderSet = true;
19858
+ return orgPlaceholder(val);
19859
+ }
19860
+
19861
+ this.OpenDropDown = Fit.Core.CreateOverride(this.OpenDropDown, function()
19862
+ {
19863
+ if (me.InputEnabled() === true && me.GetInputValue() === "" && me.GetSelections().length === 0 && treeViewEnabled === false)
19864
+ {
19865
+ // Do not open DropDown - it will only contain "Search for more options"
19866
+ // when no items are currently selected and TreeView is disabled, and no
19867
+ // search value has been entered yet.
19868
+ // The control will display "Search.." (or a custom placeholder), making it
19869
+ // obvious what the user need to do to get data - no need to display the action menu.
19870
+
19871
+ if (Fit.Browser.GetInfo().IsMobile === true)
19872
+ {
19873
+ // Focus input on mobile, even if DropDown was opened using
19874
+ // the arrow icon - this will bring up the virtual keyboard.
19875
+ this._internal.ForceFocusMobile();
19876
+ }
19877
+
19878
+ return;
19879
+ }
19880
+
19881
+ base();
19882
+ });
19883
+
19780
19884
  /// <function container="Fit.Controls.WSDropDown" name="GetListView" access="public" returns="Fit.Controls.WSListView">
19781
19885
  /// <description> Get WSListView control used to display data in a flat list view </description>
19782
19886
  /// </function>
@@ -19794,7 +19898,21 @@ Fit.Controls.WSDropDown = function(ctlId)
19794
19898
  }
19795
19899
 
19796
19900
  /// <function container="Fit.Controls.WSDropDown" name="UseActionMenu" access="public">
19797
- /// <description> Get/set value indicating whether control uses the built-in action menu to ease addition and removal of items </description>
19901
+ /// <description>
19902
+ /// Get/set value indicating whether control uses the built-in action menu to ease addition and removal of items.
19903
+ /// If this property is not explicitly set, it will automatically be changed by the control depending on data and other settings.
19904
+ /// The action menu will be enabled if TreeViewEnabled is set to False, as it would otherwise not show anything unless the user
19905
+ /// enters a search value. If TreeViewEnabled is True but no data is provided to the TreeView control upon request, the action menu
19906
+ /// is also enabled.
19907
+ /// If the control does not have any selections, InputEnabled (or its alias ListViewEnabled) is True, and TreeViewEnabled is False,
19908
+ /// no picker will be displayed since the action menu would only display the &quot;Search for options&quot; item - but it should already
19909
+ /// be obvious to the user that searching is required due to the placeholder displaying &quot;Search..&quot; by default.
19910
+ /// Likewise, if TreeViewEnabled is True and InputEnabled (or its alias ListViewEnabled) is False, and no selections are made,
19911
+ /// the action menu would only display &quot;Show available options&quot;. In this case the TreeView will be displayed instead,
19912
+ /// even if UseActionMenu has explicitely been set to True.
19913
+ /// The behaviour described is in place to make sure the action menu is only displayed when it makes sense, since it introduces
19914
+ /// and extra step (click) required by the user to access data.
19915
+ /// </description>
19798
19916
  /// <param name="val" type="boolean" default="undefined"> If defined, True enables the action menu, False disables it </param>
19799
19917
  /// </function>
19800
19918
  this.UseActionMenu = function(val)
@@ -19844,7 +19962,7 @@ Fit.Controls.WSDropDown = function(ctlId)
19844
19962
 
19845
19963
  Fit.Internationalization.RemoveOnLocaleChanged(localize);
19846
19964
 
19847
- me = list = tree = actionMenu = search = forceNewSearch = hideLinesForFlatData = dataRequested = dataLoading = nodesPopulated = requestCount = onDataLoadedCallback = suppressTreeOnOpen = timeOut = currentRequest = classes = autoUpdatedSelections = useActionMenu = useActionMenuForced = useActionMenuAfterLoad = translations = onRequestHandlers = onResponseHandlers = null;
19965
+ me = list = tree = actionMenu = search = forceNewSearch = hideLinesForFlatData = dataRequested = dataLoading = nodesPopulated = requestCount = onDataLoadedCallback = suppressTreeOnOpen = timeOut = currentRequest = classes = autoUpdatedSelections = useActionMenu = useActionMenuForced = useActionMenuAfterLoad = treeViewEnabled = orgPlaceholder = customPlaceholderSet = translations = onRequestHandlers = onResponseHandlers = null;
19848
19966
 
19849
19967
  base();
19850
19968
  });
@@ -20057,13 +20175,16 @@ Fit.Controls.WSDropDown = function(ctlId)
20057
20175
  actionMenu.AddItem(searchIcon + translations.SearchMore, "SearchMore");
20058
20176
  }
20059
20177
 
20060
- if (nodesPopulated === false || tree.GetChildren().length > 0)
20178
+ if (treeViewEnabled === true)
20061
20179
  {
20062
- actionMenu.AddItem(showAllIcon + translations.ShowAllOptions, "ShowAll");
20063
- }
20064
- else //if (nodesPopulated === true && tree.GetChildren().length === 0)
20065
- {
20066
- actionMenu.AddItem(showAllIcon + "<i>" + translations.NoneAvailable + ": " + translations.ShowAllOptions + "</i>", "ShowAllNoneFound");
20180
+ if (nodesPopulated === false || tree.GetChildren().length > 0)
20181
+ {
20182
+ actionMenu.AddItem(showAllIcon + translations.ShowAllOptions, "ShowAll");
20183
+ }
20184
+ else //if (nodesPopulated === true && tree.GetChildren().length === 0)
20185
+ {
20186
+ actionMenu.AddItem(showAllIcon + "<i>" + translations.NoneAvailable + ": " + translations.ShowAllOptions + "</i>", "ShowAllNoneFound");
20187
+ }
20067
20188
  }
20068
20189
 
20069
20190
  if (addRemoveAll === true)
@@ -20083,6 +20204,11 @@ Fit.Controls.WSDropDown = function(ctlId)
20083
20204
  translations = locale.Translations;
20084
20205
 
20085
20206
  updateActionMenu();
20207
+
20208
+ if (customPlaceholderSet === false)
20209
+ {
20210
+ orgPlaceholder(me.InputEnabled() === true ? translations.Search : "");
20211
+ }
20086
20212
  }
20087
20213
 
20088
20214
  function onDataLoaded(cb)
@@ -20169,11 +20295,13 @@ Fit.Controls.WSDropDown = function(ctlId)
20169
20295
  {
20170
20296
  InvalidSelection : "Invalid selection",
20171
20297
 
20172
- SearchMore : "Search for more options",
20173
- ShowAllOptions : "Show all available options",
20298
+ // WSDropDown
20299
+ Search : "Search..",
20300
+ SearchMore : "Search for options",
20301
+ ShowAllOptions : "Show available options",
20174
20302
  RemoveAll : "Remove all selected",
20175
20303
  Remove : "Remove",
20176
- NoneAvailable : "None available"
20304
+ NoneAvailable : "The list is empty"
20177
20305
  }
20178
20306
  },
20179
20307
  "da":
@@ -20182,11 +20310,13 @@ Fit.Controls.WSDropDown = function(ctlId)
20182
20310
  {
20183
20311
  InvalidSelection : "Ugyldigt valg",
20184
20312
 
20185
- SearchMore : "Søg efter flere valgmuligheder",
20186
- ShowAllOptions : "Vis alle tilgængelige valgmuligheder",
20313
+ // WSDropDown
20314
+ Search : "Søg..",
20315
+ SearchMore : "Søg efter valgmuligheder",
20316
+ ShowAllOptions : "Vis tilgængelige valgmuligheder",
20187
20317
  RemoveAll : "Fjern alle valgte",
20188
20318
  Remove : "Fjern",
20189
- NoneAvailable : "Ingen tilgængelige"
20319
+ NoneAvailable : "Listen er tom"
20190
20320
  }
20191
20321
  },
20192
20322
  "de":
@@ -20195,11 +20325,13 @@ Fit.Controls.WSDropDown = function(ctlId)
20195
20325
  {
20196
20326
  InvalidSelection : "Ungültige Auswahl",
20197
20327
 
20198
- SearchMore : "Nach weiteren Optionen suchen",
20199
- ShowAllOptions : "Alle verfügbaren Optionen anzeigen",
20328
+ // WSDropDown
20329
+ Search : "Suchen..",
20330
+ SearchMore : "Nach Optionen suchen",
20331
+ ShowAllOptions : "Verfügbare Optionen anzeigen",
20200
20332
  RemoveAll : "Alle ausgewählten entfernen",
20201
20333
  Remove : "Entfernen",
20202
- NoneAvailable : "Keine verfügbar"
20334
+ NoneAvailable : "Die Liste ist leer"
20203
20335
  }
20204
20336
  }
20205
20337
  }