@itwin/components-react 4.2.1 → 4.3.0-dev.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 (246) hide show
  1. package/CHANGELOG.md +1 -8
  2. package/lib/cjs/components-react/common/DelayedSpinner.js +2 -3
  3. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  4. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +1 -2
  5. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  6. package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts +13 -0
  7. package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts.map +1 -0
  8. package/lib/cjs/components-react/common/UseElementsScrollStorage.js +49 -0
  9. package/lib/cjs/components-react/common/UseElementsScrollStorage.js.map +1 -0
  10. package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
  11. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  12. package/lib/cjs/components-react/converters/TypeConverter.js +1 -2
  13. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  14. package/lib/cjs/components-react/datepicker/DatePicker.scss +3 -3
  15. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.scss +3 -3
  16. package/lib/cjs/components-react/datepicker/TimeField.scss +3 -3
  17. package/lib/cjs/components-react/editors/BooleanEditor.scss +3 -3
  18. package/lib/cjs/components-react/editors/CustomNumberEditor.js +6 -8
  19. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  20. package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -3
  21. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  22. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.scss +3 -3
  23. package/lib/cjs/components-react/editors/IconEditor.scss +3 -3
  24. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.scss +3 -3
  25. package/lib/cjs/components-react/editors/PopupButton.js +3 -4
  26. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  27. package/lib/cjs/components-react/editors/PopupButton.scss +3 -3
  28. package/lib/cjs/components-react/editors/TextEditor.js +2 -4
  29. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  30. package/lib/cjs/components-react/editors/ToggleEditor.scss +3 -3
  31. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
  32. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  33. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +3 -3
  34. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -3
  35. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  36. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  37. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  38. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  39. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  40. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  41. package/lib/cjs/components-react/filtering/ResultSelector.scss +3 -3
  42. package/lib/cjs/components-react/iconpicker/IconPickerButton.scss +3 -3
  43. package/lib/cjs/components-react/properties/renderers/ActionButtonList.scss +3 -3
  44. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  45. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  46. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  47. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  48. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +3 -3
  49. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
  50. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  51. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +3 -3
  52. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  53. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  54. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.scss +3 -3
  55. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -2
  56. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  57. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
  58. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  59. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -2
  60. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  61. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  62. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  63. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  64. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  65. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  66. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  67. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  68. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  69. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  70. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  71. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +10 -0
  72. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  73. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +59 -55
  74. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  75. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -3
  76. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  77. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  78. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  79. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  80. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  81. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  82. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  83. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  84. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  85. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  86. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  87. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  88. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  89. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  90. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  91. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  92. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
  93. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  94. package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
  95. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  96. package/lib/cjs/components-react/selectable-content/SelectableContent.scss +3 -3
  97. package/lib/cjs/components-react/toolbar/ItemWrapper.scss +3 -3
  98. package/lib/cjs/components-react/toolbar/Items.scss +3 -3
  99. package/lib/cjs/components-react/toolbar/Overflow.scss +3 -3
  100. package/lib/cjs/components-react/toolbar/OverflowPanel.scss +3 -3
  101. package/lib/cjs/components-react/toolbar/PopupItem.scss +3 -3
  102. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +3 -4
  103. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  104. package/lib/cjs/components-react/toolbar/_variables.scss +3 -3
  105. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.scss +3 -3
  106. package/lib/cjs/components-react/toolbar/groupPanel/Column.scss +3 -3
  107. package/lib/cjs/components-react/toolbar/groupPanel/Columns.scss +3 -3
  108. package/lib/cjs/components-react/toolbar/groupPanel/Panel.scss +3 -3
  109. package/lib/cjs/components-react/toolbar/groupPanel/Title.scss +3 -3
  110. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.scss +3 -3
  111. package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
  112. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  113. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  114. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  115. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts +10 -0
  116. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  117. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +11 -1
  118. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  119. package/lib/cjs/components-react/tree/controlled/component/NodeContent.scss +3 -3
  120. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
  121. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  122. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +2 -4
  123. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  124. package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
  125. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  126. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
  127. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  128. package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts +13 -0
  129. package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts.map +1 -0
  130. package/lib/esm/components-react/common/UseElementsScrollStorage.js +45 -0
  131. package/lib/esm/components-react/common/UseElementsScrollStorage.js.map +1 -0
  132. package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
  133. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  134. package/lib/esm/components-react/converters/TypeConverter.js +1 -2
  135. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  136. package/lib/esm/components-react/datepicker/DatePicker.scss +3 -3
  137. package/lib/esm/components-react/datepicker/DatePickerPopupButton.scss +3 -3
  138. package/lib/esm/components-react/datepicker/TimeField.scss +3 -3
  139. package/lib/esm/components-react/editors/BooleanEditor.scss +3 -3
  140. package/lib/esm/components-react/editors/CustomNumberEditor.js +6 -8
  141. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  142. package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
  143. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  144. package/lib/esm/components-react/editors/EnumButtonGroupEditor.scss +3 -3
  145. package/lib/esm/components-react/editors/IconEditor.scss +3 -3
  146. package/lib/esm/components-react/editors/ImageCheckBoxEditor.scss +3 -3
  147. package/lib/esm/components-react/editors/PopupButton.js +3 -4
  148. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  149. package/lib/esm/components-react/editors/PopupButton.scss +3 -3
  150. package/lib/esm/components-react/editors/TextEditor.js +2 -4
  151. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  152. package/lib/esm/components-react/editors/ToggleEditor.scss +3 -3
  153. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  154. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  155. package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +3 -3
  156. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -3
  157. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  158. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  159. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  160. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  161. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  162. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  163. package/lib/esm/components-react/filtering/ResultSelector.scss +3 -3
  164. package/lib/esm/components-react/iconpicker/IconPickerButton.scss +3 -3
  165. package/lib/esm/components-react/properties/renderers/ActionButtonList.scss +3 -3
  166. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  167. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  168. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  169. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  170. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +3 -3
  171. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
  172. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  173. package/lib/esm/components-react/properties/renderers/PropertyView.scss +3 -3
  174. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  175. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  176. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.scss +3 -3
  177. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -2
  178. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  179. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
  180. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  181. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -2
  182. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  183. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  184. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  185. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  186. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  187. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  188. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  189. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  190. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  191. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  192. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  193. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +10 -0
  194. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  195. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +57 -54
  196. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  197. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -3
  198. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  199. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  200. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  201. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  202. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  203. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  204. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  205. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  206. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  207. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  208. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  209. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  210. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  211. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  212. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  213. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  214. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
  215. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  216. package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
  217. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  218. package/lib/esm/components-react/selectable-content/SelectableContent.scss +3 -3
  219. package/lib/esm/components-react/toolbar/ItemWrapper.scss +3 -3
  220. package/lib/esm/components-react/toolbar/Items.scss +3 -3
  221. package/lib/esm/components-react/toolbar/Overflow.scss +3 -3
  222. package/lib/esm/components-react/toolbar/OverflowPanel.scss +3 -3
  223. package/lib/esm/components-react/toolbar/PopupItem.scss +3 -3
  224. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +3 -4
  225. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  226. package/lib/esm/components-react/toolbar/_variables.scss +3 -3
  227. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.scss +3 -3
  228. package/lib/esm/components-react/toolbar/groupPanel/Column.scss +3 -3
  229. package/lib/esm/components-react/toolbar/groupPanel/Columns.scss +3 -3
  230. package/lib/esm/components-react/toolbar/groupPanel/Panel.scss +3 -3
  231. package/lib/esm/components-react/toolbar/groupPanel/Title.scss +3 -3
  232. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.scss +3 -3
  233. package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
  234. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  235. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  236. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  237. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts +10 -0
  238. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  239. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +9 -0
  240. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  241. package/lib/esm/components-react/tree/controlled/component/NodeContent.scss +3 -3
  242. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
  243. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  244. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +2 -4
  245. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  246. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAK+B;AAE/B,mEAGiC;AACjC,+CAAgF;AAEhF,uDAAoD;AAEpD,yDAAsD;AACtD,6EAA0E;AAC1E,+EAAgF;AAChF,wDAA4C;AAC5C,mDAA2D;AAmB3D;;GAEG;AACH,MAAa,cACX,SAAQ,KAAK,CAAC,aAAuD;IADvE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,cAAS,GAAG,KAAK,CAAC;QAClB,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAkC;YAC9D,KAAK,EAAE,IAAI,IAAI,EAAE;YACjB,SAAS,EAAE,KAAK;SACjB,CAAC;QA+CM,kBAAa,GAAG,CAAC,QAAc,EAAQ,EAAE;YAC/C,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;gBAC/C,uBAAuB;gBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;oBACxB,QAAQ,GAAG,IAAA,gCAAoB,EAC7B,QAAQ,EACR,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAClC,CAAC;iBACH;gBAED,KAAK,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;aACjE;QACH,CAAC,CAAC;QAEM,sBAAiB,GAAG,CAAC,IAAc,EAAQ,EAAE;YACnD,sCAAsC;YAC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,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,YAAY,EAAE,IAAI,CAAC,iBAAiB,GACpC,CACE,CACP,CACG,CACL;oBACH,oBAAC,kCAAoB,IACnB,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAC5B,CACW,CACH,CACV,CACP,CAAC;IACJ,CAAC;CACF;AAtTD,wCAsTC;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,0CAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,KAAK,GAAI,CAAC;IAC7C,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,kEAQC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,0CAAkB;IAC5D,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAC;IAC5C,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,wDAQC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,SAAS,EAC3B,2BAA2B,CAC5B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,QAAQ,EAC1B,sBAAsB,CACvB,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 \"./DateTimeEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n AlternateDateFormats,\n PropertyValueFormat,\n StandardTypeNames,\n TimeDisplay,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport type { TimeSpec } from \"../datepicker/TimeField\";\nimport { TimeField } from \"../datepicker/TimeField\";\nimport type { TypeConverter } from \"../converters/TypeConverter\";\nimport { DatePicker } from \"../datepicker/DatePicker\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { adjustDateToTimezone } from \"../common/DateUtils\";\n\n// cSpell:ignore datepicker\n\n/** @internal */\ninterface DateTimeEditorState {\n value: Date;\n displayValue?: string;\n timeDisplay?: TimeDisplay;\n isDisabled?: boolean;\n typeConverter?: TypeConverter;\n editInUtc: boolean;\n}\n\n/** @internal */\ninterface DateTimeEditorProps extends PropertyEditorProps {\n showTime?: boolean;\n}\n\n/** DateTimeEditor React component that is a property editor for selection of date and time.\n * @internal\n */\nexport class DateTimeEditor\n extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<DateTimeEditorState> = {\n value: new Date(),\n editInUtc: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: this.state.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.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n public async processDateChange(\n typeConverter: TypeConverter,\n newValue: Date\n ): Promise<void> {\n // istanbul ignore else\n if (this.props.propertyRecord) {\n const displayValue = await typeConverter.convertPropertyToString(\n this.props.propertyRecord.property,\n newValue\n );\n this.setState({\n value: newValue,\n displayValue,\n });\n }\n }\n\n private _handleChange = (newValue: Date): void => {\n // istanbul ignore else\n if (this._isMounted && this.state.typeConverter) {\n // istanbul ignore else\n if (this.state.editInUtc) {\n newValue = adjustDateToTimezone(\n newValue,\n newValue.getTimezoneOffset() * -1\n );\n }\n\n void this.processDateChange(this.state.typeConverter, newValue);\n }\n };\n\n private _handleTimeChange = (time: TimeSpec): void => {\n // Combine new time into selected Date\n if (this.state.editInUtc) {\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n } else {\n const newWorkingDate = new Date(this.state.value.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\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: Date | undefined;\n let typeConverter: TypeConverter | undefined;\n let timeDisplay: TimeDisplay | undefined;\n let alternateDateFormat = AlternateDateFormats.None;\n let editInUtc = false;\n\n // istanbul ignore else\n if (this.props.showTime) timeDisplay = TimeDisplay.H12MC;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n // istanbul ignore else\n if (record.value.value instanceof Date)\n initialValue = new Date(record.value.value);\n else if (typeof record.value.value === \"string\")\n initialValue = new Date(record.value.value);\n else if (record.value.value === undefined) initialValue = new Date();\n\n typeConverter = TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n );\n\n const options = record.property.converter?.options;\n if (options) {\n // istanbul ignore else\n if (\"alternateDateFormat\" in options) {\n // istanbul ignore else\n if (\n DateTimeTypeConverterBase.isAlternateDateFormats(\n options.alternateDateFormat\n )\n ) {\n timeDisplay = TimeDisplay.H24MS;\n alternateDateFormat = options.alternateDateFormat;\n }\n }\n\n if (\"timeDisplay\" in options && this.props.showTime) {\n timeDisplay = options.timeDisplay;\n // use 24 hr time display if alternateDateFormat is defined\n // istanbul ignore next\n if (\n alternateDateFormat &&\n timeDisplay !== TimeDisplay.H24MS &&\n timeDisplay !== TimeDisplay.H24M\n )\n timeDisplay = TimeDisplay.H24MS;\n }\n\n // istanbul ignore else\n if (alternateDateFormat) {\n editInUtc = true;\n\n if (this.props.showTime) {\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\n }\n } else {\n timeDisplay = undefined;\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\n alternateDateFormat = AlternateDateFormats.IsoShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\n alternateDateFormat = AlternateDateFormats.UtcShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\n }\n }\n }\n }\n\n // istanbul ignore next\n if (!initialValue) {\n throw new Error(\"Bad Value\");\n }\n\n // istanbul ignore next\n if (!typeConverter) {\n throw new Error(\"Unable to determine TypeConverter\");\n }\n\n const isDisabled = record && !!record.isDisabled;\n const displayValue = await typeConverter.convertPropertyToString(\n record!.property,\n initialValue\n );\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n isDisabled,\n timeDisplay,\n typeConverter,\n displayValue,\n editInUtc,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n // istanbul ignore next\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const date = this.state.editInUtc\n ? adjustDateToTimezone(this.state.value, 0)\n : this.state.value;\n const timeSpec: TimeSpec = {\n hours: date.getHours(),\n minutes: date.getMinutes(),\n seconds: date.getSeconds(),\n };\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-datetime-editor\",\n this.props.className\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.displayValue}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n >\n <PopupContent>\n <>\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker\n selected={date}\n onDateChange={this._handleChange}\n showFocusOutline={false}\n />\n {this.state.timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {\"Time\"}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={this.state.timeDisplay}\n onTimeChange={this._handleTimeChange}\n />\n </div>\n )}\n </div>\n </>\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={false} />;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class DateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={true} />;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.ShortDate,\n ShortDateTimePropertyEditor\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.DateTime,\n DateTimePropertyEditor\n);\n"]}
