@eturnity/eturnity_reusable_components 8.16.9-EPDM-13618.0 → 8.16.9-EPDM-EPDM-14492.1

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