jsl-ui 9.28.2 → 9.28.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.
- package/lib/components/IntervalComponent.d.ts +17 -17
- package/lib/components/IntervalComponent.js +65 -68
- package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -22
- package/lib/components/auto-suggest/AutoSuggestComponent.js +47 -49
- package/lib/components/button/ButtonComponent.d.ts +18 -18
- package/lib/components/button/ButtonComponent.js +29 -46
- package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -28
- package/lib/components/checkbox/CheckBoxComponent.js +81 -98
- package/lib/components/date/DateComponent.d.ts +32 -32
- package/lib/components/date/DateComponent.js +89 -106
- package/lib/components/date-range/DateRangeComponent.d.ts +35 -35
- package/lib/components/date-range/DateRangeComponent.js +123 -136
- package/lib/components/date-time/DateTimeComponent.d.ts +15 -15
- package/lib/components/date-time/DateTimeComponent.js +39 -53
- package/lib/components/dialog/DialogComponent.d.ts +67 -67
- package/lib/components/dialog/DialogComponent.js +198 -251
- package/lib/components/drop-down/DropDownComponent.d.ts +27 -27
- package/lib/components/drop-down/DropDownComponent.js +60 -74
- package/lib/components/expander/ExpanderComponent.d.ts +27 -27
- package/lib/components/expander/ExpanderComponent.js +89 -90
- package/lib/components/form-field/FormComponent.d.ts +12 -12
- package/lib/components/form-field/FormComponent.js +23 -26
- package/lib/components/form-field/FormFieldComponent.d.ts +39 -39
- package/lib/components/form-field/FormFieldComponent.js +138 -140
- package/lib/components/grid/GridComponent.d.ts +26 -26
- package/lib/components/grid/GridComponent.js +110 -116
- package/lib/components/input/InputComponent.d.ts +33 -33
- package/lib/components/input/InputComponent.js +126 -147
- package/lib/components/loading/LoadingComponent.d.ts +8 -8
- package/lib/components/loading/LoadingComponent.js +20 -22
- package/lib/components/navigation/NavigationComponent.d.ts +34 -34
- package/lib/components/navigation/NavigationComponent.js +45 -70
- package/lib/components/notification/Notification.d.ts +19 -19
- package/lib/components/notification/Notification.js +65 -69
- package/lib/components/number/NumberComponent.d.ts +26 -26
- package/lib/components/number/NumberComponent.js +80 -98
- package/lib/components/overlay/OverlayComponent.d.ts +27 -27
- package/lib/components/overlay/OverlayComponent.js +137 -149
- package/lib/components/progress/ProgressComponent.d.ts +18 -18
- package/lib/components/progress/ProgressComponent.js +40 -42
- package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -12
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +23 -34
- package/lib/components/select/SelectComponent.d.ts +79 -79
- package/lib/components/select/SelectComponent.js +356 -369
- package/lib/components/select/SelectDDAreaComponent.d.ts +32 -32
- package/lib/components/select/SelectDDAreaComponent.js +303 -317
- package/lib/components/slider/nouislider.d.ts +44 -44
- package/lib/components/slider/nouislider.js +2158 -2158
- package/lib/components/stack-panel/SplitterComponent.d.ts +21 -21
- package/lib/components/stack-panel/SplitterComponent.js +124 -126
- package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -20
- package/lib/components/stack-panel/StackPanelComponent.js +50 -64
- package/lib/components/tabs/TabsComponent.d.ts +40 -40
- package/lib/components/tabs/TabsComponent.js +200 -204
- package/lib/components/time/TimeComponent.d.ts +29 -29
- package/lib/components/time/TimeComponent.js +104 -113
- package/lib/components/tree-view/TreeViewComponent.d.ts +23 -23
- package/lib/components/tree-view/TreeViewComponent.js +43 -45
- package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -30
- package/lib/components/virtual-render/VirtualRenderComponent.js +92 -104
- package/lib/core/culture.d.ts +5 -5
- package/lib/core/culture.js +385 -385
- package/lib/core/date.d.ts +14 -14
- package/lib/core/date.js +346 -350
- package/lib/core/helper.d.ts +13 -13
- package/lib/core/helper.js +100 -104
- package/lib/core/jq.d.ts +37 -37
- package/lib/core/jq.js +362 -371
- package/lib/core/lang.d.ts +24 -24
- package/lib/core/lang.js +24 -28
- package/lib/core/numeric.d.ts +7 -7
- package/lib/core/numeric.js +139 -143
- package/lib/core/polyfills.js +22 -22
- package/lib/core.d.ts +6 -6
- package/lib/core.js +6 -6
- package/lib/grid/filterDialogs/dateRangeFilter.d.ts +7 -7
- package/lib/grid/filterDialogs/dateRangeFilter.js +106 -156
- package/lib/grid/filterDialogs/excelFilter.d.ts +9 -9
- package/lib/grid/filterDialogs/excelFilter.js +250 -316
- package/lib/grid/plugins/ext.overlay.d.ts +2 -2
- package/lib/grid/plugins/ext.overlay.js +295 -295
- package/lib/grid/plugins/slick.cellrangedecorator.d.ts +12 -12
- package/lib/grid/plugins/slick.cellrangedecorator.js +68 -68
- package/lib/grid/plugins/slick.cellrangeselector.d.ts +1 -1
- package/lib/grid/plugins/slick.cellrangeselector.js +144 -144
- package/lib/grid/plugins/slick.cellselectionmodel.d.ts +1 -1
- package/lib/grid/plugins/slick.cellselectionmodel.js +194 -194
- package/lib/grid/plugins/slick.headerbuttons.d.ts +55 -55
- package/lib/grid/plugins/slick.headerbuttons.js +156 -156
- package/lib/grid/plugins/slick.headermenu.d.ts +74 -74
- package/lib/grid/plugins/slick.headermenu.js +260 -260
- package/lib/grid/plugins/slick.rowmovemanager.d.ts +18 -18
- package/lib/grid/plugins/slick.rowmovemanager.js +249 -249
- package/lib/grid/plugins/slick.rowselectionmodel.d.ts +1 -1
- package/lib/grid/plugins/slick.rowselectionmodel.js +167 -167
- package/lib/grid/slick.core.d.ts +91 -91
- package/lib/grid/slick.core.js +574 -574
- package/lib/grid/slick.creator.d.ts +81 -81
- package/lib/grid/slick.creator.js +726 -726
- package/lib/grid/slick.dataview.d.ts +71 -71
- package/lib/grid/slick.dataview.js +1069 -1080
- package/lib/grid/slick.editors.core.d.ts +4 -4
- package/lib/grid/slick.editors.core.js +235 -235
- package/lib/grid/slick.editors.date.d.ts +2 -2
- package/lib/grid/slick.editors.date.js +125 -125
- package/lib/grid/slick.editors.lookup.d.ts +14 -14
- package/lib/grid/slick.editors.lookup.js +352 -353
- package/lib/grid/slick.editors.nav.d.ts +6 -6
- package/lib/grid/slick.editors.nav.js +22 -22
- package/lib/grid/slick.formatters.d.ts +17 -17
- package/lib/grid/slick.formatters.js +144 -144
- package/lib/grid/slick.grid.d.ts +285 -285
- package/lib/grid/slick.grid.js +5409 -5412
- package/lib/grid/slick.groupitemmetadataprovider.d.ts +39 -39
- package/lib/grid/slick.groupitemmetadataprovider.js +165 -165
- package/lib/grid/slick.tree.d.ts +33 -33
- package/lib/grid/slick.tree.js +208 -220
- package/lib/grid.css +1 -705
- package/lib/grid.d.ts +13 -13
- package/lib/grid.js +13 -13
- package/lib/index.css +8 -2195
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +56 -55
- package/lib/index.js +61 -61
- package/lib/index.js.map +1 -1
- package/lib/interaction/dataconverter.d.ts +4 -4
- package/lib/interaction/dataconverter.js +0 -1
- package/lib/interaction/eventhandler.d.ts +13 -13
- package/lib/interaction/eventhandler.js +39 -42
- package/lib/interaction/moveable.d.ts +39 -39
- package/lib/interaction/moveable.js +160 -174
- package/lib/interaction/resizable.d.ts +37 -37
- package/lib/interaction/resizable.js +109 -123
- package/lib/ui/auto.suggest.d.ts +18 -18
- package/lib/ui/auto.suggest.js +244 -259
- package/lib/ui/date.picker/date-picker-options.d.ts +11 -11
- package/lib/ui/date.picker/date-picker-options.js +76 -76
- package/lib/ui/date.picker/lib/date-manip.d.ts +74 -74
- package/lib/ui/date.picker/lib/date-manip.js +120 -120
- package/lib/ui/date.picker/lib/dom.d.ts +23 -23
- package/lib/ui/date.picker/lib/dom.js +28 -28
- package/lib/ui/date.picker/lib/emitter.d.ts +13 -13
- package/lib/ui/date.picker/lib/emitter.js +49 -49
- package/lib/ui/date.picker/lib/fns.d.ts +23 -23
- package/lib/ui/date.picker/lib/fns.js +39 -43
- package/lib/ui/date.picker/mode/base-mode.d.ts +26 -26
- package/lib/ui/date.picker/mode/base-mode.js +248 -248
- package/lib/ui/date.picker/mode/dropdown-mode.d.ts +28 -28
- package/lib/ui/date.picker/mode/dropdown-mode.js +50 -50
- package/lib/ui/date.picker/mode/index.d.ts +28 -28
- package/lib/ui/date.picker/mode/index.js +18 -18
- package/lib/ui/date.picker/mode/modal-mode.d.ts +25 -25
- package/lib/ui/date.picker/mode/modal-mode.js +17 -17
- package/lib/ui/date.picker/mode/permanent-mode.d.ts +29 -29
- package/lib/ui/date.picker/mode/permanent-mode.js +19 -19
- package/lib/ui/date.picker/views/day-picker.d.ts +40 -40
- package/lib/ui/date.picker/views/day-picker.js +155 -155
- package/lib/ui/date.picker/views/month-picker.d.ts +26 -26
- package/lib/ui/date.picker/views/month-picker.js +65 -65
- package/lib/ui/date.picker/views/year-picker.d.ts +20 -20
- package/lib/ui/date.picker/views/year-picker.js +66 -66
- package/lib/ui/date.picker.d.ts +66 -66
- package/lib/ui/date.picker.js +32 -32
- package/lib/ui/dialog.d.ts +22 -22
- package/lib/ui/dialog.js +98 -113
- package/lib/ui/drop.down.d.ts +52 -52
- package/lib/ui/drop.down.js +2112 -2112
- package/lib/ui/number.input.d.ts +13 -13
- package/lib/ui/number.input.js +56 -67
- package/package.json +1 -1
package/lib/ui/auto.suggest.js
CHANGED
|
@@ -1,259 +1,244 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
//
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
that.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
that.sc.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
var
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
that.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
that.setAttribute('autocomplete', that.autocompleteAttr);
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
that.removeAttribute('autocomplete');
|
|
249
|
-
}
|
|
250
|
-
document.body.removeChild(that.sc);
|
|
251
|
-
that = null;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
return autoComplete;
|
|
256
|
-
})();
|
|
257
|
-
export function AutoSuggest(input, opts) {
|
|
258
|
-
return new autoComplete(__assign({ selector: input }, opts));
|
|
259
|
-
}
|
|
1
|
+
import "./auto.suggest.css";
|
|
2
|
+
let autoComplete = (function () {
|
|
3
|
+
function autoComplete(options) {
|
|
4
|
+
// helpers
|
|
5
|
+
function hasClass(el, className) { return el.classList.contains(className); }
|
|
6
|
+
function addEvent(el, type, handler) {
|
|
7
|
+
el.addEventListener(type, handler);
|
|
8
|
+
}
|
|
9
|
+
function removeEvent(el, type, handler) {
|
|
10
|
+
// if (el.removeEventListener) not working in IE11
|
|
11
|
+
el.removeEventListener(type, handler);
|
|
12
|
+
}
|
|
13
|
+
function live(elClass, event, cb, context) {
|
|
14
|
+
addEvent(context || document, event, function (e) {
|
|
15
|
+
let found;
|
|
16
|
+
let el = e.target || e.srcElement;
|
|
17
|
+
while (el && !(found = hasClass(el, elClass))) {
|
|
18
|
+
el = el.parentElement;
|
|
19
|
+
}
|
|
20
|
+
if (found) {
|
|
21
|
+
cb.call(el, e);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const o = {
|
|
26
|
+
selector: "",
|
|
27
|
+
source: function (val, s) { return []; },
|
|
28
|
+
minChars: 0,
|
|
29
|
+
delay: 150,
|
|
30
|
+
offsetLeft: 0,
|
|
31
|
+
offsetTop: 1,
|
|
32
|
+
cache: false,
|
|
33
|
+
menuClass: '',
|
|
34
|
+
renderItem: function (item, search) {
|
|
35
|
+
// escape special characters
|
|
36
|
+
search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
37
|
+
var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
|
|
38
|
+
return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
|
|
39
|
+
},
|
|
40
|
+
onSelect: function (e, term, item) { }
|
|
41
|
+
};
|
|
42
|
+
for (const k in options) {
|
|
43
|
+
if (options.hasOwnProperty(k)) {
|
|
44
|
+
o[k] = options[k];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// init
|
|
48
|
+
let elems = typeof o.selector === 'object' ? [o.selector] : document.querySelectorAll(o.selector);
|
|
49
|
+
for (let i = 0; i < elems.length; i++) {
|
|
50
|
+
let that = elems[i];
|
|
51
|
+
// create suggestions container "sc"
|
|
52
|
+
that.sc = document.createElement('div');
|
|
53
|
+
that.sc.className = 'autocomplete-suggestions ' + o.menuClass;
|
|
54
|
+
that.autocompleteAttr = that.getAttribute('autocomplete');
|
|
55
|
+
that.setAttribute('autocomplete', 'off');
|
|
56
|
+
that.cache = {};
|
|
57
|
+
that.last_val = '';
|
|
58
|
+
that.updateSC = function (resize, next) {
|
|
59
|
+
var rect = that.getBoundingClientRect();
|
|
60
|
+
that.sc.style.left = Math.round(rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft) + 'px';
|
|
61
|
+
that.sc.style.top = Math.round(rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + o.offsetTop) + 'px';
|
|
62
|
+
that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
|
|
63
|
+
if (!resize) {
|
|
64
|
+
that.sc.style.display = 'block';
|
|
65
|
+
if (!that.sc.maxHeight) {
|
|
66
|
+
that.sc.maxHeight = parseInt((window.getComputedStyle ? getComputedStyle(that.sc, null) : that.sc.currentStyle).maxHeight, 10);
|
|
67
|
+
}
|
|
68
|
+
if (!that.sc.suggestionHeight) {
|
|
69
|
+
that.sc.suggestionHeight = that.sc.querySelector('.autocomplete-suggestion').offsetHeight;
|
|
70
|
+
}
|
|
71
|
+
if (that.sc.suggestionHeight) {
|
|
72
|
+
if (!next) {
|
|
73
|
+
that.sc.scrollTop = 0;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
var scrTop = that.sc.scrollTop, selTop = next.getBoundingClientRect().top - that.sc.getBoundingClientRect().top;
|
|
77
|
+
if (selTop + that.sc.suggestionHeight - that.sc.maxHeight > 0) {
|
|
78
|
+
that.sc.scrollTop = selTop + that.sc.suggestionHeight + scrTop - that.sc.maxHeight;
|
|
79
|
+
}
|
|
80
|
+
else if (selTop < 0) {
|
|
81
|
+
that.sc.scrollTop = selTop + scrTop;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
addEvent(window, 'resize', that.updateSC);
|
|
88
|
+
document.body.appendChild(that.sc);
|
|
89
|
+
live('autocomplete-suggestion', 'mouseleave', function (e) {
|
|
90
|
+
const sel = that.sc.querySelector('.autocomplete-suggestion.selected');
|
|
91
|
+
if (sel) {
|
|
92
|
+
setTimeout(function () { sel.className = sel.className.replace('selected', ''); }, 20);
|
|
93
|
+
}
|
|
94
|
+
}, that.sc);
|
|
95
|
+
live('autocomplete-suggestion', 'mouseover', function (e) {
|
|
96
|
+
const sel = that.sc.querySelector('.autocomplete-suggestion.selected');
|
|
97
|
+
if (sel) {
|
|
98
|
+
sel.className = sel.className.replace('selected', '');
|
|
99
|
+
}
|
|
100
|
+
this.className += ' selected';
|
|
101
|
+
}, that.sc);
|
|
102
|
+
live('autocomplete-suggestion', 'mousedown', function (e) {
|
|
103
|
+
// window.setTimeout(() => {
|
|
104
|
+
if (hasClass(this, 'autocomplete-suggestion')) { // else outside click
|
|
105
|
+
const v = this.getAttribute('data-val');
|
|
106
|
+
that.value = v;
|
|
107
|
+
o.onSelect(e, v, this);
|
|
108
|
+
that.sc.style.display = 'none';
|
|
109
|
+
}
|
|
110
|
+
// }, 1000);
|
|
111
|
+
}, that.sc);
|
|
112
|
+
that.blurHandler = function () {
|
|
113
|
+
//var over_sb;
|
|
114
|
+
//try { over_sb = document.querySelector('.autocomplete-suggestions:hover'); } catch (e) { over_sb = 0; }
|
|
115
|
+
//if (!over_sb) {
|
|
116
|
+
that.last_val = that.value;
|
|
117
|
+
that.sc.style.display = 'none';
|
|
118
|
+
//setTimeout(function() { that.sc.style.display = 'none'; }, 350); // hide suggestions on fast input
|
|
119
|
+
//} else if (that !== document.activeElement) { setTimeout(function() { that.focus(); }, 200); }
|
|
120
|
+
};
|
|
121
|
+
addEvent(that, 'blur', that.blurHandler);
|
|
122
|
+
that.inputHandler = function () {
|
|
123
|
+
options.onChange(that.value);
|
|
124
|
+
};
|
|
125
|
+
addEvent(that, 'input', that.inputHandler);
|
|
126
|
+
var suggest = function (data) {
|
|
127
|
+
var val = that.value;
|
|
128
|
+
that.cache[val] = data;
|
|
129
|
+
if (data.length && val.length >= o.minChars) {
|
|
130
|
+
var s = '';
|
|
131
|
+
for (var i = 0; i < data.length; i++) {
|
|
132
|
+
s += o.renderItem(data[i], val);
|
|
133
|
+
}
|
|
134
|
+
that.sc.innerHTML = s;
|
|
135
|
+
that.updateSC(0);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
that.sc.style.display = 'none';
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
that.keydownHandler = function (e) {
|
|
142
|
+
var key = window.event ? e.keyCode : e.which;
|
|
143
|
+
// down (40), up (38)
|
|
144
|
+
if ((key === 40 || key === 38) && that.sc.innerHTML) {
|
|
145
|
+
var next, sel = that.sc.querySelector('.autocomplete-suggestion.selected');
|
|
146
|
+
if (!sel) {
|
|
147
|
+
next = (key == 40) ? that.sc.querySelector('.autocomplete-suggestion') : that.sc.childNodes[that.sc.childNodes.length - 1]; // first : last
|
|
148
|
+
next.className += ' selected';
|
|
149
|
+
that.value = next.getAttribute('data-val');
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
next = (key == 40) ? sel.nextSibling : sel.previousSibling;
|
|
153
|
+
if (next) {
|
|
154
|
+
sel.className = sel.className.replace('selected', '');
|
|
155
|
+
next.className += ' selected';
|
|
156
|
+
that.value = next.getAttribute('data-val');
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
sel.className = sel.className.replace('selected', '');
|
|
160
|
+
that.value = that.last_val;
|
|
161
|
+
next = 0;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
that.updateSC(0, next);
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
else if (key == 27) {
|
|
168
|
+
that.value = that.last_val;
|
|
169
|
+
that.sc.style.display = 'none';
|
|
170
|
+
}
|
|
171
|
+
else if (key == 13 || key == 9) {
|
|
172
|
+
var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
|
|
173
|
+
if (sel && that.sc.style.display != 'none') {
|
|
174
|
+
o.onSelect(e, sel.getAttribute('data-val'), sel);
|
|
175
|
+
setTimeout(function () { that.sc.style.display = 'none'; }, 20);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
addEvent(that, 'keydown', that.keydownHandler);
|
|
180
|
+
that.keyupHandler = function (e) {
|
|
181
|
+
var key = window.event ? e.keyCode : e.which;
|
|
182
|
+
if (!key || (key < 35 || key > 40) && key != 13 && key != 27) {
|
|
183
|
+
var val = that.value;
|
|
184
|
+
if (val.length >= o.minChars) {
|
|
185
|
+
if (val != that.last_val) {
|
|
186
|
+
that.last_val = val;
|
|
187
|
+
clearTimeout(that.timer);
|
|
188
|
+
if (o.cache) {
|
|
189
|
+
if (val in that.cache) {
|
|
190
|
+
suggest(that.cache[val]);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
// no requests if previous suggestions were empty
|
|
194
|
+
for (var i = 1; i < val.length - o.minChars; i++) {
|
|
195
|
+
var part = val.slice(0, val.length - i);
|
|
196
|
+
if (part in that.cache && !that.cache[part].length) {
|
|
197
|
+
suggest([]);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
that.timer = setTimeout(function () { o.source(val, suggest); }, o.delay);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
that.last_val = val;
|
|
207
|
+
that.sc.style.display = 'none';
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
addEvent(that, 'keyup', that.keyupHandler);
|
|
212
|
+
that.focusHandler = function (e) {
|
|
213
|
+
that.last_val = '\n';
|
|
214
|
+
that.keyupHandler(e);
|
|
215
|
+
};
|
|
216
|
+
if (!o.minChars) {
|
|
217
|
+
addEvent(that, 'focus', that.focusHandler);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// public destroy method
|
|
221
|
+
this.destroy = function () {
|
|
222
|
+
for (var i = 0; i < elems.length; i++) {
|
|
223
|
+
var that = elems[i];
|
|
224
|
+
removeEvent(window, 'resize', that.updateSC);
|
|
225
|
+
removeEvent(that, 'blur', that.blurHandler);
|
|
226
|
+
removeEvent(that, 'focus', that.focusHandler);
|
|
227
|
+
removeEvent(that, 'keydown', that.keydownHandler);
|
|
228
|
+
removeEvent(that, 'keyup', that.keyupHandler);
|
|
229
|
+
if (that.autocompleteAttr) {
|
|
230
|
+
that.setAttribute('autocomplete', that.autocompleteAttr);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
that.removeAttribute('autocomplete');
|
|
234
|
+
}
|
|
235
|
+
document.body.removeChild(that.sc);
|
|
236
|
+
that = null;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
return autoComplete;
|
|
241
|
+
})();
|
|
242
|
+
export function AutoSuggest(input, opts) {
|
|
243
|
+
return new autoComplete({ selector: input, ...opts });
|
|
244
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Responsible for sanitizing and creating date picker options.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* DatePickerOptions constructs a new date picker options object, overriding
|
|
6
|
-
* default values with any values specified in opts.
|
|
7
|
-
*
|
|
8
|
-
* @param {DatePickerOptions} opts
|
|
9
|
-
* @returns {DatePickerOptions}
|
|
10
|
-
*/
|
|
11
|
-
export default function DatePickerOptions(opts: any): any;
|
|
1
|
+
/**
|
|
2
|
+
* @file Responsible for sanitizing and creating date picker options.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* DatePickerOptions constructs a new date picker options object, overriding
|
|
6
|
+
* default values with any values specified in opts.
|
|
7
|
+
*
|
|
8
|
+
* @param {DatePickerOptions} opts
|
|
9
|
+
* @returns {DatePickerOptions}
|
|
10
|
+
*/
|
|
11
|
+
export default function DatePickerOptions(opts: any): any;
|