@itwin/components-react 4.12.0 → 4.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/components-react/common/DelayedSpinner.js +2 -3
  3. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  4. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +1 -2
  5. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  6. package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
  7. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  8. package/lib/cjs/components-react/converters/TypeConverter.js +1 -2
  9. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  10. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +1 -1
  11. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  12. package/lib/cjs/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  13. package/lib/cjs/components-react/editors/CustomNumberEditor.js +10 -11
  14. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  15. package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -3
  16. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  17. package/lib/cjs/components-react/editors/EditorContainer.d.ts +2 -24
  18. package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
  19. package/lib/cjs/components-react/editors/EditorContainer.js +111 -149
  20. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  21. package/lib/cjs/components-react/editors/EnumEditor.js +1 -1
  22. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  23. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  24. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js +3 -1
  25. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  26. package/lib/cjs/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  27. package/lib/cjs/components-react/editors/NumericInputEditor.js +3 -1
  28. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  29. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  30. package/lib/cjs/components-react/editors/PopupButton.js +4 -4
  31. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  32. package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
  33. package/lib/cjs/components-react/editors/TextEditor.js +6 -6
  34. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  35. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
  36. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  37. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  38. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  39. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  40. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  41. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  42. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  43. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +3 -3
  44. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  45. package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
  46. package/lib/cjs/components-react/properties/LinkHandler.js +3 -1
  47. package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
  48. package/lib/cjs/components-react/properties/ValueRendererManager.d.ts.map +1 -1
  49. package/lib/cjs/components-react/properties/ValueRendererManager.js +0 -4
  50. package/lib/cjs/components-react/properties/ValueRendererManager.js.map +1 -1
  51. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  52. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  53. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js +2 -3
  54. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -1
  55. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  56. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  57. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.d.ts +0 -1
  58. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.d.ts.map +1 -1
  59. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +4 -2
  60. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  61. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  62. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  63. package/lib/cjs/components-react/properties/renderers/PropertyView.js +3 -1
  64. package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
  65. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +1 -0
  66. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  67. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  68. package/lib/cjs/components-react/properties/renderers/value/Common.js +1 -2
  69. package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
  70. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +0 -1
  71. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  72. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +2 -4
  73. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  74. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +0 -5
  75. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts.map +1 -1
  76. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +5 -17
  77. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  78. package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts.map +1 -1
  79. package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +2 -1
  80. package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  81. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts.map +1 -1
  82. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js +3 -1
  83. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  84. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  85. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  86. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  87. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  88. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  89. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  90. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  91. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts +0 -1
  92. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  93. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  94. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  95. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts +4 -2
  96. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  97. package/lib/cjs/components-react/propertygrid/component/PropertyList.js.map +1 -1
  98. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -2
  99. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  100. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +51 -59
  101. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  102. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +4 -0
  103. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  104. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  105. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  106. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  107. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  108. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  109. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  110. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  111. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  112. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  113. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  114. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  115. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  116. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  117. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  118. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  119. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -9
  120. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  121. package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
  122. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  123. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +5 -7
  124. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  125. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  126. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  127. package/lib/cjs/components-react/tree/controlled/TreeActions.d.ts +0 -1
  128. package/lib/cjs/components-react/tree/controlled/TreeActions.d.ts.map +1 -1
  129. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts +0 -1
  130. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  131. package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
  132. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  133. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  134. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  135. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +3 -1
  136. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  137. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
  138. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  139. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +0 -1
  140. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  141. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +9 -9
  142. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  143. package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
  144. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  145. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
  146. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  147. package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
  148. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  149. package/lib/esm/components-react/converters/TypeConverter.js +1 -2
  150. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  151. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +1 -1
  152. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  153. package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  154. package/lib/esm/components-react/editors/CustomNumberEditor.js +10 -11
  155. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  156. package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
  157. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  158. package/lib/esm/components-react/editors/EditorContainer.d.ts +2 -24
  159. package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
  160. package/lib/esm/components-react/editors/EditorContainer.js +111 -149
  161. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  162. package/lib/esm/components-react/editors/EnumEditor.js +1 -1
  163. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  164. package/lib/esm/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  165. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +3 -1
  166. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  167. package/lib/esm/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  168. package/lib/esm/components-react/editors/NumericInputEditor.js +3 -1
  169. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  170. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  171. package/lib/esm/components-react/editors/PopupButton.js +4 -4
  172. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  173. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  174. package/lib/esm/components-react/editors/TextEditor.js +6 -6
  175. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  176. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  177. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  178. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  179. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  180. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  181. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  182. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  183. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  184. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +3 -3
  185. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  186. package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
  187. package/lib/esm/components-react/properties/LinkHandler.js +3 -1
  188. package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
  189. package/lib/esm/components-react/properties/ValueRendererManager.d.ts.map +1 -1
  190. package/lib/esm/components-react/properties/ValueRendererManager.js +0 -4
  191. package/lib/esm/components-react/properties/ValueRendererManager.js.map +1 -1
  192. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  193. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  194. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js +2 -3
  195. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -1
  196. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  197. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  198. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.d.ts +0 -1
  199. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.d.ts.map +1 -1
  200. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +4 -2
  201. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  202. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  203. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  204. package/lib/esm/components-react/properties/renderers/PropertyView.js +3 -1
  205. package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
  206. package/lib/esm/components-react/properties/renderers/PropertyView.scss +1 -0
  207. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  208. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  209. package/lib/esm/components-react/properties/renderers/value/Common.js +1 -2
  210. package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
  211. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +0 -1
  212. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  213. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +2 -4
  214. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  215. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +0 -5
  216. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts.map +1 -1
  217. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +4 -15
  218. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  219. package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts.map +1 -1
  220. package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +3 -2
  221. package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  222. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts.map +1 -1
  223. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js +3 -1
  224. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  225. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  226. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  227. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  228. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  229. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  230. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  231. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  232. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts +0 -1
  233. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  234. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  235. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  236. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts +4 -2
  237. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  238. package/lib/esm/components-react/propertygrid/component/PropertyList.js.map +1 -1
  239. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -2
  240. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  241. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +51 -59
  242. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  243. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +4 -0
  244. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  245. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  246. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  247. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  248. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  249. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  250. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  251. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  252. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  253. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  254. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  255. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  256. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  257. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  258. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  259. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  260. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -9
  261. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  262. package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
  263. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  264. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +5 -7
  265. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  266. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  267. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  268. package/lib/esm/components-react/tree/controlled/TreeActions.d.ts +0 -1
  269. package/lib/esm/components-react/tree/controlled/TreeActions.d.ts.map +1 -1
  270. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts +0 -1
  271. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  272. package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
  273. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  274. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  275. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  276. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +3 -1
  277. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  278. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
  279. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  280. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +0 -1
  281. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  282. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +9 -9
  283. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  284. package/package.json +8 -36
