@itwin/imodel-components-react 3.5.0-dev.19 → 3.5.0-dev.21

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,23 +1,23 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { QuantityTypeArg } from "@itwin/core-frontend";
6
- import { FormatProps } from "@itwin/core-quantity";
7
- import { CommonProps } from "@itwin/core-react";
8
- /** Properties of [[QuantityFormatPanel]] component.
9
- * @alpha
10
- */
11
- export interface QuantityFormatPanelProps extends CommonProps {
12
- quantityType: QuantityTypeArg;
13
- onFormatChange?: (format: FormatProps) => void;
14
- /** props below are to be passed on to FormatPanel */
15
- showSample?: boolean;
16
- initialMagnitude?: number;
17
- enableMinimumProperties?: boolean;
18
- }
19
- /** Component to set properties that control Quantity Formatting.
20
- * @alpha
21
- */
22
- export declare function QuantityFormatPanel(props: QuantityFormatPanelProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { QuantityTypeArg } from "@itwin/core-frontend";
6
+ import { FormatProps } from "@itwin/core-quantity";
7
+ import { CommonProps } from "@itwin/core-react";
8
+ /** Properties of [[QuantityFormatPanel]] component.
9
+ * @alpha
10
+ */
11
+ export interface QuantityFormatPanelProps extends CommonProps {
12
+ quantityType: QuantityTypeArg;
13
+ onFormatChange?: (format: FormatProps) => void;
14
+ /** props below are to be passed on to FormatPanel */
15
+ showSample?: boolean;
16
+ initialMagnitude?: number;
17
+ enableMinimumProperties?: boolean;
18
+ }
19
+ /** Component to set properties that control Quantity Formatting.
20
+ * @alpha
21
+ */
22
+ export declare function QuantityFormatPanel(props: QuantityFormatPanelProps): JSX.Element;
23
23
  //# sourceMappingURL=QuantityFormatPanel.d.ts.map
@@ -1,155 +1,155 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module QuantityFormat
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.QuantityFormatPanel = void 0;
30
- const React = __importStar(require("react"));
31
- const core_frontend_1 = require("@itwin/core-frontend");
32
- const core_react_1 = require("@itwin/core-react");
33
- const itwinui_react_1 = require("@itwin/itwinui-react");
34
- const FormatPanel_1 = require("./FormatPanel");
35
- const core_geometry_1 = require("@itwin/core-geometry");
36
- function createTextInputFormatPropEditor(key, label, inProps, getString, setString, fireFormatChange) {
37
- const value = getString(inProps);
38
- return (React.createElement(React.Fragment, { key: `${key}` },
39
- React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
40
- React.createElement(itwinui_react_1.Input, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, size: "small", onChange: (e) => {
41
- const newProps = setString(inProps, e.currentTarget.value);
42
- fireFormatChange(newProps);
43
- } })));
44
- }
45
- function createSelectFormatPropEditor(key, label, options, inProps, getString, setString, fireFormatChange) {
46
- const value = getString(inProps);
47
- return (React.createElement(React.Fragment, { key: `${key}` },
48
- React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
49
- React.createElement(core_react_1.Select, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, options: options, onChange: (e) => {
50
- const newProps = setString(inProps, e.currentTarget.value);
51
- fireFormatChange(newProps);
52
- } })));
53
- }
54
- function createCheckboxFormatPropEditor(key, label, inProps, getBool, setBool, fireFormatChange) {
55
- const isChecked = getBool(inProps);
56
- return (React.createElement(React.Fragment, { key: `${key}` },
57
- React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
58
- React.createElement(itwinui_react_1.Checkbox, { "data-testid": `${key}-editor`, key: `${key}-editor`, checked: isChecked, onChange: (e) => {
59
- const newProps = setBool(inProps, e.target.checked);
60
- fireFormatChange(newProps);
61
- } })));
62
- }
63
- function formatAreEqual(obj1, obj2) {
64
- const compare = new core_geometry_1.DeepCompare();
65
- return compare.compare(obj1, obj2);
66
- }
67
- /** Component to set properties that control Quantity Formatting.
68
- * @alpha
69
- */
70
- function QuantityFormatPanel(props) {
71
- const { quantityType, onFormatChange, ...otherProps } = props;
72
- const [formatProps, setFormatProps] = React.useState();
73
- const initialFormatProps = React.useRef();
74
- const [persistenceUnit, setPersistenceUnit] = React.useState(() => {
75
- const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
76
- const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
77
- // istanbul ignore else
78
- if (quantityTypeDefinition)
79
- return quantityTypeDefinition.persistenceUnit;
80
- else
81
- throw Error(`Unable to locate a quantity type with type ${quantityType}`);
82
- });
83
- React.useEffect(() => {
84
- const newFormatProps = core_frontend_1.IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);
85
- // istanbul ignore else
86
- if (!initialFormatProps.current)
87
- initialFormatProps.current = newFormatProps;
88
- setFormatProps(newFormatProps);
89
- }, [quantityType]); // no dependencies defined as we want this to run on every render
90
- // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)
91
- // eslint-disable-next-line react-hooks/exhaustive-deps
92
- React.useEffect(() => {
93
- const newFormatProps = core_frontend_1.IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);
94
- // istanbul ignore else
95
- if (initialFormatProps.current && newFormatProps) {
96
- if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {
97
- initialFormatProps.current = newFormatProps;
98
- setFormatProps(newFormatProps);
99
- }
100
- }
101
- }); // no dependencies defined as we want this to run on every render
102
- React.useEffect(() => {
103
- const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
104
- const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
105
- // istanbul ignore else
106
- if (quantityTypeDefinition)
107
- setPersistenceUnit(quantityTypeDefinition.persistenceUnit);
108
- }, [quantityType]);
109
- const handleOnFormatChanged = React.useCallback(async (newProps) => {
110
- setFormatProps(newProps);
111
- onFormatChange && onFormatChange(newProps);
112
- }, [onFormatChange]);
113
- const createCustomPropEditors = React.useCallback((specs, inProps, fireFormatChange) => {
114
- return specs.map((spec, index) => {
115
- if ((0, core_frontend_1.isCheckboxFormatPropEditorSpec)(spec))
116
- return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);
117
- if ((0, core_frontend_1.isTextSelectFormatPropEditorSpec)(spec))
118
- return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);
119
- /* istanbul ignore else */
120
- if ((0, core_frontend_1.isTextInputFormatPropEditorSpec)(spec))
121
- return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);
122
- /* istanbul ignore next */
123
- return React.createElement("div", { key: index });
124
- });
125
- }, []);
126
- const providePrimaryChildren = React.useCallback((inProps, fireFormatChange) => {
127
- const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
128
- const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
129
- if (quantityTypeDefinition && (0, core_frontend_1.isCustomQuantityTypeDefinition)(quantityTypeDefinition) &&
130
- quantityTypeDefinition.isCompatibleFormatProps(inProps)) {
131
- // istanbul ignore else
132
- if (quantityTypeDefinition.primaryPropEditorSpecs)
133
- return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);
134
- }
135
- return null;
136
- }, [createCustomPropEditors, quantityType]);
137
- const provideSecondaryChildren = React.useCallback((inProps, fireFormatChange) => {
138
- const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
139
- const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
140
- if (quantityTypeDefinition && (0, core_frontend_1.isCustomQuantityTypeDefinition)(quantityTypeDefinition) &&
141
- quantityTypeDefinition.isCompatibleFormatProps(inProps)) {
142
- // istanbul ignore else
143
- if (quantityTypeDefinition.secondaryPropEditorSpecs)
144
- return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);
145
- }
146
- return null;
147
- }, [createCustomPropEditors, quantityType]);
148
- const provideFormatSpec = React.useCallback(async (inProps, _persistenceUnit, _unitsProvider) => {
149
- return core_frontend_1.IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);
150
- }, [quantityType]);
151
- return (React.createElement("div", { className: "components-quantityFormat-quantityPanel" }, persistenceUnit && formatProps &&
152
- React.createElement(FormatPanel_1.FormatPanel, { onFormatChange: handleOnFormatChanged, ...otherProps, initialFormat: formatProps, unitsProvider: core_frontend_1.IModelApp.quantityFormatter.unitsProvider, persistenceUnit: persistenceUnit, providePrimaryChildren: providePrimaryChildren, provideSecondaryChildren: provideSecondaryChildren, provideFormatSpec: provideFormatSpec })));
153
- }
154
- exports.QuantityFormatPanel = QuantityFormatPanel;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module QuantityFormat
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.QuantityFormatPanel = void 0;
30
+ const React = __importStar(require("react"));
31
+ const core_frontend_1 = require("@itwin/core-frontend");
32
+ const core_react_1 = require("@itwin/core-react");
33
+ const itwinui_react_1 = require("@itwin/itwinui-react");
34
+ const FormatPanel_1 = require("./FormatPanel");
35
+ const core_geometry_1 = require("@itwin/core-geometry");
36
+ function createTextInputFormatPropEditor(key, label, inProps, getString, setString, fireFormatChange) {
37
+ const value = getString(inProps);
38
+ return (React.createElement(React.Fragment, { key: `${key}` },
39
+ React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
40
+ React.createElement(itwinui_react_1.Input, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, size: "small", onChange: (e) => {
41
+ const newProps = setString(inProps, e.currentTarget.value);
42
+ fireFormatChange(newProps);
43
+ } })));
44
+ }
45
+ function createSelectFormatPropEditor(key, label, options, inProps, getString, setString, fireFormatChange) {
46
+ const value = getString(inProps);
47
+ return (React.createElement(React.Fragment, { key: `${key}` },
48
+ React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
49
+ React.createElement(core_react_1.Select, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, options: options, onChange: (e) => {
50
+ const newProps = setString(inProps, e.currentTarget.value);
51
+ fireFormatChange(newProps);
52
+ } })));
53
+ }
54
+ function createCheckboxFormatPropEditor(key, label, inProps, getBool, setBool, fireFormatChange) {
55
+ const isChecked = getBool(inProps);
56
+ return (React.createElement(React.Fragment, { key: `${key}` },
57
+ React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
58
+ React.createElement(itwinui_react_1.Checkbox, { "data-testid": `${key}-editor`, key: `${key}-editor`, checked: isChecked, onChange: (e) => {
59
+ const newProps = setBool(inProps, e.target.checked);
60
+ fireFormatChange(newProps);
61
+ } })));
62
+ }
63
+ function formatAreEqual(obj1, obj2) {
64
+ const compare = new core_geometry_1.DeepCompare();
65
+ return compare.compare(obj1, obj2);
66
+ }
67
+ /** Component to set properties that control Quantity Formatting.
68
+ * @alpha
69
+ */
70
+ function QuantityFormatPanel(props) {
71
+ const { quantityType, onFormatChange, ...otherProps } = props;
72
+ const [formatProps, setFormatProps] = React.useState();
73
+ const initialFormatProps = React.useRef();
74
+ const [persistenceUnit, setPersistenceUnit] = React.useState(() => {
75
+ const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
76
+ const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
77
+ // istanbul ignore else
78
+ if (quantityTypeDefinition)
79
+ return quantityTypeDefinition.persistenceUnit;
80
+ else
81
+ throw Error(`Unable to locate a quantity type with type ${quantityType}`);
82
+ });
83
+ React.useEffect(() => {
84
+ const newFormatProps = core_frontend_1.IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);
85
+ // istanbul ignore else
86
+ if (!initialFormatProps.current)
87
+ initialFormatProps.current = newFormatProps;
88
+ setFormatProps(newFormatProps);
89
+ }, [quantityType]); // no dependencies defined as we want this to run on every render
90
+ // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)
91
+ // eslint-disable-next-line react-hooks/exhaustive-deps
92
+ React.useEffect(() => {
93
+ const newFormatProps = core_frontend_1.IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);
94
+ // istanbul ignore else
95
+ if (initialFormatProps.current && newFormatProps) {
96
+ if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {
97
+ initialFormatProps.current = newFormatProps;
98
+ setFormatProps(newFormatProps);
99
+ }
100
+ }
101
+ }); // no dependencies defined as we want this to run on every render
102
+ React.useEffect(() => {
103
+ const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
104
+ const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
105
+ // istanbul ignore else
106
+ if (quantityTypeDefinition)
107
+ setPersistenceUnit(quantityTypeDefinition.persistenceUnit);
108
+ }, [quantityType]);
109
+ const handleOnFormatChanged = React.useCallback(async (newProps) => {
110
+ setFormatProps(newProps);
111
+ onFormatChange && onFormatChange(newProps);
112
+ }, [onFormatChange]);
113
+ const createCustomPropEditors = React.useCallback((specs, inProps, fireFormatChange) => {
114
+ return specs.map((spec, index) => {
115
+ if ((0, core_frontend_1.isCheckboxFormatPropEditorSpec)(spec))
116
+ return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);
117
+ if ((0, core_frontend_1.isTextSelectFormatPropEditorSpec)(spec))
118
+ return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);
119
+ /* istanbul ignore else */
120
+ if ((0, core_frontend_1.isTextInputFormatPropEditorSpec)(spec))
121
+ return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);
122
+ /* istanbul ignore next */
123
+ return React.createElement("div", { key: index });
124
+ });
125
+ }, []);
126
+ const providePrimaryChildren = React.useCallback((inProps, fireFormatChange) => {
127
+ const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
128
+ const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
129
+ if (quantityTypeDefinition && (0, core_frontend_1.isCustomQuantityTypeDefinition)(quantityTypeDefinition) &&
130
+ quantityTypeDefinition.isCompatibleFormatProps(inProps)) {
131
+ // istanbul ignore else
132
+ if (quantityTypeDefinition.primaryPropEditorSpecs)
133
+ return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);
134
+ }
135
+ return null;
136
+ }, [createCustomPropEditors, quantityType]);
137
+ const provideSecondaryChildren = React.useCallback((inProps, fireFormatChange) => {
138
+ const quantityTypeKey = (0, core_frontend_1.getQuantityTypeKey)(quantityType);
139
+ const quantityTypeDefinition = core_frontend_1.IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
140
+ if (quantityTypeDefinition && (0, core_frontend_1.isCustomQuantityTypeDefinition)(quantityTypeDefinition) &&
141
+ quantityTypeDefinition.isCompatibleFormatProps(inProps)) {
142
+ // istanbul ignore else
143
+ if (quantityTypeDefinition.secondaryPropEditorSpecs)
144
+ return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);
145
+ }
146
+ return null;
147
+ }, [createCustomPropEditors, quantityType]);
148
+ const provideFormatSpec = React.useCallback(async (inProps, _persistenceUnit, _unitsProvider) => {
149
+ return core_frontend_1.IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);
150
+ }, [quantityType]);
151
+ return (React.createElement("div", { className: "components-quantityFormat-quantityPanel" }, persistenceUnit && formatProps &&
152
+ React.createElement(FormatPanel_1.FormatPanel, { onFormatChange: handleOnFormatChanged, ...otherProps, initialFormat: formatProps, unitsProvider: core_frontend_1.IModelApp.quantityFormatter.unitsProvider, persistenceUnit: persistenceUnit, providePrimaryChildren: providePrimaryChildren, provideSecondaryChildren: provideSecondaryChildren, provideFormatSpec: provideFormatSpec })));
153
+ }
154
+ exports.QuantityFormatPanel = QuantityFormatPanel;
155
155
  //# sourceMappingURL=QuantityFormatPanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityFormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/QuantityFormatPanel.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GA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CAAC,CAAC;QACtG,IAAI,sBAAsB,IAAI,IAAA,8CAA8B,EAAC,sBAAsB,CAAC;YAClF,sBAAsB,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE;YACzD,uBAAuB;YACvB,IAAI,sBAAsB,CAAC,wBAAwB;gBACjD,OAAO,uBAAuB,CAAC,sBAAsB,CAAC,wBAAwB,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;SAC9G;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9C,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,KAAK,EAAE,OAAoB,EAAE,gBAA2B,EAAE,cAA6B,EAAE,EAAE;QACzF,OAAO,yBAAS,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,yCAAyC,IACrD,eAAe,IAAI,WAAW;QAC7B,oBAAC,yBAAW,IAAC,cAAc,EAAE,qBAAqB,KAAM,UAAU,EAChE,aAAa,EAAE,WAAW,EAC1B,aAAa,EAAE,yBAAS,CAAC,iBAAiB,CAAC,aAAa,EACxD,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,EAC9C,wBAAwB,EAAE,wBAAwB,EAClD,iBAAiB,EAAE,iBAAiB,GACpC,CACA,CACP,CAAC;AACJ,CAAC;AA3GD,kDA2GC","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 {\n CustomFormatPropEditorSpec, getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition,\n isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, QuantityTypeArg,\n} from \"@itwin/core-frontend\";\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { CommonProps, Select } from \"@itwin/core-react\";\nimport { Checkbox, Input } from \"@itwin/itwinui-react\";\nimport { FormatPanel } from \"./FormatPanel\";\nimport { DeepCompare } from \"@itwin/core-geometry\";\n\nfunction createTextInputFormatPropEditor(key: string, label: string, inProps: FormatProps,\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\n const value = getString(inProps);\n return (\n <React.Fragment key={`${key}`}>\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\n <Input data-testid={`${key}-editor`} key={`${key}-editor`}\n value={value}\n size=\"small\"\n onChange={(e) => {\n const newProps = setString(inProps, e.currentTarget.value);\n fireFormatChange(newProps);\n }}\n />\n </React.Fragment>\n );\n}\n\nfunction createSelectFormatPropEditor(key: string, label: string, options: { label: string, value: string }[], inProps: FormatProps,\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\n const value = getString(inProps);\n return (\n <React.Fragment key={`${key}`}>\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\n {/* NEEDSWORK - unable to migrate this Select to iTwinUI because no menu items were found */}\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Select data-testid={`${key}-editor`} key={`${key}-editor`}\n value={value}\n options={options}\n onChange={(e) => {\n const newProps = setString(inProps, e.currentTarget.value);\n fireFormatChange(newProps);\n }}\n />\n </React.Fragment>\n );\n}\n\nfunction createCheckboxFormatPropEditor(key: string, label: string, inProps: FormatProps,\n getBool: (props: FormatProps) => boolean, setBool: (props: FormatProps, isChecked: boolean) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\n const isChecked = getBool(inProps);\n return (\n <React.Fragment key={`${key}`}>\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\n <Checkbox data-testid={`${key}-editor`} key={`${key}-editor`}\n checked={isChecked}\n onChange={(e) => {\n const newProps = setBool(inProps, e.target.checked);\n fireFormatChange(newProps);\n }} />\n </React.Fragment>\n );\n}\n\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\n const compare = new DeepCompare();\n return compare.compare(obj1, obj2);\n}\n\n/** Properties of [[QuantityFormatPanel]] component.\n * @alpha\n */\nexport interface QuantityFormatPanelProps extends CommonProps {\n quantityType: QuantityTypeArg;\n onFormatChange?: (format: FormatProps) => void;\n /** props below are to be passed on to FormatPanel */\n showSample?: boolean;\n initialMagnitude?: number;\n enableMinimumProperties?: boolean;\n}\n\n/** Component to set properties that control Quantity Formatting.\n * @alpha\n */\nexport function QuantityFormatPanel(props: QuantityFormatPanelProps) {\n const { quantityType, onFormatChange, ...otherProps } = props;\n const [formatProps, setFormatProps] = React.useState<FormatProps>();\n const initialFormatProps = React.useRef<FormatProps>();\n\n const [persistenceUnit, setPersistenceUnit] = React.useState(() => {\n const quantityTypeKey = getQuantityTypeKey(quantityType);\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\n // istanbul ignore else\n if (quantityTypeDefinition)\n return quantityTypeDefinition.persistenceUnit;\n else\n throw Error(`Unable to locate a quantity type with type ${quantityType}`);\n });\n\n React.useEffect(() => {\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\n // istanbul ignore else\n if (!initialFormatProps.current)\n initialFormatProps.current = newFormatProps;\n setFormatProps(newFormatProps);\n }, [quantityType]); // no dependencies defined as we want this to run on every render\n\n // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n React.useEffect(() => {\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\n // istanbul ignore else\n if (initialFormatProps.current && newFormatProps) {\n if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {\n initialFormatProps.current = newFormatProps;\n setFormatProps(newFormatProps);\n }\n }\n }); // no dependencies defined as we want this to run on every render\n\n React.useEffect(() => {\n const quantityTypeKey = getQuantityTypeKey(quantityType);\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\n // istanbul ignore else\n if (quantityTypeDefinition)\n setPersistenceUnit(quantityTypeDefinition.persistenceUnit);\n }, [quantityType]);\n\n const handleOnFormatChanged = React.useCallback(async (newProps: FormatProps) => {\n setFormatProps(newProps);\n onFormatChange && onFormatChange(newProps);\n }, [onFormatChange]);\n\n const createCustomPropEditors = React.useCallback((specs: CustomFormatPropEditorSpec[], inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\n return specs.map((spec, index) => {\n if (isCheckboxFormatPropEditorSpec(spec))\n return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);\n if (isTextSelectFormatPropEditorSpec(spec))\n return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);\n /* istanbul ignore else */\n if (isTextInputFormatPropEditorSpec(spec))\n return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);\n /* istanbul ignore next */\n return <div key={index} />;\n });\n }, []);\n\n const providePrimaryChildren = React.useCallback(\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\n const quantityTypeKey = getQuantityTypeKey(quantityType);\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\n // istanbul ignore else\n if (quantityTypeDefinition.primaryPropEditorSpecs)\n return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);\n }\n return null;\n }, [createCustomPropEditors, quantityType]);\n\n const provideSecondaryChildren = React.useCallback(\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\n const quantityTypeKey = getQuantityTypeKey(quantityType);\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\n // istanbul ignore else\n if (quantityTypeDefinition.secondaryPropEditorSpecs)\n return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);\n }\n return null;\n }, [createCustomPropEditors, quantityType]);\n\n const provideFormatSpec = React.useCallback(\n async (inProps: FormatProps, _persistenceUnit: UnitProps, _unitsProvider: UnitsProvider) => {\n return IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);\n }, [quantityType]);\n\n return (\n <div className=\"components-quantityFormat-quantityPanel\">\n {persistenceUnit && formatProps &&\n <FormatPanel onFormatChange={handleOnFormatChanged} {...otherProps}\n initialFormat={formatProps}\n unitsProvider={IModelApp.quantityFormatter.unitsProvider}\n persistenceUnit={persistenceUnit}\n providePrimaryChildren={providePrimaryChildren}\n provideSecondaryChildren={provideSecondaryChildren}\n provideFormatSpec={provideFormatSpec}\n />}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"QuantityFormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/QuantityFormatPanel.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,wDAG8B;AAE9B,kDAAwD;AACxD,wDAAuD;AACvD,+CAA4C;AAC5C,wDAAmD;AAEnD,SAAS,+BAA+B,CAAC,GAAW,EAAE,KAAa,EAAE,OAAoB,EACvF,SAAyC,EAAE,SAA6D,EAAE,gBAAiD;IAC3J,MAAM,KAAK,GAAG,SAAS,C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,CAAC,CAAC;SAC9G;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9C,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,KAAK,EAAE,OAAoB,EAAE,gBAA2B,EAAE,cAA6B,EAAE,EAAE;QACzF,OAAO,yBAAS,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,yCAAyC,IACrD,eAAe,IAAI,WAAW;QAC7B,oBAAC,yBAAW,IAAC,cAAc,EAAE,qBAAqB,KAAM,UAAU,EAChE,aAAa,EAAE,WAAW,EAC1B,aAAa,EAAE,yBAAS,CAAC,iBAAiB,CAAC,aAAa,EACxD,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,EAC9C,wBAAwB,EAAE,wBAAwB,EAClD,iBAAiB,EAAE,iBAAiB,GACpC,CACA,CACP,CAAC;AACJ,CAAC;AA3GD,kDA2GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\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 {\r\n CustomFormatPropEditorSpec, getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition,\r\n isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, QuantityTypeArg,\r\n} from \"@itwin/core-frontend\";\r\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { CommonProps, Select } from \"@itwin/core-react\";\r\nimport { Checkbox, Input } from \"@itwin/itwinui-react\";\r\nimport { FormatPanel } from \"./FormatPanel\";\r\nimport { DeepCompare } from \"@itwin/core-geometry\";\r\n\r\nfunction createTextInputFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Input data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n size=\"small\"\r\n onChange={(e) => {\r\n const newProps = setString(inProps, e.currentTarget.value);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction createSelectFormatPropEditor(key: string, label: string, options: { label: string, value: string }[], inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n {/* NEEDSWORK - unable to migrate this Select to iTwinUI because no menu items were found */}\r\n {/* eslint-disable-next-line deprecation/deprecation */}\r\n <Select data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n options={options}\r\n onChange={(e) => {\r\n const newProps = setString(inProps, e.currentTarget.value);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction createCheckboxFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getBool: (props: FormatProps) => boolean, setBool: (props: FormatProps, isChecked: boolean) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const isChecked = getBool(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Checkbox data-testid={`${key}-editor`} key={`${key}-editor`}\r\n checked={isChecked}\r\n onChange={(e) => {\r\n const newProps = setBool(inProps, e.target.checked);\r\n fireFormatChange(newProps);\r\n }} />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\r\n const compare = new DeepCompare();\r\n return compare.compare(obj1, obj2);\r\n}\r\n\r\n/** Properties of [[QuantityFormatPanel]] component.\r\n * @alpha\r\n */\r\nexport interface QuantityFormatPanelProps extends CommonProps {\r\n quantityType: QuantityTypeArg;\r\n onFormatChange?: (format: FormatProps) => void;\r\n /** props below are to be passed on to FormatPanel */\r\n showSample?: boolean;\r\n initialMagnitude?: number;\r\n enableMinimumProperties?: boolean;\r\n}\r\n\r\n/** Component to set properties that control Quantity Formatting.\r\n * @alpha\r\n */\r\nexport function QuantityFormatPanel(props: QuantityFormatPanelProps) {\r\n const { quantityType, onFormatChange, ...otherProps } = props;\r\n const [formatProps, setFormatProps] = React.useState<FormatProps>();\r\n const initialFormatProps = React.useRef<FormatProps>();\r\n\r\n const [persistenceUnit, setPersistenceUnit] = React.useState(() => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n // istanbul ignore else\r\n if (quantityTypeDefinition)\r\n return quantityTypeDefinition.persistenceUnit;\r\n else\r\n throw Error(`Unable to locate a quantity type with type ${quantityType}`);\r\n });\r\n\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (!initialFormatProps.current)\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n }, [quantityType]); // no dependencies defined as we want this to run on every render\r\n\r\n // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (initialFormatProps.current && newFormatProps) {\r\n if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n }\r\n }\r\n }); // no dependencies defined as we want this to run on every render\r\n\r\n React.useEffect(() => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n // istanbul ignore else\r\n if (quantityTypeDefinition)\r\n setPersistenceUnit(quantityTypeDefinition.persistenceUnit);\r\n }, [quantityType]);\r\n\r\n const handleOnFormatChanged = React.useCallback(async (newProps: FormatProps) => {\r\n setFormatProps(newProps);\r\n onFormatChange && onFormatChange(newProps);\r\n }, [onFormatChange]);\r\n\r\n const createCustomPropEditors = React.useCallback((specs: CustomFormatPropEditorSpec[], inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n return specs.map((spec, index) => {\r\n if (isCheckboxFormatPropEditorSpec(spec))\r\n return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);\r\n if (isTextSelectFormatPropEditorSpec(spec))\r\n return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore else */\r\n if (isTextInputFormatPropEditorSpec(spec))\r\n return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore next */\r\n return <div key={index} />;\r\n });\r\n }, []);\r\n\r\n const providePrimaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.primaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideSecondaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.secondaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideFormatSpec = React.useCallback(\r\n async (inProps: FormatProps, _persistenceUnit: UnitProps, _unitsProvider: UnitsProvider) => {\r\n return IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);\r\n }, [quantityType]);\r\n\r\n return (\r\n <div className=\"components-quantityFormat-quantityPanel\">\r\n {persistenceUnit && formatProps &&\r\n <FormatPanel onFormatChange={handleOnFormatChanged} {...otherProps}\r\n initialFormat={formatProps}\r\n unitsProvider={IModelApp.quantityFormatter.unitsProvider}\r\n persistenceUnit={persistenceUnit}\r\n providePrimaryChildren={providePrimaryChildren}\r\n provideSecondaryChildren={provideSecondaryChildren}\r\n provideFormatSpec={provideFormatSpec}\r\n />}\r\n </div>\r\n );\r\n}\r\n"]}
