@eturnity/eturnity_reusable_components 8.19.8-EPDM-13618.0 → 8.19.8-EPDM-14690.2

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 (575) hide show
  1. package/README.md +29 -29
  2. package/package.json +85 -85
  3. package/src/App.vue +30 -30
  4. package/src/DemoChart.vue +424 -0
  5. package/src/Test.vue +64 -64
  6. package/src/TestChart.vue +229 -0
  7. package/src/assets/icons/arrow_down.svg +3 -3
  8. package/src/assets/icons/arrow_up_red.svg +3 -3
  9. package/src/assets/icons/black_spinner.svg +35 -35
  10. package/src/assets/icons/delete_icon.svg +11 -11
  11. package/src/assets/icons/delete_icon_gray.svg +11 -11
  12. package/src/assets/icons/drag_icon.svg +8 -8
  13. package/src/assets/icons/external_icon.svg +6 -6
  14. package/src/assets/icons/language_icon.svg +6 -6
  15. package/src/assets/icons/pdf_icon.svg +6 -6
  16. package/src/assets/icons/plus_button.svg +4 -4
  17. package/src/assets/icons/search_icon_black.svg +3 -3
  18. package/src/assets/icons/subposition_icon.svg +3 -3
  19. package/src/assets/icons/subposition_marker.svg +3 -3
  20. package/src/assets/icons/warning_icon.svg +3 -3
  21. package/src/assets/svgIcons/2d_active.svg +7 -7
  22. package/src/assets/svgIcons/2d_inactive.svg +8 -8
  23. package/src/assets/svgIcons/3d_active.svg +7 -7
  24. package/src/assets/svgIcons/3d_inactive.svg +8 -8
  25. package/src/assets/svgIcons/_readme.md +7 -7
  26. package/src/assets/svgIcons/ac_power.svg +4 -4
  27. package/src/assets/svgIcons/accept.svg +5 -5
  28. package/src/assets/svgIcons/activate_panels_active.svg +22 -22
  29. package/src/assets/svgIcons/activate_panels_inactive.svg +20 -20
  30. package/src/assets/svgIcons/add_icon-1.svg +3 -3
  31. package/src/assets/svgIcons/add_icon.svg +4 -4
  32. package/src/assets/svgIcons/add_plus.svg +4 -4
  33. package/src/assets/svgIcons/address_book.svg +3 -3
  34. package/src/assets/svgIcons/adjust_roof.svg +6 -6
  35. package/src/assets/svgIcons/after_sale_as_a_service.svg +6 -6
  36. package/src/assets/svgIcons/all_good.svg +3 -3
  37. package/src/assets/svgIcons/angle_active.svg +5 -5
  38. package/src/assets/svgIcons/angle_inactive.svg +4 -4
  39. package/src/assets/svgIcons/area_active.svg +11 -11
  40. package/src/assets/svgIcons/area_inactive.svg +26 -26
  41. package/src/assets/svgIcons/areas_tool.svg +14 -14
  42. package/src/assets/svgIcons/arrow_down.svg +3 -3
  43. package/src/assets/svgIcons/arrow_down_unfilled.svg +4 -4
  44. package/src/assets/svgIcons/arrow_left.svg +4 -4
  45. package/src/assets/svgIcons/arrow_long_left.svg +3 -3
  46. package/src/assets/svgIcons/arrow_long_right.svg +3 -3
  47. package/src/assets/svgIcons/arrow_right.svg +4 -4
  48. package/src/assets/svgIcons/arrow_up.svg +3 -3
  49. package/src/assets/svgIcons/arrow_up_unfilled.svg +4 -4
  50. package/src/assets/svgIcons/attachment.svg +3 -3
  51. package/src/assets/svgIcons/base_layer.svg +3 -3
  52. package/src/assets/svgIcons/battery.svg +3 -3
  53. package/src/assets/svgIcons/bell.svg +3 -3
  54. package/src/assets/svgIcons/bell_alt.svg +3 -3
  55. package/src/assets/svgIcons/bexio.svg +4 -4
  56. package/src/assets/svgIcons/bold.svg +3 -3
  57. package/src/assets/svgIcons/bom.svg +3 -3
  58. package/src/assets/svgIcons/bom_generation.svg +10 -10
  59. package/src/assets/svgIcons/bookmaker.svg +3 -3
  60. package/src/assets/svgIcons/bubble.svg +3 -3
  61. package/src/assets/svgIcons/bug.svg +5 -5
  62. package/src/assets/svgIcons/buildings.svg +55 -55
  63. package/src/assets/svgIcons/bullet_list.svg +8 -8
  64. package/src/assets/svgIcons/calendar.svg +7 -7
  65. package/src/assets/svgIcons/calendar_icon.svg +7 -7
  66. package/src/assets/svgIcons/call.svg +3 -3
  67. package/src/assets/svgIcons/camera.svg +3 -3
  68. package/src/assets/svgIcons/car.svg +3 -3
  69. package/src/assets/svgIcons/cart.svg +3 -3
  70. package/src/assets/svgIcons/charger_icon_white.svg +44 -44
  71. package/src/assets/svgIcons/chassis_ground_symbol.svg +27 -27
  72. package/src/assets/svgIcons/checkbox.svg +3 -3
  73. package/src/assets/svgIcons/checkmark.svg +3 -3
  74. package/src/assets/svgIcons/checkmark_white.svg +4 -4
  75. package/src/assets/svgIcons/clear_formatting.svg +7 -7
  76. package/src/assets/svgIcons/clenergy.svg +3 -3
  77. package/src/assets/svgIcons/clickable_info.svg +4 -4
  78. package/src/assets/svgIcons/clickable_info_white.svg +5 -5
  79. package/src/assets/svgIcons/clip.svg +3 -3
  80. package/src/assets/svgIcons/clock.svg +17 -17
  81. package/src/assets/svgIcons/clock_full.svg +3 -3
  82. package/src/assets/svgIcons/close.svg +4 -4
  83. package/src/assets/svgIcons/co_branding.svg +5 -5
  84. package/src/assets/svgIcons/collapse.svg +4 -4
  85. package/src/assets/svgIcons/collapse_all.svg +3 -3
  86. package/src/assets/svgIcons/collections.svg +3 -3
  87. package/src/assets/svgIcons/component_library.svg +7 -7
  88. package/src/assets/svgIcons/consumption_tariffs.svg +43 -43
  89. package/src/assets/svgIcons/context_menu-1.svg +6 -6
  90. package/src/assets/svgIcons/context_menu-2.svg +5 -5
  91. package/src/assets/svgIcons/context_menu.svg +5 -5
  92. package/src/assets/svgIcons/context_menu_tabs.svg +5 -5
  93. package/src/assets/svgIcons/cross.svg +4 -4
  94. package/src/assets/svgIcons/current_variant.svg +4 -4
  95. package/src/assets/svgIcons/customer.svg +3 -3
  96. package/src/assets/svgIcons/dashboard.svg +3 -3
  97. package/src/assets/svgIcons/data_transfer.svg +3 -3
  98. package/src/assets/svgIcons/deadline.svg +4 -4
  99. package/src/assets/svgIcons/deal_flow.svg +3 -3
  100. package/src/assets/svgIcons/delete.svg +4 -4
  101. package/src/assets/svgIcons/delete_area_active.svg +16 -16
  102. package/src/assets/svgIcons/delete_area_inactive.svg +15 -15
  103. package/src/assets/svgIcons/direction_active-1.svg +12 -12
  104. package/src/assets/svgIcons/direction_active.svg +5 -5
  105. package/src/assets/svgIcons/direction_arrow.svg +4 -4
  106. package/src/assets/svgIcons/direction_inactive.svg +4 -4
  107. package/src/assets/svgIcons/dislike.svg +3 -3
  108. package/src/assets/svgIcons/distance_tool.svg +8 -8
  109. package/src/assets/svgIcons/distances_active.svg +9 -9
  110. package/src/assets/svgIcons/distances_inactive.svg +8 -8
  111. package/src/assets/svgIcons/distort_tool.svg +10 -10
  112. package/src/assets/svgIcons/distort_tool2.svg +16 -16
  113. package/src/assets/svgIcons/document.svg +3 -3
  114. package/src/assets/svgIcons/documents.svg +3 -3
  115. package/src/assets/svgIcons/documents_landscape.svg +3 -3
  116. package/src/assets/svgIcons/double_arrow_long.svg +4 -4
  117. package/src/assets/svgIcons/downarrow.svg +3 -3
  118. package/src/assets/svgIcons/download.svg +4 -4
  119. package/src/assets/svgIcons/drag_icon.svg +8 -8
  120. package/src/assets/svgIcons/draggable_corner.svg +5 -5
  121. package/src/assets/svgIcons/draw_tool.svg +3 -3
  122. package/src/assets/svgIcons/duplicate-1.svg +8 -8
  123. package/src/assets/svgIcons/duplicate-2.svg +5 -5
  124. package/src/assets/svgIcons/duplicate.svg +3 -3
  125. package/src/assets/svgIcons/e-mobility_configurator.svg +6 -6
  126. package/src/assets/svgIcons/e_signature.svg +5 -5
  127. package/src/assets/svgIcons/ed_ac.svg +3 -3
  128. package/src/assets/svgIcons/ed_ac_path.svg +3 -3
  129. package/src/assets/svgIcons/ed_acgrid.svg +3 -3
  130. package/src/assets/svgIcons/ed_acgrid_old.svg +4 -4
  131. package/src/assets/svgIcons/ed_arrow_both.svg +3 -3
  132. package/src/assets/svgIcons/ed_arrow_left.svg +3 -3
  133. package/src/assets/svgIcons/ed_arrow_right.svg +3 -3
  134. package/src/assets/svgIcons/ed_battery.svg +3 -3
  135. package/src/assets/svgIcons/ed_batteryacinverter.svg +3 -3
  136. package/src/assets/svgIcons/ed_batteryintegratedinverter.svg +3 -3
  137. package/src/assets/svgIcons/ed_cirquitbreaker.svg +3 -3
  138. package/src/assets/svgIcons/ed_cirquitbreaker_magnetic.svg +3 -3
  139. package/src/assets/svgIcons/ed_cirquitbreaker_thermal.svg +3 -3
  140. package/src/assets/svgIcons/ed_cirquitbreaker_thermal_magnetic.svg +3 -3
  141. package/src/assets/svgIcons/ed_consumption.svg +3 -3
  142. package/src/assets/svgIcons/ed_dc.svg +3 -3
  143. package/src/assets/svgIcons/ed_disconnector.svg +3 -3
  144. package/src/assets/svgIcons/ed_disconnector_fuse.svg +3 -3
  145. package/src/assets/svgIcons/ed_disconnector_fuse_switch.svg +3 -3
  146. package/src/assets/svgIcons/ed_disconnector_loadbreak_switch.svg +3 -3
  147. package/src/assets/svgIcons/ed_disconnector_switch.svg +3 -3
  148. package/src/assets/svgIcons/ed_disconnector_switch_auto_release.svg +3 -3
  149. package/src/assets/svgIcons/ed_energymanagement_rectangle.svg +3 -3
  150. package/src/assets/svgIcons/ed_evcharger.svg +3 -3
  151. package/src/assets/svgIcons/ed_flexiblecomponent_circle.svg +3 -3
  152. package/src/assets/svgIcons/ed_flexiblecomponent_square.svg +3 -3
  153. package/src/assets/svgIcons/ed_fuse.svg +3 -3
  154. package/src/assets/svgIcons/ed_ground.svg +3 -3
  155. package/src/assets/svgIcons/ed_heatpump.svg +3 -3
  156. package/src/assets/svgIcons/ed_icon_battery.svg +3 -3
  157. package/src/assets/svgIcons/ed_icon_circle.svg +3 -3
  158. package/src/assets/svgIcons/ed_icon_heatpump.svg +3 -3
  159. package/src/assets/svgIcons/ed_icon_inverter.svg +8 -8
  160. package/src/assets/svgIcons/ed_icon_m.svg +3 -3
  161. package/src/assets/svgIcons/ed_icon_optimizer.svg +11 -11
  162. package/src/assets/svgIcons/ed_icon_optimizer_path.svg +11 -11
  163. package/src/assets/svgIcons/ed_integratedbatteryinverter.svg +3 -3
  164. package/src/assets/svgIcons/ed_inverter-blank.svg +3 -3
  165. package/src/assets/svgIcons/ed_mainsconnection.svg +3 -3
  166. package/src/assets/svgIcons/ed_meter-blank.svg +3 -3
  167. package/src/assets/svgIcons/ed_meter_arrowleft.svg +3 -3
  168. package/src/assets/svgIcons/ed_meter_arrowright.svg +3 -3
  169. package/src/assets/svgIcons/ed_meter_bidirectional.svg +3 -3
  170. package/src/assets/svgIcons/ed_networkandsystemprotection_double.svg +3 -3
  171. package/src/assets/svgIcons/ed_networkandsystemprotection_single.svg +3 -3
  172. package/src/assets/svgIcons/ed_pvpanel (Stroke).svg +3 -3
  173. package/src/assets/svgIcons/ed_pvpanel.svg +3 -3
  174. package/src/assets/svgIcons/ed_rcd.svg +3 -3
  175. package/src/assets/svgIcons/ed_rcd_simple.svg +3 -3
  176. package/src/assets/svgIcons/ed_spd.svg +3 -3
  177. package/src/assets/svgIcons/ed_stringwithoptimizer.svg +5 -5
  178. package/src/assets/svgIcons/ed_stringwithoutoptimizer.svg +7 -7
  179. package/src/assets/svgIcons/ed_transformer.svg +3 -3
  180. package/src/assets/svgIcons/edit.svg +3 -3
  181. package/src/assets/svgIcons/edit_button.svg +3 -3
  182. package/src/assets/svgIcons/edit_stroke.svg +3 -3
  183. package/src/assets/svgIcons/efs.svg +5 -5
  184. package/src/assets/svgIcons/electricity_tariff.svg +3 -3
  185. package/src/assets/svgIcons/email.svg +3 -3
  186. package/src/assets/svgIcons/ems-1.svg +3 -3
  187. package/src/assets/svgIcons/ems.svg +3 -3
  188. package/src/assets/svgIcons/end_of_the_list.svg +5 -5
  189. package/src/assets/svgIcons/energy_meter.svg +3 -3
  190. package/src/assets/svgIcons/erase.svg +4 -4
  191. package/src/assets/svgIcons/erase_white.svg +4 -4
  192. package/src/assets/svgIcons/expand_all.svg +4 -4
  193. package/src/assets/svgIcons/export_document.svg +3 -3
  194. package/src/assets/svgIcons/external_icon.svg +5 -5
  195. package/src/assets/svgIcons/fav_icon.svg +4 -4
  196. package/src/assets/svgIcons/filter.svg +3 -3
  197. package/src/assets/svgIcons/finance.svg +3 -3
  198. package/src/assets/svgIcons/financing_for_pv-1.svg +5 -5
  199. package/src/assets/svgIcons/financing_for_pv-2.svg +3 -3
  200. package/src/assets/svgIcons/financing_for_pv.svg +3 -3
  201. package/src/assets/svgIcons/finish-1.svg +4 -4
  202. package/src/assets/svgIcons/finish.svg +3 -3
  203. package/src/assets/svgIcons/flatten.svg +11 -11
  204. package/src/assets/svgIcons/flatten_roof.svg +20 -20
  205. package/src/assets/svgIcons/folder.svg +3 -3
  206. package/src/assets/svgIcons/free_technology.svg +3 -3
  207. package/src/assets/svgIcons/ground_symbol.svg +28 -28
  208. package/src/assets/svgIcons/handle.svg +5 -5
  209. package/src/assets/svgIcons/heat_calc.svg +7 -7
  210. package/src/assets/svgIcons/heat_pump.svg +5 -5
  211. package/src/assets/svgIcons/heating_system.svg +3 -3
  212. package/src/assets/svgIcons/height_equalize.svg +3 -3
  213. package/src/assets/svgIcons/height_snap.svg +3 -3
  214. package/src/assets/svgIcons/house.svg +3 -3
  215. package/src/assets/svgIcons/house_3d-1.svg +7 -7
  216. package/src/assets/svgIcons/house_3d.svg +7 -7
  217. package/src/assets/svgIcons/house_sun.svg +3 -3
  218. package/src/assets/svgIcons/hybrid.svg +4 -4
  219. package/src/assets/svgIcons/inclination.svg +2 -2
  220. package/src/assets/svgIcons/info.svg +3 -3
  221. package/src/assets/svgIcons/initial_situation.svg +3 -3
  222. package/src/assets/svgIcons/integrations.svg +3 -3
  223. package/src/assets/svgIcons/intro-tour-1.svg +3 -3
  224. package/src/assets/svgIcons/intro-tour.svg +3 -3
  225. package/src/assets/svgIcons/inverter.svg +3 -3
  226. package/src/assets/svgIcons/italic.svg +3 -3
  227. package/src/assets/svgIcons/k2.svg +4 -4
  228. package/src/assets/svgIcons/kanban_view.svg +6 -6
  229. package/src/assets/svgIcons/key.svg +3 -3
  230. package/src/assets/svgIcons/lake.svg +29 -29
  231. package/src/assets/svgIcons/layers_close.svg +4 -4
  232. package/src/assets/svgIcons/layers_open.svg +4 -4
  233. package/src/assets/svgIcons/lead_marketplace.svg +6 -6
  234. package/src/assets/svgIcons/lead_provider.svg +4 -4
  235. package/src/assets/svgIcons/legend.svg +3 -3
  236. package/src/assets/svgIcons/length_2d.svg +2 -2
  237. package/src/assets/svgIcons/length_3d.svg +4 -4
  238. package/src/assets/svgIcons/length_calculator.svg +2 -2
  239. package/src/assets/svgIcons/length_in_2d_active.svg +12 -12
  240. package/src/assets/svgIcons/length_in_2d_inctive.svg +13 -13
  241. package/src/assets/svgIcons/light_bulb.svg +3 -3
  242. package/src/assets/svgIcons/like.svg +3 -3
  243. package/src/assets/svgIcons/line_graph.svg +3 -3
  244. package/src/assets/svgIcons/local_subsidies.svg +18 -18
  245. package/src/assets/svgIcons/location.svg +3 -3
  246. package/src/assets/svgIcons/lock.svg +3 -3
  247. package/src/assets/svgIcons/logout.svg +3 -3
  248. package/src/assets/svgIcons/loop.svg +3 -3
  249. package/src/assets/svgIcons/low-vegetation.svg +37 -37
  250. package/src/assets/svgIcons/lunch.svg +4 -4
  251. package/src/assets/svgIcons/magic_tool.svg +6 -6
  252. package/src/assets/svgIcons/map_icon.svg +5 -5
  253. package/src/assets/svgIcons/map_settings.svg +3 -3
  254. package/src/assets/svgIcons/margin_tool.svg +4 -4
  255. package/src/assets/svgIcons/meeting.svg +6 -6
  256. package/src/assets/svgIcons/module.svg +3 -3
  257. package/src/assets/svgIcons/move_copy.svg +4 -4
  258. package/src/assets/svgIcons/move_down.svg +3 -3
  259. package/src/assets/svgIcons/move_left.svg +3 -3
  260. package/src/assets/svgIcons/move_right.svg +3 -3
  261. package/src/assets/svgIcons/move_up.svg +3 -3
  262. package/src/assets/svgIcons/new_area_inactive.svg +11 -11
  263. package/src/assets/svgIcons/next.svg +4 -4
  264. package/src/assets/svgIcons/normal-tg.svg +30 -30
  265. package/src/assets/svgIcons/normal-vegetation.svg +53 -53
  266. package/src/assets/svgIcons/not_equal_to.svg +3 -3
  267. package/src/assets/svgIcons/numbered_list.svg +6 -6
  268. package/src/assets/svgIcons/obstacle_tool.svg +8 -8
  269. package/src/assets/svgIcons/obstacle_tool_origin.svg +3 -3
  270. package/src/assets/svgIcons/offset_tool.svg +8 -8
  271. package/src/assets/svgIcons/open-tg.svg +21 -21
  272. package/src/assets/svgIcons/optimizer.svg +3 -3
  273. package/src/assets/svgIcons/order.svg +3 -3
  274. package/src/assets/svgIcons/outline_tool.svg +11 -11
  275. package/src/assets/svgIcons/pan_tool.svg +12 -12
  276. package/src/assets/svgIcons/panels_tool.svg +8 -8
  277. package/src/assets/svgIcons/pen_tool.svg +4 -4
  278. package/src/assets/svgIcons/picker_tool.svg +4 -4
  279. package/src/assets/svgIcons/picture.svg +3 -3
  280. package/src/assets/svgIcons/pin.svg +5 -5
  281. package/src/assets/svgIcons/plus_button.svg +4 -4
  282. package/src/assets/svgIcons/presentation.svg +3 -3
  283. package/src/assets/svgIcons/preview.svg +3 -3
  284. package/src/assets/svgIcons/previous.svg +4 -4
  285. package/src/assets/svgIcons/profile-1.svg +4 -4
  286. package/src/assets/svgIcons/profile.svg +3 -3
  287. package/src/assets/svgIcons/profitability.svg +3 -3
  288. package/src/assets/svgIcons/project_analysis.svg +3 -3
  289. package/src/assets/svgIcons/project_settings.svg +3 -3
  290. package/src/assets/svgIcons/protected-tg.svg +47 -47
  291. package/src/assets/svgIcons/pv.svg +3 -3
  292. package/src/assets/svgIcons/question_mark.svg +3 -3
  293. package/src/assets/svgIcons/question_mark_white.svg +4 -4
  294. package/src/assets/svgIcons/quotations.svg +6 -6
  295. package/src/assets/svgIcons/rectangle.svg +3 -3
  296. package/src/assets/svgIcons/redo.svg +6 -6
  297. package/src/assets/svgIcons/refresh.svg +3 -3
  298. package/src/assets/svgIcons/reorder_string.svg +3 -3
  299. package/src/assets/svgIcons/resizer.svg +5 -5
  300. package/src/assets/svgIcons/roof_layer.svg +3 -3
  301. package/src/assets/svgIcons/rotate_tool.svg +3 -3
  302. package/src/assets/svgIcons/rotate_view.svg +5 -5
  303. package/src/assets/svgIcons/ruler_tool.svg +3 -3
  304. package/src/assets/svgIcons/run_simulation.svg +3 -3
  305. package/src/assets/svgIcons/save.svg +3 -3
  306. package/src/assets/svgIcons/scaling_tool.svg +8 -8
  307. package/src/assets/svgIcons/sea.svg +34 -34
  308. package/src/assets/svgIcons/search.svg +3 -3
  309. package/src/assets/svgIcons/security.svg +3 -3
  310. package/src/assets/svgIcons/settings.svg +3 -3
  311. package/src/assets/svgIcons/show_in_a_new_tab.svg +12 -12
  312. package/src/assets/svgIcons/smartphone.svg +4 -4
  313. package/src/assets/svgIcons/solar_calc.svg +13 -13
  314. package/src/assets/svgIcons/solarmarkt.svg +3 -3
  315. package/src/assets/svgIcons/sorting.svg +4 -4
  316. package/src/assets/svgIcons/split.svg +12 -12
  317. package/src/assets/svgIcons/star.svg +3 -3
  318. package/src/assets/svgIcons/start_of_the_list.svg +5 -5
  319. package/src/assets/svgIcons/strikethrough.svg +4 -4
  320. package/src/assets/svgIcons/string_design.svg +5 -5
  321. package/src/assets/svgIcons/string_directions.svg +10 -10
  322. package/src/assets/svgIcons/subscriptions.svg +3 -3
  323. package/src/assets/svgIcons/subsidies-2.svg +3 -3
  324. package/src/assets/svgIcons/subsidies.svg +3 -3
  325. package/src/assets/svgIcons/subtract_icon.svg +3 -3
  326. package/src/assets/svgIcons/suitcase.svg +3 -3
  327. package/src/assets/svgIcons/summer.svg +3 -3
  328. package/src/assets/svgIcons/switch_polarity.svg +5 -5
  329. package/src/assets/svgIcons/table_view.svg +3 -3
  330. package/src/assets/svgIcons/template_icon_not_clickable.svg +6 -6
  331. package/src/assets/svgIcons/text_column_one.svg +6 -6
  332. package/src/assets/svgIcons/text_column_three.svg +14 -14
  333. package/src/assets/svgIcons/text_column_two.svg +10 -10
  334. package/src/assets/svgIcons/text_icon.svg +3 -3
  335. package/src/assets/svgIcons/transfer.svg +4 -4
  336. package/src/assets/svgIcons/transparent_warning.svg +4 -4
  337. package/src/assets/svgIcons/trim_tool.svg +4 -4
  338. package/src/assets/svgIcons/truck.svg +3 -3
  339. package/src/assets/svgIcons/underlined.svg +3 -3
  340. package/src/assets/svgIcons/undo.svg +6 -6
  341. package/src/assets/svgIcons/uparrow.svg +3 -3
  342. package/src/assets/svgIcons/update.svg +3 -3
  343. package/src/assets/svgIcons/upload_avatar-1.svg +12 -12
  344. package/src/assets/svgIcons/upload_avatar.svg +5 -5
  345. package/src/assets/svgIcons/upload_image.svg +8 -8
  346. package/src/assets/svgIcons/upload_image_tool.svg +7 -7
  347. package/src/assets/svgIcons/variants.svg +3 -3
  348. package/src/assets/svgIcons/vdv.svg +5 -5
  349. package/src/assets/svgIcons/vertical_tool.svg +3 -3
  350. package/src/assets/svgIcons/virtual_storage.svg +3 -3
  351. package/src/assets/svgIcons/warning.svg +4 -4
  352. package/src/assets/svgIcons/warning_triangle.svg +3 -3
  353. package/src/assets/svgIcons/warning_triangle_white.svg +5 -5
  354. package/src/assets/svgIcons/way.svg +5 -5
  355. package/src/assets/svgIcons/wifi.svg +3 -3
  356. package/src/assets/svgIcons/winter.svg +3 -3
  357. package/src/assets/svgIcons/workflow_template.svg +11 -11
  358. package/src/assets/svgIcons//360/237/223/221 Documents/ed_ac.svg" +3 -3
  359. package/src/assets/svgIcons//360/237/223/221 Documents/ed_arrow_both.svg" +7 -7
  360. package/src/assets/svgIcons//360/237/223/221 Documents/ed_arrow_left.svg" +7 -7
  361. package/src/assets/svgIcons//360/237/223/221 Documents/ed_arrow_right.svg" +7 -7
  362. package/src/assets/svgIcons//360/237/223/221 Documents/ed_battery.svg" +4 -4
  363. package/src/assets/svgIcons//360/237/223/221 Documents/ed_batteryacinverter.svg" +5 -5
  364. package/src/assets/svgIcons//360/237/223/221 Documents/ed_batteryintegratedinverter.svg" +5 -5
  365. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker.svg" +6 -6
  366. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker_magnetic.svg" +9 -9
  367. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker_thermal.svg" +5 -5
  368. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker_thermal_magnetic.svg" +10 -10
  369. package/src/assets/svgIcons//360/237/223/221 Documents/ed_consumption.svg" +5 -5
  370. package/src/assets/svgIcons//360/237/223/221 Documents/ed_dc.svg" +3 -3
  371. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector.svg" +5 -5
  372. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_fuse.svg" +6 -6
  373. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_fuse_switch.svg" +7 -7
  374. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_loadbreak_switch.svg" +7 -7
  375. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_switch.svg" +6 -6
  376. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_switch_auto_release.svg" +7 -7
  377. package/src/assets/svgIcons//360/237/223/221 Documents/ed_energymanagement_rectangle.svg" +3 -3
  378. package/src/assets/svgIcons//360/237/223/221 Documents/ed_evcharger.svg" +8 -8
  379. package/src/assets/svgIcons//360/237/223/221 Documents/ed_flexiblecomponent_circle.svg" +3 -3
  380. package/src/assets/svgIcons//360/237/223/221 Documents/ed_flexiblecomponent_square.svg" +3 -3
  381. package/src/assets/svgIcons//360/237/223/221 Documents/ed_fuse.svg" +4 -4
  382. package/src/assets/svgIcons//360/237/223/221 Documents/ed_ground.svg" +6 -6
  383. package/src/assets/svgIcons//360/237/223/221 Documents/ed_heatpump.svg" +4 -4
  384. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_battery.svg" +3 -3
  385. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_circle.svg" +3 -3
  386. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_heatpump.svg" +3 -3
  387. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_inverter.svg" +3 -3
  388. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_optimizer.svg" +3 -3
  389. package/src/assets/svgIcons//360/237/223/221 Documents/ed_integratedbatteryinverter.svg" +3 -3
  390. package/src/assets/svgIcons//360/237/223/221 Documents/ed_inverter-blank.svg" +3 -3
  391. package/src/assets/svgIcons//360/237/223/221 Documents/ed_mainsconnection.svg" +3 -3
  392. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter-blank.svg" +3 -3
  393. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter_arrowleft.svg" +8 -8
  394. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter_arrowright.svg" +8 -8
  395. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter_bidirectional.svg" +8 -8
  396. package/src/assets/svgIcons//360/237/223/221 Documents/ed_networkandsystemprotection_double.svg" +15 -15
  397. package/src/assets/svgIcons//360/237/223/221 Documents/ed_networkandsystemprotection_single.svg" +10 -10
  398. package/src/assets/svgIcons//360/237/223/221 Documents/ed_pvpanel.svg" +7 -7
  399. package/src/assets/svgIcons//360/237/223/221 Documents/ed_rcd.svg" +7 -7
  400. package/src/assets/svgIcons//360/237/223/221 Documents/ed_rcd_simple.svg" +4 -4
  401. package/src/assets/svgIcons//360/237/223/221 Documents/ed_spd.svg" +9 -9
  402. package/src/assets/svgIcons//360/237/223/221 Documents/ed_stringwithoptimizer.svg" +5 -5
  403. package/src/assets/svgIcons//360/237/223/221 Documents/ed_stringwithoutoptimizer.svg" +13 -13
  404. package/src/assets/svgIcons//360/237/223/221 Documents/ed_transformer.svg" +6 -6
  405. package/src/assets/tests/__mocks__/iconCache.js +1 -1
  406. package/src/assets/tests/__mocks__/svgMock.js +1 -1
  407. package/src/assets/tests/helpers.js +12 -12
  408. package/src/assets/theme.js +688 -700
  409. package/src/components/addNewButton/AddNewButton.stories.js +17 -17
  410. package/src/components/addNewButton/addNewButton.spec.js +23 -23
  411. package/src/components/addNewButton/index.vue +66 -66
  412. package/src/components/banner/actionBanner/ActionBanner.stories.js +45 -45
  413. package/src/components/banner/actionBanner/actionBanner.spec.js +76 -76
  414. package/src/components/banner/actionBanner/index.vue +86 -86
  415. package/src/components/banner/banner/Banner.stories.js +120 -120
  416. package/src/components/banner/banner/banner.spec.js +149 -149
  417. package/src/components/banner/banner/index.vue +205 -205
  418. package/src/components/banner/infoBanner/InfoBanner.spec.js +57 -57
  419. package/src/components/banner/infoBanner/InfoBanner.stories.js +84 -84
  420. package/src/components/banner/infoBanner/index.vue +97 -97
  421. package/src/components/banner/notificationBanner/index.vue +131 -131
  422. package/src/components/barchart/BottomFields.vue +337 -253
  423. package/src/components/barchart/ChartControls.vue +113 -113
  424. package/src/components/barchart/SelectionBox.vue +150 -150
  425. package/src/components/barchart/composables/index.js +5 -5
  426. package/src/components/barchart/composables/useAxisCalculations.js +104 -104
  427. package/src/components/barchart/composables/useChartData.js +114 -114
  428. package/src/components/barchart/composables/useChartScroll.js +61 -61
  429. package/src/components/barchart/composables/useSelection.js +75 -75
  430. package/src/components/barchart/composables/useTooltip.js +125 -100
  431. package/src/components/barchart/index.vue +423 -385
  432. package/src/components/barchart/styles/bottomFields.js +80 -66
  433. package/src/components/barchart/styles/chart.js +273 -272
  434. package/src/components/barchart/styles/chartControls.js +59 -59
  435. package/src/components/buttons/buttonIcon/ButtonIcon.stories.js +167 -167
  436. package/src/components/buttons/buttonIcon/index.vue +301 -301
  437. package/src/components/buttons/closeButton/CloseButton.stories.js +25 -25
  438. package/src/components/buttons/closeButton/index.vue +62 -62
  439. package/src/components/buttons/mainButton/MainButton.stories.js +145 -145
  440. package/src/components/buttons/mainButton/index.vue +248 -256
  441. package/src/components/buttons/mainButton/mainButton.spec.js +35 -35
  442. package/src/components/buttons/splitButtons/index.vue +86 -86
  443. package/src/components/card/Card.stories.js +79 -79
  444. package/src/components/card/card.spec.js +135 -135
  445. package/src/components/card/index.vue +116 -116
  446. package/src/components/collapsableInfoText/index.vue +127 -127
  447. package/src/components/deleteIcon/DeleteIcon.stories.js +29 -29
  448. package/src/components/deleteIcon/index.vue +78 -78
  449. package/src/components/draggableCard/defaultProps.js +16 -16
  450. package/src/components/draggableCard/draggableCard.spec.js +99 -99
  451. package/src/components/draggableCard/draggableCard.stories.js +135 -135
  452. package/src/components/draggableCard/index.vue +363 -363
  453. package/src/components/draggableInputHandle/index.vue +46 -46
  454. package/src/components/dropdown/Dropdown.stories.js +53 -53
  455. package/src/components/dropdown/index.vue +138 -146
  456. package/src/components/errorMessage/errorMessage.spec.js +34 -34
  457. package/src/components/errorMessage/errorMessage.stories.js +35 -35
  458. package/src/components/errorMessage/index.vue +64 -64
  459. package/src/components/filter/filterSettings.vue +672 -672
  460. package/src/components/filter/index.vue +154 -154
  461. package/src/components/filter/parentDropdown.vue +91 -91
  462. package/src/components/filterComponent/viewFilter.vue +605 -605
  463. package/src/components/filterComponent/viewSettings.vue +281 -281
  464. package/src/components/filterComponent/viewSort.vue +330 -330
  465. package/src/components/icon/Icon.stories.js +220 -220
  466. package/src/components/icon/icon.spec.js +66 -66
  467. package/src/components/icon/iconCache.mjs +23 -23
  468. package/src/components/icon/iconCollection.vue +83 -83
  469. package/src/components/icon/index.vue +240 -240
  470. package/src/components/iconWrapper/index.vue +184 -184
  471. package/src/components/infoCard/InfoCard.stories.js +170 -170
  472. package/src/components/infoCard/defaultProps.js +7 -7
  473. package/src/components/infoCard/index.vue +172 -160
  474. package/src/components/infoCard/infoCard.spec.js +64 -64
  475. package/src/components/infoLabel/index.vue +63 -63
  476. package/src/components/infoText/constants.js +4 -4
  477. package/src/components/infoText/index.vue +650 -645
  478. package/src/components/infoText/infoText.spec.js +67 -67
  479. package/src/components/infoText/infoText.stories.js +48 -48
  480. package/src/components/infoText/placeholder.vue +225 -225
  481. package/src/components/inputs/checkbox/Checkbox.stories.js +63 -63
  482. package/src/components/inputs/checkbox/checkbox.spec.js +109 -109
  483. package/src/components/inputs/checkbox/index.vue +250 -250
  484. package/src/components/inputs/inputNumber/InputNumber.stories.js +150 -150
  485. package/src/components/inputs/inputNumber/index.vue +1088 -1006
  486. package/src/components/inputs/inputNumberQuestion/index.vue +218 -218
  487. package/src/components/inputs/inputText/InputText.stories.js +70 -70
  488. package/src/components/inputs/inputText/index.vue +478 -478
  489. package/src/components/inputs/inputText/inputText.spec.js +588 -588
  490. package/src/components/inputs/radioButton/RadioButton.stories.js +77 -77
  491. package/src/components/inputs/radioButton/defaultProps.js +31 -31
  492. package/src/components/inputs/radioButton/index.vue +336 -336
  493. package/src/components/inputs/radioButton/radioButton.spec.js +306 -306
  494. package/src/components/inputs/searchInput/SearchInput.stories.js +66 -66
  495. package/src/components/inputs/searchInput/defaultProps.js +12 -12
  496. package/src/components/inputs/searchInput/index.vue +181 -181
  497. package/src/components/inputs/searchInput/searchInput.spec.js +64 -64
  498. package/src/components/inputs/select/index.vue +1080 -1080
  499. package/src/components/inputs/select/option/index.vue +176 -176
  500. package/src/components/inputs/select/select.stories.js +58 -58
  501. package/src/components/inputs/slider/index.vue +126 -126
  502. package/src/components/inputs/switchField/index.vue +266 -266
  503. package/src/components/inputs/textAreaInput/TextAreaInput.stories.js +127 -127
  504. package/src/components/inputs/textAreaInput/index.vue +204 -204
  505. package/src/components/inputs/toggle/Toggle.stories.js +77 -77
  506. package/src/components/inputs/toggle/index.vue +322 -322
  507. package/src/components/inputs/toggle/toggle.spec.js +102 -102
  508. package/src/components/label/index.vue +98 -98
  509. package/src/components/markerItem/index.vue +95 -95
  510. package/src/components/modals/actionModal/actionModal.spec.js +52 -52
  511. package/src/components/modals/actionModal/actionModal.stories.js +53 -53
  512. package/src/components/modals/actionModal/index.vue +64 -64
  513. package/src/components/modals/infoModal/index.vue +82 -82
  514. package/src/components/modals/infoModal/infoModal.spec.js +55 -55
  515. package/src/components/modals/infoModal/infoModal.stories.js +47 -47
  516. package/src/components/modals/modal/index.vue +211 -211
  517. package/src/components/modals/modal/modal.stories.js +31 -31
  518. package/src/components/navigationTabs/index.vue +114 -114
  519. package/src/components/pageSubtitle/PageSubtitle.stories.js +58 -58
  520. package/src/components/pageSubtitle/index.vue +78 -78
  521. package/src/components/pageSubtitle/pageSubtitle.spec.js +46 -46
  522. package/src/components/pageTitle/PageTitle.stories.js +95 -95
  523. package/src/components/pageTitle/index.vue +90 -91
  524. package/src/components/pageTitle/pageTitle.spec.js +46 -46
  525. package/src/components/pagination/index.vue +148 -148
  526. package/src/components/paginationV2/index.vue +175 -175
  527. package/src/components/panelRangeInfo/index.vue +196 -196
  528. package/src/components/progressBar/index.vue +125 -116
  529. package/src/components/projectMarker/ProjectMarker.stories.js +130 -130
  530. package/src/components/projectMarker/index.vue +301 -301
  531. package/src/components/rangeSlider/Slider.vue +578 -578
  532. package/src/components/rangeSlider/index.vue +517 -517
  533. package/src/components/rangeSlider/utils/dom.js +49 -49
  534. package/src/components/rangeSlider/utils/fns.js +26 -26
  535. package/src/components/roundTabs/index.vue +107 -107
  536. package/src/components/selectedOptions/index.vue +473 -473
  537. package/src/components/selectedOptions/selectedOptions.spec.js +176 -176
  538. package/src/components/selectedOptions/selectedOptions.stories.js +253 -253
  539. package/src/components/sideMenu/index.vue +325 -325
  540. package/src/components/spinner/Spinner.stories.js +86 -86
  541. package/src/components/spinner/index.vue +129 -129
  542. package/src/components/spinner/spinner.spec.js +69 -69
  543. package/src/components/spinnerGif/SpinnerGif.stories.js +86 -86
  544. package/src/components/spinnerGif/index.vue +98 -98
  545. package/src/components/tableDropdown/TableDropdown.stories.js +192 -192
  546. package/src/components/tableDropdown/index.vue +692 -692
  547. package/src/components/tables/mainTable/MainTable.stories.js +151 -151
  548. package/src/components/tables/mainTable/exampleNested.vue +328 -328
  549. package/src/components/tables/mainTable/index.vue +523 -524
  550. package/src/components/tables/viewTable/index.vue +195 -195
  551. package/src/components/tabsHeader/TabsHeader.stories.js +142 -142
  552. package/src/components/tabsHeader/index.vue +150 -150
  553. package/src/components/threeDots/index.vue +413 -413
  554. package/src/components/videoThumbnail/index.vue +103 -103
  555. package/src/components/videoThumbnail/videoThumbnail.stories.js +106 -106
  556. package/src/helpers/currencyMapping.js +28 -28
  557. package/src/helpers/dateTimeFormatting.js +51 -51
  558. package/src/helpers/isObjectEqual.js +22 -22
  559. package/src/helpers/numberConverter.js +103 -103
  560. package/src/helpers/toLocaleNumber.js +11 -11
  561. package/src/helpers/translateLang.js +199 -199
  562. package/src/main.js +8 -8
  563. package/src/mixins/inputValidations.js +97 -97
  564. package/src/router/dynamicRoutes.js +23 -23
  565. package/src/stories/Button.stories.js +48 -48
  566. package/src/stories/Button.vue +52 -52
  567. package/src/stories/Configure.mdx +364 -364
  568. package/src/stories/Header.stories.js +41 -41
  569. package/src/stories/Header.vue +59 -59
  570. package/src/stories/Page.stories.js +30 -30
  571. package/src/stories/Page.vue +83 -83
  572. package/src/stories/button.css +30 -30
  573. package/src/stories/header.css +32 -32
  574. package/src/stories/page.css +69 -69
  575. package/src/utils/index.js +12 -12
