@oiz/stzh-components 2.12.0-beta2 → 2.13.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-b9d20033.js → app-globals-6831ae97.js} +2 -2
- package/dist/cjs/{app-globals-b9d20033.js.map → app-globals-6831ae97.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-actionset_4.cjs.entry.js +4 -2
- package/dist/cjs/stzh-actionset_4.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-badge_3.cjs.entry.js +2 -1
- package/dist/cjs/stzh-badge_3.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-chip_2.cjs.entry.js +2 -1
- package/dist/cjs/stzh-chip_2.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-datalist_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-datalist_2.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-dropdown.cjs.entry.js +37 -4
- package/dist/cjs/stzh-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-input.cjs.entry.js +2 -2
- package/dist/cjs/stzh-input.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-link.cjs.entry.js +2 -1
- package/dist/cjs/stzh-link.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-menu_2.cjs.entry.js +2 -1
- package/dist/cjs/stzh-menu_2.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-progressbar-item.cjs.entry.js +2 -1
- package/dist/cjs/stzh-progressbar-item.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-skiplink.cjs.entry.js +2 -1
- package/dist/cjs/stzh-skiplink.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-upload.cjs.entry.js +16 -2
- package/dist/cjs/stzh-upload.cjs.entry.js.map +1 -1
- package/dist/collection/components/stzh-actionset/stzh-actionset.js.map +1 -1
- package/dist/collection/components/stzh-button/stzh-button.js +2 -1
- package/dist/collection/components/stzh-button/stzh-button.js.map +1 -1
- package/dist/collection/components/stzh-card/stzh-card.css +3 -3
- package/dist/collection/components/stzh-card/stzh-card.js +3 -1
- package/dist/collection/components/stzh-card/stzh-card.js.map +1 -1
- package/dist/collection/components/stzh-chip/stzh-chip.js +2 -1
- package/dist/collection/components/stzh-chip/stzh-chip.js.map +1 -1
- package/dist/collection/components/stzh-datalist-item/stzh-datalist-item.css +1 -0
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +53 -1
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js.map +1 -1
- package/dist/collection/components/stzh-input/stzh-input.css +6 -0
- package/dist/collection/components/stzh-input/stzh-input.js +4 -4
- package/dist/collection/components/stzh-input/stzh-input.js.map +1 -1
- package/dist/collection/components/stzh-link/stzh-link.js +2 -1
- package/dist/collection/components/stzh-link/stzh-link.js.map +1 -1
- package/dist/collection/components/stzh-menu-item/stzh-menu-item.js +2 -1
- package/dist/collection/components/stzh-menu-item/stzh-menu-item.js.map +1 -1
- package/dist/collection/components/stzh-progressbar-item/stzh-progressbar-item.js +2 -1
- package/dist/collection/components/stzh-progressbar-item/stzh-progressbar-item.js.map +1 -1
- package/dist/collection/components/stzh-skiplink/stzh-skiplink.js +2 -1
- package/dist/collection/components/stzh-skiplink/stzh-skiplink.js.map +1 -1
- package/dist/collection/components/stzh-upload/stzh-upload.css +1 -1
- package/dist/collection/components/stzh-upload/stzh-upload.js +15 -3
- package/dist/collection/components/stzh-upload/stzh-upload.js.map +1 -1
- package/dist/collection/libraries/dropzone/dropzone-amd-module.js +7 -1
- package/dist/collection/libraries/dropzone/dropzone.js +7 -1
- package/dist/collection/libraries/dropzone/min/dropzone-amd-module.min.js +1 -1
- package/dist/collection/libraries/dropzone/min/dropzone.min.js +1 -1
- package/dist/collection/libraries/tom-select/cjs/tom-select.complete.js +8 -4
- package/dist/collection/libraries/tom-select/cjs/tom-select.js +8 -4
- package/dist/collection/libraries/tom-select/cjs/tom-select.popular.js +8 -4
- package/dist/collection/libraries/tom-select/esm/tom-select.complete.js +8 -4
- package/dist/collection/libraries/tom-select/esm/tom-select.js +8 -4
- package/dist/collection/libraries/tom-select/esm/tom-select.popular.js +8 -4
- package/dist/collection/libraries/tom-select/js/tom-select.base.js +8 -4
- package/dist/collection/libraries/tom-select/js/tom-select.base.min.js +34 -34
- package/dist/collection/libraries/tom-select/js/tom-select.complete.js +8 -4
- package/dist/collection/libraries/tom-select/js/tom-select.complete.min.js +19 -19
- package/dist/collection/libraries/tom-select/js/tom-select.popular.js +8 -4
- package/dist/collection/libraries/tom-select/js/tom-select.popular.min.js +31 -31
- package/dist/components/index.js +1 -1
- package/dist/components/stzh-actionset2.js.map +1 -1
- package/dist/components/stzh-button2.js +2 -1
- package/dist/components/stzh-button2.js.map +1 -1
- package/dist/components/stzh-card2.js +4 -2
- package/dist/components/stzh-card2.js.map +1 -1
- package/dist/components/stzh-chip2.js +2 -1
- package/dist/components/stzh-chip2.js.map +1 -1
- package/dist/components/stzh-datalist-item2.js +1 -1
- package/dist/components/stzh-datalist-item2.js.map +1 -1
- package/dist/components/stzh-dropdown2.js +39 -5
- package/dist/components/stzh-dropdown2.js.map +1 -1
- package/dist/components/stzh-input2.js +3 -3
- package/dist/components/stzh-input2.js.map +1 -1
- package/dist/components/stzh-link2.js +2 -1
- package/dist/components/stzh-link2.js.map +1 -1
- package/dist/components/stzh-menu-item2.js +2 -1
- package/dist/components/stzh-menu-item2.js.map +1 -1
- package/dist/components/stzh-progressbar-item2.js +2 -1
- package/dist/components/stzh-progressbar-item2.js.map +1 -1
- package/dist/components/stzh-skiplink.js +2 -1
- package/dist/components/stzh-skiplink.js.map +1 -1
- package/dist/components/stzh-upload.js +18 -2
- package/dist/components/stzh-upload.js.map +1 -1
- package/dist/esm/{app-globals-0cf2577d.js → app-globals-c1cfb228.js} +2 -2
- package/dist/esm/{app-globals-0cf2577d.js.map → app-globals-c1cfb228.js.map} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-actionset_4.entry.js +4 -2
- package/dist/esm/stzh-actionset_4.entry.js.map +1 -1
- package/dist/esm/stzh-badge_3.entry.js +2 -1
- package/dist/esm/stzh-badge_3.entry.js.map +1 -1
- package/dist/esm/stzh-chip_2.entry.js +2 -1
- package/dist/esm/stzh-chip_2.entry.js.map +1 -1
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-datalist_2.entry.js +1 -1
- package/dist/esm/stzh-datalist_2.entry.js.map +1 -1
- package/dist/esm/stzh-dropdown.entry.js +37 -4
- package/dist/esm/stzh-dropdown.entry.js.map +1 -1
- package/dist/esm/stzh-input.entry.js +2 -2
- package/dist/esm/stzh-input.entry.js.map +1 -1
- package/dist/esm/stzh-link.entry.js +2 -1
- package/dist/esm/stzh-link.entry.js.map +1 -1
- package/dist/esm/stzh-menu_2.entry.js +2 -1
- package/dist/esm/stzh-menu_2.entry.js.map +1 -1
- package/dist/esm/stzh-progressbar-item.entry.js +2 -1
- package/dist/esm/stzh-progressbar-item.entry.js.map +1 -1
- package/dist/esm/stzh-skiplink.entry.js +2 -1
- package/dist/esm/stzh-skiplink.entry.js.map +1 -1
- package/dist/esm/stzh-upload.entry.js +16 -2
- package/dist/esm/stzh-upload.entry.js.map +1 -1
- package/dist/esm-es5/{app-globals-0cf2577d.js → app-globals-c1cfb228.js} +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/stzh-actionset_4.entry.js +1 -1
- package/dist/esm-es5/stzh-actionset_4.entry.js.map +1 -1
- package/dist/esm-es5/stzh-badge_3.entry.js +1 -1
- package/dist/esm-es5/stzh-badge_3.entry.js.map +1 -1
- package/dist/esm-es5/stzh-chip_2.entry.js +1 -1
- package/dist/esm-es5/stzh-chip_2.entry.js.map +1 -1
- package/dist/esm-es5/stzh-components.js +1 -1
- package/dist/esm-es5/stzh-components.js.map +1 -1
- package/dist/esm-es5/stzh-datalist_2.entry.js +1 -1
- package/dist/esm-es5/stzh-datalist_2.entry.js.map +1 -1
- package/dist/esm-es5/stzh-dropdown.entry.js +3 -3
- package/dist/esm-es5/stzh-dropdown.entry.js.map +1 -1
- package/dist/esm-es5/stzh-input.entry.js +1 -1
- package/dist/esm-es5/stzh-input.entry.js.map +1 -1
- package/dist/esm-es5/stzh-link.entry.js +1 -1
- package/dist/esm-es5/stzh-link.entry.js.map +1 -1
- package/dist/esm-es5/stzh-menu_2.entry.js +1 -1
- package/dist/esm-es5/stzh-menu_2.entry.js.map +1 -1
- package/dist/esm-es5/stzh-progressbar-item.entry.js +1 -1
- package/dist/esm-es5/stzh-progressbar-item.entry.js.map +1 -1
- package/dist/esm-es5/stzh-skiplink.entry.js +1 -1
- package/dist/esm-es5/stzh-skiplink.entry.js.map +1 -1
- package/dist/esm-es5/stzh-upload.entry.js +1 -1
- package/dist/esm-es5/stzh-upload.entry.js.map +1 -1
- package/dist/stzh-components/{p-7873a639.entry.js → p-01e9b3b5.entry.js} +2 -2
- package/dist/stzh-components/p-01e9b3b5.entry.js.map +1 -0
- package/dist/stzh-components/{p-0db27707.entry.js → p-03fc4d3d.entry.js} +2 -2
- package/dist/stzh-components/p-03fc4d3d.entry.js.map +1 -0
- package/dist/stzh-components/{p-3ab3a5a7.system.entry.js → p-1a420f1c.system.entry.js} +2 -2
- package/dist/stzh-components/p-1a420f1c.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-aa9975e6.entry.js → p-24d82258.entry.js} +2 -2
- package/dist/stzh-components/p-24d82258.entry.js.map +1 -0
- package/dist/stzh-components/p-2653562a.entry.js +9 -0
- package/dist/stzh-components/p-2653562a.entry.js.map +1 -0
- package/dist/stzh-components/{p-42e25ae1.system.entry.js → p-3048d3ea.system.entry.js} +2 -2
- package/dist/stzh-components/p-3048d3ea.system.entry.js.map +1 -0
- package/dist/stzh-components/p-376b64c8.system.entry.js +9 -0
- package/dist/stzh-components/p-376b64c8.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-6233fc4f.system.js → p-50faf5a6.system.js} +2 -2
- package/dist/stzh-components/{p-9d0fedfe.system.entry.js → p-710d15c1.system.entry.js} +2 -2
- package/dist/stzh-components/p-710d15c1.system.entry.js.map +1 -0
- package/dist/stzh-components/p-8438088e.system.js +2 -0
- package/dist/stzh-components/{p-ae0e530e.system.js.map → p-8438088e.system.js.map} +1 -1
- package/dist/stzh-components/{p-b2b9d87e.js → p-8e02ecc8.js} +2 -2
- package/dist/stzh-components/{p-68feffea.entry.js → p-919e700b.entry.js} +2 -2
- package/dist/stzh-components/p-919e700b.entry.js.map +1 -0
- package/dist/stzh-components/p-990141f4.entry.js +2 -0
- package/dist/stzh-components/p-990141f4.entry.js.map +1 -0
- package/dist/stzh-components/{p-d5ee8b1a.entry.js → p-a0d3ec11.entry.js} +2 -2
- package/dist/stzh-components/p-a0d3ec11.entry.js.map +1 -0
- package/dist/stzh-components/{p-188dd49d.system.entry.js → p-aa0660d8.system.entry.js} +2 -2
- package/dist/stzh-components/p-aa0660d8.system.entry.js.map +1 -0
- package/dist/stzh-components/p-c1f89d5c.system.entry.js +2 -0
- package/dist/stzh-components/p-c1f89d5c.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-f73af272.entry.js → p-c70b4f1b.entry.js} +2 -2
- package/dist/stzh-components/p-c70b4f1b.entry.js.map +1 -0
- package/dist/stzh-components/{p-af33b013.entry.js → p-c90cf7f4.entry.js} +2 -2
- package/dist/stzh-components/p-c90cf7f4.entry.js.map +1 -0
- package/dist/stzh-components/{p-54a1fdcc.system.entry.js → p-cf18eff2.system.entry.js} +2 -2
- package/dist/stzh-components/p-cf18eff2.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-135d2e40.system.entry.js → p-d80b87dd.system.entry.js} +2 -2
- package/dist/stzh-components/p-d80b87dd.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-b3d76f2a.system.entry.js → p-df045b3b.system.entry.js} +2 -2
- package/dist/stzh-components/p-df045b3b.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-7c2aa5e8.entry.js → p-dfa8f780.entry.js} +2 -2
- package/dist/stzh-components/p-dfa8f780.entry.js.map +1 -0
- package/dist/stzh-components/{p-2d88c544.system.entry.js → p-e6444356.system.entry.js} +2 -2
- package/dist/stzh-components/p-e6444356.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-509f90d0.system.entry.js → p-ee4f0a17.system.entry.js} +2 -2
- package/dist/stzh-components/p-ee4f0a17.system.entry.js.map +1 -0
- package/dist/stzh-components/{p-0164f9d1.entry.js → p-f63cc727.entry.js} +2 -2
- package/dist/stzh-components/p-f63cc727.entry.js.map +1 -0
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/dist/stzh-components/stzh-components.esm.js.map +1 -1
- package/dist/stzh-components/stzh-components.js +1 -1
- package/dist/types/components/stzh-dropdown/stzh-dropdown.d.ts +4 -0
- package/dist/types/components/stzh-input/stzh-input.d.ts +1 -1
- package/dist/types/components/stzh-upload/stzh-upload.d.ts +7 -1
- package/dist/types/components.d.ts +18 -6
- package/dist/types/libraries/tom-select/types/defaults.d.ts +2 -0
- package/dist/types/libraries/tom-select/types/types/settings.d.ts +2 -0
- package/dist/vscode-data.json +7537 -0
- package/package.json +1 -1
- package/dist/stzh-components/p-0164f9d1.entry.js.map +0 -1
- package/dist/stzh-components/p-0db27707.entry.js.map +0 -1
- package/dist/stzh-components/p-135d2e40.system.entry.js.map +0 -1
- package/dist/stzh-components/p-188dd49d.system.entry.js.map +0 -1
- package/dist/stzh-components/p-2d88c544.system.entry.js.map +0 -1
- package/dist/stzh-components/p-3ab3a5a7.system.entry.js.map +0 -1
- package/dist/stzh-components/p-42e25ae1.system.entry.js.map +0 -1
- package/dist/stzh-components/p-4ad49ece.entry.js +0 -2
- package/dist/stzh-components/p-4ad49ece.entry.js.map +0 -1
- package/dist/stzh-components/p-509f90d0.system.entry.js.map +0 -1
- package/dist/stzh-components/p-54a1fdcc.system.entry.js.map +0 -1
- package/dist/stzh-components/p-68feffea.entry.js.map +0 -1
- package/dist/stzh-components/p-7873a639.entry.js.map +0 -1
- package/dist/stzh-components/p-7c2aa5e8.entry.js.map +0 -1
- package/dist/stzh-components/p-97704eb0.system.entry.js +0 -9
- package/dist/stzh-components/p-97704eb0.system.entry.js.map +0 -1
- package/dist/stzh-components/p-9d0fedfe.system.entry.js.map +0 -1
- package/dist/stzh-components/p-a0b350c2.system.entry.js +0 -2
- package/dist/stzh-components/p-a0b350c2.system.entry.js.map +0 -1
- package/dist/stzh-components/p-aa9975e6.entry.js.map +0 -1
- package/dist/stzh-components/p-ae0e530e.system.js +0 -2
- package/dist/stzh-components/p-af33b013.entry.js.map +0 -1
- package/dist/stzh-components/p-b3d76f2a.system.entry.js.map +0 -1
- package/dist/stzh-components/p-d5ee8b1a.entry.js.map +0 -1
- package/dist/stzh-components/p-f73af272.entry.js.map +0 -1
- package/dist/stzh-components/p-f91187c8.entry.js +0 -9
- package/dist/stzh-components/p-f91187c8.entry.js.map +0 -1
- /package/dist/esm-es5/{app-globals-0cf2577d.js.map → app-globals-c1cfb228.js.map} +0 -0
- /package/dist/stzh-components/{p-6233fc4f.system.js.map → p-50faf5a6.system.js.map} +0 -0
- /package/dist/stzh-components/{p-b2b9d87e.js.map → p-8e02ecc8.js.map} +0 -0
|
@@ -104,10 +104,10 @@ const o=t.score||n._getScoreFunction(s)
|
|
|
104
104
|
e.length?E(n.items,((e,n)=>{i=o(e),(!1===t.filter||i>0)&&s.items.push({score:i,id:n})})):E(n.items,((e,t)=>{s.items.push({score:1,id:t})}))
|
|
105
105
|
const r=n._getSortFunction(s)
|
|
106
106
|
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 j=(e,t)=>{if(Array.isArray(e))e.forEach(t)
|
|
107
|
-
else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},
|
|
107
|
+
else for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},q=e=>{if(e.jquery)return e[0]
|
|
108
108
|
if(e instanceof HTMLElement)return e
|
|
109
|
-
if(
|
|
110
|
-
return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},
|
|
109
|
+
if(V(e)){var t=document.createElement("template")
|
|
110
|
+
return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},V=e=>"string"==typeof e&&e.indexOf("<")>-1,D=(e,t)=>{var i=document.createEvent("HTMLEvents")
|
|
111
111
|
i.initEvent(t,!0,!1),e.dispatchEvent(i)},N=(e,t)=>{Object.assign(e.style,t)},H=(e,...t)=>{var i=M(t);(e=R(e)).map((e=>{i.map((t=>{e.classList.add(t)}))}))},z=(e,...t)=>{var i=M(t);(e=R(e)).map((e=>{i.map((t=>{e.classList.remove(t)}))}))},M=e=>{var t=[]
|
|
112
112
|
return j(e,(e=>{"string"==typeof e&&(e=e.trim().split(/[\11\12\14\15\40]/)),Array.isArray(e)&&(t=t.concat(e))})),t.filter(Boolean)},R=e=>(Array.isArray(e)||(e=[e]),e),B=(e,t,i)=>{if(!i||i.contains(e))for(;e&&e.matches;){if(e.matches(t))return e
|
|
113
113
|
e=e.parentNode}},K=(e,t=0)=>t>0?e[e.length-1]:e[0],Q=(e,t)=>{if(!e)return-1
|
|
@@ -123,7 +123,7 @@ n.splitText(i[0].length)
|
|
|
123
123
|
var o=n.cloneNode(!0)
|
|
124
124
|
return s.appendChild(o),U(n,s),1}return 0})(e):((e=>{1!==e.nodeType||!e.childNodes||/(script|style)/i.test(e.tagName)||"highlight"===e.className&&"SPAN"===e.tagName||Array.from(e.childNodes).forEach((e=>{i(e)}))})(e),0)
|
|
125
125
|
i(e)},W="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey"
|
|
126
|
-
var X={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:{}}
|
|
126
|
+
var X={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,openDisplay:"block",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,transformLoadQuery:function(e){return e.trim()},shouldLoad:function(e){return e.length>0},render:{}}
|
|
127
127
|
const Y=e=>null==e?null:Z(e),Z=e=>"boolean"==typeof e?e?"1":"0":e+"",ee=e=>(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),te=(e,t)=>{var i
|
|
128
128
|
return function(s,n){var o=this
|
|
129
129
|
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)}},ie=(e,t,i)=>{var s,n=e.trigger,o={}
|
|
@@ -156,17 +156,17 @@ s.requested[t]=!0,s.loaded[t]=n.fn.apply(i,[i.plugins.settings[t]||{}]),s.names.
|
|
|
156
156
|
if(!t.plugins.loaded.hasOwnProperty(e)){if(i.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")')
|
|
157
157
|
t.loadPlugin(e)}return i.loaded[e]}}}(t)){constructor(e,t){var i
|
|
158
158
|
super(),this.control_input=void 0,this.wrapper=void 0,this.dropdown=void 0,this.control=void 0,this.dropdown_content=void 0,this.focus_node=void 0,this.order=0,this.settings=void 0,this.input=void 0,this.tabIndex=void 0,this.is_select_tag=void 0,this.rtl=void 0,this.inputId=void 0,this._destroy=void 0,this.sifter=void 0,this.isOpen=!1,this.isDisabled=!1,this.isRequired=void 0,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=void 0,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],de++
|
|
159
|
-
var s=
|
|
159
|
+
var s=q(e)
|
|
160
160
|
if(s.tomselect)throw new Error("Tom Select already initialized on this element")
|
|
161
161
|
s.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(s,null)).getPropertyValue("direction")
|
|
162
162
|
const n=ce(s,t)
|
|
163
163
|
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=re(s,"tomselect-"+de),this.isRequired=s.required,this.sifter=new T(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)
|
|
164
164
|
var o=n.createFilter
|
|
165
165
|
"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?n.createFilter=e=>o.test(e):n.createFilter=e=>this.settings.duplicates||!this.options[e]),this.initializePlugins(n.plugins),this.setupCallbacks(),this.setupTemplates()
|
|
166
|
-
const r=
|
|
166
|
+
const r=q("<div>"),l=q("<div>"),a=this._render("dropdown"),c=q('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",u=n.mode
|
|
167
167
|
var p
|
|
168
|
-
if(H(r,n.wrapperClass,d,u),H(l,n.controlClass),ae(r,l),H(a,n.dropdownClass,u),n.copyClassesToDropdown&&H(a,d),H(c,n.dropdownContentClass),ae(a,c),
|
|
169
|
-
E(["autocorrect","autocapitalize","autocomplete"],(e=>{s.getAttribute(e)&&G(p,{[e]:s.getAttribute(e)})})),p.tabIndex=-1,l.appendChild(p),this.focus_node=p}else n.controlInput?(p=
|
|
168
|
+
if(H(r,n.wrapperClass,d,u),H(l,n.controlClass),ae(r,l),H(a,n.dropdownClass,u),n.copyClassesToDropdown&&H(a,d),H(c,n.dropdownContentClass),ae(a,c),q(n.dropdownParent||r).appendChild(a),V(n.controlInput)){p=q(n.controlInput)
|
|
169
|
+
E(["autocorrect","autocapitalize","autocomplete"],(e=>{s.getAttribute(e)&&G(p,{[e]:s.getAttribute(e)})})),p.tabIndex=-1,l.appendChild(p),this.focus_node=p}else n.controlInput?(p=q(n.controlInput),this.focus_node=p):(p=q("<input/>"),this.focus_node=l)
|
|
170
170
|
this.wrapper=r,this.dropdown=a,this.dropdown_content=c,this.control=l,this.control_input=p,this.setup()}setup(){const e=this,t=e.settings,i=e.control_input,s=e.dropdown,n=e.dropdown_content,o=e.wrapper,l=e.control,a=e.input,c=e.focus_node,d={passive:!0},u=e.inputId+"-ts-dropdown"
|
|
171
171
|
G(n,{id:u}),G(c,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":u})
|
|
172
172
|
const p=re(c,e.inputId+"-ts-control"),h="label[for='"+(e=>e.replace(/['"\\]/g,"\\$&"))(e.inputId)+"']",g=document.querySelector(h),f=e.focus.bind(e),v=a.getAttribute("aria-labelledby")
|
|
@@ -204,7 +204,7 @@ case 37:return void t.advanceSelection(-1,e)
|
|
|
204
204
|
case 39:return void t.advanceSelection(1,e)
|
|
205
205
|
case 9:return void(t.settings.selectOnTab&&(t.canSelect(t.activeOption)&&(t.onOptionSelect(e,t.activeOption),se(e)),t.settings.create&&t.createItem()&&se(e)))
|
|
206
206
|
case 8:case 46:return void t.deleteSelection(e)}t.isInputHidden&&!oe(W,e)&&se(e)}}onInput(e){var t=this
|
|
207
|
-
if(!t.isLocked){var i=
|
|
207
|
+
if(!t.isLocked){var i=this.settings.transformLoadQuery(this.control_input.value)
|
|
208
208
|
t.lastValue!==i&&(t.lastValue=i,t.settings.shouldLoad.call(t,i)&&t.load(i),t.refreshOptions(),t.trigger("type",i))}}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onFocus(e){var t=this,i=t.isFocused
|
|
209
209
|
if(t.isDisabled)return t.blur(),void se(e)
|
|
210
210
|
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
|
|
@@ -239,7 +239,7 @@ if(s.settings.score&&"function"!=typeof(i=s.settings.score.call(s,e)))throw new
|
|
|
239
239
|
return e!==s.lastQuery?(s.lastQuery=e,t=s.sifter.search(e,Object.assign(n,{score:i})),s.currentResults=t):t=Object.assign({},s.currentResults),s.settings.hideSelected&&(t.items=t.items.filter((e=>{let t=Y(e.id)
|
|
240
240
|
return!(t&&-1!==s.items.indexOf(t))}))),t}refreshOptions(e=!0){var t,i,s,n,o,r,l,a,c,d
|
|
241
241
|
const u={},p=[]
|
|
242
|
-
var h=this,g=
|
|
242
|
+
var h=this,g=this.settings.transformLoadQuery(this.control_input.value)
|
|
243
243
|
const f=g===h.lastQuery||""==g&&null==h.lastQuery
|
|
244
244
|
var v,m=h.search(g),y=null,b=h.settings.shouldOpen||!1,O=h.dropdown_content
|
|
245
245
|
for(f&&(y=h.activeOption)&&(c=y.closest("[data-group]")),n=m.items.length,"number"==typeof h.settings.maxOptions&&(n=Math.min(n,h.settings.maxOptions)),n>0&&(b=!0),t=0;t<n;t++){let e=m.items[t]
|
|
@@ -320,9 +320,9 @@ e.input.validity&&(e.isValid=e.input.validity.valid,e.isInvalid=!e.isValid)}isFu
|
|
|
320
320
|
var i,s
|
|
321
321
|
const n=t.input.querySelector('option[value=""]')
|
|
322
322
|
if(t.is_select_tag){const o=[],r=t.input.querySelectorAll("option:checked").length
|
|
323
|
-
function l(e,i,s){return e||(e=
|
|
323
|
+
function l(e,i,s){return e||(e=q('<option value="'+ee(i)+'">'+ee(s)+"</option>")),e!=n&&t.input.append(e),o.push(e),(e!=n||r>0)&&(e.selected=!0),e}t.input.querySelectorAll("option:checked").forEach((e=>{e.selected=!1})),0==t.items.length&&"single"==t.settings.mode?l(n,"",""):t.items.forEach((e=>{if(i=t.options[e],s=i[t.settings.labelField]||"",o.includes(i.$option)){l(t.input.querySelector(`option[value="${le(e)}"]:not(:checked)`),e,s)}else i.$option=l(i.$option,e,s)}))}else t.input.value=t.getValue()
|
|
324
324
|
t.isSetup&&(e.silent||t.trigger("change",t.getValue()))}open(){var e=this
|
|
325
|
-
e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.isOpen=!0,G(e.focus_node,{"aria-expanded":"true"}),e.refreshState(),N(e.dropdown,{visibility:"hidden",display:
|
|
325
|
+
e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.isOpen=!0,G(e.focus_node,{"aria-expanded":"true"}),e.refreshState(),N(e.dropdown,{visibility:"hidden",display:e.settings.openDisplay}),e.positionDropdown(),N(e.dropdown,{visibility:"visible",display:e.settings.openDisplay}),e.focus(),e.trigger("dropdown_open",e.dropdown))}close(e=!0){var t=this,i=t.isOpen
|
|
326
326
|
e&&(t.setTextboxValue(),"single"===t.settings.mode&&t.items.length&&t.hideInput()),t.isOpen=!1,G(t.focus_node,{"aria-expanded":"false"}),N(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
|
|
327
327
|
N(this.dropdown,{width:t.width+"px",top:i+"px",left:s+"px"})}}clear(e){var t=this
|
|
328
328
|
if(t.items.length){var i=t.controlChildren()
|
|
@@ -347,7 +347,7 @@ e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.inne
|
|
|
347
347
|
const n=this
|
|
348
348
|
if("function"!=typeof this.settings.render[e])return null
|
|
349
349
|
if(!(s=n.settings.render[e].call(this,t,ee)))return null
|
|
350
|
-
if(s=
|
|
350
|
+
if(s=q(s),"option"===e||"option_create"===e?t[n.settings.disabledField]?G(s,{"aria-disabled":"true"}):G(s,{"data-selectable":""}):"optgroup"===e&&(i=t.group[n.settings.optgroupValueField],G(s,{"data-group":i}),t.group[n.settings.disabledField]&&G(s,{"data-disabled":""})),"option"===e||"item"===e){const i=Z(t[n.settings.valueField])
|
|
351
351
|
G(s,{"data-value":i}),"item"===e?(H(s,n.settings.itemClass),G(s,{"data-ts-item":""})):(H(s,n.settings.optionClass),G(s,{role:"option",id:t.$id}),t.$div=s,n.options[i]=t)}return s}_render(e,t){const i=this.render(e,t)
|
|
352
352
|
if(null==i)throw"HTMLElement expected"
|
|
353
353
|
return i}clearCache(){E(this.options,(e=>{e.$div&&(e.$div.remove(),delete e.$div)}))}uncacheValue(e){const t=this.getOption(e)
|
|
@@ -358,14 +358,14 @@ e.settings.hideSelected=!1
|
|
|
358
358
|
var i=function(e){setTimeout((()=>{var t=e.querySelector("input")
|
|
359
359
|
t instanceof HTMLInputElement&&(e.classList.contains("selected")?t.checked=!0:t.checked=!1)}),1)}
|
|
360
360
|
e.hook("after","setupTemplates",(()=>{var t=e.settings.render.option
|
|
361
|
-
e.settings.render.option=(i,s)=>{var n=
|
|
361
|
+
e.settings.render.option=(i,s)=>{var n=q(t.call(e,i,s)),o=document.createElement("input")
|
|
362
362
|
o.addEventListener("click",(function(e){se(e)})),o.type="checkbox"
|
|
363
363
|
const r=Y(i[e.settings.valueField])
|
|
364
364
|
return r&&e.items.indexOf(r)>-1&&(o.checked=!0),n.prepend(o),n}})),e.on("item_remove",(t=>{var s=e.getOption(t)
|
|
365
365
|
s&&(s.classList.remove("selected"),i(s))})),e.on("item_add",(t=>{var s=e.getOption(t)
|
|
366
366
|
s&&i(s)})),e.hook("instead","onOptionSelect",((s,n)=>{if(n.classList.contains("selected"))return n.classList.remove("selected"),e.removeItem(n.dataset.value),e.refreshOptions(),void se(s,!0)
|
|
367
367
|
t.call(e,s,n),i(n)}))})),ue.define("clear_button",(function(e){const t=this,i=Object.assign({className:"clear-button",title:"Clear All",html:e=>`<div class="${e.className}" title="${e.title}">⨯</div>`},e)
|
|
368
|
-
t.on("initialize",(()=>{var e=
|
|
368
|
+
t.on("initialize",(()=>{var e=q(i.html(i))
|
|
369
369
|
e.addEventListener("click",(e=>{t.isDisabled||(t.clear(),"single"===t.settings.mode&&t.settings.allowEmptyOption&&t.addItem(""),e.preventDefault(),e.stopPropagation())})),t.control.appendChild(e)}))})),ue.define("drag_drop",(function(){var e=this
|
|
370
370
|
if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".')
|
|
371
371
|
if("multi"===e.settings.mode){var t=e.lock,i=e.unlock
|
|
@@ -374,16 +374,16 @@ return i&&i.disable(),t.call(e)})),e.hook("instead","unlock",(()=>{var t=$(e.con
|
|
|
374
374
|
return t&&t.enable(),i.call(e)})),e.on("initialize",(()=>{var t=$(e.control).sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:e.isLocked,start:(e,i)=>{i.placeholder.css("width",i.helper.css("width")),t.css({overflow:"visible"})},stop:()=>{t.css({overflow:"hidden"})
|
|
375
375
|
var i=[]
|
|
376
376
|
t.children("[data-value]").each((function(){this.dataset.value&&i.push(this.dataset.value)})),e.setValue(i)}})}))}})),ue.define("dropdown_header",(function(e){const t=this,i=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:e=>'<div class="'+e.headerClass+'"><div class="'+e.titleRowClass+'"><span class="'+e.labelClass+'">'+e.title+'</span><a class="'+e.closeClass+'">×</a></div></div>'},e)
|
|
377
|
-
t.on("initialize",(()=>{var e=
|
|
377
|
+
t.on("initialize",(()=>{var e=q(i.html(i)),s=e.querySelector("."+i.closeClass)
|
|
378
378
|
s&&s.addEventListener("click",(e=>{se(e,!0),t.close()})),t.dropdown.insertBefore(e,t.dropdown.firstChild)}))})),ue.define("caret_position",(function(){var e=this
|
|
379
379
|
e.hook("instead","setCaret",(t=>{"single"!==e.settings.mode&&e.control.contains(e.control_input)?(t=Math.max(0,Math.min(e.items.length,t)))==e.caretPos||e.isPending||e.controlChildren().forEach(((i,s)=>{s<t?e.control_input.insertAdjacentElement("beforebegin",i):e.control.appendChild(i)})):t=e.items.length,e.caretPos=t})),e.hook("instead","moveCaret",(t=>{if(!e.isFocused)return
|
|
380
380
|
const i=e.getLastActive(t)
|
|
381
381
|
if(i){const s=Q(i)
|
|
382
382
|
e.setCaret(t>0?s+1:s),e.setActiveItem(),z(i,"last-active")}else e.setCaret(e.caretPos+t)}))})),ue.define("dropdown_input",(function(){const e=this
|
|
383
383
|
e.settings.shouldOpen=!0,e.hook("before","setup",(()=>{e.focus_node=e.control,H(e.control_input,"dropdown-input")
|
|
384
|
-
const t=
|
|
384
|
+
const t=q('<div class="dropdown-input-wrap">')
|
|
385
385
|
t.append(e.control_input),e.dropdown.insertBefore(t,e.dropdown.firstChild)
|
|
386
|
-
const i=
|
|
386
|
+
const i=q('<input class="items-placeholder" tabindex="-1" />')
|
|
387
387
|
i.placeholder=e.settings.placeholder||"",e.control.append(i)})),e.on("initialize",(()=>{e.control_input.addEventListener("keydown",(t=>{switch(t.keyCode){case 27:return e.isOpen&&(se(t,!0),e.close()),void e.clearActiveItems()
|
|
388
388
|
case 9:e.focus_node.tabIndex=-1}return e.onKeyDown.call(e,t)})),e.on("blur",(()=>{e.focus_node.tabIndex=e.isDisabled?-1:e.tabIndex})),e.on("dropdown_open",(()=>{e.control_input.focus()}))
|
|
389
389
|
const t=e.onBlur
|
|
@@ -400,7 +400,7 @@ e.ignoreHover=!0,r=B(e.activeOption,"[data-group]"),s=Q(e.activeOption,"[data-se
|
|
|
400
400
|
var i=this
|
|
401
401
|
if(t.append){var s='<a href="javascript:void(0)" class="'+t.className+'" tabindex="-1" title="'+ee(t.title)+'">'+t.label+"</a>"
|
|
402
402
|
i.hook("after","setupTemplates",(()=>{var e=i.settings.render.item
|
|
403
|
-
i.settings.render.item=(t,n)=>{var o=
|
|
403
|
+
i.settings.render.item=(t,n)=>{var o=q(e.call(i,t,n)),r=q(s)
|
|
404
404
|
return o.appendChild(r),ne(r,"mousedown",(e=>{se(e,!0)})),ne(r,"click",(e=>{se(e,!0),i.isLocked||i.shouldDelete([o],e)&&(i.removeItem(o),i.refreshOptions(!1),i.inputState())})),o}}))}})),ue.define("restore_on_backspace",(function(e){const t=this,i=Object.assign({text:e=>e[t.settings.labelField]},e)
|
|
405
405
|
t.on("item_remove",(function(e){if(t.isFocused&&""===t.control_input.value.trim()){var s=t.options[e]
|
|
406
406
|
s&&t.setTextboxValue(i.text.call(t,s))}}))})),ue.define("virtual_scroll",(function(){const e=this,t=e.canLoad,i=e.clearActiveOption,s=e.loadCallback
|
|
@@ -1610,6 +1610,7 @@
|
|
|
1610
1610
|
searchField: ['text'],
|
|
1611
1611
|
searchConjunction: 'and',
|
|
1612
1612
|
mode: null,
|
|
1613
|
+
openDisplay: 'block',
|
|
1613
1614
|
wrapperClass: 'ts-wrapper',
|
|
1614
1615
|
controlClass: 'ts-control',
|
|
1615
1616
|
dropdownClass: 'ts-dropdown',
|
|
@@ -1621,6 +1622,9 @@
|
|
|
1621
1622
|
copyClassesToDropdown: false,
|
|
1622
1623
|
placeholder: null,
|
|
1623
1624
|
hidePlaceholder: null,
|
|
1625
|
+
transformLoadQuery: function (inputValue) {
|
|
1626
|
+
return inputValue.trim();
|
|
1627
|
+
},
|
|
1624
1628
|
shouldLoad: function (query) {
|
|
1625
1629
|
return query.length > 0;
|
|
1626
1630
|
},
|
|
@@ -2614,7 +2618,7 @@
|
|
|
2614
2618
|
if (self.isLocked) {
|
|
2615
2619
|
return;
|
|
2616
2620
|
}
|
|
2617
|
-
var value =
|
|
2621
|
+
var value = this.settings.transformLoadQuery(this.control_input.value);
|
|
2618
2622
|
if (self.lastValue !== value) {
|
|
2619
2623
|
self.lastValue = value;
|
|
2620
2624
|
if (self.settings.shouldLoad.call(self, value)) {
|
|
@@ -3188,7 +3192,7 @@
|
|
|
3188
3192
|
const groups = {};
|
|
3189
3193
|
const groups_order = [];
|
|
3190
3194
|
var self = this;
|
|
3191
|
-
var query =
|
|
3195
|
+
var query = this.settings.transformLoadQuery(this.control_input.value);
|
|
3192
3196
|
const same_query = query === self.lastQuery || query == '' && self.lastQuery == null;
|
|
3193
3197
|
var results = self.search(query);
|
|
3194
3198
|
var active_option = null;
|
|
@@ -3960,12 +3964,12 @@
|
|
|
3960
3964
|
self.refreshState();
|
|
3961
3965
|
applyCSS(self.dropdown, {
|
|
3962
3966
|
visibility: 'hidden',
|
|
3963
|
-
display:
|
|
3967
|
+
display: self.settings.openDisplay
|
|
3964
3968
|
});
|
|
3965
3969
|
self.positionDropdown();
|
|
3966
3970
|
applyCSS(self.dropdown, {
|
|
3967
3971
|
visibility: 'visible',
|
|
3968
|
-
display:
|
|
3972
|
+
display: self.settings.openDisplay
|
|
3969
3973
|
});
|
|
3970
3974
|
self.focus();
|
|
3971
3975
|
self.trigger('dropdown_open', self.dropdown);
|
|
@@ -104,16 +104,16 @@ const o=e.score||n._getScoreFunction(s)
|
|
|
104
104
|
t.length?E(n.items,((t,n)=>{i=o(t),(!1===e.filter||i>0)&&s.items.push({score:i,id:n})})):E(n.items,((t,e)=>{s.items.push({score:1,id:e})}))
|
|
105
105
|
const r=n._getSortFunction(s)
|
|
106
106
|
return r&&s.items.sort(r),s.total=s.items.length,"number"==typeof e.limit&&(s.items=s.items.slice(0,e.limit)),s}}const j=(t,e)=>{if(Array.isArray(t))t.forEach(e)
|
|
107
|
-
else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)}
|
|
107
|
+
else for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},$=t=>{if(t.jquery)return t[0]
|
|
108
108
|
if(t instanceof HTMLElement)return t
|
|
109
|
-
if(
|
|
110
|
-
return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)}
|
|
109
|
+
if(V(t)){var e=document.createElement("template")
|
|
110
|
+
return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},V=t=>"string"==typeof t&&t.indexOf("<")>-1,q=(t,e)=>{var i=document.createEvent("HTMLEvents")
|
|
111
111
|
i.initEvent(e,!0,!1),t.dispatchEvent(i)},D=(t,e)=>{Object.assign(t.style,e)},N=(t,...e)=>{var i=R(e);(t=M(t)).map((t=>{i.map((e=>{t.classList.add(e)}))}))},H=(t,...e)=>{var i=R(e);(t=M(t)).map((t=>{i.map((e=>{t.classList.remove(e)}))}))},R=t=>{var e=[]
|
|
112
112
|
return j(t,(t=>{"string"==typeof t&&(t=t.trim().split(/[\11\12\14\15\40]/)),Array.isArray(t)&&(e=e.concat(t))})),e.filter(Boolean)},M=t=>(Array.isArray(t)||(t=[t]),t),z=(t,e,i)=>{if(!i||i.contains(t))for(;t&&t.matches;){if(t.matches(e))return t
|
|
113
|
-
t=t.parentNode}},B=(t,e=0)=>e>0?t[t.length-1]:t[0],
|
|
113
|
+
t=t.parentNode}},B=(t,e=0)=>e>0?t[t.length-1]:t[0],Q=(t,e)=>{if(!t)return-1
|
|
114
114
|
e=e||t.nodeName
|
|
115
115
|
for(var i=0;t=t.previousElementSibling;)t.matches(e)&&i++
|
|
116
|
-
return i},
|
|
116
|
+
return i},K=(t,e)=>{j(e,((e,i)=>{null==e?t.removeAttribute(i):t.setAttribute(i,""+e)}))},G=(t,e)=>{t.parentNode&&t.parentNode.replaceChild(e,t)},J=(t,e)=>{if(null===e)return
|
|
117
117
|
if("string"==typeof e){if(!e.length)return
|
|
118
118
|
e=new RegExp(e,"i")}const i=t=>3===t.nodeType?(t=>{var i=t.data.match(e)
|
|
119
119
|
if(i&&t.data.length>0){var s=document.createElement("span")
|
|
@@ -123,7 +123,7 @@ n.splitText(i[0].length)
|
|
|
123
123
|
var o=n.cloneNode(!0)
|
|
124
124
|
return s.appendChild(o),G(n,s),1}return 0})(t):((t=>{1!==t.nodeType||!t.childNodes||/(script|style)/i.test(t.tagName)||"highlight"===t.className&&"SPAN"===t.tagName||Array.from(t.childNodes).forEach((t=>{i(t)}))})(t),0)
|
|
125
125
|
i(t)},U="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey"
|
|
126
|
-
var W={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(t){return t.length>0},render:{}}
|
|
126
|
+
var W={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,openDisplay:"block",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,transformLoadQuery:function(t){return t.trim()},shouldLoad:function(t){return t.length>0},render:{}}
|
|
127
127
|
const X=t=>null==t?null:Y(t),Y=t=>"boolean"==typeof t?t?"1":"0":t+"",Z=t=>(t+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),tt=(t,e)=>{var i
|
|
128
128
|
return function(s,n){var o=this
|
|
129
129
|
i&&(o.loading=Math.max(o.loading-1,0),clearTimeout(i)),i=setTimeout((function(){i=null,o.loadedSearches[s]=!0,t.call(o,s,n)}),e)}},et=(t,e,i)=>{var s,n=t.trigger,o={}
|
|
@@ -156,22 +156,22 @@ s.requested[e]=!0,s.loaded[e]=n.fn.apply(i,[i.plugins.settings[e]||{}]),s.names.
|
|
|
156
156
|
if(!e.plugins.loaded.hasOwnProperty(t)){if(i.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")')
|
|
157
157
|
e.loadPlugin(t)}return i.loaded[t]}}}(e)){constructor(t,e){var i
|
|
158
158
|
super(),this.control_input=void 0,this.wrapper=void 0,this.dropdown=void 0,this.control=void 0,this.dropdown_content=void 0,this.focus_node=void 0,this.order=0,this.settings=void 0,this.input=void 0,this.tabIndex=void 0,this.is_select_tag=void 0,this.rtl=void 0,this.inputId=void 0,this._destroy=void 0,this.sifter=void 0,this.isOpen=!1,this.isDisabled=!1,this.isRequired=void 0,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=void 0,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],ct++
|
|
159
|
-
var s
|
|
159
|
+
var s=$(t)
|
|
160
160
|
if(s.tomselect)throw new Error("Tom Select already initialized on this element")
|
|
161
161
|
s.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(s,null)).getPropertyValue("direction")
|
|
162
162
|
const n=at(s,e)
|
|
163
163
|
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=ot(s,"tomselect-"+ct),this.isRequired=s.required,this.sifter=new T(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)
|
|
164
164
|
var o=n.createFilter
|
|
165
165
|
"function"!=typeof o&&("string"==typeof o&&(o=new RegExp(o)),o instanceof RegExp?n.createFilter=t=>o.test(t):n.createFilter=t=>this.settings.duplicates||!this.options[t]),this.initializePlugins(n.plugins),this.setupCallbacks(),this.setupTemplates()
|
|
166
|
-
const r
|
|
166
|
+
const r=$("<div>"),l=$("<div>"),a=this._render("dropdown"),c=$('<div role="listbox" tabindex="-1">'),d=this.input.getAttribute("class")||"",u=n.mode
|
|
167
167
|
var p
|
|
168
|
-
if(N(r,n.wrapperClass,d,u),N(l,n.controlClass),lt(r,l),N(a,n.dropdownClass,u),n.copyClassesToDropdown&&N(a,d),N(c,n.dropdownContentClass),lt(a,c)
|
|
169
|
-
E(["autocorrect","autocapitalize","autocomplete"],(t=>{s.getAttribute(t)&&
|
|
168
|
+
if(N(r,n.wrapperClass,d,u),N(l,n.controlClass),lt(r,l),N(a,n.dropdownClass,u),n.copyClassesToDropdown&&N(a,d),N(c,n.dropdownContentClass),lt(a,c),$(n.dropdownParent||r).appendChild(a),V(n.controlInput)){p=$(n.controlInput)
|
|
169
|
+
E(["autocorrect","autocapitalize","autocomplete"],(t=>{s.getAttribute(t)&&K(p,{[t]:s.getAttribute(t)})})),p.tabIndex=-1,l.appendChild(p),this.focus_node=p}else n.controlInput?(p=$(n.controlInput),this.focus_node=p):(p=$("<input/>"),this.focus_node=l)
|
|
170
170
|
this.wrapper=r,this.dropdown=a,this.dropdown_content=c,this.control=l,this.control_input=p,this.setup()}setup(){const t=this,e=t.settings,i=t.control_input,s=t.dropdown,n=t.dropdown_content,o=t.wrapper,l=t.control,a=t.input,c=t.focus_node,d={passive:!0},u=t.inputId+"-ts-dropdown"
|
|
171
|
-
|
|
171
|
+
K(n,{id:u}),K(c,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":u})
|
|
172
172
|
const p=ot(c,t.inputId+"-ts-control"),h="label[for='"+(t=>t.replace(/['"\\]/g,"\\$&"))(t.inputId)+"']",g=document.querySelector(h),f=t.focus.bind(t),v=a.getAttribute("aria-labelledby")
|
|
173
|
-
if(g&&(st(g,"click",f),
|
|
174
|
-
N([o,s],e)}"multi"===e.mode&&(
|
|
173
|
+
if(g&&(st(g,"click",f),K(g,{for:p})),v&&(K(c,{"aria-labelledby":v}),K(n,{"aria-labelledby":v})),o.style.width=a.style.width,t.plugins.names.length){const e="plugin-"+t.plugins.names.join(" plugin-")
|
|
174
|
+
N([o,s],e)}"multi"===e.mode&&(K(n,{"aria-multiselectable":"true"}),t.is_select_tag&&K(a,{multiple:"multiple"})),e.placeholder&&K(i,{placeholder:e.placeholder}),!e.splitOn&&e.delimiter&&(e.splitOn=new RegExp("\\s*"+r(e.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=tt(e.load,e.loadThrottle)),t.control_input.type=a.type,st(s,"mousemove",(()=>{t.ignoreHover=!1})),st(s,"mouseenter",(e=>{var i=z(e.target,"[data-selectable]",s)
|
|
175
175
|
i&&t.onOptionHover(e,i)}),{capture:!0}),st(s,"click",(e=>{const i=z(e.target,"[data-selectable]")
|
|
176
176
|
i&&(t.onOptionSelect(e,i),it(e,!0))})),st(l,"click",(e=>{var s=z(e.target,"[data-ts-item]",l)
|
|
177
177
|
s&&t.onItemSelect(e,s)?it(e,!0):""==i.value&&(t.onClick(),it(e,!0))})),st(c,"keydown",(e=>t.onKeyDown(e))),st(i,"keypress",(e=>t.onKeyPress(e))),st(i,"input",(e=>t.onInput(e))),st(c,"blur",(e=>t.onBlur(e))),st(c,"focus",(e=>t.onFocus(e))),st(i,"paste",(e=>t.onPaste(e)))
|
|
@@ -204,7 +204,7 @@ case 37:return void e.advanceSelection(-1,t)
|
|
|
204
204
|
case 39:return void e.advanceSelection(1,t)
|
|
205
205
|
case 9:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)&&(e.onOptionSelect(t,e.activeOption),it(t)),e.settings.create&&e.createItem()&&it(t)))
|
|
206
206
|
case 8:case 46:return void e.deleteSelection(t)}e.isInputHidden&&!nt(U,t)&&it(t)}}onInput(t){var e=this
|
|
207
|
-
if(!e.isLocked){var i=
|
|
207
|
+
if(!e.isLocked){var i=this.settings.transformLoadQuery(this.control_input.value)
|
|
208
208
|
e.lastValue!==i&&(e.lastValue=i,e.settings.shouldLoad.call(e,i)&&e.load(i),e.refreshOptions(),e.trigger("type",i))}}onOptionHover(t,e){this.ignoreHover||this.setActiveOption(e,!1)}onFocus(t){var e=this,i=e.isFocused
|
|
209
209
|
if(e.isDisabled)return e.blur(),void it(t)
|
|
210
210
|
e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.preload(),i||e.trigger("focus"),e.activeItems.length||(e.showInput(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(!1!==document.hasFocus()){var e=this
|
|
@@ -225,21 +225,21 @@ if("click"===(i=e&&e.type.toLowerCase())&&nt("shiftKey",e)&&a.activeItems.length
|
|
|
225
225
|
it(e)}else"click"===i&&nt(U,e)||"keydown"===i&&nt("shiftKey",e)?t.classList.contains("active")?a.removeActiveItem(t):a.setActiveItemClass(t):(a.clearActiveItems(),a.setActiveItemClass(t))
|
|
226
226
|
a.hideInput(),a.isFocused||a.focus()}}setActiveItemClass(t){const e=this,i=e.control.querySelector(".last-active")
|
|
227
227
|
i&&H(i,"last-active"),N(t,"active last-active"),e.trigger("item_select",t),-1==e.activeItems.indexOf(t)&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t)
|
|
228
|
-
this.activeItems.splice(e,1),H(t,"active")}clearActiveItems(){H(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t,e=!0){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,
|
|
228
|
+
this.activeItems.splice(e,1),H(t,"active")}clearActiveItems(){H(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t,e=!0){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,K(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),("single"===this.settings.mode||this.settings.hideSelected)&&K(t,{"aria-selected":"true"}),N(t,"active"),e&&this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return
|
|
229
229
|
const i=this.dropdown_content,s=i.clientHeight,n=i.scrollTop||0,o=t.offsetHeight,r=t.getBoundingClientRect().top-i.getBoundingClientRect().top+n
|
|
230
230
|
r+o>s+n?this.scroll(r-s+o,e):r<n&&this.scroll(r,e)}scroll(t,e){const i=this.dropdown_content
|
|
231
|
-
e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(H(this.activeOption,"active"),("single"===this.settings.mode||this.settings.hideSelected)&&
|
|
231
|
+
e&&(i.style.scrollBehavior=e),i.scrollTop=t,i.style.scrollBehavior=""}clearActiveOption(){this.activeOption&&(H(this.activeOption,"active"),("single"===this.settings.mode||this.settings.hideSelected)&&K(this.activeOption,{"aria-selected":null})),this.activeOption=null,K(this.focus_node,{"aria-activedescendant":null})}selectAll(){const t=this
|
|
232
232
|
if("single"===t.settings.mode)return
|
|
233
233
|
const e=t.controlChildren()
|
|
234
234
|
e.length&&(t.hideInput(),t.close(),t.activeItems=e,E(e,(e=>{t.setActiveItemClass(e)})))}inputState(){var t=this
|
|
235
|
-
t.control.contains(t.control_input)&&(
|
|
235
|
+
t.control.contains(t.control_input)&&(K(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&K(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}hideInput(){this.inputState()}showInput(){this.inputState()}inputValue(){return this.control_input.value.trim()}focus(){var t=this
|
|
236
236
|
t.isDisabled||(t.ignoreFocus=!0,t.control_input.offsetWidth?t.control_input.focus():t.focus_node.focus(),setTimeout((()=>{t.ignoreFocus=!1,t.onFocus()}),0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField
|
|
237
237
|
return"string"==typeof t.sortField&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,i,s=this,n=this.getSearchOptions()
|
|
238
238
|
if(s.settings.score&&"function"!=typeof(i=s.settings.score.call(s,t)))throw new Error('Tom Select "score" setting must be a function that returns a function')
|
|
239
239
|
return t!==s.lastQuery?(s.lastQuery=t,e=s.sifter.search(t,Object.assign(n,{score:i})),s.currentResults=e):e=Object.assign({},s.currentResults),s.settings.hideSelected&&(e.items=e.items.filter((t=>{let e=X(t.id)
|
|
240
240
|
return!(e&&-1!==s.items.indexOf(e))}))),e}refreshOptions(t=!0){var e,i,s,n,o,r,l,a,c,d
|
|
241
241
|
const u={},p=[]
|
|
242
|
-
var h=this,g=
|
|
242
|
+
var h=this,g=this.settings.transformLoadQuery(this.control_input.value)
|
|
243
243
|
const f=g===h.lastQuery||""==g&&null==h.lastQuery
|
|
244
244
|
var v,m=h.search(g),y=null,b=h.settings.shouldOpen||!1,O=h.dropdown_content
|
|
245
245
|
for(f&&(y=h.activeOption)&&(c=y.closest("[data-group]")),n=m.items.length,"number"==typeof h.settings.maxOptions&&(n=Math.min(n,h.settings.maxOptions)),n>0&&(b=!0),e=0;e<n;e++){let t=m.items[e]
|
|
@@ -248,9 +248,9 @@ let n=t.id,l=h.options[n]
|
|
|
248
248
|
if(void 0===l)continue
|
|
249
249
|
let a=Y(n),d=h.getOption(a,!0)
|
|
250
250
|
const g=h.items.includes(a)
|
|
251
|
-
for(h.settings.hideSelected||(d.classList.toggle("selected",g),"multi"===this.settings.mode&&
|
|
251
|
+
for(h.settings.hideSelected||(d.classList.toggle("selected",g),"multi"===this.settings.mode&&K(d,{"aria-selected":g?"true":"false"})),o=l[h.settings.optgroupField]||"",i=0,s=(r=Array.isArray(o)?o:[o])&&r.length;i<s;i++){o=r[i],h.optgroups.hasOwnProperty(o)||(o="")
|
|
252
252
|
let t=u[o]
|
|
253
|
-
void 0===t&&(t=document.createDocumentFragment(),p.push(o)),i>0&&(d=d.cloneNode(!0),"multi"!==this.settings.mode||h.settings.hideSelected?
|
|
253
|
+
void 0===t&&(t=document.createDocumentFragment(),p.push(o)),i>0&&(d=d.cloneNode(!0),"multi"!==this.settings.mode||h.settings.hideSelected?K(d,{id:l.$id+"-clone-"+i,"aria-selected":null}):K(d,{id:l.$id+"-clone-"+i,"aria-selected":g?"true":"false"}),d.classList.add("ts-cloned"),H(d,"active"),h.activeOption&&h.activeOption.dataset.value==n&&c&&c.dataset.group===o.toString()&&(y=d)),t.appendChild(d),u[o]=t}}h.settings.lockOptgroupOrder&&p.sort(((t,e)=>{const i=h.optgroups[t],s=h.optgroups[e]
|
|
254
254
|
return(i&&i.$order||0)-(s&&s.$order||0)})),l=document.createDocumentFragment(),E(p,(t=>{let e=u[t]
|
|
255
255
|
if(!e||!e.children.length)return
|
|
256
256
|
let i=h.optgroups[t]
|
|
@@ -300,7 +300,7 @@ e&&n.setActiveOption(e)}n.isPending||n.settings.closeAfterSelect||n.refreshOptio
|
|
|
300
300
|
if(!(t=i.getItem(t)))return
|
|
301
301
|
var s,n
|
|
302
302
|
const o=t.dataset.value
|
|
303
|
-
s=
|
|
303
|
+
s=Q(t),t.remove(),t.classList.contains("active")&&(n=i.activeItems.indexOf(t),i.activeItems.splice(n,1),H(t,"active")),i.items.splice(s,1),i.lastQuery=null,!i.settings.persist&&i.userOptions.hasOwnProperty(o)&&i.removeOption(o,e),s<i.caretPos&&i.setCaret(i.caretPos-1),i.updateOriginalInput({silent:e}),i.refreshState(),i.positionDropdown(),i.trigger("item_remove",o,t)}createItem(t=null,e=(()=>{})){3===arguments.length&&(e=arguments[2]),"function"!=typeof e&&(e=()=>{})
|
|
304
304
|
var i,s=this,n=s.caretPos
|
|
305
305
|
if(t=t||s.inputValue(),!s.canCreate(t))return e(),!1
|
|
306
306
|
s.lock()
|
|
@@ -320,17 +320,17 @@ t.input.validity&&(t.isValid=t.input.validity.valid,t.isInvalid=!t.isValid)}isFu
|
|
|
320
320
|
var i,s
|
|
321
321
|
const n=e.input.querySelector('option[value=""]')
|
|
322
322
|
if(e.is_select_tag){const o=[],r=e.input.querySelectorAll("option:checked").length
|
|
323
|
-
function l(t,i,s){return t||(t
|
|
323
|
+
function l(t,i,s){return t||(t=$('<option value="'+Z(i)+'">'+Z(s)+"</option>")),t!=n&&e.input.append(t),o.push(t),(t!=n||r>0)&&(t.selected=!0),t}e.input.querySelectorAll("option:checked").forEach((t=>{t.selected=!1})),0==e.items.length&&"single"==e.settings.mode?l(n,"",""):e.items.forEach((t=>{if(i=e.options[t],s=i[e.settings.labelField]||"",o.includes(i.$option)){l(e.input.querySelector(`option[value="${rt(t)}"]:not(:checked)`),t,s)}else i.$option=l(i.$option,t,s)}))}else e.input.value=e.getValue()
|
|
324
324
|
e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this
|
|
325
|
-
t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,
|
|
326
|
-
t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.hideInput()),e.isOpen=!1,
|
|
325
|
+
t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,K(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),D(t.dropdown,{visibility:"hidden",display:t.settings.openDisplay}),t.positionDropdown(),D(t.dropdown,{visibility:"visible",display:t.settings.openDisplay}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,i=e.isOpen
|
|
326
|
+
t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.hideInput()),e.isOpen=!1,K(e.focus_node,{"aria-expanded":"false"}),D(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),i&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var t=this.control,e=t.getBoundingClientRect(),i=t.offsetHeight+e.top+window.scrollY,s=e.left+window.scrollX
|
|
327
327
|
D(this.dropdown,{width:e.width+"px",top:i+"px",left:s+"px"})}}clear(t){var e=this
|
|
328
328
|
if(e.items.length){var i=e.controlChildren()
|
|
329
329
|
E(i,(t=>{e.removeItem(t,!0)})),e.showInput(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){const e=this,i=e.caretPos,s=e.control
|
|
330
330
|
s.insertBefore(t,s.children[i]||null),e.setCaret(i+1)}deleteSelection(t){var e,i,s,n,o,r=this
|
|
331
331
|
e=t&&8===t.keyCode?-1:1,i={start:(o=r.control_input).selectionStart||0,length:(o.selectionEnd||0)-(o.selectionStart||0)}
|
|
332
332
|
const l=[]
|
|
333
|
-
if(r.activeItems.length)n=B(r.activeItems,e),s=
|
|
333
|
+
if(r.activeItems.length)n=B(r.activeItems,e),s=Q(n),e>0&&s++,E(r.activeItems,(t=>l.push(t)))
|
|
334
334
|
else if((r.isFocused||"single"===r.settings.mode)&&r.items.length){const t=r.controlChildren()
|
|
335
335
|
let s
|
|
336
336
|
e<0&&0===i.start&&0===i.length?s=t[r.caretPos-1]:e>0&&i.start===r.inputValue().length&&(s=t[r.caretPos]),void 0!==s&&l.push(s)}if(!r.shouldDelete(l,t))return!1
|
|
@@ -347,8 +347,8 @@ t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.inne
|
|
|
347
347
|
const n=this
|
|
348
348
|
if("function"!=typeof this.settings.render[t])return null
|
|
349
349
|
if(!(s=n.settings.render[t].call(this,e,Z)))return null
|
|
350
|
-
if(s
|
|
351
|
-
|
|
350
|
+
if(s=$(s),"option"===t||"option_create"===t?e[n.settings.disabledField]?K(s,{"aria-disabled":"true"}):K(s,{"data-selectable":""}):"optgroup"===t&&(i=e.group[n.settings.optgroupValueField],K(s,{"data-group":i}),e.group[n.settings.disabledField]&&K(s,{"data-disabled":""})),"option"===t||"item"===t){const i=Y(e[n.settings.valueField])
|
|
351
|
+
K(s,{"data-value":i}),"item"===t?(N(s,n.settings.itemClass),K(s,{"data-ts-item":""})):(N(s,n.settings.optionClass),K(s,{role:"option",id:e.$id}),e.$div=s,n.options[i]=e)}return s}_render(t,e){const i=this.render(t,e)
|
|
352
352
|
if(null==i)throw"HTMLElement expected"
|
|
353
353
|
return i}clearCache(){E(this.options,(t=>{t.$div&&(t.$div.remove(),delete t.$div)}))}uncacheValue(t){const e=this.getOption(t)
|
|
354
354
|
e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,i){var s=this,n=s[e]
|
|
@@ -356,12 +356,12 @@ s[e]=function(){var e,o
|
|
|
356
356
|
return"after"===t&&(e=n.apply(s,arguments)),o=i.apply(s,arguments),"instead"===t?o:("before"===t&&(e=n.apply(s,arguments)),e)}}}return dt.define("caret_position",(function(){var t=this
|
|
357
357
|
t.hook("instead","setCaret",(e=>{"single"!==t.settings.mode&&t.control.contains(t.control_input)?(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)})):e=t.items.length,t.caretPos=e})),t.hook("instead","moveCaret",(e=>{if(!t.isFocused)return
|
|
358
358
|
const i=t.getLastActive(e)
|
|
359
|
-
if(i){const s=
|
|
359
|
+
if(i){const s=Q(i)
|
|
360
360
|
t.setCaret(e>0?s+1:s),t.setActiveItem(),H(i,"last-active")}else t.setCaret(t.caretPos+e)}))})),dt.define("dropdown_input",(function(){const t=this
|
|
361
361
|
t.settings.shouldOpen=!0,t.hook("before","setup",(()=>{t.focus_node=t.control,N(t.control_input,"dropdown-input")
|
|
362
|
-
const e
|
|
362
|
+
const e=$('<div class="dropdown-input-wrap">')
|
|
363
363
|
e.append(t.control_input),t.dropdown.insertBefore(e,t.dropdown.firstChild)
|
|
364
|
-
const i
|
|
364
|
+
const i=$('<input class="items-placeholder" tabindex="-1" />')
|
|
365
365
|
i.placeholder=t.settings.placeholder||"",t.control.append(i)})),t.on("initialize",(()=>{t.control_input.addEventListener("keydown",(e=>{switch(e.keyCode){case 27:return t.isOpen&&(it(e,!0),t.close()),void t.clearActiveItems()
|
|
366
366
|
case 9:t.focus_node.tabIndex=-1}return t.onKeyDown.call(t,e)})),t.on("blur",(()=>{t.focus_node.tabIndex=t.isDisabled?-1:t.tabIndex})),t.on("dropdown_open",(()=>{t.control_input.focus()}))
|
|
367
367
|
const e=t.onBlur
|
|
@@ -370,7 +370,7 @@ this.hook("instead","deleteSelection",(i=>!!t.activeItems.length&&e.call(t,i)))}
|
|
|
370
370
|
var i=this
|
|
371
371
|
if(e.append){var s='<a href="javascript:void(0)" class="'+e.className+'" tabindex="-1" title="'+Z(e.title)+'">'+e.label+"</a>"
|
|
372
372
|
i.hook("after","setupTemplates",(()=>{var t=i.settings.render.item
|
|
373
|
-
i.settings.render.item=(e,n)=>{var o
|
|
373
|
+
i.settings.render.item=(e,n)=>{var o=$(t.call(i,e,n)),r=$(s)
|
|
374
374
|
return o.appendChild(r),st(r,"mousedown",(t=>{it(t,!0)})),st(r,"click",(t=>{it(t,!0),i.isLocked||i.shouldDelete([o],t)&&(i.removeItem(o),i.refreshOptions(!1),i.inputState())})),o}}))}})),dt.define("restore_on_backspace",(function(t){const e=this,i=Object.assign({text:t=>t[e.settings.labelField]},t)
|
|
375
375
|
e.on("item_remove",(function(t){if(e.isFocused&&""===e.control_input.value.trim()){var s=e.options[t]
|
|
376
376
|
s&&e.setTextboxValue(i.text.call(e,s))}}))})),dt}))
|
package/dist/components/index.js
CHANGED
|
@@ -835,7 +835,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
835
835
|
})();
|
|
836
836
|
|
|
837
837
|
const name = "@oiz/stzh-components";
|
|
838
|
-
const version = "2.
|
|
838
|
+
const version = "2.13.0-beta1";
|
|
839
839
|
|
|
840
840
|
const packageName = name.substring(name.indexOf('/')+1);
|
|
841
841
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"stzh-actionset2.js","mappings":";;;;;;;;;;AAAA,MAAM,gBAAgB,GAAG,isFAAisF;;MCoC7sF,aA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GAAG,EAAE,CAAC,GACxC,EACf,iBAAW,IAAI,EAAC,SAAS,IACtB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,KAC/B;;MAEE,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,UAAU,EAAE,MAAM,CAAC,UAAU,EAC7B,SAAS,EAAE,MAAM,CAAC,SAAS,EAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA,EAAE;OAE9C,MAAM,CAAC,KAAK,CACE,CAClB,CAAC,CACQ,CACC,CACX,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/stzh-actionset/stzh-actionset.scss?tag=stzh-actionset&encapsulation=scoped","src/components/stzh-actionset/stzh-actionset.tsx"],"sourcesContent":[":host {\n\n}\n\n.stzh-actionset {\n &__actions {\n display: flex;\n align-items: center;\n }\n\n &__actions-wrapper {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n overflow: hidden;\n }\n\n &__action {\n &:not(:last-child) {\n margin-right: space('xsmall');\n }\n }\n\n &__action-popover {\n opacity: 0;\n }\n\n &--has-collapsed-items &__action-popover {\n --width: auto;\n opacity: 1;\n }\n\n /* Overflow variant */\n\n &--overflow &__action {\n @include mq($from: medium) {\n --white-space: nowrap;\n }\n }\n\n /* Stack variant */\n\n &--stack &__actions {\n @include mq($to: small) {\n flex-direction: column;\n align-items: stretch;\n }\n }\n\n &--stack &__actions-wrapper { \n @include mq($to: small) {\n flex-direction: column;\n align-items: stretch;\n }\n }\n\n &--stack &__action {\n @include mq($from: small) {\n --white-space: nowrap;\n }\n\n &:not(:last-child) {\n @include mq($to: small) {\n margin-bottom: space('xsmall');\n margin-right: 0;\n }\n }\n }\n\n &--stack &__action-popover {\n @include mq($to: small) {\n margin-top: space('xsmall');\n }\n }\n\n // Hide more action popover on small if it has no collapsed items\n\n &--stack:not(#{&}--has-collapsed-items) &__action-popover {\n @include mq($to: small) {\n display: none;\n }\n }\n}\n","import {\n Component,\n Host,\n Prop,\n h,\n Element,\n Watch,\n Event,\n EventEmitter,\n State\n} from \"@stencil/core\";\n\nimport {\n StzhActionsetItem,\n StzhActionsetItemClickEvent\n} from \"../../index\";\n\nimport { StzhActionsetLocalizedText } from './stzh-actionset.localization';\n\nimport {\n media,\n addMediaChangeListener,\n removeMediaChangeListener\n} from '../../utils/media-utils';\n\nimport {\n Placement,\n} from \"@floating-ui/dom\";\n\n/**\n */\n@Component({\n tag: \"stzh-actionset\",\n styleUrl: \"stzh-actionset.scss\",\n scoped: true\n})\nexport class StzhActionset {\n /** Translation strings */\n @Prop() localization: StzhActionsetLocalizedText;\n\n /** Variant determining what position the action buttons are */\n @Prop({ reflect: true }) variant: \"stack\" | \"overflow\" = \"stack\";\n\n /** Button variant of popover button (button thats holds collapsed actions) */\n @Prop({ reflect: true }) popoverButtonVariant: \"\" | \"default\" | \"secondary\" | \"input\" | \"tertiary\" = \"\";\n\n /** Button size of popover button (button that holds collapsed actions) */\n @Prop({ reflect: true }) popoverButtonSize: \"\" | \"default\" | \"small\" | \"tiny\" = \"\";\n\n /** Popover placement of button that holds collapsed actions */\n @Prop({ reflect: true }) popoverPlacement: Placement = \"bottom-end\";\n\n /**\n * Card header actions.\n * Array of objects that can include the button attributes `id`, `variant`, `icon`, `size`, `iconPosition`, `iconOnly`, `label` or `badge`:\n * `[{\"id\":\"action-1\", \"icon\": \"alarm-bell\", \"label\": \"Lorem\"}, {\"id\":\"action-2\", \"icon\": \"mail\", \"label\": \"Lorem\"}]`\n */\n @Prop() actions: StzhActionsetItem[] | string = [];\n private _actions: StzhActionsetItem[] = [];\n\n /** Header action click event */\n @Event() stzhActionClick: EventEmitter<StzhActionsetItemClickEvent>;\n\n @Element() element: HTMLStzhActionsetElement;\n\n @Watch(\"actions\")\n actionsWatcher(newValue: StzhActionsetItem[] | string) {\n if (typeof newValue === \"string\") {\n this._actions = JSON.parse(newValue);\n } else {\n this._actions = newValue;\n }\n }\n\n @State() actionsCollapsed: StzhActionsetItem[] = [];\n @State() dynamicActions: boolean;\n @State() isSmall: boolean;\n @State() isMedium: boolean;\n\n private actionsElement: HTMLElement;\n private debounceResize: number;\n private resizeObserver: ResizeObserver;\n\n private actionClick = (action: StzhActionsetItem, originalEvent: MouseEvent) => {\n this.stzhActionClick.emit({\n component: \"stzh-actionset\",\n action,\n originalEvent\n });\n }\n\n private update = () => {\n this.isSmall = media(\"small\").matches;\n this.isMedium = media(\"medium\").matches;\n\n if (!this.actionsElement) {\n return;\n }\n\n Object.assign(this.actionsElement.style, {\n width: null,\n height: null\n });\n\n let newActionsVisible = 0;\n\n if (\n this.variant === \"overflow\" && this.isMedium\n || this.variant === \"stack\" && this.isSmall\n ) {\n this.dynamicActions = true;\n\n let newActionsHeight = 0;\n let newActionsWidth = 0;\n\n // update height and width\n Array.from(this.actionsElement.children).forEach((child: HTMLElement) => {\n // check which item is visible and\n if (child.offsetTop === 0) {\n newActionsVisible++;\n\n const style = getComputedStyle(child);\n const marginLeft = parseInt(style.marginLeft);\n const marginRight = parseInt(style.marginRight);\n const marginTop = parseInt(style.marginTop);\n const marginBottom = parseInt(style.marginBottom);\n\n const childWidth = child.offsetWidth + marginLeft + marginRight;\n const childHeight = child.offsetHeight + marginTop + marginBottom;\n\n if (newActionsHeight < childHeight) {\n newActionsHeight = childHeight;\n }\n\n newActionsWidth = newActionsWidth + childWidth + 1;\n }\n });\n\n Object.assign(this.actionsElement.style, {\n width: `${newActionsWidth}px`,\n height: `${newActionsHeight}px`\n });\n } else {\n this.dynamicActions = false;\n\n if (this.variant === \"overflow\") {\n newActionsVisible = 0;\n } else if (this.variant === \"stack\") {\n newActionsVisible = this._actions.length <= 3 ? this._actions.length : 2;\n }\n }\n\n this.actionsCollapsed = this._actions.slice(newActionsVisible);\n }\n\n private handleResize = () => {\n if (this.debounceResize) {\n window.cancelAnimationFrame(this.debounceResize);\n }\n\n this.debounceResize = requestAnimationFrame(this.update);\n }\n\n private mediaChangeHandler = () => {\n this.actionsCollapsed = [];\n requestAnimationFrame(this.update);\n }\n\n async componentWillLoad() {\n this.actionsWatcher(this.actions);\n\n if (!this.localization) {\n this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, \"actionset\");\n }\n }\n\n connectedCallback() {\n addMediaChangeListener(this.mediaChangeHandler);\n\n this.resizeObserver = new ResizeObserver(this.handleResize);\n this.resizeObserver.observe(this.element);\n }\n\n disconnectedCallback() {\n removeMediaChangeListener(this.mediaChangeHandler);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n }\n\n componentDidLoad() {\n this.update();\n }\n\n render() {\n const classes = {\n \"stzh-actionset\": true,\n // \"stzh-actionset--has-dynamic-actions\": this.dynamicActions,\n \"stzh-actionset--has-collapsed-items\": this.actionsCollapsed.length > 0,\n [`stzh-actionset--${this.variant}`]: !!this.variant\n };\n\n const Action = (action: StzhActionsetItem) => (\n <stzh-button\n class={{\n \"stzh-actionset__action\": true,\n \"is-button\": true,\n // \"show-medium\": !action.onlyCollapseText,\n // \"hide-when-collapsed\": !action.onlyCollapseText,\n // \"hide-text-when-collapsed\": action.onlyCollapseText\n }}\n icon={action.icon}\n iconPosition={action.iconPosition}\n iconOnly={action.iconOnly}\n badge={action.badge}\n variant={action.variant\n ? action.variant\n : (this.variant === \"stack\" ? \"secondary\" : \"tertiary\")}\n size={action.size\n ? action.size\n : (this.variant === \"stack\" ? \"default\" : \"tiny\")}\n badgePosition=\"icon\"\n onClick={(e) => { this.actionClick(action, e) }}\n >\n <span\n class={{\n // \"show-medium\": action.onlyCollapseText,\n // \"hide-when-collapsed\": action.onlyCollapseText\n }}\n >\n {action.label}\n </span>\n </stzh-button>\n );\n\n return (\n <Host has-collapsed-items={this.actionsCollapsed.length > 0}>\n <div class={classes}>\n <div class=\"stzh-actionset__actions\" role=\"group\">\n <div\n ref={(el) => (this.actionsElement = el as HTMLElement)}\n class=\"stzh-actionset__actions-wrapper\"\n >\n {this._actions.map(action => (\n (this.dynamicActions\n || (!this.dynamicActions &&\n this.actionsCollapsed.indexOf(action) === -1))\n &&\n (action.tooltipContent\n ?\n <stzh-tooltip\n strategy=\"fixed\"\n content={action.tooltipContent}\n >\n {Action(action)}\n </stzh-tooltip>\n :\n Action(action))\n ))}\n </div>\n\n <stzh-popover\n label={this.variant === \"stack\"\n ? this.localization.furtherActions\n : (!this.isMedium ? this.localization.actions : \"\")}\n strategy=\"fixed\"\n placement={this.popoverPlacement}\n class=\"stzh-actionset__action-popover\"\n >\n <stzh-button\n fullwidth\n disabled={this.actionsCollapsed.length === 0}\n class=\"stzh-actionset__action is-further\"\n variant={this.popoverButtonVariant !== \"\"\n ? this.popoverButtonVariant\n : (this.variant === \"stack\" ? \"secondary\" : \"tertiary\")}\n size={this.popoverButtonSize !== \"\"\n ? this.popoverButtonSize\n : (this.variant === \"stack\" ? \"default\" : \"tiny\")}\n icon={this.variant === \"stack\" ? \"angle-down\" : \"more-vertical\"}\n iconOnly={this.variant === \"overflow\" && this.isMedium}\n iconPosition=\"right\"\n label={this.variant === \"stack\"\n ? this.localization.furtherActions\n : (!this.isMedium ? this.localization.actions : \"\")}\n ></stzh-button>\n <stzh-menu slot=\"content\">\n {this.actionsCollapsed.map(action => (\n <stzh-menu-item\n // class=\"hide-medium show-when-collapsed\"\n icon={action.icon}\n badge={action.badge}\n badgeEmpty={action.badgeEmpty}\n badgeType={action.badgeType}\n onClick={(e) => { this.actionClick(action, e) }}\n >\n {action.label}\n </stzh-menu-item>\n ))}\n </stzh-menu>\n </stzh-popover>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"stzh-actionset2.js","mappings":";;;;;;;;;;AAAA,MAAM,gBAAgB,GAAG,isFAAisF;;MCoC7sF,aAAa;;;;;IAsBhB,aAAQ,GAAwB,EAAE,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IAAI,EAAC,SAAS,IACtB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,KAC/B;;MAEE,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,UAAU,EAAE,MAAM,CAAC,UAAU,EAC7B,SAAS,EAAE,MAAM,CAAC,SAAS,EAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA,EAAE;OAE9C,MAAM,CAAC,KAAK,CACE,CAClB,CAAC,CACQ,CACC,CACX,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/stzh-actionset/stzh-actionset.scss?tag=stzh-actionset&encapsulation=scoped","src/components/stzh-actionset/stzh-actionset.tsx"],"sourcesContent":[":host {\n\n}\n\n.stzh-actionset {\n &__actions {\n display: flex;\n align-items: center;\n }\n\n &__actions-wrapper {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n overflow: hidden;\n }\n\n &__action {\n &:not(:last-child) {\n margin-right: space('xsmall');\n }\n }\n\n &__action-popover {\n opacity: 0;\n }\n\n &--has-collapsed-items &__action-popover {\n --width: auto;\n opacity: 1;\n }\n\n /* Overflow variant */\n\n &--overflow &__action {\n @include mq($from: medium) {\n --white-space: nowrap;\n }\n }\n\n /* Stack variant */\n\n &--stack &__actions {\n @include mq($to: small) {\n flex-direction: column;\n align-items: stretch;\n }\n }\n\n &--stack &__actions-wrapper { \n @include mq($to: small) {\n flex-direction: column;\n align-items: stretch;\n }\n }\n\n &--stack &__action {\n @include mq($from: small) {\n --white-space: nowrap;\n }\n\n &:not(:last-child) {\n @include mq($to: small) {\n margin-bottom: space('xsmall');\n margin-right: 0;\n }\n }\n }\n\n &--stack &__action-popover {\n @include mq($to: small) {\n margin-top: space('xsmall');\n }\n }\n\n // Hide more action popover on small if it has no collapsed items\n\n &--stack:not(#{&}--has-collapsed-items) &__action-popover {\n @include mq($to: small) {\n display: none;\n }\n }\n}\n","import {\n Component,\n Host,\n Prop,\n h,\n Element,\n Watch,\n Event,\n EventEmitter,\n State\n} from \"@stencil/core\";\n\nimport {\n StzhActionsetItem,\n StzhActionsetItemClickEvent\n} from \"../../index\";\n\nimport { StzhActionsetLocalizedText } from './stzh-actionset.localization';\n\nimport {\n media,\n addMediaChangeListener,\n removeMediaChangeListener\n} from '../../utils/media-utils';\n\nimport {\n Placement,\n} from \"@floating-ui/dom\";\n\n/**\n */\n@Component({\n tag: \"stzh-actionset\",\n styleUrl: \"stzh-actionset.scss\",\n scoped: true\n})\nexport class StzhActionset {\n /** Translation strings */\n @Prop() localization: StzhActionsetLocalizedText;\n\n /** Variant determining what position the action buttons are */\n @Prop({ reflect: true }) variant: \"stack\" | \"overflow\" = \"stack\";\n\n /** Button variant of popover button (button thats holds collapsed actions) */\n @Prop({ reflect: true }) popoverButtonVariant: \"\" | \"default\" | \"secondary\" | \"input\" | \"tertiary\" = \"\";\n\n /** Button size of popover button (button that holds collapsed actions) */\n @Prop({ reflect: true }) popoverButtonSize: \"\" | \"default\" | \"small\" | \"tiny\" = \"\";\n\n /** Popover placement of button that holds collapsed actions */\n @Prop({ reflect: true }) popoverPlacement: Placement = \"bottom-end\";\n\n /**\n * Card header actions.\n * Array of objects that can include the button attributes `id`, `variant`, `icon`, `size`, `iconPosition`, `iconOnly`, `label` or `badge`:\n * `[{\"id\":\"action-1\", \"icon\": \"alarm-bell\", \"label\": \"Lorem\"}, {\"id\":\"action-2\", \"icon\": \"mail\", \"label\": \"Lorem\"}]`\n */\n @Prop() actions: StzhActionsetItem[] | string = [];\n private _actions: StzhActionsetItem[] = [];\n\n /** Header action click event */\n @Event() stzhActionClick: EventEmitter<StzhActionsetItemClickEvent>;\n\n @Element() element: HTMLStzhActionsetElement;\n\n @Watch(\"actions\")\n actionsWatcher(newValue: StzhActionsetItem[] | string) {\n if (typeof newValue === \"string\") {\n this._actions = JSON.parse(newValue);\n } else {\n this._actions = newValue;\n }\n }\n\n @State() actionsCollapsed: StzhActionsetItem[] = [];\n @State() dynamicActions: boolean;\n @State() isSmall: boolean;\n @State() isMedium: boolean;\n\n private actionsElement: HTMLElement;\n private debounceResize: number;\n private resizeObserver: ResizeObserver;\n\n private actionClick = (action: StzhActionsetItem, originalEvent: MouseEvent) => {\n this.stzhActionClick.emit({\n component: \"stzh-actionset\",\n action,\n originalEvent\n });\n }\n\n private update = () => {\n this.isSmall = media(\"small\").matches;\n this.isMedium = media(\"medium\").matches;\n\n if (!this.actionsElement) {\n return;\n }\n\n Object.assign(this.actionsElement.style, {\n width: null,\n height: null\n });\n\n let newActionsVisible = 0;\n\n if (\n this.variant === \"overflow\" && this.isMedium\n || this.variant === \"stack\" && this.isSmall\n ) {\n this.dynamicActions = true;\n\n let newActionsHeight = 0;\n let newActionsWidth = 0;\n\n // update height and width\n Array.from(this.actionsElement.children).forEach((child: HTMLElement) => {\n // check which item is visible and\n if (child.offsetTop === 0) {\n newActionsVisible++;\n\n const style = getComputedStyle(child);\n const marginLeft = parseInt(style.marginLeft);\n const marginRight = parseInt(style.marginRight);\n const marginTop = parseInt(style.marginTop);\n const marginBottom = parseInt(style.marginBottom);\n\n const childWidth = child.offsetWidth + marginLeft + marginRight;\n const childHeight = child.offsetHeight + marginTop + marginBottom;\n\n if (newActionsHeight < childHeight) {\n newActionsHeight = childHeight;\n }\n\n newActionsWidth = newActionsWidth + childWidth + 1;\n }\n });\n\n Object.assign(this.actionsElement.style, {\n width: `${newActionsWidth}px`,\n height: `${newActionsHeight}px`\n });\n } else {\n this.dynamicActions = false;\n\n if (this.variant === \"overflow\") {\n newActionsVisible = 0;\n } else if (this.variant === \"stack\") {\n newActionsVisible = this._actions.length <= 3 ? this._actions.length : 2;\n }\n }\n\n this.actionsCollapsed = this._actions.slice(newActionsVisible);\n }\n\n private handleResize = () => {\n if (this.debounceResize) {\n window.cancelAnimationFrame(this.debounceResize);\n }\n\n this.debounceResize = requestAnimationFrame(this.update);\n }\n\n private mediaChangeHandler = () => {\n this.actionsCollapsed = [];\n requestAnimationFrame(this.update);\n }\n\n async componentWillLoad() {\n this.actionsWatcher(this.actions);\n\n if (!this.localization) {\n this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, \"actionset\");\n }\n }\n\n connectedCallback() {\n addMediaChangeListener(this.mediaChangeHandler);\n\n this.resizeObserver = new ResizeObserver(this.handleResize);\n this.resizeObserver.observe(this.element);\n }\n\n disconnectedCallback() {\n removeMediaChangeListener(this.mediaChangeHandler);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n }\n\n componentDidLoad() {\n this.update();\n }\n\n render() {\n const classes = {\n \"stzh-actionset\": true,\n // \"stzh-actionset--has-dynamic-actions\": this.dynamicActions,\n \"stzh-actionset--has-collapsed-items\": this.actionsCollapsed.length > 0,\n [`stzh-actionset--${this.variant}`]: !!this.variant\n };\n\n const Action = (action: StzhActionsetItem) => (\n <stzh-button\n class={{\n \"stzh-actionset__action\": true,\n \"is-button\": true,\n // \"show-medium\": !action.onlyCollapseText,\n // \"hide-when-collapsed\": !action.onlyCollapseText,\n // \"hide-text-when-collapsed\": action.onlyCollapseText\n }}\n icon={action.icon}\n iconPosition={action.iconPosition}\n iconOnly={action.iconOnly}\n badge={action.badge}\n variant={action.variant\n ? action.variant\n : (this.variant === \"stack\" ? \"secondary\" : \"tertiary\")}\n size={action.size\n ? action.size\n : (this.variant === \"stack\" ? \"default\" : \"tiny\")}\n badgePosition=\"icon\"\n onClick={(e) => { this.actionClick(action, e) }}\n >\n <span\n class={{\n // \"show-medium\": action.onlyCollapseText,\n // \"hide-when-collapsed\": action.onlyCollapseText\n }}\n >\n {action.label}\n </span>\n </stzh-button>\n );\n\n return (\n <Host has-collapsed-items={this.actionsCollapsed.length > 0}>\n <div class={classes}>\n <div class=\"stzh-actionset__actions\" role=\"group\">\n <div\n ref={(el) => (this.actionsElement = el as HTMLElement)}\n class=\"stzh-actionset__actions-wrapper\"\n >\n {this._actions.map(action => (\n (this.dynamicActions\n || (!this.dynamicActions &&\n this.actionsCollapsed.indexOf(action) === -1))\n &&\n (action.tooltipContent\n ?\n <stzh-tooltip\n strategy=\"fixed\"\n content={action.tooltipContent}\n >\n {Action(action)}\n </stzh-tooltip>\n :\n Action(action))\n ))}\n </div>\n\n <stzh-popover\n label={this.variant === \"stack\"\n ? this.localization.furtherActions\n : (!this.isMedium ? this.localization.actions : \"\")}\n strategy=\"fixed\"\n placement={this.popoverPlacement}\n class=\"stzh-actionset__action-popover\"\n >\n <stzh-button\n fullwidth\n disabled={this.actionsCollapsed.length === 0}\n class=\"stzh-actionset__action is-further\"\n variant={this.popoverButtonVariant !== \"\"\n ? this.popoverButtonVariant\n : (this.variant === \"stack\" ? \"secondary\" : \"tertiary\")}\n size={this.popoverButtonSize !== \"\"\n ? this.popoverButtonSize\n : (this.variant === \"stack\" ? \"default\" : \"tiny\")}\n icon={this.variant === \"stack\" ? \"angle-down\" : \"more-vertical\"}\n iconOnly={this.variant === \"overflow\" && this.isMedium}\n iconPosition=\"right\"\n label={this.variant === \"stack\"\n ? this.localization.furtherActions\n : (!this.isMedium ? this.localization.actions : \"\")}\n ></stzh-button>\n <stzh-menu slot=\"content\">\n {this.actionsCollapsed.map(action => (\n <stzh-menu-item\n // class=\"hide-medium show-when-collapsed\"\n icon={action.icon}\n badge={action.badge}\n badgeEmpty={action.badgeEmpty}\n badgeType={action.badgeType}\n onClick={(e) => { this.actionClick(action, e) }}\n >\n {action.label}\n </stzh-menu-item>\n ))}\n </stzh-menu>\n </stzh-popover>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -120,7 +120,8 @@ const StzhButton = /*@__PURE__*/ proxyCustomElement(class StzhButton extends HTM
|
|
|
120
120
|
}
|
|
121
121
|
componentDidRender() {
|
|
122
122
|
requestAnimationFrame(() => {
|
|
123
|
-
|
|
123
|
+
var _a;
|
|
124
|
+
(_a = this.button) === null || _a === void 0 ? void 0 : _a.setAttribute("s-object-id", this.analyticsId || this.text.innerText);
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
127
|
render() {
|