diff --git a/lib/amd/build/form-autocomplete.min.js b/lib/amd/build/form-autocomplete.min.js index ce28280ce1d..fa95f55fc1f 100644 --- a/lib/amd/build/form-autocomplete.min.js +++ b/lib/amd/build/form-autocomplete.min.js @@ -1,2 +1,2 @@ -define ("core/form-autocomplete",["jquery","core/log","core/str","core/templates","core/notification","core/loadingicon","core/aria"],function(a,b,c,d,f,g,h){var i={DOWN:40,ENTER:13,SPACE:32,ESCAPE:27,COMMA:44,UP:38,LEFT:37,RIGHT:39},j=Date.now(),k=function(b,c){var d=a(document.getElementById(c.selectionId)),e=d.children("[aria-selected=true]").length;b=b%e;while(0>b){b+=e}var f=a(d.children("[aria-selected=true]").get(b)),g=c.selectionId+"-"+b;d.children().attr("data-active-selection",!1).attr("id","");f.attr("data-active-selection",!0).attr("id",g);d.attr("aria-activedescendant",g);return a.Deferred().resolve()},l=function(b,c,e){var g="form-autocomplete-updateSelectionList-"+c.inputId;M.util.js_pending(g);var h=[],i=a(document.getElementById(c.selectionId)),j=i.attr("aria-activedescendant"),l=!1;if(j){l=a(document.getElementById(j)).attr("data-value")}e.children("option").each(function(b,c){if(a(c).prop("selected")){var d;if(a(c).data("html")){d=a(c).data("html")}else{d=a(c).html()}if(""!==d){h.push({label:d,value:a(c).attr("value")})}}});var m=a.extend({items:h},b,c);return d.render(b.templates.items,m).then(function(b,e){d.replaceNodeContents(i,b,e);if(!1!==l){i.children("[aria-selected=true]").each(function(b,d){if(a(d).attr("data-value")===l){k(b,c)}})}return l}).then(function(){return M.util.js_complete(g)}).catch(f.exception)},m=function(a){if("undefined"!=typeof M.core_formchangechecker){M.core_formchangechecker.set_form_changed()}a[0].dispatchEvent(new Event("change"))},n=function(b,c,d,e){var f=a(d).attr("data-value");e.children("option").each(function(b,c){if(a(c).attr("value")==f){a(c).prop("selected",!1);if(a(c).attr("data-iscustom")){a(c).remove()}}});return l(b,c,e).then(function(){m(e)})},o=function(b,c){var d=a(document.getElementById(c.inputId)),e=a(document.getElementById(c.suggestionsId)),f=e.children(":not([aria-hidden])").length;b=b%f;while(0>b){b+=f}var g=a(e.children(":not([aria-hidden])").get(b)),h=a(e.children("[role=option]")).index(g),i=c.suggestionsId+"-"+h;e.children().attr("aria-selected",!1).attr("id","");g.attr("aria-selected",!0).attr("id",i);d.attr("aria-activedescendant",i);var j=g.offset().top-e.offset().top+e.scrollTop()-e.height()/2;return e.animate({scrollTop:j},100).promise()},p=function(b){var c=a(document.getElementById(b.suggestionsId)),d=c.children("[aria-selected=true]"),e=c.children(":not([aria-hidden])").index(d);return o(e+1,b)},q=function(b){var c=a(document.getElementById(b.selectionId)),d=c.children("[data-active-selection=true]");if(!d){return k(0,b)}var e=c.children("[aria-selected=true]").index(d);return k(e-1,b)},r=function(b){var c=a(document.getElementById(b.selectionId)),d=c.children("[data-active-selection=true]"),e=0;if(d){e=c.children("[aria-selected=true]").index(d);e=e+1}else{e=0}return k(e,b)},s=function(b){var c=a(document.getElementById(b.suggestionsId)),d=c.children("[aria-selected=true]"),e=c.children(":not([aria-hidden])").index(d);return o(e-1,b)},t=function(b){var c=a(document.getElementById(b.inputId)),d=a(document.getElementById(b.suggestionsId));if("true"===c.attr("aria-expanded")){c.attr("aria-expanded",!1)}c.attr("aria-activedescendant",b.selectionId);h.hide(d.get());d.hide();return a.Deferred().resolve()},u=function(b,e,g,i){var j="form-autocomplete-updateSuggestions-"+e.inputId;M.util.js_pending(j);var k=a(document.getElementById(e.inputId)),l=a(document.getElementById(e.suggestionsId)),m=!1,n=[];i.children("option").each(function(b,c){if(!0!==a(c).prop("selected")){n[n.length]={label:c.innerHTML,value:a(c).attr("value")}}});var p=e.caseSensitive?g:g.toLocaleLowerCase(),q=a.extend({options:n},b,e),r=d.render("core/form_autocomplete_suggestions",q).then(function(f,g){d.replaceNode(l,f,g);l=a(document.getElementById(e.suggestionsId));h.unhide(l.get());l.show();l.children().each(function(c,d){d=a(d);if(b.caseSensitive&&-1");f.append(document.createTextNode(e));f.attr("value",e);d.append(f);f.prop("selected",!0);f.attr("data-iscustom",!0)}}});return l(b,c,d).then(function(){m(d)}).then(function(){e.val("")}).then(function(){return t(c)})},w=function(b,c,d){var e=a(document.getElementById(c.inputId)),f=a(document.getElementById(c.suggestionsId)),g=f.children("[aria-selected=true]").attr("data-value");if(!b.multiple){d.children("option").prop("selected",!1)}d.children("option").each(function(b,c){if(a(c).attr("value")==g){a(c).prop("selected",!0)}});return l(b,c,d).then(function(){m(d)}).then(function(){if(b.closeSuggestionsOnSelect){e.val("");return t(c)}else{e.focus();return u(b,c,e.val(),d)}})},x=function(b,c,d,e,f){var h=z("updateAjax"),i=a(document.getElementById(d.selectId)).parent();g.addIconToContainerRemoveOnCompletion(i,h);var j=a(b.currentTarget).val();f.transport(c.selector,j,function(b){var g=f.processResults(c.selector,b),i=[];if(!c.multiple){e.children("option").remove()}e.children("option").each(function(b,c){c=a(c);if(!c.prop("selected")){c.remove()}else{i.push(c.attr("value")+"")}});if(!c.multiple&&0===e.children("option").length){var j=a("