@@ -64,30 +64,8 @@ export interface TypeEditor {
64
64
  htmlElement: HTMLElement | null;
65
65
  hasFocus: boolean;
66
66
  }
67
- /**
68
- * EditorContainer React component used by the Tree and PropertyGrid for cell editing.
67
+ /** EditorContainer React component used by the Tree and PropertyGrid for cell editing.
69
68
  * @public
70
69
  */
71
- export declare class EditorContainer extends React.PureComponent<EditorContainerProps> {
72
- private _editorRef;
73
- private _propertyEditor;
74
- private createEditor;
75
- private _handleEditorBlur;
76
- private _handleContainerBlur;
77
- private _handleClick;
78
- private _handleKeyDown;
79
- private _handleRightClick;
80
- private onPressEscape;
81
- private onPressEnter;
82
- private onPressTab;
83
- private displayOutputMessage;
84
- private isNewValueValid;
85
- private _handleEditorCommit;
86
- private _handleContainerCommit;
87
- private _commit;
88
- private _handleEditorCancel;
89
- private _commitCancel;
90
- /** @internal */
91
- render(): React.JSX.Element;
92
- }
70
+ export declare function EditorContainer(props: EditorContainerProps): React.JSX.Element;
93
71
  //# sourceMappingURL=EditorContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBA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AAmB,CAEzB;IAEF,OAAO,CAAC,aAAa,CAEnB;IAEF,gBAAgB;IACA,MAAM;CAgBvB"}
1
+ {"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC9C,yBAAyB;IACzB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gBAAgB;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IAC3D,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBA2K1D"}
@@ -36,162 +36,124 @@ const React = __importStar(require("react"));
36
36
  const ts_key_enum_1 = require("ts-key-enum");
37
37
  const appui_abstract_1 = require("@itwin/appui-abstract");
38
38
  const PropertyEditorManager_1 = require("./PropertyEditorManager");
39
- /**
40
- * EditorContainer React component used by the Tree and PropertyGrid for cell editing.
39
+ /** EditorContainer React component used by the Tree and PropertyGrid for cell editing.
41
40
  * @public
42
41
  */