@@ -1,1006 +1,1088 @@
1
- <template>
2
- <Container :align-items="alignItems" :input-width="inputWidth">
3
- <LabelSlotWrapper
4
- v-if="hasLabelSlot"
5
- :align-items="alignItems"
6
- :border-color="borderColor"
7
- :is-error="isError"
8
- :is-interactive="isInteractive"
9
- :no-border="noBorder"
10
- @mousedown="initInteraction"
11
- >
12
- <slot name="label"></slot>
13
- </LabelSlotWrapper>
14
-
15
- <LabelWrapper v-if="labelText">
16
- <LabelText
17
- :data-id="labelDataId"
18
- :data-test-id="labelDataTestId"
19
- :label-font-color="labelFontColor"
20
- :label-font-weight="labelFontWeight"
21
- >
22
- {{ labelText }}
23
- </LabelText>
24
-
25
- <InfoText
26
- v-if="labelInfoText"
27
- :align-arrow="labelInfoAlign"
28
- :app-theme="appTheme"
29
- :text="labelInfoText"
30
- />
31
- </LabelWrapper>
32
- <InputWrapper>
33
- <InputContainer
34
- v-bind="$attrs"
35
- ref="inputField1"
36
- :align-items="alignItems"
37
- :background-color="
38
- colorMode === 'transparent' ? 'transparent' : backgroundColor
39
- "
40
- :border-color="
41
- colorMode === 'transparent' && !borderColor ? 'white' : borderColor
42
- "
43
- :color-mode="colorMode"
44
- :data-id="inputDataId"
45
- :data-qa-id="dataQaId"
46
- :disabled="disabled"
47
- :font-color="colorMode === 'transparent' ? 'white' : fontColor"
48
- :font-size="fontSize"
49
- :has-label-slot="hasLabelSlot"
50
- :has-slot="hasSlot"
51
- :has-unit="unitName && !!unitName.length"
52
- :input-height="inputHeight"
53
- :is-disabled="disabled"
54
- :is-error="isError"
55
- :is-interactive="isInteractive"
56
- :min-width="minWidth"
57
- :no-border="noBorder"
58
- :placeholder="displayedPlaceholder"
59
- :read-only="isReadOnly"
60
- :show-arrow-controls="showArrowControls"
61
- :show-linear-unit-name="showLinearUnitName"
62
- :slot-size="slotSize"
63
- :text-align="textAlign"
64
- :value="formatWithCurrency(value)"
65
- @blur="onInputBlur($event)"
66
- @focus="focusInput()"
67
- @input="onInput($event)"
68
- @keydown.down="decrementValue"
69
- @keydown.up="incrementValue"
70
- @keyup.enter="onEnterPress"
71
- />
72
- <SlotContainer v-if="hasSlot" :is-error="isError" :slot-size="slotSize">
73
- <slot></slot>
74
- </SlotContainer>
75
-
76
- <UnitContainer
77
- v-if="unitName && showLinearUnitName && !hasSlot"
78
- :has-length="!!textInput.length"
79
- :is-error="isError"
80
- >{{ unitName }}</UnitContainer
81
- >
82
- <IconWrapper
83
- v-if="isError && !showLinearUnitName"
84
- :margin-right="showSelect ? selectWidth : 0"
85
- size="16px"
86
- >
87
- <Icon cursor="default" name="warning" size="16px" />
88
- </IconWrapper>
89
- <SelectWrapper v-if="showSelect">
90
- <Divider />
91
- <RCSelect
92
- :disabled="isSelectDisabled"
93
- :select-width="`${selectWidth}px`"
94
- :show-border="false"
95
- @input-change="$emit('select-change', $event)"
96
- >
97
- <template #selector>
98
- <SelectText>{{ getSelectValue }}</SelectText>
99
- </template>
100
- <template #dropdown>
101
- <RCOption
102
- v-for="item in selectOptions"
103
- :key="item.value"
104
- :value="item.value"
105
- >
106
- {{ item.label }}
107
- </RCOption>
108
- </template>
109
- </RCSelect>
110
- </SelectWrapper>
111
-
112
- <ArrowControls
113
- v-if="!disabled && showArrowControls"
114
- :color-mode="colorMode"
115
- >
116
- <ArrowButton @click="incrementValue">
117
- <Icon
118
- :color="colorMode === 'transparent' ? 'white' : undefined"
119
- name="arrow_up"
120
- size="8px"
121
- />
122
- </ArrowButton>
123
- <ArrowDivider :color-mode="colorMode" />
124
- <ArrowButton
125
- :is-disabled="textInput <= minNumber"
126
- @click="decrementValue"
127
- >
128
- <Icon
129
- :color="colorMode === 'transparent' ? 'white' : undefined"
130
- :disabled="textInput <= minNumber"
131
- name="arrow_down"
132
- size="8px"
133
- />
134
- </ArrowButton>
135
- </ArrowControls>
136
- </InputWrapper>
137
- <ErrorMessage v-if="isError">{{ errorMessage }}</ErrorMessage>
138
- </Container>
139
- </template>
140
-
141
- <script>
142
- // import InputNumber from "@eturnity/eturnity_reusable_components/src/components/inputs/inputNumber"
143
- //This component should be used for questions with input fields only
144
- //How to use:
145
- // <input-number
146
- // placeholder="Enter distance"
147
- // :isError="false" //default is false
148
- // inputWidth="150px" //by default, this is 100%
149
- // minWidth="100px"
150
- // :numberPrecision="3"
151
- // minDecimals="2"
152
- // unitName="pc"
153
- // :value="inputValue" //required -- String
154
- // @input-change="onInputChange($event)" //required
155
- // @on-enter-click="onInputSubmit()"
156
- // :errorMessage="Enter a number between 1 and 10"
157
- // :disabled="false"
158
- // :noBorder="true"
159
- // textAlign="left" // "left, right, center"
160
- // :showLinearUnitName="true"
161
- // fontSize="13px"
162
- // labelText="Number of Modules"
163
- // labelInfoText="Here is some information for you..."
164
- // labelInfoAlign="left"
165
- // :minNumber="0"
166
- // fontColor="blue"
167
- // :isReadOnly="true"
168
- // colorMode="transparent" // Makes background transparent, border white, and font white
169
- // >
170
- //<template name=label><img>....</template>
171
- //</inputNumber>
172
- import styled from 'vue3-styled-components'
173
- import {
174
- stringToNumber,
175
- numberToString,
176
- } from '../../../helpers/numberConverter'
177
- import InfoText from '../../infoText'
178
- import ErrorMessage from '../../errorMessage'
179
- import RCSelect from '../select'
180
- import RCOption from '../select/option'
181
- import warningIcon from '../../../assets/icons/error_icon.png'
182
- import Icon from '../../icon'
183
-
184
- const inputProps = {
185
- isError: Boolean,
186
- hasUnit: Boolean,
187
- inputWidth: String,
188
- minWidth: String,
189
- isDisabled: Boolean,
190
- noBorder: Boolean,
191
- textAlign: String,
192
- fontSize: String,
193
- fontColor: String,
194
- backgroundColor: String,
195
- hasSlot: Boolean,
196
- hasLabelSlot: Boolean,
197
- slotSize: String,
198
- inputHeight: String,
199
- isInteractive: Boolean,
200
- alignItems: String,
201
- labelFontColor: String,
202
- labelFontWeight: String,
203
- borderColor: String,
204
- showLinearUnitName: Boolean,
205
- colorMode: String,
206
- showArrowControls: Boolean,
207
- readOnly: Boolean,
208
- }
209
-
210
- const Container = styled('div', inputProps)`
211
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
212
- position: relative;
213
- display: grid;
214
- grid-template-columns: ${(props) =>
215
- props.alignItems === 'vertical' ? '1fr' : 'auto 1fr'};
216
- `
217
-
218
- const InputContainer = styled('input', inputProps)`
219
- border: ${(props) =>
220
- props.isError
221
- ? '1px solid ' + props.theme.colors.red
222
- : props.noBorder
223
- ? 'none'
224
- : props.borderColor
225
- ? props.theme.colors[props.borderColor]
226
- ? '1px solid ' + props.theme.colors[props.borderColor]
227
- : '1px solid ' + props.borderColor
228
- : '1px solid ' + props.theme.colors.grey4};
229
- height: ${(props) => props.inputHeight};
230
- max-height: ${(props) => props.inputHeight};
231
- padding: ${({ colorMode }) =>
232
- colorMode === 'transparent' ? '10px 15px' : '0 10px'};
233
- padding-right: ${({
234
- slotSize,
235
- isError,
236
- showLinearUnitName,
237
- colorMode,
238
- showArrowControls,
239
- }) =>
240
- showArrowControls
241
- ? '40px'
242
- : colorMode === 'transparent'
243
- ? '0'
244
- : slotSize
245
- ? isError && !showLinearUnitName
246
- ? 'calc(' + slotSize + ' + 24px)'
247
- : 'calc(' + slotSize + ' + 10px)'
248
- : isError && !showLinearUnitName
249
- ? '24px'
250
- : '5px'};
251
- border-radius: ${(props) =>
252
- props.isInteractive && props.alignItems != 'vertical'
253
- ? '0 4px 4px 0'
254
- : '4px'};
255
- text-align: ${(props) => props.textAlign};
256
- cursor: ${(props) =>
257
- props.isDisabled || props.readOnly ? 'not-allowed' : 'auto'};
258
- font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
259
- color: ${(props) =>
260
- props.isError
261
- ? props.theme.colors.grey6
262
- : props.isDisabled
263
- ? props.colorMode === 'transparent'
264
- ? props.theme.colors.white
265
- : props.theme.colors.grey2
266
- : props.fontColor
267
- ? props.fontColor + ' !important'
268
- : props.theme.colors.black};
269
- background-color: ${(props) =>
270
- props.readOnly
271
- ? props.theme.semanticColors.grey[300]
272
- : props.isDisabled
273
- ? props.colorMode === 'transparent'
274
- ? 'transparent'
275
- : props.theme.colors.grey5
276
- : props.backgroundColor
277
- ? props.backgroundColor + ' !important'
278
- : props.theme.colors.white};
279
- width: ${(props) =>
280
- props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
281
- min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
282
- box-sizing: border-box;
283
- opacity: ${(props) =>
284
- props.isDisabled && props.colorMode === 'transparent' ? '0.4' : '1'};
285
- pointer-events: ${(props) => (props.readOnly ? 'none' : 'auto')};
286
- user-select: ${(props) => (props.readOnly ? 'none' : 'auto')};
287
-
288
- &::placeholder {
289
- color: ${(props) => props.theme.colors.grey2};
290
- }
291
-
292
- &:focus {
293
- outline: none;
294
- }
295
- `
296
-
297
- const ArrowControlsProps = {
298
- colorMode: String,
299
- }
300
- const ArrowControls = styled('div', ArrowControlsProps)`
301
- position: absolute;
302
- right: 0;
303
- top: 0;
304
- bottom: 0;
305
- display: grid;
306
- grid-template-rows: 1fr auto 1fr;
307
- align-items: center;
308
- justify-items: center;
309
- cursor: pointer;
310
- width: 30px;
311
- background-color: ${(props) =>
312
- props.colorMode === 'transparent'
313
- ? 'transparent'
314
- : props.theme.colors.white};
315
- border-left: 1px solid
316
- ${(props) =>
317
- props.colorMode === 'transparent'
318
- ? props.theme.colors.white
319
- : props.theme.colors.black};
320
- `
321
-
322
- const ArrowButtonProps = {
323
- isDisabled: Boolean,
324
- }
325
- const ArrowButton = styled('button', ArrowButtonProps)`
326
- background: transparent;
327
- opacity: ${(props) => (props.isDisabled ? '0.2' : '1')};
328
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
329
- display: flex;
330
- align-items: center;
331
- justify-content: center;
332
- padding: 0;
333
- width: 100%;
334
- height: 100%;
335
- `
336
-
337
- const ArrowDivider = styled('div', ArrowControlsProps)`
338
- width: 100%;
339
- height: 1px;
340
- background-color: ${(props) =>
341
- props.colorMode === 'transparent'
342
- ? props.theme.colors.white
343
- : props.theme.colors.black};
344
- `
345
-
346
- const InputWrapper = styled.span`
347
- position: relative;
348
- `
349
-
350
- const UnitContainer = styled('span', inputProps)`
351
- border-left: 1px solid
352
- ${(props) =>
353
- props.isError
354
- ? props.theme.colors.red
355
- : props.hasLength
356
- ? props.theme.colors.black
357
- : props.theme.colors.mediumGray};
358
- position: absolute;
359
- right: 10px;
360
- top: 10px;
361
- padding-left: 10px;
362
- text-align: right;
363
- color: ${(props) =>
364
- props.isError
365
- ? props.theme.colors.red
366
- : props.hasLength
367
- ? props.theme.colors.black
368
- : props.theme.colors.mediumGray};
369
- `
370
-
371
- const SlotContainer = styled('span', inputProps)`
372
- text-align: right;
373
- border-left: 1px solid
374
- ${(props) =>
375
- props.isError
376
- ? props.theme.colors.red
377
- : props.hasLength
378
- ? props.theme.colors.black
379
- : props.theme.colors.mediumGray};
380
- position: absolute;
381
- width: ${(props) =>
382
- props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
383
- right: 10px;
384
- top: 10px;
385
- padding-left: 10px;
386
- color: ${(props) =>
387
- props.isError
388
- ? props.theme.colors.red
389
- : props.hasLength
390
- ? props.theme.colors.black
391
- : props.theme.colors.mediumGray};
392
- `
393
-
394
- const LabelWrapper = styled('div', inputProps)`
395
- display: flex;
396
- align-items: center;
397
- gap: 10px;
398
- margin-bottom: 8px;
399
- cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
400
- `
401
- const LabelSlotWrapper = styled('div', inputProps)`
402
- display: flex;
403
- gap: 10px;
404
- align-items: center;
405
- cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
406
- border: ${(props) =>
407
- props.alignItems == 'vertical'
408
- ? 'none'
409
- : props.isError
410
- ? '1px solid ' + props.theme.colors.red
411
- : props.noBorder
412
- ? 'none'
413
- : props.borderColor
414
- ? props.theme.colors[props.borderColor]
415
- ? '1px solid ' + props.theme.colors[props.borderColor]
416
- : '1px solid ' + props.borderColor
417
- : '1px solid ' + props.theme.colors.grey4};
418
- border-radius: 4px 0 0 4px;
419
- border-right: none;
420
- `
421
-
422
- const LabelText = styled('div', inputProps)`
423
- font-size: 13px;
424
- color: ${(props) =>
425
- props.theme.colors[props.labelFontColor]
426
- ? props.theme.colors[props.labelFontColor]
427
- : props.labelFontColor};
428
- font-weight: ${(props) => props.labelFontWeight};
429
- `
430
-
431
- const IconAttrs = { size: String, marginRight: Number }
432
- const IconWrapper = styled('div', IconAttrs)`
433
- position: absolute;
434
- top: 0;
435
- bottom: 0;
436
- margin: auto;
437
- right: ${(props) => props.marginRight + 10}px;
438
- height: ${(props) => (props.size ? props.size : 'auto')};
439
- `
440
-
441
- const SelectText = styled.div`
442
- font-size: 13px;
443
- `
444
-
445
- const SelectWrapper = styled.div`
446
- position: absolute;
447
- top: 2px;
448
- right: 2px;
449
- display: flex;
450
- height: 100%;
451
- `
452
-
453
- const Divider = styled.div`
454
- margin-top: 6px;
455
- height: calc(100% - 16px);
456
- width: 1px;
457
- background-color: ${({ theme }) => theme.colors.grey4};
458
- `
459
-
460
- export default {
461
- name: 'InputNumber',
462
- components: {
463
- Container,
464
- InputContainer,
465
- InputWrapper,
466
- UnitContainer,
467
- ErrorMessage,
468
- LabelWrapper,
469
- LabelSlotWrapper,
470
- LabelText,
471
- InfoText,
472
- Icon,
473
- SlotContainer,
474
- IconWrapper,
475
- RCSelect,
476
- RCOption,
477
- SelectWrapper,
478
- SelectText,
479
- Divider,
480
- ArrowControls,
481
- ArrowButton,
482
- ArrowDivider,
483
- },
484
- inheritAttrs: false,
485
- props: {
486
- appTheme: {
487
- type: String,
488
- required: false,
489
- },
490
- placeholder: {
491
- type: String,
492
- required: false,
493
- default: '',
494
- },
495
- isError: {
496
- type: Boolean,
497
- required: false,
498
- default: false,
499
- },
500
- inputWidth: {
501
- type: String,
502
- required: false,
503
- default: null,
504
- },
505
- minWidth: {
506
- type: String,
507
- required: false,
508
- default: null,
509
- },
510
- inputHeight: {
511
- type: String,
512
- required: false,
513
- default: '40px',
514
- },
515
- value: {
516
- required: true,
517
- default: null,
518
- validator: (val) =>
519
- typeof val === 'string' || typeof val === 'number' || val === null,
520
- },
521
- clearInput: {
522
- type: Boolean,
523
- required: false,
524
- default: false,
525
- },
526
- alignItems: {
527
- type: String,
528
- required: false,
529
- default: 'vertical',
530
- },
531
- errorMessage: {
532
- type: String,
533
- required: false,
534
- default: 'Please insert a correct number',
535
- },
536
- numberPrecision: {
537
- type: Number,
538
- required: false,
539
- default: 0,
540
- },
541
- minDecimals: {
542
- type: Number,
543
- required: false,
544
- default: 0,
545
- },
546
- unitName: {
547
- type: String,
548
- required: false,
549
- default: '',
550
- },
551
- showLinearUnitName: {
552
- type: Boolean,
553
- required: false,
554
- default: false,
555
- },
556
- disabled: {
557
- type: Boolean,
558
- required: false,
559
- default: false,
560
- },
561
- noBorder: {
562
- type: Boolean,
563
- required: false,
564
- default: false,
565
- },
566
- borderColor: {
567
- type: String,
568
- required: false,
569
- default: null,
570
- },
571
- textAlign: {
572
- type: String,
573
- required: false,
574
- default: 'left',
575
- },
576
- fontSize: {
577
- type: String,
578
- required: false,
579
- default: '13px',
580
- },
581
- isInteractive: {
582
- type: Boolean,
583
- required: false,
584
- default: false,
585
- },
586
- interactionStep: {
587
- type: Number,
588
- required: false,
589
- default: 1,
590
- },
591
- labelText: {
592
- type: String,
593
- required: false,
594
- default: null,
595
- },
596
- labelInfoText: {
597
- type: String,
598
- required: false,
599
- default: null,
600
- },
601
- labelInfoAlign: {
602
- type: String,
603
- required: false,
604
- default: 'left',
605
- },
606
- defaultNumber: {
607
- type: Number,
608
- required: false,
609
- default: null,
610
- },
611
- minNumber: {
612
- type: Number,
613
- required: false,
614
- default: null,
615
- },
616
- fontColor: {
617
- type: String,
618
- required: false,
619
- default: null,
620
- },
621
- backgroundColor: {
622
- type: String,
623
- required: false,
624
- default: null,
625
- },
626
- numberToStringEnabled: {
627
- type: Boolean,
628
- required: false,
629
- default: true,
630
- },
631
- allowNegative: {
632
- type: Boolean,
633
- required: false,
634
- default: true,
635
- },
636
- slotSize: {
637
- type: String,
638
- required: false,
639
- default: null,
640
- },
641
- labelFontColor: {
642
- type: String,
643
- required: false,
644
- default: 'eturnityGrey',
645
- },
646
- labelFontWeight: {
647
- type: String,
648
- required: false,
649
- default: '700',
650
- },
651
- focus: {
652
- type: Boolean,
653
- required: false,
654
- default: false,
655
- },
656
- labelDataId: {
657
- type: String,
658
- required: false,
659
- default: '',
660
- },
661
- inputDataId: {
662
- type: String,
663
- required: false,
664
- default: '',
665
- },
666
- dataQaId: {
667
- required: false,
668
- default: '',
669
- },
670
- showSelect: {
671
- type: Boolean,
672
- default: false,
673
- },
674
- selectWidth: {
675
- type: Number,
676
- default: 70,
677
- },
678
- selectOptions: {
679
- type: Array,
680
- default: () => [],
681
- },
682
- selectValue: {
683
- type: [String, Number],
684
- default: null,
685
- },
686
- isSelectDisabled: {
687
- type: Boolean,
688
- default: false,
689
- },
690
- colorMode: {
691
- type: String,
692
- default: '',
693
- },
694
- showArrowControls: {
695
- type: Boolean,
696
- default: false,
697
- },
698
- isReadOnly: {
699
- type: Boolean,
700
- default: false,
701
- },
702
- },
703
- data() {
704
- return {
705
- textInput: '',
706
- isFocused: false,
707
- warningIcon: warningIcon,
708
- }
709
- },
710
- computed: {
711
- displayedPlaceholder() {
712
- if (this.placeholder) return this.placeholder
713
- if (this.defaultNumber)
714
- return `${this.defaultNumber} ${this.unitName ? this.unitName : ''}`
715
- return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
716
- },
717
- hasSlot() {
718
- return !!this.$slots.default
719
- },
720
- hasLabelSlot() {
721
- return !!this.$slots.label
722
- },
723
- getSelectValue() {
724
- const item = this.selectOptions.find(
725
- ({ value }) => value === this.selectValue
726
- )
727
-
728
- return item ? item.label : '-'
729
- },
730
- },
731
- watch: {
732
- focus(value) {
733
- if (value) {
734
- this.focusInput()
735
- }
736
- },
737
- clearInput: function (value) {
738
- if (value) {
739
- // If the value is typed, then we should clear the textInput on Continue
740
- this.textInput = ''
741
- }
742
- },
743
- },
744
- created() {
745
- if (this.value) {
746
- this.textInput = numberToString({
747
- value: this.value,
748
- numberPrecision: this.numberPrecision,
749
- minDecimals: this.minDecimals,
750
- })
751
- } else if (this.defaultNumber !== null) {
752
- this.textInput = numberToString({
753
- value: this.defaultNumber,
754
- numberPrecision: this.numberPrecision,
755
- minDecimals: this.minDecimals,
756
- })
757
- } else if (this.minNumber !== null) {
758
- this.textInput = numberToString({
759
- value: this.minNumber,
760
- numberPrecision: this.numberPrecision,
761
- minDecimals: this.minDecimals,
762
- })
763
- }
764
- },
765
- mounted() {
766
- if (this.focus) {
767
- this.focusInput()
768
- }
769
- },
770
- methods: {
771
- incrementValue() {
772
- const currentValue = Math.max(
773
- parseFloat(this.textInput || 0),
774
- this.minNumber || 0
775
- )
776
- const newValue = currentValue + this.interactionStep
777
- this.textInput = numberToString({
778
- value: newValue,
779
- numberPrecision: this.numberPrecision,
780
- minDecimals: this.minDecimals,
781
- })
782
- this.$emit('on-input', newValue)
783
- this.$emit('input-change', newValue)
784
- },
785
- decrementValue() {
786
- const currentValue = Math.max(
787
- parseFloat(this.textInput || 0),
788
- this.minNumber || 0
789
- )
790
- const newValue = currentValue - this.interactionStep
791
- if (this.allowNegative || newValue >= 0) {
792
- this.textInput = numberToString({
793
- value: newValue,
794
- numberPrecision: this.numberPrecision,
795
- minDecimals: this.minDecimals,
796
- })
797
- this.$emit('on-input', newValue)
798
- this.$emit('input-change', newValue)
799
- }
800
- },
801
- onEnterPress() {
802
- this.$emit('on-enter-click')
803
- this.$refs.inputField1.$el.blur()
804
- },
805
- onChangeHandler(event) {
806
- if (isNaN(event) || event === '') {
807
- event = this.defaultNumber
808
- ? this.defaultNumber
809
- : this.minNumber || this.minNumber === 0
810
- ? this.minNumber
811
- : event
812
- }
813
- if (!this.allowNegative) {
814
- event = Math.abs(event)
815
- }
816
- if (this.minNumber && this.minNumber > event) {
817
- event = this.minNumber
818
- }
819
- event = parseFloat(event)
820
- // Need to return an integer rather than a string
821
- this.$emit('input-change', event)
822
- },
823
- onEvaluateCode(event) {
824
- // function to perform math on the code
825
- // filter the string in case of any malicious content
826
- const val = event.target.value
827
- let filtered = val.replace('(auto)', '').replace(/[^-()\d/*+.,]/g, '')
828
- filtered = filtered.split(/([-+*/()])/)
829
- let formatted = filtered.map((item) => {
830
- if (
831
- item === '+' ||
832
- item === '-' ||
833
- item === '*' ||
834
- item === '/' ||
835
- item === '(' ||
836
- item === ')' ||
837
- item === ''
838
- ) {
839
- return item
840
- } else {
841
- let num = stringToNumber({
842
- value: item,
843
- numberPrecision: false,
844
- minDecimals: this.minDecimals,
845
- })
846
- return num
847
- }
848
- })
849
- let evaluated
850
- formatted = this.removeStringItemsAfterLastNumber(formatted)
851
- evaluated = eval(formatted.join(' '))
852
- if (typeof evaluated === 'string') {
853
- evaluated = stringToNumber({
854
- value: evaluated,
855
- numberPrecision: this.numberPrecision,
856
- minDecimals: this.minDecimals,
857
- })
858
- } else if (typeof evaluated === 'number') {
859
- evaluated = evaluated.toFixed(this.numberPrecision)
860
- }
861
- return evaluated
862
- },
863
- removeStringItemsAfterLastNumber(array) {
864
- // fixed in EPDM-6487, in order to prevent 'Unexpected end of input'
865
- let lastNumberIndex = -1
866
- // Find the index of the last number in the array
867
- for (let i = array.length - 1; i >= 0; i--) {
868
- if (typeof array[i] === 'number') {
869
- lastNumberIndex = i
870
- break
871
- }
872
- }
873
- // if there are no numbers, return an empty array
874
- if (lastNumberIndex === -1) {
875
- return []
876
- }
877
- // Remove non-numeric items after the last number
878
- if (lastNumberIndex !== -1) {
879
- const newArray = array.slice(0, lastNumberIndex + 1)
880
- return newArray
881
- }
882
- return array
883
- },
884
- onInput(event) {
885
- if (!this.isFocused) {
886
- return
887
- }
888
- if (event.target.value === '') {
889
- this.$emit('on-input', '')
890
- }
891
- let evaluatedVal
892
- try {
893
- evaluatedVal = this.onEvaluateCode(event)
894
- } finally {
895
- if (evaluatedVal && this.value != evaluatedVal) {
896
- this.$emit('on-input', evaluatedVal)
897
- }
898
- }
899
- this.textInput = evaluatedVal
900
- },
901
- onInputBlur(e) {
902
- this.isFocused = false
903
- let value = e.target.value
904
- let evaluatedInput = this.onEvaluateCode(e)
905
- this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
906
- if ((evaluatedInput && value.length) || this.minNumber !== null) {
907
- this.textInput = numberToString({
908
- value:
909
- evaluatedInput && value.length
910
- ? evaluatedInput
911
- : this.defaultNumber
912
- ? this.defaultNumber
913
- : this.minNumber,
914
- numberPrecision: this.numberPrecision,
915
- minDecimals: this.minDecimals,
916
- })
917
- }
918
- let adjustedMinValue =
919
- evaluatedInput && evaluatedInput.length
920
- ? evaluatedInput
921
- : this.defaultNumber
922
- ? this.defaultNumber
923
- : this.minNumber || this.minNumber === 0
924
- ? this.minNumber
925
- : ''
926
- this.$emit('input-blur', adjustedMinValue)
927
- },
928
- focusInput() {
929
- if (this.disabled) {
930
- return
931
- }
932
- this.isFocused = true
933
- this.$nextTick(() => {
934
- this.$refs.inputField1.$el.select()
935
- })
936
- this.$emit('input-focus')
937
- },
938
- blurInput() {
939
- if (this.disabled) {
940
- return
941
- }
942
- this.isFocused = false
943
- this.$nextTick(() => {
944
- this.$refs.inputField1.$el.blur()
945
- })
946
- },
947
- formatWithCurrency(value) {
948
- let adjustedMinValue =
949
- value || value === 0
950
- ? value
951
- : this.defaultNumber
952
- ? this.defaultNumber
953
- : this.minNumber || this.minNumber === 0
954
- ? this.minNumber
955
- : ''
956
- if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
957
- let input = this.numberToStringEnabled
958
- ? numberToString({
959
- value: adjustedMinValue,
960
- numberPrecision: this.numberPrecision,
961
- minDecimals: this.minDecimals,
962
- })
963
- : adjustedMinValue
964
- let unit = this.showLinearUnitName ? '' : this.unitName
965
- //return input + ' ' + unit
966
- return input + ' ' + unit
967
- } else if (!adjustedMinValue && adjustedMinValue !== 0) {
968
- return ''
969
- } else {
970
- return this.numberToStringEnabled
971
- ? numberToString({
972
- value: adjustedMinValue,
973
- numberPrecision: this.numberPrecision,
974
- minDecimals: this.minDecimals,
975
- })
976
- : adjustedMinValue
977
- }
978
- },
979
- initInteraction(e) {
980
- this.focusInput()
981
- e.preventDefault()
982
- window.addEventListener('mousemove', this.interact, false)
983
- window.addEventListener('mouseup', this.stopInteract, false)
984
- },
985
- interact(e) {
986
- e.preventDefault()
987
- let value = parseFloat(this.value || 0)
988
- value += parseFloat(this.interactionStep) * parseInt(e.movementX)
989
- this.$emit('on-input-drag', value)
990
-
991
- this.textInput = numberToString({
992
- value: value && value.length ? value : this.minNumber,
993
- numberPrecision: this.numberPrecision,
994
- minDecimals: this.minDecimals,
995
- })
996
- //this.value=value
997
- },
998
- stopInteract(e) {
999
- e.preventDefault()
1000
- window.removeEventListener('mousemove', this.interact, false)
1001
- window.removeEventListener('mouseup', this.stopInteract, false)
1002
- this.blurInput()
1003
- },
1004
- },
1005
- }
1006
- </script>
1
+ <template>
2
+ <Container :align-items="alignItems" :input-width="inputWidth">
3
+ <LabelSlotWrapper
4
+ v-if="hasLabelSlot"
5
+ :align-items="alignItems"
6
+ :border-color="borderColor"
7
+ :is-error="isError"
8
+ :is-interactive="isInteractive"
9
+ :no-border="noBorder"
10
+ @mousedown="initInteraction"
11
+ >
12
+ <slot name="label"></slot>
13
+ </LabelSlotWrapper>
14
+
15
+ <LabelWrapper v-if="labelText">
16
+ <LabelText
17
+ :data-id="labelDataId"
18
+ :data-test-id="labelDataTestId"
19
+ :label-font-color="labelFontColor"
20
+ :label-font-weight="labelFontWeight"
21
+ >
22
+ {{ labelText }}
23
+ </LabelText>
24
+
25
+ <InfoText
26
+ v-if="labelInfoText"
27
+ :align-arrow="labelInfoAlign"
28
+ :app-theme="appTheme"
29
+ :text="labelInfoText"
30
+ />
31
+ </LabelWrapper>
32
+ <InputWrapper>
33
+ <InputInfoText
34
+ v-if="!!inputInfoText"
35
+ info-position="bottom"
36
+ :text="inputInfoText"
37
+ >
38
+ <template #trigger>
39
+ <InputContainer
40
+ v-bind="$attrs"
41
+ ref="inputField1"
42
+ :align-items="alignItems"
43
+ :background-color="
44
+ colorMode === 'transparent' ? 'transparent' : backgroundColor
45
+ "
46
+ :border-color="
47
+ colorMode === 'transparent' && !borderColor
48
+ ? 'white'
49
+ : borderColor
50
+ "
51
+ :color-mode="colorMode"
52
+ :data-id="inputDataId"
53
+ :data-qa-id="dataQaId"
54
+ :disabled="disabled"
55
+ :font-color="colorMode === 'transparent' ? 'white' : fontColor"
56
+ :font-size="fontSize"
57
+ :has-label-slot="hasLabelSlot"
58
+ :has-slot="hasSlot"
59
+ :has-unit="unitName && !!unitName.length"
60
+ :input-height="inputHeight"
61
+ :is-border-error-only="isBorderErrorOnly"
62
+ :is-disabled="disabled"
63
+ :is-error="isError"
64
+ :is-info-border="isInfoBorder"
65
+ :is-interactive="isInteractive"
66
+ :min-width="minWidth"
67
+ :no-border="noBorder"
68
+ :placeholder="displayedPlaceholder"
69
+ :read-only="isReadOnly"
70
+ :readonly="isReadOnly"
71
+ :show-arrow-controls="showArrowControls"
72
+ :show-linear-unit-name="showLinearUnitName"
73
+ :slot-size="slotSize"
74
+ :text-align="textAlign"
75
+ :value="formatWithCurrency(value)"
76
+ @blur="onInputBlur($event)"
77
+ @focus="focusInput()"
78
+ @input="onInput($event)"
79
+ @keydown.down="decrementValue"
80
+ @keydown.up="incrementValue"
81
+ @keyup.enter="onEnterPress"
82
+ />
83
+ </template>
84
+ </InputInfoText>
85
+
86
+ <InputContainer
87
+ v-else
88
+ v-bind="$attrs"
89
+ ref="inputField1"
90
+ :align-items="alignItems"
91
+ :background-color="
92
+ colorMode === 'transparent' ? 'transparent' : backgroundColor
93
+ "
94
+ :border-color="
95
+ colorMode === 'transparent' && !borderColor ? 'white' : borderColor
96
+ "
97
+ :color-mode="colorMode"
98
+ :data-id="inputDataId"
99
+ :data-qa-id="dataQaId"
100
+ :disabled="disabled"
101
+ :font-color="colorMode === 'transparent' ? 'white' : fontColor"
102
+ :font-size="fontSize"
103
+ :has-label-slot="hasLabelSlot"
104
+ :has-slot="hasSlot"
105
+ :has-unit="unitName && !!unitName.length"
106
+ :input-height="inputHeight"
107
+ :is-border-error-only="isBorderErrorOnly"
108
+ :is-disabled="disabled"
109
+ :is-error="isError"
110
+ :is-info-border="isInfoBorder"
111
+ :is-interactive="isInteractive"
112
+ :min-width="minWidth"
113
+ :no-border="noBorder"
114
+ :placeholder="displayedPlaceholder"
115
+ :read-only="isReadOnly"
116
+ :readonly="isReadOnly"
117
+ :show-arrow-controls="showArrowControls"
118
+ :show-linear-unit-name="showLinearUnitName"
119
+ :slot-size="slotSize"
120
+ :text-align="textAlign"
121
+ :value="formatWithCurrency(value)"
122
+ @blur="onInputBlur($event)"
123
+ @focus="focusInput()"
124
+ @input="onInput($event)"
125
+ @keydown.down="decrementValue"
126
+ @keydown.up="incrementValue"
127
+ @keyup.enter="onEnterPress"
128
+ />
129
+
130
+ <SlotContainer v-if="hasSlot" :is-error="isError" :slot-size="slotSize">
131
+ <slot></slot>
132
+ </SlotContainer>
133
+
134
+ <UnitContainer
135
+ v-if="unitName && showLinearUnitName && !hasSlot"
136
+ :has-length="!!textInput.length"
137
+ :is-error="isError"
138
+ >{{ unitName }}</UnitContainer
139
+ >
140
+ <IconWrapper
141
+ v-if="isError && !showLinearUnitName && !isBorderErrorOnly"
142
+ :margin-right="showSelect ? selectWidth : 0"
143
+ size="16px"
144
+ >
145
+ <Icon cursor="default" name="warning" size="16px" />
146
+ </IconWrapper>
147
+ <SelectWrapper v-if="showSelect">
148
+ <Divider />
149
+ <RCSelect
150
+ :disabled="isSelectDisabled"
151
+ :select-width="`${selectWidth}px`"
152
+ :show-border="false"
153
+ @input-change="$emit('select-change', $event)"
154
+ >
155
+ <template #selector>
156
+ <SelectText>{{ getSelectValue }}</SelectText>
157
+ </template>
158
+ <template #dropdown>
159
+ <RCOption
160
+ v-for="item in selectOptions"
161
+ :key="item.value"
162
+ :value="item.value"
163
+ >
164
+ {{ item.label }}
165
+ </RCOption>
166
+ </template>
167
+ </RCSelect>
168
+ </SelectWrapper>
169
+
170
+ <ArrowControls
171
+ v-if="!disabled && showArrowControls"
172
+ :color-mode="colorMode"
173
+ >
174
+ <ArrowButton @click="incrementValue">
175
+ <Icon
176
+ :color="colorMode === 'transparent' ? 'white' : undefined"
177
+ name="arrow_up"
178
+ size="8px"
179
+ />
180
+ </ArrowButton>
181
+ <ArrowDivider :color-mode="colorMode" />
182
+ <ArrowButton
183
+ :is-disabled="textInput <= minNumber"
184
+ @click="decrementValue"
185
+ >
186
+ <Icon
187
+ :color="colorMode === 'transparent' ? 'white' : undefined"
188
+ :disabled="textInput <= minNumber"
189
+ name="arrow_down"
190
+ size="8px"
191
+ />
192
+ </ArrowButton>
193
+ </ArrowControls>
194
+ </InputWrapper>
195
+ <ErrorMessage v-if="isError && errorMessage">{{
196
+ errorMessage
197
+ }}</ErrorMessage>
198
+ </Container>
199
+ </template>
200
+
201
+ <script>
202
+ // import InputNumber from "@eturnity/eturnity_reusable_components/src/components/inputs/inputNumber"
203
+ //This component should be used for questions with input fields only
204
+ //How to use:
205
+ // <input-number
206
+ // placeholder="Enter distance"
207
+ // :isError="false" //default is false
208
+ // inputWidth="150px" //by default, this is 100%
209
+ // minWidth="100px"
210
+ // :numberPrecision="3"
211
+ // minDecimals="2"
212
+ // unitName="pc"
213
+ // :value="inputValue" //required -- String
214
+ // @input-change="onInputChange($event)" //required
215
+ // @on-enter-click="onInputSubmit()"
216
+ // :errorMessage="Enter a number between 1 and 10"
217
+ // :disabled="false"
218
+ // :noBorder="true"
219
+ // textAlign="left" // "left, right, center"
220
+ // :showLinearUnitName="true"
221
+ // fontSize="13px"
222
+ // labelText="Number of Modules"
223
+ // labelInfoText="Here is some information for you..."
224
+ // labelInfoAlign="left"
225
+ // :minNumber="0"
226
+ // fontColor="blue"
227
+ // :isReadOnly="true"
228
+ // colorMode="transparent" // Makes background transparent, border white, and font white
229
+ // >
230
+ //<template name=label><img>....</template>
231
+ //</inputNumber>
232
+ import styled from 'vue3-styled-components'
233
+ import {
234
+ stringToNumber,
235
+ numberToString,
236
+ } from '../../../helpers/numberConverter'
237
+ import InfoText from '../../infoText'
238
+ import ErrorMessage from '../../errorMessage'
239
+ import RCSelect from '../select'
240
+ import RCOption from '../select/option'
241
+ import warningIcon from '../../../assets/icons/error_icon.png'
242
+ import Icon from '../../icon'
243
+
244
+ const inputProps = {
245
+ isError: Boolean,
246
+ hasUnit: Boolean,
247
+ inputWidth: String,
248
+ minWidth: String,
249
+ isDisabled: Boolean,
250
+ noBorder: Boolean,
251
+ textAlign: String,
252
+ fontSize: String,
253
+ fontColor: String,
254
+ backgroundColor: String,
255
+ hasSlot: Boolean,
256
+ hasLabelSlot: Boolean,
257
+ slotSize: String,
258
+ inputHeight: String,
259
+ isInteractive: Boolean,
260
+ alignItems: String,
261
+ labelFontColor: String,
262
+ labelFontWeight: String,
263
+ borderColor: String,
264
+ showLinearUnitName: Boolean,
265
+ colorMode: String,
266
+ showArrowControls: Boolean,
267
+ readOnly: Boolean,
268
+ isBorderErrorOnly: Boolean,
269
+ isInfoBorder: Boolean,
270
+ }
271
+
272
+ const Container = styled('div', inputProps)`
273
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
274
+ position: relative;
275
+ display: grid;
276
+ grid-template-columns: ${(props) =>
277
+ props.alignItems === 'vertical' ? '1fr' : 'auto 1fr'};
278
+ `
279
+
280
+ const InputContainer = styled('input', inputProps)`
281
+ border: ${(props) =>
282
+ props.isInfoBorder
283
+ ? '1px solid ' + props.theme.semanticColors.blue[500]
284
+ : props.isError
285
+ ? '1px solid ' + props.theme.colors.red
286
+ : props.noBorder
287
+ ? 'none'
288
+ : props.borderColor
289
+ ? props.theme.colors[props.borderColor]
290
+ ? '1px solid ' + props.theme.colors[props.borderColor]
291
+ : '1px solid ' + props.borderColor
292
+ : '1px solid ' + props.theme.colors.grey4};
293
+ height: ${(props) => props.inputHeight};
294
+ max-height: ${(props) => props.inputHeight};
295
+ padding: ${({ colorMode }) =>
296
+ colorMode === 'transparent' ? '10px 15px' : '0 10px'};
297
+ padding-right: ${({
298
+ slotSize,
299
+ isError,
300
+ showLinearUnitName,
301
+ colorMode,
302
+ showArrowControls,
303
+ isBorderErrorOnly,
304
+ }) =>
305
+ showArrowControls
306
+ ? '40px'
307
+ : colorMode === 'transparent'
308
+ ? '0'
309
+ : slotSize
310
+ ? isError && !showLinearUnitName && !isBorderErrorOnly
311
+ ? 'calc(' + slotSize + ' + 24px)'
312
+ : 'calc(' + slotSize + ' + 10px)'
313
+ : isError && !showLinearUnitName && !isBorderErrorOnly
314
+ ? '24px'
315
+ : '5px'};
316
+ border-radius: ${(props) =>
317
+ props.isInteractive && props.alignItems != 'vertical'
318
+ ? '0 4px 4px 0'
319
+ : '4px'};
320
+ text-align: ${(props) => props.textAlign};
321
+ cursor: ${(props) =>
322
+ props.isDisabled || props.readOnly ? 'not-allowed' : 'auto'};
323
+ font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
324
+ color: ${(props) =>
325
+ props.isError
326
+ ? props.theme.colors.grey6
327
+ : props.isDisabled
328
+ ? props.colorMode === 'transparent'
329
+ ? props.theme.colors.white
330
+ : props.theme.colors.grey2
331
+ : props.fontColor
332
+ ? props.fontColor + ' !important'
333
+ : props.theme.colors.black};
334
+ background-color: ${(props) =>
335
+ props.readOnly
336
+ ? props.theme.semanticColors.grey[300]
337
+ : props.isDisabled
338
+ ? props.colorMode === 'transparent'
339
+ ? 'transparent'
340
+ : props.theme.colors.grey5
341
+ : props.backgroundColor
342
+ ? props.backgroundColor + ' !important'
343
+ : props.theme.colors.white};
344
+ width: ${(props) =>
345
+ props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
346
+ min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
347
+ box-sizing: border-box;
348
+ opacity: ${(props) =>
349
+ props.isDisabled && props.colorMode === 'transparent' ? '0.4' : '1'};
350
+ pointer-events: ${(props) => (props.readOnly ? 'none' : 'auto')};
351
+ user-select: ${(props) => (props.readOnly ? 'none' : 'auto')};
352
+
353
+ &::placeholder {
354
+ color: ${(props) => props.theme.colors.grey2};
355
+ }
356
+
357
+ &:focus {
358
+ outline: none;
359
+ }
360
+ `
361
+
362
+ const ArrowControlsProps = {
363
+ colorMode: String,
364
+ }
365
+ const ArrowControls = styled('div', ArrowControlsProps)`
366
+ position: absolute;
367
+ right: 0;
368
+ top: 0;
369
+ bottom: 0;
370
+ display: grid;
371
+ grid-template-rows: 1fr auto 1fr;
372
+ align-items: center;
373
+ justify-items: center;
374
+ cursor: pointer;
375
+ width: 30px;
376
+ background-color: ${(props) =>
377
+ props.colorMode === 'transparent'
378
+ ? 'transparent'
379
+ : props.theme.colors.white};
380
+ border-left: 1px solid
381
+ ${(props) =>
382
+ props.colorMode === 'transparent'
383
+ ? props.theme.colors.white
384
+ : props.theme.colors.black};
385
+ `
386
+
387
+ const ArrowButtonProps = {
388
+ isDisabled: Boolean,
389
+ }
390
+ const ArrowButton = styled('button', ArrowButtonProps)`
391
+ background: transparent;
392
+ opacity: ${(props) => (props.isDisabled ? '0.2' : '1')};
393
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
394
+ display: flex;
395
+ align-items: center;
396
+ justify-content: center;
397
+ padding: 0;
398
+ width: 100%;
399
+ height: 100%;
400
+ `
401
+
402
+ const ArrowDivider = styled('div', ArrowControlsProps)`
403
+ width: 100%;
404
+ height: 1px;
405
+ background-color: ${(props) =>
406
+ props.colorMode === 'transparent'
407
+ ? props.theme.colors.white
408
+ : props.theme.colors.black};
409
+ `
410
+
411
+ const InputWrapper = styled.span`
412
+ position: relative;
413
+ `
414
+
415
+ const UnitContainer = styled('span', inputProps)`
416
+ border-left: 1px solid
417
+ ${(props) =>
418
+ props.isError
419
+ ? props.theme.colors.red
420
+ : props.hasLength
421
+ ? props.theme.colors.black
422
+ : props.theme.colors.mediumGray};
423
+ position: absolute;
424
+ right: 10px;
425
+ top: 10px;
426
+ padding-left: 10px;
427
+ text-align: right;
428
+ color: ${(props) =>
429
+ props.isError
430
+ ? props.theme.colors.red
431
+ : props.hasLength
432
+ ? props.theme.colors.black
433
+ : props.theme.colors.mediumGray};
434
+ `
435
+
436
+ const SlotContainer = styled('span', inputProps)`
437
+ text-align: right;
438
+ border-left: 1px solid
439
+ ${(props) =>
440
+ props.isError
441
+ ? props.theme.colors.red
442
+ : props.hasLength
443
+ ? props.theme.colors.black
444
+ : props.theme.colors.mediumGray};
445
+ position: absolute;
446
+ width: ${(props) =>
447
+ props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
448
+ right: 10px;
449
+ top: 10px;
450
+ padding-left: 10px;
451
+ color: ${(props) =>
452
+ props.isError
453
+ ? props.theme.colors.red
454
+ : props.hasLength
455
+ ? props.theme.colors.black
456
+ : props.theme.colors.mediumGray};
457
+ `
458
+
459
+ const LabelWrapper = styled('div', inputProps)`
460
+ display: flex;
461
+ align-items: center;
462
+ gap: 10px;
463
+ margin-bottom: 8px;
464
+ cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
465
+ `
466
+ const LabelSlotWrapper = styled('div', inputProps)`
467
+ display: flex;
468
+ gap: 10px;
469
+ align-items: center;
470
+ cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
471
+ border: ${(props) =>
472
+ props.alignItems == 'vertical'
473
+ ? 'none'
474
+ : props.isError
475
+ ? '1px solid ' + props.theme.colors.red
476
+ : props.noBorder
477
+ ? 'none'
478
+ : props.borderColor
479
+ ? props.theme.colors[props.borderColor]
480
+ ? '1px solid ' + props.theme.colors[props.borderColor]
481
+ : '1px solid ' + props.borderColor
482
+ : '1px solid ' + props.theme.colors.grey4};
483
+ border-radius: 4px 0 0 4px;
484
+ border-right: none;
485
+ `
486
+
487
+ const LabelText = styled('div', inputProps)`
488
+ font-size: 13px;
489
+ color: ${(props) =>
490
+ props.theme.colors[props.labelFontColor]
491
+ ? props.theme.colors[props.labelFontColor]
492
+ : props.labelFontColor};
493
+ font-weight: ${(props) => props.labelFontWeight};
494
+ `
495
+
496
+ const IconAttrs = { size: String, marginRight: Number }
497
+ const IconWrapper = styled('div', IconAttrs)`
498
+ position: absolute;
499
+ top: 0;
500
+ bottom: 0;
501
+ margin: auto;
502
+ right: ${(props) => props.marginRight + 10}px;
503
+ height: ${(props) => (props.size ? props.size : 'auto')};
504
+ `
505
+
506
+ const SelectText = styled.div`
507
+ font-size: 13px;
508
+ `
509
+
510
+ const SelectWrapper = styled.div`
511
+ position: absolute;
512
+ top: 2px;
513
+ right: 2px;
514
+ display: flex;
515
+ height: 100%;
516
+ `
517
+
518
+ const Divider = styled.div`
519
+ margin-top: 6px;
520
+ height: calc(100% - 16px);
521
+ width: 1px;
522
+ background-color: ${({ theme }) => theme.colors.grey4};
523
+ `
524
+
525
+ const InputInfoText = styled(InfoText)`
526
+ width: 100%;
527
+ `
528
+
529
+ export default {
530
+ name: 'InputNumber',
531
+ components: {
532
+ Container,
533
+ InputContainer,
534
+ InputWrapper,
535
+ UnitContainer,
536
+ ErrorMessage,
537
+ LabelWrapper,
538
+ LabelSlotWrapper,
539
+ LabelText,
540
+ InfoText,
541
+ Icon,
542
+ SlotContainer,
543
+ IconWrapper,
544
+ RCSelect,
545
+ RCOption,
546
+ SelectWrapper,
547
+ SelectText,
548
+ Divider,
549
+ ArrowControls,
550
+ ArrowButton,
551
+ ArrowDivider,
552
+ InputInfoText,
553
+ },
554
+ inheritAttrs: false,
555
+ props: {
556
+ appTheme: {
557
+ type: String,
558
+ required: false,
559
+ },
560
+ placeholder: {
561
+ type: String,
562
+ required: false,
563
+ default: '',
564
+ },
565
+ isError: {
566
+ type: Boolean,
567
+ required: false,
568
+ default: false,
569
+ },
570
+ inputWidth: {
571
+ type: String,
572
+ required: false,
573
+ default: null,
574
+ },
575
+ minWidth: {
576
+ type: String,
577
+ required: false,
578
+ default: null,
579
+ },
580
+ inputHeight: {
581
+ type: String,
582
+ required: false,
583
+ default: '40px',
584
+ },
585
+ value: {
586
+ required: true,
587
+ default: null,
588
+ validator: (val) =>
589
+ typeof val === 'string' || typeof val === 'number' || val === null,
590
+ },
591
+ clearInput: {
592
+ type: Boolean,
593
+ required: false,
594
+ default: false,
595
+ },
596
+ alignItems: {
597
+ type: String,
598
+ required: false,
599
+ default: 'vertical',
600
+ },
601
+ errorMessage: {
602
+ type: String,
603
+ required: false,
604
+ default: 'Please insert a correct number',
605
+ },
606
+ numberPrecision: {
607
+ type: Number,
608
+ required: false,
609
+ default: 0,
610
+ },
611
+ minDecimals: {
612
+ type: Number,
613
+ required: false,
614
+ default: 0,
615
+ },
616
+ unitName: {
617
+ type: String,
618
+ required: false,
619
+ default: '',
620
+ },
621
+ showLinearUnitName: {
622
+ type: Boolean,
623
+ required: false,
624
+ default: false,
625
+ },
626
+ disabled: {
627
+ type: Boolean,
628
+ required: false,
629
+ default: false,
630
+ },
631
+ noBorder: {
632
+ type: Boolean,
633
+ required: false,
634
+ default: false,
635
+ },
636
+ borderColor: {
637
+ type: String,
638
+ required: false,
639
+ default: null,
640
+ },
641
+ textAlign: {
642
+ type: String,
643
+ required: false,
644
+ default: 'left',
645
+ },
646
+ fontSize: {
647
+ type: String,
648
+ required: false,
649
+ default: '13px',
650
+ },
651
+ isInteractive: {
652
+ type: Boolean,
653
+ required: false,
654
+ default: false,
655
+ },
656
+ interactionStep: {
657
+ type: Number,
658
+ required: false,
659
+ default: 1,
660
+ },
661
+ labelText: {
662
+ type: String,
663
+ required: false,
664
+ default: null,
665
+ },
666
+ labelInfoText: {
667
+ type: String,
668
+ required: false,
669
+ default: null,
670
+ },
671
+ labelInfoAlign: {
672
+ type: String,
673
+ required: false,
674
+ default: 'left',
675
+ },
676
+ defaultNumber: {
677
+ type: Number,
678
+ required: false,
679
+ default: null,
680
+ },
681
+ minNumber: {
682
+ type: Number,
683
+ required: false,
684
+ default: null,
685
+ },
686
+ fontColor: {
687
+ type: String,
688
+ required: false,
689
+ default: null,
690
+ },
691
+ backgroundColor: {
692
+ type: String,
693
+ required: false,
694
+ default: null,
695
+ },
696
+ numberToStringEnabled: {
697
+ type: Boolean,
698
+ required: false,
699
+ default: true,
700
+ },
701
+ allowNegative: {
702
+ type: Boolean,
703
+ required: false,
704
+ default: true,
705
+ },
706
+ slotSize: {
707
+ type: String,
708
+ required: false,
709
+ default: null,
710
+ },
711
+ labelFontColor: {
712
+ type: String,
713
+ required: false,
714
+ default: 'eturnityGrey',
715
+ },
716
+ labelFontWeight: {
717
+ type: String,
718
+ required: false,
719
+ default: '700',
720
+ },
721
+ focus: {
722
+ type: Boolean,
723
+ required: false,
724
+ default: false,
725
+ },
726
+ labelDataId: {
727
+ type: String,
728
+ required: false,
729
+ default: '',
730
+ },
731
+ inputDataId: {
732
+ type: String,
733
+ required: false,
734
+ default: '',
735
+ },
736
+ dataQaId: {
737
+ required: false,
738
+ default: '',
739
+ },
740
+ showSelect: {
741
+ type: Boolean,
742
+ default: false,
743
+ },
744
+ selectWidth: {
745
+ type: Number,
746
+ default: 70,
747
+ },
748
+ selectOptions: {
749
+ type: Array,
750
+ default: () => [],
751
+ },
752
+ selectValue: {
753
+ type: [String, Number],
754
+ default: null,
755
+ },
756
+ isSelectDisabled: {
757
+ type: Boolean,
758
+ default: false,
759
+ },
760
+ colorMode: {
761
+ type: String,
762
+ default: '',
763
+ },
764
+ showArrowControls: {
765
+ type: Boolean,
766
+ default: false,
767
+ },
768
+ isReadOnly: {
769
+ type: Boolean,
770
+ default: false,
771
+ },
772
+ isBorderErrorOnly: {
773
+ type: Boolean,
774
+ default: false,
775
+ },
776
+ isInfoBorder: {
777
+ type: Boolean,
778
+ default: false,
779
+ },
780
+ inputInfoText: {
781
+ type: String,
782
+ default: '',
783
+ },
784
+ },
785
+ data() {
786
+ return {
787
+ textInput: '',
788
+ isFocused: false,
789
+ warningIcon: warningIcon,
790
+ }
791
+ },
792
+ computed: {
793
+ displayedPlaceholder() {
794
+ if (this.placeholder) return this.placeholder
795
+ if (this.defaultNumber)
796
+ return `${this.defaultNumber} ${this.unitName ? this.unitName : ''}`
797
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
798
+ },
799
+ hasSlot() {
800
+ return !!this.$slots.default
801
+ },
802
+ hasLabelSlot() {
803
+ return !!this.$slots.label
804
+ },
805
+ getSelectValue() {
806
+ const item = this.selectOptions.find(
807
+ ({ value }) => value === this.selectValue
808
+ )
809
+
810
+ return item ? item.label : '-'
811
+ },
812
+ },
813
+ watch: {
814
+ focus(value) {
815
+ if (value) {
816
+ this.focusInput()
817
+ }
818
+ },
819
+ clearInput: function (value) {
820
+ if (value) {
821
+ // If the value is typed, then we should clear the textInput on Continue
822
+ this.textInput = ''
823
+ }
824
+ },
825
+ },
826
+ created() {
827
+ if (this.value) {
828
+ this.textInput = numberToString({
829
+ value: this.value,
830
+ numberPrecision: this.numberPrecision,
831
+ minDecimals: this.minDecimals,
832
+ })
833
+ } else if (this.defaultNumber !== null) {
834
+ this.textInput = numberToString({
835
+ value: this.defaultNumber,
836
+ numberPrecision: this.numberPrecision,
837
+ minDecimals: this.minDecimals,
838
+ })
839
+ } else if (this.minNumber !== null) {
840
+ this.textInput = numberToString({
841
+ value: this.minNumber,
842
+ numberPrecision: this.numberPrecision,
843
+ minDecimals: this.minDecimals,
844
+ })
845
+ }
846
+ },
847
+ mounted() {
848
+ if (this.focus) {
849
+ this.focusInput()
850
+ }
851
+ },
852
+ methods: {
853
+ incrementValue() {
854
+ const currentValue = Math.max(
855
+ parseFloat(this.textInput || 0),
856
+ this.minNumber || 0
857
+ )
858
+ const newValue = currentValue + this.interactionStep
859
+ this.textInput = numberToString({
860
+ value: newValue,
861
+ numberPrecision: this.numberPrecision,
862
+ minDecimals: this.minDecimals,
863
+ })
864
+ this.$emit('on-input', newValue)
865
+ this.$emit('input-change', newValue)
866
+ },
867
+ decrementValue() {
868
+ const currentValue = Math.max(
869
+ parseFloat(this.textInput || 0),
870
+ this.minNumber || 0
871
+ )
872
+ const newValue = currentValue - this.interactionStep
873
+ if (this.allowNegative || newValue >= 0) {
874
+ this.textInput = numberToString({
875
+ value: newValue,
876
+ numberPrecision: this.numberPrecision,
877
+ minDecimals: this.minDecimals,
878
+ })
879
+ this.$emit('on-input', newValue)
880
+ this.$emit('input-change', newValue)
881
+ }
882
+ },
883
+ onEnterPress() {
884
+ this.$emit('on-enter-click')
885
+ this.$refs.inputField1.$el.blur()
886
+ },
887
+ onChangeHandler(event) {
888
+ if (isNaN(event) || event === '') {
889
+ event = this.defaultNumber
890
+ ? this.defaultNumber
891
+ : this.minNumber || this.minNumber === 0
892
+ ? this.minNumber
893
+ : event
894
+ }
895
+ if (!this.allowNegative) {
896
+ event = Math.abs(event)
897
+ }
898
+ if (this.minNumber && this.minNumber > event) {
899
+ event = this.minNumber
900
+ }
901
+ event = parseFloat(event)
902
+ // Need to return an integer rather than a string
903
+ this.$emit('input-change', event)
904
+ },
905
+ onEvaluateCode(event) {
906
+ // function to perform math on the code
907
+ // filter the string in case of any malicious content
908
+ const val = event.target.value
909
+ let filtered = val.replace('(auto)', '').replace(/[^-()\d/*+.,]/g, '')
910
+ filtered = filtered.split(/([-+*/()])/)
911
+ let formatted = filtered.map((item) => {
912
+ if (
913
+ item === '+' ||
914
+ item === '-' ||
915
+ item === '*' ||
916
+ item === '/' ||
917
+ item === '(' ||
918
+ item === ')' ||
919
+ item === ''
920
+ ) {
921
+ return item
922
+ } else {
923
+ let num = stringToNumber({
924
+ value: item,
925
+ numberPrecision: false,
926
+ minDecimals: this.minDecimals,
927
+ })
928
+ return num
929
+ }
930
+ })
931
+ let evaluated
932
+ formatted = this.removeStringItemsAfterLastNumber(formatted)
933
+ evaluated = eval(formatted.join(' '))
934
+ if (typeof evaluated === 'string') {
935
+ evaluated = stringToNumber({
936
+ value: evaluated,
937
+ numberPrecision: this.numberPrecision,
938
+ minDecimals: this.minDecimals,
939
+ })
940
+ } else if (typeof evaluated === 'number') {
941
+ evaluated = evaluated.toFixed(this.numberPrecision)
942
+ }
943
+ return evaluated
944
+ },
945
+ removeStringItemsAfterLastNumber(array) {
946
+ // fixed in EPDM-6487, in order to prevent 'Unexpected end of input'
947
+ let lastNumberIndex = -1
948
+ // Find the index of the last number in the array
949
+ for (let i = array.length - 1; i >= 0; i--) {
950
+ if (typeof array[i] === 'number') {
951
+ lastNumberIndex = i
952
+ break
953
+ }
954
+ }
955
+ // if there are no numbers, return an empty array
956
+ if (lastNumberIndex === -1) {
957
+ return []
958
+ }
959
+ // Remove non-numeric items after the last number
960
+ if (lastNumberIndex !== -1) {
961
+ const newArray = array.slice(0, lastNumberIndex + 1)
962
+ return newArray
963
+ }
964
+ return array
965
+ },
966
+ onInput(event) {
967
+ if (!this.isFocused) {
968
+ return
969
+ }
970
+ if (event.target.value === '') {
971
+ this.$emit('on-input', '')
972
+ }
973
+ let evaluatedVal
974
+ try {
975
+ evaluatedVal = this.onEvaluateCode(event)
976
+ } finally {
977
+ if (evaluatedVal && this.value != evaluatedVal) {
978
+ this.$emit('on-input', evaluatedVal)
979
+ }
980
+ }
981
+ this.textInput = evaluatedVal
982
+ },
983
+ onInputBlur(e) {
984
+ this.isFocused = false
985
+ let value = e.target.value
986
+ let evaluatedInput = this.onEvaluateCode(e)
987
+ this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
988
+ if ((evaluatedInput && value.length) || this.minNumber !== null) {
989
+ this.textInput = numberToString({
990
+ value:
991
+ evaluatedInput && value.length
992
+ ? evaluatedInput
993
+ : this.defaultNumber
994
+ ? this.defaultNumber
995
+ : this.minNumber,
996
+ numberPrecision: this.numberPrecision,
997
+ minDecimals: this.minDecimals,
998
+ })
999
+ }
1000
+ let adjustedMinValue =
1001
+ evaluatedInput && evaluatedInput.length
1002
+ ? evaluatedInput
1003
+ : this.defaultNumber
1004
+ ? this.defaultNumber
1005
+ : this.minNumber || this.minNumber === 0
1006
+ ? this.minNumber
1007
+ : ''
1008
+ this.$emit('input-blur', adjustedMinValue)
1009
+ },
1010
+ focusInput() {
1011
+ if (this.disabled) {
1012
+ return
1013
+ }
1014
+ this.isFocused = true
1015
+ this.$nextTick(() => {
1016
+ this.$refs.inputField1.$el.select()
1017
+ })
1018
+ this.$emit('input-focus')
1019
+ },
1020
+ blurInput() {
1021
+ if (this.disabled) {
1022
+ return
1023
+ }
1024
+ this.isFocused = false
1025
+ this.$nextTick(() => {
1026
+ this.$refs.inputField1.$el.blur()
1027
+ })
1028
+ },
1029
+ formatWithCurrency(value) {
1030
+ let adjustedMinValue =
1031
+ value || value === 0
1032
+ ? value
1033
+ : this.defaultNumber
1034
+ ? this.defaultNumber
1035
+ : this.minNumber || this.minNumber === 0
1036
+ ? this.minNumber
1037
+ : ''
1038
+ if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
1039
+ let input = this.numberToStringEnabled
1040
+ ? numberToString({
1041
+ value: adjustedMinValue,
1042
+ numberPrecision: this.numberPrecision,
1043
+ minDecimals: this.minDecimals,
1044
+ })
1045
+ : adjustedMinValue
1046
+ let unit = this.showLinearUnitName ? '' : this.unitName
1047
+ //return input + ' ' + unit
1048
+ return input + ' ' + unit
1049
+ } else if (!adjustedMinValue && adjustedMinValue !== 0) {
1050
+ return ''
1051
+ } else {
1052
+ return this.numberToStringEnabled
1053
+ ? numberToString({
1054
+ value: adjustedMinValue,
1055
+ numberPrecision: this.numberPrecision,
1056
+ minDecimals: this.minDecimals,
1057
+ })
1058
+ : adjustedMinValue
1059
+ }
1060
+ },
1061
+ initInteraction(e) {
1062
+ this.focusInput()
1063
+ e.preventDefault()
1064
+ window.addEventListener('mousemove', this.interact, false)
1065
+ window.addEventListener('mouseup', this.stopInteract, false)
1066
+ },
1067
+ interact(e) {
1068
+ e.preventDefault()
1069
+ let value = parseFloat(this.value || 0)
1070
+ value += parseFloat(this.interactionStep) * parseInt(e.movementX)
1071
+ this.$emit('on-input-drag', value)
1072
+
1073
+ this.textInput = numberToString({
1074
+ value: value && value.length ? value : this.minNumber,
1075
+ numberPrecision: this.numberPrecision,
1076
+ minDecimals: this.minDecimals,
1077
+ })
1078
+ //this.value=value
1079
+ },
1080
+ stopInteract(e) {
1081
+ e.preventDefault()
1082
+ window.removeEventListener('mousemove', this.interact, false)
1083
+ window.removeEventListener('mouseup', this.stopInteract, false)
1084
+ this.blurInput()
1085
+ },
1086
+ },
1087
+ }
1088
+ </script>