q2-tecton-elements 1.51.1 → 1.52.1

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 (613) hide show
  1. package/dist/cjs/click-elsewhere_2.cjs.entry.js +16 -5
  2. package/dist/cjs/click-elsewhere_2.cjs.entry.js.map +1 -1
  3. package/dist/cjs/{index-9aa4a776.js → index-07285783.js} +86 -2
  4. package/dist/cjs/index-07285783.js.map +1 -0
  5. package/dist/cjs/{index-14c3693c.js → index-e7e68b1e.js} +40 -5
  6. package/dist/cjs/index-e7e68b1e.js.map +1 -0
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/q2-action-group.cjs.entry.js +2 -2
  9. package/dist/cjs/q2-action-sheet.cjs.entry.js +3 -3
  10. package/dist/cjs/q2-avatar.cjs.entry.js +2 -2
  11. package/dist/cjs/q2-badge_7.cjs.entry.js +49 -44
  12. package/dist/cjs/q2-badge_7.cjs.entry.js.map +1 -1
  13. package/dist/cjs/q2-calendar.cjs.entry.js +17 -20
  14. package/dist/cjs/q2-calendar.cjs.entry.js.map +1 -1
  15. package/dist/cjs/q2-card.cjs.entry.js +4 -2
  16. package/dist/cjs/q2-card.cjs.entry.js.map +1 -1
  17. package/dist/cjs/q2-carousel-pane.cjs.entry.js +4 -4
  18. package/dist/cjs/q2-carousel.cjs.entry.js +2 -2
  19. package/dist/cjs/q2-chart-area.cjs.entry.js +16 -3
  20. package/dist/cjs/q2-chart-area.cjs.entry.js.map +1 -1
  21. package/dist/cjs/q2-chart-bar.cjs.entry.js +3 -3
  22. package/dist/cjs/q2-chart-donut.cjs.entry.js +19 -3
  23. package/dist/cjs/q2-chart-donut.cjs.entry.js.map +1 -1
  24. package/dist/cjs/q2-checkbox-group.cjs.entry.js +6 -5
  25. package/dist/cjs/q2-checkbox-group.cjs.entry.js.map +1 -1
  26. package/dist/cjs/q2-checkbox.cjs.entry.js +2 -2
  27. package/dist/cjs/q2-currency.cjs.entry.js +14 -2
  28. package/dist/cjs/q2-currency.cjs.entry.js.map +1 -1
  29. package/dist/cjs/q2-data-table.cjs.entry.js +3 -3
  30. package/dist/cjs/q2-data-table.cjs.entry.js.map +1 -1
  31. package/dist/cjs/q2-detail.cjs.entry.js +3 -3
  32. package/dist/cjs/q2-dropdown-item.cjs.entry.js +12 -14
  33. package/dist/cjs/q2-dropdown-item.cjs.entry.js.map +1 -1
  34. package/dist/cjs/q2-dropdown.cjs.entry.js +7 -5
  35. package/dist/cjs/q2-dropdown.cjs.entry.js.map +1 -1
  36. package/dist/cjs/q2-editable-field.cjs.entry.js +3 -3
  37. package/dist/cjs/q2-example.cjs.entry.js +145 -0
  38. package/dist/cjs/q2-example.cjs.entry.js.map +1 -0
  39. package/dist/cjs/q2-formatted-text.cjs.entry.js +2 -2
  40. package/dist/cjs/q2-item.cjs.entry.js +3 -3
  41. package/dist/cjs/q2-legend.cjs.entry.js +2 -2
  42. package/dist/cjs/q2-link.cjs.entry.js +4 -4
  43. package/dist/cjs/q2-link.cjs.entry.js.map +1 -1
  44. package/dist/cjs/q2-list.cjs.entry.js +6 -7
  45. package/dist/cjs/q2-list.cjs.entry.js.map +1 -1
  46. package/dist/cjs/q2-loading-element.cjs.entry.js +2 -2
  47. package/dist/cjs/q2-loc.cjs.entry.js +52 -3
  48. package/dist/cjs/q2-loc.cjs.entry.js.map +1 -1
  49. package/dist/cjs/q2-message.cjs.entry.js +3 -3
  50. package/dist/cjs/q2-month-picker.cjs.entry.js +4 -4
  51. package/dist/cjs/q2-optgroup.cjs.entry.js +5 -4
  52. package/dist/cjs/q2-optgroup.cjs.entry.js.map +1 -1
  53. package/dist/cjs/q2-option-list.cjs.entry.js +2 -2
  54. package/dist/cjs/q2-option.cjs.entry.js +50 -33
  55. package/dist/cjs/q2-option.cjs.entry.js.map +1 -1
  56. package/dist/cjs/q2-pagination.cjs.entry.js +11 -7
  57. package/dist/cjs/q2-pagination.cjs.entry.js.map +1 -1
  58. package/dist/cjs/q2-pill.cjs.entry.js +19 -18
  59. package/dist/cjs/q2-pill.cjs.entry.js.map +1 -1
  60. package/dist/cjs/q2-radio-group.cjs.entry.js +5 -5
  61. package/dist/cjs/q2-radio-group.cjs.entry.js.map +1 -1
  62. package/dist/cjs/q2-radio.cjs.entry.js +3 -3
  63. package/dist/cjs/q2-relative-time.cjs.entry.js +3 -3
  64. package/dist/cjs/q2-resize-observer.cjs.entry.js +2 -2
  65. package/dist/cjs/q2-section.cjs.entry.js +8 -6
  66. package/dist/cjs/q2-section.cjs.entry.js.map +1 -1
  67. package/dist/cjs/q2-select.cjs.entry.js +6 -5
  68. package/dist/cjs/q2-select.cjs.entry.js.map +1 -1
  69. package/dist/cjs/q2-stepper-pane.cjs.entry.js +5 -4
  70. package/dist/cjs/q2-stepper-pane.cjs.entry.js.map +1 -1
  71. package/dist/cjs/q2-stepper-vertical.cjs.entry.js +16 -4
  72. package/dist/cjs/q2-stepper-vertical.cjs.entry.js.map +1 -1
  73. package/dist/cjs/q2-stepper.cjs.entry.js +6 -4
  74. package/dist/cjs/q2-stepper.cjs.entry.js.map +1 -1
  75. package/dist/cjs/q2-tag.cjs.entry.js +6 -4
  76. package/dist/cjs/q2-tag.cjs.entry.js.map +1 -1
  77. package/dist/cjs/q2-tecton-elements.cjs.js +2 -2
  78. package/dist/cjs/q2-textarea.cjs.entry.js +3 -3
  79. package/dist/cjs/q2-tooltip.cjs.entry.js +2 -2
  80. package/dist/cjs/{shapes-be198cc0.js → shapes-5d45fc11.js} +2 -2
  81. package/dist/cjs/{shapes-be198cc0.js.map → shapes-5d45fc11.js.map} +1 -1
  82. package/dist/cjs/tecton-tab-pane.cjs.entry.js +3 -3
  83. package/dist/collection/collection-manifest.json +1 -0
  84. package/dist/collection/components/q2-action-group/q2-action-group.js +1 -1
  85. package/dist/collection/components/q2-action-sheet/q2-action-sheet.js +1 -1
  86. package/dist/collection/components/q2-avatar/q2-avatar.js +1 -1
  87. package/dist/collection/components/q2-calendar/q2-calendar.js +16 -18
  88. package/dist/collection/components/q2-calendar/q2-calendar.js.map +1 -1
  89. package/dist/collection/components/q2-calendar/q2-month-picker.js +2 -2
  90. package/dist/collection/components/q2-calendar/test/q2-calendar-test.e2e.js +27 -0
  91. package/dist/collection/components/q2-calendar/test/q2-calendar-test.e2e.js.map +1 -1
  92. package/dist/collection/components/q2-card/q2-card.js +2 -0
  93. package/dist/collection/components/q2-card/q2-card.js.map +1 -1
  94. package/dist/collection/components/q2-carousel-pane/q2-carousel-pane.js +2 -2
  95. package/dist/collection/components/q2-chart-area/q2-chart-area.js +42 -1
  96. package/dist/collection/components/q2-chart-area/q2-chart-area.js.map +1 -1
  97. package/dist/collection/components/q2-chart-area/test/q2-chart-area-test.e2e.js +15 -0
  98. package/dist/collection/components/q2-chart-area/test/q2-chart-area-test.e2e.js.map +1 -1
  99. package/dist/collection/components/q2-chart-bar/q2-chart-bar.js +1 -1
  100. package/dist/collection/components/q2-chart-donut/q2-chart-donut.js +41 -1
  101. package/dist/collection/components/q2-chart-donut/q2-chart-donut.js.map +1 -1
  102. package/dist/collection/components/q2-chart-donut/test/q2-chart-donut-test.e2e.js +11 -0
  103. package/dist/collection/components/q2-chart-donut/test/q2-chart-donut-test.e2e.js.map +1 -1
  104. package/dist/collection/components/q2-checkbox-group/q2-checkbox-group.css +30 -23
  105. package/dist/collection/components/q2-checkbox-group/q2-checkbox-group.js +4 -3
  106. package/dist/collection/components/q2-checkbox-group/q2-checkbox-group.js.map +1 -1
  107. package/dist/collection/components/q2-currency/q2-currency.js +37 -1
  108. package/dist/collection/components/q2-currency/q2-currency.js.map +1 -1
  109. package/dist/collection/components/q2-currency/test/q2-currency-test.e2e.js +34 -23
  110. package/dist/collection/components/q2-currency/test/q2-currency-test.e2e.js.map +1 -1
  111. package/dist/collection/components/q2-data-table/q2-data-table.js +1 -1
  112. package/dist/collection/components/q2-data-table/q2-data-table.js.map +1 -1
  113. package/dist/collection/components/q2-data-table/test/q2-data-table-test.e2e.js +6 -4
  114. package/dist/collection/components/q2-data-table/test/q2-data-table-test.e2e.js.map +1 -1
  115. package/dist/collection/components/q2-detail/q2-detail.js +1 -1
  116. package/dist/collection/components/q2-dropdown/q2-dropdown.css +5 -0
  117. package/dist/collection/components/q2-dropdown/q2-dropdown.js +10 -4
  118. package/dist/collection/components/q2-dropdown/q2-dropdown.js.map +1 -1
  119. package/dist/collection/components/q2-dropdown/test/q2-dropdown-test.e2e.js +59 -14
  120. package/dist/collection/components/q2-dropdown/test/q2-dropdown-test.e2e.js.map +1 -1
  121. package/dist/collection/components/q2-dropdown-item/q2-dropdown-item.css +29 -11
  122. package/dist/collection/components/q2-dropdown-item/q2-dropdown-item.js +9 -11
  123. package/dist/collection/components/q2-dropdown-item/q2-dropdown-item.js.map +1 -1
  124. package/dist/collection/components/q2-dropdown-item/test/q2-dropdown-item-test.e2e.js +108 -74
  125. package/dist/collection/components/q2-dropdown-item/test/q2-dropdown-item-test.e2e.js.map +1 -1
  126. package/dist/collection/components/q2-editable-field/q2-editable-field.js +1 -1
  127. package/dist/collection/components/q2-example/q2-example.css +66 -0
  128. package/dist/collection/components/q2-example/q2-example.js +312 -0
  129. package/dist/collection/components/q2-example/q2-example.js.map +1 -0
  130. package/dist/collection/components/q2-example/test/q2-example.e2e.js +27 -0
  131. package/dist/collection/components/q2-example/test/q2-example.e2e.js.map +1 -0
  132. package/dist/collection/components/q2-example/test/q2-example.spec.js +126 -0
  133. package/dist/collection/components/q2-example/test/q2-example.spec.js.map +1 -0
  134. package/dist/collection/components/q2-formatted-text/q2-formatted-text.js +1 -1
  135. package/dist/collection/components/q2-input/formatting/alpha.spec.js +10 -0
  136. package/dist/collection/components/q2-input/formatting/alpha.spec.js.map +1 -0
  137. package/dist/collection/components/q2-input/formatting/alphanumeric.spec.js +7 -0
  138. package/dist/collection/components/q2-input/formatting/alphanumeric.spec.js.map +1 -0
  139. package/dist/collection/components/q2-input/formatting/currency.spec.js +20 -0
  140. package/dist/collection/components/q2-input/formatting/currency.spec.js.map +1 -0
  141. package/dist/collection/components/q2-input/formatting/date.js +1 -1
  142. package/dist/collection/components/q2-input/formatting/date.js.map +1 -1
  143. package/dist/collection/components/q2-input/formatting/date.spec.js +17 -0
  144. package/dist/collection/components/q2-input/formatting/date.spec.js.map +1 -0
  145. package/dist/collection/components/q2-input/formatting/numeric.spec.js +32 -0
  146. package/dist/collection/components/q2-input/formatting/numeric.spec.js.map +1 -0
  147. package/dist/collection/components/q2-input/formatting/phone.spec.js +16 -0
  148. package/dist/collection/components/q2-input/formatting/phone.spec.js.map +1 -0
  149. package/dist/collection/components/q2-input/formatting/postal.js +1 -1
  150. package/dist/collection/components/q2-input/formatting/postal.js.map +1 -1
  151. package/dist/collection/components/q2-input/formatting/postal.spec.js +28 -0
  152. package/dist/collection/components/q2-input/formatting/postal.spec.js.map +1 -0
  153. package/dist/collection/components/q2-input/formatting/ssn.spec.js +7 -0
  154. package/dist/collection/components/q2-input/formatting/ssn.spec.js.map +1 -0
  155. package/dist/collection/components/q2-input/formatting/tin.spec.js +7 -0
  156. package/dist/collection/components/q2-input/formatting/tin.spec.js.map +1 -0
  157. package/dist/collection/components/q2-input/q2-input.js +58 -44
  158. package/dist/collection/components/q2-input/q2-input.js.map +1 -1
  159. package/dist/collection/components/q2-input/test/q2-input-test.e2e.js +259 -2106
  160. package/dist/collection/components/q2-input/test/q2-input-test.e2e.js.map +1 -1
  161. package/dist/collection/components/q2-input/test/q2-input-test.spec.js +4035 -0
  162. package/dist/collection/components/q2-input/test/q2-input-test.spec.js.map +1 -0
  163. package/dist/collection/components/q2-item/q2-item.js +1 -1
  164. package/dist/collection/components/q2-legend/q2-legend.js +1 -1
  165. package/dist/collection/components/q2-link/q2-link.css +17 -20
  166. package/dist/collection/components/q2-link/q2-link.js +2 -2
  167. package/dist/collection/components/q2-link/q2-link.js.map +1 -1
  168. package/dist/collection/components/q2-link/test/q2-link-test.e2e.js +6 -6
  169. package/dist/collection/components/q2-link/test/q2-link-test.e2e.js.map +1 -1
  170. package/dist/collection/components/q2-list/q2-list.js +4 -5
  171. package/dist/collection/components/q2-list/q2-list.js.map +1 -1
  172. package/dist/collection/components/q2-loc/q2-loc.js +66 -4
  173. package/dist/collection/components/q2-loc/q2-loc.js.map +1 -1
  174. package/dist/collection/components/q2-loc/test/q2-loc-test.e2e.js +19 -30
  175. package/dist/collection/components/q2-loc/test/q2-loc-test.e2e.js.map +1 -1
  176. package/dist/collection/components/q2-loc/test/q2-loc-test.spec.js +164 -0
  177. package/dist/collection/components/q2-loc/test/q2-loc-test.spec.js.map +1 -0
  178. package/dist/collection/components/q2-message/q2-message.js +1 -1
  179. package/dist/collection/components/q2-optgroup/q2-optgroup.js +3 -2
  180. package/dist/collection/components/q2-optgroup/q2-optgroup.js.map +1 -1
  181. package/dist/collection/components/q2-option/q2-option.css +1 -1
  182. package/dist/collection/components/q2-option/q2-option.js +57 -34
  183. package/dist/collection/components/q2-option/q2-option.js.map +1 -1
  184. package/dist/collection/components/q2-option/test/q2-option-test.e2e.js +110 -106
  185. package/dist/collection/components/q2-option/test/q2-option-test.e2e.js.map +1 -1
  186. package/dist/collection/components/q2-option/test/q2-option-test.spec.js +532 -0
  187. package/dist/collection/components/q2-option/test/q2-option-test.spec.js.map +1 -0
  188. package/dist/collection/components/q2-pagination/q2-pagination.js +9 -5
  189. package/dist/collection/components/q2-pagination/q2-pagination.js.map +1 -1
  190. package/dist/collection/components/q2-pagination/test/q2-pagination-test.e2e.js +18 -1
  191. package/dist/collection/components/q2-pagination/test/q2-pagination-test.e2e.js.map +1 -1
  192. package/dist/collection/components/q2-pill/q2-pill.js +18 -17
  193. package/dist/collection/components/q2-pill/q2-pill.js.map +1 -1
  194. package/dist/collection/components/q2-pill/test/q2-pill-test.e2e.js +128 -57
  195. package/dist/collection/components/q2-pill/test/q2-pill-test.e2e.js.map +1 -1
  196. package/dist/collection/components/q2-popover/q2-popover.js +17 -4
  197. package/dist/collection/components/q2-popover/q2-popover.js.map +1 -1
  198. package/dist/collection/components/q2-radio/q2-radio.js +1 -1
  199. package/dist/collection/components/q2-radio-group/q2-radio-group.css +19 -9
  200. package/dist/collection/components/q2-radio-group/q2-radio-group.js +2 -2
  201. package/dist/collection/components/q2-radio-group/q2-radio-group.js.map +1 -1
  202. package/dist/collection/components/q2-relative-time/q2-relative-time.js +1 -1
  203. package/dist/collection/components/q2-resize-observer/q2-resize-observer.js +1 -1
  204. package/dist/collection/components/q2-section/q2-section.js +6 -4
  205. package/dist/collection/components/q2-section/q2-section.js.map +1 -1
  206. package/dist/collection/components/q2-select/q2-select.js +5 -3
  207. package/dist/collection/components/q2-select/q2-select.js.map +1 -1
  208. package/dist/collection/components/q2-select/test/q2-select-test.e2e.js +123 -62
  209. package/dist/collection/components/q2-select/test/q2-select-test.e2e.js.map +1 -1
  210. package/dist/collection/components/q2-stepper/q2-stepper.js +4 -2
  211. package/dist/collection/components/q2-stepper/q2-stepper.js.map +1 -1
  212. package/dist/collection/components/q2-stepper-pane/q2-stepper-pane.js +3 -2
  213. package/dist/collection/components/q2-stepper-pane/q2-stepper-pane.js.map +1 -1
  214. package/dist/collection/components/q2-stepper-vertical/q2-stepper-vertical.js +46 -2
  215. package/dist/collection/components/q2-stepper-vertical/q2-stepper-vertical.js.map +1 -1
  216. package/dist/collection/components/q2-stepper-vertical/test/q2-stepper-vertical-test.e2e.js +26 -0
  217. package/dist/collection/components/q2-stepper-vertical/test/q2-stepper-vertical-test.e2e.js.map +1 -1
  218. package/dist/collection/components/q2-tab-container/q2-tab-container.js +4 -3
  219. package/dist/collection/components/q2-tab-container/q2-tab-container.js.map +1 -1
  220. package/dist/collection/components/q2-tab-pane/q2-tab-pane.js +1 -1
  221. package/dist/collection/components/q2-tag/q2-tag.js +5 -2
  222. package/dist/collection/components/q2-tag/q2-tag.js.map +1 -1
  223. package/dist/collection/components/q2-tag/test/q2-tag-test.e2e.js +55 -4
  224. package/dist/collection/components/q2-tag/test/q2-tag-test.e2e.js.map +1 -1
  225. package/dist/collection/components/q2-textarea/q2-textarea.js +1 -1
  226. package/dist/collection/components/tecton-tab-pane/tecton-tab-pane.js +2 -2
  227. package/dist/collection/utils/helpers.js +63 -41
  228. package/dist/collection/utils/helpers.js.map +1 -1
  229. package/dist/collection/utils/index.js +83 -0
  230. package/dist/collection/utils/index.js.map +1 -1
  231. package/dist/components/index.js +2 -0
  232. package/dist/components/index.js.map +1 -1
  233. package/dist/components/index2.js +84 -1
  234. package/dist/components/index2.js.map +1 -1
  235. package/dist/components/q2-action-group.js +1 -1
  236. package/dist/components/q2-action-sheet.js +1 -1
  237. package/dist/components/q2-avatar2.js +1 -1
  238. package/dist/components/q2-calendar.js +16 -18
  239. package/dist/components/q2-calendar.js.map +1 -1
  240. package/dist/components/q2-card.js +2 -0
  241. package/dist/components/q2-card.js.map +1 -1
  242. package/dist/components/q2-carousel-pane.js +2 -2
  243. package/dist/components/q2-chart-area.js +16 -2
  244. package/dist/components/q2-chart-area.js.map +1 -1
  245. package/dist/components/q2-chart-bar.js +1 -1
  246. package/dist/components/q2-chart-donut.js +19 -2
  247. package/dist/components/q2-chart-donut.js.map +1 -1
  248. package/dist/components/q2-checkbox-group.js +5 -4
  249. package/dist/components/q2-checkbox-group.js.map +1 -1
  250. package/dist/components/q2-currency.js +15 -2
  251. package/dist/components/q2-currency.js.map +1 -1
  252. package/dist/components/q2-data-table.js +1 -1
  253. package/dist/components/q2-data-table.js.map +1 -1
  254. package/dist/components/q2-detail.js +1 -1
  255. package/dist/components/q2-dropdown-item2.js +12 -26
  256. package/dist/components/q2-dropdown-item2.js.map +1 -1
  257. package/dist/components/q2-dropdown.js +6 -3
  258. package/dist/components/q2-dropdown.js.map +1 -1
  259. package/dist/components/q2-editable-field.js +1 -1
  260. package/dist/components/q2-example.d.ts +11 -0
  261. package/dist/components/q2-example.js +170 -0
  262. package/dist/components/q2-example.js.map +1 -0
  263. package/dist/components/q2-formatted-text.js +1 -1
  264. package/dist/components/q2-input2.js +41 -37
  265. package/dist/components/q2-input2.js.map +1 -1
  266. package/dist/components/q2-item.js +1 -1
  267. package/dist/components/q2-legend2.js +1 -1
  268. package/dist/components/q2-link.js +3 -3
  269. package/dist/components/q2-link.js.map +1 -1
  270. package/dist/components/q2-list.js +4 -5
  271. package/dist/components/q2-list.js.map +1 -1
  272. package/dist/components/q2-loc.js +55 -2
  273. package/dist/components/q2-loc.js.map +1 -1
  274. package/dist/components/q2-message2.js +1 -1
  275. package/dist/components/q2-month-picker.js +2 -2
  276. package/dist/components/q2-optgroup2.js +3 -2
  277. package/dist/components/q2-optgroup2.js.map +1 -1
  278. package/dist/components/q2-option-list2.js +1 -1
  279. package/dist/components/q2-option2.js +52 -33
  280. package/dist/components/q2-option2.js.map +1 -1
  281. package/dist/components/q2-pagination.js +9 -5
  282. package/dist/components/q2-pagination.js.map +1 -1
  283. package/dist/components/q2-pill.js +18 -17
  284. package/dist/components/q2-pill.js.map +1 -1
  285. package/dist/components/q2-popover2.js +16 -4
  286. package/dist/components/q2-popover2.js.map +1 -1
  287. package/dist/components/q2-radio-group.js +3 -3
  288. package/dist/components/q2-radio-group.js.map +1 -1
  289. package/dist/components/q2-radio.js +1 -1
  290. package/dist/components/q2-relative-time.js +1 -1
  291. package/dist/components/q2-resize-observer2.js +1 -1
  292. package/dist/components/q2-section.js +6 -4
  293. package/dist/components/q2-section.js.map +1 -1
  294. package/dist/components/q2-select2.js +6 -4
  295. package/dist/components/q2-select2.js.map +1 -1
  296. package/dist/components/q2-stepper-pane.js +3 -2
  297. package/dist/components/q2-stepper-pane.js.map +1 -1
  298. package/dist/components/q2-stepper-vertical.js +16 -3
  299. package/dist/components/q2-stepper-vertical.js.map +1 -1
  300. package/dist/components/q2-stepper.js +4 -2
  301. package/dist/components/q2-stepper.js.map +1 -1
  302. package/dist/components/q2-tab-container.js +4 -3
  303. package/dist/components/q2-tab-container.js.map +1 -1
  304. package/dist/components/q2-tab-pane.js +1 -1
  305. package/dist/components/q2-tag.js +5 -2
  306. package/dist/components/q2-tag.js.map +1 -1
  307. package/dist/components/q2-textarea.js +1 -1
  308. package/dist/components/tecton-tab-pane.js +2 -2
  309. package/dist/esm/click-elsewhere_2.entry.js +16 -5
  310. package/dist/esm/click-elsewhere_2.entry.js.map +1 -1
  311. package/dist/esm/{index-1e1ce94e.js → index-7a5365e2.js} +40 -5
  312. package/dist/esm/index-7a5365e2.js.map +1 -0
  313. package/dist/esm/{index-844fc010.js → index-d18e2a20.js} +86 -3
  314. package/dist/esm/index-d18e2a20.js.map +1 -0
  315. package/dist/esm/loader.js +3 -3
  316. package/dist/esm/q2-action-group.entry.js +2 -2
  317. package/dist/esm/q2-action-sheet.entry.js +3 -3
  318. package/dist/esm/q2-avatar.entry.js +2 -2
  319. package/dist/esm/q2-badge_7.entry.js +49 -44
  320. package/dist/esm/q2-badge_7.entry.js.map +1 -1
  321. package/dist/esm/q2-calendar.entry.js +17 -20
  322. package/dist/esm/q2-calendar.entry.js.map +1 -1
  323. package/dist/esm/q2-card.entry.js +4 -2
  324. package/dist/esm/q2-card.entry.js.map +1 -1
  325. package/dist/esm/q2-carousel-pane.entry.js +4 -4
  326. package/dist/esm/q2-carousel.entry.js +2 -2
  327. package/dist/esm/q2-chart-area.entry.js +16 -3
  328. package/dist/esm/q2-chart-area.entry.js.map +1 -1
  329. package/dist/esm/q2-chart-bar.entry.js +3 -3
  330. package/dist/esm/q2-chart-donut.entry.js +19 -3
  331. package/dist/esm/q2-chart-donut.entry.js.map +1 -1
  332. package/dist/esm/q2-checkbox-group.entry.js +6 -5
  333. package/dist/esm/q2-checkbox-group.entry.js.map +1 -1
  334. package/dist/esm/q2-checkbox.entry.js +2 -2
  335. package/dist/esm/q2-currency.entry.js +14 -2
  336. package/dist/esm/q2-currency.entry.js.map +1 -1
  337. package/dist/esm/q2-data-table.entry.js +3 -3
  338. package/dist/esm/q2-data-table.entry.js.map +1 -1
  339. package/dist/esm/q2-detail.entry.js +3 -3
  340. package/dist/esm/q2-dropdown-item.entry.js +12 -14
  341. package/dist/esm/q2-dropdown-item.entry.js.map +1 -1
  342. package/dist/esm/q2-dropdown.entry.js +7 -5
  343. package/dist/esm/q2-dropdown.entry.js.map +1 -1
  344. package/dist/esm/q2-editable-field.entry.js +3 -3
  345. package/dist/esm/q2-example.entry.js +141 -0
  346. package/dist/esm/q2-example.entry.js.map +1 -0
  347. package/dist/esm/q2-formatted-text.entry.js +2 -2
  348. package/dist/esm/q2-item.entry.js +3 -3
  349. package/dist/esm/q2-legend.entry.js +2 -2
  350. package/dist/esm/q2-link.entry.js +4 -4
  351. package/dist/esm/q2-link.entry.js.map +1 -1
  352. package/dist/esm/q2-list.entry.js +6 -7
  353. package/dist/esm/q2-list.entry.js.map +1 -1
  354. package/dist/esm/q2-loading-element.entry.js +2 -2
  355. package/dist/esm/q2-loc.entry.js +52 -3
  356. package/dist/esm/q2-loc.entry.js.map +1 -1
  357. package/dist/esm/q2-message.entry.js +3 -3
  358. package/dist/esm/q2-month-picker.entry.js +4 -4
  359. package/dist/esm/q2-optgroup.entry.js +5 -4
  360. package/dist/esm/q2-optgroup.entry.js.map +1 -1
  361. package/dist/esm/q2-option-list.entry.js +2 -2
  362. package/dist/esm/q2-option.entry.js +50 -33
  363. package/dist/esm/q2-option.entry.js.map +1 -1
  364. package/dist/esm/q2-pagination.entry.js +11 -7
  365. package/dist/esm/q2-pagination.entry.js.map +1 -1
  366. package/dist/esm/q2-pill.entry.js +19 -18
  367. package/dist/esm/q2-pill.entry.js.map +1 -1
  368. package/dist/esm/q2-radio-group.entry.js +5 -5
  369. package/dist/esm/q2-radio-group.entry.js.map +1 -1
  370. package/dist/esm/q2-radio.entry.js +3 -3
  371. package/dist/esm/q2-relative-time.entry.js +3 -3
  372. package/dist/esm/q2-resize-observer.entry.js +2 -2
  373. package/dist/esm/q2-section.entry.js +8 -6
  374. package/dist/esm/q2-section.entry.js.map +1 -1
  375. package/dist/esm/q2-select.entry.js +6 -5
  376. package/dist/esm/q2-select.entry.js.map +1 -1
  377. package/dist/esm/q2-stepper-pane.entry.js +5 -4
  378. package/dist/esm/q2-stepper-pane.entry.js.map +1 -1
  379. package/dist/esm/q2-stepper-vertical.entry.js +16 -4
  380. package/dist/esm/q2-stepper-vertical.entry.js.map +1 -1
  381. package/dist/esm/q2-stepper.entry.js +6 -4
  382. package/dist/esm/q2-stepper.entry.js.map +1 -1
  383. package/dist/esm/q2-tag.entry.js +6 -4
  384. package/dist/esm/q2-tag.entry.js.map +1 -1
  385. package/dist/esm/q2-tecton-elements.js +3 -3
  386. package/dist/esm/q2-textarea.entry.js +3 -3
  387. package/dist/esm/q2-tooltip.entry.js +2 -2
  388. package/dist/esm/{shapes-36183b2a.js → shapes-c7e1a3fa.js} +2 -2
  389. package/dist/esm/{shapes-36183b2a.js.map → shapes-c7e1a3fa.js.map} +1 -1
  390. package/dist/esm/tecton-tab-pane.entry.js +3 -3
  391. package/dist/q2-tecton-elements/action-sheet-e64cb6f7.js +77 -0
  392. package/dist/q2-tecton-elements/{p-b7554a79.js.map → action-sheet-e64cb6f7.js.map} +1 -1
  393. package/dist/q2-tecton-elements/app-globals-0f993ce5.js +4 -0
  394. package/dist/q2-tecton-elements/{p-e1255160.js.map → app-globals-0f993ce5.js.map} +1 -1
  395. package/dist/q2-tecton-elements/charting-1abfb877.js +34872 -0
  396. package/dist/q2-tecton-elements/{p-2941aafa.js.map → charting-1abfb877.js.map} +1 -1
  397. package/dist/q2-tecton-elements/click-elsewhere_2.entry.js +410 -0
  398. package/dist/q2-tecton-elements/click-elsewhere_2.entry.js.map +1 -0
  399. package/dist/q2-tecton-elements/dataSample-7b62e101.js +2602 -0
  400. package/dist/q2-tecton-elements/{p-ad80aef0.js.map → dataSample-7b62e101.js.map} +1 -1
  401. package/dist/q2-tecton-elements/index-3184c760.js +18168 -0
  402. package/dist/q2-tecton-elements/{p-f1e887f5.js.map → index-3184c760.js.map} +1 -1
  403. package/dist/q2-tecton-elements/index-7a5365e2.js +1792 -0
  404. package/dist/q2-tecton-elements/index-7a5365e2.js.map +1 -0
  405. package/dist/q2-tecton-elements/index-d18e2a20.js +323 -0
  406. package/dist/q2-tecton-elements/index-d18e2a20.js.map +1 -0
  407. package/dist/q2-tecton-elements/q2-action-group.entry.js +56 -0
  408. package/dist/q2-tecton-elements/{p-5637c486.entry.js.map → q2-action-group.entry.js.map} +1 -1
  409. package/dist/q2-tecton-elements/q2-action-sheet.entry.js +1480 -0
  410. package/dist/q2-tecton-elements/{p-188eb162.entry.js.map → q2-action-sheet.entry.js.map} +1 -1
  411. package/dist/q2-tecton-elements/q2-avatar.entry.js +101 -0
  412. package/dist/q2-tecton-elements/{p-07d1c3ae.entry.js.map → q2-avatar.entry.js.map} +1 -1
  413. package/dist/q2-tecton-elements/q2-badge_7.entry.js +5449 -0
  414. package/dist/q2-tecton-elements/q2-badge_7.entry.js.map +1 -0
  415. package/dist/q2-tecton-elements/q2-calendar.entry.js +1313 -0
  416. package/dist/q2-tecton-elements/q2-calendar.entry.js.map +1 -0
  417. package/dist/q2-tecton-elements/q2-card.entry.js +170 -0
  418. package/dist/q2-tecton-elements/q2-card.entry.js.map +1 -0
  419. package/dist/q2-tecton-elements/q2-carousel-pane.entry.js +130 -0
  420. package/dist/q2-tecton-elements/{p-7aef0c08.entry.js.map → q2-carousel-pane.entry.js.map} +1 -1
  421. package/dist/q2-tecton-elements/q2-carousel.entry.js +4613 -0
  422. package/dist/q2-tecton-elements/{p-e216ef3f.entry.js.map → q2-carousel.entry.js.map} +1 -1
  423. package/dist/q2-tecton-elements/q2-chart-area.entry.js +4330 -0
  424. package/dist/q2-tecton-elements/q2-chart-area.entry.js.map +1 -0
  425. package/dist/q2-tecton-elements/q2-chart-bar.entry.js +1479 -0
  426. package/dist/q2-tecton-elements/{p-7906f49e.entry.js.map → q2-chart-bar.entry.js.map} +1 -1
  427. package/dist/q2-tecton-elements/q2-chart-donut.entry.js +4537 -0
  428. package/dist/q2-tecton-elements/q2-chart-donut.entry.js.map +1 -0
  429. package/dist/q2-tecton-elements/q2-checkbox-group.entry.js +166 -0
  430. package/dist/q2-tecton-elements/q2-checkbox-group.entry.js.map +1 -0
  431. package/dist/q2-tecton-elements/q2-checkbox.entry.js +223 -0
  432. package/dist/q2-tecton-elements/{p-b7de110e.entry.js.map → q2-checkbox.entry.js.map} +1 -1
  433. package/dist/q2-tecton-elements/q2-currency.entry.js +153 -0
  434. package/dist/q2-tecton-elements/q2-currency.entry.js.map +1 -0
  435. package/dist/q2-tecton-elements/q2-data-table.entry.js +622 -0
  436. package/dist/q2-tecton-elements/{p-7903cd15.entry.js.map → q2-data-table.entry.js.map} +1 -1
  437. package/dist/q2-tecton-elements/q2-detail.entry.js +128 -0
  438. package/dist/q2-tecton-elements/{p-f5f23659.entry.js.map → q2-detail.entry.js.map} +1 -1
  439. package/dist/q2-tecton-elements/q2-dropdown-item.entry.js +146 -0
  440. package/dist/q2-tecton-elements/q2-dropdown-item.entry.js.map +1 -0
  441. package/dist/q2-tecton-elements/q2-dropdown.entry.js +430 -0
  442. package/dist/q2-tecton-elements/q2-dropdown.entry.js.map +1 -0
  443. package/dist/q2-tecton-elements/q2-editable-field.entry.js +296 -0
  444. package/dist/q2-tecton-elements/{p-896c7008.entry.js.map → q2-editable-field.entry.js.map} +1 -1
  445. package/dist/q2-tecton-elements/q2-example.entry.js +152 -0
  446. package/dist/q2-tecton-elements/q2-example.entry.js.map +1 -0
  447. package/dist/q2-tecton-elements/q2-formatted-text.entry.js +73 -0
  448. package/dist/q2-tecton-elements/{p-7c9f8b62.entry.js.map → q2-formatted-text.entry.js.map} +1 -1
  449. package/dist/q2-tecton-elements/q2-item.entry.js +158 -0
  450. package/dist/q2-tecton-elements/{p-7c9a0122.entry.js.map → q2-item.entry.js.map} +1 -1
  451. package/dist/q2-tecton-elements/q2-legend.entry.js +146 -0
  452. package/dist/q2-tecton-elements/{p-ff8f1a32.entry.js.map → q2-legend.entry.js.map} +1 -1
  453. package/dist/q2-tecton-elements/q2-link.entry.js +83 -0
  454. package/dist/q2-tecton-elements/q2-link.entry.js.map +1 -0
  455. package/dist/q2-tecton-elements/q2-list.entry.js +100 -0
  456. package/dist/q2-tecton-elements/q2-list.entry.js.map +1 -0
  457. package/dist/q2-tecton-elements/q2-loading-element.entry.js +36 -0
  458. package/dist/q2-tecton-elements/{p-a068c84c.entry.js.map → q2-loading-element.entry.js.map} +1 -1
  459. package/dist/q2-tecton-elements/q2-loc.entry.js +82 -0
  460. package/dist/q2-tecton-elements/q2-loc.entry.js.map +1 -0
  461. package/dist/q2-tecton-elements/q2-message.entry.js +99 -0
  462. package/dist/q2-tecton-elements/{p-8d2b02e1.entry.js.map → q2-message.entry.js.map} +1 -1
  463. package/dist/q2-tecton-elements/q2-month-picker.entry.js +198 -0
  464. package/dist/q2-tecton-elements/{p-8d07cf91.entry.js.map → q2-month-picker.entry.js.map} +1 -1
  465. package/dist/q2-tecton-elements/q2-optgroup.entry.js +88 -0
  466. package/dist/q2-tecton-elements/q2-optgroup.entry.js.map +1 -0
  467. package/dist/q2-tecton-elements/q2-option-list.entry.js +585 -0
  468. package/dist/q2-tecton-elements/{p-a5d0e252.entry.js.map → q2-option-list.entry.js.map} +1 -1
  469. package/dist/q2-tecton-elements/q2-option.entry.js +110 -0
  470. package/dist/q2-tecton-elements/q2-option.entry.js.map +1 -0
  471. package/dist/q2-tecton-elements/q2-pagination.entry.js +377 -0
  472. package/dist/q2-tecton-elements/q2-pagination.entry.js.map +1 -0
  473. package/dist/q2-tecton-elements/q2-pill.entry.js +434 -0
  474. package/dist/q2-tecton-elements/q2-pill.entry.js.map +1 -0
  475. package/dist/q2-tecton-elements/q2-radio-group.entry.js +227 -0
  476. package/dist/q2-tecton-elements/q2-radio-group.entry.js.map +1 -0
  477. package/dist/q2-tecton-elements/q2-radio.entry.js +144 -0
  478. package/dist/q2-tecton-elements/{p-c235ab3f.entry.js.map → q2-radio.entry.js.map} +1 -1
  479. package/dist/q2-tecton-elements/q2-relative-time.entry.js +162 -0
  480. package/dist/q2-tecton-elements/{p-95a7c042.entry.js.map → q2-relative-time.entry.js.map} +1 -1
  481. package/dist/q2-tecton-elements/q2-resize-observer.entry.js +100 -0
  482. package/dist/q2-tecton-elements/{p-e2c800ef.entry.js.map → q2-resize-observer.entry.js.map} +1 -1
  483. package/dist/q2-tecton-elements/q2-section.entry.js +256 -0
  484. package/dist/q2-tecton-elements/q2-section.entry.js.map +1 -0
  485. package/dist/q2-tecton-elements/q2-select.entry.js +684 -0
  486. package/dist/q2-tecton-elements/q2-select.entry.js.map +1 -0
  487. package/dist/q2-tecton-elements/q2-stepper-pane.entry.js +124 -0
  488. package/dist/q2-tecton-elements/q2-stepper-pane.entry.js.map +1 -0
  489. package/dist/q2-tecton-elements/q2-stepper-vertical.entry.js +356 -0
  490. package/dist/q2-tecton-elements/q2-stepper-vertical.entry.js.map +1 -0
  491. package/dist/q2-tecton-elements/q2-stepper.entry.js +332 -0
  492. package/dist/q2-tecton-elements/q2-stepper.entry.js.map +1 -0
  493. package/dist/q2-tecton-elements/q2-tag.entry.js +213 -0
  494. package/dist/q2-tecton-elements/q2-tag.entry.js.map +1 -0
  495. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +21 -1
  496. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
  497. package/dist/q2-tecton-elements/q2-textarea.entry.js +364 -0
  498. package/dist/q2-tecton-elements/{p-f135b265.entry.js.map → q2-textarea.entry.js.map} +1 -1
  499. package/dist/q2-tecton-elements/q2-tooltip.entry.js +105 -0
  500. package/dist/q2-tecton-elements/{p-c5667d5d.entry.js.map → q2-tooltip.entry.js.map} +1 -1
  501. package/dist/q2-tecton-elements/sectorHelper-183cedd0.js +949 -0
  502. package/dist/q2-tecton-elements/{p-eea5aa01.js.map → sectorHelper-183cedd0.js.map} +1 -1
  503. package/dist/q2-tecton-elements/shapes-c7e1a3fa.js +132 -0
  504. package/dist/q2-tecton-elements/{p-50b425de.js.map → shapes-c7e1a3fa.js.map} +1 -1
  505. package/dist/q2-tecton-elements/tecton-tab-pane.entry.js +134 -0
  506. package/dist/q2-tecton-elements/{p-96b1406c.entry.js.map → tecton-tab-pane.entry.js.map} +1 -1
  507. package/dist/types/components/q2-calendar/q2-calendar.d.ts +4 -5
  508. package/dist/types/components/q2-chart-area/q2-chart-area.d.ts +6 -0
  509. package/dist/types/components/q2-chart-donut/q2-chart-donut.d.ts +6 -0
  510. package/dist/types/components/q2-currency/q2-currency.d.ts +7 -0
  511. package/dist/types/components/q2-dropdown/q2-dropdown.d.ts +1 -1
  512. package/dist/types/components/q2-dropdown-item/q2-dropdown-item.d.ts +2 -2
  513. package/dist/types/components/q2-example/q2-example.d.ts +119 -0
  514. package/dist/types/components/q2-input/formatting/date.d.ts +22 -0
  515. package/dist/types/components/q2-input/formatting/postal.d.ts +197 -0
  516. package/dist/types/components/q2-input/q2-input.d.ts +15 -12
  517. package/dist/types/components/q2-loc/q2-loc.d.ts +15 -1
  518. package/dist/types/components/q2-option/q2-option.d.ts +11 -3
  519. package/dist/types/components/q2-pill/q2-pill.d.ts +3 -3
  520. package/dist/types/components/q2-popover/q2-popover.d.ts +1 -0
  521. package/dist/types/components/q2-select/q2-select.d.ts +1 -1
  522. package/dist/types/components/q2-stepper-vertical/q2-stepper-vertical.d.ts +6 -0
  523. package/dist/types/components/q2-tag/q2-tag.d.ts +1 -1
  524. package/dist/types/components.d.ts +104 -14
  525. package/dist/types/utils/helpers.d.ts +13 -0
  526. package/dist/types/utils/index.d.ts +11 -0
  527. package/package.json +7 -7
  528. package/dist/cjs/index-14c3693c.js.map +0 -1
  529. package/dist/cjs/index-9aa4a776.js.map +0 -1
  530. package/dist/esm/index-1e1ce94e.js.map +0 -1
  531. package/dist/esm/index-844fc010.js.map +0 -1
  532. package/dist/q2-tecton-elements/p-06701928.entry.js +0 -2
  533. package/dist/q2-tecton-elements/p-06701928.entry.js.map +0 -1
  534. package/dist/q2-tecton-elements/p-07d1c3ae.entry.js +0 -2
  535. package/dist/q2-tecton-elements/p-1305f7ca.entry.js +0 -2
  536. package/dist/q2-tecton-elements/p-1305f7ca.entry.js.map +0 -1
  537. package/dist/q2-tecton-elements/p-15ac45d6.js +0 -2
  538. package/dist/q2-tecton-elements/p-15ac45d6.js.map +0 -1
  539. package/dist/q2-tecton-elements/p-16910682.entry.js +0 -2
  540. package/dist/q2-tecton-elements/p-16910682.entry.js.map +0 -1
  541. package/dist/q2-tecton-elements/p-188eb162.entry.js +0 -3
  542. package/dist/q2-tecton-elements/p-1c760a89.entry.js +0 -2
  543. package/dist/q2-tecton-elements/p-1c760a89.entry.js.map +0 -1
  544. package/dist/q2-tecton-elements/p-1c88d057.entry.js +0 -2
  545. package/dist/q2-tecton-elements/p-1c88d057.entry.js.map +0 -1
  546. package/dist/q2-tecton-elements/p-20a3d6ed.entry.js +0 -2
  547. package/dist/q2-tecton-elements/p-20a3d6ed.entry.js.map +0 -1
  548. package/dist/q2-tecton-elements/p-2733583e.entry.js +0 -2
  549. package/dist/q2-tecton-elements/p-2733583e.entry.js.map +0 -1
  550. package/dist/q2-tecton-elements/p-2941aafa.js +0 -39
  551. package/dist/q2-tecton-elements/p-3e428290.entry.js +0 -2
  552. package/dist/q2-tecton-elements/p-3e428290.entry.js.map +0 -1
  553. package/dist/q2-tecton-elements/p-4774e5b3.entry.js +0 -2
  554. package/dist/q2-tecton-elements/p-4774e5b3.entry.js.map +0 -1
  555. package/dist/q2-tecton-elements/p-490ef8e5.entry.js +0 -2
  556. package/dist/q2-tecton-elements/p-490ef8e5.entry.js.map +0 -1
  557. package/dist/q2-tecton-elements/p-4e10550d.entry.js +0 -2
  558. package/dist/q2-tecton-elements/p-4e10550d.entry.js.map +0 -1
  559. package/dist/q2-tecton-elements/p-50b425de.js +0 -2
  560. package/dist/q2-tecton-elements/p-50f7328f.entry.js +0 -2
  561. package/dist/q2-tecton-elements/p-50f7328f.entry.js.map +0 -1
  562. package/dist/q2-tecton-elements/p-5637c486.entry.js +0 -2
  563. package/dist/q2-tecton-elements/p-56df21b0.entry.js +0 -2
  564. package/dist/q2-tecton-elements/p-56df21b0.entry.js.map +0 -1
  565. package/dist/q2-tecton-elements/p-5a834214.entry.js +0 -2
  566. package/dist/q2-tecton-elements/p-5a834214.entry.js.map +0 -1
  567. package/dist/q2-tecton-elements/p-5f99a4a8.entry.js +0 -2
  568. package/dist/q2-tecton-elements/p-5f99a4a8.entry.js.map +0 -1
  569. package/dist/q2-tecton-elements/p-72d948b4.entry.js +0 -2
  570. package/dist/q2-tecton-elements/p-72d948b4.entry.js.map +0 -1
  571. package/dist/q2-tecton-elements/p-7903cd15.entry.js +0 -2
  572. package/dist/q2-tecton-elements/p-7906f49e.entry.js +0 -2
  573. package/dist/q2-tecton-elements/p-7aef0c08.entry.js +0 -2
  574. package/dist/q2-tecton-elements/p-7c9a0122.entry.js +0 -2
  575. package/dist/q2-tecton-elements/p-7c9f8b62.entry.js +0 -2
  576. package/dist/q2-tecton-elements/p-81fbe718.entry.js +0 -2
  577. package/dist/q2-tecton-elements/p-81fbe718.entry.js.map +0 -1
  578. package/dist/q2-tecton-elements/p-896c7008.entry.js +0 -2
  579. package/dist/q2-tecton-elements/p-8d07cf91.entry.js +0 -2
  580. package/dist/q2-tecton-elements/p-8d2b02e1.entry.js +0 -2
  581. package/dist/q2-tecton-elements/p-95a7c042.entry.js +0 -2
  582. package/dist/q2-tecton-elements/p-96b1406c.entry.js +0 -2
  583. package/dist/q2-tecton-elements/p-a068c84c.entry.js +0 -2
  584. package/dist/q2-tecton-elements/p-a47597dd.entry.js +0 -2
  585. package/dist/q2-tecton-elements/p-a47597dd.entry.js.map +0 -1
  586. package/dist/q2-tecton-elements/p-a5d0e252.entry.js +0 -2
  587. package/dist/q2-tecton-elements/p-a5f18e27.js +0 -3
  588. package/dist/q2-tecton-elements/p-a5f18e27.js.map +0 -1
  589. package/dist/q2-tecton-elements/p-ac6aa392.entry.js +0 -2
  590. package/dist/q2-tecton-elements/p-ac6aa392.entry.js.map +0 -1
  591. package/dist/q2-tecton-elements/p-ad057d10.entry.js +0 -2
  592. package/dist/q2-tecton-elements/p-ad057d10.entry.js.map +0 -1
  593. package/dist/q2-tecton-elements/p-ad80aef0.js +0 -2
  594. package/dist/q2-tecton-elements/p-b0e5e9dc.entry.js +0 -2
  595. package/dist/q2-tecton-elements/p-b0e5e9dc.entry.js.map +0 -1
  596. package/dist/q2-tecton-elements/p-b1784be3.entry.js +0 -2
  597. package/dist/q2-tecton-elements/p-b1784be3.entry.js.map +0 -1
  598. package/dist/q2-tecton-elements/p-b7554a79.js +0 -2
  599. package/dist/q2-tecton-elements/p-b7de110e.entry.js +0 -2
  600. package/dist/q2-tecton-elements/p-c235ab3f.entry.js +0 -2
  601. package/dist/q2-tecton-elements/p-c5667d5d.entry.js +0 -2
  602. package/dist/q2-tecton-elements/p-e1255160.js +0 -2
  603. package/dist/q2-tecton-elements/p-e216ef3f.entry.js +0 -2
  604. package/dist/q2-tecton-elements/p-e2c800ef.entry.js +0 -2
  605. package/dist/q2-tecton-elements/p-eea5aa01.js +0 -2
  606. package/dist/q2-tecton-elements/p-f135b265.entry.js +0 -2
  607. package/dist/q2-tecton-elements/p-f1e887f5.js +0 -2
  608. package/dist/q2-tecton-elements/p-f5f23659.entry.js +0 -2
  609. package/dist/q2-tecton-elements/p-f7867f21.entry.js +0 -2
  610. package/dist/q2-tecton-elements/p-f7867f21.entry.js.map +0 -1
  611. package/dist/q2-tecton-elements/p-ff8f1a32.entry.js +0 -2
  612. package/dist/q2-tecton-elements/p-fff01dc1.entry.js +0 -2
  613. package/dist/q2-tecton-elements/p-fff01dc1.entry.js.map +0 -1
