@itwin/components-react 4.12.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +11 -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/renderers/CommonPropertyRenderer.js +3 -4
  49. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  50. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js +2 -3
  51. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -1
  52. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  53. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  54. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.d.ts +0 -1
  55. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.d.ts.map +1 -1
  56. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +4 -2
  57. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  58. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  59. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  60. package/lib/cjs/components-react/properties/renderers/PropertyView.js +3 -1
  61. package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
  62. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +1 -0
  63. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  64. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  65. package/lib/cjs/components-react/properties/renderers/value/Common.js +1 -2
  66. package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
  67. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +0 -1
  68. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  69. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +2 -4
  70. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  71. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  72. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  73. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts.map +1 -1
  74. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js +3 -1
  75. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  76. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  77. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  78. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  79. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  80. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  81. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  82. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  83. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts +0 -1
  84. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  85. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  86. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  87. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts +4 -2
  88. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  89. package/lib/cjs/components-react/propertygrid/component/PropertyList.js.map +1 -1
  90. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -2
  91. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  92. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +51 -59
  93. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  94. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +4 -0
  95. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  96. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  97. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  98. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  99. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  100. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  101. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  102. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  103. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  104. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  105. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  106. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  107. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  108. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  109. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  110. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  111. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -9
  112. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  113. package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
  114. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  115. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +5 -7
  116. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  117. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  118. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  119. package/lib/cjs/components-react/tree/controlled/TreeActions.d.ts +0 -1
  120. package/lib/cjs/components-react/tree/controlled/TreeActions.d.ts.map +1 -1
  121. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts +0 -1
  122. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  123. package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
  124. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  125. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  126. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  127. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +3 -1
  128. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  129. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
  130. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  131. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +0 -1
  132. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  133. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +9 -9
  134. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  135. package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
  136. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  137. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
  138. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  139. package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
  140. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  141. package/lib/esm/components-react/converters/TypeConverter.js +1 -2
  142. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  143. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +1 -1
  144. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  145. package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  146. package/lib/esm/components-react/editors/CustomNumberEditor.js +10 -11
  147. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  148. package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
  149. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  150. package/lib/esm/components-react/editors/EditorContainer.d.ts +2 -24
  151. package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
  152. package/lib/esm/components-react/editors/EditorContainer.js +111 -149
  153. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  154. package/lib/esm/components-react/editors/EnumEditor.js +1 -1
  155. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  156. package/lib/esm/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  157. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +3 -1
  158. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  159. package/lib/esm/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  160. package/lib/esm/components-react/editors/NumericInputEditor.js +3 -1
  161. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  162. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  163. package/lib/esm/components-react/editors/PopupButton.js +4 -4
  164. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  165. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  166. package/lib/esm/components-react/editors/TextEditor.js +6 -6
  167. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  168. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  169. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  170. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  171. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  172. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  173. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  174. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  175. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  176. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +3 -3
  177. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  178. package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
  179. package/lib/esm/components-react/properties/LinkHandler.js +3 -1
  180. package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
  181. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  182. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  183. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js +2 -3
  184. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -1
  185. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  186. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  187. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.d.ts +0 -1
  188. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.d.ts.map +1 -1
  189. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +4 -2
  190. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  191. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  192. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  193. package/lib/esm/components-react/properties/renderers/PropertyView.js +3 -1
  194. package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
  195. package/lib/esm/components-react/properties/renderers/PropertyView.scss +1 -0
  196. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  197. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  198. package/lib/esm/components-react/properties/renderers/value/Common.js +1 -2
  199. package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
  200. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +0 -1
  201. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  202. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +2 -4
  203. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  204. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  205. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  206. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts.map +1 -1
  207. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js +3 -1
  208. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  209. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  210. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  211. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  212. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  213. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  214. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  215. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  216. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts +0 -1
  217. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  218. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  219. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  220. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts +4 -2
  221. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  222. package/lib/esm/components-react/propertygrid/component/PropertyList.js.map +1 -1
  223. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -2
  224. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  225. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +51 -59
  226. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  227. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +4 -0
  228. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  229. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  230. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  231. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  232. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  233. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  234. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  235. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  236. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  237. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  238. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  239. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  240. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  241. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  242. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  243. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  244. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -9
  245. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  246. package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
  247. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  248. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +5 -7
  249. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  250. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  251. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  252. package/lib/esm/components-react/tree/controlled/TreeActions.d.ts +0 -1
  253. package/lib/esm/components-react/tree/controlled/TreeActions.d.ts.map +1 -1
  254. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts +0 -1
  255. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  256. package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
  257. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  258. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  259. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  260. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +3 -1
  261. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  262. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
  263. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  264. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +0 -1
  265. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  266. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +9 -9
  267. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  268. package/package.json +8 -36
