Skip to content

Commit

Permalink
public fix event listener : pharaonic.select2.load
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny authored Aug 22, 2021
1 parent 7e460b5 commit 27e66db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/components/scripts.blade.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<script>document.addEventListener("DOMContentLoaded",e=>{if(void 0===a)var a={};var t={Select2:{init:function(){$('[data-pharaonic="select2"]:not("[data-select2-id]")').each(function(){a.Select2.load($(this),$(this).is("[data-component-id]")?$(this).data("component-id"):null)})},load:function(e,a){if(a){var t={multiple:$(e).is("[multiple]"),placeholder:$(e).is("[data-placeholder]")?$(e).data("placeholder"):"Select an option",language:$(e).is("[data-language]")?$(e).data("language"):"en",dir:$(e).is("[data-dir]")?$(e).data("dir"):"ltr",dropdownParent:$(e).is("[data-parent]")?$($(e).data("parent")):null,minimumResultsForSearch:$(e).is("[data-search-off]")?-1:0},d=e[0].attributes,i=d.getNamedItem("wire:model")||d.getNamedItem("wire:model.defer")||null;if(delete d,e=$(e).select2(t),i){var n=i.value,l=i.name.search("defer")>0;e.on("select2:select",function(){Livewire.find(a).set(n,$(e).val(),l)})}}}}};Object.assign(a,t),$(document).ready(function(){a.Select2.init()}),window.addEventListener("pharaonic.select2.load",e=>{a.Select2.load(e.detail.target,e.detail.component)})});</script>
<script>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]"),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 l=n.value,d=n.name.search("defer")>0;a.on("select2:select",function(){Livewire.find(e).set(l,$(a).val(),d)})}}}}};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)});</script>

0 comments on commit 27e66db

Please sign in to comment.