@itwin/components-react 4.13.4 → 4.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/CHANGELOG.md +8 -5
  2. package/lib/cjs/components-react/common/ImageRenderer.d.ts.map +1 -1
  3. package/lib/cjs/components-react/common/ImageRenderer.js +0 -4
  4. package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
  5. package/lib/cjs/components-react/common/Links.d.ts.map +1 -1
  6. package/lib/cjs/components-react/common/Links.js +0 -7
  7. package/lib/cjs/components-react/common/Links.js.map +1 -1
  8. package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.d.ts.map +1 -1
  9. package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js +0 -1
  10. package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
  11. package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts.map +1 -1
  12. package/lib/cjs/components-react/common/UseElementsScrollStorage.js +0 -1
  13. package/lib/cjs/components-react/common/UseElementsScrollStorage.js.map +1 -1
  14. package/lib/cjs/components-react/converters/DateTimeTypeConverter.d.ts.map +1 -1
  15. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js +0 -13
  16. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  17. package/lib/cjs/components-react/converters/TypeConverterManager.d.ts.map +1 -1
  18. package/lib/cjs/components-react/converters/TypeConverterManager.js +0 -1
  19. package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
  20. package/lib/cjs/components-react/datepicker/DateField.d.ts.map +1 -1
  21. package/lib/cjs/components-react/datepicker/DateField.js +1 -8
  22. package/lib/cjs/components-react/datepicker/DateField.js.map +1 -1
  23. package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
  24. package/lib/cjs/components-react/datepicker/DatePicker.js +0 -2
  25. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  26. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  27. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +0 -1
  28. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  29. package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
  30. package/lib/cjs/components-react/datepicker/TimeField.js +0 -9
  31. package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
  32. package/lib/cjs/components-react/editors/BooleanEditor.d.ts.map +1 -1
  33. package/lib/cjs/components-react/editors/BooleanEditor.js +0 -8
  34. package/lib/cjs/components-react/editors/BooleanEditor.js.map +1 -1
  35. package/lib/cjs/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  36. package/lib/cjs/components-react/editors/CustomNumberEditor.js +7 -25
  37. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  38. package/lib/cjs/components-react/editors/DateTimeEditor.d.ts.map +1 -1
  39. package/lib/cjs/components-react/editors/DateTimeEditor.js +0 -21
  40. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  41. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
  42. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +1 -14
  43. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  44. package/lib/cjs/components-react/editors/EnumEditor.d.ts.map +1 -1
  45. package/lib/cjs/components-react/editors/EnumEditor.js +1 -13
  46. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  47. package/lib/cjs/components-react/editors/IconEditor.d.ts.map +1 -1
  48. package/lib/cjs/components-react/editors/IconEditor.js +0 -9
  49. package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
  50. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  51. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js +0 -6
  52. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  53. package/lib/cjs/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  54. package/lib/cjs/components-react/editors/NumericInputEditor.js +1 -10
  55. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  56. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  57. package/lib/cjs/components-react/editors/PopupButton.js +0 -2
  58. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  59. package/lib/cjs/components-react/editors/PropertyEditorManager.d.ts.map +1 -1
  60. package/lib/cjs/components-react/editors/PropertyEditorManager.js +0 -1
  61. package/lib/cjs/components-react/editors/PropertyEditorManager.js.map +1 -1
  62. package/lib/cjs/components-react/editors/SliderEditor.d.ts.map +1 -1
  63. package/lib/cjs/components-react/editors/SliderEditor.js +0 -10
  64. package/lib/cjs/components-react/editors/SliderEditor.js.map +1 -1
  65. package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
  66. package/lib/cjs/components-react/editors/TextEditor.js +0 -7
  67. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  68. package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
  69. package/lib/cjs/components-react/editors/TextareaEditor.js +0 -15
  70. package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
  71. package/lib/cjs/components-react/editors/ToggleEditor.d.ts.map +1 -1
  72. package/lib/cjs/components-react/editors/ToggleEditor.js +0 -9
  73. package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
  74. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
  75. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +0 -1
  76. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  77. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +3 -4
  78. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  79. package/lib/cjs/components-react/filtering/FilteringInput.d.ts.map +1 -1
  80. package/lib/cjs/components-react/filtering/FilteringInput.js +0 -1
  81. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  82. package/lib/cjs/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
  83. package/lib/cjs/components-react/iconpicker/IconPickerButton.js +0 -3
  84. package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
  85. package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
  86. package/lib/cjs/components-react/inputs/ParsedInput.js +0 -5
  87. package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
  88. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts.map +1 -1
  89. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +0 -1
  90. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  91. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.js +1 -2
  92. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
  93. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  94. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js +0 -2
  95. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  96. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  97. package/lib/cjs/components-react/properties/renderers/PropertyView.js +7 -4
  98. package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
  99. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts.map +1 -1
  100. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +6 -3
  101. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  102. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.scss +5 -5
  103. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +1 -0
  104. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
  105. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -0
  106. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  107. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +1 -0
  108. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
  109. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -0
  110. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  111. package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +5 -9
  112. package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  113. package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.d.ts.map +1 -1
  114. package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.js +0 -2
  115. package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
  116. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  117. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +0 -1
  118. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  119. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  120. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +3 -4
  121. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  122. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
  123. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +3 -4
  124. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  125. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  126. package/lib/cjs/components-react/propertygrid/component/PropertyList.js +0 -1
  127. package/lib/cjs/components-react/propertygrid/component/PropertyList.js.map +1 -1
  128. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  129. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +0 -2
  130. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  131. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +0 -4
  132. package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
  133. package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js +0 -1
  134. package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
  135. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
  136. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js +0 -1
  137. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
  138. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
  139. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -6
  140. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  141. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +0 -1
  142. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  143. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts.map +1 -1
  144. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +0 -2
  145. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  146. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +1 -2
  147. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  148. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  149. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +7 -24
  150. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  151. package/lib/cjs/components-react/toolbar/Items.d.ts.map +1 -1
  152. package/lib/cjs/components-react/toolbar/Items.js +0 -2
  153. package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
  154. package/lib/cjs/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
  155. package/lib/cjs/components-react/toolbar/OverflowPanel.js +0 -1
  156. package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
  157. package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
  158. package/lib/cjs/components-react/toolbar/PopupItem.js +3 -6
  159. package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
  160. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  161. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +3 -13
  162. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  163. package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  164. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +1 -7
  165. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  166. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
  167. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js +0 -3
  168. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  169. package/lib/cjs/components-react/toolbar/useDragInteraction.d.ts.map +1 -1
  170. package/lib/cjs/components-react/toolbar/useDragInteraction.js +0 -2
  171. package/lib/cjs/components-react/toolbar/useDragInteraction.js.map +1 -1
  172. package/lib/cjs/components-react/tree/TreeDataProvider.d.ts.map +1 -1
  173. package/lib/cjs/components-react/tree/TreeDataProvider.js +0 -1
  174. package/lib/cjs/components-react/tree/TreeDataProvider.js.map +1 -1
  175. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  176. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js +1 -8
  177. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
  178. package/lib/cjs/components-react/tree/controlled/TreeModel.d.ts.map +1 -1
  179. package/lib/cjs/components-react/tree/controlled/TreeModel.js +0 -1
  180. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  181. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
  182. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +0 -4
  183. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  184. package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
  185. package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js +0 -5
  186. package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  187. package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.d.ts.map +1 -1
  188. package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js +0 -1
  189. package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
  190. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  191. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +1 -10
  192. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  193. package/lib/esm/components-react/common/ImageRenderer.d.ts.map +1 -1
  194. package/lib/esm/components-react/common/ImageRenderer.js +0 -4
  195. package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
  196. package/lib/esm/components-react/common/Links.d.ts.map +1 -1
  197. package/lib/esm/components-react/common/Links.js +0 -7
  198. package/lib/esm/components-react/common/Links.js.map +1 -1
  199. package/lib/esm/components-react/common/UseContextWithMandatoryProvider.d.ts.map +1 -1
  200. package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js +0 -1
  201. package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
  202. package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts.map +1 -1
  203. package/lib/esm/components-react/common/UseElementsScrollStorage.js +0 -1
  204. package/lib/esm/components-react/common/UseElementsScrollStorage.js.map +1 -1
  205. package/lib/esm/components-react/converters/DateTimeTypeConverter.d.ts.map +1 -1
  206. package/lib/esm/components-react/converters/DateTimeTypeConverter.js +0 -13
  207. package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  208. package/lib/esm/components-react/converters/TypeConverterManager.d.ts.map +1 -1
  209. package/lib/esm/components-react/converters/TypeConverterManager.js +0 -1
  210. package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
  211. package/lib/esm/components-react/datepicker/DateField.d.ts.map +1 -1
  212. package/lib/esm/components-react/datepicker/DateField.js +1 -8
  213. package/lib/esm/components-react/datepicker/DateField.js.map +1 -1
  214. package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
  215. package/lib/esm/components-react/datepicker/DatePicker.js +0 -2
  216. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  217. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  218. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +0 -1
  219. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  220. package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
  221. package/lib/esm/components-react/datepicker/TimeField.js +0 -9
  222. package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
  223. package/lib/esm/components-react/editors/BooleanEditor.d.ts.map +1 -1
  224. package/lib/esm/components-react/editors/BooleanEditor.js +0 -8
  225. package/lib/esm/components-react/editors/BooleanEditor.js.map +1 -1
  226. package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  227. package/lib/esm/components-react/editors/CustomNumberEditor.js +7 -25
  228. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  229. package/lib/esm/components-react/editors/DateTimeEditor.d.ts.map +1 -1
  230. package/lib/esm/components-react/editors/DateTimeEditor.js +0 -21
  231. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  232. package/lib/esm/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
  233. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +1 -14
  234. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  235. package/lib/esm/components-react/editors/EnumEditor.d.ts.map +1 -1
  236. package/lib/esm/components-react/editors/EnumEditor.js +1 -13
  237. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  238. package/lib/esm/components-react/editors/IconEditor.d.ts.map +1 -1
  239. package/lib/esm/components-react/editors/IconEditor.js +0 -9
  240. package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
  241. package/lib/esm/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  242. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +0 -6
  243. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  244. package/lib/esm/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  245. package/lib/esm/components-react/editors/NumericInputEditor.js +1 -10
  246. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  247. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  248. package/lib/esm/components-react/editors/PopupButton.js +0 -2
  249. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  250. package/lib/esm/components-react/editors/PropertyEditorManager.d.ts.map +1 -1
  251. package/lib/esm/components-react/editors/PropertyEditorManager.js +0 -1
  252. package/lib/esm/components-react/editors/PropertyEditorManager.js.map +1 -1
  253. package/lib/esm/components-react/editors/SliderEditor.d.ts.map +1 -1
  254. package/lib/esm/components-react/editors/SliderEditor.js +0 -10
  255. package/lib/esm/components-react/editors/SliderEditor.js.map +1 -1
  256. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  257. package/lib/esm/components-react/editors/TextEditor.js +0 -7
  258. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  259. package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
  260. package/lib/esm/components-react/editors/TextareaEditor.js +0 -15
  261. package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
  262. package/lib/esm/components-react/editors/ToggleEditor.d.ts.map +1 -1
  263. package/lib/esm/components-react/editors/ToggleEditor.js +0 -9
  264. package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
  265. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
  266. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +0 -1
  267. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  268. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +3 -4
  269. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  270. package/lib/esm/components-react/filtering/FilteringInput.d.ts.map +1 -1
  271. package/lib/esm/components-react/filtering/FilteringInput.js +0 -1
  272. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  273. package/lib/esm/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
  274. package/lib/esm/components-react/iconpicker/IconPickerButton.js +0 -3
  275. package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
  276. package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
  277. package/lib/esm/components-react/inputs/ParsedInput.js +0 -5
  278. package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
  279. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts.map +1 -1
  280. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +0 -1
  281. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  282. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.js +1 -2
  283. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
  284. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  285. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js +0 -2
  286. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  287. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  288. package/lib/esm/components-react/properties/renderers/PropertyView.js +7 -4
  289. package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
  290. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts.map +1 -1
  291. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +3 -3
  292. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  293. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.scss +5 -5
  294. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +1 -0
  295. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
  296. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -0
  297. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  298. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +1 -0
  299. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
  300. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -0
  301. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  302. package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +5 -9
  303. package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  304. package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.d.ts.map +1 -1
  305. package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.js +0 -2
  306. package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
  307. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  308. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +0 -1
  309. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  310. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  311. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +3 -4
  312. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  313. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
  314. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +3 -4
  315. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  316. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  317. package/lib/esm/components-react/propertygrid/component/PropertyList.js +0 -1
  318. package/lib/esm/components-react/propertygrid/component/PropertyList.js.map +1 -1
  319. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  320. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +0 -2
  321. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  322. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +0 -4
  323. package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
  324. package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js +0 -1
  325. package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
  326. package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
  327. package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js +0 -1
  328. package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
  329. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
  330. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -3
  331. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  332. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +0 -1
  333. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  334. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts.map +1 -1
  335. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +0 -2
  336. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  337. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +1 -2
  338. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  339. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  340. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +7 -24
  341. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  342. package/lib/esm/components-react/toolbar/Items.d.ts.map +1 -1
  343. package/lib/esm/components-react/toolbar/Items.js +0 -2
  344. package/lib/esm/components-react/toolbar/Items.js.map +1 -1
  345. package/lib/esm/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
  346. package/lib/esm/components-react/toolbar/OverflowPanel.js +0 -1
  347. package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
  348. package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
  349. package/lib/esm/components-react/toolbar/PopupItem.js +3 -6
  350. package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
  351. package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  352. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +3 -13
  353. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  354. package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  355. package/lib/esm/components-react/toolbar/PopupItemsPanel.js +1 -7
  356. package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  357. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
  358. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js +0 -3
  359. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  360. package/lib/esm/components-react/toolbar/useDragInteraction.d.ts.map +1 -1
  361. package/lib/esm/components-react/toolbar/useDragInteraction.js +0 -2
  362. package/lib/esm/components-react/toolbar/useDragInteraction.js.map +1 -1
  363. package/lib/esm/components-react/tree/TreeDataProvider.d.ts.map +1 -1
  364. package/lib/esm/components-react/tree/TreeDataProvider.js +0 -1
  365. package/lib/esm/components-react/tree/TreeDataProvider.js.map +1 -1
  366. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  367. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js +1 -8
  368. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
  369. package/lib/esm/components-react/tree/controlled/TreeModel.d.ts.map +1 -1
  370. package/lib/esm/components-react/tree/controlled/TreeModel.js +0 -1
  371. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  372. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
  373. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +0 -4
  374. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  375. package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
  376. package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js +0 -5
  377. package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  378. package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.d.ts.map +1 -1
  379. package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js +0 -1
  380. package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
  381. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  382. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +1 -10
  383. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  384. package/package.json +3 -5