@@ -10,161 +10,123 @@ import * as React from "react";
10
10
  import { Key } from "ts-key-enum";
11
11
  import { UiAdmin } from "@itwin/appui-abstract";
12
12
  import { PropertyEditorManager } from "./PropertyEditorManager";
13
- /**
14
- * EditorContainer React component used by the Tree and PropertyGrid for cell editing.
13
+ /** EditorContainer React component used by the Tree and PropertyGrid for cell editing.
15
14
  * @public
16
15
  */
17
- export class EditorContainer extends React.PureComponent {
18
- constructor() {
19
- super(...arguments);
20
- this._handleEditorBlur = (_e) => {
21
- // istanbul ignore else
22
- if (!this.props.ignoreEditorBlur &&
23
- this._propertyEditor &&
24
- this._propertyEditor.containerHandlesBlur)
25
- void this._handleContainerCommit();
26
- };
27
- this._handleContainerBlur = (e) => {
16
+ export function EditorContainer(props) {
17
+ const { ignoreEditorBlur, title, shouldCommitOnChange, propertyRecord, setFocus, onCommit, onCancel, ...rest } = props;
18
+ const editorRef = React.useRef();
19
+ const propertyEditorRef = React.useRef();
20
+ const handleClick = (e) => e.stopPropagation();
21
+ const handleContainerBlur = (e) => e.stopPropagation();
22
+ const handleEditorCommit = (args) => void commit(args);
23
+ const handleContainerCommit = async () => {
24
+ const newValue = editorRef && (await editorRef.current?.getPropertyValue());
25
+ if (newValue === undefined)
26
+ return;
27
+ void commit({
28
+ propertyRecord,
29
+ newValue,
30
+ });
31
+ };
32
+ const onPressEscape = () => {
33
+ if (!propertyEditorRef.current?.containerHandlesEscape)
34
+ return;
35
+ onCancel();
36
+ };
37
+ const onPressEnter = (e) => {
38
+ if (!propertyEditorRef.current?.containerHandlesEnter)
39
+ return;
40
+ if (editorRef?.current?.hasFocus)
28
41
  e.stopPropagation();
29
- };
30
- this._handleClick = (e) => {
31
- e.stopPropagation();
32
- };
33
- this._handleKeyDown = (e) => {
34
- switch (e.key) {
35
- case Key.Escape.valueOf():
36
- this.onPressEscape(e);
37
- break;
38
- case Key.Enter.valueOf():
39
- this.onPressEnter(e);
40
- break;
41
- case Key.Tab.valueOf():
42
- this.onPressTab(e);
43
- break;
44
- default:
45
- if (this._propertyEditor &&
46
- this._propertyEditor.containerStopsKeydownPropagation)
47
- e.stopPropagation();
48
- }
49
- };
50
- this._handleRightClick = (e) => {
51
- e.stopPropagation();
52
- };
53
- this._handleEditorCommit = (args) => {
54
- void this._commit(args);
55
- };
56
- this._handleContainerCommit = async () => {
57
- const newValue = this._editorRef && (await this._editorRef.getPropertyValue());
58
- // istanbul ignore else
59
- if (newValue !== undefined) {
60
- void this._commit({
61
- propertyRecord: this.props.propertyRecord,
62
- newValue,
63
- });
64
- }
65
- };
66
- this._commit = async (args) => {
67
- const newValue = args.newValue;
68
- const isValid = await this.isNewValueValid(newValue);
69
- if (isValid) {
70
- let doCommit = true;
71
- // istanbul ignore else
72
- if (this._propertyEditor && args.propertyRecord) {
73
- const commitResult = await this._propertyEditor.commitValue(newValue, args.propertyRecord);
74
- if (commitResult.encounteredError) {
75
- this.displayOutputMessage(commitResult.errorMessage);
76
- doCommit = false;
77
- }
78
- }
79
- if (doCommit) {
80
- this.props.onCommit(args);
81
- }
82
- }
83
- };
84
- this._handleEditorCancel = () => {
85
- this._commitCancel();
86
- };
87
- this._commitCancel = () => {
88
- this.props.onCancel();
89
- };
90
- }
91
- createEditor() {
92
- const editorRef = (ref) => (this._editorRef = ref);
93
- const editorProps = {
94
- ref: editorRef,
95
- onCommit: this._handleEditorCommit,
96
- onCancel: this._handleEditorCancel,
97
- onBlur: this._handleEditorBlur,
98
- propertyRecord: this.props.propertyRecord,
99
- setFocus: this.props.setFocus !== undefined ? this.props.setFocus : true,
100
- className: this.props.className,
101
- style: this.props.style,
102
- shouldCommitOnChange: this.props.shouldCommitOnChange,
103
- };
104
- const propDescription = this.props.propertyRecord.property;
105
- const editorName = propDescription.editor !== undefined
106
- ? propDescription.editor.name
107
- : undefined;
108
- this._propertyEditor = PropertyEditorManager.createEditor(propDescription.typename, editorName, propDescription.dataController);
109
- const editorNode = this._propertyEditor.reactNode;
110
- let clonedNode = null;
111
- // istanbul ignore else
112
- if (React.isValidElement(editorNode)) {
113
- clonedNode = React.cloneElement(editorNode, editorProps);
42
+ void handleContainerCommit();
43
+ };
44
+ const onPressTab = (e) => {
45
+ if (!propertyEditorRef.current?.containerHandlesTab)
46
+ return;
47
+ e.stopPropagation();
48
+ void handleContainerCommit();
49
+ };
50
+ const handleKeyDown = (e) => {
51
+ switch (e.key) {
52
+ case Key.Escape.valueOf():
53
+ onPressEscape();
54
+ break;
55
+ case Key.Enter.valueOf():
56
+ onPressEnter(e);
57
+ break;
58
+ case Key.Tab.valueOf():
59
+ onPressTab(e);
60
+ break;
61
+ default:
62
+ if (propertyEditorRef.current?.containerStopsKeydownPropagation)
63
+ e.stopPropagation();
114
64
  }
115
- return clonedNode;
116
- }
117
- onPressEscape(_e) {
118
- // istanbul ignore else
119
- if (this._propertyEditor && this._propertyEditor.containerHandlesEscape) {
120
- this._commitCancel();
65
+ };
66
+ const handleEditorBlur = () => {
67
+ if (ignoreEditorBlur)
68
+ return;
69
+ if (!propertyEditorRef.current?.containerHandlesBlur)
70
+ return;
71
+ void handleContainerCommit();
72
+ };
73
+ const isNewValueValid = async (value) => {
74
+ if (!propertyEditorRef.current)
75
+ return false;
76
+ if (!propertyRecord)
77
+ return false;
78
+ const validateResult = await propertyEditorRef.current.validateValue(value, propertyRecord);
79
+ if (validateResult.encounteredError) {
80
+ displayOutputMessage(validateResult.errorMessage);
81
+ return false;
121
82
  }
122
- }
123
- onPressEnter(e) {
124
- // istanbul ignore else
125
- if (this._propertyEditor && this._propertyEditor.containerHandlesEnter) {
126
- // istanbul ignore else
127
- if (this._editorRef && this._editorRef.hasFocus)
128
- e.stopPropagation();
129
- void this._handleContainerCommit();
130
- }
131
- }
132
- onPressTab(e) {
133
- // istanbul ignore else
134
- if (this._propertyEditor && this._propertyEditor.containerHandlesTab) {
135
- e.stopPropagation();
136
- void this._handleContainerCommit();
137
- }
138
- }
139
- displayOutputMessage(errorMessage) {
140
- // istanbul ignore else
141
- if (errorMessage && this._editorRef) {
142
- const htmlElement = this._editorRef && this._editorRef.htmlElement;
143
- // istanbul ignore else
144
- if (htmlElement)
145
- UiAdmin.messagePresenter.displayInputFieldMessage(htmlElement, errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage);
146
- else
147
- UiAdmin.messagePresenter.displayMessage(errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage, errorMessage.messageType);
148
- }
149
- }
150
- async isNewValueValid(value) {
151
- let isValid = true;
152
- // istanbul ignore else
153
- if (this._propertyEditor && this.props.propertyRecord) {
154
- const validateResult = await this._propertyEditor.validateValue(value, this.props.propertyRecord);
155
- if (validateResult.encounteredError) {
156
- this.displayOutputMessage(validateResult.errorMessage);
157
- isValid = false;
83
+ return true;
84
+ };
85
+ const displayOutputMessage = (errorMessage) => {
86
+ if (!errorMessage)
87
+ return;
88
+ if (!editorRef)
89
+ return;
90
+ const htmlElement = editorRef.current?.htmlElement;
91
+ if (htmlElement)
92
+ UiAdmin.messagePresenter.displayInputFieldMessage(htmlElement, errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage);
93
+ else
94
+ UiAdmin.messagePresenter.displayMessage(errorMessage.severity, errorMessage.briefMessage, errorMessage.detailedMessage, errorMessage.messageType);
95
+ };
96
+ const commit = async (args) => {
97
+ const newValue = args.newValue;
98
+ const isValid = await isNewValueValid(newValue);
99
+ if (!isValid)
100
+ return;
101
+ if (propertyEditorRef.current && args.propertyRecord) {
102
+ const commitResult = await propertyEditorRef.current.commitValue(newValue, args.propertyRecord);
103
+ if (commitResult.encounteredError) {
104
+ displayOutputMessage(commitResult.errorMessage);
105
+ return;
158
106
  }
159
107
  }
160
- else {
161
- isValid = false;
162
- }
163
- return isValid;
164
- }
165
- /** @internal */
166
- render() {
167
- 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()));
168
- }
108
+ onCommit(args);
109
+ };
110
+ const editorProps = {
111
+ ref: (ref) => {
112
+ editorRef.current = ref ?? undefined;
113
+ },
114
+ onCommit: handleEditorCommit,
115
+ onCancel,
116
+ onBlur: handleEditorBlur,
117
+ setFocus: setFocus !== undefined ? setFocus : true,
118
+ propertyRecord,
119
+ shouldCommitOnChange,
120
+ ...rest,
121
+ };
122
+ const propDescription = propertyRecord.property;
123
+ const editorName = propDescription.editor !== undefined
124
+ ? propDescription.editor.name
125
+ : undefined;
126
+ propertyEditorRef.current = PropertyEditorManager.createEditor(propDescription.typename, editorName, propDescription.dataController);
127
+ const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)
128
+ ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)
129
+ : undefined;
130
+ 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));
169
131
  }
