@tabler/core 1.0.0-beta10 → 1.0.0-beta11
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 +33 -11
- package/dist/css/demo.css +2 -2
- package/dist/css/demo.min.css +2 -2
- package/dist/css/demo.rtl.css +2 -2
- package/dist/css/demo.rtl.min.css +2 -2
- package/dist/css/tabler-flags.css +2 -2
- package/dist/css/tabler-flags.min.css +2 -2
- package/dist/css/tabler-flags.rtl.css +2 -2
- package/dist/css/tabler-flags.rtl.min.css +2 -2
- package/dist/css/tabler-payments.css +2 -2
- package/dist/css/tabler-payments.min.css +2 -2
- package/dist/css/tabler-payments.rtl.css +2 -2
- package/dist/css/tabler-payments.rtl.min.css +2 -2
- package/dist/css/tabler-vendors.css +143 -29
- package/dist/css/tabler-vendors.min.css +3 -3
- package/dist/css/tabler-vendors.rtl.css +143 -29
- package/dist/css/tabler-vendors.rtl.min.css +3 -3
- package/dist/css/tabler.css +5741 -2725
- package/dist/css/tabler.min.css +4 -4
- package/dist/css/tabler.rtl.css +5743 -2743
- package/dist/css/tabler.rtl.min.css +4 -4
- package/dist/js/demo.js +2 -2
- package/dist/js/demo.min.js +2 -2
- package/dist/js/tabler.esm.js +1637 -1515
- package/dist/js/tabler.esm.min.js +3 -3
- package/dist/js/tabler.js +1637 -1515
- package/dist/js/tabler.min.js +3 -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 +31960 -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 +7066 -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 +5204 -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 +5251 -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 +2663 -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 +50 -29
- package/src/scss/_bootstrap-components.scss +1 -1
- package/src/scss/_bootstrap-config.scss +1 -0
- package/src/scss/_core.scss +1 -0
- package/src/scss/_mixins-override.scss +26 -26
- package/src/scss/_variables.scss +17 -9
- package/src/scss/demo.scss +4 -4
- package/src/scss/layout/_core.scss +23 -15
- package/src/scss/layout/_dark.scss +17 -13
- package/src/scss/layout/_navbar.scss +11 -10
- package/src/scss/mixins/_functions.scss +0 -14
- package/src/scss/mixins/_mixins.scss +29 -3
- package/src/scss/tabler-vendors.scss +4 -0
- package/src/scss/ui/_accordion.scss +4 -0
- package/src/scss/ui/_alerts.scss +7 -7
- package/src/scss/ui/_avatars.scss +11 -11
- package/src/scss/ui/_breadcrumbs.scss +1 -1
- package/src/scss/ui/_buttons.scss +89 -105
- package/src/scss/ui/_cards.scss +25 -28
- package/src/scss/ui/_carousel.scss +1 -1
- package/src/scss/ui/_datagrid.scss +17 -0
- package/src/scss/ui/_flags.scss +1 -1
- package/src/scss/ui/_forms.scss +7 -6
- package/src/scss/ui/_grid.scss +5 -5
- package/src/scss/ui/_legend.scss +1 -1
- package/src/scss/ui/_lists.scss +4 -4
- package/src/scss/ui/_modals.scss +1 -1
- package/src/scss/ui/_nav.scss +1 -1
- package/src/scss/ui/_offcanvas.scss +1 -1
- package/src/scss/ui/_progress.scss +2 -2
- package/src/scss/ui/_status.scss +27 -26
- package/src/scss/ui/_toasts.scss +2 -2
- package/src/scss/ui/forms/_form-custom.scss +2 -2
- package/src/scss/ui/forms/_form-imagecheck.scss +1 -1
- package/src/scss/ui/forms/_validation.scss +1 -1
- package/src/scss/utils/_colors.scss +9 -7
- package/src/scss/vendor/_dropzone.scss +27 -0
- package/src/scss/vendor/_fslightbox.scss +13 -0
- package/src/scss/vendor/_jsvectormap.scss +5 -5
- package/src/scss/vendor/_litepicker.scss +4 -4
- package/src/scss/vendor/_plyr.scss +3 -0
- package/src/scss/vendor/_tinymce.scss +25 -0
|
@@ -0,0 +1,2663 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.jsVectorMap = factory());
|
|
5
|
+
})(this, (function () { 'use strict';
|
|
6
|
+
|
|
7
|
+
// Matches polyfill
|
|
8
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
9
|
+
if (!Element.prototype.matches) {
|
|
10
|
+
Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) {
|
|
11
|
+
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
|
|
12
|
+
i = matches.length;
|
|
13
|
+
|
|
14
|
+
while (--i >= 0 && matches.item(i) !== this) {}
|
|
15
|
+
|
|
16
|
+
return i > -1;
|
|
17
|
+
};
|
|
18
|
+
} // Object.assign polyfill
|
|
19
|
+
// https://gist.github.com/spiralx/68cf40d7010d829340cb
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if (!Object.assign) {
|
|
23
|
+
Object.defineProperty(Object, 'assign', {
|
|
24
|
+
enumerable: false,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: function value(target) {
|
|
28
|
+
|
|
29
|
+
if (target === undefined || target === null) {
|
|
30
|
+
throw new TypeError('Cannot convert first argument to object');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var to = Object(target);
|
|
34
|
+
|
|
35
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
36
|
+
var nextSource = arguments[i];
|
|
37
|
+
|
|
38
|
+
if (nextSource === undefined || nextSource === null) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
nextSource = Object(nextSource);
|
|
43
|
+
var keysArray = Object.keys(Object(nextSource));
|
|
44
|
+
|
|
45
|
+
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
|
46
|
+
var nextKey = keysArray[nextIndex];
|
|
47
|
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
48
|
+
|
|
49
|
+
if (desc !== undefined && desc.enumerable) {
|
|
50
|
+
to[nextKey] = nextSource[nextKey];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return to;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* By https://github.com/TehShrike/deepmerge
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
var isMergeableObject = function isMergeableObject(value) {
|
|
65
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
function isNonNullObject(value) {
|
|
69
|
+
return !!value && typeof value === 'object';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function isSpecial(value) {
|
|
73
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
74
|
+
return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isNode(value) || isReactElement(value);
|
|
75
|
+
} // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
79
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
80
|
+
|
|
81
|
+
function isReactElement(value) {
|
|
82
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isNode(value) {
|
|
86
|
+
return value instanceof Node;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function emptyTarget(val) {
|
|
90
|
+
return Array.isArray(val) ? [] : {};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
94
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function defaultArrayMerge(target, source, options) {
|
|
98
|
+
return target.concat(source).map(function (element) {
|
|
99
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function getMergeFunction(key, options) {
|
|
104
|
+
if (!options.customMerge) {
|
|
105
|
+
return deepmerge;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
var customMerge = options.customMerge(key);
|
|
109
|
+
return typeof customMerge === 'function' ? customMerge : deepmerge;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
113
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function (symbol) {
|
|
114
|
+
return target.propertyIsEnumerable(symbol);
|
|
115
|
+
}) : [];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function getKeys(target) {
|
|
119
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function propertyIsOnObject(object, property) {
|
|
123
|
+
try {
|
|
124
|
+
return property in object;
|
|
125
|
+
} catch (_) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
} // Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
function propertyIsUnsafe(target, key) {
|
|
132
|
+
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
133
|
+
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
134
|
+
&& Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function mergeObject(target, source, options) {
|
|
138
|
+
var destination = {};
|
|
139
|
+
|
|
140
|
+
if (options.isMergeableObject(target)) {
|
|
141
|
+
getKeys(target).forEach(function (key) {
|
|
142
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
getKeys(source).forEach(function (key) {
|
|
147
|
+
if (propertyIsUnsafe(target, key)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
152
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
153
|
+
} else {
|
|
154
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return destination;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
var deepmerge = function deepmerge(target, source, options) {
|
|
161
|
+
options = options || {};
|
|
162
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
163
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject; // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
164
|
+
// implementations can use it. The caller may not replace it.
|
|
165
|
+
|
|
166
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
167
|
+
var sourceIsArray = Array.isArray(source);
|
|
168
|
+
var targetIsArray = Array.isArray(target);
|
|
169
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
170
|
+
|
|
171
|
+
if (!sourceAndTargetTypesMatch) {
|
|
172
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
173
|
+
} else if (sourceIsArray) {
|
|
174
|
+
return options.arrayMerge(target, source, options);
|
|
175
|
+
} else {
|
|
176
|
+
return mergeObject(target, source, options);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* --------------------------------------------------------------------------
|
|
182
|
+
* Public Util Api
|
|
183
|
+
* --------------------------------------------------------------------------
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
var getElement = function getElement(selector) {
|
|
187
|
+
if (typeof selector === 'object' && typeof selector.nodeType !== 'undefined') {
|
|
188
|
+
return selector;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (typeof selector === 'string') {
|
|
192
|
+
return document.querySelector(selector);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return null;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
var createElement = function createElement(type, classes, content, html) {
|
|
199
|
+
if (html === void 0) {
|
|
200
|
+
html = false;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
var el = document.createElement(type);
|
|
204
|
+
|
|
205
|
+
if (content) {
|
|
206
|
+
el[!html ? 'textContent' : 'innerHTML'] = content;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (classes) {
|
|
210
|
+
el.className = classes;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return el;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
var findElement = function findElement(parentElement, selector) {
|
|
217
|
+
return Element.prototype.querySelector.call(parentElement, selector);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
var removeElement = function removeElement(target) {
|
|
221
|
+
target.parentNode.removeChild(target);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
var isImageUrl = function isImageUrl(url) {
|
|
225
|
+
return /\.(jpg|gif|png)$/.test(url);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
var hyphenate = function hyphenate(string) {
|
|
229
|
+
return string.replace(/[\w]([A-Z])/g, function (m) {
|
|
230
|
+
return m[0] + "-" + m[1];
|
|
231
|
+
}).toLowerCase();
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
var merge = function merge(target, source, deep) {
|
|
235
|
+
if (deep === void 0) {
|
|
236
|
+
deep = false;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (deep) {
|
|
240
|
+
return deepmerge(target, source);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return Object.assign(target, source);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
var getLineUid = function getLineUid(from, to) {
|
|
247
|
+
return from.toLowerCase() + ":to:" + to.toLowerCase();
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
var inherit = function inherit(target, source) {
|
|
251
|
+
Object.assign(target.prototype, source);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
var Defaults = {
|
|
255
|
+
map: 'world',
|
|
256
|
+
backgroundColor: 'transparent',
|
|
257
|
+
draggable: true,
|
|
258
|
+
zoomButtons: true,
|
|
259
|
+
zoomOnScroll: true,
|
|
260
|
+
zoomOnScrollSpeed: 3,
|
|
261
|
+
zoomMax: 12,
|
|
262
|
+
zoomMin: 1,
|
|
263
|
+
zoomAnimate: true,
|
|
264
|
+
showTooltip: true,
|
|
265
|
+
zoomStep: 1.5,
|
|
266
|
+
bindTouchEvents: true,
|
|
267
|
+
// Line options
|
|
268
|
+
lineStyle: {
|
|
269
|
+
stroke: '#808080',
|
|
270
|
+
strokeWidth: 1,
|
|
271
|
+
strokeLinecap: 'round'
|
|
272
|
+
},
|
|
273
|
+
// Marker options
|
|
274
|
+
markersSelectable: false,
|
|
275
|
+
markersSelectableOne: false,
|
|
276
|
+
markerStyle: {
|
|
277
|
+
initial: {
|
|
278
|
+
r: 7,
|
|
279
|
+
fill: '#374151',
|
|
280
|
+
fillOpacity: 1,
|
|
281
|
+
stroke: '#FFF',
|
|
282
|
+
strokeWidth: 5,
|
|
283
|
+
strokeOpacity: .5
|
|
284
|
+
},
|
|
285
|
+
hover: {
|
|
286
|
+
fill: '#3cc0ff',
|
|
287
|
+
cursor: 'pointer'
|
|
288
|
+
},
|
|
289
|
+
selected: {
|
|
290
|
+
fill: 'blue'
|
|
291
|
+
},
|
|
292
|
+
selectedHover: {}
|
|
293
|
+
},
|
|
294
|
+
markerLabelStyle: {
|
|
295
|
+
initial: {
|
|
296
|
+
fontFamily: 'Verdana',
|
|
297
|
+
fontSize: 12,
|
|
298
|
+
fontWeight: 500,
|
|
299
|
+
cursor: 'default',
|
|
300
|
+
fill: '#374151'
|
|
301
|
+
},
|
|
302
|
+
hover: {
|
|
303
|
+
cursor: 'pointer'
|
|
304
|
+
},
|
|
305
|
+
selected: {},
|
|
306
|
+
selectedHover: {}
|
|
307
|
+
},
|
|
308
|
+
// Region options
|
|
309
|
+
regionsSelectable: false,
|
|
310
|
+
regionsSelectableOne: false,
|
|
311
|
+
regionStyle: {
|
|
312
|
+
initial: {
|
|
313
|
+
fill: '#dee2e8',
|
|
314
|
+
fillOpacity: 1,
|
|
315
|
+
stroke: 'none',
|
|
316
|
+
strokeWidth: 0
|
|
317
|
+
},
|
|
318
|
+
hover: {
|
|
319
|
+
fillOpacity: .7,
|
|
320
|
+
cursor: 'pointer'
|
|
321
|
+
},
|
|
322
|
+
selected: {
|
|
323
|
+
fill: '#9ca3af'
|
|
324
|
+
},
|
|
325
|
+
selectedHover: {}
|
|
326
|
+
},
|
|
327
|
+
regionLabelStyle: {
|
|
328
|
+
initial: {
|
|
329
|
+
fontFamily: 'Verdana',
|
|
330
|
+
fontSize: '12',
|
|
331
|
+
fontWeight: 'bold',
|
|
332
|
+
cursor: 'default',
|
|
333
|
+
fill: '#35373e'
|
|
334
|
+
},
|
|
335
|
+
hover: {
|
|
336
|
+
cursor: 'pointer'
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
function _inheritsLoose(subClass, superClass) {
|
|
342
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
343
|
+
subClass.prototype.constructor = subClass;
|
|
344
|
+
|
|
345
|
+
_setPrototypeOf(subClass, superClass);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function _setPrototypeOf(o, p) {
|
|
349
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
350
|
+
o.__proto__ = p;
|
|
351
|
+
return o;
|
|
352
|
+
};
|
|
353
|
+
return _setPrototypeOf(o, p);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function _assertThisInitialized(self) {
|
|
357
|
+
if (self === void 0) {
|
|
358
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return self;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
365
|
+
if (!o) return;
|
|
366
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
367
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
368
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
369
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
370
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function _arrayLikeToArray(arr, len) {
|
|
374
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
375
|
+
|
|
376
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
377
|
+
|
|
378
|
+
return arr2;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
382
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
383
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
384
|
+
|
|
385
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
386
|
+
if (it) o = it;
|
|
387
|
+
var i = 0;
|
|
388
|
+
return function () {
|
|
389
|
+
if (i >= o.length) return {
|
|
390
|
+
done: true
|
|
391
|
+
};
|
|
392
|
+
return {
|
|
393
|
+
done: false,
|
|
394
|
+
value: o[i++]
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* ------------------------------------------------------------------------
|
|
404
|
+
* Class Definition
|
|
405
|
+
* ------------------------------------------------------------------------
|
|
406
|
+
*/
|
|
407
|
+
|
|
408
|
+
var SVGElement = /*#__PURE__*/function () {
|
|
409
|
+
function SVGElement(name, config) {
|
|
410
|
+
this.node = this._createElement(name);
|
|
411
|
+
|
|
412
|
+
if (config) {
|
|
413
|
+
this.set(config);
|
|
414
|
+
}
|
|
415
|
+
} // Create new SVG element `svg`, `g`, `path`, `line`, `circle`, `image`, etc.
|
|
416
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
var _proto = SVGElement.prototype;
|
|
420
|
+
|
|
421
|
+
_proto._createElement = function _createElement(tagName) {
|
|
422
|
+
return document.createElementNS('http://www.w3.org/2000/svg', tagName);
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
_proto.addClass = function addClass(className) {
|
|
426
|
+
this.node.setAttribute('class', className);
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
_proto.getBBox = function getBBox() {
|
|
430
|
+
return this.node.getBBox();
|
|
431
|
+
} // Apply attributes on the current node element
|
|
432
|
+
;
|
|
433
|
+
|
|
434
|
+
_proto.set = function set(property, value) {
|
|
435
|
+
if (typeof property === 'object') {
|
|
436
|
+
for (var attr in property) {
|
|
437
|
+
this.applyAttr(attr, property[attr]);
|
|
438
|
+
}
|
|
439
|
+
} else {
|
|
440
|
+
this.applyAttr(property, value);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
_proto.get = function get(property) {
|
|
445
|
+
return this.style.initial[property];
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
_proto.applyAttr = function applyAttr(property, value) {
|
|
449
|
+
this.node.setAttribute(hyphenate(property), value);
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
_proto.remove = function remove() {
|
|
453
|
+
removeElement(this.node);
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
return SVGElement;
|
|
457
|
+
}();
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* ------------------------------------------------------------------------
|
|
461
|
+
* Class Definition
|
|
462
|
+
* ------------------------------------------------------------------------
|
|
463
|
+
*/
|
|
464
|
+
|
|
465
|
+
var SVGShapeElement = /*#__PURE__*/function (_SVGElement) {
|
|
466
|
+
_inheritsLoose(SVGShapeElement, _SVGElement);
|
|
467
|
+
|
|
468
|
+
function SVGShapeElement(name, config, style) {
|
|
469
|
+
var _this;
|
|
470
|
+
|
|
471
|
+
if (style === void 0) {
|
|
472
|
+
style = {};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
_this = _SVGElement.call(this, name, config) || this;
|
|
476
|
+
_this.isHovered = false;
|
|
477
|
+
_this.isSelected = false;
|
|
478
|
+
_this.style = style;
|
|
479
|
+
_this.style.current = {};
|
|
480
|
+
|
|
481
|
+
_this.updateStyle();
|
|
482
|
+
|
|
483
|
+
return _this;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
var _proto = SVGShapeElement.prototype;
|
|
487
|
+
|
|
488
|
+
_proto.setStyle = function setStyle(property, value) {
|
|
489
|
+
if (typeof property === 'object') {
|
|
490
|
+
merge(this.style.current, property);
|
|
491
|
+
} else {
|
|
492
|
+
var _merge;
|
|
493
|
+
|
|
494
|
+
merge(this.style.current, (_merge = {}, _merge[property] = value, _merge));
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
this.updateStyle();
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
_proto.updateStyle = function updateStyle() {
|
|
501
|
+
var attrs = {};
|
|
502
|
+
merge(attrs, this.style.initial);
|
|
503
|
+
merge(attrs, this.style.current);
|
|
504
|
+
|
|
505
|
+
if (this.isHovered) {
|
|
506
|
+
merge(attrs, this.style.hover);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (this.isSelected) {
|
|
510
|
+
merge(attrs, this.style.selected);
|
|
511
|
+
|
|
512
|
+
if (this.isHovered) {
|
|
513
|
+
merge(attrs, this.style.selectedHover);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
this.set(attrs);
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
return SVGShapeElement;
|
|
521
|
+
}(SVGElement);
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* ------------------------------------------------------------------------
|
|
525
|
+
* Class Definition
|
|
526
|
+
* ------------------------------------------------------------------------
|
|
527
|
+
*/
|
|
528
|
+
|
|
529
|
+
var SVGTextElement = /*#__PURE__*/function (_SVGShapeElement) {
|
|
530
|
+
_inheritsLoose(SVGTextElement, _SVGShapeElement);
|
|
531
|
+
|
|
532
|
+
function SVGTextElement(config, style) {
|
|
533
|
+
return _SVGShapeElement.call(this, 'text', config, style) || this;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
var _proto = SVGTextElement.prototype;
|
|
537
|
+
|
|
538
|
+
_proto.applyAttr = function applyAttr(attr, value) {
|
|
539
|
+
attr === 'text' ? this.node.textContent = value : _SVGShapeElement.prototype.applyAttr.call(this, attr, value);
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
return SVGTextElement;
|
|
543
|
+
}(SVGShapeElement);
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* ------------------------------------------------------------------------
|
|
547
|
+
* Class Definition
|
|
548
|
+
* ------------------------------------------------------------------------
|
|
549
|
+
*/
|
|
550
|
+
|
|
551
|
+
var SVGImageElement = /*#__PURE__*/function (_SVGShapeElement) {
|
|
552
|
+
_inheritsLoose(SVGImageElement, _SVGShapeElement);
|
|
553
|
+
|
|
554
|
+
function SVGImageElement(config, style) {
|
|
555
|
+
return _SVGShapeElement.call(this, 'image', config, style) || this;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
var _proto = SVGImageElement.prototype;
|
|
559
|
+
|
|
560
|
+
_proto.applyAttr = function applyAttr(attr, value) {
|
|
561
|
+
var imageUrl;
|
|
562
|
+
|
|
563
|
+
if (attr === 'image') {
|
|
564
|
+
// This get executed when we have url in series.markers[0].scale.someScale.url
|
|
565
|
+
if (typeof value === 'object') {
|
|
566
|
+
imageUrl = value.url;
|
|
567
|
+
this.offset = value.offset || [0, 0];
|
|
568
|
+
} else {
|
|
569
|
+
imageUrl = value;
|
|
570
|
+
this.offset = [0, 0];
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
this.node.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageUrl); // Set width and height then call this `applyAttr` again
|
|
574
|
+
|
|
575
|
+
this.width = 23;
|
|
576
|
+
this.height = 23;
|
|
577
|
+
this.applyAttr('width', this.width);
|
|
578
|
+
this.applyAttr('height', this.height);
|
|
579
|
+
this.applyAttr('x', this.cx - this.width / 2 + this.offset[0]);
|
|
580
|
+
this.applyAttr('y', this.cy - this.height / 2 + this.offset[1]);
|
|
581
|
+
} else if (attr == 'cx') {
|
|
582
|
+
this.cx = value;
|
|
583
|
+
|
|
584
|
+
if (this.width) {
|
|
585
|
+
this.applyAttr('x', value - this.width / 2 + this.offset[0]);
|
|
586
|
+
}
|
|
587
|
+
} else if (attr == 'cy') {
|
|
588
|
+
this.cy = value;
|
|
589
|
+
|
|
590
|
+
if (this.height) {
|
|
591
|
+
this.applyAttr('y', value - this.height / 2 + this.offset[1]);
|
|
592
|
+
}
|
|
593
|
+
} else {
|
|
594
|
+
// This time Call SVGElement
|
|
595
|
+
_SVGShapeElement.prototype.applyAttr.apply(this, arguments);
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
return SVGImageElement;
|
|
600
|
+
}(SVGShapeElement);
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* ------------------------------------------------------------------------
|
|
604
|
+
* Class Definition
|
|
605
|
+
* ------------------------------------------------------------------------
|
|
606
|
+
*/
|
|
607
|
+
|
|
608
|
+
var SVGCanvasElement = /*#__PURE__*/function (_SVGElement) {
|
|
609
|
+
_inheritsLoose(SVGCanvasElement, _SVGElement);
|
|
610
|
+
|
|
611
|
+
function SVGCanvasElement(container) {
|
|
612
|
+
var _this;
|
|
613
|
+
|
|
614
|
+
_this = _SVGElement.call(this, 'svg') || this; // Create svg element for holding the whole map
|
|
615
|
+
|
|
616
|
+
_this._container = container; // Create the defs element
|
|
617
|
+
|
|
618
|
+
_this._defsElement = new SVGElement('defs'); // Create group element which will hold the paths (regions)
|
|
619
|
+
|
|
620
|
+
_this._rootElement = new SVGElement('g', {
|
|
621
|
+
id: 'jvm-regions-group'
|
|
622
|
+
}); // Append the defs element to the this.node (SVG tag)
|
|
623
|
+
|
|
624
|
+
_this.node.appendChild(_this._defsElement.node); // Append the group to this.node (SVG tag)
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
_this.node.appendChild(_this._rootElement.node); // Append this.node (SVG tag) to the container
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
_this._container.appendChild(_this.node);
|
|
631
|
+
|
|
632
|
+
return _this;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
var _proto = SVGCanvasElement.prototype;
|
|
636
|
+
|
|
637
|
+
_proto.setSize = function setSize(width, height) {
|
|
638
|
+
this.node.setAttribute('width', width);
|
|
639
|
+
this.node.setAttribute('height', height);
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
_proto.applyTransformParams = function applyTransformParams(scale, transX, transY) {
|
|
643
|
+
this._rootElement.node.setAttribute('transform', "scale(" + scale + ") translate(" + transX + ", " + transY + ")");
|
|
644
|
+
} // Create `path` element
|
|
645
|
+
;
|
|
646
|
+
|
|
647
|
+
_proto.createPath = function createPath(config, style) {
|
|
648
|
+
var path = new SVGShapeElement('path', config, style);
|
|
649
|
+
path.node.setAttribute('fill-rule', 'evenodd');
|
|
650
|
+
return this.add(path);
|
|
651
|
+
} // Create `circle` element
|
|
652
|
+
;
|
|
653
|
+
|
|
654
|
+
_proto.createCircle = function createCircle(config, style, group) {
|
|
655
|
+
var circle = new SVGShapeElement('circle', config, style);
|
|
656
|
+
return this.add(circle, group);
|
|
657
|
+
} // Create `line` element
|
|
658
|
+
;
|
|
659
|
+
|
|
660
|
+
_proto.createLine = function createLine(config, style, group) {
|
|
661
|
+
var line = new SVGShapeElement('line', config, style);
|
|
662
|
+
return this.add(line, group);
|
|
663
|
+
} // Create `text` element
|
|
664
|
+
;
|
|
665
|
+
|
|
666
|
+
_proto.createText = function createText(config, style, group) {
|
|
667
|
+
var text = new SVGTextElement(config, style); // extends SVGShapeElement
|
|
668
|
+
|
|
669
|
+
return this.add(text, group);
|
|
670
|
+
} // Create `image` element
|
|
671
|
+
;
|
|
672
|
+
|
|
673
|
+
_proto.createImage = function createImage(config, style, group) {
|
|
674
|
+
var image = new SVGImageElement(config, style); // extends SVGShapeElement
|
|
675
|
+
|
|
676
|
+
return this.add(image, group);
|
|
677
|
+
} // Create `g` element
|
|
678
|
+
;
|
|
679
|
+
|
|
680
|
+
_proto.createGroup = function createGroup(id) {
|
|
681
|
+
var group = new SVGElement('g');
|
|
682
|
+
this.node.appendChild(group.node);
|
|
683
|
+
|
|
684
|
+
if (id) {
|
|
685
|
+
group.node.id = id;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
group.canvas = this;
|
|
689
|
+
return group;
|
|
690
|
+
} // Add some element to a spcific group or the root element if the group isn't given
|
|
691
|
+
;
|
|
692
|
+
|
|
693
|
+
_proto.add = function add(element, group) {
|
|
694
|
+
group = group || this._rootElement;
|
|
695
|
+
group.node.appendChild(element.node);
|
|
696
|
+
return element;
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
return SVGCanvasElement;
|
|
700
|
+
}(SVGElement);
|
|
701
|
+
|
|
702
|
+
var eventRegistry = {};
|
|
703
|
+
var eventUid = 1;
|
|
704
|
+
/**
|
|
705
|
+
* ------------------------------------------------------------------------
|
|
706
|
+
* Event Handler
|
|
707
|
+
* ------------------------------------------------------------------------
|
|
708
|
+
*/
|
|
709
|
+
|
|
710
|
+
var EventHandler = {
|
|
711
|
+
on: function on(element, event, handler, options) {
|
|
712
|
+
if (options === void 0) {
|
|
713
|
+
options = {};
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
var uid = "jvm:" + event + "::" + eventUid++;
|
|
717
|
+
eventRegistry[uid] = {
|
|
718
|
+
selector: element,
|
|
719
|
+
handler: handler
|
|
720
|
+
};
|
|
721
|
+
handler._uid = uid;
|
|
722
|
+
element.addEventListener(event, handler, options);
|
|
723
|
+
},
|
|
724
|
+
delegate: function delegate(element, event, selector, handler) {
|
|
725
|
+
event = event.split(' ');
|
|
726
|
+
event.forEach(function (eventName) {
|
|
727
|
+
EventHandler.on(element, eventName, function (e) {
|
|
728
|
+
var target = e.target;
|
|
729
|
+
|
|
730
|
+
if (target.matches(selector)) {
|
|
731
|
+
handler.call(target, e);
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
});
|
|
735
|
+
},
|
|
736
|
+
off: function off(element, event, handler) {
|
|
737
|
+
var eventType = event.split(':')[1];
|
|
738
|
+
element.removeEventListener(eventType, handler);
|
|
739
|
+
delete eventRegistry[handler._uid];
|
|
740
|
+
},
|
|
741
|
+
flush: function flush() {
|
|
742
|
+
Object.keys(eventRegistry).forEach(function (event) {
|
|
743
|
+
EventHandler.off(eventRegistry[event].selector, event, eventRegistry[event].handler);
|
|
744
|
+
});
|
|
745
|
+
},
|
|
746
|
+
getEventRegistry: function getEventRegistry() {
|
|
747
|
+
return eventRegistry;
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
function setupContainerEvents() {
|
|
752
|
+
var _this = this;
|
|
753
|
+
|
|
754
|
+
var mouseDown = false,
|
|
755
|
+
oldPageX,
|
|
756
|
+
oldPageY,
|
|
757
|
+
map = this;
|
|
758
|
+
|
|
759
|
+
if (this.params.draggable) {
|
|
760
|
+
EventHandler.on(this.container, 'mousemove', function (e) {
|
|
761
|
+
if (!mouseDown) {
|
|
762
|
+
return false;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
map.transX -= (oldPageX - e.pageX) / map.scale;
|
|
766
|
+
map.transY -= (oldPageY - e.pageY) / map.scale;
|
|
767
|
+
|
|
768
|
+
map._applyTransform();
|
|
769
|
+
|
|
770
|
+
oldPageX = e.pageX;
|
|
771
|
+
oldPageY = e.pageY;
|
|
772
|
+
});
|
|
773
|
+
EventHandler.on(this.container, 'mousedown', function (e) {
|
|
774
|
+
mouseDown = true;
|
|
775
|
+
oldPageX = e.pageX;
|
|
776
|
+
oldPageY = e.pageY;
|
|
777
|
+
return false;
|
|
778
|
+
});
|
|
779
|
+
EventHandler.on(document.body, 'mouseup', function () {
|
|
780
|
+
mouseDown = false;
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
if (this.params.zoomOnScroll) {
|
|
785
|
+
EventHandler.on(this.container, 'wheel', function (event) {
|
|
786
|
+
var deltaY = 0;
|
|
787
|
+
deltaY = (event.deltaY || -event.wheelDelta || event.detail) >> 10 || 1;
|
|
788
|
+
deltaY = deltaY * 75;
|
|
789
|
+
|
|
790
|
+
var rect = _this.container.getBoundingClientRect(),
|
|
791
|
+
offsetX = event.pageX - rect.left - window.pageXOffset,
|
|
792
|
+
offsetY = event.pageY - rect.top - window.pageYOffset,
|
|
793
|
+
zoomStep = Math.pow(1 + map.params.zoomOnScrollSpeed / 1000, -1.5 * deltaY);
|
|
794
|
+
|
|
795
|
+
if (map.tooltip) {
|
|
796
|
+
map.tooltip.hide();
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
map._setScale(map.scale * zoomStep, offsetX, offsetY);
|
|
800
|
+
|
|
801
|
+
event.preventDefault();
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
var Events = {
|
|
807
|
+
onViewportChange: 'viewport:changed',
|
|
808
|
+
onRegionClick: 'region:clicked',
|
|
809
|
+
onMarkerClick: 'marker:clicked',
|
|
810
|
+
onRegionSelected: 'region:selected',
|
|
811
|
+
onMarkerSelected: 'marker:selected',
|
|
812
|
+
onRegionTooltipShow: 'region.tooltip:show',
|
|
813
|
+
onMarkerTooltipShow: 'marker.tooltip:show',
|
|
814
|
+
onLoaded: 'map:loaded',
|
|
815
|
+
onDestroyed: 'map:destroyed'
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
function parseEvent(map, selector, isTooltip) {
|
|
819
|
+
var element = getElement(selector),
|
|
820
|
+
classes = element.getAttribute('class'),
|
|
821
|
+
type = classes.indexOf('jvm-region') === -1 ? 'marker' : 'region',
|
|
822
|
+
code = type === 'region' ? element.getAttribute('data-code') : element.getAttribute('data-index'),
|
|
823
|
+
event = type + ":selected"; // Init tooltip event
|
|
824
|
+
|
|
825
|
+
if (isTooltip) {
|
|
826
|
+
event = type + ".tooltip:show";
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
return {
|
|
830
|
+
event: event,
|
|
831
|
+
type: type,
|
|
832
|
+
code: code,
|
|
833
|
+
element: type === 'region' ? map.regions[code].element : map.markers[code].element,
|
|
834
|
+
tooltipText: type === 'region' ? map.mapData.paths[code].name || '' : map.markers[code].config.name || ''
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function setupElementEvents() {
|
|
839
|
+
var map = this,
|
|
840
|
+
container = this.container;
|
|
841
|
+
var pageX, pageY, mouseMoved;
|
|
842
|
+
EventHandler.on(container, 'mousemove', function (event) {
|
|
843
|
+
if (Math.abs(pageX - event.pageX) + Math.abs(pageY - event.pageY) > 2) {
|
|
844
|
+
mouseMoved = true;
|
|
845
|
+
}
|
|
846
|
+
}); // When the mouse is pressed
|
|
847
|
+
|
|
848
|
+
EventHandler.delegate(container, 'mousedown', '.jvm-element', function (event) {
|
|
849
|
+
pageX = event.pageX;
|
|
850
|
+
pageY = event.pageY;
|
|
851
|
+
mouseMoved = false;
|
|
852
|
+
}); // When the mouse is over the region/marker | When the mouse is out the region/marker
|
|
853
|
+
|
|
854
|
+
EventHandler.delegate(container, 'mouseover mouseout', '.jvm-element', function (event) {
|
|
855
|
+
var data = parseEvent(map, this, true);
|
|
856
|
+
var showTooltip = map.params.showTooltip;
|
|
857
|
+
|
|
858
|
+
if (event.type === 'mouseover') {
|
|
859
|
+
data.element.hover(true);
|
|
860
|
+
map.tooltip.text(data.tooltipText);
|
|
861
|
+
|
|
862
|
+
map._emit(data.event, [event, map.tooltip, data.code]);
|
|
863
|
+
|
|
864
|
+
if (!event.defaultPrevented) {
|
|
865
|
+
if (showTooltip) {
|
|
866
|
+
map.tooltip.show();
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
} else {
|
|
870
|
+
data.element.hover(false);
|
|
871
|
+
|
|
872
|
+
if (showTooltip) {
|
|
873
|
+
map.tooltip.hide();
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}); // When the click is released
|
|
877
|
+
|
|
878
|
+
EventHandler.delegate(container, 'mouseup', '.jvm-element', function (event) {
|
|
879
|
+
var data = parseEvent(map, this);
|
|
880
|
+
|
|
881
|
+
if (mouseMoved) {
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
if (data.type === 'region' && map.params.regionsSelectable || data.type === 'marker' && map.params.markersSelectable) {
|
|
886
|
+
var element = data.element; // We're checking if regions/markers|SelectableOne option is presented
|
|
887
|
+
|
|
888
|
+
if (map.params[data.type + "sSelectableOne"]) {
|
|
889
|
+
map._clearSelected(data.type + "s");
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
if (data.element.isSelected) {
|
|
893
|
+
element.select(false);
|
|
894
|
+
} else {
|
|
895
|
+
element.select(true);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
map._emit(data.event, [data.code, element.isSelected, map._getSelected(data.type + "s")]);
|
|
899
|
+
}
|
|
900
|
+
}); // When region/marker is clicked
|
|
901
|
+
|
|
902
|
+
EventHandler.delegate(container, 'click', '.jvm-element', function (event) {
|
|
903
|
+
var _parseEvent = parseEvent(map, this),
|
|
904
|
+
type = _parseEvent.type,
|
|
905
|
+
code = _parseEvent.code;
|
|
906
|
+
|
|
907
|
+
map._emit(type === 'region' ? Events.onRegionClick : Events.onMarkerClick, [event, code]);
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
function setupZoomButtons() {
|
|
912
|
+
var _this = this;
|
|
913
|
+
|
|
914
|
+
var map = this;
|
|
915
|
+
var zoomin = createElement('div', 'jvm-zoom-btn jvm-zoomin', '+', true);
|
|
916
|
+
var zoomout = createElement('div', 'jvm-zoom-btn jvm-zoomout', '−', true);
|
|
917
|
+
this.container.appendChild(zoomin);
|
|
918
|
+
this.container.appendChild(zoomout);
|
|
919
|
+
EventHandler.on(zoomin, 'click', function () {
|
|
920
|
+
_this._setScale(map.scale * map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
|
|
921
|
+
});
|
|
922
|
+
EventHandler.on(zoomout, 'click', function () {
|
|
923
|
+
_this._setScale(map.scale / map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
function setupContainerTouchEvents() {
|
|
928
|
+
var map = this,
|
|
929
|
+
touchStartScale,
|
|
930
|
+
touchStartDistance,
|
|
931
|
+
touchX,
|
|
932
|
+
touchY,
|
|
933
|
+
centerTouchX,
|
|
934
|
+
centerTouchY,
|
|
935
|
+
lastTouchesLength;
|
|
936
|
+
|
|
937
|
+
var handleTouchEvent = function handleTouchEvent(e) {
|
|
938
|
+
var touches = e.touches,
|
|
939
|
+
offset,
|
|
940
|
+
scale,
|
|
941
|
+
transXOld,
|
|
942
|
+
transYOld;
|
|
943
|
+
|
|
944
|
+
if (e.type == 'touchstart') {
|
|
945
|
+
lastTouchesLength = 0;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
if (touches.length == 1) {
|
|
949
|
+
if (lastTouchesLength == 1) {
|
|
950
|
+
transXOld = map.transX;
|
|
951
|
+
transYOld = map.transY;
|
|
952
|
+
map.transX -= (touchX - touches[0].pageX) / map.scale;
|
|
953
|
+
map.transY -= (touchY - touches[0].pageY) / map.scale;
|
|
954
|
+
map.tooltip.hide();
|
|
955
|
+
|
|
956
|
+
map._applyTransform();
|
|
957
|
+
|
|
958
|
+
if (transXOld != map.transX || transYOld != map.transY) {
|
|
959
|
+
e.preventDefault();
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
touchX = touches[0].pageX;
|
|
964
|
+
touchY = touches[0].pageY;
|
|
965
|
+
} else if (touches.length == 2) {
|
|
966
|
+
if (lastTouchesLength == 2) {
|
|
967
|
+
scale = Math.sqrt(Math.pow(touches[0].pageX - touches[1].pageX, 2) + Math.pow(touches[0].pageY - touches[1].pageY, 2)) / touchStartDistance;
|
|
968
|
+
|
|
969
|
+
map._setScale(touchStartScale * scale, centerTouchX, centerTouchY);
|
|
970
|
+
|
|
971
|
+
map.tooltip.hide();
|
|
972
|
+
e.preventDefault();
|
|
973
|
+
} else {
|
|
974
|
+
var rect = map.container.selector.getBoundingClientRect();
|
|
975
|
+
offset = {
|
|
976
|
+
top: rect.top + window.scrollY,
|
|
977
|
+
left: rect.left + window.scrollX
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
if (touches[0].pageX > touches[1].pageX) {
|
|
981
|
+
centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2;
|
|
982
|
+
} else {
|
|
983
|
+
centerTouchX = touches[0].pageX + (touches[1].pageX - touches[0].pageX) / 2;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
if (touches[0].pageY > touches[1].pageY) {
|
|
987
|
+
centerTouchY = touches[1].pageY + (touches[0].pageY - touches[1].pageY) / 2;
|
|
988
|
+
} else {
|
|
989
|
+
centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
centerTouchX -= offset.left;
|
|
993
|
+
centerTouchY -= offset.top;
|
|
994
|
+
touchStartScale = map.scale;
|
|
995
|
+
touchStartDistance = Math.sqrt(Math.pow(touches[0].pageX - touches[1].pageX, 2) + Math.pow(touches[0].pageY - touches[1].pageY, 2));
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
lastTouchesLength = touches.length;
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
EventHandler.on(map.container, 'touchstart', handleTouchEvent);
|
|
1003
|
+
EventHandler.on(map.container, 'touchmove', handleTouchEvent);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* ------------------------------------------------------------------------
|
|
1008
|
+
* Class Definition
|
|
1009
|
+
* ------------------------------------------------------------------------
|
|
1010
|
+
*/
|
|
1011
|
+
|
|
1012
|
+
var BaseComponent = /*#__PURE__*/function () {
|
|
1013
|
+
function BaseComponent() {}
|
|
1014
|
+
|
|
1015
|
+
var _proto = BaseComponent.prototype;
|
|
1016
|
+
|
|
1017
|
+
_proto.dispose = function dispose() {
|
|
1018
|
+
if (this._tooltip) {
|
|
1019
|
+
removeElement(this._tooltip);
|
|
1020
|
+
} else {
|
|
1021
|
+
// @todo: move shape in base component in v2
|
|
1022
|
+
this.shape.remove();
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
for (var _iterator = _createForOfIteratorHelperLoose(Object.getOwnPropertyNames(this)), _step; !(_step = _iterator()).done;) {
|
|
1026
|
+
var propertyName = _step.value;
|
|
1027
|
+
this[propertyName] = null;
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
return BaseComponent;
|
|
1032
|
+
}();
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* ------------------------------------------------------------------------
|
|
1036
|
+
* Interactable
|
|
1037
|
+
* ------------------------------------------------------------------------
|
|
1038
|
+
*/
|
|
1039
|
+
var Interactable = {
|
|
1040
|
+
getLabelText: function getLabelText(key, label) {
|
|
1041
|
+
if (!label) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
if (typeof label.render === 'function') {
|
|
1046
|
+
var params = []; // Pass additional paramater (Marker config object) in case it's a Marker.
|
|
1047
|
+
|
|
1048
|
+
if (this.config && this.config.marker) {
|
|
1049
|
+
params.push(this.config.marker);
|
|
1050
|
+
} // Becuase we need to add the key always at the end
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
params.push(key);
|
|
1054
|
+
return label.render.apply(this, params);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
return key;
|
|
1058
|
+
},
|
|
1059
|
+
getLabelOffsets: function getLabelOffsets(key, label) {
|
|
1060
|
+
if (typeof label.offsets === 'function') {
|
|
1061
|
+
return label.offsets(key);
|
|
1062
|
+
} // If offsets are an array of offsets e.g offsets: [ [0, 25], [10, 15] ]
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
if (Array.isArray(label.offsets)) {
|
|
1066
|
+
return label.offsets[key];
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
return [0, 0];
|
|
1070
|
+
},
|
|
1071
|
+
setStyle: function setStyle(property, value) {
|
|
1072
|
+
this.shape.setStyle(property, value);
|
|
1073
|
+
},
|
|
1074
|
+
remove: function remove() {
|
|
1075
|
+
this.shape.remove();
|
|
1076
|
+
if (this.label) this.label.remove();
|
|
1077
|
+
},
|
|
1078
|
+
hover: function hover(state) {
|
|
1079
|
+
this._setStatus('isHovered', state);
|
|
1080
|
+
},
|
|
1081
|
+
select: function select(state) {
|
|
1082
|
+
this._setStatus('isSelected', state);
|
|
1083
|
+
},
|
|
1084
|
+
// Private
|
|
1085
|
+
_setStatus: function _setStatus(property, state) {
|
|
1086
|
+
this.shape[property] = state;
|
|
1087
|
+
this.shape.updateStyle();
|
|
1088
|
+
this[property] = state;
|
|
1089
|
+
|
|
1090
|
+
if (this.label) {
|
|
1091
|
+
this.label[property] = state;
|
|
1092
|
+
this.label.updateStyle();
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* ------------------------------------------------------------------------
|
|
1099
|
+
* Class Definition
|
|
1100
|
+
* ------------------------------------------------------------------------
|
|
1101
|
+
*/
|
|
1102
|
+
|
|
1103
|
+
var Region = /*#__PURE__*/function (_BaseComponent) {
|
|
1104
|
+
_inheritsLoose(Region, _BaseComponent);
|
|
1105
|
+
|
|
1106
|
+
function Region(_ref) {
|
|
1107
|
+
var _this;
|
|
1108
|
+
|
|
1109
|
+
var map = _ref.map,
|
|
1110
|
+
code = _ref.code,
|
|
1111
|
+
path = _ref.path,
|
|
1112
|
+
style = _ref.style,
|
|
1113
|
+
label = _ref.label,
|
|
1114
|
+
labelStyle = _ref.labelStyle,
|
|
1115
|
+
labelsGroup = _ref.labelsGroup;
|
|
1116
|
+
_this = _BaseComponent.call(this) || this;
|
|
1117
|
+
_this._map = map;
|
|
1118
|
+
_this.shape = _this._createRegion(path, code, style);
|
|
1119
|
+
|
|
1120
|
+
var bbox = _this.shape.getBBox();
|
|
1121
|
+
|
|
1122
|
+
var text = _this.getLabelText(code, label); // If label is passed and render function returns something
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
if (label && text) {
|
|
1126
|
+
var offsets = _this.getLabelOffsets(code);
|
|
1127
|
+
|
|
1128
|
+
_this.labelX = bbox.x + bbox.width / 2 + offsets[0];
|
|
1129
|
+
_this.labelY = bbox.y + bbox.height / 2 + offsets[1];
|
|
1130
|
+
_this.label = _this._map.canvas.createText({
|
|
1131
|
+
text: text,
|
|
1132
|
+
textAnchor: 'middle',
|
|
1133
|
+
alignmentBaseline: 'central',
|
|
1134
|
+
dataCode: code,
|
|
1135
|
+
x: _this.labelX,
|
|
1136
|
+
y: _this.labelY
|
|
1137
|
+
}, labelStyle, labelsGroup);
|
|
1138
|
+
|
|
1139
|
+
_this.label.addClass('jvm-region jvm-element');
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
return _this;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
var _proto = Region.prototype;
|
|
1146
|
+
|
|
1147
|
+
_proto._createRegion = function _createRegion(path, code, style) {
|
|
1148
|
+
path = this._map.canvas.createPath({
|
|
1149
|
+
d: path,
|
|
1150
|
+
dataCode: code
|
|
1151
|
+
}, style);
|
|
1152
|
+
path.addClass('jvm-region jvm-element');
|
|
1153
|
+
return path;
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
_proto.updateLabelPosition = function updateLabelPosition() {
|
|
1157
|
+
if (this.label) {
|
|
1158
|
+
this.label.set({
|
|
1159
|
+
x: this.labelX * this._map.scale + this._map.transX * this._map.scale,
|
|
1160
|
+
y: this.labelY * this._map.scale + this._map.transY * this._map.scale
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
return Region;
|
|
1166
|
+
}(BaseComponent);
|
|
1167
|
+
|
|
1168
|
+
inherit(Region, Interactable);
|
|
1169
|
+
|
|
1170
|
+
function createRegions() {
|
|
1171
|
+
var code, region;
|
|
1172
|
+
this.regionLabelsGroup = this.regionLabelsGroup || this.canvas.createGroup('jvm-regions-labels-group');
|
|
1173
|
+
|
|
1174
|
+
for (code in this.mapData.paths) {
|
|
1175
|
+
region = new Region({
|
|
1176
|
+
map: this,
|
|
1177
|
+
code: code,
|
|
1178
|
+
path: this.mapData.paths[code].path,
|
|
1179
|
+
style: merge({}, this.params.regionStyle),
|
|
1180
|
+
labelStyle: this.params.regionLabelStyle,
|
|
1181
|
+
labelsGroup: this.regionLabelsGroup,
|
|
1182
|
+
label: this.params.labels && this.params.labels.regions
|
|
1183
|
+
});
|
|
1184
|
+
this.regions[code] = {
|
|
1185
|
+
config: this.mapData.paths[code],
|
|
1186
|
+
element: region
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* ------------------------------------------------------------------------
|
|
1193
|
+
* Class Definition
|
|
1194
|
+
* ------------------------------------------------------------------------
|
|
1195
|
+
*/
|
|
1196
|
+
|
|
1197
|
+
var Line = /*#__PURE__*/function (_BaseComponent) {
|
|
1198
|
+
_inheritsLoose(Line, _BaseComponent);
|
|
1199
|
+
|
|
1200
|
+
function Line(_ref) {
|
|
1201
|
+
var _this;
|
|
1202
|
+
|
|
1203
|
+
var index = _ref.index,
|
|
1204
|
+
map = _ref.map,
|
|
1205
|
+
style = _ref.style,
|
|
1206
|
+
x1 = _ref.x1,
|
|
1207
|
+
y1 = _ref.y1,
|
|
1208
|
+
x2 = _ref.x2,
|
|
1209
|
+
y2 = _ref.y2,
|
|
1210
|
+
group = _ref.group,
|
|
1211
|
+
config = _ref.config;
|
|
1212
|
+
_this = _BaseComponent.call(this) || this;
|
|
1213
|
+
_this.config = config;
|
|
1214
|
+
_this.shape = map.canvas.createLine({
|
|
1215
|
+
x1: x1,
|
|
1216
|
+
y1: y1,
|
|
1217
|
+
x2: x2,
|
|
1218
|
+
y2: y2,
|
|
1219
|
+
dataIndex: index
|
|
1220
|
+
}, style, group);
|
|
1221
|
+
|
|
1222
|
+
_this.shape.addClass('jvm-line');
|
|
1223
|
+
|
|
1224
|
+
return _this;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
var _proto = Line.prototype;
|
|
1228
|
+
|
|
1229
|
+
_proto.setStyle = function setStyle(property, value) {
|
|
1230
|
+
this.shape.setStyle(property, value);
|
|
1231
|
+
};
|
|
1232
|
+
|
|
1233
|
+
return Line;
|
|
1234
|
+
}(BaseComponent);
|
|
1235
|
+
|
|
1236
|
+
function createLines(lines, markers, isRecentlyCreated) {
|
|
1237
|
+
if (isRecentlyCreated === void 0) {
|
|
1238
|
+
isRecentlyCreated = false;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
var point1 = false,
|
|
1242
|
+
point2 = false; // Create group for holding lines
|
|
1243
|
+
// we're checking if `linesGroup` exists or not becuase we may add lines
|
|
1244
|
+
// after the map has loaded so we will append the futured lines to this group as well.
|
|
1245
|
+
|
|
1246
|
+
this.linesGroup = this.linesGroup || this.canvas.createGroup('jvm-lines-group');
|
|
1247
|
+
|
|
1248
|
+
for (var index in lines) {
|
|
1249
|
+
var config = lines[index];
|
|
1250
|
+
|
|
1251
|
+
for (var mindex in markers) {
|
|
1252
|
+
var markerConfig = isRecentlyCreated ? markers[mindex].config : markers[mindex];
|
|
1253
|
+
|
|
1254
|
+
if (markerConfig.name === config.from) {
|
|
1255
|
+
point1 = this.getMarkerPosition(markerConfig);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
if (markerConfig.name === config.to) {
|
|
1259
|
+
point2 = this.getMarkerPosition(markerConfig);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
if (point1 !== false && point2 !== false) {
|
|
1264
|
+
// Register lines with unique keys
|
|
1265
|
+
this.lines[getLineUid(config.from, config.to)] = new Line({
|
|
1266
|
+
index: index,
|
|
1267
|
+
map: this,
|
|
1268
|
+
// Merge the default `lineStyle` object with the custom `line` config style
|
|
1269
|
+
style: merge({
|
|
1270
|
+
initial: this.params.lineStyle
|
|
1271
|
+
}, {
|
|
1272
|
+
initial: config.style || {}
|
|
1273
|
+
}, true),
|
|
1274
|
+
x1: point1.x,
|
|
1275
|
+
y1: point1.y,
|
|
1276
|
+
x2: point2.x,
|
|
1277
|
+
y2: point2.y,
|
|
1278
|
+
group: this.linesGroup,
|
|
1279
|
+
config: config
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* ------------------------------------------------------------------------
|
|
1287
|
+
* Class Definition
|
|
1288
|
+
* ------------------------------------------------------------------------
|
|
1289
|
+
*/
|
|
1290
|
+
|
|
1291
|
+
var Marker = /*#__PURE__*/function (_BaseComponent) {
|
|
1292
|
+
_inheritsLoose(Marker, _BaseComponent);
|
|
1293
|
+
|
|
1294
|
+
function Marker(_ref) {
|
|
1295
|
+
var _this;
|
|
1296
|
+
|
|
1297
|
+
var index = _ref.index,
|
|
1298
|
+
style = _ref.style,
|
|
1299
|
+
label = _ref.label,
|
|
1300
|
+
cx = _ref.cx,
|
|
1301
|
+
cy = _ref.cy,
|
|
1302
|
+
map = _ref.map,
|
|
1303
|
+
group = _ref.group;
|
|
1304
|
+
_this = _BaseComponent.call(this) || this; // Private
|
|
1305
|
+
|
|
1306
|
+
_this._map = map;
|
|
1307
|
+
_this._isImage = !!style.initial.image; // Protected
|
|
1308
|
+
|
|
1309
|
+
_this.config = arguments[0];
|
|
1310
|
+
_this.shape = map.canvas[_this._isImage ? 'createImage' : 'createCircle']({
|
|
1311
|
+
dataIndex: index,
|
|
1312
|
+
cx: cx,
|
|
1313
|
+
cy: cy
|
|
1314
|
+
}, _this._getStyle(), group);
|
|
1315
|
+
|
|
1316
|
+
_this.shape.addClass('jvm-marker jvm-element');
|
|
1317
|
+
|
|
1318
|
+
if (_this._isImage) {
|
|
1319
|
+
_this.updateLabelPosition();
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
if (label) {
|
|
1323
|
+
_this._createLabel(_this.config);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
return _this;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
var _proto = Marker.prototype;
|
|
1330
|
+
|
|
1331
|
+
_proto.updateLabelPosition = function updateLabelPosition() {
|
|
1332
|
+
if (this.label) {
|
|
1333
|
+
this.label.set({
|
|
1334
|
+
x: this._labelX * this._map.scale + this._offsets[0] + this._map.transX * this._map.scale + 5 + (this._isImage ? (this.shape.width || 0) / 2 : this.shape.node.r.baseVal.value),
|
|
1335
|
+
y: this._labelY * this._map.scale + this._map.transY * this._map.scale + this._offsets[1]
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
|
|
1340
|
+
_proto._createLabel = function _createLabel(_ref2) {
|
|
1341
|
+
var index = _ref2.index,
|
|
1342
|
+
map = _ref2.map,
|
|
1343
|
+
label = _ref2.label,
|
|
1344
|
+
labelsGroup = _ref2.labelsGroup,
|
|
1345
|
+
cx = _ref2.cx,
|
|
1346
|
+
cy = _ref2.cy,
|
|
1347
|
+
marker = _ref2.marker,
|
|
1348
|
+
isRecentlyCreated = _ref2.isRecentlyCreated;
|
|
1349
|
+
var labelText = this.getLabelText(index, label);
|
|
1350
|
+
this._labelX = cx / map.scale - map.transX;
|
|
1351
|
+
this._labelY = cy / map.scale - map.transY;
|
|
1352
|
+
this._offsets = isRecentlyCreated && marker.offsets ? marker.offsets : this.getLabelOffsets(index, label);
|
|
1353
|
+
this.label = map.canvas.createText({
|
|
1354
|
+
text: labelText,
|
|
1355
|
+
dataIndex: index,
|
|
1356
|
+
x: this._labelX,
|
|
1357
|
+
y: this._labelY,
|
|
1358
|
+
dy: '0.6ex'
|
|
1359
|
+
}, map.params.markerLabelStyle, labelsGroup);
|
|
1360
|
+
this.label.addClass('jvm-marker jvm-element');
|
|
1361
|
+
|
|
1362
|
+
if (isRecentlyCreated) {
|
|
1363
|
+
this.updateLabelPosition();
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
_proto._getStyle = function _getStyle() {
|
|
1368
|
+
var style = {};
|
|
1369
|
+
|
|
1370
|
+
if (this._isImage) {
|
|
1371
|
+
style.initial = {
|
|
1372
|
+
image: this.config.style.initial.image
|
|
1373
|
+
};
|
|
1374
|
+
} else {
|
|
1375
|
+
style = this.config.style;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
return style;
|
|
1379
|
+
};
|
|
1380
|
+
|
|
1381
|
+
return Marker;
|
|
1382
|
+
}(BaseComponent);
|
|
1383
|
+
|
|
1384
|
+
inherit(Marker, Interactable);
|
|
1385
|
+
|
|
1386
|
+
function createMarkers(markers, isRecentlyCreated) {
|
|
1387
|
+
var _this = this;
|
|
1388
|
+
|
|
1389
|
+
if (markers === void 0) {
|
|
1390
|
+
markers = {};
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
if (isRecentlyCreated === void 0) {
|
|
1394
|
+
isRecentlyCreated = false;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
var markerConfig, marker, point, uid; // Create groups for holding markers and markers labels
|
|
1398
|
+
// We're checking if `markersGroup` exists or not becuase we may add markers after the map has loaded
|
|
1399
|
+
// So we will append the futured markers to this group as well.
|
|
1400
|
+
|
|
1401
|
+
this.markersGroup = this.markersGroup || this.canvas.createGroup('jvm-markers-group');
|
|
1402
|
+
this.markerLabelsGroup = this.markerLabelsGroup || this.canvas.createGroup('jvm-markers-labels-group');
|
|
1403
|
+
|
|
1404
|
+
for (var index in markers) {
|
|
1405
|
+
markerConfig = markers[index];
|
|
1406
|
+
point = this.getMarkerPosition(markerConfig);
|
|
1407
|
+
uid = markerConfig.coords.join(':'); // We're checking if recently created marker does already exist
|
|
1408
|
+
// If exists we don't need to create it again, so we'll continute
|
|
1409
|
+
// Becuase we may have more than one marker.
|
|
1410
|
+
|
|
1411
|
+
if (isRecentlyCreated) {
|
|
1412
|
+
if (Object.keys(this.markers).filter(function (i) {
|
|
1413
|
+
return _this.markers[i]._uid === uid;
|
|
1414
|
+
}).length) {
|
|
1415
|
+
continue;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
index = Object.keys(this.markers).length;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
if (point !== false) {
|
|
1422
|
+
marker = new Marker({
|
|
1423
|
+
index: index,
|
|
1424
|
+
map: this,
|
|
1425
|
+
// Merge the `markerStyle` object with the marker config `style` if presented.
|
|
1426
|
+
style: merge(this.params.markerStyle, {
|
|
1427
|
+
initial: markerConfig.style || {}
|
|
1428
|
+
}, true),
|
|
1429
|
+
label: this.params.labels && this.params.labels.markers,
|
|
1430
|
+
labelsGroup: this.markerLabelsGroup,
|
|
1431
|
+
cx: point.x,
|
|
1432
|
+
cy: point.y,
|
|
1433
|
+
group: this.markersGroup,
|
|
1434
|
+
marker: markerConfig,
|
|
1435
|
+
isRecentlyCreated: isRecentlyCreated
|
|
1436
|
+
}); // Check for marker duplication
|
|
1437
|
+
// this is useful when for example: a user clicks a button for creating marker two times
|
|
1438
|
+
// so it will remove the old one and the new one will take its place.
|
|
1439
|
+
|
|
1440
|
+
if (this.markers[index]) {
|
|
1441
|
+
this.removeMarkers([index]);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
this.markers[index] = {
|
|
1445
|
+
_uid: uid,
|
|
1446
|
+
config: markerConfig,
|
|
1447
|
+
element: marker
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* ------------------------------------------------------------------------
|
|
1455
|
+
* Class Definition
|
|
1456
|
+
* ------------------------------------------------------------------------
|
|
1457
|
+
*/
|
|
1458
|
+
|
|
1459
|
+
var Legend = /*#__PURE__*/function () {
|
|
1460
|
+
function Legend(options) {
|
|
1461
|
+
if (options === void 0) {
|
|
1462
|
+
options = {};
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
this._options = options;
|
|
1466
|
+
this._map = this._options.map;
|
|
1467
|
+
this._series = this._options.series;
|
|
1468
|
+
this._body = createElement('div', 'jvm-legend');
|
|
1469
|
+
|
|
1470
|
+
if (this._options.cssClass) {
|
|
1471
|
+
this._body.setAttribute('class', this._options.cssClass);
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
if (options.vertical) {
|
|
1475
|
+
this._map.legendVertical.appendChild(this._body);
|
|
1476
|
+
} else {
|
|
1477
|
+
this._map.legendHorizontal.appendChild(this._body);
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
this.render();
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
var _proto = Legend.prototype;
|
|
1484
|
+
|
|
1485
|
+
_proto.render = function render() {
|
|
1486
|
+
var ticks = this._series.scale.getTicks(),
|
|
1487
|
+
inner = createElement('div', 'jvm-legend-inner'),
|
|
1488
|
+
tick,
|
|
1489
|
+
sample,
|
|
1490
|
+
label;
|
|
1491
|
+
|
|
1492
|
+
this._body.innderHTML = '';
|
|
1493
|
+
|
|
1494
|
+
if (this._options.title) {
|
|
1495
|
+
var legendTitle = createElement('div', 'jvm-legend-title', this._options.title);
|
|
1496
|
+
|
|
1497
|
+
this._body.appendChild(legendTitle);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
this._body.appendChild(inner);
|
|
1501
|
+
|
|
1502
|
+
for (var i = 0; i < ticks.length; i++) {
|
|
1503
|
+
tick = createElement('div', 'jvm-legend-tick');
|
|
1504
|
+
sample = createElement('div', 'jvm-legend-tick-sample');
|
|
1505
|
+
|
|
1506
|
+
switch (this._series.config.attribute) {
|
|
1507
|
+
case 'fill':
|
|
1508
|
+
if (isImageUrl(ticks[i].value)) {
|
|
1509
|
+
sample.style.background = "url(" + ticks[i].value + ")";
|
|
1510
|
+
} else {
|
|
1511
|
+
sample.style.background = ticks[i].value;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
break;
|
|
1515
|
+
|
|
1516
|
+
case 'stroke':
|
|
1517
|
+
sample.style.background = ticks[i].value;
|
|
1518
|
+
break;
|
|
1519
|
+
|
|
1520
|
+
case 'image':
|
|
1521
|
+
sample.style.background = "url(" + (typeof ticks[i].value === 'object' ? ticks[i].value.url : ticks[i].value) + ") no-repeat center center";
|
|
1522
|
+
sample.style.backgroundSize = 'cover';
|
|
1523
|
+
break;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
tick.appendChild(sample);
|
|
1527
|
+
label = ticks[i].label;
|
|
1528
|
+
|
|
1529
|
+
if (this._options.labelRender) {
|
|
1530
|
+
label = this._options.labelRender(label);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
var tickText = createElement('div', 'jvm-legend-tick-text', label);
|
|
1534
|
+
tick.appendChild(tickText);
|
|
1535
|
+
inner.appendChild(tick);
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
return Legend;
|
|
1540
|
+
}();
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* ------------------------------------------------------------------------
|
|
1544
|
+
* Class Definition
|
|
1545
|
+
* ------------------------------------------------------------------------
|
|
1546
|
+
*/
|
|
1547
|
+
var OrdinalScale = /*#__PURE__*/function () {
|
|
1548
|
+
function OrdinalScale(scale) {
|
|
1549
|
+
this._scale = scale;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
var _proto = OrdinalScale.prototype;
|
|
1553
|
+
|
|
1554
|
+
_proto.getValue = function getValue(value) {
|
|
1555
|
+
return this._scale[value];
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
_proto.getTicks = function getTicks() {
|
|
1559
|
+
var ticks = [];
|
|
1560
|
+
|
|
1561
|
+
for (var key in this._scale) {
|
|
1562
|
+
ticks.push({
|
|
1563
|
+
label: key,
|
|
1564
|
+
value: this._scale[key]
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
return ticks;
|
|
1569
|
+
};
|
|
1570
|
+
|
|
1571
|
+
return OrdinalScale;
|
|
1572
|
+
}();
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* ------------------------------------------------------------------------
|
|
1576
|
+
* Class Definition
|
|
1577
|
+
* ------------------------------------------------------------------------
|
|
1578
|
+
*/
|
|
1579
|
+
|
|
1580
|
+
var Series = /*#__PURE__*/function () {
|
|
1581
|
+
function Series(config, elements, map) {
|
|
1582
|
+
if (config === void 0) {
|
|
1583
|
+
config = {};
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
// Private
|
|
1587
|
+
this._map = map;
|
|
1588
|
+
this._elements = elements; // Could be markers or regions
|
|
1589
|
+
|
|
1590
|
+
this._values = config.values || {}; // Protected
|
|
1591
|
+
|
|
1592
|
+
this.config = config;
|
|
1593
|
+
this.config.attribute = config.attribute || 'fill'; // Set initial attributes
|
|
1594
|
+
|
|
1595
|
+
if (config.attributes) {
|
|
1596
|
+
this.setAttributes(config.attributes);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
if (typeof config.scale === 'object') {
|
|
1600
|
+
this.scale = new OrdinalScale(config.scale);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
if (this.config.legend) {
|
|
1604
|
+
this.legend = new Legend(merge({
|
|
1605
|
+
map: this._map,
|
|
1606
|
+
series: this
|
|
1607
|
+
}, this.config.legend));
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
this.setValues(this._values);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
var _proto = Series.prototype;
|
|
1614
|
+
|
|
1615
|
+
_proto.setValues = function setValues(values) {
|
|
1616
|
+
var attrs = {};
|
|
1617
|
+
|
|
1618
|
+
for (var key in values) {
|
|
1619
|
+
if (values[key]) {
|
|
1620
|
+
attrs[key] = this.scale.getValue(values[key]);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
this.setAttributes(attrs);
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
_proto.setAttributes = function setAttributes(attrs) {
|
|
1628
|
+
for (var code in attrs) {
|
|
1629
|
+
if (this._elements[code]) {
|
|
1630
|
+
this._elements[code].element.setStyle(this.config.attribute, attrs[code]);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
|
|
1635
|
+
_proto.clear = function clear() {
|
|
1636
|
+
var key,
|
|
1637
|
+
attrs = {};
|
|
1638
|
+
|
|
1639
|
+
for (key in this._values) {
|
|
1640
|
+
if (this._elements[key]) {
|
|
1641
|
+
attrs[key] = this._elements[key].element.shape.style.initial[this.config.attribute];
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
this.setAttributes(attrs);
|
|
1646
|
+
this._values = {};
|
|
1647
|
+
};
|
|
1648
|
+
|
|
1649
|
+
return Series;
|
|
1650
|
+
}();
|
|
1651
|
+
|
|
1652
|
+
function createSeries() {
|
|
1653
|
+
this.series = {
|
|
1654
|
+
markers: [],
|
|
1655
|
+
regions: []
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
for (var key in this.params.series) {
|
|
1659
|
+
for (var i = 0; i < this.params.series[key].length; i++) {
|
|
1660
|
+
this.series[key][i] = new Series(this.params.series[key][i], this[key], this);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
function applyTransform() {
|
|
1666
|
+
var maxTransX, maxTransY, minTransX, minTransY;
|
|
1667
|
+
|
|
1668
|
+
if (this.defaultWidth * this.scale <= this.width) {
|
|
1669
|
+
maxTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
|
|
1670
|
+
minTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
|
|
1671
|
+
} else {
|
|
1672
|
+
maxTransX = 0;
|
|
1673
|
+
minTransX = (this.width - this.defaultWidth * this.scale) / this.scale;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
if (this.defaultHeight * this.scale <= this.height) {
|
|
1677
|
+
maxTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
|
|
1678
|
+
minTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
|
|
1679
|
+
} else {
|
|
1680
|
+
maxTransY = 0;
|
|
1681
|
+
minTransY = (this.height - this.defaultHeight * this.scale) / this.scale;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
if (this.transY > maxTransY) {
|
|
1685
|
+
this.transY = maxTransY;
|
|
1686
|
+
} else if (this.transY < minTransY) {
|
|
1687
|
+
this.transY = minTransY;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
if (this.transX > maxTransX) {
|
|
1691
|
+
this.transX = maxTransX;
|
|
1692
|
+
} else if (this.transX < minTransX) {
|
|
1693
|
+
this.transX = minTransX;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
this.canvas.applyTransformParams(this.scale, this.transX, this.transY);
|
|
1697
|
+
|
|
1698
|
+
if (this.markers) {
|
|
1699
|
+
this._repositionMarkers();
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
if (this.lines) {
|
|
1703
|
+
this._repositionLines();
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
this._repositionLabels();
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
function resize() {
|
|
1710
|
+
var curBaseScale = this.baseScale;
|
|
1711
|
+
|
|
1712
|
+
if (this.width / this.height > this.defaultWidth / this.defaultHeight) {
|
|
1713
|
+
this.baseScale = this.height / this.defaultHeight;
|
|
1714
|
+
this.baseTransX = Math.abs(this.width - this.defaultWidth * this.baseScale) / (2 * this.baseScale);
|
|
1715
|
+
} else {
|
|
1716
|
+
this.baseScale = this.width / this.defaultWidth;
|
|
1717
|
+
this.baseTransY = Math.abs(this.height - this.defaultHeight * this.baseScale) / (2 * this.baseScale);
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
this.scale *= this.baseScale / curBaseScale;
|
|
1721
|
+
this.transX *= this.baseScale / curBaseScale;
|
|
1722
|
+
this.transY *= this.baseScale / curBaseScale;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
function setScale(scale, anchorX, anchorY, isCentered, animate) {
|
|
1726
|
+
var _this = this;
|
|
1727
|
+
|
|
1728
|
+
var zoomStep,
|
|
1729
|
+
interval,
|
|
1730
|
+
i = 0,
|
|
1731
|
+
count = Math.abs(Math.round((scale - this.scale) * 60 / Math.max(scale, this.scale))),
|
|
1732
|
+
scaleStart,
|
|
1733
|
+
scaleDiff,
|
|
1734
|
+
transXStart,
|
|
1735
|
+
transXDiff,
|
|
1736
|
+
transYStart,
|
|
1737
|
+
transYDiff,
|
|
1738
|
+
transX,
|
|
1739
|
+
transY;
|
|
1740
|
+
|
|
1741
|
+
if (scale > this.params.zoomMax * this.baseScale) {
|
|
1742
|
+
scale = this.params.zoomMax * this.baseScale;
|
|
1743
|
+
} else if (scale < this.params.zoomMin * this.baseScale) {
|
|
1744
|
+
scale = this.params.zoomMin * this.baseScale;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
if (typeof anchorX != 'undefined' && typeof anchorY != 'undefined') {
|
|
1748
|
+
zoomStep = scale / this.scale;
|
|
1749
|
+
|
|
1750
|
+
if (isCentered) {
|
|
1751
|
+
transX = anchorX + this.defaultWidth * (this.width / (this.defaultWidth * scale)) / 2;
|
|
1752
|
+
transY = anchorY + this.defaultHeight * (this.height / (this.defaultHeight * scale)) / 2;
|
|
1753
|
+
} else {
|
|
1754
|
+
transX = this.transX - (zoomStep - 1) / scale * anchorX;
|
|
1755
|
+
transY = this.transY - (zoomStep - 1) / scale * anchorY;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
if (animate && count > 0) {
|
|
1760
|
+
scaleStart = this.scale;
|
|
1761
|
+
scaleDiff = (scale - scaleStart) / count;
|
|
1762
|
+
transXStart = this.transX * this.scale;
|
|
1763
|
+
transYStart = this.transY * this.scale;
|
|
1764
|
+
transXDiff = (transX * scale - transXStart) / count;
|
|
1765
|
+
transYDiff = (transY * scale - transYStart) / count;
|
|
1766
|
+
interval = setInterval(function () {
|
|
1767
|
+
i += 1;
|
|
1768
|
+
_this.scale = scaleStart + scaleDiff * i;
|
|
1769
|
+
_this.transX = (transXStart + transXDiff * i) / _this.scale;
|
|
1770
|
+
_this.transY = (transYStart + transYDiff * i) / _this.scale;
|
|
1771
|
+
|
|
1772
|
+
_this._applyTransform();
|
|
1773
|
+
|
|
1774
|
+
if (i == count) {
|
|
1775
|
+
clearInterval(interval);
|
|
1776
|
+
|
|
1777
|
+
_this._emit(Events.onViewportChange, [_this.scale, _this.transX, _this.transY]);
|
|
1778
|
+
}
|
|
1779
|
+
}, 10);
|
|
1780
|
+
} else {
|
|
1781
|
+
this.transX = transX;
|
|
1782
|
+
this.transY = transY;
|
|
1783
|
+
this.scale = scale;
|
|
1784
|
+
|
|
1785
|
+
this._applyTransform();
|
|
1786
|
+
|
|
1787
|
+
this._emit(Events.onViewportChange, [this.scale, this.transX, this.transY]);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
function setFocus(config) {
|
|
1792
|
+
var _this = this;
|
|
1793
|
+
|
|
1794
|
+
if (config === void 0) {
|
|
1795
|
+
config = {};
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
var bbox,
|
|
1799
|
+
codes = [];
|
|
1800
|
+
|
|
1801
|
+
if (config.region) {
|
|
1802
|
+
codes.push(config.region);
|
|
1803
|
+
} else if (config.regions) {
|
|
1804
|
+
codes = config.regions;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
if (codes.length) {
|
|
1808
|
+
codes.forEach(function (code) {
|
|
1809
|
+
if (_this.regions[code]) {
|
|
1810
|
+
var itemBbox = _this.regions[code].element.shape.getBBox();
|
|
1811
|
+
|
|
1812
|
+
if (itemBbox) {
|
|
1813
|
+
// Handle the first loop
|
|
1814
|
+
if (typeof bbox == 'undefined') {
|
|
1815
|
+
bbox = itemBbox;
|
|
1816
|
+
} else {
|
|
1817
|
+
// get the old bbox properties plus the current
|
|
1818
|
+
// this kinda incrementing the old values and the new values
|
|
1819
|
+
bbox = {
|
|
1820
|
+
x: Math.min(bbox.x, itemBbox.x),
|
|
1821
|
+
y: Math.min(bbox.y, itemBbox.y),
|
|
1822
|
+
width: Math.max(bbox.x + bbox.width, itemBbox.x + itemBbox.width) - Math.min(bbox.x, itemBbox.x),
|
|
1823
|
+
height: Math.max(bbox.y + bbox.height, itemBbox.y + itemBbox.height) - Math.min(bbox.y, itemBbox.y)
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
});
|
|
1829
|
+
return this._setScale(Math.min(this.width / bbox.width, this.height / bbox.height), -(bbox.x + bbox.width / 2), -(bbox.y + bbox.height / 2), true, config.animate);
|
|
1830
|
+
} else if (config.coords) {
|
|
1831
|
+
var point = this.coordsToPoint(config.coords[0], config.coords[1]);
|
|
1832
|
+
var x = this.transX - point.x / this.scale;
|
|
1833
|
+
var y = this.transY - point.y / this.scale;
|
|
1834
|
+
return this._setScale(config.scale * this.baseScale, x, y, true, config.animate);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
function updateSize() {
|
|
1839
|
+
this.width = this.container.offsetWidth;
|
|
1840
|
+
this.height = this.container.offsetHeight;
|
|
1841
|
+
|
|
1842
|
+
this._resize();
|
|
1843
|
+
|
|
1844
|
+
this.canvas.setSize(this.width, this.height);
|
|
1845
|
+
|
|
1846
|
+
this._applyTransform();
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* ------------------------------------------------------------------------
|
|
1851
|
+
* Object
|
|
1852
|
+
* ------------------------------------------------------------------------
|
|
1853
|
+
*/
|
|
1854
|
+
var Proj = {
|
|
1855
|
+
/* sgn(n){
|
|
1856
|
+
if (n > 0) {
|
|
1857
|
+
return 1;
|
|
1858
|
+
} else if (n < 0) {
|
|
1859
|
+
return -1;
|
|
1860
|
+
} else {
|
|
1861
|
+
return n;
|
|
1862
|
+
}
|
|
1863
|
+
}, */
|
|
1864
|
+
mill: function mill(lat, lng, c) {
|
|
1865
|
+
return {
|
|
1866
|
+
x: this.radius * (lng - c) * this.radDeg,
|
|
1867
|
+
y: -this.radius * Math.log(Math.tan((45 + 0.4 * lat) * this.radDeg)) / 0.8
|
|
1868
|
+
};
|
|
1869
|
+
},
|
|
1870
|
+
|
|
1871
|
+
/* mill_inv(x, y, c) {
|
|
1872
|
+
return {
|
|
1873
|
+
lat: (2.5 * Math.atan(Math.exp(0.8 * y / this.radius)) - 5 * Math.PI / 8) * this.degRad,
|
|
1874
|
+
lng: (c * this.radDeg + x / this.radius) * this.degRad
|
|
1875
|
+
};
|
|
1876
|
+
}, */
|
|
1877
|
+
merc: function merc(lat, lng, c) {
|
|
1878
|
+
return {
|
|
1879
|
+
x: this.radius * (lng - c) * this.radDeg,
|
|
1880
|
+
y: -this.radius * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))
|
|
1881
|
+
};
|
|
1882
|
+
},
|
|
1883
|
+
|
|
1884
|
+
/* merc_inv(x, y, c) {
|
|
1885
|
+
return {
|
|
1886
|
+
lat: (2 * Math.atan(Math.exp(y / this.radius)) - Math.PI / 2) * this.degRad,
|
|
1887
|
+
lng: (c * this.radDeg + x / this.radius) * this.degRad
|
|
1888
|
+
};
|
|
1889
|
+
}, */
|
|
1890
|
+
aea: function aea(lat, lng, c) {
|
|
1891
|
+
var fi0 = 0,
|
|
1892
|
+
lambda0 = c * this.radDeg,
|
|
1893
|
+
fi1 = 29.5 * this.radDeg,
|
|
1894
|
+
fi2 = 45.5 * this.radDeg,
|
|
1895
|
+
fi = lat * this.radDeg,
|
|
1896
|
+
lambda = lng * this.radDeg,
|
|
1897
|
+
n = (Math.sin(fi1) + Math.sin(fi2)) / 2,
|
|
1898
|
+
C = Math.cos(fi1) * Math.cos(fi1) + 2 * n * Math.sin(fi1),
|
|
1899
|
+
theta = n * (lambda - lambda0),
|
|
1900
|
+
ro = Math.sqrt(C - 2 * n * Math.sin(fi)) / n,
|
|
1901
|
+
ro0 = Math.sqrt(C - 2 * n * Math.sin(fi0)) / n;
|
|
1902
|
+
return {
|
|
1903
|
+
x: ro * Math.sin(theta) * this.radius,
|
|
1904
|
+
y: -(ro0 - ro * Math.cos(theta)) * this.radius
|
|
1905
|
+
};
|
|
1906
|
+
},
|
|
1907
|
+
|
|
1908
|
+
/* aea_inv(xCoord, yCoord, c) {
|
|
1909
|
+
var x = xCoord / this.radius,
|
|
1910
|
+
y = yCoord / this.radius,
|
|
1911
|
+
fi0 = 0,
|
|
1912
|
+
lambda0 = c * this.radDeg,
|
|
1913
|
+
fi1 = 29.5 * this.radDeg,
|
|
1914
|
+
fi2 = 45.5 * this.radDeg,
|
|
1915
|
+
n = (Math.sin(fi1)+Math.sin(fi2)) / 2,
|
|
1916
|
+
C = Math.cos(fi1)*Math.cos(fi1)+2*n*Math.sin(fi1),
|
|
1917
|
+
ro0 = Math.sqrt(C-2*n*Math.sin(fi0))/n,
|
|
1918
|
+
ro = Math.sqrt(x*x+(ro0-y)*(ro0-y)),
|
|
1919
|
+
theta = Math.atan( x / (ro0 - y) );
|
|
1920
|
+
return {
|
|
1921
|
+
lat: (Math.asin((C - ro * ro * n * n) / (2 * n))) * this.degRad,
|
|
1922
|
+
lng: (lambda0 + theta / n) * this.degRad
|
|
1923
|
+
};
|
|
1924
|
+
}, */
|
|
1925
|
+
lcc: function lcc(lat, lng, c) {
|
|
1926
|
+
var fi0 = 0,
|
|
1927
|
+
lambda0 = c * this.radDeg,
|
|
1928
|
+
lambda = lng * this.radDeg,
|
|
1929
|
+
fi1 = 33 * this.radDeg,
|
|
1930
|
+
fi2 = 45 * this.radDeg,
|
|
1931
|
+
fi = lat * this.radDeg,
|
|
1932
|
+
n = Math.log(Math.cos(fi1) * (1 / Math.cos(fi2))) / Math.log(Math.tan(Math.PI / 4 + fi2 / 2) * (1 / Math.tan(Math.PI / 4 + fi1 / 2))),
|
|
1933
|
+
F = Math.cos(fi1) * Math.pow(Math.tan(Math.PI / 4 + fi1 / 2), n) / n,
|
|
1934
|
+
ro = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi / 2), n),
|
|
1935
|
+
ro0 = F * Math.pow(1 / Math.tan(Math.PI / 4 + fi0 / 2), n);
|
|
1936
|
+
return {
|
|
1937
|
+
x: ro * Math.sin(n * (lambda - lambda0)) * this.radius,
|
|
1938
|
+
y: -(ro0 - ro * Math.cos(n * (lambda - lambda0))) * this.radius
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
/* lcc_inv(xCoord, yCoord, c) {
|
|
1942
|
+
var x = xCoord / this.radius,
|
|
1943
|
+
y = yCoord / this.radius,
|
|
1944
|
+
fi0 = 0,
|
|
1945
|
+
lambda0 = c * this.radDeg,
|
|
1946
|
+
fi1 = 33 * this.radDeg,
|
|
1947
|
+
fi2 = 45 * this.radDeg,
|
|
1948
|
+
n = Math.log( Math.cos(fi1) * (1 / Math.cos(fi2)) ) / Math.log( Math.tan( Math.PI / 4 + fi2 / 2) * (1 / Math.tan( Math.PI / 4 + fi1 / 2) ) ),
|
|
1949
|
+
F = ( Math.cos(fi1) * Math.pow( Math.tan( Math.PI / 4 + fi1 / 2 ), n ) ) / n,
|
|
1950
|
+
ro0 = F * Math.pow( 1 / Math.tan( Math.PI / 4 + fi0 / 2 ), n ),
|
|
1951
|
+
ro = this.sgn(n) * Math.sqrt(x*x+(ro0-y)*(ro0-y)),
|
|
1952
|
+
theta = Math.atan( x / (ro0 - y) );
|
|
1953
|
+
return {
|
|
1954
|
+
lat: (2 * Math.atan(Math.pow(F/ro, 1/n)) - Math.PI / 2) * this.degRad,
|
|
1955
|
+
lng: (lambda0 + theta / n) * this.degRad
|
|
1956
|
+
};
|
|
1957
|
+
} */
|
|
1958
|
+
|
|
1959
|
+
};
|
|
1960
|
+
Proj.degRad = 180 / Math.PI;
|
|
1961
|
+
Proj.radDeg = Math.PI / 180;
|
|
1962
|
+
Proj.radius = 6381372;
|
|
1963
|
+
|
|
1964
|
+
function coordsToPoint(lat, lng) {
|
|
1965
|
+
var point,
|
|
1966
|
+
proj = Map.maps[this.params.map].projection,
|
|
1967
|
+
centralMeridian = proj.centralMeridian,
|
|
1968
|
+
inset,
|
|
1969
|
+
bbox;
|
|
1970
|
+
point = Proj[proj.type](lat, lng, centralMeridian);
|
|
1971
|
+
inset = this.getInsetForPoint(point.x, point.y);
|
|
1972
|
+
|
|
1973
|
+
if (inset) {
|
|
1974
|
+
bbox = inset.bbox;
|
|
1975
|
+
point.x = (point.x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
|
|
1976
|
+
point.y = (point.y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
|
|
1977
|
+
return {
|
|
1978
|
+
x: point.x + this.transX * this.scale + inset.left * this.scale,
|
|
1979
|
+
y: point.y + this.transY * this.scale + inset.top * this.scale
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
return false;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
function getInsetForPoint(x, y) {
|
|
1987
|
+
var index,
|
|
1988
|
+
bbox,
|
|
1989
|
+
insets = Map.maps[this.params.map].insets;
|
|
1990
|
+
|
|
1991
|
+
for (index = 0; index < insets.length; index++) {
|
|
1992
|
+
bbox = insets[index].bbox;
|
|
1993
|
+
|
|
1994
|
+
if (x > bbox[0].x && x < bbox[1].x && y > bbox[0].y && y < bbox[1].y) {
|
|
1995
|
+
return insets[index];
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
function getMarkerPosition(_ref) {
|
|
2001
|
+
var coords = _ref.coords;
|
|
2002
|
+
|
|
2003
|
+
if (Map.maps[this.params.map].projection) {
|
|
2004
|
+
return this.coordsToPoint.apply(this, coords);
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
return {
|
|
2008
|
+
x: coords[0] * this.scale + this.transX * this.scale,
|
|
2009
|
+
y: coords[1] * this.scale + this.transY * this.scale
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
function repositionLines() {
|
|
2014
|
+
var point1 = false,
|
|
2015
|
+
point2 = false;
|
|
2016
|
+
|
|
2017
|
+
for (var index in this.lines) {
|
|
2018
|
+
for (var mindex in this.markers) {
|
|
2019
|
+
var marker = this.markers[mindex]; // console.log(this.lines[index], index);
|
|
2020
|
+
|
|
2021
|
+
if (marker.config.name === this.lines[index].config.from) {
|
|
2022
|
+
point1 = this.getMarkerPosition(marker.config);
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
if (marker.config.name === this.lines[index].config.to) {
|
|
2026
|
+
point2 = this.getMarkerPosition(marker.config);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
if (point1 !== false && point2 !== false) {
|
|
2031
|
+
this.lines[index].setStyle({
|
|
2032
|
+
x1: point1.x,
|
|
2033
|
+
y1: point1.y,
|
|
2034
|
+
x2: point2.x,
|
|
2035
|
+
y2: point2.y
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
function repositionMarkers() {
|
|
2042
|
+
var point;
|
|
2043
|
+
|
|
2044
|
+
for (var index in this.markers) {
|
|
2045
|
+
point = this.getMarkerPosition(this.markers[index].config);
|
|
2046
|
+
|
|
2047
|
+
if (point !== false) {
|
|
2048
|
+
this.markers[index].element.setStyle({
|
|
2049
|
+
cx: point.x,
|
|
2050
|
+
cy: point.y
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
function repositionLabels() {
|
|
2057
|
+
var labels = this.params.labels;
|
|
2058
|
+
|
|
2059
|
+
if (!labels) {
|
|
2060
|
+
return;
|
|
2061
|
+
} // Regions labels
|
|
2062
|
+
|
|
2063
|
+
|
|
2064
|
+
if (labels.regions) {
|
|
2065
|
+
for (var key in this.regions) {
|
|
2066
|
+
this.regions[key].element.updateLabelPosition();
|
|
2067
|
+
}
|
|
2068
|
+
} // Markers labels
|
|
2069
|
+
|
|
2070
|
+
|
|
2071
|
+
if (labels.markers) {
|
|
2072
|
+
for (var _key in this.markers) {
|
|
2073
|
+
this.markers[_key].element.updateLabelPosition();
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
var MapPrototypes = {
|
|
2079
|
+
_setupContainerEvents: setupContainerEvents,
|
|
2080
|
+
_setupElementEvents: setupElementEvents,
|
|
2081
|
+
_setupZoomButtons: setupZoomButtons,
|
|
2082
|
+
_setupContainerTouchEvents: setupContainerTouchEvents,
|
|
2083
|
+
_createRegions: createRegions,
|
|
2084
|
+
_createLines: createLines,
|
|
2085
|
+
_createMarkers: createMarkers,
|
|
2086
|
+
_createSeries: createSeries,
|
|
2087
|
+
_applyTransform: applyTransform,
|
|
2088
|
+
_resize: resize,
|
|
2089
|
+
_setScale: setScale,
|
|
2090
|
+
setFocus: setFocus,
|
|
2091
|
+
updateSize: updateSize,
|
|
2092
|
+
coordsToPoint: coordsToPoint,
|
|
2093
|
+
getInsetForPoint: getInsetForPoint,
|
|
2094
|
+
getMarkerPosition: getMarkerPosition,
|
|
2095
|
+
_repositionLines: repositionLines,
|
|
2096
|
+
_repositionMarkers: repositionMarkers,
|
|
2097
|
+
_repositionLabels: repositionLabels
|
|
2098
|
+
};
|
|
2099
|
+
|
|
2100
|
+
/**
|
|
2101
|
+
* ------------------------------------------------------------------------
|
|
2102
|
+
* Class Definition
|
|
2103
|
+
* ------------------------------------------------------------------------
|
|
2104
|
+
*/
|
|
2105
|
+
|
|
2106
|
+
var Tooltip = /*#__PURE__*/function (_BaseComponent) {
|
|
2107
|
+
_inheritsLoose(Tooltip, _BaseComponent);
|
|
2108
|
+
|
|
2109
|
+
function Tooltip(map) {
|
|
2110
|
+
var _this;
|
|
2111
|
+
|
|
2112
|
+
_this = _BaseComponent.call(this) || this;
|
|
2113
|
+
var tooltip = createElement('div', 'jvm-tooltip');
|
|
2114
|
+
_this._map = map;
|
|
2115
|
+
_this._tooltip = document.body.appendChild(tooltip);
|
|
2116
|
+
|
|
2117
|
+
_this._bindEventListeners();
|
|
2118
|
+
|
|
2119
|
+
return _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
var _proto = Tooltip.prototype;
|
|
2123
|
+
|
|
2124
|
+
_proto._bindEventListeners = function _bindEventListeners() {
|
|
2125
|
+
var _this2 = this;
|
|
2126
|
+
|
|
2127
|
+
EventHandler.on(this._map.container, 'mousemove', function (event) {
|
|
2128
|
+
if (!_this2._tooltip.classList.contains('active')) {
|
|
2129
|
+
return;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
var container = findElement(_this2._map.container, '#jvm-regions-group').getBoundingClientRect();
|
|
2133
|
+
var space = 5; // Space between the cursor and tooltip element
|
|
2134
|
+
// Tooltip
|
|
2135
|
+
|
|
2136
|
+
var _this2$_tooltip$getBo = _this2._tooltip.getBoundingClientRect(),
|
|
2137
|
+
height = _this2$_tooltip$getBo.height,
|
|
2138
|
+
width = _this2$_tooltip$getBo.width;
|
|
2139
|
+
|
|
2140
|
+
var topIsPassed = event.clientY <= container.top + height + space;
|
|
2141
|
+
var top = event.pageY - height - space;
|
|
2142
|
+
var left = event.pageX - width - space; // Ensure the tooltip will never cross outside the canvas area(map)
|
|
2143
|
+
|
|
2144
|
+
if (topIsPassed) {
|
|
2145
|
+
// Top:
|
|
2146
|
+
top += height + space; // The cursor is a bit larger from left side
|
|
2147
|
+
|
|
2148
|
+
left -= space * 2;
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
if (event.clientX < container.left + width + space) {
|
|
2152
|
+
// Left:
|
|
2153
|
+
left = event.pageX + space + 2;
|
|
2154
|
+
|
|
2155
|
+
if (topIsPassed) {
|
|
2156
|
+
left += space * 2;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
_this2.css({
|
|
2161
|
+
top: top + "px",
|
|
2162
|
+
left: left + "px"
|
|
2163
|
+
});
|
|
2164
|
+
});
|
|
2165
|
+
};
|
|
2166
|
+
|
|
2167
|
+
_proto.getElement = function getElement() {
|
|
2168
|
+
return this._tooltip;
|
|
2169
|
+
};
|
|
2170
|
+
|
|
2171
|
+
_proto.show = function show() {
|
|
2172
|
+
this._tooltip.classList.add('active');
|
|
2173
|
+
};
|
|
2174
|
+
|
|
2175
|
+
_proto.hide = function hide() {
|
|
2176
|
+
this._tooltip.classList.remove('active');
|
|
2177
|
+
};
|
|
2178
|
+
|
|
2179
|
+
_proto.text = function text(string) {
|
|
2180
|
+
if (!string) {
|
|
2181
|
+
return this._tooltip.textContent;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
this._tooltip.textContent = string;
|
|
2185
|
+
};
|
|
2186
|
+
|
|
2187
|
+
_proto.css = function css(_css) {
|
|
2188
|
+
for (var style in _css) {
|
|
2189
|
+
this._tooltip.style[style] = _css[style];
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
return this;
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2195
|
+
return Tooltip;
|
|
2196
|
+
}(BaseComponent);
|
|
2197
|
+
|
|
2198
|
+
var DataVisualization = /*#__PURE__*/function () {
|
|
2199
|
+
function DataVisualization(_ref, map) {
|
|
2200
|
+
var scale = _ref.scale,
|
|
2201
|
+
values = _ref.values;
|
|
2202
|
+
// Private
|
|
2203
|
+
this._scale = scale;
|
|
2204
|
+
this._values = values;
|
|
2205
|
+
this._fromColor = this.hexToRgb(scale[0]);
|
|
2206
|
+
this._toColor = this.hexToRgb(scale[1]);
|
|
2207
|
+
this._map = map;
|
|
2208
|
+
this.setMinMaxValues(values);
|
|
2209
|
+
this.visualize();
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
var _proto = DataVisualization.prototype;
|
|
2213
|
+
|
|
2214
|
+
_proto.setMinMaxValues = function setMinMaxValues(values) {
|
|
2215
|
+
this.min = Number.MAX_VALUE;
|
|
2216
|
+
this.max = 0;
|
|
2217
|
+
|
|
2218
|
+
for (var value in values) {
|
|
2219
|
+
value = parseFloat(values[value]);
|
|
2220
|
+
|
|
2221
|
+
if (value > this.max) {
|
|
2222
|
+
this.max = value;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
if (value < this.min) {
|
|
2226
|
+
this.min = value;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
};
|
|
2230
|
+
|
|
2231
|
+
_proto.visualize = function visualize() {
|
|
2232
|
+
var attrs = {},
|
|
2233
|
+
value;
|
|
2234
|
+
|
|
2235
|
+
for (var regionCode in this._values) {
|
|
2236
|
+
value = parseFloat(this._values[regionCode]);
|
|
2237
|
+
|
|
2238
|
+
if (!isNaN(value)) {
|
|
2239
|
+
attrs[regionCode] = this.getValue(value);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
this.setAttributes(attrs);
|
|
2244
|
+
};
|
|
2245
|
+
|
|
2246
|
+
_proto.setAttributes = function setAttributes(attrs) {
|
|
2247
|
+
for (var code in attrs) {
|
|
2248
|
+
if (this._map.regions[code]) {
|
|
2249
|
+
this._map.regions[code].element.setStyle('fill', attrs[code]);
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
_proto.getValue = function getValue(value) {
|
|
2255
|
+
var hex,
|
|
2256
|
+
color = "#";
|
|
2257
|
+
|
|
2258
|
+
for (var i = 0; i < 3; i++) {
|
|
2259
|
+
hex = Math.round(this._fromColor[i] + (this._toColor[i] - this._fromColor[i]) * ((value - this.min) / (this.max - this.min))).toString(16);
|
|
2260
|
+
color += (hex.length === 1 ? "0" : "") + hex;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
return color;
|
|
2264
|
+
};
|
|
2265
|
+
|
|
2266
|
+
_proto.hexToRgb = function hexToRgb(h) {
|
|
2267
|
+
var r = 0,
|
|
2268
|
+
g = 0,
|
|
2269
|
+
b = 0;
|
|
2270
|
+
|
|
2271
|
+
if (h.length == 4) {
|
|
2272
|
+
r = "0x" + h[1] + h[1];
|
|
2273
|
+
g = "0x" + h[2] + h[2];
|
|
2274
|
+
b = "0x" + h[3] + h[3];
|
|
2275
|
+
} else if (h.length == 7) {
|
|
2276
|
+
r = "0x" + h[1] + h[2];
|
|
2277
|
+
g = "0x" + h[3] + h[4];
|
|
2278
|
+
b = "0x" + h[5] + h[6];
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
return [parseInt(r), parseInt(g), parseInt(b)];
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
return DataVisualization;
|
|
2285
|
+
}();
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* ------------------------------------------------------------------------
|
|
2289
|
+
* Class Definition
|
|
2290
|
+
* ------------------------------------------------------------------------
|
|
2291
|
+
*/
|
|
2292
|
+
|
|
2293
|
+
var Map = /*#__PURE__*/function () {
|
|
2294
|
+
function Map(options) {
|
|
2295
|
+
var _this = this;
|
|
2296
|
+
|
|
2297
|
+
if (options === void 0) {
|
|
2298
|
+
options = {};
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
// Merge the given options with the default options
|
|
2302
|
+
this.params = merge(Map.defaults, options, true); // Throw an error if the given map name doesn't match
|
|
2303
|
+
// the map that was set in map file
|
|
2304
|
+
|
|
2305
|
+
if (!Map.maps[this.params.map]) {
|
|
2306
|
+
throw new Error("Attempt to use map which was not loaded: " + options.map);
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
this.mapData = Map.maps[this.params.map];
|
|
2310
|
+
this.regions = {};
|
|
2311
|
+
this.markers = {};
|
|
2312
|
+
this.lines = {};
|
|
2313
|
+
this.defaultWidth = this.mapData.width;
|
|
2314
|
+
this.defaultHeight = this.mapData.height;
|
|
2315
|
+
this.height = 0;
|
|
2316
|
+
this.width = 0;
|
|
2317
|
+
this.scale = 1;
|
|
2318
|
+
this.baseScale = 1;
|
|
2319
|
+
this.transX = 0;
|
|
2320
|
+
this.transY = 0;
|
|
2321
|
+
this.baseTransX = 0;
|
|
2322
|
+
this.baseTransY = 0; // `document` is already ready, just initialise now
|
|
2323
|
+
|
|
2324
|
+
if (document.readyState !== 'loading') {
|
|
2325
|
+
this._init();
|
|
2326
|
+
} else {
|
|
2327
|
+
// Wait until `document` is ready
|
|
2328
|
+
window.addEventListener('DOMContentLoaded', function () {
|
|
2329
|
+
return _this._init();
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
var _proto = Map.prototype;
|
|
2335
|
+
|
|
2336
|
+
_proto._init = function _init() {
|
|
2337
|
+
var options = this.params;
|
|
2338
|
+
this.container = getElement(options.selector);
|
|
2339
|
+
this.container.classList.add('jvm-container'); // The map canvas element
|
|
2340
|
+
|
|
2341
|
+
this.canvas = new SVGCanvasElement(this.container); // Set the map's background color
|
|
2342
|
+
|
|
2343
|
+
this.setBackgroundColor(options.backgroundColor); // Create regions
|
|
2344
|
+
|
|
2345
|
+
this._createRegions(); // Update size
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
this.updateSize(); // Create lines
|
|
2349
|
+
|
|
2350
|
+
this._createLines(options.lines || {}, options.markers || {}); // Create markers
|
|
2351
|
+
|
|
2352
|
+
|
|
2353
|
+
this._createMarkers(options.markers); // Position labels
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
this._repositionLabels(); // Setup the container events
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
this._setupContainerEvents(); // Setup regions/markers events
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
this._setupElementEvents(); // Create zoom buttons if `zoomButtons` is presented
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
if (options.zoomButtons) {
|
|
2366
|
+
this._setupZoomButtons();
|
|
2367
|
+
} // Create toolip
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
if (options.showTooltip) {
|
|
2371
|
+
this.tooltip = new Tooltip(this);
|
|
2372
|
+
} // Set selected regions if any
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
if (options.selectedRegions) {
|
|
2376
|
+
this._setSelected('regions', options.selectedRegions);
|
|
2377
|
+
} // Set selected regions if any
|
|
2378
|
+
|
|
2379
|
+
|
|
2380
|
+
if (options.selectedMarkers) {
|
|
2381
|
+
this._setSelected('markers', options.selectedMarkers);
|
|
2382
|
+
} // Set focus on a spcific region
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
if (options.focusOn) {
|
|
2386
|
+
this.setFocus(options.focusOn);
|
|
2387
|
+
} // Data visualization
|
|
2388
|
+
|
|
2389
|
+
|
|
2390
|
+
if (options.visualizeData) {
|
|
2391
|
+
this.dataVisualization = new DataVisualization(options.visualizeData, this);
|
|
2392
|
+
} // Bind touch events if true
|
|
2393
|
+
|
|
2394
|
+
|
|
2395
|
+
if (options.bindTouchEvents) {
|
|
2396
|
+
if ('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch) {
|
|
2397
|
+
this._setupContainerTouchEvents();
|
|
2398
|
+
}
|
|
2399
|
+
} // Create series if any
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
if (options.series) {
|
|
2403
|
+
this.container.appendChild(this.legendHorizontal = createElement('div', 'jvm-series-container jvm-series-h'));
|
|
2404
|
+
this.container.appendChild(this.legendVertical = createElement('div', 'jvm-series-container jvm-series-v'));
|
|
2405
|
+
|
|
2406
|
+
this._createSeries();
|
|
2407
|
+
} // Fire loaded event
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
this._emit(Events.onLoaded, [this]);
|
|
2411
|
+
};
|
|
2412
|
+
|
|
2413
|
+
_proto._emit = function _emit(eventName, args) {
|
|
2414
|
+
for (var event in Events) {
|
|
2415
|
+
if (Events[event] === eventName && typeof this.params[event] === 'function') {
|
|
2416
|
+
this.params[event].apply(this, args);
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
} // Public
|
|
2420
|
+
;
|
|
2421
|
+
|
|
2422
|
+
_proto.setBackgroundColor = function setBackgroundColor(color) {
|
|
2423
|
+
this.container.style.backgroundColor = color;
|
|
2424
|
+
} // Get selected markers/regions
|
|
2425
|
+
;
|
|
2426
|
+
|
|
2427
|
+
_proto._getSelected = function _getSelected(type) {
|
|
2428
|
+
var key,
|
|
2429
|
+
selected = [];
|
|
2430
|
+
|
|
2431
|
+
for (key in this[type]) {
|
|
2432
|
+
if (this[type][key].element.isSelected) {
|
|
2433
|
+
selected.push(key);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
return selected;
|
|
2438
|
+
};
|
|
2439
|
+
|
|
2440
|
+
_proto._setSelected = function _setSelected(type, keys) {
|
|
2441
|
+
var _this2 = this;
|
|
2442
|
+
|
|
2443
|
+
keys.forEach(function (key) {
|
|
2444
|
+
if (_this2[type][key]) {
|
|
2445
|
+
_this2[type][key].element.select(true);
|
|
2446
|
+
}
|
|
2447
|
+
});
|
|
2448
|
+
};
|
|
2449
|
+
|
|
2450
|
+
_proto._clearSelected = function _clearSelected(type) {
|
|
2451
|
+
var _this3 = this;
|
|
2452
|
+
|
|
2453
|
+
this._getSelected(type).forEach(function (i) {
|
|
2454
|
+
_this3[type][i].element.select(false);
|
|
2455
|
+
});
|
|
2456
|
+
} // Region methods
|
|
2457
|
+
;
|
|
2458
|
+
|
|
2459
|
+
_proto.getSelectedRegions = function getSelectedRegions() {
|
|
2460
|
+
return this._getSelected('regions');
|
|
2461
|
+
};
|
|
2462
|
+
|
|
2463
|
+
_proto.clearSelectedRegions = function clearSelectedRegions() {
|
|
2464
|
+
this._clearSelected('regions');
|
|
2465
|
+
} // Markers methods
|
|
2466
|
+
;
|
|
2467
|
+
|
|
2468
|
+
_proto.getSelectedMarkers = function getSelectedMarkers() {
|
|
2469
|
+
return this._getSelected('markers');
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2472
|
+
_proto.clearSelectedMarkers = function clearSelectedMarkers() {
|
|
2473
|
+
this._clearSelected('markers');
|
|
2474
|
+
};
|
|
2475
|
+
|
|
2476
|
+
_proto.addMarkers = function addMarkers(config) {
|
|
2477
|
+
if (Array.isArray(config)) {
|
|
2478
|
+
return this._createMarkers(config, true);
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
this._createMarkers([config], true);
|
|
2482
|
+
};
|
|
2483
|
+
|
|
2484
|
+
_proto.removeMarkers = function removeMarkers(markers) {
|
|
2485
|
+
var _this4 = this;
|
|
2486
|
+
|
|
2487
|
+
if (!markers) {
|
|
2488
|
+
markers = Object.keys(this.markers);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
markers.forEach(function (index) {
|
|
2492
|
+
// Remove the element from the DOM
|
|
2493
|
+
_this4.markers[index].element.remove(); // Remove the element from markers object
|
|
2494
|
+
|
|
2495
|
+
|
|
2496
|
+
delete _this4.markers[index];
|
|
2497
|
+
});
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
_proto.addLine = function addLine(from, to, style) {
|
|
2501
|
+
if (style === void 0) {
|
|
2502
|
+
style = {};
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
console.warn('`addLine` method is deprecated, please use `addLines` instead.');
|
|
2506
|
+
|
|
2507
|
+
this._createLines([{
|
|
2508
|
+
from: from,
|
|
2509
|
+
to: to,
|
|
2510
|
+
style: style
|
|
2511
|
+
}], this.markers, true);
|
|
2512
|
+
};
|
|
2513
|
+
|
|
2514
|
+
_proto.addLines = function addLines(config) {
|
|
2515
|
+
var uids = this._getLinesAsUids();
|
|
2516
|
+
|
|
2517
|
+
if (!Array.isArray(config)) {
|
|
2518
|
+
config = [config];
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
this._createLines(config.filter(function (line) {
|
|
2522
|
+
return !(uids.indexOf(getLineUid(line.from, line.to)) > -1);
|
|
2523
|
+
}), this.markers, true);
|
|
2524
|
+
};
|
|
2525
|
+
|
|
2526
|
+
_proto.removeLines = function removeLines(lines) {
|
|
2527
|
+
var _this5 = this;
|
|
2528
|
+
|
|
2529
|
+
if (Array.isArray(lines)) {
|
|
2530
|
+
lines = lines.map(function (line) {
|
|
2531
|
+
return getLineUid(line.from, line.to);
|
|
2532
|
+
});
|
|
2533
|
+
} else {
|
|
2534
|
+
lines = this._getLinesAsUids();
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
lines.forEach(function (uid) {
|
|
2538
|
+
_this5.lines[uid].dispose();
|
|
2539
|
+
|
|
2540
|
+
delete _this5.lines[uid];
|
|
2541
|
+
});
|
|
2542
|
+
};
|
|
2543
|
+
|
|
2544
|
+
_proto._getLinesAsUids = function _getLinesAsUids() {
|
|
2545
|
+
return Object.keys(this.lines);
|
|
2546
|
+
};
|
|
2547
|
+
|
|
2548
|
+
_proto.removeLine = function removeLine(from, to) {
|
|
2549
|
+
console.warn('`removeLine` method is deprecated, please use `removeLines` instead.');
|
|
2550
|
+
var uid = getLineUid(from, to);
|
|
2551
|
+
|
|
2552
|
+
if (this.lines.hasOwnProperty(uid)) {
|
|
2553
|
+
this.lines[uid].element.remove();
|
|
2554
|
+
delete this.lines[uid];
|
|
2555
|
+
}
|
|
2556
|
+
} // Reset map
|
|
2557
|
+
;
|
|
2558
|
+
|
|
2559
|
+
_proto.reset = function reset() {
|
|
2560
|
+
for (var key in this.series) {
|
|
2561
|
+
for (var i = 0; i < this.series[key].length; i++) {
|
|
2562
|
+
this.series[key][i].clear();
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
if (this.legendHorizontal) {
|
|
2567
|
+
removeElement(this.legendHorizontal);
|
|
2568
|
+
this.legendHorizontal = null;
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
if (this.legendVertical) {
|
|
2572
|
+
removeElement(this.legendVertical);
|
|
2573
|
+
this.legendVertical = null;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
this.scale = this.baseScale;
|
|
2577
|
+
this.transX = this.baseTransX;
|
|
2578
|
+
this.transY = this.baseTransY;
|
|
2579
|
+
|
|
2580
|
+
this._applyTransform();
|
|
2581
|
+
|
|
2582
|
+
this.clearSelectedMarkers();
|
|
2583
|
+
this.clearSelectedRegions();
|
|
2584
|
+
this.removeMarkers();
|
|
2585
|
+
} // Destroy the map
|
|
2586
|
+
;
|
|
2587
|
+
|
|
2588
|
+
_proto.destroy = function destroy(destroyInstance) {
|
|
2589
|
+
var _this6 = this;
|
|
2590
|
+
|
|
2591
|
+
if (destroyInstance === void 0) {
|
|
2592
|
+
destroyInstance = true;
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
// Remove event registry
|
|
2596
|
+
EventHandler.flush(); // Remove tooltip from DOM and memory
|
|
2597
|
+
|
|
2598
|
+
this.tooltip.dispose(); // Fire destroyed event
|
|
2599
|
+
|
|
2600
|
+
this._emit(Events.onDestroyed); // Remove references
|
|
2601
|
+
|
|
2602
|
+
|
|
2603
|
+
if (destroyInstance) {
|
|
2604
|
+
Object.keys(this).forEach(function (key) {
|
|
2605
|
+
try {
|
|
2606
|
+
delete _this6[key];
|
|
2607
|
+
} catch (e) {}
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
_proto.extend = function extend(name, callback) {
|
|
2613
|
+
if (typeof this[name] === 'function') {
|
|
2614
|
+
throw new Error("The method [" + name + "] already exists internally please use another name.");
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
Map.prototype[name] = callback;
|
|
2618
|
+
};
|
|
2619
|
+
|
|
2620
|
+
return Map;
|
|
2621
|
+
}();
|
|
2622
|
+
|
|
2623
|
+
Map.maps = {};
|
|
2624
|
+
Map.defaults = Defaults;
|
|
2625
|
+
Object.assign(Map.prototype, MapPrototypes);
|
|
2626
|
+
|
|
2627
|
+
/**
|
|
2628
|
+
* jsVectorMap
|
|
2629
|
+
* Copyrights (c) Mustafa Omar https://github.com/themustafaomar
|
|
2630
|
+
* Released under the MIT License.
|
|
2631
|
+
*/
|
|
2632
|
+
/**
|
|
2633
|
+
* ------------------------------------------------------------------------
|
|
2634
|
+
* Class Definition
|
|
2635
|
+
* ------------------------------------------------------------------------
|
|
2636
|
+
*/
|
|
2637
|
+
|
|
2638
|
+
var jsVectorMap = /*#__PURE__*/function () {
|
|
2639
|
+
function jsVectorMap(options) {
|
|
2640
|
+
if (options === void 0) {
|
|
2641
|
+
options = {};
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
if (!options.selector) {
|
|
2645
|
+
throw new Error('Selector is not given.');
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
return new Map(options);
|
|
2649
|
+
} // Public
|
|
2650
|
+
|
|
2651
|
+
|
|
2652
|
+
jsVectorMap.addMap = function addMap(name, map) {
|
|
2653
|
+
Map.maps[name] = map;
|
|
2654
|
+
};
|
|
2655
|
+
|
|
2656
|
+
return jsVectorMap;
|
|
2657
|
+
}();
|
|
2658
|
+
|
|
2659
|
+
var jsvectormap = window.jsVectorMap = jsVectorMap;
|
|
2660
|
+
|
|
2661
|
+
return jsvectormap;
|
|
2662
|
+
|
|
2663
|
+
}));
|