43
- class EditorContainer extends React.PureComponent {
44
- constructor() {
45
- super(...arguments);
46
- this._handleEditorBlur = (_e) => {
47
- // istanbul ignore else
48
- if (!this.props.ignoreEditorBlur &&
49
- this._propertyEditor &&
50
- this._propertyEditor.containerHandlesBlur)
51
- void this._handleContainerCommit();
52
- };
53
- this._handleContainerBlur = (e) => {
42
+ function EditorContainer(props) {
43
+ const { ignoreEditorBlur, title, shouldCommitOnChange, propertyRecord, setFocus, onCommit, onCancel, ...rest } = props;
44
+ const editorRef = React.useRef();
45
+ const propertyEditorRef = React.useRef();
46
+ const handleClick = (e) => e.stopPropagation();
47
+ const handleContainerBlur = (e) => e.stopPropagation();
48
+ const handleEditorCommit = (args) => void commit(args);
49
+ const handleContainerCommit = async () => {
50
+ const newValue = editorRef && (await editorRef.current?.getPropertyValue());
51
+ if (newValue === undefined)
52
+ return;
53
+ void commit({
54
+ propertyRecord,
55
+ newValue,
56
+ });
57
+ };
58
+ const onPressEscape = () => {
59
+ if (!propertyEditorRef.current?.containerHandlesEscape)
60
+ return;
61
+ onCancel();
62
+ };
63
+ const onPressEnter = (e) => {
64
+ if (!propertyEditorRef.current?.containerHandlesEnter)
65
+ return;
66
+ if (editorRef?.current?.hasFocus)
54
67
  e.stopPropagation();
55
- };
56
- this._handleClick = (e) => {
57
- e.stopPropagation();
58
- };
59
- this._handleKeyDown = (e) => {
60
- switch (e.key) {
61
- case ts_key_enum_1.Key.Escape.valueOf():
62
- this.onPressEscape(e);
63
- break;
64
- case ts_key_enum_1.Key.Enter.valueOf():
65
- this.onPressEnter(e);
66
- break;
67
- case ts_key_enum_1.Key.Tab.valueOf():
68
- this.onPressTab(e);
69
- break;
70
- default:
71
- if (this._propertyEditor &&
72
- this._propertyEditor.containerStopsKeydownPropagation)
73
- e.stopPropagation();
74
- }
75
- };
76
- this._handleRightClick = (e) => {
77
- e.stopPropagation();
78
- };
79
- this._handleEditorCommit = (args) => {
80
- void this._commit(args);
81
- };
82
- this._handleContainerCommit = async () => {
83
- const newValue = this._editorRef && (await this._editorRef.getPropertyValue());
84
- // istanbul ignore else
85
- if (newValue !== undefined) {
86
- void this._commit({
87
- propertyRecord: this.props.propertyRecord,
88
- newValue,
89
- });
90
- }
91
- };
92
- this._commit = async (args) => {
93
- const newValue = args.newValue;
94
- const isValid = await this.isNewValueValid(newValue);
95
- if (isValid) {
96
- let doCommit = true;
97
- // istanbul ignore else
98
- if (this._propertyEditor && args.propertyRecord) {
99
- const commitResult = await this._propertyEditor.commitValue(newValue, args.propertyRecord);
100
- if (commitResult.encounteredError) {
101
- this.displayOutputMessage(commitResult.errorMessage);
102
- doCommit = false;
103
- }
104
- }
105
- if (doCommit) {
106
- this.props.onCommit(args);
107
- }
108
- }
109
- };
110
- this._handleEditorCancel = () => {
111
- this._commitCancel();
112
- };
113
- this._commitCancel = () => {
114
- this.props.onCancel();
115
- };
116
- }
117
- createEditor() {
118
- const editorRef = (ref) => (this._editorRef = ref);
119
- const editorProps = {
120
- ref: editorRef,
121
- onCommit: this._handleEditorCommit,
122
- onCancel: this._handleEditorCancel,
123
- onBlur: this._handleEditorBlur,
124
- propertyRecord: this.props.propertyRecord,
125
- setFocus: this.props.setFocus !== undefined ? this.props.setFocus : true,
126
- className: this.props.className,
127
- style: this.props.style,
128
- shouldCommitOnChange: this.props.shouldCommitOnChange,
129
- };
130
- const propDescription = this.props.propertyRecord.property;
131
- const editorName = propDescription.editor !== undefined
132
- ? propDescription.editor.name
133
- : undefined;
134
- this._propertyEditor = PropertyEditorManager_1.PropertyEditorManager.createEditor(propDescription.typename, editorName, propDescription.dataController);
135
- const editorNode = this._propertyEditor.reactNode;
136
- let clonedNode = null;
137
- // istanbul ignore else
138
- if (React.isValidElement(editorNode)) {
139
- clonedNode = React.cloneElement(editorNode, editorProps);
140
- }
141
- return clonedNode;
142
- }
143
- onPressEscape(_e) {
144
- // istanbul ignore else
145
- if (this._propertyEditor && this._propertyEditor.containerHandlesEscape) {
146
- this._commitCancel();
147
- }
148
- }
149
- onPressEnter(e) {
150
- // istanbul ignore else
151
- if (this._propertyEditor && this._propertyEditor.containerHandlesEnter) {
152
- // istanbul ignore else
153
- if (this._editorRef && this._editorRef.hasFocus)
154
- e.stopPropagation();
155
- void this._handleContainerCommit();
68
+ void handleContainerCommit();
69
+ };
70
+ const onPressTab = (e) => {
71
+ if (!propertyEditorRef.current?.containerHandlesTab)
72
+ return;
73
+ e.stopPropagation();
74
+ void handleContainerCommit();
75
+ };
76
+ const handleKeyDown = (e) => {
77
+ switch (e.key) {
78
+ case ts_key_enum_1.Key.Escape.valueOf():
79
+ onPressEscape();
80
+ break;
81
+ case ts_key_enum_1.Key.Enter.valueOf():
82
+ onPressEnter(e);
83
+ break;
84
+ case ts_key_enum_1.Key.Tab.valueOf():
85
+ onPressTab(e);
86
+ break;
87
+ default:
88
+ if (propertyEditorRef.current?.containerStopsKeydownPropagation)
89
+ e.stopPropagation();
156
90
  }
157
- }
158
- onPressTab(e) {
159
- // istanbul ignore else
160
- if (this._propertyEditor && this._propertyEditor.containerHandlesTab) {
161
- e.stopPropagation();
162
- void this._handleContainerCommit();
163
- }
164
- }
165
- displayOutputMessage(errorMessage) {
166
- // istanbul ignore else
167
- if (errorMessage && this._editorRef) {
168
- const htmlElement = this._editorRef && this._editorRef.htmlElement;
169
- // istanbul ignore else
170
- if (htmlElement)
171
- appui_abstract_1.UiAdmin.messagePresenter.displayInputFieldMessage(htmlElement, errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage);
172
- else
173
- appui_abstract_1.UiAdmin.messagePresenter.displayMessage(errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage, errorMessage.messageType);
91
+ };
92
+ const handleEditorBlur = () => {
93
+ if (ignoreEditorBlur)
94
+ return;
95
+ if (!propertyEditorRef.current?.containerHandlesBlur)
96
+ return;
97
+ void handleContainerCommit();
98
+ };
99
+ const isNewValueValid = async (value) => {
100
+ if (!propertyEditorRef.current)
101
+ return false;
102
+ if (!propertyRecord)
103
+ return false;
104
+ const validateResult = await propertyEditorRef.current.validateValue(value, propertyRecord);
105
+ if (validateResult.encounteredError) {
106
+ displayOutputMessage(validateResult.errorMessage);
107
+ return false;
174
108
  }
175
- }
176
- async isNewValueValid(value) {
177
- let isValid = true;
178
- // istanbul ignore else
179
- if (this._propertyEditor && this.props.propertyRecord) {
180
- const validateResult = await this._propertyEditor.validateValue(value, this.props.propertyRecord);
181
- if (validateResult.encounteredError) {
182
- this.displayOutputMessage(validateResult.errorMessage);
183
- isValid = false;
109
+ return true;
110
+ };
111
+ const displayOutputMessage = (errorMessage) => {
112
+ if (!errorMessage)
113
+ return;
114
+ if (!editorRef)
115
+ return;
116
+ const htmlElement = editorRef.current?.htmlElement;
117
+ if (htmlElement)
118
+ appui_abstract_1.UiAdmin.messagePresenter.displayInputFieldMessage(htmlElement, errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage);
119
+ else
120
+ appui_abstract_1.UiAdmin.messagePresenter.displayMessage(errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage, errorMessage.messageType);
121
+ };
122
+ const commit = async (args) => {
123
+ const newValue = args.newValue;
124
+ const isValid = await isNewValueValid(newValue);
125
+ if (!isValid)
126
+ return;
127
+ if (propertyEditorRef.current && args.propertyRecord) {
128
+ const commitResult = await propertyEditorRef.current.commitValue(newValue, args.propertyRecord);
129
+ if (commitResult.encounteredError) {
130
+ displayOutputMessage(commitResult.errorMessage);
131
+ return;
184
132
  }
185
133
  }
186
- else {
187
- isValid = false;
188
- }
189
- return isValid;
190
- }
191
- /** @internal */
192
- render() {
193
- return (React.createElement("span", { className: "components-editor-container", onBlur: this._handleContainerBlur, onKeyDown: this._handleKeyDown, onClick: this._handleClick, onContextMenu: this._handleRightClick, title: this.props.title, "data-testid": "editor-container", role: "presentation" }, this.createEditor()));
194
- }
134
+ onCommit(args);
135
+ };
136
+ const editorProps = {
137
+ ref: (ref) => {
138
+ editorRef.current = ref ?? undefined;
139
+ },
140
+ onCommit: handleEditorCommit,
141
+ onCancel,
142
+ onBlur: handleEditorBlur,
143
+ setFocus: setFocus !== undefined ? setFocus : true,
144
+ propertyRecord,
145
+ shouldCommitOnChange,
146
+ ...rest,
147
+ };
148
+ const propDescription = propertyRecord.property;
149
+ const editorName = propDescription.editor !== undefined
150
+ ? propDescription.editor.name
151
+ : undefined;
152
+ propertyEditorRef.current = PropertyEditorManager_1.PropertyEditorManager.createEditor(propDescription.typename, editorName, propDescription.dataController);
153
+ const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)
154
+ ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)
155
+ : undefined;
156
+ return (React.createElement("span", { className: "components-editor-container", onBlur: handleContainerBlur, onKeyDown: handleKeyDown, onClick: handleClick, onContextMenu: handleClick, title: title, "data-testid": "editor-container", role: "presentation" }, clonedNode));
195
157
  }
196
158
  exports.EditorContainer = EditorContainer;
197
159
  //# sourceMappingURL=EditorContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kCAAgC;AAChC,6CAA+B;AAC/B,6CAAkC;AAElC,0DAAgD;AAMhD,mEAAgE;AAuEhE;;;GAGG;AACH,MAAa,eAAgB,SAAQ,KAAK,CAAC,aAAmC;IAA9E;;QAyCU,sBAAiB,GAAG,CAAC,EAAoB,EAAE,EAAE;YACnD,uBAAuB;YACvB,IACE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB;gBAC5B,IAAI,CAAC,eAAe;gBACpB,IAAI,CAAC,eAAe,CAAC,oBAAoB;gBAEzC,KAAK,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACvC,CAAC,CAAC;QAEM,yBAAoB,GAAG,CAAC,CAAmB,EAAE,EAAE;YACrD,CAAC,CAAC,eAAe,EAAE,CAAC;QACtB,CAAC,CAAC;QAEM,iBAAY,GAAG,CAAC,CAAmB,EAAE,EAAE;YAC7C,CAAC,CAAC,eAAe,EAAE,CAAC;QACtB,CAAC,CAAC;QAEM,mBAAc,GAAG,CAAC,CAAsB,EAAE,EAAE;YAClD,QAAQ,CAAC,CAAC,GAAG,EAAE;gBACb,KAAK,iBAAG,CAAC,MAAM,CAAC,OAAO,EAAE;oBACvB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;oBACtB,MAAM;gBACR,KAAK,iBAAG,CAAC,KAAK,CAAC,OAAO,EAAE;oBACtB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBACrB,MAAM;gBACR,KAAK,iBAAG,CAAC,GAAG,CAAC,OAAO,EAAE;oBACpB,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;oBACnB,MAAM;gBACR;oBACE,IACE,IAAI,CAAC,eAAe;wBACpB,IA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BAAgB,CAAC,wBAAwB,CAC/C,WAAW,EACX,YAAY,CAAC,QAAQ,EACrB,YAAY,CAAC,YAAY,EACzB,YAAY,CAAC,eAAe,CAC7B,CAAC;;gBAEF,wBAAO,CAAC,gBAAgB,CAAC,cAAc,CACrC,YAAY,CAAC,QAAQ,EACrB,YAAY,CAAC,YAAY,EACzB,YAAY,CAAC,eAAe,EAC5B,YAAY,CAAC,WAAW,CACzB,CAAC;SACL;IACH,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,KAAoB;QAChD,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,uBAAuB;QACvB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE;YACrD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,aAAa,CAC7D,KAAK,EACL,IAAI,CAAC,KAAK,CAAC,cAAc,CAC1B,CAAC;YAEF,IAAI,cAAc,CAAC,gBAAgB,EAAE;gBACnC,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;gBACvD,OAAO,GAAG,KAAK,CAAC;aACjB;SACF;aAAM;YACL,OAAO,GAAG,KAAK,CAAC;SACjB;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAiDD,gBAAgB;IACA,MAAM;QACpB,OAAO,CACL,8BACE,SAAS,EAAC,6BAA6B,EACvC,MAAM,EAAE,IAAI,CAAC,oBAAoB,EACjC,SAAS,EAAE,IAAI,CAAC,cAAc,EAC9B,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,aAAa,EAAE,IAAI,CAAC,iBAAiB,EACrC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,iBACX,kBAAkB,EAC9B,IAAI,EAAC,cAAc,IAElB,IAAI,CAAC,YAAY,EAAE,CACf,CACR,CAAC;IACJ,CAAC;CACF;AAtND,0CAsNC","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 PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { PropertyRecord, PropertyValue } from \"@itwin/appui-abstract\";\nimport { UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n */\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** @internal */\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: any) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/**\n * EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\nexport class EditorContainer extends React.PureComponent<EditorContainerProps> {\n private _editorRef: TypeEditor | undefined;\n private _propertyEditor: PropertyEditorBase | undefined;\n\n private createEditor(): React.ReactNode {\n const editorRef = (ref: TypeEditor | undefined) => (this._editorRef = ref);\n\n const editorProps: CloneProps = {\n ref: editorRef,\n onCommit: this._handleEditorCommit,\n onCancel: this._handleEditorCancel,\n onBlur: this._handleEditorBlur,\n propertyRecord: this.props.propertyRecord,\n setFocus: this.props.setFocus !== undefined ? this.props.setFocus : true,\n className: this.props.className,\n style: this.props.style,\n shouldCommitOnChange: this.props.shouldCommitOnChange,\n };\n\n const propDescription = this.props.propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n this._propertyEditor = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n const editorNode: React.ReactNode = this._propertyEditor.reactNode;\n\n let clonedNode: React.ReactNode = null;\n // istanbul ignore else\n if (React.isValidElement(editorNode)) {\n clonedNode = React.cloneElement(editorNode, editorProps);\n }\n\n return clonedNode;\n }\n\n private _handleEditorBlur = (_e: React.FocusEvent) => {\n // istanbul ignore else\n if (\n !this.props.ignoreEditorBlur &&\n this._propertyEditor &&\n this._propertyEditor.containerHandlesBlur\n )\n void this._handleContainerCommit();\n };\n\n private _handleContainerBlur = (e: React.FocusEvent) => {\n e.stopPropagation();\n };\n\n private _handleClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n private _handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n this.onPressEscape(e);\n break;\n case Key.Enter.valueOf():\n this.onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n this.onPressTab(e);\n break;\n default:\n if (\n this._propertyEditor &&\n this._propertyEditor.containerStopsKeydownPropagation\n )\n e.stopPropagation();\n }\n };\n\n private _handleRightClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n private onPressEscape(_e: React.KeyboardEvent): void {\n // istanbul ignore else\n if (this._propertyEditor && this._propertyEditor.containerHandlesEscape) {\n this._commitCancel();\n }\n }\n\n private onPressEnter(e: React.KeyboardEvent): void {\n // istanbul ignore else\n if (this._propertyEditor && this._propertyEditor.containerHandlesEnter) {\n // istanbul ignore else\n if (this._editorRef && this._editorRef.hasFocus) e.stopPropagation();\n void this._handleContainerCommit();\n }\n }\n\n private onPressTab(e: React.KeyboardEvent): void {\n // istanbul ignore else\n if (this._propertyEditor && this._propertyEditor.containerHandlesTab) {\n e.stopPropagation();\n void this._handleContainerCommit();\n }\n }\n\n private displayOutputMessage(errorMessage: AsyncErrorMessage | undefined) {\n // istanbul ignore else\n if (errorMessage && this._editorRef) {\n const htmlElement = this._editorRef && this._editorRef.htmlElement;\n // istanbul ignore else\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n }\n }\n\n private async isNewValueValid(value: PropertyValue): Promise<boolean> {\n let isValid = true;\n\n // istanbul ignore else\n if (this._propertyEditor && this.props.propertyRecord) {\n const validateResult = await this._propertyEditor.validateValue(\n value,\n this.props.propertyRecord\n );\n\n if (validateResult.encounteredError) {\n this.displayOutputMessage(validateResult.errorMessage);\n isValid = false;\n }\n } else {\n isValid = false;\n }\n\n return isValid;\n }\n\n private _handleEditorCommit = (args: PropertyUpdatedArgs): void => {\n void this._commit(args);\n };\n\n private _handleContainerCommit = async (): Promise<void> => {\n const newValue =\n this._editorRef && (await this._editorRef.getPropertyValue());\n // istanbul ignore else\n if (newValue !== undefined) {\n void this._commit({\n propertyRecord: this.props.propertyRecord,\n newValue,\n });\n }\n };\n\n private _commit = async (args: PropertyUpdatedArgs) => {\n const newValue = args.newValue;\n const isValid = await this.isNewValueValid(newValue);\n if (isValid) {\n let doCommit = true;\n // istanbul ignore else\n if (this._propertyEditor && args.propertyRecord) {\n const commitResult = await this._propertyEditor.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n this.displayOutputMessage(commitResult.errorMessage);\n doCommit = false;\n }\n }\n\n if (doCommit) {\n this.props.onCommit(args);\n }\n }\n };\n\n private _handleEditorCancel = () => {\n this._commitCancel();\n };\n\n private _commitCancel = () => {\n this.props.onCancel();\n };\n\n /** @internal */\n public override render() {\n return (\n <span\n className=\"components-editor-container\"\n onBlur={this._handleContainerBlur}\n onKeyDown={this._handleKeyDown}\n onClick={this._handleClick}\n onContextMenu={this._handleRightClick}\n title={this.props.title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {this.createEditor()}\n </span>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kCAAgC;AAChC,6CAA+B;AAC/B,6CAAkC;AAElC,0DAAgD;AAMhD,mEAAgE;AAsEhE;;GAEG;AACH,SAAgB,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,gBAAgB,EAChB,KAAK,EACL,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAA0B,CAAC;IACzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAkC,CAAC;IAEzE,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACj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7B,CAAC,CAAC,SAAS,CAAC;IAEhB,iBAAiB,CAAC,OAAO,GAAG,6CAAqB,CAAC,YAAY,CAC5D,eAAe,CAAC,QAAQ,EACxB,UAAU,EACV,eAAe,CAAC,cAAc,CAC/B,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC;QAC1E,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC;QACtE,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,CACL,8BACE,SAAS,EAAC,6BAA6B,EACvC,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,WAAW,EAC1B,KAAK,EAAE,KAAK,iBACA,kBAAkB,EAC9B,IAAI,EAAC,cAAc,IAElB,UAAU,CACN,CACR,CAAC;AACJ,CAAC;AA3KD,0CA2KC","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 PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { PropertyRecord, PropertyValue } from \"@itwin/appui-abstract\";\nimport { UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n */\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = () => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape();\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const newValue = args.newValue;\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n"]}
@@ -182,7 +182,7 @@ class EnumEditor extends React.PureComponent {
182
182
  ref: (el) => {
183
183
  if (!this.props.setFocus)
184
184
  return;
185
- el === null || el === void 0 ? void 0 : el.focus();
185
+ el?.focus();
186
186
  },
187
187
  className: "components-button",
188
188
  }, "aria-label": UiComponents_1.UiComponents.translate("editor.enum"), size: "small" })));