1
+ {"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAK+B;AAE/B,mEAGiC;AACjC,+CAAgF;AAEhF,uDAAoD;AAEpD,yDAAsD;AACtD,6EAA0E;AAC1E,+EAAgF;AAChF,wDAA4C;AAC5C,mDAA2D;AAmB3D;;GAEG;AACH,MAAa,cACX,SAAQ,KAAK,CAAC,aAAuD;IADvE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,cAAS,GAAG,KAAK,CAAC;QAClB,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,G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,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,wDAQC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,SAAS,EAC3B,2BAA2B,CAC5B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,QAAQ,EAC1B,sBAAsB,CACvB,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 \"./DateTimeEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n AlternateDateFormats,\n PropertyValueFormat,\n StandardTypeNames,\n TimeDisplay,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport type { TimeSpec } from \"../datepicker/TimeField\";\nimport { TimeField } from \"../datepicker/TimeField\";\nimport type { TypeConverter } from \"../converters/TypeConverter\";\nimport { DatePicker } from \"../datepicker/DatePicker\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { adjustDateToTimezone } from \"../common/DateUtils\";\n\n// cSpell:ignore datepicker\n\n/** @internal */\ninterface DateTimeEditorState {\n value: Date;\n displayValue?: string;\n timeDisplay?: TimeDisplay;\n isDisabled?: boolean;\n typeConverter?: TypeConverter;\n editInUtc: boolean;\n}\n\n/** @internal */\ninterface DateTimeEditorProps extends PropertyEditorProps {\n showTime?: boolean;\n}\n\n/** DateTimeEditor React component that is a property editor for selection of date and time.\n * @internal\n */\nexport class DateTimeEditor\n extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<DateTimeEditorState> = {\n value: new Date(),\n editInUtc: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: this.state.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.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n public async processDateChange(\n typeConverter: TypeConverter,\n newValue: Date\n ): Promise<void> {\n // istanbul ignore else\n if (this.props.propertyRecord) {\n const displayValue = await typeConverter.convertPropertyToString(\n this.props.propertyRecord.property,\n newValue\n );\n this.setState({\n value: newValue,\n displayValue,\n });\n }\n }\n\n private _handleChange = (newValue: Date): void => {\n // istanbul ignore else\n if (this._isMounted && this.state.typeConverter) {\n // istanbul ignore else\n if (this.state.editInUtc) {\n newValue = adjustDateToTimezone(\n newValue,\n newValue.getTimezoneOffset() * -1\n );\n }\n\n void this.processDateChange(this.state.typeConverter, newValue);\n }\n };\n\n private _handleTimeChange = (time: TimeSpec): void => {\n // Combine new time into selected Date\n if (this.state.editInUtc) {\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n } else {\n const newWorkingDate = new Date(this.state.value.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\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: Date | undefined;\n let typeConverter: TypeConverter | undefined;\n let timeDisplay: TimeDisplay | undefined;\n let alternateDateFormat = AlternateDateFormats.None;\n let editInUtc = false;\n\n // istanbul ignore else\n if (this.props.showTime) timeDisplay = TimeDisplay.H12MC;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n // istanbul ignore else\n if (record.value.value instanceof Date)\n initialValue = new Date(record.value.value);\n else if (typeof record.value.value === \"string\")\n initialValue = new Date(record.value.value);\n else if (record.value.value === undefined) initialValue = new Date();\n\n typeConverter = TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n );\n\n const options = record.property.converter?.options;\n if (options) {\n // istanbul ignore else\n if (\"alternateDateFormat\" in options) {\n // istanbul ignore else\n if (\n DateTimeTypeConverterBase.isAlternateDateFormats(\n options.alternateDateFormat\n )\n ) {\n timeDisplay = TimeDisplay.H24MS;\n alternateDateFormat = options.alternateDateFormat;\n }\n }\n\n if (\"timeDisplay\" in options && this.props.showTime) {\n timeDisplay = options.timeDisplay;\n // use 24 hr time display if alternateDateFormat is defined\n // istanbul ignore next\n if (\n alternateDateFormat &&\n timeDisplay !== TimeDisplay.H24MS &&\n timeDisplay !== TimeDisplay.H24M\n )\n timeDisplay = TimeDisplay.H24MS;\n }\n\n // istanbul ignore else\n if (alternateDateFormat) {\n editInUtc = true;\n\n if (this.props.showTime) {\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\n }\n } else {\n timeDisplay = undefined;\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\n alternateDateFormat = AlternateDateFormats.IsoShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\n alternateDateFormat = AlternateDateFormats.UtcShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\n }\n }\n }\n }\n\n // istanbul ignore next\n if (!initialValue) {\n throw new Error(\"Bad Value\");\n }\n\n // istanbul ignore next\n if (!typeConverter) {\n throw new Error(\"Unable to determine TypeConverter\");\n }\n\n const isDisabled = record && !!record.isDisabled;\n const displayValue = await typeConverter.convertPropertyToString(\n record!.property,\n initialValue\n );\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n isDisabled,\n timeDisplay,\n typeConverter,\n displayValue,\n editInUtc,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n // istanbul ignore next\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const date = this.state.editInUtc\n ? adjustDateToTimezone(this.state.value, 0)\n : this.state.value;\n const timeSpec: TimeSpec = {\n hours: date.getHours(),\n minutes: date.getMinutes(),\n seconds: date.getSeconds(),\n };\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-datetime-editor\",\n this.props.className\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.displayValue}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n >\n <PopupContent>\n <>\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker\n selected={date}\n onDateChange={this._handleChange}\n showFocusOutline={false}\n />\n {this.state.timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {\"Time\"}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={this.state.timeDisplay}\n onTimeChange={this._handleTimeChange}\n />\n </div>\n )}\n </div>\n </>\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={false} />;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class DateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={true} />;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.ShortDate,\n ShortDateTimePropertyEditor\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.DateTime,\n DateTimePropertyEditor\n);\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  $desktop-tool-stripe-width: 2px;
7
7
  $desktop-tool-stripe-height: 22px;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
6
 
7
7
  $components-color-editor-item-height: 100%;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  $image-checkbox-size: 32px;
7
7
 
@@ -85,10 +85,9 @@ class PopupButton extends React.PureComponent {
85
85
  }
86
86
  /** @internal */
87
87
  render() {
88
- var _a, _b, _c;
89
- const showArrow = (_a = this.props.showArrow) !== null && _a !== void 0 ? _a : false;
90
- const showShadow = (_b = this.props.showShadow) !== null && _b !== void 0 ? _b : false;
91
- const moveFocus = (_c = this.props.moveFocus) !== null && _c !== void 0 ? _c : true;
88
+ const showArrow = this.props.showArrow ?? false;
89
+ const showShadow = this.props.showShadow ?? false;
90
+ const moveFocus = this.props.moveFocus ?? true;
92
91
  const showPlaceholder = this.props.label === undefined && this.props.placeholder !== undefined;
93
92
  const classNames = (0, classnames_1.default)("components-popup-button", this.state.showPopup && "components-popup-expanded");
94
93
  const valueClassNames = (0, classnames_1.default)("components-popup-button-value", showPlaceholder && "components-popup-button-placeholder");
@@ -1 +1 @@
1
- {"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAqE;AAErE,kDAA6D;AAC7D,wDAA8C;AAC9C,oEAIoC;AA0CpC;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,aAGtC;IAHD;;QAIU,eAAU,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAEvD,gBAAgB;QACS,UAAK,GAA+B;YAC3D,SAAS,EAAE,KAAK;SACjB,CAAC;QAQM,iBAAY,GAAG,CAAC,KAAuB,EAAE,EAAE;YACjD,IAAI,CAAC,QAAQ,CACX,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,EACpD,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CACtD,CAAC;QACJ,CAAC,CAAC;QAMM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE;gBACvC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBAE3C,uBAAuB;gBACvB,IAAI,IA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,KAAK,CAAC,WAAW,IAElC,IAAI,CAAC,KAAK,CAAC,QAAQ,CACd,CACJ,CACP,CAAC;IACJ,CAAC;CACF;AAjHD,kCAiHC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAqB;IAChD,OAAO,oBAAC,gBAAG,OAAK,KAAK,EAAE,aAAa,EAAC,iCAAiC,GAAG,CAAC;AAC5E,CAAC;AAFD,oCAEC;AAUD;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAoB;IACvD,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,sBAAM,IACL,SAAS,EAAE,IAAA,oBAAU,EACnB,+BAA+B,EAC/B,4BAA4B,CAC7B,iBACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,mBAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EACpC,OAAO,EAAE,KAAK,CAAC,IAAI;YAEnB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,kCAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,sBAAM,IACL,SAAS,EAAE,IAAA,oBAAU,EACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,mBAAM,CAAC,SAAS,CAAC,eAAe,CAAC,EACxC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAEvB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,+BAAS,OAAG,GAAI,CAC1B,CACL,CACP,CAAC;AACJ,CAAC;AA5BD,oDA4BC","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 \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup, UiCore } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n /** @internal */\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n // istanbul ignore else\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n // istanbul ignore else\n if (\n (event.key === SpecialKey.ArrowDown ||\n event.key === SpecialKey.Space ||\n event.key === SpecialKey.Enter) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\nexport function PopupContent(props: CommonDivProps) {\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={UiCore.translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={UiCore.translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAqE;AAErE,kDAA6D;AAC7D,wDAA8C;AAC9C,oEAIoC;AA0CpC;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK,CAAC,aAGtC;IAHD;;QAIU,eAAU,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAEvD,gBAAgB;QACS,UAAK,GAA+B;YAC3D,SAAS,EAAE,KAAK;SACjB,CAAC;QAQM,iBAAY,GAAG,CAAC,KAAuB,EAAE,EAAE;YACjD,IAAI,CAAC,QAAQ,CACX,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,EACpD,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,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;AA5BD,oDA4BC","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 \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup, UiCore } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n /** @internal */\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n // istanbul ignore else\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n // istanbul ignore else\n if (\n (event.key === SpecialKey.ArrowDown ||\n event.key === SpecialKey.Space ||\n event.key === SpecialKey.Enter) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\nexport function PopupContent(props: CommonDivProps) {\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={UiCore.translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={UiCore.translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/icons/variables";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/inputs/variables";
7
7
  @import "~@itwin/core-react/lib/cjs/core-react/style/baseline";
@@ -77,12 +77,11 @@ class TextEditor extends React.PureComponent {
77
77
  };
78
78
  }
79
79
  async getPropertyValue() {
80
- var _a;
81
80
  const record = this.props.propertyRecord;
82
81
  let propertyValue;
83
82
  // istanbul ignore else
84
83
  if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
85
- propertyValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, (_a = record.property.converter) === null || _a === void 0 ? void 0 : _a.name).convertFromStringToPropertyValue(this.state.inputValue, record);
84
+ propertyValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertFromStringToPropertyValue(this.state.inputValue, record);
86
85
  propertyValue.displayValue = this.state.inputValue;
87
86
  }
88
87
  return propertyValue;
@@ -109,13 +108,12 @@ class TextEditor extends React.PureComponent {
109
108
  }
110
109
  }
