@tabler/core 1.0.0-beta20 → 1.0.0-beta21

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