170
132
  //# 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,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAuEhE;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK,CAAC,aAAmC;IAA9E;;QAyCU,sBAAiB,GAAG,CAAC,EAAoB,EAAE,EAAE;YACnD,uB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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","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,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAsEhE;;GAEG;AACH,MAAM,UAAU,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;IACjE,MAAM,mBAAmB,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACzE,MAAM,kBAAkB,GAAG,CAAC,IAAyB,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;IAE5E,MAAM,qBAAqB,GAAG,KAAK,IAAI,EAAE;QACvC,MAAM,QAAQ,GAAG,SAAS,IAAI,CAAC,MAAM,SAAS,CA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BAAiB,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","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"]}
@@ -153,7 +153,7 @@ export class EnumEditor extends React.PureComponent {
153
153
  ref: (el) => {
154
154
  if (!this.props.setFocus)
155
155
  return;
156
- el === null || el === void 0 ? void 0 : el.focus();
156
+ el?.focus();
157
157
  },
158
158
  className: "components-button",
159
159
  }, "aria-label": 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,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C;;GAEG;AACH,MAAM,OAAO,UACX,SAAQ,KAAK,CAAC,aAAmD;IADnE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QAC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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,MAAM,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,aAAF,EAAE,uBAAF,EAAE,CAAE,KAAK,EAAE,CAAC;oBACd,CAAC;oBACD,SAAS,EAAE,mBAAmB;iBAC/B,gBACW,YAAY,CAAC,SAAS,CAAC,aAAa,CAAC,EACjD,IAAI,EAAC,OAAO,GACZ,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;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;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,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
