PHP Classes

File: public/pharaonic.select2.min.js

Recommend this page to a friend!
  Classes of Moamen Eltouny  >  Laravel Livewire Select2 Alternative  >  public/pharaonic.select2.min.js  >  Download  
File: public/pharaonic.select2.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Laravel Livewire Select2 Alternative
Handle select inputs to use with Laravel Livewire
Author: By
Last change:
Date: 5 months ago
Size: 1,128 bytes
 

Contents

Class file image Download
if(void 0===Pharaonic)var Pharaonic={};var PharaonicSelect2={Select2:{init:function(){$('[data-pharaonic="select2"]:not("[data-select2-id]")').each(function(){Pharaonic.Select2.load($(this),$(this).is("[data-component-id]")?$(this).data("component-id"):null)})},load:function(a,e){if(e){var t={multiple:$(a).is("[multiple]"),tags:$(a).is("[data-tags]"),placeholder:$(a).is("[data-placeholder]")?$(a).data("placeholder"):"Select an option",language:$(a).is("[data-language]")?$(a).data("language"):"en",dir:$(a).is("[data-dir]")?$(a).data("dir"):"ltr",dropdownParent:$(a).is("[data-parent]")?$($(a).data("parent")):null,minimumResultsForSearch:$(a).is("[data-search-off]")?-1:0},i=a[0].attributes,n=i.getNamedItem("wire:model")||i.getNamedItem("wire:model.defer")||null;if(delete i,a=$(a).select2(t),n){var d=n.value,l=n.name.search("defer")>0;a.on("change",function(){Livewire.find(e).set(d,$(a).val(),l)})}}}}};Object.assign(Pharaonic,PharaonicSelect2),$(document).ready(function(){Pharaonic.Select2.init()}),window.addEventListener("pharaonic.select2.load",a=>{Pharaonic.Select2.load($(a.detail.target),a.detail.component)});
For more information send a message to info at phpclasses dot org.