3 lines
34 KiB
JavaScript
3 lines
34 KiB
JavaScript
|
/* Chosen v2.1.0 | (c) 2011-2020 JJJ | MIT License, https://github.com/jjj/chosen/blob/master/LICENSE.md */
|
||
|
|
||
|
(function(){var e,t,s,i;(i=class{constructor(e){this.options_index=0,this.parsed=[],this.copy_data_attributes=e.copy_data_attributes||!1}add_node(e){return"OPTGROUP"===e.nodeName.toUpperCase()?this.add_group(e):this.add_option(e)}add_group(e){var t,s,i,h,l,r;for(t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,title:e.title?e.title:void 0,children:0,disabled:e.disabled,hidden:e.hidden,classes:e.className}),r=[],s=0,i=(l=e.childNodes).length;s<i;s++)h=l[s],r.push(this.add_option(h,t,e.disabled));return r}add_option(e,t,s){if("OPTION"===e.nodeName.toUpperCase())return""!==e.text?(null!=t&&(this.parsed[t].children+=1),this.parsed.push({options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML.replace(/^\s+|\s+$/g,""),title:e.title?e.title:void 0,selected:e.selected,disabled:!0===s?s:e.disabled,hidden:e.hidden,group_array_index:t,group_label:null!=t?this.parsed[t].label:null,classes:e.className,style:e.style.cssText,data:this.parse_data_attributes(e)})):this.parsed.push({options_index:this.options_index,empty:!0,data:this.parse_data_attributes(e)}),this.options_index+=1}parse_data_attributes(e){var t,s,i,h,l,r;if(i={"data-option-array-index":this.parsed.length,"data-value":e.value},this.copy_data_attributes&&e)for(h=0,l=(r=e.attributes).length;h<l;h++)s=(t=r[h]).nodeName,/data-.*/.test(s)&&(i[s]=t.nodeValue);return i}}).select_to_array=function(e,t){var s,h,l,r,a;for(r=new i(t),h=0,l=(a=e.childNodes).length;h<l;h++)s=a[h],r.add_node(s);return r.parsed},t=function(){class e{constructor(t,s={}){this.label_click_handler=this.label_click_handler.bind(this),this.form_field=t,this.options=s,e.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.can_select_by_group=null!==this.form_field.getAttribute("select-by-group"),this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}set_default_values(){return this.click_test_action=(e=>this.test_active_click(e)),this.activate_action=(e=>this.activate_field(e)),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_in_values=this.options.search_in_values||!1,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.inherit_option_classes=this.options.inherit_option_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.parser_config=this.options.parser_config||{},this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select,this.create_option=this.options.create_option||!1,this.persistent_create_option=this.options.persistent_create_option||!1,this.skip_no_results=this.options.skip_no_results||!1}set_default_text(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.i
|