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

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 (573) hide show
  1. package/README.md +29 -29
  2. package/package.json +85 -85
  3. package/src/App.vue +30 -30
  4. package/src/Test.vue +64 -64
  5. package/src/assets/icons/arrow_down.svg +3 -3
  6. package/src/assets/icons/arrow_up_red.svg +3 -3
  7. package/src/assets/icons/black_spinner.svg +35 -35
  8. package/src/assets/icons/delete_icon.svg +11 -11
  9. package/src/assets/icons/delete_icon_gray.svg +11 -11
  10. package/src/assets/icons/drag_icon.svg +8 -8
  11. package/src/assets/icons/external_icon.svg +6 -6
  12. package/src/assets/icons/language_icon.svg +6 -6
  13. package/src/assets/icons/pdf_icon.svg +6 -6
  14. package/src/assets/icons/plus_button.svg +4 -4
  15. package/src/assets/icons/search_icon_black.svg +3 -3
  16. package/src/assets/icons/subposition_icon.svg +3 -3
  17. package/src/assets/icons/subposition_marker.svg +3 -3
  18. package/src/assets/icons/warning_icon.svg +3 -3
  19. package/src/assets/svgIcons/2d_active.svg +7 -7
  20. package/src/assets/svgIcons/2d_inactive.svg +8 -8
  21. package/src/assets/svgIcons/3d_active.svg +7 -7
  22. package/src/assets/svgIcons/3d_inactive.svg +8 -8
  23. package/src/assets/svgIcons/_readme.md +7 -7
  24. package/src/assets/svgIcons/ac_power.svg +4 -4
  25. package/src/assets/svgIcons/accept.svg +5 -5
  26. package/src/assets/svgIcons/activate_panels_active.svg +22 -22
  27. package/src/assets/svgIcons/activate_panels_inactive.svg +20 -20
  28. package/src/assets/svgIcons/add_icon-1.svg +3 -3
  29. package/src/assets/svgIcons/add_icon.svg +4 -4
  30. package/src/assets/svgIcons/add_plus.svg +4 -4
  31. package/src/assets/svgIcons/address_book.svg +3 -3
  32. package/src/assets/svgIcons/adjust_roof.svg +6 -6
  33. package/src/assets/svgIcons/after_sale_as_a_service.svg +6 -6
  34. package/src/assets/svgIcons/all_good.svg +3 -3
  35. package/src/assets/svgIcons/angle_active.svg +5 -5
  36. package/src/assets/svgIcons/angle_inactive.svg +4 -4
  37. package/src/assets/svgIcons/area_active.svg +11 -11
  38. package/src/assets/svgIcons/area_inactive.svg +26 -26
  39. package/src/assets/svgIcons/areas_tool.svg +14 -14
  40. package/src/assets/svgIcons/arrow_down.svg +3 -3
  41. package/src/assets/svgIcons/arrow_down_unfilled.svg +4 -4
  42. package/src/assets/svgIcons/arrow_left.svg +4 -4
  43. package/src/assets/svgIcons/arrow_long_left.svg +3 -3
  44. package/src/assets/svgIcons/arrow_long_right.svg +3 -3
  45. package/src/assets/svgIcons/arrow_right.svg +4 -4
  46. package/src/assets/svgIcons/arrow_up.svg +3 -3
  47. package/src/assets/svgIcons/arrow_up_unfilled.svg +4 -4
  48. package/src/assets/svgIcons/attachment.svg +3 -3
  49. package/src/assets/svgIcons/base_layer.svg +3 -3
  50. package/src/assets/svgIcons/battery.svg +3 -3
  51. package/src/assets/svgIcons/bell.svg +3 -3
  52. package/src/assets/svgIcons/bell_alt.svg +3 -3
  53. package/src/assets/svgIcons/bexio.svg +4 -4
  54. package/src/assets/svgIcons/bold.svg +3 -3
  55. package/src/assets/svgIcons/bom.svg +3 -3
  56. package/src/assets/svgIcons/bom_generation.svg +10 -10
  57. package/src/assets/svgIcons/bookmaker.svg +3 -3
  58. package/src/assets/svgIcons/bubble.svg +3 -3
  59. package/src/assets/svgIcons/bug.svg +5 -5
  60. package/src/assets/svgIcons/buildings.svg +55 -55
  61. package/src/assets/svgIcons/bullet_list.svg +8 -8
  62. package/src/assets/svgIcons/calendar.svg +7 -7
  63. package/src/assets/svgIcons/calendar_icon.svg +7 -7
  64. package/src/assets/svgIcons/call.svg +3 -3
  65. package/src/assets/svgIcons/camera.svg +3 -3
  66. package/src/assets/svgIcons/car.svg +3 -3
  67. package/src/assets/svgIcons/cart.svg +3 -3
  68. package/src/assets/svgIcons/charger_icon_white.svg +44 -44
  69. package/src/assets/svgIcons/chassis_ground_symbol.svg +27 -27
  70. package/src/assets/svgIcons/checkbox.svg +3 -3
  71. package/src/assets/svgIcons/checkmark.svg +3 -3
  72. package/src/assets/svgIcons/checkmark_white.svg +4 -4
  73. package/src/assets/svgIcons/clear_formatting.svg +7 -7
  74. package/src/assets/svgIcons/clenergy.svg +3 -3
  75. package/src/assets/svgIcons/clickable_info.svg +4 -4
  76. package/src/assets/svgIcons/clickable_info_white.svg +5 -5
  77. package/src/assets/svgIcons/clip.svg +3 -3
  78. package/src/assets/svgIcons/clock.svg +17 -17
  79. package/src/assets/svgIcons/clock_full.svg +3 -3
  80. package/src/assets/svgIcons/close.svg +4 -4
  81. package/src/assets/svgIcons/co_branding.svg +5 -5
  82. package/src/assets/svgIcons/collapse.svg +4 -4
  83. package/src/assets/svgIcons/collapse_all.svg +3 -3
  84. package/src/assets/svgIcons/collections.svg +3 -3
  85. package/src/assets/svgIcons/component_library.svg +7 -7
  86. package/src/assets/svgIcons/consumption_tariffs.svg +43 -43
  87. package/src/assets/svgIcons/context_menu-1.svg +6 -6
  88. package/src/assets/svgIcons/context_menu-2.svg +5 -5
  89. package/src/assets/svgIcons/context_menu.svg +5 -5
  90. package/src/assets/svgIcons/context_menu_tabs.svg +5 -5
  91. package/src/assets/svgIcons/cross.svg +4 -4
  92. package/src/assets/svgIcons/current_variant.svg +4 -4
  93. package/src/assets/svgIcons/customer.svg +3 -3
  94. package/src/assets/svgIcons/dashboard.svg +3 -3
  95. package/src/assets/svgIcons/data_transfer.svg +3 -3
  96. package/src/assets/svgIcons/deadline.svg +4 -4
  97. package/src/assets/svgIcons/deal_flow.svg +3 -3
  98. package/src/assets/svgIcons/delete.svg +4 -4
  99. package/src/assets/svgIcons/delete_area_active.svg +16 -16
  100. package/src/assets/svgIcons/delete_area_inactive.svg +15 -15
  101. package/src/assets/svgIcons/direction_active-1.svg +12 -12
  102. package/src/assets/svgIcons/direction_active.svg +5 -5
  103. package/src/assets/svgIcons/direction_arrow.svg +4 -4
  104. package/src/assets/svgIcons/direction_inactive.svg +4 -4
  105. package/src/assets/svgIcons/dislike.svg +3 -3
  106. package/src/assets/svgIcons/distance_tool.svg +8 -8
  107. package/src/assets/svgIcons/distances_active.svg +9 -9
  108. package/src/assets/svgIcons/distances_inactive.svg +8 -8
  109. package/src/assets/svgIcons/distort_tool.svg +10 -10
  110. package/src/assets/svgIcons/distort_tool2.svg +16 -16
  111. package/src/assets/svgIcons/document.svg +3 -3
  112. package/src/assets/svgIcons/documents.svg +3 -3
  113. package/src/assets/svgIcons/documents_landscape.svg +3 -3
  114. package/src/assets/svgIcons/double_arrow_long.svg +4 -4
  115. package/src/assets/svgIcons/downarrow.svg +3 -3
  116. package/src/assets/svgIcons/download.svg +4 -4
  117. package/src/assets/svgIcons/drag_icon.svg +8 -8
  118. package/src/assets/svgIcons/draggable_corner.svg +5 -5
  119. package/src/assets/svgIcons/draw_tool.svg +3 -3
  120. package/src/assets/svgIcons/duplicate-1.svg +8 -8
  121. package/src/assets/svgIcons/duplicate-2.svg +5 -5
  122. package/src/assets/svgIcons/duplicate.svg +3 -3
  123. package/src/assets/svgIcons/e-mobility_configurator.svg +6 -6
  124. package/src/assets/svgIcons/e_signature.svg +5 -5
  125. package/src/assets/svgIcons/ed_ac.svg +3 -3
  126. package/src/assets/svgIcons/ed_ac_path.svg +3 -3
  127. package/src/assets/svgIcons/ed_acgrid.svg +3 -3
  128. package/src/assets/svgIcons/ed_acgrid_old.svg +4 -4
  129. package/src/assets/svgIcons/ed_arrow_both.svg +3 -3
  130. package/src/assets/svgIcons/ed_arrow_left.svg +3 -3
  131. package/src/assets/svgIcons/ed_arrow_right.svg +3 -3
  132. package/src/assets/svgIcons/ed_battery.svg +3 -3
  133. package/src/assets/svgIcons/ed_batteryacinverter.svg +3 -3
  134. package/src/assets/svgIcons/ed_batteryintegratedinverter.svg +3 -3
  135. package/src/assets/svgIcons/ed_cirquitbreaker.svg +3 -3
  136. package/src/assets/svgIcons/ed_cirquitbreaker_magnetic.svg +3 -3
  137. package/src/assets/svgIcons/ed_cirquitbreaker_thermal.svg +3 -3
  138. package/src/assets/svgIcons/ed_cirquitbreaker_thermal_magnetic.svg +3 -3
  139. package/src/assets/svgIcons/ed_consumption.svg +3 -3
  140. package/src/assets/svgIcons/ed_dc.svg +3 -3
  141. package/src/assets/svgIcons/ed_disconnector.svg +3 -3
  142. package/src/assets/svgIcons/ed_disconnector_fuse.svg +3 -3
  143. package/src/assets/svgIcons/ed_disconnector_fuse_switch.svg +3 -3
  144. package/src/assets/svgIcons/ed_disconnector_loadbreak_switch.svg +3 -3
  145. package/src/assets/svgIcons/ed_disconnector_switch.svg +3 -3
  146. package/src/assets/svgIcons/ed_disconnector_switch_auto_release.svg +3 -3
  147. package/src/assets/svgIcons/ed_energymanagement_rectangle.svg +3 -3
  148. package/src/assets/svgIcons/ed_evcharger.svg +3 -3
  149. package/src/assets/svgIcons/ed_flexiblecomponent_circle.svg +3 -3
  150. package/src/assets/svgIcons/ed_flexiblecomponent_square.svg +3 -3
  151. package/src/assets/svgIcons/ed_fuse.svg +3 -3
  152. package/src/assets/svgIcons/ed_ground.svg +3 -3
  153. package/src/assets/svgIcons/ed_heatpump.svg +3 -3
  154. package/src/assets/svgIcons/ed_icon_battery.svg +3 -3
  155. package/src/assets/svgIcons/ed_icon_circle.svg +3 -3
  156. package/src/assets/svgIcons/ed_icon_heatpump.svg +3 -3
  157. package/src/assets/svgIcons/ed_icon_inverter.svg +8 -8
  158. package/src/assets/svgIcons/ed_icon_m.svg +3 -3
  159. package/src/assets/svgIcons/ed_icon_optimizer.svg +11 -11
  160. package/src/assets/svgIcons/ed_icon_optimizer_path.svg +11 -11
  161. package/src/assets/svgIcons/ed_integratedbatteryinverter.svg +3 -3
  162. package/src/assets/svgIcons/ed_inverter-blank.svg +3 -3
  163. package/src/assets/svgIcons/ed_mainsconnection.svg +3 -3
  164. package/src/assets/svgIcons/ed_meter-blank.svg +3 -3
  165. package/src/assets/svgIcons/ed_meter_arrowleft.svg +3 -3
  166. package/src/assets/svgIcons/ed_meter_arrowright.svg +3 -3
  167. package/src/assets/svgIcons/ed_meter_bidirectional.svg +3 -3
  168. package/src/assets/svgIcons/ed_networkandsystemprotection_double.svg +3 -3
  169. package/src/assets/svgIcons/ed_networkandsystemprotection_single.svg +3 -3
  170. package/src/assets/svgIcons/ed_pvpanel (Stroke).svg +3 -3
  171. package/src/assets/svgIcons/ed_pvpanel.svg +3 -3
  172. package/src/assets/svgIcons/ed_rcd.svg +3 -3
  173. package/src/assets/svgIcons/ed_rcd_simple.svg +3 -3
  174. package/src/assets/svgIcons/ed_spd.svg +3 -3
  175. package/src/assets/svgIcons/ed_stringwithoptimizer.svg +5 -5
  176. package/src/assets/svgIcons/ed_stringwithoutoptimizer.svg +7 -7
  177. package/src/assets/svgIcons/ed_transformer.svg +3 -3
  178. package/src/assets/svgIcons/edit.svg +3 -3
  179. package/src/assets/svgIcons/edit_button.svg +3 -3
  180. package/src/assets/svgIcons/edit_stroke.svg +3 -3
  181. package/src/assets/svgIcons/efs.svg +5 -5
  182. package/src/assets/svgIcons/electricity_tariff.svg +3 -3
  183. package/src/assets/svgIcons/email.svg +3 -3
  184. package/src/assets/svgIcons/ems-1.svg +3 -3
  185. package/src/assets/svgIcons/ems.svg +3 -3
  186. package/src/assets/svgIcons/end_of_the_list.svg +5 -5
  187. package/src/assets/svgIcons/energy_meter.svg +3 -3
  188. package/src/assets/svgIcons/erase.svg +4 -4
  189. package/src/assets/svgIcons/erase_white.svg +4 -4
  190. package/src/assets/svgIcons/expand_all.svg +4 -4
  191. package/src/assets/svgIcons/export_document.svg +3 -3
  192. package/src/assets/svgIcons/external_icon.svg +5 -5
  193. package/src/assets/svgIcons/fav_icon.svg +4 -4
  194. package/src/assets/svgIcons/filter.svg +3 -3
  195. package/src/assets/svgIcons/finance.svg +3 -3
  196. package/src/assets/svgIcons/financing_for_pv-1.svg +5 -5
  197. package/src/assets/svgIcons/financing_for_pv-2.svg +3 -3
  198. package/src/assets/svgIcons/financing_for_pv.svg +3 -3
  199. package/src/assets/svgIcons/finish-1.svg +4 -4
  200. package/src/assets/svgIcons/finish.svg +3 -3
  201. package/src/assets/svgIcons/flatten.svg +11 -11
  202. package/src/assets/svgIcons/flatten_roof.svg +20 -20
  203. package/src/assets/svgIcons/folder.svg +3 -3
  204. package/src/assets/svgIcons/free_technology.svg +3 -3
  205. package/src/assets/svgIcons/ground_symbol.svg +28 -28
  206. package/src/assets/svgIcons/handle.svg +5 -5
  207. package/src/assets/svgIcons/heat_calc.svg +7 -7
  208. package/src/assets/svgIcons/heat_pump.svg +5 -5
  209. package/src/assets/svgIcons/heating_system.svg +3 -3
  210. package/src/assets/svgIcons/height_equalize.svg +3 -3
  211. package/src/assets/svgIcons/height_snap.svg +3 -3
  212. package/src/assets/svgIcons/house.svg +3 -3
  213. package/src/assets/svgIcons/house_3d-1.svg +7 -7
  214. package/src/assets/svgIcons/house_3d.svg +7 -7
  215. package/src/assets/svgIcons/house_sun.svg +3 -3
  216. package/src/assets/svgIcons/hybrid.svg +4 -4
  217. package/src/assets/svgIcons/inclination.svg +2 -2
  218. package/src/assets/svgIcons/info.svg +3 -3
  219. package/src/assets/svgIcons/initial_situation.svg +3 -3
  220. package/src/assets/svgIcons/integrations.svg +3 -3
  221. package/src/assets/svgIcons/intro-tour-1.svg +3 -3
  222. package/src/assets/svgIcons/intro-tour.svg +3 -3
  223. package/src/assets/svgIcons/inverter.svg +3 -3
  224. package/src/assets/svgIcons/italic.svg +3 -3
  225. package/src/assets/svgIcons/k2.svg +4 -4
  226. package/src/assets/svgIcons/kanban_view.svg +6 -6
  227. package/src/assets/svgIcons/key.svg +3 -3
  228. package/src/assets/svgIcons/lake.svg +29 -29
  229. package/src/assets/svgIcons/layers_close.svg +4 -4
  230. package/src/assets/svgIcons/layers_open.svg +4 -4
  231. package/src/assets/svgIcons/lead_marketplace.svg +6 -6
  232. package/src/assets/svgIcons/lead_provider.svg +4 -4
  233. package/src/assets/svgIcons/legend.svg +3 -3
  234. package/src/assets/svgIcons/length_2d.svg +2 -2
  235. package/src/assets/svgIcons/length_3d.svg +4 -4
  236. package/src/assets/svgIcons/length_calculator.svg +2 -2
  237. package/src/assets/svgIcons/length_in_2d_active.svg +12 -12
  238. package/src/assets/svgIcons/length_in_2d_inctive.svg +13 -13
  239. package/src/assets/svgIcons/light_bulb.svg +3 -3
  240. package/src/assets/svgIcons/like.svg +3 -3
  241. package/src/assets/svgIcons/line_graph.svg +3 -3
  242. package/src/assets/svgIcons/local_subsidies.svg +18 -18
  243. package/src/assets/svgIcons/location.svg +3 -3
  244. package/src/assets/svgIcons/lock.svg +3 -3
  245. package/src/assets/svgIcons/logout.svg +3 -3
  246. package/src/assets/svgIcons/loop.svg +3 -3
  247. package/src/assets/svgIcons/low-vegetation.svg +37 -37
  248. package/src/assets/svgIcons/lunch.svg +4 -4
  249. package/src/assets/svgIcons/magic_tool.svg +6 -6
  250. package/src/assets/svgIcons/map_icon.svg +5 -5
  251. package/src/assets/svgIcons/map_settings.svg +3 -3
  252. package/src/assets/svgIcons/margin_tool.svg +4 -4
  253. package/src/assets/svgIcons/meeting.svg +6 -6
  254. package/src/assets/svgIcons/module.svg +3 -3
  255. package/src/assets/svgIcons/move_copy.svg +4 -4
  256. package/src/assets/svgIcons/move_down.svg +3 -3
  257. package/src/assets/svgIcons/move_left.svg +3 -3
  258. package/src/assets/svgIcons/move_right.svg +3 -3
  259. package/src/assets/svgIcons/move_up.svg +3 -3
  260. package/src/assets/svgIcons/new_area_inactive.svg +11 -11
  261. package/src/assets/svgIcons/next.svg +4 -4
  262. package/src/assets/svgIcons/normal-tg.svg +30 -30
  263. package/src/assets/svgIcons/normal-vegetation.svg +53 -53
  264. package/src/assets/svgIcons/not_equal_to.svg +3 -3
  265. package/src/assets/svgIcons/numbered_list.svg +6 -6
  266. package/src/assets/svgIcons/obstacle_tool.svg +8 -8
  267. package/src/assets/svgIcons/obstacle_tool_origin.svg +3 -3
  268. package/src/assets/svgIcons/offset_tool.svg +8 -8
  269. package/src/assets/svgIcons/open-tg.svg +21 -21
  270. package/src/assets/svgIcons/optimizer.svg +3 -3
  271. package/src/assets/svgIcons/order.svg +3 -3
  272. package/src/assets/svgIcons/outline_tool.svg +11 -11
  273. package/src/assets/svgIcons/pan_tool.svg +12 -12
  274. package/src/assets/svgIcons/panels_tool.svg +8 -8
  275. package/src/assets/svgIcons/pen_tool.svg +4 -4
  276. package/src/assets/svgIcons/picker_tool.svg +4 -4
  277. package/src/assets/svgIcons/picture.svg +3 -3
  278. package/src/assets/svgIcons/pin.svg +5 -5
  279. package/src/assets/svgIcons/plus_button.svg +4 -4
  280. package/src/assets/svgIcons/presentation.svg +3 -3
  281. package/src/assets/svgIcons/preview.svg +3 -3
  282. package/src/assets/svgIcons/previous.svg +4 -4
  283. package/src/assets/svgIcons/profile-1.svg +4 -4
  284. package/src/assets/svgIcons/profile.svg +3 -3
  285. package/src/assets/svgIcons/profitability.svg +3 -3
  286. package/src/assets/svgIcons/project_analysis.svg +3 -3
  287. package/src/assets/svgIcons/project_settings.svg +3 -3
  288. package/src/assets/svgIcons/protected-tg.svg +47 -47
  289. package/src/assets/svgIcons/pv.svg +3 -3
  290. package/src/assets/svgIcons/question_mark.svg +3 -3
  291. package/src/assets/svgIcons/question_mark_white.svg +4 -4
  292. package/src/assets/svgIcons/quotations.svg +6 -6
  293. package/src/assets/svgIcons/rectangle.svg +3 -3
  294. package/src/assets/svgIcons/redo.svg +6 -6
  295. package/src/assets/svgIcons/refresh.svg +3 -3
  296. package/src/assets/svgIcons/reorder_string.svg +3 -3
  297. package/src/assets/svgIcons/resizer.svg +5 -5
  298. package/src/assets/svgIcons/roof_layer.svg +3 -3
  299. package/src/assets/svgIcons/rotate_tool.svg +3 -3
  300. package/src/assets/svgIcons/rotate_view.svg +5 -5
  301. package/src/assets/svgIcons/ruler_tool.svg +3 -3
  302. package/src/assets/svgIcons/run_simulation.svg +3 -3
  303. package/src/assets/svgIcons/save.svg +3 -3
  304. package/src/assets/svgIcons/scaling_tool.svg +8 -8
  305. package/src/assets/svgIcons/sea.svg +34 -34
  306. package/src/assets/svgIcons/search.svg +3 -3
  307. package/src/assets/svgIcons/security.svg +3 -3
  308. package/src/assets/svgIcons/settings.svg +3 -3
  309. package/src/assets/svgIcons/show_in_a_new_tab.svg +12 -12
  310. package/src/assets/svgIcons/smartphone.svg +4 -4
  311. package/src/assets/svgIcons/solar_calc.svg +13 -13
  312. package/src/assets/svgIcons/solarmarkt.svg +3 -3
  313. package/src/assets/svgIcons/sorting.svg +4 -4
  314. package/src/assets/svgIcons/split.svg +12 -12
  315. package/src/assets/svgIcons/star.svg +3 -3
  316. package/src/assets/svgIcons/start_of_the_list.svg +5 -5
  317. package/src/assets/svgIcons/strikethrough.svg +4 -4
  318. package/src/assets/svgIcons/string_design.svg +5 -5
  319. package/src/assets/svgIcons/string_directions.svg +10 -10
  320. package/src/assets/svgIcons/subscriptions.svg +3 -3
  321. package/src/assets/svgIcons/subsidies-2.svg +3 -3
  322. package/src/assets/svgIcons/subsidies.svg +3 -3
  323. package/src/assets/svgIcons/subtract_icon.svg +3 -3
  324. package/src/assets/svgIcons/suitcase.svg +3 -3
  325. package/src/assets/svgIcons/summer.svg +3 -3
  326. package/src/assets/svgIcons/switch_polarity.svg +5 -5
  327. package/src/assets/svgIcons/table_view.svg +3 -3
  328. package/src/assets/svgIcons/template_icon_not_clickable.svg +6 -6
  329. package/src/assets/svgIcons/text_column_one.svg +6 -6
  330. package/src/assets/svgIcons/text_column_three.svg +14 -14
  331. package/src/assets/svgIcons/text_column_two.svg +10 -10
  332. package/src/assets/svgIcons/text_icon.svg +3 -3
  333. package/src/assets/svgIcons/transfer.svg +4 -4
  334. package/src/assets/svgIcons/transparent_warning.svg +4 -4
  335. package/src/assets/svgIcons/trim_tool.svg +4 -4
  336. package/src/assets/svgIcons/truck.svg +3 -3
  337. package/src/assets/svgIcons/underlined.svg +3 -3
  338. package/src/assets/svgIcons/undo.svg +6 -6
  339. package/src/assets/svgIcons/uparrow.svg +3 -3
  340. package/src/assets/svgIcons/update.svg +3 -3
  341. package/src/assets/svgIcons/upload_avatar-1.svg +12 -12
  342. package/src/assets/svgIcons/upload_avatar.svg +5 -5
  343. package/src/assets/svgIcons/upload_image.svg +8 -8
  344. package/src/assets/svgIcons/upload_image_tool.svg +7 -7
  345. package/src/assets/svgIcons/variants.svg +3 -3
  346. package/src/assets/svgIcons/vdv.svg +5 -5
  347. package/src/assets/svgIcons/vertical_tool.svg +3 -3
  348. package/src/assets/svgIcons/virtual_storage.svg +3 -3
  349. package/src/assets/svgIcons/warning.svg +4 -4
  350. package/src/assets/svgIcons/warning_triangle.svg +3 -3
  351. package/src/assets/svgIcons/warning_triangle_white.svg +5 -5
  352. package/src/assets/svgIcons/way.svg +5 -5
  353. package/src/assets/svgIcons/wifi.svg +3 -3
  354. package/src/assets/svgIcons/winter.svg +3 -3
  355. package/src/assets/svgIcons/workflow_template.svg +11 -11
  356. package/src/assets/svgIcons//360/237/223/221 Documents/ed_ac.svg" +3 -3
  357. package/src/assets/svgIcons//360/237/223/221 Documents/ed_arrow_both.svg" +7 -7
  358. package/src/assets/svgIcons//360/237/223/221 Documents/ed_arrow_left.svg" +7 -7
  359. package/src/assets/svgIcons//360/237/223/221 Documents/ed_arrow_right.svg" +7 -7
  360. package/src/assets/svgIcons//360/237/223/221 Documents/ed_battery.svg" +4 -4
  361. package/src/assets/svgIcons//360/237/223/221 Documents/ed_batteryacinverter.svg" +5 -5
  362. package/src/assets/svgIcons//360/237/223/221 Documents/ed_batteryintegratedinverter.svg" +5 -5
  363. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker.svg" +6 -6
  364. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker_magnetic.svg" +9 -9
  365. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker_thermal.svg" +5 -5
  366. package/src/assets/svgIcons//360/237/223/221 Documents/ed_cirquitbreaker_thermal_magnetic.svg" +10 -10
  367. package/src/assets/svgIcons//360/237/223/221 Documents/ed_consumption.svg" +5 -5
  368. package/src/assets/svgIcons//360/237/223/221 Documents/ed_dc.svg" +3 -3
  369. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector.svg" +5 -5
  370. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_fuse.svg" +6 -6
  371. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_fuse_switch.svg" +7 -7
  372. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_loadbreak_switch.svg" +7 -7
  373. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_switch.svg" +6 -6
  374. package/src/assets/svgIcons//360/237/223/221 Documents/ed_disconnector_switch_auto_release.svg" +7 -7
  375. package/src/assets/svgIcons//360/237/223/221 Documents/ed_energymanagement_rectangle.svg" +3 -3
  376. package/src/assets/svgIcons//360/237/223/221 Documents/ed_evcharger.svg" +8 -8
  377. package/src/assets/svgIcons//360/237/223/221 Documents/ed_flexiblecomponent_circle.svg" +3 -3
  378. package/src/assets/svgIcons//360/237/223/221 Documents/ed_flexiblecomponent_square.svg" +3 -3
  379. package/src/assets/svgIcons//360/237/223/221 Documents/ed_fuse.svg" +4 -4
  380. package/src/assets/svgIcons//360/237/223/221 Documents/ed_ground.svg" +6 -6
  381. package/src/assets/svgIcons//360/237/223/221 Documents/ed_heatpump.svg" +4 -4
  382. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_battery.svg" +3 -3
  383. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_circle.svg" +3 -3
  384. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_heatpump.svg" +3 -3
  385. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_inverter.svg" +3 -3
  386. package/src/assets/svgIcons//360/237/223/221 Documents/ed_icon_optimizer.svg" +3 -3
  387. package/src/assets/svgIcons//360/237/223/221 Documents/ed_integratedbatteryinverter.svg" +3 -3
  388. package/src/assets/svgIcons//360/237/223/221 Documents/ed_inverter-blank.svg" +3 -3
  389. package/src/assets/svgIcons//360/237/223/221 Documents/ed_mainsconnection.svg" +3 -3
  390. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter-blank.svg" +3 -3
  391. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter_arrowleft.svg" +8 -8
  392. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter_arrowright.svg" +8 -8
  393. package/src/assets/svgIcons//360/237/223/221 Documents/ed_meter_bidirectional.svg" +8 -8
  394. package/src/assets/svgIcons//360/237/223/221 Documents/ed_networkandsystemprotection_double.svg" +15 -15
  395. package/src/assets/svgIcons//360/237/223/221 Documents/ed_networkandsystemprotection_single.svg" +10 -10
  396. package/src/assets/svgIcons//360/237/223/221 Documents/ed_pvpanel.svg" +7 -7
  397. package/src/assets/svgIcons//360/237/223/221 Documents/ed_rcd.svg" +7 -7
  398. package/src/assets/svgIcons//360/237/223/221 Documents/ed_rcd_simple.svg" +4 -4
  399. package/src/assets/svgIcons//360/237/223/221 Documents/ed_spd.svg" +9 -9
  400. package/src/assets/svgIcons//360/237/223/221 Documents/ed_stringwithoptimizer.svg" +5 -5
  401. package/src/assets/svgIcons//360/237/223/221 Documents/ed_stringwithoutoptimizer.svg" +13 -13
  402. package/src/assets/svgIcons//360/237/223/221 Documents/ed_transformer.svg" +6 -6
  403. package/src/assets/tests/__mocks__/iconCache.js +1 -1
  404. package/src/assets/tests/__mocks__/svgMock.js +1 -1
  405. package/src/assets/tests/helpers.js +12 -12
  406. package/src/assets/theme.js +700 -688
  407. package/src/components/addNewButton/AddNewButton.stories.js +17 -17
  408. package/src/components/addNewButton/addNewButton.spec.js +23 -23
  409. package/src/components/addNewButton/index.vue +66 -66
  410. package/src/components/banner/actionBanner/ActionBanner.stories.js +45 -45
  411. package/src/components/banner/actionBanner/actionBanner.spec.js +76 -76
  412. package/src/components/banner/actionBanner/index.vue +86 -86
  413. package/src/components/banner/banner/Banner.stories.js +120 -120
  414. package/src/components/banner/banner/banner.spec.js +149 -149
  415. package/src/components/banner/banner/index.vue +205 -205
  416. package/src/components/banner/infoBanner/InfoBanner.spec.js +57 -57
  417. package/src/components/banner/infoBanner/InfoBanner.stories.js +84 -84
  418. package/src/components/banner/infoBanner/index.vue +97 -97
  419. package/src/components/banner/notificationBanner/index.vue +131 -131
  420. package/src/components/barchart/BottomFields.vue +253 -253
  421. package/src/components/barchart/ChartControls.vue +113 -113
  422. package/src/components/barchart/SelectionBox.vue +150 -150
  423. package/src/components/barchart/composables/index.js +5 -5
  424. package/src/components/barchart/composables/useAxisCalculations.js +104 -104
  425. package/src/components/barchart/composables/useChartData.js +114 -114
  426. package/src/components/barchart/composables/useChartScroll.js +61 -61
  427. package/src/components/barchart/composables/useSelection.js +75 -75
  428. package/src/components/barchart/composables/useTooltip.js +100 -100
  429. package/src/components/barchart/index.vue +385 -385
  430. package/src/components/barchart/styles/bottomFields.js +66 -66
  431. package/src/components/barchart/styles/chart.js +272 -272
  432. package/src/components/barchart/styles/chartControls.js +59 -59
  433. package/src/components/buttons/buttonIcon/ButtonIcon.stories.js +167 -167
  434. package/src/components/buttons/buttonIcon/index.vue +301 -301
  435. package/src/components/buttons/closeButton/CloseButton.stories.js +25 -25
  436. package/src/components/buttons/closeButton/index.vue +62 -62
  437. package/src/components/buttons/mainButton/MainButton.stories.js +145 -145
  438. package/src/components/buttons/mainButton/index.vue +256 -248
  439. package/src/components/buttons/mainButton/mainButton.spec.js +35 -35
  440. package/src/components/buttons/splitButtons/index.vue +86 -86
  441. package/src/components/card/Card.stories.js +79 -79
  442. package/src/components/card/card.spec.js +135 -135
  443. package/src/components/card/index.vue +116 -116
  444. package/src/components/collapsableInfoText/index.vue +127 -127
  445. package/src/components/deleteIcon/DeleteIcon.stories.js +29 -29
  446. package/src/components/deleteIcon/index.vue +78 -78
  447. package/src/components/draggableCard/defaultProps.js +16 -16
  448. package/src/components/draggableCard/draggableCard.spec.js +99 -99
  449. package/src/components/draggableCard/draggableCard.stories.js +135 -135
  450. package/src/components/draggableCard/index.vue +363 -363
  451. package/src/components/draggableInputHandle/index.vue +46 -46
  452. package/src/components/dropdown/Dropdown.stories.js +53 -53
  453. package/src/components/dropdown/index.vue +146 -138
  454. package/src/components/errorMessage/errorMessage.spec.js +34 -34
  455. package/src/components/errorMessage/errorMessage.stories.js +35 -35
  456. package/src/components/errorMessage/index.vue +64 -64
  457. package/src/components/filter/filterSettings.vue +672 -672
  458. package/src/components/filter/index.vue +154 -154
  459. package/src/components/filter/parentDropdown.vue +91 -91
  460. package/src/components/filterComponent/viewFilter.vue +605 -605
  461. package/src/components/filterComponent/viewSettings.vue +281 -281
  462. package/src/components/filterComponent/viewSort.vue +330 -330
  463. package/src/components/icon/Icon.stories.js +220 -220
  464. package/src/components/icon/icon.spec.js +66 -66
  465. package/src/components/icon/iconCache.mjs +23 -23
  466. package/src/components/icon/iconCollection.vue +83 -83
  467. package/src/components/icon/index.vue +240 -240
  468. package/src/components/iconWrapper/index.vue +184 -184
  469. package/src/components/infoCard/InfoCard.stories.js +170 -170
  470. package/src/components/infoCard/defaultProps.js +7 -7
  471. package/src/components/infoCard/index.vue +160 -160
  472. package/src/components/infoCard/infoCard.spec.js +64 -64
  473. package/src/components/infoLabel/index.vue +63 -63
  474. package/src/components/infoText/constants.js +4 -4
  475. package/src/components/infoText/index.vue +645 -645
  476. package/src/components/infoText/infoText.spec.js +67 -67
  477. package/src/components/infoText/infoText.stories.js +48 -48
  478. package/src/components/infoText/placeholder.vue +225 -225
  479. package/src/components/inputs/checkbox/Checkbox.stories.js +63 -63
  480. package/src/components/inputs/checkbox/checkbox.spec.js +109 -109
  481. package/src/components/inputs/checkbox/index.vue +250 -250
  482. package/src/components/inputs/inputNumber/InputNumber.stories.js +150 -150
  483. package/src/components/inputs/inputNumber/index.vue +1006 -1006
  484. package/src/components/inputs/inputNumberQuestion/index.vue +218 -218
  485. package/src/components/inputs/inputText/InputText.stories.js +70 -70
  486. package/src/components/inputs/inputText/index.vue +478 -476
  487. package/src/components/inputs/inputText/inputText.spec.js +588 -588
  488. package/src/components/inputs/radioButton/RadioButton.stories.js +77 -77
  489. package/src/components/inputs/radioButton/defaultProps.js +31 -31
  490. package/src/components/inputs/radioButton/index.vue +336 -336
  491. package/src/components/inputs/radioButton/radioButton.spec.js +306 -306
  492. package/src/components/inputs/searchInput/SearchInput.stories.js +66 -66
  493. package/src/components/inputs/searchInput/defaultProps.js +12 -12
  494. package/src/components/inputs/searchInput/index.vue +181 -181
  495. package/src/components/inputs/searchInput/searchInput.spec.js +64 -64
  496. package/src/components/inputs/select/index.vue +1080 -1080
  497. package/src/components/inputs/select/option/index.vue +176 -176
  498. package/src/components/inputs/select/select.stories.js +58 -58
  499. package/src/components/inputs/slider/index.vue +126 -126
  500. package/src/components/inputs/switchField/index.vue +266 -266
  501. package/src/components/inputs/textAreaInput/TextAreaInput.stories.js +127 -127
  502. package/src/components/inputs/textAreaInput/index.vue +204 -204
  503. package/src/components/inputs/toggle/Toggle.stories.js +77 -77
  504. package/src/components/inputs/toggle/index.vue +322 -322
  505. package/src/components/inputs/toggle/toggle.spec.js +102 -102
  506. package/src/components/label/index.vue +98 -98
  507. package/src/components/markerItem/index.vue +95 -95
  508. package/src/components/modals/actionModal/actionModal.spec.js +52 -52
  509. package/src/components/modals/actionModal/actionModal.stories.js +53 -53
  510. package/src/components/modals/actionModal/index.vue +64 -64
  511. package/src/components/modals/infoModal/index.vue +82 -82
  512. package/src/components/modals/infoModal/infoModal.spec.js +55 -55
  513. package/src/components/modals/infoModal/infoModal.stories.js +47 -47
  514. package/src/components/modals/modal/index.vue +211 -211
  515. package/src/components/modals/modal/modal.stories.js +31 -31
  516. package/src/components/navigationTabs/index.vue +114 -114
  517. package/src/components/pageSubtitle/PageSubtitle.stories.js +58 -58
  518. package/src/components/pageSubtitle/index.vue +78 -78
  519. package/src/components/pageSubtitle/pageSubtitle.spec.js +46 -46
  520. package/src/components/pageTitle/PageTitle.stories.js +95 -95
  521. package/src/components/pageTitle/index.vue +91 -91
  522. package/src/components/pageTitle/pageTitle.spec.js +46 -46
  523. package/src/components/pagination/index.vue +148 -148
  524. package/src/components/paginationV2/index.vue +175 -175
  525. package/src/components/panelRangeInfo/index.vue +196 -196
  526. package/src/components/progressBar/index.vue +116 -125
  527. package/src/components/projectMarker/ProjectMarker.stories.js +130 -130
  528. package/src/components/projectMarker/index.vue +301 -301
  529. package/src/components/rangeSlider/Slider.vue +578 -578
  530. package/src/components/rangeSlider/index.vue +517 -517
  531. package/src/components/rangeSlider/utils/dom.js +49 -49
  532. package/src/components/rangeSlider/utils/fns.js +26 -26
  533. package/src/components/roundTabs/index.vue +107 -107
  534. package/src/components/selectedOptions/index.vue +473 -473
  535. package/src/components/selectedOptions/selectedOptions.spec.js +176 -176
  536. package/src/components/selectedOptions/selectedOptions.stories.js +253 -253
  537. package/src/components/sideMenu/index.vue +325 -325
  538. package/src/components/spinner/Spinner.stories.js +86 -86
  539. package/src/components/spinner/index.vue +129 -129
  540. package/src/components/spinner/spinner.spec.js +69 -69
  541. package/src/components/spinnerGif/SpinnerGif.stories.js +86 -86
  542. package/src/components/spinnerGif/index.vue +98 -98
  543. package/src/components/tableDropdown/TableDropdown.stories.js +192 -192
  544. package/src/components/tableDropdown/index.vue +692 -694
  545. package/src/components/tables/mainTable/MainTable.stories.js +151 -151
  546. package/src/components/tables/mainTable/exampleNested.vue +328 -328
  547. package/src/components/tables/mainTable/index.vue +524 -523
  548. package/src/components/tables/viewTable/index.vue +195 -195
  549. package/src/components/tabsHeader/TabsHeader.stories.js +142 -142
  550. package/src/components/tabsHeader/index.vue +150 -150
  551. package/src/components/threeDots/index.vue +413 -413
  552. package/src/components/videoThumbnail/index.vue +103 -103
  553. package/src/components/videoThumbnail/videoThumbnail.stories.js +106 -106
  554. package/src/helpers/currencyMapping.js +28 -28
  555. package/src/helpers/dateTimeFormatting.js +51 -51
  556. package/src/helpers/isObjectEqual.js +22 -22
  557. package/src/helpers/numberConverter.js +103 -103
  558. package/src/helpers/toLocaleNumber.js +11 -11
  559. package/src/helpers/translateLang.js +199 -199
  560. package/src/main.js +8 -8
  561. package/src/mixins/inputValidations.js +97 -97
  562. package/src/router/dynamicRoutes.js +23 -23
  563. package/src/stories/Button.stories.js +48 -48
  564. package/src/stories/Button.vue +52 -52
  565. package/src/stories/Configure.mdx +364 -364
  566. package/src/stories/Header.stories.js +41 -41
  567. package/src/stories/Header.vue +59 -59
  568. package/src/stories/Page.stories.js +30 -30
  569. package/src/stories/Page.vue +83 -83
  570. package/src/stories/button.css +30 -30
  571. package/src/stories/header.css +32 -32
  572. package/src/stories/page.css +69 -69
  573. package/src/utils/index.js +12 -12
@@ -1,1006 +1,1006 @@
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
+ <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>