@@ -1,18 +1,18 @@
1
- /** @packageDocumentation
2
- * @module QuantityFormat
3
- */
4
- /// <reference types="react" />
5
- import { CommonProps } from "@itwin/core-react";
6
- /** Properties of [[DecimalPrecisionSelector]] component.
7
- * @internal
8
- */
9
- export interface DecimalPrecisionSelectorProps extends CommonProps {
10
- precision: number;
11
- onChange: (value: number) => void;
12
- }
13
- /** Component use to set Decimal Precision
14
- * the unit label.
15
- * @internal
16
- */
17
- export declare function DecimalPrecisionSelector(props: DecimalPrecisionSelectorProps): JSX.Element;
1
+ /** @packageDocumentation
2
+ * @module QuantityFormat
3
+ */
4
+ /// <reference types="react" />
5
+ import { CommonProps } from "@itwin/core-react";
6
+ /** Properties of [[DecimalPrecisionSelector]] component.
7
+ * @internal
8
+ */
9
+ export interface DecimalPrecisionSelectorProps extends CommonProps {
10
+ precision: number;
11
+ onChange: (value: number) => void;
12
+ }
13
+ /** Component use to set Decimal Precision
14
+ * the unit label.
15
+ * @internal
16
+ */
17
+ export declare function DecimalPrecisionSelector(props: DecimalPrecisionSelectorProps): JSX.Element;
18
18
  //# sourceMappingURL=DecimalPrecision.d.ts.map
