PHP Classes

File: public/pharaonic.tagify.min.js

Recommend this page to a friend!
  Classes of Moamen Eltouny   Livewire Tagify   public/pharaonic.tagify.min.js   Download  
File: public/pharaonic.tagify.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Livewire Tagify
Improve Laravel Livewire tags using Tagify
Author: By
Last change:
Date: 1 month ago
Size: 1,599 bytes
 

Contents

Class file image Download
if(void 0===Pharaonic)var Pharaonic={};var PharaonicTagify={Tagify:{init:function(){document.querySelectorAll('[data-pharaonic="tagify"]').forEach((a=>{a.previousElementSibling&&"TAGS"==a.previousElementSibling.tagName||!a.dataset.componentId||Pharaonic.Tagify.load(a,a.dataset.componentId)}))},load:function(a,e){var t=a.dataset.value?a.dataset.value:"value",i=a.dataset.key?a.dataset.key:"value",n=a.hasAttribute("data-direct"),s=""!=a.defaultValue?a.defaultValue:[];s.length>0&&(s=JSON.parse(s));var d={whitelist:a.dataset.suggestList?JSON.parse(a.dataset.suggestList):[],blacklist:a.dataset.blackList?JSON.parse(a.dataset.blackList):[],enforceWhitelist:!!a.hasAttribute("data-suggest-enforce"),maxTags:a.dataset.max?a.dataset.max:1/0,tagTextProp:t,dropdown:{maxItems:25,classname:a.dataset.classname?a.dataset.classname:"",enabled:a.hasAttribute("data-suggest")||a.hasAttribute("data-suggest-enforce")?0:1,closeOnSelect:!1,mapValueTo:t,searchKeys:[t]}},r=a.attributes,o=r.getNamedItem("wire:model")||r.getNamedItem("wire:model.defer")||null;if(delete r,(a=new Tagify(a,d)).addTags(s),o){var l=o.value,c=o.name.search("defer")>0;a.on("change",(a=>{(a=""==(a=a.detail.value)?[]:JSON.parse(a)).length>0&&n&&(a=a.map((a=>a[i]))),Livewire.find(e).set(l,a,c)}))}}}};Object.assign(Pharaonic,PharaonicTagify),window.addEventListener("DOMContentLoaded",(()=>{Pharaonic.Tagify.init()})),window.addEventListener("pharaonic.tagify.init",(a=>{Pharaonic.Tagify.init()})),window.addEventListener("pharaonic.tagify.load",(a=>{Pharaonic.Tagify.load(document.querySelector(a.detail.target),a.detail.component)}));