fit-ui 2.16.3 → 2.16.5

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
@@ -682,7 +682,7 @@ Fit._internal =
682
682
  {
683
683
  Core:
684
684
  {
685
- VersionInfo: { Major: 2, Minor: 16, Patch: 3 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
685
+ VersionInfo: { Major: 2, Minor: 16, Patch: 5 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
686
686
  }
687
687
  };
688
688
 
@@ -14034,6 +14034,7 @@ Fit.Controls.DatePicker = function(ctlId)
14034
14034
  var weeks = false; // Whether to display week numbers or not
14035
14035
  var jquery = undefined; // jQuery instance
14036
14036
  var datepicker = null; // jQuery UI calendar widget
14037
+ var datepickerElm = null; // jQuery UI calendar widget element (remains null until shown for the first time - element shared among all DatePicker instances)
14037
14038
  var startDate = null; // Which year/month to display in calendar widget if view needs to be restored (related to restoreView variable)
14038
14039
  var open = false; // Whether calendar widget is currently open
14039
14040
  var focused = false; // Whether control is currently focused
@@ -14287,7 +14288,7 @@ Fit.Controls.DatePicker = function(ctlId)
14287
14288
  if (hasFocus === false && isMobile === false)
14288
14289
  {
14289
14290
  // Make sure Focused() returns true while interacting with calendar widget - https://github.com/Jemt/Fit.UI/issues/194
14290
- var calendarWidget = document.getElementById("fitui-datepicker-div"); // Null if not loaded yet
14291
+ var calendarWidget = datepickerElm; // Null if not loaded yet
14291
14292
  hasFocus = calendarWidget !== null && calendarWidget.style.display === "block" && calendarWidget._associatedFitUiControl === me.GetId();
14292
14293
  }
14293
14294
 
@@ -14502,7 +14503,7 @@ Fit.Controls.DatePicker = function(ctlId)
14502
14503
 
14503
14504
  Fit.Internationalization.RemoveOnLocaleChanged(localize);
14504
14505
 
14505
- me = input = inputTime = orgVal = preVal = prevTimeVal = locale = localeEnforced = format = formatEnforced = placeholderDate = placeholderTime = weeks = jquery = datepicker = startDate = open = focused = restoreView = updateCalConf = detectBoundaries = detectBoundariesRelToViewPort = isMobile = inputMobile = inputTimeMobile = null;
14506
+ me = input = inputTime = orgVal = preVal = prevTimeVal = locale = localeEnforced = format = formatEnforced = placeholderDate = placeholderTime = weeks = jquery = datepicker = datepickerElm = startDate = open = focused = restoreView = updateCalConf = detectBoundaries = detectBoundariesRelToViewPort = isMobile = inputMobile = inputTimeMobile = null;
14506
14507
  base();
14507
14508
  });
14508
14509
 
@@ -14940,7 +14941,7 @@ Fit.Controls.DatePicker = function(ctlId)
14940
14941
 
14941
14942
  datepicker.datepicker("show"); // Fails if not visible (part of render tree)
14942
14943
 
14943
- var calendarWidget = document.getElementById("fitui-datepicker-div");
14944
+ var calendarWidget = datepickerElm;
14944
14945
  calendarWidget._associatedFitUiControl = me.GetId();
14945
14946
 
14946
14947
  // Allow light dismissable panels/callouts to prevent close/dismiss
@@ -15081,6 +15082,12 @@ Fit.Controls.DatePicker = function(ctlId)
15081
15082
  defaultDate: null,
15082
15083
  onChangeMonthYear: function(year, month, dp) // Fires when changing year/month but also when simply opening calendar widget
15083
15084
  {
15085
+ // Retain focus when changing month or year using calendar
15086
+ // widget, which causes its DOM to be removed and replaced.
15087
+ // Focus is later returned to DatePicker, but not in time for
15088
+ // OnFocusOut. Related issue: https://github.com/Jemt/Fit.UI/issues/194
15089
+ input.focus(); // Do not use Focused(true) as it will not re-focus input, since control is already considered focused.
15090
+
15084
15091
  if (open === true) // Remember which year and month the user navigated to
15085
15092
  {
15086
15093
  try
@@ -15101,6 +15108,8 @@ Fit.Controls.DatePicker = function(ctlId)
15101
15108
  },
15102
15109
  beforeShow: function(elm, dp)
15103
15110
  {
15111
+ datepickerElm = dp.dpDiv[0] || null;
15112
+
15104
15113
  // Load locale if not already loaded
15105
15114
 
15106
15115
  if (datepicker.jq.datepicker.regional[locale] === null)
@@ -15128,6 +15137,11 @@ Fit.Controls.DatePicker = function(ctlId)
15128
15137
  return false; // Do not display - wait for locale to load
15129
15138
  }
15130
15139
 
15140
+ // Retain focus when interacting with calendar widget.
15141
+ // Focus is later returned to DatePicker, but not in time for
15142
+ // OnFocusOut. Related issue: https://github.com/Jemt/Fit.UI/issues/194
15143
+ jquery(dp.dpDiv).attr("tabindex", "-1");
15144
+
15131
15145
  // Update settings in case they were changed
15132
15146
 
15133
15147
  var val = me.Value(); // Always returns value in the YYYY-MM-DD[ hh:mm] format, but returns an empty string if value entered is invalid
@@ -15215,7 +15229,7 @@ Fit.Controls.DatePicker = function(ctlId)
15215
15229
 
15216
15230
  function moveCalenderWidgetLocally()
15217
15231
  {
15218
- if (Fit._internal.ControlBase.ReduceDocumentRootPollution !== true)
15232
+ if (me._internal.ReduceDocumentRootPollution !== true && Fit._internal.ControlBase.ReduceDocumentRootPollution !== true)
15219
15233
  {
15220
15234
  return;
15221
15235
  }
@@ -15230,7 +15244,7 @@ Fit.Controls.DatePicker = function(ctlId)
15230
15244
  // For more details see https://github.com/Jemt/Fit.UI/issues/116
15231
15245
 
15232
15246
  var selfDom = me.GetDomElement();
15233
- var calendarWidget = document.getElementById("fitui-datepicker-div");
15247
+ var calendarWidget = datepickerElm;
15234
15248
 
15235
15249
  Fit.Dom.InsertAfter(selfDom, calendarWidget);
15236
15250
 
@@ -15295,12 +15309,12 @@ Fit.Controls.DatePicker = function(ctlId)
15295
15309
 
15296
15310
  function moveCalenderWidgetGlobally() // Undo everything done in moveCalenderWidgetLocally()
15297
15311
  {
15298
- if (Fit._internal.ControlBase.ReduceDocumentRootPollution !== true)
15312
+ if (me._internal.ReduceDocumentRootPollution !== true && Fit._internal.ControlBase.ReduceDocumentRootPollution !== true)
15299
15313
  {
15300
15314
  return;
15301
15315
  }
15302
15316
 
15303
- var calendarWidget = document.getElementById("fitui-datepicker-div");
15317
+ var calendarWidget = datepickerElm;
15304
15318
  Fit.Dom.Add(document.body, calendarWidget);
15305
15319
 
15306
15320
  calendarWidget.style.position = ""; // "absolute"