@tabler/core 1.0.0-beta10 → 1.0.0-beta12
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/README.md +66 -21
- package/dist/css/demo.css +251 -379
- package/dist/css/demo.min.css +3 -3
- package/dist/css/demo.rtl.css +251 -379
- package/dist/css/demo.rtl.min.css +3 -3
- package/dist/css/tabler-flags.css +266 -529
- package/dist/css/tabler-flags.min.css +3 -3
- package/dist/css/tabler-flags.rtl.css +266 -529
- package/dist/css/tabler-flags.rtl.min.css +3 -3
- package/dist/css/tabler-payments.css +127 -252
- package/dist/css/tabler-payments.min.css +2 -2
- package/dist/css/tabler-payments.rtl.css +127 -252
- package/dist/css/tabler-payments.rtl.min.css +2 -2
- package/dist/css/tabler-vendors.css +526 -611
- package/dist/css/tabler-vendors.min.css +3 -3
- package/dist/css/tabler-vendors.rtl.css +526 -611
- package/dist/css/tabler-vendors.rtl.min.css +3 -3
- package/dist/css/tabler.css +11259 -13083
- package/dist/css/tabler.min.css +4 -4
- package/dist/css/tabler.rtl.css +11251 -13090
- package/dist/css/tabler.rtl.min.css +4 -4
- package/dist/js/demo-theme.js +32 -0
- package/dist/js/demo-theme.min.js +9 -0
- package/dist/js/demo.js +2 -12
- package/dist/js/demo.min.js +3 -3
- package/dist/js/tabler.esm.js +1692 -1541
- package/dist/js/tabler.esm.min.js +9 -3
- package/dist/js/tabler.js +1687 -1514
- package/dist/js/tabler.min.js +9 -3
- package/dist/libs/apexcharts/dist/apexcharts.amd.js +2 -0
- package/dist/libs/apexcharts/dist/apexcharts.common.js +14 -0
- package/dist/libs/apexcharts/dist/apexcharts.css +691 -0
- package/dist/libs/apexcharts/dist/apexcharts.esm.js +14 -0
- package/dist/libs/apexcharts/dist/apexcharts.js +31979 -0
- package/dist/libs/apexcharts/dist/apexcharts.min.js +4 -4
- package/dist/libs/apexcharts/dist/locales/ar.json +63 -0
- package/dist/libs/apexcharts/dist/locales/ca.json +55 -0
- package/dist/libs/apexcharts/dist/locales/cs.json +55 -0
- package/dist/libs/apexcharts/dist/locales/de.json +55 -0
- package/dist/libs/apexcharts/dist/locales/el.json +55 -0
- package/dist/libs/apexcharts/dist/locales/en.json +55 -0
- package/dist/libs/apexcharts/dist/locales/es.json +55 -0
- package/dist/libs/apexcharts/dist/locales/et.json +63 -0
- package/dist/libs/apexcharts/dist/locales/fa.json +55 -0
- package/dist/libs/apexcharts/dist/locales/fi.json +55 -0
- package/dist/libs/apexcharts/dist/locales/fr.json +55 -0
- package/dist/libs/apexcharts/dist/locales/he.json +55 -0
- package/dist/libs/apexcharts/dist/locales/hi.json +55 -0
- package/dist/libs/apexcharts/dist/locales/hr.json +55 -0
- package/dist/libs/apexcharts/dist/locales/hu.json +64 -0
- package/dist/libs/apexcharts/dist/locales/hy.json +55 -0
- package/dist/libs/apexcharts/dist/locales/id.json +47 -0
- package/dist/libs/apexcharts/dist/locales/it.json +55 -0
- package/dist/libs/apexcharts/dist/locales/ja.json +55 -0
- package/dist/libs/apexcharts/dist/locales/ka.json +55 -0
- package/dist/libs/apexcharts/dist/locales/ko.json +55 -0
- package/dist/libs/apexcharts/dist/locales/lt.json +55 -0
- package/dist/libs/apexcharts/dist/locales/lv.json +64 -0
- package/dist/libs/apexcharts/dist/locales/nb.json +55 -0
- package/dist/libs/apexcharts/dist/locales/nl.json +55 -0
- package/dist/libs/apexcharts/dist/locales/pl.json +55 -0
- package/dist/libs/apexcharts/dist/locales/pt-br.json +55 -0
- package/dist/libs/apexcharts/dist/locales/pt.json +55 -0
- package/dist/libs/apexcharts/dist/locales/rs.json +55 -0
- package/dist/libs/apexcharts/dist/locales/ru.json +55 -0
- package/dist/libs/apexcharts/dist/locales/se.json +55 -0
- package/dist/libs/apexcharts/dist/locales/sk.json +55 -0
- package/dist/libs/apexcharts/dist/locales/sl.json +55 -0
- package/dist/libs/apexcharts/dist/locales/sq.json +55 -0
- package/dist/libs/apexcharts/dist/locales/th.json +55 -0
- package/dist/libs/apexcharts/dist/locales/tr.json +55 -0
- package/dist/libs/apexcharts/dist/locales/ua.json +55 -0
- package/dist/libs/apexcharts/dist/locales/zh-cn.json +55 -0
- package/dist/libs/apexcharts/dist/locales/zh-tw.json +55 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +7090 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +3 -3
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +5217 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.js +5264 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.min.js +7 -0
- package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -0
- package/dist/libs/countup.js/dist/countUp.d.ts +61 -0
- package/dist/libs/countup.js/dist/countUp.js +25 -22
- package/dist/libs/countup.js/dist/countUp.min.js +1 -0
- package/dist/libs/countup.js/dist/countUp.umd.js +293 -0
- package/dist/libs/countup.js/dist/countUp.withPolyfill.min.js +1 -0
- package/dist/libs/dropzone/dist/basic.css +1 -0
- package/dist/libs/dropzone/dist/basic.css.map +1 -0
- package/dist/libs/dropzone/dist/dropzone-min.js +2 -0
- package/dist/libs/dropzone/dist/dropzone-min.js.map +1 -0
- package/dist/libs/dropzone/dist/dropzone.css +1 -0
- package/dist/libs/dropzone/dist/dropzone.css.map +1 -0
- package/dist/libs/dropzone/dist/dropzone.js +3068 -0
- package/dist/libs/dropzone/dist/dropzone.js.map +1 -0
- package/dist/libs/dropzone/dist/dropzone.mjs +2111 -0
- package/dist/libs/dropzone/dist/dropzone.mjs.map +1 -0
- package/dist/libs/fslightbox/LICENSE +21 -0
- package/dist/libs/fslightbox/README.md +62 -0
- package/dist/libs/fslightbox/index.js +1 -0
- package/dist/libs/fslightbox/jest-setup.js +1 -0
- package/dist/libs/fslightbox/package.json +72 -0
- package/dist/libs/jsvectormap/dist/js/jsvectormap.js +2658 -0
- package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -1
- package/dist/libs/jsvectormap/dist/maps/world-merc.js +1 -1
- package/dist/libs/jsvectormap/dist/maps/world.js +1 -1
- package/dist/libs/list.js/dist/list.js +2020 -0
- package/dist/libs/list.js/dist/list.js.map +1 -0
- package/dist/libs/list.js/dist/list.min.js.map +1 -0
- package/dist/libs/litepicker/dist/bundle.js +52 -0
- package/dist/libs/litepicker/dist/css/litepicker.css +13 -0
- package/dist/libs/litepicker/dist/css/plugins/keyboardnav.js.css +12 -0
- package/dist/libs/litepicker/dist/css/plugins/mobilefriendly.js.css +133 -0
- package/dist/libs/litepicker/dist/css/plugins/multiselect.js.css +54 -0
- package/dist/libs/litepicker/dist/css/plugins/ranges.js.css +81 -0
- package/dist/libs/litepicker/dist/js/main.js +13 -0
- package/dist/libs/litepicker/dist/litepicker.amd.js +12 -0
- package/dist/libs/litepicker/dist/litepicker.commonjs2.js +12 -0
- package/dist/libs/litepicker/dist/litepicker.umd.js +12 -0
- package/dist/libs/litepicker/dist/nocss/litepicker.amd.js +12 -0
- package/dist/libs/litepicker/dist/nocss/litepicker.commonjs2.js +12 -0
- package/dist/libs/litepicker/dist/nocss/litepicker.js +12 -0
- package/dist/libs/litepicker/dist/nocss/litepicker.umd.js +12 -0
- package/dist/libs/litepicker/dist/nocss/plugins/keyboardnav.js +11 -0
- package/dist/libs/litepicker/dist/nocss/plugins/mobilefriendly.js +11 -0
- package/dist/libs/litepicker/dist/nocss/plugins/multiselect.js +11 -0
- package/dist/libs/litepicker/dist/nocss/plugins/ranges.js +11 -0
- package/dist/libs/litepicker/dist/plugins/keyboardnav.js +11 -0
- package/dist/libs/litepicker/dist/plugins/mobilefriendly.js +11 -0
- package/dist/libs/litepicker/dist/plugins/multiselect.js +11 -0
- package/dist/libs/litepicker/dist/plugins/ranges.js +11 -0
- package/dist/libs/litepicker/dist/types/calendar.d.ts +14 -0
- package/dist/libs/litepicker/dist/types/core.d.ts +23 -0
- package/dist/libs/litepicker/dist/types/datetime.d.ts +41 -0
- package/dist/libs/litepicker/dist/types/index.d.ts +4 -0
- package/dist/libs/litepicker/dist/types/interfaces.d.ts +80 -0
- package/dist/libs/litepicker/dist/types/litepicker.d.ts +25 -0
- package/dist/libs/litepicker/dist/types/methods.d.ts +20 -0
- package/dist/libs/litepicker/dist/types/utils.d.ts +4 -0
- package/dist/libs/litepicker/dist/types/window.d.ts +6 -0
- package/dist/libs/nouislider/dist/nouislider.css +304 -0
- package/dist/libs/nouislider/dist/nouislider.d.ts +198 -0
- package/dist/libs/nouislider/dist/nouislider.js +2254 -0
- package/dist/libs/nouislider/dist/nouislider.min.css +1 -0
- package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
- package/dist/libs/nouislider/dist/nouislider.min.mjs +1 -0
- package/dist/libs/nouislider/dist/nouislider.mjs +2243 -0
- package/dist/libs/plyr/dist/plyr.css +1 -0
- package/dist/libs/plyr/dist/plyr.js +8764 -0
- package/dist/libs/plyr/dist/plyr.min.js +2 -0
- package/dist/libs/plyr/dist/plyr.min.js.map +1 -0
- package/dist/libs/plyr/dist/plyr.min.mjs +1 -0
- package/dist/libs/plyr/dist/plyr.min.mjs.map +1 -0
- package/dist/libs/plyr/dist/plyr.mjs +8756 -0
- package/dist/libs/plyr/dist/plyr.polyfilled.js +9301 -0
- package/dist/libs/plyr/dist/plyr.polyfilled.min.js +2 -0
- package/dist/libs/plyr/dist/plyr.polyfilled.min.js.map +1 -0
- package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs +1 -0
- package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs.map +1 -0
- package/dist/libs/plyr/dist/plyr.polyfilled.mjs +9293 -0
- package/dist/libs/plyr/dist/plyr.svg +1 -0
- package/dist/libs/tinymce/CHANGELOG.md +2957 -0
- package/dist/libs/tinymce/README.md +71 -0
- package/dist/libs/tinymce/bower.json +27 -0
- package/dist/libs/tinymce/composer.json +52 -0
- package/dist/libs/tinymce/icons/default/icons.js +182 -0
- package/dist/libs/tinymce/icons/default/icons.min.js +1 -0
- package/dist/libs/tinymce/icons/default/index.js +7 -0
- package/dist/libs/tinymce/license.txt +21 -0
- package/dist/libs/tinymce/models/dom/index.js +7 -0
- package/dist/libs/tinymce/models/dom/model.js +7975 -0
- package/dist/libs/tinymce/models/dom/model.min.js +4 -0
- package/dist/libs/tinymce/package.json +32 -0
- package/dist/libs/tinymce/plugins/advlist/index.js +7 -0
- package/dist/libs/tinymce/plugins/advlist/plugin.js +246 -0
- package/dist/libs/tinymce/plugins/advlist/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/anchor/index.js +7 -0
- package/dist/libs/tinymce/plugins/anchor/plugin.js +195 -0
- package/dist/libs/tinymce/plugins/anchor/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/autolink/index.js +7 -0
- package/dist/libs/tinymce/plugins/autolink/plugin.js +232 -0
- package/dist/libs/tinymce/plugins/autolink/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/autoresize/index.js +7 -0
- package/dist/libs/tinymce/plugins/autoresize/plugin.js +156 -0
- package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/autosave/index.js +7 -0
- package/dist/libs/tinymce/plugins/autosave/plugin.js +232 -0
- package/dist/libs/tinymce/plugins/autosave/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/charmap/index.js +7 -0
- package/dist/libs/tinymce/plugins/charmap/plugin.js +1636 -0
- package/dist/libs/tinymce/plugins/charmap/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/code/index.js +7 -0
- package/dist/libs/tinymce/plugins/code/plugin.js +85 -0
- package/dist/libs/tinymce/plugins/code/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/codesample/index.js +7 -0
- package/dist/libs/tinymce/plugins/codesample/plugin.js +2451 -0
- package/dist/libs/tinymce/plugins/codesample/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/directionality/index.js +7 -0
- package/dist/libs/tinymce/plugins/directionality/plugin.js +384 -0
- package/dist/libs/tinymce/plugins/directionality/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/emoticons/index.js +7 -0
- package/dist/libs/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
- package/dist/libs/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
- package/dist/libs/tinymce/plugins/emoticons/js/emojis.js +1 -0
- package/dist/libs/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
- package/dist/libs/tinymce/plugins/emoticons/plugin.js +577 -0
- package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/fullscreen/index.js +7 -0
- package/dist/libs/tinymce/plugins/fullscreen/plugin.js +1190 -0
- package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/help/index.js +7 -0
- package/dist/libs/tinymce/plugins/help/plugin.js +848 -0
- package/dist/libs/tinymce/plugins/help/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/image/index.js +7 -0
- package/dist/libs/tinymce/plugins/image/plugin.js +1475 -0
- package/dist/libs/tinymce/plugins/image/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/importcss/index.js +7 -0
- package/dist/libs/tinymce/plugins/importcss/plugin.js +342 -0
- package/dist/libs/tinymce/plugins/importcss/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/insertdatetime/index.js +7 -0
- package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +176 -0
- package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/link/index.js +7 -0
- package/dist/libs/tinymce/plugins/link/plugin.js +1190 -0
- package/dist/libs/tinymce/plugins/link/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/lists/index.js +7 -0
- package/dist/libs/tinymce/plugins/lists/plugin.js +1820 -0
- package/dist/libs/tinymce/plugins/lists/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/media/index.js +7 -0
- package/dist/libs/tinymce/plugins/media/plugin.js +1157 -0
- package/dist/libs/tinymce/plugins/media/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/nonbreaking/index.js +7 -0
- package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +111 -0
- package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/pagebreak/index.js +7 -0
- package/dist/libs/tinymce/plugins/pagebreak/plugin.js +105 -0
- package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/preview/index.js +7 -0
- package/dist/libs/tinymce/plugins/preview/plugin.js +97 -0
- package/dist/libs/tinymce/plugins/preview/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/quickbars/index.js +7 -0
- package/dist/libs/tinymce/plugins/quickbars/plugin.js +421 -0
- package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/save/index.js +7 -0
- package/dist/libs/tinymce/plugins/save/plugin.js +118 -0
- package/dist/libs/tinymce/plugins/save/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/searchreplace/index.js +7 -0
- package/dist/libs/tinymce/plugins/searchreplace/plugin.js +1079 -0
- package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/table/index.js +7 -0
- package/dist/libs/tinymce/plugins/table/plugin.js +3393 -0
- package/dist/libs/tinymce/plugins/table/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/template/index.js +7 -0
- package/dist/libs/tinymce/plugins/template/plugin.js +548 -0
- package/dist/libs/tinymce/plugins/template/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/visualblocks/index.js +7 -0
- package/dist/libs/tinymce/plugins/visualblocks/plugin.js +98 -0
- package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/visualchars/index.js +7 -0
- package/dist/libs/tinymce/plugins/visualchars/plugin.js +506 -0
- package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +4 -0
- package/dist/libs/tinymce/plugins/wordcount/index.js +7 -0
- package/dist/libs/tinymce/plugins/wordcount/plugin.js +404 -0
- package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +4 -0
- package/dist/libs/tinymce/skins/content/dark/content.css +66 -0
- package/dist/libs/tinymce/skins/content/dark/content.min.css +1 -0
- package/dist/libs/tinymce/skins/content/default/content.css +61 -0
- package/dist/libs/tinymce/skins/content/default/content.min.css +1 -0
- package/dist/libs/tinymce/skins/content/document/content.css +66 -0
- package/dist/libs/tinymce/skins/content/document/content.min.css +1 -0
- package/dist/libs/tinymce/skins/content/tinymce-5/content.css +61 -0
- package/dist/libs/tinymce/skins/content/tinymce-5/content.min.css +1 -0
- package/dist/libs/tinymce/skins/content/tinymce-5-dark/content.css +66 -0
- package/dist/libs/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
- package/dist/libs/tinymce/skins/content/writer/content.css +62 -0
- package/dist/libs/tinymce/skins/content/writer/content.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide/content.css +747 -0
- package/dist/libs/tinymce/skins/ui/oxide/content.inline.css +741 -0
- package/dist/libs/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide/content.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide/skin.css +3074 -0
- package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide/skin.shadowdom.css +30 -0
- package/dist/libs/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/content.css +728 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.css +741 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +3077 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +30 -0
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/content.css +747 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.css +741 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +3158 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.css +728 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.css +741 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +3158 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
- package/dist/libs/tinymce/themes/silver/index.js +7 -0
- package/dist/libs/tinymce/themes/silver/theme.js +26184 -0
- package/dist/libs/tinymce/themes/silver/theme.min.js +4 -0
- package/dist/libs/tinymce/tinymce.d.ts +2895 -0
- package/dist/libs/tinymce/tinymce.js +29400 -0
- package/dist/libs/tinymce/tinymce.min.js +4 -0
- package/dist/libs/tom-select/dist/js/plugins/caret_position.js +170 -0
- package/dist/libs/tom-select/dist/js/plugins/caret_position.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/change_listener.js +58 -0
- package/dist/libs/tom-select/dist/js/plugins/change_listener.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js +182 -0
- package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/clear_button.js +99 -0
- package/dist/libs/tom-select/dist/js/plugins/clear_button.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/drag_drop.js +70 -0
- package/dist/libs/tom-select/dist/js/plugins/drag_drop.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js +126 -0
- package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js +240 -0
- package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js +84 -0
- package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/no_active_items.js +33 -0
- package/dist/libs/tom-select/dist/js/plugins/no_active_items.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js +40 -0
- package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js +117 -0
- package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/remove_button.js +154 -0
- package/dist/libs/tom-select/dist/js/plugins/remove_button.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js +51 -0
- package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js.map +1 -0
- package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js +279 -0
- package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js.map +1 -0
- package/dist/libs/tom-select/dist/js/tom-select.base.js +4165 -0
- package/dist/libs/tom-select/dist/js/tom-select.base.js.map +1 -0
- package/dist/libs/tom-select/dist/js/tom-select.base.min.js +144 -144
- package/dist/libs/tom-select/dist/js/tom-select.base.min.js.map +1 -0
- package/dist/libs/tom-select/dist/js/tom-select.complete.js +4978 -0
- package/dist/libs/tom-select/dist/js/tom-select.complete.js.map +1 -0
- package/dist/libs/tom-select/dist/js/tom-select.complete.min.js +363 -0
- package/dist/libs/tom-select/dist/js/tom-select.complete.min.js.map +1 -0
- package/dist/libs/tom-select/dist/js/tom-select.popular.js +4419 -0
- package/dist/libs/tom-select/dist/js/tom-select.popular.js.map +1 -0
- package/dist/libs/tom-select/dist/js/tom-select.popular.min.js +323 -0
- package/dist/libs/tom-select/dist/js/tom-select.popular.min.js.map +1 -0
- package/package.json +100 -33
- package/src/js/demo-theme.js +25 -0
- package/src/js/demo.js +0 -17
- package/src/js/src/tabler.js +17 -0
- package/src/js/tabler.js +2 -0
- package/src/scss/_bootstrap-components.scss +1 -1
- package/src/scss/_bootstrap-config.scss +1 -0
- package/src/scss/_core.scss +2 -0
- package/src/scss/_utilities.scss +2 -2
- package/src/scss/_variables.scss +218 -92
- package/src/scss/demo/_examples.scss +2 -2
- package/src/scss/demo/_highlight.scss +3 -3
- package/src/scss/demo.scss +5 -5
- package/src/scss/fonts/_webfonts.scss +0 -50
- package/src/scss/layout/_core.scss +10 -23
- package/src/scss/layout/_dark.scss +22 -16
- package/src/scss/layout/_footer.scss +2 -2
- package/src/scss/layout/_navbar.scss +18 -15
- package/src/scss/layout/_page.scss +8 -6
- package/src/scss/layout/_root.scss +37 -0
- package/src/scss/mixins/_functions.scss +2 -16
- package/src/scss/mixins/_mixins.scss +32 -5
- package/src/scss/tabler-vendors.scss +4 -0
- package/src/scss/ui/_accordion.scss +5 -1
- package/src/scss/ui/_alerts.scss +8 -8
- package/src/scss/ui/_avatars.scss +14 -14
- package/src/scss/ui/_badges.scss +2 -2
- package/src/scss/ui/_breadcrumbs.scss +1 -1
- package/src/scss/ui/_buttons.scss +100 -108
- package/src/scss/ui/_calendars.scss +8 -8
- package/src/scss/ui/_cards.scss +46 -52
- package/src/scss/ui/_carousel.scss +2 -2
- package/src/scss/ui/_chips.scss +0 -0
- package/src/scss/ui/_datagrid.scss +17 -0
- package/src/scss/ui/_empty.scss +3 -3
- package/src/scss/ui/_flags.scss +2 -2
- package/src/scss/ui/_forms.scss +12 -11
- package/src/scss/ui/_grid.scss +13 -14
- package/src/scss/ui/_icons.scss +64 -4
- package/src/scss/ui/_legend.scss +8 -4
- package/src/scss/ui/_lists.scss +17 -14
- package/src/scss/ui/_markdown.scss +2 -3
- package/src/scss/ui/_modals.scss +1 -1
- package/src/scss/ui/_nav.scss +7 -7
- package/src/scss/ui/_offcanvas.scss +3 -3
- package/src/scss/ui/_pagination.scss +10 -6
- package/src/scss/ui/_placeholder.scss +1 -1
- package/src/scss/ui/_progress.scss +45 -6
- package/src/scss/ui/_ribbons.scss +5 -5
- package/src/scss/ui/_status.scss +28 -27
- package/src/scss/ui/_steps.scss +2 -2
- package/src/scss/ui/_tables.scss +26 -5
- package/src/scss/ui/_toasts.scss +1 -2
- package/src/scss/ui/_type.scss +45 -30
- package/src/scss/ui/forms/_form-check.scss +26 -1
- package/src/scss/ui/forms/_form-colorinput.scss +2 -2
- package/src/scss/ui/forms/_form-custom.scss +2 -2
- package/src/scss/ui/forms/_form-icon.scss +1 -1
- package/src/scss/ui/forms/_form-imagecheck.scss +4 -4
- package/src/scss/ui/forms/_form-selectgroup.scss +7 -7
- package/src/scss/ui/forms/_validation.scss +1 -1
- package/src/scss/ui/typo/_hr.scss +2 -3
- package/src/scss/utils/_colors.scss +19 -8
- package/src/scss/vendor/_dropzone.scss +27 -0
- package/src/scss/vendor/_fslightbox.scss +13 -0
- package/src/scss/vendor/_jsvectormap.scss +8 -8
- package/src/scss/vendor/_litepicker.scss +14 -14
- package/src/scss/vendor/_plyr.scss +3 -0
- package/src/scss/vendor/_tinymce.scss +25 -0
- package/src/scss/vendor/_tom-select.scss +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear_button.js","sources":["../../../node_modules/@orchidjs/sifter/lib/diacritics.ts","../../../src/vanilla.ts","../../../src/plugins/clear_button/plugin.ts"],"sourcesContent":["\n// @ts-ignore TS2691 \"An import path cannot end with a '.ts' extension\"\nimport { escape_regex } from './utils.ts';\n\ntype TDiacraticList = {[key:string]:string};\n\n// https://github.com/andrewrk/node-diacritics/blob/master/index.js\n\nvar latin_pat:RegExp;\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}]'; // \\u{2bc}\nconst accent_reg = new RegExp(accent_pat,'gu');\nvar diacritic_patterns:TDiacraticList;\n\nconst latin_convert:TDiacraticList = {\n\t'æ': 'ae',\n\t'ⱥ': 'a',\n\t'ø': 'o',\n};\n\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|'),'gu');\n\nconst code_points:[[number,number]] = [[ 0, 65535 ]];\n\n/**\n * Remove accents\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n *\n */\nexport const asciifold = (str:string):string => {\n\treturn str\n\t\t.normalize('NFKD')\n\t\t.replace(accent_reg, '')\n\t\t.toLowerCase()\n\t\t.replace(convert_pat,function(foreignletter) {\n\t\t\treturn latin_convert[foreignletter];\n\t\t});\n};\n\n/**\n * Convert array of strings to a regular expression\n *\tex ['ab','a'] => (?:ab|a)\n * \tex ['a','b'] => [ab]\n *\n */\nexport const arrayToPattern = (chars:string[],glue:string='|'):string =>{\n\n\tif( chars.length == 1 ){\n\t\treturn chars[0];\n\t}\n\n\tvar longest = 1;\n\tchars.forEach((a)=>{longest = Math.max(longest,a.length)});\n\n\tif( longest == 1 ){\n\t\treturn '['+chars.join('')+']';\n\t}\n\n\treturn '(?:'+chars.join(glue)+')';\n};\n\nexport const escapeToPattern = (chars:string[]):string =>{\n\tconst escaped = chars.map((diacritic) => escape_regex(diacritic));\n\treturn arrayToPattern(escaped);\n};\n\n/**\n * Get all possible combinations of substrings that add up to the given string\n * https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string\n *\n */\nexport const allSubstrings = (input:string):string[][] => {\n\n if( input.length === 1) return [[input]];\n\n var result:string[][] = [];\n allSubstrings(input.substring(1)).forEach(function(subresult) {\n var tmp = subresult.slice(0);\n tmp[0] = input.charAt(0) + tmp[0];\n result.push(tmp);\n\n tmp = subresult.slice(0);\n tmp.unshift(input.charAt(0));\n result.push(tmp);\n });\n\n return result;\n}\n\n/**\n * Generate a list of diacritics from the list of code points\n *\n */\nexport const generateDiacritics = (code_points:[[number,number]]):TDiacraticList => {\n\n\tvar diacritics:{[key:string]:string[]} = {};\n\tcode_points.forEach((code_range)=>{\n\n\t\tfor(let i = code_range[0]; i <= code_range[1]; i++){\n\n\t\t\tlet diacritic\t= String.fromCharCode(i);\n\t\t\tlet\tlatin\t\t= asciifold(diacritic);\n\n\t\t\tif( latin == diacritic.toLowerCase() ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// skip when latin is a string longer than 3 characters long\n\t\t\t// bc the resulting regex patterns will be long\n\t\t\t// eg:\n\t\t\t// latin صلى الله عليه وسلم length 18 code point 65018\n\t\t\t// latin جل جلاله length 8 code point 65019\n\t\t\tif( latin.length > 3 ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif( !(latin in diacritics) ){\n\t\t\t\tdiacritics[latin] = [latin];\n\t\t\t}\n\n\t\t\tvar patt = new RegExp( escapeToPattern(diacritics[latin]),'iu');\n\t\t\tif( diacritic.match(patt) ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tdiacritics[latin].push(diacritic);\n\t\t}\n\t});\n\n\t// filter out if there's only one character in the list\n\tlet latin_chars = Object.keys(diacritics);\n\tfor( let i = 0; i < latin_chars.length; i++){\n\t\tconst latin = latin_chars[i];\n\t\tif( diacritics[latin].length < 2 ){\n\t\t\tdelete diacritics[latin];\n\t\t}\n\t}\n\n\n\t// latin character pattern\n\t// match longer substrings first\n\tlatin_chars\t\t= Object.keys(diacritics).sort((a, b) => b.length - a.length );\n\tlatin_pat\t\t= new RegExp('('+ escapeToPattern(latin_chars) + accent_pat + '*)','gu');\n\n\n\t// build diacritic patterns\n\t// ae needs:\n\t//\t(?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n\tvar diacritic_patterns:TDiacraticList = {};\n\tlatin_chars.sort((a,b) => a.length -b.length).forEach((latin)=>{\n\n\t\tvar substrings\t= allSubstrings(latin);\n\t\tvar pattern = substrings.map((sub_pat)=>{\n\n\t\t\tsub_pat = sub_pat.map((l)=>{\n\t\t\t\tif( diacritics.hasOwnProperty(l) ){\n\t\t\t\t\treturn escapeToPattern(diacritics[l]);\n\t\t\t\t}\n\t\t\t\treturn l;\n\t\t\t});\n\n\t\t\treturn arrayToPattern(sub_pat,'');\n\t\t});\n\n\t\tdiacritic_patterns[latin] = arrayToPattern(pattern);\n\t});\n\n\n\treturn diacritic_patterns;\n}\n\n/**\n * Expand a regular expression pattern to include diacritics\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n */\nexport const diacriticRegexPoints = (regex:string):string => {\n\n\tif( diacritic_patterns === undefined ){\n\t\tdiacritic_patterns = generateDiacritics(code_points);\n\t}\n\n\tconst decomposed\t\t= regex.normalize('NFKD').toLowerCase();\n\n\treturn decomposed.split(latin_pat).map((part:string)=>{\n\n\t\t// \"ffl\" or \"ffl\"\n\t\tconst no_accent = asciifold(part);\n\t\tif( no_accent == '' ){\n\t\t\treturn '';\n\t\t}\n\n\t\tif( diacritic_patterns.hasOwnProperty(no_accent) ){\n\t\t\treturn diacritic_patterns[no_accent];\n\t\t}\n\n\t\treturn part;\n\t}).join('');\n\n}\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","/**\n * Plugin: \"dropdown_header\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport { getDom } from '../../vanilla';\nimport { CBOptions } from './types';\n\nexport default function(this:TomSelect, userOptions:CBOptions) {\n\tconst self = this;\n\n\tconst options = Object.assign({\n\t\tclassName: 'clear-button',\n\t\ttitle: 'Clear All',\n\t\thtml: (data:CBOptions) => {\n\t\t\treturn `<div class=\"${data.className}\" title=\"${data.title}\">×</div>`;\n\t\t}\n\t}, userOptions);\n\n\tself.on('initialize',()=>{\n\t\tvar button = getDom(options.html(options));\n\t\tbutton.addEventListener('click',(evt)=>{\n\n\t\t\tif( self.isDisabled ){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tself.clear();\n\n\t\t\tif( self.settings.mode === 'single' && self.settings.allowEmptyOption ){\n\t\t\t\tself.addItem('');\n\t\t\t}\n\n\t\t\tevt.preventDefault();\n\t\t\tevt.stopPropagation();\n\t\t});\n\t\tself.control.appendChild(button);\n\t});\n\n};\n"],"names":["latin_convert","RegExp","Object","keys","join","getDom","query","jquery","HTMLElement","isHtmlString","div","document","createElement","innerHTML","trim","firstChild","querySelector","arg","indexOf","userOptions","self","options","assign","className","title","html","data","on","button","addEventListener","evt","isDisabled","clear","settings","mode","allowEmptyOption","addItem","preventDefault","stopPropagation","control","appendChild"],"mappings":";;;;;;;;;;;CACA;CAYA,MAAMA,aAA4B,GAAG;CACpC,OAAK,IAD+B;CAEpC,OAAK,GAF+B;CAGpC,OAAK;CAH+B,CAArC;CAMoB,IAAIC,MAAJ,CAAWC,MAAM,CAACC,IAAP,CAAYH,aAAZ,EAA2BI,IAA3B,CAAgC,GAAhC,CAAX,EAAgD,IAAhD;;CChBpB;CACA;CACA;CACA;CACA;CACA;;CACO,MAAMC,MAAM,GAAKC,KAAF,IAA6B;CAElD,MAAIA,KAAK,CAACC,MAAV,EAAkB;CACjB,WAAOD,KAAK,CAAC,CAAD,CAAZ;CACA;;CAED,MAAIA,KAAK,YAAYE,WAArB,EAAkC;CACjC,WAAOF,KAAP;CACA;;CAED,MAAIG,YAAY,CAACH,KAAD,CAAhB,EAAyB;CACxB,QAAII,GAAG,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAV;CACAF,IAAAA,GAAG,CAACG,SAAJ,GAAgBP,KAAK,CAACQ,IAAN,EAAhB,CAFwB;;CAGxB,WAAOJ,GAAG,CAACK,UAAX;CACA;;CAED,SAAOJ,QAAQ,CAACK,aAAT,CAAuBV,KAAvB,CAAP;CACA,CAjBM;CAmBA,MAAMG,YAAY,GAAIQ,GAAD,IAAsB;CACjD,MAAI,OAAOA,GAAP,KAAe,QAAf,IAA2BA,GAAG,CAACC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ache License, Version 2.0 (the "License");
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.drag_drop = factory());
|
|
10
|
+
})(this, (function () { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Plugin: "drag_drop" (Tom Select)
|
|
14
|
+
* Copyright (c) contributors
|
|
15
|
+
*
|
|
16
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
17
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
18
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
22
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
* governing permissions and limitations under the License.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
function plugin () {
|
|
27
|
+
var self = this;
|
|
28
|
+
if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
|
|
29
|
+
if (self.settings.mode !== 'multi') return;
|
|
30
|
+
var orig_lock = self.lock;
|
|
31
|
+
var orig_unlock = self.unlock;
|
|
32
|
+
self.hook('instead', 'lock', () => {
|
|
33
|
+
var sortable = $(self.control).data('sortable');
|
|
34
|
+
if (sortable) sortable.disable();
|
|
35
|
+
return orig_lock.call(self);
|
|
36
|
+
});
|
|
37
|
+
self.hook('instead', 'unlock', () => {
|
|
38
|
+
var sortable = $(self.control).data('sortable');
|
|
39
|
+
if (sortable) sortable.enable();
|
|
40
|
+
return orig_unlock.call(self);
|
|
41
|
+
});
|
|
42
|
+
self.on('initialize', () => {
|
|
43
|
+
var $control = $(self.control).sortable({
|
|
44
|
+
items: '[data-value]',
|
|
45
|
+
forcePlaceholderSize: true,
|
|
46
|
+
disabled: self.isLocked,
|
|
47
|
+
start: (e, ui) => {
|
|
48
|
+
ui.placeholder.css('width', ui.helper.css('width'));
|
|
49
|
+
$control.css({
|
|
50
|
+
overflow: 'visible'
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
stop: () => {
|
|
54
|
+
$control.css({
|
|
55
|
+
overflow: 'hidden'
|
|
56
|
+
});
|
|
57
|
+
var values = [];
|
|
58
|
+
$control.children('[data-value]').each(function () {
|
|
59
|
+
if (this.dataset.value) values.push(this.dataset.value);
|
|
60
|
+
});
|
|
61
|
+
self.setValue(values);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return plugin;
|
|
68
|
+
|
|
69
|
+
}));
|
|
70
|
+
//# sourceMappingURL=drag_drop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag_drop.js","sources":["../../../src/plugins/drag_drop/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"drag_drop\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\n\nexport default function(this:TomSelect) {\n\tvar self = this;\n\tif (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\tif (self.settings.mode !== 'multi') return;\n\n\tvar orig_lock\t\t= self.lock;\n\tvar orig_unlock\t\t= self.unlock;\n\n\tself.hook('instead','lock',()=>{\n\t\tvar sortable = $(self.control).data('sortable');\n\t\tif (sortable) sortable.disable();\n\t\treturn orig_lock.call(self);\n\t});\n\n\tself.hook('instead','unlock',()=>{\n\t\tvar sortable = $(self.control).data('sortable');\n\t\tif (sortable) sortable.enable();\n\t\treturn orig_unlock.call(self);\n\t});\n\n\tself.on('initialize',()=>{\n\t\tvar $control = $(self.control).sortable({\n\t\t\titems: '[data-value]',\n\t\t\tforcePlaceholderSize: true,\n\t\t\tdisabled: self.isLocked,\n\t\t\tstart: (e, ui) => {\n\t\t\t\tui.placeholder.css('width', ui.helper.css('width'));\n\t\t\t\t$control.css({overflow: 'visible'});\n\t\t\t},\n\t\t\tstop: ()=>{\n\t\t\t\t$control.css({overflow: 'hidden'});\n\n\t\t\t\tvar values:string[] = [];\n\t\t\t\t$control.children('[data-value]').each(function(this:HTMLElement){\n\t\t\t\t\tif( this.dataset.value ) values.push(this.dataset.value);\n\t\t\t\t});\n\n\t\t\t\tself.setValue(values);\n\t\t\t}\n\t\t});\n\n\t});\n\n};\n"],"names":["self","$","fn","sortable","Error","settings","mode","orig_lock","lock","orig_unlock","unlock","hook","control","data","disable","call","enable","on","$control","items","forcePlaceholderSize","disabled","isLocked","start","e","ui","placeholder","css","helper","overflow","stop","values","children","each","dataset","value","push","setValue"],"mappings":";;;;;;;;;;;CAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIe,mBAAyB;CACvC,MAAIA,IAAI,GAAG,IAAX;CACA,MAAI,CAACC,CAAC,CAACC,EAAF,CAAKC,QAAV,EAAoB,MAAM,IAAIC,KAAJ,CAAU,uDAAV,CAAN;CACpB,MAAIJ,IAAI,CAACK,QAAL,CAAcC,IAAd,KAAuB,OAA3B,EAAoC;CAEpC,MAAIC,SAAS,GAAIP,IAAI,CAACQ,IAAtB;CACA,MAAIC,WAAW,GAAIT,IAAI,CAACU,MAAxB;CAEAV,EAAAA,IAAI,CAACW,IAAL,CAAU,SAAV,EAAoB,MAApB,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CC,IAAlC,CAAuC,YAA0B;CAChE,cAAI,KAAKC,OAAL,CAAaC,KAAjB,EAAyBJ,MAAM,CAACK,IAAP,CAAY,KAAKF,OAAL,CAAaC,KAAzB;CACzB,SAFD;CAIAnC,QAAAA,IAAI,CAACqC,QAAL,CAAcN,MAAd;CACA;CAjBsC,KAAzB,CAAf;CAoBA,GArBD;CAuBA;;;;;;;;"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tom Select v2.1.0
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.dropdown_header = factory());
|
|
10
|
+
})(this, (function () { 'use strict';
|
|
11
|
+
|
|
12
|
+
// @ts-ignore TS2691 "An import path cannot end with a '.ts' extension"
|
|
13
|
+
const latin_convert = {
|
|
14
|
+
'æ': 'ae',
|
|
15
|
+
'ⱥ': 'a',
|
|
16
|
+
'ø': 'o'
|
|
17
|
+
};
|
|
18
|
+
new RegExp(Object.keys(latin_convert).join('|'), 'gu');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
|
22
|
+
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
|
23
|
+
*
|
|
24
|
+
* param query should be {}
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const getDom = query => {
|
|
28
|
+
if (query.jquery) {
|
|
29
|
+
return query[0];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (query instanceof HTMLElement) {
|
|
33
|
+
return query;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (isHtmlString(query)) {
|
|
37
|
+
let div = document.createElement('div');
|
|
38
|
+
div.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
|
39
|
+
|
|
40
|
+
return div.firstChild;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return document.querySelector(query);
|
|
44
|
+
};
|
|
45
|
+
const isHtmlString = arg => {
|
|
46
|
+
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Converts a scalar to its best string representation
|
|
55
|
+
* for hash keys and HTML attribute values.
|
|
56
|
+
*
|
|
57
|
+
* Transformations:
|
|
58
|
+
* 'str' -> 'str'
|
|
59
|
+
* null -> ''
|
|
60
|
+
* undefined -> ''
|
|
61
|
+
* true -> '1'
|
|
62
|
+
* false -> '0'
|
|
63
|
+
* 0 -> '0'
|
|
64
|
+
* 1 -> '1'
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Prevent default
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
const preventDefault = (evt, stop = false) => {
|
|
73
|
+
if (evt) {
|
|
74
|
+
evt.preventDefault();
|
|
75
|
+
|
|
76
|
+
if (stop) {
|
|
77
|
+
evt.stopPropagation();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Plugin: "dropdown_header" (Tom Select)
|
|
84
|
+
* Copyright (c) contributors
|
|
85
|
+
*
|
|
86
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
87
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
88
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
89
|
+
*
|
|
90
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
91
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
92
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
93
|
+
* governing permissions and limitations under the License.
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
function plugin (userOptions) {
|
|
97
|
+
const self = this;
|
|
98
|
+
const options = Object.assign({
|
|
99
|
+
title: 'Untitled',
|
|
100
|
+
headerClass: 'dropdown-header',
|
|
101
|
+
titleRowClass: 'dropdown-header-title',
|
|
102
|
+
labelClass: 'dropdown-header-label',
|
|
103
|
+
closeClass: 'dropdown-header-close',
|
|
104
|
+
html: data => {
|
|
105
|
+
return '<div class="' + data.headerClass + '">' + '<div class="' + data.titleRowClass + '">' + '<span class="' + data.labelClass + '">' + data.title + '</span>' + '<a class="' + data.closeClass + '">×</a>' + '</div>' + '</div>';
|
|
106
|
+
}
|
|
107
|
+
}, userOptions);
|
|
108
|
+
self.on('initialize', () => {
|
|
109
|
+
var header = getDom(options.html(options));
|
|
110
|
+
var close_link = header.querySelector('.' + options.closeClass);
|
|
111
|
+
|
|
112
|
+
if (close_link) {
|
|
113
|
+
close_link.addEventListener('click', evt => {
|
|
114
|
+
preventDefault(evt, true);
|
|
115
|
+
self.close();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
self.dropdown.insertBefore(header, self.dropdown.firstChild);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return plugin;
|
|
124
|
+
|
|
125
|
+
}));
|
|
126
|
+
//# sourceMappingURL=dropdown_header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown_header.js","sources":["../../../node_modules/@orchidjs/sifter/lib/diacritics.ts","../../../src/vanilla.ts","../../../src/utils.ts","../../../src/plugins/dropdown_header/plugin.ts"],"sourcesContent":["\n// @ts-ignore TS2691 \"An import path cannot end with a '.ts' extension\"\nimport { escape_regex } from './utils.ts';\n\ntype TDiacraticList = {[key:string]:string};\n\n// https://github.com/andrewrk/node-diacritics/blob/master/index.js\n\nvar latin_pat:RegExp;\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}]'; // \\u{2bc}\nconst accent_reg = new RegExp(accent_pat,'gu');\nvar diacritic_patterns:TDiacraticList;\n\nconst latin_convert:TDiacraticList = {\n\t'æ': 'ae',\n\t'ⱥ': 'a',\n\t'ø': 'o',\n};\n\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|'),'gu');\n\nconst code_points:[[number,number]] = [[ 0, 65535 ]];\n\n/**\n * Remove accents\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n *\n */\nexport const asciifold = (str:string):string => {\n\treturn str\n\t\t.normalize('NFKD')\n\t\t.replace(accent_reg, '')\n\t\t.toLowerCase()\n\t\t.replace(convert_pat,function(foreignletter) {\n\t\t\treturn latin_convert[foreignletter];\n\t\t});\n};\n\n/**\n * Convert array of strings to a regular expression\n *\tex ['ab','a'] => (?:ab|a)\n * \tex ['a','b'] => [ab]\n *\n */\nexport const arrayToPattern = (chars:string[],glue:string='|'):string =>{\n\n\tif( chars.length == 1 ){\n\t\treturn chars[0];\n\t}\n\n\tvar longest = 1;\n\tchars.forEach((a)=>{longest = Math.max(longest,a.length)});\n\n\tif( longest == 1 ){\n\t\treturn '['+chars.join('')+']';\n\t}\n\n\treturn '(?:'+chars.join(glue)+')';\n};\n\nexport const escapeToPattern = (chars:string[]):string =>{\n\tconst escaped = chars.map((diacritic) => escape_regex(diacritic));\n\treturn arrayToPattern(escaped);\n};\n\n/**\n * Get all possible combinations of substrings that add up to the given string\n * https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string\n *\n */\nexport const allSubstrings = (input:string):string[][] => {\n\n if( input.length === 1) return [[input]];\n\n var result:string[][] = [];\n allSubstrings(input.substring(1)).forEach(function(subresult) {\n var tmp = subresult.slice(0);\n tmp[0] = input.charAt(0) + tmp[0];\n result.push(tmp);\n\n tmp = subresult.slice(0);\n tmp.unshift(input.charAt(0));\n result.push(tmp);\n });\n\n return result;\n}\n\n/**\n * Generate a list of diacritics from the list of code points\n *\n */\nexport const generateDiacritics = (code_points:[[number,number]]):TDiacraticList => {\n\n\tvar diacritics:{[key:string]:string[]} = {};\n\tcode_points.forEach((code_range)=>{\n\n\t\tfor(let i = code_range[0]; i <= code_range[1]; i++){\n\n\t\t\tlet diacritic\t= String.fromCharCode(i);\n\t\t\tlet\tlatin\t\t= asciifold(diacritic);\n\n\t\t\tif( latin == diacritic.toLowerCase() ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// skip when latin is a string longer than 3 characters long\n\t\t\t// bc the resulting regex patterns will be long\n\t\t\t// eg:\n\t\t\t// latin صلى الله عليه وسلم length 18 code point 65018\n\t\t\t// latin جل جلاله length 8 code point 65019\n\t\t\tif( latin.length > 3 ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif( !(latin in diacritics) ){\n\t\t\t\tdiacritics[latin] = [latin];\n\t\t\t}\n\n\t\t\tvar patt = new RegExp( escapeToPattern(diacritics[latin]),'iu');\n\t\t\tif( diacritic.match(patt) ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tdiacritics[latin].push(diacritic);\n\t\t}\n\t});\n\n\t// filter out if there's only one character in the list\n\tlet latin_chars = Object.keys(diacritics);\n\tfor( let i = 0; i < latin_chars.length; i++){\n\t\tconst latin = latin_chars[i];\n\t\tif( diacritics[latin].length < 2 ){\n\t\t\tdelete diacritics[latin];\n\t\t}\n\t}\n\n\n\t// latin character pattern\n\t// match longer substrings first\n\tlatin_chars\t\t= Object.keys(diacritics).sort((a, b) => b.length - a.length );\n\tlatin_pat\t\t= new RegExp('('+ escapeToPattern(latin_chars) + accent_pat + '*)','gu');\n\n\n\t// build diacritic patterns\n\t// ae needs:\n\t//\t(?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n\tvar diacritic_patterns:TDiacraticList = {};\n\tlatin_chars.sort((a,b) => a.length -b.length).forEach((latin)=>{\n\n\t\tvar substrings\t= allSubstrings(latin);\n\t\tvar pattern = substrings.map((sub_pat)=>{\n\n\t\t\tsub_pat = sub_pat.map((l)=>{\n\t\t\t\tif( diacritics.hasOwnProperty(l) ){\n\t\t\t\t\treturn escapeToPattern(diacritics[l]);\n\t\t\t\t}\n\t\t\t\treturn l;\n\t\t\t});\n\n\t\t\treturn arrayToPattern(sub_pat,'');\n\t\t});\n\n\t\tdiacritic_patterns[latin] = arrayToPattern(pattern);\n\t});\n\n\n\treturn diacritic_patterns;\n}\n\n/**\n * Expand a regular expression pattern to include diacritics\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n */\nexport const diacriticRegexPoints = (regex:string):string => {\n\n\tif( diacritic_patterns === undefined ){\n\t\tdiacritic_patterns = generateDiacritics(code_points);\n\t}\n\n\tconst decomposed\t\t= regex.normalize('NFKD').toLowerCase();\n\n\treturn decomposed.split(latin_pat).map((part:string)=>{\n\n\t\t// \"ffl\" or \"ffl\"\n\t\tconst no_accent = asciifold(part);\n\t\tif( no_accent == '' ){\n\t\t\treturn '';\n\t\t}\n\n\t\tif( diacritic_patterns.hasOwnProperty(no_accent) ){\n\t\t\treturn diacritic_patterns[no_accent];\n\t\t}\n\n\t\treturn part;\n\t}).join('');\n\n}\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","\nimport TomSelect from './tom-select';\nimport { TomLoadCallback } from './types/index';\n\n\n/**\n * Converts a scalar to its best string representation\n * for hash keys and HTML attribute values.\n *\n * Transformations:\n * 'str' -> 'str'\n * null -> ''\n * undefined -> ''\n * true -> '1'\n * false -> '0'\n * 0 -> '0'\n * 1 -> '1'\n *\n */\nexport const hash_key = (value:undefined|null|boolean|string):string|null => {\n\tif (typeof value === 'undefined' || value === null) return null;\n\treturn get_hash(value);\n};\n\nexport const get_hash = (value:boolean|string):string => {\n\tif (typeof value === 'boolean') return value ? '1' : '0';\n\treturn value + '';\n};\n\n/**\n * Escapes a string for use within HTML.\n *\n */\nexport const escape_html = (str:string):string => {\n\treturn (str + '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"');\n};\n\n\n/**\n * Debounce the user provided load function\n *\n */\nexport const loadDebounce = (fn:(value:string,callback:TomLoadCallback) => void,delay:number) => {\n\tvar timeout: null|ReturnType<typeof setTimeout>;\n\treturn function(this:TomSelect, value:string,callback:TomLoadCallback) {\n\t\tvar self = this;\n\n\t\tif( timeout ){\n\t\t\tself.loading = Math.max(self.loading - 1, 0);\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t\ttimeout = setTimeout(function() {\n\t\t\ttimeout = null;\n\t\t\tself.loadedSearches[value] = true;\n\t\t\tfn.call(self, value, callback);\n\n\t\t}, delay);\n\t};\n};\n\n\n/**\n * Debounce all fired events types listed in `types`\n * while executing the provided `fn`.\n *\n */\nexport const debounce_events = ( self:TomSelect, types:string[], fn:() => void ) => {\n\tvar type:string;\n\tvar trigger = self.trigger;\n\tvar event_args:{ [key: string]: any } = {};\n\n\t// override trigger method\n\tself.trigger = function(){\n\t\tvar type = arguments[0];\n\t\tif (types.indexOf(type) !== -1) {\n\t\t\tevent_args[type] = arguments;\n\t\t} else {\n\t\t\treturn trigger.apply(self, arguments);\n\t\t}\n\t};\n\n\t// invoke provided function\n\tfn.apply(self, []);\n\tself.trigger = trigger;\n\n\t// trigger queued events\n\tfor( type of types ){\n\t\tif( type in event_args ){\n\t\t\ttrigger.apply(self, event_args[type]);\n\t\t}\n\t}\n};\n\n\n/**\n * Determines the current selection within a text input control.\n * Returns an object containing:\n * - start\n * - length\n *\n */\nexport const getSelection = (input:HTMLInputElement):{ start: number; length: number } => {\n\treturn {\n\t\tstart\t: input.selectionStart || 0,\n\t\tlength\t: (input.selectionEnd||0) - (input.selectionStart||0),\n\t};\n};\n\n\n/**\n * Prevent default\n *\n */\nexport const preventDefault = (evt?:Event, stop:boolean=false):void => {\n\tif( evt ){\n\t\tevt.preventDefault();\n\t\tif( stop ){\n\t\t\tevt.stopPropagation();\n\t\t}\n\t}\n}\n\n\n/**\n * Prevent default\n *\n */\nexport const addEvent = (target:EventTarget, type:string, callback:EventListenerOrEventListenerObject, options?:object):void => {\n\ttarget.addEventListener(type,callback,options);\n};\n\n\n/**\n * Return true if the requested key is down\n * Will return false if more than one control character is pressed ( when [ctrl+shift+a] != [ctrl+a] )\n * The current evt may not always set ( eg calling advanceSelection() )\n *\n */\nexport const isKeyDown = ( key_name:keyof (KeyboardEvent|MouseEvent), evt?:KeyboardEvent|MouseEvent ) => {\n\n\tif( !evt ){\n\t\treturn false;\n\t}\n\n\tif( !evt[key_name] ){\n\t\treturn false;\n\t}\n\n\tvar count = (evt.altKey?1:0) + (evt.ctrlKey?1:0) + (evt.shiftKey?1:0) + (evt.metaKey?1:0);\n\n\tif( count === 1 ){\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\n\n/**\n * Get the id of an element\n * If the id attribute is not set, set the attribute with the given id\n *\n */\nexport const getId = (el:Element,id:string) => {\n\tconst existing_id = el.getAttribute('id');\n\tif( existing_id ){\n\t\treturn existing_id;\n\t}\n\n\tel.setAttribute('id',id);\n\treturn id;\n};\n\n\n/**\n * Returns a string with backslashes added before characters that need to be escaped.\n */\nexport const addSlashes = (str:string):string => {\n\treturn str.replace(/[\\\\\"']/g, '\\\\$&');\n};\n\n/**\n *\n */\nexport const append = ( parent:Element|DocumentFragment, node: string|Node|null|undefined ):void =>{\n\tif( node ) parent.append(node);\n};\n","/**\n * Plugin: \"dropdown_header\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport { getDom } from '../../vanilla';\nimport { preventDefault } from '../../utils';\nimport { DHOptions } from './types';\n\nexport default function(this:TomSelect, userOptions:DHOptions) {\n\tconst self = this;\n\n\tconst options = Object.assign({\n\t\ttitle : 'Untitled',\n\t\theaderClass : 'dropdown-header',\n\t\ttitleRowClass : 'dropdown-header-title',\n\t\tlabelClass : 'dropdown-header-label',\n\t\tcloseClass : 'dropdown-header-close',\n\n\t\thtml: (data:DHOptions) => {\n\t\t\treturn (\n\t\t\t\t'<div class=\"' + data.headerClass + '\">' +\n\t\t\t\t\t'<div class=\"' + data.titleRowClass + '\">' +\n\t\t\t\t\t\t'<span class=\"' + data.labelClass + '\">' + data.title + '</span>' +\n\t\t\t\t\t\t'<a class=\"' + data.closeClass + '\">×</a>' +\n\t\t\t\t\t'</div>' +\n\t\t\t\t'</div>'\n\t\t\t);\n\t\t}\n\t}, userOptions);\n\n\tself.on('initialize',()=>{\n\t\tvar header = getDom(options.html(options));\n\n\t\tvar close_link = header.querySelector('.'+options.closeClass);\n\t\tif( close_link ){\n\t\t\tclose_link.addEventListener('click',(evt)=>{\n\t\t\t\tpreventDefault(evt,true);\n\t\t\t\tself.close();\n\t\t\t});\n\t\t}\n\n\t\tself.dropdown.insertBefore(header, self.dropdown.firstChild);\n\t});\n\n};\n"],"names":["latin_convert","RegExp","Object","keys","join","getDom","query","jquery","HTMLElement","isHtmlString","div","document","createElement","innerHTML","trim","firstChild","querySelector","arg","indexOf","preventDefault","evt","stop","stopPropagation","userOptions","self","options","assign","title","headerClass","titleRowClass","labelClass","closeClass","html","data","on","header","close_link","addEventListener","close","dropdown","insertBefore"],"mappings":";;;;;;;;;;;CACA;CAYA,MAAMA,aAA4B,GAAG;CACpC,OAAK,IAD+B;CAEpC,OAAK,GAF+B;CAGpC,OAAK;CAH+B,CAArC;CAMoB,IAAIC,MAAJ,CAAWC,MAAM,CAACC,IAAP,CAAYH,aAAZ,EAA2BI,IAA3B,CAAgC,GAAhC,CAAX,EAAgD,IAAhD;;CChBpB;CACA;CACA;CACA;CACA;CACA;;CACO,MAAMC,MAAM,GAAKC,KAAF,IAA6B;CAElD,MAAIA,KAAK,CAACC,MAAV,EAAkB;CACjB,WAAOD,KAAK,CAAC,CAAD,CAAZ;CACA;;CAED,MAAIA,KAAK,YAAYE,WAArB,EAAkC;CACjC,WAAOF,KAAP;CACA;;CAED,MAAIG,YAAY,CAACH,KAAD,CAAhB,EAAyB;CACxB,QAAII,GAAG,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAV;CACAF,IAAAA,GAAG,CAACG,SAAJ,GAAgBP,KAAK,CAACQ,IAAN,EAAhB,CAFwB;;CAGxB,WAAOJ,GAAG,CAACK,UAAX;CACA;;CAED,SAAOJ,QAAQ,CAACK,aAAT,CAAuBV,KAAvB,CAAP;CACA,CAjBM;CAmBA,MAAMG,YAAY,GAAIQ,GAAD,IAAsB;CACjD,MAAI,OAAOA,GAAP,KAAe,QAAf,IAA2BA,GAAG,CAACC,OAAJ,CAAY,GAAZ,IAAmB,CAAC,CAAnD,EAAsD;CACrD,WAAO,IAAP;CACA;;CACD,SAAO,KAAP;CACA,CALM;;CCvBP;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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ACfA,MAAAA,UAAU,CAACC,gBAAX,CAA4B,OAA5B,EAAqCjB,GAAD,IAAO;CAC1CD,QAAAA,cAAc,CAACC,GAAD,EAAK,IAAL,CAAd;CACAI,QAAAA,IAAI,CAACc,KAAL;CACA,OAHD;CAIA;;CAEDd,IAAAA,IAAI,CAACe,QAAL,CAAcC,YAAd,CAA2BL,MAA3B,EAAmCX,IAAI,CAACe,QAAL,CAAcxB,UAAjD;CACA,GAZD;CAcA;;;;;;;;"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tom Select v2.1.0
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.dropdown_input = factory());
|
|
10
|
+
})(this, (function () { 'use strict';
|
|
11
|
+
|
|
12
|
+
const KEY_ESC = 27;
|
|
13
|
+
const KEY_TAB = 9;
|
|
14
|
+
typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent);
|
|
15
|
+
// ctrl key or apple key for ma
|
|
16
|
+
|
|
17
|
+
// @ts-ignore TS2691 "An import path cannot end with a '.ts' extension"
|
|
18
|
+
const latin_convert = {
|
|
19
|
+
'æ': 'ae',
|
|
20
|
+
'ⱥ': 'a',
|
|
21
|
+
'ø': 'o'
|
|
22
|
+
};
|
|
23
|
+
new RegExp(Object.keys(latin_convert).join('|'), 'gu');
|
|
24
|
+
|
|
25
|
+
// @ts-ignore TS2691 "An import path cannot end with a '.ts' extension"
|
|
26
|
+
/**
|
|
27
|
+
* Iterates over arrays and hashes.
|
|
28
|
+
*
|
|
29
|
+
* ```
|
|
30
|
+
* iterate(this.items, function(item, id) {
|
|
31
|
+
* // invoked for each item
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const iterate = (object, callback) => {
|
|
38
|
+
if (Array.isArray(object)) {
|
|
39
|
+
object.forEach(callback);
|
|
40
|
+
} else {
|
|
41
|
+
for (var key in object) {
|
|
42
|
+
if (object.hasOwnProperty(key)) {
|
|
43
|
+
callback(object[key], key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
|
|
51
|
+
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
|
|
52
|
+
*
|
|
53
|
+
* param query should be {}
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
const getDom = query => {
|
|
57
|
+
if (query.jquery) {
|
|
58
|
+
return query[0];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (query instanceof HTMLElement) {
|
|
62
|
+
return query;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (isHtmlString(query)) {
|
|
66
|
+
let div = document.createElement('div');
|
|
67
|
+
div.innerHTML = query.trim(); // Never return a text node of whitespace as the result
|
|
68
|
+
|
|
69
|
+
return div.firstChild;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return document.querySelector(query);
|
|
73
|
+
};
|
|
74
|
+
const isHtmlString = arg => {
|
|
75
|
+
if (typeof arg === 'string' && arg.indexOf('<') > -1) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return false;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Add css classes
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
const addClasses = (elmts, ...classes) => {
|
|
87
|
+
var norm_classes = classesArray(classes);
|
|
88
|
+
elmts = castAsArray(elmts);
|
|
89
|
+
elmts.map(el => {
|
|
90
|
+
norm_classes.map(cls => {
|
|
91
|
+
el.classList.add(cls);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Return arguments
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
const classesArray = args => {
|
|
101
|
+
var classes = [];
|
|
102
|
+
iterate(args, _classes => {
|
|
103
|
+
if (typeof _classes === 'string') {
|
|
104
|
+
_classes = _classes.trim().split(/[\11\12\14\15\40]/);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (Array.isArray(_classes)) {
|
|
108
|
+
classes = classes.concat(_classes);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return classes.filter(Boolean);
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Create an array from arg if it's not already an array
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
const castAsArray = arg => {
|
|
119
|
+
if (!Array.isArray(arg)) {
|
|
120
|
+
arg = [arg];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return arg;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Converts a scalar to its best string representation
|
|
128
|
+
* for hash keys and HTML attribute values.
|
|
129
|
+
*
|
|
130
|
+
* Transformations:
|
|
131
|
+
* 'str' -> 'str'
|
|
132
|
+
* null -> ''
|
|
133
|
+
* undefined -> ''
|
|
134
|
+
* true -> '1'
|
|
135
|
+
* false -> '0'
|
|
136
|
+
* 0 -> '0'
|
|
137
|
+
* 1 -> '1'
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Prevent default
|
|
142
|
+
*
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
const preventDefault = (evt, stop = false) => {
|
|
146
|
+
if (evt) {
|
|
147
|
+
evt.preventDefault();
|
|
148
|
+
|
|
149
|
+
if (stop) {
|
|
150
|
+
evt.stopPropagation();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Prevent default
|
|
156
|
+
*
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
const addEvent = (target, type, callback, options) => {
|
|
160
|
+
target.addEventListener(type, callback, options);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Plugin: "dropdown_input" (Tom Select)
|
|
165
|
+
* Copyright (c) contributors
|
|
166
|
+
*
|
|
167
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
168
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
169
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
170
|
+
*
|
|
171
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
172
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
173
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
174
|
+
* governing permissions and limitations under the License.
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
177
|
+
function plugin () {
|
|
178
|
+
const self = this;
|
|
179
|
+
self.settings.shouldOpen = true; // make sure the input is shown even if there are no options to display in the dropdown
|
|
180
|
+
|
|
181
|
+
self.hook('before', 'setup', () => {
|
|
182
|
+
self.focus_node = self.control;
|
|
183
|
+
addClasses(self.control_input, 'dropdown-input');
|
|
184
|
+
const div = getDom('<div class="dropdown-input-wrap">');
|
|
185
|
+
div.append(self.control_input);
|
|
186
|
+
self.dropdown.insertBefore(div, self.dropdown.firstChild); // set a placeholder in the select control
|
|
187
|
+
|
|
188
|
+
const placeholder = getDom('<input class="items-placeholder" tabindex="-1" />');
|
|
189
|
+
placeholder.placeholder = self.settings.placeholder || '';
|
|
190
|
+
self.control.append(placeholder);
|
|
191
|
+
});
|
|
192
|
+
self.on('initialize', () => {
|
|
193
|
+
// set tabIndex on control to -1, otherwise [shift+tab] will put focus right back on control_input
|
|
194
|
+
self.control_input.addEventListener('keydown', evt => {
|
|
195
|
+
//addEvent(self.control_input,'keydown' as const,(evt:KeyboardEvent) =>{
|
|
196
|
+
switch (evt.keyCode) {
|
|
197
|
+
case KEY_ESC:
|
|
198
|
+
if (self.isOpen) {
|
|
199
|
+
preventDefault(evt, true);
|
|
200
|
+
self.close();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
self.clearActiveItems();
|
|
204
|
+
return;
|
|
205
|
+
|
|
206
|
+
case KEY_TAB:
|
|
207
|
+
self.focus_node.tabIndex = -1;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return self.onKeyDown.call(self, evt);
|
|
212
|
+
});
|
|
213
|
+
self.on('blur', () => {
|
|
214
|
+
self.focus_node.tabIndex = self.isDisabled ? -1 : self.tabIndex;
|
|
215
|
+
}); // give the control_input focus when the dropdown is open
|
|
216
|
+
|
|
217
|
+
self.on('dropdown_open', () => {
|
|
218
|
+
self.control_input.focus();
|
|
219
|
+
}); // prevent onBlur from closing when focus is on the control_input
|
|
220
|
+
|
|
221
|
+
const orig_onBlur = self.onBlur;
|
|
222
|
+
self.hook('instead', 'onBlur', evt => {
|
|
223
|
+
if (evt && evt.relatedTarget == self.control_input) return;
|
|
224
|
+
return orig_onBlur.call(self);
|
|
225
|
+
});
|
|
226
|
+
addEvent(self.control_input, 'blur', () => self.onBlur()); // return focus to control to allow further keyboard input
|
|
227
|
+
|
|
228
|
+
self.hook('before', 'close', () => {
|
|
229
|
+
if (!self.isOpen) return;
|
|
230
|
+
self.focus_node.focus({
|
|
231
|
+
preventScroll: true
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return plugin;
|
|
238
|
+
|
|
239
|
+
}));
|
|
240
|
+
//# sourceMappingURL=dropdown_input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown_input.js","sources":["../../../src/constants.ts","../../../node_modules/@orchidjs/sifter/lib/diacritics.ts","../../../node_modules/@orchidjs/sifter/lib/utils.ts","../../../src/vanilla.ts","../../../src/utils.ts","../../../src/plugins/dropdown_input/plugin.ts"],"sourcesContent":["export const KEY_A\t\t\t\t= 65;\nexport const KEY_RETURN\t\t\t= 13;\nexport const KEY_ESC\t\t\t= 27;\nexport const KEY_LEFT\t\t\t= 37;\nexport const KEY_UP\t\t\t\t= 38;\nexport const KEY_RIGHT\t\t\t= 39;\nexport const KEY_DOWN\t\t\t= 40;\nexport const KEY_BACKSPACE\t\t= 8;\nexport const KEY_DELETE\t\t\t= 46;\nexport const KEY_TAB\t\t\t= 9;\n\nexport const IS_MAC \t\t= typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent);\nexport const KEY_SHORTCUT\t\t= IS_MAC ? 'metaKey' : 'ctrlKey'; // ctrl key or apple key for ma\n","\n// @ts-ignore TS2691 \"An import path cannot end with a '.ts' extension\"\nimport { escape_regex } from './utils.ts';\n\ntype TDiacraticList = {[key:string]:string};\n\n// https://github.com/andrewrk/node-diacritics/blob/master/index.js\n\nvar latin_pat:RegExp;\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}]'; // \\u{2bc}\nconst accent_reg = new RegExp(accent_pat,'gu');\nvar diacritic_patterns:TDiacraticList;\n\nconst latin_convert:TDiacraticList = {\n\t'æ': 'ae',\n\t'ⱥ': 'a',\n\t'ø': 'o',\n};\n\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|'),'gu');\n\nconst code_points:[[number,number]] = [[ 0, 65535 ]];\n\n/**\n * Remove accents\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n *\n */\nexport const asciifold = (str:string):string => {\n\treturn str\n\t\t.normalize('NFKD')\n\t\t.replace(accent_reg, '')\n\t\t.toLowerCase()\n\t\t.replace(convert_pat,function(foreignletter) {\n\t\t\treturn latin_convert[foreignletter];\n\t\t});\n};\n\n/**\n * Convert array of strings to a regular expression\n *\tex ['ab','a'] => (?:ab|a)\n * \tex ['a','b'] => [ab]\n *\n */\nexport const arrayToPattern = (chars:string[],glue:string='|'):string =>{\n\n\tif( chars.length == 1 ){\n\t\treturn chars[0];\n\t}\n\n\tvar longest = 1;\n\tchars.forEach((a)=>{longest = Math.max(longest,a.length)});\n\n\tif( longest == 1 ){\n\t\treturn '['+chars.join('')+']';\n\t}\n\n\treturn '(?:'+chars.join(glue)+')';\n};\n\nexport const escapeToPattern = (chars:string[]):string =>{\n\tconst escaped = chars.map((diacritic) => escape_regex(diacritic));\n\treturn arrayToPattern(escaped);\n};\n\n/**\n * Get all possible combinations of substrings that add up to the given string\n * https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string\n *\n */\nexport const allSubstrings = (input:string):string[][] => {\n\n if( input.length === 1) return [[input]];\n\n var result:string[][] = [];\n allSubstrings(input.substring(1)).forEach(function(subresult) {\n var tmp = subresult.slice(0);\n tmp[0] = input.charAt(0) + tmp[0];\n result.push(tmp);\n\n tmp = subresult.slice(0);\n tmp.unshift(input.charAt(0));\n result.push(tmp);\n });\n\n return result;\n}\n\n/**\n * Generate a list of diacritics from the list of code points\n *\n */\nexport const generateDiacritics = (code_points:[[number,number]]):TDiacraticList => {\n\n\tvar diacritics:{[key:string]:string[]} = {};\n\tcode_points.forEach((code_range)=>{\n\n\t\tfor(let i = code_range[0]; i <= code_range[1]; i++){\n\n\t\t\tlet diacritic\t= String.fromCharCode(i);\n\t\t\tlet\tlatin\t\t= asciifold(diacritic);\n\n\t\t\tif( latin == diacritic.toLowerCase() ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// skip when latin is a string longer than 3 characters long\n\t\t\t// bc the resulting regex patterns will be long\n\t\t\t// eg:\n\t\t\t// latin صلى الله عليه وسلم length 18 code point 65018\n\t\t\t// latin جل جلاله length 8 code point 65019\n\t\t\tif( latin.length > 3 ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif( !(latin in diacritics) ){\n\t\t\t\tdiacritics[latin] = [latin];\n\t\t\t}\n\n\t\t\tvar patt = new RegExp( escapeToPattern(diacritics[latin]),'iu');\n\t\t\tif( diacritic.match(patt) ){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tdiacritics[latin].push(diacritic);\n\t\t}\n\t});\n\n\t// filter out if there's only one character in the list\n\tlet latin_chars = Object.keys(diacritics);\n\tfor( let i = 0; i < latin_chars.length; i++){\n\t\tconst latin = latin_chars[i];\n\t\tif( diacritics[latin].length < 2 ){\n\t\t\tdelete diacritics[latin];\n\t\t}\n\t}\n\n\n\t// latin character pattern\n\t// match longer substrings first\n\tlatin_chars\t\t= Object.keys(diacritics).sort((a, b) => b.length - a.length );\n\tlatin_pat\t\t= new RegExp('('+ escapeToPattern(latin_chars) + accent_pat + '*)','gu');\n\n\n\t// build diacritic patterns\n\t// ae needs:\n\t//\t(?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n\tvar diacritic_patterns:TDiacraticList = {};\n\tlatin_chars.sort((a,b) => a.length -b.length).forEach((latin)=>{\n\n\t\tvar substrings\t= allSubstrings(latin);\n\t\tvar pattern = substrings.map((sub_pat)=>{\n\n\t\t\tsub_pat = sub_pat.map((l)=>{\n\t\t\t\tif( diacritics.hasOwnProperty(l) ){\n\t\t\t\t\treturn escapeToPattern(diacritics[l]);\n\t\t\t\t}\n\t\t\t\treturn l;\n\t\t\t});\n\n\t\t\treturn arrayToPattern(sub_pat,'');\n\t\t});\n\n\t\tdiacritic_patterns[latin] = arrayToPattern(pattern);\n\t});\n\n\n\treturn diacritic_patterns;\n}\n\n/**\n * Expand a regular expression pattern to include diacritics\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n */\nexport const diacriticRegexPoints = (regex:string):string => {\n\n\tif( diacritic_patterns === undefined ){\n\t\tdiacritic_patterns = generateDiacritics(code_points);\n\t}\n\n\tconst decomposed\t\t= regex.normalize('NFKD').toLowerCase();\n\n\treturn decomposed.split(latin_pat).map((part:string)=>{\n\n\t\t// \"ffl\" or \"ffl\"\n\t\tconst no_accent = asciifold(part);\n\t\tif( no_accent == '' ){\n\t\t\treturn '';\n\t\t}\n\n\t\tif( diacritic_patterns.hasOwnProperty(no_accent) ){\n\t\t\treturn diacritic_patterns[no_accent];\n\t\t}\n\n\t\treturn part;\n\t}).join('');\n\n}\n","\n// @ts-ignore TS2691 \"An import path cannot end with a '.ts' extension\"\nimport { asciifold } from './diacritics.ts';\n\n// @ts-ignore TS2691 \"An import path cannot end with a '.ts' extension\"\nimport * as T from './types.ts';\n\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttr = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n return obj[name];\n};\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttrNesting = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n var part, names = name.split(\".\");\n\twhile( (part = names.shift()) && (obj = obj[part]));\n return obj;\n};\n\n/**\n * Calculates how close of a match the\n * given value is against a search token.\n *\n */\nexport const scoreValue = (value:string, token:T.Token, weight:number ):number => {\n\tvar score, pos;\n\n\tif (!value) return 0;\n\n\tvalue = value + '';\n\tpos = value.search(token.regex);\n\tif (pos === -1) return 0;\n\n\tscore = token.string.length / value.length;\n\tif (pos === 0) score += 0.5;\n\n\treturn score * weight;\n};\n\n/**\n *\n * https://stackoverflow.com/questions/63006601/why-does-u-throw-an-invalid-escape-error\n */\nexport const escape_regex = (str:string):string => {\n\treturn (str + '').replace(/([\\$\\(\\)\\*\\+\\.\\?\\[\\]\\^\\{\\|\\}\\\\])/gu, '\\\\$1');\n};\n\n\n/**\n * Cast object property to an array if it exists and has a value\n *\n */\nexport const propToArray = (obj:{[key:string]:any}, key:string) => {\n\tvar value = obj[key];\n\n\tif( typeof value == 'function' ) return value;\n\n\tif( value && !Array.isArray(value) ){\n\t\tobj[key] = [value];\n\t}\n}\n\n\n/**\n * Iterates over arrays and hashes.\n *\n * ```\n * iterate(this.items, function(item, id) {\n * // invoked for each item\n * });\n * ```\n *\n */\nexport const iterate = (object:[]|{[key:string]:any}, callback:(value:any,key:number|string)=>any) => {\n\n\tif ( Array.isArray(object)) {\n\t\tobject.forEach(callback);\n\n\t}else{\n\n\t\tfor (var key in object) {\n\t\t\tif (object.hasOwnProperty(key)) {\n\t\t\t\tcallback(object[key], key);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\n\nexport const cmp = (a:number|string, b:number|string) => {\n\tif (typeof a === 'number' && typeof b === 'number') {\n\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t}\n\ta = asciifold(a + '').toLowerCase();\n\tb = asciifold(b + '').toLowerCase();\n\tif (a > b) return 1;\n\tif (b > a) return -1;\n\treturn 0;\n};\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tlet div = document.createElement('div');\n\t\tdiv.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn div.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","\nimport TomSelect from './tom-select';\nimport { TomLoadCallback } from './types/index';\n\n\n/**\n * Converts a scalar to its best string representation\n * for hash keys and HTML attribute values.\n *\n * Transformations:\n * 'str' -> 'str'\n * null -> ''\n * undefined -> ''\n * true -> '1'\n * false -> '0'\n * 0 -> '0'\n * 1 -> '1'\n *\n */\nexport const hash_key = (value:undefined|null|boolean|string):string|null => {\n\tif (typeof value === 'undefined' || value === null) return null;\n\treturn get_hash(value);\n};\n\nexport const get_hash = (value:boolean|string):string => {\n\tif (typeof value === 'boolean') return value ? '1' : '0';\n\treturn value + '';\n};\n\n/**\n * Escapes a string for use within HTML.\n *\n */\nexport const escape_html = (str:string):string => {\n\treturn (str + '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\"/g, '"');\n};\n\n\n/**\n * Debounce the user provided load function\n *\n */\nexport const loadDebounce = (fn:(value:string,callback:TomLoadCallback) => void,delay:number) => {\n\tvar timeout: null|ReturnType<typeof setTimeout>;\n\treturn function(this:TomSelect, value:string,callback:TomLoadCallback) {\n\t\tvar self = this;\n\n\t\tif( timeout ){\n\t\t\tself.loading = Math.max(self.loading - 1, 0);\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t\ttimeout = setTimeout(function() {\n\t\t\ttimeout = null;\n\t\t\tself.loadedSearches[value] = true;\n\t\t\tfn.call(self, value, callback);\n\n\t\t}, delay);\n\t};\n};\n\n\n/**\n * Debounce all fired events types listed in `types`\n * while executing the provided `fn`.\n *\n */\nexport const debounce_events = ( self:TomSelect, types:string[], fn:() => void ) => {\n\tvar type:string;\n\tvar trigger = self.trigger;\n\tvar event_args:{ [key: string]: any } = {};\n\n\t// override trigger method\n\tself.trigger = function(){\n\t\tvar type = arguments[0];\n\t\tif (types.indexOf(type) !== -1) {\n\t\t\tevent_args[type] = arguments;\n\t\t} else {\n\t\t\treturn trigger.apply(self, arguments);\n\t\t}\n\t};\n\n\t// invoke provided function\n\tfn.apply(self, []);\n\tself.trigger = trigger;\n\n\t// trigger queued events\n\tfor( type of types ){\n\t\tif( type in event_args ){\n\t\t\ttrigger.apply(self, event_args[type]);\n\t\t}\n\t}\n};\n\n\n/**\n * Determines the current selection within a text input control.\n * Returns an object containing:\n * - start\n * - length\n *\n */\nexport const getSelection = (input:HTMLInputElement):{ start: number; length: number } => {\n\treturn {\n\t\tstart\t: input.selectionStart || 0,\n\t\tlength\t: (input.selectionEnd||0) - (input.selectionStart||0),\n\t};\n};\n\n\n/**\n * Prevent default\n *\n */\nexport const preventDefault = (evt?:Event, stop:boolean=false):void => {\n\tif( evt ){\n\t\tevt.preventDefault();\n\t\tif( stop ){\n\t\t\tevt.stopPropagation();\n\t\t}\n\t}\n}\n\n\n/**\n * Prevent default\n *\n */\nexport const addEvent = (target:EventTarget, type:string, callback:EventListenerOrEventListenerObject, options?:object):void => {\n\ttarget.addEventListener(type,callback,options);\n};\n\n\n/**\n * Return true if the requested key is down\n * Will return false if more than one control character is pressed ( when [ctrl+shift+a] != [ctrl+a] )\n * The current evt may not always set ( eg calling advanceSelection() )\n *\n */\nexport const isKeyDown = ( key_name:keyof (KeyboardEvent|MouseEvent), evt?:KeyboardEvent|MouseEvent ) => {\n\n\tif( !evt ){\n\t\treturn false;\n\t}\n\n\tif( !evt[key_name] ){\n\t\treturn false;\n\t}\n\n\tvar count = (evt.altKey?1:0) + (evt.ctrlKey?1:0) + (evt.shiftKey?1:0) + (evt.metaKey?1:0);\n\n\tif( count === 1 ){\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\n\n/**\n * Get the id of an element\n * If the id attribute is not set, set the attribute with the given id\n *\n */\nexport const getId = (el:Element,id:string) => {\n\tconst existing_id = el.getAttribute('id');\n\tif( existing_id ){\n\t\treturn existing_id;\n\t}\n\n\tel.setAttribute('id',id);\n\treturn id;\n};\n\n\n/**\n * Returns a string with backslashes added before characters that need to be escaped.\n */\nexport const addSlashes = (str:string):string => {\n\treturn str.replace(/[\\\\\"']/g, '\\\\$&');\n};\n\n/**\n *\n */\nexport const append = ( parent:Element|DocumentFragment, node: string|Node|null|undefined ):void =>{\n\tif( node ) parent.append(node);\n};\n","/**\n * Plugin: \"dropdown_input\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport * as constants from '../../constants';\nimport { getDom, addClasses } from '../../vanilla';\nimport { addEvent, preventDefault } from '../../utils';\n\n\nexport default function(this:TomSelect) {\n\tconst self = this;\n\n\tself.settings.shouldOpen = true; // make sure the input is shown even if there are no options to display in the dropdown\n\n\tself.hook('before','setup',()=>{\n\t\tself.focus_node\t\t= self.control;\n\n\t\taddClasses( self.control_input, 'dropdown-input');\n\n\t \tconst div = getDom('<div class=\"dropdown-input-wrap\">');\n\t\tdiv.append(self.control_input);\n\t\tself.dropdown.insertBefore(div, self.dropdown.firstChild);\n\n\t\t// set a placeholder in the select control\n\t\tconst placeholder = getDom('<input class=\"items-placeholder\" tabindex=\"-1\" />') as HTMLInputElement;\n\t\tplaceholder.placeholder = self.settings.placeholder ||'';\n\t\tself.control.append(placeholder);\n\n\t});\n\n\n\tself.on('initialize',()=>{\n\n\t\t// set tabIndex on control to -1, otherwise [shift+tab] will put focus right back on control_input\n\t\tself.control_input.addEventListener('keydown',(evt:KeyboardEvent) =>{\n\t\t//addEvent(self.control_input,'keydown' as const,(evt:KeyboardEvent) =>{\n\t\t\tswitch( evt.keyCode ){\n\t\t\t\tcase constants.KEY_ESC:\n\t\t\t\t\tif (self.isOpen) {\n\t\t\t\t\t\tpreventDefault(evt,true);\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t}\n\t\t\t\t\tself.clearActiveItems();\n\t\t\t\treturn;\n\t\t\t\tcase constants.KEY_TAB:\n\t\t\t\t\tself.focus_node.tabIndex = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn self.onKeyDown.call(self,evt);\n\t\t});\n\n\t\tself.on('blur',()=>{\n\t\t\tself.focus_node.tabIndex = self.isDisabled ? -1 : self.tabIndex;\n\t\t});\n\n\n\t\t// give the control_input focus when the dropdown is open\n\t\tself.on('dropdown_open',() =>{\n\t\t\tself.control_input.focus();\n\t\t});\n\n\t\t// prevent onBlur from closing when focus is on the control_input\n\t\tconst orig_onBlur = self.onBlur;\n\t\tself.hook('instead','onBlur',(evt?:FocusEvent)=>{\n\t\t\tif( evt && evt.relatedTarget == self.control_input ) return;\n\t\t\treturn orig_onBlur.call(self);\n\t\t});\n\n\t\taddEvent(self.control_input,'blur', () => self.onBlur() );\n\n\t\t// return focus to control to allow further keyboard input\n\t\tself.hook('before','close',() =>{\n\n\t\t\tif( !self.isOpen ) return;\n\t\t\tself.focus_node.focus({preventScroll: true});\n\t\t});\n\n\t});\n\n};\n"],"names":["KEY_ESC","KEY_TAB","navigator","test","userAgent","latin_convert","RegExp","Object","keys","join","iterate","object","callback","Array","isArray","forEach","key","hasOwnProperty","getDom","query","jquery","HTMLElement","isHtmlString","div","document","createElement","innerHTML","trim","firstChild","querySelector","arg","indexOf","addClasses","elmts","classes","norm_classes","classesArray","castAsArray","map","el","cls","classList","add","args","_classes","split","concat","filter","Boolean","preventDefault","evt","stop","stopPropagation","addEvent","target","type","options","addEventListener","self","settings","shouldOpen","hook","focus_node","control","control_input","append","dropdown","insertBefore","placeholder","on","keyCode","constants","isOpen","close","clearActiveItems","tabIndex","onKeyDown","call","isDisabled","focus","orig_onBlur","onBlur","relatedTarget","preventScroll"],"mappings":";;;;;;;;;;;CAEO,MAAMA,OAAO,GAAK,EAAlB;CAOA,MAAMC,OAAO,GAAK,CAAlB;CAEsB,OAAOC,SAAP,KAAqB,WAArB,GAAmC,KAAnC,GAA2C,MAAMC,IAAN,CAAWD,SAAS,CAACE,SAArB;;;CCVxE;CAYA,MAAMC,aAA4B,GAAG;CACpC,OAAK,IAD+B;CAEpC,OAAK,GAF+B;CAGpC,O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