@@ -1 +1 @@
1
- {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAA+E;AAE/E,wDAA8C;AAE9C,mEAGiC;AACjC,kDAA+C;AAU/C;;GAEG;AACH,MAAa,UACX,SAAQ,KAAK,CAAC,aAAmD;IADn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tB,kBAAkB,CACnB,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 PropertyEditors\n */\n\nimport \"./EnumEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { EnumerationChoice, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface EnumEditorState {\n selectValue: string | number;\n valueIsNumber: boolean;\n options: SelectOption<string>[];\n parentDiv: HTMLDivElement | null;\n}\n\n/** EnumEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumEditor\n extends React.PureComponent<PropertyEditorProps, EnumEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumEditorState> = {\n selectValue: \"\",\n valueIsNumber: false,\n options: [],\n parentDiv: null,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateSelectValue = (newValue: string) => {\n // istanbul ignore else\n if (this._isMounted) {\n let selectValue: string | number;\n\n // istanbul ignore if\n if (this.state.valueIsNumber) selectValue = parseInt(newValue, 10);\n else selectValue = newValue;\n\n this.setState(\n {\n selectValue,\n },\n async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n }\n );\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let initialValue: string | number = \"\";\n let valueIsNumber: boolean = false;\n\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n if (typeof primitiveValue === \"string\") {\n initialValue = primitiveValue;\n valueIsNumber = false;\n } else {\n initialValue = primitiveValue as number;\n valueIsNumber = true;\n }\n }\n\n let choices: EnumerationChoice[] | undefined;\n\n if (propertyRecord && propertyRecord.property.enum) {\n // istanbul ignore else\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const options: SelectOption<string>[] = [];\n if (choices) {\n choices.forEach((choice: EnumerationChoice) => {\n options.push({ value: choice.value.toString(), label: choice.label });\n });\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n selectValue: initialValue,\n valueIsNumber,\n options,\n parentDiv: this._divElement.current,\n });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-enum-editor\",\n this.props.className\n );\n const selectValue =\n this.state.selectValue !== undefined\n ? this.state.selectValue.toString()\n : /* istanbul ignore next */ undefined;\n\n // set min-width to show about 4 characters + down arrow\n const minWidthStyle: React.CSSProperties = {\n minWidth: `6em`,\n };\n\n // The iTwinUI-react Select onBlur still does not work properly, so it cannot be used yet. NEEDSWORK\n // onBlur={this.props.onBlur}\n return (\n <div ref={this._divElement}>\n <Select\n className={className}\n style={this.props.style ? this.props.style : minWidthStyle}\n value={selectValue}\n onChange={this._updateSelectValue}\n data-testid=\"components-select-editor\"\n options={this.state.options}\n triggerProps={{\n ref: (el) => {\n if (!this.props.setFocus) return;\n el?.focus();\n },\n className: \"components-button\",\n }}\n aria-label={UiComponents.translate(\"editor.enum\")}\n size=\"small\"\n />\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name.\n * It uses the [[EnumEditor]] React component.\n * @public\n */\nexport class EnumPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n public override get containerStopsKeydownPropagation(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <EnumEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Enum,\n EnumPropertyEditor\n);\n"]}
1
+ {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAA+E;AAE/E,wDAA8C;AAE9C,mEAGiC;AACjC,kDAA+C;AAU/C;;GAEG;AACH,MAAa,UACX,SAAQ,KAAK,CAAC,aAAmD;IADnE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC,SAA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,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC;QAE3C,wDAAwD;QACxD,MAAM,aAAa,GAAwB;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QAEF,oGAAoG;QACpG,6BAA6B;QAC7B,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,WAAW;YACxB,oBAAC,sBAAM,IACL,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAC1D,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,IAAI,CAAC,kBAAkB,iBACrB,0BAA0B,EACtC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,YAAY,EAAE;oBACZ,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;wBACV,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;4BAAE,OAAO;wBACjC,EAAE,EAAE,KAAK,EAAE,CAAC;oBACd,CAAC;oBACD,SAAS,EAAE,mBAAmB;iBAC/B,gBACW,2BAAY,CAAC,SAAS,CAAC,aAAa,CAAC,EACjD,IAAI,EAAC,OAAO,GACZ,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAtLD,gCAsLC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,0CAAkB;IACxD,uBAAuB;IACvB,IAAoB,qBAAqB;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAoB,gCAAgC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAZD,gDAYC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,IAAI,EACtB,kBAAkB,CACnB,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 PropertyEditors\n */\n\nimport \"./EnumEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { EnumerationChoice, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface EnumEditorState {\n selectValue: string | number;\n valueIsNumber: boolean;\n options: SelectOption<string>[];\n parentDiv: HTMLDivElement | null;\n}\n\n/** EnumEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumEditor\n extends React.PureComponent<PropertyEditorProps, EnumEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumEditorState> = {\n selectValue: \"\",\n valueIsNumber: false,\n options: [],\n parentDiv: null,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateSelectValue = (newValue: string) => {\n // istanbul ignore else\n if (this._isMounted) {\n let selectValue: string | number;\n\n // istanbul ignore if\n if (this.state.valueIsNumber) selectValue = parseInt(newValue, 10);\n else selectValue = newValue;\n\n this.setState(\n {\n selectValue,\n },\n async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n }\n );\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let initialValue: string | number = \"\";\n let valueIsNumber: boolean = false;\n\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n if (typeof primitiveValue === \"string\") {\n initialValue = primitiveValue;\n valueIsNumber = false;\n } else {\n initialValue = primitiveValue as number;\n valueIsNumber = true;\n }\n }\n\n let choices: EnumerationChoice[] | undefined;\n\n if (propertyRecord && propertyRecord.property.enum) {\n // istanbul ignore else\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const options: SelectOption<string>[] = [];\n if (choices) {\n choices.forEach((choice: EnumerationChoice) => {\n options.push({ value: choice.value.toString(), label: choice.label });\n });\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n selectValue: initialValue,\n valueIsNumber,\n options,\n parentDiv: this._divElement.current,\n });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-enum-editor\",\n this.props.className\n );\n const selectValue =\n this.state.selectValue !== undefined\n ? this.state.selectValue.toString()\n : /* istanbul ignore next */ undefined;\n\n // set min-width to show about 4 characters + down arrow\n const minWidthStyle: React.CSSProperties = {\n minWidth: `6em`,\n };\n\n // The iTwinUI-react Select onBlur still does not work properly, so it cannot be used yet. NEEDSWORK\n // onBlur={this.props.onBlur}\n return (\n <div ref={this._divElement}>\n <Select\n className={className}\n style={this.props.style ? this.props.style : minWidthStyle}\n value={selectValue}\n onChange={this._updateSelectValue}\n data-testid=\"components-select-editor\"\n options={this.state.options}\n triggerProps={{\n ref: (el) => {\n if (!this.props.setFocus) return;\n el?.focus();\n },\n className: \"components-button\",\n }}\n aria-label={UiComponents.translate(\"editor.enum\")}\n size=\"small\"\n />\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name.\n * It uses the [[EnumEditor]] React component.\n * @public\n */\nexport class EnumPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n public override get containerStopsKeydownPropagation(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <EnumEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Enum,\n EnumPropertyEditor\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageCheckBoxEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAKjC,gBAAgB;AAChB,UAAU,wBAAwB;IAChC,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;I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,CAAC;IAChB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AACD;;;GAGG;AACH,qBAAa,mBACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,wBAAwB,CACzE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAwD;IAE7E,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAKhE;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAMjE,OAAO,CAAC,iBAAiB;IAuCzB,OAAO,CAAC,YAAY,CAmBlB;IAEc,MAAM;CAyBvB;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
@@ -140,7 +140,9 @@ class ImageCheckBoxEditor extends React.PureComponent {
140
140
  const className = (0, classnames_1.default)("components-cell-editor", "components-imagecheckbox-editor", this.props.className);
141
141
  const checked = this.state.checkboxValue;
142
142
  const isDisabled = !!this.state.isDisabled;
143
- return (React.createElement(core_react_1.ImageCheckBox, { inputRef: this._inputElement, imageOff: this.state.imageOff, imageOn: this.state.imageOn, className: className, border: true, style: this.props.style, checked: checked, disabled: isDisabled, onClick: this._handleClick, "data-testid": "components-imagecheckbox-editor" }));
143
+ return (
144
+ // eslint-disable-next-line deprecation/deprecation
145
+ React.createElement(core_react_1.ImageCheckBox, { inputRef: this._inputElement, imageOff: this.state.imageOff, imageOn: this.state.imageOn, className: className, border: true, style: this.props.style, checked: checked, disabled: isDisabled, onClick: this._handleClick, "data-testid": "components-imagecheckbox-editor" }));
144
146
  }
145
147
  }
