jqwidgets-ng 19.2.2 → 19.2.3

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.
Files changed (189) hide show
  1. package/esm2020/jqxinput/angular_jqxinput.mjs +25 -3
  2. package/fesm2015/jqwidgets-ng-jqxinput.mjs +25 -3
  3. package/fesm2020/jqwidgets-ng-jqxinput.mjs +25 -3
  4. package/jqwidgets/jqx-all.js +13 -13
  5. package/jqwidgets/jqxangular.js +1 -1
  6. package/jqwidgets/jqxbarcode.js +1 -1
  7. package/jqwidgets/jqxbargauge.js +2 -2
  8. package/jqwidgets/jqxbulletchart.js +1 -1
  9. package/jqwidgets/jqxbuttongroup.js +1 -1
  10. package/jqwidgets/jqxbuttons.js +2 -2
  11. package/jqwidgets/jqxcalendar.js +1 -1
  12. package/jqwidgets/jqxchart.annotations.js +1 -1
  13. package/jqwidgets/jqxchart.api.js +1 -1
  14. package/jqwidgets/jqxchart.core.js +1 -1
  15. package/jqwidgets/jqxchart.js +1 -1
  16. package/jqwidgets/jqxchart.rangeselector.js +1 -1
  17. package/jqwidgets/jqxchart.waterfall.js +1 -1
  18. package/jqwidgets/jqxcheckbox.js +1 -1
  19. package/jqwidgets/jqxcheckboxgroup.js +1 -1
  20. package/jqwidgets/jqxcolorpicker.js +1 -1
  21. package/jqwidgets/jqxcombobox.js +1 -1
  22. package/jqwidgets/jqxcomplexinput.js +1 -1
  23. package/jqwidgets/jqxcore.js +1 -1
  24. package/jqwidgets/jqxdata.export.js +1 -1
  25. package/jqwidgets/jqxdata.js +1 -1
  26. package/jqwidgets/jqxdatatable.js +2 -2
  27. package/jqwidgets/jqxdate.js +1 -1
  28. package/jqwidgets/jqxdatetimeinput.js +1 -1
  29. package/jqwidgets/jqxdocking.js +1 -1
  30. package/jqwidgets/jqxdockinglayout.js +1 -1
  31. package/jqwidgets/jqxdockpanel.js +1 -1
  32. package/jqwidgets/jqxdragdrop.js +1 -1
  33. package/jqwidgets/jqxdraw.js +1 -1
  34. package/jqwidgets/jqxdropdownbutton.js +1 -1
  35. package/jqwidgets/jqxdropdownlist.js +2 -2
  36. package/jqwidgets/jqxeditor.js +1 -1
  37. package/jqwidgets/jqxexpander.js +1 -1
  38. package/jqwidgets/jqxfileupload.js +1 -1
  39. package/jqwidgets/jqxform.js +1 -1
  40. package/jqwidgets/jqxformattedinput.js +1 -1
  41. package/jqwidgets/jqxgantt.js +1 -1
  42. package/jqwidgets/jqxgauge.js +1 -1
  43. package/jqwidgets/jqxgrid.aggregates.js +1 -1
  44. package/jqwidgets/jqxgrid.columnsreorder.js +1 -1
  45. package/jqwidgets/jqxgrid.columnsresize.js +1 -1
  46. package/jqwidgets/jqxgrid.edit.js +1 -1
  47. package/jqwidgets/jqxgrid.export.js +1 -1
  48. package/jqwidgets/jqxgrid.filter.js +2 -2
  49. package/jqwidgets/jqxgrid.grouping.js +1 -1
  50. package/jqwidgets/jqxgrid.js +2 -2
  51. package/jqwidgets/jqxgrid.pager.js +1 -1
  52. package/jqwidgets/jqxgrid.selection.js +2 -2
  53. package/jqwidgets/jqxgrid.sort.js +1 -1
  54. package/jqwidgets/jqxgrid.storage.js +1 -1
  55. package/jqwidgets/jqxheatmap.js +1 -1
  56. package/jqwidgets/jqxinput.js +2 -2
  57. package/jqwidgets/jqxkanban.js +2 -2
  58. package/jqwidgets/jqxknob.js +1 -1
  59. package/jqwidgets/jqxknockout.js +1 -1
  60. package/jqwidgets/jqxlayout.js +1 -1
  61. package/jqwidgets/jqxlistbox.js +1 -1
  62. package/jqwidgets/jqxlistmenu.js +1 -1
  63. package/jqwidgets/jqxloader.js +1 -1
  64. package/jqwidgets/jqxmaskedinput.js +1 -1
  65. package/jqwidgets/jqxmenu.js +1 -1
  66. package/jqwidgets/jqxnavbar.js +1 -1
  67. package/jqwidgets/jqxnavigationbar.js +1 -1
  68. package/jqwidgets/jqxnotification.js +1 -1
  69. package/jqwidgets/jqxnumberinput.js +1 -1
  70. package/jqwidgets/jqxpanel.js +1 -1
  71. package/jqwidgets/jqxpasswordinput.js +1 -1
  72. package/jqwidgets/jqxpivot.js +1 -1
  73. package/jqwidgets/jqxpivotdesigner.js +2 -2
  74. package/jqwidgets/jqxpivotgrid.js +1 -1
  75. package/jqwidgets/jqxpopover.js +1 -1
  76. package/jqwidgets/jqxprogressbar.js +1 -1
  77. package/jqwidgets/jqxqrcode.js +1 -1
  78. package/jqwidgets/jqxradiobutton.js +1 -1
  79. package/jqwidgets/jqxradiobuttongroup.js +2 -2
  80. package/jqwidgets/jqxrangeselector.js +1 -1
  81. package/jqwidgets/jqxrating.js +1 -1
  82. package/jqwidgets/jqxresponsivepanel.js +1 -1
  83. package/jqwidgets/jqxribbon.js +1 -1
  84. package/jqwidgets/jqxscheduler.api.js +1 -1
  85. package/jqwidgets/jqxscheduler.js +1 -1
  86. package/jqwidgets/jqxscrollbar.js +1 -1
  87. package/jqwidgets/jqxscrollview.js +1 -1
  88. package/jqwidgets/jqxslider.js +1 -1
  89. package/jqwidgets/jqxsortable.js +1 -1
  90. package/jqwidgets/jqxsplitter.js +1 -1
  91. package/jqwidgets/jqxswitchbutton.js +1 -1
  92. package/jqwidgets/jqxtabs.js +2 -2
  93. package/jqwidgets/jqxtagcloud.js +1 -1
  94. package/jqwidgets/jqxtextarea.js +1 -1
  95. package/jqwidgets/jqxtimeline.js +1 -1
  96. package/jqwidgets/jqxtimepicker.js +1 -1
  97. package/jqwidgets/jqxtoolbar.js +1 -1
  98. package/jqwidgets/jqxtooltip.js +1 -1
  99. package/jqwidgets/jqxtouch.js +1 -1
  100. package/jqwidgets/jqxtree.js +1 -1
  101. package/jqwidgets/jqxtreegrid.js +1 -1
  102. package/jqwidgets/jqxtreemap.js +1 -1
  103. package/jqwidgets/jqxvalidator.js +1 -1
  104. package/jqwidgets/jqxwindow.js +1 -1
  105. package/jqwidgets/modules/jqxbarcode.js +31 -1
  106. package/jqwidgets/modules/jqxbargauge.js +47 -17
  107. package/jqwidgets/modules/jqxbulletchart.js +31 -1
  108. package/jqwidgets/modules/jqxbuttongroup.js +52 -16
  109. package/jqwidgets/modules/jqxbuttons.js +50 -14
  110. package/jqwidgets/modules/jqxcalendar.js +56 -20
  111. package/jqwidgets/modules/jqxchart.js +31 -1
  112. package/jqwidgets/modules/jqxcheckbox.js +54 -18
  113. package/jqwidgets/modules/jqxcheckboxgroup.js +54 -18
  114. package/jqwidgets/modules/jqxcolorpicker.js +56 -20
  115. package/jqwidgets/modules/jqxcombobox.js +61 -25
  116. package/jqwidgets/modules/jqxcomplexinput.js +52 -16
  117. package/jqwidgets/modules/jqxdatatable.js +90 -50
  118. package/jqwidgets/modules/jqxdatetimeinput.js +75 -39
  119. package/jqwidgets/modules/jqxdocking.js +54 -18
  120. package/jqwidgets/modules/jqxdockinglayout.js +62 -26
  121. package/jqwidgets/modules/jqxdockpanel.js +52 -16
  122. package/jqwidgets/modules/jqxdragdrop.js +54 -18
  123. package/jqwidgets/modules/jqxdraw.js +31 -1
  124. package/jqwidgets/modules/jqxdropdownbutton.js +52 -16
  125. package/jqwidgets/modules/jqxdropdownlist.js +73 -37
  126. package/jqwidgets/modules/jqxeditor.js +85 -49
  127. package/jqwidgets/modules/jqxexpander.js +58 -22
  128. package/jqwidgets/modules/jqxfileupload.js +31 -1
  129. package/jqwidgets/modules/jqxform.js +83 -47
  130. package/jqwidgets/modules/jqxformattedinput.js +75 -39
  131. package/jqwidgets/modules/jqxgantt.js +31 -1
  132. package/jqwidgets/modules/jqxgauge.js +56 -20
  133. package/jqwidgets/modules/jqxgrid.js +3988 -3932
  134. package/jqwidgets/modules/jqxheatmap.js +31 -1
  135. package/jqwidgets/modules/jqxinput.js +1232 -972
  136. package/jqwidgets/modules/jqxkanban.js +1300 -1241
  137. package/jqwidgets/modules/jqxknob.js +54 -18
  138. package/jqwidgets/modules/jqxlayout.js +62 -26
  139. package/jqwidgets/modules/jqxlineargauge.js +56 -20
  140. package/jqwidgets/modules/jqxlinkbutton.js +50 -14
  141. package/jqwidgets/modules/jqxlistbox.js +64 -28
  142. package/jqwidgets/modules/jqxlistmenu.js +81 -45
  143. package/jqwidgets/modules/jqxloader.js +31 -1
  144. package/jqwidgets/modules/jqxmaskedinput.js +31 -1
  145. package/jqwidgets/modules/jqxmenu.js +62 -26
  146. package/jqwidgets/modules/jqxnavbar.js +58 -22
  147. package/jqwidgets/modules/jqxnavigationbar.js +66 -30
  148. package/jqwidgets/modules/jqxnotification.js +58 -22
  149. package/jqwidgets/modules/jqxnumberinput.js +65 -29
  150. package/jqwidgets/modules/jqxpanel.js +56 -20
  151. package/jqwidgets/modules/jqxpasswordinput.js +58 -22
  152. package/jqwidgets/modules/jqxpivotdesigner.js +90 -54
  153. package/jqwidgets/modules/jqxpivotgrid.js +90 -54
  154. package/jqwidgets/modules/jqxpopover.js +52 -16
  155. package/jqwidgets/modules/jqxprogressbar.js +31 -1
  156. package/jqwidgets/modules/jqxqrcode.js +31 -1
  157. package/jqwidgets/modules/jqxradiobutongroup.js +55 -19
  158. package/jqwidgets/modules/jqxradiobutton.js +52 -16
  159. package/jqwidgets/modules/jqxrangeselector.js +31 -1
  160. package/jqwidgets/modules/jqxrating.js +52 -16
  161. package/jqwidgets/modules/jqxrepeatbutton.js +50 -14
  162. package/jqwidgets/modules/jqxresponsivepanel.js +31 -1
  163. package/jqwidgets/modules/jqxribbon.js +54 -18
  164. package/jqwidgets/modules/jqxscheduler.js +1291 -1005
  165. package/jqwidgets/modules/jqxscrollbar.js +10618 -91150
  166. package/jqwidgets/modules/jqxscrollview.js +52 -16
  167. package/jqwidgets/modules/jqxslider.js +52 -16
  168. package/jqwidgets/modules/jqxsortable.js +52 -16
  169. package/jqwidgets/modules/jqxsplitlayout.js +2033 -2075
  170. package/jqwidgets/modules/jqxsplitter.js +52 -16
  171. package/jqwidgets/modules/jqxswitchbutton.js +56 -20
  172. package/jqwidgets/modules/jqxtabs.js +65 -29
  173. package/jqwidgets/modules/jqxtagcloud.js +58 -22
  174. package/jqwidgets/modules/jqxtextarea.js +58 -22
  175. package/jqwidgets/modules/jqxtimeline.js +31 -1
  176. package/jqwidgets/modules/jqxtimepicker.js +31 -1
  177. package/jqwidgets/modules/jqxtogglebutton.js +50 -14
  178. package/jqwidgets/modules/jqxtoolbar.js +1262 -996
  179. package/jqwidgets/modules/jqxtooltip.js +31 -1
  180. package/jqwidgets/modules/jqxtree.js +6381 -195
  181. package/jqwidgets/modules/jqxtreegrid.js +92 -52
  182. package/jqwidgets/modules/jqxtreemap.js +31 -1
  183. package/jqwidgets/modules/jqxvalidator.js +56 -20
  184. package/jqwidgets/modules/jqxwindow.js +52 -16
  185. package/jqwidgets/styles/gantt/jqx.gantt.css +98 -98
  186. package/jqwidgets/styles/jqx.base.css +20 -20
  187. package/jqwidgets.d.ts +2 -0
  188. package/jqxinput/angular_jqxinput.d.ts +5 -1
  189. package/package.json +1 -1
@@ -20,6 +20,30 @@ Copyright (c) 2011-2024 jQWidgets.
20
20
  License: https://jqwidgets.com/license/ */
21
21
 
22
22
 