@@ -1,60 +1,60 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module QuantityFormat
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.DecimalPrecisionSelector = void 0;
30
- const React = __importStar(require("react"));
31
- const UiIModelComponents_1 = require("../../UiIModelComponents");
32
- const itwinui_react_1 = require("@itwin/itwinui-react");
33
- /** Component use to set Decimal Precision
34
- * the unit label.
35
- * @internal
36
- */
37
- function DecimalPrecisionSelector(props) {
38
- const { precision, onChange, ...otherProps } = props;
39
- const options = React.useRef([
40
- { value: 0, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.zero") },
41
- { value: 1, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.one") },
42
- { value: 2, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.two") },
43
- { value: 3, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.three") },
44
- { value: 4, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.four") },
45
- { value: 5, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.five") },
46
- { value: 6, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.six") },
47
- { value: 7, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.seven") },
48
- { value: 8, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.eight") },
49
- { value: 9, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.nine") },
50
- { value: 10, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.ten") },
51
- { value: 11, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.eleven") },
52
- { value: 12, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.twelve") },
53
- ]);
54
- const handleOnChange = React.useCallback((newValue) => {
55
- onChange && onChange(newValue);
56
- }, [onChange]);
57
- return (React.createElement(itwinui_react_1.Select, { options: options.current, value: precision, onChange: handleOnChange, size: "small", ...otherProps }));
58
- }
59
- exports.DecimalPrecisionSelector = DecimalPrecisionSelector;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module QuantityFormat
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.DecimalPrecisionSelector = void 0;
30
+ const React = __importStar(require("react"));
31
+ const UiIModelComponents_1 = require("../../UiIModelComponents");
32
+ const itwinui_react_1 = require("@itwin/itwinui-react");
33
+ /** Component use to set Decimal Precision
34
+ * the unit label.
35
+ * @internal
36
+ */
37
+ function DecimalPrecisionSelector(props) {
38
+ const { precision, onChange, ...otherProps } = props;
39
+ const options = React.useRef([
40
+ { value: 0, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.zero") },
41
+ { value: 1, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.one") },
42
+ { value: 2, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.two") },
43
+ { value: 3, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.three") },
44
+ { value: 4, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.four") },
45
+ { value: 5, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.five") },
46
+ { value: 6, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.six") },
47
+ { value: 7, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.seven") },
48
+ { value: 8, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.eight") },
49
+ { value: 9, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.nine") },
50
+ { value: 10, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.ten") },
51
+ { value: 11, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.eleven") },
52
+ { value: 12, label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal_precision.twelve") },
53
+ ]);
54
+ const handleOnChange = React.useCallback((newValue) => {
55
+ onChange && onChange(newValue);
56
+ }, [onChange]);
57
+ return (React.createElement(itwinui_react_1.Select, { options: options.current, value: precision, onChange: handleOnChange, size: "small", ...otherProps }));
58
+ }
59
+ exports.DecimalPrecisionSelector = DecimalPrecisionSelector;
60
60
  //# sourceMappingURL=DecimalPrecision.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DecimalPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalPrecision.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAU5D;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE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AS,CAAC,yCAAyC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC;AAzBD,4DAyBC","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 { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[DecimalPrecisionSelector]] component.\n * @internal\n */\nexport interface DecimalPrecisionSelectorProps extends CommonProps {\n precision: number;\n onChange: (value: number) => void;\n}\n\n/** Component use to set Decimal Precision\n * the unit label.\n * @internal\n */\nexport function DecimalPrecisionSelector(props: DecimalPrecisionSelectorProps) {\n const { precision, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<number>[]>([\n { value: 0, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.zero\") },\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.one\") },\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.two\") },\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.three\") },\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.four\") },\n { value: 5, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.five\") },\n { value: 6, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.six\") },\n { value: 7, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.seven\") },\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eight\") },\n { value: 9, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.nine\") },\n { value: 10, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.ten\") },\n { value: 11, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eleven\") },\n { value: 12, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.twelve\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: number) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
1
+ {"version":3,"file":"DecimalPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalPrecision.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,iEAA8D;AAC9D,wDAA4D;AAU5D;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC1F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,EAAE;QACzF,EAAE,KAAK,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IAEf,OAAO,CACL,oBAAC,sBAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC;AAzBD,4DAyBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\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 { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[DecimalPrecisionSelector]] component.\r\n * @internal\r\n */\r\nexport interface DecimalPrecisionSelectorProps extends CommonProps {\r\n precision: number;\r\n onChange: (value: number) => void;\r\n}\r\n\r\n/** Component use to set Decimal Precision\r\n * the unit label.\r\n * @internal\r\n */\r\nexport function DecimalPrecisionSelector(props: DecimalPrecisionSelectorProps) {\r\n const { precision, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<number>[]>([\r\n { value: 0, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.zero\") },\r\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.one\") },\r\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.two\") },\r\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.three\") },\r\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.four\") },\r\n { value: 5, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.five\") },\r\n { value: 6, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.six\") },\r\n { value: 7, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.seven\") },\r\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eight\") },\r\n { value: 9, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.nine\") },\r\n { value: 10, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.ten\") },\r\n { value: 11, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eleven\") },\r\n { value: 12, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.twelve\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: number) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}