+ {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C;;GAEG;AACH,MAAM,OAAO,UACX,SAAQ,KAAK,CAAC,aA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------------------------------\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;I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BAAwB;IAChC,oCAAoC;IACpC,OAAO,EAAE,MAAM,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"}
@@ -111,7 +111,9 @@ export class ImageCheckBoxEditor extends React.PureComponent {
111
111
  const className = classnames("components-cell-editor", "components-imagecheckbox-editor", this.props.className);
112
112
  const checked = this.state.checkboxValue;
113
113
  const isDisabled = !!this.state.isDisabled;
114
- return (React.createElement(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" }));
114
+ return (
115
+ // eslint-disable-next-line deprecation/deprecation
116
+ React.createElement(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" }));
115
117
  }
116
118
  }
117
119
  /** ImageCheckBox Property Editor registered for the "bool" and "boolean" type names.
@@ -1 +1 @@
1
- {"version":3,"file":"ImageCheckBoxEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAalD;;;GAGG;AACH,MAAM,OAAO,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,C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B,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAE3C,OAAO,CACL,oBAAC,aAAa,IACZ,QAAQ,EAAE,IAAI,CAAC,aAAa,EAC5B,QAAQ,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;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,mBAAmB,OAAG,CAAC;IACjC,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,OAAO,EACzB,2BAA2B,EAC3B,mBAAmB,CAAC,aAAa,CAClC,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,2BAA2B,EAC3B,mBAAmB,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,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAalD;;;GAGG;AACH,MAAM,OAAO,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,CAA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K,CAAC,SAAS,CACrB,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAE3C,OAAO;QACL,mDAAmD;QACnD,oBAAC,aAAa,IACZ,QAAQ,EAAE,IAAI,CAAC,aAAa,EAC5B,QAAQ,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;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,mBAAmB,OAAG,CAAC;IACjC,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,OAAO,EACzB,2BAA2B,EAC3B,mBAAmB,CAAC,aAAa,CAClC,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,2BAA2B,EAC3B,mBAAmB,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"],"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;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"}
@@ -138,7 +138,9 @@ export class NumericInputEditor extends React.PureComponent {
138
138
  ...this.props.style,
139
139
  minWidth: `${minSize * 0.75}em`,
140
140
  };
141
- return (React.createElement(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 }));
141
+ return (
142
+ // eslint-disable-next-line deprecation/deprecation
143
+ React.createElement(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 }));
142
144
  }
143
145
  }
144
146
  /** Numeric Input Property Editor registered for the "number" type name and "numeric-input" editor name.
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAgBjC;;GAEG;AACH,MAAM,OAAO,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,EAAE;YAChD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACpD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpD,uBAAuB;gBACvB,IAAI,aAAa,KAAK,SAAS,EAAE;oBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;wBACl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AM,EACxB,0BAA0B,EAC1B,mBAAmB,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":"NumericInput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AAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EACxD,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB,GAC7C,CACH,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,kBAAkB;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;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CACjC,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,GAAG,EACrB,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CACjC,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,KAAK,EACvB,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CACjC,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,mBAAmB,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAA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AAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oFAAoF;IACpF,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gBAAgB;AAChB,UAAU,gBAAgB;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK,CAAC,aAAa,CAClD,gBAAgB,EAChB,gBAAgB,CACjB;IACC,OAAO,CAAC,UAAU,CAAqC;IAEvD,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAExD;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,OAAO,CAAC,YAAY,CAKlB;IAEK,UAAU;IAIjB,OAAO,CAAC,WAAW,CAOjB;IAEF,OAAO,CAAC,cAAc,CAYpB;IAEF,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CA6D1C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,qBAGjD;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,qBA6BxD"}
@@ -58,10 +58,9 @@ export class PopupButton extends React.PureComponent {
58
58
  }
59
59
  /** @internal */
60
60
  render() {
61
- var _a, _b, _c;
62
- const showArrow = (_a = this.props.showArrow) !== null && _a !== void 0 ? _a : false;
63
- const showShadow = (_b = this.props.showShadow) !== null && _b !== void 0 ? _b : false;
64
- const moveFocus = (_c = this.props.moveFocus) !== null && _c !== void 0 ? _c : true;
61
+ const showArrow = this.props.showArrow ?? false;
62
+ const showShadow = this.props.showShadow ?? false;
63
+ const moveFocus = this.props.moveFocus ?? true;
65
64
  const showPlaceholder = this.props.label === undefined && this.props.placeholder !== undefined;
66
65
  const classNames = classnames("components-popup-button", this.state.showPopup && "components-popup-expanded");
67
66
  const valueClassNames = classnames("components-popup-button-value", showPlaceholder && "components-popup-button-placeholder");
@@ -78,6 +77,7 @@ export class PopupButton extends React.PureComponent {
78
77
  * @alpha
79
78
  */
80
79
  export function PopupContent(props) {
80
+ // eslint-disable-next-line deprecation/deprecation
81
81
  return React.createElement(Div, { ...props, mainClassName: "components-editor-popup-content" });
82
82
  }
83
83
  /** OK/Cancel Buttons