@tabler/core
Advanced tools
Comparing version 1.0.0-beta5 to 1.0.0-beta6
/*! | ||
* Tabler v1.0.0-beta5 (https://tabler.io) | ||
* @version 1.0.0-beta5 | ||
* Tabler v1.0.0-beta6 (https://tabler.io) | ||
* @version 1.0.0-beta6 | ||
* @link https://tabler.io | ||
* Copyright 2018-2021 The Tabler Authors | ||
* Copyright 2018-2021 codecalm.net Paweł Kuna | ||
* Copyright 2018-2022 The Tabler Authors | ||
* Copyright 2018-2022 codecalm.net Paweł Kuna | ||
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE) | ||
@@ -8,0 +8,0 @@ */ |
/*! | ||
* Tabler v1.0.0-beta5 (https://tabler.io) | ||
* @version 1.0.0-beta5 | ||
* Tabler v1.0.0-beta6 (https://tabler.io) | ||
* @version 1.0.0-beta6 | ||
* @link https://tabler.io | ||
* Copyright 2018-2021 The Tabler Authors | ||
* Copyright 2018-2021 codecalm.net Paweł Kuna | ||
* Copyright 2018-2022 The Tabler Authors | ||
* Copyright 2018-2022 codecalm.net Paweł Kuna | ||
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE) | ||
*/ | ||
!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";function e(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,a=[],l=!0,c=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{l||null==r.return||r.return()}finally{if(c)throw o}}return a}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}for(var r={theme:{localStorage:"tablerTheme",default:"light"},"menu-position":{localStorage:"tablerMenuPosition",default:"top"},"menu-behavior":{localStorage:"tablerMenuBehavior",default:"sticky"},"container-layout":{localStorage:"tablerContainerLayout",default:"boxed"}},n={},o=0,a=Object.entries(r);o<a.length;o++){var l=e(a[o],2),c=l[0],i=l[1];n[c]=localStorage.getItem(i.localStorage)?localStorage.getItem(i.localStorage):i.default}var u=function(){document.body.classList.remove("theme-dark"),document.body.classList.remove("theme-light"),document.body.classList.add("theme-".concat(n.theme))};!function(){for(var e=window.location.search.substring(1).split("&"),t=0;t<e.length;t++){var o=e[t].split("="),a=o[0],l=o[1];r[a]&&(localStorage.setItem(r[a].localStorage,l),n[a]=l)}}(),u();var s=document.querySelector("#offcanvasSettings");s&&(s.addEventListener("submit",function(t){t.preventDefault(),function(t){for(var o=0,a=Object.entries(r);o<a.length;o++){var l=e(a[o],2),c=l[0],i=l[1],s=t.querySelector('[name="settings-'.concat(c,'"]:checked')).value;localStorage.setItem(i.localStorage,s),n[c]=s}u(),window.dispatchEvent(new Event("resize")),new bootstrap.Offcanvas(t).hide()}(s)}),function(t){for(var o=0,a=Object.entries(r);o<a.length;o++){var l=e(a[o],2),c=l[0];l[1];var i=t.querySelector('[name="settings-'.concat(c,'"][value="').concat(n[c],'"]'));i&&(i.checked=!0)}}(s))}); |
/** | ||
* Tom Select v1.7.8 | ||
* Tom Select v2.0.0 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -12,8 +12,12 @@ */ | ||
var o | ||
const r={"æ":"ae","ⱥ":"a","ø":"o"},l=new RegExp(Object.keys(r).join("|"),"g"),a=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]],c=e=>e.normalize("NFKD").replace(n,"").toLowerCase().replace(l,(function(e){return r[e]})),d=(e,t="|")=>e.length>1?"(?:"+e.join(t)+")":e[0],p=e=>{if(1===e.length)return[[e]] | ||
const r={"æ":"ae","ⱥ":"a","ø":"o"},l=new RegExp(Object.keys(r).join("|"),"g"),a=[[67,67],[160,160],[192,438],[452,652],[961,961],[1019,1019],[1083,1083],[1281,1289],[1984,1984],[5095,5095],[7429,7441],[7545,7549],[7680,7935],[8580,8580],[9398,9449],[11360,11391],[42792,42793],[42802,42851],[42873,42897],[42912,42922],[64256,64260],[65313,65338],[65345,65370]],c=e=>e.normalize("NFKD").replace(n,"").toLowerCase().replace(l,(function(e){return r[e]})),d=(e,t="|")=>{if(1==e.length)return e[0] | ||
var i=1 | ||
return e.forEach((e=>{i=Math.max(i,e.length)})),1==i?"["+e.join("")+"]":"(?:"+e.join(t)+")"},p=e=>{if(1===e.length)return[[e]] | ||
var t=[] | ||
return p(e.substring(1)).forEach((function(i){var s=i.slice(0) | ||
s[0]=e.charAt(0)+s[0],t.push(s),(s=i.slice(0)).unshift(e.charAt(0)),t.push(s)})),t},u=e=>{void 0===o&&(o=(()=>{var e={} | ||
a.forEach((t=>{for(let i=t[0];i<=t[1];i++){let t=String.fromCharCode(i),s=c(t) | ||
s!=t.toLowerCase()&&(s in e||(e[s]=[s]),e[s].push(t))}})) | ||
a.forEach((t=>{for(let s=t[0];s<=t[1];s++){let t=String.fromCharCode(s),n=c(t) | ||
if(n!=t.toLowerCase()){n in e||(e[n]=[n]) | ||
var i=new RegExp(d(e[n]),"iu") | ||
t.match(i)||e[n].push(t)}}})) | ||
var t=Object.keys(e) | ||
@@ -28,7 +32,8 @@ t=t.sort(((e,t)=>t.length-e.length)),i=new RegExp("("+d(t)+"[̀-ͯ·ʾ]*)","g") | ||
const i=e.normalize("NFC") | ||
return i!=e?d([e,i]):e})).join("")},h=(e,t)=>{if(e)return e[t]},g=(e,t)=>{if(e){for(var i,s=t.split(".");(i=s.shift())&&(e=e[i]););return e}},m=(e,t,i)=>{var s,n | ||
return e?-1===(n=(e+="").search(t.regex))?0:(s=t.string.length/e.length,0===n&&(s+=.5),s*i):0},f=e=>(e+"").replace(/([\$\(-\+\.\?\[-\^\{-\}])/g,"\\$1"),v=(e,t)=>{var i=e[t] | ||
return i!=e?d([e,i]):e})).join("")},h=(e,t)=>{if(e)return e[t]},g=(e,t)=>{if(e){for(var i,s=t.split(".");(i=s.shift())&&(e=e[i]););return e}},v=(e,t,i)=>{var s,n | ||
return e?-1===(n=(e+="").search(t.regex))?0:(s=t.string.length/e.length,0===n&&(s+=.5),s*i):0},f=e=>(e+"").replace(/([\$\(-\+\.\?\[-\^\{-\}])/g,"\\$1"),m=(e,t)=>{var i=e[t] | ||
if("function"==typeof i)return i | ||
i&&!Array.isArray(i)&&(e[t]=[i])},y=(e,t)=>{if(Array.isArray(e))e.forEach(t) | ||
else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},O=(e,t)=>"number"==typeof e&&"number"==typeof t?e>t?1:e<t?-1:0:(e=c(e+"").toLowerCase())>(t=c(t+"").toLowerCase())?1:t>e?-1:0 | ||
class b{constructor(e,t){this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,i){if(!e||!e.length)return[] | ||
class w{constructor(e,t){this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,i){if(!e||!e.length)return[] | ||
const s=[],n=e.split(/\s+/) | ||
@@ -43,5 +48,5 @@ var o | ||
const l=1===o?function(e,t){const i=s[0].field | ||
return m(r(t,i),e,n[i])}:function(e,t){var i=0 | ||
return v(r(t,i),e,n[i])}:function(e,t){var i=0 | ||
if(e.field){const s=r(t,e.field) | ||
!e.regex&&s?i+=1/o:i+=m(s,e,1)}else y(n,((s,n)=>{i+=m(r(t,n),e,s)})) | ||
!e.regex&&s?i+=1/o:i+=v(s,e,1)}else y(n,((s,n)=>{i+=v(r(t,n),e,s)})) | ||
return i/o} | ||
@@ -52,3 +57,5 @@ return 1===i?function(e){return l(t[0],e)}:"and"===e.options.conjunction?function(e){for(var s,n=0,o=0;n<i;n++){if((s=l(t[n],e))<=0)return 0 | ||
return this._getSortFunction(i)}_getSortFunction(e){var t,i,s | ||
const n=this,o=e.options,r=!e.query&&o.sort_empty?o.sort_empty:o.sort,l=[],a=[],c=function(t,i){return"$score"===t?i.score:e.getAttrFn(n.items[i.id],t)} | ||
const n=this,o=e.options,r=!e.query&&o.sort_empty?o.sort_empty:o.sort,l=[],a=[] | ||
if("function"==typeof r)return r.bind(this) | ||
const c=function(t,i){return"$score"===t?i.score:e.getAttrFn(n.items[i.id],t)} | ||
if(r)for(t=0,i=r.length;t<i;t++)(e.query||"$score"!==r[t].field)&&l.push(r[t]) | ||
@@ -64,3 +71,3 @@ if(e.query){for(s=!0,t=0,i=l.length;t<i;t++)if("$score"===l[t].field){s=!1 | ||
var s=Object.assign({},t) | ||
if(v(s,"sort"),v(s,"sort_empty"),s.fields){v(s,"fields") | ||
if(m(s,"sort"),m(s,"sort_empty"),s.fields){m(s,"fields") | ||
const e=[] | ||
@@ -72,14 +79,12 @@ s.fields.forEach((t=>{"string"==typeof t&&(t={field:t,weight:1}),e.push(t),i[t.field]="weight"in t?t.weight:1})),s.fields=e}return{options:s,query:e.toLowerCase().trim(),tokens:this.tokenize(e,s.respect_word_boundaries,i),total:0,items:[],weights:i,getAttrFn:s.nesting?g:h}}search(e,t){var i,s,n=this | ||
const r=n._getSortFunction(s) | ||
return r&&s.items.sort(r),s.total=s.items.length,"number"==typeof t.limit&&(s.items=s.items.slice(0,t.limit)),s}}const w=e=>{if(e.jquery)return e[0] | ||
return r&&s.items.sort(r),s.total=s.items.length,"number"==typeof t.limit&&(s.items=s.items.slice(0,t.limit)),s}}const b=e=>{if(e.jquery)return e[0] | ||
if(e instanceof HTMLElement)return e | ||
if(e.indexOf("<")>-1){let t=document.createElement("div") | ||
return t.innerHTML=e.trim(),t.firstChild}return document.querySelector(e)},I=(e,t)=>{var i=document.createEvent("HTMLEvents") | ||
i.initEvent(t,!0,!1),e.dispatchEvent(i)},C=(e,t)=>{Object.assign(e.style,t)},A=(e,...t)=>{var i=S(t);(e=F(e)).map((e=>{i.map((t=>{e.classList.add(t)}))}))},_=(e,...t)=>{var i=S(t);(e=F(e)).map((e=>{i.map((t=>{e.classList.remove(t)}))}))},S=e=>{var t=[] | ||
for(let i of e)"string"==typeof i&&(i=i.trim().split(/[\11\12\14\15\40]/)),Array.isArray(i)&&(t=t.concat(i)) | ||
return t.filter(Boolean)},F=e=>(Array.isArray(e)||(e=[e]),e),x=(e,t,i)=>{if(!i||i.contains(e))for(;e&&e.matches;){if(e.matches(t))return e | ||
e=e.parentNode}},k=(e,t=0)=>t>0?e[e.length-1]:e[0],P=(e,t)=>{if(!e)return-1 | ||
if(I(e)){let t=document.createElement("div") | ||
return t.innerHTML=e.trim(),t.firstChild}return document.querySelector(e)},I=e=>"string"==typeof e&&e.indexOf("<")>-1,_=(e,t)=>{var i=document.createEvent("HTMLEvents") | ||
i.initEvent(t,!0,!1),e.dispatchEvent(i)},S=(e,t)=>{Object.assign(e.style,t)},A=(e,...t)=>{var i=F(t);(e=x(e)).map((e=>{i.map((t=>{e.classList.add(t)}))}))},C=(e,...t)=>{var i=F(t);(e=x(e)).map((e=>{i.map((t=>{e.classList.remove(t)}))}))},F=e=>{var t=[] | ||
return y(e,(e=>{"string"==typeof e&&(e=e.trim().split(/[\11\12\14\15\40]/)),Array.isArray(e)&&(t=t.concat(e))})),t.filter(Boolean)},x=e=>(Array.isArray(e)||(e=[e]),e),k=(e,t,i)=>{if(!i||i.contains(e))for(;e&&e.matches;){if(e.matches(t))return e | ||
e=e.parentNode}},L=(e,t=0)=>t>0?e[e.length-1]:e[0],P=(e,t)=>{if(!e)return-1 | ||
t=t||e.nodeName | ||
for(var i=0;e=e.previousElementSibling;)e.matches(t)&&i++ | ||
return i},L=(e,t)=>{for(const i in t){let s=t[i] | ||
null==s?e.removeAttribute(i):e.setAttribute(i,""+s)}},E=(e,t)=>{e.parentNode&&e.parentNode.replaceChild(t,e)},T=(e,t)=>{if(null===t)return | ||
return i},E=(e,t)=>{y(t,((t,i)=>{null==t?e.removeAttribute(i):e.setAttribute(i,""+t)}))},T=(e,t)=>{e.parentNode&&e.parentNode.replaceChild(t,e)},V=(e,t)=>{if(null===t)return | ||
if("string"==typeof t){if(!t.length)return | ||
@@ -92,14 +97,28 @@ t=new RegExp(t,"i")}const i=e=>3===e.nodeType?(e=>{var i=e.data.match(t) | ||
var o=n.cloneNode(!0) | ||
return s.appendChild(o),E(n,s),1}return 0})(e):((e=>{if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var t=0;t<e.childNodes.length;++t)t+=i(e.childNodes[t])})(e),0) | ||
i(e)},q="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey" | ||
var V={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,closeAfterSelect:!1,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-control",inputClass:"ts-input",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:null,copyClassesToDropdown:!0,placeholder:null,hidePlaceholder:null,shouldLoad:function(e){return e.length>0},render:{}} | ||
const j=e=>null==e?null:$(e),$=e=>"boolean"==typeof e?e?"1":"0":e+"",D=e=>(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),N=(e,t)=>{var i | ||
return s.appendChild(o),T(n,s),1}return 0})(e):((e=>{if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var t=0;t<e.childNodes.length;++t)t+=i(e.childNodes[t])})(e),0) | ||
i(e)},$="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey" | ||
var j={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'<input type="text" autocomplete="off" size="1" />',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(e){return e.length>0},render:{}} | ||
const q=e=>null==e?null:D(e),D=e=>"boolean"==typeof e?e?"1":"0":e+"",N=e=>(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),R=(e,t)=>{var i | ||
return function(s,n){var o=this | ||
i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout((function(){i=null,o.loadedSearches[s]=!0,e.call(o,s,n)}),t)}},R=(e,t,i)=>{var s,n=e.trigger,o={} | ||
for(s in e.trigger=function(){var i=arguments[0] | ||
i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout((function(){i=null,o.loadedSearches[s]=!0,e.call(o,s,n)}),t)}},H=(e,t,i)=>{var s,n=e.trigger,o={} | ||
for(s of(e.trigger=function(){var i=arguments[0] | ||
if(-1===t.indexOf(i))return n.apply(e,arguments) | ||
o[i]=arguments},i.apply(e,[]),e.trigger=n,o)n.apply(e,o[s])},H=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},z=(e,t,i,s)=>{e.addEventListener(t,i,s)},K=(e,t)=>!!t&&(!!t[e]&&1===(t.altKey?1:0)+(t.ctrlKey?1:0)+(t.shiftKey?1:0)+(t.metaKey?1:0)),M=(e,t)=>{const i=e.getAttribute("id") | ||
return i||(e.setAttribute("id",t),t)},B=e=>e.replace(/[\\"']/g,"\\$&"),Q=(e,t)=>{t&&e.append(t)} | ||
var G=0 | ||
class U extends(function(e){return e.plugins={},class extends e{constructor(...e){super(...e),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(t,i){e.plugins[t]={name:t,fn:i}}initializePlugins(e){var t,i | ||
o[i]=arguments},i.apply(e,[]),e.trigger=n,t))s in o&&n.apply(e,o[s])},z=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},K=(e,t,i,s)=>{e.addEventListener(t,i,s)},M=(e,t)=>!!t&&(!!t[e]&&1===(t.altKey?1:0)+(t.ctrlKey?1:0)+(t.shiftKey?1:0)+(t.metaKey?1:0)),B=(e,t)=>{const i=e.getAttribute("id") | ||
return i||(e.setAttribute("id",t),t)},Q=e=>e.replace(/[\\"']/g,"\\$&"),G=(e,t)=>{t&&e.append(t)} | ||
function J(e,t){var i=Object.assign({},j,t),s=i.dataAttr,n=i.labelField,o=i.valueField,r=i.disabledField,l=i.optgroupField,a=i.optgroupLabelField,c=i.optgroupValueField,d=e.tagName.toLowerCase(),p=e.getAttribute("placeholder")||e.getAttribute("data-placeholder") | ||
if(!p&&!i.allowEmptyOption){let t=e.querySelector('option[value=""]') | ||
t&&(p=t.textContent)}var u,h,g,v,f,m,O={placeholder:p,options:[],optgroups:[],items:[],maxItems:null} | ||
return"select"===d?(h=O.options,g={},v=1,f=e=>{var t=Object.assign({},e.dataset),i=s&&t[s] | ||
return"string"==typeof i&&i.length&&(t=Object.assign(t,JSON.parse(i))),t},m=(e,t)=>{var s=q(e.value) | ||
if(null!=s&&(s||i.allowEmptyOption)){if(g.hasOwnProperty(s)){if(t){var a=g[s][l] | ||
a?Array.isArray(a)?a.push(t):g[s][l]=[a,t]:g[s][l]=t}}else{var c=f(e) | ||
c[n]=c[n]||e.textContent,c[o]=c[o]||s,c[r]=c[r]||e.disabled,c[l]=c[l]||t,c.$option=e,g[s]=c,h.push(c)}e.selected&&O.items.push(s)}},O.maxItems=e.hasAttribute("multiple")?null:1,y(e.children,(e=>{var t,i,s | ||
"optgroup"===(u=e.tagName.toLowerCase())?((s=f(t=e))[a]=s[a]||t.getAttribute("label")||"",s[c]=s[c]||v++,s[r]=s[r]||t.disabled,O.optgroups.push(s),i=s[c],y(t.children,(e=>{m(e,i)}))):"option"===u&&m(e)}))):(()=>{const t=e.getAttribute(s) | ||
if(t)O.options=JSON.parse(t),y(O.options,(e=>{O.items.push(e[o])})) | ||
else{var r=e.value.trim()||"" | ||
if(!i.allowEmptyOption&&!r.length)return | ||
const t=r.split(i.delimiter) | ||
y(t,(e=>{const t={} | ||
t[n]=e,t[o]=e,O.options.push(t)})),O.items=t}})(),Object.assign({},j,O,t)}var U=0 | ||
class W extends(function(e){return e.plugins={},class extends e{constructor(...e){super(...e),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(t,i){e.plugins[t]={name:t,fn:i}}initializePlugins(e){var t,i | ||
const s=this,n=[] | ||
@@ -113,76 +132,62 @@ if(Array.isArray(e))e.forEach((e=>{"string"==typeof e?n.push(e):(s.plugins.settings[e.name]=e.options,n.push(e.name))})) | ||
t.loadPlugin(e)}return i.loaded[e]}}}(t)){constructor(e,t){var i | ||
super(),this.order=0,this.tab_key=!1,this.isOpen=!1,this.isDisabled=!1,this.isInvalid=!1,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.renderCache={item:{},option:{}},G++ | ||
var s=w(e),n=this | ||
super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],U++ | ||
var s=b(e) | ||
if(s.tomselect)throw new Error("Tom Select already initialized on this element") | ||
s.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(s,null)).getPropertyValue("direction"),this.settings=function(e,t){var i=Object.assign({},V,t),s=i.dataAttr,n=i.labelField,o=i.valueField,r=i.disabledField,l=i.optgroupField,a=i.optgroupLabelField,c=i.optgroupValueField,d=e.tagName.toLowerCase(),p=e.getAttribute("placeholder")||e.getAttribute("data-placeholder") | ||
if(!p&&!i.allowEmptyOption){let t=e.querySelector('option[value=""]') | ||
t&&(p=t.textContent)}var u={placeholder:p,options:[],optgroups:[],items:[],maxItems:null} | ||
return"select"===d?(()=>{var t,d=u.options,p={},h=1,g=e=>{var t=Object.assign({},e.dataset),i=s&&t[s] | ||
return"string"==typeof i&&i.length&&(t=Object.assign(t,JSON.parse(i))),t},m=(e,t)=>{var s=j(e.value) | ||
if(null!=s&&(s||i.allowEmptyOption)){if(p.hasOwnProperty(s)){if(t){var a=p[s][l] | ||
a?Array.isArray(a)?a.push(t):p[s][l]=[a,t]:p[s][l]=t}}else{var c=g(e) | ||
c[n]=c[n]||e.textContent,c[o]=c[o]||s,c[r]=c[r]||e.disabled,c[l]=c[l]||t,c.$option=e,p[s]=c,d.push(c)}e.selected&&u.items.push(s)}},f=e=>{var t,i;(i=g(e))[a]=i[a]||e.getAttribute("label")||"",i[c]=i[c]||h++,i[r]=i[r]||e.disabled,u.optgroups.push(i),t=i[c] | ||
for(const i of e.children)m(i,t)} | ||
u.maxItems=e.hasAttribute("multiple")?null:1 | ||
for(const i of e.children)"optgroup"===(t=i.tagName.toLowerCase())?f(i):"option"===t&&m(i)})():(()=>{const t=e.getAttribute(s) | ||
if(t){u.options=JSON.parse(t) | ||
for(const e of u.options)u.items.push(e[o])}else{var r=e.value.trim()||"" | ||
if(!i.allowEmptyOption&&!r.length)return | ||
const t=r.split(i.delimiter) | ||
for(const e of t){const t={} | ||
t[n]=e,t[o]=e,u.options.push(t)}u.items=t}})(),Object.assign({},V,u,t)}(s,t),this.input=s,this.tabIndex=s.tabIndex||0,this.is_select_tag="select"===s.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=M(s,"tomselect-"+G),this.isRequired=s.required,this.sifter=new b(this.options,{diacritics:this.settings.diacritics}),this.setupOptions(this.settings.options,this.settings.optgroups),delete this.settings.optgroups,delete this.settings.options,this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),"boolean"!=typeof this.settings.hideSelected&&(this.settings.hideSelected="multi"===this.settings.mode),"boolean"!=typeof this.settings.hidePlaceholder&&(this.settings.hidePlaceholder="multi"!==this.settings.mode) | ||
var o=this.settings.createFilter | ||
"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?this.settings.createFilter=e=>o.test(e):this.settings.createFilter=()=>!0),this.initializePlugins(this.settings.plugins),this.setupCallbacks(),this.setupTemplates() | ||
var r,l,a,c,d,p,u,h,g | ||
t=n.settings,s=n.input | ||
const m={passive:!0},v=n.inputId+"-ts-dropdown" | ||
if(p=n.settings.mode,u=s.getAttribute("class")||"",r=w("<div>"),A(r,t.wrapperClass,u,p),l=w('<div class="items">'),A(l,t.inputClass),Q(r,l),c=n._render("dropdown"),A(c,t.dropdownClass,p),d=w(`<div role="listbox" id="${v}" tabindex="-1">`),A(d,t.dropdownContentClass),Q(c,d),w(t.dropdownParent||r).appendChild(c),t.controlInput)a=w(t.controlInput) | ||
else{a=w('<input type="text" autocomplete="off" size="1" />') | ||
for(const e of["autocorrect","autocapitalize","autocomplete"])s.getAttribute(e)&&L(a,{[e]:s.getAttribute(e)})}t.controlInput||(a.tabIndex=s.disabled?-1:n.tabIndex,l.appendChild(a)),L(a,{role:"combobox",haspopup:"listbox","aria-expanded":"false","aria-controls":v}),g=M(a,n.inputId+"-tomselected") | ||
let y="label[for='"+(e=>e.replace(/['"\\]/g,"\\$&"))(n.inputId)+"']",O=document.querySelector(y) | ||
if(O){L(O,{for:g}) | ||
let e=M(O,n.inputId+"-ts-label") | ||
L(d,{"aria-labelledby":e})}n.settings.copyClassesToDropdown&&A(c,u),r.style.width=s.style.width,n.plugins.names.length&&(h="plugin-"+n.plugins.names.join(" plugin-"),A([r,c],h)),(null===t.maxItems||t.maxItems>1)&&n.is_select_tag&&L(s,{multiple:"multiple"}),n.settings.placeholder&&L(a,{placeholder:t.placeholder}),!n.settings.splitOn&&n.settings.delimiter&&(n.settings.splitOn=new RegExp("\\s*"+f(n.settings.delimiter)+"+\\s*")),this.settings.load&&this.settings.loadThrottle&&(this.settings.load=N(this.settings.load,this.settings.loadThrottle)),this.control=l,this.control_input=a,this.wrapper=r,this.dropdown=c,this.dropdown_content=d,n.control_input.type=s.type,z(c,"click",(e=>{const t=x(e.target,"[data-selectable]") | ||
t&&(n.onOptionSelect(e,t),H(e,!0))})),z(l,"click",(e=>{var t=x(e.target,"."+n.settings.itemClass,l) | ||
t&&n.onItemSelect(e,t)?H(e,!0):""==a.value&&(n.onClick(),H(e,!0))})),z(a,"mousedown",(e=>{""!==a.value&&e.stopPropagation()})),z(a,"keydown",(e=>n.onKeyDown(e))),z(a,"keyup",(e=>n.onKeyUp(e))),z(a,"keypress",(e=>n.onKeyPress(e))),z(a,"resize",(()=>n.positionDropdown()),m),z(a,"blur",(()=>n.onBlur())),z(a,"focus",(e=>n.onFocus(e))),z(a,"paste",(e=>n.onPaste(e))) | ||
const I=e=>{const t=e.composedPath()[0] | ||
if(!r.contains(t)&&!c.contains(t))return n.isFocused&&n.blur(),void n.inputState() | ||
H(e,!0)} | ||
var C=()=>{n.isOpen&&n.positionDropdown()} | ||
z(document,"mousedown",I),z(window,"sroll",C,m),z(window,"resize",C,m),this._destroy=()=>{document.removeEventListener("mousedown",I),window.removeEventListener("sroll",C),window.removeEventListener("resize",C)},this.revertSettings={innerHTML:s.innerHTML,tabIndex:s.tabIndex},s.tabIndex=-1,L(s,{hidden:"hidden"}),s.insertAdjacentElement("afterend",n.wrapper),n.setValue(t.items),t.items=[],z(s,"invalid",(e=>{H(e),n.isInvalid||(n.isInvalid=!0,n.refreshState())})),n.updateOriginalInput(),n.refreshItems(),n.close(!1),n.inputState(),n.isSetup=!0,s.disabled&&n.disable(),n.on("change",this.onChange),A(s,"tomselected"),n.trigger("initialize"),!0===t.preload&&n.load(""),n.setup()}setup(){}setupOptions(e=[],t=[]){for(const t of e)this.registerOption(t) | ||
for(const e of t)this.registerOptionGroup(e)}setupTemplates(){var e=this,t=e.settings.labelField,i=e.settings.optgroupLabelField,s={optgroup:e=>{let t=document.createElement("div") | ||
s.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(s,null)).getPropertyValue("direction") | ||
const n=J(s,t) | ||
this.settings=n,this.input=s,this.tabIndex=s.tabIndex||0,this.is_select_tag="select"===s.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.inputId=B(s,"tomselect-"+U),this.isRequired=s.required,this.sifter=new w(this.options,{diacritics:n.diacritics}),n.mode=n.mode||(1===n.maxItems?"single":"multi"),"boolean"!=typeof n.hideSelected&&(n.hideSelected="multi"===n.mode),"boolean"!=typeof n.hidePlaceholder&&(n.hidePlaceholder="multi"!==n.mode) | ||
var o=n.createFilter | ||
"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?n.createFilter=e=>o.test(e):n.createFilter=()=>!0),this.initializePlugins(n.plugins),this.setupCallbacks(),this.setupTemplates() | ||
const r=b("<div>"),l=b("<div>"),a=this._render("dropdown"),c=b('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",p=n.mode | ||
var u | ||
if(A(r,n.wrapperClass,d,p),A(l,n.controlClass),G(r,l),A(a,n.dropdownClass,p),n.copyClassesToDropdown&&A(a,d),A(c,n.dropdownContentClass),G(a,c),b(n.dropdownParent||r).appendChild(a),I(n.controlInput)){u=b(n.controlInput) | ||
y(["autocorrect","autocapitalize","autocomplete"],(e=>{s.getAttribute(e)&&E(u,{[e]:s.getAttribute(e)})})),u.tabIndex=-1,l.appendChild(u),this.focus_node=u}else n.controlInput?(u=b(n.controlInput),this.focus_node=u):(u=b("<input/>"),this.focus_node=l) | ||
this.wrapper=r,this.dropdown=a,this.dropdown_content=c,this.control=l,this.control_input=u,this.setup()}setup(){const e=this,t=e.settings,i=e.control_input,s=e.dropdown,n=e.dropdown_content,o=e.wrapper,r=e.control,l=e.input,a=e.focus_node,c={passive:!0},d=e.inputId+"-ts-dropdown" | ||
E(n,{id:d}),E(a,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":d}) | ||
const p=B(a,e.inputId+"-ts-control"),u="label[for='"+(e=>e.replace(/['"\\]/g,"\\$&"))(e.inputId)+"']",h=document.querySelector(u),g=e.focus.bind(e) | ||
if(h){K(h,"click",g),E(h,{for:p}) | ||
const t=B(h,e.inputId+"-ts-label") | ||
E(a,{"aria-labelledby":t}),E(n,{"aria-labelledby":t})}if(o.style.width=l.style.width,e.plugins.names.length){const t="plugin-"+e.plugins.names.join(" plugin-") | ||
A([o,s],t)}(null===t.maxItems||t.maxItems>1)&&e.is_select_tag&&E(l,{multiple:"multiple"}),e.settings.placeholder&&E(i,{placeholder:t.placeholder}),!e.settings.splitOn&&e.settings.delimiter&&(e.settings.splitOn=new RegExp("\\s*"+f(e.settings.delimiter)+"+\\s*")),t.load&&t.loadThrottle&&(t.load=R(t.load,t.loadThrottle)),e.control_input.type=l.type,K(s,"click",(t=>{const i=k(t.target,"[data-selectable]") | ||
i&&(e.onOptionSelect(t,i),z(t,!0))})),K(r,"click",(t=>{var s=k(t.target,"[data-ts-item]",r) | ||
s&&e.onItemSelect(t,s)?z(t,!0):""==i.value&&(e.onClick(),z(t,!0))})),K(a,"keydown",(t=>e.onKeyDown(t))),K(i,"keypress",(t=>e.onKeyPress(t))),K(i,"input",(t=>e.onInput(t))),K(a,"resize",(()=>e.positionDropdown()),c),K(a,"blur",(t=>e.onBlur(t))),K(a,"focus",(t=>e.onFocus(t))),K(a,"paste",(t=>e.onPaste(t))) | ||
const v=t=>{const n=t.composedPath()[0] | ||
if(!o.contains(n)&&!s.contains(n))return e.isFocused&&e.blur(),void e.inputState() | ||
n==i&&e.isOpen?t.stopPropagation():z(t,!0)} | ||
var m=()=>{e.isOpen&&e.positionDropdown()} | ||
K(document,"mousedown",v),K(window,"scroll",m,c),K(window,"resize",m,c),this._destroy=()=>{document.removeEventListener("mousedown",v),window.removeEventListener("sroll",m),window.removeEventListener("resize",m),h&&h.removeEventListener("click",g)},this.revertSettings={innerHTML:l.innerHTML,tabIndex:l.tabIndex},l.tabIndex=-1,l.insertAdjacentElement("afterend",e.wrapper),e.sync(!1),t.items=[],delete t.optgroups,delete t.options,K(l,"invalid",(t=>{e.isValid&&(e.isValid=!1,e.isInvalid=!0,e.refreshState())})),e.updateOriginalInput(),e.refreshItems(),e.close(!1),e.inputState(),e.isSetup=!0,l.disabled?e.disable():e.enable(),e.on("change",this.onChange),A(l,"tomselected","ts-hidden-accessible"),e.trigger("initialize"),!0===t.preload&&e.preload()}setupOptions(e=[],t=[]){this.addOptions(e),y(t,(e=>{this.registerOptionGroup(e)}))}setupTemplates(){var e=this,t=e.settings.labelField,i=e.settings.optgroupLabelField,s={optgroup:e=>{let t=document.createElement("div") | ||
return t.className="optgroup",t.appendChild(e.options),t},optgroup_header:(e,t)=>'<div class="optgroup-header">'+t(e[i])+"</div>",option:(e,i)=>"<div>"+i(e[t])+"</div>",item:(e,i)=>"<div>"+i(e[t])+"</div>",option_create:(e,t)=>'<div class="create">Add <strong>'+t(e.input)+"</strong>…</div>",no_results:()=>'<div class="no-results">No results found</div>',loading:()=>'<div class="spinner"></div>',not_loading:()=>{},dropdown:()=>"<div></div>"} | ||
e.settings.render=Object.assign({},s,e.settings.render)}setupCallbacks(){var e,t,i={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"} | ||
for(e in i)(t=this.settings[i[e]])&&this.on(e,t)}onClick(){var e=this | ||
for(e in i)(t=this.settings[i[e]])&&this.on(e,t)}sync(e=!0){const t=this,i=e?J(t.input,{delimiter:t.settings.delimiter}):t.settings | ||
t.setupOptions(i.options,i.optgroups),t.setValue(i.items,!0),t.lastQuery=null}onClick(){var e=this | ||
if(e.activeItems.length>0)return e.clearActiveItems(),void e.focus() | ||
e.isFocused&&e.isOpen?e.blur():e.focus()}onMouseDown(){}onChange(){I(this.input,"input"),I(this.input,"change")}onPaste(e){var t=this | ||
t.isFull()||t.isInputHidden||t.isLocked?H(e):t.settings.splitOn&&setTimeout((()=>{var e=t.inputValue() | ||
e.isFocused&&e.isOpen?e.blur():e.focus()}onMouseDown(){}onChange(){_(this.input,"input"),_(this.input,"change")}onPaste(e){var t=this | ||
t.isInputHidden||t.isLocked?z(e):t.settings.splitOn&&setTimeout((()=>{var e=t.inputValue() | ||
if(e.match(t.settings.splitOn)){var i=e.trim().split(t.settings.splitOn) | ||
for(const e of i)t.createItem(e)}}),0)}onKeyPress(e){var t=this | ||
y(i,(e=>{t.createItem(e)}))}}),0)}onKeyPress(e){var t=this | ||
if(!t.isLocked){var i=String.fromCharCode(e.keyCode||e.which) | ||
return t.settings.create&&"multi"===t.settings.mode&&i===t.settings.delimiter?(t.createItem(),void H(e)):void 0}H(e)}onKeyDown(e){var t=this | ||
if(t.isLocked)9!==e.keyCode&&H(e) | ||
else{switch(e.keyCode){case 65:if(K(q,e))return void t.selectAll() | ||
return t.settings.create&&"multi"===t.settings.mode&&i===t.settings.delimiter?(t.createItem(),void z(e)):void 0}z(e)}onKeyDown(e){var t=this | ||
if(t.isLocked)9!==e.keyCode&&z(e) | ||
else{switch(e.keyCode){case 65:if(M($,e)&&""==t.control_input.value)return z(e),void t.selectAll() | ||
break | ||
case 27:return t.isOpen&&(H(e,!0),t.close()),void t.clearActiveItems() | ||
case 27:return t.isOpen&&(z(e,!0),t.close()),void t.clearActiveItems() | ||
case 40:if(!t.isOpen&&t.hasOptions)t.open() | ||
else if(t.activeOption){let e=t.getAdjacent(t.activeOption,1) | ||
e&&t.setActiveOption(e)}return void H(e) | ||
e&&t.setActiveOption(e)}return void z(e) | ||
case 38:if(t.activeOption){let e=t.getAdjacent(t.activeOption,-1) | ||
e&&t.setActiveOption(e)}return void H(e) | ||
case 13:return void(t.isOpen&&t.activeOption?(t.onOptionSelect(e,t.activeOption),H(e)):t.settings.create&&t.createItem()&&H(e)) | ||
e&&t.setActiveOption(e)}return void z(e) | ||
case 13:return void(t.canSelect(t.activeOption)?(t.onOptionSelect(e,t.activeOption),z(e)):t.settings.create&&t.createItem()&&z(e)) | ||
case 37:return void t.advanceSelection(-1,e) | ||
case 39:return void t.advanceSelection(1,e) | ||
case 9:return void(t.settings.selectOnTab&&(t.isOpen&&t.activeOption&&(t.tab_key=!0,t.onOptionSelect(e,t.activeOption),H(e),t.tab_key=!1),t.settings.create&&t.createItem()&&H(e))) | ||
case 8:case 46:return void t.deleteSelection(e)}t.isInputHidden&&!K(q,e)&&H(e)}}onKeyUp(e){var t=this | ||
if(t.isLocked)H(e) | ||
else{var i=t.inputValue() | ||
case 9:return void(t.settings.selectOnTab&&(t.canSelect(t.activeOption)&&(t.onOptionSelect(e,t.activeOption),z(e)),t.settings.create&&t.createItem()&&z(e))) | ||
case 8:case 46:return void t.deleteSelection(e)}t.isInputHidden&&!M($,e)&&z(e)}}onInput(e){var t=this | ||
if(!t.isLocked){var i=t.inputValue() | ||
t.lastValue!==i&&(t.lastValue=i,t.settings.shouldLoad.call(t,i)&&t.load(i),t.refreshOptions(),t.trigger("type",i))}}onFocus(e){var t=this,i=t.isFocused | ||
if(t.isDisabled)return t.blur(),void H(e) | ||
t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.load(""),i||t.trigger("focus"),t.activeItems.length||(t.showInput(),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())}onBlur(){var e=this | ||
if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1 | ||
var t=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")} | ||
e.settings.create&&e.settings.createOnBlur?e.createItem(null,!1,t):t()}}onOptionSelect(e,t){var i,s=this | ||
t&&(t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?s.createItem(null,!0,(()=>{s.settings.closeAfterSelect&&s.close()})):void 0!==(i=t.dataset.value)&&(s.lastQuery=null,s.addItem(i),s.settings.closeAfterSelect&&s.close(),!s.settings.hideSelected&&e.type&&/click/.test(e.type)&&s.setActiveOption(t))))}onItemSelect(e,t){var i=this | ||
return!i.isLocked&&"multi"===i.settings.mode&&(H(e),i.setActiveItem(t,e),!0)}canLoad(e){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(e)}load(e){const t=this | ||
if(t.isDisabled)return t.blur(),void z(e) | ||
t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.preload(),i||t.trigger("focus"),t.activeItems.length||(t.showInput(),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())}onBlur(e){if(!1!==document.hasFocus()){var t=this | ||
if(t.isFocused){t.isFocused=!1,t.ignoreFocus=!1 | ||
var i=()=>{t.close(),t.setActiveItem(),t.setCaret(t.items.length),t.trigger("blur")} | ||
t.settings.create&&t.settings.createOnBlur?t.createItem(null,!1,i):i()}}}onOptionSelect(e,t){var i,s=this | ||
t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?s.createItem(null,!0,(()=>{s.settings.closeAfterSelect&&s.close()})):void 0!==(i=t.dataset.value)&&(s.lastQuery=null,s.addItem(i),s.settings.closeAfterSelect&&s.close(),!s.settings.hideSelected&&e.type&&/click/.test(e.type)&&s.setActiveOption(t)))}canSelect(e){return!!(this.isOpen&&e&&this.dropdown_content.contains(e))}onItemSelect(e,t){var i=this | ||
return!i.isLocked&&"multi"===i.settings.mode&&(z(e),i.setActiveItem(t,e),!0)}canLoad(e){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(e)}load(e){const t=this | ||
if(!t.canLoad(e))return | ||
@@ -192,52 +197,54 @@ A(t.wrapper,t.settings.loadingClass),t.loading++ | ||
t.settings.load.call(t,e,i)}loadCallback(e,t){const i=this | ||
i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(e,t),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||_(i.wrapper,i.settings.loadingClass),i.trigger("load",e,t)}setTextboxValue(e=""){var t=this.control_input | ||
t.value!==e&&(t.value=e,I(t,"update"),this.lastValue=e)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(e,t){R(this,t?[]:["change"],(()=>{this.clear(t),this.addItems(e,t)}))}setMaxItems(e){0===e&&(e=null),this.settings.maxItems=e,this.refreshState()}setActiveItem(e,t){var i,s,n,o,r,l,a=this | ||
i.loading=Math.max(i.loading-1,0),i.lastQuery=null,i.clearActiveOption(),i.setupOptions(e,t),i.refreshOptions(i.isFocused&&!i.isInputHidden),i.loading||C(i.wrapper,i.settings.loadingClass),i.trigger("load",e,t)}preload(){var e=this.wrapper.classList | ||
e.contains("preloaded")||(e.add("preloaded"),this.load(""))}setTextboxValue(e=""){var t=this.control_input | ||
t.value!==e&&(t.value=e,_(t,"update"),this.lastValue=e)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(e,t){H(this,t?[]:["change"],(()=>{this.clear(t),this.addItems(e,t)}))}setMaxItems(e){0===e&&(e=null),this.settings.maxItems=e,this.refreshState()}setActiveItem(e,t){var i,s,n,o,r,l,a=this | ||
if("single"!==a.settings.mode){if(!e)return a.clearActiveItems(),void(a.isFocused&&a.showInput()) | ||
if("click"===(i=t&&t.type.toLowerCase())&&K("shiftKey",t)&&a.activeItems.length){for(l=a.getLastActive(),(n=Array.prototype.indexOf.call(a.control.children,l))>(o=Array.prototype.indexOf.call(a.control.children,e))&&(r=n,n=o,o=r),s=n;s<=o;s++)e=a.control.children[s],-1===a.activeItems.indexOf(e)&&a.setActiveItemClass(e) | ||
H(t)}else"click"===i&&K(q,t)||"keydown"===i&&K("shiftKey",t)?e.classList.contains("active")?a.removeActiveItem(e):a.setActiveItemClass(e):(a.clearActiveItems(),a.setActiveItemClass(e)) | ||
if("click"===(i=t&&t.type.toLowerCase())&&M("shiftKey",t)&&a.activeItems.length){for(l=a.getLastActive(),(n=Array.prototype.indexOf.call(a.control.children,l))>(o=Array.prototype.indexOf.call(a.control.children,e))&&(r=n,n=o,o=r),s=n;s<=o;s++)e=a.control.children[s],-1===a.activeItems.indexOf(e)&&a.setActiveItemClass(e) | ||
z(t)}else"click"===i&&M($,t)||"keydown"===i&&M("shiftKey",t)?e.classList.contains("active")?a.removeActiveItem(e):a.setActiveItemClass(e):(a.clearActiveItems(),a.setActiveItemClass(e)) | ||
a.hideInput(),a.isFocused||a.focus()}}setActiveItemClass(e){const t=this,i=t.control.querySelector(".last-active") | ||
i&&_(i,"last-active"),A(e,"active last-active"),t.trigger("item_select",e),-1==t.activeItems.indexOf(e)&&t.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e) | ||
this.activeItems.splice(t,1),_(e,"active")}clearActiveItems(){_(this.activeItems,"active"),this.activeItems=[]}setActiveOption(e){e!==this.activeOption&&(this.clearActiveOption(),e&&(this.activeOption=e,L(this.control_input,{"aria-activedescendant":e.getAttribute("id")}),L(e,{"aria-selected":"true"}),A(e,"active"),this.scrollToOption(e)))}scrollToOption(e,t){if(!e)return | ||
i&&C(i,"last-active"),A(e,"active last-active"),t.trigger("item_select",e),-1==t.activeItems.indexOf(e)&&t.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e) | ||
this.activeItems.splice(t,1),C(e,"active")}clearActiveItems(){C(this.activeItems,"active"),this.activeItems=[]}setActiveOption(e){e!==this.activeOption&&(this.clearActiveOption(),e&&(this.activeOption=e,E(this.focus_node,{"aria-activedescendant":e.getAttribute("id")}),E(e,{"aria-selected":"true"}),A(e,"active"),this.scrollToOption(e)))}scrollToOption(e,t){if(!e)return | ||
const i=this.dropdown_content,s=i.clientHeight,n=i.scrollTop||0,o=e.offsetHeight,r=e.getBoundingClientRect().top-i.getBoundingClientRect().top+n | ||
r+o>s+n?this.scroll(r-s+o,t):r<n&&this.scroll(r,t)}scroll(e,t){const i=this.dropdown_content | ||
t&&(i.style.scrollBehavior=t),i.scrollTop=e,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(_(this.activeOption,"active"),L(this.activeOption,{"aria-selected":null})),this.activeOption=null,L(this.control_input,{"aria-activedescendant":null})}selectAll(){"single"!==this.settings.mode&&(this.activeItems=this.controlChildren(),this.activeItems.length&&(A(this.activeItems,"active"),this.hideInput(),this.close()),this.focus())}inputState(){var e=this | ||
e.settings.controlInput||(e.activeItems.length>0||!e.isFocused&&this.settings.hidePlaceholder&&e.items.length>0?(e.setTextboxValue(),e.isInputHidden=!0,A(e.wrapper,"input-hidden")):(e.isInputHidden=!1,_(e.wrapper,"input-hidden")))}hideInput(){this.inputState()}showInput(){this.inputState()}inputValue(){return this.control_input.value.trim()}focus(){var e=this | ||
e.isDisabled||(e.ignoreFocus=!0,e.control_input.focus(),setTimeout((()=>{e.ignoreFocus=!1,e.onFocus()}),0))}blur(){this.control_input.blur(),this.onBlur()}getScoreFunction(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())}getSearchOptions(){var e=this.settings,t=e.sortField | ||
t&&(i.style.scrollBehavior=t),i.scrollTop=e,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(C(this.activeOption,"active"),E(this.activeOption,{"aria-selected":null})),this.activeOption=null,E(this.focus_node,{"aria-activedescendant":null})}selectAll(){if("single"===this.settings.mode)return | ||
const e=this.controlChildren() | ||
e.length&&(this.hideInput(),this.close(),this.activeItems=e,A(e,"active"))}inputState(){var e=this | ||
e.control.contains(e.control_input)&&(E(e.control_input,{placeholder:e.settings.placeholder}),e.activeItems.length>0||!e.isFocused&&e.settings.hidePlaceholder&&e.items.length>0?(e.setTextboxValue(),e.isInputHidden=!0):(e.settings.hidePlaceholder&&e.items.length>0&&E(e.control_input,{placeholder:""}),e.isInputHidden=!1),e.wrapper.classList.toggle("input-hidden",e.isInputHidden))}hideInput(){this.inputState()}showInput(){this.inputState()}inputValue(){return this.control_input.value.trim()}focus(){var e=this | ||
e.isDisabled||(e.ignoreFocus=!0,e.control_input.offsetWidth?e.control_input.focus():e.focus_node.focus(),setTimeout((()=>{e.ignoreFocus=!1,e.onFocus()}),0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())}getSearchOptions(){var e=this.settings,t=e.sortField | ||
return"string"==typeof e.sortField&&(t=[{field:e.sortField}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}}search(e){var t,i,s,n=this,o=this.getSearchOptions() | ||
if(n.settings.score&&"function"!=typeof(s=n.settings.score.call(n,e)))throw new Error('Tom Select "score" setting must be a function that returns a function') | ||
if(e!==n.lastQuery?(n.lastQuery=e,i=n.sifter.search(e,Object.assign(o,{score:s})),n.currentResults=i):i=Object.assign({},n.currentResults),n.settings.hideSelected)for(t=i.items.length-1;t>=0;t--){let e=j(i.items[t].id) | ||
if(e!==n.lastQuery?(n.lastQuery=e,i=n.sifter.search(e,Object.assign(o,{score:s})),n.currentResults=i):i=Object.assign({},n.currentResults),n.settings.hideSelected)for(t=i.items.length-1;t>=0;t--){let e=q(i.items[t].id) | ||
e&&-1!==n.items.indexOf(e)&&i.items.splice(t,1)}return i}refreshOptions(e=!0){var t,i,s,n,o,r,l,a,c,d,p | ||
const u={},h=[] | ||
var g,m=this,f=m.inputValue(),v=m.search(f),y=m.activeOption,O=m.settings.shouldOpen||!1,b=m.dropdown_content | ||
for(y&&(c=y.dataset.value,d=y.closest("[data-group]")),n=v.items.length,"number"==typeof m.settings.maxOptions&&(n=Math.min(n,m.settings.maxOptions)),n>0&&(O=!0),t=0;t<n;t++){let e=v.items[t].id,n=m.options[e],l=m.getOption(e,!0) | ||
for(m.settings.hideSelected||l.classList.toggle("selected",m.items.includes(e)),o=n[m.settings.optgroupField]||"",i=0,s=(r=Array.isArray(o)?o:[o])&&r.length;i<s;i++)o=r[i],m.optgroups.hasOwnProperty(o)||(o=""),u.hasOwnProperty(o)||(u[o]=document.createDocumentFragment(),h.push(o)),i>0&&(l=l.cloneNode(!0),L(l,{id:n.$id+"-clone-"+i,"aria-selected":null}),l.classList.add("ts-cloned"),_(l,"active")),c==e&&d&&d.dataset.group===o&&(y=l),u[o].appendChild(l)}for(o of(this.settings.lockOptgroupOrder&&h.sort(((e,t)=>(m.optgroups[e]&&m.optgroups[e].$order||0)-(m.optgroups[t]&&m.optgroups[t].$order||0))),l=document.createDocumentFragment(),h))if(m.optgroups.hasOwnProperty(o)&&u[o].children.length){let e=document.createDocumentFragment(),t=m.render("optgroup_header",m.optgroups[o]) | ||
Q(e,t),Q(e,u[o]) | ||
let i=m.render("optgroup",{group:m.optgroups[o],options:e}) | ||
Q(l,i)}else Q(l,u[o]) | ||
if(b.innerHTML="",Q(b,l),m.settings.highlight&&(g=b.querySelectorAll("span.highlight"),Array.prototype.forEach.call(g,(function(e){var t=e.parentNode | ||
t.replaceChild(e.firstChild,e),t.normalize()})),v.query.length&&v.tokens.length))for(const e of v.tokens)T(b,e.regex) | ||
var w=e=>{let t=m.render(e,{input:f}) | ||
return t&&(O=!0,b.insertBefore(t,b.firstChild)),t} | ||
if(m.settings.shouldLoad.call(m,f)?m.loading?w("loading"):0===v.items.length&&w("no_results"):w("not_loading"),(a=m.canCreate(f))&&(p=w("option_create")),m.hasOptions=v.items.length>0||a,O){if(v.items.length>0){if(!b.contains(y)&&"single"===m.settings.mode&&m.items.length&&(y=m.getOption(m.items[0])),!b.contains(y)){let e=0 | ||
p&&!m.settings.addPrecedence&&(e=1),y=m.selectable()[e]}}else p&&(y=p) | ||
e&&!m.isOpen&&(m.open(),m.scrollToOption(y,"auto")),m.setActiveOption(y)}else m.clearActiveOption(),e&&m.isOpen&&m.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(e){var t,i=this | ||
if(Array.isArray(e))for(const t of e)i.addOption(t) | ||
else(t=i.registerOption(e))&&(i.userOptions[t]=!0,i.lastQuery=null,i.trigger("option_add",t,e))}registerOption(e){var t=j(e[this.settings.valueField]) | ||
return null!==t&&!this.options.hasOwnProperty(t)&&(e.$order=e.$order||++this.order,e.$id=this.inputId+"-opt-"+e.$order,this.options[t]=e,t)}registerOptionGroup(e){var t=j(e[this.settings.optgroupValueField]) | ||
var g,v=this,f=v.inputValue(),m=v.search(f),O=v.activeOption,w=v.settings.shouldOpen||!1,b=v.dropdown_content | ||
for(O&&(c=O.dataset.value,d=O.closest("[data-group]")),n=m.items.length,"number"==typeof v.settings.maxOptions&&(n=Math.min(n,v.settings.maxOptions)),n>0&&(w=!0),t=0;t<n;t++){let e=m.items[t].id,n=v.options[e],l=v.getOption(e,!0) | ||
for(v.settings.hideSelected||l.classList.toggle("selected",v.items.includes(e)),o=n[v.settings.optgroupField]||"",i=0,s=(r=Array.isArray(o)?o:[o])&&r.length;i<s;i++)o=r[i],v.optgroups.hasOwnProperty(o)||(o=""),u.hasOwnProperty(o)||(u[o]=document.createDocumentFragment(),h.push(o)),i>0&&(l=l.cloneNode(!0),E(l,{id:n.$id+"-clone-"+i,"aria-selected":null}),l.classList.add("ts-cloned"),C(l,"active")),c==e&&d&&d.dataset.group===o&&(O=l),u[o].appendChild(l)}this.settings.lockOptgroupOrder&&h.sort(((e,t)=>(v.optgroups[e]&&v.optgroups[e].$order||0)-(v.optgroups[t]&&v.optgroups[t].$order||0))),l=document.createDocumentFragment(),y(h,(e=>{if(v.optgroups.hasOwnProperty(e)&&u[e].children.length){let t=document.createDocumentFragment(),i=v.render("optgroup_header",v.optgroups[e]) | ||
G(t,i),G(t,u[e]) | ||
let s=v.render("optgroup",{group:v.optgroups[e],options:t}) | ||
G(l,s)}else G(l,u[e])})),b.innerHTML="",G(b,l),v.settings.highlight&&(g=b.querySelectorAll("span.highlight"),Array.prototype.forEach.call(g,(function(e){var t=e.parentNode | ||
t.replaceChild(e.firstChild,e),t.normalize()})),m.query.length&&m.tokens.length&&y(m.tokens,(e=>{V(b,e.regex)}))) | ||
var I=e=>{let t=v.render(e,{input:f}) | ||
return t&&(w=!0,b.insertBefore(t,b.firstChild)),t} | ||
if(v.loading?I("loading"):v.settings.shouldLoad.call(v,f)?0===m.items.length&&I("no_results"):I("not_loading"),(a=v.canCreate(f))&&(p=I("option_create")),v.hasOptions=m.items.length>0||a,w){if(m.items.length>0){if(!b.contains(O)&&"single"===v.settings.mode&&v.items.length&&(O=v.getOption(v.items[0])),!b.contains(O)){let e=0 | ||
p&&!v.settings.addPrecedence&&(e=1),O=v.selectable()[e]}}else p&&(O=p) | ||
e&&!v.isOpen&&(v.open(),v.scrollToOption(O,"auto")),v.setActiveOption(O)}else v.clearActiveOption(),e&&v.isOpen&&v.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(e,t=!1){const i=this | ||
if(Array.isArray(e))return i.addOptions(e,t),!1 | ||
const s=q(e[i.settings.valueField]) | ||
return null!==s&&!i.options.hasOwnProperty(s)&&(e.$order=e.$order||++i.order,e.$id=i.inputId+"-opt-"+e.$order,i.options[s]=e,i.lastQuery=null,t&&(i.userOptions[s]=t,i.trigger("option_add",s,e)),s)}addOptions(e,t=!1){y(e,(e=>{this.addOption(e,t)}))}registerOption(e){return this.addOption(e)}registerOptionGroup(e){var t=q(e[this.settings.optgroupValueField]) | ||
return null!==t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)}addOptionGroup(e,t){var i | ||
t[this.settings.optgroupValueField]=e,(i=this.registerOptionGroup(t))&&this.trigger("optgroup_add",i,t)}removeOptionGroup(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.clearCache(),this.trigger("optgroup_remove",e))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(e,t){const i=this | ||
var s,n | ||
const o=j(e) | ||
const o=q(e),r=q(t[i.settings.valueField]) | ||
if(null===o)return | ||
const r=j(t[i.settings.valueField]),l=i.getOption(o),a=i.getItem(o) | ||
if(i.options.hasOwnProperty(o)){if("string"!=typeof r)throw new Error("Value must be set in option data") | ||
if(t.$order=t.$order||i.options[o].$order,delete i.options[o],i.uncacheValue(r),i.uncacheValue(o,!1),i.options[r]=t,l){if(i.dropdown_content.contains(l)){const e=i._render("option",t) | ||
E(l,e),i.activeOption===l&&i.setActiveOption(e)}l.remove()}a&&(-1!==(n=i.items.indexOf(o))&&i.items.splice(n,1,r),s=i._render("item",t),a.classList.contains("active")&&A(s,"active"),E(a,s)),i.lastQuery=null}}removeOption(e,t){const i=this | ||
e=$(e),i.uncacheValue(e),delete i.userOptions[e],delete i.options[e],i.lastQuery=null,i.trigger("option_remove",e),i.removeItem(e,t)}clearOptions(){this.loadedSearches={},this.userOptions={},this.clearCache() | ||
if(!i.options.hasOwnProperty(o))return | ||
if("string"!=typeof r)throw new Error("Value must be set in option data") | ||
const l=i.getOption(o),a=i.getItem(o) | ||
if(t.$order=t.$order||i.options[o].$order,delete i.options[o],i.uncacheValue(r),i.options[r]=t,l){if(i.dropdown_content.contains(l)){const e=i._render("option",t) | ||
T(l,e),i.activeOption===l&&i.setActiveOption(e)}l.remove()}a&&(-1!==(n=i.items.indexOf(o))&&i.items.splice(n,1,r),s=i._render("item",t),a.classList.contains("active")&&A(s,"active"),T(a,s)),i.lastQuery=null}removeOption(e,t){const i=this | ||
e=D(e),i.uncacheValue(e),delete i.userOptions[e],delete i.options[e],i.lastQuery=null,i.trigger("option_remove",e),i.removeItem(e,t)}clearOptions(){this.loadedSearches={},this.userOptions={},this.clearCache() | ||
var e={} | ||
for(let t in this.options)this.options.hasOwnProperty(t)&&this.items.indexOf(t)>=0&&(e[t]=this.options[t]) | ||
this.options=this.sifter.items=e,this.lastQuery=null,this.trigger("option_clear")}uncacheValue(e,t=!0){const i=this,s=i.renderCache.item,n=i.renderCache.option | ||
if(s&&delete s[e],n&&delete n[e],t){const t=i.getOption(e) | ||
t&&t.remove()}}getOption(e,t=!1){var i=j(e),s=this.rendered("option",i) | ||
return!s&&t&&null!==i&&(s=this._render("option",this.options[i])),s}getAdjacent(e,t,i="option"){var s | ||
y(this.options,((t,i)=>{this.items.indexOf(i)>=0&&(e[i]=this.options[i])})),this.options=this.sifter.items=e,this.lastQuery=null,this.trigger("option_clear")}getOption(e,t=!1){const i=q(e) | ||
if(null!==i&&this.options.hasOwnProperty(i)){const e=this.options[i] | ||
if(e.$div)return e.$div | ||
if(t)return this._render("option",e)}return null}getAdjacent(e,t,i="option"){var s | ||
if(!e)return null | ||
@@ -247,64 +254,59 @@ s="item"==i?this.controlChildren():this.dropdown_content.querySelectorAll("[data-selectable]") | ||
return null}getItem(e){if("object"==typeof e)return e | ||
var t=j(e) | ||
return null!==t?this.control.querySelector(`[data-value="${B(t)}"]`):null}addItems(e,t){var i=this,s=Array.isArray(e)?e:[e] | ||
for(let e=0,n=(s=s.filter((e=>-1===i.items.indexOf(e)))).length;e<n;e++)i.isPending=e<n-1,i.addItem(s[e],t)}addItem(e,t){R(this,t?[]:["change"],(()=>{var i,s | ||
const n=this,o=n.settings.mode,r=j(e) | ||
if((!r||-1===n.items.indexOf(r)||("single"===o&&n.close(),"single"!==o&&n.settings.duplicates))&&null!==r&&n.options.hasOwnProperty(r)&&("single"===o&&n.clear(t),"multi"!==o||!n.isFull())){if(i=n._render("item",n.options[r]),n.control.contains(i)&&(i=i.cloneNode(!0)),s=n.isFull(),n.items.splice(n.caretPos,0,r),n.insertAtCaret(i),n.isSetup){let e=n.selectable() | ||
if(!n.isPending&&n.settings.hideSelected){let e=n.getOption(r),t=n.getAdjacent(e,1) | ||
t&&n.setActiveOption(t)}n.isPending||n.refreshOptions(n.isFocused&&"single"!==o),!e.length||n.isFull()?n.close():n.isPending||n.positionDropdown(),n.trigger("item_add",r,i),n.isPending||n.updateOriginalInput({silent:t})}(!n.isPending||!s&&n.isFull())&&n.refreshState()}}))}removeItem(e=null,t){const i=this | ||
var t=q(e) | ||
return null!==t?this.control.querySelector(`[data-value="${Q(t)}"]`):null}addItems(e,t){var i=this,s=Array.isArray(e)?e:[e] | ||
for(let e=0,n=(s=s.filter((e=>-1===i.items.indexOf(e)))).length;e<n;e++)i.isPending=e<n-1,i.addItem(s[e],t)}addItem(e,t){H(this,t?[]:["change","dropdown_close"],(()=>{var i,s | ||
const n=this,o=n.settings.mode,r=q(e) | ||
if((!r||-1===n.items.indexOf(r)||("single"===o&&n.close(),"single"!==o&&n.settings.duplicates))&&null!==r&&n.options.hasOwnProperty(r)&&("single"===o&&n.clear(t),"multi"!==o||!n.isFull())){if(i=n._render("item",n.options[r]),n.control.contains(i)&&(i=i.cloneNode(!0)),s=n.isFull(),n.items.splice(n.caretPos,0,r),n.insertAtCaret(i),n.isSetup){if(!n.isPending&&n.settings.hideSelected){let e=n.getOption(r),t=n.getAdjacent(e,1) | ||
t&&n.setActiveOption(t)}n.isPending||n.settings.closeAfterSelect||n.refreshOptions(n.isFocused&&"single"!==o),0!=n.settings.closeAfterSelect&&n.isFull()?n.close():n.isPending||n.positionDropdown(),n.trigger("item_add",r,i),n.isPending||n.updateOriginalInput({silent:t})}(!n.isPending||!s&&n.isFull())&&(n.inputState(),n.refreshState())}}))}removeItem(e=null,t){const i=this | ||
if(!(e=i.getItem(e)))return | ||
var s,n | ||
const o=e.dataset.value | ||
s=P(e),e.remove(),e.classList.contains("active")&&(n=i.activeItems.indexOf(e),i.activeItems.splice(n,1),_(e,"active")),i.items.splice(s,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(o)&&i.removeOption(o,t),s<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:t}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",o,e)}createItem(e=null,t=!0,i=(()=>{})){var s,n=this,o=n.caretPos | ||
s=P(e),e.remove(),e.classList.contains("active")&&(n=i.activeItems.indexOf(e),i.activeItems.splice(n,1),C(e,"active")),i.items.splice(s,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(o)&&i.removeOption(o,t),s<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:t}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",o,e)}createItem(e=null,t=!0,i=(()=>{})){var s,n=this,o=n.caretPos | ||
if(e=e||n.inputValue(),!n.canCreate(e))return i(),!1 | ||
n.lock() | ||
var r=!1,l=e=>{if(n.unlock(),!e||"object"!=typeof e)return i() | ||
var s=j(e[n.settings.valueField]) | ||
if("string"!=typeof s)return i() | ||
n.setTextboxValue(),n.addOption(e),n.setCaret(o),n.addItem(s),n.refreshOptions(t&&"single"!==n.settings.mode),i(e),r=!0} | ||
var t=q(e[n.settings.valueField]) | ||
if("string"!=typeof t)return i() | ||
n.setTextboxValue(),n.addOption(e,!0),n.setCaret(o),n.addItem(t),i(e),r=!0} | ||
return s="function"==typeof n.settings.create?n.settings.create.call(this,e,l):{[n.settings.labelField]:e,[n.settings.valueField]:e},r||l(s),!0}refreshItems(){var e=this | ||
e.lastQuery=null,e.isSetup&&e.addItems(e.items),e.updateOriginalInput(),e.refreshState()}refreshState(){var e=this | ||
e.lastQuery=null,e.isSetup&&e.addItems(e.items),e.updateOriginalInput(),e.refreshState()}refreshState(){const e=this | ||
e.refreshValidityState() | ||
var t=e.isFull(),i=e.isLocked | ||
const t=e.isFull(),i=e.isLocked | ||
e.wrapper.classList.toggle("rtl",e.rtl) | ||
var s,n=e.control.classList | ||
n.toggle("focus",e.isFocused),n.toggle("disabled",e.isDisabled),n.toggle("required",e.isRequired),n.toggle("invalid",e.isInvalid),n.toggle("locked",i),n.toggle("full",t),n.toggle("not-full",!t),n.toggle("input-active",e.isFocused&&!e.isInputHidden),n.toggle("dropdown-active",e.isOpen),n.toggle("has-options",(s=e.options,0===Object.keys(s).length)),n.toggle("has-items",e.items.length>0)}refreshValidityState(){var e=this | ||
if(e.input.checkValidity){this.isRequired&&(e.input.required=!0) | ||
var t=!e.input.checkValidity() | ||
e.isInvalid=t,e.control_input.required=t,this.isRequired&&(e.input.required=!t)}}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(e={}){const t=this | ||
var i,s,n,o | ||
const s=e.wrapper.classList | ||
var n | ||
s.toggle("focus",e.isFocused),s.toggle("disabled",e.isDisabled),s.toggle("required",e.isRequired),s.toggle("invalid",!e.isValid),s.toggle("locked",i),s.toggle("full",t),s.toggle("input-active",e.isFocused&&!e.isInputHidden),s.toggle("dropdown-active",e.isOpen),s.toggle("has-options",(n=e.options,0===Object.keys(n).length)),s.toggle("has-items",e.items.length>0)}refreshValidityState(){var e=this | ||
e.input.checkValidity&&(e.isValid=e.input.checkValidity(),e.isInvalid=!e.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(e={}){const t=this | ||
var i,s | ||
const n=t.input.querySelector('option[value=""]') | ||
if(t.is_select_tag){const e=[] | ||
function r(i,s,n){return i||(i=w('<option value="'+D(s)+'">'+D(n)+"</option>")),t.input.prepend(i),e.push(i),L(i,{selected:"true"}),i.selected=!0,i}if(t.input.querySelectorAll("option[selected]").forEach((e=>{L(e,{selected:null}),e.selected=!1})),0!=t.items.length||"single"!=t.settings.mode||t.isRequired)for(i=t.items.length-1;i>=0;i--)if(s=t.items[i],o=(n=t.options[s])[t.settings.labelField]||"",e.includes(n.$option)){r(t.input.querySelector(`option[value="${B(s)}"]:not([selected])`),s,o)}else n.$option=r(n.$option,s,o) | ||
else r(t.input.querySelector('option[value=""]'),"","")}else t.input.value=t.getValue() | ||
function o(i,s,o){return i||(i=b('<option value="'+N(s)+'">'+N(o)+"</option>")),i!=n&&t.input.append(i),e.push(i),i.selected=!0,i}t.input.querySelectorAll("option:checked").forEach((e=>{e.selected=!1})),0==t.items.length&&"single"==t.settings.mode?o(n,"",""):t.items.forEach((n=>{if(i=t.options[n],s=i[t.settings.labelField]||"",e.includes(i.$option)){o(t.input.querySelector(`option[value="${Q(n)}"]:not(:checked)`),n,s)}else i.$option=o(i.$option,n,s)}))}else t.input.value=t.getValue() | ||
t.isSetup&&(e.silent||t.trigger("change",t.getValue()))}open(){var e=this | ||
e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.isOpen=!0,L(e.control_input,{"aria-expanded":"true"}),e.refreshState(),C(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),C(e.dropdown,{visibility:"visible",display:"block"}),e.focus(),e.trigger("dropdown_open",e.dropdown))}close(e=!0){var t=this,i=t.isOpen | ||
e&&(t.setTextboxValue(),"single"===t.settings.mode&&t.items.length&&(t.hideInput(),t.tab_key||t.blur())),t.isOpen=!1,L(t.control_input,{"aria-expanded":"false"}),C(t.dropdown,{display:"none"}),t.settings.hideSelected&&t.clearActiveOption(),t.refreshState(),i&&t.trigger("dropdown_close",t.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),i=e.offsetHeight+t.top+window.scrollY,s=t.left+window.scrollX | ||
C(this.dropdown,{width:t.width+"px",top:i+"px",left:s+"px"})}}clear(e){var t=this | ||
e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.isOpen=!0,E(e.focus_node,{"aria-expanded":"true"}),e.refreshState(),S(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),S(e.dropdown,{visibility:"visible",display:"block"}),e.focus(),e.trigger("dropdown_open",e.dropdown))}close(e=!0){var t=this,i=t.isOpen | ||
e&&(t.setTextboxValue(),"single"===t.settings.mode&&t.items.length&&t.hideInput()),t.isOpen=!1,E(t.focus_node,{"aria-expanded":"false"}),S(t.dropdown,{display:"none"}),t.settings.hideSelected&&t.clearActiveOption(),t.refreshState(),i&&t.trigger("dropdown_close",t.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),i=e.offsetHeight+t.top+window.scrollY,s=t.left+window.scrollX | ||
S(this.dropdown,{width:t.width+"px",top:i+"px",left:s+"px"})}}clear(e){var t=this | ||
if(t.items.length){var i=t.controlChildren() | ||
for(const e of i)t.removeItem(e,!0) | ||
t.showInput(),e||t.updateOriginalInput(),t.trigger("clear")}}insertAtCaret(e){var t=this,i=Math.min(t.caretPos,t.items.length),s=t.control | ||
0===i?s.insertBefore(e,s.firstChild):s.insertBefore(e,s.children[i]),t.setCaret(i+1)}deleteSelection(e){var t,i,s,n,o,r=this | ||
y(i,(e=>{t.removeItem(e,!0)})),t.showInput(),e||t.updateOriginalInput(),t.trigger("clear")}}insertAtCaret(e){const t=this,i=t.caretPos,s=t.control | ||
s.insertBefore(e,s.children[i]),t.setCaret(i+1)}deleteSelection(e){var t,i,s,n,o,r=this | ||
t=e&&8===e.keyCode?-1:1,i={start:(o=r.control_input).selectionStart||0,length:(o.selectionEnd||0)-(o.selectionStart||0)} | ||
const l=[] | ||
if(r.activeItems.length){n=k(r.activeItems,t),s=P(n),t>0&&s++ | ||
for(const e of r.activeItems)l.push(e)}else if((r.isFocused||"single"===r.settings.mode)&&r.items.length){const e=r.controlChildren() | ||
if(r.activeItems.length)n=L(r.activeItems,t),s=P(n),t>0&&s++,y(r.activeItems,(e=>l.push(e))) | ||
else if((r.isFocused||"single"===r.settings.mode)&&r.items.length){const e=r.controlChildren() | ||
t<0&&0===i.start&&0===i.length?l.push(e[r.caretPos-1]):t>0&&i.start===r.inputValue().length&&l.push(e[r.caretPos])}const a=l.map((e=>e.dataset.value)) | ||
if(!a.length||"function"==typeof r.settings.onDelete&&!1===r.settings.onDelete.call(r,a,e))return!1 | ||
for(H(e,!0),void 0!==s&&r.setCaret(s);l.length;)r.removeItem(l.pop()) | ||
return r.showInput(),r.positionDropdown(),r.refreshOptions(!1),!0}advanceSelection(e,t){var i,s,n,o=this | ||
o.rtl&&(e*=-1),o.inputValue().length||(K(q,t)||K("shiftKey",t)?(n=(s=o.getLastActive(e))?s.classList.contains("active")?o.getAdjacent(s,e,"item"):s:e>0?o.control_input.nextElementSibling:o.control_input.previousElementSibling)&&(n.classList.contains("active")&&o.removeActiveItem(s),o.setActiveItemClass(n)):o.isFocused&&!o.activeItems.length?o.setCaret(o.caretPos+e):(s=o.getLastActive(e))&&(i=P(s),o.setCaret(e>0?i+1:i),o.setActiveItem()))}getLastActive(e){let t=this.control.querySelector(".last-active") | ||
for(z(e,!0),void 0!==s&&r.setCaret(s);l.length;)r.removeItem(l.pop()) | ||
return r.showInput(),r.positionDropdown(),r.refreshOptions(!1),!0}advanceSelection(e,t){var i,s,n=this | ||
n.rtl&&(e*=-1),n.inputValue().length||(M($,t)||M("shiftKey",t)?(s=(i=n.getLastActive(e))?i.classList.contains("active")?n.getAdjacent(i,e,"item"):i:e>0?n.control_input.nextElementSibling:n.control_input.previousElementSibling)&&(s.classList.contains("active")&&n.removeActiveItem(i),n.setActiveItemClass(s)):n.moveCaret(e))}moveCaret(e){}getLastActive(e){let t=this.control.querySelector(".last-active") | ||
if(t)return t | ||
var i=this.control.querySelectorAll(".active") | ||
return i?k(i,e):void 0}setCaret(e){var t=this | ||
"single"===t.settings.mode||t.settings.controlInput?e=t.items.length:(e=Math.max(0,Math.min(t.items.length,e)))==t.caretPos||t.isPending||t.controlChildren().forEach(((i,s)=>{s<e?t.control_input.insertAdjacentElement("beforebegin",i):t.control.appendChild(i)})),t.caretPos=e}controlChildren(){return Array.from(this.control.getElementsByClassName(this.settings.itemClass))}lock(){this.close(),this.isLocked=!0,this.refreshState()}unlock(){this.isLocked=!1,this.refreshState()}disable(){var e=this | ||
e.input.disabled=!0,e.control_input.disabled=!0,e.control_input.tabIndex=-1,e.isDisabled=!0,e.lock()}enable(){var e=this | ||
e.input.disabled=!1,e.control_input.disabled=!1,e.control_input.tabIndex=e.tabIndex,e.isDisabled=!1,e.unlock()}destroy(){var e=this,t=e.revertSettings | ||
e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML=t.innerHTML,e.input.tabIndex=t.tabIndex,_(e.input,"tomselected"),L(e.input,{hidden:null}),e.input.required=this.isRequired,e._destroy(),delete e.input.tomselect}render(e,t){return"function"!=typeof this.settings.render[e]?null:this._render(e,t)}_render(e,t){var i,s,n="" | ||
return i?L(i,e):void 0}setCaret(e){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.isLocked=!0,this.refreshState()}unlock(){this.isLocked=!1,this.refreshState()}disable(){var e=this | ||
e.input.disabled=!0,e.control_input.disabled=!0,e.focus_node.tabIndex=-1,e.isDisabled=!0,this.close(),e.lock()}enable(){var e=this | ||
e.input.disabled=!1,e.control_input.disabled=!1,e.focus_node.tabIndex=e.tabIndex,e.isDisabled=!1,e.unlock()}destroy(){var e=this,t=e.revertSettings | ||
e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML=t.innerHTML,e.input.tabIndex=t.tabIndex,C(e.input,"tomselected","ts-hidden-accessible"),e._destroy(),delete e.input.tomselect}render(e,t){return"function"!=typeof this.settings.render[e]?null:this._render(e,t)}_render(e,t){var i,s,n="" | ||
const o=this | ||
return("option"===e||"item"===e)&&(n=$(t[o.settings.valueField]),s=o.rendered(e,n))||null==(s=o.settings.render[e].call(this,t,D))||(s=w(s),"option"===e||"option_create"===e?t[o.settings.disabledField]?L(s,{"aria-disabled":"true"}):L(s,{"data-selectable":""}):"optgroup"===e&&(i=t.group[o.settings.optgroupValueField],L(s,{"data-group":i}),t.group[o.settings.disabledField]&&L(s,{"data-disabled":""})),"option"!==e&&"item"!==e||(L(s,{"data-value":n}),"item"===e?A(s,o.settings.itemClass):(A(s,o.settings.optionClass),L(s,{role:"option",id:t.$id})),o.renderCache[e][n]=s)),s}rendered(e,t){return null!==t&&this.renderCache[e].hasOwnProperty(t)?this.renderCache[e][t]:null}clearCache(e){var t=this | ||
for(let e in t.options){const i=t.getOption(e) | ||
i&&i.remove()}void 0===e?t.renderCache={item:{},option:{}}:t.renderCache[e]={}}canCreate(e){return this.settings.create&&e.length>0&&this.settings.createFilter.call(this,e)}hook(e,t,i){var s=this,n=s[t] | ||
return"option"!==e&&"item"!=e||(n=D(t[o.settings.valueField])),null==(s=o.settings.render[e].call(this,t,N))||(s=b(s),"option"===e||"option_create"===e?t[o.settings.disabledField]?E(s,{"aria-disabled":"true"}):E(s,{"data-selectable":""}):"optgroup"===e&&(i=t.group[o.settings.optgroupValueField],E(s,{"data-group":i}),t.group[o.settings.disabledField]&&E(s,{"data-disabled":""})),"option"!==e&&"item"!==e||(E(s,{"data-value":n}),"item"===e?(A(s,o.settings.itemClass),E(s,{"data-ts-item":""})):(A(s,o.settings.optionClass),E(s,{role:"option",id:t.$id}),o.options[n].$div=s))),s}clearCache(){y(this.options,((e,t)=>{e.$div&&(e.$div.remove(),delete e.$div)}))}uncacheValue(e){const t=this.getOption(e) | ||
t&&t.remove()}canCreate(e){return this.settings.create&&e.length>0&&this.settings.createFilter.call(this,e)}hook(e,t,i){var s=this,n=s[t] | ||
s[t]=function(){var t,o | ||
return"after"===e&&(t=n.apply(s,arguments)),o=i.apply(s,arguments),"instead"===e?o:("before"===e&&(t=n.apply(s,arguments)),t)}}}return U})) | ||
return"after"===e&&(t=n.apply(s,arguments)),o=i.apply(s,arguments),"instead"===e?o:("before"===e&&(t=n.apply(s,arguments)),t)}}}return W})) | ||
var tomSelect=function(e,t){return new TomSelect(e,t)} | ||
//# sourceMappingURL=tom-select.base.min.js.map |
{ | ||
"name": "@tabler/core", | ||
"version": "1.0.0-beta5", | ||
"version": "1.0.0-beta6", | ||
"description": "Premium and Open Source dashboard template with responsive and high quality UI.", | ||
@@ -58,19 +58,16 @@ "scripts": { | ||
"devDependencies": { | ||
"@babel/core": "^7.15.8", | ||
"@babel/preset-env": "^7.15.8", | ||
"@babel/core": "^7.16.7", | ||
"@babel/preset-env": "^7.16.8", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"@rollup/plugin-replace": "^3.0.0", | ||
"@rollup/pluginutils": "^4.1.1", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@rollup/plugin-replace": "^3.0.1", | ||
"@rollup/pluginutils": "^4.1.2", | ||
"@rollup/stream": "^2.0.0", | ||
"@storybook/addon-essentials": "^6.3.12", | ||
"@storybook/addon-links": "^6.3.12", | ||
"@storybook/html": "^6.3.12", | ||
"apexcharts": "^3.29.0", | ||
"autoprefixer": "^10.3.7", | ||
"apexcharts": "^3.33.0", | ||
"autoprefixer": "^10.4.2", | ||
"autosize": "^5.0.1", | ||
"browser-sync": "^2.27.5", | ||
"bundlewatch": "^0.3.2", | ||
"choices.js": "^9.0.1", | ||
"chromatic": "^6.0.5", | ||
"browser-sync": "^2.27.7", | ||
"bundlewatch": "^0.3.3", | ||
"choices.js": "^10.0.0", | ||
"chromatic": "^6.4.0", | ||
"countup.js": "^2.0.8", | ||
@@ -83,41 +80,42 @@ "critical": "^4.0.1", | ||
"gulp-clean-css": "^4.3.0", | ||
"gulp-debug": "^4.0.0", | ||
"gulp-debug": "^3.2.0", | ||
"gulp-header": "^2.0.9", | ||
"gulp-minify": "^3.1.0", | ||
"gulp-postcss": "^9.0.1", | ||
"gulp-purgecss": "^4.0.3", | ||
"gulp-purgecss": "^4.1.3", | ||
"gulp-rename": "^2.0.0", | ||
"gulp-rtlcss": "^1.4.2", | ||
"gulp-sass": "^5.0.0", | ||
"gulp-sass": "^5.1.0", | ||
"imask": "^6.2.2", | ||
"litepicker": "^2.0.11", | ||
"node-sass": "^6.0.1", | ||
"jsvectormap": "^1.4.2", | ||
"litepicker": "^2.0.12", | ||
"nouislider": "^15.5.0", | ||
"postcss": "^8.3.11", | ||
"release-it": "^14.11.6", | ||
"rollup": "^2.58.0", | ||
"postcss": "^8.4.5", | ||
"release-it": "^14.12.3", | ||
"rollup": "^2.64.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
"storybook-addon-outline": "^1.4.1", | ||
"tom-select": "^1.7.8", | ||
"sass": "^1.48.0", | ||
"tom-select": "^2.0.0", | ||
"vinyl-buffer": "^1.0.1", | ||
"vinyl-source-stream": "^2.0.0", | ||
"yaml": "^1.10.2", | ||
"yargs": "^17.2.1" | ||
"yargs": "^17.3.1" | ||
}, | ||
"dependencies": { | ||
"@popperjs/core": "^2.10.2", | ||
"@tabler/icons": "^1.44.0", | ||
"@popperjs/core": "^2.11.2", | ||
"@tabler/icons": "^1.53.0", | ||
"bootstrap": "5.1.3" | ||
}, | ||
"peerDependencies": { | ||
"apexcharts": "^3.29.0", | ||
"apexcharts": "^3.33.0", | ||
"autosize": "^5.0.1", | ||
"choices.js": "^9.0.1", | ||
"choices.js": "^10.0.0", | ||
"countup.js": "^2.0.8", | ||
"flatpickr": "^4.6.9", | ||
"imask": "^6.2.2", | ||
"litepicker": "^2.0.11", | ||
"jsvectormap": "^1.4.2", | ||
"litepicker": "^2.0.12", | ||
"nouislider": "^15.5.0", | ||
"tom-select": "^1.7.8" | ||
"tom-select": "^2.0.0" | ||
}, | ||
@@ -151,2 +149,5 @@ "peerDependenciesMeta": { | ||
"optional": true | ||
}, | ||
"jsvectormap": { | ||
"optional": true | ||
} | ||
@@ -153,0 +154,0 @@ }, |
@@ -15,1 +15,3 @@ import { Tab } from 'bootstrap'; | ||
} | ||
EnableActivationTabsFromLocationHash() |
@@ -9,3 +9,3 @@ //Vendor | ||
import './src/switch-icon'; | ||
import { EnableActivationTabsFromLocationHash } from './src/tab'; | ||
import './src/tab'; | ||
import './src/toast'; | ||
@@ -15,3 +15,1 @@ import * as bootstrap from 'bootstrap'; | ||
window.bootstrap = bootstrap; | ||
EnableActivationTabsFromLocationHash(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44
505
57943
5816031
13
+ Added@orchidjs/sifter@1.1.0(transitive)
+ Added@orchidjs/unicode-variants@1.1.2(transitive)
+ Addedchoices.js@10.2.0(transitive)
+ Addedfuse.js@6.6.2(transitive)
+ Addedjsvectormap@1.6.0(transitive)
+ Addedtom-select@2.4.1(transitive)
- Removed@orchidjs/sifter@0.8.2(transitive)
- Removedchoices.js@9.1.0(transitive)
- Removedfuse.js@3.6.1(transitive)
- Removedtom-select@1.7.8(transitive)
Updated@popperjs/core@^2.11.2
Updated@tabler/icons@^1.53.0