1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ 770: 5/***/ (() => { 6 7/** 8 * imx.Autocomplete 9 * 10 * LICENSE 11 * 12 * This software and its source code is protected by copyright law (Sec. 69a ff. UrhG). 13 * It is not allowed to make any kinds of modifications, nor must it be copied, 14 * or published without explicit permission. Misuse will lead to persecution. 15 * 16 * @copyright 2015 infomax websolutions GmbH 17 * @link http://www.infomax-it.de 18 * @author Benjamin Hofmann <[email protected]> 19 * @since 2015-08-19 20 * @version $$Id$$ 21 */ 22window.imx = window.imx || {}; 23window.imx.Autocomplete = window.imx.Autocomplete || {}; 24 25/** 26 * @class imx.Autocomplete.AjaxAdapter 27 * @constructor 28 * @param {Object} options the settings of this autocomplete 29 */ 30imx.Autocomplete.AjaxAdapter = function (options) { 31 const defaults = { 32 url: '', 33 //the base url to use for the request 34 searchTermParameterName: 'q', 35 //the name of the query paremter that gets appended as GET parameter with the searchTerm as value 36 responseParser: function (request) { 37 return JSON.parse(request.responseText); // parses the response into the objects, will be called before the autocomplete callback 38 }, 39 extraParams: {} //additional GET parameters that will be merged with the searchTerm 40 }; 41 this.requestObject = null; 42 this.setSettings(Autocomplete_util.extend(defaults, options)); 43}; 44 45/** 46 * @return the settings of this autocomplete 47 * @type {Object} 48 */ 49imx.Autocomplete.AjaxAdapter.prototype.getSettings = function () { 50 return this.settings; 51}; 52 53/** 54 * @param {Object} settings the settings of this autocomplete 55 * @return fluent interface 56 * @type {imx.Autocomplete.AjaxAdapter} 57 */ 58imx.Autocomplete.AjaxAdapter.prototype.setSettings = function (settings) { 59 this.settings = settings; 60 return this; 61}; 62 63/** 64 * @param {String} value The text to search 65 * @param {Function} callback The callback to call after the request was successful. 66 * @param {Function} before The user-callback to call before the request gets sent. 67 * @param {Function} after The user-callback to call after the request was sent. 68 * @param {Function} error The user-callback to call is the request fails for some reason. 69 * @return fluent interface 70 * @type {imx.Autocomplete.AjaxAdapter} 71 */ 72imx.Autocomplete.AjaxAdapter.prototype.request = function (value, callback, before, after, error) { 73 if (this.requestObject !== null) { 74 this.requestObject.abort(); 75 } 76 const settings = this.getSettings(); 77 const params = { 78 [settings.searchTermParameterName]: value 79 }; 80 const data = Autocomplete_util.extend(params, settings.extraParams); 81 const queryString = Autocomplete_util.serialize(data); 82 let url = settings.url; 83 url = url + (url.indexOf('?') !== -1 ? '&' : '?') + queryString; 84 const request = new XMLHttpRequest(); 85 request.open('GET', url, true); 86 if (typeof error !== 'function') { 87 error = function () {}; 88 } 89 request.onload = function () { 90 if (request.status >= 200 && request.status < 400) { 91 callback(settings.responseParser(request)); 92 } else { 93 error(request); 94 } 95 after(); 96 }; 97 before(); 98 request.send(); 99 this.requestObject = request; 100 return this; 101}; 102 103/***/ }), 104 105/***/ 3837: 106/***/ (() => { 107 108/** 109 * 110 * @type {{triggerEvent, insertAfter, isVisible, extend, serialize, createElementByTemplate}} 111 */ 112window.Autocomplete_util = function (window, document, Array, Object, encodeURIComponent) { 113 /** 114 * 115 * @param {HtmlElement} element 116 * @param {string} eventname 117 * @param {object} data 118 */ 119 var triggerEvent = function (element, eventname, data) { 120 var event = null; 121 if (typeof window.CustomEvent === "function") { 122 event = new CustomEvent(eventname, { 123 detail: data 124 }); 125 } else { 126 event = document.createEvent('CustomEvent'); 127 event.initCustomEvent(eventname, false, false, { 128 detail: data 129 }); 130 } 131 element.dispatchEvent(event); 132 }; 133 134 /** 135 * @param element 136 * @param parent 137 **/ 138 var append = function (element, parent) { 139 parent.appendChild(element); 140 }; 141 142 /** 143 * 144 * @param {HtmlElement} element 145 * @return {boolean} 146 * 147 * @see https://github.com/madrobby/zepto/blob/a08af67f24d2e0c93f6cfc5bb813b5a85cedbd53/src/selector.js#L8 148 */ 149 var isVisible = function (element) { 150 return (element.offsetWidth > 0 || element.offsetHeigth > 0) && element.style.display !== 'none'; 151 }; 152 153 /** 154 * Converts a simple object into a query string 155 * 156 * @param {Object} object 157 * @returns {string} 158 * 159 * @see https://stackoverflow.com/a/1714899 160 */ 161 var serialize = function (object) { 162 var str = []; 163 for (var p in object) { 164 if (object.hasOwnProperty(p)) { 165 str.push(encodeURIComponent(p) + "=" + encodeURIComponent(object[p])); 166 } 167 } 168 return str.join("&"); 169 }; 170 171 /** 172 * Checḱs if the given object is a array 173 * 174 * @param object 175 * @returns {boolean} 176 * @private 177 * 178 * @see https://github.com/madrobby/zepto/blob/a08af67f24d2e0c93f6cfc5bb813b5a85cedbd53/src/zepto.js#L49 179 */ 180 var _isArray = function (object) { 181 return object instanceof Array; 182 }; 183 184 /** 185 * 186 * @param object 187 * @returns {boolean} 188 * @private 189 * 190 * @see https://github.com/madrobby/zepto/blob/a08af67f24d2e0c93f6cfc5bb813b5a85cedbd53/src/zepto.js#L74 191 */ 192 var _isPlainObject = function (object) { 193 return object !== null && typeof object === 'object' && object !== object.window && Object.getPrototypeOf(object) === Object.prototype; 194 }; 195 196 /** 197 * 198 * @param target 199 * @param source 200 * @param deep 201 * @private 202 * 203 * @see https://github.com/madrobby/zepto/blob/a08af67f24d2e0c93f6cfc5bb813b5a85cedbd53/src/zepto.js#L235 204 */ 205 var _extendObject = function (target, source, deep) { 206 for (var key in source) if (deep && (_isPlainObject(source[key]) || _isArray(source[key]))) { 207 if (_isPlainObject(source[key]) && !_isPlainObject(target[key])) { 208 target[key] = {}; 209 } 210 if (_isArray(source[key]) && !_isArray(target[key])) { 211 target[key] = []; 212 } 213 _extendObject(target[key], source[key], deep); 214 } else if (source[key] !== undefined) { 215 target[key] = source[key]; 216 } 217 }; 218 219 /** 220 * extend an array or an object with following objects and arrays 221 * 222 * @param target if target is a boolean, it is used as setting for a deep extend. Then the second parameter is the 223 * target. All following arguments will be merged into the target. 224 * @returns {Object} 225 * 226 * @see https://github.com/madrobby/zepto/blob/a08af67f24d2e0c93f6cfc5bb813b5a85cedbd53/src/zepto.js#L249 227 */ 228 var extend = function (target) { 229 var deep, 230 args = Array.prototype.slice.call(arguments, 1); 231 if (typeof target === 'boolean') { 232 deep = target; 233 target = args.shift(); 234 }
235 args.forEach(function (arg) { 236 _extendObject(target, arg, deep); 237 }); 238 return target; 239 }; 240 241 /** 242 * Creates a html node by a given string template 243 * 244 * @param {String} html 245 * @returns {Node} 246 * 247 * @see https://stackoverflow.com/a/35385518 (but made compatible with IE 11) 248 */ 249 var createElementByTemplate = function (html) { 250 var htmlWrapper = document.createElement('template'); 251 htmlWrapper.innerHTML = html; 252 if (htmlWrapper.content) { 253 return htmlWrapper.content.firstChild; 254 } 255 return htmlWrapper.firstChild; 256 }; 257 return { 258 triggerEvent: triggerEvent, 259 append: append, 260 isVisible: isVisible, 261 extend: extend, 262 serialize: serialize, 263 createElementByTemplate: createElementByTemplate 264 }; 265}(window, document, Array, Object, encodeURIComponent); 266 267/***/ }), 268 269/***/ 5555: 270/***/ (() => { 271 272/** 273 * imx.Autocomplete 274 * 275 * LICENSE 276 * 277 * This software and its source code is protected by copyright law (Sec. 69a ff. UrhG). 278 * It is not allowed to make any kinds of modifications, nor must it be copied, 279 * or published without explicit permission. Misuse will lead to persecution. 280 * 281 * @copyright 2015 infomax websolutions GmbH 282 * @link http://www.infomax-it.de 283 * @author Benjamin Hofmann <[email protected]> 284 * @since 2015-08-19 285 * @version $$Id$$ 286 */ 287/* global Autocomplete_util */ 288/* global imx */ 289window.imx = window.imx || {}; 290 291/** 292 * 293 * @class imx.Autocomplete 294 * @constructor 295 * @param {HTMLInputElement} input the input field 296 * @param {Object} options the settings of this autocomplete 297 */ 298imx.Autocomplete = function (input, options) { 299 this.keyCodes = { 300 UP: 38, 301 DOWN: 40, 302 RETURN: 13, 303 TAB: 9, 304 ESC: 27, 305 DEL: 46 306 }; 307 var defaults = { 308 appendTo: document.querySelector('body'), 309 adapter: null, 310 inputClass: 'autocomplete', 311 resultsClass: 'results', 312 loadingClass: 'loading', 313 enableListStyle: true, 314 minChars: 1, 315 delay: 400, 316 lazyInit: true, 317 listElement: '<ul>', 318 itemElement: '<li>', 319 wrap: { 320 start: function (item, index, items) { 321 return false; 322 }, 323 end: function (item, index, items) { 324 return false; 325 }, 326 element: '<div>' 327 }, 328 templates: {}, 329 keyCodeEvents: {}, 330 events: { 331 select: function (item) { 332 return this; 333 }, 334 change: function (item) { 335 return this; 336 }, 337 create: function () { 338 return this; 339 }, 340 destroy: function () { 341 return this; 342 }, 343 show: function () { 344 return this; 345 }, 346 hide: function () { 347 return this; 348 }, 349 beforeRequest: function () { 350 return this; 351 }, 352 afterRequest: function () { 353 return this; 354 }, 355 error: function () { 356 return this; 357 }, 358 blur: function (event) { 359 return false; // false triggers the default logic 360 }, 361 keyDown: function (event) { 362 return false; // false triggers the default logic 363 } 364 } 365 }; 366 this.setSettings(Autocomplete_util.extend(true, defaults, options)); 367 this.setInput(input); 368}; 369 370/** 371 * 372 * @return the input field 373 * @type {HTMLInputElement} 374 */ 375imx.Autocomplete.prototype.getInput = function () { 376 return this.input; 377}; 378 379/** 380 * 381 * @param {HTMLInputElement} input the input field 382 * @return fluent interface 383 * @type {imx.Autocomplete} 384 */ 385imx.Autocomplete.prototype.setInput = function (input) { 386 this.input = input; 387 return this; 388}; 389 390/** 391 * 392 * @return The list containing all the suggestion items. 393 * @type {HTMLElement} 394 */ 395imx.Autocomplete.prototype.getList = function () { 396 return this.list; 397}; 398 399/** 400 * 401 * @param {HTMLElement} list The list containing all the suggestion items. 402 * @return fluent interface 403 * @type {imx.Autocomplete} 404 */ 405imx.Autocomplete.prototype.setList = function (list) { 406 this.list = list; 407 return this; 408}; 409 410/** 411 * 412 * @return the settings of this autocomplete 413 * @type {Object} 414 */ 415imx.Autocomplete.prototype.getSettings = function () { 416 return this.settings; 417}; 418 419/** 420 * 421 * @param {Object} settings the settings of this autocomplete 422 * @return fluent interface 423 * @type {imx.Autocomplete} 424 */ 425imx.Autocomplete.prototype.setSettings = function (settings) { 426 this.settings = settings; 427 return this; 428}; 429 430/** 431 * 432 * @param {KeyboardEvent} event 433 * @private 434 */ 435imx.Autocomplete.prototype.handleKeyDown_ = function (event) { 436 var that = this; 437 var input = this.getInput(); 438 var list = this.getList();
439 var settings = this.getSettings(); 440 var timeout = null; 441 var term = ''; 442 if (typeof settings.keyCodeEvents[event.keyCode] === 'function') { 443 var result = settings.keyCodeEvents[event.keyCode].call(this, event); 444 if (result) return; 445 } 446 switch (event.keyCode) { 447 case that.keyCodes.UP: 448 if (Autocomplete_util.isVisible(list)) { 449 that.select_('prev', term); 450 event.preventDefault(); 451 } else { 452 that.show(); 453 } 454 break; 455 case that.keyCodes.DOWN: 456 if (Autocomplete_util.isVisible(list)) { 457 that.select_('next', term); 458 event.preventDefault(); 459 } else { 460 that.show(); 461 } 462 break; 463 case that.keyCodes.RETURN: 464 case that.keyCodes.TAB: 465 if (Autocomplete_util.isVisible(list) && list.querySelectorAll('.selectable.selected').length > 0) { 466 that.change_(); 467 event.preventDefault(); 468 } 469 break; 470 case that.keyCodes.ESC: 471 that.hide(); 472 break; 473 default: 474 if (!settings.events.keyDown.call(this, event)) { 475 clearTimeout(timeout); 476 timeout = setTimeout(function () { 477 term = input.value; 478 that.handleChange_(); 479 }, settings.delay); 480 } 481 break; 482 } 483}; 484 485/** 486 * Handels the blur event 487 * 488 * @return fluent interface 489 * @type {imx.Autocomplete} 490 */ 491imx.Autocomplete.prototype.handleBlur_ = function (event) { 492 var settings = this.getSettings(); 493 if (!settings.events.blur.call(this, event)) { 494 this.hide(); 495 } 496}; 497 498/** 499 * This starts the autocomplete, builds it and binds all the needed events. 500 * 501 * @return fluent interface 502 * @type {imx.Autocomplete} 503 */ 504imx.Autocomplete.prototype.create = function () { 505 var init = function () { 506 this.input.removeEventListener('focus', init); 507 this.setList(this.buildAutocompleteList_()); 508 var input = this.getInput(); 509 var settings = this.getSettings(); 510 input.setAttribute('autocomplete', 'off'); 511 input.classList.add(settings.inputClass); 512 input.addEventListener('keydown', this.handleKeyDown_.bind(this)); 513 input.addEventListener('blur', this.handleBlur_.bind(this)); 514 settings.events.create.call(this); 515 }.bind(this); 516 if (this.getSettings().lazyInit) { 517 this.input.addEventListener('focus', init); 518 } else { 519 init(); 520 } 521 return this; 522}; 523 524/** 525 * This destroys the autocomplete and unbinds all registered events. 526 * 527 * @return fluent interface 528 * @type {imx.Autocomplete} 529 */ 530imx.Autocomplete.prototype.destroy = function () { 531 var input = this.getInput(); 532 var list = this.getList(); 533 input.removeAttribute('autocomplete'); 534 input.classList.remove(this.getSettings().inputClass); 535 input.removeEventListener('keydown', this.handleKeyDown_); 536 input.removeEventListener('blur', this.handleBlur_); 537 list.parentNode.removeChild(list); 538 this.getSettings().events.destroy.call(this); 539 return this; 540}; 541 542/** 543 * This shows the autocomplete. 544 * 545 * @return fluent interface 546 * @type {imx.Autocomplete} 547 */ 548imx.Autocomplete.prototype.show = function () { 549 this.getList().style.display = 'block'; 550 this.getSettings().events.show.call(this); 551 return this; 552}; 553 554/** 555 * This hides the autocomplete. 556 * 557 * @return fluent interface 558 * @type {imx.Autocomplete} 559 */ 560imx.Autocomplete.prototype.hide = function () { 561 var list = this.getList(); 562 var current = list.querySelector('.selectable.selected'); 563 list.style.display = 'none'; 564 if (current) { 565 current.classList.remove('selected'); 566 } 567 this.getSettings().events.hide.call(this); 568 return this; 569}; 570 571/** 572 * This handles the select of a value and sets it into the input. 573 * 574 * @private 575 * @param {String} direction 576 * @param {String} term 577 * @return fluent interface 578 * @type {imx.Autocomplete} 579 */ 580imx.Autocomplete.prototype.select_ = function (direction, term) { 581 var input = this.getInput(); 582 var list = this.getList(); 583 var selectables = []; 584 var selected = null; 585 var current = list.querySelector('.selectable.selected'); 586 if (current) { 587 selectables = current.parentNode.querySelectorAll('.selectable'); 588 for (var i = 0; i < selectables.length; i++) { 589 if (selectables[i] === current) { 590 if (direction === 'next') { 591 selected = selectables[i + 1]; 592 } else { 593 selected = selectables[i - 1]; 594 } 595 break; 596 } 597 } 598 current.classList.remove('selected'); 599 } else { 600 selectables = list.querySelectorAll('.selectable'); 601 selected = direction === 'next' ? selectables[0] : selectables[selectables.length - 1]; 602 } 603 if (selected) { 604 var item = JSON.parse(selected.dataset.item); 605 selected.classList.add('selected'); 606 input.value = item.label;
607 this.getSettings().events.select.call(this, item); 608 } else { 609 input.value = term; 610 } 611 return this; 612}; 613 614/** 615 * This handles a change of the value, sets it into the input and closes the autocomplete. 616 * 617 * @private 618 * @return fluent interface 619 * @type {imx.Autocomplete} 620 */ 621imx.Autocomplete.prototype.change_ = function () { 622 var current = this.getList().querySelector('.selectable.selected'); 623 var item = JSON.parse(current.dataset.item); 624 625 // trigger event for listeners on autosuggest 626 Autocomplete_util.triggerEvent(this.getInput(), 'setautocomplete'); 627 if (current) { 628 if (item.href) { 629 window.location.href = item.href; 630 return; 631 } else { 632 this.getInput().value = item.label; 633 this.getSettings().events.change.call(this, item); 634 this.hide(); 635 } 636 } 637 return this; 638}; 639/** 640 * Updates the list position styles according to the input element. This should be done when creating the list and when the screen changes or the 641 * contents of list change. This is only done when enableListStyle was set to true in the settings. Otherwise, you have to take care of the list yourself 642 * 643 * The postion is calculated using the boundingClientRect (relative position within the parent), the scroll offset and the client offset (margins of the 644 * body etc.). 645 * 646 * If enableListStyle is enabled a callback is called afterwards if one is provided. The callbacks gets the list and the input as parameters in that order. 647 * 648 * @param {HTMLElement} list The list element to style 649 * @param {HTMLElement} input The input the autocomplete belongs to 650 * @param {Function|null} callback A callback with list and input as parameters to call after setting the list style 651 * @param {boolean} force Set to true if the list style should be updated even if enableListStyle is set to false. Can be used when callilng manually 652 */ 653imx.Autocomplete.prototype.updateListPosition = function (list, input, callback, force) { 654 if (this.getSettings().enableListStyle || force) { 655 var clientRectangle = input.getBoundingClientRect(); 656 list.style.width = input.offsetWidth + 'px'; 657 list.style.position = 'absolute'; 658 list.style.top = clientRectangle.bottom + window.pageYOffset - document.documentElement.clientTop + 'px'; 659 list.style.left = clientRectangle.left + window.pageXOffset - document.documentElement.clientLeft + 'px'; 660 if (typeof callback === 'function') { 661 callback(list, input); 662 } 663 } 664}; 665 666/** 667 * This builds the container of the autocomplete and appends it to the <body>. 668 * 669 * @private 670 * @return The list containing all the suggestion items. 671 * @type {HTMLElement} 672 */ 673imx.Autocomplete.prototype.buildAutocompleteList_ = function () { 674 var settings = this.getSettings(); 675 var input = this.getInput(); 676 677 /** @type {HTMLElement} */ 678 var list = Autocomplete_util.createElementByTemplate(settings.listElement); 679 list.setAttribute('id', input.getAttribute('id') + '_autocomplete'); 680 list.setAttribute('class', 'autocomplete ' + settings.resultsClass); 681 this.updateListPosition(list, input, function (list) { 682 list.style.display = 'none'; 683 }); 684 Autocomplete_util.append(list, settings.appendTo); 685 return list; 686}; 687 688/** 689 * This checks for the minimum text-length and handles the keydowns within the input, that are not caught. 690 * Updates the current position of the list according to the input-field. 691 * 692 * @private 693 * @return fluent interface 694 * @type {imx.Autocomplete} 695 */ 696imx.Autocomplete.prototype.handleChange_ = function () { 697 var input = this.getInput(); 698 var settings = this.getSettings(); 699 var value = input.value; 700 var list = this.getList(); 701 this.updateListPosition(list, input); 702 if (value.length >= settings.minChars) { 703 input.classList.add(settings.loadingClass);
704 this.handleAdapter_(); 705 } else { 706 input.classList.remove(settings.loadingClass); 707 this.hide(); 708 } 709 return this; 710}; 711 712/** 713 * This method handles the adapter, requests the data and build the basic list of results. 714 * The templates will be used for this and if there is no template for a given type no item will be rendered. 715 * 716 * @private 717 * @return fluent interface 718 * @type {imx.Autocomplete} 719 */ 720imx.Autocomplete.prototype.handleAdapter_ = function () { 721 var that = this; 722 var input = this.getInput(); 723 var list = this.getList(); 724 var settings = this.getSettings(); 725 var term = this.getInput().value; 726 var callback = function (responseItems) { 727 var wrap = null; 728 list.innerHTML = ''; 729 for (var index = 0; index < responseItems.length; index++) { 730 var type = responseItems[index].type; 731 var template = settings.templates[type]; 732 if (typeof template === 'function') { 733 if (settings.wrap.start.call(that, responseItems[index], index, responseItems) === true) { 734 var wrapTemplate = ''; 735 if (typeof settings.wrap.element === 'function') { 736 wrapTemplate = settings.wrap.element.call(that, responseItems[index], index, responseItems); 737 } else { 738 wrapTemplate = settings.wrap.element; 739 } 740 wrap = Autocomplete_util.createElementByTemplate(wrapTemplate); 741 } 742 var className = 'item type-' + type; 743 if (responseItems[index].selectable) { 744 className += ' selectable'; 745 } 746 var item = Autocomplete_util.createElementByTemplate(settings.itemElement); 747 item.setAttribute('class', className); 748 item.dataset.item = JSON.stringify(responseItems[index]); 749 if (responseItems[index].selectable) { 750 item.addEventListener('mouseover', function () { 751 var selected = list.querySelector('.selected'); 752 if (selected) { 753 selected.classList.remove('selected'); 754 } 755 this.classList.add('selected'); 756 that.getSettings().events.select.call(that, JSON.parse(this.dataset.item)); 757 }); 758 item.addEventListener('mousedown', function () { 759 that.change_(); 760 }); 761 } 762 item.innerHTML = template.call(that, responseItems[index], term); 763 if (wrap) { 764 Autocomplete_util.append(item, wrap); 765 } else { 766 Autocomplete_util.append(item, list); 767 } 768 if (settings.wrap.end.call(that, responseItems[index], index, responseItems) === true) { 769 Autocomplete_util.append(wrap, list); 770 wrap = null; 771 } 772 } 773 } 774 if (list.childElementCount > 0) { 775 that.show(); 776 } 777 input.classList.remove(settings.loadingClass); 778 }; 779 settings.adapter.request(term, callback, settings.events.beforeRequest, settings.events.afterRequest, settings.events.error); 780 return this; 781}; 782 783/***/ }) 784 785/******/ }); 786/************************************************************************/ 787/******/ // The module cache 788/******/ var __webpack_module_cache__ = {}; 789/******/ 790/******/ // The require function 791/******/ function __webpack_require__(moduleId) { 792/******/ // Check if module is in cache 793/******/ var cachedModule = __webpack_module_cache__[moduleId]; 794/******/ if (cachedModule !== undefined) { 795/******/ return cachedModule.exports; 796/******/ } 797/******/ // Create a new module (and put it into the cache) 798/******/ var module = __webpack_module_cache__[moduleId] = { 799/******/ // no module.id needed 800/******/ // no module.loaded needed 801/******/ exports: {} 802/******/ }; 803/******/ 804/******/ // Execute the module function 805/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 806/******/ 807/******/ // Return the exports of the module 808/******/ return module.exports; 809/******/ } 810/******/ 811/************************************************************************/ 812/******/ /* webpack/runtime/compat get default export */ 813/******/ (() => { 814/******/ // getDefaultExport function for compatibility with non-harmony modules 815/******/ __webpack_require__.n = (module) => {
816/******/ var getter = module && module.__esModule ? 817/******/ () => (module['default']) : 818/******/ () => (module); 819/******/ __webpack_require__.d(getter, { a: getter }); 820/******/ return getter; 821/******/ }; 822/******/ })(); 823/******/ 824/******/ /* webpack/runtime/define property getters */ 825/******/ (() => { 826/******/ // define getter functions for harmony exports 827/******/ __webpack_require__.d = (exports, definition) => { 828/******/ for(var key in definition) { 829/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 830/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 831/******/ } 832/******/ } 833/******/ }; 834/******/ })(); 835/******/ 836/******/ /* webpack/runtime/hasOwnProperty shorthand */ 837/******/ (() => { 838/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 839/******/ })(); 840/******/ 841/************************************************************************/ 842// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 843(() => { 844"use strict";
845// extracted by mini-css-extract-plugin 846 847})(); 848 849// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 850(() => { 851"use strict"; 852/* harmony import */ var Autocomplete_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3837); 853/* harmony import */ var Autocomplete_util__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(Autocomplete_util__WEBPACK_IMPORTED_MODULE_0__); 854/* harmony import */ var Autocomplete__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5555); 855/* harmony import */ var Autocomplete__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(Autocomplete__WEBPACK_IMPORTED_MODULE_1__); 856/* harmony import */ var adapter_AjaxAdapter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(770); 857/* harmony import */ var adapter_AjaxAdapter__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(adapter_AjaxAdapter__WEBPACK_IMPORTED_MODULE_2__); 858 859 860 861 862 863class Fulltextsearch { 864 constructor(node) { 865 this.node = node; 866 this.language = document.documentElement.lang.split('-')[0]; 867 this.inputText = this.node.querySelector('#fulltext[type=text]'); 868 this.container = this.node.querySelector('.autocompleteContainer'); 869 this.form = this.node.querySelector('form'); 870 this.keyCodes = { 871 RETURN: 13 872 }; 873 } 874 run() { 875 return new imx.Autocomplete(this.inputText, { 876 appendTo: this.container, 877 delay: 200, 878 adapter: new imx.Autocomplete.AjaxAdapter({ 879 url: '/autocomplete/list', 880 extraParams: { 881 lang: this.language 882 }, 883 cacheable: true 884 }), 885 minChars: 3, 886 resultsClass: 'list', 887 enableListStyle: false, 888 templates: { 889 suggest: (item, term) => this._highlight(item.label, term) 890 }, 891 keyCodeEvents: { 892 [this.keyCodes.RETURN]: () => { 893 this.node.requestSubmit(); 894 return this; 895 } 896 }, 897 events: { 898 show: () => { 899 this.container.classList.add('isActive'); 900 return this; 901 }, 902 hide: () => { 903 this.container.classList.remove('isActive'); 904 return this; 905 }, 906 change: () => { 907 this.node.requestSubmit(); 908 return this; 909 } 910 } 911 }).create(); 912 } 913 914 /** 915 * 916 * @param {String} input 917 * @param {String} term 918 * @returns {String} 919 * @private 920 */ 921 _highlight(input, term) { 922 const itemTemplate = this.node.querySelector('template.autocompleteItem'); 923 const itemNode = itemTemplate.content.cloneNode(true); 924 const textNode = itemNode.querySelector('.button__text'); 925 textNode.innerHTML = input; 926 return itemNode.firstElementChild.outerHTML; 927 } 928} 929document.querySelectorAll('.fulltextSearch').forEach(node => { 930 new Fulltextsearch(node).run(); 931}); 932})(); 933 934/******/ })() 935;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.