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