@itwin/imodel-components-react 3.6.0-dev.53 → 3.6.0-dev.54

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 (342) hide show
  1. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.js +79 -79
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  4. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +186 -186
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
  8. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +107 -107
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +91 -91
  12. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +74 -74
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +145 -145
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +137 -137
  21. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  22. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  23. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
  24. package/lib/cjs/imodel-components-react/color/HueSlider.js +199 -199
  25. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  26. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  27. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +213 -213
  29. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  30. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  31. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
  32. package/lib/cjs/imodel-components-react/color/Swatch.js +60 -60
  33. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  34. package/lib/cjs/imodel-components-react/color/Swatch.scss +23 -23
  35. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  36. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
  37. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  38. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  39. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +151 -151
  40. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  41. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  42. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  43. package/lib/cjs/imodel-components-react/editors/WeightEditor.js +160 -160
  44. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  46. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  47. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +96 -96
  48. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  50. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +265 -265
  51. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  52. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  53. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  54. package/lib/cjs/imodel-components-react/lineweight/Swatch.js +85 -85
  55. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  57. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  58. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +159 -159
  59. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  60. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  61. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  62. package/lib/cjs/imodel-components-react/navigationaids/Cube.js +127 -127
  63. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  64. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  65. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  66. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +634 -634
  67. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  68. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  69. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  70. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +647 -647
  71. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  72. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  73. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +99 -99
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +53 -53
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +83 -83
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +86 -86
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +109 -109
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  92. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  93. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +184 -184
  94. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  96. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +154 -154
  97. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  98. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  99. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +59 -59
  100. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +47 -47
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +54 -54
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +48 -48
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +50 -50
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +58 -58
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +47 -47
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +56 -56
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +95 -95
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +119 -119
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  128. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  129. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +143 -143
  130. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  131. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  132. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
  133. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  134. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  135. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +81 -81
  136. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  137. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  138. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  139. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +91 -91
  140. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  141. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +25 -25
  142. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  143. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +191 -191
  144. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  145. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +106 -106
  146. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  147. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +424 -424
  148. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  149. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  150. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  151. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +54 -54
  152. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  153. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  154. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  155. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  156. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +358 -358
  157. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  158. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  159. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
  160. package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
  161. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  162. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  163. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +274 -274
  164. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  165. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  166. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
  167. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  168. package/lib/cjs/imodel-components-react.d.ts +82 -82
  169. package/lib/cjs/imodel-components-react.js +101 -101
  170. package/lib/cjs/imodel-components-react.js.map +1 -1
  171. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
  172. package/lib/esm/imodel-components-react/UiIModelComponents.js +75 -75
  173. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  174. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  175. package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
  176. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  177. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  178. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  179. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +82 -82
  180. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  181. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +91 -91
  182. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  183. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
  184. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  185. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  186. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
  187. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  188. package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  189. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  190. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +112 -112
  191. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  192. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  193. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
  194. package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
  195. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  196. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  197. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  198. package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
  199. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  200. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  201. package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
  202. package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
  203. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  204. package/lib/esm/imodel-components-react/color/Swatch.scss +23 -23
  205. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  206. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
  207. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  208. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  209. package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
  210. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  211. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  212. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  213. package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
  214. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  215. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  216. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  217. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
  218. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  219. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  220. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +240 -240
  221. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  223. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  224. package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
  225. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  226. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  227. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  228. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +133 -133
  229. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  231. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  232. package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
  233. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  234. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  235. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  236. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +606 -606
  237. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  239. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  240. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +620 -620
  241. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  242. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  243. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  244. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
  245. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  246. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +30 -30
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  250. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  251. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +60 -60
  252. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  253. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  254. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +63 -63
  255. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  256. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  257. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +83 -83
  258. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  259. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  260. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +110 -110
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  262. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  263. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +158 -158
  264. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  265. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  266. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +131 -131
  267. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  268. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  269. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
  270. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  271. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  272. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
  273. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  274. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  275. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
  276. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  277. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  278. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
  279. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  280. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  281. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
  282. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  283. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  284. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
  285. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  286. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  287. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
  288. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  289. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  290. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
  291. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  292. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  293. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +69 -69
  294. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  295. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  296. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
  297. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  298. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  299. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +139 -139
  300. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  301. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  302. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
  303. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  304. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  305. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
  306. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  307. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  308. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  309. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +64 -64
  310. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  311. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +25 -25
  312. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  313. package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
  314. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  315. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +106 -106
  316. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  317. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +398 -398
  318. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  319. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  320. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  321. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
  322. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  323. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  324. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  325. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  326. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +332 -332
  327. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  328. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  329. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
  330. package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
  331. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  332. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  333. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +251 -251
  334. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  335. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  336. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +95 -95
  337. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  338. package/lib/esm/imodel-components-react.d.ts +82 -82
  339. package/lib/esm/imodel-components-react.js +87 -87
  340. package/lib/esm/imodel-components-react.js.map +1 -1
  341. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  342. package/package.json +19 -19