111
110
  async setStateFromProps() {
112
- var _a;
113
111
  const record = this.props.propertyRecord;
114
112
  let initialValue = "";
115
113
  // istanbul ignore else
116
114
  if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
117
115
  const value = record.value.value;
118
- initialValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, (_a = record.property.converter) === null || _a === void 0 ? void 0 : _a.name).convertPropertyToString(record.property, value);
116
+ initialValue = await TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, value);
119
117
  }
120
118
  const readonly = record && undefined !== record.isReadonly ? record.isReadonly : false;
121
119
  let size;
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAG+B;AAC/B,kDAAoD;AAEpD,wDAA6C;AAC7C,6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ACvB,MAAM,IAAI,GAAG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAI,CAAC;YACrD,SAAS,GAAG,CACV,oBAAC,sBAAS,OACJ,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,IAAI,iBACE,wBAAwB,GACpC,CACH,CAAC;SACH;aAAM;YACL,SAAS,GAAG,CACV,oBAAC,qBAAK,OACA,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,iBACX,wBAAwB,EACpC,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA9LD,gCA8LC","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 \"./TextEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport type { InputProps } from \"@itwin/itwinui-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface TextEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** TextEditor React component that is a property editor with text input\n * @public\n */\nexport class TextEditor\n extends React.PureComponent<PropertyEditorProps, TextEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.text\");\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextEditorState> = {\n inputValue: \"\",\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\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 private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n inputValue: e.target.value,\n },\n async () => {\n if (\n this.props.shouldCommitOnChange &&\n this.props.onCommit &&\n this.props.propertyRecord\n ) {\n const newValue = await this.getPropertyValue();\n // istanbul ignore else\n if (newValue)\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\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 const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n iconSpec,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-text-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const inputProps: InputProps = {\n type: \"text\",\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onBlur: this.props.onBlur,\n onChange: this._updateInputValue,\n setFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n inputProps[\"aria-label\"] = this._ariaLabel;\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-text-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-text-editor\"\n size=\"small\"\n />\n );\n }\n\n return reactNode;\n }\n}\n"]}
1
+ {"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAG+B;AAC/B,kDAAoD;AAEpD,wDAA6C;AAC7C,6EAA0E;AAE1E,kDAA+C;AAY/C;;GAEG;AACH,MAAa,UACX,SAAQ,KAAK,CAAC,aAAmD;IADnE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACnD,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAA8B;YAC1D,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,KAAK;SAChB,CAAC;QA0BM,sBAAiB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACrE,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU;gBACjB,IAAI,CAAC,QAAQ,CACX;oBACE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;iBAC3B,EACD,KAAK,IAAI,EAAE;oBACT,IACE,IAAI,CAAC,KAAK,CAAC,oBAAoB;wBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ;wBACnB,IAAI,CAAC,KAAK,CAAC,cAAc,EACzB;wBACA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;wBAC/C,uBAAuB;wBACvB,IAAI,QAAQ;4BACV,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;gCAClB,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc;gCACzC,QAAQ;6BACT,CAAC,CAAC;qBACN;gBACH,CAAC,CACF,CAAC;QACN,CAAC,CAAC;IAiIJ,CAAC;IAhLQ,KAAK,CAAC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CAAC,iBAAiB;YAChC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;SACxD,CAAC;QAEF,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAE3C,IAAI,SAA0B,CAAC;QAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,MAAM,IAAI,GAAG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAI,CAAC;YACrD,SAAS,GAAG,CACV,oBAAC,sBAAS,OACJ,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,IAAI,iBACE,wBAAwB,GACpC,CACH,CAAC;SACH;aAAM;YACL,SAAS,GAAG,CACV,oBAAC,qBAAK,OACA,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,iBACX,wBAAwB,EACpC,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA9LD,gCA8LC","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 \"./TextEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport type { InputProps } from \"@itwin/itwinui-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface TextEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** TextEditor React component that is a property editor with text input\n * @public\n */\nexport class TextEditor\n extends React.PureComponent<PropertyEditorProps, TextEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.text\");\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextEditorState> = {\n inputValue: \"\",\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\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 private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n inputValue: e.target.value,\n },\n async () => {\n if (\n this.props.shouldCommitOnChange &&\n this.props.onCommit &&\n this.props.propertyRecord\n ) {\n const newValue = await this.getPropertyValue();\n // istanbul ignore else\n if (newValue)\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\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 const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n iconSpec,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-text-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const inputProps: InputProps = {\n type: \"text\",\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onBlur: this.props.onBlur,\n onChange: this._updateInputValue,\n setFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n inputProps[\"aria-label\"] = this._ariaLabel;\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-text-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-text-editor\"\n size=\"small\"\n />\n );\n }\n\n return reactNode;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  .components-property-list--horizontal {
6
6
  .components-toggle-editor {
7
7
  margin-left: var(--iui-size-2xs); // Clear the resizer in the PropertyGrid
@@ -39,12 +39,12 @@ const PropertyList_1 = require("../propertygrid/component/PropertyList");
39
39
  * @alpha
40
40
  */
41
41
  function FavoritePropertyList(props) {
42
- var _a, _b;
43
42
  const [listWidth, setListWidth] = React.useState();
44
43
  const onListResize = React.useCallback(setListWidth, [setListWidth]);
45
44
  if (props.propertyData.records.Favorite !== undefined) {
46
- const propertyValueRendererManager = (_a = props.propertyValueRendererManager) !== null && _a !== void 0 ? _a : ValueRendererManager_1.PropertyValueRendererManager.defaultManager;
47
- const orientation = (_b = props.orientation) !== null && _b !== void 0 ? _b : core_react_1.Orientation.Horizontal;
45
+ const propertyValueRendererManager = props.propertyValueRendererManager ??
46
+ ValueRendererManager_1.PropertyValueRendererManager.defaultManager;
47
+ const orientation = props.orientation ?? core_react_1.Orientation.Horizontal;
48
48
  return (React.createElement("div", { className: "components-favorite-property-list" },
49
49
  React.createElement(core_react_1.ResizableContainerObserver, { onResize: onListResize }),
50
50
  listWidth ? (React.createElement(PropertyList_1.PropertyList, { orientation: orientation, width: listWidth, properties: props.propertyData.records.Favorite, columnRatio: 1 / 3, propertyValueRendererManager: propertyValueRendererManager })) : null));
@@ -1 +1 @@
1
- {"version":3,"file":"FavoritePropertyList.js","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAA4E;AAC5E,6EAAkF;AAClF,yEAAsE;AAYtE;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAgC;;IACnE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IACvE,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;QACrD,MAAM,4BAA4B,GAChC,MAAA,KAAK,CAAC,4BAA4B,mCAClC,mDAA4B,CAAC,cAAc,CAAC;QAC9C,MAAM,WAAW,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,wBAAW,CAAC,UAAU,CAAC;QAChE,OAAO,CACL,6BAAK,SAAS,EAAC,mCAAmC;YAChD,oBAAC,uCAA0B,IAAC,QAAQ,EAAE,YAAY,GAAI;YACrD,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,2BAAY,IACX,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,EAC/C,WAAW,EAAE,CAAC,GAAG,CAAC,EAClB,4BAA4B,EAAE,4BAA4B,GAC1D,CACH,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAxBD,oDAwBC","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 Favorite\n */\n\nimport * as React from \"react\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\nimport { PropertyValueRendererManager } from \"../properties/ValueRendererManager\";\nimport { PropertyList } from \"../propertygrid/component/PropertyList\";\nimport type { PropertyData } from \"../propertygrid/PropertyDataProvider\";\n\n/** Properties for [[FavoritePropertyList]] React component\n * @alpha\n */\nexport interface FavoritePropertyListProps {\n propertyData: PropertyData;\n propertyValueRendererManager?: PropertyValueRendererManager;\n orientation?: Orientation;\n}\n\n/** Favorite Property List React component\n * @alpha\n */\nexport function FavoritePropertyList(props: FavoritePropertyListProps) {\n const [listWidth, setListWidth] = React.useState<number | undefined>();\n const onListResize = React.useCallback(setListWidth, [setListWidth]);\n if (props.propertyData.records.Favorite !== undefined) {\n const propertyValueRendererManager =\n props.propertyValueRendererManager ??\n PropertyValueRendererManager.defaultManager;\n const orientation = props.orientation ?? Orientation.Horizontal;\n return (\n <div className=\"components-favorite-property-list\">\n <ResizableContainerObserver onResize={onListResize} />\n {listWidth ? (\n <PropertyList\n orientation={orientation}\n width={listWidth}\n properties={props.propertyData.records.Favorite}\n columnRatio={1 / 3}\n propertyValueRendererManager={propertyValueRendererManager}\n />\n ) : null}\n </div>\n );\n }\n return null;\n}\n"]}
1
+ {"version":3,"file":"FavoritePropertyList.js","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAA4E;AAC5E,6EAAkF;AAClF,yEAAsE;AAYtE;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAgC;IACnE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IACvE,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;QACrD,MAAM,4BAA4B,GAChC,KAAK,CAAC,4BAA4B;YAClC,mDAA4B,CAAC,cAAc,CAAC;QAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,wBAAW,CAAC,UAAU,CAAC;QAChE,OAAO,CACL,6BAAK,SAAS,EAAC,mCAAmC;YAChD,oBAAC,uCAA0B,IAAC,QAAQ,EAAE,YAAY,GAAI;YACrD,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,2BAAY,IACX,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,EAC/C,WAAW,EAAE,CAAC,GAAG,CAAC,EAClB,4BAA4B,EAAE,4BAA4B,GAC1D,CACH,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAxBD,oDAwBC","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 Favorite\n */\n\nimport * as React from \"react\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\nimport { PropertyValueRendererManager } from \"../properties/ValueRendererManager\";\nimport { PropertyList } from \"../propertygrid/component/PropertyList\";\nimport type { PropertyData } from \"../propertygrid/PropertyDataProvider\";\n\n/** Properties for [[FavoritePropertyList]] React component\n * @alpha\n */\nexport interface FavoritePropertyListProps {\n propertyData: PropertyData;\n propertyValueRendererManager?: PropertyValueRendererManager;\n orientation?: Orientation;\n}\n\n/** Favorite Property List React component\n * @alpha\n */\nexport function FavoritePropertyList(props: FavoritePropertyListProps) {\n const [listWidth, setListWidth] = React.useState<number | undefined>();\n const onListResize = React.useCallback(setListWidth, [setListWidth]);\n if (props.propertyData.records.Favorite !== undefined) {\n const propertyValueRendererManager =\n props.propertyValueRendererManager ??\n PropertyValueRendererManager.defaultManager;\n const orientation = props.orientation ?? Orientation.Horizontal;\n return (\n <div className=\"components-favorite-property-list\">\n <ResizableContainerObserver onResize={onListResize} />\n {listWidth ? (\n <PropertyList\n orientation={orientation}\n width={listWidth}\n properties={props.propertyData.records.Favorite}\n columnRatio={1 / 3}\n propertyValueRendererManager={propertyValueRendererManager}\n />\n ) : null}\n </div>\n );\n }\n return null;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .rule {
7
7
  display: grid;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .filter-builder > .rule-group {
7
7
  & > .rule-group-content {
@@ -39,10 +39,9 @@ const Operators_1 = require("./Operators");
39
39
  * @internal
40
40
  */
41
41
  function PropertyFilterBuilderRuleOperator(props) {
42
- var _a;
43
42
  const { operator, property, onChange } = props;
44
43
  const availableOperators = React.useMemo(() => (0, Operators_1.getPropertyFilterOperators)(property), [property]);
45
- const selectedOperator = (_a = availableOperators.find((op) => op === operator)) !== null && _a !== void 0 ? _a : availableOperators[0];
44
+ const selectedOperator = availableOperators.find((op) => op === operator) ?? availableOperators[0];
46
45
  React.useEffect(() => {
47
46
  onChange(selectedOperator);
48
47
  }, [onChange, selectedOperator]);
@@ -1 +1 @@
1
- {"version":3,"file":"FilterBuilderRuleOperator.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleOperator.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,wDAA8C;AAE9C,2CAGqB;AAerB;;;GAGG;AACH,SAAgB,iCAAiC,CAC/C,KAA6C;;IAE7C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE/C,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CACtC,GAAG,EAAE,CAAC,IAAA,sCAA0B,EAAC,QAAQ,CAAC,EAC1C,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,MAAM,gBAAgB,GACpB,MAAA,kBAAkB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,mCAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAE5E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEjC,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CACpC,GAAG,EAAE,CACH,kBAAkB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9B,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,IAAA,0CAA8B,EAAC,EAAE,CAAC;KAC1C,CAAC,CAAC,EACL,CAAC,kBAAkB,CAAC,CACrB,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,eAAe;QAC5B,oBAAC,sBAAM,IACL,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACE,CACP,CAAC;AACJ,CAAC;AAnCD,8EAmCC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport { Select } from \"@itwin/itwinui-react\";\nimport type { PropertyFilterRuleOperator } from \"./Operators\";\nimport {\n getPropertyFilterOperatorLabel,\n getPropertyFilterOperators,\n} from \"./Operators\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleOperator]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRuleOperatorProps {\n /** Currently selected operator. */\n operator?: PropertyFilterRuleOperator;\n /** Property used in rule for which this operator will be used. */\n property: PropertyDescription;\n /** Callback that is invoked when selected operator changes. */\n onChange: (operator: PropertyFilterRuleOperator) => void;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] operator selector.\n * @internal\n */\nexport function PropertyFilterBuilderRuleOperator(\n props: PropertyFilterBuilderRuleOperatorProps\n) {\n const { operator, property, onChange } = props;\n\n const availableOperators = React.useMemo(\n () => getPropertyFilterOperators(property),\n [property]\n );\n const selectedOperator =\n availableOperators.find((op) => op === operator) ?? availableOperators[0];\n\n React.useEffect(() => {\n onChange(selectedOperator);\n }, [onChange, selectedOperator]);\n\n const availableOptions = React.useMemo(\n () =>\n availableOperators.map((op) => ({\n value: op,\n label: getPropertyFilterOperatorLabel(op),\n })),\n [availableOperators]\n );\n\n return (\n <div className=\"rule-operator\">\n <Select\n options={availableOptions}\n value={selectedOperator}\n onChange={onChange}\n size=\"small\"\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"FilterBuilderRuleOperator.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleOperator.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,wDAA8C;AAE9C,2CAGqB;AAerB;;;GAGG;AACH,SAAgB,iCAAiC,CAC/C,KAA6C;IAE7C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE/C,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CACtC,GAAG,EAAE,CAAC,IAAA,sCAA0B,EAAC,QAAQ,CAAC,EAC1C,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,MAAM,gBAAgB,GACpB,kBAAkB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAE5E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEjC,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CACpC,GAAG,EAAE,CACH,kBAAkB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9B,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,IAAA,0CAA8B,EAAC,EAAE,CAAC;KAC1C,CAAC,CAAC,EACL,CAAC,kBAAkB,CAAC,CACrB,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,eAAe;QAC5B,oBAAC,sBAAM,IACL,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACE,CACP,CAAC;AACJ,CAAC;AAnCD,8EAmCC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport { Select } from \"@itwin/itwinui-react\";\nimport type { PropertyFilterRuleOperator } from \"./Operators\";\nimport {\n getPropertyFilterOperatorLabel,\n getPropertyFilterOperators,\n} from \"./Operators\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleOperator]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRuleOperatorProps {\n /** Currently selected operator. */\n operator?: PropertyFilterRuleOperator;\n /** Property used in rule for which this operator will be used. */\n property: PropertyDescription;\n /** Callback that is invoked when selected operator changes. */\n onChange: (operator: PropertyFilterRuleOperator) => void;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] operator selector.\n * @internal\n */\nexport function PropertyFilterBuilderRuleOperator(\n props: PropertyFilterBuilderRuleOperatorProps\n) {\n const { operator, property, onChange } = props;\n\n const availableOperators = React.useMemo(\n () => getPropertyFilterOperators(property),\n [property]\n );\n const selectedOperator =\n availableOperators.find((op) => op === operator) ?? availableOperators[0];\n\n React.useEffect(() => {\n onChange(selectedOperator);\n }, [onChange, selectedOperator]);\n\n const availableOptions = React.useMemo(\n () =>\n availableOperators.map((op) => ({\n value: op,\n label: getPropertyFilterOperatorLabel(op),\n })),\n [availableOperators]\n );\n\n return (\n <div className=\"rule-operator\">\n <Select\n options={availableOptions}\n value={selectedOperator}\n onChange={onChange}\n size=\"small\"\n />\n </div>\n );\n}\n"]}
@@ -49,8 +49,8 @@ function PropertyFilterBuilderRuleProperty(props) {
49
49
  onSelectedPropertyChanged(properties.find((property) => property.name === name));
50
50
  }, [properties, onSelectedPropertyChanged]);
51
51
  React.useEffect(() => {
52
- const currentSelectedProperty = properties.find((property) => property.name === (selectedProperty === null || selectedProperty === void 0 ? void 0 : selectedProperty.name));
53
- if ((currentSelectedProperty === null || currentSelectedProperty === void 0 ? void 0 : currentSelectedProperty.name) !== (selectedProperty === null || selectedProperty === void 0 ? void 0 : selectedProperty.name))
52
+ const currentSelectedProperty = properties.find((property) => property.name === selectedProperty?.name);
53
+ if (currentSelectedProperty?.name !== selectedProperty?.name)
54
54
  onSelectedPropertyChanged(currentSelectedProperty);
55
55
  }, [properties, selectedProperty, onSelectedPropertyChanged]);
56
56
  const itemRenderer = React.useCallback((selectOption, { isSelected, id }) => {
@@ -59,7 +59,7 @@ function PropertyFilterBuilderRuleProperty(props) {
59
59
  : selectOption.label));
60
60
  }, [propertyRenderer]);
61
61
  return (React.createElement("div", { className: "rule-property" },
62
- React.createElement(itwinui_react_1.ComboBox, { options: selectOptions, onChange: onPropertyChanged, value: selectedProperty === null || selectedProperty === void 0 ? void 0 : selectedProperty.name, inputProps: {
62
+ React.createElement(itwinui_react_1.ComboBox, { options: selectOptions, onChange: onPropertyChanged, value: selectedProperty?.name, inputProps: {
63
63
  placeholder: UiComponents_1.UiComponents.translate("filterBuilder.chooseProperty"),
64
64
  disabled: isDisabled,
65
65
  size: "small",
@@ -1 +1 @@
1
- {"version":3,"file":"FilterBuilderRuleProperty.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleProperty.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAA0D;AAC1D,kDAA+C;AAmB/C;;;GAGG;AACH,SAAgB,iCAAiC,CAC/C,KAA6C;IAE7C,MAAM,EACJ,gBAAgB,EAChB,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,GACX,GAAG,KAAK,CAAC;IAEV,MAAM,aAAa,GA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AAgB;YACf,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC;YACtC,CAAC,CAAC,YAAY,CAAC,KAAK,CACb,CACZ,CAAC;IACJ,CAAC,EACD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,eAAe;QAC5B,oBAAC,wBAAQ,IACP,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,EAC7B,UAAU,EAAE;gBACV,WAAW,EAAE,2BAAY,CAAC,SAAS,CAAC,8BAA8B,CAAC;gBACnE,QAAQ,EAAE,UAAU;gBACpB,IAAI,EAAE,OAAO;aACd,EACD,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,IAAI,GAC1B,CACE,CACP,CAAC;AACJ,CAAC;AArED,8EAqEC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport type { ComboBoxProps, SelectOption } from \"@itwin/itwinui-react\";\nimport { ComboBox, MenuItem } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleProperty]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRulePropertyProps {\n /** List of available properties. */\n properties: PropertyDescription[];\n /** Currently selected property. */\n selectedProperty?: PropertyDescription;\n /** Callback that is invoked when selected property changes. */\n onSelectedPropertyChanged: (property?: PropertyDescription) => void;\n /** Custom renderer for property item inside selector. */\n propertyRenderer?: (name: string) => React.ReactNode;\n /** Specifies whether selector should be disabled or not. */\n isDisabled?: boolean;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] property selector.\n * @internal\n */\nexport function PropertyFilterBuilderRuleProperty(\n props: PropertyFilterBuilderRulePropertyProps\n) {\n const {\n selectedProperty,\n properties,\n onSelectedPropertyChanged,\n propertyRenderer,\n isDisabled,\n } = props;\n\n const selectOptions = React.useMemo<SelectOption<string>[]>(\n () =>\n properties.map((property) => ({\n id: property.name,\n label: property.displayLabel,\n value: property.name,\n })),\n [properties]\n );\n\n const onPropertyChanged = React.useCallback(\n (name: string) => {\n onSelectedPropertyChanged(\n properties.find((property) => property.name === name)\n );\n },\n [properties, onSelectedPropertyChanged]\n );\n\n React.useEffect(() => {\n const currentSelectedProperty = properties.find(\n (property) => property.name === selectedProperty?.name\n );\n if (currentSelectedProperty?.name !== selectedProperty?.name)\n onSelectedPropertyChanged(currentSelectedProperty);\n }, [properties, selectedProperty, onSelectedPropertyChanged]);\n\n const itemRenderer = React.useCallback<\n Required<ComboBoxProps<string>>[\"itemRenderer\"]\n >(\n (selectOption, { isSelected, id }) => {\n return (\n <MenuItem key={id} id={id} isSelected={isSelected}>\n {propertyRenderer\n ? propertyRenderer(selectOption.value)\n : selectOption.label}\n </MenuItem>\n );\n },\n [propertyRenderer]\n );\n\n return (\n <div className=\"rule-property\">\n <ComboBox\n options={selectOptions}\n onChange={onPropertyChanged}\n value={selectedProperty?.name}\n inputProps={{\n placeholder: UiComponents.translate(\"filterBuilder.chooseProperty\"),\n disabled: isDisabled,\n size: \"small\",\n }}\n itemRenderer={itemRenderer}\n enableVirtualization={true}\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"FilterBuilderRuleProperty.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleProperty.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAA0D;AAC1D,kDAA+C;AAmB/C;;;GAGG;AACH,SAAgB,iCAAiC,CAC/C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UAAU,IAC9C,gBAAgB;YACf,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC;YACtC,CAAC,CAAC,YAAY,CAAC,KAAK,CACb,CACZ,CAAC;IACJ,CAAC,EACD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,eAAe;QAC5B,oBAAC,wBAAQ,IACP,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAC7B,UAAU,EAAE;gBACV,WAAW,EAAE,2BAAY,CAAC,SAAS,CAAC,8BAA8B,CAAC;gBACnE,QAAQ,EAAE,UAAU;gBACpB,IAAI,EAAE,OAAO;aACd,EACD,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,IAAI,GAC1B,CACE,CACP,CAAC;AACJ,CAAC;AArED,8EAqEC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport type { ComboBoxProps, SelectOption } from \"@itwin/itwinui-react\";\nimport { ComboBox, MenuItem } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleProperty]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRulePropertyProps {\n /** List of available properties. */\n properties: PropertyDescription[];\n /** Currently selected property. */\n selectedProperty?: PropertyDescription;\n /** Callback that is invoked when selected property changes. */\n onSelectedPropertyChanged: (property?: PropertyDescription) => void;\n /** Custom renderer for property item inside selector. */\n propertyRenderer?: (name: string) => React.ReactNode;\n /** Specifies whether selector should be disabled or not. */\n isDisabled?: boolean;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] property selector.\n * @internal\n */\nexport function PropertyFilterBuilderRuleProperty(\n props: PropertyFilterBuilderRulePropertyProps\n) {\n const {\n selectedProperty,\n properties,\n onSelectedPropertyChanged,\n propertyRenderer,\n isDisabled,\n } = props;\n\n const selectOptions = React.useMemo<SelectOption<string>[]>(\n () =>\n properties.map((property) => ({\n id: property.name,\n label: property.displayLabel,\n value: property.name,\n })),\n [properties]\n );\n\n const onPropertyChanged = React.useCallback(\n (name: string) => {\n onSelectedPropertyChanged(\n properties.find((property) => property.name === name)\n );\n },\n [properties, onSelectedPropertyChanged]\n );\n\n React.useEffect(() => {\n const currentSelectedProperty = properties.find(\n (property) => property.name === selectedProperty?.name\n );\n if (currentSelectedProperty?.name !== selectedProperty?.name)\n onSelectedPropertyChanged(currentSelectedProperty);\n }, [properties, selectedProperty, onSelectedPropertyChanged]);\n\n const itemRenderer = React.useCallback<\n Required<ComboBoxProps<string>>[\"itemRenderer\"]\n >(\n (selectOption, { isSelected, id }) => {\n return (\n <MenuItem key={id} id={id} isSelected={isSelected}>\n {propertyRenderer\n ? propertyRenderer(selectOption.value)\n : selectOption.label}\n </MenuItem>\n );\n },\n [propertyRenderer]\n );\n\n return (\n <div className=\"rule-property\">\n <ComboBox\n options={selectOptions}\n onChange={onPropertyChanged}\n value={selectedProperty?.name}\n inputProps={{\n placeholder: UiComponents.translate(\"filterBuilder.chooseProperty\"),\n disabled: isDisabled,\n size: \"small\",\n }}\n itemRenderer={itemRenderer}\n enableVirtualization={true}\n />\n </div>\n );\n}\n"]}
@@ -41,7 +41,7 @@ const EditorContainer_1 = require("../editors/EditorContainer");
41
41
  function PropertyFilterBuilderRuleValue(props) {
42
42
  const { value, property, onChange } = props;
43
43
  const propertyRecord = React.useMemo(() => {
44
- return new appui_abstract_1.PropertyRecord(value !== null && value !== void 0 ? value : { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive }, property);
44
+ return new appui_abstract_1.PropertyRecord(value ?? { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive }, property);
45
45
  }, [value, property]);
46
46
  const onValueChange = React.useCallback(({ newValue }) => {
47
47
  onChange(newValue);
@@ -1 +1 @@
1
- {"version":3,"file":"FilterBuilderRuleValue.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleValue.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4E;AAE5E,gEAA6D;AAe7D;;;GAGG;AACH,SAAgB,8BAA8B,CAC5C,KAA0C;IAE1C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE5C,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,IAAI,+BAAc,CACvB,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,WAAW,EAAE,oCAAmB,CAAC,SAAS,EAAE,EACvD,QAAQ,CACT,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtB,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACrC,CAAC,EAAE,QAAQ,EAAuB,EAAE,EAAE;QACpC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,YAAY;QACzB,oBAAC,iCAAe,IACd,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAE,CAAC,EAC7C,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,KAAK,EACf,oBAAoB,EAAE,IAAI,GAC1B,CACE,CACP,CAAC;AACJ,CAAC;AA9BD,wEA8BC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"../editors/EditorContainer\";\nimport { EditorContainer } from \"../editors/EditorContainer\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleValue]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRuleValueProps {\n /** Currently entered value. */\n value?: PropertyValue;\n /** Property used in rule to which this value will be compared to. */\n property: PropertyDescription;\n /** Callback that is invoked when value changes. */\n onChange: (value: PropertyValue) => void;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] value input.\n * @internal\n */\nexport function PropertyFilterBuilderRuleValue(\n props: PropertyFilterBuilderRuleValueProps\n) {\n const { value, property, onChange } = props;\n\n const propertyRecord = React.useMemo(() => {\n return new PropertyRecord(\n value ?? { valueFormat: PropertyValueFormat.Primitive },\n property\n );\n }, [value, property]);\n\n const onValueChange = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <div className=\"rule-value\">\n <EditorContainer\n propertyRecord={propertyRecord}\n onCancel={/* istanbul ignore next */ () => {}}\n onCommit={onValueChange}\n setFocus={false}\n shouldCommitOnChange={true}\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"FilterBuilderRuleValue.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleValue.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4E;AAE5E,gEAA6D;AAe7D;;;GAGG;AACH,SAAgB,8BAA8B,CAC5C,KAA0C;IAE1C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE5C,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,IAAI,+BAAc,CACvB,KAAK,IAAI,EAAE,WAAW,EAAE,oCAAmB,CAAC,SAAS,EAAE,EACvD,QAAQ,CACT,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtB,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACrC,CAAC,EAAE,QAAQ,EAAuB,EAAE,EAAE;QACpC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,YAAY;QACzB,oBAAC,iCAAe,IACd,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAE,CAAC,EAC7C,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,KAAK,EACf,oBAAoB,EAAE,IAAI,GAC1B,CACE,CACP,CAAC;AACJ,CAAC;AA9BD,wEA8BC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"../editors/EditorContainer\";\nimport { EditorContainer } from \"../editors/EditorContainer\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleValue]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRuleValueProps {\n /** Currently entered value. */\n value?: PropertyValue;\n /** Property used in rule to which this value will be compared to. */\n property: PropertyDescription;\n /** Callback that is invoked when value changes. */\n onChange: (value: PropertyValue) => void;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] value input.\n * @internal\n */\nexport function PropertyFilterBuilderRuleValue(\n props: PropertyFilterBuilderRuleValueProps\n) {\n const { value, property, onChange } = props;\n\n const propertyRecord = React.useMemo(() => {\n return new PropertyRecord(\n value ?? { valueFormat: PropertyValueFormat.Primitive },\n property\n );\n }, [value, property]);\n\n const onValueChange = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <div className=\"rule-value\">\n <EditorContainer\n propertyRecord={propertyRecord}\n onCancel={/* istanbul ignore next */ () => {}}\n onCommit={onValueChange}\n setFocus={false}\n shouldCommitOnChange={true}\n />\n </div>\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
6
 
7
7
  .components-result-selector {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/z-index";
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @mixin property-action-button-list {
6
6
  display: flex;
7
7
  justify-content: flex-end;
@@ -61,7 +61,7 @@ class CommonPropertyRenderer {
61
61
  return currentSize - minColumnLabelWidth;
62
62
  }
63
63
  static createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager, isExpanded, onExpansionToggled, onHeightChanged, highlight) {
64
- const highlightCallback = (highlight === null || highlight === void 0 ? void 0 : highlight.applyOnValue)
64
+ const highlightCallback = highlight?.applyOnValue
65
65
  ? CommonPropertyRenderer.createHighlightCallback(highlight, propertyRecord)
66
66
  : undefined;
67
67
  const rendererContext = {
@@ -85,10 +85,9 @@ class CommonPropertyRenderer {
85
85
  return displayValue;
86
86
  }
87
87
  static createHighlightCallback(highlight, propertyRecord) {
88
- var _a;
89
88
  const activeMatch = highlight.activeHighlight;
90
- const propertyName = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightedItemIdentifier;
91
- const matchIndex = (_a = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightIndex) !== null && _a !== void 0 ? _a : 0;
89
+ const propertyName = activeMatch?.highlightedItemIdentifier;
90
+ const matchIndex = activeMatch?.highlightIndex ?? 0;
92
91
  let labelMatches;
93
92
  if (highlight.applyOnLabel) {
94
93
  labelMatches = (0, countMatchesInString_1.countMatchesInString)(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);