23
+ /******/ (() => { // webpackBootstrap
24
+ var __webpack_exports__ = {};
25
+
26
+ /* Release Date: 28-May-2024
27
+ Copyright (c) 2011-2024 jQWidgets.
28
+ License: https://jqwidgets.com/license/ */
29
+
30
+
31
+ /******/ (() => { // webpackBootstrap
32
+ var __webpack_exports__ = {};
33
+
34
+ /* Release Date: 28-May-2024
35
+ Copyright (c) 2011-2024 jQWidgets.
36
+ License: https://jqwidgets.com/license/ */
37
+
38
+
39
+ /******/ (() => { // webpackBootstrap
40
+ var __webpack_exports__ = {};
41
+
42
+ /* Release Date: 28-May-2024
43
+ Copyright (c) 2011-2024 jQWidgets.
44
+ License: https://jqwidgets.com/license/ */
45
+
46
+
23
47
  /******/ (() => { // webpackBootstrap
24
48
  /******/ var __webpack_modules__ = ({
25
49
 
@@ -8204,7 +8228,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* tslint:disabl
8204
8228
  // file names, and JQXLite is normally delivered in a lowercase file name.
8205
8229
  // Do this after creating the global so that if an AMD module wants to call
8206
8230
  // noConflict to hide this version of JQXLite, it will work.
8207
- if ( true && __nested_webpack_require_227__.amdO.JQXLite) {
8231
+ if ( true && __nested_webpack_require_227__.amdO.JQXLite) {
8208
8232
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return JQXLite; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
8209
8233
  __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
8210
8234
  }
@@ -17856,1169 +17880,1399 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* tslint:disabl
17856
17880
 
17857
17881
  /* tslint:disable */
17858
17882
  /* eslint-disable */
17859
- (function(){
17860
- if (typeof document === 'undefined') {
17861
- return;
17862
- }
17883
+ (function () {
17884
+ if (typeof document === 'undefined') {
17885
+ return;
17886
+ }
17863
17887
 
17864
- (function ($) {
17865
- 'use strict';
17866
- $.jqx.jqxWidget('jqxInput', '', {});
17888
+ (function ($) {
17889
+ 'use strict';
17890
+ $.jqx.jqxWidget('jqxInput', '', {});
17867
17891
 
17868
- $.extend($.jqx._jqxInput.prototype, {
17869
- defineInstance: function () {
17870
- var that = this;
17871
- var settings = {
17872
- disabled: false,
17873
- filter: that._filter,
17874
- sort: that._sort,
17875
- highlight: that._highlight,
17876
- dropDownWidth: null,
17877
- renderer: that._renderer,
17878
- opened: false,
17879
- $popup: document.createElement('ul'),
17880
- source: [],
17881
- roundedCorners: true,
17882
- searchMode: 'default',
17883
- placeHolder: '',
17884
- width: null,
17885
- height: null,
17886
- value: '',
17887
- rtl: false,
17888
- enableBrowserBoundsDetection: true,
17889
- hint: true,
17890
- displayMember: '',
17891
- valueMember: '',
17892
- events: ['select', 'open', 'close', 'change'],
17893
- popupZIndex: 1000,
17894
- items: 8,
17895
- minLength: 1,
17896
- maxLength: null
17897
- };
17898
- if (this === $.jqx._jqxInput.prototype) {
17892
+ $.extend($.jqx._jqxInput.prototype, {
17893
+ defineInstance: function () {
17894
+ var that = this;
17895
+ var settings = {
17896
+ disabled: false,
17897
+ filter: that._filter,
17898
+ sort: that._sort,
17899
+ highlight: that._highlight,
17900
+ dropDownWidth: null,
17901
+ renderer: that._renderer,
17902
+ opened: false,
17903
+ $popup: document.createElement('ul'),
17904
+ source: [],
17905
+ roundedCorners: true,
17906
+ searchMode: 'default',
17907
+ placeHolder: '',
17908
+ width: null,
17909
+ height: null,
17910
+ value: '',
17911
+ rtl: false,
17912
+ enableBrowserBoundsDetection: true,
17913
+ hint: true,
17914
+ displayMember: '',
17915
+ valueMember: '',
17916
+ inlineAutoComplete: false,
17917
+ events: ['select', 'open', 'close', 'change'],
17918
+ popupZIndex: 1000,
17919
+ items: 8,
17920
+ minLength: 1,
17921
+ maxLength: null,
17922
+ aiKey: ''
17923
+ };
17924
+ if (this === $.jqx._jqxInput.prototype) {
17925
+ return settings;
17926
+ }
17927
+ $.extend(true, this, settings);
17899
17928
  return settings;
17900
- }
17901
- $.extend(true, this, settings);
17902
- return settings;
17903
- },
17929
+ },
17904
17930
 
17905
- createInstance: function () {
17906
- var that = this;
17907
- if (that.host.css('display') === 'none' || document.body.contains(that.element) === false) {
17908
- that._initiallyHidden = true;
17909
- }
17910
- that._popupHelper = $(that.$popup);
17911
- that.render();
17912
- },
17931
+ createInstance: function () {
17932
+ var that = this;
17933
+ if (that.host.css('display') === 'none' || document.body.contains(that.element) === false) {
17934
+ that._initiallyHidden = true;
17935
+ }
17936
+ that._popupHelper = $(that.$popup);
17937
+ that.render();
17938
+ },
17913
17939
 
17914
- render: function () {
17915
- var that = this;
17940
+ getAISuggestions: function (callback) {
17941
+ var that = this;
17942
+ var response = '';
17943
+ if (!that.aiKey) {
17944
+ callback('');
17945
+ }
17946
+
17947
+ function buildPrompt(textBefore, textAfter) {
17948
+ var systemMessageBuilder = [];
17949
+ systemMessageBuilder.push("Predict what text the user in the given ROLE would insert after the cursor position indicated by ^^^. Auto-correct the text.\n");
17950
+ systemMessageBuilder.push("RULES:\n");
17951
+ systemMessageBuilder.push("1. Reply with OK:, then in square brackets the predicted text, then END_INSERTION, and no other output.\n");
17952
+ systemMessageBuilder.push("2. When a specific value or quantity cannot be inferred and would need to be provided, use the word NEED_INFO.\n");
17953
+ systemMessageBuilder.push("3. If there isn't enough information to predict any words that the user would type next, just reply with the word NO_PREDICTION.\n");
17954
+ systemMessageBuilder.push("4. NEVER invent new information. If you can't be sure what the user is about to type, ALWAYS stop the prediction with END_INSERTION.\n");
17955
+
17956
+ /*
17957
+ if (that.userPhrases.length) {
17958
+ systemMessageBuilder.push("\nAlways try to use variations on the following phrases as part of the predictions:\n");
17959
+ for (let i = 0; i < that.userPhrases.length; i++) {
17960
+ systemMessageBuilder.push("- {0}\n", that.userPhrases[i]);
17961
+ }
17962
+ }*/
17916
17963
 
17917
- this.input = this.element;
17964
+ systemMessageBuilder.push("\n\nROLE: " + "User" + " USER_TEXT: " + textBefore + textAfter + "^^^");
17918
17965
 
17919
- if (that.isMaterialized() && this.input instanceof HTMLInputElement) {
17920
- var children = this.host.children();
17921
- $.each(children, function (index) {
17922
- var classToAdd = 'jqx-input-group-addon';
17923
- $(this).removeClass(that.toThemeProperty('jqx-rc-all'));
17924
- if (index === 0) {
17925
- classToAdd += ' jqx-rc-l';
17926
- }
17927
- if (index === children.length - 1) {
17928
- classToAdd += ' jqx-rc-r';
17929
- }
17930
- if (this !== that.element) {
17931
- classToAdd += ' jqx-fill-state-normal';
17932
- }
17933
- this.className += ' ' + that.toThemeProperty(classToAdd);
17934
- });
17966
+ return systemMessageBuilder.join('\n');
17967
+ }
17935
17968
 
17936
- var group = $("<div></div>");
17937
- group.addClass(that.toThemeProperty('jqx-input-group'));
17938
- this.host.after(group);
17939
- var input = this.element;
17940
- var data = this.host.data();
17969
+ function fetchAIResponse(prompt, callback) {
17970
+ var apiKey = that.aiKey; // Replace this with your OpenAI API key (don't expose it on public websites)
17941
17971
 
17942
- group.append(input);
17943
- var label = $("<label></label");
17972
+ var headers = {
17973
+ 'Content-Type': 'application/json',
17974
+ 'Authorization': 'Bearer ' + apiKey
17975
+ };
17944
17976
 
17945
- if (this.hint) {
17946
- label[0].innerHTML = this.placeHolder;
17947
- }
17977
+ var body = JSON.stringify({
17978
+ model: "gpt-3.5-turbo", // or "gpt-4" if you have access
17979
+ messages: [{ role: "user", content: prompt }], // The conversation format
17980
+ // stop_frequences: ["END_INSERTION", "NEED_INFO"],
17981
+ max_tokens: 200 // You can adjust token length based on your needs,
17982
+ });
17948
17983
 
17949
- label.addClass(that.toThemeProperty('jqx-input-label'));
17950
- group.append(label);
17984
+ var xhr = new XMLHttpRequest();
17985
+ xhr.open('POST', 'https://api.openai.com/v1/chat/completions', true);
17986
+ xhr.setRequestHeader('Content-Type', 'application/json');
17987
+ xhr.setRequestHeader('Authorization', 'Bearer ' + apiKey);
17988
+
17989
+ xhr.onreadystatechange = function () {
17990
+ if (xhr.readyState === 4) {
17991
+ if (xhr.status === 200) {
17992
+ var response = JSON.parse(xhr.responseText);
17993
+ // Make sure there are choices and content in the response
17994
+ if (response.choices && response.choices.length > 0 && response.choices[0].message.content) {
17995
+ var content = response.choices[0].message.content;
17996
+
17997
+ if (content.length > 5 && content.startsWith("OK")) {
17998
+ content = content.substring(4);
17999
+ content = content.replace('END_INSERTION', '');
18000
+
18001
+ var matches = content.match(/\[(.*?)\]/g);
18002
+
18003
+ // Remove the brackets from the extracted text
18004
+ if (matches) {
18005
+ // Use map to strip out brackets
18006
+ var extractedText = matches.map(function (match) {
18007
+ return match.replace(/^\[|\]$/g, '');
18008
+ });
18009
+
18010
+ content = extractedText[0]
18011
+ }
18012
+
18013
+ content = content.replace('[', '');
18014
+ content = content.replace(']', '');
18015
+ }
17951
18016
 
17952
- var bar = $("<span></span>");
17953
- group.append(bar);
17954
- bar.addClass(that.toThemeProperty('jqx-input-bar'));
18017
+ if (content.indexOf('NO_PREDICTION') >= 0) {
18018
+ content = '';
18019
+ }
17955
18020
 
17956
- group[0].id = this.element.id;
17957
- this.element.removeAttribute('id');
18021
+ callback(null, content);
18022
+ }
18023
+ else {
18024
+ callback('Error: No valid response from AI', null);
18025
+ }
18026
+ } else {
18027
+ callback('Error fetching AI response: ' + xhr.statusText, null);
18028
+ }
18029
+ }
18030
+ };
17958
18031
 
17959
- group[0].style.cssText = this.element.style.cssText;
17960
- if (this.element.className.indexOf('underlined') >= 0) {
17961
- group.addClass('underlined');
18032
+ xhr.send(body);
17962
18033
  }
17963
18034
 
17964
- that.input = that.element;
17965
- if (!(this.input instanceof HTMLInputElement)) {
17966
- this.input = this.host.find('input');
17967
- if (this.input.length > 0) {
17968
- this.input = this.input[0];
18035
+ var textBefore = that.input.value.substring(0, that.input.selectionStart);
18036
+ var textAfter = that.input.value.substring(that.input.selectionStart + 1);
18037
+ var text = textBefore + textAfter;
18038
+ if (text.endsWith(' ')) {
18039
+ var prompt = buildPrompt(textBefore, textAfter);
18040
+ fetchAIResponse(prompt.toString(), function (error, aiResponse) {
18041
+ if (error) {
18042
+ callback('');
18043
+ } else {
18044
+ callback(aiResponse);
18045
+ }
17969
18046
  }
17970
- $(this.input).addClass(this.toThemeProperty("jqx-input-widget"));
18047
+ );
17971
18048
  }
17972
- this.label = label;
17973
- this.bar = bar;
17974
- this.element.style.cssText = '';
17975
- this.host = group;
17976
- this.element = group[0];
17977
- this.host.data(data);
18049
+ },
17978
18050
 
18051
+ render: function () {
17979
18052
  var that = this;
17980
18053
 
17981
- if (that.template) {
17982
- that.bar.addClass(that.toThemeProperty("jqx-" + that.template));
17983
- that.label.addClass(that.toThemeProperty("jqx-" + that.template));
17984
- }
18054
+ this.input = this.element;
17985
18055
 
17986
- if (children.length > 0) {
17987
- that._hasAddons = true;
17988
- }
17989
- }
17990
- else if (this.element.nodeName.toLowerCase() === 'textarea') {
17991
- this.element.style.overflow = 'auto';
17992
- } else
17993
- if (this.element.nodeName.toLowerCase() === 'div') {
17994
- this.baseHost = this.element;
17995
- var input = that.element.getElementsByTagName('input');
17996
- var hasTextInput = false;
17997
-
17998
- $.each(input, function () {
17999
- var type = this.type;
18000
- if (type == null || type === 'text' || type === 'textarea') {
18001
- input = $(this);
18002
- hasTextInput = true;
18003
- return false;
18056
+ if (that.isMaterialized() && this.input instanceof HTMLInputElement) {
18057
+ var children = this.host.children();
18058
+ $.each(children, function (index) {
18059
+ var classToAdd = 'jqx-input-group-addon';
18060
+ $(this).removeClass(that.toThemeProperty('jqx-rc-all'));
18061
+ if (index === 0) {
18062
+ classToAdd += ' jqx-rc-l';
18004
18063
  }
18064
+ if (index === children.length - 1) {
18065
+ classToAdd += ' jqx-rc-r';
18066
+ }
18067
+ if (this !== that.element) {
18068
+ classToAdd += ' jqx-fill-state-normal';
18069
+ }
18070
+ this.className += ' ' + that.toThemeProperty(classToAdd);
18005
18071
  });
18006
- if (!hasTextInput) {
18007
- throw new Error('jqxInput: Missing Text Input in the Input Group');
18008
- }
18009
-
18010
- if (input.length > 0) {
18011
- this.baseHost = $(this.element);
18012
- that.baseElement = that.element;
18013
- var data = this.host.data();
18014
- this.host = input;
18015
- this.element = input[0];
18016
- that.input = input[0];
18017
- this.host.data(data);
18018
- that.baseElement.className += ' ' + that.toThemeProperty('jqx-widget jqx-rc-all jqx-input-group');
18019
- var children = this.baseHost.children();
18020
- $.each(children, function (index) {
18021
- var classToAdd = 'jqx-input-group-addon';
18022
- $(this).removeClass(that.toThemeProperty('jqx-rc-all'));
18023
- if (index === 0) {
18024
- classToAdd += ' jqx-rc-l';
18025
- }
18026
- if (index === children.length - 1) {
18027
- classToAdd += ' jqx-rc-r';
18028
- }
18029
- if (this !== that.element) {
18030
- classToAdd += ' jqx-fill-state-normal';
18031
- }
18032
- this.className += ' ' + that.toThemeProperty(classToAdd);
18033
- });
18072
+
18073
+ var group = $("<div></div>");
18074
+ group.addClass(that.toThemeProperty('jqx-input-group'));
18075
+ this.host.after(group);
18076
+ var input = this.element;
18077
+ var data = this.host.data();
18078
+
18079
+
18080
+ group.append(input);
18081
+ var label = $("<label></label");
18082
+
18083
+ if (this.hint) {
18084
+ label[0].innerHTML = this.placeHolder;
18034
18085
  }
18035
- }
18036
18086
 
18037
- this.addHandlers();
18038
- if (this.rtl) {
18039
- that.element.className += ' ' + that.toThemeProperty('jqx-rtl');
18040
- }
18041
- that.element.setAttribute('role', 'textbox');
18042
- $.jqx.aria(this, 'aria-autocomplete', 'both');
18043
- $.jqx.aria(this, 'aria-disabled', this.disabled);
18044
- $.jqx.aria(this, 'aria-readonly', false);
18045
- $.jqx.aria(this, 'aria-multiline', false);
18046
- if (this.source && this.source.length) {
18047
- $.jqx.aria(this, 'aria-haspopup', true);
18048
- }
18049
- if (this.value !== '') {
18050
- this.input.value = this.value;
18051
- }
18087
+ label.addClass(that.toThemeProperty('jqx-input-label'));
18088
+ group.append(label);
18052
18089
 
18053
- this._oldsource = this.source;
18054
- this._updateSource();
18055
- },
18090
+ var autoCompleteLabel = $("<label class='jqx-input-inline'></label");
18091
+ autoCompleteLabel[0].style.display = 'none';
18092
+ this._inlineLabel = autoCompleteLabel[0];
18056
18093
 
18057
- _updateSource: function () {
18058
- var that = this;
18094
+ group.append(autoCompleteLabel);
18059
18095
 
18060
- var mapItem = function (item) {
18061
- if (item === undefined) {
18062
- return null;
18063
- }
18064
18096
 
18065
- if (typeof item === 'string' || item instanceof String) {
18066
- return { label: item, value: item };
18067
- }
18097
+ var bar = $("<span></span>");
18098
+ group.append(bar);
18099
+ bar.addClass(that.toThemeProperty('jqx-input-bar'));
18068
18100
 
18069
- if (typeof item !== 'string' && item instanceof String === false) {
18070
- var label = '';
18071
- var value = '';
18101
+ group[0].id = this.element.id;
18102
+ this.element.removeAttribute('id');
18072
18103
 
18073
- if (that.displayMember !== '' && that.displayMember !== undefined) {
18074
- if (item[that.displayMember]) {
18075
- label = item[that.displayMember];
18076
- }
18104
+ group[0].style.cssText = this.element.style.cssText;
18105
+ if (this.element.className.indexOf('underlined') >= 0) {
18106
+ group.addClass('underlined');
18077
18107
  }
18078
18108
 
18079
- if (that.valueMember !== '' && that.valueMember !== undefined) {
18080
- value = item[that.valueMember];
18109
+ that.input = that.element;
18110
+ if (!(this.input instanceof HTMLInputElement)) {
18111
+ this.input = this.host.find('input');
18112
+ if (this.input.length > 0) {
18113
+ this.input = this.input[0];
18114
+ }
18115
+ $(this.input).addClass(this.toThemeProperty("jqx-input-widget"));
18081
18116
  }
18117
+ this.label = label;
18118
+ this.bar = bar;
18119
+ this.element.style.cssText = '';
18120
+ this.host = group;
18121
+ this.element = group[0];
18122
+ this.host.data(data);
18082
18123
 
18083
- if (label === '') {
18084
- label = item.label;
18085
- }
18086
- if (value === '') {
18087
- value = item.value;
18124
+ var that = this;
18125
+
18126
+ if (that.template) {
18127
+ that.bar.addClass(that.toThemeProperty("jqx-" + that.template));
18128
+ that.label.addClass(that.toThemeProperty("jqx-" + that.template));
18088
18129
  }
18089
18130
 
18090
- return { label: label, value: value };
18131
+ if (children.length > 0) {
18132
+ that._hasAddons = true;
18133
+ }
18091
18134
  }
18135
+ else if (this.element.nodeName.toLowerCase() === 'textarea') {
18136
+ this.element.style.overflow = 'auto';
18137
+ } else
18138
+ if (this.element.nodeName.toLowerCase() === 'div') {
18139
+ this.baseHost = this.element;
18140
+ var input = that.element.getElementsByTagName('input');
18141
+ var hasTextInput = false;
18092
18142
 
18093
- return item;
18094
- };
18095
-
18096
- var mapItems = function (source) {
18097
- var items = [];
18098
- for (var i = 0; i < source.length; i++) {
18099
- items[i] = mapItem(source[i]);
18100
- }
18101
- return items;
18102
- };
18143
+ $.each(input, function () {
18144
+ var type = this.type;
18145
+ if (type == null || type === 'text' || type === 'textarea') {
18146
+ input = $(this);
18147
+ hasTextInput = true;
18148
+ return false;
18149
+ }
18150
+ });
18151
+ if (!hasTextInput) {
18152
+ throw new Error('jqxInput: Missing Text Input in the Input Group');
18153
+ }
18103
18154
 
18104
- if (this.source && this.source._source) {
18105
- this.adapter = this.source;
18106
- if (this.adapter._source.localdata != null) {
18107
- this.adapter.unbindBindingUpdate(this.element.id);
18108
- this.adapter.bindBindingUpdate(this.element.id, function () {
18109
- that.source = mapItems(that.adapter.records);
18110
- });
18111
- }
18112
- else {
18113
- var postdata = {};
18114
- if (this.adapter._options.data) {
18115
- $.extend(that.adapter._options.data, postdata);
18116
- }
18117
- else {
18118
- if (this.source._source.data) {
18119
- $.extend(postdata, this.source._source.data);
18155
+ if (input.length > 0) {
18156
+ this.baseHost = $(this.element);
18157
+ that.baseElement = that.element;
18158
+ var data = this.host.data();
18159
+ this.host = input;
18160
+ this.element = input[0];
18161
+ that.input = input[0];
18162
+ this.host.data(data);
18163
+ that.baseElement.className += ' ' + that.toThemeProperty('jqx-widget jqx-rc-all jqx-input-group');
18164
+ var children = this.baseHost.children();
18165
+ $.each(children, function (index) {
18166
+ var classToAdd = 'jqx-input-group-addon';
18167
+ $(this).removeClass(that.toThemeProperty('jqx-rc-all'));
18168
+ if (index === 0) {
18169
+ classToAdd += ' jqx-rc-l';
18170
+ }
18171
+ if (index === children.length - 1) {
18172
+ classToAdd += ' jqx-rc-r';
18173
+ }
18174
+ if (this !== that.element) {
18175
+ classToAdd += ' jqx-fill-state-normal';
18176
+ }
18177
+ this.className += ' ' + that.toThemeProperty(classToAdd);
18178
+ });
18120
18179
  }
18121
- this.adapter._options.data = postdata;
18122
18180
  }
18123
- this.adapter.unbindDownloadComplete(this.element.id);
18124
- this.adapter.bindDownloadComplete(this.element.id, function () {
18125
- that.source = mapItems(that.adapter.records);
18126
- });
18127
- }
18128
- this.source.dataBind();
18129
- return;
18130
- }
18131
-
18132
- if (!$.isFunction(this.source)) {
18133
- this.source = mapItems(this.source);
18134
- }
18135
- },
18136
-
18137
- _refreshClasses: function (add) {
18138
- var func = add ? 'addClass' : 'removeClass',
18139
- hostClass = 'jqx-widget-content jqx-input-widget jqx-input jqx-widget',
18140
- popupClass = 'jqx-popup jqx-input-popup jqx-menu jqx-menu-vertical jqx-menu-dropdown jqx-widget jqx-widget-content';
18141
-
18142
- if ($.jqx.browser.msie) {
18143
- popupClass += ' jqx-noshadow';
18144
- }
18145
- if (this.roundedCorners) {
18146
- hostClass += ' jqx-rc-all';
18147
- popupClass += ' jqx-rc-all';
18148
- }
18149
- if (this.disabled) {
18150
- hostClass += ' jqx-fill-state-disabled';
18151
- } else {
18152
- this.host.removeClass(this.toThemeProperty('jqx-fill-state-disabled'));
18153
- }
18154
- this.host[func](this.toThemeProperty(hostClass));
18155
- this._popupHelper[func](this.toThemeProperty(popupClass));
18156
- },
18157
18181
 
18158
- selectAll: function () {
18159
- var that = this;
18160
- var textbox = this.host;
18182
+ this.addHandlers();
18183
+ if (this.rtl) {
18184
+ that.element.className += ' ' + that.toThemeProperty('jqx-rtl');
18185
+ }
18161
18186
 
18162
- if (textbox[0] instanceof HTMLInputElement === false) {
18163
- textbox = $(that.input);
18164
- }
18187
+ that.input.setAttribute('autocomplete', 'off');
18188
+ that.input.setAttribute('autocorrect', 'off');
18189
+ that.input.setAttribute('spellcheck', false);
18165
18190
 
18166
- setTimeout(function () {
18167
- if ('selectionStart' in textbox[0]) {
18168
- textbox[0].focus();
18169
- textbox[0].setSelectionRange(0, textbox[0].value.length);
18191
+ that.element.setAttribute('role', 'textbox');
18192
+ $.jqx.aria(this, 'aria-autocomplete', 'both');
18193
+ $.jqx.aria(this, 'aria-disabled', this.disabled);
18194
+ $.jqx.aria(this, 'aria-readonly', false);
18195
+ $.jqx.aria(this, 'aria-multiline', false);
18196
+ if (this.source && this.source.length) {
18197
+ $.jqx.aria(this, 'aria-haspopup', true);
18170
18198
  }
18171
- else {
18172
- var range = textbox[0].createTextRange();
18173
- range.collapse(true);
18174
- range.moveEnd('character', textbox[0].value.length);
18175
- range.moveStart('character', 0);
18176
- range.select();
18199
+ if (this.value !== '') {
18200
+ this.input.value = this.value;
18177
18201
  }
18178
- }, 10);
18179
- },
18180
18202
 
18181
- selectLast: function () {
18182
- var that = this;
18183
- var textbox = this.host;
18203
+ this._oldsource = this.source;
18204
+ this._updateSource();
18205
+ },
18184
18206
 
18185
- if (textbox[0] instanceof HTMLInputElement === false) {
18186
- textbox = $(that.input);
18187
- }
18207
+ _updateSource: function () {
18208
+ var that = this;
18188
18209
 
18189
- this.selectStart(textbox[0].value.length);
18190
- },
18210
+ var mapItem = function (item) {
18211
+ if (item === undefined) {
18212
+ return null;
18213
+ }
18191
18214
 
18192
- selectFirst: function () {
18193
- //var textbox = this.host;
18194
- this.selectStart(0);
18195
- },
18215
+ if (typeof item === 'string' || item instanceof String) {
18216
+ return { label: item, value: item };
18217
+ }
18196
18218
 
18197
- selectStart: function (index) {
18198
- var that = this;
18199
- var textbox = this.host;
18219
+ if (typeof item !== 'string' && item instanceof String === false) {
18220
+ var label = '';
18221
+ var value = '';
18200
18222
 
18201
- if (textbox[0] instanceof HTMLInputElement === false) {
18202
- textbox = $(that.input);
18203
- }
18223
+ if (that.displayMember !== '' && that.displayMember !== undefined) {
18224
+ if (item[that.displayMember]) {
18225
+ label = item[that.displayMember];
18226
+ }
18227
+ }
18204
18228
 
18205
- setTimeout(function () {
18206
- if ('selectionStart' in textbox[0]) {
18207
- textbox[0].focus();
18208
- textbox[0].setSelectionRange(index, index);
18209
- }
18210
- else {
18211
- var range = textbox[0].createTextRange();
18212
- range.collapse(true);
18213
- range.moveEnd('character', index);
18214
- range.moveStart('character', index);
18215
- range.select();
18216
- }
18217
- }, 10);
18218
- },
18229
+ if (that.valueMember !== '' && that.valueMember !== undefined) {
18230
+ value = item[that.valueMember];
18231
+ }
18219
18232
 
18220
- focus: function () {
18221
- try {
18222
- var that = this;
18223
- that.element.focus();
18224
- setTimeout(function () {
18225
- that.element.focus();
18226
- }, 25);
18233
+ if (label === '') {
18234
+ label = item.label;
18235
+ }
18236
+ if (value === '') {
18237
+ value = item.value;
18238
+ }
18227
18239
 
18228
- }
18229
- catch (error) {
18230
- }
18231
- },
18240
+ return { label: label, value: value };
18241
+ }
18232
18242
 
18233
- resize: function (width, height) {
18234
- this.width = width;
18235
- this.height = height;
18236
- this.refresh();
18237
- },
18243
+ return item;
18244
+ };
18238
18245
 
18239
- refresh: function () {
18240
- this._refreshClasses(false);
18241
- this._refreshClasses(true);
18246
+ var mapItems = function (source) {
18247
+ var items = [];
18248
+ for (var i = 0; i < source.length; i++) {
18249
+ items[i] = mapItem(source[i]);
18250
+ }
18251
+ return items;
18252
+ };
18242
18253
 
18243
- if (!this.baseHost) {
18244
- if (this.width != null && this.width.toString().indexOf("px") != -1) {
18245
- this.element.style.width = parseInt(this.width) + 'px';
18246
- }
18247
- else if (this.width != undefined && !isNaN(this.width)) {
18248
- this.element.style.width = this.width + 'px';
18249
- }
18250
- else {
18251
- this.element.style.width = this.width;
18254
+ if (this.source && this.source._source) {
18255
+ this.adapter = this.source;
18256
+ if (this.adapter._source.localdata != null) {
18257
+ this.adapter.unbindBindingUpdate(this.element.id);
18258
+ this.adapter.bindBindingUpdate(this.element.id, function () {
18259
+ that.source = mapItems(that.adapter.records);
18260
+ });
18261
+ }
18262
+ else {
18263
+ var postdata = {};
18264
+ if (this.adapter._options.data) {
18265
+ $.extend(that.adapter._options.data, postdata);
18266
+ }
18267
+ else {
18268
+ if (this.source._source.data) {
18269
+ $.extend(postdata, this.source._source.data);
18270
+ }
18271
+ this.adapter._options.data = postdata;
18272
+ }
18273
+ this.adapter.unbindDownloadComplete(this.element.id);
18274
+ this.adapter.bindDownloadComplete(this.element.id, function () {
18275
+ that.source = mapItems(that.adapter.records);
18276
+ });
18277
+ }
18278
+ this.source.dataBind();
18279
+ return;
18252
18280
  }
18253
18281
 
18254
- if (this.height != null && this.height.toString().indexOf("px") != -1) {
18255
- this.element.style.height = parseInt(this.height) + 'px';;
18256
- }
18257
- else if (this.height != undefined && !isNaN(this.height)) {
18258
- this.element.style.height = this.height + 'px';
18259
- }
18260
- else {
18261
- this.element.style.height = this.height;
18282
+ if (!$.isFunction(this.source)) {
18283
+ this.source = mapItems(this.source);
18262
18284
  }
18263
- if (this._hasAddons) {
18264
- this._addonsWidth = 35;
18265
- this.input.style.width = 'calc(100% - ' + this._addonsWidth + 'px)';
18285
+ },
18286
+
18287
+ _refreshClasses: function (add) {
18288
+ var func = add ? 'addClass' : 'removeClass',
18289
+ hostClass = 'jqx-widget-content jqx-input-widget jqx-input jqx-widget',
18290
+ popupClass = 'jqx-popup jqx-input-popup jqx-menu jqx-menu-vertical jqx-menu-dropdown jqx-widget jqx-widget-content';
18291
+
18292
+ if ($.jqx.browser.msie) {
18293
+ popupClass += ' jqx-noshadow';
18266
18294
  }
18267
- } else {
18268
- if (this.width != null && this.width.toString().indexOf("px") != -1) {
18269
- this.baseElement.style.width = parseInt(this.width) + 'px';
18295
+ if (this.roundedCorners) {
18296
+ hostClass += ' jqx-rc-all';
18297
+ popupClass += ' jqx-rc-all';
18270
18298
  }
18271
- else if (this.width != undefined && !isNaN(this.width)) {
18272
- this.baseElement.style.width = this.width + 'px';
18299
+ if (this.disabled) {
18300
+ hostClass += ' jqx-fill-state-disabled';
18301
+ } else {
18302
+ this.host.removeClass(this.toThemeProperty('jqx-fill-state-disabled'));
18273
18303
  }
18304
+ this.host[func](this.toThemeProperty(hostClass));
18305
+ this._popupHelper[func](this.toThemeProperty(popupClass));
18306
+ },
18274
18307
 
18275
- if (this.height != null && this.height.toString().indexOf("px") != -1) {
18276
- this.baseElement.style.height = parseInt(this.height) + 'px';
18308
+ selectAll: function () {
18309
+ var that = this;
18310
+ var textbox = this.host;
18311
+
18312
+ if (textbox[0] instanceof HTMLInputElement === false) {
18313
+ textbox = $(that.input);
18277
18314
  }
18278
- else if (this.height != undefined && !isNaN(this.height)) {
18279
- this.baseElement.style.height = this.height + 'px';
18280
- };
18281
- var that = this,
18282
- IE8 = $.jqx.browser.msie && $.jqx.browser.version < 9,
18283
- totalWidth = 0;
18284
- $.each(this.baseHost.children(), function () {
18285
- this.style.height = '100%';
18286
- if (this !== that.element) {
18287
- totalWidth += $(this).outerWidth();
18315
+
18316
+ setTimeout(function () {
18317
+ if ('selectionStart' in textbox[0]) {
18318
+ textbox[0].focus();
18319
+ textbox[0].setSelectionRange(0, textbox[0].value.length);
18288
18320
  }
18289
- });
18290
- that._addonsWidth = totalWidth;
18291
- if (IE8) {
18292
- var height = Math.max(0, that.baseElement.offsetHeight - 2);
18293
- that.element.style.width = Math.max(0, (that.baseElement.offsetWidth - totalWidth - 1)) + 'px';
18294
- that.element.style.minHeight = height + 'px';
18295
- that.element.style.lineHeight = height + 'px';
18296
- } else {
18297
- that.element.style.width = 'calc(100% - ' + totalWidth + 'px)';
18298
- }
18299
- $.jqx.utilities.resize(that.baseHost, function () {
18300
- if (IE8 && typeof that.width === 'string' && that.width.indexOf('%') !== -1 && !that._initiallyHidden) {
18301
- that.element.style.width = (that.baseElement.offsetWidth - that._addonsWidth - 1) + 'px';
18302
- } else if (that._initiallyHidden) {
18303
- that._addonsWidth = that._getAddonsWidth();
18304
- if (!IE8) {
18305
- that.element.style.width = 'calc(100% - ' + that._addonsWidth + 'px)';
18306
- } else {
18307
- that.element.style.width = (that.baseElement.offsetWidth - that._addonsWidth - 1) + 'px';
18308
- var height = that.baseElement.offsetHeight - 2;
18309
- that.element.style.minHeight = height + 'px';
18310
- that.element.style.lineHeight = height + 'px';
18311
- }
18312
- that._initiallyHidden = false;
18321
+ else {
18322
+ var range = textbox[0].createTextRange();
18323
+ range.collapse(true);
18324
+ range.moveEnd('character', textbox[0].value.length);
18325
+ range.moveStart('character', 0);
18326
+ range.select();
18313
18327
  }
18314
- });
18315
- }
18328
+ }, 10);
18329
+ },
18316
18330
 
18317
- if (this.disabled) {
18318
- this.element.setAttribute('disabled', true);
18319
- } else {
18320
- this.element.removeAttribute('disabled');
18321
- }
18322
- if (this.maxLength) {
18323
- this.element.setAttribute('maxlength', this.maxLength);
18331
+ selectLast: function () {
18332
+ var that = this;
18333
+ var textbox = this.host;
18324
18334
 
18325
- if (this.input) {
18326
- this.input.setAttribute('maxlength', this.maxLength);
18335
+ if (textbox[0] instanceof HTMLInputElement === false) {
18336
+ textbox = $(that.input);
18327
18337
  }
18328
- }
18329
18338
 
18330
- if (!this.element.getAttribute('placeholder')) {
18331
- this._refreshPlaceHolder();
18332
- }
18333
- },
18339
+ this.selectStart(textbox[0].value.length);
18340
+ },
18334
18341
 
18335
- _refreshPlaceHolder: function () {
18336
- var that = this;
18342
+ selectFirst: function () {
18343
+ //var textbox = this.host;
18344
+ this.selectStart(0);
18345
+ },
18337
18346
 
18338
- if (!that.isMaterialized() || !that.hint) {
18339
- if ('placeholder' in this.input && !($.jqx.browser.msie && $.jqx.browser.version < 9)) {
18340
- that.input.setAttribute('placeHolder', that.placeHolder);
18341
- } else {
18342
- if (that.input.value === '') {
18343
- that.input.value = that.placeHolder;
18344
- }
18347
+ selectStart: function (index) {
18348
+ var that = this;
18349
+ var textbox = this.host;
18350
+
18351
+ if (textbox[0] instanceof HTMLInputElement === false) {
18352
+ textbox = $(that.input);
18345
18353
  }
18346
- }
18347
18354
 
18348
- if (!that.hint) {
18349
- return;
18350
- }
18355
+ setTimeout(function () {
18356
+ if ('selectionStart' in textbox[0]) {
18357
+ textbox[0].focus();
18358
+ textbox[0].setSelectionRange(index, index);
18359
+ }
18360
+ else {
18361
+ var range = textbox[0].createTextRange();
18362
+ range.collapse(true);
18363
+ range.moveEnd('character', index);
18364
+ range.moveStart('character', index);
18365
+ range.select();
18366
+ }
18367
+ }, 10);
18368
+ },
18351
18369
 
18352
- if (that.input.value !== "") {
18353
- that.element.setAttribute("hint", true);
18354
- }
18355
- else {
18356
- that.element.removeAttribute("hint");
18357
- }
18370
+ focus: function () {
18371
+ try {
18372
+ var that = this;
18373
+ that.element.focus();
18374
+ setTimeout(function () {
18375
+ that.element.focus();
18376
+ }, 25);
18358
18377
 
18359
- if (that.label) {
18360
- that.label.innerHTML = that.placeHolder;
18361
- }
18362
- },
18378
+ }
18379
+ catch (error) {
18380
+ }
18381
+ },
18363
18382
 
18364
- destroy: function () {
18365
- this.removeHandlers();
18366
- if (this.baseHost) {
18367
- this.baseHost.remove();
18368
- } else {
18369
- this.host.remove();
18370
- }
18371
- if (this.$popup) {
18372
- this._popupHelper.remove();
18373
- }
18374
- },
18383
+ resize: function (width, height) {
18384
+ this.width = width;
18385
+ this.height = height;
18386
+ this.refresh();
18387
+ },
18375
18388
 
18376
- propertiesChangedHandler: function (object, key, value) {
18377
- if (value.width && value.height && Object.keys(value).length === 2) {
18378
- object.refresh();
18379
- }
18380
- },
18389
+ refresh: function () {
18390
+ this._refreshClasses(false);
18391
+ this._refreshClasses(true);
18381
18392
 
18382
- propertyChangedHandler: function (object, key, oldvalue, value) {
18383
- if (key === 'width' && value !== oldvalue) {
18384
- if (object.baseHost) {
18385
- object.baseElement.style.width = object._toPx(value);
18386
- if ($.jqx.browser.msie && $.jqx.browser.version < 9) {
18387
- object.element.style.width = (object.baseElement.offsetWidth - object._addonsWidth - 1) + 'px';
18393
+ if (!this.baseHost) {
18394
+ if (this.width != null && this.width.toString().indexOf("px") != -1) {
18395
+ this.element.style.width = parseInt(this.width) + 'px';
18396
+ }
18397
+ else if (this.width != undefined && !isNaN(this.width)) {
18398
+ this.element.style.width = this.width + 'px';
18399
+ }
18400
+ else {
18401
+ this.element.style.width = this.width;
18402
+ }
18403
+
18404
+ if (this.height != null && this.height.toString().indexOf("px") != -1) {
18405
+ this.element.style.height = parseInt(this.height) + 'px';;
18406
+ }
18407
+ else if (this.height != undefined && !isNaN(this.height)) {
18408
+ this.element.style.height = this.height + 'px';
18409
+ }
18410
+ else {
18411
+ this.element.style.height = this.height;
18412
+ }
18413
+ if (this._hasAddons) {
18414
+ this._addonsWidth = 35;
18415
+ this.input.style.width = 'calc(100% - ' + this._addonsWidth + 'px)';
18388
18416
  }
18389
18417
  } else {
18390
- object.element.style.width = object._toPx(value);
18418
+ if (this.width != null && this.width.toString().indexOf("px") != -1) {
18419
+ this.baseElement.style.width = parseInt(this.width) + 'px';
18420
+ }
18421
+ else if (this.width != undefined && !isNaN(this.width)) {
18422
+ this.baseElement.style.width = this.width + 'px';
18423
+ }
18424
+
18425
+ if (this.height != null && this.height.toString().indexOf("px") != -1) {
18426
+ this.baseElement.style.height = parseInt(this.height) + 'px';
18427
+ }
18428
+ else if (this.height != undefined && !isNaN(this.height)) {
18429
+ this.baseElement.style.height = this.height + 'px';
18430
+ };
18431
+ var that = this,
18432
+ IE8 = $.jqx.browser.msie && $.jqx.browser.version < 9,
18433
+ totalWidth = 0;
18434
+ $.each(this.baseHost.children(), function () {
18435
+ this.style.height = '100%';
18436
+ if (this !== that.element) {
18437
+ totalWidth += $(this).outerWidth();
18438
+ }
18439
+ });
18440
+ that._addonsWidth = totalWidth;
18441
+ if (IE8) {
18442
+ var height = Math.max(0, that.baseElement.offsetHeight - 2);
18443
+ that.element.style.width = Math.max(0, (that.baseElement.offsetWidth - totalWidth - 1)) + 'px';
18444
+ that.element.style.minHeight = height + 'px';
18445
+ that.element.style.lineHeight = height + 'px';
18446
+ } else {
18447
+ that.element.style.width = 'calc(100% - ' + totalWidth + 'px)';
18448
+ }
18449
+ $.jqx.utilities.resize(that.baseHost, function () {
18450
+ if (IE8 && typeof that.width === 'string' && that.width.indexOf('%') !== -1 && !that._initiallyHidden) {
18451
+ that.element.style.width = (that.baseElement.offsetWidth - that._addonsWidth - 1) + 'px';
18452
+ } else if (that._initiallyHidden) {
18453
+ that._addonsWidth = that._getAddonsWidth();
18454
+ if (!IE8) {
18455
+ that.element.style.width = 'calc(100% - ' + that._addonsWidth + 'px)';
18456
+ } else {
18457
+ that.element.style.width = (that.baseElement.offsetWidth - that._addonsWidth - 1) + 'px';
18458
+ var height = that.baseElement.offsetHeight - 2;
18459
+ that.element.style.minHeight = height + 'px';
18460
+ that.element.style.lineHeight = height + 'px';
18461
+ }
18462
+ that._initiallyHidden = false;
18463
+ }
18464
+ });
18391
18465
  }
18392
- return;
18393
- }
18394
18466
 
18395
- if (key === 'placeHolder') {
18396
- if ((!('placeholder' in object.element) || ($.jqx.browser.msie && $.jqx.browser.version < 9)) && object.input.value === oldvalue) {
18397
- object.input.value = '';
18467
+ if (this.disabled) {
18468
+ this.element.setAttribute('disabled', true);
18469
+ } else {
18470
+ this.element.removeAttribute('disabled');
18398
18471
  }
18399
- object._refreshPlaceHolder();
18400
- return;
18401
- }
18472
+ if (this.maxLength) {
18473
+ this.element.setAttribute('maxlength', this.maxLength);
18402
18474
 
18403
- if (object.batchUpdate && object.batchUpdate.width && object.batchUpdate.height && Object.keys(object.batchUpdate).length === 2) {
18404
- return;
18405
- }
18475
+ if (this.input) {
18476
+ this.input.setAttribute('maxlength', this.maxLength);
18477
+ }
18478
+ }
18406
18479
 
18407
- if (key === 'theme') {
18408
- $.jqx.utilities.setTheme(oldvalue, value, object.host);
18409
- }
18480
+ if (!this.element.getAttribute('placeholder')) {
18481
+ this._refreshPlaceHolder();
18482
+ }
18483
+ },
18410
18484
 
18411
- if (key === 'opened') {
18412
- if (value) {
18413
- object.open();
18414
- } else {
18415
- object.close();
18485
+ _refreshPlaceHolder: function () {
18486
+ var that = this;
18487
+
18488
+ if (!that.isMaterialized() || !that.hint) {
18489
+
18490
+ if ('placeholder' in this.input && !($.jqx.browser.msie && $.jqx.browser.version < 9)) {
18491
+ that.input.setAttribute('placeHolder', that.placeHolder);
18492
+ } else {
18493
+ if (that.input.value === '') {
18494
+ that.input.value = that.placeHolder;
18495
+ }
18496
+ }
18416
18497
  }
18417
- return;
18418
- }
18419
- if (key === 'source') {
18420
- object._oldsource = value;
18421
- object._updateSource();
18422
- }
18423
- if (key === 'displayMember' || key === 'valueMember') {
18424
- object.source = object._oldsource;
18425
- object._updateSource();
18426
- }
18427
- if (key === 'disabled') {
18428
- $.jqx.aria(object, 'aria-disabled', object.disabled);
18429
- }
18430
18498
 
18431
- if (key === 'value') {
18432
- object.input.value = value;
18433
- object._refreshPlaceHolder();
18434
- }
18499
+ if (!that.hint) {
18500
+ return;
18501
+ }
18435
18502
 
18436
- object.refresh();
18437
- },
18503
+ if (that.input.value !== "") {
18504
+ that.element.setAttribute("hint", true);
18505
+ }
18506
+ else {
18507
+ that.element.removeAttribute("hint");
18508
+ }
18438
18509
 
18439
- select: function (event, ui, changeType) {
18440
- var selectedItem = this._find('jqx-fill-state-pressed', this._popupHelper);
18441
- var val = selectedItem.getAttribute('data-value');
18442
- var label = selectedItem.getAttribute('data-name');
18443
- this.input.value = this.renderer(label, this.input.value);
18444
- this.selectedItem = { 'label': label, 'value': val };
18445
- this.element.setAttribute('data-value', val);
18446
- this.element.setAttribute('data-label', label);
18447
- this._raiseEvent('0', { 'item': { 'label': label, 'value': val }, 'label': label, 'value': val });
18448
- this._raiseEvent('3', { type: changeType, 'item': { 'label': label, 'value': val }, 'label': label, 'value': val });
18449
- this.value = label;
18450
- return this.close();
18451
- },
18510
+ if (that.label) {
18511
+ that.label.innerHTML = that.placeHolder;
18512
+ }
18513
+
18514
+ if (this._inlineLabel && that.inlineAutoComplete) {
18515
+ this._inlineLabel.style.display = 'none';
18516
+ that.host.css('overflow', 'visible');
18517
+ }
18518
+
18519
+ },
18520
+
18521
+ destroy: function () {
18522
+ this.removeHandlers();
18523
+ if (this.baseHost) {
18524
+ this.baseHost.remove();
18525
+ } else {
18526
+ this.host.remove();
18527
+ }
18528
+ if (this.$popup) {
18529
+ this._popupHelper.remove();
18530
+ }
18531
+ },
18452
18532
 
18453
- val: function (value) {
18454
- if (arguments.length === 0 || (value != null && typeof (value) === 'object' && !value.label && !value.value)) {
18455
- if (this.displayMember !== '' && this.valueMember !== '' && this.selectedItem) {
18456
- if (this.input.value === '') {
18457
- return '';
18533
+ propertiesChangedHandler: function (object, key, value) {
18534
+ if (value.width && value.height && Object.keys(value).length === 2) {
18535
+ object.refresh();
18536
+ }
18537
+ },
18538
+
18539
+ propertyChangedHandler: function (object, key, oldvalue, value) {
18540
+ if (key === 'width' && value !== oldvalue) {
18541
+ if (object.baseHost) {
18542
+ object.baseElement.style.width = object._toPx(value);
18543
+ if ($.jqx.browser.msie && $.jqx.browser.version < 9) {
18544
+ object.element.style.width = (object.baseElement.offsetWidth - object._addonsWidth - 1) + 'px';
18545
+ }
18546
+ } else {
18547
+ object.element.style.width = object._toPx(value);
18458
18548
  }
18459
- return this.selectedItem;
18549
+ return;
18460
18550
  }
18461
18551
 
18462
- return this.input.value;
18463
- }
18552
+ if (key === 'placeHolder') {
18553
+ if ((!('placeholder' in object.element) || ($.jqx.browser.msie && $.jqx.browser.version < 9)) && object.input.value === oldvalue) {
18554
+ object.input.value = '';
18555
+ }
18556
+ object._refreshPlaceHolder();
18557
+ return;
18558
+ }
18464
18559
 
18465
- if (value && value.label) {
18466
- this.selectedItem = { 'label': value.label, 'value': value.value };
18467
- this.element.setAttribute('data-value', value.value);
18468
- this.element.setAttribute('data-label', value.label);
18469
- this.value = value;
18470
- this.input.value = value.label;
18471
- if (this.input) {
18472
- this.input.value = value.label;
18560
+ if (object.batchUpdate && object.batchUpdate.width && object.batchUpdate.height && Object.keys(object.batchUpdate).length === 2) {
18561
+ return;
18473
18562
  }
18474
- return this.input.value;
18475
- }
18476
18563
 
18477
- this.value = value;
18478
- this.input.value = value;
18564
+ if (key === 'theme') {
18565
+ $.jqx.utilities.setTheme(oldvalue, value, object.host);
18566
+ }
18479
18567
 
18480
- this.element.setAttribute('data-value', value);
18481
- this.element.setAttribute('data-label', value);
18482
- if (value && value.label) {
18483
- this._raiseEvent('3', { type: null, 'item': { 'label': value.label, 'value': value.value }, 'label': value.label, 'value': value.value });
18484
- }
18485
- else {
18486
- this._raiseEvent('3', { type: null, 'item': { 'label': value, 'value': value }, 'label': value, 'value': value });
18487
- }
18488
- this._refreshPlaceHolder();
18489
- return this.input.value;
18490
- },
18568
+ if (key === 'opened') {
18569
+ if (value) {
18570
+ object.open();
18571
+ } else {
18572
+ object.close();
18573
+ }
18574
+ return;
18575
+ }
18576
+ if (key === 'source') {
18577
+ object._oldsource = value;
18578
+ object._updateSource();
18579
+ }
18580
+ if (key === 'displayMember' || key === 'valueMember') {
18581
+ object.source = object._oldsource;
18582
+ object._updateSource();
18583
+ }
18584
+ if (key === 'disabled') {
18585
+ $.jqx.aria(object, 'aria-disabled', object.disabled);
18586
+ }
18491
18587
 
18492
- _raiseEvent: function (id, arg) {
18493
- if (arg === undefined) {
18494
- arg = { owner: null };
18495
- }
18588
+ if (key === 'value') {
18589
+ object.input.value = value;
18590
+ object._refreshPlaceHolder();
18591
+ }
18496
18592
 
18497
- var evt = this.events[id];
18498
- arg.owner = this;
18593
+ object.refresh();
18594
+ },
18499
18595
 
18500
- var event = new $.Event(evt);
18501
- event.owner = this;
18502
- event.args = arg;
18503
- if (event.preventDefault) {
18504
- event.preventDefault();
18505
- }
18596
+ select: function (event, ui, changeType) {
18597
+ var that = this;
18598
+ var selectedItem = this._find('jqx-fill-state-pressed', this._popupHelper);
18599
+
18600
+ if (this.inlineAutoComplete) {
18601
+ selectedItem = this.element.querySelector('.jqx-input-inline');
18602
+ selectedItem.style.display = 'none';
18603
+ that.host.css('overflow', 'visible');
18604
+ }
18605
+
18606
+ var val = selectedItem.getAttribute('data-value');
18607
+ var label = selectedItem.getAttribute('data-name');
18608
+ this.input.value = this.renderer(label, this.input.value);
18609
+ this.selectedItem = { 'label': label, 'value': val };
18610
+ this.element.setAttribute('data-value', val);
18611
+ this.element.setAttribute('data-label', label);
18612
+ this._raiseEvent('0', { 'item': { 'label': label, 'value': val }, 'label': label, 'value': val });
18613
+ this._raiseEvent('3', { type: changeType, 'item': { 'label': label, 'value': val }, 'label': label, 'value': val });
18614
+ this.value = label;
18615
+ return this.close();
18616
+ },
18506
18617
 
18507
- var result = this.host.trigger(event);
18508
- return result;
18509
- },
18618
+ val: function (value) {
18619
+ if (arguments.length === 0 || (value != null && typeof (value) === 'object' && !value.label && !value.value)) {
18620
+ if (this.displayMember !== '' && this.valueMember !== '' && this.selectedItem) {
18621
+ if (this.input.value === '') {
18622
+ return '';
18623
+ }
18624
+ return this.selectedItem;
18625
+ }
18510
18626
 
18511
- _renderer: function (item) {
18512
- return item;
18513
- },
18627
+ return this.input.value;
18628
+ }
18514
18629
 
18515
- open: function () {
18516
- if ($.jqx.isHidden(this.host)) {
18517
- return;
18518
- }
18630
+ if (value && value.label) {
18631
+ this.selectedItem = { 'label': value.label, 'value': value.value };
18632
+ this.element.setAttribute('data-value', value.value);
18633
+ this.element.setAttribute('data-label', value.label);
18634
+ this.value = value;
18635
+ this.input.value = value.label;
18636
+ if (this.input) {
18637
+ this.input.value = value.label;
18638
+ }
18639
+ return this.input.value;
18640
+ }
18519
18641
 
18520
- var position = $.extend({}, this.host.coord(true), {
18521
- height: this.element.offsetHeight
18522
- });
18642
+ this.value = value;
18643
+ this.input.value = value;
18523
18644
 
18524
- if (this.$popup.parentNode !== document.body) {
18525
- var popupId = this.element.id + '_popup';
18526
- this.$popup.id = popupId;
18527
- $.jqx.aria(this, 'aria-owns', popupId);
18528
- document.body.appendChild(this.$popup);
18529
- }
18645
+ this.element.setAttribute('data-value', value);
18646
+ this.element.setAttribute('data-label', value);
18647
+ if (value && value.label) {
18648
+ this._raiseEvent('3', { type: null, 'item': { 'label': value.label, 'value': value.value }, 'label': value.label, 'value': value.value });
18649
+ }
18650
+ else {
18651
+ this._raiseEvent('3', { type: null, 'item': { 'label': value, 'value': value }, 'label': value, 'value': value });
18652
+ }
18653
+ this._refreshPlaceHolder();
18654
+ return this.input.value;
18655
+ },
18530
18656
 
18531
- this.$popup.style.position = 'absolute';
18532
- this.$popup.style.zIndex = this.popupZIndex;
18533
- this.$popup.style.top = this._toPx(position.top + position.height);
18534
- this.$popup.style.left = this._toPx(position.left);
18535
- this.$popup.style.display = 'block';
18657
+ _raiseEvent: function (id, arg) {
18658
+ if (arg === undefined) {
18659
+ arg = { owner: null };
18660
+ }
18536
18661
 
18537
- var height = 0;
18538
- var children = this._popupHelper.children();
18539
- $.each(children, function () {
18540
- height += $(this).outerHeight() + 1;
18541
- });
18542
- this.$popup.style.height = this._toPx(height);
18662
+ var evt = this.events[id];
18663
+ arg.owner = this;
18543
18664
 
18544
- if (this.enableBrowserBoundsDetection) {
18545
- var viewHeight = $(window).height() + $(window).scrollTop();
18546
- var offset = $(this.$popup).offset();
18547
- var dpHeight = $(this.$popup).outerHeight();
18665
+ var event = new $.Event(evt);
18666
+ event.owner = this;
18667
+ event.args = arg;
18668
+ if (event.preventDefault) {
18669
+ event.preventDefault();
18670
+ }
18548
18671
 
18549
- if (offset.top + dpHeight > viewHeight) {
18550
- var newPosition = position.top + position.height - dpHeight - this.host.height();
18551
- if (newPosition < 0) {
18552
- newPosition = 0;
18553
- }
18554
- this.$popup.style.top = newPosition + 'px';
18672
+ var result = this.host.trigger(event);
18673
+ return result;
18674
+ },
18675
+
18676
+ _renderer: function (item) {
18677
+ return item;
18678
+ },
18679
+
18680
+ open: function () {
18681
+ if ($.jqx.isHidden(this.host)) {
18682
+ return;
18555
18683
  }
18556
- }
18557
18684
 
18558
- this.opened = true;
18559
- this._raiseEvent('1', { popup: this.$popup });
18560
- $.jqx.aria(this, 'aria-expanded', true);
18561
- return this;
18562
- },
18685
+ var position = $.extend({}, this.host.coord(true), {
18686
+ height: this.element.offsetHeight
18687
+ });
18563
18688
 
18564
- close: function () {
18565
- if (!this.opened) {
18566
- return;
18567
- }
18689
+ if (this.$popup.parentNode !== document.body) {
18690
+ var popupId = this.element.id + '_popup';
18691
+ this.$popup.id = popupId;
18692
+ $.jqx.aria(this, 'aria-owns', popupId);
18693
+ document.body.appendChild(this.$popup);
18694
+ }
18568
18695
 
18569
- this.$popup.style.display = 'none';
18570
- this.opened = false;
18571
- this._raiseEvent('2', { popup: this.$popup });
18572
- $.jqx.aria(this, 'aria-expanded', false);
18573
- this._refreshPlaceHolder();
18574
- return this;
18575
- },
18696
+ this.$popup.style.position = 'absolute';
18697
+ this.$popup.style.zIndex = this.popupZIndex;
18698
+ this.$popup.style.top = this._toPx(position.top + position.height);
18699
+ this.$popup.style.left = this._toPx(position.left);
18700
+ this.$popup.style.display = 'block';
18576
18701
 
18577
- suggest: function () {
18578
- var items;
18579
- this.query = this.input.value;
18702
+ var height = 0;
18703
+ var children = this._popupHelper.children();
18704
+ $.each(children, function () {
18705
+ height += $(this).outerHeight() + 1;
18706
+ });
18707
+ this.$popup.style.height = this._toPx(height);
18580
18708
 
18581
- if (!this.query || this.query.length < this.minLength) {
18582
- return this.opened ? this.close() : this;
18583
- }
18709
+ if (this.enableBrowserBoundsDetection) {
18710
+ var viewHeight = $(window).height() + $(window).scrollTop();
18711
+ var offset = $(this.$popup).offset();
18712
+ var dpHeight = $(this.$popup).outerHeight();
18713
+
18714
+ if (offset.top + dpHeight > viewHeight) {
18715
+ var newPosition = position.top + position.height - dpHeight - this.host.height();
18716
+ if (newPosition < 0) {
18717
+ newPosition = 0;
18718
+ }
18719
+ this.$popup.style.top = newPosition + 'px';
18720
+ }
18721
+ }
18584
18722
 
18585
- if ($.isFunction(this.source)) {
18586
- items = this.source(this.query, $.proxy(this.load, this));
18587
- }
18588
- else {
18589
- items = this.source;
18590
- }
18723
+ this.opened = true;
18724
+ this._raiseEvent('1', { popup: this.$popup });
18725
+ $.jqx.aria(this, 'aria-expanded', true);
18726
+ return this;
18727
+ },
18591
18728
 
18592
- if (items) {
18593
- return this.load(items);
18594
- }
18729
+ close: function () {
18730
+ if (this._inlineLabel) {
18731
+ this._inlineLabel.style.display = 'none';
18732
+ }
18595
18733
 
18596
- return this;
18597
- },
18734
+ if (!this.opened) {
18735
+ return;
18736
+ }
18598
18737
 
18599
- load: function (originalItems) {
18600
- var that = this,
18601
- items = [];
18738
+ this.$popup.style.display = 'none';
18739
+ this.opened = false;
18740
+ this._raiseEvent('2', { popup: this.$popup });
18741
+ $.jqx.aria(this, 'aria-expanded', false);
18742
+ this._refreshPlaceHolder();
18743
+ return this;
18744
+ },
18602
18745
 
18603
- for (var i = 0; i < originalItems.length; i++) {
18604
- var item = originalItems[i];
18605
- if (that.filter(item)) {
18606
- items.push(item);
18746
+ suggest: function () {
18747
+ var items;
18748
+ var that = this;
18749
+ this.query = this.input.value;
18750
+
18751
+ if (that.inlineAutoComplete && that.aiKey) {
18752
+ this.load([]);
18753
+ return;
18607
18754
  }
18608
- }
18755
+ if (!this.query || this.query.length < this.minLength) {
18756
+ if (this._inlineLabel) {
18757
+ this._inlineLabel.style.display = 'none';
18758
+ }
18609
18759
 
18610
- items = this.sort(items);
18760
+ return this.opened ? this.close() : this;
18761
+ }
18611
18762
 
18612
- if (!items.length) {
18613
- if (this.opened) {
18614
- return this.close();
18763
+ if ($.isFunction(this.source)) {
18764
+ items = this.source(this.query, $.proxy(this.load, this));
18615
18765
  }
18616
18766
  else {
18617
- return this;
18767
+ items = this.source;
18618
18768
  }
18619
- }
18620
18769
 
18621
- return this._render(items.slice(0, this.items)).open();
18622
- },
18770
+ if (items) {
18771
+ return this.load(items);
18772
+ }
18623
18773
 
18624
- _filter: function (item) {
18625
- var value = this.query;
18626
- var itemValue = item;
18627
- if (item.label != null) {
18628
- itemValue = item.label;
18629
- }
18630
- else if (this.displayMember) {
18631
- itemValue = item[this.displayMember];
18632
- }
18774
+ return this;
18775
+ },
18633
18776
 
18634
- switch (this.searchMode) {
18635
- case 'none':
18636
- break;
18637
- default: // ('containsignorecase')
18638
- return $.jqx.string.containsIgnoreCase(itemValue, value);
18639
- case 'contains':
18640
- return $.jqx.string.contains(itemValue, value);
18641
- case 'equals':
18642
- return $.jqx.string.equals(itemValue, value);
18643
- case 'equalsignorecase':
18644
- return $.jqx.string.equalsIgnoreCase(itemValue, value);
18645
- case 'startswith':
18646
- return $.jqx.string.startsWith(itemValue, value);
18647
- case 'startswithignorecase':
18648
- return $.jqx.string.startsWithIgnoreCase(itemValue, value);
18649
- case 'endswith':
18650
- return $.jqx.string.endsWith(itemValue, value);
18651
- case 'endswithignorecase':
18652
- return $.jqx.string.endsWithIgnoreCase(itemValue, value);
18653
- }
18654
- },
18777
+ load: function (originalItems) {
18778
+ var that = this,
18779
+ items = [];
18655
18780
 
18656
- _sort: function (items) {
18657
- var bw = [], cs = [], cis = [];
18781
+ var searchMode = this.searchMode;
18782
+ if (this.inlineAutoComplete) {
18783
+ this.searchMode = 'startswith';
18784
+ }
18658
18785
 
18659
- for (var i = 0; i < items.length; i++) {
18660
- var item = items[i];
18786
+ for (var i = 0; i < originalItems.length; i++) {
18787
+ var item = originalItems[i];
18788
+ if (that.filter(item)) {
18789
+ items.push(item);
18790
+ }
18791
+ }
18792
+
18793
+ items = this.sort(items);
18794
+
18795
+ if (!items.length) {
18796
+ if (this.inlineAutoComplete) {
18797
+ var labelElement = this.element.querySelector('.jqx-input-inline');
18798
+ labelElement.style.display = 'none';
18799
+ that.host.css('overflow', 'visible');
18800
+
18801
+ if (that._writeTimer) {
18802
+ clearTimeout(that._writeTimer);
18803
+ }
18804
+ that._writeTimer = setTimeout(function () {
18805
+ that.getAISuggestions(function (suggestion) {
18806
+ if (suggestion) {
18807
+ suggestion = that.input.value + suggestion;
18808
+ labelElement.textContent = suggestion;
18809
+ labelElement.setAttribute('data-value', suggestion);
18810
+ labelElement.setAttribute('data-name', suggestion);
18811
+ labelElement.style.opacity = 0.5;
18812
+ labelElement.style.position = 'absolute';
18813
+ labelElement.style.zIndex = 5;
18814
+ labelElement.style.display = '';
18815
+ labelElement.style.left = '6px';
18816
+ labelElement.style.lineHeight = that.height + 'px';
18817
+ that.host.css('overflow', 'hidden');
18818
+ that.searchMode = searchMode;
18819
+ }
18820
+ });
18821
+ }, 500);
18822
+ }
18661
18823
 
18824
+ if (this.opened) {
18825
+ return this.close();
18826
+ }
18827
+ else {
18828
+ return this;
18829
+ }
18830
+ }
18831
+
18832
+ if (this.inlineAutoComplete) {
18833
+ var item = items.length ? items[0] : '';
18834
+ var label = typeof item === 'string' ? item : item.label;
18835
+ var value = typeof item === 'string' ? item : item.value;
18836
+ var labelElement = this.element.querySelector('.jqx-input-inline');
18837
+ labelElement.textContent = label;
18838
+ labelElement.setAttribute('data-value', value);
18839
+ labelElement.setAttribute('data-name', label);
18840
+ labelElement.style.opacity = 0.5;
18841
+ labelElement.style.position = 'absolute';
18842
+ labelElement.style.zIndex = 5;
18843
+ labelElement.style.display = '';
18844
+ labelElement.style.left = '6px';
18845
+ labelElement.style.lineHeight = that.height + 'px';
18846
+ this.searchMode = searchMode;
18847
+ that.host.css('overflow', 'hidden');
18848
+
18849
+ this.getAISuggestions(function (suggestion) {
18850
+ if (suggestion) {
18851
+ labelElement.textContent = suggestion;
18852
+ }
18853
+ });
18854
+ return;
18855
+ }
18856
+ return this._render(items.slice(0, this.items)).open();
18857
+ },
18858
+
18859
+ _filter: function (item) {
18860
+ var value = this.query;
18662
18861
  var itemValue = item;
18663
- if (item.label) {
18862
+ if (item.label != null) {
18664
18863
  itemValue = item.label;
18665
18864
  }
18666
18865
  else if (this.displayMember) {
18667
18866
  itemValue = item[this.displayMember];
18668
18867
  }
18669
18868
 
18670
- if (itemValue.toString().toLowerCase().indexOf(this.query.toString().toLowerCase()) === 0) {
18671
- bw.push(item);
18672
- }
18673
- else if (itemValue.toString().indexOf(this.query) >= 0) {
18674
- cs.push(item);
18675
- }
18676
- else if (itemValue.toString().toLowerCase().indexOf(this.query.toString().toLowerCase()) >= 0) {
18677
- cis.push(item);
18869
+ switch (this.searchMode) {
18870
+ case 'none':
18871
+ break;
18872
+ default: // ('containsignorecase')
18873
+ return $.jqx.string.containsIgnoreCase(itemValue, value);
18874
+ case 'contains':
18875
+ return $.jqx.string.contains(itemValue, value);
18876
+ case 'equals':
18877
+ return $.jqx.string.equals(itemValue, value);
18878
+ case 'equalsignorecase':
18879
+ return $.jqx.string.equalsIgnoreCase(itemValue, value);
18880
+ case 'startswith':
18881
+ return $.jqx.string.startsWith(itemValue, value);
18882
+ case 'startswithignorecase':
18883
+ return $.jqx.string.startsWithIgnoreCase(itemValue, value);
18884
+ case 'endswith':
18885
+ return $.jqx.string.endsWith(itemValue, value);
18886
+ case 'endswithignorecase':
18887
+ return $.jqx.string.endsWithIgnoreCase(itemValue, value);
18678
18888
  }
18679
- }
18889
+ },
18680
18890
 
18681
- return bw.concat(cs, cis);
18682
- },
18891
+ _sort: function (items) {
18892
+ var bw = [], cs = [], cis = [];
18683
18893
 
18684
- _highlight: function (item) {
18685
- var query = this.query;
18686
- query = query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
18894
+ for (var i = 0; i < items.length; i++) {
18895
+ var item = items[i];
18687
18896
 
18688
- var regex = new RegExp('(' + query + ')', 'ig');
18689
- return item.replace(regex, function ($1, match) {
18690
- return '<b>' + match + '</b>';
18691
- });
18692
- },
18897
+ var itemValue = item;
18898
+ if (item.label) {
18899
+ itemValue = item.label;
18900
+ }
18901
+ else if (this.displayMember) {
18902
+ itemValue = item[this.displayMember];
18903
+ }
18693
18904
 
18694
- escapeHTML: function (value) {
18695
- var entityMap = {
18696
- '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', '\'': '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;'
18697
- };
18905
+ if (itemValue.toString().toLowerCase().indexOf(this.query.toString().toLowerCase()) === 0) {
18906
+ bw.push(item);
18907
+ }
18908
+ else if (itemValue.toString().indexOf(this.query) >= 0) {
18909
+ cs.push(item);
18910
+ }
18911
+ else if (itemValue.toString().toLowerCase().indexOf(this.query.toString().toLowerCase()) >= 0) {
18912
+ cis.push(item);
18913
+ }
18914
+ }
18698
18915
 
18699
- return String(value).replace(/[&<>"'`=\/]/g, function (s) { return entityMap[s] });
18700
- },
18916
+ return bw.concat(cs, cis);
18917
+ },
18701
18918
 
18702
- sanitizeHTML: function (value) {
18703
- var that = this;
18704
- var regExp = new RegExp('<\s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)[^>]*>(.*?)<\s*/\s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)>', 'ig');
18705
- var result = String(value).replace(regExp, function (s) { return that.escapeHTML(s) });
18919
+ _highlight: function (item) {
18920
+ var query = this.query;
18921
+ query = query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
18706
18922
 
18707
- return result;
18708
- },
18923
+ var regex = new RegExp('(' + query + ')', 'ig');
18924
+ return item.replace(regex, function ($1, match) {
18925
+ return '<b>' + match + '</b>';
18926
+ });
18927
+ },
18709
18928
 
18710
- escape_HTML: function (html_str) {
18711
- if (html_str && (html_str.indexOf('onclick') >= 0 || html_str.indexOf('onload') >= 0 || html_str.indexOf('onerror') >= 0)) {
18712
- return this.escapeHTML(html_str)
18713
- }
18929
+ escapeHTML: function (value) {
18930
+ var entityMap = {
18931
+ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', '\'': '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;'
18932
+ };
18714
18933
 
18715
- var sanitized = this.sanitizeHTML(html_str);
18934
+ return String(value).replace(/[&<>"'`=\/]/g, function (s) { return entityMap[s] });
18935
+ },
18716
18936
 
18717
- return sanitized;
18718
- },
18937
+ sanitizeHTML: function (value) {
18938
+ var that = this;
18939
+ var regExp = new RegExp('<\s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)[^>]*>(.*?)<\s*/\s*(applet|audio|base|bgsound|embed|form|iframe|isindex|keygen|layout|link|meta|object|script|svg|style|template|video)>', 'ig');
18940
+ var result = String(value).replace(regExp, function (s) { return that.escapeHTML(s) });
18719
18941
 
18720
- _render: function (originalItems) {
18721
- var that = this,
18722
- popupChildren = that._popupHelper.children();
18942
+ return result;
18943
+ },
18723
18944
 
18724
- if (popupChildren.length > 0) {
18725
- for (var j = 0; j < popupChildren.length; j++) {
18726
- $(popupChildren[j]).remove();
18945
+ escape_HTML: function (html_str) {
18946
+ if (html_str && html_str.indexOf && (html_str.indexOf('onclick') >= 0 || html_str.indexOf('onload') >= 0 || html_str.indexOf('onerror') >= 0)) {
18947
+ return this.escapeHTML(html_str)
18727
18948
  }
18728
- }
18729
18949
 
18730
- var mapItem = function (item, index) {
18731
- var itemValue = item,
18732
- i = document.createElement('li'),
18733
- a = document.createElement('a'),
18734
- dataName, dataValue;
18735
- a.setAttribute('href', '#');
18736
- i.appendChild(a);
18737
- if (item.value !== undefined && item.value !== null) {
18738
- if (item.label !== undefined && item.label !== null) {
18739
- dataName = item.label;
18740
- dataValue = that.escape_HTML(item.value);
18741
- } else {
18742
- dataName = item.value;
18743
- dataValue = that.escape_HTML(item.value);
18744
- }
18745
- } else if (item.label !== undefined && item.label !== null) {
18746
- dataName = item.label;
18747
- dataValue = item.label;
18748
- } else if (that.displayMember !== undefined && that.displayMember !== '') {
18749
- dataName = item[that.displayMember];
18750
- dataValue = item[that.valueMember];
18751
- } else {
18752
- dataName = item;
18753
- dataValue = item;
18754
- }
18755
- i.setAttribute('data-value', dataValue);
18756
- i.setAttribute('data-name', dataName);
18950
+ var sanitized = this.sanitizeHTML(html_str);
18757
18951
 
18758
- if (item.label) {
18759
- itemValue = item.label;
18760
- }
18761
- else if (that.displayMember) {
18762
- itemValue = item[that.displayMember];
18763
- }
18952
+ return sanitized;
18953
+ },
18764
18954
 
18765
- a.innerHTML = that.highlight(itemValue);
18766
- var plusClass = '';
18767
- if (that.rtl) {
18768
- plusClass = ' jqx-rtl';
18769
- }
18770
- if (index === 0) {
18771
- plusClass += ' jqx-fill-state-pressed';
18955
+ _render: function (originalItems) {
18956
+ var that = this,
18957
+ popupChildren = that._popupHelper.children();
18958
+
18959
+ if (popupChildren.length > 0) {
18960
+ for (var j = 0; j < popupChildren.length; j++) {
18961
+ $(popupChildren[j]).remove();
18962
+ }
18772
18963
  }
18773
- i.className = that.toThemeProperty('jqx-item jqx-menu-item jqx-rc-all' + plusClass);
18774
- that.$popup.appendChild(i);
18775
18964
 
18776
- that.addHandler(i, 'mouseenter', function (event) { that.mouseenter(event); });
18777
- };
18965
+ var mapItem = function (item, index) {
18966
+ var itemValue = item,
18967
+ i = document.createElement('li'),
18968
+ a = document.createElement('a'),
18969
+ dataName, dataValue;
18970
+ a.setAttribute('href', '#');
18971
+ i.appendChild(a);
18972
+ if (item.value !== undefined && item.value !== null) {
18973
+ if (item.label !== undefined && item.label !== null) {
18974
+ dataName = item.label;
18975
+ dataValue = that.escape_HTML(item.value);
18976
+ } else {
18977
+ dataName = item.value;
18978
+ dataValue = that.escape_HTML(item.value);
18979
+ }
18980
+ } else if (item.label !== undefined && item.label !== null) {
18981
+ dataName = item.label;
18982
+ dataValue = item.label;
18983
+ } else if (that.displayMember !== undefined && that.displayMember !== '') {
18984
+ dataName = item[that.displayMember];
18985
+ dataValue = item[that.valueMember];
18986
+ } else {
18987
+ dataName = item;
18988
+ dataValue = item;
18989
+ }
18990
+ i.setAttribute('data-value', dataValue);
18991
+ i.setAttribute('data-name', dataName);
18778
18992
 
18779
- var mapItems = function (source) {
18780
- for (var i = 0; i < source.length; i++) {
18781
- mapItem(source[i], i);
18782
- }
18783
- };
18993
+ if (item.label) {
18994
+ itemValue = item.label;
18995
+ }
18996
+ else if (that.displayMember) {
18997
+ itemValue = item[that.displayMember];
18998
+ }
18784
18999
 
18785
- mapItems(originalItems);
19000
+ a.innerHTML = that.highlight(itemValue);
19001
+ var plusClass = '';
19002
+ if (that.rtl) {
19003
+ plusClass = ' jqx-rtl';
19004
+ }
19005
+ if (index === 0) {
19006
+ plusClass += ' jqx-fill-state-pressed';
19007
+ }
19008
+ i.className = that.toThemeProperty('jqx-item jqx-menu-item jqx-rc-all' + plusClass);
19009
+ that.$popup.appendChild(i);
18786
19010
 
18787
- if (!this.dropDownWidth) {
18788
- this.$popup.style.width = that._toPx(that.element.offsetWidth - 6);
18789
- } else {
18790
- this.$popup.style.width = that._toPx(that.dropDownWidth);
18791
- }
19011
+ that.addHandler(i, 'mouseenter', function (event) { that.mouseenter(event); });
19012
+ };
18792
19013
 
18793
- return this;
18794
- },
19014
+ var mapItems = function (source) {
19015
+ for (var i = 0; i < source.length; i++) {
19016
+ mapItem(source[i], i);
19017
+ }
19018
+ };
18795
19019
 
18796
- next: function () {
18797
- var active = this._find('jqx-fill-state-pressed', this._popupHelper),
18798
- next = active.nextSibling;
18799
- $(active).removeClass(this.toThemeProperty('jqx-fill-state-pressed'));
18800
- if (!next) {
18801
- next = this.$popup.firstChild;
18802
- }
19020
+ mapItems(originalItems);
18803
19021
 
18804
- next.className += ' ' + this.toThemeProperty('jqx-fill-state-pressed');
18805
- },
19022
+ if (!this.dropDownWidth) {
19023
+ this.$popup.style.width = that._toPx(that.element.offsetWidth - 6);
19024
+ } else {
19025
+ this.$popup.style.width = that._toPx(that.dropDownWidth);
19026
+ }
18806
19027
 
18807
- prev: function () {
18808
- var active = this._find('jqx-fill-state-pressed', this._popupHelper),
18809
- prev = active.previousSibling;
18810
- $(active).removeClass(this.toThemeProperty('jqx-fill-state-pressed'));
18811
- if (!prev) {
18812
- prev = this.$popup.lastChild;
18813
- }
19028
+ return this;
19029
+ },
18814
19030
 
18815
- prev.className += ' ' + this.toThemeProperty('jqx-fill-state-pressed');
18816
- },
19031
+ next: function () {
19032
+ var active = this._find('jqx-fill-state-pressed', this._popupHelper),
19033
+ next = active.nextSibling;
19034
+ $(active).removeClass(this.toThemeProperty('jqx-fill-state-pressed'));
19035
+ if (!next) {
19036
+ next = this.$popup.firstChild;
19037
+ }
18817
19038
 
18818
- addHandlers: function () {
18819
- var that = this,
18820
- eventNamespace = '.jqxInput' + that.element.id;
18821
- that.addHandler(that.host, 'focus' + eventNamespace, function () { that.onFocus(); });
18822
- that.addHandler(that.host, 'blur' + eventNamespace, function () { that.onBlur(); });
18823
- if (that.isMaterialized() && this.input instanceof HTMLInputElement) {
18824
- that.addHandler(that.input, 'blur' + eventNamespace, function () { that.onBlur(); });
18825
- }
19039
+ next.className += ' ' + this.toThemeProperty('jqx-fill-state-pressed');
19040
+ },
18826
19041
 
18827
- that.addHandler(that.host, 'change' + eventNamespace, function (event) {
18828
- if (that.opened && !event.args) {
18829
- event.stopPropagation();
18830
- event.preventDefault();
18831
- event.stopImmediatePropagation();
19042
+ prev: function () {
19043
+ var active = this._find('jqx-fill-state-pressed', this._popupHelper),
19044
+ prev = active.previousSibling;
19045
+ $(active).removeClass(this.toThemeProperty('jqx-fill-state-pressed'));
19046
+ if (!prev) {
19047
+ prev = this.$popup.lastChild;
19048
+ }
18832
19049
 
18833
- return;
19050
+ prev.className += ' ' + this.toThemeProperty('jqx-fill-state-pressed');
19051
+ },
19052
+
19053
+ addHandlers: function () {
19054
+ var that = this,
19055
+ eventNamespace = '.jqxInput' + that.element.id;
19056
+ that.addHandler(that.host, 'focus' + eventNamespace, function () { that.onFocus(); });
19057
+ that.addHandler(that.host, 'blur' + eventNamespace, function () { that.onBlur(); });
19058
+ if (that.isMaterialized() && this.input instanceof HTMLInputElement) {
19059
+ that.addHandler(that.input, 'blur' + eventNamespace, function () { that.onBlur(); });
18834
19060
  }
18835
- if (!event.args) {
18836
- event.stopPropagation();
18837
- event.preventDefault();
18838
- event.stopImmediatePropagation();
18839
19061
 
18840
- var item = that.val(),
18841
- label, val;
18842
- if (item && item.label) {
18843
- label = item.label;
18844
- val = item.val;
18845
- }
18846
- else {
18847
- label = item;
18848
- val = item;
19062
+ that.addHandler(that.host, 'change' + eventNamespace, function (event) {
19063
+ if (that.opened && !event.args) {
19064
+ event.stopPropagation();
19065
+ event.preventDefault();
19066
+ event.stopImmediatePropagation();
19067
+
19068
+ return;
18849
19069
  }
18850
- that._raiseEvent('3', { type: 'keyboard', 'item': { 'label': label, 'value': val }, 'label': label, 'value': val });
18851
- that.value = label;
18852
- that._refreshPlaceHolder();
18853
- }
18854
- });
19070
+ if (!event.args) {
19071
+ event.stopPropagation();
19072
+ event.preventDefault();
19073
+ event.stopImmediatePropagation();
18855
19074
 
18856
- that.addHandler(that.host, 'keypress' + eventNamespace, function (event) { that.keypress(event); });
18857
- that.addHandler(that.host, 'keyup' + eventNamespace, function (event) { that.keyup(event); });
18858
- that.addHandler(that.host, 'keydown' + eventNamespace, function (event) { that.keydown(event); });
18859
- that.addHandler(that.$popup, 'pointerdown' + eventNamespace, function (event) { that.click(event); });
18860
- },
19075
+ var item = that.val(),
19076
+ label, val;
19077
+ if (item && item.label) {
19078
+ label = item.label;
19079
+ val = item.val;
19080
+ }
19081
+ else {
19082
+ label = item;
19083
+ val = item;
19084
+ }
19085
+ that._raiseEvent('3', { type: 'keyboard', 'item': { 'label': label, 'value': val }, 'label': label, 'value': val });
19086
+ that.value = label;
19087
+ that._refreshPlaceHolder();
19088
+ }
19089
+ });
18861
19090
 
18862
- removeHandlers: function () {
18863
- var that = this,
18864
- eventNamespace = '.jqxInput' + that.element.id;
18865
- that.removeHandler(that.host, 'change' + eventNamespace);
18866
- that.removeHandler(that.host, 'focus' + eventNamespace);
18867
- that.removeHandler(that.host, 'blur' + eventNamespace);
18868
- that.removeHandler(that.host, 'keypress' + eventNamespace);
18869
- that.removeHandler(that.host, 'keyup' + eventNamespace);
18870
- that.removeHandler(that.host, 'keydown' + eventNamespace);
18871
- that.removeHandler(that.$popup, 'pointerdown' + eventNamespace);
18872
- },
19091
+ that.addHandler(that.host, 'keypress' + eventNamespace, function (event) { that.keypress(event); });
19092
+ that.addHandler(that.host, 'keyup' + eventNamespace, function (event) { that.keyup(event); });
19093
+ that.addHandler(that.host, 'keydown' + eventNamespace, function (event) { that.keydown(event); });
19094
+ that.addHandler(that.$popup, 'pointerdown' + eventNamespace, function (event) { that.click(event); });
19095
+ },
18873
19096
 
18874
- move: function (e) {
18875
- if (!this.opened) {
18876
- return;
18877
- }
19097
+ removeHandlers: function () {
19098
+ var that = this,
19099
+ eventNamespace = '.jqxInput' + that.element.id;
19100
+ that.removeHandler(that.host, 'change' + eventNamespace);
19101
+ that.removeHandler(that.host, 'focus' + eventNamespace);
19102
+ that.removeHandler(that.host, 'blur' + eventNamespace);
19103
+ that.removeHandler(that.host, 'keypress' + eventNamespace);
19104
+ that.removeHandler(that.host, 'keyup' + eventNamespace);
19105
+ that.removeHandler(that.host, 'keydown' + eventNamespace);
19106
+ that.removeHandler(that.$popup, 'pointerdown' + eventNamespace);
19107
+ },
18878
19108
 
18879
- switch (e.keyCode) {
18880
- case 9: // tab
18881
- case 13: // enter
18882
- case 27: // escape
18883
- e.preventDefault();
18884
- break;
19109
+ move: function (e) {
19110
+ if (!this.opened) {
19111
+ return;
19112
+ }
18885
19113
 
18886
- case 38: // up arrow
18887
- if (!e.shiftKey) {
19114
+ switch (e.keyCode) {
19115
+ case 9: // tab
19116
+ case 13: // enter
19117
+ case 27: // escape
18888
19118
  e.preventDefault();
18889
- this.prev();
18890
- }
18891
- break;
19119
+ break;
18892
19120
 
18893
- case 40: // down arrow
18894
- if (!e.shiftKey) {
18895
- e.preventDefault();
18896
- this.next();
18897
- }
18898
- break;
18899
- }
19121
+ case 38: // up arrow
19122
+ if (!e.shiftKey) {
19123
+ e.preventDefault();
19124
+ this.prev();
19125
+ }
19126
+ break;
18900
19127
 
18901
- e.stopPropagation();
18902
- },
19128
+ case 40: // down arrow
19129
+ if (!e.shiftKey) {
19130
+ e.preventDefault();
19131
+ this.next();
19132
+ }
19133
+ break;
19134
+ }
18903
19135
 
18904
- keydown: function (e) {
18905
- var arr = [40, 38, 9, 13, 27];
18906
- this.suppressKeyPressRepeat = arr.indexOf(e.keyCode) !== -1;
18907
- this.move(e);
18908
- },
19136
+ e.stopPropagation();
19137
+ },
18909
19138
 
18910
- keypress: function (e) {
18911
- if (this.suppressKeyPressRepeat) {
18912
- return;
18913
- }
18914
- this.move(e);
18915
- },
19139
+ keydown: function (e) {
19140
+ var arr = [40, 38, 9, 13, 27];
19141
+ this.suppressKeyPressRepeat = arr.indexOf(e.keyCode) !== -1;
18916
19142
 
18917
- keyup: function (e) {
18918
- switch (e.keyCode) {
18919
- case 40: // down arrow
18920
- case 38: // up arrow
18921
- case 16: // shift
18922
- case 17: // ctrl
18923
- case 18: // alt
18924
- e.stopPropagation();
18925
- e.preventDefault();
18926
- break;
18927
-
18928
- case 9: // tab
18929
- case 13: // enter
19143
+ if (e.key === 'Tab') {
18930
19144
  if (!this.opened) {
19145
+ if (this.inlineAutoComplete) {
19146
+ this.select(e, this, 'keyboard');
19147
+ }
18931
19148
  return;
18932
19149
  }
18933
- this.select(e, this, 'keyboard');
18934
- e.stopPropagation();
18935
- e.preventDefault();
18936
- break;
19150
+ }
19151
+ this.move(e);
19152
+ },
18937
19153
 
18938
- case 27: // escape
18939
- if (!this.opened) {
18940
- return;
18941
- }
18942
- this.close();
18943
- e.stopPropagation();
18944
- e.preventDefault();
18945
- break;
19154
+ keypress: function (e) {
19155
+ if (this.suppressKeyPressRepeat) {
19156
+ return;
19157
+ }
19158
+ this.move(e);
19159
+ },
18946
19160
 
18947
- default:
18948
- {
18949
- var me = this;
18950
- if (this.timer) {
18951
- clearTimeout(this.timer);
19161
+ keyup: function (e) {
19162
+ switch (e.keyCode) {
19163
+ case 40: // down arrow
19164
+ case 38: // up arrow
19165
+ case 16: // shift
19166
+ case 17: // ctrl
19167
+ case 18: // alt
19168
+ e.stopPropagation();
19169
+ e.preventDefault();
19170
+ break;
19171
+
19172
+ case 9: // tab
19173
+ case 13: // enter
19174
+ if (!this.opened) {
19175
+ if (this.inlineAutoComplete) {
19176
+ this.select(e, this, 'keyboard');
19177
+ e.stopPropagation();
19178
+ e.preventDefault();
19179
+ }
19180
+ return;
18952
19181
  }
18953
- this.timer = setTimeout(function () {
18954
- me.suggest();
18955
- }, 300);
18956
- }
18957
- }
19182
+ this.select(e, this, 'keyboard');
19183
+ e.stopPropagation();
19184
+ e.preventDefault();
19185
+ break;
18958
19186
 
18959
- },
19187
+ case 27: // escape
19188
+ if (!this.opened) {
19189
+ return;
19190
+ }
19191
+ this.close();
19192
+ e.stopPropagation();
19193
+ e.preventDefault();
19194
+ break;
18960
19195
 
18961
- clear: function () {
18962
- this.val('');
18963
- },
19196
+ default:
19197
+ {
19198
+ var me = this;
19199
+ if (this.timer) {
19200
+ clearTimeout(this.timer);
19201
+ }
18964
19202
 
18965
- onBlur: function () {
18966
- var that = this;
18967
- setTimeout(function () { that.close(); }, 150);
18968
- that.host.removeClass(that.toThemeProperty('jqx-fill-state-focus'));
18969
- that._refreshPlaceHolder();
18970
- },
19203
+ if (this.inlineAutoComplete) {
19204
+ me.suggest();
19205
+ return;
19206
+ }
19207
+ this.timer = setTimeout(function () {
19208
+ me.suggest();
19209
+ }, 300);
19210
+ }
19211
+ }
18971
19212
 
18972
- onFocus: function () {
18973
- var that = this;
18974
- that.element.className += ' ' + that.toThemeProperty('jqx-fill-state-focus');
18975
- that._refreshPlaceHolder();
18976
- },
19213
+ },
18977
19214
 
18978
- click: function (e) {
18979
- e.stopPropagation();
18980
- e.preventDefault();
18981
- this.select(e, this, 'mouse');
18982
- },
19215
+ clear: function () {
19216
+ this.val('');
19217
+ },
18983
19218
 
18984
- mouseenter: function (e) {
18985
- $(this._find('jqx-fill-state-pressed', this._popupHelper)).removeClass(this.toThemeProperty('jqx-fill-state-pressed'));
18986
- e.currentTarget.className += ' ' + this.toThemeProperty('jqx-fill-state-pressed');
18987
- },
19219
+ onBlur: function () {
19220
+ var that = this;
19221
+ setTimeout(function () { that.close(); }, 150);
19222
+ that.host.removeClass(that.toThemeProperty('jqx-fill-state-focus'));
19223
+ that._refreshPlaceHolder();
19224
+ },
18988
19225
 
18989
- _toPx: function (value) {
18990
- if (typeof value === 'number') {
18991
- return value + 'px';
18992
- } else {
18993
- return value;
18994
- }
18995
- },
19226
+ onFocus: function () {
19227
+ var that = this;
19228
+ that.element.className += ' ' + that.toThemeProperty('jqx-fill-state-focus');
19229
+ that._refreshPlaceHolder();
19230
+ },
18996
19231
 
18997
- _find: function (className, parentElement) {
18998
- var children = parentElement.children();
18999
- for (var i = 0; i < children.length; i++) {
19000
- var child = children[i];
19001
- if (child.className.indexOf(className) !== -1) {
19002
- return child;
19232
+ click: function (e) {
19233
+ e.stopPropagation();
19234
+ e.preventDefault();
19235
+ this.select(e, this, 'mouse');
19236
+ },
19237
+
19238
+ mouseenter: function (e) {
19239
+ $(this._find('jqx-fill-state-pressed', this._popupHelper)).removeClass(this.toThemeProperty('jqx-fill-state-pressed'));
19240
+ e.currentTarget.className += ' ' + this.toThemeProperty('jqx-fill-state-pressed');
19241
+ },
19242
+
19243
+ _toPx: function (value) {
19244
+ if (typeof value === 'number') {
19245
+ return value + 'px';
19246
+ } else {
19247
+ return value;
19003
19248
  }
19004
- }
19005
- },
19249
+ },
19006
19250
 
19007
- _getAddonsWidth: function () {
19008
- var that = this,
19009
- children = that.baseHost.children(),
19010
- result = 0;
19251
+ _find: function (className, parentElement) {
19252
+ var children = parentElement.children();
19253
+ for (var i = 0; i < children.length; i++) {
19254
+ var child = children[i];
19255
+ if (child.className.indexOf(className) !== -1) {
19256
+ return child;
19257
+ }
19258
+ }
19259
+ },
19260
+
19261
+ _getAddonsWidth: function () {
19262
+ var that = this,
19263
+ children = that.baseHost.children(),
19264
+ result = 0;
19011
19265
 
19012
- for (var i = 0; i < children.length; i++) {
19013
- if (children[i] !== that.element) {
19014
- result += $(children[i]).outerWidth();
19266
+ for (var i = 0; i < children.length; i++) {
19267
+ if (children[i] !== that.element) {
19268
+ result += $(children[i]).outerWidth();
19269
+ }
19015
19270
  }
19016
- }
19017
19271
 
19018
- return result;
19019
- }
19020
- });
19021
- })(jqxBaseFramework); //ignore jslint
19272
+ return result;
19273
+ }
19274
+ });
19275
+ })(jqxBaseFramework); //ignore jslint
19022
19276
  })();
19023
19277
 
19024
19278
  /***/ }),
@@ -20583,7 +20837,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* tslint:disabl
20583
20837
  /******/ var __webpack_module_cache__ = {};
20584
20838
  /******/
20585
20839
  /******/ // The require function
20586
- /******/ function __nested_webpack_require_759217__(moduleId) {
20840
+ /******/ function __nested_webpack_require_774751__(moduleId) {
20587
20841
  /******/ // Check if module is in cache
20588
20842
  /******/ var cachedModule = __webpack_module_cache__[moduleId];
20589
20843
  /******/ if (cachedModule !== undefined) {
@@ -20597,7 +20851,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* tslint:disabl
20597
20851
  /******/ };
20598
20852
  /******/
20599
20853
  /******/ // Execute the module function
20600
- /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_759217__);
20854
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_774751__);
20601
20855
  /******/
20602
20856
  /******/ // Return the exports of the module
20603
20857
  /******/ return module.exports;
@@ -20606,17 +20860,17 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* tslint:disabl
20606
20860
  /************************************************************************/
20607
20861
  /******/ /* webpack/runtime/amd options */
20608
20862
  /******/ (() => {
20609
- /******/ __nested_webpack_require_759217__.amdO = {};
20863
+ /******/ __nested_webpack_require_774751__.amdO = {};
20610
20864
  /******/ })();
20611
20865
  /******/
20612
20866
  /******/ /* webpack/runtime/compat get default export */
20613
20867
  /******/ (() => {
20614
20868
  /******/ // getDefaultExport function for compatibility with non-harmony modules
20615
- /******/ __nested_webpack_require_759217__.n = (module) => {
20869
+ /******/ __nested_webpack_require_774751__.n = (module) => {
20616
20870
  /******/ var getter = module && module.__esModule ?
20617
20871
  /******/ () => (module['default']) :
20618
20872
  /******/ () => (module);
20619
- /******/ __nested_webpack_require_759217__.d(getter, { a: getter });
20873
+ /******/ __nested_webpack_require_774751__.d(getter, { a: getter });
20620
20874
  /******/ return getter;
20621
20875
  /******/ };
20622
20876
  /******/ })();
@@ -20624,9 +20878,9 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* tslint:disabl
20624
20878
  /******/ /* webpack/runtime/define property getters */
20625
20879
  /******/ (() => {
20626
20880
  /******/ // define getter functions for harmony exports
20627
- /******/ __nested_webpack_require_759217__.d = (exports, definition) => {
20881
+ /******/ __nested_webpack_require_774751__.d = (exports, definition) => {
20628
20882
  /******/ for(var key in definition) {
20629
- /******/ if(__nested_webpack_require_759217__.o(definition, key) && !__nested_webpack_require_759217__.o(exports, key)) {
20883
+ /******/ if(__nested_webpack_require_774751__.o(definition, key) && !__nested_webpack_require_774751__.o(exports, key)) {
20630
20884
  /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
20631
20885
  /******/ }
20632
20886
  /******/ }
@@ -20635,7 +20889,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* tslint:disabl
20635
20889
  /******/
20636
20890
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
20637
20891
  /******/ (() => {
20638
- /******/ __nested_webpack_require_759217__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
20892
+ /******/ __nested_webpack_require_774751__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
20639
20893
  /******/ })();
20640
20894
  /******/
20641
20895
  /************************************************************************/
@@ -20643,20 +20897,26 @@ var __webpack_exports__ = {};
20643
20897
  // This entry need to be wrapped in an IIFE because it need to be in strict mode.
20644
20898
  (() => {
20645
20899
  "use strict";
20646
- /* harmony import */ var _jqxcore__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_759217__(5459);
20647
- /* harmony import */ var _jqxcore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_759217__.n(_jqxcore__WEBPACK_IMPORTED_MODULE_0__);
20648
- /* harmony import */ var _jqxdatetimeinput__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_759217__(4993);
20649
- /* harmony import */ var _jqxdatetimeinput__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_759217__.n(_jqxdatetimeinput__WEBPACK_IMPORTED_MODULE_1__);
20650
- /* harmony import */ var _jqxinput__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_759217__(5875);
20651
- /* harmony import */ var _jqxinput__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_759217__.n(_jqxinput__WEBPACK_IMPORTED_MODULE_2__);
20652
- /* harmony import */ var _jqxknob__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_759217__(887);
20653
- /* harmony import */ var _jqxknob__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_759217__.n(_jqxknob__WEBPACK_IMPORTED_MODULE_3__);
20900
+ /* harmony import */ var _jqxcore__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_774751__(5459);
20901
+ /* harmony import */ var _jqxcore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_774751__.n(_jqxcore__WEBPACK_IMPORTED_MODULE_0__);
20902
+ /* harmony import */ var _jqxdatetimeinput__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_774751__(4993);
20903
+ /* harmony import */ var _jqxdatetimeinput__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_774751__.n(_jqxdatetimeinput__WEBPACK_IMPORTED_MODULE_1__);
20904
+ /* harmony import */ var _jqxinput__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_774751__(5875);
20905
+ /* harmony import */ var _jqxinput__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_774751__.n(_jqxinput__WEBPACK_IMPORTED_MODULE_2__);
20906
+ /* harmony import */ var _jqxknob__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_774751__(887);
20907
+ /* harmony import */ var _jqxknob__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_774751__.n(_jqxknob__WEBPACK_IMPORTED_MODULE_3__);
20654
20908
 
20655
20909
 
20656
20910
 
20657
20911
 
20658
20912
  })();
20659
20913
 
20914
+ /******/ })()
20915
+ ;
20916
+ /******/ })()
20917
+ ;
20918
+ /******/ })()
20919
+ ;
20660
20920
  /******/ })()
20661
20921
  ;
20662
20922
  /******/ })()