diff --git a/lang/en/form.php b/lang/en/form.php index 734279e2a46..5fd2b8cf2b6 100644 --- a/lang/en/form.php +++ b/lang/en/form.php @@ -49,6 +49,7 @@ $string['month'] = 'Month'; $string['mustbeoverriden'] = 'Abstract form_definition() method in class {$a} must be overridden, please fix the code.'; $string['nomethodforaddinghelpbutton'] = 'There is no method for adding a help button to form element {$a->name} (class {$a->classname})'; $string['nonexistentformelements'] = 'Trying to add help buttons to non-existent form elements : {$a}'; +$string['noselection'] = 'No selection'; $string['optional'] = 'Optional'; $string['othersettings'] = 'Other settings'; $string['requiredelement'] = 'Required field'; @@ -56,6 +57,7 @@ $string['revealpassword'] = 'Reveal'; $string['security'] = 'Security'; $string['selectallornone'] = 'Select all/none'; $string['selected'] = 'Selected'; +$string['selecteditems'] = 'Selected items:'; $string['showadvanced'] = 'Show advanced'; $string['showless'] = 'Show less...'; $string['showmore'] = 'Show more...'; diff --git a/lib/amd/build/form-autocomplete.min.js b/lib/amd/build/form-autocomplete.min.js new file mode 100644 index 00000000000..388903e82bd --- /dev/null +++ b/lib/amd/build/form-autocomplete.min.js @@ -0,0 +1 @@ +define(["jquery","core/log","core/str","core/templates","core/notification"],function(a,b,c,d,e){var f={DOWN:40,ENTER:13,SPACE:32,ESCAPE:27,COMMA:188,UP:38},g=null,h=function(b,c){var d=a(document.getElementById(c)),e=d.children("[aria-selected=true]").length;for(b%=e;0>b;)b+=e;var f=a(d.children("[aria-selected=true]").get(b)),g=c+"-"+b;d.children().attr("data-active-selection",!1).attr("id",""),f.attr("data-active-selection",!0).attr("id",g),d.attr("aria-activedescendant",g)},i=function(b,c,d,e,f,g){var h=a(document.getElementById(d)),i=h.children("[data-active-selection=true]").attr("data-value");f||e.children("option").prop("selected",!1),e.children("option").each(function(b,c){a(c).attr("value")==i&&(a(c).prop("selected",!1),g&&a(c).remove())}),r(d,b,e,f)},j=function(b,c,d){var e=a(document.getElementById(c)),f=a(document.getElementById(d)),g=f.children("[aria-hidden=false]").length;for(b%=g;0>b;)b+=g;var h=a(f.children("[aria-hidden=false]").get(b)),i=a(f.children("[role=option]")).index(h),j=d+"-"+i;f.children().attr("aria-selected",!1).attr("id",""),h.attr("aria-selected",!0).attr("id",j),e.attr("aria-activedescendant",j)},k=function(b,c){var d=a(document.getElementById(c)),e=d.children("[aria-selected=true]"),f=d.children("[aria-hidden=false]").index(e);j(f+1,b,c)},l=function(b){var c=a(document.getElementById(b)),d=c.children("[data-active-selection=true]");if(!d)return void h(0,b);var e=c.children("[aria-selected=true]").index(d);h(e-1,b)},m=function(b){var c=a(document.getElementById(b)),d=c.children("[data-active-selection=true]");if(!d)return void h(0,b);var e=c.children("[aria-selected=true]").index(d);h(e+1,b)},n=function(b,c){var d=a(document.getElementById(c)),e=d.children("[aria-selected=true]"),f=d.children("[aria-hidden=false]").index(e);j(f-1,b,c)},o=function(b,c,d){var e=a(document.getElementById(b)),f=a(document.getElementById(c));e.attr("aria-expanded",!1).attr("aria-activedescendant",d),f.hide().attr("aria-hidden",!0)},p=function(b,c,f,g,h,i){var k=a(document.getElementById(c)),l=a(document.getElementById(f)),m=!1,n=[];g.children("option").each(function(b,c){a(c).prop("selected")!==!0&&(n[n.length]={label:c.innerHTML,value:a(c).attr("value")})}),d.render("core/form_autocomplete_suggestions",{inputId:c,suggestionsId:f,options:n,multiple:h}).done(function(d){l.replaceWith(d),l=a(document.getElementById(f)),l.show().attr("aria-hidden",!1),l.children().each(function(c,d){d=a(d),d.text().indexOf(b)>-1?(d.show().attr("aria-hidden",!1),m=!0):d.hide().attr("aria-hidden",!0)}),m?(k.attr("aria-expanded",!0),i||j(0,c,f)):(l.hide(),l.attr("aria-hidden",!0),k.attr("aria-expanded",!1))}).fail(e.exception)},q=function(b,c,f,g,h){var i=a(document.getElementById(b)),j=i.val(),k=j.split(","),l=!1;a.each(k,function(b,c){if(c=c.trim(),""!==c&&(g||h.children("option").prop("selected",!1),h.children("option").each(function(b,d){a(d).attr("value")==c&&(l=!0,a(d).prop("selected",!0))}),!l)){var d=a("