@@ -1,20 +1,20 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { CommonProps } from "@itwin/core-react";
6
- import { FormatProps, UnitProps, UnitsProvider } from "@itwin/core-quantity";
7
- /** Properties of [[FormatUnits]] component.
8
- * @alpha
9
- */
10
- export interface FormatUnitsProps extends CommonProps {
11
- initialFormat: FormatProps;
12
- persistenceUnit?: UnitProps;
13
- unitsProvider: UnitsProvider;
14
- onUnitsChange?: (format: FormatProps) => void;
15
- }
16
- /** Component to show/edit Units used for Quantity Formatting.
17
- * @alpha
18
- */
19
- export declare function FormatUnits(props: FormatUnitsProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { CommonProps } from "@itwin/core-react";
6
+ import { FormatProps, UnitProps, UnitsProvider } from "@itwin/core-quantity";
7
+ /** Properties of [[FormatUnits]] component.
8
+ * @alpha
9
+ */
10
+ export interface FormatUnitsProps extends CommonProps {
11
+ initialFormat: FormatProps;
12
+ persistenceUnit?: UnitProps;
13
+ unitsProvider: UnitsProvider;
14
+ onUnitsChange?: (format: FormatProps) => void;
15
+ }
16
+ /** Component to show/edit Units used for Quantity Formatting.
17
+ * @alpha
18
+ */
19
+ export declare function FormatUnits(props: FormatUnitsProps): JSX.Element;
20
20
  //# sourceMappingURL=FormatUnits.d.ts.map
@@ -1,111 +1,111 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module QuantityFormat
7
- */
8
- import * as React from "react";
9
- import { Input } from "@itwin/itwinui-react";
10
- import { UnitDescr } from "./misc/UnitDescr";
11
- import { UiIModelComponents } from "../UiIModelComponents";
12
- /** Component to show/edit Units used for Quantity Formatting.
13
- * @alpha
14
- */
15
- export function FormatUnits(props) {
16
- var _a, _b, _c;
17
- const { initialFormat, persistenceUnit, unitsProvider, onUnitsChange } = props;
18
- const initialFormatRef = React.useRef(initialFormat);
19
- const [formatProps, setFormatProps] = React.useState(initialFormat);
20
- React.useEffect(() => {
21
- if (initialFormatRef.current !== initialFormat) {
22
- initialFormatRef.current = initialFormat;
23
- setFormatProps(initialFormat);
24
- }
25
- }, [initialFormat]);
26
- const handleSetFormatProps = React.useCallback((newProps) => {
27
- setFormatProps(newProps);
28
- onUnitsChange && onUnitsChange(newProps);
29
- }, [onUnitsChange]);
30
- const handleUnitLabelChange = React.useCallback((newLabel, index) => {
31
- // istanbul ignore else
32
- if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {
33
- const units = formatProps.composite.units.map((entry, ndx) => {
34
- // istanbul ignore else
35
- if (index === ndx)
36
- return { name: entry.name, label: newLabel };
37
- else
38
- return entry;
39
- });
40
- const composite = { ...formatProps.composite, units };
41
- const newFormatProps = { ...formatProps, composite };
42
- handleSetFormatProps(newFormatProps);
43
- }
44
- }, [formatProps, handleSetFormatProps]);
45
- const handleUnitChange = React.useCallback((newUnit, index) => {
46
- const unitParts = newUnit.split(/:/);
47
- if (unitParts[0] === "REMOVEUNIT") {
48
- // istanbul ignore else
49
- if (formatProps.composite && formatProps.composite.units.length > 1) {
50
- const units = [...formatProps.composite.units];
51
- units.pop();
52
- const composite = { ...formatProps.composite, units };
53
- const newFormatProps = { ...formatProps, composite };
54
- handleSetFormatProps(newFormatProps);
55
- }
56
- }
57
- else if (unitParts[0] === "ADDSUBUNIT") {
58
- const units = formatProps.composite && formatProps.composite.units.length ?
59
- [...formatProps.composite.units, { name: unitParts[1], label: unitParts[2] }] :
60
- /* istanbul ignore next*/ [{ name: unitParts[1], label: unitParts[2] }];
61
- const composite = { ...formatProps.composite, units };
62
- const newFormatProps = { ...formatProps, composite };
63
- handleSetFormatProps(newFormatProps);
64
- }
65
- else {
66
- // istanbul ignore else
67
- if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {
68
- const units = formatProps.composite.units.map((entry, ndx) => {
69
- // istanbul ignore else
70
- if (index === ndx)
71
- return { name: unitParts[0], label: unitParts[1] };
72
- else
73
- return entry;
74
- });
75
- const composite = { ...formatProps.composite, units };
76
- const newFormatProps = { ...formatProps, composite };
77
- handleSetFormatProps(newFormatProps);
78
- }
79
- else if (!formatProps.composite) {
80
- const composite = { units: [{ name: unitParts[0], label: unitParts[1] }] };
81
- const newFormatProps = { ...formatProps, composite };
82
- handleSetFormatProps(newFormatProps);
83
- }
84
- }
85
- }, [formatProps, handleSetFormatProps]);
86
- const handleOnSpacerChange = React.useCallback((e) => {
87
- // istanbul ignore else
88
- if (formatProps.composite) {
89
- const spacerValue = e.target.value.length ? e.target.value[0] : /* istanbul ignore next */ ""; // spacer can only be empty or a single character
90
- const composite = { ...formatProps.composite, spacer: spacerValue };
91
- const newFormatProps = { ...formatProps, composite };
92
- handleSetFormatProps(newFormatProps);
93
- }
94
- }, [formatProps, handleSetFormatProps]);
95
- const compositeSpacer = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.compositeSpacer"));
96
- return (React.createElement(React.Fragment, null,
97
- ((_a = formatProps.composite) === null || _a === void 0 ? void 0 : _a.units)
98
- ?
99
- formatProps.composite.units.map((value, index) => {
100
- var _a;
101
- return React.createElement(UnitDescr, { key: value.name, name: value.name, label: (_a = value.label) !== null && _a !== void 0 ? _a : "", parentUnitName: index > 0 ? formatProps.composite.units[index - 1].name :
102
- undefined, unitsProvider: unitsProvider, index: index, onUnitChange: handleUnitChange, onLabelChange: handleUnitLabelChange, readonly: index < (formatProps.composite.units.length - 1) });
103
- })
104
- :
105
- persistenceUnit && React.createElement(UnitDescr, { key: persistenceUnit.name, name: persistenceUnit.name, label: persistenceUnit.label, unitsProvider: unitsProvider, index: 0, onUnitChange: handleUnitChange, onLabelChange: handleUnitLabelChange }),
106
- (((_b = formatProps.composite) === null || _b === void 0 ? void 0 : _b.units) && formatProps.composite.units.length > 1) &&
107
- React.createElement(React.Fragment, null,
108
- React.createElement("span", { key: "composite-spacer-label", className: "uicore-label" }, compositeSpacer.current),
109
- React.createElement(Input, { key: "composite-spacer", "data-testid": "composite-spacer", value: (_c = formatProps.composite.spacer) !== null && _c !== void 0 ? _c : "", onChange: handleOnSpacerChange, size: "small" }))));
110
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module QuantityFormat
7
+ */
8
+ import * as React from "react";
9
+ import { Input } from "@itwin/itwinui-react";
10
+ import { UnitDescr } from "./misc/UnitDescr";
11
+ import { UiIModelComponents } from "../UiIModelComponents";
12
+ /** Component to show/edit Units used for Quantity Formatting.
13
+ * @alpha
14
+ */
15
+ export function FormatUnits(props) {
16
+ var _a, _b, _c;
17
+ const { initialFormat, persistenceUnit, unitsProvider, onUnitsChange } = props;
18
+ const initialFormatRef = React.useRef(initialFormat);
19
+ const [formatProps, setFormatProps] = React.useState(initialFormat);
20
+ React.useEffect(() => {
21
+ if (initialFormatRef.current !== initialFormat) {
22
+ initialFormatRef.current = initialFormat;
23
+ setFormatProps(initialFormat);
24
+ }
25
+ }, [initialFormat]);
26
+ const handleSetFormatProps = React.useCallback((newProps) => {
27
+ setFormatProps(newProps);
28
+ onUnitsChange && onUnitsChange(newProps);
29
+ }, [onUnitsChange]);
30
+ const handleUnitLabelChange = React.useCallback((newLabel, index) => {
31
+ // istanbul ignore else
32
+ if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {
33
+ const units = formatProps.composite.units.map((entry, ndx) => {
34
+ // istanbul ignore else
35
+ if (index === ndx)
36
+ return { name: entry.name, label: newLabel };
37
+ else
38
+ return entry;
39
+ });
40
+ const composite = { ...formatProps.composite, units };
41
+ const newFormatProps = { ...formatProps, composite };
42
+ handleSetFormatProps(newFormatProps);
43
+ }
44
+ }, [formatProps, handleSetFormatProps]);
45
+ const handleUnitChange = React.useCallback((newUnit, index) => {
46
+ const unitParts = newUnit.split(/:/);
47
+ if (unitParts[0] === "REMOVEUNIT") {
48
+ // istanbul ignore else
49
+ if (formatProps.composite && formatProps.composite.units.length > 1) {
50
+ const units = [...formatProps.composite.units];
51
+ units.pop();
52
+ const composite = { ...formatProps.composite, units };
53
+ const newFormatProps = { ...formatProps, composite };
54
+ handleSetFormatProps(newFormatProps);
55
+ }
56
+ }
57
+ else if (unitParts[0] === "ADDSUBUNIT") {
58
+ const units = formatProps.composite && formatProps.composite.units.length ?
59
+ [...formatProps.composite.units, { name: unitParts[1], label: unitParts[2] }] :
60
+ /* istanbul ignore next*/ [{ name: unitParts[1], label: unitParts[2] }];
61
+ const composite = { ...formatProps.composite, units };
62
+ const newFormatProps = { ...formatProps, composite };
63
+ handleSetFormatProps(newFormatProps);
64
+ }
65
+ else {
66
+ // istanbul ignore else
67
+ if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {
68
+ const units = formatProps.composite.units.map((entry, ndx) => {
69
+ // istanbul ignore else
70
+ if (index === ndx)
71
+ return { name: unitParts[0], label: unitParts[1] };
72
+ else
73
+ return entry;
74
+ });
75
+ const composite = { ...formatProps.composite, units };
76
+ const newFormatProps = { ...formatProps, composite };
77
+ handleSetFormatProps(newFormatProps);
78
+ }
79
+ else if (!formatProps.composite) {
80
+ const composite = { units: [{ name: unitParts[0], label: unitParts[1] }] };
81
+ const newFormatProps = { ...formatProps, composite };
82
+ handleSetFormatProps(newFormatProps);
83
+ }
84
+ }
85
+ }, [formatProps, handleSetFormatProps]);
86
+ const handleOnSpacerChange = React.useCallback((e) => {
87
+ // istanbul ignore else
88
+ if (formatProps.composite) {
89
+ const spacerValue = e.target.value.length ? e.target.value[0] : /* istanbul ignore next */ ""; // spacer can only be empty or a single character
90
+ const composite = { ...formatProps.composite, spacer: spacerValue };
91
+ const newFormatProps = { ...formatProps, composite };
92
+ handleSetFormatProps(newFormatProps);
93
+ }
94
+ }, [formatProps, handleSetFormatProps]);
95
+ const compositeSpacer = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.compositeSpacer"));
96
+ return (React.createElement(React.Fragment, null,
97
+ ((_a = formatProps.composite) === null || _a === void 0 ? void 0 : _a.units)
98
+ ?
99
+ formatProps.composite.units.map((value, index) => {
100
+ var _a;
101
+ return React.createElement(UnitDescr, { key: value.name, name: value.name, label: (_a = value.label) !== null && _a !== void 0 ? _a : "", parentUnitName: index > 0 ? formatProps.composite.units[index - 1].name :
102
+ undefined, unitsProvider: unitsProvider, index: index, onUnitChange: handleUnitChange, onLabelChange: handleUnitLabelChange, readonly: index < (formatProps.composite.units.length - 1) });
103
+ })
104
+ :
105
+ persistenceUnit && React.createElement(UnitDescr, { key: persistenceUnit.name, name: persistenceUnit.name, label: persistenceUnit.label, unitsProvider: unitsProvider, index: 0, onUnitChange: handleUnitChange, onLabelChange: handleUnitLabelChange }),
106
+ (((_b = formatProps.composite) === null || _b === void 0 ? void 0 : _b.units) && formatProps.composite.units.length > 1) &&
107
+ React.createElement(React.Fragment, null,
108
+ React.createElement("span", { key: "composite-spacer-label", className: "uicore-label" }, compositeSpacer.current),
109
+ React.createElement(Input, { key: "composite-spacer", "data-testid": "composite-spacer", value: (_c = formatProps.composite.spacer) !== null && _c !== void 0 ? _c : "", onChange: handleOnSpacerChange, size: "small" }))));
110
+ }
111
111
  //# sourceMappingURL=FormatUnits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatUnits.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnits.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAY3D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;;IACjD,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAC/E,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAc,aAAa,CAAC,CAAC;IAClE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpE,KAAK,CAAC,SAAS,CAAC,GAAG,EA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eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,EACjF,KAAK,EAAE,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,qBAAqB,GAAI;QAGjJ,CAAC,CAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,KAAK,KAAI,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YACvE;gBACE,8BAAM,GAAG,EAAE,wBAAwB,EAAE,SAAS,EAAE,cAAc,IAAG,eAAe,CAAC,OAAO,CAAQ;gBAChG,oBAAC,KAAK,IAAC,GAAG,EAAE,kBAAkB,iBAAc,kBAAkB,EAAC,KAAK,EAAE,MAAA,WAAW,CAAC,SAAS,CAAC,MAAM,mCAAI,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAC,OAAO,GAAG,CACxJ,CAEJ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UnitDescr } from \"./misc/UnitDescr\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[FormatUnits]] component.\n * @alpha\n */\nexport interface FormatUnitsProps extends CommonProps {\n initialFormat: FormatProps;\n persistenceUnit?: UnitProps;\n unitsProvider: UnitsProvider;\n onUnitsChange?: (format: FormatProps) => void;\n}\n\n/** Component to show/edit Units used for Quantity Formatting.\n * @alpha\n */\nexport function FormatUnits(props: FormatUnitsProps) {\n const { initialFormat, persistenceUnit, unitsProvider, onUnitsChange } = props;\n const initialFormatRef = React.useRef<FormatProps>(initialFormat);\n const [formatProps, setFormatProps] = React.useState(initialFormat);\n\n React.useEffect(() => {\n if (initialFormatRef.current !== initialFormat) {\n initialFormatRef.current = initialFormat;\n setFormatProps(initialFormat);\n }\n }, [initialFormat]);\n\n const handleSetFormatProps = React.useCallback((newProps: FormatProps) => {\n setFormatProps(newProps);\n onUnitsChange && onUnitsChange(newProps);\n }, [onUnitsChange]);\n\n const handleUnitLabelChange = React.useCallback((newLabel: string, index: number) => {\n // istanbul ignore else\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\n const units = formatProps.composite.units.map((entry, ndx) => {\n // istanbul ignore else\n if (index === ndx)\n return { name: entry.name, label: newLabel };\n else\n return entry;\n });\n\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n }, [formatProps, handleSetFormatProps]);\n\n const handleUnitChange = React.useCallback((newUnit: string, index: number) => {\n const unitParts = newUnit.split(/:/);\n if (unitParts[0] === \"REMOVEUNIT\") {\n // istanbul ignore else\n if (formatProps.composite && formatProps.composite.units.length > 1) {\n const units = [...formatProps.composite.units];\n units.pop();\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n } else if (unitParts[0] === \"ADDSUBUNIT\") {\n const units = formatProps.composite && formatProps.composite.units.length ?\n [...formatProps.composite.units, { name: unitParts[1], label: unitParts[2] }] :\n /* istanbul ignore next*/[{ name: unitParts[1], label: unitParts[2] }];\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n } else {\n // istanbul ignore else\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\n const units = formatProps.composite.units.map((entry, ndx) => {\n // istanbul ignore else\n if (index === ndx)\n return { name: unitParts[0], label: unitParts[1] };\n else\n return entry;\n });\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n } else if (!formatProps.composite) {\n const composite = { units: [{ name: unitParts[0], label: unitParts[1] }] };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n }\n }, [formatProps, handleSetFormatProps]);\n\n const handleOnSpacerChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (formatProps.composite) {\n const spacerValue = e.target.value.length ? e.target.value[0] : /* istanbul ignore next */ \"\"; // spacer can only be empty or a single character\n const composite = { ...formatProps.composite, spacer: spacerValue };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n }, [formatProps, handleSetFormatProps]);\n\n const compositeSpacer = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.compositeSpacer\"));\n\n return (\n <>\n {(formatProps.composite?.units)\n ?\n formatProps.composite.units.map((value, index) => <UnitDescr key={value.name} name={value.name}\n label={value.label ?? \"\"} parentUnitName={index > 0 ? formatProps.composite!.units[index - 1].name :\n undefined} unitsProvider={unitsProvider} index={index} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange}\n readonly={index < (formatProps.composite!.units.length - 1)} />)\n :\n persistenceUnit && <UnitDescr key={persistenceUnit.name} name={persistenceUnit.name}\n label={persistenceUnit.label} unitsProvider={unitsProvider} index={0} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange} />\n }\n\n {(formatProps.composite?.units && formatProps.composite.units.length > 1) &&\n <>\n <span key={\"composite-spacer-label\"} className={\"uicore-label\"}>{compositeSpacer.current}</span>\n <Input key={\"composite-spacer\"} data-testid=\"composite-spacer\" value={formatProps.composite.spacer ?? \"\"} onChange={handleOnSpacerChange} size=\"small\" />\n </>\n }\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"FormatUnits.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnits.tsx"],"names":[],"mappings":"AAAA;;;+FAG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n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { Input } from \"@itwin/itwinui-react\";\r\nimport { UnitDescr } from \"./misc/UnitDescr\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties of [[FormatUnits]] component.\r\n * @alpha\r\n */\r\nexport interface FormatUnitsProps extends CommonProps {\r\n initialFormat: FormatProps;\r\n persistenceUnit?: UnitProps;\r\n unitsProvider: UnitsProvider;\r\n onUnitsChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component to show/edit Units used for Quantity Formatting.\r\n * @alpha\r\n */\r\nexport function FormatUnits(props: FormatUnitsProps) {\r\n const { initialFormat, persistenceUnit, unitsProvider, onUnitsChange } = props;\r\n const initialFormatRef = React.useRef<FormatProps>(initialFormat);\r\n const [formatProps, setFormatProps] = React.useState(initialFormat);\r\n\r\n React.useEffect(() => {\r\n if (initialFormatRef.current !== initialFormat) {\r\n initialFormatRef.current = initialFormat;\r\n setFormatProps(initialFormat);\r\n }\r\n }, [initialFormat]);\r\n\r\n const handleSetFormatProps = React.useCallback((newProps: FormatProps) => {\r\n setFormatProps(newProps);\r\n onUnitsChange && onUnitsChange(newProps);\r\n }, [onUnitsChange]);\r\n\r\n const handleUnitLabelChange = React.useCallback((newLabel: string, index: number) => {\r\n // istanbul ignore else\r\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\r\n const units = formatProps.composite.units.map((entry, ndx) => {\r\n // istanbul ignore else\r\n if (index === ndx)\r\n return { name: entry.name, label: newLabel };\r\n else\r\n return entry;\r\n });\r\n\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleUnitChange = React.useCallback((newUnit: string, index: number) => {\r\n const unitParts = newUnit.split(/:/);\r\n if (unitParts[0] === \"REMOVEUNIT\") {\r\n // istanbul ignore else\r\n if (formatProps.composite && formatProps.composite.units.length > 1) {\r\n const units = [...formatProps.composite.units];\r\n units.pop();\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n } else if (unitParts[0] === \"ADDSUBUNIT\") {\r\n const units = formatProps.composite && formatProps.composite.units.length ?\r\n [...formatProps.composite.units, { name: unitParts[1], label: unitParts[2] }] :\r\n /* istanbul ignore next*/[{ name: unitParts[1], label: unitParts[2] }];\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n } else {\r\n // istanbul ignore else\r\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\r\n const units = formatProps.composite.units.map((entry, ndx) => {\r\n // istanbul ignore else\r\n if (index === ndx)\r\n return { name: unitParts[0], label: unitParts[1] };\r\n else\r\n return entry;\r\n });\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n } else if (!formatProps.composite) {\r\n const composite = { units: [{ name: unitParts[0], label: unitParts[1] }] };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n }\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleOnSpacerChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n // istanbul ignore else\r\n if (formatProps.composite) {\r\n const spacerValue = e.target.value.length ? e.target.value[0] : /* istanbul ignore next */ \"\"; // spacer can only be empty or a single character\r\n const composite = { ...formatProps.composite, spacer: spacerValue };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const compositeSpacer = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.compositeSpacer\"));\r\n\r\n return (\r\n <>\r\n {(formatProps.composite?.units)\r\n ?\r\n formatProps.composite.units.map((value, index) => <UnitDescr key={value.name} name={value.name}\r\n label={value.label ?? \"\"} parentUnitName={index > 0 ? formatProps.composite!.units[index - 1].name :\r\n undefined} unitsProvider={unitsProvider} index={index} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange}\r\n readonly={index < (formatProps.composite!.units.length - 1)} />)\r\n :\r\n persistenceUnit && <UnitDescr key={persistenceUnit.name} name={persistenceUnit.name}\r\n label={persistenceUnit.label} unitsProvider={unitsProvider} index={0} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange} />\r\n }\r\n\r\n {(formatProps.composite?.units && formatProps.composite.units.length > 1) &&\r\n <>\r\n <span key={\"composite-spacer-label\"} className={\"uicore-label\"}>{compositeSpacer.current}</span>\r\n <Input key={\"composite-spacer\"} data-testid=\"composite-spacer\" value={formatProps.composite.spacer ?? \"\"} onChange={handleOnSpacerChange} size=\"small\" />\r\n </>\r\n }\r\n </>\r\n );\r\n}\r\n"]}
@@ -1,22 +1,22 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- import * as React from "react";
5
- import { CommonProps } from "@itwin/core-react";
6
- import { FormatProps } from "@itwin/core-quantity";
7
- /** Properties of [[MiscFormatOptions]] component.
8
- * @alpha
9
- */
10
- export interface MiscFormatOptionsProps extends CommonProps {
11
- formatProps: FormatProps;
12
- onChange?: (format: FormatProps) => void;
13
- enableMinimumProperties?: boolean;
14
- showOptions: boolean;
15
- onShowHideOptions: (show: boolean) => void;
16
- children?: React.ReactNode;
17
- }
18
- /** Component use to set miscellaneous properties is a Formatted Quantity.
19
- * @alpha
20
- */
21
- export declare function MiscFormatOptions(props: MiscFormatOptionsProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ import * as React from "react";
5
+ import { CommonProps } from "@itwin/core-react";
6
+ import { FormatProps } from "@itwin/core-quantity";
7
+ /** Properties of [[MiscFormatOptions]] component.
8
+ * @alpha
9
+ */
10
+ export interface MiscFormatOptionsProps extends CommonProps {
11
+ formatProps: FormatProps;
12
+ onChange?: (format: FormatProps) => void;
13
+ enableMinimumProperties?: boolean;
14
+ showOptions: boolean;
15
+ onShowHideOptions: (show: boolean) => void;
16
+ children?: React.ReactNode;
17
+ }
18
+ /** Component use to set miscellaneous properties is a Formatted Quantity.
19
+ * @alpha
20
+ */
21
+ export declare function MiscFormatOptions(props: MiscFormatOptionsProps): JSX.Element;
22
22
  //# sourceMappingURL=MiscFormatOptions.d.ts.map