@@ -0,0 +1,4537 @@
1
+ import { r as t, c as e, h as i, g as r } from "./index-7a5365e2.js";
2
+
3
+ import { o as a, i as n, l as o, d as s } from "./index-d18e2a20.js";
4
+
5
+ import { br as l, W as c, _ as h, ay as u, bs as v, bt as d, b5 as f, bu as p, D as g, bv as b, x as m, a0 as w, I as y, bw as x, aM as S, bx as T, by as M, j as L, bz as C, E as I, bA as A, bB as P, bC as k, bD as V, d as D, bE as z, bF as O, bG as N, bH as R, bI as B, bJ as H, bK as W, bL as U, a as F, bM as j, bN as $, bO as X, bP as G, bQ as Y, bj as E, aK as _, bR as K, a$ as q, bS as J, bT as Z, bU as Q, a9 as tt, b0 as et, bV as it, aA as rt, bW as at, a4 as nt, m as ot, a6 as st, o as lt, y as ct, bX as ht, bY as ut, b as vt, bZ as dt, b2 as ft, b_ as pt, b$ as gt, c0 as bt, c as mt, ai as wt, G as yt, aB as xt, b6 as St, aC as Tt, c1 as Mt, b1 as Lt, u as Ct, c2 as It, aw as At, a3 as Pt, R as kt, bm as Vt, i as Dt, s as zt, z as Ot, t as Nt, g as Rt, be as Bt, c3 as Ht, V as Wt, b8 as Ut, C as Ft, ak as jt, am as $t, c4 as Xt, c5 as Gt, c6 as Yt, S as Et, c7 as _t, ab as Kt, aa as qt, ac as Jt, ad as Zt } from "./charting-1abfb877.js";
6
+
7
+ import { l as Qt, a as te, g as ee, s as ie, b as re, i as ae } from "./sectorHelper-183cedd0.js";
8
+
9
+ function makeBackground(t, e) {
10
+ var i = l(e.get("padding"));
11
+ var r = e.getItemStyle([ "color", "opacity" ]);
12
+ r.fill = e.get("backgroundColor");
13
+ t = new c({
14
+ shape: {
15
+ x: t.x - i[3],
16
+ y: t.y - i[0],
17
+ width: t.width + i[1] + i[3],
18
+ height: t.height + i[0] + i[2],
19
+ r: e.get("borderRadius")
20
+ },
21
+ style: r,
22
+ silent: true,
23
+ z2: -1
24
+ });
25
+ // FIXME
26
+ // `subPixelOptimizeRect` may bring some gap between edge of viewpart
27
+ // and background rect when setting like `left: 0`, `top: 0`.
28
+ // graphic.subPixelOptimizeRect(rect);
29
+ return t;
30
+ }
31
+
32
+ var ne = /** @class */ function(t) {
33
+ h(TooltipModel, t);
34
+ function TooltipModel() {
35
+ var e = t !== null && t.apply(this, arguments) || this;
36
+ e.type = TooltipModel.type;
37
+ return e;
38
+ }
39
+ TooltipModel.type = "tooltip";
40
+ TooltipModel.dependencies = [ "axisPointer" ];
41
+ TooltipModel.defaultOption = {
42
+ // zlevel: 0,
43
+ z: 60,
44
+ show: true,
45
+ // tooltip main content
46
+ showContent: true,
47
+ // 'trigger' only works on coordinate system.
48
+ // 'item' | 'axis' | 'none'
49
+ trigger: "item",
50
+ // 'click' | 'mousemove' | 'none'
51
+ triggerOn: "mousemove|click",
52
+ alwaysShowContent: false,
53
+ displayMode: "single",
54
+ renderMode: "auto",
55
+ // whether restraint content inside viewRect.
56
+ // If renderMode: 'richText', default true.
57
+ // If renderMode: 'html', defaut false (for backward compat).
58
+ confine: null,
59
+ showDelay: 0,
60
+ hideDelay: 100,
61
+ // Animation transition time, unit is second
62
+ transitionDuration: .4,
63
+ enterable: false,
64
+ backgroundColor: "#fff",
65
+ // box shadow
66
+ shadowBlur: 10,
67
+ shadowColor: "rgba(0, 0, 0, .2)",
68
+ shadowOffsetX: 1,
69
+ shadowOffsetY: 2,
70
+ // tooltip border radius, unit is px, default is 4
71
+ borderRadius: 4,
72
+ // tooltip border width, unit is px, default is 0 (no border)
73
+ borderWidth: 1,
74
+ // Tooltip inside padding, default is 5 for all direction
75
+ // Array is allowed to set up, right, bottom, left, same with css
76
+ // The default value: See `tooltip/tooltipMarkup.ts#getPaddingFromTooltipModel`.
77
+ padding: null,
78
+ // Extra css text
79
+ extraCssText: "",
80
+ // axis indicator, trigger by axis
81
+ axisPointer: {
82
+ // default is line
83
+ // legal values: 'line' | 'shadow' | 'cross'
84
+ type: "line",
85
+ // Valid when type is line, appoint tooltip line locate on which line. Optional
86
+ // legal values: 'x' | 'y' | 'angle' | 'radius' | 'auto'
87
+ // default is 'auto', chose the axis which type is category.
88
+ // for multiply y axis, cartesian coord chose x axis, polar chose angle axis
89
+ axis: "auto",
90
+ animation: "auto",
91
+ animationDurationUpdate: 200,
92
+ animationEasingUpdate: "exponentialOut",
93
+ crossStyle: {
94
+ color: "#999",
95
+ width: 1,
96
+ type: "dashed",
97
+ // TODO formatter
98
+ textStyle: {}
99
+ }
100
+ },
101
+ textStyle: {
102
+ color: "#666",
103
+ fontSize: 14
104
+ }
105
+ };
106
+ return TooltipModel;
107
+ }(u);
108
+
109
+ const oe = ne;
110
+
111
+ /* global document */ function shouldTooltipConfine(t) {
112
+ var e = t.get("confine");
113
+ return e != null ? !!e : t.get("renderMode") === "richText";
114
+ }
115
+
116
+ function testStyle(t) {
117
+ if (!d.domSupported) {
118
+ return;
119
+ }
120
+ var e = document.documentElement.style;
121
+ for (var i = 0, r = t.length; i < r; i++) {
122
+ if (t[i] in e) {
123
+ return t[i];
124
+ }
125
+ }
126
+ }
127
+
128
+ var se = testStyle([ "transform", "webkitTransform", "OTransform", "MozTransform", "msTransform" ]);
129
+
130
+ var le = testStyle([ "webkitTransition", "transition", "OTransition", "MozTransition", "msTransition" ]);
131
+
132
+ function toCSSVendorPrefix(t, e) {
133
+ if (!t) {
134
+ return e;
135
+ }
136
+ e = v(e, true);
137
+ var i = t.indexOf(e);
138
+ t = i === -1 ? e : "-" + t.slice(0, i) + "-" + e;
139
+ return t.toLowerCase();
140
+ }
141
+
142
+ function getComputedStyle$1(t, e) {
143
+ var i = t.currentStyle || document.defaultView && document.defaultView.getComputedStyle(t);
144
+ return i ? e ? i[e] : i : null;
145
+ }
146
+
147
+ /* global document, window */ var ce = toCSSVendorPrefix(le, "transition");
148
+
149
+ var he = toCSSVendorPrefix(se, "transform");
150
+
151
+ // eslint-disable-next-line
152
+ var ue = "position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;" + (d.transform3dSupported ? "will-change:transform;" : "");
153
+
154
+ function mirrorPos(t) {
155
+ t = t === "left" ? "right" : t === "right" ? "left" : t === "top" ? "bottom" : "top";
156
+ return t;
157
+ }
158
+
159
+ function assembleArrow(t, e, i) {
160
+ if (!f(i) || i === "inside") {
161
+ return "";
162
+ }
163
+ var r = t.get("backgroundColor");
164
+ var a = t.get("borderWidth");
165
+ e = m(e);
166
+ var n = mirrorPos(i);
167
+ var o = Math.max(Math.round(a) * 1.5, 6);
168
+ var s = "";
169
+ var l = he + ":";
170
+ var c;
171
+ if (S([ "left", "right" ], n) > -1) {
172
+ s += "top:50%";
173
+ l += "translateY(-50%) rotate(" + (c = n === "left" ? -225 : -45) + "deg)";
174
+ } else {
175
+ s += "left:50%";
176
+ l += "translateX(-50%) rotate(" + (c = n === "top" ? 225 : 45) + "deg)";
177
+ }
178
+ var h = c * Math.PI / 180;
179
+ var u = o + a;
180
+ var v = u * Math.abs(Math.cos(h)) + u * Math.abs(Math.sin(h));
181
+ var d = Math.round(((v - Math.SQRT2 * a) / 2 + Math.SQRT2 * a - (v - u) / 2) * 100) / 100;
182
+ s += ";" + n + ":-" + d + "px";
183
+ var p = e + " solid " + a + "px;";
184
+ var g = [ "position:absolute;width:" + o + "px;height:" + o + "px;z-index:-1;", s + ";" + l + ";", "border-bottom:" + p, "border-right:" + p, "background-color:" + r + ";" ];
185
+ return '<div style="' + g.join("") + '"></div>';
186
+ }
187
+
188
+ function assembleTransition(t, e) {
189
+ var i = "cubic-bezier(0.23,1,0.32,1)";
190
+ var r = " " + t / 2 + "s " + i;
191
+ var a = "opacity" + r + ",visibility" + r;
192
+ if (!e) {
193
+ r = " " + t + "s " + i;
194
+ a += d.transformSupported ? "," + he + r : ",left" + r + ",top" + r;
195
+ }
196
+ return ce + ":" + a;
197
+ }
198
+
199
+ function assembleTransform(t, e, i) {
200
+ // If using float on style, the final width of the dom might
201
+ // keep changing slightly while mouse move. So `toFixed(0)` them.
202
+ var r = t.toFixed(0) + "px";
203
+ var a = e.toFixed(0) + "px";
204
+ // not support transform, use `left` and `top` instead.
205
+ if (!d.transformSupported) {
206
+ return i ? "top:" + a + ";left:" + r + ";" : [ [ "top", a ], [ "left", r ] ];
207
+ }
208
+ // support transform
209
+ var n = d.transform3dSupported;
210
+ var o = "translate" + (n ? "3d" : "") + "(" + r + "," + a + (n ? ",0" : "") + ")";
211
+ return i ? "top:0;left:0;" + he + ":" + o + ";" : [ [ "top", 0 ], [ "left", 0 ], [ se, o ] ];
212
+ }
213
+
214
+ /**
215
+ * @param {Object} textStyle
216
+ * @return {string}
217
+ * @inner
218
+ */ function assembleFont(t) {
219
+ var e = [];
220
+ var i = t.get("fontSize");
221
+ var r = t.getTextColor();
222
+ r && e.push("color:" + r);
223
+ e.push("font:" + t.getFont());
224
+ i && e.push("line-height:" + Math.round(i * 3 / 2) + "px");
225
+ var a = t.get("textShadowColor");
226
+ var n = t.get("textShadowBlur") || 0;
227
+ var o = t.get("textShadowOffsetX") || 0;
228
+ var s = t.get("textShadowOffsetY") || 0;
229
+ a && n && e.push("text-shadow:" + o + "px " + s + "px " + n + "px " + a);
230
+ y([ "decoration", "align" ], (function(i) {
231
+ var r = t.get(i);
232
+ r && e.push("text-" + i + ":" + r);
233
+ }));
234
+ return e.join(";");
235
+ }
236
+
237
+ function assembleCssText(t, e, i) {
238
+ var r = [];
239
+ var a = t.get("transitionDuration");
240
+ var n = t.get("backgroundColor");
241
+ var o = t.get("shadowBlur");
242
+ var s = t.get("shadowColor");
243
+ var c = t.get("shadowOffsetX");
244
+ var h = t.get("shadowOffsetY");
245
+ var u = t.getModel("textStyle");
246
+ var d = T(t, "html");
247
+ var f = c + "px " + h + "px " + o + "px " + s;
248
+ r.push("box-shadow:" + f);
249
+ // Animation transition. Do not animate when transitionDuration is 0.
250
+ e && a && r.push(assembleTransition(a, i));
251
+ if (n) {
252
+ r.push("background-color:" + n);
253
+ }
254
+ // Border style
255
+ y([ "width", "color", "radius" ], (function(e) {
256
+ var i = "border-" + e;
257
+ var a = v(i);
258
+ var n = t.get(a);
259
+ n != null && r.push(i + ":" + n + (e === "color" ? "" : "px"));
260
+ }));
261
+ // Text style
262
+ r.push(assembleFont(u));
263
+ // Padding
264
+ if (d != null) {
265
+ r.push("padding:" + l(d).join("px ") + "px");
266
+ }
267
+ return r.join(";") + ";";
268
+ }
269
+
270
+ // If not able to make, do not modify the input `out`.
271
+ function makeStyleCoord$1(t, e, i, r, a) {
272
+ var n = e && e.painter;
273
+ if (i) {
274
+ var o = n && n.getViewportRoot();
275
+ if (o) {
276
+ // Some APPs might use scale on body, so we support CSS transform here.
277
+ M(t, o, i, r, a);
278
+ }
279
+ } else {
280
+ t[0] = r;
281
+ t[1] = a;
282
+ // xy should be based on canvas root. But tooltipContent is
283
+ // the sibling of canvas root. So padding of ec container
284
+ // should be considered here.
285
+ var s = n && n.getViewportRootOffset();
286
+ if (s) {
287
+ t[0] += s.offsetLeft;
288
+ t[1] += s.offsetTop;
289
+ }
290
+ }
291
+ t[2] = t[0] / e.getWidth();
292
+ t[3] = t[1] / e.getHeight();
293
+ }
294
+
295
+ var ve = /** @class */ function() {
296
+ function TooltipHTMLContent(t, e) {
297
+ this._show = false;
298
+ this._styleCoord = [ 0, 0, 0, 0 ];
299
+ this._enterable = true;
300
+ this._alwaysShowContent = false;
301
+ this._firstShow = true;
302
+ this._longHide = true;
303
+ if (d.wxa) {
304
+ return null;
305
+ }
306
+ var i = document.createElement("div");
307
+ // TODO: TYPE
308
+ i.domBelongToZr = true;
309
+ this.el = i;
310
+ var r = this._zr = t.getZr();
311
+ var a = e.appendTo;
312
+ var n = a && (f(a) ? document.querySelector(a) : p(a) ? a : g(a) && a(t.getDom()));
313
+ makeStyleCoord$1(this._styleCoord, r, n, t.getWidth() / 2, t.getHeight() / 2);
314
+ (n || t.getDom()).appendChild(i);
315
+ this._api = t;
316
+ this._container = n;
317
+ // FIXME
318
+ // Is it needed to trigger zr event manually if
319
+ // the browser do not support `pointer-events: none`.
320
+ var o = this;
321
+ i.onmouseenter = function() {
322
+ // clear the timeout in hideLater and keep showing tooltip
323
+ if (o._enterable) {
324
+ clearTimeout(o._hideTimeout);
325
+ o._show = true;
326
+ }
327
+ o._inContent = true;
328
+ };
329
+ i.onmousemove = function(t) {
330
+ t = t || window.event;
331
+ if (!o._enterable) {
332
+ // `pointer-events: none` is set to tooltip content div
333
+ // if `enterable` is set as `false`, and `el.onmousemove`
334
+ // can not be triggered. But in browser that do not
335
+ // support `pointer-events`, we need to do this:
336
+ // Try trigger zrender event to avoid mouse
337
+ // in and out shape too frequently
338
+ var e = r.handler;
339
+ var i = r.painter.getViewportRoot();
340
+ b(i, t, true);
341
+ e.dispatch("mousemove", t);
342
+ }
343
+ };
344
+ i.onmouseleave = function() {
345
+ // set `_inContent` to `false` before `hideLater`
346
+ o._inContent = false;
347
+ if (o._enterable) {
348
+ if (o._show) {
349
+ o.hideLater(o._hideDelay);
350
+ }
351
+ }
352
+ };
353
+ }
354
+ /**
355
+ * Update when tooltip is rendered
356
+ */ TooltipHTMLContent.prototype.update = function(t) {
357
+ // FIXME
358
+ // Move this logic to ec main?
359
+ if (!this._container) {
360
+ var e = this._api.getDom();
361
+ var i = getComputedStyle$1(e, "position");
362
+ var r = e.style;
363
+ if (r.position !== "absolute" && i !== "absolute") {
364
+ r.position = "relative";
365
+ }
366
+ }
367
+ // move tooltip if chart resized
368
+ var a = t.get("alwaysShowContent");
369
+ a && this._moveIfResized();
370
+ // update alwaysShowContent
371
+ this._alwaysShowContent = a;
372
+ // update className
373
+ this.el.className = t.get("className") || "";
374
+ // Hide the tooltip
375
+ // PENDING
376
+ // this.hide();
377
+ };
378
+ TooltipHTMLContent.prototype.show = function(t, e) {
379
+ clearTimeout(this._hideTimeout);
380
+ clearTimeout(this._longHideTimeout);
381
+ var i = this.el;
382
+ var r = i.style;
383
+ var a = this._styleCoord;
384
+ if (!i.innerHTML) {
385
+ r.display = "none";
386
+ } else {
387
+ r.cssText = ue + assembleCssText(t, !this._firstShow, this._longHide) + assembleTransform(a[0], a[1], true) + ("border-color:" + m(e) + ";") + (t.get("extraCssText") || "") + (";pointer-events:" + (this._enterable ? "auto" : "none"));
388
+ }
389
+ this._show = true;
390
+ this._firstShow = false;
391
+ this._longHide = false;
392
+ };
393
+ TooltipHTMLContent.prototype.setContent = function(t, e, i, r, a) {
394
+ var n = this.el;
395
+ if (t == null) {
396
+ n.innerHTML = "";
397
+ return;
398
+ }
399
+ var o = "";
400
+ if (f(a) && i.get("trigger") === "item" && !shouldTooltipConfine(i)) {
401
+ o = assembleArrow(i, r, a);
402
+ }
403
+ if (f(t)) {
404
+ n.innerHTML = t + o;
405
+ } else if (t) {
406
+ // Clear previous
407
+ n.innerHTML = "";
408
+ if (!w(t)) {
409
+ t = [ t ];
410
+ }
411
+ for (var s = 0; s < t.length; s++) {
412
+ if (p(t[s]) && t[s].parentNode !== n) {
413
+ n.appendChild(t[s]);
414
+ }
415
+ }
416
+ // no arrow if empty
417
+ if (o && n.childNodes.length) {
418
+ // no need to create a new parent element, but it's not supported by IE 10 and older.
419
+ // const arrowEl = document.createRange().createContextualFragment(arrow);
420
+ var l = document.createElement("div");
421
+ l.innerHTML = o;
422
+ n.appendChild(l);
423
+ }
424
+ }
425
+ };
426
+ TooltipHTMLContent.prototype.setEnterable = function(t) {
427
+ this._enterable = t;
428
+ };
429
+ TooltipHTMLContent.prototype.getSize = function() {
430
+ var t = this.el;
431
+ return [ t.offsetWidth, t.offsetHeight ];
432
+ };
433
+ TooltipHTMLContent.prototype.moveTo = function(t, e) {
434
+ var i = this._styleCoord;
435
+ makeStyleCoord$1(i, this._zr, this._container, t, e);
436
+ if (i[0] != null && i[1] != null) {
437
+ var r = this.el.style;
438
+ var a = assembleTransform(i[0], i[1]);
439
+ y(a, (function(t) {
440
+ r[t[0]] = t[1];
441
+ }));
442
+ }
443
+ };
444
+ /**
445
+ * when `alwaysShowContent` is true,
446
+ * move the tooltip after chart resized
447
+ */ TooltipHTMLContent.prototype._moveIfResized = function() {
448
+ // The ratio of left to width
449
+ var t = this._styleCoord[2];
450
+ // The ratio of top to height
451
+ var e = this._styleCoord[3];
452
+ this.moveTo(t * this._zr.getWidth(), e * this._zr.getHeight());
453
+ };
454
+ TooltipHTMLContent.prototype.hide = function() {
455
+ var t = this;
456
+ var e = this.el.style;
457
+ e.visibility = "hidden";
458
+ e.opacity = "0";
459
+ d.transform3dSupported && (e.willChange = "");
460
+ this._show = false;
461
+ this._longHideTimeout = setTimeout((function() {
462
+ return t._longHide = true;
463
+ }), 500);
464
+ };
465
+ TooltipHTMLContent.prototype.hideLater = function(t) {
466
+ if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {
467
+ if (t) {
468
+ this._hideDelay = t;
469
+ // Set show false to avoid invoke hideLater multiple times
470
+ this._show = false;
471
+ this._hideTimeout = setTimeout(x(this.hide, this), t);
472
+ } else {
473
+ this.hide();
474
+ }
475
+ }
476
+ };
477
+ TooltipHTMLContent.prototype.isShow = function() {
478
+ return this._show;
479
+ };
480
+ TooltipHTMLContent.prototype.dispose = function() {
481
+ clearTimeout(this._hideTimeout);
482
+ clearTimeout(this._longHideTimeout);
483
+ var t = this.el.parentNode;
484
+ t && t.removeChild(this.el);
485
+ this.el = this._container = null;
486
+ };
487
+ return TooltipHTMLContent;
488
+ }();
489
+
490
+ const de = ve;
491
+
492
+ var fe = /** @class */ function() {
493
+ function TooltipRichContent(t) {
494
+ this._show = false;
495
+ this._styleCoord = [ 0, 0, 0, 0 ];
496
+ this._alwaysShowContent = false;
497
+ this._enterable = true;
498
+ this._zr = t.getZr();
499
+ makeStyleCoord(this._styleCoord, this._zr, t.getWidth() / 2, t.getHeight() / 2);
500
+ }
501
+ /**
502
+ * Update when tooltip is rendered
503
+ */ TooltipRichContent.prototype.update = function(t) {
504
+ var e = t.get("alwaysShowContent");
505
+ e && this._moveIfResized();
506
+ // update alwaysShowContent
507
+ this._alwaysShowContent = e;
508
+ };
509
+ TooltipRichContent.prototype.show = function() {
510
+ if (this._hideTimeout) {
511
+ clearTimeout(this._hideTimeout);
512
+ }
513
+ this.el.show();
514
+ this._show = true;
515
+ };
516
+ /**
517
+ * Set tooltip content
518
+ */ TooltipRichContent.prototype.setContent = function(t, e, i, r, a) {
519
+ var n = this;
520
+ if (L(t)) {
521
+ C("");
522
+ }
523
+ if (this.el) {
524
+ this._zr.remove(this.el);
525
+ }
526
+ var o = i.getModel("textStyle");
527
+ this.el = new I({
528
+ style: {
529
+ rich: e.richTextStyles,
530
+ text: t,
531
+ lineHeight: 22,
532
+ borderWidth: 1,
533
+ borderColor: r,
534
+ textShadowColor: o.get("textShadowColor"),
535
+ fill: i.get([ "textStyle", "color" ]),
536
+ padding: T(i, "richText"),
537
+ verticalAlign: "top",
538
+ align: "left"
539
+ },
540
+ z: i.get("z")
541
+ });
542
+ y([ "backgroundColor", "borderRadius", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY" ], (function(t) {
543
+ n.el.style[t] = i.get(t);
544
+ }));
545
+ y([ "textShadowBlur", "textShadowOffsetX", "textShadowOffsetY" ], (function(t) {
546
+ n.el.style[t] = o.get(t) || 0;
547
+ }));
548
+ this._zr.add(this.el);
549
+ var s = this;
550
+ this.el.on("mouseover", (function() {
551
+ // clear the timeout in hideLater and keep showing tooltip
552
+ if (s._enterable) {
553
+ clearTimeout(s._hideTimeout);
554
+ s._show = true;
555
+ }
556
+ s._inContent = true;
557
+ }));
558
+ this.el.on("mouseout", (function() {
559
+ if (s._enterable) {
560
+ if (s._show) {
561
+ s.hideLater(s._hideDelay);
562
+ }
563
+ }
564
+ s._inContent = false;
565
+ }));
566
+ };
567
+ TooltipRichContent.prototype.setEnterable = function(t) {
568
+ this._enterable = t;
569
+ };
570
+ TooltipRichContent.prototype.getSize = function() {
571
+ var t = this.el;
572
+ var e = this.el.getBoundingRect();
573
+ // bounding rect does not include shadow. For renderMode richText,
574
+ // if overflow, it will be cut. So calculate them accurately.
575
+ var i = calcShadowOuterSize(t.style);
576
+ return [ e.width + i.left + i.right, e.height + i.top + i.bottom ];
577
+ };
578
+ TooltipRichContent.prototype.moveTo = function(t, e) {
579
+ var i = this.el;
580
+ if (i) {
581
+ var r = this._styleCoord;
582
+ makeStyleCoord(r, this._zr, t, e);
583
+ t = r[0];
584
+ e = r[1];
585
+ var a = i.style;
586
+ var n = mathMaxWith0(a.borderWidth || 0);
587
+ var o = calcShadowOuterSize(a);
588
+ // rich text x, y do not include border.
589
+ i.x = t + n + o.left;
590
+ i.y = e + n + o.top;
591
+ i.markRedraw();
592
+ }
593
+ };
594
+ /**
595
+ * when `alwaysShowContent` is true,
596
+ * move the tooltip after chart resized
597
+ */ TooltipRichContent.prototype._moveIfResized = function() {
598
+ // The ratio of left to width
599
+ var t = this._styleCoord[2];
600
+ // The ratio of top to height
601
+ var e = this._styleCoord[3];
602
+ this.moveTo(t * this._zr.getWidth(), e * this._zr.getHeight());
603
+ };
604
+ TooltipRichContent.prototype.hide = function() {
605
+ if (this.el) {
606
+ this.el.hide();
607
+ }
608
+ this._show = false;
609
+ };
610
+ TooltipRichContent.prototype.hideLater = function(t) {
611
+ if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {
612
+ if (t) {
613
+ this._hideDelay = t;
614
+ // Set show false to avoid invoke hideLater multiple times
615
+ this._show = false;
616
+ this._hideTimeout = setTimeout(x(this.hide, this), t);
617
+ } else {
618
+ this.hide();
619
+ }
620
+ }
621
+ };
622
+ TooltipRichContent.prototype.isShow = function() {
623
+ return this._show;
624
+ };
625
+ TooltipRichContent.prototype.dispose = function() {
626
+ this._zr.remove(this.el);
627
+ };
628
+ return TooltipRichContent;
629
+ }();
630
+
631
+ function mathMaxWith0(t) {
632
+ return Math.max(0, t);
633
+ }
634
+
635
+ function calcShadowOuterSize(t) {
636
+ var e = mathMaxWith0(t.shadowBlur || 0);
637
+ var i = mathMaxWith0(t.shadowOffsetX || 0);
638
+ var r = mathMaxWith0(t.shadowOffsetY || 0);
639
+ return {
640
+ left: mathMaxWith0(e - i),
641
+ right: mathMaxWith0(e + i),
642
+ top: mathMaxWith0(e - r),
643
+ bottom: mathMaxWith0(e + r)
644
+ };
645
+ }
646
+
647
+ function makeStyleCoord(t, e, i, r) {
648
+ t[0] = i;
649
+ t[1] = r;
650
+ t[2] = t[0] / e.getWidth();
651
+ t[3] = t[1] / e.getHeight();
652
+ }
653
+
654
+ const pe = fe;
655
+
656
+ var ge = new c({
657
+ shape: {
658
+ x: -1,
659
+ y: -1,
660
+ width: 2,
661
+ height: 2
662
+ }
663
+ });
664
+
665
+ var be = /** @class */ function(t) {
666
+ h(TooltipView, t);
667
+ function TooltipView() {
668
+ var e = t !== null && t.apply(this, arguments) || this;
669
+ e.type = TooltipView.type;
670
+ return e;
671
+ }
672
+ TooltipView.prototype.init = function(t, e) {
673
+ if (d.node || !e.getDom()) {
674
+ return;
675
+ }
676
+ var i = t.getComponent("tooltip");
677
+ var r = this._renderMode = A(i.get("renderMode"));
678
+ this._tooltipContent = r === "richText" ? new pe(e) : new de(e, {
679
+ appendTo: i.get("appendToBody", true) ? "body" : i.get("appendTo", true)
680
+ });
681
+ };
682
+ TooltipView.prototype.render = function(t, e, i) {
683
+ if (d.node || !i.getDom()) {
684
+ return;
685
+ }
686
+ // Reset
687
+ this.group.removeAll();
688
+ this._tooltipModel = t;
689
+ this._ecModel = e;
690
+ this._api = i;
691
+ var r = this._tooltipContent;
692
+ r.update(t);
693
+ r.setEnterable(t.get("enterable"));
694
+ this._initGlobalListener();
695
+ this._keepShow();
696
+ // PENDING
697
+ // `mousemove` event will be triggered very frequently when the mouse moves fast,
698
+ // which causes that the `updatePosition` function was also called frequently.
699
+ // In Chrome with devtools open and Firefox, tooltip looks laggy and shakes. See #14695 #16101
700
+ // To avoid frequent triggering,
701
+ // consider throttling it in 50ms when transition is enabled
702
+ if (this._renderMode !== "richText" && t.get("transitionDuration")) {
703
+ P(this, "_updatePosition", 50, "fixRate");
704
+ } else {
705
+ k(this, "_updatePosition");
706
+ }
707
+ };
708
+ TooltipView.prototype._initGlobalListener = function() {
709
+ var t = this._tooltipModel;
710
+ var e = t.get("triggerOn");
711
+ V("itemTooltip", this._api, x((function(t, i, r) {
712
+ // If 'none', it is not controlled by mouse totally.
713
+ if (e !== "none") {
714
+ if (e.indexOf(t) >= 0) {
715
+ this._tryShow(i, r);
716
+ } else if (t === "leave") {
717
+ this._hide(r);
718
+ }
719
+ }
720
+ }), this));
721
+ };
722
+ TooltipView.prototype._keepShow = function() {
723
+ var t = this._tooltipModel;
724
+ var e = this._ecModel;
725
+ var i = this._api;
726
+ var r = t.get("triggerOn");
727
+ // Try to keep the tooltip show when refreshing
728
+ if (this._lastX != null && this._lastY != null && r !== "none" && r !== "click") {
729
+ var a = this;
730
+ clearTimeout(this._refreshUpdateTimeout);
731
+ this._refreshUpdateTimeout = setTimeout((function() {
732
+ // Show tip next tick after other charts are rendered
733
+ // In case highlight action has wrong result
734
+ // FIXME
735
+ !i.isDisposed() && a.manuallyShowTip(t, e, i, {
736
+ x: a._lastX,
737
+ y: a._lastY,
738
+ dataByCoordSys: a._lastDataByCoordSys
739
+ });
740
+ }));
741
+ }
742
+ };
743
+ /**
744
+ * Show tip manually by
745
+ * dispatchAction({
746
+ * type: 'showTip',
747
+ * x: 10,
748
+ * y: 10
749
+ * });
750
+ * Or
751
+ * dispatchAction({
752
+ * type: 'showTip',
753
+ * seriesIndex: 0,
754
+ * dataIndex or dataIndexInside or name
755
+ * });
756
+ *
757
+ * TODO Batch
758
+ */ TooltipView.prototype.manuallyShowTip = function(t, e, i, r) {
759
+ if (r.from === this.uid || d.node || !i.getDom()) {
760
+ return;
761
+ }
762
+ var a = makeDispatchAction(r, i);
763
+ // Reset ticket
764
+ this._ticket = "";
765
+ // When triggered from axisPointer.
766
+ var n = r.dataByCoordSys;
767
+ var o = findComponentReference(r, e, i);
768
+ if (o) {
769
+ var s = o.el.getBoundingRect().clone();
770
+ s.applyTransform(o.el.transform);
771
+ this._tryShow({
772
+ offsetX: s.x + s.width / 2,
773
+ offsetY: s.y + s.height / 2,
774
+ target: o.el,
775
+ position: r.position,
776
+ // When manully trigger, the mouse is not on the el, so we'd better to
777
+ // position tooltip on the bottom of the el and display arrow is possible.
778
+ positionDefault: "bottom"
779
+ }, a);
780
+ } else if (r.tooltip && r.x != null && r.y != null) {
781
+ var l = ge;
782
+ l.x = r.x;
783
+ l.y = r.y;
784
+ l.update();
785
+ D(l).tooltipConfig = {
786
+ name: null,
787
+ option: r.tooltip
788
+ };
789
+ // Manually show tooltip while view is not using zrender elements.
790
+ this._tryShow({
791
+ offsetX: r.x,
792
+ offsetY: r.y,
793
+ target: l
794
+ }, a);
795
+ } else if (n) {
796
+ this._tryShow({
797
+ offsetX: r.x,
798
+ offsetY: r.y,
799
+ position: r.position,
800
+ dataByCoordSys: n,
801
+ tooltipOption: r.tooltipOption
802
+ }, a);
803
+ } else if (r.seriesIndex != null) {
804
+ if (this._manuallyAxisShowTip(t, e, i, r)) {
805
+ return;
806
+ }
807
+ var c = z(r, e);
808
+ var h = c.point[0];
809
+ var u = c.point[1];
810
+ if (h != null && u != null) {
811
+ this._tryShow({
812
+ offsetX: h,
813
+ offsetY: u,
814
+ target: c.el,
815
+ position: r.position,
816
+ // When manully trigger, the mouse is not on the el, so we'd better to
817
+ // position tooltip on the bottom of the el and display arrow is possible.
818
+ positionDefault: "bottom"
819
+ }, a);
820
+ }
821
+ } else if (r.x != null && r.y != null) {
822
+ // FIXME
823
+ // should wrap dispatchAction like `axisPointer/globalListener` ?
824
+ i.dispatchAction({
825
+ type: "updateAxisPointer",
826
+ x: r.x,
827
+ y: r.y
828
+ });
829
+ this._tryShow({
830
+ offsetX: r.x,
831
+ offsetY: r.y,
832
+ position: r.position,
833
+ target: i.getZr().findHover(r.x, r.y).target
834
+ }, a);
835
+ }
836
+ };
837
+ TooltipView.prototype.manuallyHideTip = function(t, e, i, r) {
838
+ var a = this._tooltipContent;
839
+ if (this._tooltipModel) {
840
+ a.hideLater(this._tooltipModel.get("hideDelay"));
841
+ }
842
+ this._lastX = this._lastY = this._lastDataByCoordSys = null;
843
+ if (r.from !== this.uid) {
844
+ this._hide(makeDispatchAction(r, i));
845
+ }
846
+ };
847
+ // Be compatible with previous design, that is, when tooltip.type is 'axis' and
848
+ // dispatchAction 'showTip' with seriesIndex and dataIndex will trigger axis pointer
849
+ // and tooltip.
850
+ TooltipView.prototype._manuallyAxisShowTip = function(t, e, i, r) {
851
+ var a = r.seriesIndex;
852
+ var n = r.dataIndex;
853
+ // @ts-ignore
854
+ var o = e.getComponent("axisPointer").coordSysAxesInfo;
855
+ if (a == null || n == null || o == null) {
856
+ return;
857
+ }
858
+ var s = e.getSeriesByIndex(a);
859
+ if (!s) {
860
+ return;
861
+ }
862
+ var l = s.getData();
863
+ var c = buildTooltipModel([ l.getItemModel(n), s, (s.coordinateSystem || {}).model ], this._tooltipModel);
864
+ if (c.get("trigger") !== "axis") {
865
+ return;
866
+ }
867
+ i.dispatchAction({
868
+ type: "updateAxisPointer",
869
+ seriesIndex: a,
870
+ dataIndex: n,
871
+ position: r.position
872
+ });
873
+ return true;
874
+ };
875
+ TooltipView.prototype._tryShow = function(t, e) {
876
+ var i = t.target;
877
+ var r = this._tooltipModel;
878
+ if (!r) {
879
+ return;
880
+ }
881
+ // Save mouse x, mouse y. So we can try to keep showing the tip if chart is refreshed
882
+ this._lastX = t.offsetX;
883
+ this._lastY = t.offsetY;
884
+ var a = t.dataByCoordSys;
885
+ if (a && a.length) {
886
+ this._showAxisTooltip(a, t);
887
+ } else if (i) {
888
+ var n = D(i);
889
+ if (n.ssrType === "legend") {
890
+ // Don't trigger tooltip for legend tooltip item
891
+ return;
892
+ }
893
+ this._lastDataByCoordSys = null;
894
+ var o;
895
+ var s;
896
+ O(i, (function(t) {
897
+ // Always show item tooltip if mouse is on the element with dataIndex
898
+ if (D(t).dataIndex != null) {
899
+ o = t;
900
+ return true;
901
+ }
902
+ // Tooltip provided directly. Like legend.
903
+ if (D(t).tooltipConfig != null) {
904
+ s = t;
905
+ return true;
906
+ }
907
+ }), true);
908
+ if (o) {
909
+ this._showSeriesItemTooltip(t, o, e);
910
+ } else if (s) {
911
+ this._showComponentItemTooltip(t, s, e);
912
+ } else {
913
+ this._hide(e);
914
+ }
915
+ } else {
916
+ this._lastDataByCoordSys = null;
917
+ this._hide(e);
918
+ }
919
+ };
920
+ TooltipView.prototype._showOrMove = function(t, e) {
921
+ // showDelay is used in this case: tooltip.enterable is set
922
+ // as true. User intent to move mouse into tooltip and click
923
+ // something. `showDelay` makes it easier to enter the content
924
+ // but tooltip do not move immediately.
925
+ var i = t.get("showDelay");
926
+ e = x(e, this);
927
+ clearTimeout(this._showTimout);
928
+ i > 0 ? this._showTimout = setTimeout(e, i) : e();
929
+ };
930
+ TooltipView.prototype._showAxisTooltip = function(t, e) {
931
+ var i = this._ecModel;
932
+ var r = this._tooltipModel;
933
+ var a = [ e.offsetX, e.offsetY ];
934
+ var n = buildTooltipModel([ e.tooltipOption ], r);
935
+ var o = this._renderMode;
936
+ var s = [];
937
+ var l = N("section", {
938
+ blocks: [],
939
+ noHeader: true
940
+ });
941
+ // Only for legacy: `Serise['formatTooltip']` returns a string.
942
+ var c = [];
943
+ var h = new R;
944
+ y(t, (function(t) {
945
+ y(t.dataByAxis, (function(t) {
946
+ var e = i.getComponent(t.axisDim + "Axis", t.axisIndex);
947
+ var a = t.value;
948
+ if (!e || a == null) {
949
+ return;
950
+ }
951
+ var n = B(a, e.axis, i, t.seriesDataIndices, t.valueLabelOpt);
952
+ var u = N("section", {
953
+ header: n,
954
+ noHeader: !H(n),
955
+ sortBlocks: true,
956
+ blocks: []
957
+ });
958
+ l.blocks.push(u);
959
+ y(t.seriesDataIndices, (function(l) {
960
+ var v = i.getSeriesByIndex(l.seriesIndex);
961
+ var d = l.dataIndexInside;
962
+ var f = v.getDataParams(d);
963
+ // Can't find data.
964
+ if (f.dataIndex < 0) {
965
+ return;
966
+ }
967
+ f.axisDim = t.axisDim;
968
+ f.axisIndex = t.axisIndex;
969
+ f.axisType = t.axisType;
970
+ f.axisId = t.axisId;
971
+ f.axisValue = W(e.axis, {
972
+ value: a
973
+ });
974
+ f.axisValueLabel = n;
975
+ // Pre-create marker style for makers. Users can assemble richText
976
+ // text in `formatter` callback and use those markers style.
977
+ f.marker = h.makeTooltipMarker("item", m(f.color), o);
978
+ var p = U(v.formatTooltip(d, true, null));
979
+ var g = p.frag;
980
+ if (g) {
981
+ var b = buildTooltipModel([ v ], r).get("valueFormatter");
982
+ u.blocks.push(b ? F({
983
+ valueFormatter: b
984
+ }, g) : g);
985
+ }
986
+ if (p.text) {
987
+ c.push(p.text);
988
+ }
989
+ s.push(f);
990
+ }));
991
+ }));
992
+ }));
993
+ // In most cases, the second axis is displays upper on the first one.
994
+ // So we reverse it to look better.
995
+ l.blocks.reverse();
996
+ c.reverse();
997
+ var u = e.position;
998
+ var v = n.get("order");
999
+ var d = j(l, h, o, v, i.get("useUTC"), n.get("textStyle"));
1000
+ d && c.unshift(d);
1001
+ var f = o === "richText" ? "\n\n" : "<br/>";
1002
+ var p = c.join(f);
1003
+ this._showOrMove(n, (function() {
1004
+ if (this._updateContentNotChangedOnAxis(t, s)) {
1005
+ this._updatePosition(n, u, a[0], a[1], this._tooltipContent, s);
1006
+ } else {
1007
+ this._showTooltipContent(n, p, s, Math.random() + "", a[0], a[1], u, null, h);
1008
+ }
1009
+ }));
1010
+ // Do not trigger events here, because this branch only be entered
1011
+ // from dispatchAction.
1012
+ };
1013
+ TooltipView.prototype._showSeriesItemTooltip = function(t, e, i) {
1014
+ var r = this._ecModel;
1015
+ var a = D(e);
1016
+ // Use dataModel in element if possible
1017
+ // Used when mouseover on a element like markPoint or edge
1018
+ // In which case, the data is not main data in series.
1019
+ var n = a.seriesIndex;
1020
+ var o = r.getSeriesByIndex(n);
1021
+ // For example, graph link.
1022
+ var s = a.dataModel || o;
1023
+ var l = a.dataIndex;
1024
+ var c = a.dataType;
1025
+ var h = s.getData(c);
1026
+ var u = this._renderMode;
1027
+ var v = t.positionDefault;
1028
+ var d = buildTooltipModel([ h.getItemModel(l), s, o && (o.coordinateSystem || {}).model ], this._tooltipModel, v ? {
1029
+ position: v
1030
+ } : null);
1031
+ var f = d.get("trigger");
1032
+ if (f != null && f !== "item") {
1033
+ return;
1034
+ }
1035
+ var p = s.getDataParams(l, c);
1036
+ var g = new R;
1037
+ // Pre-create marker style for makers. Users can assemble richText
1038
+ // text in `formatter` callback and use those markers style.
1039
+ p.marker = g.makeTooltipMarker("item", m(p.color), u);
1040
+ var b = U(s.formatTooltip(l, false, c));
1041
+ var w = d.get("order");
1042
+ var y = d.get("valueFormatter");
1043
+ var x = b.frag;
1044
+ var S = x ? j(y ? F({
1045
+ valueFormatter: y
1046
+ }, x) : x, g, u, w, r.get("useUTC"), d.get("textStyle")) : b.text;
1047
+ var T = "item_" + s.name + "_" + l;
1048
+ this._showOrMove(d, (function() {
1049
+ this._showTooltipContent(d, S, p, T, t.offsetX, t.offsetY, t.position, t.target, g);
1050
+ }));
1051
+ // FIXME
1052
+ // duplicated showtip if manuallyShowTip is called from dispatchAction.
1053
+ i({
1054
+ type: "showTip",
1055
+ dataIndexInside: l,
1056
+ dataIndex: h.getRawIndex(l),
1057
+ seriesIndex: n,
1058
+ from: this.uid
1059
+ });
1060
+ };
1061
+ TooltipView.prototype._showComponentItemTooltip = function(t, e, i) {
1062
+ var r = this._renderMode === "html";
1063
+ var a = D(e);
1064
+ var n = a.tooltipConfig;
1065
+ var o = n.option || {};
1066
+ var s = o.encodeHTMLContent;
1067
+ if (f(o)) {
1068
+ var l = o;
1069
+ o = {
1070
+ content: l,
1071
+ // Fixed formatter
1072
+ formatter: l
1073
+ };
1074
+ // when `tooltipConfig.option` is a string rather than an object,
1075
+ // we can't know if the content needs to be encoded
1076
+ // for the sake of security, encode it by default.
1077
+ s = true;
1078
+ }
1079
+ if (s && r && o.content) {
1080
+ // clone might be unnecessary?
1081
+ o = $(o);
1082
+ o.content = X(o.content);
1083
+ }
1084
+ var c = [ o ];
1085
+ var h = this._ecModel.getComponent(a.componentMainType, a.componentIndex);
1086
+ if (h) {
1087
+ c.push(h);
1088
+ }
1089
+ // In most cases, component tooltip formatter has different params with series tooltip formatter,
1090
+ // so that they cannot share the same formatter. Since the global tooltip formatter is used for series
1091
+ // by convention, we do not use it as the default formatter for component.
1092
+ c.push({
1093
+ formatter: o.content
1094
+ });
1095
+ var u = t.positionDefault;
1096
+ var v = buildTooltipModel(c, this._tooltipModel, u ? {
1097
+ position: u
1098
+ } : null);
1099
+ var d = v.get("content");
1100
+ var p = Math.random() + "";
1101
+ // PENDING: this case do not support richText style yet.
1102
+ var g = new R;
1103
+ // Do not check whether `trigger` is 'none' here, because `trigger`
1104
+ // only works on coordinate system. In fact, we have not found case
1105
+ // that requires setting `trigger` nothing on component yet.
1106
+ this._showOrMove(v, (function() {
1107
+ // Use formatterParams from element defined in component
1108
+ // Avoid users modify it.
1109
+ var i = $(v.get("formatterParams") || {});
1110
+ this._showTooltipContent(v, d, i, p, t.offsetX, t.offsetY, t.position, e, g);
1111
+ }));
1112
+ // If not dispatch showTip, tip may be hide triggered by axis.
1113
+ i({
1114
+ type: "showTip",
1115
+ from: this.uid
1116
+ });
1117
+ };
1118
+ TooltipView.prototype._showTooltipContent = function(
1119
+ // Use Model<TooltipOption> insteadof TooltipModel because this model may be from series or other options.
1120
+ // Instead of top level tooltip.
1121
+ t, e, i, r, a, n, o, s, l) {
1122
+ // Reset ticket
1123
+ this._ticket = "";
1124
+ if (!t.get("showContent") || !t.get("show")) {
1125
+ return;
1126
+ }
1127
+ var c = this._tooltipContent;
1128
+ c.setEnterable(t.get("enterable"));
1129
+ var h = t.get("formatter");
1130
+ o = o || t.get("position");
1131
+ var u = e;
1132
+ var v = this._getNearestPoint([ a, n ], i, t.get("trigger"), t.get("borderColor"));
1133
+ var d = v.color;
1134
+ if (h) {
1135
+ if (f(h)) {
1136
+ var p = t.ecModel.get("useUTC");
1137
+ var b = w(i) ? i[0] : i;
1138
+ var m = b && b.axisType && b.axisType.indexOf("time") >= 0;
1139
+ u = h;
1140
+ if (m) {
1141
+ u = G(b.axisValue, u, p);
1142
+ }
1143
+ u = Y(u, i, true);
1144
+ } else if (g(h)) {
1145
+ var y = x((function(e, r) {
1146
+ if (e === this._ticket) {
1147
+ c.setContent(r, l, t, d, o);
1148
+ this._updatePosition(t, o, a, n, c, i, s);
1149
+ }
1150
+ }), this);
1151
+ this._ticket = r;
1152
+ u = h(i, r, y);
1153
+ } else {
1154
+ u = h;
1155
+ }
1156
+ }
1157
+ c.setContent(u, l, t, d, o);
1158
+ c.show(t, d);
1159
+ this._updatePosition(t, o, a, n, c, i, s);
1160
+ };
1161
+ TooltipView.prototype._getNearestPoint = function(t, e, i, r) {
1162
+ if (i === "axis" || w(e)) {
1163
+ return {
1164
+ color: r || (this._renderMode === "html" ? "#fff" : "none")
1165
+ };
1166
+ }
1167
+ if (!w(e)) {
1168
+ return {
1169
+ color: r || e.color || e.borderColor
1170
+ };
1171
+ }
1172
+ };
1173
+ TooltipView.prototype._updatePosition = function(t, e, i,
1174
+ // Mouse x
1175
+ r,
1176
+ // Mouse y
1177
+ a, n, o) {
1178
+ var s = this._api.getWidth();
1179
+ var l = this._api.getHeight();
1180
+ e = e || t.get("position");
1181
+ var c = a.getSize();
1182
+ var h = t.get("align");
1183
+ var u = t.get("verticalAlign");
1184
+ var v = o && o.getBoundingRect().clone();
1185
+ o && v.applyTransform(o.transform);
1186
+ if (g(e)) {
1187
+ // Callback of position can be an array or a string specify the position
1188
+ e = e([ i, r ], n, a.el, v, {
1189
+ viewSize: [ s, l ],
1190
+ contentSize: c.slice()
1191
+ });
1192
+ }
1193
+ if (w(e)) {
1194
+ i = E(e[0], s);
1195
+ r = E(e[1], l);
1196
+ } else if (L(e)) {
1197
+ var d = e;
1198
+ d.width = c[0];
1199
+ d.height = c[1];
1200
+ var p = _(d, {
1201
+ width: s,
1202
+ height: l
1203
+ });
1204
+ i = p.x;
1205
+ r = p.y;
1206
+ h = null;
1207
+ // When positionExpr is left/top/right/bottom,
1208
+ // align and verticalAlign will not work.
1209
+ u = null;
1210
+ }
1211
+ // Specify tooltip position by string 'top' 'bottom' 'left' 'right' around graphic element
1212
+ else if (f(e) && o) {
1213
+ var b = calcTooltipPosition(e, v, c, t.get("borderWidth"));
1214
+ i = b[0];
1215
+ r = b[1];
1216
+ } else {
1217
+ var b = refixTooltipPosition(i, r, a, s, l, h ? null : 20, u ? null : 20);
1218
+ i = b[0];
1219
+ r = b[1];
1220
+ }
1221
+ h && (i -= isCenterAlign(h) ? c[0] / 2 : h === "right" ? c[0] : 0);
1222
+ u && (r -= isCenterAlign(u) ? c[1] / 2 : u === "bottom" ? c[1] : 0);
1223
+ if (shouldTooltipConfine(t)) {
1224
+ var b = confineTooltipPosition(i, r, a, s, l);
1225
+ i = b[0];
1226
+ r = b[1];
1227
+ }
1228
+ a.moveTo(i, r);
1229
+ };
1230
+ // FIXME
1231
+ // Should we remove this but leave this to user?
1232
+ TooltipView.prototype._updateContentNotChangedOnAxis = function(t, e) {
1233
+ var i = this._lastDataByCoordSys;
1234
+ var r = this._cbParamsList;
1235
+ var a = !!i && i.length === t.length;
1236
+ a && y(i, (function(i, n) {
1237
+ var o = i.dataByAxis || [];
1238
+ var s = t[n] || {};
1239
+ var l = s.dataByAxis || [];
1240
+ a = a && o.length === l.length;
1241
+ a && y(o, (function(t, i) {
1242
+ var n = l[i] || {};
1243
+ var o = t.seriesDataIndices || [];
1244
+ var s = n.seriesDataIndices || [];
1245
+ a = a && t.value === n.value && t.axisType === n.axisType && t.axisId === n.axisId && o.length === s.length;
1246
+ a && y(o, (function(t, e) {
1247
+ var i = s[e];
1248
+ a = a && t.seriesIndex === i.seriesIndex && t.dataIndex === i.dataIndex;
1249
+ }));
1250
+ // check is cbParams data value changed
1251
+ r && y(t.seriesDataIndices, (function(t) {
1252
+ var i = t.seriesIndex;
1253
+ var n = e[i];
1254
+ var o = r[i];
1255
+ if (n && o && o.data !== n.data) {
1256
+ a = false;
1257
+ }
1258
+ }));
1259
+ }));
1260
+ }));
1261
+ this._lastDataByCoordSys = t;
1262
+ this._cbParamsList = e;
1263
+ return !!a;
1264
+ };
1265
+ TooltipView.prototype._hide = function(t) {
1266
+ // Do not directly hideLater here, because this behavior may be prevented
1267
+ // in dispatchAction when showTip is dispatched.
1268
+ // FIXME
1269
+ // duplicated hideTip if manuallyHideTip is called from dispatchAction.
1270
+ this._lastDataByCoordSys = null;
1271
+ t({
1272
+ type: "hideTip",
1273
+ from: this.uid
1274
+ });
1275
+ };
1276
+ TooltipView.prototype.dispose = function(t, e) {
1277
+ if (d.node || !e.getDom()) {
1278
+ return;
1279
+ }
1280
+ k(this, "_updatePosition");
1281
+ this._tooltipContent.dispose();
1282
+ K("itemTooltip", e);
1283
+ };
1284
+ TooltipView.type = "tooltip";
1285
+ return TooltipView;
1286
+ }(q);
1287
+
1288
+ /**
1289
+ * From top to bottom. (the last one should be globalTooltipModel);
1290
+ */ function buildTooltipModel(t, e, i) {
1291
+ // Last is always tooltip model.
1292
+ var r = e.ecModel;
1293
+ var a;
1294
+ if (i) {
1295
+ a = new J(i, r, r);
1296
+ a = new J(e.option, a, r);
1297
+ } else {
1298
+ a = e;
1299
+ }
1300
+ for (var n = t.length - 1; n >= 0; n--) {
1301
+ var o = t[n];
1302
+ if (o) {
1303
+ if (o instanceof J) {
1304
+ o = o.get("tooltip", true);
1305
+ }
1306
+ // In each data item tooltip can be simply write:
1307
+ // {
1308
+ // value: 10,
1309
+ // tooltip: 'Something you need to know'
1310
+ // }
1311
+ if (f(o)) {
1312
+ o = {
1313
+ formatter: o
1314
+ };
1315
+ }
1316
+ if (o) {
1317
+ a = new J(o, a, r);
1318
+ }
1319
+ }
1320
+ }
1321
+ return a;
1322
+ }
1323
+
1324
+ function makeDispatchAction(t, e) {
1325
+ return t.dispatchAction || x(e.dispatchAction, e);
1326
+ }
1327
+
1328
+ function refixTooltipPosition(t, e, i, r, a, n, o) {
1329
+ var s = i.getSize();
1330
+ var l = s[0];
1331
+ var c = s[1];
1332
+ if (n != null) {
1333
+ // Add extra 2 pixels for this case:
1334
+ // At present the "values" in default tooltip are using CSS `float: right`.
1335
+ // When the right edge of the tooltip box is on the right side of the
1336
+ // viewport, the `float` layout might push the "values" to the second line.
1337
+ if (t + l + n + 2 > r) {
1338
+ t -= l + n;
1339
+ } else {
1340
+ t += n;
1341
+ }
1342
+ }
1343
+ if (o != null) {
1344
+ if (e + c + o > a) {
1345
+ e -= c + o;
1346
+ } else {
1347
+ e += o;
1348
+ }
1349
+ }
1350
+ return [ t, e ];
1351
+ }
1352
+
1353
+ function confineTooltipPosition(t, e, i, r, a) {
1354
+ var n = i.getSize();
1355
+ var o = n[0];
1356
+ var s = n[1];
1357
+ t = Math.min(t + o, r) - o;
1358
+ e = Math.min(e + s, a) - s;
1359
+ t = Math.max(t, 0);
1360
+ e = Math.max(e, 0);
1361
+ return [ t, e ];
1362
+ }
1363
+
1364
+ function calcTooltipPosition(t, e, i, r) {
1365
+ var a = i[0];
1366
+ var n = i[1];
1367
+ var o = Math.ceil(Math.SQRT2 * r) + 8;
1368
+ var s = 0;
1369
+ var l = 0;
1370
+ var c = e.width;
1371
+ var h = e.height;
1372
+ switch (t) {
1373
+ case "inside":
1374
+ s = e.x + c / 2 - a / 2;
1375
+ l = e.y + h / 2 - n / 2;
1376
+ break;
1377
+
1378
+ case "top":
1379
+ s = e.x + c / 2 - a / 2;
1380
+ l = e.y - n - o;
1381
+ break;
1382
+
1383
+ case "bottom":
1384
+ s = e.x + c / 2 - a / 2;
1385
+ l = e.y + h + o;
1386
+ break;
1387
+
1388
+ case "left":
1389
+ s = e.x - a - o;
1390
+ l = e.y + h / 2 - n / 2;
1391
+ break;
1392
+
1393
+ case "right":
1394
+ s = e.x + c + o;
1395
+ l = e.y + h / 2 - n / 2;
1396
+ }
1397
+ return [ s, l ];
1398
+ }
1399
+
1400
+ function isCenterAlign(t) {
1401
+ return t === "center" || t === "middle";
1402
+ }
1403
+
1404
+ /**
1405
+ * Find target component by payload like:
1406
+ * ```js
1407
+ * { legendId: 'some_id', name: 'xxx' }
1408
+ * { toolboxIndex: 1, name: 'xxx' }
1409
+ * { geoName: 'some_name', name: 'xxx' }
1410
+ * ```
1411
+ * PENDING: at present only
1412
+ *
1413
+ * If not found, return null/undefined.
1414
+ */ function findComponentReference(t, e, i) {
1415
+ var r = Z(t).queryOptionMap;
1416
+ var a = r.keys()[0];
1417
+ if (!a || a === "series") {
1418
+ return;
1419
+ }
1420
+ var n = Q(e, a, r.get(a), {
1421
+ useDefault: false,
1422
+ enableAll: false,
1423
+ enableNone: false
1424
+ });
1425
+ var o = n.models[0];
1426
+ if (!o) {
1427
+ return;
1428
+ }
1429
+ var s = i.getViewOfComponentModel(o);
1430
+ var l;
1431
+ s.group.traverse((function(e) {
1432
+ var i = D(e).tooltipConfig;
1433
+ if (i && i.name === t.name) {
1434
+ l = e;
1435
+ return true;
1436
+ // stop
1437
+ }
1438
+ }));
1439
+ if (l) {
1440
+ return {
1441
+ componentMainType: a,
1442
+ componentIndex: o.componentIndex,
1443
+ el: l
1444
+ };
1445
+ }
1446
+ }
1447
+
1448
+ const me = be;
1449
+
1450
+ function install$4(t) {
1451
+ tt(et);
1452
+ t.registerComponentModel(oe);
1453
+ t.registerComponentView(me);
1454
+ /**
1455
+ * @action
1456
+ * @property {string} type
1457
+ * @property {number} seriesIndex
1458
+ * @property {number} dataIndex
1459
+ * @property {number} [x]
1460
+ * @property {number} [y]
1461
+ */ t.registerAction({
1462
+ type: "showTip",
1463
+ event: "showTip",
1464
+ update: "tooltip:manuallyShowTip"
1465
+ }, it);
1466
+ t.registerAction({
1467
+ type: "hideTip",
1468
+ event: "hideTip",
1469
+ update: "tooltip:manuallyHideTip"
1470
+ }, it);
1471
+ }
1472
+
1473
+ var getDefaultSelectorOptions = function(t, e) {
1474
+ if (e === "all") {
1475
+ return {
1476
+ type: "all",
1477
+ title: t.getLocaleModel().get([ "legend", "selector", "all" ])
1478
+ };
1479
+ } else if (e === "inverse") {
1480
+ return {
1481
+ type: "inverse",
1482
+ title: t.getLocaleModel().get([ "legend", "selector", "inverse" ])
1483
+ };
1484
+ }
1485
+ };
1486
+
1487
+ var we = /** @class */ function(t) {
1488
+ h(LegendModel, t);
1489
+ function LegendModel() {
1490
+ var e = t !== null && t.apply(this, arguments) || this;
1491
+ e.type = LegendModel.type;
1492
+ e.layoutMode = {
1493
+ type: "box",
1494
+ // legend.width/height are maxWidth/maxHeight actually,
1495
+ // whereas real width/height is calculated by its content.
1496
+ // (Setting {left: 10, right: 10} does not make sense).
1497
+ // So consider the case:
1498
+ // `setOption({legend: {left: 10});`
1499
+ // then `setOption({legend: {right: 10});`
1500
+ // The previous `left` should be cleared by setting `ignoreSize`.
1501
+ ignoreSize: true
1502
+ };
1503
+ return e;
1504
+ }
1505
+ LegendModel.prototype.init = function(t, e, i) {
1506
+ this.mergeDefaultAndTheme(t, i);
1507
+ t.selected = t.selected || {};
1508
+ this._updateSelector(t);
1509
+ };
1510
+ LegendModel.prototype.mergeOption = function(e, i) {
1511
+ t.prototype.mergeOption.call(this, e, i);
1512
+ this._updateSelector(e);
1513
+ };
1514
+ LegendModel.prototype._updateSelector = function(t) {
1515
+ var e = t.selector;
1516
+ var i = this.ecModel;
1517
+ if (e === true) {
1518
+ e = t.selector = [ "all", "inverse" ];
1519
+ }
1520
+ if (w(e)) {
1521
+ y(e, (function(t, r) {
1522
+ f(t) && (t = {
1523
+ type: t
1524
+ });
1525
+ e[r] = rt(t, getDefaultSelectorOptions(i, t.type));
1526
+ }));
1527
+ }
1528
+ };
1529
+ LegendModel.prototype.optionUpdated = function() {
1530
+ this._updateData(this.ecModel);
1531
+ var t = this._data;
1532
+ // If selectedMode is single, try to select one
1533
+ if (t[0] && this.get("selectedMode") === "single") {
1534
+ var e = false;
1535
+ // If has any selected in option.selected
1536
+ for (var i = 0; i < t.length; i++) {
1537
+ var r = t[i].get("name");
1538
+ if (this.isSelected(r)) {
1539
+ // Force to unselect others
1540
+ this.select(r);
1541
+ e = true;
1542
+ break;
1543
+ }
1544
+ }
1545
+ // Try select the first if selectedMode is single
1546
+ !e && this.select(t[0].get("name"));
1547
+ }
1548
+ };
1549
+ LegendModel.prototype._updateData = function(t) {
1550
+ var e = [];
1551
+ var i = [];
1552
+ t.eachRawSeries((function(r) {
1553
+ var a = r.name;
1554
+ i.push(a);
1555
+ var n;
1556
+ if (r.legendVisualProvider) {
1557
+ var o = r.legendVisualProvider;
1558
+ var s = o.getAllNames();
1559
+ if (!t.isSeriesFiltered(r)) {
1560
+ i = i.concat(s);
1561
+ }
1562
+ if (s.length) {
1563
+ e = e.concat(s);
1564
+ } else {
1565
+ n = true;
1566
+ }
1567
+ } else {
1568
+ n = true;
1569
+ }
1570
+ if (n && at(r)) {
1571
+ e.push(r.name);
1572
+ }
1573
+ }));
1574
+ /**
1575
+ * @type {Array.<string>}
1576
+ * @private
1577
+ */ this._availableNames = i;
1578
+ // If legend.data is not specified in option, use availableNames as data,
1579
+ // which is convenient for user preparing option.
1580
+ var r = this.get("data") || e;
1581
+ var a = nt();
1582
+ var n = ot(r, (function(t) {
1583
+ // Can be string or number
1584
+ if (f(t) || lt(t)) {
1585
+ t = {
1586
+ name: t
1587
+ };
1588
+ }
1589
+ if (a.get(t.name)) {
1590
+ // remove legend name duplicate
1591
+ return null;
1592
+ }
1593
+ a.set(t.name, true);
1594
+ return new J(t, this, this.ecModel);
1595
+ }), this);
1596
+ /**
1597
+ * @type {Array.<module:echarts/model/Model>}
1598
+ * @private
1599
+ */ this._data = st(n, (function(t) {
1600
+ return !!t;
1601
+ }));
1602
+ };
1603
+ LegendModel.prototype.getData = function() {
1604
+ return this._data;
1605
+ };
1606
+ LegendModel.prototype.select = function(t) {
1607
+ var e = this.option.selected;
1608
+ var i = this.get("selectedMode");
1609
+ if (i === "single") {
1610
+ var r = this._data;
1611
+ y(r, (function(t) {
1612
+ e[t.get("name")] = false;
1613
+ }));
1614
+ }
1615
+ e[t] = true;
1616
+ };
1617
+ LegendModel.prototype.unSelect = function(t) {
1618
+ if (this.get("selectedMode") !== "single") {
1619
+ this.option.selected[t] = false;
1620
+ }
1621
+ };
1622
+ LegendModel.prototype.toggleSelected = function(t) {
1623
+ var e = this.option.selected;
1624
+ // Default is true
1625
+ if (!e.hasOwnProperty(t)) {
1626
+ e[t] = true;
1627
+ }
1628
+ this[e[t] ? "unSelect" : "select"](t);
1629
+ };
1630
+ LegendModel.prototype.allSelect = function() {
1631
+ var t = this._data;
1632
+ var e = this.option.selected;
1633
+ y(t, (function(t) {
1634
+ e[t.get("name", true)] = true;
1635
+ }));
1636
+ };
1637
+ LegendModel.prototype.inverseSelect = function() {
1638
+ var t = this._data;
1639
+ var e = this.option.selected;
1640
+ y(t, (function(t) {
1641
+ var i = t.get("name", true);
1642
+ // Initially, default value is true
1643
+ if (!e.hasOwnProperty(i)) {
1644
+ e[i] = true;
1645
+ }
1646
+ e[i] = !e[i];
1647
+ }));
1648
+ };
1649
+ LegendModel.prototype.isSelected = function(t) {
1650
+ var e = this.option.selected;
1651
+ return !(e.hasOwnProperty(t) && !e[t]) && S(this._availableNames, t) >= 0;
1652
+ };
1653
+ LegendModel.prototype.getOrient = function() {
1654
+ return this.get("orient") === "vertical" ? {
1655
+ index: 1,
1656
+ name: "vertical"
1657
+ } : {
1658
+ index: 0,
1659
+ name: "horizontal"
1660
+ };
1661
+ };
1662
+ LegendModel.type = "legend.plain";
1663
+ LegendModel.dependencies = [ "series" ];
1664
+ LegendModel.defaultOption = {
1665
+ // zlevel: 0,
1666
+ z: 4,
1667
+ show: true,
1668
+ orient: "horizontal",
1669
+ left: "center",
1670
+ // right: 'center',
1671
+ top: 0,
1672
+ // bottom: null,
1673
+ align: "auto",
1674
+ backgroundColor: "rgba(0,0,0,0)",
1675
+ borderColor: "#ccc",
1676
+ borderRadius: 0,
1677
+ borderWidth: 0,
1678
+ padding: 5,
1679
+ itemGap: 10,
1680
+ itemWidth: 25,
1681
+ itemHeight: 14,
1682
+ symbolRotate: "inherit",
1683
+ symbolKeepAspect: true,
1684
+ inactiveColor: "#ccc",
1685
+ inactiveBorderColor: "#ccc",
1686
+ inactiveBorderWidth: "auto",
1687
+ itemStyle: {
1688
+ color: "inherit",
1689
+ opacity: "inherit",
1690
+ borderColor: "inherit",
1691
+ borderWidth: "auto",
1692
+ borderCap: "inherit",
1693
+ borderJoin: "inherit",
1694
+ borderDashOffset: "inherit",
1695
+ borderMiterLimit: "inherit"
1696
+ },
1697
+ lineStyle: {
1698
+ width: "auto",
1699
+ color: "inherit",
1700
+ inactiveColor: "#ccc",
1701
+ inactiveWidth: 2,
1702
+ opacity: "inherit",
1703
+ type: "inherit",
1704
+ cap: "inherit",
1705
+ join: "inherit",
1706
+ dashOffset: "inherit",
1707
+ miterLimit: "inherit"
1708
+ },
1709
+ textStyle: {
1710
+ color: "#333"
1711
+ },
1712
+ selectedMode: true,
1713
+ selector: false,
1714
+ selectorLabel: {
1715
+ show: true,
1716
+ borderRadius: 10,
1717
+ padding: [ 3, 5, 3, 5 ],
1718
+ fontSize: 12,
1719
+ fontFamily: "sans-serif",
1720
+ color: "#666",
1721
+ borderWidth: 1,
1722
+ borderColor: "#666"
1723
+ },
1724
+ emphasis: {
1725
+ selectorLabel: {
1726
+ show: true,
1727
+ color: "#eee",
1728
+ backgroundColor: "#666"
1729
+ }
1730
+ },
1731
+ selectorPosition: "auto",
1732
+ selectorItemGap: 7,
1733
+ selectorButtonGap: 10,
1734
+ tooltip: {
1735
+ show: false
1736
+ }
1737
+ };
1738
+ return LegendModel;
1739
+ }(u);
1740
+
1741
+ const ye = we;
1742
+
1743
+ var xe = wt;
1744
+
1745
+ var Se = y;
1746
+
1747
+ var Te = yt;
1748
+
1749
+ var Me = /** @class */ function(t) {
1750
+ h(LegendView, t);
1751
+ function LegendView() {
1752
+ var e = t !== null && t.apply(this, arguments) || this;
1753
+ e.type = LegendView.type;
1754
+ e.newlineDisabled = false;
1755
+ return e;
1756
+ }
1757
+ LegendView.prototype.init = function() {
1758
+ this.group.add(this._contentGroup = new Te);
1759
+ this.group.add(this._selectorGroup = new Te);
1760
+ this._isFirstRender = true;
1761
+ };
1762
+ /**
1763
+ * @protected
1764
+ */ LegendView.prototype.getContentGroup = function() {
1765
+ return this._contentGroup;
1766
+ };
1767
+ /**
1768
+ * @protected
1769
+ */ LegendView.prototype.getSelectorGroup = function() {
1770
+ return this._selectorGroup;
1771
+ };
1772
+ /**
1773
+ * @override
1774
+ */ LegendView.prototype.render = function(t, e, i) {
1775
+ var r = this._isFirstRender;
1776
+ this._isFirstRender = false;
1777
+ this.resetInner();
1778
+ if (!t.get("show", true)) {
1779
+ return;
1780
+ }
1781
+ var a = t.get("align");
1782
+ var n = t.get("orient");
1783
+ if (!a || a === "auto") {
1784
+ a = t.get("left") === "right" && n === "vertical" ? "right" : "left";
1785
+ }
1786
+ // selector has been normalized to an array in model
1787
+ var o = t.get("selector", true);
1788
+ var s = t.get("selectorPosition", true);
1789
+ if (o && (!s || s === "auto")) {
1790
+ s = n === "horizontal" ? "end" : "start";
1791
+ }
1792
+ this.renderInner(a, t, e, i, o, n, s);
1793
+ // Perform layout.
1794
+ var l = t.getBoxLayoutParams();
1795
+ var c = {
1796
+ width: i.getWidth(),
1797
+ height: i.getHeight()
1798
+ };
1799
+ var h = t.get("padding");
1800
+ var u = _(l, c, h);
1801
+ var v = this.layoutInner(t, a, u, r, o, s);
1802
+ // Place mainGroup, based on the calculated `mainRect`.
1803
+ var d = _(ct({
1804
+ width: v.width,
1805
+ height: v.height
1806
+ }, l), c, h);
1807
+ this.group.x = d.x - v.x;
1808
+ this.group.y = d.y - v.y;
1809
+ this.group.markRedraw();
1810
+ // Render background after group is layout.
1811
+ this.group.add(this._backgroundEl = makeBackground(v, t));
1812
+ };
1813
+ LegendView.prototype.resetInner = function() {
1814
+ this.getContentGroup().removeAll();
1815
+ this._backgroundEl && this.group.remove(this._backgroundEl);
1816
+ this.getSelectorGroup().removeAll();
1817
+ };
1818
+ LegendView.prototype.renderInner = function(t, e, i, r, a, n, o) {
1819
+ var s = this.getContentGroup();
1820
+ var l = nt();
1821
+ var c = e.get("selectedMode");
1822
+ var h = [];
1823
+ i.eachRawSeries((function(t) {
1824
+ !t.get("legendHoverLink") && h.push(t.id);
1825
+ }));
1826
+ Se(e.getData(), (function(a, n) {
1827
+ var o = a.get("name");
1828
+ // Use empty string or \n as a newline string
1829
+ if (!this.newlineDisabled && (o === "" || o === "\n")) {
1830
+ var u = new Te;
1831
+ // @ts-ignore
1832
+ u.newline = true;
1833
+ s.add(u);
1834
+ return;
1835
+ }
1836
+ // Representitive series.
1837
+ var v = i.getSeriesByName(o)[0];
1838
+ if (l.get(o)) {
1839
+ // Have been drawn
1840
+ return;
1841
+ }
1842
+ // Legend to control series.
1843
+ if (v) {
1844
+ var d = v.getData();
1845
+ var f = d.getVisual("legendLineStyle") || {};
1846
+ var p = d.getVisual("legendIcon");
1847
+ /**
1848
+ * `data.getVisual('style')` may be the color from the register
1849
+ * in series. For example, for line series,
1850
+ */ var g = d.getVisual("style");
1851
+ var b = this._createItem(v, o, n, a, e, t, f, g, p, c, r);
1852
+ b.on("click", xe(dispatchSelectAction, o, null, r, h)).on("mouseover", xe(dispatchHighlightAction, v.name, null, r, h)).on("mouseout", xe(dispatchDownplayAction, v.name, null, r, h));
1853
+ if (i.ssr) {
1854
+ b.eachChild((function(t) {
1855
+ var e = D(t);
1856
+ e.seriesIndex = v.seriesIndex;
1857
+ e.dataIndex = n;
1858
+ e.ssrType = "legend";
1859
+ }));
1860
+ }
1861
+ l.set(o, true);
1862
+ } else {
1863
+ // Legend to control data. In pie and funnel.
1864
+ i.eachRawSeries((function(s) {
1865
+ // In case multiple series has same data name
1866
+ if (l.get(o)) {
1867
+ return;
1868
+ }
1869
+ if (s.legendVisualProvider) {
1870
+ var u = s.legendVisualProvider;
1871
+ if (!u.containName(o)) {
1872
+ return;
1873
+ }
1874
+ var v = u.indexOfName(o);
1875
+ var d = u.getItemVisual(v, "style");
1876
+ var f = u.getItemVisual(v, "legendIcon");
1877
+ var p = ht(d.fill);
1878
+ // Color may be set to transparent in visualMap when data is out of range.
1879
+ // Do not show nothing.
1880
+ if (p && p[3] === 0) {
1881
+ p[3] = .2;
1882
+ // TODO color is set to 0, 0, 0, 0. Should show correct RGBA
1883
+ d = F(F({}, d), {
1884
+ fill: ut(p, "rgba")
1885
+ });
1886
+ }
1887
+ var g = this._createItem(s, o, n, a, e, t, {}, d, f, c, r);
1888
+ // FIXME: consider different series has items with the same name.
1889
+ g.on("click", xe(dispatchSelectAction, null, o, r, h)).on("mouseover", xe(dispatchHighlightAction, null, o, r, h)).on("mouseout", xe(dispatchDownplayAction, null, o, r, h));
1890
+ if (i.ssr) {
1891
+ g.eachChild((function(t) {
1892
+ var e = D(t);
1893
+ e.seriesIndex = s.seriesIndex;
1894
+ e.dataIndex = n;
1895
+ e.ssrType = "legend";
1896
+ }));
1897
+ }
1898
+ l.set(o, true);
1899
+ }
1900
+ }), this);
1901
+ }
1902
+ }), this);
1903
+ if (a) {
1904
+ this._createSelector(a, e, r, n, o);
1905
+ }
1906
+ };
1907
+ LegendView.prototype._createSelector = function(t, e, i, r, a) {
1908
+ var n = this.getSelectorGroup();
1909
+ Se(t, (function createSelectorButton(t) {
1910
+ var r = t.type;
1911
+ var a = new I({
1912
+ style: {
1913
+ x: 0,
1914
+ y: 0,
1915
+ align: "center",
1916
+ verticalAlign: "middle"
1917
+ },
1918
+ onclick: function() {
1919
+ i.dispatchAction({
1920
+ type: r === "all" ? "legendAllSelect" : "legendInverseSelect"
1921
+ });
1922
+ }
1923
+ });
1924
+ n.add(a);
1925
+ var o = e.getModel("selectorLabel");
1926
+ var s = e.getModel([ "emphasis", "selectorLabel" ]);
1927
+ vt(a, {
1928
+ normal: o,
1929
+ emphasis: s
1930
+ }, {
1931
+ defaultText: t.title
1932
+ });
1933
+ dt(a);
1934
+ }));
1935
+ };
1936
+ LegendView.prototype._createItem = function(t, e, i, r, a, n, o, s, l, h, u) {
1937
+ var v = t.visualDrawType;
1938
+ var d = a.get("itemWidth");
1939
+ var p = a.get("itemHeight");
1940
+ var b = a.isSelected(e);
1941
+ var m = r.get("symbolRotate");
1942
+ var w = r.get("symbolKeepAspect");
1943
+ var y = r.get("icon");
1944
+ l = y || l || "roundRect";
1945
+ var x = getLegendStyle(l, r, o, s, v, b, u);
1946
+ var S = new Te;
1947
+ var T = r.getModel("textStyle");
1948
+ if (g(t.getLegendIcon) && (!y || y === "inherit")) {
1949
+ // Series has specific way to define legend icon
1950
+ S.add(t.getLegendIcon({
1951
+ itemWidth: d,
1952
+ itemHeight: p,
1953
+ icon: l,
1954
+ iconRotate: m,
1955
+ itemStyle: x.itemStyle,
1956
+ lineStyle: x.lineStyle,
1957
+ symbolKeepAspect: w
1958
+ }));
1959
+ } else {
1960
+ // Use default legend icon policy for most series
1961
+ var M = y === "inherit" && t.getData().getVisual("symbol") ? m === "inherit" ? t.getData().getVisual("symbolRotate") : m : 0;
1962
+ // No rotation for no icon
1963
+ S.add(getDefaultLegendIcon({
1964
+ itemWidth: d,
1965
+ itemHeight: p,
1966
+ icon: l,
1967
+ iconRotate: M,
1968
+ itemStyle: x.itemStyle,
1969
+ lineStyle: x.lineStyle,
1970
+ symbolKeepAspect: w
1971
+ }));
1972
+ }
1973
+ var L = n === "left" ? d + 5 : -5;
1974
+ var C = n;
1975
+ var A = a.get("formatter");
1976
+ var P = e;
1977
+ if (f(A) && A) {
1978
+ P = A.replace("{name}", e != null ? e : "");
1979
+ } else if (g(A)) {
1980
+ P = A(e);
1981
+ }
1982
+ var k = b ? T.getTextColor() : r.get("inactiveColor");
1983
+ S.add(new I({
1984
+ style: ft(T, {
1985
+ text: P,
1986
+ x: L,
1987
+ y: p / 2,
1988
+ fill: k,
1989
+ align: C,
1990
+ verticalAlign: "middle"
1991
+ }, {
1992
+ inheritColor: k
1993
+ })
1994
+ }));
1995
+ // Add a invisible rect to increase the area of mouse hover
1996
+ var V = new c({
1997
+ shape: S.getBoundingRect(),
1998
+ style: {
1999
+ // Cannot use 'invisible' because SVG SSR will miss the node
2000
+ fill: "transparent"
2001
+ }
2002
+ });
2003
+ var D = r.getModel("tooltip");
2004
+ if (D.get("show")) {
2005
+ pt({
2006
+ el: V,
2007
+ componentModel: a,
2008
+ itemName: e,
2009
+ itemTooltipOption: D.option
2010
+ });
2011
+ }
2012
+ S.add(V);
2013
+ S.eachChild((function(t) {
2014
+ t.silent = true;
2015
+ }));
2016
+ V.silent = !h;
2017
+ this.getContentGroup().add(S);
2018
+ dt(S);
2019
+ // @ts-ignore
2020
+ S.__legendDataIndex = i;
2021
+ return S;
2022
+ };
2023
+ LegendView.prototype.layoutInner = function(t, e, i, r, a, n) {
2024
+ var o = this.getContentGroup();
2025
+ var s = this.getSelectorGroup();
2026
+ // Place items in contentGroup.
2027
+ gt(t.get("orient"), o, t.get("itemGap"), i.width, i.height);
2028
+ var l = o.getBoundingRect();
2029
+ var c = [ -l.x, -l.y ];
2030
+ s.markRedraw();
2031
+ o.markRedraw();
2032
+ if (a) {
2033
+ // Place buttons in selectorGroup
2034
+ gt(
2035
+ // Buttons in selectorGroup always layout horizontally
2036
+ "horizontal", s, t.get("selectorItemGap", true));
2037
+ var h = s.getBoundingRect();
2038
+ var u = [ -h.x, -h.y ];
2039
+ var v = t.get("selectorButtonGap", true);
2040
+ var d = t.getOrient().index;
2041
+ var f = d === 0 ? "width" : "height";
2042
+ var p = d === 0 ? "height" : "width";
2043
+ var g = d === 0 ? "y" : "x";
2044
+ if (n === "end") {
2045
+ u[d] += l[f] + v;
2046
+ } else {
2047
+ c[d] += h[f] + v;
2048
+ }
2049
+ // Always align selector to content as 'middle'
2050
+ u[1 - d] += l[p] / 2 - h[p] / 2;
2051
+ s.x = u[0];
2052
+ s.y = u[1];
2053
+ o.x = c[0];
2054
+ o.y = c[1];
2055
+ var b = {
2056
+ x: 0,
2057
+ y: 0
2058
+ };
2059
+ b[f] = l[f] + v + h[f];
2060
+ b[p] = Math.max(l[p], h[p]);
2061
+ b[g] = Math.min(0, h[g] + u[1 - d]);
2062
+ return b;
2063
+ } else {
2064
+ o.x = c[0];
2065
+ o.y = c[1];
2066
+ return this.group.getBoundingRect();
2067
+ }
2068
+ };
2069
+ /**
2070
+ * @protected
2071
+ */ LegendView.prototype.remove = function() {
2072
+ this.getContentGroup().removeAll();
2073
+ this._isFirstRender = true;
2074
+ };
2075
+ LegendView.type = "legend.plain";
2076
+ return LegendView;
2077
+ }(q);
2078
+
2079
+ function getLegendStyle(t, e, i, r, a, n, o) {
2080
+ /**
2081
+ * Use series style if is inherit;
2082
+ * elsewise, use legend style
2083
+ */
2084
+ function handleCommonProps(t, e) {
2085
+ // If lineStyle.width is 'auto', it is set to be 2 if series has border
2086
+ if (t.lineWidth === "auto") {
2087
+ t.lineWidth = e.lineWidth > 0 ? 2 : 0;
2088
+ }
2089
+ Se(t, (function(i, r) {
2090
+ t[r] === "inherit" && (t[r] = e[r]);
2091
+ }));
2092
+ }
2093
+ // itemStyle
2094
+ var s = e.getModel("itemStyle");
2095
+ var l = s.getItemStyle();
2096
+ var c = t.lastIndexOf("empty", 0) === 0 ? "fill" : "stroke";
2097
+ var h = s.getShallow("decal");
2098
+ l.decal = !h || h === "inherit" ? r.decal : bt(h, o);
2099
+ if (l.fill === "inherit") {
2100
+ /**
2101
+ * Series with visualDrawType as 'stroke' should have
2102
+ * series stroke as legend fill
2103
+ */
2104
+ l.fill = r[a];
2105
+ }
2106
+ if (l.stroke === "inherit") {
2107
+ /**
2108
+ * icon type with "emptyXXX" should use fill color
2109
+ * in visual style
2110
+ */
2111
+ l.stroke = r[c];
2112
+ }
2113
+ if (l.opacity === "inherit") {
2114
+ /**
2115
+ * Use lineStyle.opacity if drawType is stroke
2116
+ */
2117
+ l.opacity = (a === "fill" ? r : i).opacity;
2118
+ }
2119
+ handleCommonProps(l, r);
2120
+ // lineStyle
2121
+ var u = e.getModel("lineStyle");
2122
+ var v = u.getLineStyle();
2123
+ handleCommonProps(v, i);
2124
+ // Fix auto color to real color
2125
+ l.fill === "auto" && (l.fill = r.fill);
2126
+ l.stroke === "auto" && (l.stroke = r.fill);
2127
+ v.stroke === "auto" && (v.stroke = r.fill);
2128
+ if (!n) {
2129
+ var d = e.get("inactiveBorderWidth");
2130
+ /**
2131
+ * Since stroke is set to be inactiveBorderColor, it may occur that
2132
+ * there is no border in series but border in legend, so we need to
2133
+ * use border only when series has border if is set to be auto
2134
+ */ var f = l[c];
2135
+ l.lineWidth = d === "auto" ? r.lineWidth > 0 && f ? 2 : 0 : l.lineWidth;
2136
+ l.fill = e.get("inactiveColor");
2137
+ l.stroke = e.get("inactiveBorderColor");
2138
+ v.stroke = u.get("inactiveColor");
2139
+ v.lineWidth = u.get("inactiveWidth");
2140
+ }
2141
+ return {
2142
+ itemStyle: l,
2143
+ lineStyle: v
2144
+ };
2145
+ }
2146
+
2147
+ function getDefaultLegendIcon(t) {
2148
+ var e = t.icon || "roundRect";
2149
+ var i = mt(e, 0, 0, t.itemWidth, t.itemHeight, t.itemStyle.fill, t.symbolKeepAspect);
2150
+ i.setStyle(t.itemStyle);
2151
+ i.rotation = (t.iconRotate || 0) * Math.PI / 180;
2152
+ i.setOrigin([ t.itemWidth / 2, t.itemHeight / 2 ]);
2153
+ if (e.indexOf("empty") > -1) {
2154
+ i.style.stroke = i.style.fill;
2155
+ i.style.fill = "#fff";
2156
+ i.style.lineWidth = 2;
2157
+ }
2158
+ return i;
2159
+ }
2160
+
2161
+ function dispatchSelectAction(t, e, i, r) {
2162
+ // downplay before unselect
2163
+ dispatchDownplayAction(t, e, i, r);
2164
+ i.dispatchAction({
2165
+ type: "legendToggleSelect",
2166
+ name: t != null ? t : e
2167
+ });
2168
+ // highlight after select
2169
+ // TODO highlight immediately may cause animation loss.
2170
+ dispatchHighlightAction(t, e, i, r);
2171
+ }
2172
+
2173
+ function isUseHoverLayer(t) {
2174
+ var e = t.getZr().storage.getDisplayList();
2175
+ var i;
2176
+ var r = 0;
2177
+ var a = e.length;
2178
+ while (r < a && !(i = e[r].states.emphasis)) {
2179
+ r++;
2180
+ }
2181
+ return i && i.hoverLayer;
2182
+ }
2183
+
2184
+ function dispatchHighlightAction(t, e, i, r) {
2185
+ // If element hover will move to a hoverLayer.
2186
+ if (!isUseHoverLayer(i)) {
2187
+ i.dispatchAction({
2188
+ type: "highlight",
2189
+ seriesName: t,
2190
+ name: e,
2191
+ excludeSeriesId: r
2192
+ });
2193
+ }
2194
+ }
2195
+
2196
+ function dispatchDownplayAction(t, e, i, r) {
2197
+ // If element hover will move to a hoverLayer.
2198
+ if (!isUseHoverLayer(i)) {
2199
+ i.dispatchAction({
2200
+ type: "downplay",
2201
+ seriesName: t,
2202
+ name: e,
2203
+ excludeSeriesId: r
2204
+ });
2205
+ }
2206
+ }
2207
+
2208
+ const Le = Me;
2209
+
2210
+ /*
2211
+ * Licensed to the Apache Software Foundation (ASF) under one
2212
+ * or more contributor license agreements. See the NOTICE file
2213
+ * distributed with this work for additional information
2214
+ * regarding copyright ownership. The ASF licenses this file
2215
+ * to you under the Apache License, Version 2.0 (the
2216
+ * "License"); you may not use this file except in compliance
2217
+ * with the License. You may obtain a copy of the License at
2218
+ *
2219
+ * http://www.apache.org/licenses/LICENSE-2.0
2220
+ *
2221
+ * Unless required by applicable law or agreed to in writing,
2222
+ * software distributed under the License is distributed on an
2223
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2224
+ * KIND, either express or implied. See the License for the
2225
+ * specific language governing permissions and limitations
2226
+ * under the License.
2227
+ */
2228
+ /**
2229
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
2230
+ */
2231
+ /*
2232
+ * Licensed to the Apache Software Foundation (ASF) under one
2233
+ * or more contributor license agreements. See the NOTICE file
2234
+ * distributed with this work for additional information
2235
+ * regarding copyright ownership. The ASF licenses this file
2236
+ * to you under the Apache License, Version 2.0 (the
2237
+ * "License"); you may not use this file except in compliance
2238
+ * with the License. You may obtain a copy of the License at
2239
+ *
2240
+ * http://www.apache.org/licenses/LICENSE-2.0
2241
+ *
2242
+ * Unless required by applicable law or agreed to in writing,
2243
+ * software distributed under the License is distributed on an
2244
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2245
+ * KIND, either express or implied. See the License for the
2246
+ * specific language governing permissions and limitations
2247
+ * under the License.
2248
+ */ function legendFilter(t) {
2249
+ var e = t.findComponents({
2250
+ mainType: "legend"
2251
+ });
2252
+ if (e && e.length) {
2253
+ t.filterSeries((function(t) {
2254
+ // If in any legend component the status is not selected.
2255
+ // Because in legend series is assumed selected when it is not in the legend data.
2256
+ for (var i = 0; i < e.length; i++) {
2257
+ if (!e[i].isSelected(t.name)) {
2258
+ return false;
2259
+ }
2260
+ }
2261
+ return true;
2262
+ }));
2263
+ }
2264
+ }
2265
+
2266
+ function legendSelectActionHandler(t, e, i) {
2267
+ var r = {};
2268
+ var a = t === "toggleSelected";
2269
+ var n;
2270
+ // Update all legend components
2271
+ i.eachComponent("legend", (function(i) {
2272
+ if (a && n != null) {
2273
+ // Force other legend has same selected status
2274
+ // Or the first is toggled to true and other are toggled to false
2275
+ // In the case one legend has some item unSelected in option. And if other legend
2276
+ // doesn't has the item, they will assume it is selected.
2277
+ i[n ? "select" : "unSelect"](e.name);
2278
+ } else if (t === "allSelect" || t === "inverseSelect") {
2279
+ i[t]();
2280
+ } else {
2281
+ i[t](e.name);
2282
+ n = i.isSelected(e.name);
2283
+ }
2284
+ var o = i.getData();
2285
+ y(o, (function(t) {
2286
+ var e = t.get("name");
2287
+ // Wrap element
2288
+ if (e === "\n" || e === "") {
2289
+ return;
2290
+ }
2291
+ var a = i.isSelected(e);
2292
+ if (r.hasOwnProperty(e)) {
2293
+ // Unselected if any legend is unselected
2294
+ r[e] = r[e] && a;
2295
+ } else {
2296
+ r[e] = a;
2297
+ }
2298
+ }));
2299
+ }));
2300
+ // Return the event explicitly
2301
+ return t === "allSelect" || t === "inverseSelect" ? {
2302
+ selected: r
2303
+ } : {
2304
+ name: e.name,
2305
+ selected: r
2306
+ };
2307
+ }
2308
+
2309
+ function installLegendAction(t) {
2310
+ /**
2311
+ * @event legendToggleSelect
2312
+ * @type {Object}
2313
+ * @property {string} type 'legendToggleSelect'
2314
+ * @property {string} [from]
2315
+ * @property {string} name Series name or data item name
2316
+ */
2317
+ t.registerAction("legendToggleSelect", "legendselectchanged", wt(legendSelectActionHandler, "toggleSelected"));
2318
+ t.registerAction("legendAllSelect", "legendselectall", wt(legendSelectActionHandler, "allSelect"));
2319
+ t.registerAction("legendInverseSelect", "legendinverseselect", wt(legendSelectActionHandler, "inverseSelect"));
2320
+ /**
2321
+ * @event legendSelect
2322
+ * @type {Object}
2323
+ * @property {string} type 'legendSelect'
2324
+ * @property {string} name Series name or data item name
2325
+ */ t.registerAction("legendSelect", "legendselected", wt(legendSelectActionHandler, "select"));
2326
+ /**
2327
+ * @event legendUnSelect
2328
+ * @type {Object}
2329
+ * @property {string} type 'legendUnSelect'
2330
+ * @property {string} name Series name or data item name
2331
+ */ t.registerAction("legendUnSelect", "legendunselected", wt(legendSelectActionHandler, "unSelect"));
2332
+ }
2333
+
2334
+ function install$3(t) {
2335
+ t.registerComponentModel(ye);
2336
+ t.registerComponentView(Le);
2337
+ t.registerProcessor(t.PRIORITY.PROCESSOR.SERIES_FILTER, legendFilter);
2338
+ t.registerSubTypeDefaulter("legend", (function() {
2339
+ return "plain";
2340
+ }));
2341
+ installLegendAction(t);
2342
+ }
2343
+
2344
+ var Ce = /** @class */ function(t) {
2345
+ h(ScrollableLegendModel, t);
2346
+ function ScrollableLegendModel() {
2347
+ var e = t !== null && t.apply(this, arguments) || this;
2348
+ e.type = ScrollableLegendModel.type;
2349
+ return e;
2350
+ }
2351
+ /**
2352
+ * @param {number} scrollDataIndex
2353
+ */ ScrollableLegendModel.prototype.setScrollDataIndex = function(t) {
2354
+ this.option.scrollDataIndex = t;
2355
+ };
2356
+ ScrollableLegendModel.prototype.init = function(e, i, r) {
2357
+ var a = xt(e);
2358
+ t.prototype.init.call(this, e, i, r);
2359
+ mergeAndNormalizeLayoutParams(this, e, a);
2360
+ };
2361
+ /**
2362
+ * @override
2363
+ */ ScrollableLegendModel.prototype.mergeOption = function(e, i) {
2364
+ t.prototype.mergeOption.call(this, e, i);
2365
+ mergeAndNormalizeLayoutParams(this, this.option, e);
2366
+ };
2367
+ ScrollableLegendModel.type = "legend.scroll";
2368
+ ScrollableLegendModel.defaultOption = St(ye.defaultOption, {
2369
+ scrollDataIndex: 0,
2370
+ pageButtonItemGap: 5,
2371
+ pageButtonGap: null,
2372
+ pageButtonPosition: "end",
2373
+ pageFormatter: "{current}/{total}",
2374
+ pageIcons: {
2375
+ horizontal: [ "M0,0L12,-10L12,10z", "M0,0L-12,-10L-12,10z" ],
2376
+ vertical: [ "M0,0L20,0L10,-20z", "M0,0L20,0L10,20z" ]
2377
+ },
2378
+ pageIconColor: "#2f4554",
2379
+ pageIconInactiveColor: "#aaa",
2380
+ pageIconSize: 15,
2381
+ pageTextStyle: {
2382
+ color: "#333"
2383
+ },
2384
+ animationDurationUpdate: 800
2385
+ });
2386
+ return ScrollableLegendModel;
2387
+ }(ye);
2388
+
2389
+ // Do not `ignoreSize` to enable setting {left: 10, right: 10}.
2390
+ function mergeAndNormalizeLayoutParams(t, e, i) {
2391
+ var r = t.getOrient();
2392
+ var a = [ 1, 1 ];
2393
+ a[r.index] = 0;
2394
+ Tt(e, i, {
2395
+ type: "box",
2396
+ ignoreSize: !!a
2397
+ });
2398
+ }
2399
+
2400
+ const Ie = Ce;
2401
+
2402
+ var Ae = yt;
2403
+
2404
+ var Pe = [ "width", "height" ];
2405
+
2406
+ var ke = [ "x", "y" ];
2407
+
2408
+ var Ve = /** @class */ function(t) {
2409
+ h(ScrollableLegendView, t);
2410
+ function ScrollableLegendView() {
2411
+ var e = t !== null && t.apply(this, arguments) || this;
2412
+ e.type = ScrollableLegendView.type;
2413
+ e.newlineDisabled = true;
2414
+ e._currentIndex = 0;
2415
+ return e;
2416
+ }
2417
+ ScrollableLegendView.prototype.init = function() {
2418
+ t.prototype.init.call(this);
2419
+ this.group.add(this._containerGroup = new Ae);
2420
+ this._containerGroup.add(this.getContentGroup());
2421
+ this.group.add(this._controllerGroup = new Ae);
2422
+ };
2423
+ /**
2424
+ * @override
2425
+ */ ScrollableLegendView.prototype.resetInner = function() {
2426
+ t.prototype.resetInner.call(this);
2427
+ this._controllerGroup.removeAll();
2428
+ this._containerGroup.removeClipPath();
2429
+ this._containerGroup.__rectSize = null;
2430
+ };
2431
+ /**
2432
+ * @override
2433
+ */ ScrollableLegendView.prototype.renderInner = function(e, i, r, a, n, o, s) {
2434
+ var l = this;
2435
+ // Render content items.
2436
+ t.prototype.renderInner.call(this, e, i, r, a, n, o, s);
2437
+ var c = this._controllerGroup;
2438
+ // FIXME: support be 'auto' adapt to size number text length,
2439
+ // e.g., '3/12345' should not overlap with the control arrow button.
2440
+ var h = i.get("pageIconSize", true);
2441
+ var u = w(h) ? h : [ h, h ];
2442
+ createPageButton("pagePrev", 0);
2443
+ var v = i.getModel("pageTextStyle");
2444
+ c.add(new I({
2445
+ name: "pageText",
2446
+ style: {
2447
+ // Placeholder to calculate a proper layout.
2448
+ text: "xx/xx",
2449
+ fill: v.getTextColor(),
2450
+ font: v.getFont(),
2451
+ verticalAlign: "middle",
2452
+ align: "center"
2453
+ },
2454
+ silent: true
2455
+ }));
2456
+ createPageButton("pageNext", 1);
2457
+ function createPageButton(t, e) {
2458
+ var r = t + "DataIndex";
2459
+ var n = Mt(i.get("pageIcons", true)[i.getOrient().name][e], {
2460
+ // Buttons will be created in each render, so we do not need
2461
+ // to worry about avoiding using legendModel kept in scope.
2462
+ onclick: x(l._pageGo, l, r, i, a)
2463
+ }, {
2464
+ x: -u[0] / 2,
2465
+ y: -u[1] / 2,
2466
+ width: u[0],
2467
+ height: u[1]
2468
+ });
2469
+ n.name = t;
2470
+ c.add(n);
2471
+ }
2472
+ };
2473
+ /**
2474
+ * @override
2475
+ */ ScrollableLegendView.prototype.layoutInner = function(t, e, i, r, a, n) {
2476
+ var o = this.getSelectorGroup();
2477
+ var s = t.getOrient().index;
2478
+ var l = Pe[s];
2479
+ var c = ke[s];
2480
+ var h = Pe[1 - s];
2481
+ var u = ke[1 - s];
2482
+ a && gt(
2483
+ // Buttons in selectorGroup always layout horizontally
2484
+ "horizontal", o, t.get("selectorItemGap", true));
2485
+ var v = t.get("selectorButtonGap", true);
2486
+ var d = o.getBoundingRect();
2487
+ var f = [ -d.x, -d.y ];
2488
+ var p = $(i);
2489
+ a && (p[l] = i[l] - d[l] - v);
2490
+ var g = this._layoutContentAndController(t, r, p, s, l, h, u, c);
2491
+ if (a) {
2492
+ if (n === "end") {
2493
+ f[s] += g[l] + v;
2494
+ } else {
2495
+ var b = d[l] + v;
2496
+ f[s] -= b;
2497
+ g[c] -= b;
2498
+ }
2499
+ g[l] += d[l] + v;
2500
+ f[1 - s] += g[u] + g[h] / 2 - d[h] / 2;
2501
+ g[h] = Math.max(g[h], d[h]);
2502
+ g[u] = Math.min(g[u], d[u] + f[1 - s]);
2503
+ o.x = f[0];
2504
+ o.y = f[1];
2505
+ o.markRedraw();
2506
+ }
2507
+ return g;
2508
+ };
2509
+ ScrollableLegendView.prototype._layoutContentAndController = function(t, e, i, r, a, n, o, s) {
2510
+ var l = this.getContentGroup();
2511
+ var h = this._containerGroup;
2512
+ var u = this._controllerGroup;
2513
+ // Place items in contentGroup.
2514
+ gt(t.get("orient"), l, t.get("itemGap"), !r ? null : i.width, r ? null : i.height);
2515
+ gt(
2516
+ // Buttons in controller are layout always horizontally.
2517
+ "horizontal", u, t.get("pageButtonItemGap", true));
2518
+ var v = l.getBoundingRect();
2519
+ var d = u.getBoundingRect();
2520
+ var f = this._showController = v[a] > i[a];
2521
+ // In case that the inner elements of contentGroup layout do not based on [0, 0]
2522
+ var p = [ -v.x, -v.y ];
2523
+ // Remain contentPos when scroll animation perfroming.
2524
+ // If first rendering, `contentGroup.position` is [0, 0], which
2525
+ // does not make sense and may cause unexepcted animation if adopted.
2526
+ if (!e) {
2527
+ p[r] = l[s];
2528
+ }
2529
+ // Layout container group based on 0.
2530
+ var g = [ 0, 0 ];
2531
+ var b = [ -d.x, -d.y ];
2532
+ var m = Lt(t.get("pageButtonGap", true), t.get("itemGap", true));
2533
+ // Place containerGroup and controllerGroup and contentGroup.
2534
+ if (f) {
2535
+ var w = t.get("pageButtonPosition", true);
2536
+ // controller is on the right / bottom.
2537
+ if (w === "end") {
2538
+ b[r] += i[a] - d[a];
2539
+ }
2540
+ // controller is on the left / top.
2541
+ else {
2542
+ g[r] += d[a] + m;
2543
+ }
2544
+ }
2545
+ // Always align controller to content as 'middle'.
2546
+ b[1 - r] += v[n] / 2 - d[n] / 2;
2547
+ l.setPosition(p);
2548
+ h.setPosition(g);
2549
+ u.setPosition(b);
2550
+ // Calculate `mainRect` and set `clipPath`.
2551
+ // mainRect should not be calculated by `this.group.getBoundingRect()`
2552
+ // for sake of the overflow.
2553
+ var y = {
2554
+ x: 0,
2555
+ y: 0
2556
+ };
2557
+ // Consider content may be overflow (should be clipped).
2558
+ y[a] = f ? i[a] : v[a];
2559
+ y[n] = Math.max(v[n], d[n]);
2560
+ // `containerRect[yx] + containerPos[1 - orientIdx]` is 0.
2561
+ y[o] = Math.min(0, d[o] + b[1 - r]);
2562
+ h.__rectSize = i[a];
2563
+ if (f) {
2564
+ var x = {
2565
+ x: 0,
2566
+ y: 0
2567
+ };
2568
+ x[a] = Math.max(i[a] - d[a] - m, 0);
2569
+ x[n] = y[n];
2570
+ h.setClipPath(new c({
2571
+ shape: x
2572
+ }));
2573
+ // Consider content may be larger than container, container rect
2574
+ // can not be obtained from `containerGroup.getBoundingRect()`.
2575
+ h.__rectSize = x[a];
2576
+ } else {
2577
+ // Do not remove or ignore controller. Keep them set as placeholders.
2578
+ u.eachChild((function(t) {
2579
+ t.attr({
2580
+ invisible: true,
2581
+ silent: true
2582
+ });
2583
+ }));
2584
+ }
2585
+ // Content translate animation.
2586
+ var S = this._getPageInfo(t);
2587
+ S.pageIndex != null && Ct(l, {
2588
+ x: S.contentPosition[0],
2589
+ y: S.contentPosition[1]
2590
+ },
2591
+ // When switch from "show controller" to "not show controller", view should be
2592
+ // updated immediately without animation, otherwise causes weird effect.
2593
+ f ? t : null);
2594
+ this._updatePageInfoView(t, S);
2595
+ return y;
2596
+ };
2597
+ ScrollableLegendView.prototype._pageGo = function(t, e, i) {
2598
+ var r = this._getPageInfo(e)[t];
2599
+ r != null && i.dispatchAction({
2600
+ type: "legendScroll",
2601
+ scrollDataIndex: r,
2602
+ legendId: e.id
2603
+ });
2604
+ };
2605
+ ScrollableLegendView.prototype._updatePageInfoView = function(t, e) {
2606
+ var i = this._controllerGroup;
2607
+ y([ "pagePrev", "pageNext" ], (function(r) {
2608
+ var a = r + "DataIndex";
2609
+ var n = e[a] != null;
2610
+ var o = i.childOfName(r);
2611
+ if (o) {
2612
+ o.setStyle("fill", n ? t.get("pageIconColor", true) : t.get("pageIconInactiveColor", true));
2613
+ o.cursor = n ? "pointer" : "default";
2614
+ }
2615
+ }));
2616
+ var r = i.childOfName("pageText");
2617
+ var a = t.get("pageFormatter");
2618
+ var n = e.pageIndex;
2619
+ var o = n != null ? n + 1 : 0;
2620
+ var s = e.pageCount;
2621
+ r && a && r.setStyle("text", f(a) ? a.replace("{current}", o == null ? "" : o + "").replace("{total}", s == null ? "" : s + "") : a({
2622
+ current: o,
2623
+ total: s
2624
+ }));
2625
+ };
2626
+ /**
2627
+ * contentPosition: Array.<number>, null when data item not found.
2628
+ * pageIndex: number, null when data item not found.
2629
+ * pageCount: number, always be a number, can be 0.
2630
+ * pagePrevDataIndex: number, null when no previous page.
2631
+ * pageNextDataIndex: number, null when no next page.
2632
+ * }
2633
+ */ ScrollableLegendView.prototype._getPageInfo = function(t) {
2634
+ var e = t.get("scrollDataIndex", true);
2635
+ var i = this.getContentGroup();
2636
+ var r = this._containerGroup.__rectSize;
2637
+ var a = t.getOrient().index;
2638
+ var n = Pe[a];
2639
+ var o = ke[a];
2640
+ var s = this._findTargetItemIndex(e);
2641
+ var l = i.children();
2642
+ var c = l[s];
2643
+ var h = l.length;
2644
+ var u = !h ? 0 : 1;
2645
+ var v = {
2646
+ contentPosition: [ i.x, i.y ],
2647
+ pageCount: u,
2648
+ pageIndex: u - 1,
2649
+ pagePrevDataIndex: null,
2650
+ pageNextDataIndex: null
2651
+ };
2652
+ if (!c) {
2653
+ return v;
2654
+ }
2655
+ var d = getItemInfo(c);
2656
+ v.contentPosition[a] = -d.s;
2657
+ // Strategy:
2658
+ // (1) Always align based on the left/top most item.
2659
+ // (2) It is user-friendly that the last item shown in the
2660
+ // current window is shown at the begining of next window.
2661
+ // Otherwise if half of the last item is cut by the window,
2662
+ // it will have no chance to display entirely.
2663
+ // (3) Consider that item size probably be different, we
2664
+ // have calculate pageIndex by size rather than item index,
2665
+ // and we can not get page index directly by division.
2666
+ // (4) The window is to narrow to contain more than
2667
+ // one item, we should make sure that the page can be fliped.
2668
+ for (var f = s + 1, p = d, g = d, b = null; f <= h; ++f) {
2669
+ b = getItemInfo(l[f]);
2670
+ if (
2671
+ // Half of the last item is out of the window.
2672
+ !b && g.e > p.s + r || b && !intersect(b, p.s)) {
2673
+ if (g.i > p.i) {
2674
+ p = g;
2675
+ } else {
2676
+ // e.g., when page size is smaller than item size.
2677
+ p = b;
2678
+ }
2679
+ if (p) {
2680
+ if (v.pageNextDataIndex == null) {
2681
+ v.pageNextDataIndex = p.i;
2682
+ }
2683
+ ++v.pageCount;
2684
+ }
2685
+ }
2686
+ g = b;
2687
+ }
2688
+ for (var f = s - 1, p = d, g = d, b = null; f >= -1; --f) {
2689
+ b = getItemInfo(l[f]);
2690
+ if (
2691
+ // If the the end item does not intersect with the window started
2692
+ // from the current item, a page can be settled.
2693
+ (!b || !intersect(g, b.s)) && p.i < g.i) {
2694
+ g = p;
2695
+ if (v.pagePrevDataIndex == null) {
2696
+ v.pagePrevDataIndex = p.i;
2697
+ }
2698
+ ++v.pageCount;
2699
+ ++v.pageIndex;
2700
+ }
2701
+ p = b;
2702
+ }
2703
+ return v;
2704
+ function getItemInfo(t) {
2705
+ if (t) {
2706
+ var e = t.getBoundingRect();
2707
+ var i = e[o] + t[o];
2708
+ return {
2709
+ s: i,
2710
+ e: i + e[n],
2711
+ i: t.__legendDataIndex
2712
+ };
2713
+ }
2714
+ }
2715
+ function intersect(t, e) {
2716
+ return t.e >= e && t.s <= e + r;
2717
+ }
2718
+ };
2719
+ ScrollableLegendView.prototype._findTargetItemIndex = function(t) {
2720
+ if (!this._showController) {
2721
+ return 0;
2722
+ }
2723
+ var e;
2724
+ var i = this.getContentGroup();
2725
+ var r;
2726
+ i.eachChild((function(i, a) {
2727
+ var n = i.__legendDataIndex;
2728
+ // FIXME
2729
+ // If the given targetDataIndex (from model) is illegal,
2730
+ // we use defaultIndex. But the index on the legend model and
2731
+ // action payload is still illegal. That case will not be
2732
+ // changed until some scenario requires.
2733
+ if (r == null && n != null) {
2734
+ r = a;
2735
+ }
2736
+ if (n === t) {
2737
+ e = a;
2738
+ }
2739
+ }));
2740
+ return e != null ? e : r;
2741
+ };
2742
+ ScrollableLegendView.type = "legend.scroll";
2743
+ return ScrollableLegendView;
2744
+ }(Le);
2745
+
2746
+ const De = Ve;
2747
+
2748
+ /*
2749
+ * Licensed to the Apache Software Foundation (ASF) under one
2750
+ * or more contributor license agreements. See the NOTICE file
2751
+ * distributed with this work for additional information
2752
+ * regarding copyright ownership. The ASF licenses this file
2753
+ * to you under the Apache License, Version 2.0 (the
2754
+ * "License"); you may not use this file except in compliance
2755
+ * with the License. You may obtain a copy of the License at
2756
+ *
2757
+ * http://www.apache.org/licenses/LICENSE-2.0
2758
+ *
2759
+ * Unless required by applicable law or agreed to in writing,
2760
+ * software distributed under the License is distributed on an
2761
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2762
+ * KIND, either express or implied. See the License for the
2763
+ * specific language governing permissions and limitations
2764
+ * under the License.
2765
+ */
2766
+ /**
2767
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
2768
+ */
2769
+ /*
2770
+ * Licensed to the Apache Software Foundation (ASF) under one
2771
+ * or more contributor license agreements. See the NOTICE file
2772
+ * distributed with this work for additional information
2773
+ * regarding copyright ownership. The ASF licenses this file
2774
+ * to you under the Apache License, Version 2.0 (the
2775
+ * "License"); you may not use this file except in compliance
2776
+ * with the License. You may obtain a copy of the License at
2777
+ *
2778
+ * http://www.apache.org/licenses/LICENSE-2.0
2779
+ *
2780
+ * Unless required by applicable law or agreed to in writing,
2781
+ * software distributed under the License is distributed on an
2782
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2783
+ * KIND, either express or implied. See the License for the
2784
+ * specific language governing permissions and limitations
2785
+ * under the License.
2786
+ */ function installScrollableLegendAction(t) {
2787
+ /**
2788
+ * @event legendScroll
2789
+ * @type {Object}
2790
+ * @property {string} type 'legendScroll'
2791
+ * @property {string} scrollDataIndex
2792
+ */
2793
+ t.registerAction("legendScroll", "legendscroll", (function(t, e) {
2794
+ var i = t.scrollDataIndex;
2795
+ i != null && e.eachComponent({
2796
+ mainType: "legend",
2797
+ subType: "scroll",
2798
+ query: t
2799
+ }, (function(t) {
2800
+ t.setScrollDataIndex(i);
2801
+ }));
2802
+ }));
2803
+ }
2804
+
2805
+ function install$2(t) {
2806
+ tt(install$3);
2807
+ t.registerComponentModel(Ie);
2808
+ t.registerComponentView(De);
2809
+ installScrollableLegendAction(t);
2810
+ }
2811
+
2812
+ function install$1(t) {
2813
+ tt(install$3);
2814
+ tt(install$2);
2815
+ }
2816
+
2817
+ var ze = Math.PI * 2;
2818
+
2819
+ var Oe = Math.PI / 180;
2820
+
2821
+ function getViewRect(t, e) {
2822
+ return _(t.getBoxLayoutParams(), {
2823
+ width: e.getWidth(),
2824
+ height: e.getHeight()
2825
+ });
2826
+ }
2827
+
2828
+ function getBasicPieLayout(t, e) {
2829
+ var i = getViewRect(t, e);
2830
+ // center can be string or number when coordinateSystem is specified
2831
+ var r = t.get("center");
2832
+ var a = t.get("radius");
2833
+ if (!w(a)) {
2834
+ a = [ 0, a ];
2835
+ }
2836
+ var n = E(i.width, e.getWidth());
2837
+ var o = E(i.height, e.getHeight());
2838
+ var s = Math.min(n, o);
2839
+ var l = E(a[0], s / 2);
2840
+ var c = E(a[1], s / 2);
2841
+ var h;
2842
+ var u;
2843
+ var v = t.coordinateSystem;
2844
+ if (v) {
2845
+ // percentage is not allowed when coordinate system is specified
2846
+ var d = v.dataToPoint(r);
2847
+ h = d[0] || 0;
2848
+ u = d[1] || 0;
2849
+ } else {
2850
+ if (!w(r)) {
2851
+ r = [ r, r ];
2852
+ }
2853
+ h = E(r[0], n) + i.x;
2854
+ u = E(r[1], o) + i.y;
2855
+ }
2856
+ return {
2857
+ cx: h,
2858
+ cy: u,
2859
+ r0: l,
2860
+ r: c
2861
+ };
2862
+ }
2863
+
2864
+ function pieLayout(t, e, i) {
2865
+ e.eachSeriesByType(t, (function(t) {
2866
+ var e = t.getData();
2867
+ var r = e.mapDimension("value");
2868
+ var a = getViewRect(t, i);
2869
+ var n = getBasicPieLayout(t, i), o = n.cx, s = n.cy, l = n.r, c = n.r0;
2870
+ var h = -t.get("startAngle") * Oe;
2871
+ var u = t.get("endAngle");
2872
+ var v = t.get("padAngle") * Oe;
2873
+ u = u === "auto" ? h - ze : -u * Oe;
2874
+ var d = t.get("minAngle") * Oe;
2875
+ var f = d + v;
2876
+ var p = 0;
2877
+ e.each(r, (function(t) {
2878
+ !isNaN(t) && p++;
2879
+ }));
2880
+ var g = e.getSum(r);
2881
+ // Sum may be 0
2882
+ var b = Math.PI / (g || p) * 2;
2883
+ var m = t.get("clockwise");
2884
+ var w = t.get("roseType");
2885
+ var y = t.get("stillShowZeroSum");
2886
+ // [0...max]
2887
+ var x = e.getDataExtent(r);
2888
+ x[0] = 0;
2889
+ var S = m ? 1 : -1;
2890
+ var T = [ h, u ];
2891
+ var M = S * v / 2;
2892
+ It(T, !m);
2893
+ h = T[0], u = T[1];
2894
+ var L = Ne(t);
2895
+ L.startAngle = h;
2896
+ L.endAngle = u;
2897
+ L.clockwise = m;
2898
+ var C = Math.abs(u - h);
2899
+ // In the case some sector angle is smaller than minAngle
2900
+ var I = C;
2901
+ var A = 0;
2902
+ var P = h;
2903
+ e.setLayout({
2904
+ viewRect: a,
2905
+ r: l
2906
+ });
2907
+ e.each(r, (function(t, i) {
2908
+ var r;
2909
+ if (isNaN(t)) {
2910
+ e.setItemLayout(i, {
2911
+ angle: NaN,
2912
+ startAngle: NaN,
2913
+ endAngle: NaN,
2914
+ clockwise: m,
2915
+ cx: o,
2916
+ cy: s,
2917
+ r0: c,
2918
+ r: w ? NaN : l
2919
+ });
2920
+ return;
2921
+ }
2922
+ // FIXME 兼容 2.0 但是 roseType 是 area 的时候才是这样?
2923
+ if (w !== "area") {
2924
+ r = g === 0 && y ? b : t * b;
2925
+ } else {
2926
+ r = C / p;
2927
+ }
2928
+ if (r < f) {
2929
+ r = f;
2930
+ I -= f;
2931
+ } else {
2932
+ A += t;
2933
+ }
2934
+ var a = P + S * r;
2935
+ // calculate display angle
2936
+ var n = 0;
2937
+ var h = 0;
2938
+ if (v > r) {
2939
+ n = P + S * r / 2;
2940
+ h = n;
2941
+ } else {
2942
+ n = P + M;
2943
+ h = a - M;
2944
+ }
2945
+ e.setItemLayout(i, {
2946
+ angle: r,
2947
+ startAngle: n,
2948
+ endAngle: h,
2949
+ clockwise: m,
2950
+ cx: o,
2951
+ cy: s,
2952
+ r0: c,
2953
+ r: w ? At(t, x, [ c, l ]) : l
2954
+ });
2955
+ P = a;
2956
+ }));
2957
+ // Some sector is constrained by minAngle and padAngle
2958
+ // Rest sectors needs recalculate angle
2959
+ if (I < ze && p) {
2960
+ // Average the angle if rest angle is not enough after all angles is
2961
+ // Constrained by minAngle and padAngle
2962
+ if (I <= .001) {
2963
+ var k = C / p;
2964
+ e.each(r, (function(t, i) {
2965
+ if (!isNaN(t)) {
2966
+ var r = e.getItemLayout(i);
2967
+ r.angle = k;
2968
+ var a = 0;
2969
+ var n = 0;
2970
+ if (k < v) {
2971
+ a = h + S * (i + 1 / 2) * k;
2972
+ n = a;
2973
+ } else {
2974
+ a = h + S * i * k + M;
2975
+ n = h + S * (i + 1) * k - M;
2976
+ }
2977
+ r.startAngle = a;
2978
+ r.endAngle = n;
2979
+ }
2980
+ }));
2981
+ } else {
2982
+ b = I / A;
2983
+ P = h;
2984
+ e.each(r, (function(t, i) {
2985
+ if (!isNaN(t)) {
2986
+ var r = e.getItemLayout(i);
2987
+ var a = r.angle === f ? f : t * b;
2988
+ var n = 0;
2989
+ var o = 0;
2990
+ if (a < v) {
2991
+ n = P + S * a / 2;
2992
+ o = n;
2993
+ } else {
2994
+ n = P + M;
2995
+ o = P + S * a - M;
2996
+ }
2997
+ r.startAngle = n;
2998
+ r.endAngle = o;
2999
+ P += S * a;
3000
+ }
3001
+ }));
3002
+ }
3003
+ }
3004
+ }));
3005
+ }
3006
+
3007
+ var Ne = Pt();
3008
+
3009
+ /*
3010
+ * Licensed to the Apache Software Foundation (ASF) under one
3011
+ * or more contributor license agreements. See the NOTICE file
3012
+ * distributed with this work for additional information
3013
+ * regarding copyright ownership. The ASF licenses this file
3014
+ * to you under the Apache License, Version 2.0 (the
3015
+ * "License"); you may not use this file except in compliance
3016
+ * with the License. You may obtain a copy of the License at
3017
+ *
3018
+ * http://www.apache.org/licenses/LICENSE-2.0
3019
+ *
3020
+ * Unless required by applicable law or agreed to in writing,
3021
+ * software distributed under the License is distributed on an
3022
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3023
+ * KIND, either express or implied. See the License for the
3024
+ * specific language governing permissions and limitations
3025
+ * under the License.
3026
+ */
3027
+ /**
3028
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
3029
+ */
3030
+ /*
3031
+ * Licensed to the Apache Software Foundation (ASF) under one
3032
+ * or more contributor license agreements. See the NOTICE file
3033
+ * distributed with this work for additional information
3034
+ * regarding copyright ownership. The ASF licenses this file
3035
+ * to you under the Apache License, Version 2.0 (the
3036
+ * "License"); you may not use this file except in compliance
3037
+ * with the License. You may obtain a copy of the License at
3038
+ *
3039
+ * http://www.apache.org/licenses/LICENSE-2.0
3040
+ *
3041
+ * Unless required by applicable law or agreed to in writing,
3042
+ * software distributed under the License is distributed on an
3043
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3044
+ * KIND, either express or implied. See the License for the
3045
+ * specific language governing permissions and limitations
3046
+ * under the License.
3047
+ */ function dataFilter(t) {
3048
+ return {
3049
+ seriesType: t,
3050
+ reset: function(t, e) {
3051
+ var i = e.findComponents({
3052
+ mainType: "legend"
3053
+ });
3054
+ if (!i || !i.length) {
3055
+ return;
3056
+ }
3057
+ var r = t.getData();
3058
+ r.filterSelf((function(t) {
3059
+ var e = r.getName(t);
3060
+ // If in any legend component the status is not selected.
3061
+ for (var a = 0; a < i.length; a++) {
3062
+ // @ts-ignore FIXME: LegendModel
3063
+ if (!i[a].isSelected(e)) {
3064
+ return false;
3065
+ }
3066
+ }
3067
+ return true;
3068
+ }));
3069
+ }
3070
+ };
3071
+ }
3072
+
3073
+ var Re = Math.PI / 180;
3074
+
3075
+ function adjustSingleSide(t, e, i, r, a, n, o, s, l, c) {
3076
+ if (t.length < 2) {
3077
+ return;
3078
+ }
3079
+ function recalculateXOnSemiToAlignOnEllipseCurve(t) {
3080
+ var n = t.rB;
3081
+ var o = n * n;
3082
+ for (var s = 0; s < t.list.length; s++) {
3083
+ var l = t.list[s];
3084
+ var c = Math.abs(l.label.y - i);
3085
+ // horizontal r is always same with original r because x is not changed.
3086
+ var h = r + l.len;
3087
+ var u = h * h;
3088
+ // Use ellipse implicit function to calculate x
3089
+ var v = Math.sqrt((1 - Math.abs(c * c / o)) * u);
3090
+ var d = e + (v + l.len2) * a;
3091
+ var f = d - l.label.x;
3092
+ var p = l.targetTextWidth - f * a;
3093
+ // text x is changed, so need to recalculate width.
3094
+ constrainTextWidth(l, p, true);
3095
+ l.label.x = d;
3096
+ }
3097
+ }
3098
+ // Adjust X based on the shifted y. Make tight labels aligned on an ellipse curve.
3099
+ function recalculateX(t) {
3100
+ // Extremes of
3101
+ var n = {
3102
+ list: [],
3103
+ maxY: 0
3104
+ };
3105
+ var o = {
3106
+ list: [],
3107
+ maxY: 0
3108
+ };
3109
+ for (var s = 0; s < t.length; s++) {
3110
+ if (t[s].labelAlignTo !== "none") {
3111
+ continue;
3112
+ }
3113
+ var l = t[s];
3114
+ var c = l.label.y > i ? o : n;
3115
+ var h = Math.abs(l.label.y - i);
3116
+ if (h >= c.maxY) {
3117
+ var u = l.label.x - e - l.len2 * a;
3118
+ // horizontal r is always same with original r because x is not changed.
3119
+ var v = r + l.len;
3120
+ // Canculate rB based on the topest / bottemest label.
3121
+ var d = Math.abs(u) < v ? Math.sqrt(h * h / (1 - u * u / v / v)) : v;
3122
+ c.rB = d;
3123
+ c.maxY = h;
3124
+ }
3125
+ c.list.push(l);
3126
+ }
3127
+ recalculateXOnSemiToAlignOnEllipseCurve(n);
3128
+ recalculateXOnSemiToAlignOnEllipseCurve(o);
3129
+ }
3130
+ var h = t.length;
3131
+ for (var u = 0; u < h; u++) {
3132
+ if (t[u].position === "outer" && t[u].labelAlignTo === "labelLine") {
3133
+ var v = t[u].label.x - c;
3134
+ t[u].linePoints[1][0] += v;
3135
+ t[u].label.x = c;
3136
+ }
3137
+ }
3138
+ if (Vt(t, l, l + o)) {
3139
+ recalculateX(t);
3140
+ }
3141
+ }
3142
+
3143
+ function avoidOverlap(t, e, i, r, a, n, o, s) {
3144
+ var l = [];
3145
+ var c = [];
3146
+ var h = Number.MAX_VALUE;
3147
+ var u = -Number.MAX_VALUE;
3148
+ for (var v = 0; v < t.length; v++) {
3149
+ var d = t[v].label;
3150
+ if (isPositionCenter(t[v])) {
3151
+ continue;
3152
+ }
3153
+ if (d.x < e) {
3154
+ h = Math.min(h, d.x);
3155
+ l.push(t[v]);
3156
+ } else {
3157
+ u = Math.max(u, d.x);
3158
+ c.push(t[v]);
3159
+ }
3160
+ }
3161
+ for (var v = 0; v < t.length; v++) {
3162
+ var f = t[v];
3163
+ if (!isPositionCenter(f) && f.linePoints) {
3164
+ if (f.labelStyleWidth != null) {
3165
+ continue;
3166
+ }
3167
+ var d = f.label;
3168
+ var p = f.linePoints;
3169
+ var g = void 0;
3170
+ if (f.labelAlignTo === "edge") {
3171
+ if (d.x < e) {
3172
+ g = p[2][0] - f.labelDistance - o - f.edgeDistance;
3173
+ } else {
3174
+ g = o + a - f.edgeDistance - p[2][0] - f.labelDistance;
3175
+ }
3176
+ } else if (f.labelAlignTo === "labelLine") {
3177
+ if (d.x < e) {
3178
+ g = h - o - f.bleedMargin;
3179
+ } else {
3180
+ g = o + a - u - f.bleedMargin;
3181
+ }
3182
+ } else {
3183
+ if (d.x < e) {
3184
+ g = d.x - o - f.bleedMargin;
3185
+ } else {
3186
+ g = o + a - d.x - f.bleedMargin;
3187
+ }
3188
+ }
3189
+ f.targetTextWidth = g;
3190
+ constrainTextWidth(f, g);
3191
+ }
3192
+ }
3193
+ adjustSingleSide(c, e, i, r, 1, a, n, o, s, u);
3194
+ adjustSingleSide(l, e, i, r, -1, a, n, o, s, h);
3195
+ for (var v = 0; v < t.length; v++) {
3196
+ var f = t[v];
3197
+ if (!isPositionCenter(f) && f.linePoints) {
3198
+ var d = f.label;
3199
+ var p = f.linePoints;
3200
+ var b = f.labelAlignTo === "edge";
3201
+ var m = d.style.padding;
3202
+ var w = m ? m[1] + m[3] : 0;
3203
+ // textRect.width already contains paddingH if bgColor is set
3204
+ var y = d.style.backgroundColor ? 0 : w;
3205
+ var x = f.rect.width + y;
3206
+ var S = p[1][0] - p[2][0];
3207
+ if (b) {
3208
+ if (d.x < e) {
3209
+ p[2][0] = o + f.edgeDistance + x + f.labelDistance;
3210
+ } else {
3211
+ p[2][0] = o + a - f.edgeDistance - x - f.labelDistance;
3212
+ }
3213
+ } else {
3214
+ if (d.x < e) {
3215
+ p[2][0] = d.x + f.labelDistance;
3216
+ } else {
3217
+ p[2][0] = d.x - f.labelDistance;
3218
+ }
3219
+ p[1][0] = p[2][0] + S;
3220
+ }
3221
+ p[1][1] = p[2][1] = d.y;
3222
+ }
3223
+ }
3224
+ }
3225
+
3226
+ /**
3227
+ * Set max width of each label, and then wrap each label to the max width.
3228
+ *
3229
+ * @param layout label layout
3230
+ * @param availableWidth max width for the label to display
3231
+ * @param forceRecalculate recaculate the text layout even if the current width
3232
+ * is smaller than `availableWidth`. This is useful when the text was previously
3233
+ * wrapped by calling `constrainTextWidth` but now `availableWidth` changed, in
3234
+ * which case, previous wrapping should be redo.
3235
+ */ function constrainTextWidth(t, e, i) {
3236
+ if (i === void 0) {
3237
+ i = false;
3238
+ }
3239
+ if (t.labelStyleWidth != null) {
3240
+ // User-defined style.width has the highest priority.
3241
+ return;
3242
+ }
3243
+ var r = t.label;
3244
+ var a = r.style;
3245
+ var n = t.rect;
3246
+ var o = a.backgroundColor;
3247
+ var s = a.padding;
3248
+ var l = s ? s[1] + s[3] : 0;
3249
+ var c = a.overflow;
3250
+ // textRect.width already contains paddingH if bgColor is set
3251
+ var h = n.width + (o ? 0 : l);
3252
+ if (e < h || i) {
3253
+ var u = n.height;
3254
+ if (c && c.match("break")) {
3255
+ // Temporarily set background to be null to calculate
3256
+ // the bounding box without background.
3257
+ r.setStyle("backgroundColor", null);
3258
+ // Set constraining width
3259
+ r.setStyle("width", e - l);
3260
+ // This is the real bounding box of the text without padding.
3261
+ var v = r.getBoundingRect();
3262
+ r.setStyle("width", Math.ceil(v.width));
3263
+ r.setStyle("backgroundColor", o);
3264
+ } else {
3265
+ var d = e - l;
3266
+ var f = e < h ? d :
3267
+ // Current available width is enough, but the text may have
3268
+ // already been wrapped with a smaller available width.
3269
+ i ? d > t.unconstrainedWidth ? null : d : null;
3270
+ r.setStyle("width", f);
3271
+ }
3272
+ var p = r.getBoundingRect();
3273
+ n.width = p.width;
3274
+ var g = (r.style.margin || 0) + 2.1;
3275
+ n.height = p.height + g;
3276
+ n.y -= (n.height - u) / 2;
3277
+ }
3278
+ }
3279
+
3280
+ function isPositionCenter(t) {
3281
+ // Not change x for center label
3282
+ return t.position === "center";
3283
+ }
3284
+
3285
+ function pieLabelLayout(t) {
3286
+ var e = t.getData();
3287
+ var i = [];
3288
+ var r;
3289
+ var a;
3290
+ var n = false;
3291
+ var o = (t.get("minShowLabelAngle") || 0) * Re;
3292
+ var s = e.getLayout("viewRect");
3293
+ var l = e.getLayout("r");
3294
+ var c = s.width;
3295
+ var h = s.x;
3296
+ var u = s.y;
3297
+ var v = s.height;
3298
+ function setNotShow(t) {
3299
+ t.ignore = true;
3300
+ }
3301
+ function isLabelShown(t) {
3302
+ if (!t.ignore) {
3303
+ return true;
3304
+ }
3305
+ for (var e in t.states) {
3306
+ if (t.states[e].ignore === false) {
3307
+ return true;
3308
+ }
3309
+ }
3310
+ return false;
3311
+ }
3312
+ e.each((function(t) {
3313
+ var s = e.getItemGraphicEl(t);
3314
+ var u = s.shape;
3315
+ var v = s.getTextContent();
3316
+ var d = s.getTextGuideLine();
3317
+ var f = e.getItemModel(t);
3318
+ var p = f.getModel("label");
3319
+ // Use position in normal or emphasis
3320
+ var g = p.get("position") || f.get([ "emphasis", "label", "position" ]);
3321
+ var b = p.get("distanceToLabelLine");
3322
+ var m = p.get("alignTo");
3323
+ var w = E(p.get("edgeDistance"), c);
3324
+ var x = p.get("bleedMargin");
3325
+ var S = f.getModel("labelLine");
3326
+ var T = S.get("length");
3327
+ T = E(T, c);
3328
+ var M = S.get("length2");
3329
+ M = E(M, c);
3330
+ if (Math.abs(u.endAngle - u.startAngle) < o) {
3331
+ y(v.states, setNotShow);
3332
+ v.ignore = true;
3333
+ if (d) {
3334
+ y(d.states, setNotShow);
3335
+ d.ignore = true;
3336
+ }
3337
+ return;
3338
+ }
3339
+ if (!isLabelShown(v)) {
3340
+ return;
3341
+ }
3342
+ var L = (u.startAngle + u.endAngle) / 2;
3343
+ var C = Math.cos(L);
3344
+ var I = Math.sin(L);
3345
+ var A;
3346
+ var P;
3347
+ var k;
3348
+ var V;
3349
+ r = u.cx;
3350
+ a = u.cy;
3351
+ var D = g === "inside" || g === "inner";
3352
+ if (g === "center") {
3353
+ A = u.cx;
3354
+ P = u.cy;
3355
+ V = "center";
3356
+ } else {
3357
+ var z = (D ? (u.r + u.r0) / 2 * C : u.r * C) + r;
3358
+ var O = (D ? (u.r + u.r0) / 2 * I : u.r * I) + a;
3359
+ A = z + C * 3;
3360
+ P = O + I * 3;
3361
+ if (!D) {
3362
+ // For roseType
3363
+ var N = z + C * (T + l - u.r);
3364
+ var R = O + I * (T + l - u.r);
3365
+ var B = N + (C < 0 ? -1 : 1) * M;
3366
+ var H = R;
3367
+ if (m === "edge") {
3368
+ // Adjust textX because text align of edge is opposite
3369
+ A = C < 0 ? h + w : h + c - w;
3370
+ } else {
3371
+ A = B + (C < 0 ? -b : b);
3372
+ }
3373
+ P = H;
3374
+ k = [ [ z, O ], [ N, R ], [ B, H ] ];
3375
+ }
3376
+ V = D ? "center" : m === "edge" ? C > 0 ? "right" : "left" : C > 0 ? "left" : "right";
3377
+ }
3378
+ var W = Math.PI;
3379
+ var U = 0;
3380
+ var F = p.get("rotate");
3381
+ if (lt(F)) {
3382
+ U = F * (W / 180);
3383
+ } else if (g === "center") {
3384
+ U = 0;
3385
+ } else if (F === "radial" || F === true) {
3386
+ var j = C < 0 ? -L + W : -L;
3387
+ U = j;
3388
+ } else if (F === "tangential" && g !== "outside" && g !== "outer") {
3389
+ var $ = Math.atan2(C, I);
3390
+ if ($ < 0) {
3391
+ $ = W * 2 + $;
3392
+ }
3393
+ var X = I > 0;
3394
+ if (X) {
3395
+ $ = W + $;
3396
+ }
3397
+ U = $ - W;
3398
+ }
3399
+ n = !!U;
3400
+ v.x = A;
3401
+ v.y = P;
3402
+ v.rotation = U;
3403
+ v.setStyle({
3404
+ verticalAlign: "middle"
3405
+ });
3406
+ // Not sectorShape the inside label
3407
+ if (!D) {
3408
+ var G = v.getBoundingRect().clone();
3409
+ G.applyTransform(v.getComputedTransform());
3410
+ // Text has a default 1px stroke. Exclude this.
3411
+ var Y = (v.style.margin || 0) + 2.1;
3412
+ G.y -= Y / 2;
3413
+ G.height += Y;
3414
+ i.push({
3415
+ label: v,
3416
+ labelLine: d,
3417
+ position: g,
3418
+ len: T,
3419
+ len2: M,
3420
+ minTurnAngle: S.get("minTurnAngle"),
3421
+ maxSurfaceAngle: S.get("maxSurfaceAngle"),
3422
+ surfaceNormal: new kt(C, I),
3423
+ linePoints: k,
3424
+ textAlign: V,
3425
+ labelDistance: b,
3426
+ labelAlignTo: m,
3427
+ edgeDistance: w,
3428
+ bleedMargin: x,
3429
+ rect: G,
3430
+ unconstrainedWidth: G.width,
3431
+ labelStyleWidth: v.style.width
3432
+ });
3433
+ } else {
3434
+ v.setStyle({
3435
+ align: V
3436
+ });
3437
+ var _ = v.states.select;
3438
+ if (_) {
3439
+ _.x += v.x;
3440
+ _.y += v.y;
3441
+ }
3442
+ }
3443
+ s.setTextConfig({
3444
+ inside: D
3445
+ });
3446
+ }));
3447
+ if (!n && t.get("avoidLabelOverlap")) {
3448
+ avoidOverlap(i, r, a, l, c, v, h, u);
3449
+ }
3450
+ for (var d = 0; d < i.length; d++) {
3451
+ var f = i[d];
3452
+ var p = f.label;
3453
+ var g = f.labelLine;
3454
+ var b = isNaN(p.x) || isNaN(p.y);
3455
+ if (p) {
3456
+ p.setStyle({
3457
+ align: f.textAlign
3458
+ });
3459
+ if (b) {
3460
+ y(p.states, setNotShow);
3461
+ p.ignore = true;
3462
+ }
3463
+ var m = p.states.select;
3464
+ if (m) {
3465
+ m.x += p.x;
3466
+ m.y += p.y;
3467
+ }
3468
+ }
3469
+ if (g) {
3470
+ var w = f.linePoints;
3471
+ if (b || !w) {
3472
+ y(g.states, setNotShow);
3473
+ g.ignore = true;
3474
+ } else {
3475
+ Qt(w, f.minTurnAngle);
3476
+ te(w, f.surfaceNormal, f.maxSurfaceAngle);
3477
+ g.setShape({
3478
+ points: w
3479
+ });
3480
+ // Set the anchor to the midpoint of sector
3481
+ p.__hostTarget.textGuideLineConfig = {
3482
+ anchor: new kt(w[0][0], w[0][1])
3483
+ };
3484
+ }
3485
+ }
3486
+ }
3487
+ }
3488
+
3489
+ /**
3490
+ * Piece of pie including Sector, Label, LabelLine
3491
+ */ var Be = /** @class */ function(t) {
3492
+ h(PiePiece, t);
3493
+ function PiePiece(e, i, r) {
3494
+ var a = t.call(this) || this;
3495
+ a.z2 = 2;
3496
+ var n = new I;
3497
+ a.setTextContent(n);
3498
+ a.updateData(e, i, r, true);
3499
+ return a;
3500
+ }
3501
+ PiePiece.prototype.updateData = function(t, e, i, r) {
3502
+ var a = this;
3503
+ var n = t.hostModel;
3504
+ var o = t.getItemModel(e);
3505
+ var s = o.getModel("emphasis");
3506
+ var l = t.getItemLayout(e);
3507
+ // cornerRadius & innerCornerRadius doesn't exist in the item layout. Use `0` if null value is specified.
3508
+ // see `setItemLayout` in `pieLayout.ts`.
3509
+ var c = F(ee(o.getModel("itemStyle"), l, true), l);
3510
+ // Ignore NaN data.
3511
+ if (isNaN(c.startAngle)) {
3512
+ // Use NaN shape to avoid drawing shape.
3513
+ a.setShape(c);
3514
+ return;
3515
+ }
3516
+ if (r) {
3517
+ a.setShape(c);
3518
+ var h = n.getShallow("animationType");
3519
+ if (n.ecModel.ssr) {
3520
+ // Use scale animation in SSR mode(opacity?)
3521
+ // Because CSS SVG animation doesn't support very customized shape animation.
3522
+ Dt(a, {
3523
+ scaleX: 0,
3524
+ scaleY: 0
3525
+ }, n, {
3526
+ dataIndex: e,
3527
+ isFrom: true
3528
+ });
3529
+ a.originX = c.cx;
3530
+ a.originY = c.cy;
3531
+ } else if (h === "scale") {
3532
+ a.shape.r = l.r0;
3533
+ Dt(a, {
3534
+ shape: {
3535
+ r: l.r
3536
+ }
3537
+ }, n, e);
3538
+ }
3539
+ // Expansion
3540
+ else {
3541
+ if (i != null) {
3542
+ a.setShape({
3543
+ startAngle: i,
3544
+ endAngle: i
3545
+ });
3546
+ Dt(a, {
3547
+ shape: {
3548
+ startAngle: l.startAngle,
3549
+ endAngle: l.endAngle
3550
+ }
3551
+ }, n, e);
3552
+ } else {
3553
+ a.shape.endAngle = l.startAngle;
3554
+ Ct(a, {
3555
+ shape: {
3556
+ endAngle: l.endAngle
3557
+ }
3558
+ }, n, e);
3559
+ }
3560
+ }
3561
+ } else {
3562
+ zt(a);
3563
+ // Transition animation from the old shape
3564
+ Ct(a, {
3565
+ shape: c
3566
+ }, n, e);
3567
+ }
3568
+ a.useStyle(t.getItemVisual(e, "style"));
3569
+ Ot(a, o);
3570
+ var u = (l.startAngle + l.endAngle) / 2;
3571
+ var v = n.get("selectedOffset");
3572
+ var d = Math.cos(u) * v;
3573
+ var f = Math.sin(u) * v;
3574
+ var p = o.getShallow("cursor");
3575
+ p && a.attr("cursor", p);
3576
+ this._updateLabel(n, t, e);
3577
+ a.ensureState("emphasis").shape = F({
3578
+ r: l.r + (s.get("scale") ? s.get("scaleSize") || 0 : 0)
3579
+ }, ee(s.getModel("itemStyle"), l));
3580
+ F(a.ensureState("select"), {
3581
+ x: d,
3582
+ y: f,
3583
+ shape: ee(o.getModel([ "select", "itemStyle" ]), l)
3584
+ });
3585
+ F(a.ensureState("blur"), {
3586
+ shape: ee(o.getModel([ "blur", "itemStyle" ]), l)
3587
+ });
3588
+ var g = a.getTextGuideLine();
3589
+ var b = a.getTextContent();
3590
+ g && F(g.ensureState("select"), {
3591
+ x: d,
3592
+ y: f
3593
+ });
3594
+ // TODO: needs dx, dy in zrender?
3595
+ F(b.ensureState("select"), {
3596
+ x: d,
3597
+ y: f
3598
+ });
3599
+ Nt(this, s.get("focus"), s.get("blurScope"), s.get("disabled"));
3600
+ };
3601
+ PiePiece.prototype._updateLabel = function(t, e, i) {
3602
+ var r = this;
3603
+ var a = e.getItemModel(i);
3604
+ var n = a.getModel("labelLine");
3605
+ var o = e.getItemVisual(i, "style");
3606
+ var s = o && o.fill;
3607
+ var l = o && o.opacity;
3608
+ vt(r, Rt(a), {
3609
+ labelFetcher: e.hostModel,
3610
+ labelDataIndex: i,
3611
+ inheritColor: s,
3612
+ defaultOpacity: l,
3613
+ defaultText: t.getFormattedLabel(i, "normal") || e.getName(i)
3614
+ });
3615
+ var c = r.getTextContent();
3616
+ // Set textConfig on sector.
3617
+ r.setTextConfig({
3618
+ // reset position, rotation
3619
+ position: null,
3620
+ rotation: null
3621
+ });
3622
+ // Make sure update style on labelText after setLabelStyle.
3623
+ // Because setLabelStyle will replace a new style on it.
3624
+ c.attr({
3625
+ z2: 10
3626
+ });
3627
+ var h = t.get([ "label", "position" ]);
3628
+ if (h !== "outside" && h !== "outer") {
3629
+ r.removeTextGuideLine();
3630
+ } else {
3631
+ var u = this.getTextGuideLine();
3632
+ if (!u) {
3633
+ u = new Bt;
3634
+ this.setTextGuideLine(u);
3635
+ }
3636
+ // Default use item visual color
3637
+ ie(this, re(a), {
3638
+ stroke: s,
3639
+ opacity: Ht(n.get([ "lineStyle", "opacity" ]), l, 1)
3640
+ });
3641
+ }
3642
+ };
3643
+ return PiePiece;
3644
+ }(Wt);
3645
+
3646
+ // Pie view
3647
+ var He = /** @class */ function(t) {
3648
+ h(PieView, t);
3649
+ function PieView() {
3650
+ var e = t !== null && t.apply(this, arguments) || this;
3651
+ e.ignoreLabelLineUpdate = true;
3652
+ return e;
3653
+ }
3654
+ PieView.prototype.render = function(t, e, i, r) {
3655
+ var a = t.getData();
3656
+ var n = this._data;
3657
+ var o = this.group;
3658
+ var s;
3659
+ // First render
3660
+ if (!n && a.count() > 0) {
3661
+ var l = a.getItemLayout(0);
3662
+ for (var c = 1; isNaN(l && l.startAngle) && c < a.count(); ++c) {
3663
+ l = a.getItemLayout(c);
3664
+ }
3665
+ if (l) {
3666
+ s = l.startAngle;
3667
+ }
3668
+ }
3669
+ // remove empty-circle if it exists
3670
+ if (this._emptyCircleSector) {
3671
+ o.remove(this._emptyCircleSector);
3672
+ }
3673
+ // when all data are filtered, show lightgray empty circle
3674
+ if (a.count() === 0 && t.get("showEmptyCircle")) {
3675
+ var h = Ne(t);
3676
+ var u = new Wt({
3677
+ shape: F(getBasicPieLayout(t, i), h)
3678
+ });
3679
+ u.useStyle(t.getModel("emptyCircleStyle").getItemStyle());
3680
+ this._emptyCircleSector = u;
3681
+ o.add(u);
3682
+ }
3683
+ a.diff(n).add((function(t) {
3684
+ var e = new Be(a, t, s);
3685
+ a.setItemGraphicEl(t, e);
3686
+ o.add(e);
3687
+ })).update((function(t, e) {
3688
+ var i = n.getItemGraphicEl(e);
3689
+ i.updateData(a, t, s);
3690
+ i.off("click");
3691
+ o.add(i);
3692
+ a.setItemGraphicEl(t, i);
3693
+ })).remove((function(e) {
3694
+ var i = n.getItemGraphicEl(e);
3695
+ Ut(i, t, e);
3696
+ })).execute();
3697
+ pieLabelLayout(t);
3698
+ // Always use initial animation.
3699
+ if (t.get("animationTypeUpdate") !== "expansion") {
3700
+ this._data = a;
3701
+ }
3702
+ };
3703
+ PieView.prototype.dispose = function() {};
3704
+ PieView.prototype.containPoint = function(t, e) {
3705
+ var i = e.getData();
3706
+ var r = i.getItemLayout(0);
3707
+ if (r) {
3708
+ var a = t[0] - r.cx;
3709
+ var n = t[1] - r.cy;
3710
+ var o = Math.sqrt(a * a + n * n);
3711
+ return o <= r.r && o >= r.r0;
3712
+ }
3713
+ };
3714
+ PieView.type = "pie";
3715
+ return PieView;
3716
+ }(Ft);
3717
+
3718
+ const We = He;
3719
+
3720
+ /**
3721
+ * [Usage]:
3722
+ * (1)
3723
+ * createListSimply(seriesModel, ['value']);
3724
+ * (2)
3725
+ * createListSimply(seriesModel, {
3726
+ * coordDimensions: ['value'],
3727
+ * dimensionsCount: 5
3728
+ * });
3729
+ */ function createSeriesDataSimply(t, e, i) {
3730
+ e = w(e) && {
3731
+ coordDimensions: e
3732
+ } || F({
3733
+ encodeDefine: t.getEncode()
3734
+ }, e);
3735
+ var r = t.getSource();
3736
+ var a = jt(r, e).dimensions;
3737
+ var n = new $t(a, t);
3738
+ n.initData(r, i);
3739
+ return n;
3740
+ }
3741
+
3742
+ /*
3743
+ * Licensed to the Apache Software Foundation (ASF) under one
3744
+ * or more contributor license agreements. See the NOTICE file
3745
+ * distributed with this work for additional information
3746
+ * regarding copyright ownership. The ASF licenses this file
3747
+ * to you under the Apache License, Version 2.0 (the
3748
+ * "License"); you may not use this file except in compliance
3749
+ * with the License. You may obtain a copy of the License at
3750
+ *
3751
+ * http://www.apache.org/licenses/LICENSE-2.0
3752
+ *
3753
+ * Unless required by applicable law or agreed to in writing,
3754
+ * software distributed under the License is distributed on an
3755
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3756
+ * KIND, either express or implied. See the License for the
3757
+ * specific language governing permissions and limitations
3758
+ * under the License.
3759
+ */
3760
+ /**
3761
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
3762
+ */
3763
+ /*
3764
+ * Licensed to the Apache Software Foundation (ASF) under one
3765
+ * or more contributor license agreements. See the NOTICE file
3766
+ * distributed with this work for additional information
3767
+ * regarding copyright ownership. The ASF licenses this file
3768
+ * to you under the Apache License, Version 2.0 (the
3769
+ * "License"); you may not use this file except in compliance
3770
+ * with the License. You may obtain a copy of the License at
3771
+ *
3772
+ * http://www.apache.org/licenses/LICENSE-2.0
3773
+ *
3774
+ * Unless required by applicable law or agreed to in writing,
3775
+ * software distributed under the License is distributed on an
3776
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3777
+ * KIND, either express or implied. See the License for the
3778
+ * specific language governing permissions and limitations
3779
+ * under the License.
3780
+ */
3781
+ /**
3782
+ * LegendVisualProvider is an bridge that pick encoded color from data and
3783
+ * provide to the legend component.
3784
+ */ var Ue = /** @class */ function() {
3785
+ function LegendVisualProvider(
3786
+ // Function to get data after filtered. It stores all the encoding info
3787
+ t,
3788
+ // Function to get raw data before filtered.
3789
+ e) {
3790
+ this._getDataWithEncodedVisual = t;
3791
+ this._getRawData = e;
3792
+ }
3793
+ LegendVisualProvider.prototype.getAllNames = function() {
3794
+ var t = this._getRawData();
3795
+ // We find the name from the raw data. In case it's filtered by the legend component.
3796
+ // Normally, the name can be found in rawData, but can't be found in filtered data will display as gray.
3797
+ return t.mapArray(t.getName);
3798
+ };
3799
+ LegendVisualProvider.prototype.containName = function(t) {
3800
+ var e = this._getRawData();
3801
+ return e.indexOfName(t) >= 0;
3802
+ };
3803
+ LegendVisualProvider.prototype.indexOfName = function(t) {
3804
+ // Only get data when necessary.
3805
+ // Because LegendVisualProvider constructor may be new in the stage that data is not prepared yet.
3806
+ // Invoking Series#getData immediately will throw an error.
3807
+ var e = this._getDataWithEncodedVisual();
3808
+ return e.indexOfName(t);
3809
+ };
3810
+ LegendVisualProvider.prototype.getItemVisual = function(t, e) {
3811
+ // Get encoded visual properties from final filtered data.
3812
+ var i = this._getDataWithEncodedVisual();
3813
+ return i.getItemVisual(t, e);
3814
+ };
3815
+ return LegendVisualProvider;
3816
+ }();
3817
+
3818
+ const Fe = Ue;
3819
+
3820
+ var je = Pt();
3821
+
3822
+ var $e = /** @class */ function(t) {
3823
+ h(PieSeriesModel, t);
3824
+ function PieSeriesModel() {
3825
+ return t !== null && t.apply(this, arguments) || this;
3826
+ }
3827
+ /**
3828
+ * @overwrite
3829
+ */ PieSeriesModel.prototype.init = function(e) {
3830
+ t.prototype.init.apply(this, arguments);
3831
+ // Enable legend selection for each data item
3832
+ // Use a function instead of direct access because data reference may changed
3833
+ this.legendVisualProvider = new Fe(x(this.getData, this), x(this.getRawData, this));
3834
+ this._defaultLabelLine(e);
3835
+ };
3836
+ /**
3837
+ * @overwrite
3838
+ */ PieSeriesModel.prototype.mergeOption = function() {
3839
+ t.prototype.mergeOption.apply(this, arguments);
3840
+ };
3841
+ /**
3842
+ * @overwrite
3843
+ */ PieSeriesModel.prototype.getInitialData = function() {
3844
+ return createSeriesDataSimply(this, {
3845
+ coordDimensions: [ "value" ],
3846
+ encodeDefaulter: wt(Xt, this)
3847
+ });
3848
+ };
3849
+ /**
3850
+ * @overwrite
3851
+ */ PieSeriesModel.prototype.getDataParams = function(e) {
3852
+ var i = this.getData();
3853
+ // update seats when data is changed
3854
+ var r = je(i);
3855
+ var a = r.seats;
3856
+ if (!a) {
3857
+ var n = [];
3858
+ i.each(i.mapDimension("value"), (function(t) {
3859
+ n.push(t);
3860
+ }));
3861
+ a = r.seats = Gt(n, i.hostModel.get("percentPrecision"));
3862
+ }
3863
+ var o = t.prototype.getDataParams.call(this, e);
3864
+ // seats may be empty when sum is 0
3865
+ o.percent = a[e] || 0;
3866
+ o.$vars.push("percent");
3867
+ return o;
3868
+ };
3869
+ PieSeriesModel.prototype._defaultLabelLine = function(t) {
3870
+ // Extend labelLine emphasis
3871
+ Yt(t, "labelLine", [ "show" ]);
3872
+ var e = t.labelLine;
3873
+ var i = t.emphasis.labelLine;
3874
+ // Not show label line if `label.normal.show = false`
3875
+ e.show = e.show && t.label.show;
3876
+ i.show = i.show && t.emphasis.label.show;
3877
+ };
3878
+ PieSeriesModel.type = "series.pie";
3879
+ PieSeriesModel.defaultOption = {
3880
+ // zlevel: 0,
3881
+ z: 2,
3882
+ legendHoverLink: true,
3883
+ colorBy: "data",
3884
+ // 默认全局居中
3885
+ center: [ "50%", "50%" ],
3886
+ radius: [ 0, "75%" ],
3887
+ // 默认顺时针
3888
+ clockwise: true,
3889
+ startAngle: 90,
3890
+ endAngle: "auto",
3891
+ padAngle: 0,
3892
+ // 最小角度改为0
3893
+ minAngle: 0,
3894
+ // If the angle of a sector less than `minShowLabelAngle`,
3895
+ // the label will not be displayed.
3896
+ minShowLabelAngle: 0,
3897
+ // 选中时扇区偏移量
3898
+ selectedOffset: 10,
3899
+ // 选择模式,默认关闭,可选single,multiple
3900
+ // selectedMode: false,
3901
+ // 南丁格尔玫瑰图模式,'radius'(半径) | 'area'(面积)
3902
+ // roseType: null,
3903
+ percentPrecision: 2,
3904
+ // If still show when all data zero.
3905
+ stillShowZeroSum: true,
3906
+ // cursor: null,
3907
+ left: 0,
3908
+ top: 0,
3909
+ right: 0,
3910
+ bottom: 0,
3911
+ width: null,
3912
+ height: null,
3913
+ label: {
3914
+ // color: 'inherit',
3915
+ // If rotate around circle
3916
+ rotate: 0,
3917
+ show: true,
3918
+ overflow: "truncate",
3919
+ // 'outer', 'inside', 'center'
3920
+ position: "outer",
3921
+ // 'none', 'labelLine', 'edge'. Works only when position is 'outer'
3922
+ alignTo: "none",
3923
+ // Closest distance between label and chart edge.
3924
+ // Works only position is 'outer' and alignTo is 'edge'.
3925
+ edgeDistance: "25%",
3926
+ // Works only position is 'outer' and alignTo is not 'edge'.
3927
+ bleedMargin: 10,
3928
+ // Distance between text and label line.
3929
+ distanceToLabelLine: 5
3930
+ },
3931
+ // Enabled when label.normal.position is 'outer'
3932
+ labelLine: {
3933
+ show: true,
3934
+ // 引导线两段中的第一段长度
3935
+ length: 15,
3936
+ // 引导线两段中的第二段长度
3937
+ length2: 15,
3938
+ smooth: false,
3939
+ minTurnAngle: 90,
3940
+ maxSurfaceAngle: 90,
3941
+ lineStyle: {
3942
+ // color: 各异,
3943
+ width: 1,
3944
+ type: "solid"
3945
+ }
3946
+ },
3947
+ itemStyle: {
3948
+ borderWidth: 1,
3949
+ borderJoin: "round"
3950
+ },
3951
+ showEmptyCircle: true,
3952
+ emptyCircleStyle: {
3953
+ color: "lightgray",
3954
+ opacity: 1
3955
+ },
3956
+ labelLayout: {
3957
+ // Hide the overlapped label.
3958
+ hideOverlap: true
3959
+ },
3960
+ emphasis: {
3961
+ scale: true,
3962
+ scaleSize: 5
3963
+ },
3964
+ // If use strategy to avoid label overlapping
3965
+ avoidLabelOverlap: true,
3966
+ // Animation type. Valid values: expansion, scale
3967
+ animationType: "expansion",
3968
+ animationDuration: 1e3,
3969
+ // Animation type when update. Valid values: transition, expansion
3970
+ animationTypeUpdate: "transition",
3971
+ animationEasingUpdate: "cubicInOut",
3972
+ animationDurationUpdate: 500,
3973
+ animationEasing: "cubicInOut"
3974
+ };
3975
+ return PieSeriesModel;
3976
+ }(Et);
3977
+
3978
+ const Xe = $e;
3979
+
3980
+ function negativeDataFilter(t) {
3981
+ return {
3982
+ seriesType: t,
3983
+ reset: function(t, e) {
3984
+ var i = t.getData();
3985
+ i.filterSelf((function(t) {
3986
+ // handle negative value condition
3987
+ var e = i.mapDimension("value");
3988
+ var r = i.get(e, t);
3989
+ if (lt(r) && !isNaN(r) && r < 0) {
3990
+ return false;
3991
+ }
3992
+ return true;
3993
+ }));
3994
+ }
3995
+ };
3996
+ }
3997
+
3998
+ function install(t) {
3999
+ t.registerChartView(We);
4000
+ t.registerSeriesModel(Xe);
4001
+ _t("pie", t.registerAction);
4002
+ t.registerLayout(wt(pieLayout, "pie"));
4003
+ t.registerProcessor(dataFilter("pie"));
4004
+ t.registerProcessor(negativeDataFilter("pie"));
4005
+ }
4006
+
4007
+ const Ge = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{position:relative;width:100%;display:block}.container{aspect-ratio:1/1;width:100%;display:flex;justify-content:center;align-items:center;position:relative}.chart-container{width:100%;height:100%;--comp-color-1:var(--tct-chart-donut-color-1, var(--t-chart-donut-color-1, var(--t-accent-1, #e05252)));--comp-color-2:var(--tct-chart-donut-color-2, var(--t-chart-donut-color-2, var(--t-accent-2, #e09952)));--comp-color-3:var(--tct-chart-donut-color-3, var(--t-chart-donut-color-3, var(--t-accent-3, #e0e052)));--comp-color-4:var(--tct-chart-donut-color-4, var(--t-chart-donut-color-4, var(--t-accent-4, #99e052)));--comp-color-5:var(--tct-chart-donut-color-5, var(--t-chart-donut-color-5, var(--t-accent-5, #52e052)));--comp-color-6:var(--tct-chart-donut-color-6, var(--t-chart-donut-color-6, var(--t-accent-6, #52e099)));--comp-color-7:var(--tct-chart-donut-color-7, var(--t-chart-donut-color-7, var(--t-accent-7, #52e0e0)));--comp-color-8:var(--tct-chart-donut-color-8, var(--t-chart-donut-color-8, var(--t-accent-8, #5299e0)));--comp-color-9:var(--tct-chart-donut-color-9, var(--t-chart-donut-color-9, var(--t-accent-9, #5252e0)));--comp-color-10:var(--tct-chart-donut-color-10, var(--t-chart-donut-color-10, var(--t-accent-10, #9952e0)));--comp-color-11:var(--tct-chart-donut-color-11, var(--t-chart-donut-color-11, var(--t-accent-11, #e052e0)));--comp-color-12:var(--tct-chart-donut-color-12, var(--t-chart-donut-color-12, var(--t-accent-12, #e05299)))}.chart-container,.center-card{--comp-background-color:var(--tct-chart-donut-border-color, var(--t-chart-donut-border-color, var(--t-base, #ffffff)))}button{--comp-button-padding:var(--tct-chart-donut-button-padding, var(--tct-chart-donut-button-vertical-padding, var(--t-chart-donut-button-vertical-padding, var(--app-scale-1x, 5px))) 0);transition:box-shadow var(--tct-chart-donut-button-tween, var(--t-chart-donut-button-tween, var(--app-tween-1, 0.2s ease)));padding:var(--comp-button-padding)}button:active{box-shadow:var(--const-double-focus-ring), var(--tct-chart-donut-button-hover-box-shadow, var(--t-chart-donut-button-hover-box-shadow, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14))))}button:hover{box-shadow:var(--tct-chart-donut-button-hover-box-shadow, var(--t-chart-donut-button-hover-box-shadow, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14))))}button:focus{box-shadow:var(--const-double-focus-ring), var(--tct-chart-donut-button-hover-box-shadow, var(--t-chart-donut-button-hover-box-shadow, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14))))}.center-card-container{position:absolute;top:50%;transform:translateY(-50%);padding:var(--tct-chart-donut-button-container-padding, var(--t-chart-donut-button-container-padding, var(--app-scale-1x, 5px)))}.center-card{width:100%;text-align:center;color:var(--tct-chart-donut-text-color, var(--t-chart-donut-text-color, var(--t-text, #4d4d4d)));margin-inline:auto;display:block}.center-card:is(button){cursor:pointer;background:var(--comp-background-color);border:0;border-radius:var(--tct-chart-donut-button-border-radius, var(--t-chart-donut-button-border-radius, var(--app-border-radius-1, 4px)))}q2-icon{--tct-icon-size:var(--tct-chart-donut-icon-size, var(--t-chart-donut-icon-size, 26px));--comp-icon-margin:var(--tct-chart-donut-icon-margin, 0 0 var(--tct-chart-donut-icon-margin-bottom, var(--t-chart-donut-icon-margin-bottom, var(--app-scale-1x, 5px))));margin:var(--comp-icon-margin)}.name{font-size:var(--tct-chart-donut-name-font-size, var(--t-chart-donut-name-font-size, 14px))}.value{font-size:var(--tct-chart-donut-value-font-size, var(--t-chart-donut-value-font-size, 21px))}figure{margin:0}.legend{margin-top:var(--tct-chart-donut-legend-margin-top, var(--app-scale-0x, 0))}";
4008
+
4009
+ const Ye = Ge;
4010
+
4011
+ tt([ install$4, install$1, install, Kt, qt, ae ]);
4012
+
4013
+ const Ee = class {
4014
+ constructor(i) {
4015
+ t(this, i);
4016
+ this.change = e(this, "change", 7);
4017
+ this.click = e(this, "click", 7);
4018
+ this.defaultRecord = {
4019
+ id: null,
4020
+ value: null,
4021
+ name: null
4022
+ };
4023
+ this.onButtonClick = t => {
4024
+ t.stopPropagation();
4025
+ const {selectedId: e} = this;
4026
+ const i = e ? this.getDataById(e) : Object.assign({}, this.defaultRecord);
4027
+ this.click.emit(i);
4028
+ };
4029
+ this.onButtonKeyDown = t => {
4030
+ const {selectedId: e, data: i} = this;
4031
+ let r = this.getIndexById(e) || 0;
4032
+ switch (t.key) {
4033
+ case "ArrowUp":
4034
+ case "ArrowDown":
4035
+ t.preventDefault();
4036
+ break;
4037
+
4038
+ case "ArrowLeft":
4039
+ t.preventDefault();
4040
+ r--;
4041
+ if (r < 0) r = i.length - 1;
4042
+ this.chart.dispatchAction({
4043
+ type: "select",
4044
+ seriesId: "pie",
4045
+ dataIndex: r
4046
+ });
4047
+ break;
4048
+
4049
+ case "ArrowRight":
4050
+ t.preventDefault();
4051
+ r++;
4052
+ if (r > i.length - 1) r = 0;
4053
+ this.chart.dispatchAction({
4054
+ type: "select",
4055
+ seriesId: "pie",
4056
+ dataIndex: r
4057
+ });
4058
+ break;
4059
+
4060
+ case "Escape":
4061
+ this.clearSelection();
4062
+ break;
4063
+
4064
+ case " ":
4065
+ t.preventDefault();
4066
+ break;
4067
+
4068
+ default:
4069
+ return;
4070
+ }
4071
+ };
4072
+ this.onClickElsewhere = t => {
4073
+ t.stopPropagation();
4074
+ this.clearSelection();
4075
+ };
4076
+ this.onContainerClick = t => {
4077
+ if (this.isInChangeEvent) return;
4078
+ if (!(t.target instanceof HTMLElement)) return;
4079
+ this.clearSelection();
4080
+ t.stopPropagation();
4081
+ };
4082
+ this.onLegendClick = t => {
4083
+ t.stopPropagation();
4084
+ if (t.detail) {
4085
+ const e = this.getDataIndexForId(t.detail.id);
4086
+ this.selectedId = t.detail.id;
4087
+ this.chart.dispatchAction({
4088
+ type: "select",
4089
+ seriesIndex: 0,
4090
+ dataIndex: e
4091
+ });
4092
+ } else {
4093
+ const t = this.getDataIndexForId(this.selectedId);
4094
+ this.hoveredId = this.selectedId;
4095
+ this.selectedId = null;
4096
+ this.chart.dispatchAction({
4097
+ type: "unselect",
4098
+ seriesIndex: 0,
4099
+ dataIndex: t
4100
+ });
4101
+ }
4102
+ };
4103
+ this.onLegendMouseenter = t => {
4104
+ const e = this.getDataIndexForId(t.detail.id);
4105
+ this.hoveredId = t.detail.id;
4106
+ this.chart.dispatchAction({
4107
+ type: "highlight",
4108
+ seriesIndex: 0,
4109
+ dataIndex: e
4110
+ });
4111
+ };
4112
+ this.onLegendMouseleave = t => {
4113
+ const e = this.getDataIndexForId(t.detail.id);
4114
+ this.hoveredId = this.selectedId;
4115
+ this.chart.dispatchAction({
4116
+ type: "downplay",
4117
+ seriesIndex: 0,
4118
+ dataIndex: e
4119
+ });
4120
+ };
4121
+ this.hoveredId = undefined;
4122
+ this.legendData = undefined;
4123
+ this.chartName = undefined;
4124
+ this.data = [];
4125
+ this.format = undefined;
4126
+ this.hoverScaleSize = 5;
4127
+ this.innerRadius = "70%";
4128
+ this.isClickable = undefined;
4129
+ this.minSliceSize = "2.5%";
4130
+ this.outerRadius = "85%";
4131
+ this.selectedId = undefined;
4132
+ this.selectedOffset = 10;
4133
+ this.showLegend = false;
4134
+ this.summaryIcon = undefined;
4135
+ this.summaryName = undefined;
4136
+ }
4137
+ // #endregion
4138
+ // #region Component Lifecycle Events
4139
+ disconnectedCallback() {
4140
+ var t;
4141
+ (t = this.resizeObserver) === null || t === void 0 ? void 0 : t.disconnect();
4142
+ this.resizeObserver = null;
4143
+ }
4144
+ componentDidLoad() {
4145
+ const t = Jt(this.chartContainer);
4146
+ this.cacheComputedStyles();
4147
+ this.colors = this.getColors();
4148
+ this.resizeObserver = new ResizeObserver((() => this.resizeChart()));
4149
+ this.resizeObserver.observe(this.hostElement);
4150
+ this.updateChart(t);
4151
+ this.setupChartEvents(t);
4152
+ this.checkSelectedId();
4153
+ this.chart = t;
4154
+ this.setLegendData();
4155
+ this.selectById(this.selectedId);
4156
+ a(this.hostElement);
4157
+ }
4158
+ // #endregion
4159
+ // #region Listeners
4160
+ delegateFocus(t) {
4161
+ var e;
4162
+ if (!n(t, this.hostElement)) return;
4163
+ if (!this.isClickable) return;
4164
+ (e = this.centerButtonElement) === null || e === void 0 ? void 0 : e.focus();
4165
+ }
4166
+ // #endregion
4167
+ // #region Public Methods API
4168
+ /**
4169
+ * Clears any selected slice.
4170
+ */
4171
+ async clearSelection() {
4172
+ const {selectedId: t} = this;
4173
+ if (!t) return;
4174
+ this.chart.dispatchAction({
4175
+ type: "unselect",
4176
+ seriesId: "pie",
4177
+ dataIndex: this.getIndexById(t)
4178
+ });
4179
+ }
4180
+ /**
4181
+ * Returns the chart instance for e2e testing.
4182
+ *
4183
+ * @testOnly
4184
+ */ async getChartOptions() {
4185
+ return this.chart.getOption();
4186
+ }
4187
+ /**
4188
+ * Selects a slice by its provided `id` in the provided `data`.
4189
+ */ async selectById(t) {
4190
+ const e = this.getIndexById(t);
4191
+ if (e === -1) return;
4192
+ this.chart.dispatchAction({
4193
+ type: "select",
4194
+ seriesId: "pie",
4195
+ dataIndex: e
4196
+ });
4197
+ }
4198
+ /**
4199
+ * Selects a slice by its index in the provided `data`.
4200
+ */ async selectByIndex(t) {
4201
+ const e = this.data[t] ? t : null;
4202
+ if (!e) return;
4203
+ this.chart.dispatchAction({
4204
+ type: "select",
4205
+ seriesId: "pie",
4206
+ dataIndex: e
4207
+ });
4208
+ }
4209
+ // #endregion
4210
+ // #region Watchers
4211
+ propsUpdates() {
4212
+ this.updateChart(this.chart);
4213
+ }
4214
+ dataUpdated() {
4215
+ this.colors = this.getColors();
4216
+ this.updateChart(this.chart);
4217
+ this.setLegendData();
4218
+ }
4219
+ innerRadiusUpdated() {
4220
+ const {innerRadius: t, outerRadius: e} = this;
4221
+ const i = parseFloat(t);
4222
+ const r = parseFloat(e);
4223
+ if (i >= r) {
4224
+ this.innerRadius = `${r - 15}%`;
4225
+ }
4226
+ }
4227
+ outerRadiusUpdated() {
4228
+ const {innerRadius: t, outerRadius: e} = this;
4229
+ const i = parseFloat(t);
4230
+ const r = parseFloat(e);
4231
+ if (r <= i) {
4232
+ this.outerRadius = `${i + 15}%`;
4233
+ }
4234
+ }
4235
+ /**
4236
+ * Function to detect and set a data range (category) as selected
4237
+ * Logic for when legends are present, and can set selectedId when ledgend category is clicked
4238
+ * Also can be used by dev to preset
4239
+ */ checkSelectedId() {
4240
+ if (!!this.selectedId) {
4241
+ this.hoveredId = this.selectedId;
4242
+ // Dispatch action only to be fired when chart is rendered
4243
+ if (this.chart) {
4244
+ this.selectById(this.selectedId);
4245
+ }
4246
+ } else {
4247
+ // Dispatch action only to be fired when chart is rendered
4248
+ if (this.chart) {
4249
+ this.chart.dispatchAction({
4250
+ type: "unselect",
4251
+ seriesId: "pie",
4252
+ dataIndex: this.getIndexById(this.hoveredId)
4253
+ });
4254
+ }
4255
+ this.hoveredId = null;
4256
+ }
4257
+ }
4258
+ // #endregion
4259
+ // #region Local Methods
4260
+ get centerData() {
4261
+ const {hoveredId: t, data: e} = this;
4262
+ const i = t;
4263
+ const r = this.getIndexById(i);
4264
+ return i ? Object.assign(Object.assign({}, this.getDataById(i)), {
4265
+ color: this.colors[r]
4266
+ }) : {
4267
+ name: o(this.summaryName || "tecton.element.chartDonut.button.summaryName"),
4268
+ icon: this.summaryIcon,
4269
+ value: e.reduce(((t, e) => t + e.value), 0),
4270
+ color: null
4271
+ };
4272
+ }
4273
+ get isMobile() {
4274
+ return s();
4275
+ }
4276
+ get legendHoveredId() {
4277
+ return this.hoveredId === this.selectedId ? null : this.hoveredId;
4278
+ }
4279
+ cacheComputedStyles() {
4280
+ this.chartContainerStyles = getComputedStyle(this.chartContainer);
4281
+ this.hostElementStyles = getComputedStyle(this.hostElement);
4282
+ }
4283
+ displayValue(t) {
4284
+ const e = parseFloat(t.toString());
4285
+ if (isNaN(e)) return;
4286
+ if (this.format === "currency") {
4287
+ return Intl.NumberFormat("en-US", {
4288
+ style: "currency",
4289
+ currency: "USD"
4290
+ }).format(e);
4291
+ } else {
4292
+ return Intl.NumberFormat("en-US").format(e);
4293
+ }
4294
+ }
4295
+ getColors() {
4296
+ const t = [ 1, 3, 8, 4, 2, 10, 7, 11, 6, 9, 12, 5 ].map((t => `--comp-color-${t}`));
4297
+ return this.data.reduce(((e, i, r) => {
4298
+ let a = t[r % t.length];
4299
+ if (i.color) a = i.color;
4300
+ e.push(Zt(a, this.chartContainerStyles, this.hostElementStyles) || a);
4301
+ return e;
4302
+ }), []);
4303
+ }
4304
+ getCSSProperty(t) {
4305
+ let e;
4306
+ if (t.startsWith("var(") && t.endsWith(")")) {
4307
+ const i = /var\((.*)\)/g;
4308
+ const r = i.exec(t);
4309
+ const a = r.length >= 2 ? r[1].split(",") : [];
4310
+ t = a[0];
4311
+ e = a[1];
4312
+ }
4313
+ let i = this.chartContainerStyles.getPropertyValue(t).trim();
4314
+ if (!i) i = this.hostElementStyles.getPropertyValue(t).trim();
4315
+ return i || e;
4316
+ }
4317
+ getDataById(t) {
4318
+ if (!t) return;
4319
+ return this.data.find((e => e.id === t));
4320
+ }
4321
+ getDataByIndex(t) {
4322
+ if (typeof t !== "number") return;
4323
+ return this.data[t];
4324
+ }
4325
+ getDataIndexForId(t) {
4326
+ return this.data.findIndex((e => e.id === t));
4327
+ }
4328
+ getIndexById(t) {
4329
+ return this.data.findIndex((e => e.id === t));
4330
+ }
4331
+ getMinSliceSizeAsAngle() {
4332
+ return parseFloat(this.minSliceSize) / 100 * 360;
4333
+ }
4334
+ resizeChart() {
4335
+ this.chart.resize();
4336
+ }
4337
+ setLegendData() {
4338
+ const t = this.chart.getOption().series[0].color;
4339
+ this.legendData = this.data.map(((e, i) => {
4340
+ const r = Object.assign({}, e);
4341
+ if (!r.color) r.color = t[i];
4342
+ return r;
4343
+ }));
4344
+ }
4345
+ // Edit with caution. Echarts does not interpret events the same on mobile.
4346
+ setupChartEvents(t) {
4347
+ if (!this.isMobile) {
4348
+ t.on("mouseover", (t => {
4349
+ this.hoveredId = t.data.id;
4350
+ }));
4351
+ t.on("mouseout", (() => {
4352
+ this.hoveredId = this.selectedId;
4353
+ }));
4354
+ }
4355
+ t.on("click", (t => {
4356
+ t.event.stop();
4357
+ }));
4358
+ t.on("selectchanged", (t => {
4359
+ var e, i, r, a;
4360
+ const n = (a = (r = (i = (e = t.selected) === null || e === void 0 ? void 0 : e[0]) === null || i === void 0 ? void 0 : i.dataIndex) === null || r === void 0 ? void 0 : r[0]) !== null && a !== void 0 ? a : null;
4361
+ const o = typeof n === "number" ? this.getDataByIndex(n) : Object.assign({}, this.defaultRecord);
4362
+ this.selectedId = o.id;
4363
+ this.isInChangeEvent = true;
4364
+ this.change.emit(o);
4365
+ setTimeout((() => {
4366
+ this.isInChangeEvent = false;
4367
+ }), 0);
4368
+ }));
4369
+ t.on("finished", (() => {
4370
+ var e;
4371
+ const i = t.getDom().querySelector("canvas");
4372
+ if ((e = i === null || i === void 0 ? void 0 : i.hasAttribute("aria-hidden")) !== null && e !== void 0 ? e : false) return;
4373
+ i.setAttribute("aria-hidden", "true");
4374
+ }));
4375
+ }
4376
+ validateColor() {
4377
+ // check if there is name duplicated, then custom style using `itemStyle` object will be used.
4378
+ if (this.data.length > Object.keys(this.data.reduce(((t, e) => {
4379
+ t[e.name] = e.name;
4380
+ return t;
4381
+ }), {})).length) {
4382
+ this.data.forEach(((t, e) => {
4383
+ t.itemStyle = Object.assign(Object.assign({}, t.itemStyle), {
4384
+ color: t.color || this.colors[e]
4385
+ });
4386
+ }));
4387
+ }
4388
+ }
4389
+ updateChart(t) {
4390
+ this.validateColor();
4391
+ return t.setOption({
4392
+ tooltip: {
4393
+ show: false
4394
+ },
4395
+ legend: {
4396
+ show: false
4397
+ },
4398
+ aria: {
4399
+ enabled: true
4400
+ },
4401
+ series: [ {
4402
+ name: this.chartName,
4403
+ animationType: "scale",
4404
+ color: this.colors,
4405
+ id: "pie",
4406
+ type: "pie",
4407
+ selectedOffset: this.selectedOffset,
4408
+ selectedMode: "single",
4409
+ radius: [ this.innerRadius, this.outerRadius ],
4410
+ label: {
4411
+ show: false
4412
+ },
4413
+ labelLine: {
4414
+ show: false
4415
+ },
4416
+ itemStyle: {
4417
+ borderWidth: 5,
4418
+ borderColor: Zt("--comp-background-color", this.chartContainerStyles, this.hostElementStyles)
4419
+ },
4420
+ emphasis: {
4421
+ disabled: this.isMobile,
4422
+ scaleSize: this.hoverScaleSize,
4423
+ itemStyle: {
4424
+ color: "inherit"
4425
+ }
4426
+ },
4427
+ minAngle: this.getMinSliceSizeAsAngle(),
4428
+ data: this.data
4429
+ } ]
4430
+ });
4431
+ }
4432
+ // #endregion
4433
+ // #region Test Methods API
4434
+ /**
4435
+ * A method to select a slice with index.
4436
+ *
4437
+ * @testOnly
4438
+ */
4439
+ async selectDataPoint(t) {
4440
+ this.chart.dispatchAction({
4441
+ type: "select",
4442
+ seriesId: "pie",
4443
+ dataIndex: t
4444
+ });
4445
+ }
4446
+ // #endregion
4447
+ // #region Render Methods
4448
+ renderCenterBlock() {
4449
+ const {icon: t, name: e, value: r, color: a} = this.centerData;
4450
+ const {isClickable: n} = this;
4451
+ const s = n ? "button" : "div";
4452
+ const l = this.displayValue(r);
4453
+ const c = n ? {
4454
+ onKeyDown: this.onButtonKeyDown,
4455
+ onClick: this.onButtonClick,
4456
+ ref: t => this.centerButtonElement = t,
4457
+ "aria-describedby": "center-card-description",
4458
+ "aria-roledescription": o("tecton.element.chartDonut.button.roleDescription")
4459
+ } : null;
4460
+ return i("div", {
4461
+ class: "center-card-container",
4462
+ style: {
4463
+ width: `calc(${this.innerRadius} - 10%)`
4464
+ }
4465
+ }, i("div", {
4466
+ id: "center-card-description",
4467
+ class: "sr"
4468
+ }, o("tecton.element.chartDonut.button.description")), i(s, Object.assign({
4469
+ class: "center-card",
4470
+ "test-id": "centerCard"
4471
+ }, c), !!t && i("q2-icon", {
4472
+ type: t,
4473
+ style: a && {
4474
+ "--tct-icon-stroke-primary": a,
4475
+ "--tct-icon-stroke-secondary": a,
4476
+ color: a
4477
+ }
4478
+ }), !!e && i("div", {
4479
+ class: "name"
4480
+ }, e), !isNaN(r) && i("div", {
4481
+ class: "value"
4482
+ }, l)));
4483
+ }
4484
+ render() {
4485
+ return i("click-elsewhere", {
4486
+ key: "061f0df2cfc531af2df0d583f7cea0a2e7d68c7d",
4487
+ onChange: this.onClickElsewhere
4488
+ }, i("figure", {
4489
+ key: "324163777739ef74d986c94fda412a91f0f34124"
4490
+ }, i("div", {
4491
+ key: "a866867bfd653239d8f7c0a630f2b222c353bdb1",
4492
+ class: "container"
4493
+ }, i("div", {
4494
+ key: "fcb2076e8b390ef19ab28f03d25e66bb48c7bdd9",
4495
+ ref: t => this.chartContainer = t,
4496
+ "aria-describedby": !this.isClickable ? "center-card-description" : undefined,
4497
+ class: "chart-container",
4498
+ role: "img",
4499
+ "test-id": "chartContainer",
4500
+ onClick: this.onContainerClick,
4501
+ tabIndex: !this.isClickable ? 0 : undefined,
4502
+ onKeyDown: !this.isClickable ? this.onButtonKeyDown : undefined
4503
+ }), this.renderCenterBlock()), this.showLegend && i("figcaption", {
4504
+ key: "2115b858f955bb6751a8d7d4476d4addc76e8f50"
4505
+ }, i("q2-legend", {
4506
+ key: "2a20e076a5bb3ac2b3430f1cefe38d9cdf594ccb",
4507
+ class: "legend",
4508
+ data: this.legendData,
4509
+ format: this.format,
4510
+ hoveredItemId: this.legendHoveredId,
4511
+ onClick: this.onLegendClick,
4512
+ onMouseleave: this.onLegendMouseleave,
4513
+ onMouseenter: this.onLegendMouseenter,
4514
+ selectedItemId: this.selectedId
4515
+ }))));
4516
+ }
4517
+ get hostElement() {
4518
+ return r(this);
4519
+ }
4520
+ static get watchers() {
4521
+ return {
4522
+ chartName: [ "propsUpdates" ],
4523
+ innerRadius: [ "propsUpdates", "innerRadiusUpdated" ],
4524
+ outerRadius: [ "propsUpdates", "outerRadiusUpdated" ],
4525
+ minSliceSize: [ "propsUpdates" ],
4526
+ hoverScaleSize: [ "propsUpdates" ],
4527
+ selectedOffset: [ "propsUpdates" ],
4528
+ data: [ "dataUpdated" ],
4529
+ selectedId: [ "checkSelectedId" ]
4530
+ };
4531
+ }
4532
+ };
4533
+
4534
+ Ee.style = Ye;
4535
+
4536
+ export { Ee as q2_chart_donut };
4537
+ //# sourceMappingURL=q2-chart-donut.entry.js.map