@@ -28,16 +28,13 @@ export class EnumButtonGroupEditor extends React.Component {
28
28
  };
29
29
  this._handleButtonClick = (index) => {
30
30
  const propertyRecord = this.props.propertyRecord;
31
- // istanbul ignore else
32
31
  if (this.state.choices && this.state.choices.length > index) {
33
32
  const selectValue = this.state.choices[index].value;
34
33
  this.setState({
35
34
  selectValue,
36
35
  }, async () => {
37
- // istanbul ignore else
38
36
  if (propertyRecord && this.props.onCommit) {
39
37
  const propertyValue = await this.getPropertyValue();
40
- // istanbul ignore else
41
38
  if (propertyValue !== undefined) {
42
39
  this.props.onCommit({ propertyRecord, newValue: propertyValue });
43
40
  }
@@ -49,7 +46,6 @@ export class EnumButtonGroupEditor extends React.Component {
49
46
  async getPropertyValue() {
50
47
  const record = this.props.propertyRecord;
51
48
  let propertyValue;
52
- // istanbul ignore else
53
49
  if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {
54
50
  propertyValue = {
55
51
  valueFormat: PropertyValueFormat.Primitive,
@@ -64,7 +60,6 @@ export class EnumButtonGroupEditor extends React.Component {
64
60
  }
65
61
  get hasFocus() {
66
62
  let containsFocus = false;
67
- // istanbul ignore else
68
63
  if (this._divElement.current)
69
64
  containsFocus = this._divElement.current.contains(document.activeElement);
70
65
  return containsFocus;
@@ -81,7 +76,6 @@ export class EnumButtonGroupEditor extends React.Component {
81
76
  }
82
77
  async setStateFromProps() {
83
78
  const { propertyRecord } = this.props;
84
- // istanbul ignore else
85
79
  if (propertyRecord &&
86
80
  propertyRecord.property.enum &&
87
81
  propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {
@@ -94,7 +88,6 @@ export class EnumButtonGroupEditor extends React.Component {
94
88
  selectValue = primitiveValue;
95
89
  }
96
90
  let choices = [];
97
- // istanbul ignore else
98
91
  if (propertyRecord && propertyRecord.property.enum) {
99
92
  if (propertyRecord.property.enum.choices instanceof Promise) {
100
93
  choices = await propertyRecord.property.enum.choices;
@@ -106,17 +99,13 @@ export class EnumButtonGroupEditor extends React.Component {
106
99
  const numChoices = choices.length;
107
100
  const enumIcons = new Array(numChoices);
108
101
  enumIcons.fill({ iconSpec: svgPlaceholder });
109
- // istanbul ignore else
110
102
  if (propertyRecord.property.editor &&
111
103
  propertyRecord.property.editor.params) {
112
- // istanbul ignore else
113
104
  if (propertyRecord.property.editor &&
114
105
  propertyRecord.property.editor.params) {
115
106
  const bgParams = propertyRecord.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.ButtonGroupData.valueOf());
116
- // istanbul ignore else
117
107
  if (bgParams) {
118
108
  bgParams.buttons.forEach((iconDef, index) => {
119
- // istanbul ignore else
120
109
  if (index < numChoices) {
121
110
  enumIcons[index] = iconDef;
122
111
  }
@@ -130,11 +119,10 @@ export class EnumButtonGroupEditor extends React.Component {
130
119
  getButton(choice, index) {
131
120
  const choiceValue = this.state.choices
132
121
  ? this.state.choices[index].value
133
- : /* istanbul ignore next */ 0;
122
+ : 0;
134
123
  const isActive = choiceValue === this.state.selectValue ? true : false;
135
124
  let isDisabled = false;
136
125
  const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;
137
- // istanbul ignore else
138
126
  if (isEnabledFunction) {
139
127
  isDisabled = !isEnabledFunction();
140
128
  }
@@ -154,7 +142,6 @@ export class EnumButtonGroupEditor extends React.Component {
154
142
  * @public
155
143
  */
156
144
  export class EnumPropertyButtonGroupEditor extends PropertyEditorBase {
157
- // istanbul ignore next
158
145
  get reactNode() {
159
146
  return React.createElement(EnumButtonGroupEditor, null);
160
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,cAAc,MAAM,8CAA8C,CAAC;AAW1E;;GAEG;AACH,MAAM,OAAO,qBACX,SAAQ,KAAK,CAAC,SAA0D;IAD1E;;QAIU,aAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;QACzD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAyC;YACrE,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QA0GM,uBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;gBAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;gBAEpD,IAAI,CAAC,QAAQ,CACX;oBACE,W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K,CAAC,CAC9B,CACC,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,kBAAkB;IACnE,uBAAuB;IACvB,IAAW,SAAS;QAClB,OAAO,oBAAC,qBAAqB,OAAG,CAAC;IACnC,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,6BAA6B,EAC7B,mBAAmB,CAAC,eAAe,CACpC,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 \"./EnumButtonGroupEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ButtonGroupEditorParams,\n EnumerationChoice,\n IconDefinition,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport svgPlaceholder from \"@bentley/icons-generic/icons/placeholder.svg\";\n\n// cspell:ignore buttongroup enumbuttongroup\n\n/** @internal */\ninterface EnumButtonGroupEditorState {\n selectValue: string | number;\n enumIcons: IconDefinition[];\n choices: EnumerationChoice[];\n}\n\n/** EnumButtonGroupEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumButtonGroupEditor\n extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState>\n implements TypeEditor\n{\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\n selectValue: \"\",\n enumIcons: [],\n choices: [],\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 public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\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 /** @internal */\n public override componentDidMount() {\n void this.setStateFromProps();\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\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.property.enum &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n let selectValue: string | number;\n\n if (typeof primitiveValue === \"string\") {\n selectValue = primitiveValue;\n } else {\n selectValue = primitiveValue as number;\n }\n\n let choices: EnumerationChoice[] = [];\n // istanbul ignore else\n if (propertyRecord && propertyRecord.property.enum) {\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 numChoices = choices.length;\n const enumIcons = new Array<IconDefinition>(numChoices);\n enumIcons.fill({ iconSpec: svgPlaceholder });\n\n // istanbul ignore else\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n // istanbul ignore else\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n const bgParams = propertyRecord.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.ButtonGroupData.valueOf()\n ) as ButtonGroupEditorParams;\n // istanbul ignore else\n if (bgParams) {\n bgParams.buttons.forEach(\n (iconDef: IconDefinition, index: number) => {\n // istanbul ignore else\n if (index < numChoices) {\n enumIcons[index] = iconDef;\n }\n }\n );\n }\n }\n }\n\n this.setState({ selectValue, enumIcons, choices });\n }\n }\n\n private _handleButtonClick = (index: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n // istanbul ignore else\n if (this.state.choices && this.state.choices.length > index) {\n const selectValue = this.state.choices[index].value;\n\n this.setState(\n {\n selectValue,\n },\n async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n }\n );\n }\n };\n\n private getButton(choice: EnumerationChoice, index: number) {\n const choiceValue = this.state.choices\n ? this.state.choices[index].value\n : /* istanbul ignore next */ 0;\n const isActive = choiceValue === this.state.selectValue ? true : false;\n let isDisabled = false;\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\n // istanbul ignore else\n if (isEnabledFunction) {\n isDisabled = !isEnabledFunction();\n }\n\n const className = classnames(\n \"components-enumbuttongroup-button\",\n isDisabled && \"nz-is-disabled\",\n isActive && \"nz-is-active\"\n );\n\n return (\n <button\n ref={(ref: HTMLButtonElement | null) =>\n ref && this._btnRefs.set(choiceValue, ref)\n }\n data-testid={choice.label}\n className={className}\n title={choice.label}\n key={choice.label}\n onClick={() => this._handleButtonClick(index)}\n >\n <Icon iconSpec={this.state.enumIcons[index].iconSpec} />\n </button>\n );\n }\n\n /** @internal */\n public override render() {\n return (\n <div\n className={classnames(\n \"components-enumbuttongroup-editor\",\n this.props.className\n )}\n style={this.props.style}\n ref={this._divElement}\n >\n {this.state.choices &&\n this.state.enumIcons.length &&\n this.state.choices.map((choice: EnumerationChoice, index: number) =>\n this.getButton(choice, index)\n )}\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\n * It uses the [[EnumButtonGroupEditor]] React component.\n * @public\n */\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase {\n // istanbul ignore next\n public get reactNode(): React.ReactNode {\n return <EnumButtonGroupEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Enum,\n EnumPropertyButtonGroupEditor,\n StandardEditorNames.EnumButtonGroup\n);\n"]}
1
+ {"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,cAAc,MAAM,8CAA8C,CAAC;AAW1E;;GAEG;AACH,MAAM,OAAO,qBACX,SAAQ,KAAK,CAAC,SAA0D;IAD1E;;QAIU,aAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;QACzD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAyC;YACrE,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QAkGM,uBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,IAAI,IAAI,CAA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AClE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAC9B,CACC,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,kBAAkB;IACnE,IAAW,SAAS;QAClB,OAAO,oBAAC,qBAAqB,OAAG,CAAC;IACnC,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,6BAA6B,EAC7B,mBAAmB,CAAC,eAAe,CACpC,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 \"./EnumButtonGroupEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ButtonGroupEditorParams,\n EnumerationChoice,\n IconDefinition,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport svgPlaceholder from \"@bentley/icons-generic/icons/placeholder.svg\";\n\n// cspell:ignore buttongroup enumbuttongroup\n\n/** @internal */\ninterface EnumButtonGroupEditorState {\n selectValue: string | number;\n enumIcons: IconDefinition[];\n choices: EnumerationChoice[];\n}\n\n/** EnumButtonGroupEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumButtonGroupEditor\n extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState>\n implements TypeEditor\n{\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\n selectValue: \"\",\n enumIcons: [],\n choices: [],\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\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 public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n /** @internal */\n public override componentDidMount() {\n void this.setStateFromProps();\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\n if (\n propertyRecord &&\n propertyRecord.property.enum &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n let selectValue: string | number;\n\n if (typeof primitiveValue === \"string\") {\n selectValue = primitiveValue;\n } else {\n selectValue = primitiveValue as number;\n }\n\n let choices: EnumerationChoice[] = [];\n if (propertyRecord && propertyRecord.property.enum) {\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 numChoices = choices.length;\n const enumIcons = new Array<IconDefinition>(numChoices);\n enumIcons.fill({ iconSpec: svgPlaceholder });\n\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n const bgParams = propertyRecord.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.ButtonGroupData.valueOf()\n ) as ButtonGroupEditorParams;\n if (bgParams) {\n bgParams.buttons.forEach(\n (iconDef: IconDefinition, index: number) => {\n if (index < numChoices) {\n enumIcons[index] = iconDef;\n }\n }\n );\n }\n }\n }\n\n this.setState({ selectValue, enumIcons, choices });\n }\n }\n\n private _handleButtonClick = (index: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n if (this.state.choices && this.state.choices.length > index) {\n const selectValue = this.state.choices[index].value;\n\n this.setState(\n {\n selectValue,\n },\n async () => {\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n }\n );\n }\n };\n\n private getButton(choice: EnumerationChoice, index: number) {\n const choiceValue = this.state.choices\n ? this.state.choices[index].value\n : 0;\n const isActive = choiceValue === this.state.selectValue ? true : false;\n let isDisabled = false;\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\n if (isEnabledFunction) {\n isDisabled = !isEnabledFunction();\n }\n\n const className = classnames(\n \"components-enumbuttongroup-button\",\n isDisabled && \"nz-is-disabled\",\n isActive && \"nz-is-active\"\n );\n\n return (\n <button\n ref={(ref: HTMLButtonElement | null) =>\n ref && this._btnRefs.set(choiceValue, ref)\n }\n data-testid={choice.label}\n className={className}\n title={choice.label}\n key={choice.label}\n onClick={() => this._handleButtonClick(index)}\n >\n <Icon iconSpec={this.state.enumIcons[index].iconSpec} />\n </button>\n );\n }\n\n /** @internal */\n public override render() {\n return (\n <div\n className={classnames(\n \"components-enumbuttongroup-editor\",\n this.props.className\n )}\n style={this.props.style}\n ref={this._divElement}\n >\n {this.state.choices &&\n this.state.enumIcons.length &&\n this.state.choices.map((choice: EnumerationChoice, index: number) =>\n this.getButton(choice, index)\n )}\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\n * It uses the [[EnumButtonGroupEditor]] React component.\n * @public\n */\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <EnumButtonGroupEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Enum,\n EnumPropertyButtonGroupEditor,\n StandardEditorNames.EnumButtonGroup\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EnumEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAGjC,gBAAgB;AAChB,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAChC,SAAS,EAAE,cAAc,GAAG,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,UACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,eAAe,CAChE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAqC;IAExD,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAKvD;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAiBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAGD,IAAW,QAAQ,IAAI,OAAO,CAM7B;IAED,OAAO,CAAC,kBAAkB,CA4BxB;IAEF,g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aAAa,GAAG,SAAS,CAAC;IAenE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAK7B;IAED,OAAO,CAAC,kBAAkB,CAwBxB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IA6C/B,gBAAgB;IACA,MAAM;CAwCvB;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,kBAAkB;IACxD,IAAoB,qBAAqB,IAAI,OAAO,CAEnD;IACD,IAAoB,gCAAgC,IAAI,OAAO,CAE9D;IAED,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
@@ -28,10 +28,8 @@ export class EnumEditor extends React.PureComponent {
28
28
  parentDiv: null,
29
29
  };
30
30
  this._updateSelectValue = (newValue) => {
31
- // istanbul ignore else
32
31
  if (this._isMounted) {
33
32
  let selectValue;
34
- // istanbul ignore if
35
33
  if (this.state.valueIsNumber)
36
34
  selectValue = parseInt(newValue, 10);
37
35
  else
@@ -39,10 +37,8 @@ export class EnumEditor extends React.PureComponent {
39
37
  this.setState({
40
38
  selectValue,
41
39
  }, async () => {
42
- // istanbul ignore else
43
40
  if (this.props.propertyRecord && this.props.onCommit) {
44
41
  const propertyValue = await this.getPropertyValue();
45
- // istanbul ignore else
46
42
  if (propertyValue) {
47
43
  this.props.onCommit({
48
44
  propertyRecord: this.props.propertyRecord,
@@ -57,7 +53,6 @@ export class EnumEditor extends React.PureComponent {
57
53
  async getPropertyValue() {
58
54
  const record = this.props.propertyRecord;
59
55
  let propertyValue;
60
- // istanbul ignore else
61
56
  if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {
62
57
  propertyValue = {
63
58
  valueFormat: PropertyValueFormat.Primitive,
@@ -67,14 +62,11 @@ export class EnumEditor extends React.PureComponent {
67
62
  }
68
63
  return propertyValue;
69
64
  }
70
- // istanbul ignore next
71
65
  get htmlElement() {
72
66
  return this._divElement.current;
73
67
  }
74
- // istanbul ignore next
75
68
  get hasFocus() {
76
69
  let containsFocus = false;
77
- // istanbul ignore else
78
70
  if (this._divElement.current)
79
71
  containsFocus = this._divElement.current.contains(document.activeElement);
80
72
  return containsFocus;
@@ -98,7 +90,6 @@ export class EnumEditor extends React.PureComponent {
98
90
  const { propertyRecord } = this.props;
99
91
  let initialValue = "";
100
92
  let valueIsNumber = false;
101
- // istanbul ignore else
102
93
  if (propertyRecord &&
103
94
  propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {
104
95
  const primitiveValue = propertyRecord.value.value;
@@ -113,7 +104,6 @@ export class EnumEditor extends React.PureComponent {
113
104
  }
114
105
  let choices;
115
106
  if (propertyRecord && propertyRecord.property.enum) {
116
- // istanbul ignore else
117
107
  if (propertyRecord.property.enum.choices instanceof Promise) {
118
108
  choices = await propertyRecord.property.enum.choices;
119
109
  }
@@ -127,7 +117,6 @@ export class EnumEditor extends React.PureComponent {
127
117
  options.push({ value: choice.value.toString(), label: choice.label });
128
118
  });
129
119
  }
130
- // istanbul ignore else
131
120
  if (this._isMounted)
132
121
  this.setState({
133
122
  selectValue: initialValue,
@@ -141,7 +130,7 @@ export class EnumEditor extends React.PureComponent {
141
130
  const className = classnames("components-cell-editor", "components-enum-editor", this.props.className);
142
131
  const selectValue = this.state.selectValue !== undefined
143
132
  ? this.state.selectValue.toString()
144
- : /* istanbul ignore next */ undefined;
133
+ : undefined;
145
134
  // set min-width to show about 4 characters + down arrow
146
135
  const minWidthStyle = {
147
136
  minWidth: `6em`,
@@ -164,7 +153,6 @@ export class EnumEditor extends React.PureComponent {
164
153
  * @public
165
154
  */
166
155
  export class EnumPropertyEditor extends PropertyEditorBase {
167
- // istanbul ignore next
168
156
  get containerHandlesEnter() {
169
157
  return false;
170
158
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/edit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wBACV,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;4BAAE,OAAO;wBACjC,EAAE,EAAE,KAAK,EAAE,CAAC;oBACd,CAAC;oBACD,SAAS,EAAE,mBAAmB;iBAC/B,gBACW,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,aAAmD;IADnE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAA8B;YAC1D,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,IAAI;SAChB,CAAC;QA4BM,uBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;YAChD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,IAAI,WAA4B,CAAC;gBAEjC,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa;oBAAE,WAAW,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;;oBAC9D,WAAW,GAAG,QAAQ,CAAC;gBAE5B,IAAI,CAAC,QAAQ,CACX;oBACE,WAAW;iBACZ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Y,EAAE;oBACZ,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;wBACV,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;4BAAE,OAAO;wBACjC,EAAE,EAAE,KAAK,EAAE,CAAC;oBACd,CAAC;oBACD,SAAS,EAAE,mBAAmB;iBAC/B,gBACW,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,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 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 public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateSelectValue = (newValue: string) => {\n if (this._isMounted) {\n let selectValue: string | number;\n\n if (this.state.valueIsNumber) selectValue = parseInt(newValue, 10);\n else selectValue = newValue;\n\n this.setState(\n {\n selectValue,\n },\n async () => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\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 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 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 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 : 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 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":"IconEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/IconEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAIV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAIjC,gBAAgB;AAChB,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AAEH,qBAAa,UACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,eAAe,CAChE,YAAW,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAqC;gBAE5C,KAAK,EAAE,mBAAmB;IAgCzB,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAK7B;IAED,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,aAAa,CAkBnB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IAsB/B,gBAAgB;IACA,MAAM;CAqBvB;AAED;;;GAGG;AAEH,qBAAa,k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AED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,kBAAkB;IACxD,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
@@ -14,7 +14,6 @@ import { PropertyEditorBase, PropertyEditorManager, } from "./PropertyEditorMana
14
14
  /** IconEditor React component that is a property editor with button and popup
15
15
  * @alpha
16
16
  */
17
- // istanbul ignore next
18
17
  export class IconEditor extends React.PureComponent {
19
18
  constructor(props) {
20
19
  super(props);
@@ -26,10 +25,8 @@ export class IconEditor extends React.PureComponent {
26
25
  this.setState({
27
26
  icon,
28
27
  }, async () => {
29
- // istanbul ignore else
30
28
  if (propertyRecord && this.props.onCommit) {
31
29
  const propertyValue = await this.getPropertyValue();
32
- // istanbul ignore else
33
30
  if (propertyValue) {
34
31
  this.props.onCommit({ propertyRecord, newValue: propertyValue });
35
32
  }
@@ -47,7 +44,6 @@ export class IconEditor extends React.PureComponent {
47
44
  record.property.editor &&
48
45
  record.property.editor.params) {
49
46
  const iconParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.IconListData.valueOf());
50
- // istanbul ignore else
51
47
  if (iconParams) {
52
48
  if (iconParams.iconValue)
53
49
  icon = iconParams.iconValue;
@@ -62,7 +58,6 @@ export class IconEditor extends React.PureComponent {
62
58
  async getPropertyValue() {
63
59
  const record = this.props.propertyRecord;
64
60
  let propertyValue;
65
- // istanbul ignore else
66
61
  if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {
67
62
  propertyValue = {
68
63
  valueFormat: PropertyValueFormat.Primitive,
@@ -82,7 +77,6 @@ export class IconEditor extends React.PureComponent {
82
77
  return containsFocus;
83
78
  }
84
79
  setFocus() {
85
- // istanbul ignore else
86
80
  if (this._control && !this.state.isDisabled) {
87
81
  this._control.setFocus();
88
82
  }
@@ -105,13 +99,11 @@ export class IconEditor extends React.PureComponent {
105
99
  async setStateFromProps() {
106
100
  const record = this.props.propertyRecord;
107
101
  let initialValue = "";
108
- // istanbul ignore else
109
102
  if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {
110
103
  initialValue = record.value.value;
111
104
  }
112
105
  const readonly = record && undefined !== record.isReadonly ? record.isReadonly : false;
113
106
  const isDisabled = record ? record.isDisabled : undefined;
114
- // istanbul ignore else
115
107
  if (this._isMounted)
116
108
  this.setState({ icon: initialValue, readonly, isDisabled }, () => {
117
109
  if (this.props.setFocus) {
@@ -130,7 +122,6 @@ export class IconEditor extends React.PureComponent {
130
122
  * It uses the [[IconEditor]] React component.
131
123
  * @alpha
132
124
  */
133
- // istanbul ignore next
134
125
  export class IconPropertyEditor extends PropertyEditorBase {
135
126
  get reactNode() {
136
127
  return React.createElement(IconEditor, null);
@@ -1 +1 @@
1
- {"version":3,"file":"IconEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/IconEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,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,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAajC;;GAEG;AACH,uBAAuB;AACvB,MAAM,OAAO,UACX,SAAQ,KAAK,CAAC,aAAmD;IAOjE,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QALP,aAAQ,GAAQ,IAAI,CAAC;QACrB,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAoEhD,kBAAa,GAAG,CAAC,IAAY,EAAE,EAAE;YACvC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,IAAI,CA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AS,EAAE,UAAU,CAAC,wBAAwB,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EACrE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,GAAG,EAAE,IAAI,CAAC,WAAW;YAErB,oBAAC,gBAAgB,IACf,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,EAC3C,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EAC/B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,YAAY,EAAE,IAAI,CAAC,aAAa,iBACpB,wBAAwB,GACpC,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,uBAAuB;AACvB,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IACxD,IAAW,SAAS;QAClB,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,kBAAkB,EAClB,mBAAmB,CAAC,UAAU,CAC/B,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,kBAAkB,EAClB,mBAAmB,CAAC,UAAU,CAC/B,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 \"./IconEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconListEditorParams,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { IconPickerButton } from \"../iconpicker/IconPickerButton\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n// cspell:ignore iconpicker\n\n/** @internal */\ninterface IconEditorState {\n icon: string;\n icons: string[];\n numColumns: number;\n readonly?: boolean;\n isDisabled?: boolean;\n}\n\n/** IconEditor React component that is a property editor with button and popup\n * @alpha\n */\n// istanbul ignore next\nexport class IconEditor\n extends React.PureComponent<PropertyEditorProps, IconEditorState>\n implements TypeEditor\n{\n private _control: any = null;\n private _isMounted = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n constructor(props: PropertyEditorProps) {\n super(props);\n\n let icon = \"\";\n let numColumns = 4;\n const icons: string[] = [];\n const readonly = false;\n\n // TODO: add support for following if we need to specify set of weights to display\n const record = props.propertyRecord;\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.IconListData.valueOf()\n ) as IconListEditorParams;\n // istanbul ignore else\n if (iconParams) {\n if (iconParams.iconValue) icon = iconParams.iconValue;\n if (iconParams.numColumns) numColumns = iconParams.numColumns;\n if (iconParams.iconValues)\n iconParams.iconValues.forEach((i: string) => icons.push(i));\n }\n }\n\n this.state = { icon, icons, numColumns, readonly };\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.icon,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private setFocus(): void {\n // istanbul ignore else\n if (this._control && !this.state.isDisabled) {\n this._control.setFocus();\n }\n }\n\n private _onIconChange = (icon: string) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n this.setState(\n {\n icon,\n },\n async () => {\n // istanbul ignore else\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\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 record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as string;\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n const isDisabled = record ? record.isDisabled : undefined;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ icon: initialValue, readonly, isDisabled }, () => {\n if (this.props.setFocus) {\n this.setFocus();\n }\n });\n }\n\n /** @internal */\n public override render() {\n const { icon, icons, numColumns } = this.state;\n return (\n <div\n className={classnames(\"components-icon-editor\", this.props.className)}\n style={this.props.style}\n ref={this._divElement}\n >\n <IconPickerButton\n ref={(control) => (this._control = control)}\n icon={icon}\n icons={icons}\n numColumns={numColumns}\n disabled={this.state.isDisabled}\n readonly={this.state.readonly}\n onIconChange={this._onIconChange}\n data-testid=\"components-icon-editor\"\n />\n </div>\n );\n }\n}\n\n/** Icon Property Editor registered for the \"text\" and \"string\" type names and the \"icon-picker\" editor name.\n * It uses the [[IconEditor]] React component.\n * @alpha\n */\n// istanbul ignore next\nexport class IconPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <IconEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Text,\n IconPropertyEditor,\n StandardEditorNames.IconPicker\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.String,\n IconPropertyEditor,\n StandardEditorNames.IconPicker\n);\n"]}
1
+ {"version":3,"file":"IconEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/IconEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,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,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAajC;;GAEG;AACH,MAAM,OAAO,UACX,SAAQ,KAAK,CAAC,aAAmD;IAOjE,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QALP,aAAQ,GAAQ,IAAI,CAAC;QACrB,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAiEhD,kBAAa,GAAG,CAAC,IAAY,EAAE,EAAE;YACvC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,IAAI,CAAC,QAAQ,CACX;gBACE,IAAI;aACL,EACD,KAAK,IAAI,EAAE;gBACT,IAAI,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;oBAC1C,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACpD,IAA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K,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EAC/B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,YAAY,EAAE,IAAI,CAAC,aAAa,iBACpB,wBAAwB,GACpC,CACE,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IACxD,IAAW,SAAS;QAClB,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,IAAI,EACtB,kBAAkB,EAClB,mBAAmB,CAAC,UAAU,CAC/B,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,kBAAkB,EAClB,mBAAmB,CAAC,UAAU,CAC/B,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 \"./IconEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconListEditorParams,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { IconPickerButton } from \"../iconpicker/IconPickerButton\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n// cspell:ignore iconpicker\n\n/** @internal */\ninterface IconEditorState {\n icon: string;\n icons: string[];\n numColumns: number;\n readonly?: boolean;\n isDisabled?: boolean;\n}\n\n/** IconEditor React component that is a property editor with button and popup\n * @alpha\n */\nexport class IconEditor\n extends React.PureComponent<PropertyEditorProps, IconEditorState>\n implements TypeEditor\n{\n private _control: any = null;\n private _isMounted = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n constructor(props: PropertyEditorProps) {\n super(props);\n\n let icon = \"\";\n let numColumns = 4;\n const icons: string[] = [];\n const readonly = false;\n\n // TODO: add support for following if we need to specify set of weights to display\n const record = props.propertyRecord;\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.IconListData.valueOf()\n ) as IconListEditorParams;\n if (iconParams) {\n if (iconParams.iconValue) icon = iconParams.iconValue;\n if (iconParams.numColumns) numColumns = iconParams.numColumns;\n if (iconParams.iconValues)\n iconParams.iconValues.forEach((i: string) => icons.push(i));\n }\n }\n\n this.state = { icon, icons, numColumns, readonly };\n }\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.icon,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private setFocus(): void {\n if (this._control && !this.state.isDisabled) {\n this._control.setFocus();\n }\n }\n\n private _onIconChange = (icon: string) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n this.setState(\n {\n icon,\n },\n async () => {\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\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 record = this.props.propertyRecord;\n let initialValue = \"\";\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as string;\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (this._isMounted)\n this.setState({ icon: initialValue, readonly, isDisabled }, () => {\n if (this.props.setFocus) {\n this.setFocus();\n }\n });\n }\n\n /** @internal */\n public override render() {\n const { icon, icons, numColumns } = this.state;\n return (\n <div\n className={classnames(\"components-icon-editor\", this.props.className)}\n style={this.props.style}\n ref={this._divElement}\n >\n <IconPickerButton\n ref={(control) => (this._control = control)}\n icon={icon}\n icons={icons}\n numColumns={numColumns}\n disabled={this.state.isDisabled}\n readonly={this.state.readonly}\n onIconChange={this._onIconChange}\n data-testid=\"components-icon-editor\"\n />\n </div>\n );\n }\n}\n\n/** Icon Property Editor registered for the \"text\" and \"string\" type names and the \"icon-picker\" editor name.\n * It uses the [[IconEditor]] React component.\n * @alpha\n */\nexport class IconPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <IconEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Text,\n IconPropertyEditor,\n StandardEditorNames.IconPicker\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.String,\n IconPropertyEditor,\n StandardEditorNames.IconPicker\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageCheckBoxEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAKjC,gBAAgB;AAChB,UAAU,wBAAwB;IAChC,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;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"}
1
+ {"version":3,"file":"ImageCheckBoxEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAKjC,gBAAgB;AAChB,UAAU,wBAAwB;IAChC,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;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;IAenE,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;IAoCzB,OAAO,CAAC,YAAY,CAiBlB;IAEc,MAAM;CAyBvB;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
@@ -31,10 +31,8 @@ export class ImageCheckBoxEditor extends React.PureComponent {
31
31
  this.setState({
32
32
  checkboxValue: checked,
33
33
  }, async () => {
34
- // istanbul ignore else
35
34
  if (this.props.propertyRecord && this.props.onCommit) {
36
35
  const propertyValue = await this.getPropertyValue();
37
- // istanbul ignore else
38
36
  if (this._isMounted && propertyValue !== undefined) {
39
37
  this.props.onCommit({
40
38
  propertyRecord: this.props.propertyRecord,
@@ -48,7 +46,6 @@ export class ImageCheckBoxEditor extends React.PureComponent {
48
46
  async getPropertyValue() {
49
47
  const record = this.props.propertyRecord;
50
48
  let propertyValue;
51
- // istanbul ignore else
52
49
  if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {
53
50
  propertyValue = {
54
51
  valueFormat: PropertyValueFormat.Primitive,
@@ -85,13 +82,11 @@ export class ImageCheckBoxEditor extends React.PureComponent {
85
82
  let imageOn = "";
86
83
  let imageOff = "";
87
84
  let isDisabled = false;
88
- // istanbul ignore else
89
85
  if (propertyRecord &&
90
86
  propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {
91
87
  const primitiveValue = propertyRecord.value.value;
92
88
  checkboxValue = primitiveValue;
93
89
  }
94
- // istanbul ignore else
95
90
  if (propertyRecord && propertyRecord.isDisabled)
96
91
  isDisabled = propertyRecord.isDisabled;
97
92
  if (propertyRecord &&
@@ -99,7 +94,6 @@ export class ImageCheckBoxEditor extends React.PureComponent {
99
94
  propertyRecord.property.editor &&
100
95
  propertyRecord.property.editor.params) {
101
96
  const imageCheckBoxParams = propertyRecord.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.CheckBoxImages.valueOf());
102
- // istanbul ignore else
103
97
  if (imageCheckBoxParams) {
104
98
  imageOn = imageCheckBoxParams.imageOn;
105
99
  imageOff = imageCheckBoxParams.imageOff;
@@ -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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,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
+ {"version":3,"file":"ImageCheckBoxEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ImageCheckBoxEditor.tsx"],"names":[],"mapp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,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 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 if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n checkboxValue = primitiveValue as boolean;\n }\n\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 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 if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\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;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AGG;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;IAenE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,OAAO,CAAC,aAAa,CAUnB;IAEF,OAAO,CAAC,YAAY,CAelB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IA4D/B,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CAgC1C;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IACD,IAAoB,qBAAqB,IAAI,OAAO,CAGnD;CACF"}
@@ -26,10 +26,8 @@ export class NumericInputEditor extends React.PureComponent {
26
26
  readonly: false,
27
27
  };
28
28
  this._handleCommit = async () => {
29
- // istanbul ignore else
30
29
  if (this.props.propertyRecord && this.props.onCommit) {
31
30
  const propertyValue = await this.getPropertyValue();
32
- // istanbul ignore else
33
31
  if (propertyValue !== undefined) {
34
32
  this.props.onCommit({
35
33
  propertyRecord: this.props.propertyRecord,
@@ -39,8 +37,7 @@ export class NumericInputEditor extends React.PureComponent {
39
37
  }
40
38
  };
41
39
  this._updateValue = (value, _stringValue) => {
42
- const newValue = value !== undefined ? value : /* istanbul ignore next */ 0;
43
- // istanbul ignore else
40
+ const newValue = value !== undefined ? value : 0;
44
41
  if (this._isMounted)
45
42
  this.setState({
46
43
  value: newValue,
@@ -52,7 +49,6 @@ export class NumericInputEditor extends React.PureComponent {
52
49
  async getPropertyValue() {
53
50
  const record = this.props.propertyRecord;
54
51
  let propertyValue;
55
- // istanbul ignore else
56
52
  if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {
57
53
  propertyValue = {
58
54
  valueFormat: PropertyValueFormat.Primitive,
@@ -83,7 +79,6 @@ export class NumericInputEditor extends React.PureComponent {
83
79
  async setStateFromProps() {
84
80
  const record = this.props.propertyRecord;
85
81
  let initialValue = 0;
86
- // istanbul ignore else
87
82
  if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {
88
83
  initialValue = record.value.value;
89
84
  }
@@ -101,10 +96,8 @@ export class NumericInputEditor extends React.PureComponent {
101
96
  record.property.editor.params) {
102
97
  const editorSizeParams = record.property.editor.params.find((param) => param.type === PropertyEditorParamTypes.InputEditorSize.valueOf());
103
98
  if (editorSizeParams) {
104
- // istanbul ignore else
105
99
  if (editorSizeParams.size)
106
100
  size = editorSizeParams.size;
107
- // istanbul ignore else
108
101
  if (editorSizeParams.maxLength)
109
102
  maxLength = editorSizeParams.maxLength;
110
103
  }
@@ -116,7 +109,6 @@ export class NumericInputEditor extends React.PureComponent {
116
109
  precision = rangeParams.precision;
117
110
  }
118
111
  }
119
- // istanbul ignore else
120
112
  if (this._isMounted)
121
113
  this.setState({
122
114
  value: initialValue,
@@ -151,7 +143,6 @@ export class NumericInputPropertyEditor extends PropertyEditorBase {
151
143
  get reactNode() {
152
144
  return React.createElement(NumericInputEditor, null);
153
145
  }
154
- // istanbul ignore next
155
146
  get containerHandlesEnter() {
156
147
  // let input editor process enter key
157
148
  return false;