PHP Classes

File: public/js/filament/forms/components/tags-input.js

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Lara Filament   public/js/filament/forms/components/tags-input.js   Download  
File: public/js/filament/forms/components/tags-input.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Lara Filament
Blog post management and publication system
Author: By
Last change:
Date: 8 days ago
Size: 849 bytes
 

Contents

Class file image Download
function i({state:a,splitKeys:n}){return{newTag:"",state:a,createTag:function(){if(this.newTag=this.newTag.trim(),this.newTag!==""){if(this.state.includes(this.newTag)){this.newTag="";return}this.state.push(this.newTag),this.newTag=""}},deleteTag:function(t){this.state=this.state.filter(e=>e!==t)},reorderTags:function(t){let e=this.state.splice(t.oldIndex,1)[0];this.state.splice(t.newIndex,0,e),this.state=[...this.state]},input:{["x-on:blur"]:"createTag()",["x-model"]:"newTag",["x-on:keydown"](t){["Enter",...n].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.createTag())},["x-on:paste"](){this.$nextTick(()=>{if(n.length===0){this.createTag();return}let t=n.map(e=>e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")).join("|");this.newTag.split(new RegExp(t,"g")).forEach(e=>{this.newTag=e,this.createTag()})})}}}}export{i as default};