146
148
  exports.ImageCheckBoxEditor = ImageCheckBoxEditor;
@@ -1 +1 @@
1
- {"version":3,"file":"ImageCheckBoxEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sCAAoC;AACpC,4DAAoC;AACpC,6CAA+B;AAM/B,0DAK+B;AAE/B,mEAGiC;AACjC,kDAAkD;AAalD;;;GAGG;AACH,MAAa,mBACX,SAAQ,KAAK,CAAC,aAA4D;IAD5E;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QAE7E,gBAAgB;QACS,UAAK,GAAuC;YACnE,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QAmFM,iBAAY,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,CACX;gBACE,aAAa,EAAE,OAAO;aACvB,EACD,KAAK,IAAI,EAAE;gBACT,uBAAuB;gBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACpD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACpD,uBAAuB;oBACvB,IAAI,IAAI,CAAC,UAAU,IAAI,aAAa,KAAK,SAAS,EAAE;wBAClD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;4BAClB,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc;4BACzC,QAAQ,EAAE,aAAa;yBACxB,CAAC,CAAC;qBACJ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Q,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAC3B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,IAAI,CAAC,YAAY,iBACd,iCAAiC,GAC7C,CACH,CAAC;IACJ,CAAC;CACF;AA7ID,kDA6IC;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,0CAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,mBAAmB,OAAG,CAAC;IACjC,CAAC;CACF;AAJD,kEAIC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,OAAO,EACzB,2BAA2B,EAC3B,oCAAmB,CAAC,aAAa,CAClC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,IAAI,EACtB,2BAA2B,EAC3B,oCAAmB,CAAC,aAAa,CAClC,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 PropertyEditors\n */\n\nimport \"./ImageCheckBoxEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ImageCheckBoxParams,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { ImageCheckBox } from \"@itwin/core-react\";\n\n// cSpell:ignore imagecheckbox\n\n/** @internal */\ninterface ImageCheckBoxEditorState {\n /** Image for the \"checked\" state */\n imageOn: string;\n /** Image for the \"unchecked\" (default) state */\n imageOff: string;\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n/** [[ImageCheckBoxEditor]]\n * Boolean editor that renders with an image instead of checkbox\n * @public\n */\nexport class ImageCheckBoxEditor\n extends React.PureComponent<PropertyEditorProps, ImageCheckBoxEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n\n /** @internal */\n public override readonly state: Readonly<ImageCheckBoxEditorState> = {\n imageOff: \"\",\n imageOn: \"\",\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps();\n }\n }\n\n private setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let imageOn = \"\";\n let imageOff = \"\";\n let isDisabled = false;\n\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n if (\n propertyRecord &&\n propertyRecord.property &&\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n const imageCheckBoxParams = propertyRecord.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.CheckBoxImages.valueOf()\n ) as ImageCheckBoxParams;\n // istanbul ignore else\n if (imageCheckBoxParams) {\n imageOn = imageCheckBoxParams.imageOn;\n imageOff = imageCheckBoxParams.imageOff;\n }\n }\n this.setState({ imageOn, imageOff, checkboxValue, isDisabled });\n }\n\n private _handleClick = (checked: boolean) => {\n this.setState(\n {\n checkboxValue: checked,\n },\n async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (this._isMounted && propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n }\n );\n };\n\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-imagecheckbox-editor\",\n this.props.className\n );\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <ImageCheckBox\n inputRef={this._inputElement}\n imageOff={this.state.imageOff}\n imageOn={this.state.imageOn}\n className={className}\n border={true}\n style={this.props.style}\n checked={checked}\n disabled={isDisabled}\n onClick={this._handleClick}\n data-testid=\"components-imagecheckbox-editor\"\n />\n );\n }\n}\n\n/** ImageCheckBox Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[ImageCheckBoxEditor]] React component.\n * @public\n */\nexport class ImageCheckBoxPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <ImageCheckBoxEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Boolean,\n ImageCheckBoxPropertyEditor,\n StandardEditorNames.ImageCheckBox\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Bool,\n ImageCheckBoxPropertyEditor,\n StandardEditorNames.ImageCheckBox\n);\n"]}
1
+ {"version":3,"file":"ImageCheckBoxEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sCAAoC;AACpC,4DAAoC;AACpC,6CAA+B;AAM/B,0DAK+B;AAE/B,mEAGiC;AACjC,kDAAkD;AAalD;;;GAGG;AACH,MAAa,mBACX,SAAQ,KAAK,CAAC,aAA4D;IAD5E;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QAE7E,gBAAgB;QACS,UAAK,GAAuC;YACnE,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,KAAK;SAClB,CAAC;QAmFM,iBAAY,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,CACX;gBACE,aAAa,EAAE,OAAO;aACvB,EACD,KAAK,IAAI,EAAE;gBACT,uBAAuB;gBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACpD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACpD,uBAAuB;oBACvB,IAAI,IAAI,CAAC,UAAU,IAAI,aAAa,KAAK,SAAS,EAAE;wBAClD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;4BAClB,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc;4BACzC,QAAQ,EAAE,aAAa;yBACxB,CAAC,CAAC;qBACJ;iBACF;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IA2BJ,CAAC;IA/HQ,KAAK,CAAC,gBAAgB;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;Q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,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,IAAI,CAAC,YAAY,iBACd,iCAAiC,GAC7C,CACH,CAAC;IACJ,CAAC;CACF;AA9ID,kDA8IC;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,0CAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,mBAAmB,OAAG,CAAC;IACjC,CAAC;CACF;AAJD,kEAIC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,OAAO,EACzB,2BAA2B,EAC3B,oCAAmB,CAAC,aAAa,CAClC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,IAAI,EACtB,2BAA2B,EAC3B,oCAAmB,CAAC,aAAa,CAClC,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 PropertyEditors\n */\n\nimport \"./ImageCheckBoxEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ImageCheckBoxParams,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { ImageCheckBox } from \"@itwin/core-react\";\n\n// cSpell:ignore imagecheckbox\n\n/** @internal */\ninterface ImageCheckBoxEditorState {\n /** Image for the \"checked\" state */\n imageOn: string;\n /** Image for the \"unchecked\" (default) state */\n imageOff: string;\n checkboxValue: boolean;\n isDisabled?: boolean;\n}\n/** [[ImageCheckBoxEditor]]\n * Boolean editor that renders with an image instead of checkbox\n * @public\n */\nexport class ImageCheckBoxEditor\n extends React.PureComponent<PropertyEditorProps, ImageCheckBoxEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n\n /** @internal */\n public override readonly state: Readonly<ImageCheckBoxEditorState> = {\n imageOff: \"\",\n imageOn: \"\",\n checkboxValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.checkboxValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps();\n }\n }\n\n private setStateFromProps() {\n const { propertyRecord } = this.props;\n let checkboxValue = false;\n let imageOn = \"\";\n let imageOff = \"\";\n let isDisabled = false;\n\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n if (\n propertyRecord &&\n propertyRecord.property &&\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n const imageCheckBoxParams = propertyRecord.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.CheckBoxImages.valueOf()\n ) as ImageCheckBoxParams;\n // istanbul ignore else\n if (imageCheckBoxParams) {\n imageOn = imageCheckBoxParams.imageOn;\n imageOff = imageCheckBoxParams.imageOff;\n }\n }\n this.setState({ imageOn, imageOff, checkboxValue, isDisabled });\n }\n\n private _handleClick = (checked: boolean) => {\n this.setState(\n {\n checkboxValue: checked,\n },\n async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (this._isMounted && propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n }\n );\n };\n\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-imagecheckbox-editor\",\n this.props.className\n );\n const checked = this.state.checkboxValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n // eslint-disable-next-line deprecation/deprecation\n <ImageCheckBox\n inputRef={this._inputElement}\n imageOff={this.state.imageOff}\n imageOn={this.state.imageOn}\n className={className}\n border={true}\n style={this.props.style}\n checked={checked}\n disabled={isDisabled}\n onClick={this._handleClick}\n data-testid=\"components-imagecheckbox-editor\"\n />\n );\n }\n}\n\n/** ImageCheckBox Property Editor registered for the \"bool\" and \"boolean\" type names.\n * It uses the [[ImageCheckBoxEditor]] React component.\n * @public\n */\nexport class ImageCheckBoxPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <ImageCheckBoxEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Boolean,\n ImageCheckBoxPropertyEditor,\n StandardEditorNames.ImageCheckBox\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Bool,\n ImageCheckBoxPropertyEditor,\n StandardEditorNames.ImageCheckBox\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInputEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/NumericInputEditor.tsx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CAAC,SAAS;CA+B1C;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IAED,IAAoB,qBAAqB,IAAI,OAAO,CAGnD;CACF"}
1
+ {"version":3,"file":"NumericInputEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAEjC,gBAAgB;AAChB,UAAU,uBAAuB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,kBACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,uBAAuB,CACxE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAwD;IACtE,QAAQ,UAAS;IAExB,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAG/D;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,OAAO,CAAC,aAAa,CAYnB;IAEF,OAAO,CAAC,YAAY,CAgBlB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IAgE/B,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CAgC1C;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IAED,IAAoB,qBAAqB,IAAI,OAAO,CAGnD;CACF"}
@@ -167,7 +167,9 @@ class NumericInputEditor extends React.PureComponent {
167
167
  ...this.props.style,
168
168
  minWidth: `${minSize * 0.75}em`,
169
169
  };
170
- return (React.createElement(core_react_1.NumberInput, { ref: this._inputElement, className: className, style: style, value: this.state.value, min: this.state.min, max: this.state.max, step: this.state.step, precision: this.state.precision, readOnly: this.state.readonly, maxLength: this.state.maxLength, onBlur: this.props.onBlur, onChange: this._updateValue, autoFocus: this.props.setFocus && !this.state.isDisabled, isControlled: this.props.shouldCommitOnChange }));
170
+ return (
171
+ // eslint-disable-next-line deprecation/deprecation
172
+ React.createElement(core_react_1.NumberInput, { ref: this._inputElement, className: className, style: style, value: this.state.value, min: this.state.min, max: this.state.max, step: this.state.step, precision: this.state.precision, readOnly: this.state.readonly, maxLength: this.state.maxLength, onBlur: this.props.onBlur, onChange: this._updateValue, autoFocus: this.props.setFocus && !this.state.isDisabled, isControlled: this.props.shouldCommitOnChange }));
171
173
  }
172
174
  }
173
175
  exports.NumericInputEditor = NumericInputEditor;
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DA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AAU,EACxD,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB,GAC7C,CACH,CAAC;IACJ,CAAC;CACF;AApLD,gDAoLC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,0CAAkB;IAChE,IAAW,SAAS;QAClB,OAAO,oBAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;IACD,uBAAuB;IACvB,IAAoB,qBAAqB;QACvC,qCAAqC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AATD,gEASC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,GAAG,EACrB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,KAAK,EACvB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,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 PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n PropertyEditorParams,\n PropertyValue,\n RangeEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class NumericInputEditor\n extends React.PureComponent<PropertyEditorProps, NumericInputEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n /** @internal */\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _updateValue = (\n value: number | undefined,\n _stringValue: string\n ): void => {\n const newValue = value !== undefined ? value : /* istanbul ignore next */ 0;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n value: newValue,\n },\n async () => {\n await this._handleCommit();\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Range.valueOf()\n ) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n min,\n max,\n step,\n precision,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-numeric-input-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n\n return (\n <NumberInput\n ref={this._inputElement}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.state.readonly}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n autoFocus={this.props.setFocus && !this.state.isDisabled} // eslint-disable-line jsx-a11y/no-autofocus\n isControlled={this.props.shouldCommitOnChange}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @public\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n // let input editor process enter key\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Int,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Float,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Double,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\n"]}
1
+ {"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAO/B,0DAK+B;AAC/B,kDAAgD;AAEhD,mEAGiC;AAgBjC;;GAEG;AACH,MAAa,kBACX,SAAQ,KAAK,CAAC,aAA2D;IAD3E;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAsC,KAAK,CAAC,SAAS,EAAE,CAAC;QACtE,aAAQ,GAAG,KAAK,CAAC,CAAC,gDAAgD;QAEzE,gBAAgB;QACS,UAAK,GAAsC;YAClE,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,KAAK;SAChB,CAAC;QAsBM,kBAAa,GAAG,KAAK,IAAmB,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,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,GAAG,EACrB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,KAAK,EACvB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,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 PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n PropertyEditorParams,\n PropertyValue,\n RangeEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class NumericInputEditor\n extends React.PureComponent<PropertyEditorProps, NumericInputEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement> = React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n /** @internal */\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _updateValue = (\n value: number | undefined,\n _stringValue: string\n ): void => {\n const newValue = value !== undefined ? value : /* istanbul ignore next */ 0;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n value: newValue,\n },\n async () => {\n await this._handleCommit();\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Range.valueOf()\n ) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n min,\n max,\n step,\n precision,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-numeric-input-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n\n return (\n // eslint-disable-next-line deprecation/deprecation\n <NumberInput\n ref={this._inputElement}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.state.readonly}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n autoFocus={this.props.setFocus && !this.state.isDisabled} // eslint-disable-line jsx-a11y/no-autofocus\n isControlled={this.props.shouldCommitOnChange}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @public\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n // let input editor process enter key\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Int,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Float,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Double,\n NumericInputPropertyEditor,\n StandardEditorNames.NumericInput\n);\n"]}